@tangle-network/agent-runtime 0.53.0 → 0.54.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 (71) hide show
  1. package/README.md +27 -16
  2. package/dist/agent.d.ts +1 -1
  3. package/dist/agent.js +5 -3
  4. package/dist/agent.js.map +1 -1
  5. package/dist/analyst-loop.d.ts +1 -1
  6. package/dist/analyst-loop.js +2 -2
  7. package/dist/{chunk-K5M3SHEU.js → chunk-2BDXWZUC.js} +5 -34
  8. package/dist/chunk-2BDXWZUC.js.map +1 -0
  9. package/dist/chunk-A73RADPB.js +281 -0
  10. package/dist/chunk-A73RADPB.js.map +1 -0
  11. package/dist/chunk-FRBWCJLP.js +396 -0
  12. package/dist/chunk-FRBWCJLP.js.map +1 -0
  13. package/dist/chunk-GRAGM4MC.js +72 -0
  14. package/dist/chunk-GRAGM4MC.js.map +1 -0
  15. package/dist/{chunk-K6WP7PYW.js → chunk-JTH2FPCK.js} +3231 -424
  16. package/dist/chunk-JTH2FPCK.js.map +1 -0
  17. package/dist/{chunk-P4QNEXFC.js → chunk-KJH62YEK.js} +2 -2
  18. package/dist/{chunk-HNUXAZIJ.js → chunk-P5OKDSLB.js} +2 -2
  19. package/dist/{chunk-GSUO5QS6.js → chunk-VLF5RHEQ.js} +2 -5
  20. package/dist/{chunk-GSUO5QS6.js.map → chunk-VLF5RHEQ.js.map} +1 -1
  21. package/dist/{chunk-JFIYKDXF.js → chunk-XRYEZPR6.js} +2 -1
  22. package/dist/chunk-XRYEZPR6.js.map +1 -0
  23. package/dist/{coder-LKm3Mczw.d.ts → coder-CEkUFv8h.d.ts} +1 -1
  24. package/dist/{types-CNDJCL_0.d.ts → coordination-BMzskrUR.d.ts} +268 -2
  25. package/dist/{kb-gate-CKfykcYQ.d.ts → delegates-BPLIl8EC.d.ts} +491 -566
  26. package/dist/index.d.ts +7 -7
  27. package/dist/index.js +23 -80
  28. package/dist/index.js.map +1 -1
  29. package/dist/intelligence.d.ts +2 -2
  30. package/dist/kb-gate-CuzMYGYM.d.ts +76 -0
  31. package/dist/{loop-runner-bin-D4Ir7b00.d.ts → loop-runner-bin-BGpVVyXp.d.ts} +6 -27
  32. package/dist/loop-runner-bin.d.ts +5 -5
  33. package/dist/loop-runner-bin.js +6 -5
  34. package/dist/loops.d.ts +8 -6
  35. package/dist/loops.js +32 -8
  36. package/dist/mcp/bin.js +94 -30
  37. package/dist/mcp/bin.js.map +1 -1
  38. package/dist/mcp/index.d.ts +9 -272
  39. package/dist/mcp/index.js +45 -365
  40. package/dist/mcp/index.js.map +1 -1
  41. package/dist/{openai-tools-CKfR3EMh.d.ts → openai-tools-CoeLQ7Uo.d.ts} +1 -1
  42. package/dist/profiles.d.ts +2 -2
  43. package/dist/profiles.js +4 -4
  44. package/dist/{router-client-B0Qi1NiN.d.ts → router-client-30Y_pca8.d.ts} +1 -1
  45. package/dist/{run-loop-DgVhucoR.d.ts → run-loop-DluzfJ2h.d.ts} +1 -1
  46. package/dist/runtime.d.ts +424 -23
  47. package/dist/runtime.js +32 -8
  48. package/dist/topology.d.ts +54 -1
  49. package/dist/topology.js +222 -0
  50. package/dist/topology.js.map +1 -1
  51. package/dist/{types-CklkW4Eh.d.ts → types-C8rNlxfV.d.ts} +4 -4
  52. package/dist/workflow.d.ts +2 -2
  53. package/dist/workflow.js +4 -2
  54. package/dist/workflow.js.map +1 -1
  55. package/package.json +5 -5
  56. package/skills/agent-runtime-adoption/SKILL.md +54 -46
  57. package/skills/build-with-agent-runtime/SKILL.md +12 -8
  58. package/skills/loop-writer/SKILL.md +9 -1
  59. package/skills/supervise/SKILL.md +24 -0
  60. package/dist/chunk-5M2WDWBI.js +0 -908
  61. package/dist/chunk-5M2WDWBI.js.map +0 -1
  62. package/dist/chunk-AYRQZRDV.js +0 -623
  63. package/dist/chunk-AYRQZRDV.js.map +0 -1
  64. package/dist/chunk-FO4DCM7R.js +0 -1356
  65. package/dist/chunk-FO4DCM7R.js.map +0 -1
  66. package/dist/chunk-JFIYKDXF.js.map +0 -1
  67. package/dist/chunk-K5M3SHEU.js.map +0 -1
  68. package/dist/chunk-K6WP7PYW.js.map +0 -1
  69. package/dist/driver-B2RKkVJW.d.ts +0 -221
  70. /package/dist/{chunk-P4QNEXFC.js.map → chunk-KJH62YEK.js.map} +0 -0
  71. /package/dist/{chunk-HNUXAZIJ.js.map → chunk-P5OKDSLB.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- import { e as LoopTraceEvent } from './types-CklkW4Eh.js';
1
+ import { e as LoopTraceEvent } from './types-C8rNlxfV.js';
2
2
  import { AgentProfileMcpServer } from '@tangle-network/sandbox';
3
- import { T as ToolSpec } from './router-client-B0Qi1NiN.js';
3
+ import { T as ToolSpec } from './router-client-30Y_pca8.js';
4
4
  import '@tangle-network/agent-eval';
5
5
  import './runtime-hooks-C7JwKb9E.js';
6
6
 
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @experimental
3
+ *
4
+ * `createKbGate` — the valid-only knowledge-base growth gate, distilled from
5
+ * physim's KB-research subsystem. A research-in-a-loop delegate (or any KB
6
+ * writer) runs candidate facts through this before persisting, so the KB grows
7
+ * with ONLY grounded facts — hallucinated, unsourced, or laundered claims are
8
+ * vetoed at the gate.
9
+ *
10
+ * Fail-closed by construction: every judge must `accept`; the FIRST veto wins
11
+ * and the fact is rejected. The non-negotiable floor (always on, can't be
12
+ * disabled) is the **passage-present guard** — a fact's `verbatimPassage` MUST
13
+ * literally appear in its `sourceText`. That single check kills the dominant
14
+ * failure mode (a confident claim decoupled from any real source).
15
+ *
16
+ * Pure + dependency-free: it operates on fact candidates, not on a store, so it
17
+ * composes with `@tangle-network/agent-knowledge` or any persistence layer
18
+ * without importing it. The remediation policy (correct-on-veto vs
19
+ * escalate-as-unverified) is the caller's — this returns the verdict; it never
20
+ * drops a fact silently.
21
+ */
22
+ /** @experimental A fact proposed for the KB, with its grounding. */
23
+ interface FactCandidate {
24
+ /** The atomic claim text. */
25
+ claim: string;
26
+ /** Optional extracted value (number or string) the claim asserts. */
27
+ value?: string | number;
28
+ /** Verbatim span lifted from the source that backs the claim. */
29
+ verbatimPassage: string;
30
+ /** The raw source text the passage must be grounded in. */
31
+ sourceText: string;
32
+ /** Where the fact claims to come from — checked for circular/self citations. */
33
+ citation?: string;
34
+ }
35
+ /** @experimental */
36
+ interface FactJudgeVerdict {
37
+ accept: boolean;
38
+ reason?: string;
39
+ }
40
+ /** @experimental A pluggable fact validator. Throw is NOT allowed — return a
41
+ * verdict; a thrown judge is a programmer error, not a veto. */
42
+ interface FactJudge {
43
+ name: string;
44
+ judge(candidate: FactCandidate): FactJudgeVerdict | Promise<FactJudgeVerdict>;
45
+ }
46
+ /** @experimental */
47
+ interface KbGateResult {
48
+ accepted: boolean;
49
+ /** Name of the judge that vetoed; undefined when accepted. */
50
+ vetoedBy?: string;
51
+ reason?: string;
52
+ }
53
+ /** @experimental */
54
+ interface CreateKbGateOptions {
55
+ /** Extra judges appended after the built-in floor (e.g. an LLM judge). */
56
+ judges?: FactJudge[];
57
+ /** Minimum verbatim-passage length. Default 12 — kills empty/stub passages. */
58
+ minPassageChars?: number;
59
+ /**
60
+ * Citation tokens that denote a SELF-generated artifact (e.g. `'spec'`,
61
+ * `'cad_params'`, `'requirements'`). A citation naming one is circular
62
+ * (laundering) — the fact cites a derived artifact, not a real source.
63
+ * Default `[]` (no circular check unless the consumer declares its kinds).
64
+ */
65
+ selfArtifactKinds?: string[];
66
+ }
67
+ /**
68
+ * @experimental
69
+ *
70
+ * Build a fail-closed KB gate. The returned function runs the built-in floor
71
+ * (passage-non-empty → passage-present → value-in-passage → no-circular-citation)
72
+ * then any consumer judges, returning on the first veto.
73
+ */
74
+ declare function createKbGate(options?: CreateKbGateOptions): (candidate: FactCandidate) => Promise<KbGateResult>;
75
+
76
+ export { type CreateKbGateOptions as C, type FactCandidate as F, type KbGateResult as K, type FactJudge as a, type FactJudgeVerdict as b, createKbGate as c };
@@ -1,10 +1,10 @@
1
1
  import { Scenario } from '@tangle-network/agent-eval/campaign';
