@tangle-network/agent-runtime 0.79.3 → 0.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +54 -325
  2. package/dist/agent.js +5 -5
  3. package/dist/analyst-loop.js +2 -2
  4. package/dist/{chunk-VMNEQHJR.js → chunk-3X53HYRW.js} +17 -2
  5. package/dist/chunk-3X53HYRW.js.map +1 -0
  6. package/dist/{chunk-T2HVQVB4.js → chunk-4J6RBI3K.js} +15 -1
  7. package/dist/chunk-4J6RBI3K.js.map +1 -0
  8. package/dist/{chunk-IODKUOBA.js → chunk-C2FZ6GR6.js} +2 -2
  9. package/dist/{chunk-63MHOCIE.js → chunk-DH72UOYR.js} +4 -4
  10. package/dist/{chunk-Z3RRRPRB.js → chunk-H7IBHAFT.js} +23 -14
  11. package/dist/chunk-H7IBHAFT.js.map +1 -0
  12. package/dist/{chunk-PVPFDTO3.js → chunk-LLJRUTE7.js} +2 -2
  13. package/dist/{chunk-PBE35ULD.js → chunk-M3Y362RW.js} +2 -2
  14. package/dist/{chunk-AG335EXG.js → chunk-QSO2TVDS.js} +668 -74
  15. package/dist/chunk-QSO2TVDS.js.map +1 -0
  16. package/dist/{chunk-KRULXIWS.js → chunk-TPII5AU7.js} +55 -7
  17. package/dist/chunk-TPII5AU7.js.map +1 -0
  18. package/dist/{coordination-DCmljYDf.d.ts → coordination-BI9tpcmF.d.ts} +12 -3
  19. package/dist/environment-provider.d.ts +1 -1
  20. package/dist/environment-provider.js +1 -1
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +8 -8
  23. package/dist/intelligence.d.ts +30 -2
  24. package/dist/intelligence.js +33 -23
  25. package/dist/intelligence.js.map +1 -1
  26. package/dist/{loop-runner-bin-C4X0FZ2Z.d.ts → loop-runner-bin-CBkLsyFg.d.ts} +2 -2
  27. package/dist/loop-runner-bin.d.ts +4 -4
  28. package/dist/loop-runner-bin.js +7 -7
  29. package/dist/loops.d.ts +265 -14
  30. package/dist/loops.js +28 -6
  31. package/dist/mcp/bin.js +5 -5
  32. package/dist/mcp/index.d.ts +6 -6
  33. package/dist/mcp/index.js +7 -7
  34. package/dist/{router-client-Ak2IGuXq.d.ts → router-client-D6Ocf4jG.d.ts} +19 -0
  35. package/dist/{types-C1sozrte.d.ts → types-By9LXllv.d.ts} +9 -2
  36. package/dist/{worktree-fanout-CXGzHET4.d.ts → worktree-fanout-D9Z2dMS9.d.ts} +2 -2
  37. package/dist/{worktree-harness-Bmho9SH0.d.ts → worktree-harness-Dx8XULW3.d.ts} +1 -1
  38. package/package.json +1 -1
  39. package/skills/build-with-agent-runtime/SKILL.md +53 -23
  40. package/dist/chunk-AG335EXG.js.map +0 -1
  41. package/dist/chunk-KRULXIWS.js.map +0 -1
  42. package/dist/chunk-T2HVQVB4.js.map +0 -1
  43. package/dist/chunk-VMNEQHJR.js.map +0 -1
  44. package/dist/chunk-Z3RRRPRB.js.map +0 -1
  45. /package/dist/{chunk-IODKUOBA.js.map → chunk-C2FZ6GR6.js.map} +0 -0
  46. /package/dist/{chunk-63MHOCIE.js.map → chunk-DH72UOYR.js.map} +0 -0
  47. /package/dist/{chunk-PVPFDTO3.js.map → chunk-LLJRUTE7.js.map} +0 -0
  48. /package/dist/{chunk-PBE35ULD.js.map → chunk-M3Y362RW.js.map} +0 -0
@@ -129,8 +129,8 @@ type UsageEvent = {
129
129
  } | {
130
130
  kind: 'iteration';
131
131
  };
