/**
 * Generated by scripts/gen-cordis-api.ts — do not edit by hand; run
 * `pnpm run gen-cordis-api` to regenerate (freshness-gated by
 * `pnpm run verify-cordis-api` in doc-sync).
 *
 * The machine-readable cordis API catalog `cordis_inspect` serves to the
 * model: harness services (summary + public method signatures), harness
 * events (mode + signature), and the inherited `ctx` surface. Produced by
 * the same AST walk as docs/cordis-catalog, so this data and the rendered
 * docs cannot diverge.
 *
 * @module @deepseek-ai/dsh-tool-cordis/api-catalog
 */

/** One harness `ctx.<key>` service: its one-line summary and public method signatures. */
export interface ServiceApiEntry {
  /** The `ctx.<key>` name, e.g. `tools`. */
  key: string
  /** First sentence of the service class JSDoc. */
  summary: string
  /** Public method signatures, bodies stripped, in source order. */
  methods: readonly string[]
}

/** One harness event: its dispatch mode, exact signature, and one-line summary. */
export interface EventApiEntry {
  /** The scoped event name, e.g. `agent/status`. */
  name: string
  /** The dispatch mode from the declaration's `@mode` tag. */
  mode: string
  /** The exact listener signature, whitespace-normalized. */
  signature: string
  /** First sentence of the event JSDoc. */
  summary: string
}

/** One inherited (cordis core + loader/hmr/timer) `ctx` member group with its summary. */
export interface InheritedApiEntry {
  /** The `ctx` member name(s), e.g. `ctx.on / ctx.once`. */
  name: string
  /** One-line summary of what the member does. */
  summary: string
}

/** One named type shape the service signatures reference. */
export interface TypeApiEntry {
  /** The exported type/interface name, e.g. `BashRunResult`. */
  name: string
  /** The full declaration text, comments stripped. */
  declaration: string
}

/** Every harness `ctx.<key>` service, sorted by key. */
export const SERVICE_API: readonly ServiceApiEntry[] = [
  {
    key: 'agentLoop',
    summary: 'The agent-loop plugin (`ctx.agentLoop`): creates ReactLoopAgents, runs their loops, and registers them in `ctx.agents`.',
    methods: [
      'create(id: AgentId, options: AgentOptions = {}, meta: Pick<SessionHeader, \'cwd\'> = {}): ReactLoopAgent',
      'createAgent(options: CreateAgentOptions): AgentHandle',
      'async resume(options: ResumeAgentOptions): Promise<AgentHandle>',
    ],
  },
  {
    key: 'agents',
    summary: 'Agent registry (`ctx.agents`): tracks live agents so UI, hook, and orchestrator plugins can find them without depending on the concrete loop package.',
    methods: [
      'setFactory(factory: AgentFactory): () => void',
      'create(options: CreateAgentOptions): AgentHandle',
      'async resume(options: ResumeAgentOptions): Promise<AgentHandle>',
      'register(agent: Agent): () => void',
      'get(id: AgentId): Agent | undefined',
      'list(): Agent[]',
    ],
  },
  {
    key: 'approval',
    summary: 'The `ctx.approval` service: dispatches ApprovalRequests to the `approval/request` waterfall and audits every ask/outcome pair to the requesting agent\'s session log.',
    methods: [
      'async request(req: ApprovalRequest): Promise<ApprovalOutcome>',
    ],
  },
  {
    key: 'bash',
    summary: 'Abstract bash execution service.',
    methods: [
      'abstract resolve(request: BashExecRequest): BashExecSpec',
      'abstract run(spec: BashExecSpec): Promise<BashRunResult>',
      'abstract start(spec: BashExecSpec): BashTask',
      'abstract get(id: BashTaskId): BashTask | undefined',
      'abstract ownerOf(id: BashTaskId): OwnerToken | undefined',
      'abstract list(): BashTask[]',
      'abstract readOutput(id: BashTaskId): BashTaskRead',
      'abstract kill(id: BashTaskId): boolean',
      'onTaskDone(listener: BashTaskListener): () => void',
    ],
  },
  {
    key: 'codeRuntime',
    summary: 'Abstract code-execution service.',
    methods: [
      'abstract run(request: CodeRunRequest): Promise<CodeRunResult>',
    ],
  },
  {
    key: 'compact',
    summary: 'Abstract compaction service.',
    methods: [
      'abstract compactIfNeeded( agent: CompactAgentContext, fullSystemPrompt: string, sessionPrefix: readonly Message[], signal: AbortSignal, ): Promise<CompactionResult | null>',
      'abstract compactRegion( session: Session, start: number, end: number, agent: CompactAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>',
    ],
  },
  {
    key: 'fs',
    summary: 'Abstract filesystem provider service.',
    methods: [
      'abstract resolve(path: string, opts?: { cwd?: string }): Promise<FsTarget>',
      'abstract stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>',
      'abstract readText(target: FsTarget, signal?: AbortSignal): Promise<string>',
      'abstract streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>>',
      'abstract listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>',
      'abstract writeText(target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal): Promise<FsWriteOutcome>',
      'abstract editText(target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal): Promise<FsEditOutcome>',
    ],
  },
  {
    key: 'llm',
    summary: 'The abstract `llm` service: an adapter registry plus a streaming model-call surface, interceptable via the `llm/stream` waterfall.',
    methods: [
      'registerAdapter(models: string[], adapter: LlmAdapter): () => void',
      'models(): string[]',
      'stream(options: GenerateOptions): AsyncIterable<StreamChunk>',
    ],
  },
  {
    key: 'sandbox',
    summary: 'Abstract process-sandbox service.',
    methods: [
      'abstract confine(argv: readonly string[], policy: SandboxPolicy): ConfinedArgv',
    ],
  },
  {
    key: 'sessionPersistence',
    summary: 'Abstract durable session-persistence service.',
    methods: [
      'abstract create(meta: SessionHeader): Promise<void>',
      'abstract append(id: SessionId, events: readonly SessionEvent[]): Promise<void>',
      'abstract load(id: SessionId): Promise<{ meta: SessionHeader; events: SessionEvent[] }>',
      'abstract list(): Promise<SessionHeader[]>',
    ],
  },
  {
    key: 'sessions',
    summary: 'In-memory session store (`ctx.sessions`).',
    methods: [
      'create(id?: SessionId, options?: CreateSessionOptions): Session',
      'prepare(id?: SessionId, options?: CreateSessionOptions): Session',
      'enter(session: Session): () => void',
      'announce(session: Session): void',
      'get(id: SessionId): Session | undefined',
      'list(): Session[]',
      'fork(source: SessionForkSource, boundary?: number, childSessionId?: SessionId): Session',
    ],
  },
  {
    key: 'skills',
    summary: 'Registry of skill providers.',
    methods: [
      'registerProvider(provider: SkillProvider): () => void',
      'register(skill: SkillRegistration): () => void',
      'async list(options: SkillLookupOptions = {}): Promise<SkillSummary[]>',
      'async get(name: string, options: SkillLookupOptions = {}): Promise<SkillDefinition | undefined>',
    ],
  },
  {
    key: 'subagents',
    summary: 'The `subagents` service: a registry of named SubagentProviders and a capability-checked start surface.',
    methods: [
      'registerProvider(provider: SubagentProvider): () => void',
      'getProvider(name: string): SubagentProvider | undefined',
      'list(): string[]',
      'start(name: string, request: SubagentStartRequest): SubagentRun',
    ],
  },
  {
    key: 'systemPrompt',
    summary: 'Registry service (`ctx.systemPrompt`): plugins contribute ordered text sections, tool-schema providers, and named prompt variables; the agent loop calls `assemble(context)` once per step.',
    methods: [
      'section(section: PromptSection): () => void',
      'tools(provider: () => ToolSchema[]): () => void',
      'variable(name: string, provider: (context: AssembleContext) => string | undefined): () => void',
      'async assemble(context: AssembleContext = {}): Promise<PromptAssembly>',
    ],
  },
  {
    key: 'tools',
    summary: 'Tool registry (`ctx.tools`): tool plugins register definitions; the agent loop executes calls through the `tools/pre-execute` → `tools/execute` → `tools/post-execute` pipeline.',
    methods: [
      'register(definition: ToolDefinition): () => void',
      'get(name: string): ToolDefinition | undefined',
      'schemas(): ToolSchema[]',
      'async execute(exec: ToolExecution): Promise<ToolExecutionResult>',
    ],
  },
  {
    key: 'userInteraction',
    summary: '`ctx.userInteraction`: one active UI provider plus an `ask()` surface.',
    methods: [
      'registerProvider(provider: UserInteractionProvider): () => void',
      'async ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>',
    ],
  },
  {
    key: 'web',
    summary: 'The web access service.',
    methods: [
      'registerSearchProvider(provider: WebSearchProvider): () => void',
      'registerFetchProvider(provider: WebFetchProvider): () => void',
      'async search(request: WebSearchRequest, exec?: WebExecContext): Promise<WebSearchResult>',
      'async fetch(request: WebFetchRequest, exec?: WebExecContext): Promise<WebFetchResult>',
    ],
  },
  {
    key: 'workflows',
    summary: 'Abstract workflow execution service.',
    methods: [
      'abstract start(request: WorkflowStartRequest): WorkflowRun',
    ],
  },
]