2
2
  import { SelfImproveOptions, SelfImproveResult } from '@tangle-network/agent-eval/contract';
3
3
  import { R as RunAnalystLoopOpts, a as RunAnalystLoopResult } from './types-p8dWBIXL.js';
4
- import { D as DelegateCodeArgs, C as CoderReviewer, a as CoderWinnerSelection, F as FactCandidate, b as CreateKbGateOptions } from './kb-gate-CKfykcYQ.js';
5
- import { C as CoderOutput } from './coder-LKm3Mczw.js';
6
- import { S as SandboxClient, O as OutputAdapter, V as Validator, A as AgentRunSpec, b as LoopResult } from './types-CklkW4Eh.js';
7
- import { T as TopologyPlanner, C as CreateDriverOptions, D as DriverDecision } from './driver-B2RKkVJW.js';
4
+ import { D as DelegateCodeArgs, C as CoderReviewer, a as CoderWinnerSelection } from './delegates-BPLIl8EC.js';
5
+ import { F as FactCandidate, C as CreateKbGateOptions } from './kb-gate-CuzMYGYM.js';
6
+ import { C as CoderOutput } from './coder-CEkUFv8h.js';
7
+ import { S as SandboxClient } from './types-C8rNlxfV.js';
8
8
 
9
9
  /**
10
10
  * @experimental
@@ -20,7 +20,6 @@ import { T as TopologyPlanner, C as CreateDriverOptions, D as DriverDecision } f
20
20
  * research → research-in-a-loop with valid-only KB growth (createKbGate)
21
21
  * audit → analyze trace/run data → findings (runAnalystLoop, caller-wired)
22
22
  * self-improve → closed-loop text/config optimization (selfImprove, held-out gated)
23
- * dynamic → agent-authored topology (runLoop + createDriver)
24
23
  *
25
24
  * It is intentionally a thin façade: the value is that EVERY product reuses the
26
25
  * one hardened engine instead of forking delegation logic. The dispatcher owns
@@ -30,7 +29,7 @@ import { T as TopologyPlanner, C as CreateDriverOptions, D as DriverDecision } f
30
29
  */
