export { CatastrophicCommandError, CommandPolicy, ContextMatchError, ContextMatchReason, CreateApplyPatchToolOptions, CreateBraveWebSearchAdapterOptions, CreateCurrentTimeToolOptions, CreateEditFileToolOptions, CreateGenericHttpSearchAdapterOptions, CreateGitDiffToolOptions, CreateGitStatusToolOptions, CreateGlobToolOptions, CreateInteractiveShellToolOptions, CreateListDirToolOptions, CreateReadFileToolOptions, CreateRunVitestToolOptions, CreateSearchTextToolOptions, CreateShellToolOptions, CreateViewImageToolOptions, CreateWebFetchToolOptions, CreateWebSearchToolOptions, CreateWriteFileToolOptions, DEFAULT_MAX_IMAGE_BYTES, DEFAULT_TOOL_GUIDANCE, EnvContextOptions, PlanModeTool, PlanModeToolOptions, PlanModeToolWithStore, PlanNode, QuestionTool, QuestionToolOptions, ReadTracker, ReasoningTools, RedirectBlockedError, RepoMapOptions, ResolveAndScreenOptions, ScreenedFetchOptions, SessionArtifactStore, SessionArtifactStoreOptions, SsrfBlockedError, TodoItem, TodolistTool, ToolGuidanceMap, TruncationMode, TruncationOptions, TruncationResult, VitestSummary, WebSearchCallback, WebSearchResult, buildEnvContext, buildRepoMap, catastrophicShellReason, commandDenialReason, createApplyPatchTool, createBraveWebSearchAdapter, createCurrentTimeTool, createEditFileTool, createGenericHttpSearchAdapter, createGitDiffTool, createGitStatusTool, createGlobTool, createInteractiveShellTool, createListDirTool, createPlanModeTool, createQuestionTool, createReadFileTool, createRunVitestTool, createSearchTextTool, createSessionArtifactStore, createShellTool, createTodolistTool, createUpdatePlanTool, createViewImageTool, createWebFetchTool, createWebSearchTool, createWriteFileTool, createWriteStdinTool, denyCatastrophicCommands, formatCode, formatDiff, formatError, formatFileList, injectGuidance, isBlockedIp, isCommandAllowed, renderToolList, replaceUnique, resolveAndScreen, screenedFetch, todoItemsToPlanNodes, truncateOutput, withDefaultGuidance, withDescription, withName, withShellExitGuidance, withToolResultGuidance } from '@theokit/sdk-tools'; import * as _theokit_sdk from '@theokit/sdk'; import { TheokitAgentError } from '@theokit/sdk/errors'; import { D as DelegationTarget, a as DelegateOptions } from './delegation-scoring-CURe4oSL.js'; import { z } from 'zod'; import '@theokit/sdk/retry'; import './agent-compiler-BMpuJFAI.js'; import '@theokit/sdk/subagents-loader'; import './types-DdltPCj2.js'; import './setting-sources-gate-BJJiKq33.js'; import './hook-handlers-Cw2FsnE5.js'; import '@theokit/presenter/wire'; /** * A roster misconfiguration — always raised at factory time, never at the model's first call. * * The distinction is the point. `delegate()` refuses an empty `apiKey` deep in its own call stack, * so a factory that forwards `{}` fails only when the model first reaches for the tool — by which * point the failure is a tool error the model will try to reason about, rather than a startup error * a human can read. */ declare class DelegateToolConfigError extends TheokitAgentError { readonly code: 'empty_roster' | 'duplicate_name' | 'missing_api_key' | 'unknown_agent'; readonly name = "DelegateToolConfigError"; constructor(message: string, code: 'empty_roster' | 'duplicate_name' | 'missing_api_key' | 'unknown_agent'); } /** * One delegation target, named. * * The name is carried here rather than read off the target because `DelegationPort` is `{run}` and * has no name to read — pairing them keeps a type guard out of every use site. */ interface DelegateRosterEntry { readonly name: string; readonly target: DelegationTarget; } interface CreateDelegateToolOptions { /** Who the agent may delegate to. Must be non-empty and free of duplicate names. */ readonly roster: readonly DelegateRosterEntry[]; /** Forwarded to `delegate()` verbatim. `apiKey` is required when any target is a `SubAgentSpec`. */ readonly defaults?: DelegateOptions; /** Defaults to `delegate`. Override when an app already exposes a tool by that name. */ readonly name?: string; /** Defaults to a description naming the roster. Override to describe the roster's semantics. */ readonly description?: string; } /** * Build a tool that lets the agent delegate a task to one of `roster`. * * Recursion is bounded by BUDGET, not by depth — a sub-agent holding this same tool may delegate * again, and `delegate()` clamps the parent's remaining budget into each child. That guarantee is * conditional on the caller supplying `budget` / `parentBudgetRemaining` in `defaults`; both are * optional in `DelegateOptions`, and with neither set nothing at this layer bounds the descent. * Stated rather than fixed: a depth counter here would be a second owner of a rule `delegate()` * already owns. */ declare function createDelegateTool(options: CreateDelegateToolOptions): _theokit_sdk.CustomTool; /** * B-079 + B-080 — the tools through which the agent declares the work it is judged on. * * ## The half-present feature these close * * The runtime already models tasks and already emits their lifecycle: `Task.submit` is published and * `task_started` / `task_updated` / `task_completed` reach a consumer through `RunEvent`, so the * channel is real enough to have needed a security gate. * * This said "B-018 even shipped moderation for `task_progress.text`", and it had not. Measured * 2026-09-17 while closing #732: `agent-endpoint.ts` stated in the same tree that `done.result` and * `task_progress.text` were NOT covered, and neither composition had a pass over the channel. The * moderation exists NOW — a third `moderateOutputStream` pass on both surfaces — and the false claim * is corrected rather than deleted, because a wrong statement about a security control is what stops * the next reader from checking. * * What was missing is the way in. Measured 2026-09-14: `packages/agents/src` emitted `task_started` * in **0** files and produced `subgoals` in **0**, against a control of 2 for `GoalOptions`. So * `Task.submit` was reachable by the EMBEDDER and by nothing the model could call — a UI could draw * a task list the agent had no way to populate. * * ## Why a declaration is a DEFERRED task, and not a quick one * * `Task.submit(kind, work, options?)` takes a work FUNCTION: it was designed to RUN work. A * declaration has no function — the work is the agent, across turns. So the work this submits * returns a promise that stays pending until `task_complete` resolves it. * * The naive alternative is worth naming because it looks correct: submitting work that returns * immediately emits `task_started` and `task_completed` in the same tick. Every declaration would be * born finished, and "declared and still open" could never be distinguished from "never declared" — * which is the whole point of declaring. * * ## Two tools rather than one with a verb * * `task({ action: "declare" | "complete" })` would put the branch inside the handler, where a wrong * value is a runtime error the model discovers by failing. Two tools put it in the schema, where the * invalid call cannot be expressed. */ /** * The slice of the task registry these tools use. * * Declared structurally rather than importing `Task` directly, so a test can supply a stub without * standing up the SDK's registry — and so this module states exactly which two capabilities it * depends on rather than the whole class. */ interface TaskRegistry { submit(kind: string, work: (ctx: { readonly signal: AbortSignal; }) => Promise): Promise<{ readonly id: string; }>; readonly resolvers: Map void>; } interface TaskToolOptions { readonly registry: TaskRegistry; /** Overrides the tool name, for a consumer whose registry already uses it. */ readonly name?: string; } /** The declaration tool: one unit of work the agent intends to do. */ declare function createTaskDeclareTool(options: TaskToolOptions): { name: string; description: string; inputSchema: z.ZodObject<{ what: z.ZodString; }, z.core.$strip>; handler: (raw: unknown) => Promise; }; /** The completion tool: the declared unit is done. */ declare function createTaskCompleteTool(options: TaskToolOptions): { name: string; description: string; inputSchema: z.ZodObject<{ id: z.ZodString; }, z.core.$strip>; handler: (raw: unknown) => Promise; }; export { type CreateDelegateToolOptions, type DelegateRosterEntry, DelegateToolConfigError, type TaskRegistry, type TaskToolOptions, createDelegateTool, createTaskCompleteTool, createTaskDeclareTool };