/** Every harness event, sorted by name. */
export const EVENT_API: readonly EventApiEntry[] = [
  {
    name: 'agent/created',
    mode: 'emit',
    signature: '\'agent/created\'(agent: Agent): void',
    summary: 'An agent was registered in the AgentRegistry and is ready to receive messages.',
  },
  {
    name: 'agent/disposed',
    mode: 'emit',
    signature: '\'agent/disposed\'(agent: Agent): void',
    summary: 'An agent was disposed and removed from the registry; its fiber and any in-flight turn have been torn down.',
  },
  {
    name: 'agent/error',
    mode: 'emit',
    signature: '\'agent/error\'(agent: Agent, turn: number, step: number, error: Error): void',
    summary: 'A step or turn errored.',
  },
  {
    name: 'agent/pre-step',
    mode: 'serial',
    signature: '\'agent/pre-step\'(agent: Agent, turn: number, step: number, fullSystemPrompt: string, sessionPrefix: readonly Message[], signal: AbortSignal): Promise<void> | void',
    summary: 'Awaited pre-step surface-mutation checkpoint, fired once per step AFTER `turn/start` (and after the prior step closed) but BEFORE this step\'s `step/start` — so anything a listener appends lands OUTSIDE the step, between `turn/start`/`step/end` and the upcoming `step/start`.',
  },
  {
    name: 'agent/prompt-submit',
    mode: 'waterfall',
    signature: '\'agent/prompt-submit\'(agent: Agent, content: ContentBlock[], source: MessageSource, next: () => Promise<PromptDecision>): Promise<PromptDecision>',
    summary: 'Waterfall: decide what happens to ONE drained queued message before it becomes a `user/message` — allow (optionally rewriting the prompt bytes or attaching `additionalContext`) or block it.',
  },
  {
    name: 'agent/queued',
    mode: 'emit',
    signature: '\'agent/queued\'(agent: Agent, content: ContentBlock[], info: { source: MessageSource; steering: boolean }): void',
    summary: 'A message entered the agent\'s inbox (queued or steering).',
  },
  {
    name: 'agent/request',
    mode: 'waterfall',
    signature: '\'agent/request\'(agent: Agent, turn: number, step: number, config: LlmCallConfig, next: () => Promise<LlmCallConfig>): Promise<LlmCallConfig>',
    summary: 'Waterfall: shape the step\'s call configuration — model switching, sampling overrides — by returning a replacement LlmCallConfig (the frozen seed is the config the loop would otherwise use).',
  },
  {
    name: 'agent/session-prefix',
    mode: 'waterfall',
    signature: '\'agent/session-prefix\'(agent: Agent, prefix: Message[], signal: AbortSignal, next: () => Promise<Message[]>): Promise<Message[]>',
    summary: 'Waterfall: compose the SESSION PREFIX — request-only messages placed in front of the ENTIRE derived history (directly after the provider\'s system slot) on every request this loop instance sends.',
  },
  {
    name: 'agent/session-start',
    mode: 'emit',
    signature: '\'agent/session-start\'(agent: Agent, source: SessionStartSource): void',
    summary: 'The agent\'s session lifecycle began, fired once before its first turn.',
  },
  {
    name: 'agent/status',
    mode: 'emit',
    signature: '\'agent/status\'(agent: Agent, status: AgentStatus): void',
    summary: 'Agent status changed (`idle` ⇄ `running`, or → `disposed`).',
  },
  {
    name: 'agent/step-result',
    mode: 'waterfall',
    signature: '\'agent/step-result\'(agent: Agent, turn: number, step: number, message: Message, next: () => Promise<Message>): Promise<Message>',
    summary: 'Waterfall: post-process the assembled assistant Message before tool dispatch (validation, content rewriting, …).',
  },
  {
    name: 'agent/turn-continuation',
    mode: 'waterfall',
    signature: '\'agent/turn-continuation\'(agent: Agent, turn: number, defaultDecision: ContinuationDecision, next: () => Promise<ContinuationDecision>): Promise<ContinuationDecision>',
    summary: 'Waterfall: override the turn-continuation decision via a typed ContinuationDecision.',
  },
  {
    name: 'approval/request',
    mode: 'waterfall',
    signature: '\'approval/request\'(this: ApprovalService, req: ApprovalRequest, next: () => Promise<ApprovalOutcome>): Promise<ApprovalOutcome>',
    summary: 'Waterfall asking the composed answerers to decide one approval request.',
  },
  {
    name: 'fs/edit-intent',
    mode: 'waterfall',
    signature: '\'fs/edit-intent\'(target: FsTarget, actor: object | undefined, next: () => { version: FsVersion } | undefined | Promise<{ version: FsVersion } | undefined>): Promise<{ version: FsVersion } | undefined>',
    summary: 'Single-slot decision: produce the optional version guard for the next FileSystem.editText.',
  },
  {
    name: 'fs/observed',
    mode: 'emit',
    signature: '\'fs/observed\'(target: FsTarget, version: FsVersion, actor: object | undefined): void',
    summary: 'Record that an actor observed a target at a version, after a successful read/write/edit.',
  },
  {
    name: 'fs/write-intent',
    mode: 'waterfall',
    signature: '\'fs/write-intent\'(target: FsTarget, actor: object | undefined, next: () => FsWriteIntent | undefined | Promise<FsWriteIntent | undefined>): Promise<FsWriteIntent | undefined>',
    summary: 'Single-slot decision: produce the write intent for the next FileSystem.writeText.',
  },
  {
    name: 'llm/stream',
    mode: 'waterfall',
    signature: '\'llm/stream\'(this: LlmService, options: GenerateOptions, next: () => AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>',
    summary: 'Waterfall around every streaming model call (retry, replay, routing).',
  },
  {
    name: 'session/created',
    mode: 'emit',
    signature: '\'session/created\'(session: Session): void',
    summary: 'A session was created in the store.',
  },
  {
    name: 'session/event',
    mode: 'emit',
    signature: '\'session/event\'(session: Session, event: SessionEvent): void',
    summary: 'An event was appended to a session log (sync, fire-and-forget).',
  },
  {
    name: 'session/flush',
    mode: 'parallel',
    signature: '\'session/flush\'(session: Session): Promise<void> | void',
    summary: 'Awaited durability checkpoint.',
  },
  {
    name: 'skill/provider-added',
    mode: 'emit',
    signature: '\'skill/provider-added\'(provider: SkillProvider): void',
    summary: 'A skill provider became resolvable in the `ctx.skills` registry.',
  },
  {
    name: 'skill/provider-removed',
    mode: 'emit',
    signature: '\'skill/provider-removed\'(name: string): void',
    summary: 'A skill provider left the registry because its plugin fiber was disposed.',
  },
  {
    name: 'subagent/end',
    mode: 'emit',
    signature: '\'subagent/end\'(info: SubagentRunEndInfo): void',
    summary: 'A subagent run settled — emitted when SubagentRun.result resolves (any stop reason).',
  },
  {
    name: 'subagent/provider-added',
    mode: 'emit',
    signature: '\'subagent/provider-added\'(provider: SubagentProvider): void',
    summary: 'A provider became resolvable in the SubagentService registry.',
  },
  {
    name: 'subagent/provider-removed',
    mode: 'emit',
    signature: '\'subagent/provider-removed\'(name: string): void',
    summary: 'A provider left the registry (its plugin\'s fiber was disposed — an unload or an HMR reload).',
  },
  {
    name: 'subagent/start',
    mode: 'emit',
    signature: '\'subagent/start\'(info: SubagentRunInfo): void',
    summary: 'A subagent run started — emitted after the provider is resolved and its capabilities validated, as the child run begins.',
  },
  {
    name: 'system-prompt/assemble',
    mode: 'waterfall',
    signature: '\'system-prompt/assemble\'(this: SystemPrompt, assembly: PromptAssembly, context: AssembleContext, next: () => Promise<PromptAssembly>): Promise<PromptAssembly>',
    summary: 'Waterfall around prompt assembly — mutate or extend the PromptAssembly (sections + tools + variables) before it is rendered.',
  },
  {
    name: 'system-prompt/change',
    mode: 'emit',
    signature: '\'system-prompt/change\'(): void',
    summary: 'A section, tool provider, or variable provider was registered or unregistered (the assembly inputs changed).',
  },
  {
    name: 'tools/change',
    mode: 'emit',
    signature: '\'tools/change\'(): void',
    summary: 'A tool was registered or unregistered (the available tool set changed).',
  },
  {
    name: 'tools/execute',
    mode: 'waterfall',
    signature: '\'tools/execute\'(this: ToolRegistry, exec: ToolExecution, next: () => Promise<ToolExecutionResult>): Promise<ToolExecutionResult>',
    summary: 'Around-dispatch waterfall wrapping the registry\'s core tool dispatch, between the `tools/pre-execute` gate and the `tools/post-execute` seam.',
  },
  {
    name: 'tools/post-execute',
    mode: 'waterfall',
    signature: '\'tools/post-execute\'(this: ToolRegistry, exec: ToolExecution, result: ToolExecutionResult, next: () => Promise<PostToolDecision>): Promise<PostToolDecision>',
    summary: 'Waterfall AFTER a tool runs — where hook plugins inspect the result and accept it (optionally REPLACING the model-facing content, and/or attaching `additionalContext` for the next request) or block it with corrective `feedback` (Claude Code\'s `PostToolUse`).',
  },
  {
    name: 'tools/pre-execute',
    mode: 'waterfall',
    signature: '\'tools/pre-execute\'(this: ToolRegistry, exec: ToolExecution, next: () => Promise<PreToolDecision>): Promise<PreToolDecision>',
    summary: 'Waterfall BEFORE a tool runs — the gate where sandbox, permission, and hook plugins allow or deny a call (Claude Code\'s `PreToolUse`).',
  },
  {
    name: 'workflow/agent-end',
    mode: 'emit',
    signature: '\'workflow/agent-end\'(info: WorkflowRunInfo, agent: WorkflowAgentEndInfo): void',
    summary: 'One `agent()` call settled (clean result, child failure, or run cancellation).',
  },
  {
    name: 'workflow/agent-start',
    mode: 'emit',
    signature: '\'workflow/agent-start\'(info: WorkflowRunInfo, agent: WorkflowAgentInfo): void',
    summary: 'One `agent()` call started a child run.',
  },
  {
    name: 'workflow/end',
    mode: 'emit',
    signature: '\'workflow/end\'(info: WorkflowRunInfo, result: WorkflowResultInfo): void',
    summary: 'A workflow run settled (any stop reason).',
  },
  {
    name: 'workflow/log',
    mode: 'emit',
    signature: '\'workflow/log\'(info: WorkflowRunInfo, message: string): void',
    summary: 'The script emitted a narration line (a `log(message)` call).',
  },
  {
    name: 'workflow/phase',
    mode: 'emit',
    signature: '\'workflow/phase\'(info: WorkflowRunInfo, title: string): void',
    summary: 'The script entered a phase (a `phase(title)` call) — progress grouping for observers; no execution semantics.',
  },
  {
    name: 'workflow/start',
    mode: 'emit',
    signature: '\'workflow/start\'(info: WorkflowRunInfo): void',
    summary: 'A workflow run started — the script\'s meta block validated, the body about to execute.',
  },
]

