@tangle-network/agent-eval 0.201.0 → 0.202.1

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.
@@ -0,0 +1,56 @@
1
+ # Retained external dispatch
2
+
3
+ `createRetainedDispatch` from `@tangle-network/agent-eval/campaign` wraps an external dispatch. `runEval` remains the scheduler and measurement owner. Separate named allowances reserve development and audit calls; they are counts, not monetary receipts.
4
+
5
+ The owning durable Run binds authority, execution revision and receipt-decoder revision in `scope`. Record that a scope has started outside its local directory, then use `requireExisting: true` when recovering that scope. Complete directory loss must not be mistaken for a new allowance.
6
+
7
+ An immutable `dispatch-scope.json` binds the run scope and named limits.
8
+ Every history event is committed in two durable steps through the existing compare-and-append contract.
9
+ The event is appended to `dispatches.jsonl`, then `dispatch-anchor.jsonl` records the committed byte length and cumulative digest.
10
+ The digest covers the history header, which binds the anchor to the scope and limits.
11
+ An event takes effect only after its anchor entry is durable.
12
+ An external dispatch therefore cannot run before its `started` event is anchored.
13
+ Settlement cannot be replayed before its event is anchored.
14
+
15
+ On open and before every replay, history must match its durable high-water mark exactly.
16
+ Truncation below the anchor, including to a valid header-only journal, stops for reconciliation.
17
+ History that diverges from the anchor or extends beyond it also stops for reconciliation.
18
+ Committed allowances are not reset, no allowance is reissued, and no dispatch is repeated.
19
+ An unanchored suffix is never trusted or synthesized.
20
+ A crash between the journal and anchor appends also stops for reconciliation.
21
+ Missing, empty, torn, or changed history is refused.
22
+ History without its anchor is half-initialized or tampered, and no such state is cleared automatically.
23
+ A live instance also rechecks the anchored history before replay.
24
+
25
+ Concurrent processes use compare-and-append for each file.
26
+ A writer that loses the journal append race refreshes and retries against committed state.
27
+ A reader that lands inside another writer's two-step commit window fails closed.
28
+ Retry after the writer completes by constructing a new instance.
29
+ If the writer stopped before anchoring its event, reconcile the incomplete state before resuming.
30
+ Explicit measured failures can be retained.
31
+ An external throw or an unretained side effect remains `outcome_unknown` and keeps its reservation.
32
+ The existing retained-result reconciliation handles a result written before its settlement event.
33
+
34
+ Receipt parsing must preserve the canonical stored value. A different decoder cannot transform old evidence while keeping the original digest. This check is not proof that the external receipt is true; the caller still owns its provenance and authorization.
35
+
36
+ ## Upgrading existing runs
37
+
38
+ Existing v1 directories without a scope anchor deliberately stop for reconciliation.
39
+ Directories with a scope anchor but no `dispatch-anchor.jsonl` also stop.
40
+ That state may be half-initialized, interrupted between the history and anchor appends, or tampered.
41
+ This release never synthesizes an anchor from potentially incomplete state.
42
+ Do not delete them, change their directory, or clear the owning Run's started marker to retry.
43
+ Drain existing runs with their pinned implementation, or have the authority owner reconcile their original history and evidence before migration.
44
+
45
+ A partially initialized scope also stops rather than assuming nothing ran. The durable owner can distinguish an initialization failure from an issued external dispatch using its own record.
46
+
47
+ This mechanism does not certify arbitrary storage rollback or corruption, globally exactly-once remote effects, financial settlement, or semantic correctness. An independent durable Run/fence and proper storage retention remain necessary.
48
+
49
+ ## Executed checks
50
+
51
+ ```sh
52
+ pnpm exec tsx scripts/prove-retained-dispatch.ts
53
+ pnpm exec tsx scripts/prove-retained-dispatch-integrity.ts
54
+ ```
55
+
56
+ The first maintained proof exercises contention, SIGKILL, failed dispatches, retained-result reconciliation and audit reservations. The second adds independent-process journal-loss, empty-history, header-only-truncation, whole-directory-loss, stale-live-instance and changed-decoder checks. Both perform real filesystem and child-process operations, with no provider calls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "0.201.0",
3
+ "version": "0.202.1",
4
4
  "description": "Evaluate and improve AI agents from runs, traces, judges, and feedback. Compare candidates, cluster failures, measure lift, and gate releases.",
5
5
  "homepage": "https://github.com/tangle-network/agent-eval#readme",
6
6
  "repository": {