@tangle-network/agent-runtime 0.52.0 → 0.53.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.
Files changed (48) hide show
  1. package/dist/agent.d.ts +2 -2
  2. package/dist/agent.js +2 -2
  3. package/dist/analyst-loop.d.ts +1 -1
  4. package/dist/{chunk-7SP2OVYZ.js → chunk-5M2WDWBI.js} +3 -3
  5. package/dist/{chunk-4JI4BCBI.js → chunk-AYRQZRDV.js} +2 -2
  6. package/dist/{chunk-BERLUBAP.js → chunk-FO4DCM7R.js} +2 -2
  7. package/dist/{chunk-7JITYN6T.js → chunk-JFIYKDXF.js} +17 -2
  8. package/dist/chunk-JFIYKDXF.js.map +1 -0
  9. package/dist/{chunk-COAVO6QB.js → chunk-K5M3SHEU.js} +3 -3
  10. package/dist/{chunk-2OU7ZQPD.js → chunk-K6WP7PYW.js} +42 -57
  11. package/dist/chunk-K6WP7PYW.js.map +1 -0
  12. package/dist/{chunk-V2K35HF2.js → chunk-P4QNEXFC.js} +2 -2
  13. package/dist/{coder-_YCf3BAK.d.ts → coder-LKm3Mczw.d.ts} +1 -1
  14. package/dist/{delegation-profile-1GbW5yA3.d.ts → delegation-profile-Bvfro2m1.d.ts} +28 -2
  15. package/dist/{driver-DLI1io57.d.ts → driver-B2RKkVJW.d.ts} +1 -1
  16. package/dist/index.d.ts +7 -7
  17. package/dist/index.js +7 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/intelligence.d.ts +475 -5
  20. package/dist/intelligence.js +547 -3
  21. package/dist/intelligence.js.map +1 -1
  22. package/dist/{kb-gate-CHAyt4aI.d.ts → kb-gate-CKfykcYQ.d.ts} +2 -2
  23. package/dist/{loop-runner-bin-DFUNgpeK.d.ts → loop-runner-bin-D4Ir7b00.d.ts} +4 -4
  24. package/dist/loop-runner-bin.d.ts +5 -5
  25. package/dist/loop-runner-bin.js +3 -3
  26. package/dist/loops.d.ts +6 -5
  27. package/dist/loops.js +1 -1
  28. package/dist/mcp/bin.js +4 -4
  29. package/dist/mcp/index.d.ts +7 -7
  30. package/dist/mcp/index.js +6 -6
  31. package/dist/{openai-tools-D4HLDWgw.d.ts → openai-tools-CKfR3EMh.d.ts} +1 -1
  32. package/dist/profiles.d.ts +2 -2
  33. package/dist/router-client-B0Qi1NiN.d.ts +120 -0
  34. package/dist/{run-loop-BIineL1T.d.ts → run-loop-DgVhucoR.d.ts} +1 -1
  35. package/dist/runtime.d.ts +16 -119
  36. package/dist/runtime.js +1 -1
  37. package/dist/{types-5MGt5KTY.d.ts → types-CNDJCL_0.d.ts} +1 -1
  38. package/dist/{types-BEQsBhOE.d.ts → types-CklkW4Eh.d.ts} +2 -1
  39. package/dist/workflow.d.ts +2 -2
  40. package/dist/workflow.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-2OU7ZQPD.js.map +0 -1
  43. package/dist/chunk-7JITYN6T.js.map +0 -1
  44. /package/dist/{chunk-7SP2OVYZ.js.map → chunk-5M2WDWBI.js.map} +0 -0
  45. /package/dist/{chunk-4JI4BCBI.js.map → chunk-AYRQZRDV.js.map} +0 -0
  46. /package/dist/{chunk-BERLUBAP.js.map → chunk-FO4DCM7R.js.map} +0 -0
  47. /package/dist/{chunk-COAVO6QB.js.map → chunk-K5M3SHEU.js.map} +0 -0
  48. /package/dist/{chunk-V2K35HF2.js.map → chunk-P4QNEXFC.js.map} +0 -0
package/dist/mcp/index.js CHANGED
@@ -14,12 +14,12 @@ import {
14
14
  removeWorktree,
15
15
  traceContextToEnv,
16
16
  validateDelegateUiAuditArgs
17
- } from "../chunk-7SP2OVYZ.js";
17
+ } from "../chunk-5M2WDWBI.js";
18
18
  import "../chunk-WIR4HOOJ.js";