/** Shapes of every exported type the SERVICE_API signatures reference (transitively), sorted by name. */
export const TYPE_API: readonly TypeApiEntry[] = [
  {
    name: 'Agent',
    declaration: 'export interface Agent {\n    readonly id: AgentId;\n    readonly options: AgentOptions;\n    readonly session: Session;\n    readonly status: AgentStatus;\n    send(content: ContentBlock[], options?: SendOptions): void;\n    steer(content: ContentBlock[], options?: SendOptions): void;\n    inject(content: ContentBlock[], options?: SendOptions): void;\n    cancel(reason?: string): void;\n    whenIdle(): Promise<void>;\n}',
  },
  {
    name: 'AgentFactory',
    declaration: 'export interface AgentFactory {\n    createAgent(options: CreateAgentOptions): AgentHandle;\n    resume(options: ResumeAgentOptions): Promise<AgentHandle>;\n}',
  },
  {
    name: 'AgentHandle',
    declaration: 'export interface AgentHandle {\n    agent: Agent;\n    dispose(): Promise<void>;\n}',
  },
  {
    name: 'AgentId',
    declaration: 'export type AgentId = Branded<\'AgentId\'>;',
  },
  {
    name: 'AgentOptions',
    declaration: 'export interface AgentOptions {\n    model?: string;\n}',
  },
  {
    name: 'AgentStatus',
    declaration: 'export type AgentStatus = \'idle\' | \'running\' | \'disposed\';',
  },
  {
    name: 'ApprovalOutcome',
    declaration: 'export type ApprovalOutcome = \'allowed-once\' | \'rejected\' | \'cancelled\' | \'unavailable\';',
  },
  {
    name: 'ApprovalRequest',
    declaration: 'export interface ApprovalRequest {\n    agent: Agent;\n    toolName: string;\n    callId?: CallId;\n    reason?: string;\n    signal?: AbortSignal;\n}',
  },
  {
    name: 'AskUserQuestionAnswer',
    declaration: 'export interface AskUserQuestionAnswer {\n    answers: AskUserQuestionAnswerItem[];\n}',
  },
  {
    name: 'AskUserQuestionAnswerItem',
    declaration: 'export interface AskUserQuestionAnswerItem {\n    id: string;\n    selected: string[];\n    custom?: string;\n}',
  },
  {
    name: 'AskUserQuestionItem',
    declaration: 'export interface AskUserQuestionItem {\n    id: string;\n    question: string;\n    header?: string;\n    options?: AskUserQuestionOption[];\n    multiSelect?: boolean;\n}',
  },
  {
    name: 'AskUserQuestionOption',
    declaration: 'export interface AskUserQuestionOption {\n    label: string;\n    description?: string;\n}',
  },
  {
    name: 'AskUserQuestionRequest',
    declaration: 'export interface AskUserQuestionRequest {\n    questions: AskUserQuestionItem[];\n    agent?: Agent;\n    signal?: AbortSignal;\n}',
  },
  {
    name: 'AssembleContext',
    declaration: 'export interface AssembleContext {\n}',
  },
  {
    name: 'AssembledSection',
    declaration: 'export interface AssembledSection {\n    name: string;\n    order: number;\n    text: string;\n}',
  },
  {
    name: 'BashExecRequest',
    declaration: 'export interface BashExecRequest {\n    command: string;\n    workdir?: string | undefined;\n    timeoutMs?: number | undefined;\n    signal?: AbortSignal | undefined;\n    stdin?: string | undefined;\n    env?: Record<string, string> | undefined;\n    owner?: OwnerToken | undefined;\n    sandboxMode?: SandboxMode | undefined;\n}',
  },
  {
    name: 'BashExecSpec',
    declaration: 'export interface BashExecSpec {\n    command: string;\n    workdir: string;\n    timeoutMs: number;\n    signal?: AbortSignal | undefined;\n    stdin?: string | undefined;\n    env?: Record<string, string> | undefined;\n    owner: OwnerToken | undefined;\n    sandboxMode: SandboxMode | undefined;\n}',
  },
  {
    name: 'BashRunResult',
    declaration: 'export interface BashRunResult {\n    exitCode: number | null;\n    signal: NodeJS.Signals | null;\n    timedOut: boolean;\n    aborted: boolean;\n    timeoutMs: number;\n    stdout: CollectedOutput;\n    stderr: CollectedOutput;\n    sandbox?: BashSandboxInfo;\n}',
  },
  {
    name: 'BashSandboxInfo',
    declaration: 'export interface BashSandboxInfo {\n    mode: SandboxMode;\n    denied: boolean;\n    enforcement?: SandboxEnforcement;\n    runnerFailed?: boolean;\n}',
  },
  {
    name: 'BashTask',
    declaration: 'export interface BashTask {\n    readonly id: BashTaskId;\n    readonly command: string;\n    status: BashTaskStatus;\n    exitCode: number | null;\n    signal: NodeJS.Signals | null;\n    readonly done: Promise<void>;\n    sandbox?: BashSandboxInfo;\n}',
  },
  {
    name: 'BashTaskId',
    declaration: 'export type BashTaskId = Branded<\'BashTaskId\'>;',
  },
  {
    name: 'BashTaskListener',
    declaration: 'export type BashTaskListener = (task: BashTask) => void;',
  },
  {
    name: 'BashTaskRead',
    declaration: 'export interface BashTaskRead {\n    task: BashTask;\n    delta: string;\n    lossy: boolean;\n    stdoutSpillPath?: string;\n    stderrSpillPath?: string;\n}',
  },
  {
    name: 'BashTaskStatus',
    declaration: 'export type BashTaskStatus = \'running\' | \'completed\' | \'killed\';',
  },
  {
    name: 'Branded',
    declaration: 'export type Branded<B extends string> = string & {\n    readonly [BRAND]: B;\n};',
  },
  {
    name: 'CallId',
    declaration: 'export type CallId = Branded<\'CallId\'>;',
  },
  {
    name: 'CodeBindingFunction',
    declaration: 'export type CodeBindingFunction = (args: unknown) => Promise<unknown>;',
  },
  {
    name: 'CodeBindingNamespace',
    declaration: 'export interface CodeBindingNamespace {\n    global: string;\n    functions: Record<string, CodeBindingFunction>;\n}',
  },
  {
    name: 'CodeLogEntry',
    declaration: 'export interface CodeLogEntry {\n    source: \'console\' | \'stdout\' | \'stderr\';\n    level?: \'log\' | \'info\' | \'warn\' | \'error\' | \'debug\';\n    text: string;\n}',
  },
  {
    name: 'CodeRunFailure',
    declaration: 'export interface CodeRunFailure {\n    kind: \'exception\' | \'timeout\' | \'abort\' | \'worker-exit\';\n    message: string;\n}',
  },
  {
    name: 'CodeRunRequest',
    declaration: 'export interface CodeRunRequest {\n    program: string;\n    bindings: CodeBindingNamespace[];\n    signal?: AbortSignal;\n}',
  },
  {
    name: 'CodeRunResult',
    declaration: 'export interface CodeRunResult {\n    value?: unknown;\n    logs: CodeLogEntry[];\n    error?: CodeRunFailure;\n}',
  },
  {
    name: 'CollectedOutput',
    declaration: 'export interface CollectedOutput {\n    text: string;\n    truncated: boolean;\n    spillPath?: string;\n}',
  },
  {
    name: 'CompactAgentContext',
    declaration: 'export interface CompactAgentContext {\n    session: Session;\n    options: {\n        model?: string;\n    };\n}',
  },
  {
    name: 'CompactionResult',
    declaration: 'export interface CompactionResult {\n    startSeq: number;\n    summarySeq: number;\n    endSeq: number;\n    summary: ContentBlock[];\n    shadowedRange: {\n        start: number;\n        end: number;\n    };\n    shadowedSeqs: number[];\n    shadowedTokenCount: number;\n}',
  },
  {
    name: 'ConfinedArgv',
    declaration: 'export interface ConfinedArgv {\n    argv: string[];\n    enforcement: SandboxEnforcement;\n    denialSignatures: readonly string[];\n    runnerFailureSignatures: readonly string[];\n}',
  },
  {
    name: 'ConfinedSandboxMode',
    declaration: 'export type ConfinedSandboxMode = Exclude<SandboxMode, \'danger-full-access\'>;',
  },
  {
    name: 'ContentBlockMap',
    declaration: 'export interface ContentBlockMap {\n    \'text\': TextBlock;\n    \'reasoning\': ReasoningBlock;\n    \'tool-call\': ToolCallBlock;\n    \'tool-result\': ToolResultBlock;\n}',
  },
  {
    name: 'ContentBlockType',
    declaration: 'export type ContentBlockType = keyof ContentBlockMap;',
  },
  {
    name: 'CreateAgentOptions',
    declaration: 'export interface CreateAgentOptions {\n    agentId: AgentId;\n    sessionId: SessionId;\n    meta?: {\n        cwd?: string;\n        parentSession?: SessionId;\n        seedLength?: number;\n    };\n    seed?: SessionEvent[];\n    agentOptions?: AgentOptions;\n}',
  },
  {
    name: 'CreateSessionOptions',
    declaration: 'export interface CreateSessionOptions {\n    seed?: SessionEvent[];\n    meta?: {\n        cwd?: string;\n        parentSession?: SessionId;\n        createdAt?: number;\n        seedLength?: number;\n    };\n}',
  },
  {
    name: 'DiffCallView',
    declaration: 'export interface DiffCallView {\n    card: \'diff\';\n    title: string;\n    diffs: FileDiff[];\n    locations?: FileLocation[];\n}',
  },
  {
    name: 'DiffResultView',
    declaration: 'export interface DiffResultView {\n    card: \'diff\';\n    title?: string;\n    diffs: FileDiff[];\n}',
  },
  {
    name: 'FileDiff',
    declaration: 'export interface FileDiff {\n    path: string;\n    oldText: string | null;\n    newText: string;\n}',
  },
  {
    name: 'FileLocation',
    declaration: 'export interface FileLocation {\n    path: string;\n    line?: number;\n}',
  },
  {
    name: 'FinishReason',
    declaration: 'export type FinishReason = FinishReasonMap[keyof FinishReasonMap];',
  },
  {
    name: 'FinishReasonMap',
    declaration: 'export interface FinishReasonMap {\n    \'stop\': {\n        kind: \'stop\';\n    };\n    \'tool-calls\': {\n        kind: \'tool-calls\';\n    };\n    \'max-tokens\': {\n        kind: \'max-tokens\';\n    };\n    \'aborted\': {\n        kind: \'aborted\';\n    };\n    \'error\': {\n        kind: \'error\';\n        message: string;\n        code?: string;\n    };\n}',
  },
  {
    name: 'FsDirEntry',
    declaration: 'export interface FsDirEntry {\n    name: string;\n    type: \'file\' | \'directory\' | \'other\';\n    target: FsTarget;\n    version?: FsVersion;\n    size?: number;\n}',
  },
  {
    name: 'FsEditOutcome',
    declaration: 'export interface FsEditOutcome {\n    version: FsVersion;\n    before: string;\n    after: string;\n}',
  },
  {
    name: 'FsEditRequest',
    declaration: 'export interface FsEditRequest {\n    oldString: string;\n    newString: string;\n    replaceAll: boolean;\n}',
  },
  {
    name: 'FsInfo',
    declaration: 'export interface FsInfo {\n    version: FsVersion;\n    type: \'file\' | \'directory\' | \'other\';\n    size?: number;\n}',
  },
  {
    name: 'FsTarget',
    declaration: 'export interface FsTarget {\n    targetKey: FsTargetKey;\n    displayPath: string;\n}',
  },
  {
    name: 'FsTargetKey',
    declaration: 'export type FsTargetKey = Branded<\'FsTargetKey\'>;',
  },
  {
    name: 'FsVersion',
    declaration: 'export type FsVersion = Branded<\'FsVersion\'>;',
  },
  {
    name: 'FsWriteIntent',
    declaration: 'export type FsWriteIntent = {\n    kind: \'createIfAbsent\';\n} | {\n    kind: \'replaceIfVersion\';\n    version: FsVersion;\n};',
  },
  {
    name: 'FsWriteOutcome',
    declaration: 'export interface FsWriteOutcome {\n    operation: \'create\' | \'update\';\n    version: FsVersion;\n    before: string | null;\n    after: string;\n}',
  },
  {
    name: 'GenerateOptions',
    declaration: 'export interface GenerateOptions {\n    model: string;\n    messages: Message[];\n    system?: string;\n    tools?: ToolSchema[];\n    temperature?: number;\n    maxTokens?: number;\n    stop?: string[];\n    signal?: AbortSignal;\n    sessionId?: Branded<\'SessionId\'>;\n}',
  },
  {
    name: 'GenericCallView',
    declaration: 'export interface GenericCallView {\n    card: \'generic\';\n    title: string;\n    kind?: ToolCallKind;\n    rawInput?: unknown;\n    content?: ContentBlock[];\n    locations?: FileLocation[];\n}',
  },
  {
    name: 'GenericResultView',
    declaration: 'export interface GenericResultView {\n    card: \'generic\';\n    title?: string;\n    content?: ContentBlock[];\n}',
  },
  {
    name: 'HookContext',
    declaration: 'export interface HookContext {\n    content: ContentBlock[];\n    source: MessageSource;\n}',
  },
  {
    name: 'Message',
    declaration: 'export interface Message {\n    role: \'system\' | \'user\' | \'assistant\';\n    content: ContentBlock[];\n}',
  },
  {
    name: 'MessageSource',
    declaration: 'export type MessageSource = MessageSourceMap[keyof MessageSourceMap];',
  },
  {
    name: 'MessageSourceMap',
    declaration: 'export interface MessageSourceMap {\n    user: {\n        kind: \'user\';\n    };\n    plugin: {\n        kind: \'plugin\';\n        plugin: string;\n    };\n}',
  },
  {
    name: 'OwnerToken',
    declaration: 'export type OwnerToken = Branded<\'OwnerToken\'>;',
  },
  {
    name: 'PromptAssembly',
    declaration: 'export interface PromptAssembly {\n    sections: AssembledSection[];\n    tools: ToolSchema[];\n    variables: Record<string, string | undefined>;\n}',
  },
  {
    name: 'PromptSection',
    declaration: 'export interface PromptSection {\n    name: string;\n    order: number;\n    text: string | ((context: AssembleContext) => string);\n}',
  },
  {
    name: 'ReasoningBlock',
    declaration: 'export interface ReasoningBlock {\n    type: \'reasoning\';\n    text: string;\n}',
  },
  {
    name: 'ResumeAgentOptions',
    declaration: 'export interface ResumeAgentOptions {\n    agentId: AgentId;\n    resumeSessionId: SessionId;\n    agentOptions?: AgentOptions;\n}',
  },
  {
    name: 'SandboxEnforcement',
    declaration: 'export type SandboxEnforcement = \'full\' | \'partial\';',
  },
  {
    name: 'SandboxMode',
    declaration: 'export type SandboxMode = \'read-only\' | \'workspace-write\' | \'danger-full-access\';',
  },
  {
    name: 'SandboxPolicy',
    declaration: 'export interface SandboxPolicy {\n    mode: ConfinedSandboxMode;\n    workspaceRoot: string;\n}',
  },
  {
    name: 'SendOptions',
    declaration: 'export interface SendOptions {\n    source?: MessageSource;\n}',
  },
  {
    name: 'SessionEvent',
    declaration: 'export type SessionEvent<T extends SessionEventType = SessionEventType> = {\n    [K in SessionEventType]: {\n        type: K;\n        seq: number;\n        time: number;\n        data: SessionEventMap[K];\n    } & (K extends SurfaceEventType ? {\n        sourceEventSeqs?: number[];\n        surfaceOp?: SurfaceOp;\n    } : object);\n}[T];',
  },
  {
    name: 'SessionEventMap',
    declaration: 'export interface SessionEventMap {\n    \'turn/start\': {\n        turn: number;\n        trigger: TurnTrigger;\n    };\n    \'turn/end\': {\n        turn: number;\n        reason: TurnEndReason;\n    };\n    \'step/start\': {\n        turn: number;\n        step: number;\n    };\n    \'step/end\': {\n        turn: number;\n        step: number;\n    };\n    \'user/message\': {\n        content: ContentBlock[];\n        source: MessageSource;\n    };\n    \'prompt/blocked\': {\n        content: ContentBlock[];\n        source: MessageSource;\n        reason: string;\n    };\n    \'context/message\': {\n        content: ContentBlock[];\n        source: MessageSource;\n    };\n    \'assistant/chunk\': {\n        turn: number;\n        step: number;\n        chunk: StreamChunk;\n    };\n    \'assistant/message\': {\n        turn: number;\n        step: number;\n        content: ContentBlock[];\n        usage?: TokenUsage;\n    };\n    \'tool/call\': {\n        turn: number;\n        step: number;\n        callId: CallId;\n        name: string;\n        arguments: string;\n    };\n    \'tool/result\': {\n        turn: number;\n        step: number;\n        callId: CallId;\n        content: ContentBlock[];\n        isError: boolean;\n        error?: {\n            name: string;\n            code: string;\n        };\n        meta?: unknown;\n    };\n    \'steering/message\': {\n        turn: number;\n        content: ContentBlock[];\n        source: MessageSource;\n    };\n    \'todo/write\': {\n        todos: TodoItem[];\n    };\n    \'request/header\': {\n        header: E /* …truncated — full shape in source */',
  },
  {
    name: 'SessionEventType',
    declaration: 'export type SessionEventType = keyof SessionEventMap;',
  },
  {
    name: 'SessionForkSource',
    declaration: 'export type SessionForkSource = Session | SessionId;',
  },
  {
    name: 'SessionHeader',
    declaration: 'export interface SessionHeader {\n    version: number;\n    id: SessionId;\n    createdAt: number;\n    cwd?: string;\n    parentSession?: SessionId;\n    seedLength?: number;\n}',
  },
  {
    name: 'SessionId',
    declaration: 'export type SessionId = Branded<\'SessionId\'>;',
  },
  {
    name: 'SkillCandidate',
    declaration: 'export interface SkillCandidate extends SkillSummary {\n    rank: number;\n    locator: unknown;\n    path?: string;\n    metadata?: Record<string, unknown>;\n}',
  },
  {
    name: 'SkillDefinition',
    declaration: 'export interface SkillDefinition extends SkillSummary {\n    content: string;\n    path?: string;\n    metadata?: Record<string, unknown>;\n}',
  },
  {
    name: 'SkillLookupOptions',
    declaration: 'export interface SkillLookupOptions {\n    cwd?: string | undefined;\n    signal?: AbortSignal | undefined;\n}',
  },
  {
    name: 'SkillProvider',
    declaration: 'export interface SkillProvider {\n    name: string;\n    list(options: SkillLookupOptions): Promise<SkillCandidate[]>;\n    get(candidate: SkillCandidate, options: SkillLookupOptions): Promise<SkillDefinition | undefined>;\n}',
  },
  {
    name: 'SkillRegistration',
    declaration: 'export type SkillRegistration = Omit<SkillDefinition, \'provider\'> & {\n    provider?: string;\n};',
  },
  {
    name: 'SkillResourceBase',
    declaration: 'export type SkillResourceBase = {\n    kind: \'directory\';\n    path: string;\n} | {\n    kind: \'url\';\n    url: string;\n} | {\n    kind: \'opaque\';\n    description: string;\n};',
  },
  {
    name: 'SkillSource',
    declaration: 'export type SkillSource = \'project-dsh\' | \'project-agents\' | \'runtime\' | \'user-dsh\' | \'user-agents\' | \'custom\' | (string & {});',
  },
  {
    name: 'SkillSummary',
    declaration: 'export interface SkillSummary {\n    name: string;\n    description: string;\n    whenToUse?: string;\n    disableModelInvocation?: boolean;\n    source: SkillSource;\n    provider: string;\n    resourceBase?: SkillResourceBase;\n}',
  },
  {
    name: 'StreamChunk',
    declaration: 'export type StreamChunk = {\n    type: \'block-start\';\n    index: number;\n    blockType: ContentBlockType;\n} | {\n    type: \'text-delta\';\n    index: number;\n    text: string;\n} | {\n    type: \'reasoning-delta\';\n    index: number;\n    text: string;\n} | {\n    type: \'tool-call-delta\';\n    index: number;\n    id: CallId;\n    name?: string;\n    argumentsDelta: string;\n} | {\n    type: \'block-end\';\n    index: number;\n    block: ContentBlock;\n} | {\n    type: \'usage\';\n    usage: TokenUsage;\n} | {\n    type: \'finish\';\n    reason: FinishReason;\n};',
  },
  {
    name: 'StructuredOutputSchema',
    declaration: 'export type StructuredOutputSchema = StructuredSchemaNode & {\n    type: \'object\';\n};',
  },
  {
    name: 'StructuredScalar',
    declaration: 'export type StructuredScalar = string | number | boolean | null;',
  },
  {
    name: 'StructuredSchemaNode',
    declaration: 'export interface StructuredSchemaNode {\n    type: StructuredSchemaType;\n    properties?: Record<string, StructuredSchemaNode>;\n    required?: string[];\n    additionalProperties?: boolean;\n    items?: StructuredSchemaNode;\n    enum?: StructuredScalar[];\n    const?: StructuredScalar;\n    description?: string;\n    title?: string;\n    default?: unknown;\n    examples?: unknown;\n}',
  },
  {
    name: 'StructuredSchemaType',
    declaration: 'export type StructuredSchemaType = \'object\' | \'array\' | \'string\' | \'number\' | \'integer\' | \'boolean\' | \'null\';',
  },
  {
    name: 'SubagentCapabilities',
    declaration: 'export interface SubagentCapabilities {\n    outputSchema: boolean;\n    depthLimit: boolean;\n    toolFilter: boolean;\n}',
  },
  {
    name: 'SubagentProvider',
    declaration: 'export interface SubagentProvider {\n    readonly name: string;\n    readonly capabilities: SubagentCapabilities;\n    readonly inheritsParentContext: boolean;\n    start(request: SubagentStartRequest): SubagentRun;\n}',
  },
  {
    name: 'SubagentResult',
    declaration: 'export interface SubagentResult {\n    output: ContentBlock[];\n    structured?: unknown;\n    stopReason: SubagentStopReason;\n}',
  },
  {
    name: 'SubagentRun',
    declaration: 'export interface SubagentRun {\n    readonly id: AgentId;\n    readonly result: Promise<SubagentResult>;\n    cancel(reason?: string): void;\n    dispose(): Promise<void>;\n    sendMessage?(content: ContentBlock[]): void;\n    resume?(content: ContentBlock[]): SubagentRun;\n}',
  },
  {
    name: 'SubagentStartRequest',
    declaration: 'export interface SubagentStartRequest {\n    prompt: ContentBlock[];\n    parent: Agent;\n    signal?: AbortSignal;\n    agentOptions?: AgentOptions;\n    outputSchema?: StructuredOutputSchema;\n    maxDepth?: number;\n    toolFilter?: {\n        allow?: string[];\n        deny?: string[];\n    };\n}',
  },
  {
    name: 'SubagentStopReason',
    declaration: 'export type SubagentStopReason = SubagentStopReasonMap[keyof SubagentStopReasonMap];',
  },
  {
    name: 'SubagentStopReasonMap',
    declaration: 'export interface SubagentStopReasonMap {\n    completed: \'completed\';\n    aborted: \'aborted\';\n    error: \'error\';\n    \'max-tokens\': \'max-tokens\';\n    refusal: \'refusal\';\n}',
  },
  {
    name: 'SurfaceEventType',
    declaration: 'export type SurfaceEventType = \'user/message\' | \'assistant/message\' | \'tool/result\' | \'context/message\' | \'steering/message\';',
  },
  {
    name: 'SurfaceOp',
    declaration: 'export type SurfaceOp = \'append\' | {\n    op: \'replace\';\n    start: number;\n    end: number;\n};',
  },
  {
    name: 'TerminalCallView',
    declaration: 'export interface TerminalCallView {\n    card: \'terminal\';\n    title: string;\n    description?: string;\n    cwd?: string;\n}',
  },
  {
    name: 'TerminalResultView',
    declaration: 'export interface TerminalResultView {\n    card: \'terminal\';\n    title?: string;\n    output?: string;\n    exitCode?: number;\n    signal?: string;\n}',
  },
  {
    name: 'TodoItem',
    declaration: 'export interface TodoItem {\n    content: string;\n    status: \'pending\' | \'in_progress\' | \'completed\';\n}',
  },
  {
    name: 'TokenUsage',
    declaration: 'export interface TokenUsage {\n    inputTokens: number;\n    outputTokens: number;\n    cacheReadTokens?: number;\n    cacheWriteTokens?: number;\n    reasoningTokens?: number;\n}',
  },
  {
    name: 'ToolCallBlock',
    declaration: 'export interface ToolCallBlock {\n    type: \'tool-call\';\n    id: CallId;\n    name: string;\n    arguments: string;\n}',
  },
  {
    name: 'ToolCallKind',
    declaration: 'export type ToolCallKind = \'read\' | \'edit\' | \'delete\' | \'move\' | \'search\' | \'execute\' | \'fetch\' | \'other\';',
  },
  {
    name: 'ToolCallView',
    declaration: 'export type ToolCallView = GenericCallView | TerminalCallView | DiffCallView;',
  },
  {
    name: 'ToolDefinition',
    declaration: 'export interface ToolDefinition extends ToolSchema {\n    execute(args: unknown, exec: ToolExecution): Promise<ToolExecuteReturn>;\n    timeoutMs?: number;\n    presentCall?(args: unknown): ToolCallView | undefined;\n    presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined;\n}',
  },
  {
    name: 'ToolErrorInfo',
    declaration: 'export interface ToolErrorInfo {\n    name: string;\n    code: string;\n}',
  },
  {
    name: 'ToolExecuteReturn',
    declaration: 'export type ToolExecuteReturn = ContentBlock[] | {\n    content: ContentBlock[];\n    meta?: unknown;\n};',
  },
  {
    name: 'ToolExecution',
    declaration: 'export interface ToolExecution {\n    callId: CallId;\n    name: string;\n    arguments: unknown;\n    agent?: Agent;\n    signal?: AbortSignal;\n}',
  },
  {
    name: 'ToolExecutionResult',
    declaration: 'export interface ToolExecutionResult {\n    callId: CallId;\n    content: ContentBlock[];\n    isError: boolean;\n    error?: ToolErrorInfo;\n    additionalContext?: HookContext;\n    meta?: unknown;\n}',
  },
  {
    name: 'ToolResult',
    declaration: 'export interface ToolResult {\n    content: ContentBlock[];\n    isError: boolean;\n    meta?: unknown;\n}',
  },
  {
    name: 'ToolResultBlock',
    declaration: 'export interface ToolResultBlock {\n    type: \'tool-result\';\n    toolCallId: CallId;\n    content: ContentBlock[];\n    isError?: boolean;\n}',
  },
  {
    name: 'ToolResultView',
    declaration: 'export type ToolResultView = GenericResultView | TerminalResultView | DiffResultView;',
  },
  {
    name: 'ToolSchema',
    declaration: 'export interface ToolSchema {\n    name: string;\n    description: string;\n    parameters: Record<string, unknown>;\n}',
  },
  {
    name: 'TurnEndReason',
    declaration: 'export type TurnEndReason = TurnEndReasonMap[keyof TurnEndReasonMap];',
  },
  {
    name: 'TurnEndReasonMap',
    declaration: 'export interface TurnEndReasonMap {\n    completed: {\n        kind: \'completed\';\n    };\n    aborted: {\n        kind: \'aborted\';\n        reason?: string;\n    };\n    error: {\n        kind: \'error\';\n        step: number;\n        message: string;\n        code?: string;\n    };\n    disposed: {\n        kind: \'disposed\';\n    };\n    \'max-tokens\': {\n        kind: \'max-tokens\';\n    };\n    rejected: {\n        kind: \'rejected\';\n        reason: string;\n    };\n    interrupted: {\n        kind: \'interrupted\';\n    };\n}',
  },
  {
    name: 'TurnTrigger',
    declaration: 'export type TurnTrigger = TurnTriggerMap[keyof TurnTriggerMap];',
  },
  {
    name: 'TurnTriggerMap',
    declaration: 'export interface TurnTriggerMap {\n    message: {\n        kind: \'message\';\n        source: MessageSource;\n    };\n    injection: {\n        kind: \'injection\';\n        source: MessageSource;\n    };\n}',
  },
  {
    name: 'UserInteractionProvider',
    declaration: 'export interface UserInteractionProvider {\n    ask(request: AskUserQuestionRequest): Promise<AskUserQuestionAnswer>;\n}',
  },
  {
    name: 'WebExecContext',
    declaration: 'export interface WebExecContext {\n    readonly signal?: AbortSignal;\n}',
  },
  {
    name: 'WebFetchBody',
    declaration: 'export type WebFetchBody = {\n    readonly kind: \'html\';\n    readonly content: string;\n} | {\n    readonly kind: \'text\';\n    readonly content: string;\n};',
  },
  {
    name: 'WebFetchProvider',
    declaration: 'export interface WebFetchProvider {\n    readonly id: string;\n    status(): WebProviderStatus;\n    fetch(request: WebFetchRequest, exec?: WebExecContext): Promise<WebFetchResult>;\n}',
  },
  {
    name: 'WebFetchRequest',
    declaration: 'export interface WebFetchRequest {\n    readonly url: string;\n    readonly timeoutMs?: number;\n}',
  },
  {
    name: 'WebFetchResult',
    declaration: 'export interface WebFetchResult {\n    readonly providerId: string;\n    readonly url: string;\n    readonly statusCode: number;\n    readonly body: WebFetchBody;\n    readonly truncated: boolean;\n}',
  },
  {
    name: 'WebProviderStatus',
    declaration: 'export type WebProviderStatus = {\n    readonly available: true;\n} | {\n    readonly available: false;\n    readonly reason: \'missing-credential\' | \'misconfigured\';\n};',
  },
  {
    name: 'WebSearchProvider',
    declaration: 'export interface WebSearchProvider {\n    readonly id: string;\n    status(): WebProviderStatus;\n    search(request: WebSearchRequest, exec?: WebExecContext): Promise<WebSearchResult>;\n}',
  },
  {
    name: 'WebSearchRequest',
    declaration: 'export interface WebSearchRequest {\n    readonly query: string;\n    readonly maxResults?: number;\n}',
  },
  {
    name: 'WebSearchResult',
    declaration: 'export interface WebSearchResult {\n    readonly providerId: string;\n    readonly query: string;\n    readonly content?: string;\n    readonly sources: readonly WebSearchSource[];\n    readonly truncated: boolean;\n}',
  },
  {
    name: 'WebSearchSource',
    declaration: 'export interface WebSearchSource {\n    readonly url: string;\n    readonly title?: string;\n    readonly snippet?: string;\n    readonly publishedAt?: string;\n}',
  },
  {
    name: 'WorkflowMeta',
    declaration: 'export interface WorkflowMeta {\n    name: string;\n    description: string;\n    whenToUse?: string;\n    phases?: WorkflowPhase[];\n}',
  },
  {
    name: 'WorkflowPhase',
    declaration: 'export interface WorkflowPhase {\n    title: string;\n    detail?: string;\n    model?: string;\n}',
  },
  {
    name: 'WorkflowResult',
    declaration: 'export interface WorkflowResult {\n    value: unknown;\n    stopReason: WorkflowStopReason;\n    error?: string;\n    agentsStarted: number;\n}',
  },
  {
    name: 'WorkflowRun',
    declaration: 'export interface WorkflowRun {\n    readonly id: WorkflowRunId;\n    readonly meta: WorkflowMeta;\n    readonly result: Promise<WorkflowResult>;\n    cancel(reason?: string): void;\n    dispose(): Promise<void>;\n}',
  },
  {
    name: 'WorkflowRunId',
    declaration: 'export type WorkflowRunId = Branded<\'WorkflowRunId\'>;',
  },
  {
    name: 'WorkflowStartRequest',
    declaration: 'export interface WorkflowStartRequest {\n    script: string;\n    meta: WorkflowMeta;\n    args?: unknown;\n    parent: Agent;\n    signal?: AbortSignal;\n}',
  },
  {
    name: 'WorkflowStopReason',
    declaration: 'export type WorkflowStopReason = \'completed\' | \'cancelled\' | \'error\';',
  },
]