31
30
 
32
31
  /** @experimental Every delegated-loop mode, for validation + CLI surfaces. */
33
- declare const DELEGATED_LOOP_MODES: readonly ["code", "review", "research", "audit", "self-improve", "dynamic"];
32
+ declare const DELEGATED_LOOP_MODES: readonly ["code", "review", "research", "audit", "self-improve"];
34
33
  /** @experimental */
35
34
  type DelegatedLoopMode = (typeof DELEGATED_LOOP_MODES)[number];
36
35
  /** @experimental Type guard for an untrusted mode string (CLI / config input). */
@@ -88,26 +87,6 @@ declare function coderLoopRunner(options: CoderLoopRunnerOptions): DelegatedLoop
88
87
  declare function reviewLoopRunner(options: CoderLoopRunnerOptions & {
89
88
  reviewer: CoderReviewer;
90
89
  }): DelegatedLoopRunner<CoderOutput>;
91
- /** @experimental Options for the default `dynamic` runner. */
92
- interface DynamicLoopRunnerOptions<Task, Output> {
93
- sandboxClient: SandboxClient;
94
- /** The agent-authored topology planner (sync or async; an async planner is where an LLM call goes). */
95
- planner: TopologyPlanner<Task, Output>;
96
- task: Task;
97
- output: OutputAdapter<Output>;
98
- validator?: Validator<Output>;
99
- /** Exactly one of `agentRun` / `agentRuns` (runLoop validates). */
100
- agentRun?: AgentRunSpec<Task>;
101
- agentRuns?: AgentRunSpec<Task>[];
102
- maxIterations?: number;
103
- maxFanout?: number;
104
- /** Optional trace-analyst hook forwarded to the dynamic driver so the loop runs
105
- * `f(trace, findings)` — see `CreateDriverOptions.analyze`. Caller-side
106
- * seam to `runAnalystLoop`; keeps this runner analyst-free. */
107
- analyze?: CreateDriverOptions<Task, Output>['analyze'];
108
- }
109
- /** @experimental `dynamic` mode — agent-authored topology over `runLoop`. */
110
- declare function dynamicLoopRunner<Task, Output>(o: DynamicLoopRunnerOptions<Task, Output>): DelegatedLoopRunner<LoopResult<Task, Output, DriverDecision>>;
111
90
  /** @experimental A fact rejected at the KB gate — surfaced, never dropped. */
112
91
  interface VetoedFact {
113
92
  candidate: FactCandidate;
@@ -193,4 +172,4 @@ declare function parseLoopRunnerArgv(argv: string[]): {
193
172
  config?: string;
194
173
  };
195
174
 
196
- export { type CoderLoopRunnerOptions as C, DELEGATED_LOOP_MODES as D, type LoopRunnerCliArgs as L, type ResearchLoopResult as R, type VetoedFact as V, type DelegatedLoopMode as a, type DelegatedLoopRegistry as b, type DelegatedLoopResult as c, type DelegatedLoopRunner as d, type DynamicLoopRunnerOptions as e, type LoopRunnerCliResult as f, type ResearchLoopRunnerOptions as g, type RunDelegatedLoopOptions as h, auditLoopRunner as i, coderLoopRunner as j, dynamicLoopRunner as k, isDelegatedLoopMode as l, reviewLoopRunner as m, runDelegatedLoop as n, runLoopRunnerCli as o, parseLoopRunnerArgv as p, researchLoopRunner as r, selfImproveLoopRunner as s };
175
+ export { type CoderLoopRunnerOptions as C, DELEGATED_LOOP_MODES as D, type LoopRunnerCliArgs as L, type ResearchLoopResult as R, type VetoedFact as V, type DelegatedLoopMode as a, type DelegatedLoopRegistry as b, type DelegatedLoopResult as c, type DelegatedLoopRunner as d, type LoopRunnerCliResult as e, type ResearchLoopRunnerOptions as f, type RunDelegatedLoopOptions as g, auditLoopRunner as h, coderLoopRunner as i, isDelegatedLoopMode as j, reviewLoopRunner as k, runDelegatedLoop as l, runLoopRunnerCli as m, parseLoopRunnerArgv as p, researchLoopRunner as r, selfImproveLoopRunner as s };
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- export { L as LoopRunnerCliArgs, f as LoopRunnerCliResult, p as parseLoopRunnerArgv, o as runLoopRunnerCli } from './loop-runner-bin-D4Ir7b00.js';
2
+ export { L as LoopRunnerCliArgs, e as LoopRunnerCliResult, p as parseLoopRunnerArgv, m as runLoopRunnerCli } from './loop-runner-bin-BGpVVyXp.js';
3
3
  import '@tangle-network/agent-eval/campaign';
4
4
  import '@tangle-network/agent-eval/contract';
5
5
  import './types-p8dWBIXL.js';
6
6
  import '@tangle-network/agent-eval';
7
- import './kb-gate-CKfykcYQ.js';
8
- import './coder-LKm3Mczw.js';
7
+ import './delegates-BPLIl8EC.js';
8
+ import './coder-CEkUFv8h.js';
9
9
  import '@tangle-network/sandbox';
10
- import './types-CklkW4Eh.js';
10
+ import './types-C8rNlxfV.js';
11
11
  import './runtime-hooks-C7JwKb9E.js';
12
12
  import './substrate-CUgk7F7s.js';
13
- import './driver-B2RKkVJW.js';
13
+ import './kb-gate-CuzMYGYM.js';
@@ -2,14 +2,15 @@
2
2
  import {
3
3
  parseLoopRunnerArgv,
4
4
  runLoopRunnerCli
5
- } from "./chunk-K5M3SHEU.js";
5
+ } from "./chunk-2BDXWZUC.js";
6
6
  import "./chunk-FNMGYYSS.js";
