@tangle-network/agent-runtime 0.57.0 → 0.59.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.
@@ -5,7 +5,7 @@ import {
5
5
  parseDetachedSessionRef,
6
6
  runDetachedTurn,
7
7
  runLoop
8
- } from "./chunk-RLDUT4JL.js";
8
+ } from "./chunk-45D64J7B.js";
9
9
  import {
10
10
  coderProfile,
11
11
  multiHarnessCoderFanout
@@ -279,4 +279,4 @@ export {
279
279
  coderTaskFromArgs,
280
280
  settleDetachedCoderTurn
281
281
  };
282
- //# sourceMappingURL=chunk-WFEQCRQP.js.map
282
+ //# sourceMappingURL=chunk-4FEUFYOY.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-FNMGYYSS.js";
4
4
  import {
5
5
  createDefaultCoderDelegate
6
- } from "./chunk-WFEQCRQP.js";
6
+ } from "./chunk-4FEUFYOY.js";
7
7
  import {
8
8
  runAnalystLoop
9
9
  } from "./chunk-P5OKDSLB.js";
@@ -171,4 +171,4 @@ export {
171
171
  runLoopRunnerCli,
172
172
  parseLoopRunnerArgv
173
173
  };
174
- //# sourceMappingURL=chunk-6BOIKGSU.js.map
174
+ //# sourceMappingURL=chunk-IN7WHMGZ.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createFleetWorkspaceExecutor,
3
3
  createSiblingSandboxExecutor
4
- } from "./chunk-WFEQCRQP.js";
4
+ } from "./chunk-4FEUFYOY.js";
5
5
  import {
6
6
  runWorktreeHarness
7
- } from "./chunk-RLDUT4JL.js";
7
+ } from "./chunk-45D64J7B.js";
8
8
  import {
9
9
  buildLoopOtelSpans,
10
10
  createOtelExporter
@@ -294,4 +294,4 @@ export {
294
294
  createPropagatingTraceEmitter,
295
295
  traceContextToEnv
296
296
  };
297
- //# sourceMappingURL=chunk-TVBXDW7C.js.map
297
+ //# sourceMappingURL=chunk-MMDIORZY.js.map
@@ -14,7 +14,7 @@ import {
14
14
  DELEGATION_STATUS_DESCRIPTION,
15
15
  DELEGATION_STATUS_INPUT_SCHEMA,
16
16
  DELEGATION_STATUS_TOOL_NAME
17
- } from "./chunk-RLDUT4JL.js";
17
+ } from "./chunk-45D64J7B.js";
18
18
 
19
19
  // src/mcp/openai-tools.ts
20
20
  function buildTool(name, description, parameters) {
@@ -61,4 +61,4 @@ export {
61
61
  mcpToolsForRuntimeMcp,
62
62
  mcpToolsForRuntimeMcpSubset
63
63
  };
64
- //# sourceMappingURL=chunk-NJST5D2G.js.map
64
+ //# sourceMappingURL=chunk-ZWGEA722.js.map
@@ -495,8 +495,9 @@ interface WidenGate<Out> {
495
495
  * harness exits + the diff is captured, the worktree is removed.
496
496
  *
497
497
  * All operations spawn `git` via `child_process.spawn` synchronously
498
- * (via a `runGit` helper). Stays narrow on purpose: no working-tree
499
- * staging, no commits, no rebases.
498
+ * (via a `runGit` helper). Stays narrow on purpose: no commits, no rebases.
499
+ * Diff capture stages all changes (`git add -A`) into the ephemeral worktree's
500
+ * index so created (untracked) files appear in the `--cached` diff.
500
501
  */
501
502
  /** @experimental */
502
503
  interface WorktreeHandle {
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mcpToolsForRuntimeMcp,
3
3
  mcpToolsForRuntimeMcpSubset
4
- } from "./chunk-NJST5D2G.js";
4
+ } from "./chunk-ZWGEA722.js";
5
5
  import {
6
6
  DEFAULT_ROUTER_BASE_URL,
7
7
  cleanModelId,
@@ -21,16 +21,16 @@ import {
21
21
  runDelegatedLoop,
22
22
  runLoopRunnerCli,
23
23
  selfImproveLoopRunner
24
- } from "./chunk-6BOIKGSU.js";
24
+ } from "./chunk-IN7WHMGZ.js";
25
25
  import "./chunk-FNMGYYSS.js";
26
- import "./chunk-WFEQCRQP.js";
26
+ import "./chunk-4FEUFYOY.js";
27
27
  import "./chunk-P5OKDSLB.js";
28
28
  import {
29
29
  composeRuntimeHooks,
30
30
  defineRuntimeHooks,
31
31
  notifyRuntimeDecisionPoint,
32
32
  notifyRuntimeHookEvent
33
- } from "./chunk-RLDUT4JL.js";
33
+ } from "./chunk-45D64J7B.js";
34
34
  import "./chunk-7QYOXFCD.js";
35
35
  import "./chunk-WIR4HOOJ.js";
36
36
  import {
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-6BOIKGSU.js";
5
+ } from "./chunk-IN7WHMGZ.js";
6
6
  import "./chunk-FNMGYYSS.js";
7
- import "./chunk-WFEQCRQP.js";
7
+ import "./chunk-4FEUFYOY.js";
8
8
  import "./chunk-P5OKDSLB.js";
9
- import "./chunk-RLDUT4JL.js";
9
+ import "./chunk-45D64J7B.js";
10
10
  import "./chunk-7QYOXFCD.js";
11
11
  import "./chunk-WIR4HOOJ.js";
12
12
  import "./chunk-VLF5RHEQ.js";
