@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,221 +0,0 @@
1
- import { AnalystFinding } from '@tangle-network/agent-eval';
2
- import { I as Iteration, D as Driver } from './types-CklkW4Eh.js';
3
-
4
- /**
5
- * @experimental
6
- *
7
- * Completion / satisfiability — the OTHER output of the pluggable analyst (the steer output
8
- * is `AnalystFinding[]` via the `analyze` hook; this is the "is it done?" output via the
9
- * `complete` hook). A `CompletionAnalyst` reads a node's trace and returns a `CompletionVerdict`
10
- * the PARENT (driver) acts on: end the node, or keep going. It fits ANY node and composes to
11
- * any depth — a 1-deep loop has one; an N-deep tree has one per node.
12
- *
13
- * The verdict's authority scales with its DETERMINISM (the thing that varies by task):
14
- * - `deterministic` — build/test/lint pass, a proof checks, every claim's citation resolves:
15
- * ground truth, the driver TRUSTS it and ends. Not an opinion.
16
- * - `probabilistic` — a quality/soundness judgment (marketing, "the experiment is sound"):
17
- * ADVISORY. It passes to the driver with its reasons; the driver validates (here: a
18
- * confidence threshold; a richer driver may re-examine the reasons) before ending.
19
- *
20
- * Two stop-signal mechanisms, by node mode, both → one `CompletionVerdict`:
21
- * - sandbox-agent (text stream): a unique per-node STOP SENTINEL the agent emits when done
22
- * (`stopSentinel` / `sentinelCompletion`) — ralph-loop style; the seed makes it
23
- * unguessable + attributable, so it can't be spuriously emitted or confused with content.
24
- * - deterministic check (compile/test/citation/proof): `deterministicCompletion(check)` —
25
- * a verifier over the output, never the judge verdict (selector ≠ judge holds).
26
- */
27
-
28
- /** Trace-derived evidence for a completion claim — an artifact (output) or a verifier metric,
29
- * never the judge's own verdict. Mirrors the steer-firewall's provenance discipline. */
30
- interface CompletionEvidence {
31
- kind: 'artifact' | 'metric';
32
- uri: string;
33
- }
34
- /** The "is it done?" verdict an analyst returns to the parent. */
35
- interface CompletionVerdict {
36
- done: boolean;
37
- /** How verifiable the claim is — sets whether the driver trusts it or validates it. */
38
- determinism: 'deterministic' | 'probabilistic';
39
- /** Why the analyst believes it is (or isn't) done — what the driver validates. */
40
- reasons?: string;
41
- /** 0..1, for probabilistic verdicts; the driver's validation threshold reads this. */
42
- confidence?: number;
43
- evidence?: ReadonlyArray<CompletionEvidence>;
44
- }
45
- /** Reads a node's trace → a completion verdict. Same input shape as the `analyze` hook, so
46
- * ONE analyst node can back both channels (findings for steer, a verdict for stop). */
47
- interface CompletionAnalyst<Task, Output> {
48
- assess(input: {
49
- task: Task;
50
- history: ReadonlyArray<Iteration<Task, Output>>;
51
- }): CompletionVerdict | Promise<CompletionVerdict>;
52
- }
53
- /** When a verdict authorizes the driver to END. Deterministic → trust (ground truth);
54
- * probabilistic → validate by confidence threshold (the driver's check). */
55
- interface CompletionPolicy {
56
- /** Minimum confidence a PROBABILISTIC verdict must clear to end. Default 0.8. */
57
- minConfidence?: number;
58
- }
59
- declare function completionAuthorizes(v: CompletionVerdict, policy?: CompletionPolicy): boolean;
60
- /**
61
- * A unique, attributable stop sentinel for a node (ralph-loop style). Deterministic from the
62
- * seed (no Math.random — reproducible + attributable to the node); the agent is instructed to
63
- * emit it VERBATIM when it judges itself done. Unguessable enough that content never trips it.
64
- */
65
- declare function stopSentinel(seed: string): string;
66
- /**
67
- * Completion for a sandbox-agent node: done iff the latest output carries the node's stop
68
- * sentinel. PROBABILISTIC (the agent's own self-judgment) — the driver validates it.
69
- */
70
- declare function sentinelCompletion<Task>(sentinel: string, opts?: {
71
- confidence?: number;
72
- }): CompletionAnalyst<Task, string>;
73
- /**
74
- * Completion for a DETERMINISTIC check (build/test/lint/citation/proof): done iff the check
75
- * passes. Ground truth — the driver ends directly, no validation. The check reads the output
76
- * (a verifier), never the judge verdict — selector ≠ judge stays intact.
77
- */
78
- declare function deterministicCompletion<Task, Output>(check: (output: Output, history: ReadonlyArray<Iteration<Task, Output>>) => {
79
- passed: boolean;
80
- reasons?: string;
81
- }): CompletionAnalyst<Task, Output>;
82
-
83
- /**
84
- * @experimental
85
- *
86
- * Dynamic driver — the agent authors the loop topology at runtime.
87
- *
88
- * Where a fixed-shape driver encodes one topology as a pure function of
89
- * history, this driver delegates the per-round shape to an injected
90
- * `TopologyPlanner`. Each round the planner inspects the task + iteration
91
- * history and emits one `TopologyMove`:
92
- * - `refine` → one task next round (optionally rewritten from the prior attempt)
93
- * - `fanout` → N tasks next round (the kernel round-robins `agentRuns`, so a
94
- * 2-harness fanout dispatches branch 0 to harness A and branch 1 to harness B)
95
- * - `stop` → terminate; the kernel selects the winner across all iterations
96
- *
97
- * The planner is the brain; this driver is the structure. It maps moves onto
98
- * the kernel's `plan`/`decide` contract, enforces the iteration + fanout caps,
99
- * and fails loud on a malformed move. The planner is injected — so a test can
100
- * drive a deterministic policy through the real kernel, and production can wire
101
- * it to an LLM-backed, agent-authored planner.
102
- *
103
- * Topology is orthogonal to harness: the planner never names a backend. Which
104
- * harness runs a branch is decided by the `AgentRunSpec` the kernel round-robins
105
- * to, so one dynamic driver works across claude-code, codex, opencode, pi —
106
- * including fanning a single round across several at once.
107
- */
108
-
109
- /** Terminal once `decide` returns `'done'` (a kernel terminal decision). */
110
- type DriverDecision = 'continue' | 'done';
111
- /**
112
- * One topology decision for the next round. `fanout` carries explicit tasks
113
- * rather than a count so the planner can issue heterogeneous branches (a
114
- * different sub-task per harness); pass N copies of one task for a homogeneous
115
- * fanout that relies on `agentRuns` diversity instead.
116
- *
117
- * @experimental
118
- */
119
- type TopologyMove<Task> = {
120
- kind: 'refine';
121
- task: Task;
122
- rationale?: string;
123
- parentIndex?: number;
124
- } | {
125
- kind: 'fanout';
126
- tasks: Task[];
127
- rationale?: string;
128
- parentIndex?: number;
129
- } | {
130
- kind: 'stop';
131
- rationale?: string;
132
- } | {
133
- kind: 'select';
134
- index: number;
135
- rationale?: string;
136
- };
137
- /** @experimental */
138
- interface PlannerContext<Task, Output> {
139
- /** The root task the loop was invoked with — stable across rounds. */
140
- task: Task;
141
- /** Every iteration so far, in dispatch order, with outputs + verdicts. */
142
- history: ReadonlyArray<Iteration<Task, Output>>;
143
- /** `history.length` — iterations already spent. */
144
- iterationsSpent: number;
145
- /** Iterations left before the driver's `maxIterations` cap forces a stop. */
146
- iterationsRemaining: number;
147
- /**
148
- * Trace-analyst findings about the attempts so far — populated only when an
149
- * `analyze` hook is wired into the driver (see CreateDriverOptions).
150
- * This is the channel that lets the planner steer from the DIAGNOSIS
151
- * (`f(trace, findings)`), not the verdict score alone. Undefined = no analyst
152
- * wired (the planner runs exactly as before). @experimental
153
- */
154
- analyses?: ReadonlyArray<AnalystFinding>;
155
- }
156
- /**
157
- * Chooses the next topology move from the task + history. Sync or async; an
158
- * async planner is where an LLM call goes (an agent-authored topology planner).
159
- *
160
- * @experimental
161
- */
162
- type TopologyPlanner<Task, Output> = (ctx: PlannerContext<Task, Output>) => TopologyMove<Task> | Promise<TopologyMove<Task>>;
163
- /**
164
- * Input to the optional `analyze` hook: the root task + the trace so far. The
165
- * hook turns this into `AnalystFinding[]` — the caller's seam to `runAnalystLoop`.
166
- * @experimental
167
- */
168
- interface AnalyzeInput<Task, Output> {
169
- task: Task;
170
- history: ReadonlyArray<Iteration<Task, Output>>;
171
- }
172
- /** @experimental */
173
- interface CreateDriverOptions<Task, Output> {
174
- /** The agent-authored topology policy. Invoked once per round in `plan`. */
175
- planner: TopologyPlanner<Task, Output>;
176
- /**
177
- * Optional trace-analyst hook. When set, the driver calls it each round AFTER
178
- * the first (a trace must exist) and BEFORE the planner, then passes the
179
- * findings to the planner via `PlannerContext.analyses` — so the planner
180
- * decides from the diagnosis, not the verdict score alone. This is the seam to
181
- * `runAnalystLoop`; it lives on the driver so `run-loop` stays analyst-free
182
- * (the layering rule). Fail-loud: a throwing or non-array hook aborts the round
183
- * (no silent empty findings).
184
- */
185
- analyze?: (input: AnalyzeInput<Task, Output>) => ReadonlyArray<AnalystFinding> | Promise<ReadonlyArray<AnalystFinding>>;
186
- /**
187
- * Optional completion analyst — the DEPLOYABLE, non-oracle stop. Each round (after a
188
- * trace exists) the driver asks "is it done?"; if the verdict AUTHORIZES ending
189
- * (deterministic = trust ground truth; probabilistic = clears `completionPolicy`'s
190
- * confidence), the driver stops BEFORE consulting the planner. This is the satisfiability
191
- * primitive — usable at 1 deep, composing to any depth (one per node). Fail-loud: a
192
- * throwing or non-verdict assess aborts the round. Distinct from `analyze` (the steer
193
- * channel) though one analyst node may back both.
194
- */
195
- complete?: CompletionAnalyst<Task, Output>;
196
- /** Validation policy for a probabilistic completion verdict (the driver's check). */
197
- completionPolicy?: CompletionPolicy;
198
- /**
199
- * Hard safety cap on total iterations. When reached, the driver stops before
200
- * consulting the planner. Default 8. Set the kernel's `runLoop`
201
- * `maxIterations >= ` this so the driver's cap governs and the loop closes on
202
- * a clean `'done'` rather than a truncated `'continue'`.
203
- */
204
- maxIterations?: number;
205
- /** Max branches a single `fanout` move may dispatch. Default 4. */
206
- maxFanout?: number;
207
- /** Stable identifier surfaced in trace events. Default `'dynamic'`. */
208
- name?: string;
209
- }
210
- /** @experimental */
211
- declare function createDriver<Task, Output>(options: CreateDriverOptions<Task, Output>): Driver<Task, Output, DriverDecision>;
212
- /**
213
- * Compact, planner-facing rendering of trace-analyst findings — the diagnosis the
214
- * planner steers from. Empty input renders to '' (callers omit the section). Shows
215
- * severity·area·claim·recommended_action·confidence; raw evidence_refs/metadata are
216
- * for renderers that know the analyst, not the topology decision.
217
- * @experimental
218
- */
219
- declare function renderAnalyses(findings: ReadonlyArray<AnalystFinding>): string;
220
-
221
- export { type AnalyzeInput as A, type CreateDriverOptions as C, type DriverDecision as D, type PlannerContext as P, type TopologyPlanner as T, type CompletionAnalyst as a, type CompletionEvidence as b, type CompletionPolicy as c, type CompletionVerdict as d, type TopologyMove as e, completionAuthorizes as f, createDriver as g, deterministicCompletion as h, stopSentinel as i, renderAnalyses as r, sentinelCompletion as s };