diff options
| author | Dax <[email protected]> | 2025-10-31 15:07:36 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-10-31 15:07:36 -0400 |
| commit | 96bdeb3c7b04e95ecabaa0253deddd2a22e14afe (patch) | |
| tree | c37898ee62e8c4f84f5d9abd4c644b1ec7066963 /packages/sdk/js/src | |
| parent | 81c617770d8595978b497a9cf3c0a5316b108352 (diff) | |
| download | opencode-96bdeb3c7b04e95ecabaa0253deddd2a22e14afe.tar.gz opencode-96bdeb3c7b04e95ecabaa0253deddd2a22e14afe.zip | |
OpenTUI is here (#2685)
Diffstat (limited to 'packages/sdk/js/src')
| -rw-r--r-- | packages/sdk/js/src/gen/sdk.gen.ts | 40 | ||||
| -rw-r--r-- | packages/sdk/js/src/gen/types.gen.ts | 228 |
2 files changed, 184 insertions, 84 deletions
diff --git a/packages/sdk/js/src/gen/sdk.gen.ts b/packages/sdk/js/src/gen/sdk.gen.ts index 5eb12b0f5..1dcdd8067 100644 --- a/packages/sdk/js/src/gen/sdk.gen.ts +++ b/packages/sdk/js/src/gen/sdk.gen.ts @@ -105,6 +105,8 @@ import type { AppAgentsResponses, McpStatusData, McpStatusResponses, + LspStatusData, + LspStatusResponses, TuiAppendPromptData, TuiAppendPromptResponses, TuiAppendPromptErrors, @@ -125,6 +127,9 @@ import type { TuiExecuteCommandErrors, TuiShowToastData, TuiShowToastResponses, + TuiPublishData, + TuiPublishResponses, + TuiPublishErrors, TuiControlNextData, TuiControlNextResponses, TuiControlResponseData, @@ -754,6 +759,20 @@ class Mcp extends _HeyApiClient { } } +class Lsp extends _HeyApiClient { + /** + * Get LSP server status + */ + public status<ThrowOnError extends boolean = false>( + options?: Options<LspStatusData, ThrowOnError>, + ) { + return (options?.client ?? this._client).get<LspStatusResponses, unknown, ThrowOnError>({ + url: "/lsp", + ...options, + }) + } +} + class Control extends _HeyApiClient { /** * Get the next TUI request from the queue @@ -916,6 +935,26 @@ class Tui extends _HeyApiClient { }, }) } + + /** + * Publish a TUI event + */ + public publish<ThrowOnError extends boolean = false>( + options?: Options<TuiPublishData, ThrowOnError>, + ) { + return (options?.client ?? this._client).post< + TuiPublishResponses, + TuiPublishErrors, + ThrowOnError + >({ + url: "/tui/publish", + ...options, + headers: { + "Content-Type": "application/json", + ...options?.headers, + }, + }) + } control = new Control({ client: this._client }) } @@ -983,6 +1022,7 @@ export class OpencodeClient extends _HeyApiClient { file = new File({ client: this._client }) app = new App({ client: this._client }) mcp = new Mcp({ client: this._client }) + lsp = new Lsp({ client: this._client }) tui = new Tui({ client: this._client }) auth = new Auth({ client: this._client }) event = new Event({ client: this._client }) diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts index ae492c9af..046dccf68 100644 --- a/packages/sdk/js/src/gen/types.gen.ts +++ b/packages/sdk/js/src/gen/types.gen.ts @@ -19,10 +19,6 @@ export type KeybindsConfig = { */ leader?: string /** - * Show help dialog - */ - app_help?: string - /** * Exit the application */ app_exit?: string @@ -35,17 +31,13 @@ export type KeybindsConfig = { */ theme_list?: string /** - * Create/update AGENTS.md - */ - project_init?: string - /** - * Toggle tool details + * Toggle sidebar */ - tool_details?: string + sidebar_toggle?: string /** - * Toggle thinking blocks + * View status */ - thinking_blocks?: string + status_view?: string /** * Export session to editor */ @@ -79,14 +71,6 @@ export type KeybindsConfig = { */ session_compact?: string /** - * Cycle to next child session - */ - session_child_cycle?: string - /** - * Cycle to previous child session - */ - session_child_cycle_reverse?: string - /** * Scroll messages up by one page */ messages_page_up?: string @@ -127,13 +111,9 @@ export type KeybindsConfig = { */ model_list?: string /** - * Next recent model - */ - model_cycle_recent?: string - /** - * Previous recent model + * List available commands */ - model_cycle_recent_reverse?: string + command_list?: string /** * List agents */ @@ -162,54 +142,6 @@ export type KeybindsConfig = { * Insert newline in input */ input_newline?: string - /** - * @deprecated use agent_cycle. Next mode - */ - switch_mode?: string - /** - * @deprecated use agent_cycle_reverse. Previous mode - */ - switch_mode_reverse?: string - /** - * @deprecated use agent_cycle. Next agent - */ - switch_agent?: string - /** - * @deprecated use agent_cycle_reverse. Previous agent - */ - switch_agent_reverse?: string - /** - * @deprecated Currently not available. List files - */ - file_list?: string - /** - * @deprecated Close file - */ - file_close?: string - /** - * @deprecated Search file - */ - file_search?: string - /** - * @deprecated Split/unified diff - */ - file_diff_toggle?: string - /** - * @deprecated Navigate to previous message - */ - messages_previous?: string - /** - * @deprecated Navigate to next message - */ - messages_next?: string - /** - * @deprecated Toggle layout - */ - messages_layout_toggle?: string - /** - * @deprecated use messages_undo. Revert message - */ - messages_revert?: string } export type AgentConfig = { @@ -781,11 +713,17 @@ export type FilePart = { export type ToolStatePending = { status: "pending" + input: { + [key: string]: unknown + } + raw: string } export type ToolStateRunning = { status: "running" - input: unknown + input: { + [key: string]: unknown + } title?: string metadata?: { [key: string]: unknown @@ -1086,6 +1024,72 @@ export type Agent = { } } +export type McpStatusConnected = { + status: "connected" +} + +export type McpStatusDisabled = { + status: "disabled" +} + +export type McpStatusFailed = { + status: "failed" + error: string +} + +export type McpStatus = McpStatusConnected | McpStatusDisabled | McpStatusFailed + +export type LspStatus = { + id: string + name: string + root: string + status: "connected" | "error" +} + +export type EventTuiPromptAppend = { + type: "tui.prompt.append" + properties: { + text: string + } +} + +export type EventTuiCommandExecute = { + type: "tui.command.execute" + properties: { + command: + | ( + | "session.list" + | "session.new" + | "session.share" + | "session.interrupt" + | "session.compact" + | "session.page.up" + | "session.page.down" + | "session.half.page.up" + | "session.half.page.down" + | "session.first" + | "session.last" + | "prompt.clear" + | "prompt.submit" + | "agent.cycle" + ) + | string + } +} + +export type EventTuiToastShow = { + type: "tui.toast.show" + properties: { + title?: string + message: string + variant: "info" | "success" | "warning" | "error" + /** + * Duration in milliseconds + */ + duration?: number + } +} + export type OAuth = { type: "oauth" refresh: string @@ -1121,6 +1125,13 @@ export type EventLspClientDiagnostics = { } } +export type EventLspUpdated = { + type: "lsp.updated" + properties: { + [key: string]: unknown + } +} + export type EventMessageUpdated = { type: "message.updated" properties: { @@ -1261,16 +1272,10 @@ export type EventServerConnected = { } } -export type EventIdeInstalled = { - type: "ide.installed" - properties: { - ide: string - } -} - export type Event = | EventInstallationUpdated | EventLspClientDiagnostics + | EventLspUpdated | EventMessageUpdated | EventMessageRemoved | EventMessagePartUpdated @@ -1286,8 +1291,10 @@ export type Event = | EventSessionUpdated | EventSessionDeleted | EventSessionError + | EventTuiPromptAppend + | EventTuiCommandExecute + | EventTuiToastShow | EventServerConnected - | EventIdeInstalled export type ProjectListData = { body?: never @@ -2455,9 +2462,31 @@ export type McpStatusResponses = { /** * MCP server status */ - 200: unknown + 200: { + [key: string]: McpStatus + } +} + +export type McpStatusResponse = McpStatusResponses[keyof McpStatusResponses] + +export type LspStatusData = { + body?: never + path?: never + query?: { + directory?: string + } + url: "/lsp" +} + +export type LspStatusResponses = { + /** + * LSP server status + */ + 200: Array<LspStatus> } +export type LspStatusResponse = LspStatusResponses[keyof LspStatusResponses] + export type TuiAppendPromptData = { body?: { text: string @@ -2629,6 +2658,10 @@ export type TuiShowToastData = { title?: string message: string variant: "info" | "success" | "warning" | "error" + /** + * Duration in milliseconds + */ + duration?: number } path?: never query?: { @@ -2646,6 +2679,33 @@ export type TuiShowToastResponses = { export type TuiShowToastResponse = TuiShowToastResponses[keyof TuiShowToastResponses] +export type TuiPublishData = { + body?: EventTuiPromptAppend | EventTuiCommandExecute | EventTuiToastShow + path?: never + query?: { + directory?: string + } + url: "/tui/publish" +} + +export type TuiPublishErrors = { + /** + * Bad request + */ + 400: BadRequestError +} + +export type TuiPublishError = TuiPublishErrors[keyof TuiPublishErrors] + +export type TuiPublishResponses = { + /** + * Event published successfully + */ + 200: boolean +} + +export type TuiPublishResponse = TuiPublishResponses[keyof TuiPublishResponses] + export type TuiControlNextData = { body?: never path?: never |