package/dist/loops.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
2
- export { AgenticOptions, AgenticRunResult, AgenticSurface, AgenticTask, AgenticTool, AnytimeReport, AnytimeStrategySummary, AnytimeTaskCurve, ArtifactHandle, AssertTraceDerivedFindings, AuditIntentInput, AuditIntentOptions, AuthorStrategyOptions, AuthoredCoderHarness, AuthoredProfile, AuthoredStrategy, BenchmarkCell, BenchmarkConfig, BenchmarkLift, BenchmarkReport, BenchmarkStrategySummary, BenchmarkTaskRow, BridgeSeam, BudgetPool, BudgetReadout, ChampionPick, ChampionPolicy, CheckpointCapableBox, CliSeam, CliWorktreeSeam, CoderDeliverableOptions, CoderWinnerStrategy, CombinatorShape, CompletionAnalyst, CompletionEvidence, CompletionPolicy, CompletionVerdict, CoordinationDriverOptions, CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, CreateScopeAnalystOptions, CriuCapableClient, DefinePersona, DefinePersonaInput, Deliverable, DeliverableSpec, DetectorMonitor, DetectorMonitorOptions, DriverChat, DriverMessage, DriverToolCall, DriverTurn, Environment, EqualKArm, EqualKOnCost, EqualKOnCostOptions, EqualKVerdict, EvolutionArchiveNode, EvolutionAuthor, EvolutionBandInfo, EvolutionCandidate, EvolutionGeneration, EvolutionReport, ExecutorConfig, Fanout, FanoutOptions, FanoutSynthesis, FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, FlatWidenGate, ForkCapableBox, GitWorkspaceOptions, HarvestCorpusOptions, HarvestFailure, HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, Inbox, InboxMessage, IntentAudit, LoopDispatchOptions, LoopOptionsForDispatch, LoopShape, LoopUntil, LoopUntilSpec, LoopUntilState, McpEndpoint, McpEnvironmentOptions, NestedScopeSeam, Observation, ObserveInput, ObserveOptions, OpenSandboxRunOptions, Outcome, Panel, PanelJudge, PanelSpec, PanelVerdict, Persona, PersonaContext, PersonaExecutors, Pipeline, PipelineStage, PromotionGateOptions, PromotionVerdict, RecordedToolStep, RegistryAnalyzeProjection, RenderCorpusToInstructions, RenderCorpusToInstructionsOptions, ReservationTicket, RouterSeam, RouterToolsSeam, RunAgenticOptions, RunPersonified, RunPersonifiedOptions, SandboxCapabilities, SandboxLineage, SandboxLineageHandle, SandboxRun, SandboxSeam, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, SessionCapableBox, ShapeBudget, ShapeContext, ShapeRegistry, Shell, ShotPersona, ShotSpec, SteerContext, Strategy, StrategyCtx, StrategyEvolutionConfig, StrategyResult, SurfaceScore, ToolStep, TrajectoryAnalysis, TrajectoryNode, TrajectoryRecorder, TrajectoryReport, TrajectoryReportFn, TrajectoryReportOptions, TurnResult, UsageSink, VerifierEnvironmentOptions, Verify, VerifySpec, WaterfallCollector, WaterfallReport, WaterfallSpan, Widen, WidenDecision, WidenLineage, WidenSpec, Workspace, WorkspaceCommit, WorkspaceRun, WorktreeCliExecutorOptions, WorktreeCoderFanoutOptions, WorktreeCommandResult, WorktreePatchArtifact, acquireSandbox, adaptiveRefine, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createDetectorMonitor, createExecutor, createExecutorRegistry, createInbox, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createTrajectoryRecorder, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, defaultAnalystInstruction, defaultAuditorInstruction, defaultToolDetectors, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerDriverChat, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, trajectoryReport, verify, widen, withDriverExecutor, worktreeCoderFanout } from './runtime.js';
2
+ export { AgenticOptions, AgenticRunResult, AgenticSurface, AgenticTask, AgenticTool, AnytimeReport, AnytimeStrategySummary, AnytimeTaskCurve, ArtifactHandle, AssertTraceDerivedFindings, AuditIntentInput, AuditIntentOptions, AuthorStrategyOptions, AuthoredCoderHarness, AuthoredProfile, AuthoredStrategy, BenchmarkCell, BenchmarkConfig, BenchmarkLift, BenchmarkReport, BenchmarkStrategySummary, BenchmarkTaskRow, BridgeSeam, BudgetPool, BudgetReadout, ChampionPick, ChampionPolicy, CheckpointCapableBox, CliSeam, CliWorktreeSeam, CoderDeliverableOptions, CoderWinnerStrategy, CombinatorShape, CompletionAnalyst, CompletionEvidence, CompletionPolicy, CompletionVerdict, CoordinationDriverOptions, CoordinationMcpHandle, Corpus, CorpusFilter, CorpusRecord, CreateScopeAnalystOptions, CriuCapableClient, DefinePersona, DefinePersonaInput, Deliverable, DeliverableSpec, DriverChat, DriverMessage, DriverToolCall, DriverTurn, Environment, EqualKArm, EqualKOnCost, EqualKOnCostOptions, EqualKVerdict, EvolutionArchiveNode, EvolutionAuthor, EvolutionBandInfo, EvolutionCandidate, EvolutionGeneration, EvolutionReport, ExecutorConfig, Fanout, FanoutOptions, FanoutSynthesis, FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, FlatWidenGate, ForkCapableBox, GitWorkspaceOptions, HarvestCorpusOptions, HarvestFailure, HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, Inbox, InboxMessage, IntentAudit, LoopDispatchOptions, LoopOptionsForDispatch, LoopShape, LoopUntil, LoopUntilSpec, LoopUntilState, McpEndpoint, McpEnvironmentOptions, NestedScopeSeam, Observation, ObserveInput, ObserveOptions, OpenSandboxRunOptions, Outcome, Panel, PanelJudge, PanelSpec, PanelVerdict, Persona, PersonaContext, PersonaExecutors, Pipeline, PipelineStage, PromotionGateOptions, PromotionVerdict, RegistryAnalyzeProjection, RenderCorpusToInstructions, RenderCorpusToInstructionsOptions, ReservationTicket, RouterSeam, RouterToolsSeam, RunAgenticOptions, RunPersonified, RunPersonifiedOptions, SandboxCapabilities, SandboxLineage, SandboxLineageHandle, SandboxRun, SandboxSeam, ScopeAnalyst, ScopeAnalyzeInput, ScopeWidenGate, SessionCapableBox, SessionMessageLike, SessionTraceBox, ShapeBudget, ShapeContext, ShapeRegistry, Shell, ShotPersona, ShotSpec, SteerContext, Strategy, StrategyCtx, StrategyEvolutionConfig, StrategyResult, SurfaceScore, ToolPartDecoder, ToolStepInput, TraceSource, TrajectoryAnalysis, TrajectoryNode, TrajectoryReport, TrajectoryReportFn, TrajectoryReportOptions, TurnResult, UsageSink, VerifierEnvironmentOptions, Verify, VerifySpec, WatchTraceOptions, WaterfallCollector, WaterfallReport, WaterfallSpan, Widen, WidenDecision, WidenLineage, WidenSpec, Workspace, WorkspaceCommit, WorkspaceRun, WorktreeCliExecutorOptions, WorktreeCoderFanoutOptions, WorktreeCommandResult, WorktreePatchArtifact, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createExecutor, createExecutorRegistry, createInbox, createMcpEnvironment, createPartsTraceSource, createPushTraceSource, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, decodeAnthropicPart, decodeOpenAiPart, decodeOpencodePart, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultToolDetectors, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerDriverChat, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, toToolSpan, toolPartDecoders, trajectoryReport, verify, watchTrace, widen, withDriverExecutor, worktreeCoderFanout } from './runtime.js';
3
3
  export { a as RouterChatResult, b as RouterChatToolsResult, R as RouterConfig, c as RouterToolCall, d as RouterToolLoopResult, T as ToolSpec, r as routerChatWithTools, e as routerChatWithUsage, f as routerToolLoop } from './router-client-30Y_pca8.js';
