From 3f034462c470408d3be155b763f55fe9439bc6de Mon Sep 17 00:00:00 2001 From: Dax Date: Sat, 4 Jul 2026 19:39:19 +0000 Subject: [PATCH] fix(client): preserve named promise types --- .../client/src/promise/generated/types.ts | 7587 ++++++----------- packages/httpapi-codegen/src/index.ts | 138 +- .../httpapi-codegen/test/generate.test.ts | 54 +- 3 files changed, 2801 insertions(+), 4978 deletions(-) diff --git a/packages/client/src/promise/generated/types.ts b/packages/client/src/promise/generated/types.ts index 151f0ff03f..d3164c6798 100644 --- a/packages/client/src/promise/generated/types.ts +++ b/packages/client/src/promise/generated/types.ts @@ -157,13 +157,2442 @@ export type ProjectCopyError = { export const isProjectCopyError = (value: unknown): value is ProjectCopyError => typeof value === "object" && value !== null && "name" in value && value["name"] === "ProjectCopyError" +export type LocationQuery = { + readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined +} + +export type ModelRef = { readonly id: string; readonly providerID: string; readonly variant?: string } + +export type ProviderSettings = { readonly [x: string]: JsonValue } + +export type AgentColor = string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" + +export type PermissionV2Effect = "allow" | "deny" | "ask" + +export type ProviderRequest = { + readonly settings: ProviderSettings + readonly headers: { readonly [x: string]: string } + readonly body: { readonly [x: string]: JsonValue } +} + +export type PermissionV2Rule = { + readonly action: string + readonly resource: string + readonly effect: PermissionV2Effect +} + +export type PermissionV2Ruleset = ReadonlyArray + +export type AgentV2Info = { + readonly id: string + readonly model?: ModelRef + readonly request: ProviderRequest + readonly system?: string + readonly description?: string + readonly mode: "subagent" | "primary" | "all" + readonly hidden: boolean + readonly color?: AgentColor + readonly steps?: number + readonly permissions: PermissionV2Ruleset +} + +export type PluginInfo = { readonly id: string } + +export type SessionsQuery = { + readonly workspace?: string | undefined + readonly limit?: number | undefined + readonly order?: "asc" | "desc" | undefined + readonly search?: string | undefined + readonly parentID?: string | null | undefined + readonly directory?: string | undefined + readonly project?: string | undefined + readonly subpath?: string | undefined + readonly cursor?: string | undefined +} + +export type LocationRef = { readonly directory: string; readonly workspaceID?: string } + +export type FileDiff = { + readonly path: string + readonly status: "added" | "modified" | "deleted" + readonly additions: number + readonly deletions: number + readonly patch: string +} + +export type SessionWatermarks = { readonly [x: string]: number } + +export type RevertState = { + readonly messageID: string + readonly partID?: string + readonly snapshot?: string + readonly diff?: string + readonly files?: ReadonlyArray +} + +export type SessionV2Info = { + readonly id: string + readonly parentID?: string + readonly projectID: string + readonly agent?: string + readonly model?: ModelRef + readonly cost: number + readonly tokens: { + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } + readonly time: { readonly created: number; readonly updated: number; readonly archived?: number } + readonly title: string + readonly location: LocationRef + readonly subpath?: string + readonly revert?: RevertState +} + +export type SessionsResponse = { + readonly data: ReadonlyArray + readonly watermarks: SessionWatermarks + readonly cursor: { readonly previous?: string | null; readonly next?: string | null } +} + +export type SessionActive = { readonly type: "running" } + +export type PromptSource = { readonly start: number; readonly end: number; readonly text: string } + +export type PromptInputFileAttachment = { + readonly uri: string + readonly name?: string + readonly description?: string + readonly source?: PromptSource +} + +export type PromptAgentAttachment = { readonly name: string; readonly source?: PromptSource } + +export type PromptInput = { + readonly text: string + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray +} + +export type PromptFileAttachment = { + readonly uri: string + readonly mime: string + readonly name?: string + readonly description?: string + readonly source?: PromptSource +} + +export type Prompt = { + readonly text: string + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray +} + +export type SessionInputAdmitted = { + readonly admittedSeq: number + readonly id: string + readonly sessionID: string + readonly prompt: Prompt + readonly delivery: "steer" | "queue" + readonly timeCreated: number + readonly promotedSeq?: number +} + +export type SessionMessageAgentSelected = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly type: "agent-switched" + readonly agent: string +} + +export type SessionMessageSynthetic = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly sessionID: string + readonly text: string + readonly description?: string + readonly type: "synthetic" +} + +export type SessionMessageSystem = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly type: "system" + readonly text: string +} + +export type SessionMessageSkill = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly type: "skill" + readonly name: string + readonly text: string +} + +export type Shell = { + readonly id: string + readonly status: "running" | "exited" | "timeout" | "killed" + readonly command: string + readonly cwd: string + readonly shell: string + readonly file: string + readonly pid?: number + readonly exit?: number | "Infinity" | "-Infinity" | "NaN" + readonly metadata: { readonly [x: string]: JsonValue } + readonly time: { + readonly started: number | "Infinity" | "-Infinity" | "NaN" + readonly completed?: number | "Infinity" | "-Infinity" | "NaN" + } +} + +export type SessionMessageAssistantText = { readonly type: "text"; readonly id: string; readonly text: string } + +export type LLMProviderMetadata = { readonly [x: string]: { readonly [x: string]: JsonValue } } + +export type SessionMessageToolStatePending = { readonly status: "pending"; readonly input: string } + +export type ToolTextContent = { readonly type: "text"; readonly text: string } + +export type ToolFileContent = { + readonly type: "file" + readonly uri: string + readonly mime: string + readonly name?: string +} + +export type SessionErrorUnknown = { readonly type: "unknown"; readonly message: string } + +export type SessionMessageCompaction = { + readonly type: "compaction" + readonly reason: "auto" | "manual" + readonly summary: string + readonly recent: string + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } +} + +export type SessionMessageModelSelected = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly type: "model-switched" + readonly model: ModelRef + readonly previous?: ModelRef +} + +export type SessionMessageShell = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number; readonly completed?: number } + readonly type: "shell" + readonly shell: Shell + readonly output?: { + readonly output: string + readonly cursor: number + readonly size: number + readonly truncated: boolean + } +} + +export type SessionMessageAssistantReasoning = { + readonly type: "reasoning" + readonly id: string + readonly text: string + readonly providerMetadata?: LLMProviderMetadata + readonly time?: { readonly created: number; readonly completed?: number } +} + +export type LLMToolContent = ToolTextContent | ToolFileContent + +export type SessionMessageUser = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number } + readonly text: string + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray + readonly type: "user" +} + +export type SessionMessageToolStateRunning = { + readonly status: "running" + readonly input: { readonly [x: string]: JsonValue } + readonly structured: { readonly [x: string]: JsonValue } + readonly content: ReadonlyArray +} + +export type SessionMessageToolStateCompleted = { + readonly status: "completed" + readonly input: { readonly [x: string]: JsonValue } + readonly attachments?: ReadonlyArray + readonly content: ReadonlyArray + readonly outputPaths?: ReadonlyArray + readonly structured: { readonly [x: string]: JsonValue } + readonly result?: JsonValue +} + +export type SessionMessageToolStateError = { + readonly status: "error" + readonly input: { readonly [x: string]: JsonValue } + readonly content: ReadonlyArray + readonly structured: { readonly [x: string]: JsonValue } + readonly error: SessionErrorUnknown + readonly result?: JsonValue +} + +export type SessionMessageAssistantTool = { + readonly type: "tool" + readonly id: string + readonly name: string + readonly provider?: { + readonly executed: boolean + readonly metadata?: LLMProviderMetadata + readonly resultMetadata?: LLMProviderMetadata + } + readonly state: + | SessionMessageToolStatePending + | SessionMessageToolStateRunning + | SessionMessageToolStateCompleted + | SessionMessageToolStateError + readonly time: { + readonly created: number + readonly ran?: number + readonly completed?: number + readonly pruned?: number + } +} + +export type SessionMessageAssistant = { + readonly id: string + readonly metadata?: { readonly [x: string]: JsonValue } + readonly time: { readonly created: number; readonly completed?: number } + readonly type: "assistant" + readonly agent: string + readonly model: ModelRef + readonly content: ReadonlyArray< + SessionMessageAssistantText | SessionMessageAssistantReasoning | SessionMessageAssistantTool + > + readonly snapshot?: { readonly start?: string; readonly end?: string; readonly files?: ReadonlyArray } + readonly finish?: string + readonly cost?: number + readonly tokens?: { + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } + readonly error?: SessionErrorUnknown +} + +export type SessionMessage = + | SessionMessageAgentSelected + | SessionMessageModelSelected + | SessionMessageUser + | SessionMessageSynthetic + | SessionMessageSystem + | SessionMessageSkill + | SessionMessageShell + | SessionMessageAssistant + | SessionMessageCompaction + +export type SessionContextEntryKey = string + +export type SessionContextEntryInfo = { readonly key: SessionContextEntryKey; readonly value: JsonValue } + +export type Shell2 = { + readonly id: string + readonly status: "running" | "exited" | "timeout" | "killed" + readonly command: string + readonly cwd: string + readonly shell: string + readonly file: string + readonly pid?: number + readonly exit?: number + readonly metadata: { readonly [x: string]: unknown } + readonly time: { readonly started: number; readonly completed?: number } +} + +export type LLMProviderMetadata2 = { readonly [x: string]: { readonly [x: string]: unknown } } + +export type SessionRetryError = { + readonly message: string + readonly statusCode?: number + readonly isRetryable: boolean + readonly responseHeaders?: { readonly [x: string]: string } + readonly responseBody?: string + readonly metadata?: { readonly [x: string]: string } +} + +export type EventLogSynced = { readonly type: "log.synced"; readonly aggregateID: string; readonly seq?: number } + +export type SessionAgentSelected = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.agent.selected" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly agent: string } +} + +export type SessionMoved = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.moved" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly location: LocationRef; readonly subpath?: string } +} + +export type SessionRenamed = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.renamed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly title: string } +} + +export type SessionForked = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.forked" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly parentID: string; readonly from?: string } +} + +export type SessionPromptPromoted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.prompt.promoted" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly inputID: string } +} + +export type SessionContextUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.context.updated" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly text: string } +} + +export type SessionSynthetic = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.synthetic" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly text: string + readonly description?: string + readonly metadata?: { readonly [x: string]: unknown } + } +} + +export type SessionSkillActivated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.skill.activated" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly name: string; readonly text: string } +} + +export type SessionStepEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.step.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly finish: string + readonly cost: number + readonly tokens: { + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } + readonly snapshot?: string + readonly files?: ReadonlyArray + } +} + +export type SessionTextStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.text.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly assistantMessageID: string; readonly textID: string } +} + +export type SessionTextEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.text.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly textID: string + readonly text: string + } +} + +export type SessionToolInputStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.input.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly name: string + } +} + +export type SessionToolInputEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.input.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly text: string + } +} + +export type SessionCompactionStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.compaction.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly reason: "auto" | "manual" } +} + +export type SessionCompactionEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.compaction.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly reason: "auto" | "manual" + readonly text: string + readonly recent: string + } +} + +export type SessionRevertCleared = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.revert.cleared" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string } +} + +export type SessionRevertCommitted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.revert.committed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly messageID: string } +} + +export type SessionModelSelected = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.model.selected" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly model: ModelRef } +} + +export type SessionStepStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.step.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly agent: string + readonly model: ModelRef + readonly snapshot?: string + } +} + +export type SessionShellStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.shell.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly shell: Shell2 } +} + +export type SessionShellEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.shell.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly shell: Shell2 + readonly output: { + readonly output: string + readonly cursor: number + readonly size: number + readonly truncated: boolean + } + } +} + +export type SessionStepFailed = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.step.failed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly error: SessionErrorUnknown + } +} + +export type SessionReasoningStarted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.reasoning.started" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly reasoningID: string + readonly providerMetadata?: LLMProviderMetadata2 + } +} + +export type SessionReasoningEnded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.reasoning.ended" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly reasoningID: string + readonly text: string + readonly providerMetadata?: LLMProviderMetadata2 + } +} + +export type SessionToolCalled = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.called" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly tool: string + readonly input: { readonly [x: string]: unknown } + readonly provider: { readonly executed: boolean; readonly metadata?: LLMProviderMetadata2 } + } +} + +export type SessionToolFailed = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.failed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly error: SessionErrorUnknown + readonly result?: unknown + readonly provider: { readonly executed: boolean; readonly metadata?: LLMProviderMetadata2 } + } +} + +export type SessionRetried = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.retried" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly attempt: number; readonly error: SessionRetryError } +} + +export type SessionToolProgress = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.progress" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly structured: { readonly [x: string]: unknown } + readonly content: ReadonlyArray + } +} + +export type SessionToolSuccess = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.success" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly structured: { readonly [x: string]: unknown } + readonly content: ReadonlyArray + readonly outputPaths?: ReadonlyArray + readonly result?: unknown + readonly provider: { readonly executed: boolean; readonly metadata?: LLMProviderMetadata2 } + } +} + +export type SessionRevertStaged = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.revert.staged" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly revert: RevertState } +} + +export type SessionPromptAdmitted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.prompt.admitted" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly inputID: string + readonly prompt: Prompt + readonly delivery: "steer" | "queue" + } +} + +export type SessionDurableEvent = + | SessionAgentSelected + | SessionModelSelected + | SessionMoved + | SessionRenamed + | SessionForked + | SessionPromptPromoted + | SessionPromptAdmitted + | SessionContextUpdated + | SessionSynthetic + | SessionSkillActivated + | SessionShellStarted + | SessionShellEnded + | SessionStepStarted + | SessionStepEnded + | SessionStepFailed + | SessionTextStarted + | SessionTextEnded + | SessionReasoningStarted + | SessionReasoningEnded + | SessionToolInputStarted + | SessionToolInputEnded + | SessionToolCalled + | SessionToolProgress + | SessionToolSuccess + | SessionToolFailed + | SessionRetried + | SessionCompactionStarted + | SessionCompactionEnded + | SessionRevertStaged + | SessionRevertCleared + | SessionRevertCommitted + +export type SessionLogItem = SessionDurableEvent | EventLogSynced + +export type SessionMessagesQuery = { + readonly limit?: number | undefined + readonly order?: "asc" | "desc" | undefined + readonly cursor?: string | undefined +} + +export type SessionMessagesResponse = { + readonly data: ReadonlyArray + readonly watermark?: number + readonly cursor: { readonly previous?: string | null; readonly next?: string | null } +} + +export type ModelApi = + | { + readonly id: string + readonly type: "aisdk" + readonly package: string + readonly url?: string + readonly settings?: { readonly [x: string]: JsonValue } + } + | { + readonly id: string + readonly type: "native" + readonly url?: string + readonly settings: { readonly [x: string]: JsonValue } + } + +export type ModelCapabilities = { + readonly tools: boolean + readonly input: ReadonlyArray + readonly output: ReadonlyArray +} + +export type ModelCost = { + readonly tier?: { readonly type: "context"; readonly size: number } + readonly input: number + readonly output: number + readonly cache: { readonly read: number; readonly write: number } +} + +export type ModelV2Info = { + readonly id: string + readonly providerID: string + readonly family?: string + readonly name: string + readonly api: ModelApi + readonly capabilities: ModelCapabilities + readonly request: { + readonly settings: ProviderSettings + readonly headers: { readonly [x: string]: string } + readonly body: { readonly [x: string]: JsonValue } + readonly variant?: string + } + readonly variants: ReadonlyArray<{ + readonly id: string + readonly settings: ProviderSettings + readonly headers: { readonly [x: string]: string } + readonly body: { readonly [x: string]: JsonValue } + }> + readonly time: { readonly released: number } + readonly cost: ReadonlyArray + readonly status: "alpha" | "beta" | "deprecated" | "active" + readonly enabled: boolean + readonly limit: { readonly context: number; readonly input?: number; readonly output: number } +} + +export type GenerateTextResponse = { readonly data: { readonly text: string } } + +export type ProviderAISDK = { + readonly type: "aisdk" + readonly package: string + readonly url?: string + readonly settings?: { readonly [x: string]: JsonValue } +} + +export type ProviderNative = { + readonly type: "native" + readonly url?: string + readonly settings: { readonly [x: string]: JsonValue } +} + +export type ProviderApi = ProviderAISDK | ProviderNative + +export type ProviderV2Info = { + readonly id: string + readonly integrationID?: string + readonly name: string + readonly disabled?: boolean + readonly api: ProviderApi + readonly request: ProviderRequest +} + +export type IntegrationWhen = { readonly key: string; readonly op: "eq" | "neq"; readonly value: string } + +export type IntegrationKeyMethod = { readonly type: "key"; readonly label?: string } + +export type IntegrationEnvMethod = { readonly type: "env"; readonly names: ReadonlyArray } + +export type ConnectionCredentialInfo = { readonly type: "credential"; readonly id: string; readonly label: string } + +export type ConnectionEnvInfo = { readonly type: "env"; readonly name: string } + +export type IntegrationTextPrompt = { + readonly type: "text" + readonly key: string + readonly message: string + readonly placeholder?: string + readonly when?: IntegrationWhen +} + +export type IntegrationSelectPrompt = { + readonly type: "select" + readonly key: string + readonly message: string + readonly options: ReadonlyArray<{ readonly label: string; readonly value: string; readonly hint?: string }> + readonly when?: IntegrationWhen +} + +export type ConnectionInfo = ConnectionCredentialInfo | ConnectionEnvInfo + +export type IntegrationOAuthMethod = { + readonly id: string + readonly type: "oauth" + readonly label: string + readonly prompts?: ReadonlyArray +} + +export type IntegrationMethod = IntegrationOAuthMethod | IntegrationKeyMethod | IntegrationEnvMethod + +export type IntegrationAttemptStatus = + | { + readonly status: "pending" + readonly time: { + readonly created: number | "Infinity" | "-Infinity" | "NaN" + readonly expires: number | "Infinity" | "-Infinity" | "NaN" + } + } + | { + readonly status: "complete" + readonly time: { + readonly created: number | "Infinity" | "-Infinity" | "NaN" + readonly expires: number | "Infinity" | "-Infinity" | "NaN" + } + } + | { + readonly status: "failed" + readonly message: string + readonly time: { + readonly created: number | "Infinity" | "-Infinity" | "NaN" + readonly expires: number | "Infinity" | "-Infinity" | "NaN" + } + } + | { + readonly status: "expired" + readonly time: { + readonly created: number | "Infinity" | "-Infinity" | "NaN" + readonly expires: number | "Infinity" | "-Infinity" | "NaN" + } + } + +export type McpStatusConnected = { readonly status: "connected" } + +export type McpStatusPending = { readonly status: "pending" } + +export type McpStatusDisabled = { readonly status: "disabled" } + +export type McpStatusFailed = { readonly status: "failed"; readonly error: string } + +export type McpStatusNeedsAuth = { readonly status: "needs_auth" } + +export type McpStatusNeedsClientRegistration = { readonly status: "needs_client_registration"; readonly error: string } + +export type McpServer = { + readonly name: string + readonly status: + | McpStatusConnected + | McpStatusPending + | McpStatusDisabled + | McpStatusFailed + | McpStatusNeedsAuth + | McpStatusNeedsClientRegistration + readonly integrationID?: string +} + +export type ProjectCurrent = { readonly id: string; readonly directory: string } + +export type ProjectDirectory = { readonly directory: string; readonly strategy?: string } + +export type ProjectDirectories = ReadonlyArray + +export type FormMetadata = { readonly [x: string]: JsonValue } + +export type FormWhen = { + readonly key: string + readonly op: "eq" | "neq" + readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean +} + +export type FormOption = { readonly value: string; readonly label: string; readonly description?: string } + +export type FormUrlInfo = { + readonly id: string + readonly sessionID: string + readonly title?: string + readonly metadata?: FormMetadata + readonly mode: "url" + readonly url: string +} + +export type FormNumberField = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "number" + readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" + readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" + readonly default?: number | "Infinity" | "-Infinity" | "NaN" +} + +export type FormIntegerField = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "integer" + readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" + readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" + readonly default?: number | "Infinity" | "-Infinity" | "NaN" +} + +export type FormBooleanField = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "boolean" + readonly default?: boolean +} + +export type FormStringField = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "string" + readonly format?: "email" | "uri" | "date" | "date-time" + readonly minLength?: number + readonly maxLength?: number + readonly pattern?: string + readonly placeholder?: string + readonly default?: string + readonly options?: ReadonlyArray + readonly custom?: boolean +} + +export type FormMultiselectField = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "multiselect" + readonly options: ReadonlyArray + readonly minItems?: number + readonly maxItems?: number + readonly custom?: boolean + readonly default?: ReadonlyArray +} + +export type FormFormInfo = { + readonly id: string + readonly sessionID: string + readonly title?: string + readonly metadata?: FormMetadata + readonly mode: "form" + readonly fields: ReadonlyArray< + FormStringField | FormNumberField | FormIntegerField | FormBooleanField | FormMultiselectField + > +} + +export type FormCreatePayload = { + readonly id?: string | null + readonly title?: string + readonly metadata?: FormMetadata + readonly mode: "form" | "url" + readonly fields?: ReadonlyArray< + FormStringField | FormNumberField | FormIntegerField | FormBooleanField | FormMultiselectField + > | null + readonly url?: string | null +} + +export type FormValue = string | number | "Infinity" | "-Infinity" | "NaN" | boolean | ReadonlyArray + +export type FormAnswer = { readonly [x: string]: FormValue } + +export type FormState = + | { readonly status: "pending" } + | { readonly status: "answered"; readonly answer: FormAnswer } + | { readonly status: "cancelled" } + +export type FormReply = { readonly answer: FormAnswer } + +export type PermissionV2Source = { readonly type: "tool"; readonly messageID: string; readonly callID: string } + +export type PermissionV2Request = { + readonly id: string + readonly sessionID: string + readonly action: string + readonly resources: ReadonlyArray + readonly save?: ReadonlyArray + readonly metadata?: { readonly [x: string]: JsonValue } + readonly source?: PermissionV2Source +} + +export type PermissionSavedInfo = { + readonly id: string + readonly projectID: string + readonly action: string + readonly resource: string +} + +export type PermissionV2Reply = "once" | "always" | "reject" + +export type FileSystemEntry = { readonly path: string; readonly type: "file" | "directory" } + +export type CommandV2Info = { + readonly name: string + readonly template: string + readonly description?: string + readonly agent?: string + readonly model?: ModelRef + readonly subtask?: boolean +} + +export type SkillV2Info = { + readonly name: string + readonly description?: string + readonly slash?: boolean + readonly autoinvoke?: boolean + readonly location: string + readonly content: string +} + +export type SnapshotFileDiff = { + readonly file?: string + readonly patch?: string + readonly additions: number + readonly deletions: number + readonly status?: "added" | "deleted" | "modified" +} + +export type PermissionAction = "allow" | "deny" | "ask" + +export type JSONSchema = { readonly [x: string]: any } + +export type ProviderAuthError = { + readonly name: "ProviderAuthError" + readonly data: { readonly providerID: string; readonly message: string } +} + +export type UnknownError2 = { + readonly name: "UnknownError" + readonly data: { readonly message: string; readonly ref?: string | undefined } +} + +export type MessageOutputLengthError = { readonly name: "MessageOutputLengthError"; readonly data: {} } + +export type MessageAbortedError = { readonly name: "MessageAbortedError"; readonly data: { readonly message: string } } + +export type StructuredOutputError = { + readonly name: "StructuredOutputError" + readonly data: { readonly message: string; readonly retries: number } +} + +export type ContextOverflowError = { + readonly name: "ContextOverflowError" + readonly data: { readonly message: string; readonly responseBody?: string | undefined } +} + +export type ContentFilterError = { readonly name: "ContentFilterError"; readonly data: { readonly message: string } } + +export type APIError = { + readonly name: "APIError" + readonly data: { + readonly message: string + readonly statusCode?: number | undefined + readonly isRetryable: boolean + readonly responseHeaders?: { readonly [x: string]: string } | undefined + readonly responseBody?: string | undefined + readonly metadata?: { readonly [x: string]: string } | undefined + } +} + +export type TextPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "text" + readonly text: string + readonly synthetic?: boolean | undefined + readonly ignored?: boolean | undefined + readonly time?: { readonly start: number; readonly end?: number | undefined } | undefined + readonly metadata?: { readonly [x: string]: any } | undefined +} + +export type SubtaskPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "subtask" + readonly prompt: string + readonly description: string + readonly agent: string + readonly model?: { readonly providerID: string; readonly modelID: string } | undefined + readonly command?: string | undefined +} + +export type ReasoningPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "reasoning" + readonly text: string + readonly metadata?: { readonly [x: string]: any } | undefined + readonly time: { readonly start: number; readonly end?: number | undefined } +} + +export type FilePartSourceText = { readonly value: string; readonly start: number; readonly end: number } + +export type Range = { + readonly start: { readonly line: number; readonly character: number } + readonly end: { readonly line: number; readonly character: number } +} + +export type ToolStatePending = { + readonly status: "pending" + readonly input: { readonly [x: string]: any } + readonly raw: string +} + +export type ToolStateRunning = { + readonly status: "running" + readonly input: { readonly [x: string]: any } + readonly title?: string | undefined + readonly metadata?: { readonly [x: string]: any } | undefined + readonly time: { readonly start: number } +} + +export type ToolStateError = { + readonly status: "error" + readonly input: { readonly [x: string]: any } + readonly error: string + readonly metadata?: { readonly [x: string]: any } | undefined + readonly time: { readonly start: number; readonly end: number } +} + +export type StepStartPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "step-start" + readonly snapshot?: string | undefined +} + +export type StepFinishPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "step-finish" + readonly reason: string + readonly snapshot?: string | undefined + readonly cost: number + readonly tokens: { + readonly total?: number | undefined + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } +} + +export type SnapshotPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "snapshot" + readonly snapshot: string +} + +export type PatchPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "patch" + readonly hash: string + readonly files: ReadonlyArray +} + +export type AgentPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "agent" + readonly name: string + readonly source?: { readonly value: string; readonly start: number; readonly end: number } | undefined +} + +export type CompactionPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "compaction" + readonly auto: boolean + readonly overflow?: boolean | undefined + readonly tail_start_id?: string | undefined +} + +export type Pty = { + readonly id: string + readonly title: string + readonly command: string + readonly args: ReadonlyArray + readonly cwd: string + readonly status: "running" | "exited" + readonly pid: number + readonly exitCode?: number +} + +export type QuestionV2Option = { readonly label: string; readonly description: string } + +export type QuestionV2Tool = { readonly messageID: string; readonly callID: string } + +export type QuestionV2Answer = ReadonlyArray + +export type FormMetadata2 = { readonly [x: string]: unknown } + +export type FormWhen2 = { readonly key: string; readonly op: "eq" | "neq"; readonly value: string | number | boolean } + +export type FormValue2 = string | number | boolean | ReadonlyArray + +export type Todo = { readonly content: string; readonly status: string; readonly priority: string } + +export type SessionStatus = + | { readonly type: "idle" } + | { + readonly type: "retry" + readonly attempt: number + readonly message: string + readonly action?: { + readonly reason: string + readonly provider: string + readonly title: string + readonly message: string + readonly label: string + readonly link?: string + } + readonly next: number + } + | { readonly type: "busy" } + +export type QuestionOption = { readonly label: string; readonly description: string } + +export type QuestionTool = { readonly messageID: string; readonly callID: string } + +export type QuestionAnswer = ReadonlyArray + +export type ModelsDevRefreshed = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "models-dev.refreshed" + readonly location?: LocationRef + readonly data: {} +} + +export type IntegrationUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "integration.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type IntegrationConnectionUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "integration.connection.updated" + readonly location?: LocationRef + readonly data: { readonly integrationID: string } +} + +export type CatalogUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "catalog.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type AgentUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "agent.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type MessageRemoved = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "message.removed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly messageID: string } +} + +export type MessagePartRemoved = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "message.part.removed" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly messageID: string; readonly partID: string } +} + +export type SessionTextDelta = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.text.delta" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly textID: string + readonly delta: string + } +} + +export type SessionReasoningDelta = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.reasoning.delta" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly reasoningID: string + readonly delta: string + } +} + +export type SessionToolInputDelta = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.tool.input.delta" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly assistantMessageID: string + readonly callID: string + readonly delta: string + } +} + +export type SessionCompactionDelta = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.compaction.delta" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly text: string } +} + +export type FilesystemChanged = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "filesystem.changed" + readonly location?: LocationRef + readonly data: { readonly file: string; readonly event: "add" | "change" | "unlink" } +} + +export type ReferenceUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "reference.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type PluginAdded = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "plugin.added" + readonly location?: LocationRef + readonly data: { readonly id: string } +} + +export type ProjectDirectoriesUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "project.directories.updated" + readonly location?: LocationRef + readonly data: { readonly projectID: string } +} + +export type CommandUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "command.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type ConfigUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "config.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type SkillUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "skill.updated" + readonly location?: LocationRef + readonly data: {} +} + +export type PtyExited = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "pty.exited" + readonly location?: LocationRef + readonly data: { readonly id: string; readonly exitCode: number } +} + +export type PtyDeleted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "pty.deleted" + readonly location?: LocationRef + readonly data: { readonly id: string } +} + +export type ShellExited = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "shell.exited" + readonly location?: LocationRef + readonly data: { + readonly id: string + readonly exit?: number + readonly status: "running" | "exited" | "timeout" | "killed" + } +} + +export type ShellDeleted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "shell.deleted" + readonly location?: LocationRef + readonly data: { readonly id: string } +} + +export type QuestionV2Rejected = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.v2.rejected" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly requestID: string } +} + +export type FormCancelled = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "form.cancelled" + readonly location?: LocationRef + readonly data: { readonly id: string; readonly sessionID: string } +} + +export type SessionIdle = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.idle" + readonly location?: LocationRef + readonly data: { readonly sessionID: string } +} + +export type TuiPromptAppend = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "tui.prompt.append" + readonly location?: LocationRef + readonly data: { readonly text: string } +} + +export type TuiCommandExecute = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "tui.command.execute" + readonly location?: LocationRef + readonly data: { + readonly command: + | "session.list" + | "session.new" + | "session.share" + | "session.interrupt" + | "session.background" + | "session.compact" + | "session.page.up" + | "session.page.down" + | "session.line.up" + | "session.line.down" + | "session.half.page.up" + | "session.half.page.down" + | "session.first" + | "session.last" + | "prompt.clear" + | "prompt.submit" + | "agent.cycle" + | string + } +} + +export type TuiToastShow = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "tui.toast.show" + readonly location?: LocationRef + readonly data: { + readonly title?: string + readonly message: string + readonly variant: "info" | "success" | "warning" | "error" + readonly duration?: number | undefined + } +} + +export type TuiSessionSelect = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "tui.session.select" + readonly location?: LocationRef + readonly data: { readonly sessionID: string } +} + +export type InstallationUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "installation.updated" + readonly location?: LocationRef + readonly data: { readonly version: string } +} + +export type InstallationUpdateAvailable = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "installation.update-available" + readonly location?: LocationRef + readonly data: { readonly version: string } +} + +export type VcsBranchUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "vcs.branch.updated" + readonly location?: LocationRef + readonly data: { readonly branch?: string } +} + +export type McpStatusChanged = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "mcp.status.changed" + readonly location?: LocationRef + readonly data: { readonly server: string } +} + +export type PermissionAsked = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "permission.asked" + readonly location?: LocationRef + readonly data: { + readonly id: string + readonly sessionID: string + readonly permission: string + readonly patterns: ReadonlyArray + readonly metadata: { readonly [x: string]: unknown } + readonly always: ReadonlyArray + readonly tool?: { readonly messageID: string; readonly callID: string } | undefined + } +} + +export type PermissionReplied = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "permission.replied" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly requestID: string + readonly reply: "once" | "always" | "reject" + } +} + +export type QuestionRejected = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.rejected" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly requestID: string } +} + +export type V2EventServerConnected = { + readonly id: string + readonly metadata?: { readonly [x: string]: unknown } | undefined + readonly location?: LocationRef | undefined + readonly type: "server.connected" + readonly data: {} +} + +export type PermissionRule = { + readonly permission: string + readonly pattern: string + readonly action: PermissionAction +} + +export type OutputFormat = + | { readonly type: "text" } + | { readonly type: "json_schema"; readonly schema: JSONSchema; readonly retryCount?: number | undefined | undefined } + +export type AssistantMessage = { + readonly id: string + readonly sessionID: string + readonly role: "assistant" + readonly time: { readonly created: number; readonly completed?: number | undefined } + readonly error?: + | ProviderAuthError + | UnknownError2 + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ContentFilterError + | APIError + | undefined + readonly parentID: string + readonly modelID: string + readonly providerID: string + readonly mode: string + readonly agent: string + readonly path: { readonly cwd: string; readonly root: string } + readonly summary?: boolean | undefined + readonly cost: number + readonly tokens: { + readonly total?: number | undefined + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } + readonly structured?: any | undefined + readonly variant?: string | undefined + readonly finish?: string | undefined +} + +export type RetryPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "retry" + readonly attempt: number + readonly error: APIError + readonly time: { readonly created: number } +} + +export type SessionError = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.error" + readonly location?: LocationRef + readonly data: { + readonly sessionID?: string | undefined + readonly error?: + | ProviderAuthError + | UnknownError2 + | MessageOutputLengthError + | MessageAbortedError + | StructuredOutputError + | ContextOverflowError + | ContentFilterError + | APIError + | undefined + } +} + +export type FileSource = { readonly text: FilePartSourceText; readonly type: "file"; readonly path: string } + +export type ResourceSource = { + readonly text: FilePartSourceText + readonly type: "resource" + readonly clientName: string + readonly uri: string +} + +export type SymbolSource = { + readonly text: FilePartSourceText + readonly type: "symbol" + readonly path: string + readonly range: Range + readonly name: string + readonly kind: number +} + +export type SessionExecutionSettled = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.execution.settled" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly outcome: "success" | "failure" | "interrupted" + readonly error?: SessionErrorUnknown + } +} + +export type ShellCreated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "shell.created" + readonly location?: LocationRef + readonly data: { readonly info: Shell2 } +} + +export type PermissionV2Asked = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "permission.v2.asked" + readonly location?: LocationRef + readonly data: { + readonly id: string + readonly sessionID: string + readonly action: string + readonly resources: ReadonlyArray + readonly save?: ReadonlyArray + readonly metadata?: { readonly [x: string]: unknown } + readonly source?: PermissionV2Source + } +} + +export type PermissionV2Replied = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "permission.v2.replied" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly requestID: string; readonly reply: PermissionV2Reply } +} + +export type PtyCreated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "pty.created" + readonly location?: LocationRef + readonly data: { readonly info: Pty } +} + +export type PtyUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "pty.updated" + readonly location?: LocationRef + readonly data: { readonly info: Pty } +} + +export type QuestionV2Info = { + readonly question: string + readonly header: string + readonly options: ReadonlyArray + readonly multiple?: boolean + readonly custom?: boolean +} + +export type QuestionV2Replied = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.v2.replied" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly requestID: string + readonly answers: ReadonlyArray + } +} + +export type FormUrlInfo2 = { + readonly id: string + readonly sessionID: string + readonly title?: string + readonly metadata?: FormMetadata2 + readonly mode: "url" + readonly url: string +} + +export type FormNumberField2 = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "number" + readonly minimum?: number + readonly maximum?: number + readonly default?: number +} + +export type FormIntegerField2 = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "integer" + readonly minimum?: number + readonly maximum?: number + readonly default?: number +} + +export type FormBooleanField2 = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "boolean" + readonly default?: boolean +} + +export type FormStringField2 = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "string" + readonly format?: "email" | "uri" | "date" | "date-time" + readonly minLength?: number + readonly maxLength?: number + readonly pattern?: string + readonly placeholder?: string + readonly default?: string + readonly options?: ReadonlyArray + readonly custom?: boolean +} + +export type FormMultiselectField2 = { + readonly key: string + readonly title?: string + readonly description?: string + readonly required?: boolean + readonly when?: ReadonlyArray + readonly type: "multiselect" + readonly options: ReadonlyArray + readonly minItems?: number + readonly maxItems?: number + readonly custom?: boolean + readonly default?: ReadonlyArray +} + +export type FormAnswer2 = { readonly [x: string]: FormValue2 } + +export type TodoUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "todo.updated" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly todos: ReadonlyArray } +} + +export type SessionStatus2 = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.status" + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly status: SessionStatus } +} + +export type QuestionInfo = { + readonly question: string + readonly header: string + readonly options: ReadonlyArray + readonly multiple?: boolean | undefined + readonly custom?: boolean | undefined +} + +export type QuestionReplied = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.replied" + readonly location?: LocationRef + readonly data: { + readonly sessionID: string + readonly requestID: string + readonly answers: ReadonlyArray + } +} + +export type PermissionRuleset = ReadonlyArray + +export type UserMessage = { + readonly id: string + readonly sessionID: string + readonly role: "user" + readonly time: { readonly created: number } + readonly format?: OutputFormat | undefined + readonly summary?: + | { + readonly title?: string | undefined + readonly body?: string | undefined + readonly diffs: ReadonlyArray + } + | undefined + readonly agent: string + readonly model: { readonly providerID: string; readonly modelID: string; readonly variant?: string | undefined } + readonly system?: string | undefined + readonly tools?: { readonly [x: string]: boolean } | undefined +} + +export type FilePartSource = FileSource | SymbolSource | ResourceSource + +export type QuestionV2Asked = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.v2.asked" + readonly location?: LocationRef + readonly data: { + readonly id: string + readonly sessionID: string + readonly questions: ReadonlyArray + readonly tool?: QuestionV2Tool + } +} + +export type FormFormInfo2 = { + readonly id: string + readonly sessionID: string + readonly title?: string + readonly metadata?: FormMetadata2 + readonly mode: "form" + readonly fields: ReadonlyArray< + FormStringField2 | FormNumberField2 | FormIntegerField2 | FormBooleanField2 | FormMultiselectField2 + > +} + +export type FormReplied = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "form.replied" + readonly location?: LocationRef + readonly data: { readonly id: string; readonly sessionID: string; readonly answer: FormAnswer2 } +} + +export type QuestionAsked = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "question.asked" + readonly location?: LocationRef + readonly data: { + readonly id: string + readonly sessionID: string + readonly questions: ReadonlyArray + readonly tool?: QuestionTool | undefined + } +} + +export type Session = { + readonly id: string + readonly slug: string + readonly projectID: string + readonly workspaceID?: string + readonly directory: string + readonly path?: string + readonly parentID?: string + readonly summary?: { + readonly additions: number + readonly deletions: number + readonly files: number + readonly diffs?: ReadonlyArray + } + readonly cost?: number + readonly tokens?: { + readonly input: number + readonly output: number + readonly reasoning: number + readonly cache: { readonly read: number; readonly write: number } + } + readonly share?: { readonly url: string } + readonly title: string + readonly agent?: string + readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } + readonly version: string + readonly metadata?: { readonly [x: string]: any } + readonly time: { + readonly created: number + readonly updated: number + readonly compacting?: number + readonly archived?: number + } + readonly permission?: PermissionRuleset + readonly revert?: { + readonly messageID: string + readonly partID?: string + readonly snapshot?: string + readonly diff?: string + } +} + +export type Message = UserMessage | AssistantMessage + +export type FilePart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "file" + readonly mime: string + readonly filename?: string | undefined + readonly url: string + readonly source?: FilePartSource | undefined +} + +export type FormCreated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "form.created" + readonly location?: LocationRef + readonly data: { readonly form: FormFormInfo2 | FormUrlInfo2 } +} + +export type SessionCreated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.created" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly info: Session } +} + +export type SessionUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.updated" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly info: Session } +} + +export type SessionDeleted = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "session.deleted" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly info: Session } +} + +export type MessageUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "message.updated" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly info: Message } +} + +export type ToolStateCompleted = { + readonly status: "completed" + readonly input: { readonly [x: string]: any } + readonly output: string + readonly title: string + readonly metadata: { readonly [x: string]: any } + readonly time: { readonly start: number; readonly end: number; readonly compacted?: number | undefined } + readonly attachments?: ReadonlyArray | undefined +} + +export type ToolState = ToolStatePending | ToolStateRunning | ToolStateCompleted | ToolStateError + +export type ToolPart = { + readonly id: string + readonly sessionID: string + readonly messageID: string + readonly type: "tool" + readonly callID: string + readonly tool: string + readonly state: ToolState + readonly metadata?: { readonly [x: string]: any } | undefined +} + +export type Part = + | TextPart + | SubtaskPart + | ReasoningPart + | FilePart + | ToolPart + | StepStartPart + | StepFinishPart + | SnapshotPart + | PatchPart + | AgentPart + | RetryPart + | CompactionPart + +export type MessagePartUpdated = { + readonly id: string + readonly created: number + readonly metadata?: { readonly [x: string]: unknown } + readonly type: "message.part.updated" + readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } + readonly location?: LocationRef + readonly data: { readonly sessionID: string; readonly part: Part; readonly time: number } +} + +export type V2Event = + | ModelsDevRefreshed + | IntegrationUpdated + | IntegrationConnectionUpdated + | CatalogUpdated + | AgentUpdated + | SessionCreated + | SessionUpdated + | SessionDeleted + | MessageUpdated + | MessageRemoved + | MessagePartUpdated + | MessagePartRemoved + | SessionAgentSelected + | SessionModelSelected + | SessionMoved + | SessionRenamed + | SessionForked + | SessionPromptPromoted + | SessionPromptAdmitted + | SessionExecutionSettled + | SessionContextUpdated + | SessionSynthetic + | SessionSkillActivated + | SessionShellStarted + | SessionShellEnded + | SessionStepStarted + | SessionStepEnded + | SessionStepFailed + | SessionTextStarted + | SessionTextDelta + | SessionTextEnded + | SessionReasoningStarted + | SessionReasoningDelta + | SessionReasoningEnded + | SessionToolInputStarted + | SessionToolInputDelta + | SessionToolInputEnded + | SessionToolCalled + | SessionToolProgress + | SessionToolSuccess + | SessionToolFailed + | SessionRetried + | SessionCompactionStarted + | SessionCompactionDelta + | SessionCompactionEnded + | SessionRevertStaged + | SessionRevertCleared + | SessionRevertCommitted + | FilesystemChanged + | ReferenceUpdated + | PermissionV2Asked + | PermissionV2Replied + | PluginAdded + | ProjectDirectoriesUpdated + | CommandUpdated + | ConfigUpdated + | SkillUpdated + | PtyCreated + | PtyUpdated + | PtyExited + | PtyDeleted + | ShellCreated + | ShellExited + | ShellDeleted + | QuestionV2Asked + | QuestionV2Replied + | QuestionV2Rejected + | FormCreated + | FormReplied + | FormCancelled + | TodoUpdated + | SessionStatus2 + | SessionIdle + | TuiPromptAppend + | TuiCommandExecute + | TuiToastShow + | TuiSessionSelect + | InstallationUpdated + | InstallationUpdateAvailable + | VcsBranchUpdated + | McpStatusChanged + | PermissionAsked + | PermissionReplied + | QuestionAsked + | QuestionReplied + | QuestionRejected + | SessionError + | V2EventServerConnected + +export type EventLogHint = { readonly type: "log.hint"; readonly aggregateID: string; readonly seq: number } + +export type EventLogSweepRequired = { readonly type: "log.sweep_required" } + +export type EventLogChange = EventLogHint | EventLogSweepRequired + +export type QuestionV2Request = { + readonly id: string + readonly sessionID: string + readonly questions: ReadonlyArray + readonly tool?: QuestionV2Tool +} + +export type QuestionV2Reply = { readonly answers: ReadonlyArray } + +export type ReferenceLocalSource = { + readonly type: "local" + readonly path: string + readonly description?: string + readonly hidden?: boolean +} + +export type ReferenceGitSource = { + readonly type: "git" + readonly repository: string + readonly branch?: string + readonly description?: string + readonly hidden?: boolean +} + +export type ReferenceSource = ReferenceLocalSource | ReferenceGitSource + +export type ProjectCopyCopy = { readonly directory: string } + +export type VcsFileStatus = { + readonly file: string + readonly additions: number + readonly deletions: number + readonly status: "added" | "deleted" | "modified" +} + +export type VcsMode = "working" | "branch" + export type HealthGetOutput = { readonly healthy: true } -export type LocationGetInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type LocationGetInput = { readonly location?: LocationQuery["location"] } export type LocationGetOutput = { readonly directory: string @@ -171,11 +2600,7 @@ export type LocationGetOutput = { readonly project: { readonly id: string; readonly directory: string } } -export type AgentListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type AgentListInput = { readonly location?: LocationQuery["location"] } export type AgentListOutput = { readonly location: { @@ -183,33 +2608,10 @@ export type AgentListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly request: { - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - } - readonly system?: string - readonly description?: string - readonly mode: "subagent" | "primary" | "all" - readonly hidden: boolean - readonly color?: string | "primary" | "secondary" | "accent" | "success" | "warning" | "error" | "info" - readonly steps?: number - readonly permissions: ReadonlyArray<{ - readonly action: string - readonly resource: string - readonly effect: "allow" | "deny" | "ask" - }> - }> + readonly data: ReadonlyArray } -export type PluginListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type PluginListInput = { readonly location?: LocationQuery["location"] } export type PluginListOutput = { readonly location: { @@ -217,411 +2619,118 @@ export type PluginListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ readonly id: string }> + readonly data: ReadonlyArray } export type SessionListInput = { - readonly workspace?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["workspace"] - readonly limit?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["limit"] - readonly order?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["order"] - readonly search?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["search"] - readonly parentID?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["parentID"] - readonly directory?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["directory"] - readonly project?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["project"] - readonly subpath?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["subpath"] - readonly cursor?: { - readonly workspace?: string | undefined - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly search?: string | undefined - readonly parentID?: string | null | undefined - readonly directory?: string | undefined - readonly project?: string | undefined - readonly subpath?: string | undefined - readonly cursor?: string | undefined - }["cursor"] + readonly workspace?: SessionsQuery["workspace"] + readonly limit?: SessionsQuery["limit"] + readonly order?: SessionsQuery["order"] + readonly search?: SessionsQuery["search"] + readonly parentID?: SessionsQuery["parentID"] + readonly directory?: SessionsQuery["directory"] + readonly project?: SessionsQuery["project"] + readonly subpath?: SessionsQuery["subpath"] + readonly cursor?: SessionsQuery["cursor"] } -export type SessionListOutput = { - readonly data: ReadonlyArray<{ - readonly id: string - readonly parentID?: string - readonly projectID: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly time: { readonly created: number; readonly updated: number; readonly archived?: number } - readonly title: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - }> - readonly watermarks: { readonly [x: string]: number } - readonly cursor: { readonly previous?: string | null; readonly next?: string | null } -} +export type SessionListOutput = SessionsResponse export type SessionCreateInput = { readonly id?: { readonly id?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly location?: { readonly directory: string; readonly workspaceID?: string } | null + readonly model?: ModelRef | null + readonly location?: LocationRef | null }["id"] readonly agent?: { readonly id?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly location?: { readonly directory: string; readonly workspaceID?: string } | null + readonly model?: ModelRef | null + readonly location?: LocationRef | null }["agent"] readonly model?: { readonly id?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly location?: { readonly directory: string; readonly workspaceID?: string } | null + readonly model?: ModelRef | null + readonly location?: LocationRef | null }["model"] readonly location?: { readonly id?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly location?: { readonly directory: string; readonly workspaceID?: string } | null + readonly model?: ModelRef | null + readonly location?: LocationRef | null }["location"] } -export type SessionCreateOutput = { - readonly data: { - readonly id: string - readonly parentID?: string - readonly projectID: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly time: { readonly created: number; readonly updated: number; readonly archived?: number } - readonly title: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - } -}["data"] +export type SessionCreateOutput = { readonly data: SessionV2Info }["data"] export type SessionActiveOutput = { - readonly data: { readonly [x: string]: { readonly type: "running" } } - readonly watermarks: { readonly [x: string]: number } + readonly data: { readonly [x: string]: SessionActive } + readonly watermarks: SessionWatermarks } export type SessionGetInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionGetOutput = { - readonly data: { - readonly id: string - readonly parentID?: string - readonly projectID: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly time: { readonly created: number; readonly updated: number; readonly archived?: number } - readonly title: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - } -}["data"] +export type SessionGetOutput = { readonly data: SessionV2Info }["data"] export type SessionForkInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly messageID?: { readonly messageID?: string | undefined }["messageID"] + readonly messageID?: { readonly messageID?: string | null }["messageID"] } -export type SessionForkOutput = { - readonly data: { - readonly id: string - readonly parentID?: string - readonly projectID: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly time: { readonly created: number; readonly updated: number; readonly archived?: number } - readonly title: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - } -}["data"] +export type SessionForkOutput = { readonly data: SessionV2Info }["data"] export type SessionSwitchAgentInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] readonly agent: { readonly agent: string }["agent"] } -export type SessionSwitchAgentOutput = void +export type SessionSwitchAgentOutput = null export type SessionSwitchModelInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly model: { - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - }["model"] + readonly model: { readonly model: ModelRef }["model"] } -export type SessionSwitchModelOutput = void +export type SessionSwitchModelOutput = null export type SessionRenameInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] readonly title: { readonly title: string }["title"] } -export type SessionRenameOutput = void +export type SessionRenameOutput = null export type SessionPromptInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] readonly id?: { readonly id?: string | null - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } + readonly prompt: PromptInput readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["id"] readonly prompt: { readonly id?: string | null - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } + readonly prompt: PromptInput readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["prompt"] readonly delivery?: { readonly id?: string | null - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } + readonly prompt: PromptInput readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["delivery"] readonly resume?: { readonly id?: string | null - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } + readonly prompt: PromptInput readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["resume"] } -export type SessionPromptOutput = { - readonly data: { - readonly admittedSeq: number - readonly id: string - readonly sessionID: string - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } - readonly delivery: "steer" | "queue" - readonly timeCreated: number - readonly promotedSeq?: number - } -}["data"] +export type SessionPromptOutput = { readonly data: SessionInputAdmitted }["data"] export type SessionCommandInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] @@ -630,17 +2739,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["id"] @@ -649,17 +2750,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["command"] @@ -668,17 +2761,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["arguments"] @@ -687,17 +2772,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["agent"] @@ -706,17 +2783,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["model"] @@ -725,17 +2794,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["files"] @@ -744,17 +2805,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["agents"] @@ -763,17 +2816,9 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["delivery"] @@ -782,67 +2827,24 @@ export type SessionCommandInput = { readonly command: string readonly arguments?: string | null readonly agent?: string | null - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> + readonly model?: ModelRef | null + readonly files?: ReadonlyArray + readonly agents?: ReadonlyArray readonly delivery?: "steer" | "queue" | null readonly resume?: boolean | null }["resume"] } -export type SessionCommandOutput = { - readonly data: { - readonly admittedSeq: number - readonly id: string - readonly sessionID: string - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } - readonly delivery: "steer" | "queue" - readonly timeCreated: number - readonly promotedSeq?: number - } -}["data"] +export type SessionCommandOutput = { readonly data: SessionInputAdmitted }["data"] export type SessionSkillInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly id?: { - readonly id?: string | undefined - readonly skill: string - readonly resume?: boolean | undefined - }["id"] - readonly skill: { - readonly id?: string | undefined - readonly skill: string - readonly resume?: boolean | undefined - }["skill"] - readonly resume?: { - readonly id?: string | undefined - readonly skill: string - readonly resume?: boolean | undefined - }["resume"] + readonly id?: { readonly id?: string | null; readonly skill: string; readonly resume?: boolean | null }["id"] + readonly skill: { readonly id?: string | null; readonly skill: string; readonly resume?: boolean | null }["skill"] + readonly resume?: { readonly id?: string | null; readonly skill: string; readonly resume?: boolean | null }["resume"] } -export type SessionSkillOutput = void +export type SessionSkillOutput = null export type SessionSyntheticInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] @@ -863,258 +2865,62 @@ export type SessionSyntheticInput = { }["metadata"] } -export type SessionSyntheticOutput = void +export type SessionSyntheticOutput = null export type SessionShellInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly id?: { readonly id?: string | undefined; readonly command: string }["id"] - readonly command: { readonly id?: string | undefined; readonly command: string }["command"] + readonly id?: { readonly id?: string | null; readonly command: string }["id"] + readonly command: { readonly id?: string | null; readonly command: string }["command"] } -export type SessionShellOutput = void +export type SessionShellOutput = null export type SessionCompactInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionCompactOutput = void +export type SessionCompactOutput = null export type SessionWaitInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionWaitOutput = void +export type SessionWaitOutput = null export type SessionRevertStageInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly messageID: { readonly messageID: string; readonly files?: boolean | undefined }["messageID"] - readonly files?: { readonly messageID: string; readonly files?: boolean | undefined }["files"] + readonly messageID: { readonly messageID: string; readonly files?: boolean | null }["messageID"] + readonly files?: { readonly messageID: string; readonly files?: boolean | null }["files"] } -export type SessionRevertStageOutput = { - readonly data: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } -}["data"] +export type SessionRevertStageOutput = { readonly data: RevertState }["data"] export type SessionRevertClearInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionRevertClearOutput = void +export type SessionRevertClearOutput = null export type SessionRevertCommitInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionRevertCommitOutput = void +export type SessionRevertCommitOutput = null export type SessionContextInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionContextOutput = { - readonly data: ReadonlyArray< - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "agent-switched" - readonly agent: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "model-switched" - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly previous?: { readonly id: string; readonly providerID: string; readonly variant?: string } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly type: "user" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly sessionID: string - readonly text: string - readonly description?: string - readonly type: "synthetic" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "system" - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "skill" - readonly name: string - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "shell" - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - } - readonly output?: { - readonly output: string - readonly cursor: number - readonly size: number - readonly truncated: boolean - } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "assistant" - readonly agent: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly id: string; readonly text: string } - | { - readonly type: "reasoning" - readonly id: string - readonly text: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly time?: { readonly created: number; readonly completed?: number } - } - | { - readonly type: "tool" - readonly id: string - readonly name: string - readonly provider?: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly resultMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - } - readonly state: - | { readonly status: "pending"; readonly input: string } - | { - readonly status: "running" - readonly input: { readonly [x: string]: JsonValue } - readonly structured: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - } - | { - readonly status: "completed" - readonly input: { readonly [x: string]: JsonValue } - readonly attachments?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly outputPaths?: ReadonlyArray - readonly structured: { readonly [x: string]: JsonValue } - readonly result?: JsonValue - } - | { - readonly status: "error" - readonly input: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly structured: { readonly [x: string]: JsonValue } - readonly error: { readonly type: "unknown"; readonly message: string } - readonly result?: JsonValue - } - readonly time: { - readonly created: number - readonly ran?: number - readonly completed?: number - readonly pruned?: number - } - } - > - readonly snapshot?: { readonly start?: string; readonly end?: string; readonly files?: ReadonlyArray } - readonly finish?: string - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly error?: { readonly type: "unknown"; readonly message: string } - } - | { - readonly type: "compaction" - readonly reason: "auto" | "manual" - readonly summary: string - readonly recent: string - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - } - > -}["data"] +export type SessionContextOutput = { readonly data: ReadonlyArray }["data"] export type SessionListContextEntriesInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionListContextEntriesOutput = { - readonly data: ReadonlyArray<{ readonly key: string; readonly value: JsonValue }> -}["data"] +export type SessionListContextEntriesOutput = { readonly data: ReadonlyArray }["data"] export type SessionPutContextEntryInput = { - readonly sessionID: { readonly sessionID: string; readonly key: string }["sessionID"] - readonly key: { readonly sessionID: string; readonly key: string }["key"] + readonly sessionID: { readonly sessionID: string; readonly key: SessionContextEntryKey }["sessionID"] + readonly key: { readonly sessionID: string; readonly key: SessionContextEntryKey }["key"] readonly value: { readonly value: JsonValue }["value"] } -export type SessionPutContextEntryOutput = void +export type SessionPutContextEntryOutput = null export type SessionRemoveContextEntryInput = { - readonly sessionID: { readonly sessionID: string; readonly key: string }["sessionID"] - readonly key: { readonly sessionID: string; readonly key: string }["key"] + readonly sessionID: { readonly sessionID: string; readonly key: SessionContextEntryKey }["sessionID"] + readonly key: { readonly sessionID: string; readonly key: SessionContextEntryKey }["key"] } -export type SessionRemoveContextEntryOutput = void +export type SessionRemoveContextEntryOutput = null export type SessionLogInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] @@ -1122,880 +2928,33 @@ export type SessionLogInput = { readonly follow?: { readonly after?: number | undefined; readonly follow?: boolean | undefined }["follow"] } -export type SessionLogOutput = - | ( - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.agent.selected" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly agent: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.model.selected" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.moved" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.renamed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly title: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.forked" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly parentID: string; readonly from?: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.prompt.promoted" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly inputID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.prompt.admitted" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly inputID: string - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } - readonly delivery: "steer" | "queue" - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.context.updated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.synthetic" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly text: string - readonly description?: string - readonly metadata?: { readonly [x: string]: unknown } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.skill.activated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly name: string; readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.shell.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number - readonly metadata: { readonly [x: string]: unknown } - readonly time: { readonly started: number; readonly completed?: number } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.shell.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number - readonly metadata: { readonly [x: string]: unknown } - readonly time: { readonly started: number; readonly completed?: number } - } - readonly output: { - readonly output: string - readonly cursor: number - readonly size: number - readonly truncated: boolean - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly agent: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly snapshot?: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly finish: string - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly snapshot?: string - readonly files?: ReadonlyArray - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.failed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly error: { readonly type: "unknown"; readonly message: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.text.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly assistantMessageID: string; readonly textID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.text.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly textID: string - readonly text: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.reasoning.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly reasoningID: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.reasoning.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly reasoningID: string - readonly text: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.input.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly name: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.input.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly text: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.called" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly tool: string - readonly input: { readonly [x: string]: unknown } - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.progress" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly structured: { readonly [x: string]: unknown } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.success" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly structured: { readonly [x: string]: unknown } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly outputPaths?: ReadonlyArray - readonly result?: unknown - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.failed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly error: { readonly type: "unknown"; readonly message: string } - readonly result?: unknown - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.retried" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly attempt: number - readonly error: { - readonly message: string - readonly statusCode?: number - readonly isRetryable: boolean - readonly responseHeaders?: { readonly [x: string]: string } - readonly responseBody?: string - readonly metadata?: { readonly [x: string]: string } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.compaction.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly reason: "auto" | "manual" } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.compaction.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly reason: "auto" | "manual" - readonly text: string - readonly recent: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.staged" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly revert: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.cleared" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.committed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly messageID: string } - } - ) - | { readonly type: "log.synced"; readonly aggregateID: string; readonly seq?: number } +export type SessionLogOutput = SessionLogItem export type SessionInterruptInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionInterruptOutput = void +export type SessionInterruptOutput = null export type SessionBackgroundInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type SessionBackgroundOutput = void +export type SessionBackgroundOutput = null export type SessionMessageInput = { readonly sessionID: { readonly sessionID: string; readonly messageID: string }["sessionID"] readonly messageID: { readonly sessionID: string; readonly messageID: string }["messageID"] } -export type SessionMessageOutput = { - readonly data: - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "agent-switched" - readonly agent: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "model-switched" - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly previous?: { readonly id: string; readonly providerID: string; readonly variant?: string } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly type: "user" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly sessionID: string - readonly text: string - readonly description?: string - readonly type: "synthetic" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "system" - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "skill" - readonly name: string - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "shell" - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - } - readonly output?: { - readonly output: string - readonly cursor: number - readonly size: number - readonly truncated: boolean - } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "assistant" - readonly agent: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly id: string; readonly text: string } - | { - readonly type: "reasoning" - readonly id: string - readonly text: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly time?: { readonly created: number; readonly completed?: number } - } - | { - readonly type: "tool" - readonly id: string - readonly name: string - readonly provider?: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly resultMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - } - readonly state: - | { readonly status: "pending"; readonly input: string } - | { - readonly status: "running" - readonly input: { readonly [x: string]: JsonValue } - readonly structured: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - } - | { - readonly status: "completed" - readonly input: { readonly [x: string]: JsonValue } - readonly attachments?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly outputPaths?: ReadonlyArray - readonly structured: { readonly [x: string]: JsonValue } - readonly result?: JsonValue - } - | { - readonly status: "error" - readonly input: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly structured: { readonly [x: string]: JsonValue } - readonly error: { readonly type: "unknown"; readonly message: string } - readonly result?: JsonValue - } - readonly time: { - readonly created: number - readonly ran?: number - readonly completed?: number - readonly pruned?: number - } - } - > - readonly snapshot?: { readonly start?: string; readonly end?: string; readonly files?: ReadonlyArray } - readonly finish?: string - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly error?: { readonly type: "unknown"; readonly message: string } - } - | { - readonly type: "compaction" - readonly reason: "auto" | "manual" - readonly summary: string - readonly recent: string - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - } -}["data"] +export type SessionMessageOutput = { readonly data: SessionMessage }["data"] export type MessageListInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly limit?: { - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly cursor?: string | undefined - }["limit"] - readonly order?: { - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly cursor?: string | undefined - }["order"] - readonly cursor?: { - readonly limit?: number | undefined - readonly order?: "asc" | "desc" | undefined - readonly cursor?: string | undefined - }["cursor"] + readonly limit?: SessionMessagesQuery["limit"] + readonly order?: SessionMessagesQuery["order"] + readonly cursor?: SessionMessagesQuery["cursor"] } -export type MessageListOutput = { - readonly data: ReadonlyArray< - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "agent-switched" - readonly agent: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "model-switched" - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly previous?: { readonly id: string; readonly providerID: string; readonly variant?: string } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly type: "user" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly sessionID: string - readonly text: string - readonly description?: string - readonly type: "synthetic" - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "system" - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - readonly type: "skill" - readonly name: string - readonly text: string - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "shell" - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - } - readonly output?: { - readonly output: string - readonly cursor: number - readonly size: number - readonly truncated: boolean - } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number; readonly completed?: number } - readonly type: "assistant" - readonly agent: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly id: string; readonly text: string } - | { - readonly type: "reasoning" - readonly id: string - readonly text: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly time?: { readonly created: number; readonly completed?: number } - } - | { - readonly type: "tool" - readonly id: string - readonly name: string - readonly provider?: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - readonly resultMetadata?: { readonly [x: string]: { readonly [x: string]: JsonValue } } - } - readonly state: - | { readonly status: "pending"; readonly input: string } - | { - readonly status: "running" - readonly input: { readonly [x: string]: JsonValue } - readonly structured: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - } - | { - readonly status: "completed" - readonly input: { readonly [x: string]: JsonValue } - readonly attachments?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly outputPaths?: ReadonlyArray - readonly structured: { readonly [x: string]: JsonValue } - readonly result?: JsonValue - } - | { - readonly status: "error" - readonly input: { readonly [x: string]: JsonValue } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly structured: { readonly [x: string]: JsonValue } - readonly error: { readonly type: "unknown"; readonly message: string } - readonly result?: JsonValue - } - readonly time: { - readonly created: number - readonly ran?: number - readonly completed?: number - readonly pruned?: number - } - } - > - readonly snapshot?: { readonly start?: string; readonly end?: string; readonly files?: ReadonlyArray } - readonly finish?: string - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly error?: { readonly type: "unknown"; readonly message: string } - } - | { - readonly type: "compaction" - readonly reason: "auto" | "manual" - readonly summary: string - readonly recent: string - readonly id: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly time: { readonly created: number } - } - > - readonly watermark?: number - readonly cursor: { readonly previous?: string | null; readonly next?: string | null } -} +export type MessageListOutput = SessionMessagesResponse -export type ModelListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ModelListInput = { readonly location?: LocationQuery["location"] } export type ModelListOutput = { readonly location: { @@ -2003,60 +2962,10 @@ export type ModelListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly providerID: string - readonly family?: string - readonly name: string - readonly api: - | { - readonly id: string - readonly type: "aisdk" - readonly package: string - readonly url?: string - readonly settings?: { readonly [x: string]: JsonValue } - } - | { - readonly id: string - readonly type: "native" - readonly url?: string - readonly settings: { readonly [x: string]: JsonValue } - } - readonly capabilities: { - readonly tools: boolean - readonly input: ReadonlyArray - readonly output: ReadonlyArray - } - readonly request: { - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - readonly variant?: string - } - readonly variants: ReadonlyArray<{ - readonly id: string - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - }> - readonly time: { readonly released: number } - readonly cost: ReadonlyArray<{ - readonly tier?: { readonly type: "context"; readonly size: number } - readonly input: number - readonly output: number - readonly cache: { readonly read: number; readonly write: number } - }> - readonly status: "alpha" | "beta" | "deprecated" | "active" - readonly enabled: boolean - readonly limit: { readonly context: number; readonly input?: number; readonly output: number } - }> + readonly data: ReadonlyArray } -export type ModelDefaultInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ModelDefaultInput = { readonly location?: LocationQuery["location"] } export type ModelDefaultOutput = { readonly location: { @@ -2064,76 +2973,18 @@ export type ModelDefaultOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly providerID: string - readonly family?: string - readonly name: string - readonly api: - | { - readonly id: string - readonly type: "aisdk" - readonly package: string - readonly url?: string - readonly settings?: { readonly [x: string]: JsonValue } - } - | { - readonly id: string - readonly type: "native" - readonly url?: string - readonly settings: { readonly [x: string]: JsonValue } - } - readonly capabilities: { - readonly tools: boolean - readonly input: ReadonlyArray - readonly output: ReadonlyArray - } - readonly request: { - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - readonly variant?: string - } - readonly variants: ReadonlyArray<{ - readonly id: string - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - }> - readonly time: { readonly released: number } - readonly cost: ReadonlyArray<{ - readonly tier?: { readonly type: "context"; readonly size: number } - readonly input: number - readonly output: number - readonly cache: { readonly read: number; readonly write: number } - }> - readonly status: "alpha" | "beta" | "deprecated" | "active" - readonly enabled: boolean - readonly limit: { readonly context: number; readonly input?: number; readonly output: number } - } | null + readonly data: ModelV2Info | null } export type GenerateTextInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] - readonly prompt: { - readonly prompt: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - }["prompt"] - readonly model?: { - readonly prompt: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } | null - }["model"] + readonly location?: LocationQuery["location"] + readonly prompt: { readonly prompt: string; readonly model?: ModelRef | null }["prompt"] + readonly model?: { readonly prompt: string; readonly model?: ModelRef | null }["model"] } -export type GenerateTextOutput = { readonly data: { readonly text: string } }["data"] +export type GenerateTextOutput = GenerateTextResponse["data"] -export type ProviderListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ProviderListInput = { readonly location?: LocationQuery["location"] } export type ProviderListOutput = { readonly location: { @@ -2141,32 +2992,12 @@ export type ProviderListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly integrationID?: string - readonly name: string - readonly disabled?: boolean - readonly api: - | { - readonly type: "aisdk" - readonly package: string - readonly url?: string - readonly settings?: { readonly [x: string]: JsonValue } - } - | { readonly type: "native"; readonly url?: string; readonly settings: { readonly [x: string]: JsonValue } } - readonly request: { - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - } - }> + readonly data: ReadonlyArray } export type ProviderGetInput = { readonly providerID: { readonly providerID: string }["providerID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } export type ProviderGetOutput = { @@ -2175,32 +3006,10 @@ export type ProviderGetOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly integrationID?: string - readonly name: string - readonly disabled?: boolean - readonly api: - | { - readonly type: "aisdk" - readonly package: string - readonly url?: string - readonly settings?: { readonly [x: string]: JsonValue } - } - | { readonly type: "native"; readonly url?: string; readonly settings: { readonly [x: string]: JsonValue } } - readonly request: { - readonly settings: { readonly [x: string]: JsonValue } - readonly headers: { readonly [x: string]: string } - readonly body: { readonly [x: string]: JsonValue } - } - } + readonly data: ProviderV2Info } -export type IntegrationListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type IntegrationListInput = { readonly location?: LocationQuery["location"] } export type IntegrationListOutput = { readonly location: { @@ -2211,47 +3020,14 @@ export type IntegrationListOutput = { readonly data: ReadonlyArray<{ readonly id: string readonly name: string - readonly methods: ReadonlyArray< - | { - readonly id: string - readonly type: "oauth" - readonly label: string - readonly prompts?: ReadonlyArray< - | { - readonly type: "text" - readonly key: string - readonly message: string - readonly placeholder?: string - readonly when?: { readonly key: string; readonly op: "eq" | "neq"; readonly value: string } - } - | { - readonly type: "select" - readonly key: string - readonly message: string - readonly options: ReadonlyArray<{ - readonly label: string - readonly value: string - readonly hint?: string - }> - readonly when?: { readonly key: string; readonly op: "eq" | "neq"; readonly value: string } - } - > - } - | { readonly type: "key"; readonly label?: string } - | { readonly type: "env"; readonly names: ReadonlyArray } - > - readonly connections: ReadonlyArray< - | { readonly type: "credential"; readonly id: string; readonly label: string } - | { readonly type: "env"; readonly name: string } - > + readonly methods: ReadonlyArray + readonly connections: ReadonlyArray }> } export type IntegrationGetInput = { readonly integrationID: { readonly integrationID: string }["integrationID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } export type IntegrationGetOutput = { @@ -2263,72 +3039,37 @@ export type IntegrationGetOutput = { readonly data: { readonly id: string readonly name: string - readonly methods: ReadonlyArray< - | { - readonly id: string - readonly type: "oauth" - readonly label: string - readonly prompts?: ReadonlyArray< - | { - readonly type: "text" - readonly key: string - readonly message: string - readonly placeholder?: string - readonly when?: { readonly key: string; readonly op: "eq" | "neq"; readonly value: string } - } - | { - readonly type: "select" - readonly key: string - readonly message: string - readonly options: ReadonlyArray<{ - readonly label: string - readonly value: string - readonly hint?: string - }> - readonly when?: { readonly key: string; readonly op: "eq" | "neq"; readonly value: string } - } - > - } - | { readonly type: "key"; readonly label?: string } - | { readonly type: "env"; readonly names: ReadonlyArray } - > - readonly connections: ReadonlyArray< - | { readonly type: "credential"; readonly id: string; readonly label: string } - | { readonly type: "env"; readonly name: string } - > + readonly methods: ReadonlyArray + readonly connections: ReadonlyArray } | null } export type IntegrationConnectKeyInput = { readonly integrationID: { readonly integrationID: string }["integrationID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] - readonly key: { readonly key: string; readonly label?: string | undefined }["key"] - readonly label?: { readonly key: string; readonly label?: string | undefined }["label"] + readonly location?: LocationQuery["location"] + readonly key: { readonly key: string; readonly label?: string | null }["key"] + readonly label?: { readonly key: string; readonly label?: string | null }["label"] } -export type IntegrationConnectKeyOutput = void +export type IntegrationConnectKeyOutput = null export type IntegrationConnectOauthInput = { readonly integrationID: { readonly integrationID: string }["integrationID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly methodID: { readonly methodID: string readonly inputs: { readonly [x: string]: string } - readonly label?: string | undefined + readonly label?: string | null }["methodID"] readonly inputs: { readonly methodID: string readonly inputs: { readonly [x: string]: string } - readonly label?: string | undefined + readonly label?: string | null }["inputs"] readonly label?: { readonly methodID: string readonly inputs: { readonly [x: string]: string } - readonly label?: string | undefined + readonly label?: string | null }["label"] } @@ -2352,9 +3093,7 @@ export type IntegrationConnectOauthOutput = { export type IntegrationAttemptStatusInput = { readonly attemptID: { readonly attemptID: string }["attemptID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } export type IntegrationAttemptStatusOutput = { @@ -2363,62 +3102,25 @@ export type IntegrationAttemptStatusOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: - | { - readonly status: "pending" - readonly time: { - readonly created: number | "Infinity" | "-Infinity" | "NaN" - readonly expires: number | "Infinity" | "-Infinity" | "NaN" - } - } - | { - readonly status: "complete" - readonly time: { - readonly created: number | "Infinity" | "-Infinity" | "NaN" - readonly expires: number | "Infinity" | "-Infinity" | "NaN" - } - } - | { - readonly status: "failed" - readonly message: string - readonly time: { - readonly created: number | "Infinity" | "-Infinity" | "NaN" - readonly expires: number | "Infinity" | "-Infinity" | "NaN" - } - } - | { - readonly status: "expired" - readonly time: { - readonly created: number | "Infinity" | "-Infinity" | "NaN" - readonly expires: number | "Infinity" | "-Infinity" | "NaN" - } - } + readonly data: IntegrationAttemptStatus } export type IntegrationAttemptCompleteInput = { readonly attemptID: { readonly attemptID: string }["attemptID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] - readonly code?: { readonly code?: string | undefined }["code"] + readonly location?: LocationQuery["location"] + readonly code?: { readonly code?: string | null }["code"] } -export type IntegrationAttemptCompleteOutput = void +export type IntegrationAttemptCompleteOutput = null export type IntegrationAttemptCancelInput = { readonly attemptID: { readonly attemptID: string }["attemptID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type IntegrationAttemptCancelOutput = void +export type IntegrationAttemptCancelOutput = null -export type ServerMcpListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ServerMcpListInput = { readonly location?: LocationQuery["location"] } export type ServerMcpListOutput = { readonly location: { @@ -2426,60 +3128,36 @@ export type ServerMcpListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly name: string - readonly status: - | { readonly status: "connected" } - | { readonly status: "pending" } - | { readonly status: "disabled" } - | { readonly status: "failed"; readonly error: string } - | { readonly status: "needs_auth" } - | { readonly status: "needs_client_registration"; readonly error: string } - readonly integrationID?: string - }> + readonly data: ReadonlyArray } export type CredentialUpdateInput = { readonly credentialID: { readonly credentialID: string }["credentialID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly label: { readonly label: string }["label"] } -export type CredentialUpdateOutput = void +export type CredentialUpdateOutput = null export type CredentialRemoveInput = { readonly credentialID: { readonly credentialID: string }["credentialID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type CredentialRemoveOutput = void +export type CredentialRemoveOutput = null -export type ProjectCurrentInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ProjectCurrentInput = { readonly location?: LocationQuery["location"] } -export type ProjectCurrentOutput = { readonly id: string; readonly directory: string } +export type ProjectCurrentOutput = ProjectCurrent export type ProjectDirectoriesInput = { readonly projectID: { readonly projectID: string }["projectID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type ProjectDirectoriesOutput = ReadonlyArray<{ readonly directory: string; readonly strategy?: string }> +export type ProjectDirectoriesOutput = ProjectDirectories -export type FormListRequestsInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type FormListRequestsInput = { readonly location?: LocationQuery["location"] } export type FormListRequestsOutput = { readonly location: { @@ -2487,1073 +3165,55 @@ export type FormListRequestsOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray< - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" - readonly fields: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > - } - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "url" - readonly url: string - } - > + readonly data: ReadonlyArray } export type FormListInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type FormListOutput = { - readonly data: ReadonlyArray< - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" - readonly fields: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > - } - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "url" - readonly url: string - } - > -}["data"] +export type FormListOutput = { readonly data: ReadonlyArray }["data"] export type FormCreateInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] - readonly id?: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["id"] - readonly title?: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["title"] - readonly metadata?: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["metadata"] - readonly mode: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["mode"] - readonly fields?: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["fields"] - readonly url?: { - readonly id?: string | null - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" | "url" - readonly fields?: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > | null - readonly url?: string | null - }["url"] + readonly id?: FormCreatePayload["id"] + readonly title?: FormCreatePayload["title"] + readonly metadata?: FormCreatePayload["metadata"] + readonly mode: FormCreatePayload["mode"] + readonly fields?: FormCreatePayload["fields"] + readonly url?: FormCreatePayload["url"] } -export type FormCreateOutput = { - readonly data: - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" - readonly fields: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > - } - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "url" - readonly url: string - } -}["data"] +export type FormCreateOutput = { readonly data: FormFormInfo | FormUrlInfo }["data"] export type FormGetInput = { readonly sessionID: { readonly sessionID: string; readonly formID: string }["sessionID"] readonly formID: { readonly sessionID: string; readonly formID: string }["formID"] } -export type FormGetOutput = { - readonly data: - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "form" - readonly fields: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "number" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "integer" - readonly minimum?: number | "Infinity" | "-Infinity" | "NaN" - readonly maximum?: number | "Infinity" | "-Infinity" | "NaN" - readonly default?: number | "Infinity" | "-Infinity" | "NaN" - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | "Infinity" | "-Infinity" | "NaN" | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > - } - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: JsonValue } - readonly mode: "url" - readonly url: string - } -}["data"] +export type FormGetOutput = { readonly data: FormFormInfo | FormUrlInfo }["data"] export type FormStateInput = { readonly sessionID: { readonly sessionID: string; readonly formID: string }["sessionID"] readonly formID: { readonly sessionID: string; readonly formID: string }["formID"] } -export type FormStateOutput = { - readonly data: - | { readonly status: "pending" } - | { - readonly status: "answered" - readonly answer: { readonly [x: string]: string | number | boolean | ReadonlyArray } - } - | { readonly status: "cancelled" } -}["data"] +export type FormStateOutput = { readonly data: FormState }["data"] export type FormReplyInput = { readonly sessionID: { readonly sessionID: string; readonly formID: string }["sessionID"] readonly formID: { readonly sessionID: string; readonly formID: string }["formID"] - readonly answer: { - readonly answer: { readonly [x: string]: string | number | boolean | ReadonlyArray } - }["answer"] + readonly answer: FormReply["answer"] } -export type FormReplyOutput = void +export type FormReplyOutput = null export type FormCancelInput = { readonly sessionID: { readonly sessionID: string; readonly formID: string }["sessionID"] readonly formID: { readonly sessionID: string; readonly formID: string }["formID"] } -export type FormCancelOutput = void +export type FormCancelOutput = null -export type PermissionListRequestsInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type PermissionListRequestsInput = { readonly location?: LocationQuery["location"] } export type PermissionListRequestsOutput = { readonly location: { @@ -3561,31 +3221,16 @@ export type PermissionListRequestsOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly sessionID: string - readonly action: string - readonly resources: ReadonlyArray - readonly save?: ReadonlyArray - readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } - }> + readonly data: ReadonlyArray } export type PermissionListSavedInput = { readonly projectID?: { readonly projectID?: string | undefined }["projectID"] } -export type PermissionListSavedOutput = { - readonly data: ReadonlyArray<{ - readonly id: string - readonly projectID: string - readonly action: string - readonly resource: string - }> -}["data"] +export type PermissionListSavedOutput = { readonly data: ReadonlyArray }["data"] export type PermissionRemoveSavedInput = { readonly id: { readonly id: string }["id"] } -export type PermissionRemoveSavedOutput = void +export type PermissionRemoveSavedOutput = null export type PermissionCreateInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] @@ -3595,7 +3240,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["id"] readonly action: { @@ -3604,7 +3249,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["action"] readonly resources: { @@ -3613,7 +3258,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["resources"] readonly save?: { @@ -3622,7 +3267,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["save"] readonly metadata?: { @@ -3631,7 +3276,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["metadata"] readonly source?: { @@ -3640,7 +3285,7 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["source"] readonly agent?: { @@ -3649,61 +3294,36 @@ export type PermissionCreateInput = { readonly resources: ReadonlyArray readonly save?: ReadonlyArray readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } + readonly source?: PermissionV2Source readonly agent?: string | null }["agent"] } export type PermissionCreateOutput = { - readonly data: { readonly id: string; readonly effect: "allow" | "deny" | "ask" } + readonly data: { readonly id: string; readonly effect: PermissionV2Effect } }["data"] export type PermissionListInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type PermissionListOutput = { - readonly data: ReadonlyArray<{ - readonly id: string - readonly sessionID: string - readonly action: string - readonly resources: ReadonlyArray - readonly save?: ReadonlyArray - readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } - }> -}["data"] +export type PermissionListOutput = { readonly data: ReadonlyArray }["data"] export type PermissionGetInput = { readonly sessionID: { readonly sessionID: string; readonly requestID: string }["sessionID"] readonly requestID: { readonly sessionID: string; readonly requestID: string }["requestID"] } -export type PermissionGetOutput = { - readonly data: { - readonly id: string - readonly sessionID: string - readonly action: string - readonly resources: ReadonlyArray - readonly save?: ReadonlyArray - readonly metadata?: { readonly [x: string]: JsonValue } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } - } -}["data"] +export type PermissionGetOutput = { readonly data: PermissionV2Request }["data"] export type PermissionReplyInput = { readonly sessionID: { readonly sessionID: string; readonly requestID: string }["sessionID"] readonly requestID: { readonly sessionID: string; readonly requestID: string }["requestID"] - readonly reply: { readonly reply: "once" | "always" | "reject"; readonly message?: string | undefined }["reply"] - readonly message?: { readonly reply: "once" | "always" | "reject"; readonly message?: string | undefined }["message"] + readonly reply: { readonly reply: PermissionV2Reply; readonly message?: string | null }["reply"] + readonly message?: { readonly reply: PermissionV2Reply; readonly message?: string | null }["message"] } -export type PermissionReplyOutput = void +export type PermissionReplyOutput = null -export type FileReadInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] - readonly path: string -} +export type FileReadInput = { readonly location?: LocationQuery["location"]; readonly path: string } export type FileReadOutput = globalThis.Uint8Array @@ -3724,7 +3344,7 @@ export type FileListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ readonly path: string; readonly type: "file" | "directory" }> + readonly data: ReadonlyArray } export type FileFindInput = { @@ -3760,14 +3380,10 @@ export type FileFindOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ readonly path: string; readonly type: "file" | "directory" }> + readonly data: ReadonlyArray } -export type CommandListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type CommandListInput = { readonly location?: LocationQuery["location"] } export type CommandListOutput = { readonly location: { @@ -3775,21 +3391,10 @@ export type CommandListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly name: string - readonly template: string - readonly description?: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly subtask?: boolean - }> + readonly data: ReadonlyArray } -export type SkillListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type SkillListInput = { readonly location?: LocationQuery["location"] } export type SkillListOutput = { readonly location: { @@ -3797,1745 +3402,14 @@ export type SkillListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly name: string - readonly description?: string - readonly slash?: boolean - readonly autoinvoke?: boolean - readonly location: string - readonly content: string - }> + readonly data: ReadonlyArray } -export type EventSubscribeOutput = - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "models-dev.refreshed" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "integration.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "integration.connection.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly integrationID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "catalog.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "agent.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.created" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly info: { - readonly id: string - readonly slug: string - readonly projectID: string - readonly workspaceID?: string - readonly directory: string - readonly path?: string - readonly parentID?: string - readonly summary?: { - readonly additions: number - readonly deletions: number - readonly files: number - readonly diffs?: ReadonlyArray<{ - readonly file?: string - readonly patch?: string - readonly additions: number - readonly deletions: number - readonly status?: "added" | "deleted" | "modified" - }> - } - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly share?: { readonly url: string } - readonly title: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly version: string - readonly metadata?: { readonly [x: string]: any } - readonly time: { - readonly created: number - readonly updated: number - readonly compacting?: number - readonly archived?: number - } - readonly permission?: ReadonlyArray<{ - readonly permission: string - readonly pattern: string - readonly action: "allow" | "deny" | "ask" - }> - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.updated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly info: { - readonly id: string - readonly slug: string - readonly projectID: string - readonly workspaceID?: string - readonly directory: string - readonly path?: string - readonly parentID?: string - readonly summary?: { - readonly additions: number - readonly deletions: number - readonly files: number - readonly diffs?: ReadonlyArray<{ - readonly file?: string - readonly patch?: string - readonly additions: number - readonly deletions: number - readonly status?: "added" | "deleted" | "modified" - }> - } - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly share?: { readonly url: string } - readonly title: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly version: string - readonly metadata?: { readonly [x: string]: any } - readonly time: { - readonly created: number - readonly updated: number - readonly compacting?: number - readonly archived?: number - } - readonly permission?: ReadonlyArray<{ - readonly permission: string - readonly pattern: string - readonly action: "allow" | "deny" | "ask" - }> - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.deleted" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly info: { - readonly id: string - readonly slug: string - readonly projectID: string - readonly workspaceID?: string - readonly directory: string - readonly path?: string - readonly parentID?: string - readonly summary?: { - readonly additions: number - readonly deletions: number - readonly files: number - readonly diffs?: ReadonlyArray<{ - readonly file?: string - readonly patch?: string - readonly additions: number - readonly deletions: number - readonly status?: "added" | "deleted" | "modified" - }> - } - readonly cost?: number - readonly tokens?: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly share?: { readonly url: string } - readonly title: string - readonly agent?: string - readonly model?: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly version: string - readonly metadata?: { readonly [x: string]: any } - readonly time: { - readonly created: number - readonly updated: number - readonly compacting?: number - readonly archived?: number - } - readonly permission?: ReadonlyArray<{ - readonly permission: string - readonly pattern: string - readonly action: "allow" | "deny" | "ask" - }> - readonly revert?: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "message.updated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly info: - | { - readonly id: string - readonly sessionID: string - readonly role: "user" - readonly time: { readonly created: number } - readonly format?: - | ( - | { readonly type: "text" } - | { - readonly type: "json_schema" - readonly schema: { readonly [x: string]: any } - readonly retryCount?: number | undefined | undefined - } - ) - | undefined - readonly summary?: - | { - readonly title?: string | undefined - readonly body?: string | undefined - readonly diffs: ReadonlyArray<{ - readonly file?: string - readonly patch?: string - readonly additions: number - readonly deletions: number - readonly status?: "added" | "deleted" | "modified" - }> - } - | undefined - readonly agent: string - readonly model: { - readonly providerID: string - readonly modelID: string - readonly variant?: string | undefined - } - readonly system?: string | undefined - readonly tools?: { readonly [x: string]: boolean } | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly role: "assistant" - readonly time: { readonly created: number; readonly completed?: number | undefined } - readonly error?: - | { - readonly name: "ProviderAuthError" - readonly data: { readonly providerID: string; readonly message: string } - } - | { - readonly name: "UnknownError" - readonly data: { readonly message: string; readonly ref?: string | undefined } - } - | { readonly name: "MessageOutputLengthError"; readonly data: {} } - | { readonly name: "MessageAbortedError"; readonly data: { readonly message: string } } - | { - readonly name: "StructuredOutputError" - readonly data: { readonly message: string; readonly retries: number } - } - | { - readonly name: "ContextOverflowError" - readonly data: { readonly message: string; readonly responseBody?: string | undefined } - } - | { readonly name: "ContentFilterError"; readonly data: { readonly message: string } } - | { - readonly name: "APIError" - readonly data: { - readonly message: string - readonly statusCode?: number | undefined - readonly isRetryable: boolean - readonly responseHeaders?: { readonly [x: string]: string } | undefined - readonly responseBody?: string | undefined - readonly metadata?: { readonly [x: string]: string } | undefined - } - } - | undefined - readonly parentID: string - readonly modelID: string - readonly providerID: string - readonly mode: string - readonly agent: string - readonly path: { readonly cwd: string; readonly root: string } - readonly summary?: boolean | undefined - readonly cost: number - readonly tokens: { - readonly total?: number | undefined - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly structured?: any | undefined - readonly variant?: string | undefined - readonly finish?: string | undefined - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "message.removed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly messageID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "message.part.updated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly part: - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "text" - readonly text: string - readonly synthetic?: boolean | undefined - readonly ignored?: boolean | undefined - readonly time?: { readonly start: number; readonly end?: number | undefined } | undefined - readonly metadata?: { readonly [x: string]: any } | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "subtask" - readonly prompt: string - readonly description: string - readonly agent: string - readonly model?: { readonly providerID: string; readonly modelID: string } | undefined - readonly command?: string | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "reasoning" - readonly text: string - readonly metadata?: { readonly [x: string]: any } | undefined - readonly time: { readonly start: number; readonly end?: number | undefined } - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "file" - readonly mime: string - readonly filename?: string | undefined - readonly url: string - readonly source?: - | ( - | { - readonly text: { readonly value: string; readonly start: number; readonly end: number } - readonly type: "file" - readonly path: string - } - | { - readonly text: { readonly value: string; readonly start: number; readonly end: number } - readonly type: "symbol" - readonly path: string - readonly range: { - readonly start: { readonly line: number; readonly character: number } - readonly end: { readonly line: number; readonly character: number } - } - readonly name: string - readonly kind: number - } - | { - readonly text: { readonly value: string; readonly start: number; readonly end: number } - readonly type: "resource" - readonly clientName: string - readonly uri: string - } - ) - | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "tool" - readonly callID: string - readonly tool: string - readonly state: - | { readonly status: "pending"; readonly input: { readonly [x: string]: any }; readonly raw: string } - | { - readonly status: "running" - readonly input: { readonly [x: string]: any } - readonly title?: string | undefined - readonly metadata?: { readonly [x: string]: any } | undefined - readonly time: { readonly start: number } - } - | { - readonly status: "completed" - readonly input: { readonly [x: string]: any } - readonly output: string - readonly title: string - readonly metadata: { readonly [x: string]: any } - readonly time: { - readonly start: number - readonly end: number - readonly compacted?: number | undefined - } - readonly attachments?: - | ReadonlyArray<{ - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "file" - readonly mime: string - readonly filename?: string | undefined - readonly url: string - readonly source?: - | ( - | { - readonly text: { - readonly value: string - readonly start: number - readonly end: number - } - readonly type: "file" - readonly path: string - } - | { - readonly text: { - readonly value: string - readonly start: number - readonly end: number - } - readonly type: "symbol" - readonly path: string - readonly range: { - readonly start: { readonly line: number; readonly character: number } - readonly end: { readonly line: number; readonly character: number } - } - readonly name: string - readonly kind: number - } - | { - readonly text: { - readonly value: string - readonly start: number - readonly end: number - } - readonly type: "resource" - readonly clientName: string - readonly uri: string - } - ) - | undefined - }> - | undefined - } - | { - readonly status: "error" - readonly input: { readonly [x: string]: any } - readonly error: string - readonly metadata?: { readonly [x: string]: any } | undefined - readonly time: { readonly start: number; readonly end: number } - } - readonly metadata?: { readonly [x: string]: any } | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "step-start" - readonly snapshot?: string | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "step-finish" - readonly reason: string - readonly snapshot?: string | undefined - readonly cost: number - readonly tokens: { - readonly total?: number | undefined - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "snapshot" - readonly snapshot: string - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "patch" - readonly hash: string - readonly files: ReadonlyArray - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "agent" - readonly name: string - readonly source?: { readonly value: string; readonly start: number; readonly end: number } | undefined - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "retry" - readonly attempt: number - readonly error: { - readonly name: "APIError" - readonly data: { - readonly message: string - readonly statusCode?: number | undefined - readonly isRetryable: boolean - readonly responseHeaders?: { readonly [x: string]: string } | undefined - readonly responseBody?: string | undefined - readonly metadata?: { readonly [x: string]: string } | undefined - } - } - readonly time: { readonly created: number } - } - | { - readonly id: string - readonly sessionID: string - readonly messageID: string - readonly type: "compaction" - readonly auto: boolean - readonly overflow?: boolean | undefined - readonly tail_start_id?: string | undefined - } - readonly time: number - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "message.part.removed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly messageID: string; readonly partID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.agent.selected" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly agent: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.model.selected" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.moved" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly location: { readonly directory: string; readonly workspaceID?: string } - readonly subpath?: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.renamed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly title: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.forked" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly parentID: string; readonly from?: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.prompt.promoted" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly inputID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.prompt.admitted" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly inputID: string - readonly prompt: { - readonly text: string - readonly files?: ReadonlyArray<{ - readonly uri: string - readonly mime: string - readonly name?: string - readonly description?: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - readonly agents?: ReadonlyArray<{ - readonly name: string - readonly source?: { readonly start: number; readonly end: number; readonly text: string } - }> - } - readonly delivery: "steer" | "queue" - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.execution.settled" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly outcome: "success" | "failure" | "interrupted" - readonly error?: { readonly type: "unknown"; readonly message: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.context.updated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.synthetic" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly text: string - readonly description?: string - readonly metadata?: { readonly [x: string]: unknown } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.skill.activated" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly name: string; readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.shell.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number - readonly metadata: { readonly [x: string]: unknown } - readonly time: { readonly started: number; readonly completed?: number } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.shell.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly shell: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number - readonly metadata: { readonly [x: string]: unknown } - readonly time: { readonly started: number; readonly completed?: number } - } - readonly output: { - readonly output: string - readonly cursor: number - readonly size: number - readonly truncated: boolean - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly agent: string - readonly model: { readonly id: string; readonly providerID: string; readonly variant?: string } - readonly snapshot?: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly finish: string - readonly cost: number - readonly tokens: { - readonly input: number - readonly output: number - readonly reasoning: number - readonly cache: { readonly read: number; readonly write: number } - } - readonly snapshot?: string - readonly files?: ReadonlyArray - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.step.failed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly error: { readonly type: "unknown"; readonly message: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.text.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly assistantMessageID: string; readonly textID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.text.delta" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly textID: string - readonly delta: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.text.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly textID: string - readonly text: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.reasoning.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly reasoningID: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.reasoning.delta" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly reasoningID: string - readonly delta: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.reasoning.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly reasoningID: string - readonly text: string - readonly providerMetadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.input.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly name: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.input.delta" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly delta: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.input.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly text: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.called" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly tool: string - readonly input: { readonly [x: string]: unknown } - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.progress" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly structured: { readonly [x: string]: unknown } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.success" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly structured: { readonly [x: string]: unknown } - readonly content: ReadonlyArray< - | { readonly type: "text"; readonly text: string } - | { readonly type: "file"; readonly uri: string; readonly mime: string; readonly name?: string } - > - readonly outputPaths?: ReadonlyArray - readonly result?: unknown - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.tool.failed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly assistantMessageID: string - readonly callID: string - readonly error: { readonly type: "unknown"; readonly message: string } - readonly result?: unknown - readonly provider: { - readonly executed: boolean - readonly metadata?: { readonly [x: string]: { readonly [x: string]: unknown } } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.retried" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly attempt: number - readonly error: { - readonly message: string - readonly statusCode?: number - readonly isRetryable: boolean - readonly responseHeaders?: { readonly [x: string]: string } - readonly responseBody?: string - readonly metadata?: { readonly [x: string]: string } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.compaction.started" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly reason: "auto" | "manual" } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.compaction.delta" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.compaction.ended" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly reason: "auto" | "manual" - readonly text: string - readonly recent: string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.staged" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly revert: { - readonly messageID: string - readonly partID?: string - readonly snapshot?: string - readonly diff?: string - readonly files?: ReadonlyArray<{ - readonly path: string - readonly status: "added" | "modified" | "deleted" - readonly additions: number - readonly deletions: number - readonly patch: string - }> - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.cleared" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.revert.committed" - readonly durable: { readonly aggregateID: string; readonly seq: number; readonly version: number } - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly messageID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "filesystem.changed" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly file: string; readonly event: "add" | "change" | "unlink" } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "reference.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "permission.v2.asked" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly sessionID: string - readonly action: string - readonly resources: ReadonlyArray - readonly save?: ReadonlyArray - readonly metadata?: { readonly [x: string]: unknown } - readonly source?: { readonly type: "tool"; readonly messageID: string; readonly callID: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "permission.v2.replied" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly requestID: string - readonly reply: "once" | "always" | "reject" - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "plugin.added" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly id: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "project.directories.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly projectID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "command.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "config.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "skill.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: {} - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "pty.created" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly info: { - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "pty.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly info: { - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "pty.exited" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly id: string; readonly exitCode: number } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "pty.deleted" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly id: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "shell.created" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly info: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number - readonly metadata: { readonly [x: string]: unknown } - readonly time: { readonly started: number; readonly completed?: number } - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "shell.exited" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly exit?: number - readonly status: "running" | "exited" | "timeout" | "killed" - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "shell.deleted" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly id: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.v2.asked" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly sessionID: string - readonly questions: ReadonlyArray<{ - readonly question: string - readonly header: string - readonly options: ReadonlyArray<{ readonly label: string; readonly description: string }> - readonly multiple?: boolean - readonly custom?: boolean - }> - readonly tool?: { readonly messageID: string; readonly callID: string } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.v2.replied" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly requestID: string - readonly answers: ReadonlyArray> - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.v2.rejected" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly requestID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "form.created" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly form: - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: unknown } - readonly mode: "form" - readonly fields: ReadonlyArray< - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | boolean - }> - readonly type: "string" - readonly format?: "email" | "uri" | "date" | "date-time" - readonly minLength?: number - readonly maxLength?: number - readonly pattern?: string - readonly placeholder?: string - readonly default?: string - readonly options?: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly custom?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | boolean - }> - readonly type: "number" - readonly minimum?: number - readonly maximum?: number - readonly default?: number - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | boolean - }> - readonly type: "integer" - readonly minimum?: number - readonly maximum?: number - readonly default?: number - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | boolean - }> - readonly type: "boolean" - readonly default?: boolean - } - | { - readonly key: string - readonly title?: string - readonly description?: string - readonly required?: boolean - readonly when?: ReadonlyArray<{ - readonly key: string - readonly op: "eq" | "neq" - readonly value: string | number | boolean - }> - readonly type: "multiselect" - readonly options: ReadonlyArray<{ - readonly value: string - readonly label: string - readonly description?: string - }> - readonly minItems?: number - readonly maxItems?: number - readonly custom?: boolean - readonly default?: ReadonlyArray - } - > - } - | { - readonly id: string - readonly sessionID: string - readonly title?: string - readonly metadata?: { readonly [x: string]: unknown } - readonly mode: "url" - readonly url: string - } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "form.replied" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly sessionID: string - readonly answer: { readonly [x: string]: string | number | boolean | ReadonlyArray } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "form.cancelled" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly id: string; readonly sessionID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "todo.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly todos: ReadonlyArray<{ readonly content: string; readonly status: string; readonly priority: string }> - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.status" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly status: - | { readonly type: "idle" } - | { - readonly type: "retry" - readonly attempt: number - readonly message: string - readonly action?: { - readonly reason: string - readonly provider: string - readonly title: string - readonly message: string - readonly label: string - readonly link?: string - } - readonly next: number - } - | { readonly type: "busy" } - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.idle" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "tui.prompt.append" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly text: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "tui.command.execute" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly command: - | "session.list" - | "session.new" - | "session.share" - | "session.interrupt" - | "session.background" - | "session.compact" - | "session.page.up" - | "session.page.down" - | "session.line.up" - | "session.line.down" - | "session.half.page.up" - | "session.half.page.down" - | "session.first" - | "session.last" - | "prompt.clear" - | "prompt.submit" - | "agent.cycle" - | string - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "tui.toast.show" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly title?: string - readonly message: string - readonly variant: "info" | "success" | "warning" | "error" - readonly duration?: number | undefined - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "tui.session.select" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "installation.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly version: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "installation.update-available" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly version: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "vcs.branch.updated" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly branch?: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "mcp.status.changed" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly server: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "permission.asked" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly sessionID: string - readonly permission: string - readonly patterns: ReadonlyArray - readonly metadata: { readonly [x: string]: unknown } - readonly always: ReadonlyArray - readonly tool?: { readonly messageID: string; readonly callID: string } | undefined - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "permission.replied" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly requestID: string - readonly reply: "once" | "always" | "reject" - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.asked" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly id: string - readonly sessionID: string - readonly questions: ReadonlyArray<{ - readonly question: string - readonly header: string - readonly options: ReadonlyArray<{ readonly label: string; readonly description: string }> - readonly multiple?: boolean | undefined - readonly custom?: boolean | undefined - }> - readonly tool?: { readonly messageID: string; readonly callID: string } | undefined - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.replied" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID: string - readonly requestID: string - readonly answers: ReadonlyArray> - } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "question.rejected" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { readonly sessionID: string; readonly requestID: string } - } - | { - readonly id: string - readonly created: number - readonly metadata?: { readonly [x: string]: unknown } - readonly type: "session.error" - readonly location?: { readonly directory: string; readonly workspaceID?: string } - readonly data: { - readonly sessionID?: string | undefined - readonly error?: - | { - readonly name: "ProviderAuthError" - readonly data: { readonly providerID: string; readonly message: string } - } - | { - readonly name: "UnknownError" - readonly data: { readonly message: string; readonly ref?: string | undefined } - } - | { readonly name: "MessageOutputLengthError"; readonly data: {} } - | { readonly name: "MessageAbortedError"; readonly data: { readonly message: string } } - | { - readonly name: "StructuredOutputError" - readonly data: { readonly message: string; readonly retries: number } - } - | { - readonly name: "ContextOverflowError" - readonly data: { readonly message: string; readonly responseBody?: string | undefined } - } - | { readonly name: "ContentFilterError"; readonly data: { readonly message: string } } - | { - readonly name: "APIError" - readonly data: { - readonly message: string - readonly statusCode?: number | undefined - readonly isRetryable: boolean - readonly responseHeaders?: { readonly [x: string]: string } | undefined - readonly responseBody?: string | undefined - readonly metadata?: { readonly [x: string]: string } | undefined - } - } - | undefined - } - } - | { - readonly id: string - readonly metadata?: { readonly [x: string]: unknown } | undefined - readonly location?: { readonly directory: string; readonly workspaceID?: string } | undefined - readonly type: "server.connected" - readonly data: {} - } +export type EventSubscribeOutput = V2Event -export type EventChangesOutput = - | { readonly type: "log.hint"; readonly aggregateID: string; readonly seq: number } - | { readonly type: "log.sweep_required" } +export type EventChangesOutput = EventLogChange -export type PtyListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type PtyListInput = { readonly location?: LocationQuery["location"] } export type PtyListOutput = { readonly location: { @@ -5543,22 +3417,11 @@ export type PtyListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - }> + readonly data: ReadonlyArray } export type PtyCreateInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly command?: { readonly command?: string readonly args?: ReadonlyArray @@ -5602,23 +3465,12 @@ export type PtyCreateOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - } + readonly data: Pty } export type PtyGetInput = { readonly ptyID: { readonly ptyID: string }["ptyID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } export type PtyGetOutput = { @@ -5627,23 +3479,12 @@ export type PtyGetOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - } + readonly data: Pty } export type PtyUpdateInput = { readonly ptyID: { readonly ptyID: string }["ptyID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly title?: { readonly title?: string readonly size?: { readonly rows: number; readonly cols: number } @@ -5657,32 +3498,17 @@ export type PtyUpdateOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly title: string - readonly command: string - readonly args: ReadonlyArray - readonly cwd: string - readonly status: "running" | "exited" - readonly pid: number - readonly exitCode?: number - } + readonly data: Pty } export type PtyRemoveInput = { readonly ptyID: { readonly ptyID: string }["ptyID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type PtyRemoveOutput = void +export type PtyRemoveOutput = null -export type ShellListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ShellListInput = { readonly location?: LocationQuery["location"] } export type ShellListOutput = { readonly location: { @@ -5690,27 +3516,11 @@ export type ShellListOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - }> + readonly data: ReadonlyArray } export type ShellCreateInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly command: { readonly command: string readonly cwd?: string @@ -5743,28 +3553,12 @@ export type ShellCreateOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - } + readonly data: Shell } export type ShellGetInput = { readonly id: { readonly id: string }["id"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } export type ShellGetOutput = { @@ -5773,21 +3567,7 @@ export type ShellGetOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: { - readonly id: string - readonly status: "running" | "exited" | "timeout" | "killed" - readonly command: string - readonly cwd: string - readonly shell: string - readonly file: string - readonly pid?: number - readonly exit?: number | "Infinity" | "-Infinity" | "NaN" - readonly metadata: { readonly [x: string]: JsonValue } - readonly time: { - readonly started: number | "Infinity" | "-Infinity" | "NaN" - readonly completed?: number | "Infinity" | "-Infinity" | "NaN" - } - } + readonly data: Shell } export type ShellOutputInput = { @@ -5825,18 +3605,12 @@ export type ShellOutputOutput = { export type ShellRemoveInput = { readonly id: { readonly id: string }["id"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type ShellRemoveOutput = void +export type ShellRemoveOutput = null -export type QuestionListRequestsInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type QuestionListRequestsInput = { readonly location?: LocationQuery["location"] } export type QuestionListRequestsOutput = { readonly location: { @@ -5844,57 +3618,29 @@ export type QuestionListRequestsOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly id: string - readonly sessionID: string - readonly questions: ReadonlyArray<{ - readonly question: string - readonly header: string - readonly options: ReadonlyArray<{ readonly label: string; readonly description: string }> - readonly multiple?: boolean - readonly custom?: boolean - }> - readonly tool?: { readonly messageID: string; readonly callID: string } - }> + readonly data: ReadonlyArray } export type QuestionListInput = { readonly sessionID: { readonly sessionID: string }["sessionID"] } -export type QuestionListOutput = { - readonly data: ReadonlyArray<{ - readonly id: string - readonly sessionID: string - readonly questions: ReadonlyArray<{ - readonly question: string - readonly header: string - readonly options: ReadonlyArray<{ readonly label: string; readonly description: string }> - readonly multiple?: boolean - readonly custom?: boolean - }> - readonly tool?: { readonly messageID: string; readonly callID: string } - }> -}["data"] +export type QuestionListOutput = { readonly data: ReadonlyArray }["data"] export type QuestionReplyInput = { readonly sessionID: { readonly sessionID: string; readonly requestID: string }["sessionID"] readonly requestID: { readonly sessionID: string; readonly requestID: string }["requestID"] - readonly answers: { readonly answers: ReadonlyArray> }["answers"] + readonly answers: QuestionV2Reply["answers"] } -export type QuestionReplyOutput = void +export type QuestionReplyOutput = null export type QuestionRejectInput = { readonly sessionID: { readonly sessionID: string; readonly requestID: string }["sessionID"] readonly requestID: { readonly sessionID: string; readonly requestID: string }["requestID"] } -export type QuestionRejectOutput = void +export type QuestionRejectOutput = null -export type ReferenceListInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type ReferenceListInput = { readonly location?: LocationQuery["location"] } export type ReferenceListOutput = { readonly location: { @@ -5907,55 +3653,37 @@ export type ReferenceListOutput = { readonly path: string readonly description?: string readonly hidden?: boolean - readonly source: - | { readonly type: "local"; readonly path: string; readonly description?: string; readonly hidden?: boolean } - | { - readonly type: "git" - readonly repository: string - readonly branch?: string - readonly description?: string - readonly hidden?: boolean - } + readonly source: ReferenceSource }> } export type ProjectCopyCreateInput = { readonly projectID: { readonly projectID: string }["projectID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly strategy: { readonly strategy: string; readonly directory: string; readonly name?: string }["strategy"] readonly directory: { readonly strategy: string; readonly directory: string; readonly name?: string }["directory"] readonly name?: { readonly strategy: string; readonly directory: string; readonly name?: string }["name"] } -export type ProjectCopyCreateOutput = { readonly directory: string } +export type ProjectCopyCreateOutput = ProjectCopyCopy export type ProjectCopyRemoveInput = { readonly projectID: { readonly projectID: string }["projectID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] readonly directory: { readonly directory: string; readonly force: boolean }["directory"] readonly force: { readonly directory: string; readonly force: boolean }["force"] } -export type ProjectCopyRemoveOutput = void +export type ProjectCopyRemoveOutput = null export type ProjectCopyRefreshInput = { readonly projectID: { readonly projectID: string }["projectID"] - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] + readonly location?: LocationQuery["location"] } -export type ProjectCopyRefreshOutput = void +export type ProjectCopyRefreshOutput = null -export type VcsStatusInput = { - readonly location?: { - readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - }["location"] -} +export type VcsStatusInput = { readonly location?: LocationQuery["location"] } export type VcsStatusOutput = { readonly location: { @@ -5963,28 +3691,23 @@ export type VcsStatusOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly file: string - readonly additions: number - readonly deletions: number - readonly status: "added" | "deleted" | "modified" - }> + readonly data: ReadonlyArray } export type VcsDiffInput = { readonly location?: { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - readonly mode: "working" | "branch" + readonly mode: VcsMode readonly context?: number | undefined }["location"] readonly mode: { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - readonly mode: "working" | "branch" + readonly mode: VcsMode readonly context?: number | undefined }["mode"] readonly context?: { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined - readonly mode: "working" | "branch" + readonly mode: VcsMode readonly context?: number | undefined }["context"] } @@ -5995,11 +3718,5 @@ export type VcsDiffOutput = { readonly workspaceID?: string readonly project: { readonly id: string; readonly directory: string } } - readonly data: ReadonlyArray<{ - readonly file?: string - readonly patch?: string - readonly additions: number - readonly deletions: number - readonly status?: "added" | "deleted" | "modified" - }> + readonly data: ReadonlyArray } diff --git a/packages/httpapi-codegen/src/index.ts b/packages/httpapi-codegen/src/index.ts index 8f22b4553f..e72eb74c7f 100644 --- a/packages/httpapi-codegen/src/index.ts +++ b/packages/httpapi-codegen/src/index.ts @@ -57,6 +57,14 @@ export type Endpoint = { readonly unwrapData: boolean readonly errors: ReadonlyArray<{ readonly status: number; readonly schema: Schema.Top }> readonly successes: ReadonlyArray + readonly wire: { + readonly params: Schema.Top | undefined + readonly query: Schema.Top | undefined + readonly headers: Schema.Top | undefined + readonly payloads: ReadonlyArray + readonly errors: ReadonlyArray<{ readonly status: number; readonly schema: Schema.Top }> + readonly successes: ReadonlyArray + } readonly effectPortable: boolean } @@ -76,6 +84,12 @@ type PromiseInputField = | (InputField & { readonly optional: boolean }) | { readonly name: string; readonly source: "wildcard"; readonly optional: false } +type PromiseReferences = { + readonly types: Map + readonly variants: Map> + readonly names: Set +} + const resolveHttpApiStatus = SchemaAST.resolveAt("httpApiStatus") const resolveHttpApiEncoding = SchemaAST.resolveAt("~httpApiEncoding") const resolveContentSchema = SchemaAST.resolveAt("contentSchema") @@ -161,6 +175,14 @@ export function compile( unwrapData: isDataEnvelope(success.schema), successes: [success.schema], errors: errorSchemas.map((item) => ({ status: item.status, schema: item.schema })), + wire: { + params: params?.wire, + query: query?.wire, + headers: headers?.wire, + payloads: payloads.map((item) => item.wire), + successes: [success.wire], + errors: errorSchemas.map((item) => ({ status: item.status, schema: item.wire })), + }, effectPortable, operation: { group: groupName, @@ -356,7 +378,7 @@ function groupShapeTypeName(group: Group, endpoint: Endpoint) { function assertPromiseEndpoint(endpoint: Endpoint) { const name = `${endpoint.group}.${endpoint.endpoint.name}` - const payload = endpoint.payloads[0] + const payload = endpoint.wire.payloads[0] const payloadEncoding = payload === undefined ? undefined : resolveHttpApiEncoding(payload.ast) if ( payload !== undefined && @@ -364,7 +386,7 @@ function assertPromiseEndpoint(endpoint: Endpoint) { ) { throw new GenerationError({ reason: `Unsupported Promise payload encoding: ${name}` }) } - const success = endpoint.successes[0] + const success = endpoint.wire.successes[0] if (isStreamSchema(success)) { if ( success._tag !== "StreamSse" || @@ -379,7 +401,7 @@ function assertPromiseEndpoint(endpoint: Endpoint) { throw new GenerationError({ reason: `Unsupported Promise success encoding: ${name}` }) } } - for (const error of endpoint.errors) { + for (const error of endpoint.wire.errors) { if (declaredErrorFields(error.schema) === undefined) { throw new GenerationError({ reason: `Promise error must have a literal discriminator: ${name}` }) } @@ -521,24 +543,35 @@ function renderPromiseTypes( outputTypes?: Readonly>, ) { const types = new Map() + const references: PromiseReferences = { types: new Map(), variants: new Map(), names: new Set() } const typeOf = (schema: Schema.Top, decoded = false) => { const projected = decoded ? Schema.toType(schema) : Schema.toEncoded(schema) const cached = types.get(projected.ast) if (cached !== undefined) return cached - const type = structuralType(projected) + const type = structuralType(projected, references) types.set(projected.ast, type) return type } const errors = new Map( groups.flatMap((group) => group.endpoints.flatMap((endpoint) => - endpoint.errors.flatMap((error) => { + endpoint.wire.errors.flatMap((error) => { const tagged = declaredErrorFields(error.schema) return tagged === undefined ? [] : [[tagged.tag, tagged] as const] }), ), ), ) + references.names.add("JsonValue") + for (const error of errors.values()) references.names.add(error.identifier) + for (const override of Object.values(outputTypes ?? {})) references.names.add(override.name) + for (const group of groups) { + for (const endpoint of group.endpoints) { + const prefix = promiseTypePrefix(group.identifier, endpoint.operation.name) + references.names.add(`${prefix}Input`) + references.names.add(`${prefix}Output`) + } + } const errorTypes = Array.from(errors.values()).map((error) => { const fields = error.fields .map(([name, schema, optional]) => `readonly ${JSON.stringify(name)}${optional ? "?" : ""}: ${typeOf(schema)}`) @@ -550,10 +583,10 @@ function renderPromiseTypes( group.endpoints.flatMap((endpoint) => { const prefix = promiseTypePrefix(group.identifier, endpoint.operation.name) const schemas = { - params: endpoint.params, - query: endpoint.query, - headers: endpoint.headers, - payload: endpoint.payloads[0], + params: endpoint.wire.params, + query: endpoint.wire.query, + headers: endpoint.wire.headers, + payload: endpoint.wire.payloads[0], } const input = promiseInput(endpoint) .map((field) => { @@ -564,7 +597,7 @@ function renderPromiseTypes( return `readonly ${JSON.stringify(field.name)}${field.optional ? "?" : ""}: (${typeOf(schema, field.source === "query")})[${JSON.stringify(field.name)}]` }) .join("; ") - const successSchema = endpoint.successes[0] + const successSchema = endpoint.wire.successes[0] const success = outputTypes?.[`${group.identifier}.${endpoint.operation.name}`]?.name ?? typeOf( @@ -581,11 +614,12 @@ function renderPromiseTypes( }), ) .join("\n\n") - const json = operations.includes("JsonValue") + const referenceTypes = Array.from(references.types, ([name, type]) => `export type ${name} = ${type}`).join("\n\n") + const json = [referenceTypes, operations, ...errorTypes].some((source) => source.includes("JsonValue")) ? "export type JsonValue = null | boolean | number | string | ReadonlyArray | { readonly [key: string]: JsonValue }" : "" const imports = [...new Set(Object.values(outputTypes ?? {}).map((override) => override.import))] - return [...imports, json, ...errorTypes, operations].filter(Boolean).join("\n\n") + return [...imports, json, ...errorTypes, referenceTypes, operations].filter(Boolean).join("\n\n") } function renderPromiseClient(groups: ReadonlyArray) { @@ -612,14 +646,14 @@ function renderPromiseClient(groups: ReadonlyArray) { : `{ ${inputs.map((field) => `${JSON.stringify(field.name)}: ${access(field.name)}`).join(", ")} }` } const parts = [ - endpoint.query === undefined ? undefined : `query: ${part("query")}`, - endpoint.headers === undefined ? undefined : `headers: ${part("headers")}`, - endpoint.payloads.length === 0 ? undefined : `body: ${part("payload")}`, + endpoint.wire.query === undefined ? undefined : `query: ${part("query")}`, + endpoint.wire.headers === undefined ? undefined : `headers: ${part("headers")}`, + endpoint.wire.payloads.length === 0 ? undefined : `body: ${part("payload")}`, ].filter((value): value is string => value !== undefined) - const declaredStatuses = [...new Set(endpoint.errors.map((error) => error.status))] - const descriptor = `{ method: ${JSON.stringify(endpoint.endpoint.method)}, path: ${path}${parts.length === 0 ? "" : `, ${parts.join(", ")}`}, successStatus: ${resolveHttpApiStatus(endpoint.successes[0].ast) ?? 200}, declaredStatuses: [${declaredStatuses.join(", ")}], empty: ${endpoint.operation.success === "void"}${isBinarySchema(endpoint.successes[0]) ? ", binary: true" : ""} }` + const declaredStatuses = [...new Set(endpoint.wire.errors.map((error) => error.status))] + const descriptor = `{ method: ${JSON.stringify(endpoint.endpoint.method)}, path: ${path}${parts.length === 0 ? "" : `, ${parts.join(", ")}`}, successStatus: ${resolveHttpApiStatus(endpoint.wire.successes[0].ast) ?? 200}, declaredStatuses: [${declaredStatuses.join(", ")}], empty: ${endpoint.operation.success === "void"}${isBinarySchema(endpoint.wire.successes[0]) ? ", binary: true" : ""} }` if (endpoint.operation.success === "stream") { - const success = endpoint.successes[0] + const success = endpoint.wire.successes[0] if (!isStreamSchema(success) || success._tag !== "StreamSse" || success.sseMode !== "data") { throw new GenerationError({ reason: `Promise stream emission is not implemented: ${group.identifier}.${endpoint.endpoint.name}`, @@ -652,7 +686,7 @@ function identifierPart(value: string) { .join("") } -function structuralType(schema: Schema.Top) { +function structuralType(schema: Schema.Top, references: PromiseReferences) { const document = SchemaRepresentation.toCodeDocument(SchemaRepresentation.fromASTs([schema.ast])) if ( document.artifacts.some( @@ -663,28 +697,62 @@ function structuralType(schema: Schema.Top) { ) { throw new GenerationError({ reason: "Referenced Promise types are not implemented" }) } - const references = new Map( - document.references.nonRecursives.map((reference) => [reference.$ref, reference.code.Type]), + const source = new Map( + document.references.nonRecursives.map((reference) => [reference.$ref, promiseType(reference.code.Type)]), ) const expand = (type: string, seen = new Set()): string => { - for (const [reference, value] of references) { - const pattern = `(?/g, "") - .replaceAll("Schema.Json", "JsonValue") + const names = new Map() + for (const reference of document.references.nonRecursives) { + const canonical = expand(source.get(reference.$ref)!) + const variants = references.variants.get(reference.$ref) ?? new Map() + const existing = variants.get(canonical) + if (existing !== undefined) { + names.set(reference.$ref, existing) + continue + } + const name = uniqueTypeName(identifierPart(reference.$ref), references.names) + references.names.add(name) + variants.set(canonical, name) + references.variants.set(reference.$ref, variants) + names.set(reference.$ref, name) + } + const rewrite = (type: string) => { + for (const [from, to] of names) type = type.replace(typeReferencePattern(from), to) + return type + } + for (const reference of document.references.nonRecursives) { + const name = names.get(reference.$ref)! + if (!references.types.has(name)) references.types.set(name, rewrite(source.get(reference.$ref)!)) + } + return rewrite(promiseType(document.codes[0].Type)) +} + +function typeReferencePattern(name: string) { + return new RegExp(`(?) { + if (!names.has(name)) return name + let suffix = 2 + while (names.has(`${name}${suffix}`)) suffix++ + return `${name}${suffix}` +} + +function promiseType(type: string) { + return type.replaceAll(/ & Brand\.Brand<"[^"]+">/g, "").replaceAll("Schema.Json", "JsonValue") } function normalizePromiseClientContent(content: string, groups: ReadonlyArray) { const endpoints = groups.flatMap((group) => group.endpoints) - const usesBinary = endpoints.some((endpoint) => isBinarySchema(endpoint.successes[0])) + const usesBinary = endpoints.some((endpoint) => isBinarySchema(endpoint.wire.successes[0])) const usesWildcard = endpoints.some((endpoint) => promiseWildcardInput(endpoint) !== undefined) const sseReady = replaceOne(content, "let next: ReadableStreamReadResult", "let next") @@ -769,7 +837,7 @@ function normalizeTransport( operation: string, ) { if (schema === undefined) return undefined - if (isStreamSchema(schema)) return { schema, effectPortable: true } as const + if (isStreamSchema(schema)) return { schema, wire: schema, effectPortable: true } as const if (!metadataPortable(schema.ast, new Set())) { throw new GenerationError({ reason: `Unportable schema: ${operation}.${source}` }) } @@ -798,8 +866,8 @@ function normalizeTransport( ? Array.from(rebuilt.success)[0] : Array.from(rebuilt.error)[0] if (normalized === undefined) throw new GenerationError({ reason: `Unportable schema: ${operation}.${source}` }) - if (!sameEncoding(schema.ast, normalized.ast)) return { schema, effectPortable: false } as const - return { schema: decoded, effectPortable: true } as const + if (!sameEncoding(schema.ast, normalized.ast)) return { schema, wire: schema, effectPortable: false } as const + return { schema: decoded, wire: schema, effectPortable: true } as const } function isPathInput(path: string): path is HttpRouter.PathInput { diff --git a/packages/httpapi-codegen/test/generate.test.ts b/packages/httpapi-codegen/test/generate.test.ts index 4ee5749b1d..86a736bfdf 100644 --- a/packages/httpapi-codegen/test/generate.test.ts +++ b/packages/httpapi-codegen/test/generate.test.ts @@ -270,8 +270,8 @@ describe("HttpApiCodegen.generate", () => { expect(types).not.toContain("Brand") }) - test("inlines non-recursive references in Promise wire types", () => { - const Referenced = Schema.Struct({ value: Schema.String }).annotate({ identifier: "Referenced" }) + test("preserves non-recursive references as named Promise wire types", () => { + const Referenced = Schema.Struct({ value: Schema.String }).annotate({ identifier: "Session.Info" }) const output = emitPromise( compileContract( api( @@ -282,12 +282,12 @@ describe("HttpApiCodegen.generate", () => { ), ) - expect(output.files.find((file) => file.path === "types.ts")?.content).toContain( - 'export type SessionGetOutput = ({ readonly "data": ({ readonly "value": string }) })["data"]', - ) + const types = output.files.find((file) => file.path === "types.ts")?.content + expect(types).toContain('export type SessionInfo = { readonly "value": string }') + expect(types).toContain('export type SessionGetOutput = ({ readonly "data": SessionInfo })["data"]') }) - test("expands Promise references only at identifier boundaries", () => { + test("preserves distinct Promise reference names at identifier boundaries", () => { const Session = Schema.Struct({ name: Schema.Literal("Session"), id: Schema.String }).annotate({ identifier: "Session", }) @@ -302,9 +302,47 @@ describe("HttpApiCodegen.generate", () => { ), ) - expect(output.files.find((file) => file.path === "types.ts")?.content).toContain( - 'readonly "session": ({ readonly "name": "Session", readonly "id": string })', + const types = output.files.find((file) => file.path === "types.ts")?.content + expect(types).toContain('export type Session = { readonly "name": "Session", readonly "id": string }') + expect(types).toContain("export type SessionID = string") + expect(types).toContain('readonly "session": Session, readonly "sessionID": SessionID') + }) + + test("preserves encoded shapes in named Promise wire types", () => { + const Referenced = Schema.Struct({ value: Schema.Number }).annotate({ identifier: "Referenced" }) + const output = emitPromise( + compileContract( + api( + HttpApiEndpoint.get("get", "/session", { + success: Schema.Struct({ data: Referenced }), + }), + ), + ), ) + + const types = output.files.find((file) => file.path === "types.ts")?.content + expect(types).toContain('export type Referenced = { readonly "value": number | "Infinity" | "-Infinity" | "NaN" }') + expect(types).toContain('export type SessionGetOutput = ({ readonly "data": Referenced })["data"]') + }) + + test("distinguishes decoded inputs from encoded Promise references", () => { + const Referenced = Schema.Struct({ value: Schema.NumberFromString }).annotate({ identifier: "Referenced" }) + const output = emitPromise( + compileContract( + api( + HttpApiEndpoint.get("get", "/session", { + query: { filter: Referenced }, + success: Schema.Struct({ data: Referenced }), + }), + ), + ), + ) + + const types = output.files.find((file) => file.path === "types.ts")?.content + expect(types).toContain('export type Referenced = { readonly "value": number }') + expect(types).toContain('export type Referenced2 = { readonly "value": string }') + expect(types).toContain('readonly "filter": ({ readonly "filter": Referenced })["filter"]') + expect(types).toContain('export type SessionGetOutput = ({ readonly "data": Referenced2 })["data"]') }) test("emits Effect Json schemas as standalone Promise types", () => {