/** The inherited `ctx` surface (cordis core + loader/hmr/timer), in curated order. */
export const INHERITED_CTX_API: readonly InheritedApiEntry[] = [
  { name: 'ctx.on / ctx.once', summary: 'Register an event listener (disposable).' },
  { name: 'ctx.emit / ctx.parallel / ctx.serial / ctx.bail / ctx.waterfall', summary: 'Dispatch an event (sync / awaited / first-bail / veto-chain).' },
  { name: 'ctx.plugin / ctx.inject', summary: 'Load a plugin / declare required services.' },
  { name: 'ctx.effect', summary: 'Register a disposable side effect tied to the fiber.' },
  { name: 'ctx.get / ctx.set / ctx.provide / ctx.accessor / ctx.mixin', summary: 'Low-level service-store access and binding.' },
  { name: 'ctx.extend / ctx.isolate / ctx.intercept', summary: 'Derive a child context (scoped services / isolation / interception).' },
  { name: 'ctx.root / ctx.scope / ctx.fiber / ctx.registry / ctx.reflect / ctx.events / ctx.logger', summary: 'Ambient handles onto the running context graph.' },
  { name: 'ctx.timer (+ interval / timeout / throttle / debounce / setTimeout / setInterval)', summary: 'Disposable timer helpers. The `timer` key is provided at runtime; the six helpers are mixed onto ctx directly (declared via Pick).' },
  { name: 'ctx.loader', summary: 'The config Loader that booted the app (present under the loader).' },
  { name: 'ctx.hmr', summary: 'The hot-module-reload watcher (present under the hmr plugin).' },
]
