summaryrefslogtreecommitdiffhomepage
path: root/packages/sdk/src/resources
diff options
context:
space:
mode:
authoradamdotdevin <[email protected]>2025-07-22 11:50:51 -0500
committeradamdotdevin <[email protected]>2025-07-22 11:50:51 -0500
commit10c8b495907069461f5dc464f6285321290c8b14 (patch)
tree9fed07910dd7d99688c0261a364d810a500e21d3 /packages/sdk/src/resources
parent500cea5ce7fa635a924cd9abea63aaf672f7645d (diff)
downloadopencode-10c8b495907069461f5dc464f6285321290c8b14.tar.gz
opencode-10c8b495907069461f5dc464f6285321290c8b14.zip
chore: generate sdk into packages/sdk
Diffstat (limited to 'packages/sdk/src/resources')
-rw-r--r--packages/sdk/src/resources/app.ts190
-rw-r--r--packages/sdk/src/resources/config.ts438
-rw-r--r--packages/sdk/src/resources/event.ts243
-rw-r--r--packages/sdk/src/resources/file.ts52
-rw-r--r--packages/sdk/src/resources/find.ts133
-rw-r--r--packages/sdk/src/resources/index.ts81
-rw-r--r--packages/sdk/src/resources/session.ts555
-rw-r--r--packages/sdk/src/resources/shared.ts33
-rw-r--r--packages/sdk/src/resources/tui.ts37
9 files changed, 1762 insertions, 0 deletions
diff --git a/packages/sdk/src/resources/app.ts b/packages/sdk/src/resources/app.ts
new file mode 100644
index 000000000..69991a3fe
--- /dev/null
+++ b/packages/sdk/src/resources/app.ts
@@ -0,0 +1,190 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+
+export class AppResource extends APIResource {
+ /**
+ * Get app info
+ */
+ get(options?: RequestOptions): APIPromise<App> {
+ return this._client.get('/app', options);
+ }
+
+ /**
+ * Initialize the app
+ */
+ init(options?: RequestOptions): APIPromise<AppInitResponse> {
+ return this._client.post('/app/init', options);
+ }
+
+ /**
+ * Write a log entry to the server logs
+ */
+ log(body: AppLogParams, options?: RequestOptions): APIPromise<AppLogResponse> {
+ return this._client.post('/log', { body, ...options });
+ }
+
+ /**
+ * List all modes
+ */
+ modes(options?: RequestOptions): APIPromise<AppModesResponse> {
+ return this._client.get('/mode', options);
+ }
+
+ /**
+ * List all providers
+ */
+ providers(options?: RequestOptions): APIPromise<AppProvidersResponse> {
+ return this._client.get('/config/providers', options);
+ }
+}
+
+export interface App {
+ git: boolean;
+
+ hostname: string;
+
+ path: App.Path;
+
+ time: App.Time;
+}
+
+export namespace App {
+ export interface Path {
+ config: string;
+
+ cwd: string;
+
+ data: string;
+
+ root: string;
+
+ state: string;
+ }
+
+ export interface Time {
+ initialized?: number;
+ }
+}
+
+export interface Mode {
+ name: string;
+
+ tools: { [key: string]: boolean };
+
+ model?: Mode.Model;
+
+ prompt?: string;
+}
+
+export namespace Mode {
+ export interface Model {
+ modelID: string;
+
+ providerID: string;
+ }
+}
+
+export interface Model {
+ id: string;
+
+ attachment: boolean;
+
+ cost: Model.Cost;
+
+ limit: Model.Limit;
+
+ name: string;
+
+ options: { [key: string]: unknown };
+
+ reasoning: boolean;
+
+ release_date: string;
+
+ temperature: boolean;
+
+ tool_call: boolean;
+}
+
+export namespace Model {
+ export interface Cost {
+ input: number;
+
+ output: number;
+
+ cache_read?: number;
+
+ cache_write?: number;
+ }
+
+ export interface Limit {
+ context: number;
+
+ output: number;
+ }
+}
+
+export interface Provider {
+ id: string;
+
+ env: Array<string>;
+
+ models: { [key: string]: Model };
+
+ name: string;
+
+ api?: string;
+
+ npm?: string;
+}
+
+export type AppInitResponse = boolean;
+
+export type AppLogResponse = boolean;
+
+export type AppModesResponse = Array<Mode>;
+
+export interface AppProvidersResponse {
+ default: { [key: string]: string };
+
+ providers: Array<Provider>;
+}
+
+export interface AppLogParams {
+ /**
+ * Log level
+ */
+ level: 'debug' | 'info' | 'error' | 'warn';
+
+ /**
+ * Log message
+ */
+ message: string;
+
+ /**
+ * Service name for the log entry
+ */
+ service: string;
+
+ /**
+ * Additional metadata for the log entry
+ */
+ extra?: { [key: string]: unknown };
+}
+
+export declare namespace AppResource {
+ export {
+ type App as App,
+ type Mode as Mode,
+ type Model as Model,
+ type Provider as Provider,
+ type AppInitResponse as AppInitResponse,
+ type AppLogResponse as AppLogResponse,
+ type AppModesResponse as AppModesResponse,
+ type AppProvidersResponse as AppProvidersResponse,
+ type AppLogParams as AppLogParams,
+ };
+}
diff --git a/packages/sdk/src/resources/config.ts b/packages/sdk/src/resources/config.ts
new file mode 100644
index 000000000..e1fc09de5
--- /dev/null
+++ b/packages/sdk/src/resources/config.ts
@@ -0,0 +1,438 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import * as ConfigAPI from './config';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+
+export class ConfigResource extends APIResource {
+ /**
+ * Get config info
+ */
+ get(options?: RequestOptions): APIPromise<Config> {
+ return this._client.get('/config', options);
+ }
+}
+
+export interface Config {
+ /**
+ * JSON schema reference for configuration validation
+ */
+ $schema?: string;
+
+ /**
+ * @deprecated Use 'share' field instead. Share newly created sessions
+ * automatically
+ */
+ autoshare?: boolean;
+
+ /**
+ * Automatically update to the latest version
+ */
+ autoupdate?: boolean;
+
+ /**
+ * Disable providers that are loaded automatically
+ */
+ disabled_providers?: Array<string>;
+
+ experimental?: Config.Experimental;
+
+ /**
+ * Additional instruction files or patterns to include
+ */
+ instructions?: Array<string>;
+
+ /**
+ * Custom keybind configurations
+ */
+ keybinds?: KeybindsConfig;
+
+ /**
+ * @deprecated Always uses stretch layout.
+ */
+ layout?: 'auto' | 'stretch';
+
+ /**
+ * MCP (Model Context Protocol) server configurations
+ */
+ mcp?: { [key: string]: McpLocalConfig | McpRemoteConfig };
+
+ /**
+ * Modes configuration, see https://opencode.ai/docs/modes
+ */
+ mode?: Config.Mode;
+
+ /**
+ * Model to use in the format of provider/model, eg anthropic/claude-2
+ */
+ model?: string;
+
+ /**
+ * Custom provider configurations and model overrides
+ */
+ provider?: { [key: string]: Config.Provider };
+
+ /**
+ * Control sharing behavior:'manual' allows manual sharing via commands, 'auto'
+ * enables automatic sharing, 'disabled' disables all sharing
+ */
+ share?: 'manual' | 'auto' | 'disabled';
+
+ /**
+ * Small model to use for tasks like summarization and title generation in the
+ * format of provider/model
+ */
+ small_model?: string;
+
+ /**
+ * Theme name to use for the interface
+ */
+ theme?: string;
+
+ /**
+ * Custom username to display in conversations instead of system username
+ */
+ username?: string;
+}
+
+export namespace Config {
+ export interface Experimental {
+ hook?: Experimental.Hook;
+ }
+
+ export namespace Experimental {
+ export interface Hook {
+ file_edited?: { [key: string]: Array<Hook.FileEdited> };
+
+ session_completed?: Array<Hook.SessionCompleted>;
+ }
+
+ export namespace Hook {
+ export interface FileEdited {
+ command: Array<string>;
+
+ environment?: { [key: string]: string };
+ }
+
+ export interface SessionCompleted {
+ command: Array<string>;
+
+ environment?: { [key: string]: string };
+ }
+ }
+ }
+
+ /**
+ * Modes configuration, see https://opencode.ai/docs/modes
+ */
+ export interface Mode {
+ build?: ConfigAPI.ModeConfig;
+
+ plan?: ConfigAPI.ModeConfig;
+
+ [k: string]: ConfigAPI.ModeConfig | undefined;
+ }
+
+ export interface Provider {
+ models: { [key: string]: Provider.Models };
+
+ id?: string;
+
+ api?: string;
+
+ env?: Array<string>;
+
+ name?: string;
+
+ npm?: string;
+
+ options?: { [key: string]: unknown };
+ }
+
+ export namespace Provider {
+ export interface Models {
+ id?: string;
+
+ attachment?: boolean;
+
+ cost?: Models.Cost;
+
+ limit?: Models.Limit;
+
+ name?: string;
+
+ options?: { [key: string]: unknown };
+
+ reasoning?: boolean;
+
+ release_date?: string;
+
+ temperature?: boolean;
+
+ tool_call?: boolean;
+ }
+
+ export namespace Models {
+ export interface Cost {
+ input: number;
+
+ output: number;
+
+ cache_read?: number;
+
+ cache_write?: number;
+ }
+
+ export interface Limit {
+ context: number;
+
+ output: number;
+ }
+ }
+ }
+}
+
+export interface KeybindsConfig {
+ /**
+ * Exit the application
+ */
+ app_exit: string;
+
+ /**
+ * Show help dialog
+ */
+ app_help: string;
+
+ /**
+ * Open external editor
+ */
+ editor_open: string;
+
+ /**
+ * Close file
+ */
+ file_close: string;
+
+ /**
+ * Split/unified diff
+ */
+ file_diff_toggle: string;
+
+ /**
+ * List files
+ */
+ file_list: string;
+
+ /**
+ * Search file
+ */
+ file_search: string;
+
+ /**
+ * Clear input field
+ */
+ input_clear: string;
+
+ /**
+ * Insert newline in input
+ */
+ input_newline: string;
+
+ /**
+ * Paste from clipboard
+ */
+ input_paste: string;
+
+ /**
+ * Submit input
+ */
+ input_submit: string;
+
+ /**
+ * Leader key for keybind combinations
+ */
+ leader: string;
+
+ /**
+ * Copy message
+ */
+ messages_copy: string;
+
+ /**
+ * Navigate to first message
+ */
+ messages_first: string;
+
+ /**
+ * Scroll messages down by half page
+ */
+ messages_half_page_down: string;
+
+ /**
+ * Scroll messages up by half page
+ */
+ messages_half_page_up: string;
+
+ /**
+ * Navigate to last message
+ */
+ messages_last: string;
+
+ /**
+ * Toggle layout
+ */
+ messages_layout_toggle: string;
+
+ /**
+ * Navigate to next message
+ */
+ messages_next: string;
+
+ /**
+ * Scroll messages down by one page
+ */
+ messages_page_down: string;
+
+ /**
+ * Scroll messages up by one page
+ */
+ messages_page_up: string;
+
+ /**
+ * Navigate to previous message
+ */
+ messages_previous: string;
+
+ /**
+ * Revert message
+ */
+ messages_revert: string;
+
+ /**
+ * List available models
+ */
+ model_list: string;
+
+ /**
+ * Create/update AGENTS.md
+ */
+ project_init: string;
+
+ /**
+ * Compact the session
+ */
+ session_compact: string;
+
+ /**
+ * Export session to editor
+ */
+ session_export: string;
+
+ /**
+ * Interrupt current session
+ */
+ session_interrupt: string;
+
+ /**
+ * List all sessions
+ */
+ session_list: string;
+
+ /**
+ * Create a new session
+ */
+ session_new: string;
+
+ /**
+ * Share current session
+ */
+ session_share: string;
+
+ /**
+ * Unshare current session
+ */
+ session_unshare: string;
+
+ /**
+ * Next mode
+ */
+ switch_mode: string;
+
+ /**
+ * Previous Mode
+ */
+ switch_mode_reverse: string;
+
+ /**
+ * List available themes
+ */
+ theme_list: string;
+
+ /**
+ * Toggle tool details
+ */
+ tool_details: string;
+}
+
+export interface McpLocalConfig {
+ /**
+ * Command and arguments to run the MCP server
+ */
+ command: Array<string>;
+
+ /**
+ * Type of MCP server connection
+ */
+ type: 'local';
+
+ /**
+ * Enable or disable the MCP server on startup
+ */
+ enabled?: boolean;
+
+ /**
+ * Environment variables to set when running the MCP server
+ */
+ environment?: { [key: string]: string };
+}
+
+export interface McpRemoteConfig {
+ /**
+ * Type of MCP server connection
+ */
+ type: 'remote';
+
+ /**
+ * URL of the remote MCP server
+ */
+ url: string;
+
+ /**
+ * Enable or disable the MCP server on startup
+ */
+ enabled?: boolean;
+
+ /**
+ * Headers to send with the request
+ */
+ headers?: { [key: string]: string };
+}
+
+export interface ModeConfig {
+ model?: string;
+
+ prompt?: string;
+
+ tools?: { [key: string]: boolean };
+}
+
+export declare namespace ConfigResource {
+ export {
+ type Config as Config,
+ type KeybindsConfig as KeybindsConfig,
+ type McpLocalConfig as McpLocalConfig,
+ type McpRemoteConfig as McpRemoteConfig,
+ type ModeConfig as ModeConfig,
+ };
+}
diff --git a/packages/sdk/src/resources/event.ts b/packages/sdk/src/resources/event.ts
new file mode 100644
index 000000000..a3dd9288c
--- /dev/null
+++ b/packages/sdk/src/resources/event.ts
@@ -0,0 +1,243 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import * as SessionAPI from './session';
+import * as Shared from './shared';
+import { APIPromise } from '../core/api-promise';
+import { Stream } from '../core/streaming';
+import { RequestOptions } from '../internal/request-options';
+
+export class Event extends APIResource {
+ /**
+ * Get events
+ */
+ list(options?: RequestOptions): APIPromise<Stream<EventListResponse>> {
+ return this._client.get('/event', { ...options, stream: true }) as APIPromise<Stream<EventListResponse>>;
+ }
+}
+
+export type EventListResponse =
+ | EventListResponse.EventLspClientDiagnostics
+ | EventListResponse.EventPermissionUpdated
+ | EventListResponse.EventFileEdited
+ | EventListResponse.EventInstallationUpdated
+ | EventListResponse.EventMessageUpdated
+ | EventListResponse.EventMessageRemoved
+ | EventListResponse.EventMessagePartUpdated
+ | EventListResponse.EventStorageWrite
+ | EventListResponse.EventSessionUpdated
+ | EventListResponse.EventSessionDeleted
+ | EventListResponse.EventSessionIdle
+ | EventListResponse.EventSessionError
+ | 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;
+
+ 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 EventInstallationUpdated {
+ properties: EventInstallationUpdated.Properties;
+
+ type: 'installation.updated';
+ }
+
+ export namespace EventInstallationUpdated {
+ export interface Properties {
+ version: string;
+ }
+ }
+
+ export interface EventMessageUpdated {
+ properties: EventMessageUpdated.Properties;
+
+ type: 'message.updated';
+ }
+
+ export namespace EventMessageUpdated {
+ export interface Properties {
+ info: SessionAPI.Message;
+ }
+ }
+
+ export interface EventMessageRemoved {
+ properties: EventMessageRemoved.Properties;
+
+ type: 'message.removed';
+ }
+
+ export namespace EventMessageRemoved {
+ export interface Properties {
+ messageID: string;
+
+ sessionID: string;
+ }
+ }
+
+ export interface EventMessagePartUpdated {
+ properties: EventMessagePartUpdated.Properties;
+
+ type: 'message.part.updated';
+ }
+
+ export namespace EventMessagePartUpdated {
+ export interface Properties {
+ part: SessionAPI.Part;
+ }
+ }
+
+ export interface EventStorageWrite {
+ properties: EventStorageWrite.Properties;
+
+ type: 'storage.write';
+ }
+
+ export namespace EventStorageWrite {
+ export interface Properties {
+ key: string;
+
+ content?: unknown;
+ }
+ }
+
+ export interface EventSessionUpdated {
+ properties: EventSessionUpdated.Properties;
+
+ type: 'session.updated';
+ }
+
+ export namespace EventSessionUpdated {
+ export interface Properties {
+ info: SessionAPI.Session;
+ }
+ }
+
+ export interface EventSessionDeleted {
+ properties: EventSessionDeleted.Properties;
+
+ type: 'session.deleted';
+ }
+
+ export namespace EventSessionDeleted {
+ export interface Properties {
+ info: SessionAPI.Session;
+ }
+ }
+
+ export interface EventSessionIdle {
+ properties: EventSessionIdle.Properties;
+
+ type: 'session.idle';
+ }
+
+ export namespace EventSessionIdle {
+ export interface Properties {
+ sessionID: string;
+ }
+ }
+
+ export interface EventSessionError {
+ properties: EventSessionError.Properties;
+
+ type: 'session.error';
+ }
+
+ export namespace EventSessionError {
+ export interface Properties {
+ error?:
+ | Shared.ProviderAuthError
+ | Shared.UnknownError
+ | Properties.MessageOutputLengthError
+ | Shared.MessageAbortedError;
+
+ sessionID?: string;
+ }
+
+ export namespace Properties {
+ export interface MessageOutputLengthError {
+ data: unknown;
+
+ name: 'MessageOutputLengthError';
+ }
+ }
+ }
+
+ export interface EventFileWatcherUpdated {
+ properties: EventFileWatcherUpdated.Properties;
+
+ type: 'file.watcher.updated';
+ }
+
+ export namespace EventFileWatcherUpdated {
+ export interface Properties {
+ event: 'rename' | 'change';
+
+ file: string;
+ }
+ }
+
+ export interface EventIdeInstalled {
+ properties: EventIdeInstalled.Properties;
+
+ type: 'ide.installed';
+ }
+
+ export namespace EventIdeInstalled {
+ export interface Properties {
+ ide: string;
+ }
+ }
+}
+
+export declare namespace Event {
+ export { type EventListResponse as EventListResponse };
+}
diff --git a/packages/sdk/src/resources/file.ts b/packages/sdk/src/resources/file.ts
new file mode 100644
index 000000000..fd7bdac69
--- /dev/null
+++ b/packages/sdk/src/resources/file.ts
@@ -0,0 +1,52 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+
+export class FileResource extends APIResource {
+ /**
+ * Read a file
+ */
+ read(query: FileReadParams, options?: RequestOptions): APIPromise<FileReadResponse> {
+ return this._client.get('/file', { query, ...options });
+ }
+
+ /**
+ * Get file status
+ */
+ status(options?: RequestOptions): APIPromise<FileStatusResponse> {
+ return this._client.get('/file/status', options);
+ }
+}
+
+export interface File {
+ added: number;
+
+ path: string;
+
+ removed: number;
+
+ status: 'added' | 'deleted' | 'modified';
+}
+
+export interface FileReadResponse {
+ content: string;
+
+ type: 'raw' | 'patch';
+}
+
+export type FileStatusResponse = Array<File>;
+
+export interface FileReadParams {
+ path: string;
+}
+
+export declare namespace FileResource {
+ export {
+ type File as File,
+ type FileReadResponse as FileReadResponse,
+ type FileStatusResponse as FileStatusResponse,
+ type FileReadParams as FileReadParams,
+ };
+}
diff --git a/packages/sdk/src/resources/find.ts b/packages/sdk/src/resources/find.ts
new file mode 100644
index 000000000..13062c426
--- /dev/null
+++ b/packages/sdk/src/resources/find.ts
@@ -0,0 +1,133 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+
+export class Find extends APIResource {
+ /**
+ * Find files
+ */
+ files(query: FindFilesParams, options?: RequestOptions): APIPromise<FindFilesResponse> {
+ return this._client.get('/find/file', { query, ...options });
+ }
+
+ /**
+ * Find workspace symbols
+ */
+ symbols(query: FindSymbolsParams, options?: RequestOptions): APIPromise<FindSymbolsResponse> {
+ return this._client.get('/find/symbol', { query, ...options });
+ }
+
+ /**
+ * Find text in files
+ */
+ text(query: FindTextParams, options?: RequestOptions): APIPromise<FindTextResponse> {
+ return this._client.get('/find', { query, ...options });
+ }
+}
+
+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;
+
+ location: Symbol.Location;
+
+ name: string;
+}
+
+export namespace Symbol {
+ export interface Location {
+ range: Location.Range;
+
+ uri: string;
+ }
+
+ export namespace Location {
+ export interface Range {
+ end: Range.End;
+
+ start: Range.Start;
+ }
+
+ export namespace Range {
+ export interface End {
+ character: number;
+
+ line: number;
+ }
+
+ export interface Start {
+ character: number;
+
+ line: number;
+ }
+ }
+ }
+}
+
+export type FindFilesResponse = Array<string>;
+
+export type FindSymbolsResponse = Array<Symbol>;
+
+export type FindTextResponse = Array<Match>;
+
+export interface FindFilesParams {
+ query: string;
+}
+
+export interface FindSymbolsParams {
+ query: string;
+}
+
+export interface FindTextParams {
+ pattern: string;
+}
+
+export declare namespace Find {
+ export {
+ type Match as Match,
+ type Symbol as Symbol,
+ type FindFilesResponse as FindFilesResponse,
+ type FindSymbolsResponse as FindSymbolsResponse,
+ type FindTextResponse as FindTextResponse,
+ type FindFilesParams as FindFilesParams,
+ type FindSymbolsParams as FindSymbolsParams,
+ type FindTextParams as FindTextParams,
+ };
+}
diff --git a/packages/sdk/src/resources/index.ts b/packages/sdk/src/resources/index.ts
new file mode 100644
index 000000000..50df8ff46
--- /dev/null
+++ b/packages/sdk/src/resources/index.ts
@@ -0,0 +1,81 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+export * from './shared';
+export {
+ AppResource,
+ type App,
+ type Mode,
+ type Model,
+ type Provider,
+ type AppInitResponse,
+ type AppLogResponse,
+ type AppModesResponse,
+ type AppProvidersResponse,
+ type AppLogParams,
+} from './app';
+export {
+ ConfigResource,
+ type Config,
+ type KeybindsConfig,
+ type McpLocalConfig,
+ type McpRemoteConfig,
+ type ModeConfig,
+} from './config';
+export { Event, type EventListResponse } from './event';
+export {
+ FileResource,
+ type File,
+ type FileReadResponse,
+ type FileStatusResponse,
+ type FileReadParams,
+} from './file';
+export {
+ Find,
+ type Match,
+ type Symbol,
+ type FindFilesResponse,
+ type FindSymbolsResponse,
+ type FindTextResponse,
+ type FindFilesParams,
+ type FindSymbolsParams,
+ type FindTextParams,
+} from './find';
+export {
+ SessionResource,
+ type AssistantMessage,
+ type FilePart,
+ type FilePartInput,
+ type FilePartSource,
+ type FilePartSourceText,
+ type FileSource,
+ type Message,
+ type Part,
+ type Session,
+ type SnapshotPart,
+ type StepFinishPart,
+ type StepStartPart,
+ type SymbolSource,
+ type TextPart,
+ type TextPartInput,
+ type ToolPart,
+ type ToolStateCompleted,
+ type ToolStateError,
+ type ToolStatePending,
+ type ToolStateRunning,
+ type UserMessage,
+ type SessionListResponse,
+ type SessionDeleteResponse,
+ type SessionAbortResponse,
+ type SessionInitResponse,
+ type SessionMessagesResponse,
+ type SessionSummarizeResponse,
+ type SessionChatParams,
+ type SessionInitParams,
+ type SessionSummarizeParams,
+} from './session';
+export {
+ Tui,
+ type TuiAppendPromptResponse,
+ type TuiOpenHelpResponse,
+ type TuiAppendPromptParams,
+} from './tui';
diff --git a/packages/sdk/src/resources/session.ts b/packages/sdk/src/resources/session.ts
new file mode 100644
index 000000000..6e160321d
--- /dev/null
+++ b/packages/sdk/src/resources/session.ts
@@ -0,0 +1,555 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import * as SessionAPI from './session';
+import * as Shared from './shared';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+import { path } from '../internal/utils/path';
+
+export class SessionResource extends APIResource {
+ /**
+ * Create a new session
+ */
+ create(options?: RequestOptions): APIPromise<Session> {
+ return this._client.post('/session', options);
+ }
+
+ /**
+ * List all sessions
+ */
+ list(options?: RequestOptions): APIPromise<SessionListResponse> {
+ return this._client.get('/session', options);
+ }
+
+ /**
+ * Delete a session and all its data
+ */
+ delete(id: string, options?: RequestOptions): APIPromise<SessionDeleteResponse> {
+ return this._client.delete(path`/session/${id}`, options);
+ }
+
+ /**
+ * Abort a session
+ */
+ abort(id: string, options?: RequestOptions): APIPromise<SessionAbortResponse> {
+ return this._client.post(path`/session/${id}/abort`, options);
+ }
+
+ /**
+ * Create and send a new message to a session
+ */
+ chat(id: string, body: SessionChatParams, options?: RequestOptions): APIPromise<AssistantMessage> {
+ return this._client.post(path`/session/${id}/message`, { body, ...options });
+ }
+
+ /**
+ * Analyze the app and create an AGENTS.md file
+ */
+ init(id: string, body: SessionInitParams, options?: RequestOptions): APIPromise<SessionInitResponse> {
+ return this._client.post(path`/session/${id}/init`, { body, ...options });
+ }
+
+ /**
+ * List messages for a session
+ */
+ messages(id: string, options?: RequestOptions): APIPromise<SessionMessagesResponse> {
+ return this._client.get(path`/session/${id}/message`, options);
+ }
+
+ /**
+ * Share a session
+ */
+ share(id: string, options?: RequestOptions): APIPromise<Session> {
+ return this._client.post(path`/session/${id}/share`, options);
+ }
+
+ /**
+ * Summarize the session
+ */
+ summarize(
+ id: string,
+ body: SessionSummarizeParams,
+ options?: RequestOptions,
+ ): APIPromise<SessionSummarizeResponse> {
+ return this._client.post(path`/session/${id}/summarize`, { body, ...options });
+ }
+
+ /**
+ * Unshare the session
+ */
+ unshare(id: string, options?: RequestOptions): APIPromise<Session> {
+ return this._client.delete(path`/session/${id}/share`, options);
+ }
+}
+
+export interface AssistantMessage {
+ id: string;
+
+ cost: number;
+
+ modelID: string;
+
+ path: AssistantMessage.Path;
+
+ providerID: string;
+
+ role: 'assistant';
+
+ sessionID: string;
+
+ system: Array<string>;
+
+ time: AssistantMessage.Time;
+
+ tokens: AssistantMessage.Tokens;
+
+ error?:
+ | Shared.ProviderAuthError
+ | Shared.UnknownError
+ | AssistantMessage.MessageOutputLengthError
+ | Shared.MessageAbortedError;
+
+ summary?: boolean;
+}
+
+export namespace AssistantMessage {
+ export interface Path {
+ cwd: string;
+
+ root: string;
+ }
+
+ export interface Time {
+ created: number;
+
+ completed?: number;
+ }
+
+ export interface Tokens {
+ cache: Tokens.Cache;
+
+ input: number;
+
+ output: number;
+
+ reasoning: number;
+ }
+
+ export namespace Tokens {
+ export interface Cache {
+ read: number;
+
+ write: number;
+ }
+ }
+
+ export interface MessageOutputLengthError {
+ data: unknown;
+
+ name: 'MessageOutputLengthError';
+ }
+}
+
+export interface FilePart {
+ id: string;
+
+ messageID: string;
+
+ mime: string;
+
+ sessionID: string;
+
+ type: 'file';
+
+ url: string;
+
+ filename?: string;
+
+ source?: FilePartSource;
+}
+
+export interface FilePartInput {
+ mime: string;
+
+ type: 'file';
+
+ url: string;
+
+ id?: string;
+
+ filename?: string;
+
+ source?: FilePartSource;
+}
+
+export type FilePartSource = FileSource | SymbolSource;
+
+export interface FilePartSourceText {
+ end: number;
+
+ start: number;
+
+ value: string;
+}
+
+export interface FileSource {
+ path: string;
+
+ text: FilePartSourceText;
+
+ type: 'file';
+}
+
+export type Message = UserMessage | AssistantMessage;
+
+export type Part = TextPart | FilePart | ToolPart | StepStartPart | StepFinishPart | SnapshotPart;
+
+export interface Session {
+ id: string;
+
+ time: Session.Time;
+
+ title: string;
+
+ version: string;
+
+ parentID?: string;
+
+ revert?: Session.Revert;
+
+ share?: Session.Share;
+}
+
+export namespace Session {
+ export interface Time {
+ created: number;
+
+ updated: number;
+ }
+
+ export interface Revert {
+ messageID: string;
+
+ part: number;
+
+ snapshot?: string;
+ }
+
+ export interface Share {
+ url: string;
+ }
+}
+
+export interface SnapshotPart {
+ id: string;
+
+ messageID: string;
+
+ sessionID: string;
+
+ snapshot: string;
+
+ type: 'snapshot';
+}
+
+export interface StepFinishPart {
+ id: string;
+
+ cost: number;
+
+ messageID: string;
+
+ sessionID: string;
+
+ tokens: StepFinishPart.Tokens;
+
+ type: 'step-finish';
+}
+
+export namespace StepFinishPart {
+ export interface Tokens {
+ cache: Tokens.Cache;
+
+ input: number;
+
+ output: number;
+
+ reasoning: number;
+ }
+
+ export namespace Tokens {
+ export interface Cache {
+ read: number;
+
+ write: number;
+ }
+ }
+}
+
+export interface StepStartPart {
+ id: string;
+
+ messageID: string;
+
+ sessionID: string;
+
+ type: 'step-start';
+}
+
+export interface SymbolSource {
+ kind: number;
+
+ name: string;
+
+ path: string;
+
+ range: SymbolSource.Range;
+
+ text: FilePartSourceText;
+
+ type: 'symbol';
+}
+
+export namespace SymbolSource {
+ export interface Range {
+ end: Range.End;
+
+ start: Range.Start;
+ }
+
+ export namespace Range {
+ export interface End {
+ character: number;
+
+ line: number;
+ }
+
+ export interface Start {
+ character: number;
+
+ line: number;
+ }
+ }
+}
+
+export interface TextPart {
+ id: string;
+
+ messageID: string;
+
+ sessionID: string;
+
+ text: string;
+
+ type: 'text';
+
+ synthetic?: boolean;
+
+ time?: TextPart.Time;
+}
+
+export namespace TextPart {
+ export interface Time {
+ start: number;
+
+ end?: number;
+ }
+}
+
+export interface TextPartInput {
+ text: string;
+
+ type: 'text';
+
+ id?: string;
+
+ synthetic?: boolean;
+
+ time?: TextPartInput.Time;
+}
+
+export namespace TextPartInput {
+ export interface Time {
+ start: number;
+
+ end?: number;
+ }
+}
+
+export interface ToolPart {
+ id: string;
+
+ callID: string;
+
+ messageID: string;
+
+ sessionID: string;
+
+ state: ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError;
+
+ tool: string;
+
+ type: 'tool';
+}
+
+export interface ToolStateCompleted {
+ input: { [key: string]: unknown };
+
+ metadata: { [key: string]: unknown };
+
+ output: string;
+
+ status: 'completed';
+
+ time: ToolStateCompleted.Time;
+
+ title: string;
+}
+
+export namespace ToolStateCompleted {
+ export interface Time {
+ end: number;
+
+ start: number;
+ }
+}
+
+export interface ToolStateError {
+ error: string;
+
+ input: { [key: string]: unknown };
+
+ status: 'error';
+
+ time: ToolStateError.Time;
+}
+
+export namespace ToolStateError {
+ export interface Time {
+ end: number;
+
+ start: number;
+ }
+}
+
+export interface ToolStatePending {
+ status: 'pending';
+}
+
+export interface ToolStateRunning {
+ status: 'running';
+
+ time: ToolStateRunning.Time;
+
+ input?: unknown;
+
+ metadata?: { [key: string]: unknown };
+
+ title?: string;
+}
+
+export namespace ToolStateRunning {
+ export interface Time {
+ start: number;
+ }
+}
+
+export interface UserMessage {
+ id: string;
+
+ role: 'user';
+
+ sessionID: string;
+
+ time: UserMessage.Time;
+}
+
+export namespace UserMessage {
+ export interface Time {
+ created: number;
+ }
+}
+
+export type SessionListResponse = Array<Session>;
+
+export type SessionDeleteResponse = boolean;
+
+export type SessionAbortResponse = boolean;
+
+export type SessionInitResponse = boolean;
+
+export type SessionMessagesResponse = Array<SessionMessagesResponse.SessionMessagesResponseItem>;
+
+export namespace SessionMessagesResponse {
+ export interface SessionMessagesResponseItem {
+ info: SessionAPI.Message;
+
+ parts: Array<SessionAPI.Part>;
+ }
+}
+
+export type SessionSummarizeResponse = boolean;
+
+export interface SessionChatParams {
+ modelID: string;
+
+ parts: Array<TextPartInput | FilePartInput>;
+
+ providerID: string;
+
+ messageID?: string;
+
+ mode?: string;
+
+ tools?: { [key: string]: boolean };
+}
+
+export interface SessionInitParams {
+ messageID: string;
+
+ modelID: string;
+
+ providerID: string;
+}
+
+export interface SessionSummarizeParams {
+ modelID: string;
+
+ providerID: string;
+}
+
+export declare namespace SessionResource {
+ export {
+ type AssistantMessage as AssistantMessage,
+ type FilePart as FilePart,
+ type FilePartInput as FilePartInput,
+ type FilePartSource as FilePartSource,
+ type FilePartSourceText as FilePartSourceText,
+ type FileSource as FileSource,
+ type Message as Message,
+ type Part as Part,
+ type Session as Session,
+ type SnapshotPart as SnapshotPart,
+ type StepFinishPart as StepFinishPart,
+ type StepStartPart as StepStartPart,
+ type SymbolSource as SymbolSource,
+ type TextPart as TextPart,
+ type TextPartInput as TextPartInput,
+ type ToolPart as ToolPart,
+ type ToolStateCompleted as ToolStateCompleted,
+ type ToolStateError as ToolStateError,
+ type ToolStatePending as ToolStatePending,
+ type ToolStateRunning as ToolStateRunning,
+ type UserMessage as UserMessage,
+ type SessionListResponse as SessionListResponse,
+ type SessionDeleteResponse as SessionDeleteResponse,
+ type SessionAbortResponse as SessionAbortResponse,
+ type SessionInitResponse as SessionInitResponse,
+ type SessionMessagesResponse as SessionMessagesResponse,
+ type SessionSummarizeResponse as SessionSummarizeResponse,
+ type SessionChatParams as SessionChatParams,
+ type SessionInitParams as SessionInitParams,
+ type SessionSummarizeParams as SessionSummarizeParams,
+ };
+}
diff --git a/packages/sdk/src/resources/shared.ts b/packages/sdk/src/resources/shared.ts
new file mode 100644
index 000000000..31378f6fe
--- /dev/null
+++ b/packages/sdk/src/resources/shared.ts
@@ -0,0 +1,33 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+export interface MessageAbortedError {
+ data: unknown;
+
+ name: 'MessageAbortedError';
+}
+
+export interface ProviderAuthError {
+ data: ProviderAuthError.Data;
+
+ name: 'ProviderAuthError';
+}
+
+export namespace ProviderAuthError {
+ export interface Data {
+ message: string;
+
+ providerID: string;
+ }
+}
+
+export interface UnknownError {
+ data: UnknownError.Data;
+
+ name: 'UnknownError';
+}
+
+export namespace UnknownError {
+ export interface Data {
+ message: string;
+ }
+}
diff --git a/packages/sdk/src/resources/tui.ts b/packages/sdk/src/resources/tui.ts
new file mode 100644
index 000000000..c7efbdd6c
--- /dev/null
+++ b/packages/sdk/src/resources/tui.ts
@@ -0,0 +1,37 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../core/resource';
+import { APIPromise } from '../core/api-promise';
+import { RequestOptions } from '../internal/request-options';
+
+export class Tui extends APIResource {
+ /**
+ * Append prompt to the TUI
+ */
+ appendPrompt(body: TuiAppendPromptParams, options?: RequestOptions): APIPromise<TuiAppendPromptResponse> {
+ return this._client.post('/tui/append-prompt', { body, ...options });
+ }
+
+ /**
+ * Open the help dialog
+ */
+ openHelp(options?: RequestOptions): APIPromise<TuiOpenHelpResponse> {
+ return this._client.post('/tui/open-help', options);
+ }
+}
+
+export type TuiAppendPromptResponse = boolean;
+
+export type TuiOpenHelpResponse = boolean;
+
+export interface TuiAppendPromptParams {
+ text: string;
+}
+
+export declare namespace Tui {
+ export {
+ type TuiAppendPromptResponse as TuiAppendPromptResponse,
+ type TuiOpenHelpResponse as TuiOpenHelpResponse,
+ type TuiAppendPromptParams as TuiAppendPromptParams,
+ };
+}