19
19
  import {
20
20
  mcpToolsForRuntimeMcp,
21
21
  mcpToolsForRuntimeMcpSubset
22
- } from "../chunk-V2K35HF2.js";
22
+ } from "../chunk-P4QNEXFC.js";
23
23
  import {
24
24
  DELEGATE_CODE_DESCRIPTION,
25
25
  DELEGATE_CODE_INPUT_SCHEMA,
@@ -54,7 +54,7 @@ import {
54
54
  validateDelegateResearchArgs,
55
55
  validateDelegationHistoryArgs,
56
56
  validateDelegationStatusArgs
57
- } from "../chunk-BERLUBAP.js";
57
+ } from "../chunk-FO4DCM7R.js";
58
58
  import {
59
59
  createKbGate
60
60
  } from "../chunk-FNMGYYSS.js";
@@ -75,7 +75,7 @@ import {
75
75
  parseDetachedSessionRef,
76
76
  runDetachedTurn,
77
77
  settleDetachedCoderTurn
78
- } from "../chunk-4JI4BCBI.js";
78
+ } from "../chunk-AYRQZRDV.js";
79
79
  import "../chunk-KADIJAD4.js";
80
80
  import {
81
81
  runLocalHarness
@@ -84,11 +84,11 @@ import {
84
84
  DELEGATION_MCP_SERVER_KEY,
85
85
  buildDelegationMcpServer,
86
86
  composeProductionAgentProfile
87
- } from "../chunk-7JITYN6T.js";
87
+ } from "../chunk-JFIYKDXF.js";
88
88
  import "../chunk-G3RGMA7C.js";
89
89
  import {
90
90
  assertTraceDerivedFindings
91
- } from "../chunk-2OU7ZQPD.js";
91
+ } from "../chunk-K6WP7PYW.js";
92
92
  import "../chunk-GSUO5QS6.js";
93
93
  import "../chunk-DGUM43GV.js";
94
94
 
@@ -1,4 +1,4 @@
1
- import { c as OpenAIChatTool } from './types-BEQsBhOE.js';
1
+ import { c as OpenAIChatTool } from './types-CklkW4Eh.js';
2
2
 
