@tangle-network/agent-runtime 0.90.1 → 0.92.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 (86) hide show
  1. package/README.md +4 -2
  2. package/dist/agent.d.ts +3 -3
  3. package/dist/agent.js +88 -9
  4. package/dist/agent.js.map +1 -1
  5. package/dist/{mcp-serve-verifier-XsX8rkB9.d.ts → agentic-generator-B8oeE2Yv.d.ts} +6 -33
  6. package/dist/analyst-loop.d.ts +1 -1
  7. package/dist/candidate-execution/index.d.ts +104 -0
  8. package/dist/candidate-execution/index.js +34 -0
  9. package/dist/candidate-execution/index.js.map +1 -0
  10. package/dist/chunk-3BE7KTMU.js +1229 -0
  11. package/dist/chunk-3BE7KTMU.js.map +1 -0
  12. package/dist/chunk-3D2RHC4K.js +73 -0
  13. package/dist/chunk-3D2RHC4K.js.map +1 -0
  14. package/dist/chunk-3MDZX7YU.js +125 -0
  15. package/dist/chunk-3MDZX7YU.js.map +1 -0
  16. package/dist/{chunk-RYBVU4M3.js → chunk-6O5USWVH.js} +32 -1413
  17. package/dist/chunk-6O5USWVH.js.map +1 -0
  18. package/dist/chunk-6O73TRHW.js +142 -0
  19. package/dist/chunk-6O73TRHW.js.map +1 -0
  20. package/dist/{chunk-R2VAJGR3.js → chunk-7VJJJ2T2.js} +2 -2
  21. package/dist/chunk-A62TP7SK.js +4784 -0
  22. package/dist/chunk-A62TP7SK.js.map +1 -0
  23. package/dist/chunk-APVPRF4Y.js +2166 -0
  24. package/dist/chunk-APVPRF4Y.js.map +1 -0
  25. package/dist/{chunk-QK4DV5PR.js → chunk-AUEIDTR3.js} +2 -2
  26. package/dist/{chunk-OOL3675H.js → chunk-FRBHUNQ7.js} +2 -139
  27. package/dist/chunk-FRBHUNQ7.js.map +1 -0
  28. package/dist/{chunk-7ON74BQO.js → chunk-GDAQUFG6.js} +2 -2
  29. package/dist/{chunk-ZV4LXYCJ.js → chunk-I7WVPJBZ.js} +23 -1231
  30. package/dist/chunk-I7WVPJBZ.js.map +1 -0
  31. package/dist/{chunk-WRUSWK4F.js → chunk-IGGZGKJD.js} +3 -3
  32. package/dist/chunk-PH65PR4F.js +860 -0
  33. package/dist/chunk-PH65PR4F.js.map +1 -0
  34. package/dist/chunk-RSWM2ZKM.js +659 -0
  35. package/dist/chunk-RSWM2ZKM.js.map +1 -0
  36. package/dist/{chunk-BZF3KQ6G.js → chunk-VSWBYWFK.js} +4 -122
  37. package/dist/chunk-VSWBYWFK.js.map +1 -0
  38. package/dist/{completion-gate-DkAnUmpb.d.ts → completion-gate-BLaiN0-X.d.ts} +1 -1
  39. package/dist/{coordination-rRj5hjJK.d.ts → coordination-DxJ83oZA.d.ts} +12 -5
  40. package/dist/environment-provider.d.ts +2 -2
  41. package/dist/environment-provider.js +2 -1
  42. package/dist/improve-CUVCq7xg.d.ts +152 -0
  43. package/dist/{improvement-adapter-CDR8QNVM.d.ts → improvement-adapter-BieWeK5J.d.ts} +16 -0
  44. package/dist/index.d.ts +27 -291
  45. package/dist/index.js +70 -889
  46. package/dist/index.js.map +1 -1
  47. package/dist/intelligence.d.ts +160 -13
  48. package/dist/intelligence.js +535 -59
  49. package/dist/intelligence.js.map +1 -1
  50. package/dist/knowledge.d.ts +6 -6
  51. package/dist/knowledge.js +6 -4
  52. package/dist/lifecycle.d.ts +2 -1
  53. package/dist/lifecycle.js +5 -3
  54. package/dist/lifecycle.js.map +1 -1
  55. package/dist/{loop-runner-bin-DTbZVGfM.d.ts → loop-runner-bin-kKUNGLyV.d.ts} +2 -2
  56. package/dist/loop-runner-bin.d.ts +5 -5
  57. package/dist/loop-runner-bin.js +8 -5
  58. package/dist/loops.d.ts +16 -16
  59. package/dist/loops.js +47 -41
  60. package/dist/mcp/bin.js +6 -4
  61. package/dist/mcp/bin.js.map +1 -1
  62. package/dist/mcp/index.d.ts +8 -8
  63. package/dist/mcp/index.js +9 -6
  64. package/dist/mcp/index.js.map +1 -1
  65. package/dist/mcp-serve-verifier-Bg4C3p5S.d.ts +34 -0
  66. package/dist/{openai-tools-C4ZfUD4L.d.ts → openai-tools-E3woykz9.d.ts} +1 -1
  67. package/dist/prepare-Z08a4heC.d.ts +713 -0
  68. package/dist/profiles.d.ts +1 -1
  69. package/dist/{router-client-DJImUDlm.d.ts → sanitize-C9go6tXj.d.ts} +113 -1
  70. package/dist/{structural-rollout-MwlpgQ-6.d.ts → structural-rollout-DHGDbhvR.d.ts} +3 -3
  71. package/dist/{supervise-DPmYPk0j.d.ts → supervise-T2pazU3G.d.ts} +4 -4
  72. package/dist/{types-SyuwunY_.d.ts → types-B00NtbCs.d.ts} +1 -1
  73. package/dist/{types-eMNgWgFi.d.ts → types-DAdIm4AC.d.ts} +1 -1
  74. package/dist/{worktree-fanout-BDFQIO-Y.d.ts → worktree-fanout-BUb2Ag02.d.ts} +3 -3
  75. package/package.json +26 -36
  76. package/skills/build-with-agent-runtime/SKILL.md +1 -1
  77. package/dist/chunk-BZF3KQ6G.js.map +0 -1
  78. package/dist/chunk-IVGYLCFH.js +0 -381
  79. package/dist/chunk-IVGYLCFH.js.map +0 -1
  80. package/dist/chunk-OOL3675H.js.map +0 -1
  81. package/dist/chunk-RYBVU4M3.js.map +0 -1
  82. package/dist/chunk-ZV4LXYCJ.js.map +0 -1
  83. /package/dist/{chunk-R2VAJGR3.js.map → chunk-7VJJJ2T2.js.map} +0 -0
  84. /package/dist/{chunk-QK4DV5PR.js.map → chunk-AUEIDTR3.js.map} +0 -0
  85. /package/dist/{chunk-7ON74BQO.js.map → chunk-GDAQUFG6.js.map} +0 -0
  86. /package/dist/{chunk-WRUSWK4F.js.map → chunk-IGGZGKJD.js.map} +0 -0