7
- import "./chunk-AYRQZRDV.js";
7
+ import "./chunk-A73RADPB.js";
8
8
  import "./chunk-KADIJAD4.js";
9
- import "./chunk-HNUXAZIJ.js";
9
+ import "./chunk-P5OKDSLB.js";
10
+ import "./chunk-JTH2FPCK.js";
11
+ import "./chunk-WIR4HOOJ.js";
12
+ import "./chunk-VLF5RHEQ.js";
10
13
  import "./chunk-G3RGMA7C.js";
11
- import "./chunk-K6WP7PYW.js";
12
- import "./chunk-GSUO5QS6.js";
13
14
  import "./chunk-DGUM43GV.js";
14
15
  export {
15
16
  parseLoopRunnerArgv,
package/dist/loops.d.ts CHANGED
@@ -1,11 +1,13 @@
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, AuthoredStrategy, BenchmarkCell, BenchmarkConfig, BenchmarkLift, BenchmarkReport, BenchmarkStrategySummary, BenchmarkTaskRow, BridgeSeam, BudgetPool, BudgetReadout, ChampionPick, ChampionPolicy, CheckpointCapableBox, CliSeam, CombinatorShape, Corpus, CorpusFilter, CorpusRecord, CreateScopeAnalystOptions, CriuCapableClient, DefinePersona, DefinePersonaInput, Deliverable, Environment, EqualKArm, EqualKOnCost, EqualKOnCostOptions, EqualKVerdict, EvolutionArchiveNode, EvolutionAuthor, EvolutionBandInfo, EvolutionCandidate, EvolutionGeneration, EvolutionReport, ExecutorConfig, Fanout, FanoutOptions, FanoutSynthesis, FileCorpus, FileResultBlobStore, FileSpawnJournal, FlatWidenGate, ForkCapableBox, GitWorkspaceOptions, HarvestCorpusOptions, HarvestFailure, HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, IntentAudit, LoopDispatchOptions, LoopOptionsForDispatch, LoopShape, LoopUntil, LoopUntilSpec, LoopUntilState, McpEndpoint, McpEnvironmentOptions, 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, ShapeBudget, ShapeContext, ShapeRegistry, Shell, ShotPersona, ShotSpec, SteerContext, Strategy, StrategyCtx, StrategyEvolutionConfig, StrategyResult, SurfaceScore, TrajectoryNode, TrajectoryReport, TrajectoryReportFn, TrajectoryReportOptions, TurnResult, UsageSink, VerifierEnvironmentOptions, Verify, VerifySpec, WaterfallCollector, WaterfallReport, WaterfallSpan, Widen, WidenDecision, WidenLineage, WidenSpec, Workspace, WorkspaceCommit, acquireSandbox, adaptiveRefine, anytimeReport, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, breadthDriver, buildSteerContext, builtinShapes, contentAddress, createBudgetPool, createExecutor, createExecutorRegistry, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, defaultAnalystInstruction, defaultAuditorInstruction, definePersona, defineStrategy, depthDriver, discriminatingMeans, equalKOnCost, extractLlmCallEvent, fanout, flatWidenGate, gitWorkspace, harvestCorpus, inlineSandboxClient, jjWorkspace, localShell, loopDispatch, loopUntil, mapSandboxEvent, materializeTreeView, observe, openSandboxRun, panel, pickChampion, pipeline, printBenchmarkReport, probeSandboxCapabilities, promotionGate, refine, registerShape, registryScopeAnalyst, renderAnytimeTable, renderCorpusToInstructions, renderReport, replaySpawnTree, reportLoopUsage, runAgentic, runBenchmark, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, settledToIteration, spendFromUsageEvents, strategyAuthorContract, trajectoryReport, verify, widen } from './runtime.js';
3
- export { A as AnalyzeInput, a as CompletionAnalyst, b as CompletionEvidence, c as CompletionPolicy, d as CompletionVerdict, C as CreateDriverOptions, D as DriverDecision, P as PlannerContext, e as TopologyMove, T as TopologyPlanner, f as completionAuthorizes, g as createDriver, h as deterministicCompletion, r as renderAnalyses, s as sentinelCompletion, i as stopSentinel } from './driver-B2RKkVJW.js';
4
- export { R as RouterChatResult, a as RouterChatToolsResult, b as RouterConfig, c as RouterToolCall, d as RouterToolLoopResult, T as ToolSpec, r as routerChatWithTools, e as routerChatWithUsage, f as routerToolLoop } from './router-client-B0Qi1NiN.js';
5
- export { R as RunLoopOptions, c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-DgVhucoR.js';
6
- export { A as Agent, d as AgentSpec, B as Budget, j as Executor, k as ExecutorContext, h as ExecutorFactory, E as ExecutorRegistry, l as ExecutorResult, H as Handle, N as NodeId, m as NodeSnapshot, n as NodeStatus, o as Restart, R as ResultBlobStore, e as RootHandle, p as RootSignal, q as Runtime, S as Scope, c as Settled, b as SpawnEvent, a as SpawnJournal, r as SpawnOpts, g as Spend, f as SupervisedResult, i as Supervisor, s as SupervisorOpts, T as TreeView, U as UsageEvent, W as WidenGate } from './types-CNDJCL_0.js';
7
- 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, d as LoopTokenUsage, g as LoopTraceEmitter, e as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, S as SandboxClient, U as ValidationCtx, V as Validator } from './types-CklkW4Eh.js';
2
+ export { AgenticOptions, AgenticRunResult, AgenticSurface, AgenticTask, AgenticTool, AnytimeReport, AnytimeStrategySummary, AnytimeTaskCurve, ArtifactHandle, AssertTraceDerivedFindings, AuditIntentInput, AuditIntentOptions, AuthorStrategyOptions, AuthoredProfile, AuthoredStrategy, BenchmarkCell, BenchmarkConfig, BenchmarkLift, BenchmarkReport, BenchmarkStrategySummary, BenchmarkTaskRow, BridgeSeam, BudgetPool, BudgetReadout, ChampionPick, ChampionPolicy, CheckpointCapableBox, CliSeam, 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, FileCorpus, FileResultBlobStore, FileSpawnJournal, FlatWidenGate, ForkCapableBox, GitWorkspaceOptions, HarvestCorpusOptions, HarvestFailure, HarvestReport, InMemoryCorpus, InMemoryResultBlobStore, InMemorySpawnJournal, 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, ShapeBudget, ShapeContext, ShapeRegistry, Shell, ShotPersona, ShotSpec, SteerContext, Strategy, StrategyCtx, StrategyEvolutionConfig, StrategyResult, SurfaceScore, TrajectoryNode, TrajectoryReport, TrajectoryReportFn, TrajectoryReportOptions, TurnResult, UsageSink, VerifierEnvironmentOptions, Verify, VerifySpec, WaterfallCollector, WaterfallReport, WaterfallSpan, Widen, WidenDecision, WidenLineage, WidenSpec, Workspace, WorkspaceCommit, WorkspaceRun, acquireSandbox, adaptiveRefine, anytimeReport, asAuthoredProfile, assertStrategyContract, assertTraceDerivedFindings, auditIntent, authorStrategy, authoredWorker, breadthDriver, buildSteerContext, builtinShapes, completionAuthorizes, contentAddress, coordinationDriverAgent, createBudgetPool, createExecutor, createExecutorRegistry, createMcpEnvironment, createRootHandle, createSandboxLineage, createScope, createScopeAnalyst, createShapeRegistry, createSupervisor, createVerifierEnvironment, createWaterfallCollector, defaultAnalystInstruction, defaultAuditorInstruction, 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, runAgentic, runBenchmark, runInWorkspace, runPersonified, runStrategyEvolution, sample, sampleThenRefine, selectChampion, sentinelCompletion, serveCoordinationMcp, settledToIteration, spendFromUsageEvents, stopSentinel, strategyAuthorContract, supervisorSkill, trajectoryReport, verify, widen, withDriverExecutor } from './runtime.js';
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
+ export { R as RunLoopOptions, c as createSandboxForSpec, d as defaultSelectWinner, r as runLoop } from './run-loop-DluzfJ2h.js';
5
+ export { t as Agent, s as AgentSpec, B as Budget, z as Executor, G as ExecutorContext, y as ExecutorFactory, E as ExecutorRegistry, H as ExecutorResult, K as Handle, N as NodeId, L as NodeSnapshot, O as NodeStatus, P as Restart, R as ResultBlobStore, u as RootHandle, V as RootSignal, W as Runtime, x as Scope, r as Settled, q as SpawnEvent, p as SpawnJournal, X as SpawnOpts, w as Spend, v as SupervisedResult, D as Supervisor, Y as SupervisorOpts, T as TreeView, U as UsageEvent, Z as WidenGate } from './coordination-BMzskrUR.js';
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, d as LoopTokenUsage, g as LoopTraceEmitter, e as LoopTraceEvent, L as LoopWinner, O as OutputAdapter, S as SandboxClient, U as ValidationCtx, V as Validator } from './types-C8rNlxfV.js';
8
7
  export { DefaultVerdict } from '@tangle-network/agent-eval';
