@theokit/agents 16.0.0 → 16.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +47 -1
- package/dist/{agent-compiler-BMpuJFAI.d.ts → agent-compiler-JSYkHpa7.d.ts} +2 -2
- package/dist/{delegation-scoring-CURe4oSL.d.ts → agent-orchestrator-BFWg2URC.d.ts} +11 -426
- package/dist/agent-runner-BUJKNNuI.d.ts +364 -0
- package/dist/agent-sse-handler-BRp9vHrb.d.ts +348 -0
- package/dist/{bridge-entry-BxJWDpQP.d.ts → bridge-entry-BNWDrPzg.d.ts} +8 -422
- package/dist/bridge.d.ts +8 -5
- package/dist/bridge.js +19 -15
- package/dist/{chunk-4PHZ25JN.js → chunk-3TE4PJZL.js} +62 -1137
- package/dist/chunk-3TE4PJZL.js.map +1 -0
- package/dist/{chunk-FIGLHWR2.js → chunk-4SXVNI5O.js} +7 -7
- package/dist/chunk-A2UVVEB3.js +799 -0
- package/dist/chunk-A2UVVEB3.js.map +1 -0
- package/dist/chunk-Z5SYU6Z6.js +353 -0
- package/dist/chunk-Z5SYU6Z6.js.map +1 -0
- package/dist/delegation-scoring-Cn5eM4lQ.d.ts +79 -0
- package/dist/evals.d.ts +84 -0
- package/dist/evals.js +191 -0
- package/dist/evals.js.map +1 -0
- package/dist/handoff.d.ts +91 -0
- package/dist/handoff.js +268 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +19 -369
- package/dist/index.js +36 -32
- package/dist/index.js.map +1 -1
- package/dist/mcp-health.d.ts +1 -1
- package/dist/sdk-adapter-DQnKx7bA.d.ts +435 -0
- package/dist/testing.d.ts +2 -2
- package/dist/tools.d.ts +5 -3
- package/dist/tools.js +10 -6
- package/dist/tools.js.map +1 -1
- package/dist/{types-DdltPCj2.d.ts → types-D5cHmSLi.d.ts} +1 -1
- package/docs/capability-map.md +31 -1
- package/package.json +12 -2
- package/dist/chunk-4PHZ25JN.js.map +0 -1
- /package/dist/{chunk-FIGLHWR2.js.map → chunk-4SXVNI5O.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/capability/capability.ts","../src/capability/capabilities.ts","../src/capability/registry.ts","../src/capability/agent-capabilities.ts","../src/capability/agent-shape.ts","../src/capability/toolbox.ts","../src/capability/toolset.ts","../src/a2a/agent-card.ts","../src/a2a/mcp-server-manifest.ts","../src/conversation-scope.ts","../src/skills-resolver.ts","../src/acp/protocol.ts","../src/acp/client.ts","../src/bridge/subagent-inventory.ts","../src/in-process-turn.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAASA,SAASC,kBAAkB;;;ACPpC,SAASC,yBAAyB;AAElC,SAASC,yBAAyB;AA6C3B,IAAMC,0BAAN,cAAsCC,kBAAAA;EA/C7C,OA+C6CA;;;EACzBC,OAAO;EACzB,YAAYC,OAAeC,UAAmBC,MAAeC,YAAoB;AAC/E;;;;MAIE,eAAeA,UAAAA,aAAuBH,KAAAA,uBAA4BI,QAAQH,QAAAA,CAAAA,4CAC9BG,QAAQF,IAAAA,CAAAA;MAEpD;QACEG,MAAM;;QAENC,aAAa;MACf;IAAA;EAEJ;AACF;AAGA,SAASF,QAAQG,OAAc;AAC7B,MAAIA,UAAU,KAAM,QAAO;AAC3B,MAAIC,MAAMC,QAAQF,KAAAA,EAAQ,QAAO,SAASA,MAAMG,MAAM;AACtD,MAAI,OAAOH,UAAU,UAAU;AAC7B,WAAO,UAAUI,OAAOC,KAAKL,KAAAA,EAC1BM,KAAK,CAACC,GAAGC,MAAMD,EAAEE,cAAcD,CAAAA,CAAAA,EAC/BE,KAAK,GAAA,CAAA;EACV;AACA,SAAO,OAAOV;AAChB;AATS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KG,mBACvB;IAAEL;IAAOf,eAAeoB;EAAiB,IACzCtB;AAEN,QAAM0B,YAAYhB,MAAMgB,aAAaC,OAAOC,WAAU;AAMtD,UAAQ,mBAAA;AACN,QAAId,SAASe,gBAAgB;AAC3B,YAAMC,UAAU,MAAMC,qBAAqBjB,SAASe,gBAAgBf,SAASkB,cAAc,CAAC,CAAA;AAC5F,UAAIF,YAAY9B,OAAWc,UAASmB,SAAS;QAAEH;QAASI,YAAY;MAAK;IAC3E;AACA,WAAOvB,KAAKC,OAAOE,UAAUL,QAAQ;MACnC0B,SAASzB,MAAMyB;;MAEf,GAAIzB,MAAM0B,WAAWpC,SAAY;QAAEoC,QAAQ1B,MAAM0B;MAAO,IAAI,CAAC;MAC7DV;MACAR;MACAmB,QAAQ3B,MAAM2B;MACd,GAAI3B,MAAM4B,eAAetC,SAAY;QAAEsC,YAAY5B,MAAM4B;MAAW,IAAI,CAAC;;;MAGzE,GAAI5B,MAAM6B,UAAUvC,SAAY;QAAEuC,OAAO7B,MAAM6B;MAAM,IAAI,CAAC;MAC1D,GAAI7B,MAAM8B,uBAAuBxC,SAC7B;QAAEwC,oBAAoB9B,MAAM8B;MAAmB,IAC/C,CAAC;;;MAGL,GAAI9B,MAAM+B,YAAYzC,SAAY;QAAEyC,SAAS/B,MAAM+B;MAAQ,IAAI,CAAC;IAClE,CAAA;EACF,GAAA;AACF;AA7DgBlC;;;Af2HhB,SACEmC,oBACAC,sBACAC,YACAC,cACAC,qBACAC,2BACK;AAkBP,SACEC,qBACAC,iBACAC,mBACAC,WACAC,8BACK;AAuBP,SAASC,yBAAyB;AAvP3B,IAAMC,QAA+BC;","names":["Agent","AgentDoSdk","isDeepStrictEqual","TheokitAgentError","CapabilityConflictError","TheokitAgentError","name","field","previous","next","capability","shapeOf","code","isRetryable","value","Array","isArray","length","Object","keys","sort","a","b","localeCompare","join","createDraft","tools","agents","provenance","applyCapabilities","capabilities","draft","c","apply","stream","setOnce","undefined","isDeepStrictEqual","push","contributed","describe","value","Array","isArray","ModelCapability","name","id","reasoningEffort","ConfigurationError","trim","length","apply","draft","setOnce","undefined","ToolsCapability","tools","push","provenance","capability","contributed","SkillsCapability","entries","e","field","compiled","compileSkillsSelection","slice","skills","previous","enabled","inline","TheokitAgentError","UnknownCapabilityError","TheokitAgentError","name","requested","known","join","code","isRetryable","CapabilityRegistry","Map","register","factory","set","has","names","keys","resolve","arg","get","undefined","CapabilityPreset","members","apply","draft","member","FieldCapability","value","apply","draft","setOnce","field","name","MemoryCapability","ContextWindowCapability","options","compileContextWindow","context","ProjectContextCapability","McpServersCapability","SubagentsCapability","GuardrailsCapability","CheckpointCapability","HumanInTheLoopCapability","SubAgentsCapability","children","child","Object","entries","agents","ConfigurationError","provenance","push","capability","contributed","SkillsOptionsCapability","compileSkills","SettingSourcesCapability","selection","resolveSettingSources","claudeCode","undefined","resolveCompatSources","HookApprovalCapability","SessionStoreCapability","CanUseToolCapability","TelemetryCapability","PluginsCapability","RunContextCapability","SkillsResolverCapability","AgentConfigCapability","config","Number","isFinite","claimedByMainLoop","some","p","includes","maxIterations","timeoutMs","systemPrompt","parseThinkTags","stripToolDialect","recoverLeakedToolCalls","stream","MainLoopCapability","length","declareAgentShape","name","members","draft","applyCapabilities","shape","tools","Object","freeze","provenance","model","undefined","reasoningEffort","ToolboxCapability","name","instance","options","ConfigurationError","declared","tools","undefined","length","tool","method","namespace","toolRuntimeName","class","guards","map","propertyKey","config","approval","trace","audit","hitl","apply","draft","walk","push","compileTools","Map","provenance","capability","contributed","gates","compileHitlGates","size","key","set","TheokitAgentError","ToolsetError","TheokitAgentError","name","message","code","Toolset","byName","Object","freeze","from","tools","Map","tool","has","set","get","undefined","resolve","names","seen","Set","map","add","keys","all","values","trimTrailingSlash","url","endsWith","slice","buildAgentCard","entry","options","base","baseUrl","name","description","route","version","capabilities","streaming","stream","pushNotifications","stateTransitionHistory","defaultInputModes","defaultOutputModes","skills","tools","map","t","id","wellKnownCardPath","agentName","MCP_PROTOCOL_VERSION","buildMcpToolDescriptors","entry","tools","map","t","name","description","inputSchema","type","properties","mcpServerInfo","version","protocolVersion","SEPARATOR","deriveConversationId","resource","thread","Error","encodeURIComponent","parseConversationId","id","idx","indexOf","length","decodeURIComponent","slice","resolveEnabledSkills","selection","ctx","undefined","filter","s","resolved","Array","isArray","Error","names","every","n","trim","length","encodeAcpMessage","message","JSON","stringify","AcpMessageDecoder","buffer","push","chunk","messages","newlineIndex","indexOf","line","slice","trim","length","parse","cause","Error","TheokitAgentError","AcpProtocolError","TheokitAgentError","name","line","options","code","isRetryable","AcpConnectionClosedError","cause","message","isResponse","m","e","error","id","isServerRequest","method","isNotification","AcpClient","nextId","pending","Map","handlers","notificationHandlers","buffer","closed","transport","subscribe","chunk","lines","split","pop","receive","trim","onClose","fail","request","params","Promise","resolve","reject","set","send","encodeAcpMessage","jsonrpc","onRequest","handler","onNotification","JSON","parse","err","Object","Array","isArray","dispatch","size","console","warn","entry","values","clear","get","delete","Error","result","handleServerRequest","catch","notify","req","reply","body","Squad","Tool","Provider","setDiagnosticsSink","SubAgent","assertNoSymlinkEscape","isForbiddenPath","safePathJoin","CONTEXT_WINDOW_FLOOR","CONTEXT_WINDOW_MARGIN","ContextWindowMarginError","resolveEffectiveContextWindow","discoverSubagents","loadSubagentDefinition","discoverSubagents","listSubagentNames","cwd","options","discovered","discoverSubagents","Object","keys","sort","a","b","localeCompare","WindowBudgetExceededError","BudgetExceededError","TheokitAgentError","InProcessApprovalRequiredError","TheokitAgentError","name","toolNames","join","code","isRetryable","postureResolver","posturePolicy","undefined","kind","awaitApproval","Promise","resolve","approved","reason","streamAgentTurnInProcess","mod","apiKey","input","deps","stream","streamAgentUIMessages","compiled","compileAgentModule","source","gated","hitl","size","approvals","keys","approvalResolver","approvalId","opts","toolName","sessionId","crypto","randomUUID","skillsResolver","enabled","resolveEnabledSkills","runContext","skills","autoInject","message","images","signal","onRunEvent","retry","exposeUsageToTools","onError","applySecurityFloor","auditEnvReachability","foldLayers","recordWiring","resolveTrustPosture","verifyLayerOrdering","GenerateObjectError","LayerOrderError","StreamObjectError","ToolError","UngatedCapabilityError","foldTurnLifecycle","Agent","AgentDoSdk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/capability/capability.ts","../src/capability/capabilities.ts","../src/capability/registry.ts","../src/capability/agent-capabilities.ts","../src/capability/agent-shape.ts","../src/capability/toolbox.ts","../src/capability/toolset.ts","../src/a2a/agent-card.ts","../src/a2a/mcp-server-manifest.ts","../src/conversation-scope.ts","../src/skills-resolver.ts","../src/acp/protocol.ts","../src/acp/client.ts","../src/bridge/subagent-inventory.ts","../src/in-process-turn.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,SAASA,SAASC,kBAAkB;;;ACPpC,SAASC,yBAAyB;AAElC,SAASC,yBAAyB;AA6C3B,IAAMC,0BAAN,cAAsCC,kBAAAA;EA/C7C,OA+C6CA;;;EACzBC,OAAO;EACzB,YAAYC,OAAeC,UAAmBC,MAAeC,YAAoB;AAC/E;;;;MAIE,eAAeA,UAAAA,aAAuBH,KAAAA,uBAA4BI,QAAQH,QAAAA,CAAAA,4CAC9BG,QAAQF,IAAAA,CAAAA;MAEpD;QACEG,MAAM;;QAENC,aAAa;MACf;IAAA;EAEJ;AACF;AAGA,SAASF,QAAQG,OAAc;AAC7B,MAAIA,UAAU,KAAM,QAAO;AAC3B,MAAIC,MAAMC,QAAQF,KAAAA,EAAQ,QAAO,SAASA,MAAMG,MAAM;AACtD,MAAI,OAAOH,UAAU,UAAU;AAC7B,WAAO,UAAUI,OAAOC,KAAKL,KAAAA,EAC1BM,KAAK,CAACC,GAAGC,MAAMD,EAAEE,cAAcD,CAAAA,CAAAA,EAC/BE,KAAK,GAAA,CAAA;EACV;AACA,SAAO,OAAOV;AAChB;AATSH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G,mBACvB;IAAEL;IAAOf,eAAeoB;EAAiB,IACzCtB;AAEN,QAAM0B,YAAYhB,MAAMgB,aAAaC,OAAOC,WAAU;AAMtD,UAAQ,mBAAA;AACN,QAAId,SAASe,gBAAgB;AAC3B,YAAMC,UAAU,MAAMC,qBAAqBjB,SAASe,gBAAgBf,SAASkB,cAAc,CAAC,CAAA;AAC5F,UAAIF,YAAY9B,OAAWc,UAASmB,SAAS;QAAEH;QAASI,YAAY;MAAK;IAC3E;AACA,WAAOvB,KAAKC,OAAOE,UAAUL,QAAQ;MACnC0B,SAASzB,MAAMyB;;MAEf,GAAIzB,MAAM0B,WAAWpC,SAAY;QAAEoC,QAAQ1B,MAAM0B;MAAO,IAAI,CAAC;MAC7DV;MACAR;MACAmB,QAAQ3B,MAAM2B;MACd,GAAI3B,MAAM4B,eAAetC,SAAY;QAAEsC,YAAY5B,MAAM4B;MAAW,IAAI,CAAC;;;MAGzE,GAAI5B,MAAM6B,UAAUvC,SAAY;QAAEuC,OAAO7B,MAAM6B;MAAM,IAAI,CAAC;MAC1D,GAAI7B,MAAM8B,uBAAuBxC,SAC7B;QAAEwC,oBAAoB9B,MAAM8B;MAAmB,IAC/C,CAAC;;;MAGL,GAAI9B,MAAM+B,YAAYzC,SAAY;QAAEyC,SAAS/B,MAAM+B;MAAQ,IAAI,CAAC;IAClE,CAAA;EACF,GAAA;AACF;AA7DgBlC;;;Af2HhB,SACEmC,oBACAC,sBACAC,YACAC,cACAC,qBACAC,2BACK;AAkBP,SACEC,qBACAC,iBACAC,mBACAC,WACAC,8BACK;AAuBP,SAASC,yBAAyB;AAvP3B,IAAMC,QAA+BC;","names":["Agent","AgentDoSdk","isDeepStrictEqual","TheokitAgentError","CapabilityConflictError","TheokitAgentError","name","field","previous","next","capability","shapeOf","code","isRetryable","value","Array","isArray","length","Object","keys","sort","a","b","localeCompare","join","createDraft","tools","agents","provenance","applyCapabilities","capabilities","draft","c","apply","stream","setOnce","undefined","isDeepStrictEqual","push","contributed","describe","value","Array","isArray","ModelCapability","name","id","reasoningEffort","ConfigurationError","trim","length","apply","draft","setOnce","undefined","ToolsCapability","tools","push","provenance","capability","contributed","SkillsCapability","entries","e","field","compiled","compileSkillsSelection","slice","skills","previous","enabled","inline","TheokitAgentError","UnknownCapabilityError","TheokitAgentError","name","requested","known","join","code","isRetryable","CapabilityRegistry","Map","register","factory","set","has","names","keys","resolve","arg","get","undefined","CapabilityPreset","members","apply","draft","member","FieldCapability","value","apply","draft","setOnce","field","name","MemoryCapability","ContextWindowCapability","options","compileContextWindow","context","ProjectContextCapability","McpServersCapability","SubagentsCapability","GuardrailsCapability","CheckpointCapability","HumanInTheLoopCapability","SubAgentsCapability","children","child","Object","entries","agents","ConfigurationError","provenance","push","capability","contributed","SkillsOptionsCapability","compileSkills","SettingSourcesCapability","selection","resolveSettingSources","claudeCode","undefined","resolveCompatSources","HookApprovalCapability","SessionStoreCapability","CanUseToolCapability","TelemetryCapability","PluginsCapability","RunContextCapability","SkillsResolverCapability","AgentConfigCapability","config","Number","isFinite","claimedByMainLoop","some","p","includes","maxIterations","timeoutMs","systemPrompt","parseThinkTags","stripToolDialect","recoverLeakedToolCalls","stream","MainLoopCapability","length","declareAgentShape","name","members","draft","applyCapabilities","shape","tools","Object","freeze","provenance","model","undefined","reasoningEffort","ToolboxCapability","name","instance","options","ConfigurationError","declared","tools","undefined","length","tool","method","namespace","toolRuntimeName","class","guards","map","propertyKey","config","approval","trace","audit","hitl","apply","draft","walk","push","compileTools","Map","provenance","capability","contributed","gates","compileHitlGates","size","key","set","TheokitAgentError","ToolsetError","TheokitAgentError","name","message","code","Toolset","byName","Object","freeze","from","tools","Map","tool","has","set","get","undefined","resolve","names","seen","Set","map","add","keys","all","values","trimTrailingSlash","url","endsWith","slice","buildAgentCard","entry","options","base","baseUrl","name","description","route","version","capabilities","streaming","stream","pushNotifications","stateTransitionHistory","defaultInputModes","defaultOutputModes","skills","tools","map","t","id","wellKnownCardPath","agentName","MCP_PROTOCOL_VERSION","buildMcpToolDescriptors","entry","tools","map","t","name","description","inputSchema","type","properties","mcpServerInfo","version","protocolVersion","SEPARATOR","deriveConversationId","resource","thread","Error","encodeURIComponent","parseConversationId","id","idx","indexOf","length","decodeURIComponent","slice","resolveEnabledSkills","selection","ctx","undefined","filter","s","resolved","Array","isArray","Error","names","every","n","trim","length","encodeAcpMessage","message","JSON","stringify","AcpMessageDecoder","buffer","push","chunk","messages","newlineIndex","indexOf","line","slice","trim","length","parse","cause","Error","TheokitAgentError","AcpProtocolError","TheokitAgentError","name","line","options","code","isRetryable","AcpConnectionClosedError","cause","message","isResponse","m","e","error","id","isServerRequest","method","isNotification","AcpClient","nextId","pending","Map","handlers","notificationHandlers","buffer","closed","transport","subscribe","chunk","lines","split","pop","receive","trim","onClose","fail","request","params","Promise","resolve","reject","set","send","encodeAcpMessage","jsonrpc","onRequest","handler","onNotification","JSON","parse","err","Object","Array","isArray","dispatch","size","console","warn","entry","values","clear","get","delete","Error","result","handleServerRequest","catch","notify","req","reply","body","Squad","Tool","Provider","setDiagnosticsSink","SubAgent","assertNoSymlinkEscape","isForbiddenPath","safePathJoin","CONTEXT_WINDOW_FLOOR","CONTEXT_WINDOW_MARGIN","ContextWindowMarginError","resolveEffectiveContextWindow","discoverSubagents","loadSubagentDefinition","discoverSubagents","listSubagentNames","cwd","options","discovered","discoverSubagents","Object","keys","sort","a","b","localeCompare","WindowBudgetExceededError","BudgetExceededError","TheokitAgentError","InProcessApprovalRequiredError","TheokitAgentError","name","toolNames","join","code","isRetryable","postureResolver","posturePolicy","undefined","kind","awaitApproval","Promise","resolve","approved","reason","streamAgentTurnInProcess","mod","apiKey","input","deps","stream","streamAgentUIMessages","compiled","compileAgentModule","source","gated","hitl","size","approvals","keys","approvalResolver","approvalId","opts","toolName","sessionId","crypto","randomUUID","skillsResolver","enabled","resolveEnabledSkills","runContext","skills","autoInject","message","images","signal","onRunEvent","retry","exposeUsageToTools","onError","applySecurityFloor","auditEnvReachability","foldLayers","recordWiring","resolveTrustPosture","verifyLayerOrdering","GenerateObjectError","LayerOrderError","StreamObjectError","ToolError","UngatedCapabilityError","foldTurnLifecycle","Agent","AgentDoSdk"]}
|
package/dist/mcp-health.d.ts
CHANGED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, RunEventSink } from '@theokit/sdk';
|
|
2
|
+
import { RetryOptions } from '@theokit/sdk/retry';
|
|
3
|
+
import { H as HumanInTheLoopOptions, R as ReasoningEffort } from './types-D5cHmSLi.js';
|
|
4
|
+
import { A as AgentDefinition, a as CompiledAgentOptions, C as CompiledTool } from './agent-compiler-JSYkHpa7.js';
|
|
5
|
+
import { A as ApprovalRequiredEvent, S as StreamEvent } from './agent-sse-handler-BRp9vHrb.js';
|
|
6
|
+
import { SandboxPosture } from '@theokit/sdk/sandbox';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* M4 (theokit-ai-first) — the HITL producer: a `pre_tool_call` plugin that pauses the SDK run
|
|
10
|
+
* for a human-in-the-loop tool approval.
|
|
11
|
+
*
|
|
12
|
+
* ADR 0038: this is the ADAPTER seam — it makes the shipped-but-dead `@HumanInTheLoop` decorator
|
|
13
|
+
* FUNCTIONAL by wiring the SDK's OWN async `pre_tool_call` veto hook (which the SDK loop `await`s,
|
|
14
|
+
* so returning a pending Promise genuinely PAUSES the run) to a human approval. It calls no LLM,
|
|
15
|
+
* dispatches no tool, and runs no second loop — the SDK owns all of that.
|
|
16
|
+
*
|
|
17
|
+
* Flow: gated tool about to run → emit an `ApprovalRequiredEvent` (which the translator maps to
|
|
18
|
+
* the ai-sdk `tool-approval-request` chunk) → `await awaitApproval(approvalId)` (resolved by the
|
|
19
|
+
* out-of-band approve route) → allow (`undefined`) or veto (`{ block, message }`, which the SDK
|
|
20
|
+
* surfaces as a tool result the model self-corrects on).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* M20 — a settled HITL decision. Structural mirror of the harness's `ApprovalDecision` (the agents
|
|
25
|
+
* package must not import from `theokit` — dependency direction). `awaitApproval` may resolve a bare
|
|
26
|
+
* boolean (legacy) OR this object; the plugin normalizes both.
|
|
27
|
+
*/
|
|
28
|
+
interface HitlDecision {
|
|
29
|
+
approved: boolean;
|
|
30
|
+
reason?: string;
|
|
31
|
+
payload?: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* What settled this, when it was not a person (usetheokit/theokit#393).
|
|
34
|
+
*
|
|
35
|
+
* Mirrors `ApprovalDecision.settledBy` in `theokit`, for the reason the comment above this
|
|
36
|
+
* interface gives: this package must not import from `theokit`. Absent means the decision came
|
|
37
|
+
* through the approve route; `'timeout'` means the window closed with nobody deciding.
|
|
38
|
+
*/
|
|
39
|
+
settledBy?: 'timeout';
|
|
40
|
+
}
|
|
41
|
+
/** Injected wiring — the harness (mount-agent) supplies these; the plugin stays pure. */
|
|
42
|
+
interface HitlWiring {
|
|
43
|
+
/** Tool name → its `@HumanInTheLoop` config. A tool absent here is NOT gated. */
|
|
44
|
+
gated: Map<string, HumanInTheLoopOptions>;
|
|
45
|
+
/** Push the approval-required event into the agent stream (the translator emits the chunk). */
|
|
46
|
+
emit: (event: ApprovalRequiredEvent) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Await the human decision for `approvalId`; resolves approve/deny (or timeout). M20 — may resolve
|
|
49
|
+
* a bare boolean (legacy) OR a {@link HitlDecision} carrying an approver `reason` + `payload`.
|
|
50
|
+
*/
|
|
51
|
+
awaitApproval: (approvalId: string, opts: HumanInTheLoopOptions, toolName: string) => Promise<boolean | HitlDecision>;
|
|
52
|
+
/**
|
|
53
|
+
* OPTIONAL — reach the owner off the stream (usetheokit/theokit#458).
|
|
54
|
+
*
|
|
55
|
+
* `emit` above puts the pause into the run's own event stream, and that was the only egress: a
|
|
56
|
+
* caller not currently consuming it never learned the run was waiting, so the framework's
|
|
57
|
+
* asynchronous promise held exactly as long as someone was watching.
|
|
58
|
+
*
|
|
59
|
+
* This receives the same facts the stream carries and does whatever the APPLICATION does — Slack,
|
|
60
|
+
* email, a row in a table. Deliberately not a `@theokit/gateway` dependency: this package must not
|
|
61
|
+
* import from it, and picking a channel is a policy decision the framework does not get to make.
|
|
62
|
+
*
|
|
63
|
+
* Fire-and-forget by contract. The run does not wait for it and does not fail on it: a dispatch
|
|
64
|
+
* outage must not decide whether a gated tool runs, and must not delay the pause it announces.
|
|
65
|
+
*/
|
|
66
|
+
onApprovalRequired?: (request: ApprovalRequest) => void | Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/** What an application is told when a gated tool pauses. The stream's facts, off the stream. */
|
|
69
|
+
interface ApprovalRequest {
|
|
70
|
+
approvalId: string;
|
|
71
|
+
toolName: string;
|
|
72
|
+
question: string;
|
|
73
|
+
input: unknown;
|
|
74
|
+
/** Relative, exactly as the stream carries it — the app knows its own base URL; this does not. */
|
|
75
|
+
callbackUrl: string;
|
|
76
|
+
timeoutMs: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* M96 U1 — the approval posture: what a surface does when a gated tool asks for approval.
|
|
81
|
+
*
|
|
82
|
+
* ## Why a closed type, and why mandatory
|
|
83
|
+
*
|
|
84
|
+
* The defect this module closes was one of TYPE, not of behaviour. The "no HITL" posture was not
|
|
85
|
+
* representable as a value, so it was expressed as ABSENCE — and an absence has no exhaustive
|
|
86
|
+
* `match`, appears in no log, and fails no test. `toAgentFactory` compiled the `compiled.hitl` map
|
|
87
|
+
* that `.approvals({…})` produces and threw it away, with the discard admitted in writing in the
|
|
88
|
+
* JSDoc, while the sibling bridge REFUSED for the same definition.
|
|
89
|
+
*
|
|
90
|
+
* The permissive posture remains entirely expressible — as a NAMED VALUE, with a written reason.
|
|
91
|
+
* What stops existing is the omission.
|
|
92
|
+
*
|
|
93
|
+
* ## Os peers
|
|
94
|
+
*
|
|
95
|
+
* `codex` models the posture as a four-variant `enum AskForApproval` in the protocol crate, and
|
|
96
|
+
* makes forgetting it a compile error through the `ToolRuntime: Approvable + Sandboxable` supertrait;
|
|
97
|
+
* a mandatory field is the closest this type system gets to that.
|
|
98
|
+
*
|
|
99
|
+
* Omission resolves in the safe direction — never auto-approved — and the human's stand-in is named
|
|
100
|
+
* rather than inferred from the absence of one.
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/** The map of gated tools that `compileAgentDefinition` produces (`compiled.hitl`). */
|
|
104
|
+
type GatedTools = ReadonlyMap<string, HumanInTheLoopOptions>;
|
|
105
|
+
/**
|
|
106
|
+
* What this surface does when a gated tool asks for approval. Four variants, none of them
|
|
107
|
+
* "omission" — each with a concrete consumer and a written reason.
|
|
108
|
+
*/
|
|
109
|
+
type ApprovalPosture = {
|
|
110
|
+
/** There is a human: the request is EMITTED and execution pauses until the decision arrives. */
|
|
111
|
+
kind: 'interactive';
|
|
112
|
+
/**
|
|
113
|
+
* Pushes the `ApprovalRequiredEvent` into the surface's stream. MANDATORY: `toAgentFactory`
|
|
114
|
+
* returns a raw handle, with no stream and no translator, so the sink comes from whoever passes
|
|
115
|
+
* the posture — which is precisely the surface that owns the stream. A no-op default would
|
|
116
|
+
* bring the silent discard back through the back door: the request would be "emitted" nowhere.
|
|
117
|
+
*/
|
|
118
|
+
emit: (event: ApprovalRequiredEvent) => void;
|
|
119
|
+
/** Resolves the human decision; execution stays paused until this settles. */
|
|
120
|
+
awaitApproval: (approvalId: string, opts: HumanInTheLoopOptions, toolName: string) => Promise<boolean | HitlDecision>;
|
|
121
|
+
} | {
|
|
122
|
+
/** Nobody asks and the tool runs. Legitimate only when something else confines the execution. */
|
|
123
|
+
kind: 'auto-approve';
|
|
124
|
+
/**
|
|
125
|
+
* M77 — the EVIDENCE that something else confines the execution. Not optional, and not a
|
|
126
|
+
* string.
|
|
127
|
+
*
|
|
128
|
+
* This is the most consequential decision a coding agent makes — "run commands without
|
|
129
|
+
* asking" — and until M77 its type asked only for a `reason: string`. A string is
|
|
130
|
+
* unverifiable at the seam: nothing could tell "confined by bwrap, kernel-enforced" from
|
|
131
|
+
* "I'm sure it's fine". So the consumer implemented the refusal itself, TWICE
|
|
132
|
+
* (`shouldAutoApprove` in the TUI, `resolveHeadlessApproval` in the headless path), with the
|
|
133
|
+
* same rule in both — an absent posture counts as unconfined. A security rule duplicated
|
|
134
|
+
* across two call sites is a rule that will eventually disagree with itself (G12).
|
|
135
|
+
*
|
|
136
|
+
* `SandboxPosture` is the SDK's own honest answer to "am I kernel-enforced right now?", and
|
|
137
|
+
* it carries `detail` so a refusal can say WHY rather than just "unconfined". Requiring it
|
|
138
|
+
* makes the unconfined case unrepresentable at the type level; {@link applyPosture} refuses
|
|
139
|
+
* it at runtime for the caller who casts past the type.
|
|
140
|
+
*/
|
|
141
|
+
confinedBy: SandboxPosture;
|
|
142
|
+
reason: string;
|
|
143
|
+
} | {
|
|
144
|
+
/** Nobody asks and the tool does NOT run — the safe reading of omission (codex `GranularApprovalConfig`). */
|
|
145
|
+
kind: 'auto-reject';
|
|
146
|
+
reason: string;
|
|
147
|
+
} | {
|
|
148
|
+
/**
|
|
149
|
+
* The gate is driven by the SERVING SURFACE (the ACP client, through the protocol itself), so
|
|
150
|
+
* the layer installs no plugin at all. It is a bypass — but a NAMED bypass, with a written
|
|
151
|
+
* reason, that shows up in the `match`, shows up in logs and can be counted by a gate. What it
|
|
152
|
+
* replaces is worse: today the same effect happens by omission, with none of that.
|
|
153
|
+
*/
|
|
154
|
+
kind: 'owned-by-surface';
|
|
155
|
+
reason: string;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Writes the plugins the posture requires into `extra` — the object `toAgentFactory` spreads AFTER
|
|
159
|
+
* `m8` into the `Agent.create` options, and which therefore wins. Plugins already present (from the
|
|
160
|
+
* agent, via `m8`, and from an override, via `extra`) are preserved: running them over is the M14
|
|
161
|
+
* regression that `buildExtraCreateOptions` already carries a guard against.
|
|
162
|
+
*
|
|
163
|
+
* The legacy `plugins` shape (an `{ enabled }` object) cannot carry both, so a posture that needs to
|
|
164
|
+
* install a plugin alongside it is refused LOUD AND CLEAR, rather than resolved by dropping one of
|
|
165
|
+
* them: silently dropping the approval gate is exactly the class of defect this milestone closes
|
|
166
|
+
* (Rule 8, fail-closed).
|
|
167
|
+
*/
|
|
168
|
+
declare function applyPosture(extra: Record<string, unknown>, m8: {
|
|
169
|
+
plugins?: unknown;
|
|
170
|
+
}, posturePolicy: ApprovalPosture, gated: GatedTools | undefined): void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A definition, or a THUNK that produces one per session.
|
|
174
|
+
*
|
|
175
|
+
* M91 — the `apiKey` line just below has accepted a thunk since M74, added for **exactly** this
|
|
176
|
+
* reason. The asymmetry was one line wide and cost a lot: with the object shape, trust, hooks, skills
|
|
177
|
+
* and MCP are frozen at module load. In a `theokit acp` process an IDE keeps open for hours, that
|
|
178
|
+
* reintroduces the staleness M67 removed by moving construction to the entry point.
|
|
179
|
+
*/
|
|
180
|
+
type DefinitionOrThunk = AgentDefinition | ((sessionId: string) => AgentDefinition | Promise<AgentDefinition>);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* SDK Adapter — bridges @theokit/agents decorators → @theokit/sdk runtime.
|
|
184
|
+
*
|
|
185
|
+
* Per rule sdk-runtime.md (UNBREAKABLE): @theokit/sdk is the ONLY agent runtime.
|
|
186
|
+
* This adapter replaces llm-runner.ts (which called OpenRouter API directly).
|
|
187
|
+
*
|
|
188
|
+
* Flow: @Agent decorator → compileAgent() → createSdkAgentStream() → SDK Agent.create() → Run.stream()
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Per-request overrides forwarded into `Agent.create` (V4-L.2 + V4-L.3). Bundled into
|
|
193
|
+
* one object (rather than positional params) so the per-request surface can grow without
|
|
194
|
+
* a parameter explosion. Each field is Axis-A SWAP — a value the app holds at call time.
|
|
195
|
+
*/
|
|
196
|
+
/**
|
|
197
|
+
* A multimodal image for a send turn — the SDK's `SDKImage` shape, typed locally because `@theokit/sdk`
|
|
198
|
+
* is an optional peer (dynamic import). Either a URL or inline base64 `{ data, mimeType }`.
|
|
199
|
+
*/
|
|
200
|
+
type BridgeImage = {
|
|
201
|
+
url: string;
|
|
202
|
+
} | {
|
|
203
|
+
data: string;
|
|
204
|
+
mimeType: string;
|
|
205
|
+
};
|
|
206
|
+
interface RuntimeOverrides {
|
|
207
|
+
/** Overrides the model for this call (`?? compiled.model ?? default`). */
|
|
208
|
+
model?: string | ModelSelection;
|
|
209
|
+
/**
|
|
210
|
+
* M35 (multimodal) — images to send alongside the text. When present, the SDK send switches from the
|
|
211
|
+
* plain-string form to the structured `{ text, images }` form (`SDKUserMessage`). Absent ⇒ the
|
|
212
|
+
* string path is byte-unchanged (back-compat).
|
|
213
|
+
*/
|
|
214
|
+
images?: readonly BridgeImage[];
|
|
215
|
+
/**
|
|
216
|
+
* Per-run extended-thinking effort (`?? compiled.reasoningEffort`). Mapped to the SDK
|
|
217
|
+
* `ModelSelection.params` so the provider produces reasoning (surfaced as `thinking` StreamEvents).
|
|
218
|
+
*/
|
|
219
|
+
reasoningEffort?: ReasoningEffort;
|
|
220
|
+
/**
|
|
221
|
+
* Per-run opt-in (`?? compiled.parseThinkTags`): when true, wrap the event stream with the M2
|
|
222
|
+
* `<think>`-tag extractor so inline `<think>…</think>` text becomes `thinking` StreamEvents.
|
|
223
|
+
*/
|
|
224
|
+
parseThinkTags?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Per-run opt-in (`?? compiled.stripToolDialect`): when true, strip a leaked Hermes
|
|
227
|
+
* `<function=…></tool_call>` tool-call dialect out of the assistant text stream (theocode#32).
|
|
228
|
+
*/
|
|
229
|
+
stripToolDialect?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Per-run opt-in (`?? compiled.recoverLeakedToolCalls`): when true, enable the SDK chat route's
|
|
232
|
+
* `extractToolCallsFromContent` so a leaked Hermes `<function=…></tool_call>` dialect is recovered
|
|
233
|
+
* and EXECUTED (theokit#58). Sibling of {@link stripToolDialect}; has effect only when {@link providers}
|
|
234
|
+
* routes a provider.
|
|
235
|
+
*/
|
|
236
|
+
recoverLeakedToolCalls?: boolean;
|
|
237
|
+
/** Per-run cwd → `Agent.create({ local: { cwd } })` → `SystemPromptContext.cwd`. */
|
|
238
|
+
cwd?: string;
|
|
239
|
+
/**
|
|
240
|
+
* M7 — per-run run-context override (`?? compiled.runContext`). Injected into every tool
|
|
241
|
+
* handler's `ctx.context` by `buildSdkTools`. Lets a single request override the agent-level
|
|
242
|
+
* `defineAgent({ context })` (mirrors `model`/`cwd`).
|
|
243
|
+
*/
|
|
244
|
+
runContext?: Record<string, unknown>;
|
|
245
|
+
/**
|
|
246
|
+
* Per-run plugins (e.g. permission gate selected by request mode). Accepts EITHER
|
|
247
|
+
* named-plugin discovery settings (`{ enabled: [...] }`) OR an array of code `Plugin`
|
|
248
|
+
* objects, forwarded RAW through the duck-typed `Agent.create` bridge (mirrors the
|
|
249
|
+
* @theokit/sdk `AgentOptions.plugins` widen).
|
|
250
|
+
*/
|
|
251
|
+
plugins?: PluginsSettings | readonly Plugin[];
|
|
252
|
+
/** Per-run provider routing. */
|
|
253
|
+
providers?: ProviderRoutingSettings;
|
|
254
|
+
/** Per-run sub-agent definitions (opts-only; `compiled.agents` stays deferred — ADR D3). */
|
|
255
|
+
agents?: Record<string, AgentDefinition$1>;
|
|
256
|
+
/** Per-run SDK budget tracker (inner tool-loop cap; distinct from the loop's USD `budget`). */
|
|
257
|
+
budgetTracker?: BudgetTracker;
|
|
258
|
+
/**
|
|
259
|
+
* SDK 4.0 (SE40) — root of the native Claude-shaped `.jsonl` session transcript the SDK writes
|
|
260
|
+
* automatically (`<root>/projects/<encoded-cwd>/<agentId>.jsonl`). The framework threads the
|
|
261
|
+
* app's project root here (see `mount-agent`) so sessions persist per-app; unset ⇒ SDK default
|
|
262
|
+
* (`~/.theokit`). Replaces the removed pluggable `conversationStorage` — persistence is now the
|
|
263
|
+
* SDK's native transcript, not a swappable adapter.
|
|
264
|
+
*
|
|
265
|
+
* Forwarded to the SDK as `local.baseDir`, which that package deprecated in its own #301 in favour
|
|
266
|
+
* of `sessionDir`. It stays `baseDir` on purpose: `sessionDir` does not exist at `^4.52.1`, the
|
|
267
|
+
* floor this package declares, so switching would type-error on the floor and — worse — silently
|
|
268
|
+
* send the transcript to the SDK default `~/.theokit` for any consumer resolving there, losing
|
|
269
|
+
* per-app persistence. Migrating the name is a floor bump, not a rename, and the deprecated field
|
|
270
|
+
* is still honoured. Attempted and reverted rather than assumed: the typecheck gate caught it.
|
|
271
|
+
*
|
|
272
|
+
* **Setting this also relocates the agent's durable MEMORY**, which the SDK's own docstring for
|
|
273
|
+
* the field denies ("Only transcripts are written here"). `MEMORY.md` moves from
|
|
274
|
+
* `<cwd>/.theokit/memory/` to `<root>/projects/<encoded-cwd>/memory/`, while `.index/` and
|
|
275
|
+
* `sessions/` stay behind — so the store looks alive and the capture looks broken. Since the
|
|
276
|
+
* mount sets this unconditionally, it applies to every agent the framework serves.
|
|
277
|
+
*
|
|
278
|
+
* Measured against `@theokit/sdk` 4.62.0 and filed as usetheokit/theokit-sdk#463; the downstream
|
|
279
|
+
* report is usetheokit/theokit#557. Documented here rather than worked around because one SDK
|
|
280
|
+
* field governs both roots — there is no way to place them separately from this side.
|
|
281
|
+
*/
|
|
282
|
+
baseDir?: string;
|
|
283
|
+
/**
|
|
284
|
+
* V4-Q: pre-built SDK `CustomTool[]` forwarded RAW to `Agent.create.tools` (appended after the
|
|
285
|
+
* compiled tools), bypassing `defineTool` (which requires a Zod schema). Lets an app whose tools
|
|
286
|
+
* come from imperative SDK factories supply them without the `@Tool` compile path.
|
|
287
|
+
*/
|
|
288
|
+
sdkTools?: readonly CustomTool[];
|
|
289
|
+
/**
|
|
290
|
+
* theokit#132 — sink for the SDK's typed `RunEvent`s (`tool_progress`, `rate_limit`,
|
|
291
|
+
* `permission_denied`, `task_*`, `compact_boundary`, `tripwire`, `completion_check`), threaded
|
|
292
|
+
* straight to `SendOptions.onRunEvent`.
|
|
293
|
+
*
|
|
294
|
+
* Threaded, NOT multiplexed into the UIMessage stream. These are run diagnostics for an observer —
|
|
295
|
+
* theokit-studio's event inspector is the demand that opened the issue — and folding them into the
|
|
296
|
+
* message protocol would force every consumer of the chat stream to know about frames it has no
|
|
297
|
+
* use for. Threading leaves the chat path byte-identical for anyone who does not opt in, which is
|
|
298
|
+
* why the key is omitted entirely rather than set to `undefined` when absent.
|
|
299
|
+
*/
|
|
300
|
+
onRunEvent?: RunEventSink;
|
|
301
|
+
/**
|
|
302
|
+
* theokit#474 — per-turn transient retry, opt-in.
|
|
303
|
+
*
|
|
304
|
+
* When set, the START of the turn (the SDK handshake plus its first event, before anything is
|
|
305
|
+
* yielded) is wrapped in the SDK `Retry`, so a 429/5xx/network blip that kills the turn before it
|
|
306
|
+
* produced anything is recovered instead of ending it. Absent ⇒ a single attempt, and the key is
|
|
307
|
+
* omitted from every downstream call, so the stream is byte-identical to before.
|
|
308
|
+
*
|
|
309
|
+
* See `turn-retry.ts` for why a rejection-shaped retry would have been inert on this path, and
|
|
310
|
+
* for the invariant that closes the retry window on the first event.
|
|
311
|
+
*/
|
|
312
|
+
retry?: RetryOptions;
|
|
313
|
+
/**
|
|
314
|
+
* theokit#475 — expose the run's REAL token usage to tool handlers as `ctx.usage`, opt-in.
|
|
315
|
+
*
|
|
316
|
+
* When true, the adapter installs a {@link RunUsageMeter} as the run's `budgetTracker` (wrapping
|
|
317
|
+
* the caller's own, when there is one) and hands every tool handler a snapshot of what the
|
|
318
|
+
* provider has reported so far. A tool can then answer "how much context is left?" from a
|
|
319
|
+
* measurement instead of a character-count estimate. See `usage/run-usage.ts`.
|
|
320
|
+
*
|
|
321
|
+
* Opt-in rather than always-on because installing a `budgetTracker` changes what `Agent.create`
|
|
322
|
+
* receives for every run that never asked for it, and the back-compat floor here is a floor, not
|
|
323
|
+
* a preference. Absent ⇒ handlers are wrapped exactly as before (`ctx.usage` does not exist) and
|
|
324
|
+
* the SDK receives no tracker it was not already given.
|
|
325
|
+
*/
|
|
326
|
+
exposeUsageToTools?: boolean;
|
|
327
|
+
}
|
|
328
|
+
declare function createSdkAgentStream(compiled: CompiledAgentOptions, compiledTools: CompiledTool[], apiKey: string | (() => string | Promise<string>), overrides?: RuntimeOverrides): ((message: string, sessionId: string, factoryOpts?: {
|
|
329
|
+
disableTools?: boolean;
|
|
330
|
+
}) => AsyncIterable<StreamEvent>) & {
|
|
331
|
+
resolvedModel: string | ModelSelection;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* The minimal `SDKAgent` surface a serving host needs (ACP checks `agentId: string` + `send: fn`).
|
|
335
|
+
* `Agent.getOrCreate` returns the real SDK agent — this alias just types what {@link toAgentFactory}
|
|
336
|
+
* hands back without re-exporting the full `@theokit/sdk` `Agent` type.
|
|
337
|
+
*/
|
|
338
|
+
/**
|
|
339
|
+
* The minimum a turn returns. Structural on purpose (M91's ADR-2).
|
|
340
|
+
*
|
|
341
|
+
* Re-exporting the SDK's type would tie this layer's public signature to theirs — the opposite of
|
|
342
|
+
* what the boundary exists to do, and the same reason `SdkAgentHandle` was already an alias rather
|
|
343
|
+
* than a re-export.
|
|
344
|
+
*
|
|
345
|
+
* `status` and `error` are what the SDK eval runner reads: a row is scored only when
|
|
346
|
+
* `status === 'finished'`, and otherwise errors with `error?.message ?? 'run <status>'` (B-413).
|
|
347
|
+
* A guard block never resolves here: it rejects with `GuardrailViolationError` (`send` for input,
|
|
348
|
+
* `wait` for output, theokit#139). The ACP server (4.0.1) answers that with JSON-RPC -32603 carrying
|
|
349
|
+
* the guard's name and reason, and no text; it keeps `refusal` for `error.code: 'safety_blocked'`.
|
|
350
|
+
*/
|
|
351
|
+
interface SdkTurnHandle {
|
|
352
|
+
wait: () => Promise<{
|
|
353
|
+
result?: string;
|
|
354
|
+
usage?: {
|
|
355
|
+
totalTokens?: number;
|
|
356
|
+
};
|
|
357
|
+
status?: string;
|
|
358
|
+
error?: {
|
|
359
|
+
message: string;
|
|
360
|
+
};
|
|
361
|
+
}>;
|
|
362
|
+
stream?: () => AsyncIterable<unknown>;
|
|
363
|
+
}
|
|
364
|
+
/** Per-turn options. Open for now — the SDK accepts more than the layer needs to declare. */
|
|
365
|
+
type SdkSendOptions = Record<string, unknown>;
|
|
366
|
+
interface SdkAgentHandle {
|
|
367
|
+
readonly agentId: string;
|
|
368
|
+
/**
|
|
369
|
+
* B-062 — a tool-using run that returns schema-validated output.
|
|
370
|
+
*
|
|
371
|
+
* The SDK's `agent.generate(input, { output })` "runs the agent's NORMAL tool loop (the user's
|
|
372
|
+
* tools run first) and then coerces the final answer into a Zod schema". It existed and this
|
|
373
|
+
* handle did not declare it, so a consumer of `@theokit/agents` could reach it only by importing
|
|
374
|
+
* `@theokit/sdk` directly — the one thing this layer's doctrine forbids.
|
|
375
|
+
*
|
|
376
|
+
* The survey that filed this concluded the capability was absent, having measured `generateObject`
|
|
377
|
+
* — which is the TOOLLESS path by design: it builds a transient agent whose only tool is the
|
|
378
|
+
* synthetic output tool. Both paths exist and answer different questions.
|
|
379
|
+
*
|
|
380
|
+
* OPTIONAL, because a caller-injected handle (tests, a custom transport) need not implement it,
|
|
381
|
+
* and requiring it would break every such double to add a method most of them never call.
|
|
382
|
+
*
|
|
383
|
+
* BOTH wrappers (`handle-wrappers.ts`) forward it, and `pluginManager`. A wrapper that rebuilds the
|
|
384
|
+
* handle silently removes every method it does not name, and the consumer meets the loss at runtime
|
|
385
|
+
* as "the handle has no `generate`" after the types said it had one. Each forward is pinned by test.
|
|
386
|
+
*
|
|
387
|
+
* It is NOT put through the output guards, stated rather than assumed: `generate` resolves to a
|
|
388
|
+
* validated OBJECT and those guards moderate TEXT, so running them over a serialised object would
|
|
389
|
+
* moderate a shape no guard was written against. Guarding the structured path needs its own
|
|
390
|
+
* decision about what a redaction means to a schema, and inventing one would be the gate that
|
|
391
|
+
* reports without gating this module already refuses to build.
|
|
392
|
+
*/
|
|
393
|
+
readonly generate?: (message: string, options: {
|
|
394
|
+
output: unknown;
|
|
395
|
+
[key: string]: unknown;
|
|
396
|
+
}) => Promise<unknown>;
|
|
397
|
+
readonly pluginManager?: () => unknown;
|
|
398
|
+
/**
|
|
399
|
+
* M91 — era `(msg: string, opts?: unknown) => unknown`.
|
|
400
|
+
*
|
|
401
|
+
* The `unknown` return cost the consumer a whole module: `agents/lib/goal/runner-facade.ts`, 38
|
|
402
|
+
* lines whose only job was to re-narrow this return into the `send → wait` contract the goal loop
|
|
403
|
+
* requires. That module's docstring records that, before it, the caller wrote `as never` — and that
|
|
404
|
+
* **it was under that cover that the goal surface diverged from the real agent for several
|
|
405
|
+
* milestones**. The layer always knew the shape; it simply did not declare it.
|
|
406
|
+
*
|
|
407
|
+
* The shape is **asynchronous**: `SDKAgent.send` returns `Promise<Run>`, and the SDK's
|
|
408
|
+
* `GoalLoopAgent` declares `send(prompt): Promise<{ wait(): Promise<…> }>`. This milestone's first
|
|
409
|
+
* attempt typed it as synchronous and the consumer's `tsc` would not have caught it — the facade's
|
|
410
|
+
* `as never` absorbed the difference. It is literally the divergence the facade's docstring
|
|
411
|
+
* described, met again while trying to remove it.
|
|
412
|
+
*/
|
|
413
|
+
send: (msg: string, opts?: SdkSendOptions) => Promise<SdkTurnHandle>;
|
|
414
|
+
dispose: () => Promise<void>;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* #12 — bridge a builder/`defineAgent` {@link TheokitAgentDefinition} to a real `SDKAgent` FACTORY,
|
|
418
|
+
* so surfaces that require an `SDKAgent` (or `(sessionId) => SDKAgent`) — notably `theokit acp`,
|
|
419
|
+
* whose entry default-export must be one — can serve an agent defined with the `AgentBuilder.create()` chain.
|
|
420
|
+
*
|
|
421
|
+
* The factory reuses the SAME projection the streaming path uses (`compileAgentDefinition` → tools /
|
|
422
|
+
* model / `assembleM8CreateOptions`), so the served agent has identical tools, model, system prompt,
|
|
423
|
+
* skills, and `mcpServers`. Keyed per `sessionId` via `Agent.getOrCreate` (matches the run path).
|
|
424
|
+
*
|
|
425
|
+
* M96 — the surface DECLARES its {@link ApprovalPosture} and the factory installs the plugin the
|
|
426
|
+
* variant requires. Before, the `compiled.hitl` map was compiled and DISCARDED here. Rationale in
|
|
427
|
+
* `./approval-posture.ts`.
|
|
428
|
+
*/
|
|
429
|
+
declare function toAgentFactory(def: DefinitionOrThunk, opts: {
|
|
430
|
+
apiKey: string | (() => string | Promise<string>);
|
|
431
|
+
approvals: ApprovalPosture;
|
|
432
|
+
overrides?: RuntimeOverrides;
|
|
433
|
+
}): (sessionId: string) => Promise<SdkAgentHandle>;
|
|
434
|
+
|
|
435
|
+
export { type ApprovalPosture as A, type DefinitionOrThunk as D, type HitlDecision as H, type RuntimeOverrides as R, type SdkAgentHandle as S, type ApprovalRequest as a, type SdkSendOptions as b, type SdkTurnHandle as c, applyPosture as d, createSdkAgentStream as e, type HitlWiring as f, toAgentFactory as t };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AgentOutputEvent } from '@theokit/presenter';
|
|
2
2
|
export { AgentOutputEvent } from '@theokit/presenter';
|
|
3
3
|
import { WireChunk } from '@theokit/presenter/wire';
|
|
4
|
-
import { A as AgentDefinition } from './agent-compiler-
|
|
4
|
+
import { A as AgentDefinition } from './agent-compiler-JSYkHpa7.js';
|
|
5
5
|
import '@theokit/sdk';
|
|
6
6
|
import '@theokit/sdk/subagents-loader';
|
|
7
7
|
import '@theokit/sdk/errors';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-D5cHmSLi.js';
|
|
9
9
|
import 'zod';
|
|
10
10
|
import './setting-sources-gate-BJJiKq33.js';
|
|
11
11
|
import './hook-handlers-Cw2FsnE5.js';
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
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';
|
|
2
2
|
import * as _theokit_sdk from '@theokit/sdk';
|
|
3
3
|
import { TheokitAgentError } from '@theokit/sdk/errors';
|
|
4
|
-
import {
|
|
4
|
+
import { a as DelegateOptions } from './agent-orchestrator-BFWg2URC.js';
|
|
5
|
+
import { D as DelegationTarget } from './delegation-scoring-Cn5eM4lQ.js';
|
|
5
6
|
import { z } from 'zod';
|
|
6
7
|
import '@theokit/sdk/retry';
|
|
7
|
-
import './agent-compiler-
|
|
8
|
+
import './agent-compiler-JSYkHpa7.js';
|
|
8
9
|
import '@theokit/sdk/subagents-loader';
|
|
9
|
-
import './types-
|
|
10
|
+
import './types-D5cHmSLi.js';
|
|
10
11
|
import './setting-sources-gate-BJJiKq33.js';
|
|
11
12
|
import './hook-handlers-Cw2FsnE5.js';
|
|
13
|
+
import './agent-sse-handler-BRp9vHrb.js';
|
|
12
14
|
import '@theokit/presenter/wire';
|
|
13
15
|
|
|
14
16
|
/**
|