@@ -2,14 +2,17 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-WRUSWK4F.js";
5
+ } from "./chunk-IGGZGKJD.js";
6
6
  import "./chunk-SGKPNBXE.js";
7
- import "./chunk-ZV4LXYCJ.js";
7
+ import "./chunk-I7WVPJBZ.js";
8
+ import "./chunk-3BE7KTMU.js";
8
9
  import "./chunk-ZQZX77MM.js";
9
- import "./chunk-RYBVU4M3.js";
10
+ import "./chunk-6O5USWVH.js";
10
11
  import "./chunk-DPEUKJRO.js";
11
- import "./chunk-IVGYLCFH.js";
12
- import "./chunk-BZF3KQ6G.js";
12
+ import "./chunk-APVPRF4Y.js";
13
+ import "./chunk-3D2RHC4K.js";
14
+ import "./chunk-VSWBYWFK.js";
15
+ import "./chunk-3MDZX7YU.js";
13
16
  import "./chunk-FVJ7M3DA.js";
14
17
  import "./chunk-CMYMTRGA.js";
15
18
  import "./chunk-YEJR7IXO.js";
package/dist/loops.d.ts CHANGED
@@ -2,26 +2,26 @@ import { ChatClient, RunRecord, HarnessType, AgentProfile, AnalystFinding, Analy
2
2
  export { AnalystFinding, DefaultVerdict, computeFindingId, makeFinding } from '@tangle-network/agent-eval';
3
3
  import { SandboxEvent, SandboxInstance, CreateSandboxOptions, PromptOptions, TaskOptions } from '@tangle-network/sandbox';
4
4
  export { AgentProfile, CreateSandboxOptions, SandboxEvent, SandboxInstance } from '@tangle-network/sandbox';
5
- import { a as ResultBlobStore, g as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, A as Agent, B as Budget, d as Settled, S as Scope, b as SupervisedResult, e as Spend, U as UsageEvent, h as ExecutorRegistry, k as Supervisor } from './types-eMNgWgFi.js';
6
- export { f as AgentSpec, c as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-eMNgWgFi.js';
7
- import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-rRj5hjJK.js';
8
- export { bf as BusEvent, bg as BusRecord, bh as BusStats, bi as EventBus, bj as ProviderSeam, bk as PublishOptions, bl as cliWorktreeExecutor, bm as createEventBus, bn as createExecutor, bo as createExecutorRegistry } from './coordination-rRj5hjJK.js';
9
- import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, A as AgentRunSpec, c as OutputAdapter, V as Validator, E as ExecCtx, Y as LoopWinner, Z as LoopLineageOptions, _ as LoopResult, L as LoopTokenUsage, b as RuntimeStreamEvent, $ as MountRecorder, j as AgentExecutionBackend, p as AgentTaskStatus, B as BackendErrorDetail } from './types-SyuwunY_.js';
10
- export { a0 as LoopDecisionPayload, a1 as LoopEndedPayload, a2 as LoopIterationDispatchPayload, a3 as LoopIterationEndedPayload, a4 as LoopIterationStartedPayload, a5 as LoopPlanDescription, a6 as LoopPlanPayload, e as LoopSandboxPlacement, a7 as LoopStartedPayload, a8 as LoopTeardownFailedPayload, f as LoopTraceEmitter, d as LoopTraceEvent, a9 as MountManifestEntry, aa as RunProvenance, a as SelectionReceipt, ab as ValidationCtx } from './types-SyuwunY_.js';
5
+ import { a as ResultBlobStore, g as SpawnJournal, N as NodeId, j as SpawnEvent, E as ExecutorFactory, A as Agent, B as Budget, d as Settled, S as Scope, b as SupervisedResult, e as Spend, U as UsageEvent, h as ExecutorRegistry, k as Supervisor } from './types-DAdIm4AC.js';
6
+ export { f as AgentSpec, c as Executor, l as ExecutorContext, m as ExecutorResult, R as Runtime, n as SupervisorOpts, T as TreeView, W as WidenGate } from './types-DAdIm4AC.js';
7
+ import { M as MakeWorkerAgent, A as AnalystRegistry, o as CoordinationTools, n as CoordinationEvent, as as QuestionPolicy, E as ExecutorConfig } from './coordination-DxJ83oZA.js';
8
+ export { bh as BusEvent, bi as BusRecord, bj as BusStats, bk as EventBus, bl as ProviderSeam, bm as PublishOptions, bn as cliWorktreeExecutor, bo as createEventBus, bp as createExecutor, bq as createExecutorRegistry } from './coordination-DxJ83oZA.js';
9
+ import { R as RuntimeHooks, I as Iteration, S as SandboxClient, D as Driver, e as AgentRunSpec, d as OutputAdapter, V as Validator, E as ExecCtx, Y as LoopWinner, Z as LoopLineageOptions, _ as LoopResult, L as LoopTokenUsage, b as RuntimeStreamEvent, $ as MountRecorder, l as AgentExecutionBackend, c as AgentTaskStatus, B as BackendErrorDetail } from './types-B00NtbCs.js';
10
+ export { a0 as LoopDecisionPayload, a1 as LoopEndedPayload, a2 as LoopIterationDispatchPayload, a3 as LoopIterationEndedPayload, a4 as LoopIterationStartedPayload, a5 as LoopPlanDescription, a6 as LoopPlanPayload, f as LoopSandboxPlacement, a7 as LoopStartedPayload, a8 as LoopTeardownFailedPayload, h as LoopTraceEmitter, g as LoopTraceEvent, a9 as MountManifestEntry, aa as RunProvenance, a as SelectionReceipt, ab as ValidationCtx } from './types-B00NtbCs.js';
11
11
  import { RunProfileMatrixResult, Scenario, ProfileDispatchFn, JudgeConfig, RunProfileMatrixOptions, DispatchFn } from '@tangle-network/agent-eval/campaign';
12
12
  export { AgentEnvironmentProviderRef, AgentEnvironmentProviderRegistry, ProviderAsSandboxClientOptions, ProviderExecutorOptions, SandboxClientProviderOptions, createAgentEnvironmentProviderRegistry, providerAsExecutor, providerAsSandboxClient, resolveAgentEnvironmentProvider, sandboxClientAsProvider } from './environment-provider.js';
13
- import { c as CorpusRecord, C as Corpus, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, O as Outcome, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-BDFQIO-Y.js';
14
- export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-BDFQIO-Y.js';
15
- import { A as AgenticSurface, a as AgenticTask, b as AgenticOptions, c as Strategy, d as ArtifactHandle, e as SurfaceScore, f as AgenticTool } from './structural-rollout-MwlpgQ-6.js';
16
- export { g as AgenticRunResult, C as CheckExecChannel, h as CheckOutcome, i as CheckRunContext, j as CheckRunner, k as CheckSource, l as CheckSourceCtx, m as CorpusReadbackOptions, R as RepairStop, n as RunAgenticOptions, o as ShotPersona, p as ShotSpec, q as StrategyCtx, r as StrategyResult, s as StructuralRolloutConfig, S as StructuralRolloutPolicy, t as StructuralRolloutResult, V as VisibleCheck, u as adaptiveRefine, v as breadthStrategy, w as canDisplace, x as compareCheckOutcomes, y as composeCheckSources, z as defaultExtractCandidate, B as defaultStructuralRolloutPolicy, D as defineStrategy, E as depthStrategy, F as filterAuthoredAsserts, G as modelAuthoredChecks, H as officialChecksFromMeta, I as refine, J as resolveEntrySymbol, K as runAgentic, L as sample, M as sampleThenRefine, N as sandboxCheckRunner, O as selectBestIndex, P as structuralRollout, Q as visibleCheckScore } from './structural-rollout-MwlpgQ-6.js';
13
+ import { c as CorpusRecord, C as Corpus, S as ScopeAnalyzeInput, d as AssertTraceDerivedFindings, O as Outcome, e as SteerContext, f as ScopeAnalyst, F as FanoutOptions, g as CombinatorShape, h as ScopeWidenGate, L as LoopUntilSpec, P as PanelSpec, i as PipelineStage, W as WinnerStrategy, j as FanoutWinnerSelector, V as VerifySpec, k as WidenSpec, l as CorpusFilter, R as RenderCorpusToInstructionsOptions, D as DefinePersonaInput, m as Persona, n as RunPersonifiedOptions, o as ShapeRegistry, p as LoopShape, E as EqualKArm, q as EqualKOnCostOptions, r as EqualKVerdict, T as TrajectoryReportOptions, s as TrajectoryReport } from './worktree-fanout-BUb2Ag02.js';
14
+ export { A as AuthoredHarness, t as DefinePersona, u as EqualKOnCost, v as Fanout, w as FanoutSynthesis, x as FlatWidenGate, y as LoopUntil, z as LoopUntilState, B as Panel, G as PanelJudge, H as PanelVerdict, I as PatchDeliverableOptions, J as PersonaContext, K as PersonaExecutors, M as Pipeline, N as RenderCorpusToInstructions, Q as RunPersonified, U as ShapeBudget, X as ShapeContext, Y as TrajectoryNode, Z as TrajectoryReportFn, _ as Verify, $ as Widen, a0 as WidenDecision, a1 as WidenLineage, a2 as WorktreeCliExecutorOptions, a as WorktreeFanoutOptions, b as WorktreePatchArtifact, a3 as createWorktreeCliExecutor, a4 as patchDelivered, a5 as worktreeFanout } from './worktree-fanout-BUb2Ag02.js';
15
+ import { A as AgenticSurface, a as AgenticTask, b as AgenticOptions, c as Strategy, d as ArtifactHandle, e as SurfaceScore, f as AgenticTool } from './structural-rollout-DHGDbhvR.js';
16
+ export { g as AgenticRunResult, C as CheckExecChannel, h as CheckOutcome, i as CheckRunContext, j as CheckRunner, k as CheckSource, l as CheckSourceCtx, m as CorpusReadbackOptions, R as RepairStop, n as RunAgenticOptions, o as ShotPersona, p as ShotSpec, q as StrategyCtx, r as StrategyResult, s as StructuralRolloutConfig, S as StructuralRolloutPolicy, t as StructuralRolloutResult, V as VisibleCheck, u as adaptiveRefine, v as breadthStrategy, w as canDisplace, x as compareCheckOutcomes, y as composeCheckSources, z as defaultExtractCandidate, B as defaultStructuralRolloutPolicy, D as defineStrategy, E as depthStrategy, F as filterAuthoredAsserts, G as modelAuthoredChecks, H as officialChecksFromMeta, I as refine, J as resolveEntrySymbol, K as runAgentic, L as sample, M as sampleThenRefine, N as sandboxCheckRunner, O as selectBestIndex, P as structuralRollout, Q as visibleCheckScore } from './structural-rollout-DHGDbhvR.js';
17
17
  import { b as AnalystRegistryLike } from './types-BC3bZpH0.js';
18
18
  import { AgentProfile as AgentProfile$1 } from '@tangle-network/agent-interface';
19
- import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './router-client-DJImUDlm.js';
20
- export { c as RouterChatResult, d as RouterChatToolsResult, e as RouterToolCall, f as RouterToolLoopResult, g as ToolLoopCompaction, b as ToolSpec, r as routerBrain, h as routerChatWithTools, i as routerChatWithUsage, j as routerToolLoop } from './router-client-DJImUDlm.js';
21
- import { D as DeliverableSpec } from './completion-gate-DkAnUmpb.js';
22
- export { g as WorktreeCommandResult, h as gateOnDeliverable } from './completion-gate-DkAnUmpb.js';
23
- import { S as SupervisorProfile } from './supervise-DPmYPk0j.js';
24
- export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-DPmYPk0j.js';
19
+ import { R as RouterConfig, T as ToolLoopChat, a as ToolLoopCompactionOptions } from './sanitize-C9go6tXj.js';
20
+ export { j as RouterChatResult, k as RouterChatToolsResult, l as RouterToolCall, m as RouterToolLoopResult, n as ToolLoopCompaction, b as ToolSpec, r as routerBrain, o as routerChatWithTools, p as routerChatWithUsage, q as routerToolLoop } from './sanitize-C9go6tXj.js';
21
+ import { D as DeliverableSpec } from './completion-gate-BLaiN0-X.js';
22
+ export { g as WorktreeCommandResult, h as gateOnDeliverable } from './completion-gate-BLaiN0-X.js';
23
+ import { S as SupervisorProfile } from './supervise-T2pazU3G.js';
24
+ export { D as DriveHarness, a as SuperviseOptions, b as SupervisorAgentDeps, s as supervise, c as supervisorAgent, w as workerFromBackend } from './supervise-T2pazU3G.js';
25
25
  import { stuckLoopView, toolWasteView } from '@tangle-network/agent-eval/pipelines';
26
26
  export { AgentEnvironment, AgentEnvironmentCapabilities, AgentEnvironmentEvent, AgentEnvironmentProvider, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSession, AgentSessionRef, AgentSessionStatus, AgentTurnInput, AgentTurnResult, CheckpointRef, CheckpointRequest, CreateAgentEnvironmentInput, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from '@tangle-network/agent-interface/environment-provider';
27
27
  import './substrate-DO2GHNg2.js';
package/dist/loops.js CHANGED
@@ -2,21 +2,16 @@ import {
2
2
  FileCorpus,
3
3
  InMemoryCorpus,
4
4
  SandboxRunAbortError,
5
- adaptiveRefine,
6
5
  analyzeTrace,
7
6
  anytimeReport,
8
7
  assertStrategyContract,
9
8
  assertTraceDerivedFindings,
10
9
  auditIntent,
11
10
  authorStrategy,
12
- breadthStrategy,
13
11
  buildSteerContext,
14
12
  builtinShapes,
15
- canDisplace,
16
13
  collectAgentTurn,
17
- compareCheckOutcomes,
18
14
  completionAuthorizes,
19
- composeCheckSources,
20
15
  computeFindingId,
21
16
  createMcpEnvironment,
22
17
  createPushTraceSource,
@@ -25,22 +20,16 @@ import {
25
20
  createVerifierEnvironment,
26
21
  createWaterfallCollector,
27
22
  decodeToolPart,
28
- defaultAnalystInstruction,
29
23
  defaultAuditorInstruction,
30
- defaultExtractCandidate,
31
- defaultStructuralRolloutPolicy,
32
24
  defaultToolDetectors,
33
25
  defineLeaderboard,
34
26
  definePersona,
35
- defineStrategy,
36
- depthStrategy,
37
27
  deterministicCompletion,
38
28
  discriminatingMeans,
39
29
  dumbDriver,
40
30
  equalKOnCost,
41
31
  failuresAnalyst,
42
32
  fanout,
43
- filterAuthoredAsserts,
44
33
  flatWidenGate,
45
34
  gitWorkspace,
46
35
  harvestCorpus,
@@ -53,10 +42,7 @@ import {
53
42
  loopDispatch,
54
43
  loopUntil,
55
44
  makeFinding,
56
- modelAuthoredChecks,
57
45
  naiveDriver,
58
- observe,
59
- officialChecksFromMeta,
60
46
  openSandboxRun,
61
47
  pairwiseSignificance,
62
48
  panel,
@@ -65,7 +51,6 @@ import {
65
51
  pipeline,
66
52
  printBenchmarkReport,
67
53
  promotionGate,
68
- refine,
69
54
  registerShape,
70
55
  registryScopeAnalyst,
71
56
  renderAnytimeTable,
@@ -74,54 +59,64 @@ import {
74
59
  renderLeaderboardMarkdown,
75
60
  renderLeaderboardSvg,
76
61
  renderPairwiseMarkdown,
77
- renderReport,
78
62
  reportLoopUsage,
79
- resolveEntrySymbol,
80
63
  resolveSandboxClient,
81
- runAgentic,
82
64
  runBenchmark,
83
65
  runInWorkspace,
84
66
  runPersonified,
85
67
  runStrategyEvolution,
86
- sample,
87
- sampleThenRefine,
88
- sandboxCheckRunner,
89
68
  sandboxSessionTraceSource,
90
- selectBestIndex,
91
69
  selectChampion,
92
70
  selectValidWinner,
93
71
  sentinelCompletion,
94
72
  stopSentinel,
95
73
  strategyAuthorContract,
96
74
  streamAgentTurn,
97
- structuralRollout,
98
75
  superviseSurface,
99
76
  trajectoryReport,
100
77
  verify,
101
- visibleCheckScore,
102
78
  watchTrace,
103
79
  widen,
104
80
  worktreeFanout
105
- } from "./chunk-ZV4LXYCJ.js";
81
+ } from "./chunk-I7WVPJBZ.js";
82
+ import {
83
+ adaptiveRefine,
84
+ breadthStrategy,
85
+ canDisplace,
86
+ compareCheckOutcomes,
87
+ composeCheckSources,
88
+ defaultAnalystInstruction,
89
+ defaultExtractCandidate,
90
+ defaultStructuralRolloutPolicy,
91
+ defineStrategy,
92
+ depthStrategy,
93
+ filterAuthoredAsserts,
94
+ modelAuthoredChecks,
95
+ observe,
96
+ officialChecksFromMeta,
97
+ refine,
98
+ renderReport,
99
+ resolveEntrySymbol,
100
+ runAgentic,
101
+ sample,
102
+ sampleThenRefine,
103
+ sandboxCheckRunner,
104
+ selectBestIndex,
105
+ structuralRollout,
106
+ visibleCheckScore
107
+ } from "./chunk-3BE7KTMU.js";
106
108
  import {
107
- InMemoryResultBlobStore,
108
- InMemorySpawnJournal,
109
109
  acquireSandbox,
110
110
  asAuthoredProfile,
111
- assertModelAllowed,
112
111
  assessAuthoredProfile,
113
112
  authoredWorker,
114
113
  cliWorktreeExecutor,
115
- contentAddress,
116
- createBudgetPool,
117
114
  createEventBus,
118
115
  createExecutor,
119
116
  createExecutorRegistry,
120
117
  createInMemoryRunContext,
121
118
  createInbox,
122
119
  createSandboxLineage,
123
- createScope,
124
- createSupervisor,
125
120
  createWorktreeCliExecutor,
126
121
  defaultDelegateBudget,
127
122
  defaultProfileRichnessThresholds,
@@ -132,28 +127,39 @@ import {
132
127
  gateOnDeliverable,
133
128
  probeSandboxCapabilities,
134
129
  profileRichnessFinding,
135
- routerBrain,
136
- routerChatWithTools,
137
- routerChatWithUsage,
138
- routerToolLoop,
139
130
  runLoop,
140
131
  serveCoordinationMcp,
141
- settledToIteration,
142
- spendFromUsageEvents,
143
132
  supervise,
144
133
  supervisorAgent,
145
134
  supervisorInstructions,
146
135
  workerFromBackend
147
- } from "./chunk-RYBVU4M3.js";
136
+ } from "./chunk-6O5USWVH.js";
148
137
  import "./chunk-DPEUKJRO.js";
149
- import "./chunk-IVGYLCFH.js";
138
+ import {
139
+ assertModelAllowed,
140
+ createBudgetPool,
141
+ createScope,
142
+ createSupervisor,
143
+ routerBrain,
144
+ routerChatWithTools,
145
+ routerChatWithUsage,
146
+ routerToolLoop,
147
+ settledToIteration,
148
+ spendFromUsageEvents
149
+ } from "./chunk-APVPRF4Y.js";
150
+ import {
151
+ InMemoryResultBlobStore,
152
+ InMemorySpawnJournal,
153
+ contentAddress
154
+ } from "./chunk-3D2RHC4K.js";
150
155
  import {
151
156
  createAgentEnvironmentProviderRegistry,
152
157
  providerAsExecutor,
153
158
  providerAsSandboxClient,
154
159
  resolveAgentEnvironmentProvider,
155
160
  sandboxClientAsProvider
156
- } from "./chunk-BZF3KQ6G.js";
161
+ } from "./chunk-VSWBYWFK.js";
162
+ import "./chunk-3MDZX7YU.js";
157
163
  import {
158
164
  createSandboxToolPartState,
159
165
  extractLlmCallEvent,
package/dist/mcp/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  readTraceContextFromEnv
4
- } from "../chunk-7ON74BQO.js";
4
+ } from "../chunk-GDAQUFG6.js";
5
5
  import {
6
6
  resolveRouterBaseUrl
7
7
  } from "../chunk-NURIQBJQ.js";
@@ -9,10 +9,12 @@ import {
9
9
  DelegationTaskQueue,
10
10
  FileDelegationStore,
11
11
  createMcpServer
12
- } from "../chunk-RYBVU4M3.js";
12
+ } from "../chunk-6O5USWVH.js";
13
13
  import "../chunk-DPEUKJRO.js";
14
- import "../chunk-IVGYLCFH.js";
15
- import "../chunk-BZF3KQ6G.js";
14
+ import "../chunk-APVPRF4Y.js";
15
+ import "../chunk-3D2RHC4K.js";
16
+ import "../chunk-VSWBYWFK.js";
17
+ import "../chunk-3MDZX7YU.js";
16
18
  import "../chunk-FVJ7M3DA.js";
17
19
  import "../chunk-CMYMTRGA.js";
18
20
  import "../chunk-YEJR7IXO.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC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KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACD,UAAQ,OAAO,MAAM,sDAAiD,SAAS;AAAA,CAAI;AACnF,SAAO;AACT;AAEA,SAAS,eAAe,KAA6C;AACnE,MAAI,QAAQ,UAAa,IAAI,KAAK,MAAM,GAAI,QAAO;AACnD,QAAM,IAAI,OAAO,GAAG;AACpB,MAAI,CAAC,OAAO,UAAU,CAAC,KAAK,IAAI,GAAG;AACjC,YAAQ,OAAO;AAAA,MACb,gGAAgG,GAAG;AAAA;AAAA,IACrG;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,kBAAkB,QAAoD;AAKnF,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,MACL,MAAM,SAAS;AACb,cAAM,IAAI;AAAA,UACR;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAIA,QAAM,MAAM,MAAM,OAAO,yBAAyB,EAAE,MAAM,CAAC,QAAQ;AACjE,YAAQ,OAAO;AAAA,MACb,8DAA8D,IAAI,OAAO;AAAA;AAAA,IAC3E;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACD,QAAM,cAAe,IAA6D;AAClF,MAAI,CAAC,aAAa;AAChB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,QAAM,UAAU,QAAQ,IAAI,kBAAkB,KAAK,KAAK;AACxD,SAAO,IAAI,YAAY,EAAE,QAAQ,QAAQ,CAAC;AAC5C;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../src/mcp/delegate-supervisor-provisioning.ts","../../src/mcp/bin.ts"],"sourcesContent":["/**\n *\n * Resolve the `delegate` supervisor substrate (router brain + worker backend) from env, so the\n * `agent-runtime-mcp` bin can serve the ONE generic `delegate` verb by env, over the SAME stdio\n * invocation a consumer already mounts.\n *\n * `delegate` is wired into `createMcpServer` via `McpServerOptions.delegateSupervisor`, which needs a\n * router (the supervisor brain's substrate) and a backend (WHERE the authored workers run). Inside a\n * sandbox child the natural backend is `sandbox`: authored workers run as sub-sandboxes through the\n * SAME `SandboxClient` the bin already loads from `TANGLE_API_KEY`. The brain's router reuses the\n * repo's `resolveRouterBaseUrl` convention\n * (`TANGLE_ROUTER_URL` / `TANGLE_ROUTER_BASE_URL`), normalised to an OpenAI-compatible `/v1` endpoint,\n * keyed by `TANGLE_API_KEY`.\n *\n * @experimental\n */\n\nimport type { BackendType } from '@tangle-network/sandbox'\nimport { type RouterEnv, resolveRouterBaseUrl } from '../model-resolution.js'\nimport type { SandboxClient } from '../runtime'\nimport type { RouterConfig } from '../runtime/router-client'\nimport type { ExecutorConfig } from '../runtime/supervise/runtime'\nimport type { DelegateHandlerOptions } from './tools/delegate'\n\nconst DEFAULT_SUPERVISOR_MODEL = 'moonshotai/kimi-k2.6'\nconst DEFAULT_WORKER_HARNESS = 'opencode'\n\nfunction trimmed(value: string | undefined): string | undefined {\n const v = value?.trim()\n return v ? v : undefined\n}\n\n/** True when the operator opted the generic `delegate` verb in (`MCP_ENABLE_DELEGATE=1`). Default off:\n * the wiring is additive, so consumers that do not enable it are unaffected. */\nexport function delegateEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n return env.MCP_ENABLE_DELEGATE === '1'\n}\n\n/** Resolve the supervisor brain's router substrate from env. The key falls back through the platform\n * key the bin already requires; the base reuses `resolveRouterBaseUrl`, normalised to `/v1`. */\nfunction resolveRouter(env: NodeJS.ProcessEnv): RouterConfig {\n const routerKey = trimmed(env.MCP_SUPERVISOR_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY) ?? ''\n const base = trimmed(env.MCP_SUPERVISOR_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env as RouterEnv)\n const routerBaseUrl = /\\/v\\d+\\/?$/.test(base)\n ? base.replace(/\\/$/, '')\n : `${base.replace(/\\/$/, '')}/v1`\n const model =\n trimmed(env.MCP_SUPERVISOR_MODEL) ??\n trimmed(env.MCP_WORKER_MODEL) ??\n trimmed(env.WORKER_MODEL) ??\n DEFAULT_SUPERVISOR_MODEL\n return { routerBaseUrl, routerKey, model }\n}\n\n/**\n * Build the `delegateSupervisor` substrate for `createMcpServer` from env + the bin's loaded\n * `SandboxClient`. Returns `undefined` when `delegate` is not opted in, so the caller mounts it only\n * when asked. The worker backend is `sandbox` (authored workers run as sub-sandboxes via the same\n * client) on the harness named by `MCP_DELEGATE_WORKER_HARNESS` (default `opencode`).\n */\nexport function resolveDelegateSupervisor(\n sandboxClient: SandboxClient,\n env: NodeJS.ProcessEnv = process.env,\n): DelegateHandlerOptions | undefined {\n if (!delegateEnabled(env)) return undefined\n const router = resolveRouter(env)\n const harness = (trimmed(env.MCP_DELEGATE_WORKER_HARNESS) ??\n DEFAULT_WORKER_HARNESS) as BackendType\n const backend: ExecutorConfig = {\n backend: 'sandbox',\n harness,\n sandboxClient,\n }\n return {\n router,\n backend,\n model: router.model,\n }\n}\n","#!/usr/bin/env node\n\n/**\n *\n * `agent-runtime-mcp` — stdio MCP server entry point.\n *\n * Serves the ONE generic `delegate` verb (opt-in via `MCP_ENABLE_DELEGATE=1`): one intent → a\n * supervisor that authors + drives its own worker over `supervise()`, returning the delivered output\n * with its cost. The supervisor brain runs on the router; authored workers run as sub-sandboxes\n * through the same `SandboxClient` the bin loads from `TANGLE_API_KEY`. The queue-bound tools\n * (`delegate_feedback`, `delegation_status`, `delegation_history`) are always served.\n *\n * Environment variables:\n * TANGLE_API_KEY required — passed to `new Sandbox({ apiKey })`\n * SANDBOX_BASE_URL optional — sandbox-SDK base URL override\n * MCP_ENABLE_DELEGATE set to `1` to serve the generic `delegate` verb. Its authoring\n * supervisor runs the brain on the router and spawns authored\n * workers as sub-sandboxes via the same client; needs TANGLE_API_KEY.\n * MCP_SUPERVISOR_MODEL supervisor brain model id (falls back to MCP_WORKER_MODEL, then\n * WORKER_MODEL, then a default). Must be a tool-calling model.\n * MCP_SUPERVISOR_ROUTER_KEY router key for the supervisor brain (defaults to TANGLE_API_KEY)\n * MCP_SUPERVISOR_ROUTER_BASE_URL router base for the supervisor brain (defaults to the repo's\n * resolveRouterBaseUrl, normalized to `/v1`)\n * MCP_DELEGATE_WORKER_HARNESS harness the authored workers run on (default `opencode`)\n * AGENT_RUNTIME_DELEGATION_STATE_FILE\n * optional — absolute path of a JSON state\n * file. When set, delegation records persist\n * across MCP restarts (FileDelegationStore):\n * status/history survive and idempotency keys\n * dedupe across processes.\n * AGENT_RUNTIME_DELEGATION_STATE_RECOVER\n * set to `1` to archive a corrupt state file\n * (`<file>.corrupt-<ts>`) and start empty\n * instead of refusing to boot.\n * AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL\n * optional — positive integer cap on retained\n * terminal records. Unset = keep forever.\n *\n * @experimental\n */\n\nimport type { SandboxClient } from '../runtime'\nimport { delegateEnabled, resolveDelegateSupervisor } from './delegate-supervisor-provisioning'\nimport { FileDelegationStore } from './delegation-store'\nimport { createMcpServer } from './server'\nimport { DelegationTaskQueue } from './task-queue'\nimport { readTraceContextFromEnv, type TraceContext } from './trace-propagation'\n\nconst DEFAULT_SANDBOX_BASE_URL = 'https://sandbox.tangle.tools'\n\nasync function main(): Promise<void> {\n const wantDelegate = delegateEnabled(process.env)\n\n // The generic `delegate` verb needs the sandbox client: its authored workers run as sub-sandboxes\n // (the `sandbox` backend). When `delegate` is not opted in, the server runs the queue-only subset\n // (feedback + status + history) with no sandbox.\n let sandboxClient: SandboxClient | undefined\n if (wantDelegate) {\n const apiKey = process.env.TANGLE_API_KEY\n if (!apiKey && !process.env.AGENT_RUNTIME_MCP_ALLOW_NO_KEY) {\n process.stderr.write(\n 'agent-runtime-mcp: TANGLE_API_KEY is required to serve `delegate`. Set AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 to run without it for diagnostics, or unset MCP_ENABLE_DELEGATE to run the queue-only subset.\\n',\n )\n process.exit(2)\n }\n sandboxClient = await loadSandboxClient(apiKey)\n }\n\n // The supervisor's loop topology spans export to the OTLP / Tangle Intelligence sink when\n // OTEL_EXPORTER_OTLP_ENDPOINT is set (+ TRACE_ID / PARENT_SPAN_ID for correlation). The same\n // context is stamped onto every delegation record so journal consumers join records into the\n // caller's trace.\n const traceContext = readTraceContextFromEnv()\n if (process.env.OTEL_EXPORTER_OTLP_ENDPOINT) {\n process.stderr.write(\n `agent-runtime-mcp: exporting loop topology → ${process.env.OTEL_EXPORTER_OTLP_ENDPOINT}\\n`,\n )\n }\n\n // The ONE generic `delegate` verb — opt-in via MCP_ENABLE_DELEGATE=1. Its authoring supervisor\n // runs the brain on the router and spawns authored workers as sub-sandboxes through the SAME\n // client, so it needs the loaded `sandboxClient`. Gated on the client resolving (no key → no\n // delegate, fail-closed).\n const delegateSupervisor =\n wantDelegate && sandboxClient ? resolveDelegateSupervisor(sandboxClient) : undefined\n if (wantDelegate && delegateSupervisor) {\n process.stderr.write('agent-runtime-mcp: delegate enabled — generic authoring supervisor\\n')\n }\n\n const durableQueue = await buildDurableQueueFromEnv(traceContext)\n const server = createMcpServer({\n ...(delegateSupervisor ? { delegateSupervisor } : {}),\n traceContext,\n ...(durableQueue ? { queue: durableQueue } : {}),\n })\n\n const shutdown = () => {\n server.stop()\n // Drain journal writes so the state file reflects the final record\n // states before the process exits. A persist failure already routed\n // through onPersistError; swallow the duplicate rejection here.\n if (durableQueue) {\n void durableQueue\n .flush()\n .catch(() => {})\n .finally(() => process.exit(0))\n return\n }\n process.exit(0)\n }\n process.on('SIGINT', shutdown)\n process.on('SIGTERM', shutdown)\n\n await server.serve()\n}\n\nasync function buildDurableQueueFromEnv(\n traceContext: TraceContext,\n): Promise<DelegationTaskQueue | undefined> {\n const stateFile = process.env.AGENT_RUNTIME_DELEGATION_STATE_FILE?.trim()\n if (!stateFile) return undefined\n const store = new FileDelegationStore({\n filePath: stateFile,\n recoverCorrupt: process.env.AGENT_RUNTIME_DELEGATION_STATE_RECOVER === '1',\n })\n const maxTerminalRecords = parseRetention(process.env.AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL)\n const queue = await DelegationTaskQueue.restore({\n store,\n traceContext,\n ...(maxTerminalRecords !== undefined ? { maxTerminalRecords } : {}),\n onPersistError: (error) => {\n // Durable mode that can no longer write is a broken contract: crash\n // loud instead of degrading to memory-only behind the caller's back.\n process.stderr.write(`agent-runtime-mcp: ${error.message}\\n`)\n process.exit(1)\n },\n })\n process.stderr.write(`agent-runtime-mcp: durable delegation state → ${stateFile}\\n`)\n return queue\n}\n\nfunction parseRetention(raw: string | undefined): number | undefined {\n if (raw === undefined || raw.trim() === '') return undefined\n const n = Number(raw)\n if (!Number.isInteger(n) || n < 1) {\n process.stderr.write(\n `agent-runtime-mcp: AGENT_RUNTIME_DELEGATION_RETAIN_TERMINAL must be a positive integer, got \"${raw}\"\\n`,\n )\n process.exit(2)\n }\n return n\n}\n\nasync function loadSandboxClient(apiKey: string | undefined): Promise<SandboxClient> {\n // Diagnostic mode: AGENT_RUNTIME_MCP_ALLOW_NO_KEY=1 enables tools/list + the\n // queue-bound tools (status / history / feedback) without sandbox creds.\n // `delegate` requires a real client; the stub fails loud at create() so the\n // agent observes the cause instead of silent success.\n if (!apiKey) {\n return {\n async create() {\n throw new Error(\n 'agent-runtime-mcp: TANGLE_API_KEY is unset; `delegate` is disabled in diagnostic mode. Set TANGLE_API_KEY or unset MCP_ENABLE_DELEGATE to remove the unsupported tool from the tool list.',\n )\n },\n } satisfies SandboxClient\n }\n // Dynamic import keeps the bin importable in environments that haven't\n // installed `@tangle-network/sandbox` yet (the runtime package lists it\n // as a peer dep, not a hard dep).\n const mod = await import('@tangle-network/sandbox').catch((err) => {\n process.stderr.write(\n `agent-runtime-mcp: failed to load @tangle-network/sandbox (${err.message}); install the peer dependency\\n`,\n )\n process.exit(2)\n })\n const SandboxCtor = (mod as { Sandbox?: new (config: unknown) => SandboxClient }).Sandbox\n if (!SandboxCtor) {\n process.stderr.write(\n 'agent-runtime-mcp: @tangle-network/sandbox does not export Sandbox; cannot construct client\\n',\n )\n process.exit(2)\n }\n // @tangle-network/sandbox ≥0.6 makes baseUrl required; default it so the MCP server\n // starts without forcing every caller to set SANDBOX_BASE_URL. Treat empty/whitespace as\n // unset (|| not ??) so `SANDBOX_BASE_URL=` still resolves to the default.\n const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL\n return new SandboxCtor({ apiKey, baseUrl })\n}\n\nmain().catch((err) => {\n process.stderr.write(`agent-runtime-mcp: ${err instanceof Error ? err.stack : String(err)}\\n`)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAE/B,SAAS,QAAQ,OAA+C;AAC9D,QAAM,IAAI,OAAO,KAAK;AACtB,SAAO,IAAI,IAAI;AACjB;AAIO,SAAS,gBAAgB,MAAyB,QAAQ,KAAc;AAC7E,SAAO,IAAI,wBAAwB;AACrC;AAIA,SAAS,cAAc,KAAsC;AAC3D,QAAM,YAAY,QAAQ,IAAI,yBAAyB,KAAK,QAAQ,IAAI,cAAc,KAAK;AAC3F,QAAM,OAAO,QAAQ,IAAI,8BAA8B,KAAK,qBAAqB,GAAgB;AACjG,QAAM,gBAAgB,aAAa,KAAK,IAAI,IACxC,KAAK,QAAQ,OAAO,EAAE,IACtB,GAAG,KAAK,QAAQ,OAAO,EAAE,CAAC;AAC9B,QAAM,QACJ,QAAQ,IAAI,oBAAoB,KAChC,QAAQ,IAAI,gBAAgB,KAC5B,QAAQ,IAAI,YAAY,KACxB;AACF,SAAO,EAAE,eAAe,WAAW,MAAM;AAC3C;AAQO,SAAS,0BACd,eACA,MAAyB,QAAQ,KACG;AACpC,MAAI,CAAC,gBAAgB,GAAG,EAAG,QAAO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,MACb,8DAA8D,IAAI,OAAO;AAAA;AAAA,IAC3E;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACD,QAAM,cAAe,IAA6D;AAClF,MAAI,CAAC,aAAa;AAChB,YAAQ,OAAO;AAAA,MACb;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAIA,QAAM,UAAU,QAAQ,IAAI,kBAAkB,KAAK,KAAK;AACxD,SAAO,IAAI,YAAY,EAAE,QAAQ,QAAQ,CAAC;AAC5C;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,OAAO,MAAM,sBAAsB,eAAe,QAAQ,IAAI,QAAQ,OAAO,GAAG,CAAC;AAAA,CAAI;AAC7F,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
@@ -1,18 +1,18 @@
1
- import { S as SandboxClient, e as LoopSandboxPlacement } from '../types-SyuwunY_.js';
2
- import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-rRj5hjJK.js';
3
- export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-rRj5hjJK.js';
1
+ import { S as SandboxClient, f as LoopSandboxPlacement } from '../types-B00NtbCs.js';
2
+ import { F as FleetHandle, D as DelegationExecutor, a as DelegationTaskQueue, b as FeedbackStore, c as DelegateFeedbackResult, d as DelegateFeedbackArgs, U as UiAuditorDelegate, e as DelegateUiAuditArgs, f as DelegateUiAuditResult, g as DelegationHistoryResult, h as DelegationHistoryArgs, i as DelegationStatusResult, j as DelegationStatusArgs } from '../coordination-DxJ83oZA.js';
3
+ export { A as AnalystRegistry, C as CappedDelegationTrace, k as CoderDelegate, l as CoderReview, m as CoderReviewer, n as CoordinationEvent, o as CoordinationTools, p as CoordinationToolsOptions, q as DELEGATE_DESCRIPTION, r as DELEGATE_INPUT_SCHEMA, s as DELEGATE_TOOL_NAME, t as DELEGATION_TRACE_MAX_BYTES, u as DELEGATION_TRACE_MAX_SPANS, v as DelegateArgs, w as DelegateCodeArgs, x as DelegateCodeConfig, y as DelegateCodeResult, z as DelegateHandlerOptions, B as DelegateResearchArgs, G as DelegateResearchConfig, H as DelegateResearchResult, I as DelegateResult, J as DelegateRunCtx, K as DelegateUiAuditConfig, L as DelegateUiAuditRoute, N as DelegationError, O as DelegationFeedbackSnapshot, P as DelegationHistoryEntry, Q as DelegationPersistenceError, R as DelegationProfile, S as DelegationProgress, T as DelegationRecord, V as DelegationResultPayload, W as DelegationResumeContext, X as DelegationResumeDriver, Y as DelegationResumeTick, Z as DelegationRunContext, _ as DelegationStateCorruptError, $ as DelegationStatus, a0 as DelegationStore, a1 as DelegationTaskQueueOptions, a2 as DelegationTraceCaps, a3 as DelegationTraceCollector, a4 as DelegationTraceSpan, a5 as DetachedSessionDelegateOptions, a6 as DetachedSessionRefParts, a7 as DetachedTurn, a8 as DetachedTurnResumeDriverOptions, a9 as DetachedWinnerSelection, aa as DriveTurnCapableBox, ab as DriveTurnTick, ac as FeedbackEvent, ad as FeedbackRating, ae as FeedbackRefersTo, af as FileDelegationStore, ag as FileDelegationStoreOptions, ah as FleetWorkspaceExecutorOptions, ai as InMemoryDelegationStore, aj as InMemoryFeedbackStore, ak as JsonRpcMessage, al as JsonRpcResponse, M as MakeWorkerAgent, am as McpServer, an as McpServerOptions, ao as McpToolDescriptor, ap as McpTransport, aq as Question, ar as QuestionDecision, as as QuestionPolicy, at as QuestionRecord, au as ResearchOutputShape, av as ResearchSource, aw as RunDetachedTurnOptions, ax as SettleDetachedCoderTurnOptions, ay as SettledWorker, az as SiblingSandboxExecutorOptions, aA as SubmitInput, aB as SubmitOutput, aC as TraceContext, aD as UiAuditorDelegationOutput, aE as buildDelegationTraceSpans, aF as capDelegationTrace, aG as coderTaskFromArgs, aH as composeLoopTraceEmitters, aI as createCoordinationTools, aJ as createDelegateHandler, aK as createDelegationTraceCollector, aL as createDetachedTurnResumeDriver, aM as createFleetWorkspaceExecutor, aN as createInProcessTransport, aO as createMcpServer, aP as createPropagatingTraceEmitter, aQ as createSiblingSandboxExecutor, aR as detachedSessionDelegate, aS as detachedTurnEvents, aT as eventToSnapshot, aU as formatDetachedSessionRef, aV as hashIdempotencyInput, aW as parseDetachedSessionRef, aX as readTraceContextFromEnv, aY as runDetachedTurn, aZ as settleDetachedCoderTurn, a_ as traceContextToEnv, a$ as validateDelegateArgs } from '../coordination-DxJ83oZA.js';
4
4
  import { L as LocalHarness, r as runLocalHarness } from '../local-harness-dcD5WTTr.js';
5
5
  export { a as LocalHarnessResult, R as RunLocalHarnessOptions } from '../local-harness-dcD5WTTr.js';
6
- import { G as GitRunner } from '../completion-gate-DkAnUmpb.js';
7
- export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-DkAnUmpb.js';
6
+ import { G as GitRunner } from '../completion-gate-BLaiN0-X.js';
7
+ export { C as CreateWorktreeOptions, b as DiffOptions, c as DiffResult, R as RemoveWorktreeOptions, d as WorktreeHandle, e as captureWorktreeDiff, f as createWorktree, r as removeWorktree } from '../completion-gate-BLaiN0-X.js';
8
8
  export { C as CreateKbGateOptions, F as FactCandidate, a as FactJudge, b as FactJudgeVerdict, K as KbGateResult, c as createKbGate } from '../kb-gate-CwHO0vz6.js';
9
- export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-C4ZfUD4L.js';
9
+ export { m as mcpToolsForRuntimeMcp, a as mcpToolsForRuntimeMcpSubset } from '../openai-tools-E3woykz9.js';
10
10
  import { AnalystFinding } from '@tangle-network/agent-eval';
11
11
  import { U as UiLens } from '../substrate-DO2GHNg2.js';
12
12
  import '@tangle-network/sandbox';
13
- import '../types-eMNgWgFi.js';
13
+ import '../types-DAdIm4AC.js';
14
14
  import '@tangle-network/agent-interface';
15
- import '../router-client-DJImUDlm.js';
15
+ import '../sanitize-C9go6tXj.js';
16
16
  import '../environment-provider.js';
17
17
  import '@tangle-network/agent-interface/environment-provider';
18
18
  import 'node:child_process';
package/dist/mcp/index.js CHANGED
@@ -5,11 +5,11 @@ import {
5
5
  createPropagatingTraceEmitter,
6
6
  readTraceContextFromEnv,
7
7
  traceContextToEnv
8
- } from "../chunk-7ON74BQO.js";
8
+ } from "../chunk-GDAQUFG6.js";
9
9
  import {
10
10
  mcpToolsForRuntimeMcp,
11
11
  mcpToolsForRuntimeMcpSubset
12
- } from "../chunk-QK4DV5PR.js";
12
+ } from "../chunk-AUEIDTR3.js";
13
13
  import {
14
14
  createKbGate
15
15
  } from "../chunk-SGKPNBXE.js";
@@ -17,7 +17,8 @@ import {
17
17
  assertTraceDerivedFindings,
18
18
  runCoderChecks,
19
19
  selectValidWinner
20
- } from "../chunk-ZV4LXYCJ.js";
20
+ } from "../chunk-I7WVPJBZ.js";
21
+ import "../chunk-3BE7KTMU.js";
21
22
  import {
22
23
  DELEGATE_DESCRIPTION,
23
24
  DELEGATE_FEEDBACK_DESCRIPTION,
@@ -67,15 +68,17 @@ import {
67
68
  validateDelegateUiAuditArgs,
68
69
  validateDelegationHistoryArgs,
69
70
  validateDelegationStatusArgs
70
- } from "../chunk-RYBVU4M3.js";
71
+ } from "../chunk-6O5USWVH.js";
71
72
  import "../chunk-DPEUKJRO.js";
72
- import "../chunk-IVGYLCFH.js";
73
+ import "../chunk-APVPRF4Y.js";
74
+ import "../chunk-3D2RHC4K.js";
75
+ import "../chunk-VSWBYWFK.js";
73
76
  import {
74
77
  deleteBoxSafe,
75
78
  sleep,
76
79
  throwAbort,
77
80
  throwIfAborted
78
- } from "../chunk-BZF3KQ6G.js";
81
+ } from "../chunk-3MDZX7YU.js";
79
82
  import "../chunk-FVJ7M3DA.js";
80
83
  import {
81
84
  runLocalHarness