4
4
  export { R as RunLoopOptions, c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-CcqfR_gy.js';
5
- export { z as Agent, y as AgentSpec, B as Budget, Y as BusEvent, Z as BusRecord, _ as BusStats, $ as EventBus, U as Executor, a0 as ExecutorContext, P as ExecutorFactory, E as ExecutorRegistry, a1 as ExecutorResult, a2 as Handle, N as NodeId, a3 as NodeSnapshot, a4 as NodeStatus, a5 as PublishOptions, a6 as Restart, u as ResultBlobStore, H as RootHandle, a7 as RootSignal, a8 as Runtime, O as Scope, x as Settled, w as SpawnEvent, v as SpawnJournal, a9 as SpawnOpts, L as Spend, K as SupervisedResult, X as Supervisor, aa as SupervisorOpts, T as TreeView, V as UsageEvent, ab as WidenGate, ac as createEventBus } from './coordination-BydGBQCZ.js';
5
+ export { z as Agent, y as AgentSpec, B as Budget, Y as BusEvent, Z as BusRecord, _ as BusStats, $ as EventBus, U as Executor, a0 as ExecutorContext, P as ExecutorFactory, E as ExecutorRegistry, a1 as ExecutorResult, a2 as Handle, N as NodeId, a3 as NodeSnapshot, a4 as NodeStatus, a5 as PublishOptions, a6 as Restart, u as ResultBlobStore, H as RootHandle, a7 as RootSignal, a8 as Runtime, O as Scope, x as Settled, w as SpawnEvent, v as SpawnJournal, a9 as SpawnOpts, L as Spend, K as SupervisedResult, X as Supervisor, aa as SupervisorOpts, T as TreeView, V as UsageEvent, ab as WidenGate, ac as createEventBus } from './coordination-Biw19JzN.js';
6
6
  export { A as AgentRunSpec, D as Driver, E as ExecCtx, I as Iteration, F as LoopDecisionPayload, G as LoopEndedPayload, H as LoopIterationDispatchPayload, J as LoopIterationEndedPayload, M as LoopIterationStartedPayload, a as LoopLineageOptions, N as LoopPlanDescription, P as LoopPlanPayload, b as LoopResult, f as LoopSandboxPlacement, Q as LoopStartedPayload, T as LoopTeardownFailedPayload, e as LoopTokenUsage, g as LoopTraceEmitter, d as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, S as SandboxClient, U as ValidationCtx, V as Validator } from './types-CUzjRFZ3.js';
7
7
  export { DefaultVerdict } from '@tangle-network/agent-eval';
8
8
  import './runtime-hooks-C7JwKb9E.js';
package/dist/loops.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  InMemorySpawnJournal,
8
8
  acquireSandbox,
9
9
  adaptiveRefine,
10
+ analyzeTrace,
10
11
  anytimeReport,
11
12
  asAuthoredProfile,
12
13
  assertStrategyContract,
@@ -23,12 +24,13 @@ import {
23
24
  contentAddress,
24
25
  coordinationDriverAgent,
25
26
  createBudgetPool,
26
- createDetectorMonitor,
27
27
  createEventBus,
28
28
  createExecutor,
29
29
  createExecutorRegistry,
30
30
  createInbox,
31
31
  createMcpEnvironment,
32
+ createPartsTraceSource,
33
+ createPushTraceSource,
32
34
  createRootHandle,
33
35
  createSandboxForSpec,
34
36
  createSandboxLineage,
@@ -36,10 +38,13 @@ import {
36
38
  createScopeAnalyst,
37
39
  createShapeRegistry,
38
40
  createSupervisor,
39
- createTrajectoryRecorder,
40
41
  createVerifierEnvironment,
41
42
  createWaterfallCollector,
42
43
  createWorktreeCliExecutor,
44
+ decodeAnthropicPart,
45
+ decodeOpenAiPart,
46
+ decodeOpencodePart,
47
+ decodeToolPart,
43
48
  defaultAnalystInstruction,
44
49
  defaultAuditorInstruction,
45
50
  defaultSelectWinner,
@@ -94,6 +99,7 @@ import {
94
99
  runStrategyEvolution,
95
100
  sample,
96
101
  sampleThenRefine,
102
+ sandboxSessionTraceSource,
97
103
  selectChampion,
98
104
  sentinelCompletion,
99
105
  serveCoordinationMcp,
@@ -102,12 +108,15 @@ import {
102
108
  stopSentinel,
103
109
  strategyAuthorContract,
104
110
  supervisorSkill,
111
+ toToolSpan,
112
+ toolPartDecoders,
105
113
  trajectoryReport,
106
114
  verify,
115
+ watchTrace,
107
116
  widen,
108
117
  withDriverExecutor,
109
118
  worktreeCoderFanout
110
- } from "./chunk-RLDUT4JL.js";
119
+ } from "./chunk-45D64J7B.js";
111
120
  import "./chunk-7QYOXFCD.js";
112
121
  import "./chunk-WIR4HOOJ.js";
113
122
  import {
@@ -126,6 +135,7 @@ export {
126
135
  InMemorySpawnJournal,
127
136
  acquireSandbox,
128
137
  adaptiveRefine,
138
+ analyzeTrace,
129
139
  anytimeReport,
130
140
  asAuthoredProfile,
131
141
  assertStrategyContract,
@@ -142,12 +152,13 @@ export {
142
152
  contentAddress,
143
153
  coordinationDriverAgent,
144
154
  createBudgetPool,
145
- createDetectorMonitor,
146
155
  createEventBus,
147
156
  createExecutor,
148
157
  createExecutorRegistry,
149
158
  createInbox,
150
159
  createMcpEnvironment,
160
+ createPartsTraceSource,
161
+ createPushTraceSource,
151
162
  createRootHandle,
152
163
  createSandboxForSpec,
153
164
  createSandboxLineage,
@@ -155,10 +166,13 @@ export {
155
166
  createScopeAnalyst,
156
167
  createShapeRegistry,
157
168
  createSupervisor,
158
- createTrajectoryRecorder,
159
169
  createVerifierEnvironment,
160
170
  createWaterfallCollector,
161
171
  createWorktreeCliExecutor,
172
+ decodeAnthropicPart,
173
+ decodeOpenAiPart,
174
+ decodeOpencodePart,
175
+ decodeToolPart,
162
176
  defaultAnalystInstruction,
163
177
  defaultAuditorInstruction,
164
178
  defaultSelectWinner,
@@ -215,6 +229,7 @@ export {
215
229
  runStrategyEvolution,
216
230
  sample,
217
231
  sampleThenRefine,
232
+ sandboxSessionTraceSource,
218
233
  selectChampion,
219
234
  sentinelCompletion,
220
235
  serveCoordinationMcp,
@@ -223,8 +238,11 @@ export {
223
238
  stopSentinel,
224
239
  strategyAuthorContract,
225
240
  supervisorSkill,
241
+ toToolSpan,
242
+ toolPartDecoders,
226
243
  trajectoryReport,
227
244
  verify,
245
+ watchTrace,
228
246
  widen,
229
247
  withDriverExecutor,
230
248
  worktreeCoderFanout
package/dist/mcp/bin.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createPropagatingTraceEmitter,
4
4
  detectExecutor,
5
5
  readTraceContextFromEnv
6
- } from "../chunk-TVBXDW7C.js";
6
+ } from "../chunk-MMDIORZY.js";
7
7
  import {
8
8
  resolveRouterBaseUrl
9
9
  } from "../chunk-GRAGM4MC.js";
@@ -11,7 +11,7 @@ import {
11
11
  coderTaskFromArgs,
12
12
  createDefaultCoderDelegate,
13
13
  settleDetachedCoderTurn
14
- } from "../chunk-WFEQCRQP.js";
14
+ } from "../chunk-4FEUFYOY.js";
15
15
  import {
16
16
  DEFAULT_SANDBOX_BASE_URL
17
17
  } from "../chunk-XRYEZPR6.js";
@@ -26,7 +26,7 @@ import {
26
26
  parseDetachedSessionRef,
27
27
  runDetachedTurn,
28
28
  runLoop
29
- } from "../chunk-RLDUT4JL.js";
29
+ } from "../chunk-45D64J7B.js";
30
30
  import {
31
31
  coderProfile
32
32
  } from "../chunk-7QYOXFCD.js";
@@ -2,8 +2,8 @@ import { S as SandboxClient, f as LoopSandboxPlacement } from '../types-CUzjRFZ3
2
2
  import { F as FleetHandle, f as DelegationExecutor, d as DelegationTaskQueue, e as CoderDelegate, D as DelegateCodeArgs, g as DelegateCodeResult, h as DelegateFeedbackResult, b as DelegateFeedbackArgs, i as ResearchSource, R as ResearcherDelegate, j as DelegateResearchArgs, k as DelegateResearchResult, U as UiAuditorDelegate, l as DelegateUiAuditArgs, m as DelegateUiAuditResult, n as DelegationHistoryResult, o as DelegationHistoryArgs, p as DelegationStatusResult, q as DelegationStatusArgs } from '../delegates-C94qchkz.js';
3
3
  export { r as CappedDelegationTrace, s as CoderReview, C as CoderReviewer, a as CoderWinnerSelection, t as CreateDefaultCoderDelegateOptions, u as DELEGATION_TRACE_MAX_BYTES, v as DELEGATION_TRACE_MAX_SPANS, w as DelegateCodeConfig, x as DelegateResearchConfig, y as DelegateRunCtx, z as DelegateUiAuditConfig, A as DelegateUiAuditRoute, B as DelegationError, c as DelegationFeedbackSnapshot, E as DelegationHistoryEntry, G as DelegationPersistenceError, H as DelegationProfile, I as DelegationProgress, J as DelegationRecord, K as DelegationResultPayload, L as DelegationResumeContext, M as DelegationResumeDriver, N as DelegationResumeTick, O as DelegationRunContext, P as DelegationStateCorruptError, Q as DelegationStatus, S as DelegationStore, V as DelegationTaskQueueOptions, W as DelegationTraceCaps, X as DelegationTraceCollector, Y as DelegationTraceSpan, Z as DetachedSessionRefParts, _ as DetachedTurn, $ as DriveTurnCapableBox, a0 as DriveTurnResumeDriverOptions, a1 as DriveTurnTick, a2 as FeedbackRating, a3 as FeedbackRefersTo, a4 as FileDelegationStore, a5 as FileDelegationStoreOptions, a6 as FleetWorkspaceExecutorOptions, a7 as InMemoryDelegationStore, a8 as ResearchOutputShape, a9 as RunDetachedTurnOptions, aa as SettleDetachedCoderTurnOptions, ab as SiblingSandboxExecutorOptions, ac as SubmitInput, ad as SubmitOutput, T as TraceContext, ae as UiAuditorDelegationOutput, af as buildDelegationTraceSpans, ag as capDelegationTrace, ah as coderTaskFromArgs, ai as composeLoopTraceEmitters, aj as createDefaultCoderDelegate, ak as createDelegationTraceCollector, al as createDriveTurnResumeDriver, am as createFleetWorkspaceExecutor, an as createPropagatingTraceEmitter, ao as createSiblingSandboxExecutor, ap as detachedTurnEvents, aq as formatDetachedSessionRef, ar as hashIdempotencyInput, as as parseDetachedSessionRef, at as readTraceContextFromEnv, au as runDetachedTurn, av as settleDetachedCoderTurn, aw as traceContextToEnv } from '../delegates-C94qchkz.js';
4
4
  export { B as BuildDelegationMcpServerOptions, C as ComposeProductionAgentProfileOptions, D as DELEGATION_MCP_SERVER_KEY, b as buildDelegationMcpServer, c as composeProductionAgentProfile } from '../delegation-profile-Bvfro2m1.js';
5
- import { G as GitRunner, F as FeedbackStore } from '../coordination-BydGBQCZ.js';
6
- export { A as AnalystRegistry, C as CoordinationEvent, a as CoordinationTools, b as CoordinationToolsOptions, c as CreateWorktreeOptions, D as DiffOptions, d as DiffResult, e as FeedbackEvent, I as InMemoryFeedbackStore, J as JsonRpcMessage, f as JsonRpcResponse, M as MakeWorkerAgent, g as McpServer, h as McpServerOptions, i as McpToolDescriptor, j as McpTransport, Q as Question, k as QuestionDecision, l as QuestionPolicy, m as QuestionRecord, R as RemoveWorktreeOptions, S as SettledWorker, W as WorktreeHandle, n as captureWorktreeDiff, o as createCoordinationTools, p as createInProcessTransport, q as createMcpServer, r as createWorktree, s as eventToSnapshot, t as removeWorktree } from '../coordination-BydGBQCZ.js';
5
+ import { G as GitRunner, F as FeedbackStore } from '../coordination-Biw19JzN.js';
6
+ export { A as AnalystRegistry, C as CoordinationEvent, a as CoordinationTools, b as CoordinationToolsOptions, c as CreateWorktreeOptions, D as DiffOptions, d as DiffResult, e as FeedbackEvent, I as InMemoryFeedbackStore, J as JsonRpcMessage, f as JsonRpcResponse, M as MakeWorkerAgent, g as McpServer, h as McpServerOptions, i as McpToolDescriptor, j as McpTransport, Q as Question, k as QuestionDecision, l as QuestionPolicy, m as QuestionRecord, R as RemoveWorktreeOptions, S as SettledWorker, W as WorktreeHandle, n as captureWorktreeDiff, o as createCoordinationTools, p as createInProcessTransport, q as createMcpServer, r as createWorktree, s as eventToSnapshot, t as removeWorktree } from '../coordination-Biw19JzN.js';
7
7
  import { L as LocalHarness, r as runLocalHarness } from '../local-harness-BE_h8szs.js';
8
8
  export { a as LocalHarnessResult, R as RunLocalHarnessOptions } from '../local-harness-BE_h8szs.js';
9
9
  export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CuzMYGYM.js';
package/dist/mcp/index.js CHANGED
@@ -4,11 +4,11 @@ import {
4
4
  detectExecutor,
5
5
  readTraceContextFromEnv,
6
6
  traceContextToEnv
7
- } from "../chunk-TVBXDW7C.js";
7
+ } from "../chunk-MMDIORZY.js";
8
8
  import {
9
9
  mcpToolsForRuntimeMcp,
10
10
  mcpToolsForRuntimeMcpSubset
11
- } from "../chunk-NJST5D2G.js";
11
+ } from "../chunk-ZWGEA722.js";
12
12
  import {
13
13
  createKbGate
14
14
  } from "../chunk-FNMGYYSS.js";
@@ -18,7 +18,7 @@ import {
18
18
  createFleetWorkspaceExecutor,
19
19
  createSiblingSandboxExecutor,
20
20
  settleDetachedCoderTurn
21
- } from "../chunk-WFEQCRQP.js";
21
+ } from "../chunk-4FEUFYOY.js";
22
22
  import {
23
23
  DELEGATION_MCP_SERVER_KEY,
24
24
  buildDelegationMcpServer,
@@ -81,7 +81,7 @@ import {
81
81
  validateDelegateUiAuditArgs,
82
82
  validateDelegationHistoryArgs,
83
83
  validateDelegationStatusArgs
84
- } from "../chunk-RLDUT4JL.js";
84
+ } from "../chunk-45D64J7B.js";
85
85
  import "../chunk-7QYOXFCD.js";
86
86
  import "../chunk-WIR4HOOJ.js";
87
87
  import "../chunk-VLF5RHEQ.js";
package/dist/runtime.d.ts CHANGED
@@ -1,9 +1,9 @@
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 { u as ResultBlobStore, v as SpawnJournal, N as NodeId, w as SpawnEvent, T as TreeView, x as Settled, y as AgentSpec, E as ExecutorRegistry, B as Budget, z as Agent, H as RootHandle, K as SupervisedResult, L as Spend, O as Scope, P as ExecutorFactory, U as Executor, V as UsageEvent, G as GitRunner, M as MakeWorkerAgent, a as CoordinationTools, A as AnalystRegistry, C as CoordinationEvent, l as QuestionPolicy, X as Supervisor } from './coordination-BydGBQCZ.js';
4
- export { Y as BusEvent, Z as BusRecord, _ as BusStats, $ as EventBus, a0 as ExecutorContext, a1 as ExecutorResult, a2 as Handle, a3 as NodeSnapshot, a4 as NodeStatus, a5 as PublishOptions, a6 as Restart, a7 as RootSignal, a8 as Runtime, a9 as SpawnOpts, aa as SupervisorOpts, ab as WidenGate, ac as createEventBus } from './coordination-BydGBQCZ.js';
3
+ import { u as ResultBlobStore, v as SpawnJournal, N as NodeId, w as SpawnEvent, T as TreeView, x as Settled, y as AgentSpec, E as ExecutorRegistry, B as Budget, z as Agent, H as RootHandle, K as SupervisedResult, L as Spend, O as Scope, P as ExecutorFactory, U as Executor, V as UsageEvent, G as GitRunner, M as MakeWorkerAgent, a as CoordinationTools, A as AnalystRegistry, C as CoordinationEvent, l as QuestionPolicy, X as Supervisor } from './coordination-Biw19JzN.js';
4
+ export { Y as BusEvent, Z as BusRecord, _ as BusStats, $ as EventBus, a0 as ExecutorContext, a1 as ExecutorResult, a2 as Handle, a3 as NodeSnapshot, a4 as NodeStatus, a5 as PublishOptions, a6 as Restart, a7 as RootSignal, a8 as Runtime, a9 as SpawnOpts, aa as SupervisorOpts, ab as WidenGate, ac as createEventBus } from './coordination-Biw19JzN.js';
5
5
  import { R as RuntimeHooks } from './runtime-hooks-C7JwKb9E.js';
6
- import { ChatClient, AnalystFinding, DefaultVerdict, AgentProfile as AgentProfile$1, AnalystRunInputs, DetectorSignal, StreamingDetector, buildTrajectory } from '@tangle-network/agent-eval';
6
+ import { ChatClient, AnalystFinding, DefaultVerdict, AgentProfile as AgentProfile$1, AnalystRunInputs, ToolSpan, StreamingDetector, DetectorSignal, buildTrajectory } from '@tangle-network/agent-eval';
7
7
  export { DefaultVerdict } from '@tangle-network/agent-eval';
8
8
  import { I as Iteration, S as SandboxClient, b as LoopResult, e as LoopTokenUsage, R as RuntimeStreamEvent, A as AgentRunSpec, E as ExecCtx } from './types-CUzjRFZ3.js';
9
9
  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, d as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, U as ValidationCtx, V as Validator } from './types-CUzjRFZ3.js';
@@ -3383,38 +3383,141 @@ declare function serveCoordinationMcp(opts: {
3383
3383
  /**
3384
3384
  * @experimental
3385
3385
  *
3386
- * The online analyst on the worker pipe. As a worker streams its tool calls, this folds each one
3387
- * through agent-eval's streaming detector kernel (`repeatedActionDetector` etc. the SAME kernel the
3388
- * control loop uses, published in @tangle-network/agent-eval) and fires `onSignal` the moment one
3389
- * trips. The wiring point: `onSignal` raises a `finding` on the coordination bus, so the driver learns
3390
- * mid-round that its worker is stuck instead of finding out only at settle.
3386
+ * `TraceSource` the ONE substrate-agnostic source of a worker's tool-call trace. The online
3387
+ * detectors and the settle-time analyzers consume agent-eval `ToolSpan`s from here, regardless of
3388
+ * whether the worker is:
3389
+ * - an OWNED tool loop (router-tools, cli-bridge tool dispatch) push spans as we dispatch them;
3390
+ * - a SANDBOX / fleet box read the harness's tool calls off the session (`streamPrompt` parts
3391
+ * live, `session.messages()` / `findCompletedTurn` at settle).
3391
3392
  *
3392
- * Detection logic + the failure taxonomy live in agent-eval (substrate); this module is the thin
3393
- * runtime adapter that projects a live tool call into a `DetectorEvent` (the tool name + `argHash` of
3394
- * its args an action fingerprint) and pumps the detectors. No detection logic is reimplemented here.
3393
+ * The common currency is agent-eval's `ToolSpan` (so the same detectors + `buildTrajectory`/
3394
+ * `stuckLoopView`/`toolWasteView` run over any source). A source exposes two lanes:
3395
+ * - `onSpan` live spans for ONLINE detection (best-effort; a black-box box may only collect).
3396
+ * - `collect` — the full span set at settle for the BATCH analyzers (always available).
3397
+ *
3398
+ * This module imports NO substrate SDK — it decodes generic message parts / OpenAI tool-call shapes.
3399
+ * The sandbox wiring (`sandboxSessionTraceSource`) is the thin adapter that feeds box session parts in.
3395
3400
  */
3396
3401
 
3397
- interface ToolStep {
3402
+ interface ToolStepInput {
3398
3403
  readonly toolName: string;
3399
3404
  readonly args: unknown;
3400
- /** Whether the tool call errored (drives error-streak detection). Omit/`'ok'` when unknown. */
3401
3405
  readonly status?: 'ok' | 'error';
3402
- }
3403
- interface DetectorMonitor {
3404
- /** Fold one tool step through the detectors; returns (and fires `onSignal` for) every signal. */
3405
- observeToolStep(step: ToolStep): DetectorSignal[];
3406
- reset(): void;
3407
- }
3408
- interface DetectorMonitorOptions {
3406
+ readonly result?: unknown;
3407
+ /** Stable id of the tool call — used to de-duplicate the repeated state transitions a harness
3408
+ * streams for one call (opencode emits pending→running→completed, plus a `raw`-wrapped copy). */
3409
+ readonly callId?: string;
3410
+ }
3411
+ interface TraceSource {
3412
+ /** Subscribe to tool spans as they are produced (ONLINE). Returns an unsubscribe. A source that
3413
+ * only exposes its trace at the end registers nothing and returns a no-op. */
3414
+ onSpan(handler: (span: ToolSpan) => void): () => void;
3415
+ /** The full set of tool spans for the run (SETTLE / batch). Always available. */
3416
+ collect(): Promise<ToolSpan[]>;
3417
+ }
3418
+ /** Project a normalized tool step into the canonical agent-eval `ToolSpan`. */
3419
+ declare function toToolSpan(input: ToolStepInput, runId: string, seq: number, at: number): ToolSpan;
3420
+ /** Decode one harness message part into a tool step, or `undefined` if it is not a (completed) tool
3421
+ * call. ONE adapter per harness family — each owns its real wire shape; the flow downstream is
3422
+ * identical. Add a harness = add a decoder + register it; no other code changes. */
3423
+ type ToolPartDecoder = (part: Record<string, unknown>) => ToolStepInput | undefined;
3424
+ /** opencode parts ARE agent-interface's canonical `ToolPart` (`{ type:'tool', tool, callID?,
3425
+ * state: ToolState }`) — the shape every adc sdk-provider normalizes its harness output into. We
3426
+ * decode against that published type (single source of truth) rather than a re-derived shape; the
3427
+ * `ToolState` union drives the status mapping, so a status that adc adds/renames is a compile error
3428
+ * here, not a silent miss. The same call streams pending→running→terminal; only a terminal state
3429
+ * (`completed` / `error` / `failed`) is a finished call. */
3430
+ declare const decodeOpencodePart: ToolPartDecoder;
3431
+ /** Anthropic / claude-code (also kimi's tool_use variant): a `{ type:'tool_use', id|tool_use_id,
3432
+ * name|tool, input }` content block. CONFIRMED against the cli-bridge's authoritative parsers
3433
+ * (claude.ts reads `block.type==='tool_use', block.id, block.name, block.input`; kimi.ts adds the
3434
+ * `tool_use_id`/`tool` fallbacks) — the canonical readers of these harnesses' real native output. */
3435
+ declare const decodeAnthropicPart: ToolPartDecoder;
3436
+ /** OpenAI-compatible (router / kimi's top-level form / glm): `{ type:'function'|'tool_call', id,
3437
+ * function:{ name, arguments:<JSON string> } }`. CONFIRMED against the cli-bridge (kimi.ts surfaces
3438
+ * kimi's top-level `tool_calls:[{type:'function', id, function:{name,arguments}}]` exactly this way).
3439
+ * NOTE: codex does NOT emit structured tool calls (the bridge's codex.ts never yields `tool_calls` —
3440
+ * it runs shell internally and surfaces only text), so per-tool detection is unavailable for codex
3441
+ * from any path — a harness property, not a decoder gap. */
3442
+ declare const decodeOpenAiPart: ToolPartDecoder;
3443
+ /** The harness → decoder registry. Add a harness by adding one entry. */
3444
+ declare const toolPartDecoders: Record<string, ToolPartDecoder>;
3445
+ /** Decode a part with a specific harness's adapter when known, else try every registered adapter
3446
+ * (the composite — robust to mixed/unknown streams). Never throws. */
3447
+ declare function decodeToolPart(part: unknown, harness?: string): ToolStepInput | undefined;
3448
+ /** A push source for OWNED tool loops (router-tools / cli-bridge tool dispatch): the loop calls
3449
+ * `record(step)` for each tool call; it becomes a span, fan-out to live subscribers + buffered for
3450
+ * `collect`. */
3451
+ declare function createPushTraceSource(opts?: {
3452
+ runId?: string;
3453
+ now?: () => number;
3454
+ }): {
3455
+ source: TraceSource;
3456
+ record: (input: ToolStepInput) => ToolSpan;
3457
+ };
3458
+ /** A source backed by harness message PARTS (sandbox session, cli-bridge). `collect` reads the full
3459
+ * part list and decodes the tool calls; `subscribe`, when given, streams parts live for online
3460
+ * detection. The caller supplies how to get parts (e.g. `box.session(id).messages()` flat-mapped to
3461
+ * parts) — keeping this module free of any substrate SDK. */
3462
+ declare function createPartsTraceSource(opts: {
3463
+ collectParts: () => Promise<ReadonlyArray<unknown>>;
3464
+ subscribeParts?: (onPart: (part: unknown) => void) => () => void;
3465
+ /** The harness whose decoder to use (e.g. 'opencode'); omit to try every registered adapter. */
3466
+ harness?: string;
3467
+ runId?: string;
3468
+ now?: () => number;
3469
+ }): TraceSource;
3470
+ /** A harness session message carrying parts (the shape `box.messages()` returns). Structurally typed
3471
+ * so this works with the real `@tangle-network/sandbox` box AND a test double, no SDK import. */
3472
+ interface SessionMessageLike {
3473
+ readonly parts?: ReadonlyArray<unknown>;
3474
+ }
3475
+ /** The minimal box surface this needs: list a session's messages (incl. mid-turn partials). */
3476
+ interface SessionTraceBox {
3477
+ messages(opts: {
3478
+ sessionId: string;
3479
+ }): Promise<ReadonlyArray<SessionMessageLike>>;
3480
+ }
3481
+ /** The SANDBOX / fleet trace source: read a box session's message parts and decode the harness's tool
3482
+ * calls into spans. `collect` (settle) is the solid path — `box.messages({sessionId})` → parts → spans;
3483
+ * black-box harnesses aren't mid-step interruptible, so online steering is the owned-loop's job and a
3484
+ * live `subscribe` is opt-in (pass `subscribeParts` from `streamPrompt` when the harness streams parts). */
3485
+ declare function sandboxSessionTraceSource(box: SessionTraceBox, sessionId: string, opts?: {
3486
+ /** The box's harness (e.g. 'opencode', 'claude-code') → selects its decoder adapter. */
3487
+ harness?: string;
3488
+ subscribeParts?: (onPart: (part: unknown) => void) => () => void;
3489
+ runId?: string;
3490
+ now?: () => number;
3491
+ }): TraceSource;
3492
+
3493
+ /**
3494
+ * @experimental
3495
+ *
3496
+ * The ONLINE analyst: watch a `TraceSource` and fold each tool span through agent-eval's published
3497
+ * streaming detector kernel (`repeatedActionDetector`/`errorStreakDetector` — the SAME kernel the
3498
+ * control loop folds), firing `onSignal` the moment a worker loops or error-storms. Substrate-
3499
+ * agnostic: it consumes spans from any source (owned router/bridge loop OR a sandbox box session),
3500
+ * never the raw tool seam. Detection logic + the failure taxonomy live in agent-eval; not reimplemented.
3501
+ */
3502
+
3503
+ interface WatchTraceOptions {
3409
3504
  /** The detectors to run online. Defaults to a stuck-loop + error-streak panel. */
3410
3505
  readonly detectors?: ReadonlyArray<StreamingDetector>;
3411
3506
  /** Fired for each signal a detector raises — the seam that raises a `finding` on the bus. */
3412
- readonly onSignal?: (signal: DetectorSignal) => void | Promise<void>;
3507
+ readonly onSignal?: (signal: DetectorSignal, span: ToolSpan) => void | Promise<void>;
3413
3508
  }
3414
3509
  /** The default online panel for a tool-call pipe: a worker repeating the same call, or hammering
3415
- * consecutive errors. (No-progress needs a domain progress-probe, so it is opt-in, not default.) */
3510
+ * consecutive errors. (No-progress needs a domain progress-probe, so it is opt-in, not default.)
3511
+ *
3512
+ * Coverage note: `repeated-action` works for EVERY harness (it needs only tool name + args, which
3513
+ * every adapter provides). `error-streak` needs per-call status — opencode carries it inline
3514
+ * (`state.status`, VALIDATED live), but claude-code/codex tool-call parts do NOT (their errors live
3515
+ * in separate result blocks not yet decoded), so error-streak is silent for those until result-block
3516
+ * decoding is added + live-validated. It is in the panel because it is correct where status exists. */
3416
3517
  declare function defaultToolDetectors(): StreamingDetector[];
3417
- declare function createDetectorMonitor(opts?: DetectorMonitorOptions): DetectorMonitor;
3518
+ /** Subscribe to a `TraceSource` and run the streaming detectors over its live spans. Returns an
3519
+ * unsubscribe. A defensive `argHash` failure (circular args) never throws out of the side-channel. */
3520
+ declare function watchTrace(source: TraceSource, opts?: WatchTraceOptions): () => void;
3418
3521
 
3419
3522
  /**
3420
3523
  * @experimental
@@ -3852,43 +3955,25 @@ declare function createRootHandle<Out>(): RootHandle<Out>;
3852
3955
  /**
3853
3956
  * @experimental
3854
3957
  *
3855
- * The settle-time trace analyzer. Captures a worker's tool steps and, when it settles, replays them
3856
- * as agent-eval spans into an in-memory `TraceStore` and runs agent-eval's PUBLISHED batch analyzers
3857
- * over them — `buildTrajectory` (structured run summary), `stuckLoopView` (full-run repeated-call
3858
- * view, complementing the ONLINE consecutive detector), and `toolWasteView` (waste ratio). The result
3859
- * is the "parent runs trace analyzers over the whole loop trace at settle" piece, reusing agent-eval
3860
- * no analysis logic is reimplemented here; this is the thin adapter that bridges live tool steps into
3861
- * the substrate's trace model.
3862
- *
3863
- * Pairs with `createDetectorMonitor` (the ONLINE pipe watcher): feed both from the worker's `onToolStep`
3864
- * seam — the monitor raises findings mid-run, the recorder produces the post-hoc trajectory at settle.
3958
+ * The SETTLE-time analyst: when a worker finishes, collect its tool spans from a `TraceSource` and run
3959
+ * agent-eval's PUBLISHED batch analyzers over them — `buildTrajectory` (structured run summary),
3960
+ * `stuckLoopView` (full-run repeated-call view, complementing the online consecutive detector), and
3961
+ * `toolWasteView`. Substrate-agnostic: the spans come from any source (an owned loop's buffer OR a
3962
+ * sandbox box session). No analysis reimplemented this is the thin bridge into agent-eval's analyzers.
3865
3963
  */
3866
3964
 
3867
- interface RecordedToolStep {
3868
- readonly toolName: string;
3869
- readonly args: unknown;
3870
- readonly status?: 'ok' | 'error';
3871
- readonly result?: unknown;
3872
- }
3873
3965
  interface TrajectoryAnalysis {
3874
- /** Structured run summary (tool-call count, step order). Steps are recorded at a single timestamp
3875
- * — the moment the tool call resolved — so per-span duration is 0; loop/waste detection keys on
3876
- * call PATTERNS + cross-span windows, not individual durations. */
3966
+ /** Structured run summary (tool-call count, step order). Steps carry a single timestamp, so per-span
3967
+ * duration is 0; loop/waste detection keys on call PATTERNS + cross-span windows, not durations. */
3877
3968
  readonly trajectory: Awaited<ReturnType<typeof buildTrajectory>>;
3878
- /** Full-run repeated-call view (total occurrences + window), distinct from the online consecutive
3879
- * detector catches a loop that is interleaved with other calls. */
3969
+ /** Full-run repeated-call view (total occurrences + window) catches a loop the online consecutive
3970
+ * detector interleaves past. */
3880
3971
  readonly stuckLoop: Awaited<ReturnType<typeof stuckLoopView>>;
3881
3972
  /** Wasted-vs-total tool-call ratio for the run. */
3882
3973
  readonly toolWaste: Awaited<ReturnType<typeof toolWasteView>>;
3883
3974
  }
3884
- interface TrajectoryRecorder {
3885
- /** Capture one tool step (feed from the same `onToolStep` seam as the online monitor). */
3886
- observeToolStep(step: RecordedToolStep): void;
3887
- /** Replay the captured steps as agent-eval spans and run the batch analyzers over them. */
3888
- analyze(): Promise<TrajectoryAnalysis>;
3889
- reset(): void;
3890
- }
3891
- declare function createTrajectoryRecorder(runId: string, now?: () => number): TrajectoryRecorder;
3975
+ /** Collect the source's spans and run the agent-eval batch analyzers over them under one `runId`. */
3976
+ declare function analyzeTrace(source: TraceSource, runId?: string): Promise<TrajectoryAnalysis>;
3892
3977
 
3893
3978
  /**
3894
3979
  * createVerifierEnvironment — ANY checkable task as an `Environment`, no tool surface
@@ -3985,4 +4070,4 @@ declare function runInWorkspace<T>(ws: Workspace, body: (cwd: string) => Promise
3985
4070
  commitOnInvalid?: boolean;
3986
4071
  }): Promise<WorkspaceRun<T>>;
3987
4072
 
3988
- 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 AuthoredCoderHarness, type AuthoredProfile, 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 CliWorktreeSeam, type CoderDeliverableOptions, type CoderWinnerStrategy, type CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, type CoordinationDriverOptions, type CoordinationMcpHandle, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type DeliverableSpec, type DetectorMonitor, type DetectorMonitorOptions, type DriverChat, type DriverMessage, type DriverToolCall, type DriverTurn, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, Executor, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, type FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, type NestedScopeSeam, 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 RecordedToolStep, type RegistryAnalyzeProjection, type RenderCorpusToInstructions, type RenderCorpusToInstructionsOptions, type ReservationTicket, ResultBlobStore, RootHandle, RouterConfig, 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 ToolStep, type TrajectoryAnalysis, type TrajectoryNode, type TrajectoryRecorder, 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, type WorkspaceRun, type WorktreeCliExecutorOptions, type WorktreeCoderFanoutOptions, type WorktreeCommandResult, type WorktreePatchArtifact, acquireSandbox, adaptiveRefine, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createDetectorMonitor, createExecutor, createExecutorRegistry, createInbox, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createTrajectoryRecorder, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, defaultAnalystInstruction, defaultAuditorInstruction, defaultToolDetectors, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerDriverChat, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, trajectoryReport, verify, widen, withDriverExecutor, worktreeCoderFanout };
4073
+ 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 AuthoredCoderHarness, type AuthoredProfile, 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 CliWorktreeSeam, type CoderDeliverableOptions, type CoderWinnerStrategy, type CombinatorShape, type CompletionAnalyst, type CompletionEvidence, type CompletionPolicy, type CompletionVerdict, type CoordinationDriverOptions, type CoordinationMcpHandle, type Corpus, type CorpusFilter, type CorpusRecord, type CreateScopeAnalystOptions, type CriuCapableClient, type DefinePersona, type DefinePersonaInput, type Deliverable, type DeliverableSpec, type DriverChat, type DriverMessage, type DriverToolCall, type DriverTurn, type Environment, type EqualKArm, type EqualKOnCost, type EqualKOnCostOptions, type EqualKVerdict, type EvolutionArchiveNode, type EvolutionAuthor, type EvolutionBandInfo, type EvolutionCandidate, type EvolutionGeneration, type EvolutionReport, ExecCtx, Executor, type ExecutorConfig, ExecutorFactory, ExecutorRegistry, type Fanout, type FanoutOptions, type FanoutSynthesis, type FanoutWinnerSelector, FileCorpus, FileResultBlobStore, FileSpawnJournal, type FlatWidenGate, type ForkCapableBox, type GitWorkspaceOptions, type HarvestCorpusOptions, type HarvestFailure, type HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, type Inbox, type InboxMessage, type IntentAudit, Iteration, type LoopDispatchOptions, type LoopOptionsForDispatch, LoopResult, type LoopShape, LoopTokenUsage, type LoopUntil, type LoopUntilSpec, type LoopUntilState, type McpEndpoint, type McpEnvironmentOptions, type NestedScopeSeam, 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, RouterConfig, 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, type SessionMessageLike, type SessionTraceBox, 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 ToolPartDecoder, ToolSpec, type ToolStepInput, type TraceSource, type TrajectoryAnalysis, type TrajectoryNode, type TrajectoryReport, type TrajectoryReportFn, type TrajectoryReportOptions, TreeView, type TurnResult, UsageEvent, type UsageSink, type VerifierEnvironmentOptions, type Verify, type VerifySpec, type WatchTraceOptions, type WaterfallCollector, type WaterfallReport, type WaterfallSpan, type Widen, type WidenDecision, type WidenLineage, type WidenSpec, type Workspace, type WorkspaceCommit, type WorkspaceRun, type WorktreeCliExecutorOptions, type WorktreeCoderFanoutOptions, type WorktreeCommandResult, type WorktreePatchArtifact, acquireSandbox, adaptiveRefine, analyzeTrace, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, cliWorktreeExecutor, coderDeliverable, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createExecutor, createExecutorRegistry, createInbox, createMcpEnvironment, createPartsTraceSource, createPushTraceSource, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, createWorktreeCliExecutor, decodeAnthropicPart, decodeOpenAiPart, decodeOpencodePart, decodeToolPart, defaultAnalystInstruction, defaultAuditorInstruction, defaultToolDetectors, definePersona, defineStrategy, depthDriver, deterministicCompletion, discriminatingMeans, driverChild, driverExecutorFactory, driverRuntime, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gateOnDeliverable, gitWorkspace, harvestCorpus, inlineSandboxClient, isDriverSpec, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, nestedScopeSeamKey, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, routerDriverChat, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, sandboxSessionTraceSource, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, toToolSpan, toolPartDecoders, trajectoryReport, verify, watchTrace, widen, withDriverExecutor, worktreeCoderFanout };