3
3
  /**
4
4
  * @experimental
@@ -1,5 +1,5 @@
1
- export { C as CoderOutput, a as CoderProfileOptions, b as CoderTask, M as MultiHarnessCoderFanoutOptions, c as coderProfile, d as createCoderValidator, m as multiHarnessCoderFanout } from './coder-_YCf3BAK.js';
2
- import { S as SandboxClient, O as OutputAdapter, V as Validator, A as AgentRunSpec } from './types-BEQsBhOE.js';
1
+ export { C as CoderOutput, a as CoderProfileOptions, b as CoderTask, M as MultiHarnessCoderFanoutOptions, c as coderProfile, d as createCoderValidator, m as multiHarnessCoderFanout } from './coder-LKm3Mczw.js';
2
+ import { S as SandboxClient, O as OutputAdapter, V as Validator, A as AgentRunSpec } from './types-CklkW4Eh.js';
3
3
  import { a as UiLens, U as UiFinding } from './substrate-CUgk7F7s.js';
4
4
  export { b as UI_FINDING_SEVERITIES, c as UI_LENSES, d as UiFindingScreenshot, e as UiFindingSeverity } from './substrate-CUgk7F7s.js';
5
5
  import { SandboxEvent, AgentProfile } from '@tangle-network/sandbox';
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The one router chat client: direct OpenAI-compatible completions through the
3
+ * Tangle router — the cheapest dial, no sandbox. Three layers: `routerChatWithUsage`
4
+ * (chat-only), `routerChatWithTools` (one completion with function tools), and
5
+ * `routerToolLoop` (the off-box agentic loop over tool-calling). Shared by the
6
+ * built-in executors and the bench/lab harnesses.
7
+ *
8
+ * Reports REAL token usage so the backend-integrity guard sees a real backend.
9
+ * Returns `undefined` usage when the provider omitted it — never a fabricated 0
10
+ * (a phantom 0 reads as a free call downstream, which the gate would act on).
11
+ */
12
+ interface RouterConfig {
13
+ routerBaseUrl: string;
14
+ routerKey: string;
15
+ model: string;
16
+ }
17
+ interface RouterChatResult {
18
+ content: string;
19
+ /** REAL usage, or undefined when the provider reported none. */
20
+ usage?: {
21
+ input: number;
22
+ output: number;
23
+ };
24
+ /** Derived from usage via `estimateCost` when the model is priced; else undefined. */
25
+ costUsd?: number;
26
+ }
27
+ declare function routerChatWithUsage(cfg: RouterConfig, messages: Array<{
28
+ role: string;
29
+ content: string;
30
+ }>, opts?: {
31
+ temperature?: number;
32
+ signal?: AbortSignal;
33
+ maxTokens?: number;
34
+ }): Promise<RouterChatResult>;
35
+ /** A tool-call the model emitted (provider-neutral; mirrors the runtime's ToolCallRequest). */
36
+ interface RouterToolCall {
37
+ id: string;
38
+ name: string;
39
+ /** Raw JSON arguments string as emitted by the model. */
40
+ arguments: string;
41
+ }
42
+ interface RouterChatToolsResult {
43
+ content: string | null;
44
+ toolCalls: RouterToolCall[];
45
+ usage?: {
46
+ input: number;
47
+ output: number;
48
+ };
49
+ costUsd?: number;
50
+ }
51
+ /**
52
+ * A router completion WITH tool-calling — the operator driver's LLM seam. Passes OpenAI-shape
53
+ * `messages` (system/user/assistant-with-tool_calls/tool roles) + function `tools`, and returns the
54
+ * assistant text plus the tool calls the model wants run. Same fail-loud + real-usage discipline as
55
+ * `routerChatWithUsage`. `tool_choice: 'auto'` lets the model decide; the driver loops on the result.
56
+ */
57
+ declare function routerChatWithTools(cfg: RouterConfig, messages: ReadonlyArray<Record<string, unknown>>, tools: ReadonlyArray<{
58
+ type: 'function';
59
+ function: {
60
+ name: string;
61
+ description?: string;
62
+ parameters: unknown;
63
+ };
64
+ }>, opts?: {
65
+ temperature?: number;
66
+ signal?: AbortSignal;
67
+ toolChoice?: 'auto' | 'required' | 'none';
68
+ maxTokens?: number;
69
+ }): Promise<RouterChatToolsResult>;
70
+ interface ToolSpec {
71
+ type: 'function';
72
+ function: {
73
+ name: string;
74
+ description?: string;
75
+ parameters: unknown;
76
+ };
77
+ }
78
+ interface RouterToolLoopResult {
79
+ /** The model's final assistant text (the turn where it stopped calling tools, or the budget turn). */
80
+ final: string;
81
+ /** Inference turns spent (≤ maxTurns) — the equal-budget unit vs random@k. */
82
+ turns: number;
83
+ toolCalls: number;
84
+ /** The behavior trace: each tool call + its result, in order. What a trace-analyst
85
+ * steerer reads (behavior, never the verdict) to diagnose + redirect the next shot. */
86
+ toolTrace: Array<{
87
+ name: string;
88
+ args: string;
89
+ result: string;
90
+ }>;
91
+ usage: {
92
+ input: number;
93
+ output: number;
94
+ };
95
+ /** The full conversation after the loop (seed + every assistant/tool turn). Lets a caller
96
+ * CARRY the messages into the next shot (depth continuation) and read the trajectory. */
97
+ messages: Array<Record<string, unknown>>;
98
+ }
99
+ /**
100
+ * The tool-using router backend: a real agentic loop OVER the Tangle router (which
101
+ * supports tool-calling), off-box — no sandbox. Each turn is one router completion
102
+ * with `tools`; if the model emits tool_calls, `execute` runs them on the host and
103
+ * their results are folded back as `tool` messages; the loop repeats until the
104
+ * model answers without a tool call or the turn budget is hit. One turn = one
105
+ * inference call, so `maxTurns` is the equal-compute unit against random@k.
106
+ *
107
+ * This is the depth substrate for agentic gates (the worker ACTS, observes the real
108
+ * result, and continues) that the chat-only `routerChatWithUsage` cannot express.
109
+ */
110
+ declare function routerToolLoop(cfg: RouterConfig, system: string, user: string, tools: ReadonlyArray<ToolSpec>, execute: (name: string, args: Record<string, unknown>) => Promise<string>, opts?: {
111
+ maxTurns?: number;
112
+ temperature?: number;
113
+ signal?: AbortSignal;
114
+ maxTokens?: number;
115
+ /** Seed the loop with an existing conversation (depth continuation) instead of
116
+ * `[system, user]`. When set, `system`/`user` are ignored. The array is copied. */
117
+ initialMessages?: ReadonlyArray<Record<string, unknown>>;
118
+ }): Promise<RouterToolLoopResult>;
119
+
120
+ export { type RouterChatResult as R, type ToolSpec as T, type RouterChatToolsResult as a, type RouterConfig as b, type RouterToolCall as c, type RouterToolLoopResult as d, routerChatWithUsage as e, routerToolLoop as f, routerChatWithTools as r };
@@ -1,5 +1,5 @@
1
1
  import { SandboxInstance } from '@tangle-network/sandbox';
