The open source coding agent.
TypeScript
wip: undo properly remove messages from UI
Dax Raad9c9cbb3e8128
diff --git a/packages/opencode/src/cli/cmd/tui.ts b/packages/opencode/src/cli/cmd/tui.tsindex 37317329e11..bb5d94b05d9 100644--- a/packages/opencode/src/cli/cmd/tui.ts+++ b/packages/opencode/src/cli/cmd/tui.ts@@ -113,7 +113,7 @@ export const TuiCommand = cmd({});(async () => {- if (Installation.VERSION === "dev") return+ if (Installation.isDev()) returnif (Installation.isSnapshot()) returnconst config = await Config.global()if (config.autoupdate === false) returndiff --git a/packages/opencode/src/server/server.ts b/packages/opencode/src/server/server.tsindex 4caaead28d1..1c4f19b67a1 100644--- a/packages/opencode/src/server/server.ts+++ b/packages/opencode/src/server/server.ts@@ -43,6 +43,10 @@ export namespace Server {export type Routes = ReturnType<typeof app>+ export const Event = {+ Connected: Bus.event("server.connected", z.object({})),+ }+function app() {const app = new Hono()@@ -109,7 +113,10 @@ export namespace Server {log.info("event connected")return streamSSE(c, async (stream) => {stream.writeSSE({- data: JSON.stringify({}),+ data: JSON.stringify({+ type: "server.connected",+ properties: {},+ }),})const unsub = Bus.subscribeAll(async (event) => {await stream.writeSSE({diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.tsindex e8507342424..a0bf60862a5 100644--- a/packages/opencode/src/session/index.ts+++ b/packages/opencode/src/session/index.ts@@ -540,8 +540,6 @@ export namespace Session {for (const part of userParts) {await updatePart(part)}- // mark session as updated since a message has been added to it- await update(input.sessionID, (_draft) => {})if (isLocked(input.sessionID)) {return new Promise((resolve) => {@@ -566,6 +564,7 @@ export namespace Session {const [preserve, remove] = splitWhen(msgs, (x) => x.info.id === messageID)msgs = preservefor (const msg of remove) {+ if (msg.info.id === userMsg.id) continueawait Storage.remove(`session/message/${input.sessionID}/${msg.info.id}`)await Bus.publish(MessageV2.Event.Removed, { sessionID: input.sessionID, messageID: msg.info.id })}@@ -577,11 +576,15 @@ export namespace Session {for (const part of removeParts) {await Storage.remove(`session/part/${input.sessionID}/${last.info.id}/${part.id}`)await Bus.publish(MessageV2.Event.PartRemoved, {+ sessionID: input.sessionID,messageID: last.info.id,partID: part.id,})}}+ await update(input.sessionID, (draft) => {+ draft.revert = undefined+ })}const previous = msgs.filter((x) => x.info.role === "assistant").at(-1)?.info as MessageV2.Assistantdiff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.tsindex 962cca95f42..488f9e3ca2a 100644--- a/packages/opencode/src/session/message-v2.ts+++ b/packages/opencode/src/session/message-v2.ts@@ -284,6 +284,7 @@ export namespace MessageV2 {PartRemoved: Bus.event("message.part.removed",z.object({+ sessionID: z.string(),messageID: z.string(),partID: z.string(),}),diff --git a/packages/opencode/src/tool/read.ts b/packages/opencode/src/tool/read.tsindex 2b0fff28e10..f93840afb90 100644--- a/packages/opencode/src/tool/read.ts+++ b/packages/opencode/src/tool/read.ts@@ -14,8 +14,8 @@ export const ReadTool = Tool.define("read", {description: DESCRIPTION,parameters: z.object({filePath: z.string().describe("The path to the file to read"),- offset: z.number().describe("The line number to start reading from (0-based)").optional(),- limit: z.number().describe("The number of lines to read (defaults to 2000)").optional(),+ offset: z.coerce.number().describe("The line number to start reading from (0-based)").optional(),+ limit: z.coerce.number().describe("The number of lines to read (defaults to 2000)").optional(),}),async execute(params, ctx) {let filePath = params.filePathdiff --git a/packages/sdk/.stats.yml b/packages/sdk/.stats.ymlindex e9e292b7856..3f719fabfe4 100644--- a/packages/sdk/.stats.yml+++ b/packages/sdk/.stats.yml@@ -1,4 +1,4 @@configured_endpoints: 26-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5748199af356c3243a46a466e73b5d0bab7eaa0c56895e1d0f903d637f61d0bb.yml-openapi_spec_hash: c04f6b6be54b05d9b1283c24e870163b+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-62d8fccba4eb8dc3a80434e0849eab3352e49fb96a718bb7b6d17ed8e582b716.yml+openapi_spec_hash: 4ff9376cf9634e91731e63fe482ea532config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3diff --git a/packages/sdk/api.md b/packages/sdk/api.mdindex d1f4a482fca..c0526f06392 100644--- a/packages/sdk/api.md+++ b/packages/sdk/api.md@@ -41,7 +41,6 @@ Methods:Types:-- <code><a href="./src/resources/find.ts">Match</a></code>- <code><a href="./src/resources/find.ts">Symbol</a></code>- <code><a href="./src/resources/find.ts">FindFilesResponse</a></code>- <code><a href="./src/resources/find.ts">FindSymbolsResponse</a></code>diff --git a/packages/sdk/src/client.ts b/packages/sdk/src/client.tsindex 7045719f65e..9241bd5824b 100644--- a/packages/sdk/src/client.ts+++ b/packages/sdk/src/client.ts@@ -46,7 +46,6 @@ import {FindSymbolsResponse,FindTextParams,FindTextResponse,- Match,Symbol,} from './resources/find';import {@@ -789,7 +788,6 @@ export declare namespace Opencode {export {Find as Find,- type Match as Match,type Symbol as Symbol,type FindFilesResponse as FindFilesResponse,type FindSymbolsResponse as FindSymbolsResponse,diff --git a/packages/sdk/src/resources/app.ts b/packages/sdk/src/resources/app.tsindex 69991a3fee0..8ee56e3206f 100644--- a/packages/sdk/src/resources/app.ts+++ b/packages/sdk/src/resources/app.ts@@ -77,6 +77,8 @@ export interface Mode {model?: Mode.Model;prompt?: string;++ temperature?: number;}export namespace Mode {diff --git a/packages/sdk/src/resources/config.ts b/packages/sdk/src/resources/config.tsindex 7637573d451..11592f4aaf0 100644--- a/packages/sdk/src/resources/config.ts+++ b/packages/sdk/src/resources/config.ts@@ -20,6 +20,11 @@ export interface Config {*/$schema?: string;+ /**+ * Modes configuration, see https://opencode.ai/docs/modes+ */+ agent?: Config.Agent;+/*** @deprecated Use 'share' field instead. Share newly created sessions* automatically@@ -97,6 +102,33 @@ export interface Config {}export namespace Config {+ /**+ * Modes configuration, see https://opencode.ai/docs/modes+ */+ export interface Agent {+ general?: Agent.General;++ [k: string]: Agent.AgentConfig | undefined;+ }++ export namespace Agent {+ export interface General extends ConfigAPI.ModeConfig {+ description: string;+ }++ export interface AgentConfig extends ConfigAPI.ModeConfig {+ description: string;+ }+ }++ export interface AgentConfig extends ConfigAPI.ModeConfig {+ description: string;+ }++ export interface AgentConfig extends ConfigAPI.ModeConfig {+ description: string;+ }+export interface Experimental {hook?: Experimental.Hook;}@@ -438,10 +470,14 @@ export interface McpRemoteConfig {}export interface ModeConfig {+ disable?: boolean;+model?: string;prompt?: string;+ temperature?: number;+tools?: { [key: string]: boolean };}diff --git a/packages/sdk/src/resources/event.ts b/packages/sdk/src/resources/event.tsindex eae023b441e..bd51b22b3be 100644--- a/packages/sdk/src/resources/event.ts+++ b/packages/sdk/src/resources/event.ts@@ -17,84 +17,47 @@ export class Event extends APIResource {}export type EventListResponse =- | EventListResponse.EventLspClientDiagnostics- | EventListResponse.EventPermissionUpdated- | EventListResponse.EventFileEdited| EventListResponse.EventInstallationUpdated+ | EventListResponse.EventLspClientDiagnostics| EventListResponse.EventMessageUpdated| EventListResponse.EventMessageRemoved| EventListResponse.EventMessagePartUpdated| EventListResponse.EventMessagePartRemoved| EventListResponse.EventStorageWrite+ | EventListResponse.EventPermissionUpdated+ | EventListResponse.EventFileEdited| EventListResponse.EventSessionUpdated| EventListResponse.EventSessionDeleted| EventListResponse.EventSessionIdle| EventListResponse.EventSessionError+ | EventListResponse.EventServerConnected| EventListResponse.EventFileWatcherUpdated| EventListResponse.EventIdeInstalled;export namespace EventListResponse {- export interface EventLspClientDiagnostics {- properties: EventLspClientDiagnostics.Properties;-- type: 'lsp.client.diagnostics';- }-- export namespace EventLspClientDiagnostics {- export interface Properties {- path: string;-- serverID: string;- }- }-- export interface EventPermissionUpdated {- properties: EventPermissionUpdated.Properties;+ export interface EventInstallationUpdated {+ properties: EventInstallationUpdated.Properties;- type: 'permission.updated';+ type: 'installation.updated';}- export namespace EventPermissionUpdated {+ export namespace EventInstallationUpdated {export interface Properties {- id: string;-- metadata: { [key: string]: unknown };-- sessionID: string;-- time: Properties.Time;-- title: string;- }-- export namespace Properties {- export interface Time {- created: number;- }+ version: string;}}- export interface EventFileEdited {- properties: EventFileEdited.Properties;+ export interface EventLspClientDiagnostics {+ properties: EventLspClientDiagnostics.Properties;- type: 'file.edited';+ type: 'lsp.client.diagnostics';}- export namespace EventFileEdited {+ export namespace EventLspClientDiagnostics {export interface Properties {- file: string;- }- }-- export interface EventInstallationUpdated {- properties: EventInstallationUpdated.Properties;-- type: 'installation.updated';- }+ path: string;- export namespace EventInstallationUpdated {- export interface Properties {- version: string;+ serverID: string;}}@@ -147,6 +110,8 @@ export namespace EventListResponse {messageID: string;partID: string;++ sessionID: string;}}@@ -164,6 +129,44 @@ export namespace EventListResponse {}}+ export interface EventPermissionUpdated {+ properties: EventPermissionUpdated.Properties;++ type: 'permission.updated';+ }++ export namespace EventPermissionUpdated {+ export interface Properties {+ id: string;++ metadata: { [key: string]: unknown };++ sessionID: string;++ time: Properties.Time;++ title: string;+ }++ export namespace Properties {+ export interface Time {+ created: number;+ }+ }+ }++ export interface EventFileEdited {+ properties: EventFileEdited.Properties;++ type: 'file.edited';+ }++ export namespace EventFileEdited {+ export interface Properties {+ file: string;+ }+ }+export interface EventSessionUpdated {properties: EventSessionUpdated.Properties;@@ -226,6 +229,12 @@ export namespace EventListResponse {}}+ export interface EventServerConnected {+ properties: unknown;++ type: 'server.connected';+ }+export interface EventFileWatcherUpdated {properties: EventFileWatcherUpdated.Properties;diff --git a/packages/sdk/src/resources/find.ts b/packages/sdk/src/resources/find.tsindex 13062c426e5..d9d6597e580 100644--- a/packages/sdk/src/resources/find.ts+++ b/packages/sdk/src/resources/find.ts@@ -27,42 +27,6 @@ export class Find extends APIResource {}}-export interface Match {- absolute_offset: number;-- line_number: number;-- lines: Match.Lines;-- path: Match.Path;-- submatches: Array<Match.Submatch>;-}--export namespace Match {- export interface Lines {- text: string;- }-- export interface Path {- text: string;- }-- export interface Submatch {- end: number;-- match: Submatch.Match;-- start: number;- }-- export namespace Submatch {- export interface Match {- text: string;- }- }-}-export interface Symbol {kind: number;@@ -105,7 +69,45 @@ export type FindFilesResponse = Array<string>;export type FindSymbolsResponse = Array<Symbol>;-export type FindTextResponse = Array<Match>;+export type FindTextResponse = Array<FindTextResponse.FindTextResponseItem>;++export namespace FindTextResponse {+ export interface FindTextResponseItem {+ absolute_offset: number;++ line_number: number;++ lines: FindTextResponseItem.Lines;++ path: FindTextResponseItem.Path;++ submatches: Array<FindTextResponseItem.Submatch>;+ }++ export namespace FindTextResponseItem {+ export interface Lines {+ text: string;+ }++ export interface Path {+ text: string;+ }++ export interface Submatch {+ end: number;++ match: Submatch.Match;++ start: number;+ }++ export namespace Submatch {+ export interface Match {+ text: string;+ }+ }+ }+}export interface FindFilesParams {query: string;@@ -121,7 +123,6 @@ export interface FindTextParams {export declare namespace Find {export {- type Match as Match,type Symbol as Symbol,type FindFilesResponse as FindFilesResponse,type FindSymbolsResponse as FindSymbolsResponse,diff --git a/packages/sdk/src/resources/index.ts b/packages/sdk/src/resources/index.tsindex db8bde9b407..4e7934af148 100644--- a/packages/sdk/src/resources/index.ts+++ b/packages/sdk/src/resources/index.ts@@ -31,7 +31,6 @@ export {} from './file';export {Find,- type Match,type Symbol,type FindFilesResponse,type FindSymbolsResponse,diff --git a/packages/sdk/src/resources/session.ts b/packages/sdk/src/resources/session.tsindex 322c9e9aeef..5dbdc31f8bd 100644--- a/packages/sdk/src/resources/session.ts+++ b/packages/sdk/src/resources/session.ts@@ -270,6 +270,8 @@ export namespace Session {export interface Revert {messageID: string;+ diff?: string;+partID?: string;snapshot?: string;@@ -541,6 +543,8 @@ export interface SessionChatParams {mode?: string;+ system?: string;+tools?: { [key: string]: boolean };}diff --git a/packages/sdk/tests/api-resources/session.test.ts b/packages/sdk/tests/api-resources/session.test.tsindex 1c4984a621f..2acf082510d 100644--- a/packages/sdk/tests/api-resources/session.test.ts+++ b/packages/sdk/tests/api-resources/session.test.ts@@ -77,6 +77,7 @@ describe('resource session', () => {providerID: 'providerID',messageID: 'msg',mode: 'mode',+ system: 'system',tools: { foo: true },});});diff --git a/packages/tui/internal/components/chat/messages.go b/packages/tui/internal/components/chat/messages.goindex 098a329ba7a..fa0ec5e5466 100644--- a/packages/tui/internal/components/chat/messages.go+++ b/packages/tui/internal/components/chat/messages.go@@ -190,6 +190,12 @@ func (m *messagesComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {if msg.Properties.Part.SessionID == m.app.Session.ID {cmds = append(cmds, m.renderView())}+ case opencode.EventListResponseEventMessagePartRemoved:+ if msg.Properties.SessionID == m.app.Session.ID {+ // Clear the cache when a part is removed to ensure proper re-rendering+ m.cache.Clear()+ cmds = append(cmds, m.renderView())+ }case renderCompleteMsg:m.partCount = msg.partCountm.lineCount = msg.lineCountdiff --git a/packages/tui/internal/tui/tui.go b/packages/tui/internal/tui/tui.goindex ee0b22b48d5..410b8d1ae43 100644--- a/packages/tui/internal/tui/tui.go+++ b/packages/tui/internal/tui/tui.go@@ -402,6 +402,58 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {a.app.Messages[messageIndex] = message}}+ case opencode.EventListResponseEventMessagePartRemoved:+ slog.Info("message part removed", "session", msg.Properties.SessionID, "message", msg.Properties.MessageID, "part", msg.Properties.PartID)+ if msg.Properties.SessionID == a.app.Session.ID {+ messageIndex := slices.IndexFunc(a.app.Messages, func(m app.Message) bool {+ switch casted := m.Info.(type) {+ case opencode.UserMessage:+ return casted.ID == msg.Properties.MessageID+ case opencode.AssistantMessage:+ return casted.ID == msg.Properties.MessageID+ }+ return false+ })+ if messageIndex > -1 {+ message := a.app.Messages[messageIndex]+ partIndex := slices.IndexFunc(message.Parts, func(p opencode.PartUnion) bool {+ switch casted := p.(type) {+ case opencode.TextPart:+ return casted.ID == msg.Properties.PartID+ case opencode.FilePart:+ return casted.ID == msg.Properties.PartID+ case opencode.ToolPart:+ return casted.ID == msg.Properties.PartID+ case opencode.StepStartPart:+ return casted.ID == msg.Properties.PartID+ case opencode.StepFinishPart:+ return casted.ID == msg.Properties.PartID+ }+ return false+ })+ if partIndex > -1 {+ // Remove the part at partIndex+ message.Parts = append(message.Parts[:partIndex], message.Parts[partIndex+1:]...)+ a.app.Messages[messageIndex] = message+ }+ }+ }+ case opencode.EventListResponseEventMessageRemoved:+ slog.Info("message removed", "session", msg.Properties.SessionID, "message", msg.Properties.MessageID)+ if msg.Properties.SessionID == a.app.Session.ID {+ messageIndex := slices.IndexFunc(a.app.Messages, func(m app.Message) bool {+ switch casted := m.Info.(type) {+ case opencode.UserMessage:+ return casted.ID == msg.Properties.MessageID+ case opencode.AssistantMessage:+ return casted.ID == msg.Properties.MessageID+ }+ return false+ })+ if messageIndex > -1 {+ a.app.Messages = append(a.app.Messages[:messageIndex], a.app.Messages[messageIndex+1:]...)+ }+ }case opencode.EventListResponseEventMessageUpdated:if msg.Properties.Info.SessionID == a.app.Session.ID {matchIndex := slices.IndexFunc(a.app.Messages, func(m app.Message) bool {diff --git a/packages/tui/sdk/.stats.yml b/packages/tui/sdk/.stats.ymlindex e9e292b7856..3f719fabfe4 100644--- a/packages/tui/sdk/.stats.yml+++ b/packages/tui/sdk/.stats.yml@@ -1,4 +1,4 @@configured_endpoints: 26-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-5748199af356c3243a46a466e73b5d0bab7eaa0c56895e1d0f903d637f61d0bb.yml-openapi_spec_hash: c04f6b6be54b05d9b1283c24e870163b+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/opencode%2Fopencode-62d8fccba4eb8dc3a80434e0849eab3352e49fb96a718bb7b6d17ed8e582b716.yml+openapi_spec_hash: 4ff9376cf9634e91731e63fe482ea532config_hash: 1ae82c93499b9f0b9ba828b8919f9cb3diff --git a/packages/tui/sdk/api.md b/packages/tui/sdk/api.mdindex 0bb72433c8a..fb3db9c53ea 100644--- a/packages/tui/sdk/api.md+++ b/packages/tui/sdk/api.md@@ -36,14 +36,14 @@ Methods:Response Types:-- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Match">Match</a>- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Symbol">Symbol</a>+- <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindTextResponse">FindTextResponse</a>Methods:- <code title="get /find/file">client.Find.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindService.Files">Files</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindFilesParams">FindFilesParams</a>) ([]<a href="https://pkg.go.dev/builtin#string">string</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>- <code title="get /find/symbol">client.Find.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindService.Symbols">Symbols</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindSymbolsParams">FindSymbolsParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Symbol">Symbol</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>-- <code title="get /find">client.Find.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindService.Text">Text</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindTextParams">FindTextParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#Match">Match</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>+- <code title="get /find">client.Find.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindService.Text">Text</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, query <a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindTextParams">FindTextParams</a>) ([]<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go">opencode</a>.<a href="https://pkg.go.dev/github.com/sst/opencode-sdk-go#FindTextResponse">FindTextResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code># Filediff --git a/packages/tui/sdk/app.go b/packages/tui/sdk/app.goindex 407de0617ac..479011a2383 100644--- a/packages/tui/sdk/app.go+++ b/packages/tui/sdk/app.go@@ -146,11 +146,12 @@ func (r appTimeJSON) RawJSON() string {}type Mode struct {- Name string `json:"name,required"`- Tools map[string]bool `json:"tools,required"`- Model ModeModel `json:"model"`- Prompt string `json:"prompt"`- JSON modeJSON `json:"-"`+ Name string `json:"name,required"`+ Tools map[string]bool `json:"tools,required"`+ Model ModeModel `json:"model"`+ Prompt string `json:"prompt"`+ Temperature float64 `json:"temperature"`+ JSON modeJSON `json:"-"`}// modeJSON contains the JSON metadata for the struct [Mode]@@ -159,6 +160,7 @@ type modeJSON struct {Tools apijson.FieldModel apijson.FieldPrompt apijson.Field+ Temperature apijson.Fieldraw stringExtraFields map[string]apijson.Field}diff --git a/packages/tui/sdk/config.go b/packages/tui/sdk/config.goindex 763fead444a..fb8776fa9d6 100644--- a/packages/tui/sdk/config.go+++ b/packages/tui/sdk/config.go@@ -43,6 +43,8 @@ func (r *ConfigService) Get(ctx context.Context, opts ...option.RequestOption) (type Config struct {// JSON schema reference for configuration validationSchema string `json:"$schema"`+ // Modes configuration, see https://opencode.ai/docs/modes+ Agent ConfigAgent `json:"agent"`// @deprecated Use 'share' field instead. Share newly created sessions// automaticallyAutoshare bool `json:"autoshare"`@@ -81,6 +83,7 @@ type Config struct {// configJSON contains the JSON metadata for the struct [Config]type configJSON struct {Schema apijson.Field+ Agent apijson.FieldAutoshare apijson.FieldAutoupdate apijson.FieldDisabledProviders apijson.Field@@ -108,6 +111,50 @@ func (r configJSON) RawJSON() string {return r.raw}+// Modes configuration, see https://opencode.ai/docs/modes+type ConfigAgent struct {+ General ConfigAgentGeneral `json:"general"`+ ExtraFields map[string]ConfigAgent `json:"-,extras"`+ JSON configAgentJSON `json:"-"`+}++// configAgentJSON contains the JSON metadata for the struct [ConfigAgent]+type configAgentJSON struct {+ General apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *ConfigAgent) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r configAgentJSON) RawJSON() string {+ return r.raw+}++type ConfigAgentGeneral struct {+ Description string `json:"description,required"`+ JSON configAgentGeneralJSON `json:"-"`+ ModeConfig+}++// configAgentGeneralJSON contains the JSON metadata for the struct+// [ConfigAgentGeneral]+type configAgentGeneralJSON struct {+ Description apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *ConfigAgentGeneral) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r configAgentGeneralJSON) RawJSON() string {+ return r.raw+}+type ConfigExperimental struct {Hook ConfigExperimentalHook `json:"hook"`JSON configExperimentalJSON `json:"-"`@@ -716,16 +763,20 @@ func (r McpRemoteConfigType) IsKnown() bool {}type ModeConfig struct {- Model string `json:"model"`- Prompt string `json:"prompt"`- Tools map[string]bool `json:"tools"`- JSON modeConfigJSON `json:"-"`+ Disable bool `json:"disable"`+ Model string `json:"model"`+ Prompt string `json:"prompt"`+ Temperature float64 `json:"temperature"`+ Tools map[string]bool `json:"tools"`+ JSON modeConfigJSON `json:"-"`}// modeConfigJSON contains the JSON metadata for the struct [ModeConfig]type modeConfigJSON struct {+ Disable apijson.FieldModel apijson.FieldPrompt apijson.Field+ Temperature apijson.FieldTools apijson.Fieldraw stringExtraFields map[string]apijson.Fielddiff --git a/packages/tui/sdk/event.go b/packages/tui/sdk/event.goindex fca2c6fe43f..5203ab23a5d 100644--- a/packages/tui/sdk/event.go+++ b/packages/tui/sdk/event.go@@ -48,19 +48,19 @@ func (r *EventService) ListStreaming(ctx context.Context, opts ...option.Requesttype EventListResponse struct {// This field can have the runtime type of- // [EventListResponseEventLspClientDiagnosticsProperties],- // [EventListResponseEventPermissionUpdatedProperties],- // [EventListResponseEventFileEditedProperties],// [EventListResponseEventInstallationUpdatedProperties],+ // [EventListResponseEventLspClientDiagnosticsProperties],// [EventListResponseEventMessageUpdatedProperties],// [EventListResponseEventMessageRemovedProperties],// [EventListResponseEventMessagePartUpdatedProperties],// [EventListResponseEventMessagePartRemovedProperties],// [EventListResponseEventStorageWriteProperties],+ // [EventListResponseEventPermissionUpdatedProperties],+ // [EventListResponseEventFileEditedProperties],// [EventListResponseEventSessionUpdatedProperties],// [EventListResponseEventSessionDeletedProperties],// [EventListResponseEventSessionIdleProperties],- // [EventListResponseEventSessionErrorProperties],+ // [EventListResponseEventSessionErrorProperties], [interface{}],// [EventListResponseEventFileWatcherUpdatedProperties],// [EventListResponseEventIdeInstalledProperties].Properties interface{} `json:"properties,required"`@@ -95,31 +95,32 @@ func (r *EventListResponse) UnmarshalJSON(data []byte) (err error) {// specific types for more type safety.//// Possible runtime types of the union are-// [EventListResponseEventLspClientDiagnostics],-// [EventListResponseEventPermissionUpdated], [EventListResponseEventFileEdited],// [EventListResponseEventInstallationUpdated],+// [EventListResponseEventLspClientDiagnostics],// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],// [EventListResponseEventMessagePartUpdated],// [EventListResponseEventMessagePartRemoved],-// [EventListResponseEventStorageWrite], [EventListResponseEventSessionUpdated],+// [EventListResponseEventStorageWrite], [EventListResponseEventPermissionUpdated],+// [EventListResponseEventFileEdited], [EventListResponseEventSessionUpdated],// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionIdle],-// [EventListResponseEventSessionError],+// [EventListResponseEventSessionError], [EventListResponseEventServerConnected],// [EventListResponseEventFileWatcherUpdated],// [EventListResponseEventIdeInstalled].func (r EventListResponse) AsUnion() EventListResponseUnion {return r.union}-// Union satisfied by [EventListResponseEventLspClientDiagnostics],-// [EventListResponseEventPermissionUpdated], [EventListResponseEventFileEdited],-// [EventListResponseEventInstallationUpdated],+// Union satisfied by [EventListResponseEventInstallationUpdated],+// [EventListResponseEventLspClientDiagnostics],// [EventListResponseEventMessageUpdated], [EventListResponseEventMessageRemoved],// [EventListResponseEventMessagePartUpdated],// [EventListResponseEventMessagePartRemoved],-// [EventListResponseEventStorageWrite], [EventListResponseEventSessionUpdated],+// [EventListResponseEventStorageWrite], [EventListResponseEventPermissionUpdated],+// [EventListResponseEventFileEdited], [EventListResponseEventSessionUpdated],// [EventListResponseEventSessionDeleted], [EventListResponseEventSessionIdle],-// [EventListResponseEventSessionError], [EventListResponseEventFileWatcherUpdated]-// or [EventListResponseEventIdeInstalled].+// [EventListResponseEventSessionError], [EventListResponseEventServerConnected],+// [EventListResponseEventFileWatcherUpdated] or+// [EventListResponseEventIdeInstalled].type EventListResponseUnion interface {implementsEventListResponse()}@@ -130,23 +131,13 @@ func init() {"type",apijson.UnionVariant{TypeFilter: gjson.JSON,- Type: reflect.TypeOf(EventListResponseEventLspClientDiagnostics{}),- DiscriminatorValue: "lsp.client.diagnostics",- },- apijson.UnionVariant{- TypeFilter: gjson.JSON,- Type: reflect.TypeOf(EventListResponseEventPermissionUpdated{}),- DiscriminatorValue: "permission.updated",- },- apijson.UnionVariant{- TypeFilter: gjson.JSON,- Type: reflect.TypeOf(EventListResponseEventFileEdited{}),- DiscriminatorValue: "file.edited",+ Type: reflect.TypeOf(EventListResponseEventInstallationUpdated{}),+ DiscriminatorValue: "installation.updated",},apijson.UnionVariant{TypeFilter: gjson.JSON,- Type: reflect.TypeOf(EventListResponseEventInstallationUpdated{}),- DiscriminatorValue: "installation.updated",+ Type: reflect.TypeOf(EventListResponseEventLspClientDiagnostics{}),+ DiscriminatorValue: "lsp.client.diagnostics",},apijson.UnionVariant{TypeFilter: gjson.JSON,@@ -173,6 +164,16 @@ func init() {Type: reflect.TypeOf(EventListResponseEventStorageWrite{}),DiscriminatorValue: "storage.write",},+ apijson.UnionVariant{+ TypeFilter: gjson.JSON,+ Type: reflect.TypeOf(EventListResponseEventPermissionUpdated{}),+ DiscriminatorValue: "permission.updated",+ },+ apijson.UnionVariant{+ TypeFilter: gjson.JSON,+ Type: reflect.TypeOf(EventListResponseEventFileEdited{}),+ DiscriminatorValue: "file.edited",+ },apijson.UnionVariant{TypeFilter: gjson.JSON,Type: reflect.TypeOf(EventListResponseEventSessionUpdated{}),@@ -193,6 +194,11 @@ func init() {Type: reflect.TypeOf(EventListResponseEventSessionError{}),DiscriminatorValue: "session.error",},+ apijson.UnionVariant{+ TypeFilter: gjson.JSON,+ Type: reflect.TypeOf(EventListResponseEventServerConnected{}),+ DiscriminatorValue: "server.connected",+ },apijson.UnionVariant{TypeFilter: gjson.JSON,Type: reflect.TypeOf(EventListResponseEventFileWatcherUpdated{}),@@ -206,272 +212,123 @@ func init() {)}-type EventListResponseEventLspClientDiagnostics struct {- Properties EventListResponseEventLspClientDiagnosticsProperties `json:"properties,required"`- Type EventListResponseEventLspClientDiagnosticsType `json:"type,required"`- JSON eventListResponseEventLspClientDiagnosticsJSON `json:"-"`-}--// eventListResponseEventLspClientDiagnosticsJSON contains the JSON metadata for-// the struct [EventListResponseEventLspClientDiagnostics]-type eventListResponseEventLspClientDiagnosticsJSON struct {- Properties apijson.Field- Type apijson.Field- raw string- ExtraFields map[string]apijson.Field-}--func (r *EventListResponseEventLspClientDiagnostics) UnmarshalJSON(data []byte) (err error) {- return apijson.UnmarshalRoot(data, r)-}--func (r eventListResponseEventLspClientDiagnosticsJSON) RawJSON() string {- return r.raw-}--func (r EventListResponseEventLspClientDiagnostics) implementsEventListResponse() {}--type EventListResponseEventLspClientDiagnosticsProperties struct {- Path string `json:"path,required"`- ServerID string `json:"serverID,required"`- JSON eventListResponseEventLspClientDiagnosticsPropertiesJSON `json:"-"`-}--// eventListResponseEventLspClientDiagnosticsPropertiesJSON contains the JSON-// metadata for the struct [EventListResponseEventLspClientDiagnosticsProperties]-type eventListResponseEventLspClientDiagnosticsPropertiesJSON struct {- Path apijson.Field- ServerID apijson.Field- raw string- ExtraFields map[string]apijson.Field-}--func (r *EventListResponseEventLspClientDiagnosticsProperties) UnmarshalJSON(data []byte) (err error) {- return apijson.UnmarshalRoot(data, r)-}--func (r eventListResponseEventLspClientDiagnosticsPropertiesJSON) RawJSON() string {- return r.raw-}--type EventListResponseEventLspClientDiagnosticsType string--const (- EventListResponseEventLspClientDiagnosticsTypeLspClientDiagnostics EventListResponseEventLspClientDiagnosticsType = "lsp.client.diagnostics"-)--func (r EventListResponseEventLspClientDiagnosticsType) IsKnown() bool {- switch r {- case EventListResponseEventLspClientDiagnosticsTypeLspClientDiagnostics:- return true- }- return false-}--type EventListResponseEventPermissionUpdated struct {- Properties EventListResponseEventPermissionUpdatedProperties `json:"properties,required"`- Type EventListResponseEventPermissionUpdatedType `json:"type,required"`- JSON eventListResponseEventPermissionUpdatedJSON `json:"-"`-}--// eventListResponseEventPermissionUpdatedJSON contains the JSON metadata for the-// struct [EventListResponseEventPermissionUpdated]-type eventListResponseEventPermissionUpdatedJSON struct {- Properties apijson.Field- Type apijson.Field- raw string- ExtraFields map[string]apijson.Field-}--func (r *EventListResponseEventPermissionUpdated) UnmarshalJSON(data []byte) (err error) {- return apijson.UnmarshalRoot(data, r)-}--func (r eventListResponseEventPermissionUpdatedJSON) RawJSON() string {- return r.raw-}--func (r EventListResponseEventPermissionUpdated) implementsEventListResponse() {}--type EventListResponseEventPermissionUpdatedProperties struct {- ID string `json:"id,required"`- Metadata map[string]interface{} `json:"metadata,required"`- SessionID string `json:"sessionID,required"`- Time EventListResponseEventPermissionUpdatedPropertiesTime `json:"time,required"`- Title string `json:"title,required"`- JSON eventListResponseEventPermissionUpdatedPropertiesJSON `json:"-"`-}--// eventListResponseEventPermissionUpdatedPropertiesJSON contains the JSON metadata-// for the struct [EventListResponseEventPermissionUpdatedProperties]-type eventListResponseEventPermissionUpdatedPropertiesJSON struct {- ID apijson.Field- Metadata apijson.Field- SessionID apijson.Field- Time apijson.Field- Title apijson.Field- raw string- ExtraFields map[string]apijson.Field-}--func (r *EventListResponseEventPermissionUpdatedProperties) UnmarshalJSON(data []byte) (err error) {- return apijson.UnmarshalRoot(data, r)-}--func (r eventListResponseEventPermissionUpdatedPropertiesJSON) RawJSON() string {- return r.raw-}--type EventListResponseEventPermissionUpdatedPropertiesTime struct {- Created float64 `json:"created,required"`- JSON eventListResponseEventPermissionUpdatedPropertiesTimeJSON `json:"-"`-}--// eventListResponseEventPermissionUpdatedPropertiesTimeJSON contains the JSON-// metadata for the struct [EventListResponseEventPermissionUpdatedPropertiesTime]-type eventListResponseEventPermissionUpdatedPropertiesTimeJSON struct {- Created apijson.Field- raw string- ExtraFields map[string]apijson.Field-}--func (r *EventListResponseEventPermissionUpdatedPropertiesTime) UnmarshalJSON(data []byte) (err error) {- return apijson.UnmarshalRoot(data, r)-}--func (r eventListResponseEventPermissionUpdatedPropertiesTimeJSON) RawJSON() string {- return r.raw-}--type EventListResponseEventPermissionUpdatedType string--const (- EventListResponseEventPermissionUpdatedTypePermissionUpdated EventListResponseEventPermissionUpdatedType = "permission.updated"-)--func (r EventListResponseEventPermissionUpdatedType) IsKnown() bool {- switch r {- case EventListResponseEventPermissionUpdatedTypePermissionUpdated:- return true- }- return false-}--type EventListResponseEventFileEdited struct {- Properties EventListResponseEventFileEditedProperties `json:"properties,required"`- Type EventListResponseEventFileEditedType `json:"type,required"`- JSON eventListResponseEventFileEditedJSON `json:"-"`+type EventListResponseEventInstallationUpdated struct {+ Properties EventListResponseEventInstallationUpdatedProperties `json:"properties,required"`+ Type EventListResponseEventInstallationUpdatedType `json:"type,required"`+ JSON eventListResponseEventInstallationUpdatedJSON `json:"-"`}-// eventListResponseEventFileEditedJSON contains the JSON metadata for the struct-// [EventListResponseEventFileEdited]-type eventListResponseEventFileEditedJSON struct {+// eventListResponseEventInstallationUpdatedJSON contains the JSON metadata for the+// struct [EventListResponseEventInstallationUpdated]+type eventListResponseEventInstallationUpdatedJSON struct {Properties apijson.FieldType apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *EventListResponseEventFileEdited) UnmarshalJSON(data []byte) (err error) {+func (r *EventListResponseEventInstallationUpdated) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r eventListResponseEventFileEditedJSON) RawJSON() string {+func (r eventListResponseEventInstallationUpdatedJSON) RawJSON() string {return r.raw}-func (r EventListResponseEventFileEdited) implementsEventListResponse() {}+func (r EventListResponseEventInstallationUpdated) implementsEventListResponse() {}-type EventListResponseEventFileEditedProperties struct {- File string `json:"file,required"`- JSON eventListResponseEventFileEditedPropertiesJSON `json:"-"`+type EventListResponseEventInstallationUpdatedProperties struct {+ Version string `json:"version,required"`+ JSON eventListResponseEventInstallationUpdatedPropertiesJSON `json:"-"`}-// eventListResponseEventFileEditedPropertiesJSON contains the JSON metadata for-// the struct [EventListResponseEventFileEditedProperties]-type eventListResponseEventFileEditedPropertiesJSON struct {- File apijson.Field+// eventListResponseEventInstallationUpdatedPropertiesJSON contains the JSON+// metadata for the struct [EventListResponseEventInstallationUpdatedProperties]+type eventListResponseEventInstallationUpdatedPropertiesJSON struct {+ Version apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *EventListResponseEventFileEditedProperties) UnmarshalJSON(data []byte) (err error) {+func (r *EventListResponseEventInstallationUpdatedProperties) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r eventListResponseEventFileEditedPropertiesJSON) RawJSON() string {+func (r eventListResponseEventInstallationUpdatedPropertiesJSON) RawJSON() string {return r.raw}-type EventListResponseEventFileEditedType string+type EventListResponseEventInstallationUpdatedType stringconst (- EventListResponseEventFileEditedTypeFileEdited EventListResponseEventFileEditedType = "file.edited"+ EventListResponseEventInstallationUpdatedTypeInstallationUpdated EventListResponseEventInstallationUpdatedType = "installation.updated")-func (r EventListResponseEventFileEditedType) IsKnown() bool {+func (r EventListResponseEventInstallationUpdatedType) IsKnown() bool {switch r {- case EventListResponseEventFileEditedTypeFileEdited:+ case EventListResponseEventInstallationUpdatedTypeInstallationUpdated:return true}return false}-type EventListResponseEventInstallationUpdated struct {- Properties EventListResponseEventInstallationUpdatedProperties `json:"properties,required"`- Type EventListResponseEventInstallationUpdatedType `json:"type,required"`- JSON eventListResponseEventInstallationUpdatedJSON `json:"-"`+type EventListResponseEventLspClientDiagnostics struct {+ Properties EventListResponseEventLspClientDiagnosticsProperties `json:"properties,required"`+ Type EventListResponseEventLspClientDiagnosticsType `json:"type,required"`+ JSON eventListResponseEventLspClientDiagnosticsJSON `json:"-"`}-// eventListResponseEventInstallationUpdatedJSON contains the JSON metadata for the-// struct [EventListResponseEventInstallationUpdated]-type eventListResponseEventInstallationUpdatedJSON struct {+// eventListResponseEventLspClientDiagnosticsJSON contains the JSON metadata for+// the struct [EventListResponseEventLspClientDiagnostics]+type eventListResponseEventLspClientDiagnosticsJSON struct {Properties apijson.FieldType apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *EventListResponseEventInstallationUpdated) UnmarshalJSON(data []byte) (err error) {+func (r *EventListResponseEventLspClientDiagnostics) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r eventListResponseEventInstallationUpdatedJSON) RawJSON() string {+func (r eventListResponseEventLspClientDiagnosticsJSON) RawJSON() string {return r.raw}-func (r EventListResponseEventInstallationUpdated) implementsEventListResponse() {}+func (r EventListResponseEventLspClientDiagnostics) implementsEventListResponse() {}-type EventListResponseEventInstallationUpdatedProperties struct {- Version string `json:"version,required"`- JSON eventListResponseEventInstallationUpdatedPropertiesJSON `json:"-"`+type EventListResponseEventLspClientDiagnosticsProperties struct {+ Path string `json:"path,required"`+ ServerID string `json:"serverID,required"`+ JSON eventListResponseEventLspClientDiagnosticsPropertiesJSON `json:"-"`}-// eventListResponseEventInstallationUpdatedPropertiesJSON contains the JSON-// metadata for the struct [EventListResponseEventInstallationUpdatedProperties]-type eventListResponseEventInstallationUpdatedPropertiesJSON struct {- Version apijson.Field+// eventListResponseEventLspClientDiagnosticsPropertiesJSON contains the JSON+// metadata for the struct [EventListResponseEventLspClientDiagnosticsProperties]+type eventListResponseEventLspClientDiagnosticsPropertiesJSON struct {+ Path apijson.Field+ ServerID apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *EventListResponseEventInstallationUpdatedProperties) UnmarshalJSON(data []byte) (err error) {+func (r *EventListResponseEventLspClientDiagnosticsProperties) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r eventListResponseEventInstallationUpdatedPropertiesJSON) RawJSON() string {+func (r eventListResponseEventLspClientDiagnosticsPropertiesJSON) RawJSON() string {return r.raw}-type EventListResponseEventInstallationUpdatedType string+type EventListResponseEventLspClientDiagnosticsType stringconst (- EventListResponseEventInstallationUpdatedTypeInstallationUpdated EventListResponseEventInstallationUpdatedType = "installation.updated"+ EventListResponseEventLspClientDiagnosticsTypeLspClientDiagnostics EventListResponseEventLspClientDiagnosticsType = "lsp.client.diagnostics")-func (r EventListResponseEventInstallationUpdatedType) IsKnown() bool {+func (r EventListResponseEventLspClientDiagnosticsType) IsKnown() bool {switch r {- case EventListResponseEventInstallationUpdatedTypeInstallationUpdated:+ case EventListResponseEventLspClientDiagnosticsTypeLspClientDiagnostics:return true}return false@@ -687,6 +544,7 @@ func (r EventListResponseEventMessagePartRemoved) implementsEventListResponse()type EventListResponseEventMessagePartRemovedProperties struct {MessageID string `json:"messageID,required"`PartID string `json:"partID,required"`+ SessionID string `json:"sessionID,required"`JSON eventListResponseEventMessagePartRemovedPropertiesJSON `json:"-"`}@@ -695,6 +553,7 @@ type EventListResponseEventMessagePartRemovedProperties struct {type eventListResponseEventMessagePartRemovedPropertiesJSON struct {MessageID apijson.FieldPartID apijson.Field+ SessionID apijson.Fieldraw stringExtraFields map[string]apijson.Field}@@ -783,6 +642,155 @@ func (r EventListResponseEventStorageWriteType) IsKnown() bool {return false}+type EventListResponseEventPermissionUpdated struct {+ Properties EventListResponseEventPermissionUpdatedProperties `json:"properties,required"`+ Type EventListResponseEventPermissionUpdatedType `json:"type,required"`+ JSON eventListResponseEventPermissionUpdatedJSON `json:"-"`+}++// eventListResponseEventPermissionUpdatedJSON contains the JSON metadata for the+// struct [EventListResponseEventPermissionUpdated]+type eventListResponseEventPermissionUpdatedJSON struct {+ Properties apijson.Field+ Type apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventPermissionUpdated) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventPermissionUpdatedJSON) RawJSON() string {+ return r.raw+}++func (r EventListResponseEventPermissionUpdated) implementsEventListResponse() {}++type EventListResponseEventPermissionUpdatedProperties struct {+ ID string `json:"id,required"`+ Metadata map[string]interface{} `json:"metadata,required"`+ SessionID string `json:"sessionID,required"`+ Time EventListResponseEventPermissionUpdatedPropertiesTime `json:"time,required"`+ Title string `json:"title,required"`+ JSON eventListResponseEventPermissionUpdatedPropertiesJSON `json:"-"`+}++// eventListResponseEventPermissionUpdatedPropertiesJSON contains the JSON metadata+// for the struct [EventListResponseEventPermissionUpdatedProperties]+type eventListResponseEventPermissionUpdatedPropertiesJSON struct {+ ID apijson.Field+ Metadata apijson.Field+ SessionID apijson.Field+ Time apijson.Field+ Title apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventPermissionUpdatedProperties) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventPermissionUpdatedPropertiesJSON) RawJSON() string {+ return r.raw+}++type EventListResponseEventPermissionUpdatedPropertiesTime struct {+ Created float64 `json:"created,required"`+ JSON eventListResponseEventPermissionUpdatedPropertiesTimeJSON `json:"-"`+}++// eventListResponseEventPermissionUpdatedPropertiesTimeJSON contains the JSON+// metadata for the struct [EventListResponseEventPermissionUpdatedPropertiesTime]+type eventListResponseEventPermissionUpdatedPropertiesTimeJSON struct {+ Created apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventPermissionUpdatedPropertiesTime) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventPermissionUpdatedPropertiesTimeJSON) RawJSON() string {+ return r.raw+}++type EventListResponseEventPermissionUpdatedType string++const (+ EventListResponseEventPermissionUpdatedTypePermissionUpdated EventListResponseEventPermissionUpdatedType = "permission.updated"+)++func (r EventListResponseEventPermissionUpdatedType) IsKnown() bool {+ switch r {+ case EventListResponseEventPermissionUpdatedTypePermissionUpdated:+ return true+ }+ return false+}++type EventListResponseEventFileEdited struct {+ Properties EventListResponseEventFileEditedProperties `json:"properties,required"`+ Type EventListResponseEventFileEditedType `json:"type,required"`+ JSON eventListResponseEventFileEditedJSON `json:"-"`+}++// eventListResponseEventFileEditedJSON contains the JSON metadata for the struct+// [EventListResponseEventFileEdited]+type eventListResponseEventFileEditedJSON struct {+ Properties apijson.Field+ Type apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventFileEdited) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventFileEditedJSON) RawJSON() string {+ return r.raw+}++func (r EventListResponseEventFileEdited) implementsEventListResponse() {}++type EventListResponseEventFileEditedProperties struct {+ File string `json:"file,required"`+ JSON eventListResponseEventFileEditedPropertiesJSON `json:"-"`+}++// eventListResponseEventFileEditedPropertiesJSON contains the JSON metadata for+// the struct [EventListResponseEventFileEditedProperties]+type eventListResponseEventFileEditedPropertiesJSON struct {+ File apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventFileEditedProperties) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventFileEditedPropertiesJSON) RawJSON() string {+ return r.raw+}++type EventListResponseEventFileEditedType string++const (+ EventListResponseEventFileEditedTypeFileEdited EventListResponseEventFileEditedType = "file.edited"+)++func (r EventListResponseEventFileEditedType) IsKnown() bool {+ switch r {+ case EventListResponseEventFileEditedTypeFileEdited:+ return true+ }+ return false+}+type EventListResponseEventSessionUpdated struct {Properties EventListResponseEventSessionUpdatedProperties `json:"properties,required"`Type EventListResponseEventSessionUpdatedType `json:"type,required"`@@ -1159,6 +1167,45 @@ func (r EventListResponseEventSessionErrorType) IsKnown() bool {return false}+type EventListResponseEventServerConnected struct {+ Properties interface{} `json:"properties,required"`+ Type EventListResponseEventServerConnectedType `json:"type,required"`+ JSON eventListResponseEventServerConnectedJSON `json:"-"`+}++// eventListResponseEventServerConnectedJSON contains the JSON metadata for the+// struct [EventListResponseEventServerConnected]+type eventListResponseEventServerConnectedJSON struct {+ Properties apijson.Field+ Type apijson.Field+ raw string+ ExtraFields map[string]apijson.Field+}++func (r *EventListResponseEventServerConnected) UnmarshalJSON(data []byte) (err error) {+ return apijson.UnmarshalRoot(data, r)+}++func (r eventListResponseEventServerConnectedJSON) RawJSON() string {+ return r.raw+}++func (r EventListResponseEventServerConnected) implementsEventListResponse() {}++type EventListResponseEventServerConnectedType string++const (+ EventListResponseEventServerConnectedTypeServerConnected EventListResponseEventServerConnectedType = "server.connected"+)++func (r EventListResponseEventServerConnectedType) IsKnown() bool {+ switch r {+ case EventListResponseEventServerConnectedTypeServerConnected:+ return true+ }+ return false+}+type EventListResponseEventFileWatcherUpdated struct {Properties EventListResponseEventFileWatcherUpdatedProperties `json:"properties,required"`Type EventListResponseEventFileWatcherUpdatedType `json:"type,required"`@@ -1299,26 +1346,27 @@ func (r EventListResponseEventIdeInstalledType) IsKnown() bool {type EventListResponseType stringconst (- EventListResponseTypeLspClientDiagnostics EventListResponseType = "lsp.client.diagnostics"- EventListResponseTypePermissionUpdated EventListResponseType = "permission.updated"- EventListResponseTypeFileEdited EventListResponseType = "file.edited"EventListResponseTypeInstallationUpdated EventListResponseType = "installation.updated"+ EventListResponseTypeLspClientDiagnostics EventListResponseType = "lsp.client.diagnostics"EventListResponseTypeMessageUpdated EventListResponseType = "message.updated"EventListResponseTypeMessageRemoved EventListResponseType = "message.removed"EventListResponseTypeMessagePartUpdated EventListResponseType = "message.part.updated"EventListResponseTypeMessagePartRemoved EventListResponseType = "message.part.removed"EventListResponseTypeStorageWrite EventListResponseType = "storage.write"+ EventListResponseTypePermissionUpdated EventListResponseType = "permission.updated"+ EventListResponseTypeFileEdited EventListResponseType = "file.edited"EventListResponseTypeSessionUpdated EventListResponseType = "session.updated"EventListResponseTypeSessionDeleted EventListResponseType = "session.deleted"EventListResponseTypeSessionIdle EventListResponseType = "session.idle"EventListResponseTypeSessionError EventListResponseType = "session.error"+ EventListResponseTypeServerConnected EventListResponseType = "server.connected"EventListResponseTypeFileWatcherUpdated EventListResponseType = "file.watcher.updated"EventListResponseTypeIdeInstalled EventListResponseType = "ide.installed")func (r EventListResponseType) IsKnown() bool {switch r {- case EventListResponseTypeLspClientDiagnostics, EventListResponseTypePermissionUpdated, EventListResponseTypeFileEdited, EventListResponseTypeInstallationUpdated, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeStorageWrite, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeIdeInstalled:+ case EventListResponseTypeInstallationUpdated, EventListResponseTypeLspClientDiagnostics, EventListResponseTypeMessageUpdated, EventListResponseTypeMessageRemoved, EventListResponseTypeMessagePartUpdated, EventListResponseTypeMessagePartRemoved, EventListResponseTypeStorageWrite, EventListResponseTypePermissionUpdated, EventListResponseTypeFileEdited, EventListResponseTypeSessionUpdated, EventListResponseTypeSessionDeleted, EventListResponseTypeSessionIdle, EventListResponseTypeSessionError, EventListResponseTypeServerConnected, EventListResponseTypeFileWatcherUpdated, EventListResponseTypeIdeInstalled:return true}return falsediff --git a/packages/tui/sdk/find.go b/packages/tui/sdk/find.goindex 10f92fc059f..a993a353fb7 100644--- a/packages/tui/sdk/find.go+++ b/packages/tui/sdk/find.go@@ -50,238 +50,242 @@ func (r *FindService) Symbols(ctx context.Context, query FindSymbolsParams, opts}// Find text in files-func (r *FindService) Text(ctx context.Context, query FindTextParams, opts ...option.RequestOption) (res *[]Match, err error) {+func (r *FindService) Text(ctx context.Context, query FindTextParams, opts ...option.RequestOption) (res *[]FindTextResponse, err error) {opts = append(r.Options[:], opts...)path := "find"err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)return}-type Match struct {- AbsoluteOffset float64 `json:"absolute_offset,required"`- LineNumber float64 `json:"line_number,required"`- Lines MatchLines `json:"lines,required"`- Path MatchPath `json:"path,required"`- Submatches []MatchSubmatch `json:"submatches,required"`- JSON matchJSON `json:"-"`+type Symbol struct {+ Kind float64 `json:"kind,required"`+ Location SymbolLocation `json:"location,required"`+ Name string `json:"name,required"`+ JSON symbolJSON `json:"-"`}-// matchJSON contains the JSON metadata for the struct [Match]-type matchJSON struct {- AbsoluteOffset apijson.Field- LineNumber apijson.Field- Lines apijson.Field- Path apijson.Field- Submatches apijson.Field- raw string- ExtraFields map[string]apijson.Field+// symbolJSON contains the JSON metadata for the struct [Symbol]+type symbolJSON struct {+ Kind apijson.Field+ Location apijson.Field+ Name apijson.Field+ raw string+ ExtraFields map[string]apijson.Field}-func (r *Match) UnmarshalJSON(data []byte) (err error) {+func (r *Symbol) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r matchJSON) RawJSON() string {+func (r symbolJSON) RawJSON() string {return r.raw}-type MatchLines struct {- Text string `json:"text,required"`- JSON matchLinesJSON `json:"-"`+type SymbolLocation struct {+ Range SymbolLocationRange `json:"range,required"`+ Uri string `json:"uri,required"`+ JSON symbolLocationJSON `json:"-"`}-// matchLinesJSON contains the JSON metadata for the struct [MatchLines]-type matchLinesJSON struct {- Text apijson.Field+// symbolLocationJSON contains the JSON metadata for the struct [SymbolLocation]+type symbolLocationJSON struct {+ Range apijson.Field+ Uri apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *MatchLines) UnmarshalJSON(data []byte) (err error) {+func (r *SymbolLocation) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r matchLinesJSON) RawJSON() string {+func (r symbolLocationJSON) RawJSON() string {return r.raw}-type MatchPath struct {- Text string `json:"text,required"`- JSON matchPathJSON `json:"-"`+type SymbolLocationRange struct {+ End SymbolLocationRangeEnd `json:"end,required"`+ Start SymbolLocationRangeStart `json:"start,required"`+ JSON symbolLocationRangeJSON `json:"-"`}-// matchPathJSON contains the JSON metadata for the struct [MatchPath]-type matchPathJSON struct {- Text apijson.Field+// symbolLocationRangeJSON contains the JSON metadata for the struct+// [SymbolLocationRange]+type symbolLocationRangeJSON struct {+ End apijson.Field+ Start apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *MatchPath) UnmarshalJSON(data []byte) (err error) {+func (r *SymbolLocationRange) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r matchPathJSON) RawJSON() string {+func (r symbolLocationRangeJSON) RawJSON() string {return r.raw}-type MatchSubmatch struct {- End float64 `json:"end,required"`- Match MatchSubmatchesMatch `json:"match,required"`- Start float64 `json:"start,required"`- JSON matchSubmatchJSON `json:"-"`+type SymbolLocationRangeEnd struct {+ Character float64 `json:"character,required"`+ Line float64 `json:"line,required"`+ JSON symbolLocationRangeEndJSON `json:"-"`}-// matchSubmatchJSON contains the JSON metadata for the struct [MatchSubmatch]-type matchSubmatchJSON struct {- End apijson.Field- Match apijson.Field- Start apijson.Field+// symbolLocationRangeEndJSON contains the JSON metadata for the struct+// [SymbolLocationRangeEnd]+type symbolLocationRangeEndJSON struct {+ Character apijson.Field+ Line apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *MatchSubmatch) UnmarshalJSON(data []byte) (err error) {+func (r *SymbolLocationRangeEnd) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r matchSubmatchJSON) RawJSON() string {+func (r symbolLocationRangeEndJSON) RawJSON() string {return r.raw}-type MatchSubmatchesMatch struct {- Text string `json:"text,required"`- JSON matchSubmatchesMatchJSON `json:"-"`+type SymbolLocationRangeStart struct {+ Character float64 `json:"character,required"`+ Line float64 `json:"line,required"`+ JSON symbolLocationRangeStartJSON `json:"-"`}-// matchSubmatchesMatchJSON contains the JSON metadata for the struct-// [MatchSubmatchesMatch]-type matchSubmatchesMatchJSON struct {- Text apijson.Field+// symbolLocationRangeStartJSON contains the JSON metadata for the struct+// [SymbolLocationRangeStart]+type symbolLocationRangeStartJSON struct {+ Character apijson.Field+ Line apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *MatchSubmatchesMatch) UnmarshalJSON(data []byte) (err error) {+func (r *SymbolLocationRangeStart) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r matchSubmatchesMatchJSON) RawJSON() string {+func (r symbolLocationRangeStartJSON) RawJSON() string {return r.raw}-type Symbol struct {- Kind float64 `json:"kind,required"`- Location SymbolLocation `json:"location,required"`- Name string `json:"name,required"`- JSON symbolJSON `json:"-"`+type FindTextResponse struct {+ AbsoluteOffset float64 `json:"absolute_offset,required"`+ LineNumber float64 `json:"line_number,required"`+ Lines FindTextResponseLines `json:"lines,required"`+ Path FindTextResponsePath `json:"path,required"`+ Submatches []FindTextResponseSubmatch `json:"submatches,required"`+ JSON findTextResponseJSON `json:"-"`}-// symbolJSON contains the JSON metadata for the struct [Symbol]-type symbolJSON struct {- Kind apijson.Field- Location apijson.Field- Name apijson.Field- raw string- ExtraFields map[string]apijson.Field+// findTextResponseJSON contains the JSON metadata for the struct+// [FindTextResponse]+type findTextResponseJSON struct {+ AbsoluteOffset apijson.Field+ LineNumber apijson.Field+ Lines apijson.Field+ Path apijson.Field+ Submatches apijson.Field+ raw string+ ExtraFields map[string]apijson.Field}-func (r *Symbol) UnmarshalJSON(data []byte) (err error) {+func (r *FindTextResponse) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r symbolJSON) RawJSON() string {+func (r findTextResponseJSON) RawJSON() string {return r.raw}-type SymbolLocation struct {- Range SymbolLocationRange `json:"range,required"`- Uri string `json:"uri,required"`- JSON symbolLocationJSON `json:"-"`+type FindTextResponseLines struct {+ Text string `json:"text,required"`+ JSON findTextResponseLinesJSON `json:"-"`}-// symbolLocationJSON contains the JSON metadata for the struct [SymbolLocation]-type symbolLocationJSON struct {- Range apijson.Field- Uri apijson.Field+// findTextResponseLinesJSON contains the JSON metadata for the struct+// [FindTextResponseLines]+type findTextResponseLinesJSON struct {+ Text apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *SymbolLocation) UnmarshalJSON(data []byte) (err error) {+func (r *FindTextResponseLines) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r symbolLocationJSON) RawJSON() string {+func (r findTextResponseLinesJSON) RawJSON() string {return r.raw}-type SymbolLocationRange struct {- End SymbolLocationRangeEnd `json:"end,required"`- Start SymbolLocationRangeStart `json:"start,required"`- JSON symbolLocationRangeJSON `json:"-"`+type FindTextResponsePath struct {+ Text string `json:"text,required"`+ JSON findTextResponsePathJSON `json:"-"`}-// symbolLocationRangeJSON contains the JSON metadata for the struct-// [SymbolLocationRange]-type symbolLocationRangeJSON struct {- End apijson.Field- Start apijson.Field+// findTextResponsePathJSON contains the JSON metadata for the struct+// [FindTextResponsePath]+type findTextResponsePathJSON struct {+ Text apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *SymbolLocationRange) UnmarshalJSON(data []byte) (err error) {+func (r *FindTextResponsePath) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r symbolLocationRangeJSON) RawJSON() string {+func (r findTextResponsePathJSON) RawJSON() string {return r.raw}-type SymbolLocationRangeEnd struct {- Character float64 `json:"character,required"`- Line float64 `json:"line,required"`- JSON symbolLocationRangeEndJSON `json:"-"`+type FindTextResponseSubmatch struct {+ End float64 `json:"end,required"`+ Match FindTextResponseSubmatchesMatch `json:"match,required"`+ Start float64 `json:"start,required"`+ JSON findTextResponseSubmatchJSON `json:"-"`}-// symbolLocationRangeEndJSON contains the JSON metadata for the struct-// [SymbolLocationRangeEnd]-type symbolLocationRangeEndJSON struct {- Character apijson.Field- Line apijson.Field+// findTextResponseSubmatchJSON contains the JSON metadata for the struct+// [FindTextResponseSubmatch]+type findTextResponseSubmatchJSON struct {+ End apijson.Field+ Match apijson.Field+ Start apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *SymbolLocationRangeEnd) UnmarshalJSON(data []byte) (err error) {+func (r *FindTextResponseSubmatch) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r symbolLocationRangeEndJSON) RawJSON() string {+func (r findTextResponseSubmatchJSON) RawJSON() string {return r.raw}-type SymbolLocationRangeStart struct {- Character float64 `json:"character,required"`- Line float64 `json:"line,required"`- JSON symbolLocationRangeStartJSON `json:"-"`+type FindTextResponseSubmatchesMatch struct {+ Text string `json:"text,required"`+ JSON findTextResponseSubmatchesMatchJSON `json:"-"`}-// symbolLocationRangeStartJSON contains the JSON metadata for the struct-// [SymbolLocationRangeStart]-type symbolLocationRangeStartJSON struct {- Character apijson.Field- Line apijson.Field+// findTextResponseSubmatchesMatchJSON contains the JSON metadata for the struct+// [FindTextResponseSubmatchesMatch]+type findTextResponseSubmatchesMatchJSON struct {+ Text apijson.Fieldraw stringExtraFields map[string]apijson.Field}-func (r *SymbolLocationRangeStart) UnmarshalJSON(data []byte) (err error) {+func (r *FindTextResponseSubmatchesMatch) UnmarshalJSON(data []byte) (err error) {return apijson.UnmarshalRoot(data, r)}-func (r symbolLocationRangeStartJSON) RawJSON() string {+func (r findTextResponseSubmatchesMatchJSON) RawJSON() string {return r.raw}diff --git a/packages/tui/sdk/session.go b/packages/tui/sdk/session.goindex 813cf00d6db..2598d51c660 100644--- a/packages/tui/sdk/session.go+++ b/packages/tui/sdk/session.go@@ -1073,6 +1073,7 @@ func (r sessionTimeJSON) RawJSON() string {type SessionRevert struct {MessageID string `json:"messageID,required"`+ Diff string `json:"diff"`PartID string `json:"partID"`Snapshot string `json:"snapshot"`JSON sessionRevertJSON `json:"-"`@@ -1081,6 +1082,7 @@ type SessionRevert struct {// sessionRevertJSON contains the JSON metadata for the struct [SessionRevert]type sessionRevertJSON struct {MessageID apijson.Field+ Diff apijson.FieldPartID apijson.FieldSnapshot apijson.Fieldraw string@@ -2039,6 +2041,7 @@ type SessionChatParams struct {ProviderID param.Field[string] `json:"providerID,required"`MessageID param.Field[string] `json:"messageID"`Mode param.Field[string] `json:"mode"`+ System param.Field[string] `json:"system"`Tools param.Field[map[string]bool] `json:"tools"`}diff --git a/packages/tui/sdk/session_test.go b/packages/tui/sdk/session_test.goindex 807f1956382..295e9e7ce57 100644--- a/packages/tui/sdk/session_test.go+++ b/packages/tui/sdk/session_test.go@@ -131,6 +131,7 @@ func TestSessionChatWithOptionalParams(t *testing.T) {ProviderID: opencode.F("providerID"),MessageID: opencode.F("msg"),Mode: opencode.F("mode"),+ System: opencode.F("system"),Tools: opencode.F(map[string]bool{"foo": true,}),