diff options
| author | Dax <[email protected]> | 2025-07-31 01:00:29 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-31 01:00:29 -0400 |
| commit | 33cef075d228e80aefb44671ec68e1989c2855a8 (patch) | |
| tree | d43a5c1bcc40d4d938eacccfd923c80301706cf1 /packages/sdk/src/resources | |
| parent | b09ebf464552f3899120b22c7a8572669000a554 (diff) | |
| download | opencode-33cef075d228e80aefb44671ec68e1989c2855a8.tar.gz opencode-33cef075d228e80aefb44671ec68e1989c2855a8.zip | |
ci: new publish method (#1451)
Diffstat (limited to 'packages/sdk/src/resources')
| -rw-r--r-- | packages/sdk/src/resources/app.ts | 192 | ||||
| -rw-r--r-- | packages/sdk/src/resources/config.ts | 492 | ||||
| -rw-r--r-- | packages/sdk/src/resources/event.ts | 267 | ||||
| -rw-r--r-- | packages/sdk/src/resources/file.ts | 52 | ||||
| -rw-r--r-- | packages/sdk/src/resources/find.ts | 134 | ||||
| -rw-r--r-- | packages/sdk/src/resources/index.ts | 81 | ||||
| -rw-r--r-- | packages/sdk/src/resources/session.ts | 605 | ||||
| -rw-r--r-- | packages/sdk/src/resources/shared.ts | 33 | ||||
| -rw-r--r-- | packages/sdk/src/resources/tui.ts | 37 |
9 files changed, 0 insertions, 1893 deletions
diff --git a/packages/sdk/src/resources/app.ts b/packages/sdk/src/resources/app.ts deleted file mode 100644 index 8ee56e320..000000000 --- a/packages/sdk/src/resources/app.ts +++ /dev/null @@ -1,192 +0,0 @@ -// 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; - - temperature?: number; -} - -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 deleted file mode 100644 index 11592f4aa..000000000 --- a/packages/sdk/src/resources/config.ts +++ /dev/null @@ -1,492 +0,0 @@ -// 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; - - /** - * Modes configuration, see https://opencode.ai/docs/modes - */ - agent?: Config.Agent; - - /** - * @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 { - /** - * 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; - } - - 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?: Provider.Options; - } - - 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 Options { - apiKey?: string; - - baseURL?: string; - - [k: string]: unknown; - } - } -} - -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; - - /** - * Redo message - */ - messages_redo: string; - - /** - * @deprecated use messages_undo. Revert message - */ - messages_revert: string; - - /** - * Undo message - */ - messages_undo: 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 { - disable?: boolean; - - model?: string; - - prompt?: string; - - temperature?: number; - - 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 deleted file mode 100644 index bd51b22b3..000000000 --- a/packages/sdk/src/resources/event.ts +++ /dev/null @@ -1,267 +0,0 @@ -// 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.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 EventInstallationUpdated { - properties: EventInstallationUpdated.Properties; - - type: 'installation.updated'; - } - - export namespace EventInstallationUpdated { - export interface Properties { - version: string; - } - } - - export interface EventLspClientDiagnostics { - properties: EventLspClientDiagnostics.Properties; - - type: 'lsp.client.diagnostics'; - } - - export namespace EventLspClientDiagnostics { - export interface Properties { - path: string; - - serverID: 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 EventMessagePartRemoved { - properties: EventMessagePartRemoved.Properties; - - type: 'message.part.removed'; - } - - export namespace EventMessagePartRemoved { - export interface Properties { - messageID: string; - - partID: string; - - sessionID: string; - } - } - - export interface EventStorageWrite { - properties: EventStorageWrite.Properties; - - type: 'storage.write'; - } - - export namespace EventStorageWrite { - export interface Properties { - key: string; - - content?: unknown; - } - } - - 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; - - 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 EventServerConnected { - properties: unknown; - - type: 'server.connected'; - } - - 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 deleted file mode 100644 index fd7bdac69..000000000 --- a/packages/sdk/src/resources/file.ts +++ /dev/null @@ -1,52 +0,0 @@ -// 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 deleted file mode 100644 index d9d6597e5..000000000 --- a/packages/sdk/src/resources/find.ts +++ /dev/null @@ -1,134 +0,0 @@ -// 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 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<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; -} - -export interface FindSymbolsParams { - query: string; -} - -export interface FindTextParams { - pattern: string; -} - -export declare namespace Find { - export { - 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 deleted file mode 100644 index 4e7934af1..000000000 --- a/packages/sdk/src/resources/index.ts +++ /dev/null @@ -1,81 +0,0 @@ -// 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 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 SessionRevertParams, - 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 deleted file mode 100644 index 5dbdc31f8..000000000 --- a/packages/sdk/src/resources/session.ts +++ /dev/null @@ -1,605 +0,0 @@ -// 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); - } - - /** - * Revert a message - */ - revert(id: string, body: SessionRevertParams, options?: RequestOptions): APIPromise<Session> { - return this._client.post(path`/session/${id}/revert`, { body, ...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 }); - } - - /** - * Restore all reverted messages - */ - unrevert(id: string, options?: RequestOptions): APIPromise<Session> { - return this._client.post(path`/session/${id}/unrevert`, 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; - - mode: string; - - 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 - | Part.PatchPart; - -export namespace Part { - export interface PatchPart { - id: string; - - files: Array<string>; - - hash: string; - - messageID: string; - - sessionID: string; - - type: 'patch'; - } -} - -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; - - diff?: string; - - partID?: string; - - 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; - - system?: string; - - tools?: { [key: string]: boolean }; -} - -export interface SessionInitParams { - messageID: string; - - modelID: string; - - providerID: string; -} - -export interface SessionRevertParams { - messageID: string; - - partID?: 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 SessionRevertParams as SessionRevertParams, - type SessionSummarizeParams as SessionSummarizeParams, - }; -} diff --git a/packages/sdk/src/resources/shared.ts b/packages/sdk/src/resources/shared.ts deleted file mode 100644 index 31378f6fe..000000000 --- a/packages/sdk/src/resources/shared.ts +++ /dev/null @@ -1,33 +0,0 @@ -// 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 deleted file mode 100644 index c7efbdd6c..000000000 --- a/packages/sdk/src/resources/tui.ts +++ /dev/null @@ -1,37 +0,0 @@ -// 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, - }; -} |