2
- import { D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, I as Iteration, L as LoopWinner, a as LoopLineageOptions, S as SandboxClient, b as LoopResult } from './types-BEQsBhOE.js';
2
+ import { D as Driver, A as AgentRunSpec, O as OutputAdapter, V as Validator, E as ExecCtx, I as Iteration, L as LoopWinner, a as LoopLineageOptions, S as SandboxClient, b as LoopResult } from './types-CklkW4Eh.js';
3
3
 
4
4
  /**
5
5
  * @experimental
package/dist/runtime.d.ts CHANGED
@@ -1,17 +1,19 @@
1
1
  import { AgentProfile, BackendType, CreateSandboxOptions, SandboxInstance, SandboxEvent } from '@tangle-network/sandbox';
2
2
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
3
- import { R as ResultBlobStore, a as SpawnJournal, N as NodeId, b as SpawnEvent, T as TreeView, c as Settled, d as AgentSpec, E as ExecutorRegistry, B as Budget, A as Agent, e as RootHandle, f as SupervisedResult, g as Spend, S as Scope, h as ExecutorFactory, U as UsageEvent, i as Supervisor } from './types-5MGt5KTY.js';
4
- export { j as Executor, k as ExecutorContext, l as ExecutorResult, H as Handle, m as NodeSnapshot, n as NodeStatus, o as Restart, p as RootSignal, q as Runtime, r as SpawnOpts, s as SupervisorOpts, W as WidenGate } from './types-5MGt5KTY.js';
3
+ import { R as ResultBlobStore, a as SpawnJournal, N as NodeId, b as SpawnEvent, T as TreeView, c as Settled, d as AgentSpec, E as ExecutorRegistry, B as Budget, A as Agent, e as RootHandle, f as SupervisedResult, g as Spend, S as Scope, h as ExecutorFactory, U as UsageEvent, i as Supervisor } from './types-CNDJCL_0.js';
4
+ export { j as Executor, k as ExecutorContext, l as ExecutorResult, H as Handle, m as NodeSnapshot, n as NodeStatus, o as Restart, p as RootSignal, q as Runtime, r as SpawnOpts, s as SupervisorOpts, W as WidenGate } from './types-CNDJCL_0.js';
5
5
  import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
6
6
  import { ChatClient, AnalystFinding, DefaultVerdict, AgentProfile as AgentProfile$1, AnalystRunInputs } from '@tangle-network/agent-eval';
7
7
  export { DefaultVerdict } from '@tangle-network/agent-eval';
8
- export { A as AnalyzeInput, a as CompletionAnalyst, b as CompletionEvidence, c as CompletionPolicy, d as CompletionVerdict, C as CreateDriverOptions, D as DriverDecision, P as PlannerContext, e as TopologyMove, T as TopologyPlanner, f as completionAuthorizes, g as createDriver, h as deterministicCompletion, r as renderAnalyses, s as sentinelCompletion, i as stopSentinel } from './driver-DLI1io57.js';
9
- import { S as SandboxClient, b as LoopResult, d as LoopTokenUsage, R as RuntimeStreamEvent, A as AgentRunSpec, E as ExecCtx, I as Iteration } from './types-BEQsBhOE.js';
10
- export { D as Driver, F as LoopDecisionPayload, G as LoopEndedPayload, H as LoopIterationDispatchPayload, J as LoopIterationEndedPayload, M as LoopIterationStartedPayload, a as LoopLineageOptions, N as LoopPlanDescription, P as LoopPlanPayload, e as LoopSandboxPlacement, Q as LoopStartedPayload, T as LoopTeardownFailedPayload, f as LoopTraceEmitter, g as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, U as ValidationCtx, V as Validator } from './types-BEQsBhOE.js';
8
+ export { A as AnalyzeInput, a as CompletionAnalyst, b as CompletionEvidence, c as CompletionPolicy, d as CompletionVerdict, C as CreateDriverOptions, D as DriverDecision, P as PlannerContext, e as TopologyMove, T as TopologyPlanner, f as completionAuthorizes, g as createDriver, h as deterministicCompletion, r as renderAnalyses, s as sentinelCompletion, i as stopSentinel } from './driver-B2RKkVJW.js';
9
+ import { S as SandboxClient, b as LoopResult, d as LoopTokenUsage, R as RuntimeStreamEvent, A as AgentRunSpec, E as ExecCtx, I as Iteration } from './types-CklkW4Eh.js';
10
+ export { D as Driver, F as LoopDecisionPayload, G as LoopEndedPayload, H as LoopIterationDispatchPayload, J as LoopIterationEndedPayload, M as LoopIterationStartedPayload, a as LoopLineageOptions, N as LoopPlanDescription, P as LoopPlanPayload, f as LoopSandboxPlacement, Q as LoopStartedPayload, T as LoopTeardownFailedPayload, g as LoopTraceEmitter, e as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, U as ValidationCtx, V as Validator } from './types-CklkW4Eh.js';
11
11
  import { Scenario, ProfileDispatchFn } from '@tangle-network/agent-eval/campaign';
12
- import { R as RunLoopOptions } from './run-loop-BIineL1T.js';
13
- export { c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-BIineL1T.js';
12
+ import { R as RunLoopOptions } from './run-loop-DgVhucoR.js';
13
+ export { c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-DgVhucoR.js';
14
14
  import { b as AnalystRegistryLike } from './types-p8dWBIXL.js';
15
+ import { T as ToolSpec } from './router-client-B0Qi1NiN.js';
16
+ export { R as RouterChatResult, a as RouterChatToolsResult, b as RouterConfig, c as RouterToolCall, d as RouterToolLoopResult, r as routerChatWithTools, e as routerChatWithUsage, f as routerToolLoop } from './router-client-B0Qi1NiN.js';
15
17
 
16
18
  /**
17
19
  * @experimental
@@ -528,6 +530,12 @@ interface RunPersonifiedOptions<Task, D> {
528
530
  /** Optional scope analyst threaded into the shape's ShapeContext so loopUntil/widen steer
529
531
  * on trace-derived findings instead of the dormant empty default. */