9
8
  import './runtime-hooks-C7JwKb9E.js';
10
9
  import '@tangle-network/agent-eval/campaign';
11
10
  import './types-p8dWBIXL.js';
11
+ import './delegates-BPLIl8EC.js';
12
+ import './coder-CEkUFv8h.js';
13
+ import './substrate-CUgk7F7s.js';
package/dist/loops.js CHANGED
@@ -8,17 +8,19 @@ import {
8
8
  acquireSandbox,
9
9
  adaptiveRefine,
10
10
  anytimeReport,
11
+ asAuthoredProfile,
11
12
  assertStrategyContract,
12
13
  assertTraceDerivedFindings,
13
14
  auditIntent,
14
15
  authorStrategy,
16
+ authoredWorker,
15
17
  breadthDriver,
16
18
  buildSteerContext,
17
19
  builtinShapes,
18
20
  completionAuthorizes,
19
21
  contentAddress,
22
+ coordinationDriverAgent,
20
23
  createBudgetPool,
21
- createDriver,
22
24
  createExecutor,
23
25
  createExecutorRegistry,
24
26
  createMcpEnvironment,
@@ -39,17 +41,23 @@ import {
39
41
  depthDriver,
40
42
  deterministicCompletion,
41
43
  discriminatingMeans,
44
+ driverChild,
45
+ driverExecutorFactory,
46
+ driverRuntime,
42
47
  equalKOnCost,
43
48
  fanout,
44
49
  flatWidenGate,
50
+ gateOnDeliverable,
45
51
  gitWorkspace,
46
52
  harvestCorpus,
47
53
  inlineSandboxClient,
54
+ isDriverSpec,
48
55
  jjWorkspace,
49
56
  localShell,
50
57
  loopDispatch,
51
58
  loopUntil,
52
59
  materializeTreeView,
60
+ nestedScopeSeamKey,
53
61
  observe,
54
62
  openSandboxRun,
55
63
  panel,
@@ -61,7 +69,6 @@ import {
61
69
  refine,
62
70
  registerShape,
63
71
  registryScopeAnalyst,
64
- renderAnalyses,
65
72
  renderAnytimeTable,
66
73
  renderCorpusToInstructions,
67
74
  renderReport,
@@ -72,6 +79,7 @@ import {
72
79
  routerToolLoop,
73
80
  runAgentic,
74
81
  runBenchmark,
82
+ runInWorkspace,
75
83
  runLoop,
76
84
  runPersonified,
77
85
  runStrategyEvolution,
@@ -79,18 +87,23 @@ import {
79
87
  sampleThenRefine,
80
88
  selectChampion,
81
89
  sentinelCompletion,
90
+ serveCoordinationMcp,
82
91
  settledToIteration,
83
92
  spendFromUsageEvents,
84
93
  stopSentinel,
85
94
  strategyAuthorContract,
95
+ supervisorSkill,
86
96
  trajectoryReport,
87
97
  verify,
88
- widen
89
- } from "./chunk-K6WP7PYW.js";
98
+ widen,
99
+ withDriverExecutor
100
+ } from "./chunk-JTH2FPCK.js";
101
+ import "./chunk-WIR4HOOJ.js";
90
102
  import {
91
103
  extractLlmCallEvent,
92
104
  mapSandboxEvent
93
- } from "./chunk-GSUO5QS6.js";
105
+ } from "./chunk-VLF5RHEQ.js";
106
+ import "./chunk-G3RGMA7C.js";
94
107
  import "./chunk-DGUM43GV.js";
95
108
  export {
96
109
  FileCorpus,
@@ -102,17 +115,19 @@ export {
102
115
  acquireSandbox,
103
116
  adaptiveRefine,
104
117
  anytimeReport,
118
+ asAuthoredProfile,
105
119
  assertStrategyContract,
106
120
  assertTraceDerivedFindings,
107
121
  auditIntent,
108
122
  authorStrategy,
123
+ authoredWorker,
109
124
  breadthDriver,
110
125
  buildSteerContext,
111
126
  builtinShapes,
112
127
  completionAuthorizes,
113
128
  contentAddress,
129
+ coordinationDriverAgent,
114
130
  createBudgetPool,
115
- createDriver,
116
131
  createExecutor,
117
132
  createExecutorRegistry,
118
133
  createMcpEnvironment,
@@ -133,19 +148,25 @@ export {
133
148
  depthDriver,
134
149
  deterministicCompletion,
135
150
  discriminatingMeans,
151
+ driverChild,
152
+ driverExecutorFactory,
153
+ driverRuntime,
136
154
  equalKOnCost,
137
155
  extractLlmCallEvent,
138
156
  fanout,
139
157
  flatWidenGate,
158
+ gateOnDeliverable,
140
159
  gitWorkspace,
141
160
  harvestCorpus,
142
161
  inlineSandboxClient,
162
+ isDriverSpec,
143
163
  jjWorkspace,
144
164
  localShell,
145
165
  loopDispatch,
146
166
  loopUntil,
147
167
  mapSandboxEvent,
148
168
  materializeTreeView,
169
+ nestedScopeSeamKey,
149
170
  observe,
150
171
  openSandboxRun,
151
172
  panel,
@@ -157,7 +178,6 @@ export {
157
178
  refine,
158
179
  registerShape,
159
180
  registryScopeAnalyst,
160
- renderAnalyses,
161
181
  renderAnytimeTable,
162
182
  renderCorpusToInstructions,
163
183
  renderReport,
@@ -168,6 +188,7 @@ export {
168
188
  routerToolLoop,
169
189
  runAgentic,
170
190
  runBenchmark,
191
+ runInWorkspace,
171
192
  runLoop,
172
193
  runPersonified,
173
194
  runStrategyEvolution,
@@ -175,12 +196,15 @@ export {
175
196
  sampleThenRefine,
176
197
  selectChampion,
177
198
  sentinelCompletion,
199
+ serveCoordinationMcp,
178
200
  settledToIteration,
179
201
  spendFromUsageEvents,
180
202
  stopSentinel,
181
203
  strategyAuthorContract,
204
+ supervisorSkill,
182
205
  trajectoryReport,
183
206
  verify,
184
- widen
207
+ widen,
208
+ withDriverExecutor
185
209
  };
186
210
  //# sourceMappingURL=loops.js.map
package/dist/mcp/bin.js CHANGED
@@ -1,37 +1,81 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- createMcpServer,
4
3
  createPropagatingTraceEmitter,
5
4
  detectExecutor,
6
5
  readTraceContextFromEnv
7
- } from "../chunk-5M2WDWBI.js";
8
- import "../chunk-WIR4HOOJ.js";
6
+ } from "../chunk-FRBWCJLP.js";
9
7
  import {
10
- DelegationTaskQueue,
11
- FileDelegationStore
12
- } from "../chunk-FO4DCM7R.js";
8
+ resolveRouterBaseUrl
9
+ } from "../chunk-GRAGM4MC.js";
13
10
  import {
14
11
  coderTaskFromArgs,
15
- composeLoopTraceEmitters,
16
12
  createDefaultCoderDelegate,
17
- createDriveTurnResumeDriver,
18
- detachedTurnEvents,
19
- formatDetachedSessionRef,
20
- parseDetachedSessionRef,
21
- runDetachedTurn,
22
13
  settleDetachedCoderTurn
23
- } from "../chunk-AYRQZRDV.js";
14
+ } from "../chunk-A73RADPB.js";
24
15
  import {
25
16
  coderProfile
26
17
  } from "../chunk-KADIJAD4.js";
27
18
  import "../chunk-GLR25NG7.js";
28
- import "../chunk-G3RGMA7C.js";
29
19
  import {
20
+ DEFAULT_SANDBOX_BASE_URL
21
+ } from "../chunk-XRYEZPR6.js";
22
+ import {
23
+ DelegationTaskQueue,
24
+ FileDelegationStore,
25
+ composeLoopTraceEmitters,
26
+ createDriveTurnResumeDriver,
27
+ createMcpServer,
28
+ detachedTurnEvents,
29
+ formatDetachedSessionRef,
30
+ parseDetachedSessionRef,
31
+ runDetachedTurn,
30
32
  runLoop
31
- } from "../chunk-K6WP7PYW.js";
32
- import "../chunk-GSUO5QS6.js";
33
+ } from "../chunk-JTH2FPCK.js";
34
+ import "../chunk-WIR4HOOJ.js";
35
+ import "../chunk-VLF5RHEQ.js";
36
+ import "../chunk-G3RGMA7C.js";
33
37
  import "../chunk-DGUM43GV.js";
34
38
 
39
+ // src/mcp/researcher-provisioning.ts
40
+ var DEFAULT_HARNESS = "opencode";
41
+ var DEFAULT_MODEL = "moonshotai/kimi-k2.6";
42
+ function trimmed(value) {
43
+ const t = value?.trim();
44
+ return t ? t : void 0;
45
+ }
46
+ function csv(value) {
47
+ const list = value?.split(",").map((v) => v.trim()).filter(Boolean);
48
+ return list && list.length > 0 ? list : void 0;
49
+ }
50
+ function resolveResearcherProvisioning(env = process.env) {
51
+ const harness = trimmed(env.MCP_RESEARCHER_HARNESS) ?? DEFAULT_HARNESS;
52
+ const model = trimmed(env.MCP_RESEARCHER_MODEL) ?? trimmed(env.MCP_WORKER_MODEL) ?? trimmed(env.WORKER_MODEL) ?? DEFAULT_MODEL;
53
+ const routerKey = trimmed(env.MCP_RESEARCHER_ROUTER_KEY) ?? trimmed(env.TANGLE_API_KEY);
54
+ const base = trimmed(env.MCP_RESEARCHER_ROUTER_BASE_URL) ?? resolveRouterBaseUrl(env);
55
+ const routerBaseUrl = /\/v\d+\/?$/.test(base) ? base.replace(/\/$/, "") : `${base.replace(/\/$/, "")}/v1`;
56
+ const fanoutHarnesses = csv(env.MCP_RESEARCHER_FANOUT_HARNESSES);
57
+ const fanoutModels = csv(env.MCP_RESEARCHER_FANOUT_MODELS);
58
+ return {
59
+ harness,
60
+ model,
61
+ ...routerKey ? { routerKey } : {},
62
+ routerBaseUrl,
63
+ ...fanoutHarnesses ? { fanoutHarnesses } : {},
64
+ ...fanoutModels ? { fanoutModels } : {}
65
+ };
66
+ }
67
+ function applyRouterEnv(spec, routerKey, routerBaseUrl) {
68
+ if (!routerKey) return;
69
+ spec.sandboxOverrides = {
70
+ ...spec.sandboxOverrides ?? {},
71
+ env: {
72
+ ...spec.sandboxOverrides?.env ?? {},
73
+ OPENAI_API_KEY: routerKey,
74
+ OPENAI_BASE_URL: routerBaseUrl
75
+ }
76
+ };
77
+ }
78
+
35
79
  // src/mcp/bin.ts
36
80
  async function main() {
37
81
  const fanoutHarnesses = parseHarnesses(process.env.MCP_CODER_FANOUT_HARNESSES);
@@ -221,11 +265,8 @@ async function loadSandboxClient(apiKey) {
221
265
  );
222
266
  process.exit(2);
223
267
  }
224
- const baseUrl = process.env.SANDBOX_BASE_URL;
225
- return new SandboxCtor({
226
- apiKey,
227
- ...baseUrl ? { baseUrl } : {}
228
- });
268
+ const baseUrl = process.env.SANDBOX_BASE_URL?.trim() || DEFAULT_SANDBOX_BASE_URL;
269
+ return new SandboxCtor({ apiKey, baseUrl });
229
270
  }
230
271
  async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
231
272
  const sandboxClient = executor.client;
@@ -235,9 +276,22 @@ async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
235
276
  const fanoutFactory = mod.multiHarnessResearcherFanout;
236
277
  const singleFactory = mod.researcherProfile;
237
278
  if (!fanoutFactory || !singleFactory) return void 0;
279
+ const {
280
+ harness,
281
+ model,
282
+ routerKey,
283
+ routerBaseUrl,
284
+ fanoutHarnesses: cfgFanoutHarnesses,
285
+ fanoutModels
286
+ } = resolveResearcherProvisioning();
287
+ const buildPreset = (task) => {
288
+ const preset = singleFactory({ task, harness, model });
289
+ applyRouterEnv(preset.agentRunSpec, routerKey, routerBaseUrl);
290
+ return preset;
291
+ };
238
292
  const settleSingle = async (turn, args, sessionId, signal) => {
239
293
  const task = buildResearchTask(args);
240
- const preset = singleFactory({ task });
294
+ const preset = buildPreset(task);
241
295
  if (!preset.validator) {
242
296
  throw new Error("agent-runtime-mcp: researcher preset exposes no validator; cannot settle");
243
297
  }
@@ -254,7 +308,7 @@ async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
254
308
  const loopEmitter = composeLoopTraceEmitters(traceEmitter, ctx.traceEmitter);
255
309
  ctx.report({ iteration: 0, phase: "starting" });
256
310
  if (variants <= 1) {
257
- const preset = singleFactory({ task });
311
+ const preset = buildPreset(task);
258
312
  if (ctx.detachedSessionRef !== void 0 && ctx.updateDetachedSessionRef) {
259
313
  const { sessionId } = parseDetachedSessionRef(ctx.detachedSessionRef);
260
314
  const rebind = ctx.updateDetachedSessionRef;
@@ -301,10 +355,20 @@ async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
301
355
  ctx.report({ iteration: 1, phase: "completed" });
302
356
  return output2;
303
357
  }
304
- const fanout = fanoutFactory({ task });
358
+ const fanoutHarnesses = cfgFanoutHarnesses ?? Array.from({ length: variants }, () => harness);
359
+ const fanout = fanoutFactory({
360
+ task,
361
+ harnesses: fanoutHarnesses,
362
+ models: fanoutHarnesses.map((_, i) => fanoutModels?.[i] ?? model)
363
+ });
364
+ for (const spec of fanout.agentRuns) {
365
+ applyRouterEnv(spec, routerKey, routerBaseUrl);
366
+ }
367
+ const runs = fanout.agentRuns.slice(0, variants);
368
+ const effectiveVariants = Math.max(1, runs.length);
305
369
  const result = await runLoop({
306
370
  driver: fanout.driver,
307
- agentRuns: fanout.agentRuns.slice(0, variants),
371
+ agentRuns: runs,
308
372
  output: fanout.output,
309
373
  validator: fanout.validator,
310
374
  task,
@@ -313,8 +377,8 @@ async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
313
377
  signal: ctx.signal,
314
378
  ...loopEmitter ? { traceEmitter: loopEmitter } : {}
315
379
  },
316
- maxIterations: variants,
317
- maxConcurrency: Math.min(maxConcurrency, variants)
380
+ maxIterations: effectiveVariants,
381
+ maxConcurrency: Math.min(maxConcurrency, effectiveVariants)
318
382
  });
319
383
  const output = result.winner?.output;
320
384
  if (!output) throw new Error("researcher delegate fanout produced no winner");
@@ -326,7 +390,7 @@ async function loadResearcherSupport(executor, maxConcurrency, traceEmitter) {
326
390
  resume: {
327
391
  message(args) {
328
392
  const task = buildResearchTask(args);
329
- const spec = singleFactory({ task }).agentRunSpec;
393
+ const spec = buildPreset(task).agentRunSpec;
330
394
  return spec.taskToPrompt(task);
331
395
  },
332
396
  async settle(turn, args, signal) {
@@ -356,8 +420,8 @@ function parseHarnesses(raw) {
356
420
  }
357
421
  function parseFleetId(raw) {
358
422
  if (typeof raw !== "string") return void 0;
359
- const trimmed = raw.trim();
360
- return trimmed.length > 0 ? trimmed : void 0;
423
+ const trimmed2 = raw.trim();
424
+ return trimmed2.length > 0 ? trimmed2 : void 0;
361
425
  }
362
426
  function parseConcurrency(raw) {
363
427
  if (!raw) return 4;