import { McpServerConfig, SystemPromptResolver } from '@theokit/sdk'; import { z } from 'zod'; /** * Provider-agnostic extended-thinking knob (M1 reasoning-visibility). The common set autocompletes; * `(string & {})` accepts provider-specific values forward-compat (mirrors `AgentRunErrorCode`) — the * SDK validates the value against the model's catalog. Defined in this leaf module so every layer * (`@Agent` config, compiler, runner, sdk-adapter) imports it without an import cycle. */ type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | (string & {}); /** Scalar agent configuration. */ interface AgentOptions { /** Unique agent name (kebab-case). */ name: string; /** HTTP route prefix (e.g., '/api/agents/support'). */ route: string; /** LLM model identifier (e.g., 'claude-sonnet-4-5-20250929'). */ model?: string; /** Extended-thinking effort; mapped to the SDK `ModelSelection.params` so the provider reasons. */ reasoningEffort?: ReasoningEffort; /** * Opt-in (default false): convert inline `…` in the text stream into `thinking` * events (M2) — for models that emit reasoning as inline tags (qwen/deepseek) rather than via a * native reasoning param. Off by default since a code assistant may emit literal `` in text. */ parseThinkTags?: boolean; /** * Opt-in (default false): strip a leaked Hermes `` tool-call dialect out of * the visible text (theocode#32) — for models (qwen/qwen3-coder) that intermittently emit tool calls * as text instead of native `tool_calls`. Off by default since a code assistant may emit a literal * `` tool-call dialect so the * call actually EXECUTES (theokit#58 follow-up). Where {@link stripToolDialect} only hides the leaked * block from the visible text, this enables the SDK's `extractToolCallsFromContent` on the chat route, * so a `chat_completions` finish with ZERO native `tool_calls` has its text scanned for the dialect and * any recovered calls are dispatched by the loop. For models (qwen/qwen3-coder via OpenRouter) that * leak tool calls as text. Off by default (a code assistant may print a literal ` boolean; /** * M53 — moved here from the `@HumanInTheLoop` decorator, which is being deleted: the type is * consumed by `compileHitlGates` and the toolbox capability, not by the decorator alone. */ type TimeoutAction = 'abort' | 'proceed' | 'retry'; interface HumanInTheLoopOptions { /** Question shown to the human approver. */ question: string; /** Timeout in milliseconds before onTimeout fires (default: 300_000 = 5 min). */ timeout?: number; /** Action when timeout expires (default: 'abort'). */ onTimeout?: TimeoutAction; /** Show the tool input to the approver (default: true). */ showInput?: boolean; /** * M20 — an optional JSON-schema descriptor of the custom payload the approver may attach (edited * args, a review note). Carried into the `approval_required` event + `GET /approvals` so the UI * knows what to collect. A plain JSON object, not a live Zod schema (keeps the wire serializable). */ payloadSchema?: Record; } type McpServersMap = Record; /** M53 — moved from the `@ProjectContext` decorator being deleted; read by the compiler. */ type IndexStrategy = 'tree-sitter' | 'regex' | 'none'; type RelevanceStrategy = 'git-history' | 'import-graph' | 'semantic' | 'manual'; interface ProjectContextOptions { /** Files that mark the project root (searched upward from cwd). */ rootMarkers?: string[]; /** How to index the codebase for structural understanding. */ indexStrategy?: IndexStrategy; /** Maximum files to include in context per request. */ maxFilesInContext?: number; /** How to rank file relevance when selecting context. */ relevanceStrategy?: RelevanceStrategy; /** Glob patterns to exclude from indexing and context. */ ignorePatterns?: string[]; /** File extensions to include in indexing (default: all text files). */ includeExtensions?: string[]; } /** * #724 — whether the run tells the client its transcript can be resumed. * * ## What this replaced, and why the shape had to go * * `CheckpointOptions` declared four fields — `storage`, `strategy`, `maxCheckpoints`, `ttl` — and * read exactly one, as an `=== 'filesystem'` equality deciding whether a `checkpoint_saved` event is * emitted. `strategy`, `maxCheckpoints` and `ttl` were read NOWHERE in the monorepo, and `'drizzle'` * and `'redis'` were indistinguishable from `'memory'` in every code path: nothing rejected them, * nothing warned about them, nothing behaved differently. * * The warning was the sharpest part. It told an author `'filesystem'` "selects the SDK's durable * conversation store", while the comment above the one read states the SDK persists EVERY session to * its transcript regardless. So it pushed authors toward a value that changes only whether an event * is emitted — and on a pod with no volume, `filesystem` is the one storage actually unreachable. * Four knobs made that read as an informed choice. * * ## Why removal rather than deprecation * * This ecosystem's rule for a configuration surface is that it is read, or refused with a reason, * and never accepted and ignored. For a typed API the refusal is removing the field: an author * cannot write what does not compile, and a `@deprecated` tag on an inert field is the accepted-and- * ignored state with a label on it. * * Nothing in this monorepo wrote the removed fields. An external caller that did was configuring * nothing, so what breaks is a compile, never a behaviour. * * ## What durable state actually is here * * Resume is a property of the SDK's session transcript, not of this option — see the comment at the * emit site. Durable application state belongs to the developer through the data plane. */ interface CheckpointOptions { /** * Emit `checkpoint_saved` so a client knows the run can be resumed. Default off. * * A SIGNAL, not a backend selector — that is the whole of what the field it replaced ever did. */ resumeSignal?: boolean; } type MemoryProvider = 'built-in' | 'honcho' | 'supermemory' | 'mem0'; type MemoryScope = 'per-user' | 'per-agent' | 'per-tenant' | 'global'; interface MemoryOptions { /** Memory provider backend. */ provider?: MemoryProvider; /** Enable semantic search via embeddings. */ embeddings?: boolean; /** Enable full-text search (FTS5). */ fts?: boolean; /** Memory isolation scope (default: 'per-user'). */ scope?: MemoryScope; /** Maximum facts to retain per scope (0 = unlimited). */ maxFacts?: number; } export type { ApprovalOptions as A, BudgetOptions as B, CheckpointOptions as C, HumanInTheLoopOptions as H, McpServersMap as M, ProjectContextOptions as P, ReasoningEffort as R, ToolOptions as T, MemoryOptions as a, MainLoopMeta as b, AgentOptions as c, MainLoopOptions as d, PolicyHandler as e, TimeoutAction as f, ToolboxOptions as g };