@@ -6,6 +6,7 @@ package uctypes
66import (
77 "fmt"
88 "net/url"
9+ "slices"
910 "strings"
1011)
1112
@@ -78,13 +79,14 @@ type UIMessageDataUserFile struct {
7879
7980// ToolDefinition represents a tool that can be used by the AI model
8081type ToolDefinition struct {
81- Name string `json:"name"`
82- DisplayName string `json:"displayname,omitempty"` // internal field (cannot marshal to API, must be stripped)
83- Description string `json:"description"`
84- ShortDescription string `json:"shortdescription,omitempty"` // internal field (cannot marshal to API, must be stripped)
85- ToolLogName string `json:"-"` // short name for telemetry (e.g., "term:getscrollback")
86- InputSchema map [string ]any `json:"input_schema"`
87- Strict bool `json:"strict,omitempty"`
82+ Name string `json:"name"`
83+ DisplayName string `json:"displayname,omitempty"` // internal field (cannot marshal to API, must be stripped)
84+ Description string `json:"description"`
85+ ShortDescription string `json:"shortdescription,omitempty"` // internal field (cannot marshal to API, must be stripped)
86+ ToolLogName string `json:"-"` // short name for telemetry (e.g., "term:getscrollback")
87+ InputSchema map [string ]any `json:"input_schema"`
88+ Strict bool `json:"strict,omitempty"`
89+ RequiredCapabilities []string `json:"requiredcapabilities,omitempty"`
8890
8991 ToolTextCallback func (any ) (string , error ) `json:"-"`
9092 ToolAnyCallback func (any , * UIMessageDataToolUse ) (any , error ) `json:"-"` // *UIMessageDataToolUse will NOT be nil
@@ -114,6 +116,18 @@ func (td *ToolDefinition) Desc() string {
114116 return td .Description
115117}
116118
119+ func (td * ToolDefinition ) HasRequiredCapabilities (capabilities []string ) bool {
120+ if td == nil || len (td .RequiredCapabilities ) == 0 {
121+ return true
122+ }
123+ for _ , reqCap := range td .RequiredCapabilities {
124+ if ! slices .Contains (capabilities , reqCap ) {
125+ return false
126+ }
127+ }
128+ return true
129+ }
130+
117131//------------------
118132// Wave specific types, stop reasons, tool calls, config
119133// these are used internally to coordinate the calls/steps
@@ -168,6 +182,10 @@ type AIThinkingModeConfig struct {
168182 Capabilities []string `json:"capabilities,omitempty"`
169183}
170184
185+ func (c * AIThinkingModeConfig ) HasCapability (cap string ) bool {
186+ return slices .Contains (c .Capabilities , cap )
187+ }
188+
171189// when updating this struct, also modify frontend/app/aipanel/aitypes.ts WaveUIDataTypes.tooluse
172190type UIMessageDataToolUse struct {
173191 ToolCallId string `json:"toolcallid"`
@@ -230,17 +248,18 @@ type WaveContinueResponse struct {
230248
231249// Wave Specific AI opts for configuration
232250type AIOptsType struct {
233- APIType string `json:"apitype,omitempty"`
234- Model string `json:"model"`
235- APIToken string `json:"apitoken"`
236- OrgID string `json:"orgid,omitempty"`
237- APIVersion string `json:"apiversion,omitempty"`
238- BaseURL string `json:"baseurl,omitempty"`
239- ProxyURL string `json:"proxyurl,omitempty"`
240- MaxTokens int `json:"maxtokens,omitempty"`
241- TimeoutMs int `json:"timeoutms,omitempty"`
242- ThinkingLevel string `json:"thinkinglevel,omitempty"` // ThinkingLevelLow, ThinkingLevelMedium, or ThinkingLevelHigh
243- ThinkingMode string `json:"thinkingmode,omitempty"` // quick, balanced, or deep
251+ APIType string `json:"apitype,omitempty"`
252+ Model string `json:"model"`
253+ APIToken string `json:"apitoken"`
254+ OrgID string `json:"orgid,omitempty"`
255+ APIVersion string `json:"apiversion,omitempty"`
256+ BaseURL string `json:"baseurl,omitempty"`
257+ ProxyURL string `json:"proxyurl,omitempty"`
258+ MaxTokens int `json:"maxtokens,omitempty"`
259+ TimeoutMs int `json:"timeoutms,omitempty"`
260+ ThinkingLevel string `json:"thinkinglevel,omitempty"` // ThinkingLevelLow, ThinkingLevelMedium, or ThinkingLevelHigh
261+ ThinkingMode string `json:"thinkingmode,omitempty"` // quick, balanced, or deep
262+ Capabilities []string `json:"capabilities,omitempty"`
244263}
245264
246265func (opts AIOptsType ) IsWaveProxy () bool {
@@ -251,6 +270,10 @@ func (opts AIOptsType) IsPremiumModel() bool {
251270 return opts .Model == "gpt-5" || opts .Model == "gpt-5.1" || strings .Contains (opts .Model , "claude-sonnet" )
252271}
253272
273+ func (opts AIOptsType ) HasCapability (cap string ) bool {
274+ return slices .Contains (opts .Capabilities , cap )
275+ }
276+
254277type AIChat struct {
255278 ChatId string `json:"chatid"`
256279 APIType string `json:"apitype"`
0 commit comments