530
532
  readonly analyst?: ScopeAnalyst<D>;
533
+ /**
534
+ * Lifecycle stream sink, forwarded to `SupervisorOpts.hooks` so the root `Scope`'s
535
+ * `agent.spawn`/`agent.child` events flow to an observer (e.g. the Intelligence SDK's
536
+ * trace export). Absent ⇒ no stream (the run is silent, as today).
537
+ */
538
+ readonly hooks?: RuntimeHooks;
531
539
  }
532
540
  /** The composed run signature. */
533
541
  type RunPersonified = <Task, D>(options: RunPersonifiedOptions<Task, D>) => Promise<SupervisedResult<Outcome<D>>>;
@@ -2035,117 +2043,6 @@ interface UsageSink {
2035
2043
  */
2036
2044
  declare function reportLoopUsage<Task, Output, Decision>(cost: UsageSink, result: Pick<LoopResult<Task, Output, Decision>, 'costUsd' | 'tokenUsage'>, source?: string): void;
2037
2045
 
2038
- /**
2039
- * The one router chat client: direct OpenAI-compatible completions through the
2040
- * Tangle router — the cheapest dial, no sandbox. Three layers: `routerChatWithUsage`
2041
- * (chat-only), `routerChatWithTools` (one completion with function tools), and
2042
- * `routerToolLoop` (the off-box agentic loop over tool-calling). Shared by the
2043
- * built-in executors and the bench/lab harnesses.
2044
- *
2045
- * Reports REAL token usage so the backend-integrity guard sees a real backend.
2046
- * Returns `undefined` usage when the provider omitted it — never a fabricated 0
2047
- * (a phantom 0 reads as a free call downstream, which the gate would act on).
2048
- */
2049
- interface RouterConfig {
2050
- routerBaseUrl: string;
2051
- routerKey: string;
2052
- model: string;
2053
- }
2054
- interface RouterChatResult {
2055
- content: string;
2056
- /** REAL usage, or undefined when the provider reported none. */
2057
- usage?: {
2058
- input: number;
2059
- output: number;
2060
- };
2061
- /** Derived from usage via `estimateCost` when the model is priced; else undefined. */
2062
- costUsd?: number;
2063
- }
2064
- declare function routerChatWithUsage(cfg: RouterConfig, messages: Array<{
2065
- role: string;
2066
- content: string;
2067
- }>, opts?: {
2068
- temperature?: number;
2069
- signal?: AbortSignal;
2070
- maxTokens?: number;
2071
- }): Promise<RouterChatResult>;
2072
- /** A tool-call the model emitted (provider-neutral; mirrors the runtime's ToolCallRequest). */
2073
- interface RouterToolCall {
2074
- id: string;
2075
- name: string;
2076
- /** Raw JSON arguments string as emitted by the model. */
2077
- arguments: string;
2078
- }
2079
- interface RouterChatToolsResult {
2080
- content: string | null;
2081
- toolCalls: RouterToolCall[];
2082
- usage?: {
2083
- input: number;
2084
- output: number;
2085
- };
2086
- costUsd?: number;
2087
- }
2088
- /**
2089
- * A router completion WITH tool-calling — the operator driver's LLM seam. Passes OpenAI-shape
2090
- * `messages` (system/user/assistant-with-tool_calls/tool roles) + function `tools`, and returns the
2091
- * assistant text plus the tool calls the model wants run. Same fail-loud + real-usage discipline as
2092
- * `routerChatWithUsage`. `tool_choice: 'auto'` lets the model decide; the driver loops on the result.
2093
- */
2094
- declare function routerChatWithTools(cfg: RouterConfig, messages: ReadonlyArray<Record<string, unknown>>, tools: ReadonlyArray<{
2095
- type: 'function';
2096
- function: {
2097
- name: string;
2098
- description?: string;
2099
- parameters: unknown;
2100
- };
2101
- }>, opts?: {
2102
- temperature?: number;
2103
- signal?: AbortSignal;
2104
- toolChoice?: 'auto' | 'required' | 'none';
2105
- }): Promise<RouterChatToolsResult>;
2106
- interface ToolSpec {
2107
- type: 'function';
2108
- function: {
2109
- name: string;
2110
- description?: string;
2111
- parameters: unknown;
2112
- };
2113
- }
2114
- interface RouterToolLoopResult {
2115
- /** The model's final assistant text (the turn where it stopped calling tools, or the budget turn). */
2116
- final: string;
2117
- /** Inference turns spent (≤ maxTurns) — the equal-budget unit vs random@k. */
2118
- turns: number;
2119
- toolCalls: number;
2120
- /** The behavior trace: each tool call + its result, in order. What a trace-analyst
2121
- * steerer reads (behavior, never the verdict) to diagnose + redirect the next shot. */
2122
- toolTrace: Array<{
2123
- name: string;
2124
- args: string;
2125
- result: string;
2126
- }>;
2127
- usage: {
2128
- input: number;
2129
- output: number;
2130
- };
2131
- }
2132
- /**
2133
- * The tool-using router backend: a real agentic loop OVER the Tangle router (which
2134
- * supports tool-calling), off-box — no sandbox. Each turn is one router completion
2135
- * with `tools`; if the model emits tool_calls, `execute` runs them on the host and
2136
- * their results are folded back as `tool` messages; the loop repeats until the
2137
- * model answers without a tool call or the turn budget is hit. One turn = one
2138
- * inference call, so `maxTurns` is the equal-compute unit against random@k.
2139
- *
2140
- * This is the depth substrate for agentic gates (the worker ACTS, observes the real
2141
- * result, and continues) that the chat-only `routerChatWithUsage` cannot express.
2142
- */
2143
- declare function routerToolLoop(cfg: RouterConfig, system: string, user: string, tools: ReadonlyArray<ToolSpec>, execute: (name: string, args: Record<string, unknown>) => Promise<string>, opts?: {
2144
- maxTurns?: number;
2145
- temperature?: number;
2146
- signal?: AbortSignal;
2147
- }): Promise<RouterToolLoopResult>;
2148
-
2149
2046
  /**
2150
2047
  * @experimental
2151
2048
  *
@@ -3223,4 +3120,4 @@ declare function gitWorkspace(opts: GitWorkspaceOptions): Workspace;
3223
3120
  * requires `jj` on the `Shell`'s host. */
3224
3121
  declare function jjWorkspace(opts: GitWorkspaceOptions): Workspace;
3225
3122
 
3226
- export { Agent, AgentRunSpec, AgentSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ArtifactHandle, type AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, type BridgeSeam, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CliSeam, type CombinatorShape, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, NodeId, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, type Outcome, type Panel, type PanelJudge, type PanelSpec, type PanelVerdict, type Persona, type PersonaContext, type PersonaExecutors, type Pipeline, type PipelineStage, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, type RenderCorpusToInstructions, type RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RootHandle, type RouterChatResult, type RouterChatToolsResult, type RouterConfig, type RouterSeam, type RouterToolCall, type RouterToolLoopResult, type RouterToolsSeam, type RunAgenticOptions, RunLoopOptions, type RunPersonified, type RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, type SandboxSeam, Scope, type ScopeAnalyst, type ScopeAnalyzeInput, type ScopeWidenGate, type SessionCapableBox, Settled, type ShapeBudget, type ShapeContext, type ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, SpawnEvent, SpawnJournal, Spend, type SteerContext, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, SupervisedResult, Supervisor, type SurfaceScore, type ToolSpec, type TrajectoryNode, type TrajectoryReport, type TrajectoryReportFn, type TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, type VerifierEnvironmentOptions, type Verify, type VerifySpec, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, type Widen, type WidenDecision, type WidenLineage, type WidenSpec, type Workspace, type WorkspaceCommit, acquireSandbox, adaptiveRefine, anytimeReport, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, breadthDriver, buildSteerContext, builtinShapes, contentAddress, createBudgetPool, createExecutor, createExecutorRegistry, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, defaultAnalystInstruction, defaultAuditorInstruction, definePersona, defineStrategy, depthDriver, discriminatingMeans, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gitWorkspace, harvestCorpus, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerChatWithTools, routerChatWithUsage, routerToolLoop, runAgentic, runBenchmark, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, settledToIteration, spendFromUsageEvents, strategyAuthorContract, trajectoryReport, verify, widen };
3123
+ export { Agent, AgentRunSpec, AgentSpec, type AgenticOptions, type AgenticRunResult, type AgenticSurface, type AgenticTask, type AgenticTool, type AnytimeReport, type AnytimeStrategySummary, type AnytimeTaskCurve, type ArtifactHandle, type AssertTraceDerivedFindings, type AuditIntentInput, type AuditIntentOptions, type AuthorStrategyOptions, type AuthoredStrategy, type BenchmarkCell, type BenchmarkConfig, type BenchmarkLift, type BenchmarkReport, type BenchmarkStrategySummary, type BenchmarkTaskRow, type BridgeSeam, Budget, type BudgetPool, type BudgetReadout, type ChampionPick, type ChampionPolicy, type CheckpointCapableBox, type CliSeam, type CombinatorShape, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, NodeId, type Observation, type ObserveInput, type ObserveOptions, type OpenSandboxRunOptions, type Outcome, type Panel, type PanelJudge, type PanelSpec, type PanelVerdict, type Persona, type PersonaContext, type PersonaExecutors, type Pipeline, type PipelineStage, type PromotionGateOptions, type PromotionVerdict, type RegistryAnalyzeProjection, type RenderCorpusToInstructions, type RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RootHandle, type RouterSeam, type RouterToolsSeam, type RunAgenticOptions, RunLoopOptions, type RunPersonified, type RunPersonifiedOptions, type SandboxCapabilities, SandboxClient, type SandboxLineage, type SandboxLineageHandle, type SandboxRun, type SandboxSeam, Scope, type ScopeAnalyst, type ScopeAnalyzeInput, type ScopeWidenGate, type SessionCapableBox, Settled, type ShapeBudget, type ShapeContext, type ShapeRegistry, type Shell, type ShotPersona, type ShotSpec, SpawnEvent, SpawnJournal, Spend, type SteerContext, type Strategy, type StrategyCtx, type StrategyEvolutionConfig, type StrategyResult, SupervisedResult, Supervisor, type SurfaceScore, ToolSpec, type TrajectoryNode, type TrajectoryReport, type TrajectoryReportFn, type TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, type VerifierEnvironmentOptions, type Verify, type VerifySpec, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, type Widen, type WidenDecision, type WidenLineage, type WidenSpec, type Workspace, type WorkspaceCommit, acquireSandbox, adaptiveRefine, anytimeReport, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, breadthDriver, buildSteerContext, builtinShapes, contentAddress, createBudgetPool, createExecutor, createExecutorRegistry, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, defaultAnalystInstruction, defaultAuditorInstruction, definePersona, defineStrategy, depthDriver, discriminatingMeans, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gitWorkspace, harvestCorpus, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, runAgentic, runBenchmark, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, settledToIteration, spendFromUsageEvents, strategyAuthorContract, trajectoryReport, verify, widen };
package/dist/runtime.js CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  trajectoryReport,
87
87
  verify,
88
88
  widen
89
- } from "./chunk-2OU7ZQPD.js";
89
+ } from "./chunk-K6WP7PYW.js";
90
90
  import {
91
91
  extractLlmCallEvent,
92
92
  mapSandboxEvent
@@ -1,7 +1,7 @@
1
1
  import { DefaultVerdict } from '@tangle-network/agent-eval';
2
2
  import { AgentProfile, BackendType } from '@tangle-network/sandbox';
3
3
  import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
4
- import { d as LoopTokenUsage } from './types-BEQsBhOE.js';
4
+ import { d as LoopTokenUsage } from './types-CklkW4Eh.js';
5
5
 
6
6
  /**
7
7
  * @experimental
@@ -319,6 +319,7 @@ type RuntimeStreamEvent = {
319
319
  proposalId: string;
320
320
  title: string;
321
321
  status?: 'pending' | 'approved' | 'rejected';
322
+ content?: string;
322
323
  timestamp?: string;
323
324
  } | {
324
325
  type: 'backend_error';
@@ -1096,4 +1097,4 @@ interface ExecCtx {
1096
1097
  parentSpanId?: string;
1097
1098
  }
1098
1099
 
1099
- export { type AgentRunSpec as A, type BackendErrorDetail as B, startRuntimeRun as C, type Driver as D, type ExecCtx as E, type LoopDecisionPayload as F, type LoopEndedPayload as G, type LoopIterationDispatchPayload as H, type Iteration as I, type LoopIterationEndedPayload as J, type KnowledgeReadinessDecision as K, type LoopWinner as L, type LoopIterationStartedPayload as M, type LoopPlanDescription as N, type OutputAdapter as O, type LoopPlanPayload as P, type LoopStartedPayload as Q, type RuntimeStreamEvent as R, type SandboxClient as S, type LoopTeardownFailedPayload as T, type ValidationCtx as U, type Validator as V, type LoopLineageOptions as a, type LoopResult as b, type OpenAIChatTool as c, type LoopTokenUsage as d, type LoopSandboxPlacement as e, type LoopTraceEmitter as f, type LoopTraceEvent as g, type AgentBackendInput as h, type AgentExecutionBackend as i, type OpenAIChatToolChoice as j, type AgentBackendContext as k, type RunAgentTaskOptions as l, type AgentTaskRunResult as m, type RunAgentTaskStreamOptions as n, type AgentRuntimeEvent as o, type AgentTaskStatus as p, type RuntimeSessionStore as q, type RuntimeSession as r, type AgentAdapter as s, type AgentKnowledgeProvider as t, type AgentRuntimeEventSink as u, type AgentTaskContext as v, type AgentTaskSpec as w, type RuntimeRunHandle as x, type RuntimeRunPersistenceAdapter as y, type RuntimeRunRow as z };
1100
+ export { type AgentRunSpec as A, type BackendErrorDetail as B, startRuntimeRun as C, type Driver as D, type ExecCtx as E, type LoopDecisionPayload as F, type LoopEndedPayload as G, type LoopIterationDispatchPayload as H, type Iteration as I, type LoopIterationEndedPayload as J, type KnowledgeReadinessDecision as K, type LoopWinner as L, type LoopIterationStartedPayload as M, type LoopPlanDescription as N, type OutputAdapter as O, type LoopPlanPayload as P, type LoopStartedPayload as Q, type RuntimeStreamEvent as R, type SandboxClient as S, type LoopTeardownFailedPayload as T, type ValidationCtx as U, type Validator as V, type LoopLineageOptions as a, type LoopResult as b, type OpenAIChatTool as c, type LoopTokenUsage as d, type LoopTraceEvent as e, type LoopSandboxPlacement as f, type LoopTraceEmitter as g, type AgentBackendInput as h, type AgentExecutionBackend as i, type OpenAIChatToolChoice as j, type AgentBackendContext as k, type RunAgentTaskOptions as l, type AgentTaskRunResult as m, type RunAgentTaskStreamOptions as n, type AgentRuntimeEvent as o, type AgentTaskStatus as p, type RuntimeSessionStore as q, type RuntimeSession as r, type AgentAdapter as s, type AgentKnowledgeProvider as t, type AgentRuntimeEventSink as u, type AgentTaskContext as v, type AgentTaskSpec as w, type RuntimeRunHandle as x, type RuntimeRunPersistenceAdapter as y, type RuntimeRunRow as z };
@@ -1,6 +1,6 @@
1
1
  import { AgentProfile, CreateSandboxOptions, PromptOptions, TaskOptions, SandboxEvent } from '@tangle-network/sandbox';
2
- import { S as SandboxClient, O as OutputAdapter, e as LoopSandboxPlacement, b as LoopResult } from './types-BEQsBhOE.js';
3
- import { R as RunLoopOptions } from './run-loop-BIineL1T.js';
2
+ import { S as SandboxClient, O as OutputAdapter, f as LoopSandboxPlacement, b as LoopResult } from './types-CklkW4Eh.js';
3
+ import { R as RunLoopOptions } from './run-loop-DgVhucoR.js';
4
4
  import '@tangle-network/agent-eval';
5
5
  import './runtime-hooks-C7JwKb9E.js';
6
6
 
package/dist/workflow.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createSandboxForSpec,
3
3
  describeSandboxPlacement,
4
4
  runLoop
5
- } from "./chunk-2OU7ZQPD.js";
5
+ } from "./chunk-K6WP7PYW.js";
6
6
  import {
7
7
  ValidationError,
8
8
  extractLlmCallEvent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.52.0",
3
+ "version": "0.53.0",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {