@tangle-network/agent-runtime 0.72.0 → 0.73.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.
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +4 -3
- package/dist/agent.js.map +1 -1
- package/dist/analyst-loop.d.ts +1 -1
- package/dist/analyst-loop.js +3 -2
- package/dist/{chunk-VYXBFWHZ.js → chunk-7ODB76J5.js} +2 -2
- package/dist/{chunk-PHKNOAOU.js → chunk-HPYWEFVY.js} +25 -7
- package/dist/chunk-HPYWEFVY.js.map +1 -0
- package/dist/{chunk-P5OKDSLB.js → chunk-IODKUOBA.js} +5 -3
- package/dist/{chunk-P5OKDSLB.js.map → chunk-IODKUOBA.js.map} +1 -1
- package/dist/chunk-NBV35BR6.js +68 -0
- package/dist/chunk-NBV35BR6.js.map +1 -0
- package/dist/{chunk-55WKGOGU.js → chunk-NCH4XUZ7.js} +111 -31
- package/dist/chunk-NCH4XUZ7.js.map +1 -0
- package/dist/{chunk-VLF5RHEQ.js → chunk-T2HVQVB4.js} +1 -66
- package/dist/chunk-T2HVQVB4.js.map +1 -0
- package/dist/{chunk-HXVMLRYU.js → chunk-U56XGKVY.js} +7 -7
- package/dist/{coordination-CFVF0OzX.d.ts → coordination-DU0saWeg.d.ts} +8 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +1 -1
- package/dist/lifecycle.d.ts +281 -0
- package/dist/lifecycle.js +174 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/{loop-runner-bin-B7biH0Gk.d.ts → loop-runner-bin-eD3m0rHW.d.ts} +2 -2
- package/dist/loop-runner-bin.d.ts +4 -4
- package/dist/loop-runner-bin.js +6 -5
- package/dist/loops.d.ts +45 -9
- package/dist/loops.js +6 -3
- package/dist/mcp/bin.js +6 -5
- package/dist/mcp/bin.js.map +1 -1
- package/dist/mcp/index.d.ts +6 -6
- package/dist/mcp/index.js +5 -4
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-DOI5mKNw.d.ts → openai-tools-CBurv8Cu.d.ts} +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-K8-xkiw1.d.ts → types-JufmXF2a.d.ts} +80 -1
- package/dist/{worktree-JXGJ1MxQ.d.ts → worktree-DaxOvw-C.d.ts} +1 -1
- package/dist/{worktree-fanout-DJHQy7Ux.d.ts → worktree-fanout-DIffZohV.d.ts} +15 -5
- package/package.json +6 -1
- package/dist/chunk-55WKGOGU.js.map +0 -1
- package/dist/chunk-PHKNOAOU.js.map +0 -1
- package/dist/chunk-VLF5RHEQ.js.map +0 -1
- /package/dist/{chunk-VYXBFWHZ.js.map → chunk-7ODB76J5.js.map} +0 -0
- /package/dist/{chunk-HXVMLRYU.js.map → chunk-U56XGKVY.js.map} +0 -0
|
@@ -763,9 +763,15 @@ interface AgentRunSpec<Task> {
|
|
|
763
763
|
* files, or seed datasets. The hook is part of the runtime surface so loop
|
|
764
764
|
* consumers do not hand-roll Sandbox SDK orchestration just to prepare a
|
|
765
765
|
* workspace before the agent sees it.
|
|
766
|
+
*
|
|
767
|
+
* `ctx.recordMount` records what was placed into the box so the run carries a
|
|
768
|
+
* provenance manifest (`LoopResult.provenance.mounts`). It is optional and
|
|
769
|
+
* provenance-only — the kernel never reads box contents and attaches no
|
|
770
|
+
* meaning to the entries; not calling it simply leaves the manifest empty.
|
|
766
771
|
*/
|
|
767
772
|
prepareBox?: (box: SandboxInstance, ctx: {
|
|
768
773
|
signal: AbortSignal;
|
|
774
|
+
recordMount: MountRecorder;
|
|
769
775
|
}) => Promise<void> | void;
|
|
770
776
|
/**
|
|
771
777
|
* Per-spec stable name. Surfaced in trace events and the default winner
|
|
@@ -801,6 +807,75 @@ interface LoopTokenUsage {
|
|
|
801
807
|
input: number;
|
|
802
808
|
output: number;
|
|
803
809
|
}
|
|
810
|
+
/**
|
|
811
|
+
* One mounted resource recorded during box preparation — a pure provenance
|
|
812
|
+
* record of what the caller placed into a box before the agent saw it. The
|
|
813
|
+
* kernel never reads box contents itself (it does not know what was mounted);
|
|
814
|
+
* the caller, which owns the bytes inside `prepareBox`, supplies each entry via
|
|
815
|
+
* `recordMount`. Carries no domain semantics — just where the resource landed,
|
|
816
|
+
* its content fingerprint, its size, and where it came from — so a run is
|
|
817
|
+
* auditable after the fact ("what exactly was this agent given?").
|
|
818
|
+
*
|
|
819
|
+
* @experimental
|
|
820
|
+
*/
|
|
821
|
+
interface MountManifestEntry {
|
|
822
|
+
/** Destination path inside the box where the resource was placed. */
|
|
823
|
+
path: string;
|
|
824
|
+
/** Hex SHA-256 of the mounted bytes. The caller computes it from the bytes
|
|
825
|
+
* it wrote — the kernel does not hash box contents. */
|
|
826
|
+
sha256: string;
|
|
827
|
+
/** Size of the mounted resource in bytes. */
|
|
828
|
+
bytes: number;
|
|
829
|
+
/** Free-form origin of the resource (e.g. a repo ref, a corpus id, a local
|
|
830
|
+
* path, a URL). Provenance only — the kernel attaches no meaning to it. */
|
|
831
|
+
source: string;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* A record of one candidate-selection decision: which iteration the selector
|
|
835
|
+
* picked (or rejected) and why. Pure audit trail of the SELECTOR role — it
|
|
836
|
+
* carries the selector's identity, the candidate's score, and an optional
|
|
837
|
+
* human-readable reason, with no domain semantics. The kernel emits one receipt
|
|
838
|
+
* per scored candidate at finalize so a run answers "why did THIS one win?".
|
|
839
|
+
*
|
|
840
|
+
* @experimental
|
|
841
|
+
*/
|
|
842
|
+
interface SelectionReceipt {
|
|
843
|
+
/** Iteration index this receipt is about. */
|
|
844
|
+
candidateIndex: number;
|
|
845
|
+
/** True for the iteration the selector chose as winner; false otherwise. */
|
|
846
|
+
selected: boolean;
|
|
847
|
+
/** The candidate's verdict score, when it has one. */
|
|
848
|
+
score?: number;
|
|
849
|
+
/** Why this candidate was (or was not) selected, when the selector states it. */
|
|
850
|
+
reason?: string;
|
|
851
|
+
/** Identity of the selector that produced this receipt — `'caller'` (an
|
|
852
|
+
* explicit `selectWinner`), `'driver'` (a driver-authored winner), or
|
|
853
|
+
* `'default'` (the kernel's best-valid-score argmax). */
|
|
854
|
+
selector: 'caller' | 'driver' | 'default';
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Domain-free run provenance: a manifest of what was mounted into the run's
|
|
858
|
+
* boxes and the receipts for how the winner was selected. Surfaced on
|
|
859
|
+
* `LoopResult` purely for run auditability — nothing in the kernel branches on
|
|
860
|
+
* it. Empty arrays when the caller recorded no mounts and there was no
|
|
861
|
+
* candidate to select.
|
|
862
|
+
*
|
|
863
|
+
* @experimental
|
|
864
|
+
*/
|
|
865
|
+
interface RunProvenance {
|
|
866
|
+
/** Every resource recorded via `prepareBox`'s `recordMount`, in record order. */
|
|
867
|
+
mounts: MountManifestEntry[];
|
|
868
|
+
/** One receipt per scored candidate at finalize, in iteration order. */
|
|
869
|
+
selectionReceipts: SelectionReceipt[];
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Records a mounted resource into the run's provenance manifest. Passed to
|
|
873
|
+
* `prepareBox` so the caller — which owns the bytes it writes into the box —
|
|
874
|
+
* declares what it mounted without the kernel having to inspect box contents.
|
|
875
|
+
*
|
|
876
|
+
* @experimental
|
|
877
|
+
*/
|
|
878
|
+
type MountRecorder = (entry: MountManifestEntry) => void;
|
|
804
879
|
/** @experimental */
|
|
805
880
|
interface Iteration<Task, Output> {
|
|
806
881
|
/** 0-based iteration index assigned by the kernel. */
|
|
@@ -892,6 +967,10 @@ interface LoopResult<Task, Output, Decision> {
|
|
|
892
967
|
* `ctx.cost.observeTokens` in a `runProfileMatrix` dispatch so the
|
|
893
968
|
* integrity guard sees real LLM activity. */
|
|
894
969
|
tokenUsage: LoopTokenUsage;
|
|
970
|
+
/** Domain-free run provenance for auditability: the mount manifest recorded
|
|
971
|
+
* during `prepareBox` and the selection receipts for how the winner was
|
|
972
|
+
* chosen. Always present; empty arrays when nothing was recorded. */
|
|
973
|
+
provenance: RunProvenance;
|
|
895
974
|
}
|
|
896
975
|
/**
|
|
897
976
|
* Minimal sandbox client surface the kernel calls. Satisfied structurally by
|
|
@@ -1178,4 +1257,4 @@ interface ExecCtx {
|
|
|
1178
1257
|
parentSpanId?: string;
|
|
1179
1258
|
}
|
|
1180
1259
|
|
|
1181
|
-
export { type
|
|
1260
|
+
export { type LoopEndedPayload as $, type AgentRunSpec as A, type BackendErrorDetail as B, type RuntimeHookEvent as C, type RuntimeHookPhase as D, type ExecCtx as E, type RuntimeHookTarget as F, type RuntimeRunHandle as G, type RuntimeRunPersistenceAdapter as H, type Iteration as I, type RuntimeRunRow as J, type KnowledgeReadinessDecision as K, type LoopTokenUsage as L, composeRuntimeHooks as M, defineRuntimeHooks as N, type OpenAIChatTool as O, notifyRuntimeDecisionPoint as P, notifyRuntimeHookEvent as Q, type RuntimeStreamEvent as R, type SandboxClient as S, startRuntimeRun as T, type Driver as U, type Validator as V, type LoopWinner as W, type LoopLineageOptions as X, type LoopResult as Y, type MountRecorder as Z, type LoopDecisionPayload as _, type OutputAdapter as a, type LoopIterationDispatchPayload as a0, type LoopIterationEndedPayload as a1, type LoopIterationStartedPayload as a2, type LoopPlanDescription as a3, type LoopPlanPayload as a4, type LoopStartedPayload as a5, type LoopTeardownFailedPayload as a6, type MountManifestEntry as a7, type RunProvenance as a8, type SelectionReceipt as a9, type ValidationCtx as aa, type RuntimeHooks as b, type LoopTraceEvent as c, type LoopSandboxPlacement as d, type LoopTraceEmitter as e, type AgentBackendInput as f, type AgentExecutionBackend as g, type OpenAIChatToolChoice as h, type AgentBackendContext as i, type RunAgentTaskOptions as j, type AgentTaskRunResult as k, type RunAgentTaskStreamOptions as l, type AgentRuntimeEvent as m, type AgentTaskStatus as n, type RuntimeSessionStore as o, type RuntimeSession as p, type AgentAdapter as q, type AgentKnowledgeProvider as r, type AgentRuntimeEventSink as s, type AgentTaskContext as t, type AgentTaskSpec as u, type RuntimeDecisionEvidenceRef as v, type RuntimeDecisionKind as w, type RuntimeDecisionPoint as x, type RuntimeHookContext as y, type RuntimeHookErrorContext as z };
|
|
@@ -2,7 +2,7 @@ import { ChildProcess } from 'node:child_process';
|
|
|
2
2
|
import { DefaultVerdict } from '@tangle-network/agent-eval';
|
|
3
3
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
4
4
|
import { BackendType } from '@tangle-network/sandbox';
|
|
5
|
-
import { L as LoopTokenUsage, b as RuntimeHooks } from './types-
|
|
5
|
+
import { L as LoopTokenUsage, b as RuntimeHooks } from './types-JufmXF2a.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @experimental
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentProfile } from '@tangle-network/agent-interface';
|
|
2
2
|
import { AnalystFinding, DefaultVerdict } from '@tangle-network/agent-eval';
|
|
3
|
-
import { A as AgentSpec, E as ExecutorRegistry, B as Budget, g as Agent, S as SpawnJournal, h as ResultBlobStore, i as RootHandle, j as SupervisedResult, N as NodeId, k as Settled, l as Spend, m as Scope, L as LocalHarness, G as GitRunner, r as runLocalHarness, n as Executor, o as DeliverableSpec } from './worktree-
|
|
4
|
-
import { b as RuntimeHooks, I as Iteration } from './types-
|
|
3
|
+
import { A as AgentSpec, E as ExecutorRegistry, B as Budget, g as Agent, S as SpawnJournal, h as ResultBlobStore, i as RootHandle, j as SupervisedResult, N as NodeId, k as Settled, l as Spend, m as Scope, L as LocalHarness, G as GitRunner, r as runLocalHarness, n as Executor, o as DeliverableSpec } from './worktree-DaxOvw-C.js';
|
|
4
|
+
import { b as RuntimeHooks, I as Iteration } from './types-JufmXF2a.js';
|
|
5
5
|
import { BackendType } from '@tangle-network/sandbox';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -869,9 +869,12 @@ type WorktreeCheckRunner = (opts: {
|
|
|
869
869
|
* result onto the `Executor` port (artifact + spend) and owns the teardown point. The §1.5 payload
|
|
870
870
|
* (authored systemPrompt + model) reaches the harness inside the core, not here.
|
|
871
871
|
*
|
|
872
|
-
* Token accounting: a harness CLI does not surface usage, so this executor
|
|
873
|
-
* — its spend is NOT metered against the conserved pool and its iterations are
|
|
874
|
-
* equal-k arms by construction (mirrors `cliExecutor`).
|
|
872
|
+
* Token accounting: a harness CLI does not surface usage, so this executor defaults to
|
|
873
|
+
* `budgetExempt: true` — its spend is NOT metered against the conserved pool and its iterations are
|
|
874
|
+
* EXCLUDED from the equal-k arms by construction (mirrors `cliExecutor`). The exemption is an
|
|
875
|
+
* explicit, documented `budgetExempt` option rather than a buried hardcode: set it `false` ONLY for
|
|
876
|
+
* a harness that genuinely surfaces real token/usd usage to meter into the pool — otherwise the
|
|
877
|
+
* executor would meter a fabricated zero, which the no-silent-zeros rule forbids.
|
|
875
878
|
*/
|
|
876
879
|
|
|
877
880
|
/** Terminal artifact of one worktree-CLI run — the canonical worktree-harness result (the captured
|
|
@@ -909,6 +912,13 @@ interface WorktreeCliExecutorOptions {
|
|
|
909
912
|
/** Test seam — inject the verification-command runner so unit tests script test/typecheck
|
|
910
913
|
* outcomes without spawning a real shell. Defaults to a `/bin/sh -c` spawn in the worktree. */
|
|
911
914
|
runCommand?: WorktreeCheckRunner;
|
|
915
|
+
/**
|
|
916
|
+
* Exclude this leaf's spend from the conserved pool + equal-k arms. Defaults to `true` because a
|
|
917
|
+
* coding-harness CLI does not surface token usage, so metering it would record a fabricated zero
|
|
918
|
+
* (the no-silent-zeros rule forbids that). Set `false` ONLY for a harness that surfaces real
|
|
919
|
+
* token/usd usage worth metering — the executor would then debit the (real) spend it captures.
|
|
920
|
+
*/
|
|
921
|
+
budgetExempt?: boolean;
|
|
912
922
|
}
|
|
913
923
|
/**
|
|
914
924
|
* Build a worktree-CLI leaf `Executor`. Per-spawn (a fresh worktree + abort + teardown each), so a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.73.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": {
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"import": "./dist/analyst-loop.js",
|
|
40
40
|
"default": "./dist/analyst-loop.js"
|
|
41
41
|
},
|
|
42
|
+
"./lifecycle": {
|
|
43
|
+
"types": "./dist/lifecycle.d.ts",
|
|
44
|
+
"import": "./dist/lifecycle.js",
|
|
45
|
+
"default": "./dist/lifecycle.js"
|
|
46
|
+
},
|
|
42
47
|
"./profiles": {
|
|
43
48
|
"types": "./dist/profiles.d.ts",
|
|
44
49
|
"import": "./dist/profiles.js",
|