132
- /** The runtime tag of a `Executor` impl. Open by intent `string` so a BYO executor
133
- * names its own runtime; the built-ins use these literals. */
132
+ /** The runtime tag of a `Executor` impl. Open by intent: custom runtimes use their own string name.
133
+ * External executors can register additional runtime strings without widening this type. */
134
134
  type Runtime = 'router' | 'inline' | 'sandbox' | 'cli' | (string & {});
135
135
  /**
136
136
  * `AgentProfile` does NOT carry a `harness`/backend field — `harness` lives on the
@@ -274,6 +274,13 @@ interface Scope<Out> {
274
274
  /** ray.wait n=1 over this scope's in-memory live set; resolves as each child settles;
275
275
  * `null` when the live set is empty. */
276
276
  next(): Promise<Settled<Out> | null>;
277
+ /**
278
+ * Non-blocking twin of `next()`: deliver an ALREADY-settled, undelivered child, or `null`
279
+ * when none is ready — never awaits a live child. The driver's post-loop drain reads this so
280
+ * a child that settled while the driver was busy (or after it stopped pulling) still reaches
281
+ * the finalize ledger instead of being silently lost.
282
+ */
283
+ nextResolved(): Promise<Settled<Out> | null>;
277
284
  /**
278
285
  * Steer a RUNNING child out-of-band — deliver a message to its executor's inbox (the driver's
279
286
  * `send` verb: next-instruction, interrupt, or resume). Returns `true` if the message was
@@ -1,9 +1,9 @@
1
1
  import { AgentProfile } from '@tangle-network/agent-interface';
2
2
  import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
3
- import { A as AgentSpec, b as ExecutorRegistry, B as Budget, c as Agent, S as SpawnJournal, d as ResultBlobStore, e as RootHandle, f as SupervisedResult, N as NodeId, g as Settled, h as Spend, i as Scope, a as Executor } from './types-C1sozrte.js';
3
+ import { A as AgentSpec, b as ExecutorRegistry, B as Budget, c as Agent, S as SpawnJournal, d as ResultBlobStore, e as RootHandle, f as SupervisedResult, N as NodeId, g as Settled, h as Spend, i as Scope, a as Executor } from './types-By9LXllv.js';
4
4
  import { R as RuntimeHooks, I as Iteration } from './types-BF-MEsQB.js';
5
5
  import { BackendType } from '@tangle-network/sandbox';
6
- import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-Bmho9SH0.js';
6
+ import { W as WorktreeHarnessResult, G as GitRunner, a as WorktreeCheckRunner, D as DeliverableSpec } from './worktree-harness-Dx8XULW3.js';
7
7
  import { L as LocalHarness, r as runLocalHarness } from './local-harness-DU7yV6mG.js';
8
8
 
9
9
  /**
@@ -1,4 +1,4 @@
1
- import { a as Executor } from './types-C1sozrte.js';
1
+ import { a as Executor } from './types-By9LXllv.js';
2
2
  import { L as LocalHarness } from './local-harness-DU7yV6mG.js';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-runtime",
3
- "version": "0.79.3",
3
+ "version": "0.80.0",
4
4
  "description": "Shared task-lifecycle skeleton for agents: a recursive loop kernel for chat turns, one-shot tasks, and multi-attempt loops, with trace capture and eval-gated self-improvement. Domain behavior lives in adapters; scoring and ship-gates in @tangle-network/agent-eval.",
5
5
  "homepage": "https://github.com/tangle-network/agent-runtime#readme",
6
6
  "repository": {
@@ -21,8 +21,8 @@ capture-integrity, or eval/prod parity).
21
21
 
22
22
  ## Load order — point at source, never freeze snippets
23
23
 
24
- This skill carries **no API snippets**. The barrel MOVES (`./loops` is a
25
- back-compat alias of `./runtime`), the agent-eval pin drifts, and signatures get
24
+ This skill carries **no API snippets**. The barrel MOVES (`./loops` is the
25
+ runtime barrel), the agent-eval pin drifts, and signatures get
26
26
  corrected in place. Freezing a snippet here guarantees rot. Instead, read, in
27
27
  order, and re-verify against source:
28
28
 
@@ -32,9 +32,8 @@ order, and re-verify against source:
32
32
  two-substrate map. Every signature there was read from source.
33
33
  2. **`grep` the export barrel** — `grep -nE 'export (function|const|type)' src/runtime/index.ts`
34
34
  (and `src/agent/index.ts`, `src/improvement/index.ts`, `src/mcp/index.ts`,
35
- `src/intelligence/index.ts`) for the live names + subpaths. `./loops` and
36
- `./runtime` resolve to the SAME barrel (`package.json` maps both to
37
- `src/runtime/index.ts`).
35
+ `src/intelligence/index.ts`) for the live names + subpaths. `./loops` is the
36
+ runtime barrel (`package.json` maps it to `src/runtime/index.ts`).
38
37
  3. **`bench/HARNESS.md`** — the experiment-harness map: commands, the
39
38
  `rollout → corpus → selector → CI → gate` flow, and the `ADAPTERS` registry
40
39
  (a harness-local export, `bench/src/adapters.ts`, not a package export).
@@ -54,36 +53,48 @@ profile and letting the substrate materialize it into harness shapes —
54
53
  self-verification, iteration, and audit are profile levers (hooks/skills/
55
54
  subagents), never glue code.
56
55
 
57
- `AgentProfile` is now owned by `@tangle-network/agent-interface` (the `/runtime`
58
- barrel still re-exports the sandbox alias for back-compat), which also owns
56
+ `AgentProfile` is owned by `@tangle-network/agent-interface` (the `/loops`
57
+ barrel re-exports the sandbox alias as a one-stop import), which also owns
59
58
  `HarnessType` + `ReasoningEffort` and a capability layer
60
59
  (`harnessSupportsModel` / `reasoningEffortsFor`) — so harness/model/reasoning
61
60
  compatibility is a queryable contract, not an assumption.
62
61
 
62
+ Harness is a RUN-layer coordinate, not part of the portable genome: it rides on
63
+ agent-runtime's `AgentSpec { profile, harness }`. To sweep it as an eval axis,
64
+ don't hand-declare a harness list — expand one base profile across
65
+ `CODING_HARNESSES` with `expandProfileAxes` (agent-eval), run with
66
+ `runProfileMatrix`, and pivot results by the stamped `AgentProfileCell`
67
+ (`groupRunsByAgentProfileCell`); incompatible `(harness, model)` pairs drop via
68
+ `harnessSupportsModel`.
69
+
63
70
  | Altitude — I want to… | Use | Source |
64
71
  |---|---|---|
65
- | **Define a genome** (who the agent is + what it can do, ONE surface) | `AgentProfile` (runnable) / `AgentSurfaces` (the editable-coordinate map) — `/runtime`, `/agent` | canonical-api §3.2 |
66
- | **Define the personified-run record** (model+prompt+tools+role+seams) | `definePersona(input)` — `/runtime` | canonical-api §3.1 |
67
- | **Run a genome driver⟷worker, end-to-end** | `runPersonified({ persona, shape, task, budget })` — `/runtime` | canonical-api §3.1 |
68
- | **Loop a worker over one evolving artifact, K rounds, stop-when-good** | `loopUntil(seed, spec)` as the `shape` — `/runtime` | canonical-api §3.1 |
69
- | **Best-of-N / parallel-research at equal compute** | `fanout(items, opts)` — `/runtime` | canonical-api §3.1 |
70
- | **Produce-then-gate / multi-judge quorum / fixed chain** | `verify` / `panel` / `pipeline` — `/runtime` | canonical-api §3.1 |
72
+ | **Define a genome** (who the agent is + what it can do, ONE surface) | `AgentProfile` (runnable) / `AgentSurfaces` (the editable-coordinate map) — `/loops`, `/agent` | canonical-api §3.2 |
73
+ | **Define the personified-run record** (model+prompt+tools+role+seams) | `definePersona(input)` — `/loops` | canonical-api §3.1 |
74
+ | **Run a genome driver⟷worker, end-to-end** | `runPersonified({ persona, shape, task, budget })` — `/loops` | canonical-api §3.1 |
75
+ | **Loop a worker over one evolving artifact, K rounds, stop-when-good** | `loopUntil(seed, spec)` as the `shape` — `/loops` | canonical-api §3.1 |
76
+ | **Best-of-N / parallel-research at equal compute** | `fanout(items, opts)` — `/loops` | canonical-api §3.1 |
77
+ | **Produce-then-gate / multi-judge quorum / fixed chain** | `verify` / `panel` / `pipeline` — `/loops` | canonical-api §3.1 |
71
78
  | **Run depth-vs-breadth (or a custom strategy) over a stateful tool domain** | `runAgentic({ surface, task, mode\|strategy, budget })` — `/loops` | canonical-api §3.3 |
72
79
  | **Author a new topology/strategy compactly** | `defineStrategy(name, body)` w/ `ctx.shot()`+`ctx.critique()` — `/loops` | canonical-api §3.3 |
73
80
  | **Add a stateful tool-using domain** | implement `AgenticSurface` (5 hooks) — `/loops` | canonical-api §3.3 |
81
+ | **Drive a team of agents over a graded `AgenticSurface` task** (workers settle on its check, driver self-improves from the failing tests) | `superviseSurface(profile, task, { surface, worker })` — `/loops` | canonical-api §2 |
74
82
  | **Benchmark: compare strategies + significance + Pareto on a domain** | `runBenchmark({ environment, tasks, worker, strategies })` — `/loops` | canonical-api §3.3 |
83
+ | **Benchmark report: multi-profile × multi-axis leaderboard** (ranked board + score matrix + SVG/HTML charts, any `RunRecord[]`) | `leaderboard(records)` + `renderLeaderboardMarkdown` / `renderLeaderboardSvg` / `renderLeaderboardHtml` — `/loops` | canonical-api §2 |
84
+ | **Meter one `openSandboxRun` cell's token/cost usage** | `sumSandboxUsage(events)` — `/loops` | canonical-api §2 |
85
+ | **Sweep harness × model as an eval axis** (turn one base profile into the full harness × model set) | `expandProfileAxes({ base, harnesses, models })` over `CODING_HARNESSES` → `runProfileMatrix(...)`, pivot with `groupRunsByAgentProfileCell` — `agent-eval` root — NOT a hand-declared `HARNESSES` list | agent-eval root (verify vs source) |
75
86
  | **Benchmark: add/run an external benchmark from the harness** | `ADAPTERS`/`resolveAdapter(key)` + a bench gate (`*-gate.mts`) over `openSandboxRun` + `sandboxAgentRun` (`bench/src/sandbox-run.ts`) | canonical-api §3.3 |
76
- | **Spawn N coding agents on isolated git worktrees, keep the one whose patch passes checks** | `worktreeFanout` + `createWorktreeCliExecutor` + `gateOnDeliverable(DeliverableSpec)` over a raw `WorktreePatchArtifact`, winner via `selectValidWinner` — `/runtime` — NOT a hand-rolled spawn-loop / "coder" role | canonical-api §3.1 / §5 |
77
- | **Sandbox coding rollout** (fresh box/round, or persistent+resume) | `runLoop(options)` / `openSandboxRun(client, opts, deliverable)` — `/runtime` | canonical-api §3.1 |
78
- | **Optimize a CODE surface** in a gated loop | `improvementDriver({ worktree, generator })` — `/improvement` | canonical-api §3.4 |
87
+ | **Spawn N coding agents on isolated git worktrees, keep the one whose patch passes checks** | `worktreeFanout` + `createWorktreeCliExecutor` + `gateOnDeliverable(DeliverableSpec)` over a raw `WorktreePatchArtifact`, winner via `selectValidWinner` — `/loops` — NOT a hand-rolled spawn-loop / "coder" role | canonical-api §3.1 / §5 |
88
+ | **Sandbox coding rollout** (fresh box/round, or persistent+resume) | `runLoop(options)` / `openSandboxRun(client, opts, deliverable)` — `/loops` | canonical-api §3.1 |
89
+ | **Optimize a CODE surface** in a gated loop | `improvementDriver({ worktree, generator })` — root `.` | canonical-api §3.4 |
79
90
  | **Optimize a PROMPT/config surface** (one call) | `selfImprove({ agent, scenarios, judge, baselineSurface })` — `agent-eval/contract` | canonical-api §3.4 |
80
91
  | **Gate: ship/hold a candidate** (campaign ctx) | `defaultProductionGate` / `heldOutGate` / `composeGate` — `agent-eval/contract` | canonical-api §3.4 |
81
- | **Gate: ship/hold from a `BenchmarkReport`** (per-task cells) | `promotionGate({ report, incumbent, candidate })` — `/runtime` | canonical-api §3.4 |
82
- | **Run the full multi-generation flywheel + certify** | `runStrategyEvolution(config)` — `/runtime` | canonical-api §3.4 |
83
- | **Compose the prod sandbox profile** (eval/prod parity) | `composeProductionAgentProfile(base, opts)` — `/mcp` | canonical-api §3.2 |
84
- | **Observe a run** (cost/time waterfall, live tree, OTLP) | `createWaterfallCollector` / `createOtelExporter` via `composeRuntimeHooks(...)` — root; `createTopologyView` / `renderTopologyTree` — `/topology` | canonical-api §3.5 |
92
+ | **Gate: ship/hold from a `BenchmarkReport`** (per-task cells) | `promotionGate({ report, incumbent, candidate })` — `/loops` | canonical-api §3.4 |
93
+ | **Run the full multi-generation flywheel + certify** | `runStrategyEvolution(config)` — `/loops` | canonical-api §3.4 |
94
+ | **Observe a run** (cost/time waterfall, OTLP) | `createWaterfallCollector()` — `/loops`; `createOtelExporter` attached via `composeRuntimeHooks(...)` — root `.` | canonical-api §2 |
85
95
  | **State any A/B claim** | `pairedLift` (bench) over `pairedBootstrap`/`heldoutSignificance` (substrate) | canonical-api §3.5 |
86
- | **Observe/ship with billing-boundary** | `withTangleIntelligence(agent, { project, effort })` — `/intelligence` | canonical-api §7 (now live on main — verify) |
96
+ | **Observe/ship with billing-boundary** | `withTangleIntelligence(agent, { project, effort })` — `/intelligence` | canonical-api §2 |
97
+ | **Pull the certified profile from the Intelligence plane** (pull-by-default delivery: fold the gate-certified prompt onto the base surface) | `pullCertified` / `withCertifiedDelivery` / `composeCertifiedPrompt` — `/intelligence` | `src/intelligence/delivery.ts` |
87
98
 
88
99
  ## Do-NOT-reinvent — the traps this skill exists to stop
89
100
 
@@ -112,6 +123,12 @@ holds the load-bearing invariant the parallel breaks:
112
123
  sum of spans IS the billed run cost; a parallel tally drifts).
113
124
  - your own bootstrap loop / PRNG per gate **≈** `pairedLift` / `promotionGate`
114
125
  (seeded, identical run-to-run; never report a point lift without `low/high/pairs`).
126
+ - a per-product `HARNESSES` / `HarnessBackend` list + a metadata-harness reader
127
+ **≈** `CODING_HARNESSES` + `expandProfileAxes` (the one canonical harness list;
128
+ incompatible `(harness, model)` pairs drop via `harnessSupportsModel`) and the
129
+ `AgentProfileCell` stamped by `runProfileMatrix`, pivoted via
130
+ `groupRunsByAgentProfileCell` — never bake the harness into the model id so the
131
+ same model can run under multiple harnesses.
115
132
 
116
133
  ## End-to-end recipe
117
134
 
@@ -146,8 +163,21 @@ One line wraps any agent with trace + billing boundary:
146
163
  off|eco|standard|thorough|max` (`'off'` is the provable passthrough floor —
147
164
  intelligence spend clamped to 0). It builds on `createOtelExporter` +
148
165
  `loopEventToOtelSpan` — don't hand-roll a trace-wrapper or effort/tier config.
149
- Verify the live subpath against `src/intelligence/index.ts` (canonical-api §7's
150
- "branch-only" note is stale — it landed on main).
166
+ Verify the live subpath against `src/intelligence/index.ts`.
167
+
168
+ Two operational facts every consumer must know:
169
+
170
+ - **Export is a silent no-op without an endpoint.** The export leg only ships
171
+ when `INTELLIGENCE_OTLP_ENDPOINT` (or `OTEL_EXPORTER_OTLP_ENDPOINT`) is set —
172
+ e.g. `https://intelligence.tangle.tools/v1/otlp`; absent, spans are dropped
173
+ best-effort with no error. The client's `doctor().exportConfigured` is the
174
+ check that export will actually ship.
175
+ - **Delivery pulls the certified profile from the plane.** `pullCertified` /
176
+ `withCertifiedDelivery` hit
177
+ `GET {TANGLE_INTELLIGENCE_URL|https://intelligence.tangle.tools}/v1/profiles/:target/composed`
178
+ with `Bearer TANGLE_API_KEY`; `withCertifiedDelivery` folds the certified
179
+ prompt onto the base surface, refreshes at most every 5 minutes, and is
180
+ fail-closed — a failed pull runs the agent on its base surface.
151
181
 
152
182
  ## Final check
153
183