// Generated by @opencode-ai/httpapi-codegen. Do not edit. import type { Effect, Stream } from "effect" import type { Location } from "@opencode-ai/schema/location" import type { Agent } from "@opencode-ai/schema/agent" import type { Plugin } from "@opencode-ai/schema/plugin" import type { Workspace } from "@opencode-ai/schema/workspace" import type { Session } from "@opencode-ai/schema/session" import type { AbsolutePath } from "@opencode-ai/schema/schema" import type { Project } from "@opencode-ai/schema/project" import type { RelativePath } from "@opencode-ai/schema/schema" import type { Brand } from "effect" import type { Model } from "@opencode-ai/schema/model" import type { DateTime } from "effect" import type { SessionMessage } from "@opencode-ai/schema/session-message" import type { SessionInbox } from "@opencode-ai/schema/session-inbox" import type { PromptInput } from "@opencode-ai/schema/prompt-input" import type { AgentAttachment } from "@opencode-ai/schema/prompt" import type { Skill } from "@opencode-ai/schema/skill" import type { Event } from "@opencode-ai/schema/event" import type { InstructionEntry } from "@opencode-ai/schema/instruction-entry" import type { Schema } from "effect" import type { EventLog } from "@opencode-ai/schema/event-log" import type { Shell } from "@opencode-ai/schema/shell" import type { Provider } from "@opencode-ai/schema/provider" import type { Integration } from "@opencode-ai/schema/integration" import type { Form } from "@opencode-ai/schema/form" import type { Mcp } from "@opencode-ai/schema/mcp" import type { Credential } from "@opencode-ai/schema/credential" import type { Permission } from "@opencode-ai/schema/permission" import type { PermissionSaved } from "@opencode-ai/schema/permission-saved" import type { FileSystem } from "@opencode-ai/schema/filesystem" import type { Command } from "@opencode-ai/schema/command" import type { OpenCodeEvent } from "@opencode-ai/protocol/groups/event" import type { Pty } from "@opencode-ai/schema/pty" import type { PtyTicket } from "@opencode-ai/schema/pty-ticket" import type { Reference } from "@opencode-ai/schema/reference" import type { Worktree } from "@opencode-ai/schema/worktree" import type { Vcs } from "@opencode-ai/schema/vcs" import type { FileDiff } from "@opencode-ai/schema/file-diff" import type { WebSearch } from "@opencode-ai/schema/websearch" import type { Config } from "@opencode-ai/schema/config" export type HealthGetOutput = { readonly healthy: true; readonly version: string; readonly pid: number } export type HealthGetOperation = () => Effect.Effect export interface HealthApi { readonly get: HealthGetOperation } export type ServerGetOutput = { readonly urls: ReadonlyArray } export type ServerGetOperation = () => Effect.Effect export interface ServerApi { readonly get: ServerGetOperation } export type LocationGetInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type LocationGetOutput = Location.Info export type LocationGetOperation = (input?: LocationGetInput) => Effect.Effect export interface LocationApi { readonly get: LocationGetOperation } export type AgentListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type AgentListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type AgentListOperation = (input?: AgentListInput) => Effect.Effect export type AgentGetInput = { readonly agentID: Agent.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type AgentGetOutput = { readonly location: Location.Info; readonly data: Agent.Info } export type AgentGetOperation = (input: AgentGetInput) => Effect.Effect export interface AgentApi { readonly list: AgentListOperation readonly get: AgentGetOperation } export type PluginListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type PluginListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type PluginListOperation = (input?: PluginListInput) => Effect.Effect export interface PluginApi { readonly list: PluginListOperation } export type SessionListInput = { readonly workspace?: Workspace.ID | undefined readonly limit?: number | undefined readonly order?: "asc" | "desc" | undefined readonly search?: string | undefined readonly parentID?: Session.ID | null | undefined readonly directory?: AbsolutePath | undefined readonly project?: Project.ID | undefined readonly subpath?: RelativePath | undefined readonly cursor?: (string & Brand.Brand<"SessionsCursor">) | undefined } export type SessionListOutput = { readonly data: ReadonlyArray readonly cursor: { readonly previous?: (string & Brand.Brand<"SessionsCursor">) | undefined readonly next?: (string & Brand.Brand<"SessionsCursor">) | undefined } } export type SessionListOperation = (input?: SessionListInput) => Effect.Effect export type SessionStatsInput = { readonly from?: number | undefined readonly to?: number | undefined readonly project?: Project.ID | undefined readonly timezone?: string | undefined readonly tools?: "none" | "summary" | "detail" | undefined } export type SessionStatsOutput = { readonly range: { readonly from: DateTime.Utc; readonly to: DateTime.Utc } readonly sessions: number readonly subagents: number readonly prompts: number readonly steps: number readonly tokens: { readonly input: number readonly output: number readonly reasoning: number readonly cache: { readonly read: number; readonly write: number } } readonly cost: number & Brand.Brand<"Money.USD"> readonly tools: | { readonly mode: "none" } | { readonly mode: "summary" readonly totals: { readonly calls: number readonly succeeded: number readonly failed: number readonly unfinished: number } } | { readonly mode: "detail" readonly totals: { readonly calls: number readonly succeeded: number readonly failed: number readonly unfinished: number } readonly usage: ReadonlyArray<{ readonly name: string readonly calls: number readonly succeeded: number readonly failed: number readonly unfinished: number readonly durationP50?: number | undefined }> } readonly activeDays: number readonly streak: number readonly activity: ReadonlyArray<{ readonly date: string; readonly steps: number }> readonly models: ReadonlyArray<{ readonly model: Model.Ref readonly steps: number readonly tokens: { readonly input: number readonly output: number readonly reasoning: number readonly cache: { readonly read: number; readonly write: number } } readonly cost: number & Brand.Brand<"Money.USD"> }> } export type SessionStatsOperation = (input?: SessionStatsInput) => Effect.Effect export type SessionCreateInput = { readonly id?: Session.ID | undefined readonly title?: string | undefined readonly agent?: Agent.ID | undefined readonly model?: Model.Ref | undefined readonly location?: Location.Ref | undefined readonly metadata?: Session.Metadata | undefined } export type SessionCreateOutput = Session.Info export type SessionCreateOperation = (input?: SessionCreateInput) => Effect.Effect export type SessionImportInput = { readonly info: Session.Info readonly messages: ReadonlyArray readonly location?: Location.Ref | undefined } export type SessionImportOutput = Session.Info export type SessionImportOperation = (input: SessionImportInput) => Effect.Effect export type SessionExportInput = { readonly sessionID: Session.ID; readonly sanitize?: boolean | undefined } export type SessionExportOutput = { readonly info: Session.Info; readonly messages: ReadonlyArray } export type SessionExportOperation = (input: SessionExportInput) => Effect.Effect export type SessionActiveOutput = { readonly [x: Session.ID]: { readonly type: "running" } } export type SessionActiveOperation = () => Effect.Effect export type SessionGetInput = { readonly sessionID: Session.ID } export type SessionGetOutput = Session.Info export type SessionGetOperation = (input: SessionGetInput) => Effect.Effect export type SessionRemoveInput = { readonly sessionID: Session.ID } export type SessionRemoveOutput = void export type SessionRemoveOperation = (input: SessionRemoveInput) => Effect.Effect export type SessionForkInput = { readonly sessionID: Session.ID; readonly boundary: Session.ForkRequestBoundary } export type SessionForkOutput = Session.Info export type SessionForkOperation = (input: SessionForkInput) => Effect.Effect export type SessionSwitchAgentInput = { readonly sessionID: Session.ID; readonly agent: Agent.ID } export type SessionSwitchAgentOutput = void export type SessionSwitchAgentOperation = ( input: SessionSwitchAgentInput, ) => Effect.Effect export type SessionSwitchModelInput = { readonly sessionID: Session.ID; readonly model: Model.Ref } export type SessionSwitchModelOutput = void export type SessionSwitchModelOperation = ( input: SessionSwitchModelInput, ) => Effect.Effect export type SessionRenameInput = { readonly sessionID: Session.ID; readonly title: string } export type SessionRenameOutput = void export type SessionRenameOperation = (input: SessionRenameInput) => Effect.Effect export type SessionMoveInput = { readonly sessionID: Session.ID readonly directory: AbsolutePath readonly workspaceID?: Workspace.ID | undefined readonly delivery?: SessionInbox.Delivery | undefined } export type SessionMoveOutput = void export type SessionMoveOperation = (input: SessionMoveInput) => Effect.Effect export type SessionPromptInput = { readonly sessionID: Session.ID readonly id?: SessionMessage.ID | undefined readonly text: string readonly files?: ReadonlyArray | undefined readonly agents?: ReadonlyArray | undefined readonly skills?: ReadonlyArray | undefined readonly metadata?: { readonly [x: string]: unknown } | undefined readonly delivery?: SessionInbox.Delivery | undefined readonly resume?: boolean | undefined } export type SessionPromptOutput = SessionInbox.User export type SessionPromptOperation = (input: SessionPromptInput) => Effect.Effect export type SessionCommandInput = { readonly sessionID: Session.ID readonly command: string readonly text: string readonly files?: ReadonlyArray | undefined readonly agents?: ReadonlyArray | undefined readonly skills?: ReadonlyArray | undefined readonly delivery?: SessionInbox.Delivery | undefined } export type SessionCommandOutput = void export type SessionCommandOperation = (input: SessionCommandInput) => Effect.Effect export type SessionSkillInput = { readonly sessionID: Session.ID readonly id?: SessionMessage.ID | undefined readonly skill: Skill.ID readonly resume?: boolean | undefined } export type SessionSkillOutput = void export type SessionSkillOperation = (input: SessionSkillInput) => Effect.Effect export type SessionSyntheticInput = { readonly sessionID: Session.ID readonly id?: SessionMessage.ID | undefined readonly text: string readonly description?: string | undefined readonly metadata?: { readonly [x: string]: unknown } | undefined readonly delivery?: SessionInbox.Delivery | undefined readonly resume?: boolean | undefined } export type SessionSyntheticOutput = SessionInbox.Synthetic export type SessionSyntheticOperation = ( input: SessionSyntheticInput, ) => Effect.Effect export type SessionShellInput = { readonly sessionID: Session.ID readonly id?: Event.ID | undefined readonly command: string } export type SessionShellOutput = void export type SessionShellOperation = (input: SessionShellInput) => Effect.Effect export type SessionCompactInput = { readonly sessionID: Session.ID readonly id?: SessionMessage.ID | undefined readonly delivery?: SessionInbox.Delivery | undefined } export type SessionCompactOutput = SessionInbox.Compaction export type SessionCompactOperation = (input: SessionCompactInput) => Effect.Effect export type SessionWaitInput = { readonly sessionID: Session.ID } export type SessionWaitOutput = void export type SessionWaitOperation = (input: SessionWaitInput) => Effect.Effect export type SessionRevertStageInput = { readonly sessionID: Session.ID readonly messageID: SessionMessage.ID readonly files?: boolean | undefined } export type SessionRevertStageOutput = Session.Revert export type SessionRevertStageOperation = ( input: SessionRevertStageInput, ) => Effect.Effect export type SessionRevertClearInput = { readonly sessionID: Session.ID } export type SessionRevertClearOutput = void export type SessionRevertClearOperation = ( input: SessionRevertClearInput, ) => Effect.Effect export type SessionRevertCommitInput = { readonly sessionID: Session.ID } export type SessionRevertCommitOutput = void export type SessionRevertCommitOperation = ( input: SessionRevertCommitInput, ) => Effect.Effect export type SessionContextInput = { readonly sessionID: Session.ID } export type SessionContextOutput = ReadonlyArray export type SessionContextOperation = (input: SessionContextInput) => Effect.Effect export type SessionInboxListInput = { readonly sessionID: Session.ID } export type SessionInboxListOutput = ReadonlyArray export type SessionInboxListOperation = ( input: SessionInboxListInput, ) => Effect.Effect export type SessionInboxCancelInput = { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID } export type SessionInboxCancelOutput = void export type SessionInboxCancelOperation = ( input: SessionInboxCancelInput, ) => Effect.Effect export type SessionInboxSteerInput = { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID } export type SessionInboxSteerOutput = void export type SessionInboxSteerOperation = ( input: SessionInboxSteerInput, ) => Effect.Effect export type SessionInboxQueueInput = { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID } export type SessionInboxQueueOutput = void export type SessionInboxQueueOperation = ( input: SessionInboxQueueInput, ) => Effect.Effect export type SessionInstructionsEntryListInput = { readonly sessionID: Session.ID } export type SessionInstructionsEntryListOutput = ReadonlyArray export type SessionInstructionsEntryListOperation = ( input: SessionInstructionsEntryListInput, ) => Effect.Effect export type SessionInstructionsEntryPutInput = { readonly sessionID: Session.ID readonly key: InstructionEntry.Key readonly value: Schema.Json } export type SessionInstructionsEntryPutOutput = void export type SessionInstructionsEntryPutOperation = ( input: SessionInstructionsEntryPutInput, ) => Effect.Effect export type SessionInstructionsEntryRemoveInput = { readonly sessionID: Session.ID; readonly key: InstructionEntry.Key } export type SessionInstructionsEntryRemoveOutput = void export type SessionInstructionsEntryRemoveOperation = ( input: SessionInstructionsEntryRemoveInput, ) => Effect.Effect export type SessionGenerateInput = { readonly sessionID: Session.ID; readonly prompt: string } export type SessionGenerateOutput = { readonly text: string } export type SessionGenerateOperation = ( input: SessionGenerateInput, ) => Effect.Effect export type SessionLogInput = { readonly sessionID: Session.ID readonly after?: Event.Seq | undefined readonly follow?: boolean | undefined } export type SessionLogOutput = | ( | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.created" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly projectID: Project.ID readonly location: Location.Ref readonly subpath?: RelativePath | undefined readonly parentID?: Session.ID | undefined readonly slug: string readonly title?: string | undefined readonly agent?: Agent.ID | undefined readonly model?: Model.Ref | undefined readonly metadata?: Session.Metadata | undefined readonly version: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.agent.selected" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly agent: Agent.ID readonly previous?: Agent.ID | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.model.selected" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly model: Model.Ref readonly previous?: Model.Ref | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.moved" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly location: Location.Ref readonly projectID: Project.ID readonly subpath?: RelativePath | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.renamed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly title: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.viewed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly idle: number } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.deleted" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.forked" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly parentID: Session.ID readonly boundary: Session.ForkBoundary readonly instructions?: | { readonly [x: string & Brand.Brand<"Instruction.Key">]: string & Brand.Brand<"Instruction.Hash"> } | undefined readonly instructionEntries?: InstructionEntry.Snapshot | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.inbox.delivered" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.inbox.enqueued" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly inboxID: SessionMessage.ID readonly item: SessionInbox.Item } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.inbox.cancelled" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly inboxID: SessionMessage.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.inbox.delivery.changed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly inboxID: SessionMessage.ID readonly delivery: SessionInbox.Delivery } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.execution.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.execution.succeeded" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.execution.failed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly error: { readonly type: string; readonly message: string; readonly status?: number | undefined } } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.execution.interrupted" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly reason: "user" | "shutdown" | "superseded" } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.instructions.updated" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly delta: { readonly [x: string]: (string & Brand.Brand<"Instruction.Hash">) | "removed" } readonly text?: string | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.synthetic" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly text: string readonly description?: string | undefined readonly metadata?: { readonly [x: string]: unknown } | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.skill.activated" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly id: Skill.ID readonly name: Skill.Name readonly text: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.shell.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly shell: Shell.Info } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.shell.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly shell: Shell.Info readonly output: { readonly output: string readonly cursor: number readonly size: number readonly truncated: boolean } } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.step.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly agent: Agent.ID readonly model: Model.Ref readonly snapshot?: (string & Brand.Brand<"Snapshot.ID">) | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.step.streamed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly assistantMessageID: SessionMessage.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.step.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly finish: "stop" | "length" | "tool-calls" | "content-filter" | "error" | "unknown" readonly rawFinish?: string | undefined readonly providerState?: SessionMessage.ProviderState | undefined readonly cost: number & Brand.Brand<"Money.USD"> readonly tokens: { readonly input: number readonly output: number readonly reasoning: number readonly cache: { readonly read: number; readonly write: number } } readonly snapshot?: (string & Brand.Brand<"Snapshot.ID">) | undefined readonly files?: ReadonlyArray | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.step.failed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly error: { readonly type: string; readonly message: string; readonly status?: number | undefined } readonly finish?: "content-filter" | undefined readonly rawFinish?: string | undefined readonly providerState?: SessionMessage.ProviderState | undefined readonly cost?: (number & Brand.Brand<"Money.USD">) | undefined readonly tokens?: | { readonly input: number readonly output: number readonly reasoning: number readonly cache: { readonly read: number; readonly write: number } } | undefined readonly snapshot?: (string & Brand.Brand<"Snapshot.ID">) | undefined readonly files?: ReadonlyArray | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.text.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly ordinal: number } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.text.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly ordinal: number readonly text: string readonly state?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.reasoning.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly ordinal: number readonly state?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.reasoning.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly ordinal: number readonly text: string readonly state?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.tool.input.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly id: string readonly name: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.tool.input.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly id: string readonly text: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.tool.called" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly id: string readonly input: { readonly [x: string]: unknown } readonly executed: boolean readonly state?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.tool.success" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly id: string readonly content: readonly [ ( | { readonly type: "text"; readonly text: string } | { readonly type: "file" readonly uri: string readonly mime: string readonly name?: string | undefined } ), ...Array< | { readonly type: "text"; readonly text: string } | { readonly type: "file" readonly uri: string readonly mime: string readonly name?: string | undefined } >, ] readonly metadata?: { readonly [x: string]: Schema.Json } | undefined readonly executed: boolean readonly resultState?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.tool.failed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly id: string readonly error: { readonly type: string; readonly message: string; readonly status?: number | undefined } readonly content?: | readonly [ ( | { readonly type: "text"; readonly text: string } | { readonly type: "file" readonly uri: string readonly mime: string readonly name?: string | undefined } ), ...Array< | { readonly type: "text"; readonly text: string } | { readonly type: "file" readonly uri: string readonly mime: string readonly name?: string | undefined } >, ] | undefined readonly metadata?: { readonly [x: string]: Schema.Json } | undefined readonly executed: boolean readonly resultState?: SessionMessage.ProviderState | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.retry.scheduled" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly assistantMessageID: SessionMessage.ID readonly attempt: number readonly at: number readonly error: { readonly type: string; readonly message: string; readonly status?: number | undefined } } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.compaction.started" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly reason: "auto" | "manual" readonly recent: string readonly inputID?: SessionMessage.ID | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.compaction.ended" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly reason: "auto" | "manual" readonly text: string readonly recent: string } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.compaction.failed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly reason: "auto" | "manual" readonly error: { readonly type: string; readonly message: string; readonly status?: number | undefined } readonly inputID?: SessionMessage.ID | undefined } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.revert.staged" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly revert: Session.Revert } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.revert.cleared" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.revert.committed" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID; readonly to: SessionMessage.ID } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.message.content.updated" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly messageID: SessionMessage.ID readonly content: ReadonlyArray } } | { readonly id: Event.ID readonly created: number readonly metadata?: { readonly [x: string]: unknown } | undefined readonly type: "session.usage.recorded" readonly durable: { readonly aggregateID: string; readonly seq: Event.Seq; readonly version: Event.Version } readonly location?: Location.Ref | undefined readonly data: { readonly sessionID: Session.ID readonly source: "title" | "compaction" readonly cost: number & Brand.Brand<"Money.USD"> readonly tokens: { readonly input: number readonly output: number readonly reasoning: number readonly cache: { readonly read: number; readonly write: number } } } } ) | EventLog.Synced export type SessionLogOperation = (input: SessionLogInput) => Stream.Stream export type SessionInterruptInput = { readonly sessionID: Session.ID; readonly continue?: boolean | undefined } export type SessionInterruptOutput = { readonly interrupted: boolean } export type SessionInterruptOperation = ( input: SessionInterruptInput, ) => Effect.Effect export type SessionBackgroundInput = { readonly sessionID: Session.ID } export type SessionBackgroundOutput = void export type SessionBackgroundOperation = ( input: SessionBackgroundInput, ) => Effect.Effect export type SessionMessageInput = { readonly sessionID: Session.ID; readonly messageID: SessionMessage.ID } export type SessionMessageOutput = SessionMessage.Info export type SessionMessageOperation = (input: SessionMessageInput) => Effect.Effect export type SessionMessageUpdateInput = { readonly sessionID: Session.ID readonly messageID: SessionMessage.ID readonly content: ReadonlyArray< SessionMessage.AssistantText | SessionMessage.AssistantReasoning | SessionMessage.AssistantTool > } export type SessionMessageUpdateOutput = SessionMessage.Assistant export type SessionMessageUpdateOperation = ( input: SessionMessageUpdateInput, ) => Effect.Effect export type SessionEnvironmentInput = { readonly sessionID: Session.ID readonly variables: { readonly [x: string]: string } } export type SessionEnvironmentOutput = void export type SessionEnvironmentOperation = ( input: SessionEnvironmentInput, ) => Effect.Effect export type SessionViewInput = { readonly sessionID: Session.ID; readonly idle: number } export type SessionViewOutput = void export type SessionViewOperation = (input: SessionViewInput) => Effect.Effect export interface SessionApi { readonly list: SessionListOperation readonly stats: SessionStatsOperation readonly create: SessionCreateOperation readonly import: SessionImportOperation readonly export: SessionExportOperation readonly active: SessionActiveOperation readonly get: SessionGetOperation readonly remove: SessionRemoveOperation readonly fork: SessionForkOperation readonly switchAgent: SessionSwitchAgentOperation readonly switchModel: SessionSwitchModelOperation readonly rename: SessionRenameOperation readonly move: SessionMoveOperation readonly prompt: SessionPromptOperation readonly command: SessionCommandOperation readonly skill: SessionSkillOperation readonly synthetic: SessionSyntheticOperation readonly shell: SessionShellOperation readonly compact: SessionCompactOperation readonly wait: SessionWaitOperation readonly revert: { readonly stage: SessionRevertStageOperation readonly clear: SessionRevertClearOperation readonly commit: SessionRevertCommitOperation } readonly context: SessionContextOperation readonly inbox: { readonly list: SessionInboxListOperation readonly cancel: SessionInboxCancelOperation readonly steer: SessionInboxSteerOperation readonly queue: SessionInboxQueueOperation } readonly instructions: { readonly entry: { readonly list: SessionInstructionsEntryListOperation readonly put: SessionInstructionsEntryPutOperation readonly remove: SessionInstructionsEntryRemoveOperation } } readonly generate: SessionGenerateOperation readonly log: SessionLogOperation readonly interrupt: SessionInterruptOperation readonly background: SessionBackgroundOperation readonly message: SessionMessageOperation readonly messageUpdate: SessionMessageUpdateOperation readonly environment: SessionEnvironmentOperation readonly view: SessionViewOperation } export type MessageListInput = { readonly sessionID: Session.ID readonly limit?: number | undefined readonly order?: "asc" | "desc" | undefined readonly cursor?: string | undefined } export type MessageListOutput = { readonly data: ReadonlyArray readonly cursor: { readonly previous?: string | undefined; readonly next?: string | undefined } } export type MessageListOperation = (input: MessageListInput) => Effect.Effect export interface MessageApi { readonly list: MessageListOperation } export type ModelListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ModelListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type ModelListOperation = (input?: ModelListInput) => Effect.Effect export type ModelDefaultInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ModelDefaultOutput = { readonly location: Location.Info; readonly data: Model.Info | undefined } export type ModelDefaultOperation = (input?: ModelDefaultInput) => Effect.Effect export interface ModelApi { readonly list: ModelListOperation readonly default: ModelDefaultOperation } export type GenerateTextInput = { readonly prompt: string; readonly model?: Model.Ref | undefined } export type GenerateTextOutput = { readonly text: string } export type GenerateTextOperation = (input: GenerateTextInput) => Effect.Effect export interface GenerateApi { readonly text: GenerateTextOperation } export type ProviderListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ProviderListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type ProviderListOperation = (input?: ProviderListInput) => Effect.Effect export type ProviderGetInput = { readonly providerID: Provider.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ProviderGetOutput = { readonly location: Location.Info; readonly data: Provider.Info } export type ProviderGetOperation = (input: ProviderGetInput) => Effect.Effect export interface ProviderApi { readonly list: ProviderListOperation readonly get: ProviderGetOperation } export type IntegrationListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type IntegrationListOperation = ( input?: IntegrationListInput, ) => Effect.Effect export type IntegrationGetInput = { readonly integrationID: Integration.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationGetOutput = { readonly location: Location.Info; readonly data: Integration.Info | undefined } export type IntegrationGetOperation = (input: IntegrationGetInput) => Effect.Effect export type IntegrationWellknownAddInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly url: string } export type IntegrationWellknownAddOutput = void export type IntegrationWellknownAddOperation = ( input: IntegrationWellknownAddInput, ) => Effect.Effect export type IntegrationConnectKeyInput = { readonly integrationID: Integration.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly key: string readonly answer?: Form.Answer | undefined readonly label?: string | undefined } export type IntegrationConnectKeyOutput = void export type IntegrationConnectKeyOperation = ( input: IntegrationConnectKeyInput, ) => Effect.Effect export type IntegrationOauthConnectInput = { readonly integrationID: Integration.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly methodID: Integration.MethodID readonly answer?: Form.Answer | undefined readonly label?: string | undefined } export type IntegrationOauthConnectOutput = { readonly location: Location.Info; readonly data: Integration.Attempt } export type IntegrationOauthConnectOperation = ( input: IntegrationOauthConnectInput, ) => Effect.Effect export type IntegrationOauthStatusInput = { readonly integrationID: Integration.ID readonly attemptID: Integration.AttemptID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationOauthStatusOutput = { readonly location: Location.Info readonly data: Integration.AttemptStatus } export type IntegrationOauthStatusOperation = ( input: IntegrationOauthStatusInput, ) => Effect.Effect export type IntegrationOauthCompleteInput = { readonly integrationID: Integration.ID readonly attemptID: Integration.AttemptID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly code?: string | undefined } export type IntegrationOauthCompleteOutput = void export type IntegrationOauthCompleteOperation = ( input: IntegrationOauthCompleteInput, ) => Effect.Effect export type IntegrationOauthCancelInput = { readonly integrationID: Integration.ID readonly attemptID: Integration.AttemptID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationOauthCancelOutput = void export type IntegrationOauthCancelOperation = ( input: IntegrationOauthCancelInput, ) => Effect.Effect export type IntegrationCommandConnectInput = { readonly integrationID: Integration.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly methodID: Integration.MethodID readonly label?: string | undefined } export type IntegrationCommandConnectOutput = { readonly location: Location.Info readonly data: Integration.CommandAttempt } export type IntegrationCommandConnectOperation = ( input: IntegrationCommandConnectInput, ) => Effect.Effect export type IntegrationCommandStatusInput = { readonly integrationID: Integration.ID readonly attemptID: Integration.AttemptID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationCommandStatusOutput = { readonly location: Location.Info readonly data: Integration.CommandAttemptStatus } export type IntegrationCommandStatusOperation = ( input: IntegrationCommandStatusInput, ) => Effect.Effect export type IntegrationCommandCancelInput = { readonly integrationID: Integration.ID readonly attemptID: Integration.AttemptID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type IntegrationCommandCancelOutput = void export type IntegrationCommandCancelOperation = ( input: IntegrationCommandCancelInput, ) => Effect.Effect export interface IntegrationApi { readonly list: IntegrationListOperation readonly get: IntegrationGetOperation readonly wellknown: { readonly add: IntegrationWellknownAddOperation } readonly connect: { readonly key: IntegrationConnectKeyOperation } readonly oauth: { readonly connect: IntegrationOauthConnectOperation readonly status: IntegrationOauthStatusOperation readonly complete: IntegrationOauthCompleteOperation readonly cancel: IntegrationOauthCancelOperation } readonly command: { readonly connect: IntegrationCommandConnectOperation readonly status: IntegrationCommandStatusOperation readonly cancel: IntegrationCommandCancelOperation } } export type McpListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type McpListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type McpListOperation = (input?: McpListInput) => Effect.Effect export type McpAddInput = { readonly server: string readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly config: Mcp.LocalConfig | Mcp.RemoteConfig } export type McpAddOutput = void export type McpAddOperation = (input: McpAddInput) => Effect.Effect export type McpRemoveInput = { readonly server: string readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type McpRemoveOutput = void export type McpRemoveOperation = (input: McpRemoveInput) => Effect.Effect export type McpConnectInput = { readonly server: string readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type McpConnectOutput = void export type McpConnectOperation = (input: McpConnectInput) => Effect.Effect export type McpDisconnectInput = { readonly server: string readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type McpDisconnectOutput = void export type McpDisconnectOperation = (input: McpDisconnectInput) => Effect.Effect export type McpResourceCatalogInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type McpResourceCatalogOutput = { readonly location: Location.Info; readonly data: Mcp.ResourceCatalog } export type McpResourceCatalogOperation = ( input?: McpResourceCatalogInput, ) => Effect.Effect export interface McpApi { readonly list: McpListOperation readonly add: McpAddOperation readonly remove: McpRemoveOperation readonly connect: McpConnectOperation readonly disconnect: McpDisconnectOperation readonly resource: { readonly catalog: McpResourceCatalogOperation } } export type CredentialUpdateInput = { readonly credentialID: Credential.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly label: string } export type CredentialUpdateOutput = void export type CredentialUpdateOperation = ( input: CredentialUpdateInput, ) => Effect.Effect export type CredentialActivateInput = { readonly credentialID: Credential.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type CredentialActivateOutput = void export type CredentialActivateOperation = ( input: CredentialActivateInput, ) => Effect.Effect export type CredentialRemoveInput = { readonly credentialID: Credential.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type CredentialRemoveOutput = void export type CredentialRemoveOperation = ( input: CredentialRemoveInput, ) => Effect.Effect export interface CredentialApi { readonly update: CredentialUpdateOperation readonly activate: CredentialActivateOperation readonly remove: CredentialRemoveOperation } export type ProjectListOutput = ReadonlyArray export type ProjectListOperation = () => Effect.Effect export type ProjectUpdateInput = { readonly projectID: Project.ID readonly name?: string | undefined readonly icon?: Project.Icon | undefined readonly commands?: Project.Commands | undefined } export type ProjectUpdateOutput = Project.Info export type ProjectUpdateOperation = (input: ProjectUpdateInput) => Effect.Effect export type ProjectCurrentInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ProjectCurrentOutput = Project.Current export type ProjectCurrentOperation = (input?: ProjectCurrentInput) => Effect.Effect export interface ProjectApi { readonly list: ProjectListOperation readonly update: ProjectUpdateOperation readonly current: ProjectCurrentOperation } export type FormRequestListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type FormRequestListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type FormRequestListOperation = ( input?: FormRequestListInput, ) => Effect.Effect export type FormListInput = { readonly sessionID: string } export type FormListOutput = ReadonlyArray export type FormListOperation = (input: FormListInput) => Effect.Effect export type FormCreateInput = { readonly sessionID: string readonly id?: Form.ID | undefined readonly title: string readonly metadata?: Form.Metadata | undefined readonly fields: Form.Fields } export type FormCreateOutput = Form.Info export type FormCreateOperation = (input: FormCreateInput) => Effect.Effect export type FormGetInput = { readonly sessionID: string; readonly formID: Form.ID } export type FormGetOutput = Form.Info export type FormGetOperation = (input: FormGetInput) => Effect.Effect export type FormStateInput = { readonly sessionID: string; readonly formID: Form.ID } export type FormStateOutput = Form.State export type FormStateOperation = (input: FormStateInput) => Effect.Effect export type FormReplyInput = { readonly sessionID: string; readonly formID: Form.ID; readonly answer: Form.Answer } export type FormReplyOutput = void export type FormReplyOperation = (input: FormReplyInput) => Effect.Effect export type FormCancelInput = { readonly sessionID: string; readonly formID: Form.ID } export type FormCancelOutput = void export type FormCancelOperation = (input: FormCancelInput) => Effect.Effect export interface FormApi { readonly request: { readonly list: FormRequestListOperation } readonly list: FormListOperation readonly create: FormCreateOperation readonly get: FormGetOperation readonly state: FormStateOperation readonly reply: FormReplyOperation readonly cancel: FormCancelOperation } export type PermissionRequestListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type PermissionRequestListOutput = { readonly location: Location.Info readonly data: ReadonlyArray } export type PermissionRequestListOperation = ( input?: PermissionRequestListInput, ) => Effect.Effect export type PermissionSavedListInput = { readonly projectID?: Project.ID | undefined } export type PermissionSavedListOutput = ReadonlyArray export type PermissionSavedListOperation = ( input?: PermissionSavedListInput, ) => Effect.Effect export type PermissionSavedRemoveInput = { readonly id: PermissionSaved.ID } export type PermissionSavedRemoveOutput = void export type PermissionSavedRemoveOperation = ( input: PermissionSavedRemoveInput, ) => Effect.Effect export type PermissionCreateInput = { readonly sessionID: Session.ID readonly id?: Permission.ID | undefined readonly action: string readonly resources: ReadonlyArray readonly save?: ReadonlyArray | undefined readonly metadata?: { readonly [x: string]: unknown } | undefined readonly source?: Permission.Source | undefined readonly agent?: Agent.ID | undefined } export type PermissionCreateOutput = { readonly id: Permission.ID; readonly effect: Permission.Effect } export type PermissionCreateOperation = ( input: PermissionCreateInput, ) => Effect.Effect export type PermissionListInput = { readonly sessionID: Session.ID } export type PermissionListOutput = ReadonlyArray export type PermissionListOperation = (input: PermissionListInput) => Effect.Effect export type PermissionGetInput = { readonly sessionID: Session.ID; readonly requestID: Permission.ID } export type PermissionGetOutput = Permission.Request export type PermissionGetOperation = (input: PermissionGetInput) => Effect.Effect export type PermissionReplyInput = { readonly sessionID: Session.ID readonly requestID: Permission.ID readonly reply: Permission.Reply readonly message?: string | undefined } export type PermissionReplyOutput = void export type PermissionReplyOperation = ( input: PermissionReplyInput, ) => Effect.Effect export interface PermissionApi { readonly request: { readonly list: PermissionRequestListOperation } readonly saved: { readonly list: PermissionSavedListOperation; readonly remove: PermissionSavedRemoveOperation } readonly create: PermissionCreateOperation readonly list: PermissionListOperation readonly get: PermissionGetOperation readonly reply: PermissionReplyOperation } export type FileListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly path?: RelativePath | undefined } export type FileListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type FileListOperation = (input?: FileListInput) => Effect.Effect export type FileFindInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly query: string readonly type?: "file" | "directory" | undefined readonly limit?: number | undefined } export type FileFindOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type FileFindOperation = (input: FileFindInput) => Effect.Effect export interface FileApi { readonly list: FileListOperation readonly find: FileFindOperation } export type CommandListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type CommandListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type CommandListOperation = (input?: CommandListInput) => Effect.Effect export interface CommandApi { readonly list: CommandListOperation } export type SkillListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type SkillListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type SkillListOperation = (input?: SkillListInput) => Effect.Effect export interface SkillApi { readonly list: SkillListOperation } export type EventSubscribeOutput = OpenCodeEvent export type EventSubscribeOperation = () => Stream.Stream export interface EventApi { readonly subscribe: EventSubscribeOperation } export type PtyListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type PtyListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type PtyListOperation = (input?: PtyListInput) => Effect.Effect export type PtyCreateInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly command?: string | undefined readonly args?: ReadonlyArray | undefined readonly cwd?: string | undefined readonly title?: string | undefined readonly env?: { readonly [x: string]: string } | undefined } export type PtyCreateOutput = { readonly location: Location.Info; readonly data: Pty.Info } export type PtyCreateOperation = (input?: PtyCreateInput) => Effect.Effect export type PtyGetInput = { readonly ptyID: Pty.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type PtyGetOutput = { readonly location: Location.Info; readonly data: Pty.Info } export type PtyGetOperation = (input: PtyGetInput) => Effect.Effect export type PtyUpdateInput = { readonly ptyID: Pty.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly title?: string | undefined readonly size?: { readonly rows: number; readonly cols: number } | undefined } export type PtyUpdateOutput = { readonly location: Location.Info; readonly data: Pty.Info } export type PtyUpdateOperation = (input: PtyUpdateInput) => Effect.Effect export type PtyRemoveInput = { readonly ptyID: Pty.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type PtyRemoveOutput = void export type PtyRemoveOperation = (input: PtyRemoveInput) => Effect.Effect export type PtyConnectTokenInput = { readonly ptyID: Pty.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly "x-opencode-ticket"?: string | undefined } export type PtyConnectTokenOutput = { readonly location: Location.Info; readonly data: PtyTicket.ConnectToken } export type PtyConnectTokenOperation = ( input: PtyConnectTokenInput, ) => Effect.Effect export interface PtyApi { readonly list: PtyListOperation readonly create: PtyCreateOperation readonly get: PtyGetOperation readonly update: PtyUpdateOperation readonly remove: PtyRemoveOperation readonly connect: { readonly token: PtyConnectTokenOperation } } export type ExperimentalPersistentPtyReadInput = { readonly sessionID: Session.ID; readonly lines?: number | undefined } export type ExperimentalPersistentPtyReadOutput = { readonly ptyID: Pty.ID readonly title: string readonly cwd: string readonly foregroundProcess: string | null readonly screen: { readonly text: string readonly cols: number readonly rows: number readonly cursor: { readonly x: number; readonly y: number } } } | null export type ExperimentalPersistentPtyReadOperation = ( input: ExperimentalPersistentPtyReadInput, ) => Effect.Effect export type ExperimentalPersistentPtyListInput = { readonly sessionID: Session.ID } export type ExperimentalPersistentPtyListOutput = ReadonlyArray<{ readonly id: Pty.ID readonly title: string readonly command: string readonly args: ReadonlyArray readonly cwd: string readonly status: "running" | "exited" readonly pid: number readonly exitCode?: number | undefined readonly sessionID: Session.ID readonly foregroundProcess: string | null readonly size: { readonly cols: number; readonly rows: number } readonly output: { readonly head: number; readonly tail: number } }> export type ExperimentalPersistentPtyListOperation = ( input: ExperimentalPersistentPtyListInput, ) => Effect.Effect export type ExperimentalPersistentPtyCreateInput = { readonly sessionID: Session.ID readonly command?: string | undefined readonly args: ReadonlyArray readonly cwd?: string | undefined readonly title: string readonly env: { readonly [x: string]: string } readonly size?: { readonly cols: number; readonly rows: number } | undefined } export type ExperimentalPersistentPtyCreateOutput = { readonly id: Pty.ID readonly title: string readonly command: string readonly args: ReadonlyArray readonly cwd: string readonly status: "running" | "exited" readonly pid: number readonly exitCode?: number | undefined readonly sessionID: Session.ID readonly foregroundProcess: string | null readonly size: { readonly cols: number; readonly rows: number } readonly output: { readonly head: number; readonly tail: number } } export type ExperimentalPersistentPtyCreateOperation = ( input: ExperimentalPersistentPtyCreateInput, ) => Effect.Effect export type ExperimentalPersistentPtyShutdownOutput = void export type ExperimentalPersistentPtyShutdownOperation = () => Effect.Effect< ExperimentalPersistentPtyShutdownOutput, E > export type ExperimentalPersistentPtyHandoffOutput = { readonly handoff: { readonly directory: string readonly instanceID: string readonly ticket: string readonly expiresAt: number } | null } export type ExperimentalPersistentPtyHandoffOperation = () => Effect.Effect< ExperimentalPersistentPtyHandoffOutput, E > export type ExperimentalPersistentPtyGetInput = { readonly ptyID: Pty.ID } export type ExperimentalPersistentPtyGetOutput = { readonly id: Pty.ID readonly title: string readonly command: string readonly args: ReadonlyArray readonly cwd: string readonly status: "running" | "exited" readonly pid: number readonly exitCode?: number | undefined readonly sessionID: Session.ID readonly foregroundProcess: string | null readonly size: { readonly cols: number; readonly rows: number } readonly output: { readonly head: number; readonly tail: number } } export type ExperimentalPersistentPtyGetOperation = ( input: ExperimentalPersistentPtyGetInput, ) => Effect.Effect export type ExperimentalPersistentPtyUpdateInput = { readonly ptyID: Pty.ID readonly attachmentID?: string | undefined readonly size: { readonly cols: number; readonly rows: number } } export type ExperimentalPersistentPtyUpdateOutput = { readonly id: Pty.ID readonly title: string readonly command: string readonly args: ReadonlyArray readonly cwd: string readonly status: "running" | "exited" readonly pid: number readonly exitCode?: number | undefined readonly sessionID: Session.ID readonly foregroundProcess: string | null readonly size: { readonly cols: number; readonly rows: number } readonly output: { readonly head: number; readonly tail: number } } export type ExperimentalPersistentPtyUpdateOperation = ( input: ExperimentalPersistentPtyUpdateInput, ) => Effect.Effect export type ExperimentalPersistentPtySnapshotInput = { readonly ptyID: Pty.ID } export type ExperimentalPersistentPtySnapshotOutput = { readonly info: { readonly id: Pty.ID readonly title: string readonly command: string readonly args: ReadonlyArray readonly cwd: string readonly status: "running" | "exited" readonly pid: number readonly exitCode?: number | undefined readonly sessionID: Session.ID readonly foregroundProcess: string | null readonly size: { readonly cols: number; readonly rows: number } readonly output: { readonly head: number; readonly tail: number } } readonly text: string readonly checkpoint: globalThis.Uint8Array readonly cursor: { readonly x: number; readonly y: number } } export type ExperimentalPersistentPtySnapshotOperation = ( input: ExperimentalPersistentPtySnapshotInput, ) => Effect.Effect export type ExperimentalPersistentPtyRemoveInput = { readonly ptyID: Pty.ID } export type ExperimentalPersistentPtyRemoveOutput = void export type ExperimentalPersistentPtyRemoveOperation = ( input: ExperimentalPersistentPtyRemoveInput, ) => Effect.Effect export type ExperimentalPersistentPtyConnectTokenInput = { readonly ptyID: Pty.ID readonly "x-opencode-ticket"?: string | undefined } export type ExperimentalPersistentPtyConnectTokenOutput = PtyTicket.ConnectToken export type ExperimentalPersistentPtyConnectTokenOperation = ( input: ExperimentalPersistentPtyConnectTokenInput, ) => Effect.Effect export interface ExperimentalApi { readonly persistentPty: { readonly read: ExperimentalPersistentPtyReadOperation readonly list: ExperimentalPersistentPtyListOperation readonly create: ExperimentalPersistentPtyCreateOperation readonly shutdown: ExperimentalPersistentPtyShutdownOperation readonly handoff: ExperimentalPersistentPtyHandoffOperation readonly get: ExperimentalPersistentPtyGetOperation readonly update: ExperimentalPersistentPtyUpdateOperation readonly snapshot: ExperimentalPersistentPtySnapshotOperation readonly remove: ExperimentalPersistentPtyRemoveOperation readonly connectToken: ExperimentalPersistentPtyConnectTokenOperation } } export type ShellListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ShellListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type ShellListOperation = (input?: ShellListInput) => Effect.Effect export type ShellCreateInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly command: string readonly cwd?: string | undefined readonly timeout: number readonly metadata?: { readonly [x: string]: unknown } | undefined } export type ShellCreateOutput = { readonly location: Location.Info; readonly data: Shell.Info } export type ShellCreateOperation = (input: ShellCreateInput) => Effect.Effect export type ShellGetInput = { readonly id: Shell.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ShellGetOutput = { readonly location: Location.Info; readonly data: Shell.Info } export type ShellGetOperation = (input: ShellGetInput) => Effect.Effect export type ShellTimeoutInput = { readonly id: Shell.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly timeout: number } export type ShellTimeoutOutput = { readonly location: Location.Info; readonly data: Shell.Info } export type ShellTimeoutOperation = (input: ShellTimeoutInput) => Effect.Effect export type ShellOutputInput = { readonly id: Shell.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly cursor?: number | undefined readonly limit?: number | undefined } export type ShellOutputOutput = { readonly location: Location.Info readonly data: { readonly output: string readonly cursor: number readonly size: number readonly truncated: boolean } } export type ShellOutputOperation = (input: ShellOutputInput) => Effect.Effect export type ShellRemoveInput = { readonly id: Shell.ID readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ShellRemoveOutput = void export type ShellRemoveOperation = (input: ShellRemoveInput) => Effect.Effect export interface ShellApi { readonly list: ShellListOperation readonly create: ShellCreateOperation readonly get: ShellGetOperation readonly timeout: ShellTimeoutOperation readonly output: ShellOutputOperation readonly remove: ShellRemoveOperation } export type ReferenceListInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ReferenceListOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type ReferenceListOperation = (input?: ReferenceListInput) => Effect.Effect export interface ReferenceApi { readonly list: ReferenceListOperation } export type WorktreeListInput = { readonly projectID: Project.ID } export type WorktreeListOutput = Worktree.List export type WorktreeListOperation = (input: WorktreeListInput) => Effect.Effect export type WorktreeCreateInput = { readonly projectID: Project.ID readonly strategy: Worktree.StrategyID readonly from?: AbsolutePath | undefined readonly branch?: string | undefined readonly directory: AbsolutePath readonly name?: string | undefined } export type WorktreeCreateOutput = Worktree.Info export type WorktreeCreateOperation = (input: WorktreeCreateInput) => Effect.Effect export type WorktreeRemoveInput = { readonly projectID: Project.ID readonly directory: AbsolutePath readonly force: boolean } export type WorktreeRemoveOutput = void export type WorktreeRemoveOperation = (input: WorktreeRemoveInput) => Effect.Effect export type WorktreeRefreshInput = { readonly projectID: Project.ID } export type WorktreeRefreshOutput = void export type WorktreeRefreshOperation = ( input: WorktreeRefreshInput, ) => Effect.Effect export interface WorktreeApi { readonly list: WorktreeListOperation readonly create: WorktreeCreateOperation readonly remove: WorktreeRemoveOperation readonly refresh: WorktreeRefreshOperation } export type WorkspaceCreateInput = { readonly id?: Workspace.ID | undefined; readonly provider: string } export type WorkspaceCreateOutput = Workspace.ID export type WorkspaceCreateOperation = ( input: WorkspaceCreateInput, ) => Effect.Effect export type WorkspaceDestroyInput = { readonly workspaceID: Workspace.ID } export type WorkspaceDestroyOutput = Workspace.DestroyResult export type WorkspaceDestroyOperation = ( input: WorkspaceDestroyInput, ) => Effect.Effect export interface WorkspaceApi { readonly create: WorkspaceCreateOperation readonly destroy: WorkspaceDestroyOperation } export type VcsGetInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type VcsGetOutput = { readonly location: Location.Info; readonly data: Vcs.Info } export type VcsGetOperation = (input?: VcsGetInput) => Effect.Effect export type VcsBaseInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type VcsBaseOutput = { readonly location: Location.Info; readonly data: Vcs.Base | null } export type VcsBaseOperation = (input?: VcsBaseInput) => Effect.Effect export type VcsStatusInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type VcsStatusOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type VcsStatusOperation = (input?: VcsStatusInput) => Effect.Effect export type VcsBranchesInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly search?: string | undefined readonly limit?: number | undefined } export type VcsBranchesOutput = { readonly location: Location.Info; readonly data: Vcs.BranchList } export type VcsBranchesOperation = (input?: VcsBranchesInput) => Effect.Effect export type VcsDiffInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly mode: Vcs.Mode readonly base?: string | undefined readonly context?: number | undefined } export type VcsDiffOutput = { readonly location: Location.Info; readonly data: ReadonlyArray } export type VcsDiffOperation = (input: VcsDiffInput) => Effect.Effect export interface VcsApi { readonly get: VcsGetOperation readonly base: VcsBaseOperation readonly status: VcsStatusOperation readonly branches: VcsBranchesOperation readonly diff: VcsDiffOperation } export type DebugLocationListOutput = ReadonlyArray export type DebugLocationListOperation = () => Effect.Effect export type DebugLocationEvictInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type DebugLocationEvictOutput = void export type DebugLocationEvictOperation = ( input?: DebugLocationEvictInput, ) => Effect.Effect export interface DebugApi { readonly location: { readonly list: DebugLocationListOperation; readonly evict: DebugLocationEvictOperation } } export type MigrationV1StatusOutput = | { readonly status: "required" | "completed" } | { readonly status: "running" readonly progress: { readonly label: string readonly numerator?: number | undefined readonly denominator?: number | undefined } } | { readonly status: "error"; readonly error: string } export type MigrationV1StatusOperation = () => Effect.Effect export interface MigrationApi { readonly v1: { readonly status: MigrationV1StatusOperation } } export type WebsearchProvidersInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type WebsearchProvidersOutput = { readonly location: Location.Info readonly data: ReadonlyArray } export type WebsearchProvidersOperation = ( input?: WebsearchProvidersInput, ) => Effect.Effect export type WebsearchQueryInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined readonly query: string readonly providerID?: WebSearch.ID | undefined } export type WebsearchQueryOutput = { readonly location: Location.Info; readonly data: WebSearch.Response } export type WebsearchQueryOperation = (input: WebsearchQueryInput) => Effect.Effect export interface WebsearchApi { readonly providers: WebsearchProvidersOperation readonly query: WebsearchQueryOperation } export type ConfigGetInput = { readonly location?: { readonly directory?: string | undefined; readonly workspace?: string | undefined } | undefined } export type ConfigGetOutput = ReadonlyArray export type ConfigGetOperation = (input?: ConfigGetInput) => Effect.Effect export interface ConfigApi { readonly get: ConfigGetOperation } export interface AppApi { readonly health: HealthApi readonly server: ServerApi readonly location: LocationApi readonly agent: AgentApi readonly plugin: PluginApi readonly session: SessionApi readonly message: MessageApi readonly model: ModelApi readonly generate: GenerateApi readonly provider: ProviderApi readonly integration: IntegrationApi readonly mcp: McpApi readonly credential: CredentialApi readonly project: ProjectApi readonly form: FormApi readonly permission: PermissionApi readonly file: FileApi readonly command: CommandApi readonly skill: SkillApi readonly event: EventApi readonly pty: PtyApi readonly experimental: ExperimentalApi readonly shell: ShellApi readonly reference: ReferenceApi readonly worktree: WorktreeApi readonly workspace: WorkspaceApi readonly vcs: VcsApi readonly debug: DebugApi readonly migration: MigrationApi readonly websearch: WebsearchApi readonly config: ConfigApi }