@tangle-network/agent-runtime 0.107.5 → 0.108.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/README.md +17 -4
- package/dist/{activation-Ck5ksFWg.js → activation-DRpnplEm.js} +3 -3
- package/dist/{activation-Ck5ksFWg.js.map → activation-DRpnplEm.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-BUpR0mSD.js → candidate-execution-nYMa-bc-.js} +4 -4
- package/dist/{candidate-execution-BUpR0mSD.js.map → candidate-execution-nYMa-bc-.js.map} +1 -1
- package/dist/durable.d.ts +134 -0
- package/dist/durable.js +124 -0
- package/dist/durable.js.map +1 -0
- package/dist/{environment-provider-IUGU3epE.d.ts → environment-provider-D0NXc4Qz.d.ts} +73 -4
- package/dist/environment-provider.d.ts +1 -1
- package/dist/{improvement-cycle-Ulvvbg5p.js → improvement-cycle-CRnDDdX0.js} +49 -155
- package/dist/improvement-cycle-CRnDDdX0.js.map +1 -0
- package/dist/{index-B3wAV1SJ.d.ts → index-BZbJWqoZ.d.ts} +165 -25
- package/dist/{index-BbB5mmK0.d.ts → index-DQp3BPeC.d.ts} +11 -159
- package/dist/{index-D2g5qCwg.d.ts → index-cdkwHruJ.d.ts} +3 -3
- package/dist/index.d.ts +6 -6
- package/dist/index.js +14 -121
- package/dist/index.js.map +1 -1
- package/dist/intelligence.d.ts +15 -7
- package/dist/intelligence.js +4 -4
- package/dist/{knowledge-Dizh_AtL.js → knowledge-rdrpPIXs.js} +5 -5
- package/dist/{knowledge-Dizh_AtL.js.map → knowledge-rdrpPIXs.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-Dw9_OZfu.d.ts → loop-runner-bin-9-JlGqN7.d.ts} +3 -3
- package/dist/{loop-runner-bin-BHELvjdO.js → loop-runner-bin-B1V-XS5A.js} +3 -3
- package/dist/{loop-runner-bin-BHELvjdO.js.map → loop-runner-bin-B1V-XS5A.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/loops.d.ts +3 -3
- package/dist/loops.js +5 -5
- package/dist/mcp/bin.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-CKLy1C7M.js → openai-tools-BjQq2TTL.js} +2 -2
- package/dist/{openai-tools-CKLy1C7M.js.map → openai-tools-BjQq2TTL.js.map} +1 -1
- package/dist/{prepare-_WTTffkz.js → prepare-Pr19X93k.js} +141 -6
- package/dist/prepare-Pr19X93k.js.map +1 -0
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-ZUwVuftA.js → protected-model-port-uthtDNqu.js} +2 -2
- package/dist/{protected-model-port-ZUwVuftA.js.map → protected-model-port-uthtDNqu.js.map} +1 -1
- package/dist/{redact-C5xOm8cu.d.ts → redact-BkasKlyd.d.ts} +17 -27
- package/dist/{runtime-M_GIzIwe.js → runtime-CDekUROm.js} +4 -4
- package/dist/{runtime-M_GIzIwe.js.map → runtime-CDekUROm.js.map} +1 -1
- package/dist/{structural-rollout-IXUEplky.js → structural-rollout-BC81Otmc.js} +10 -9
- package/dist/structural-rollout-BC81Otmc.js.map +1 -0
- package/dist/{supervise-BiRutHS9.js → supervise-JfKPwIlO.js} +270 -69
- package/dist/supervise-JfKPwIlO.js.map +1 -0
- package/dist/{supervisor-DTKhF-RV.js → supervisor-B2LzaWRb.js} +221 -16
- package/dist/supervisor-B2LzaWRb.js.map +1 -0
- package/dist/testing.js +288 -239
- package/dist/testing.js.map +1 -1
- package/dist/{workspace-archive-CIG1VNCj.js → workspace-archive-C9w_rxt6.js} +2 -2
- package/dist/{workspace-archive-CIG1VNCj.js.map → workspace-archive-C9w_rxt6.js.map} +1 -1
- package/package.json +11 -6
- package/dist/improvement-cycle-Ulvvbg5p.js.map +0 -1
- package/dist/prepare-_WTTffkz.js.map +0 -1
- package/dist/structural-rollout-IXUEplky.js.map +0 -1
- package/dist/supervise-BiRutHS9.js.map +0 -1
- package/dist/supervisor-DTKhF-RV.js.map +0 -1
|
@@ -2356,7 +2356,61 @@ function createScope(args) {
|
|
|
2356
2356
|
let meterSeq = 0;
|
|
2357
2357
|
const now = args.now ?? Date.now;
|
|
2358
2358
|
const unclaimedWaits = new Map((args.resumeFrom?.waits ?? []).map((w) => [w.label, w]));
|
|
2359
|
+
const keyed = /* @__PURE__ */ new Map();
|
|
2360
|
+
for (const [key, prior] of args.resumeFrom?.keys ?? []) if (prior.state === "completed" && prior.settled?.kind === "done") keyed.set(key, {
|
|
2361
|
+
state: "done",
|
|
2362
|
+
id: prior.id,
|
|
2363
|
+
settled: prior.settled
|
|
2364
|
+
});
|
|
2365
|
+
else if (prior.state === "down" && prior.settled?.kind === "down") keyed.set(key, {
|
|
2366
|
+
state: "down",
|
|
2367
|
+
id: prior.id,
|
|
2368
|
+
reason: prior.settled.reason
|
|
2369
|
+
});
|
|
2370
|
+
else keyed.set(key, {
|
|
2371
|
+
state: "in-doubt",
|
|
2372
|
+
id: prior.id
|
|
2373
|
+
});
|
|
2374
|
+
/** Fold a keyed child's terminal settlement back into the registry, so a later spawn with the
|
|
2375
|
+
* same key resolves to it (done → committed result; down → explicit retry). */
|
|
2376
|
+
const recordKeyedSettlement = (key, settled) => {
|
|
2377
|
+
if (settled.kind === "done") keyed.set(key, {
|
|
2378
|
+
state: "done",
|
|
2379
|
+
id: settled.handle.id,
|
|
2380
|
+
settled
|
|
2381
|
+
});
|
|
2382
|
+
else keyed.set(key, {
|
|
2383
|
+
state: "down",
|
|
2384
|
+
id: settled.handle.id,
|
|
2385
|
+
reason: settled.reason
|
|
2386
|
+
});
|
|
2387
|
+
};
|
|
2359
2388
|
function spawn(agent, task, opts) {
|
|
2389
|
+
let prior;
|
|
2390
|
+
if (opts.key !== void 0) {
|
|
2391
|
+
const existing = keyed.get(opts.key);
|
|
2392
|
+
if (existing?.state === "live") return {
|
|
2393
|
+
ok: false,
|
|
2394
|
+
reason: "duplicate-key"
|
|
2395
|
+
};
|
|
2396
|
+
if (existing?.state === "done") return {
|
|
2397
|
+
ok: true,
|
|
2398
|
+
handle: existing.settled.handle,
|
|
2399
|
+
prior: {
|
|
2400
|
+
state: "completed",
|
|
2401
|
+
settled: existing.settled
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
if (existing?.state === "down") prior = {
|
|
2405
|
+
state: "retried",
|
|
2406
|
+
priorId: existing.id,
|
|
2407
|
+
reason: existing.reason
|
|
2408
|
+
};
|
|
2409
|
+
else if (existing?.state === "in-doubt") prior = {
|
|
2410
|
+
state: "lost",
|
|
2411
|
+
priorId: existing.id
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2360
2414
|
if (args.maxDepth !== void 0 && args.depth >= args.maxDepth) return {
|
|
2361
2415
|
ok: false,
|
|
2362
2416
|
reason: "depth-exceeded"
|
|
@@ -2401,6 +2455,7 @@ function createScope(args) {
|
|
|
2401
2455
|
runtime: executor.runtime,
|
|
2402
2456
|
budget: opts.budget,
|
|
2403
2457
|
label: opts.label,
|
|
2458
|
+
...opts.key !== void 0 ? { key: opts.key } : {},
|
|
2404
2459
|
spent: zeroSpend(),
|
|
2405
2460
|
settled: void 0,
|
|
2406
2461
|
delivered: false,
|
|
@@ -2412,11 +2467,16 @@ function createScope(args) {
|
|
|
2412
2467
|
...executor.traceSource ? { readTraceSource: executor.traceSource.bind(executor) } : {}
|
|
2413
2468
|
};
|
|
2414
2469
|
children.set(id, live);
|
|
2470
|
+
if (opts.key !== void 0) keyed.set(opts.key, {
|
|
2471
|
+
state: "live",
|
|
2472
|
+
id
|
|
2473
|
+
});
|
|
2415
2474
|
args.journal.appendEvent(args.root, {
|
|
2416
2475
|
kind: "spawned",
|
|
2417
2476
|
id,
|
|
2418
2477
|
parent: args.parentId,
|
|
2419
2478
|
label: opts.label,
|
|
2479
|
+
...opts.key !== void 0 ? { key: opts.key } : {},
|
|
2420
2480
|
budget: opts.budget,
|
|
2421
2481
|
runtime: executor.runtime,
|
|
2422
2482
|
seq: ordinal,
|
|
@@ -2446,7 +2506,8 @@ function createScope(args) {
|
|
|
2446
2506
|
});
|
|
2447
2507
|
return {
|
|
2448
2508
|
ok: true,
|
|
2449
|
-
handle
|
|
2509
|
+
handle,
|
|
2510
|
+
...prior ? { prior } : {}
|
|
2450
2511
|
};
|
|
2451
2512
|
} catch (err) {
|
|
2452
2513
|
args.pool.reconcile(reservation.ticket, zeroSpend());
|
|
@@ -2465,7 +2526,9 @@ function createScope(args) {
|
|
|
2465
2526
|
const seq = cursorSeq++;
|
|
2466
2527
|
const settlement = chosen.resolved;
|
|
2467
2528
|
if (!settlement) throw new ValidationError(`scope.next: child '${chosen.id}' won the settle race without a resolved value`);
|
|
2468
|
-
|
|
2529
|
+
const delivered = await finalizeSettlement(chosen, settlement, seq, args, now);
|
|
2530
|
+
if (chosen.key !== void 0) recordKeyedSettlement(chosen.key, delivered);
|
|
2531
|
+
return delivered;
|
|
2469
2532
|
}
|
|
2470
2533
|
}
|
|
2471
2534
|
async function nextResolved() {
|
|
@@ -2476,7 +2539,9 @@ function createScope(args) {
|
|
|
2476
2539
|
const settlement = await pick.settled;
|
|
2477
2540
|
if (pick.delivered) continue;
|
|
2478
2541
|
pick.delivered = true;
|
|
2479
|
-
|
|
2542
|
+
const delivered = await finalizeSettlement(pick, settlement, cursorSeq++, args, now);
|
|
2543
|
+
if (pick.key !== void 0) recordKeyedSettlement(pick.key, delivered);
|
|
2544
|
+
return delivered;
|
|
2480
2545
|
}
|
|
2481
2546
|
}
|
|
2482
2547
|
function send(nodeId, msg) {
|
|
@@ -2679,7 +2744,9 @@ function createScope(args) {
|
|
|
2679
2744
|
const resume = args.resumeFrom ? {
|
|
2680
2745
|
settled: args.resumeFrom.settled,
|
|
2681
2746
|
view: args.resumeFrom.view,
|
|
2682
|
-
waits: args.resumeFrom.waits
|
|
2747
|
+
waits: args.resumeFrom.waits,
|
|
2748
|
+
keys: args.resumeFrom.keys,
|
|
2749
|
+
priorSpend: args.resumeFrom.priorSpend
|
|
2683
2750
|
} : void 0;
|
|
2684
2751
|
return {
|
|
2685
2752
|
spawn,
|
|
@@ -3506,6 +3573,108 @@ function createBudgetPool(root, now = Date.now) {
|
|
|
3506
3573
|
};
|
|
3507
3574
|
}
|
|
3508
3575
|
//#endregion
|
|
3576
|
+
//#region src/runtime/supervise/finalizer.ts
|
|
3577
|
+
/**
|
|
3578
|
+
* `SupervisorFinalizer` — the pluggable last step of a driver run: how the settled-worker ledger
|
|
3579
|
+
* becomes the run's output. `bestDelivered` (the default) returns the single highest-scoring
|
|
3580
|
+
* DELIVERED child's output; `collectDelivered` returns every verified distinct output with its
|
|
3581
|
+
* provenance — the shape a panel of disagreeing evaluators, a Pareto set, or a competing-hypotheses
|
|
3582
|
+
* record needs. A custom finalizer plugs in through `DriverAgentOptions.finalizer` /
|
|
3583
|
+
* `SuperviseOptions.finalizer`.
|
|
3584
|
+
*
|
|
3585
|
+
* THE INVARIANT the seam enforces, not merely documents: a finalizer operates on structurally
|
|
3586
|
+
* DELIVERED outputs only — children that settled `done` AND passed their completion oracle
|
|
3587
|
+
* (`valid === true`). `runFinalizer` materializes exactly those into `ctx.delivered`, and the
|
|
3588
|
+
* `ctx.blobs` reader it hands over refuses any `outRef` that is not a delivered child's result
|
|
3589
|
+
* (fail loud). An undelivered or invalid child is visible in `ctx.allSettled` as METADATA — a
|
|
3590
|
+
* finalizer can record the disagreement — but its prose is unreachable and it can never become
|
|
3591
|
+
* (or be folded into) the output. Returning `undefined` means "nothing deliverable": the
|
|
3592
|
+
* supervisor types it a no-winner, never a best-effort coercion.
|
|
3593
|
+
*
|
|
3594
|
+
* @experimental
|
|
3595
|
+
*/
|
|
3596
|
+
/**
|
|
3597
|
+
* The tree that describes the WHOLE run: this process's live nodes plus, on a resumed run, the
|
|
3598
|
+
* committed nodes of the prior process(es). Node ids are assigned by the journal and unique across
|
|
3599
|
+
* processes, so the union needs no reconciliation. `inFlight`/`waiting` stay the LIVE counts — a
|
|
3600
|
+
* prior process's in-flight node died with it and is not in flight now.
|
|
3601
|
+
*
|
|
3602
|
+
* Without this, a resumed run reports spend for work whose nodes are missing from its own tree.
|
|
3603
|
+
* On a run that never resumed there is nothing to merge and the live view is returned unchanged.
|
|
3604
|
+
*/
|
|
3605
|
+
function runTree(scope) {
|
|
3606
|
+
const live = scope.view;
|
|
3607
|
+
const prior = scope.resume?.view;
|
|
3608
|
+
if (prior === void 0) return live;
|
|
3609
|
+
const liveIds = new Set(live.nodes.map((n) => n.id));
|
|
3610
|
+
const carried = prior.nodes.filter((n) => !liveIds.has(n.id));
|
|
3611
|
+
if (carried.length === 0) return live;
|
|
3612
|
+
return {
|
|
3613
|
+
...live,
|
|
3614
|
+
nodes: [...carried, ...live.nodes]
|
|
3615
|
+
};
|
|
3616
|
+
}
|
|
3617
|
+
/** The single argmax both the default finalizer and `finalizeBestDelivered` share: highest
|
|
3618
|
+
* score wins, missing scores count 0, ties keep the earliest ledger entry. */
|
|
3619
|
+
function pickBestDelivered(delivered) {
|
|
3620
|
+
let best;
|
|
3621
|
+
for (const w of delivered) if (best === void 0 || (w.score ?? 0) > (best.score ?? 0)) best = w;
|
|
3622
|
+
return best;
|
|
3623
|
+
}
|
|
3624
|
+
/** Keep-best under the completion oracle — the DEFAULT finalizer and the exact behavior every
|
|
3625
|
+
* existing caller had: the highest-scoring delivered child's output, `undefined` when nothing
|
|
3626
|
+
* delivered (or the best delivered child carries no artifact). */
|
|
3627
|
+
const bestDelivered = (ctx) => pickBestDelivered(ctx.delivered)?.out;
|
|
3628
|
+
/**
|
|
3629
|
+
* Every verified distinct output, highest score first — the shape for competing hypotheses, a
|
|
3630
|
+
* Pareto front, or a recorded evaluator split (three judges 2:1 → both outputs survive, with
|
|
3631
|
+
* provenance, instead of the minority report being erased). Distinct by `outRef` (content
|
|
3632
|
+
* address), so identical outputs collapse to one entry. `undefined` when nothing delivered —
|
|
3633
|
+
* an empty collection is a no-winner, not a winner wrapping `[]`.
|
|
3634
|
+
*/
|
|
3635
|
+
const collectDelivered = (ctx) => {
|
|
3636
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3637
|
+
const distinct = [...ctx.delivered].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).filter((w) => {
|
|
3638
|
+
if (w.outRef === void 0 || seen.has(w.outRef)) return false;
|
|
3639
|
+
seen.add(w.outRef);
|
|
3640
|
+
return true;
|
|
3641
|
+
}).map((w) => ({
|
|
3642
|
+
id: w.id,
|
|
3643
|
+
score: w.score,
|
|
3644
|
+
outRef: w.outRef,
|
|
3645
|
+
out: w.out
|
|
3646
|
+
}));
|
|
3647
|
+
return distinct.length > 0 ? distinct : void 0;
|
|
3648
|
+
};
|
|
3649
|
+
/**
|
|
3650
|
+
* Run a finalizer over a settled-worker ledger under the delivered-only invariant: filter the
|
|
3651
|
+
* ledger to structurally delivered children, materialize their outputs, and hand the finalizer a
|
|
3652
|
+
* blob reader that throws on any ref outside that set. This is the one call site both driver arms
|
|
3653
|
+
* (the in-process tool-loop and the MCP-mounted harness) finalize through.
|
|
3654
|
+
*/
|
|
3655
|
+
async function runFinalizer(finalizer, args) {
|
|
3656
|
+
const deliveredRows = args.settled.filter((w) => w.status === "done" && w.valid === true);
|
|
3657
|
+
const deliveredRefs = /* @__PURE__ */ new Set();
|
|
3658
|
+
for (const w of deliveredRows) if (w.outRef !== void 0) deliveredRefs.add(w.outRef);
|
|
3659
|
+
return finalizer({
|
|
3660
|
+
delivered: await Promise.all(deliveredRows.map(async (w) => ({
|
|
3661
|
+
id: w.id,
|
|
3662
|
+
...w.score !== void 0 ? { score: w.score } : {},
|
|
3663
|
+
...w.outRef !== void 0 ? {
|
|
3664
|
+
outRef: w.outRef,
|
|
3665
|
+
out: await args.blobs.get(w.outRef)
|
|
3666
|
+
} : {}
|
|
3667
|
+
}))),
|
|
3668
|
+
allSettled: args.settled,
|
|
3669
|
+
tree: args.tree,
|
|
3670
|
+
blobs: { get: (outRef) => {
|
|
3671
|
+
if (!deliveredRefs.has(outRef)) throw new ValidationError(`finalizer: outRef '${outRef}' is not a DELIVERED child's result — a finalizer may only operate on outputs that settled done and passed their completion oracle`);
|
|
3672
|
+
return args.blobs.get(outRef);
|
|
3673
|
+
} },
|
|
3674
|
+
budget: args.budget
|
|
3675
|
+
});
|
|
3676
|
+
}
|
|
3677
|
+
//#endregion
|
|
3509
3678
|
//#region src/runtime/supervise/supervisor.ts
|
|
3510
3679
|
/**
|
|
3511
3680
|
*
|
|
@@ -3542,6 +3711,32 @@ function createBudgetPool(root, now = Date.now) {
|
|
|
3542
3711
|
*
|
|
3543
3712
|
* @experimental
|
|
3544
3713
|
*/
|
|
3714
|
+
/**
|
|
3715
|
+
* The keyed assignments a prior journal proves: every `spawned` event carrying a `key`, resolved
|
|
3716
|
+
* against the replayed settlements. A key spawned more than once (a retry chain) resolves to its
|
|
3717
|
+
* LATEST attempt — iterate in ordinal order so later spawns overwrite earlier ones. A spawned
|
|
3718
|
+
* event with no matching settlement is `in-doubt`: the process died with it in flight.
|
|
3719
|
+
*/
|
|
3720
|
+
function keyedAssignments(events, settled) {
|
|
3721
|
+
const byId = new Map(settled.map((s) => [s.handle.id, s]));
|
|
3722
|
+
const keys = /* @__PURE__ */ new Map();
|
|
3723
|
+
const spawns = events.filter((ev) => ev.kind === "spawned").sort((a, b) => a.seq - b.seq);
|
|
3724
|
+
for (const ev of spawns) {
|
|
3725
|
+
if (ev.key === void 0) continue;
|
|
3726
|
+
const s = byId.get(ev.id);
|
|
3727
|
+
keys.set(ev.key, s === void 0 ? {
|
|
3728
|
+
id: ev.id,
|
|
3729
|
+
label: ev.label,
|
|
3730
|
+
state: "in-doubt"
|
|
3731
|
+
} : {
|
|
3732
|
+
id: ev.id,
|
|
3733
|
+
label: ev.label,
|
|
3734
|
+
state: s.kind === "done" ? "completed" : "down",
|
|
3735
|
+
settled: s
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3738
|
+
return keys;
|
|
3739
|
+
}
|
|
3545
3740
|
/** Highest `seq` among events matching `pred`, or `-1` when none match (so a resumed scope's
|
|
3546
3741
|
* first new ordinal/seq is 0 — the same start a fresh scope uses). */
|
|
3547
3742
|
function maxSeqOf(events, pred) {
|
|
@@ -3561,15 +3756,19 @@ function createSupervisor() {
|
|
|
3561
3756
|
const prior = opts.resume === true ? await opts.journal.loadTree(opts.runId) : void 0;
|
|
3562
3757
|
const resuming = prior !== void 0 && prior.length > 0;
|
|
3563
3758
|
let resumeFrom;
|
|
3564
|
-
if (resuming)
|
|
3565
|
-
settled
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3759
|
+
if (resuming) {
|
|
3760
|
+
const settled = await replaySpawnTree(opts.journal, opts.blobs, opts.runId);
|
|
3761
|
+
resumeFrom = {
|
|
3762
|
+
settled,
|
|
3763
|
+
view: materializeTreeView(prior),
|
|
3764
|
+
maxSpawnOrdinal: maxSeqOf(prior, (ev) => ev.kind === "spawned"),
|
|
3765
|
+
maxCursorSeq: maxSeqOf(prior, (ev) => ev.kind === "settled" || ev.kind === "cancelled" || ev.kind === "woken"),
|
|
3766
|
+
maxWaitOrdinal: maxSeqOf(prior, (ev) => ev.kind === "waiting"),
|
|
3767
|
+
waits: pendingWaits(prior),
|
|
3768
|
+
keys: keyedAssignments(prior, settled),
|
|
3769
|
+
priorSpend: sumSpendFromEvents(prior)
|
|
3770
|
+
};
|
|
3771
|
+
} else {
|
|
3573
3772
|
await opts.journal.beginTree(opts.runId, new Date(now()).toISOString());
|
|
3574
3773
|
await opts.journal.appendEvent(opts.runId, {
|
|
3575
3774
|
kind: "spawned",
|
|
@@ -3629,7 +3828,7 @@ function createSupervisor() {
|
|
|
3629
3828
|
if (opts.signal) opts.signal.removeEventListener("abort", onCallerAbort);
|
|
3630
3829
|
if (attached) attached.unbind();
|
|
3631
3830
|
}
|
|
3632
|
-
const tree = scope
|
|
3831
|
+
const tree = runTree(scope);
|
|
3633
3832
|
if (actOutcome.ok) {
|
|
3634
3833
|
pool.assertNoOpenTickets();
|
|
3635
3834
|
const out = actOutcome.out;
|
|
@@ -3766,6 +3965,12 @@ function poolExhausted(pool, opts) {
|
|
|
3766
3965
|
async function spentFromJournal(journal, root) {
|
|
3767
3966
|
const events = await journal.loadTree(root);
|
|
3768
3967
|
if (events === void 0) throw new RuntimeRunStateError(`supervisor: spawn tree '${root}' is missing from the journal after run (corrupted log)`);
|
|
3968
|
+
return sumSpendFromEvents(events);
|
|
3969
|
+
}
|
|
3970
|
+
/** Per-channel sum over a journaled event list: `settled` = spawned-child work (reconciled);
|
|
3971
|
+
* `metered` = driver inference (re-homed up the tree, so a single root-tree pass already
|
|
3972
|
+
* includes every nested driver's inference). */
|
|
3973
|
+
function sumSpendFromEvents(events) {
|
|
3769
3974
|
const childWork = {
|
|
3770
3975
|
iterations: 0,
|
|
3771
3976
|
tokens: {
|
|
@@ -3821,6 +4026,6 @@ function isNonEmptySpend(s) {
|
|
|
3821
4026
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0;
|
|
3822
4027
|
}
|
|
3823
4028
|
//#endregion
|
|
3824
|
-
export {
|
|
4029
|
+
export { runSettledCommand as A, notifyRuntimeDecisionPoint as C, routerChatWithUsage as D, routerChatWithTools as E, removeWorktree as F, harnessInvocation as I, parseCodexTokenUsage as L, runWorktreeHarness as M, captureWorktreeDiff as N, routerToolLoop as O, createWorktree as P, runLocalHarness as R, defineRuntimeHooks as S, routerBrain as T, waitUntil as _, runFinalizer as a, readWorkerProgress as b, spendFromUsageEvents as c, settledToIteration as d, createWaitProbes as f, validateWaitSpec as g, timerAt as h, pickBestDelivered as i, runWorktreeChecks as j, runBrainLoop as k, withDriverExecutor as l, pollFor as m, bestDelivered as n, runTree as o, isWaitOutcome as p, collectDelivered as r, createBudgetPool as s, createSupervisor as t, createScope as u, DEFAULT_STALL_AFTER_MS as v, notifyRuntimeHookEvent as w, composeRuntimeHooks as x, createActivityLog as y, CodexExecutionDiagnosticError as z };
|
|
3825
4030
|
|
|
3826
|
-
//# sourceMappingURL=supervisor-
|
|
4031
|
+
//# sourceMappingURL=supervisor-B2LzaWRb.js.map
|