@tangle-network/agent-runtime 0.153.1 → 0.155.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/{activation-DKxQsHiO.js → activation-B4fRz8QL.js} +3 -3
- package/dist/{activation-DKxQsHiO.js.map → activation-B4fRz8QL.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +3 -3
- package/dist/{analyst-loop-B2kTHKNh.js → analyst-loop-Bouu53-l.js} +2 -2
- package/dist/{analyst-loop-B2kTHKNh.js.map → analyst-loop-Bouu53-l.js.map} +1 -1
- package/dist/analyst-loop.js +1 -1
- package/dist/{authoring-Tk2xFys0.js → authoring-8NW3YQvI.js} +2 -2
- package/dist/{authoring-Tk2xFys0.js.map → authoring-8NW3YQvI.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-CB9RJbbJ.js → candidate-execution-Ic92NMl9.js} +4 -4
- package/dist/{candidate-execution-CB9RJbbJ.js.map → candidate-execution-Ic92NMl9.js.map} +1 -1
- package/dist/{conversation-D64WyWrK.js → conversation-DLYKdh6W.js} +28 -13
- package/dist/{conversation-D64WyWrK.js.map → conversation-DLYKdh6W.js.map} +1 -1
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.js +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +3 -6
- package/dist/durable.js.map +1 -1
- package/dist/{environment-provider-DJG0yIYl.d.ts → environment-provider-C_QI6VCG.d.ts} +2 -2
- package/dist/{environment-provider-D_MXw3jK.js → environment-provider-Dz9JB-X_.js} +134 -29
- package/dist/environment-provider-Dz9JB-X_.js.map +1 -0
- package/dist/environment-provider.d.ts +1 -1
- package/dist/environment-provider.js +1 -1
- package/dist/{executable-spec-BUcUcEPk.js → executable-spec-7ovS7PBo.js} +2 -2
- package/dist/{executable-spec-BUcUcEPk.js.map → executable-spec-7ovS7PBo.js.map} +1 -1
- package/dist/{graph-M0Qr4863.js → graph-BCzC-tnl.js} +3 -3
- package/dist/{graph-M0Qr4863.js.map → graph-BCzC-tnl.js.map} +1 -1
- package/dist/{improvement-cycle-CDxlGQGE.js → improvement-cycle-g6RsxGbg.js} +7 -7
- package/dist/{improvement-cycle-CDxlGQGE.js.map → improvement-cycle-g6RsxGbg.js.map} +1 -1
- package/dist/{index-Dlz7ejRx.d.ts → index-CNqUQfuv.d.ts} +13 -8
- package/dist/{index-LQfgFJoX.d.ts → index-DPFUNEdU.d.ts} +6 -4
- package/dist/{index-BihHgUAI.d.ts → index-DU6lU9GO.d.ts} +4 -4
- package/dist/index.d.ts +7 -7
- package/dist/index.js +13 -13
- package/dist/intelligence.d.ts +4 -4
- package/dist/intelligence.js +6 -6
- package/dist/jsonl-file-CDfsCI5s.js +59 -0
- package/dist/jsonl-file-CDfsCI5s.js.map +1 -0
- package/dist/kernel.d.ts +5 -5
- package/dist/kernel.js +10 -10
- package/dist/{knowledge-DM-i40b9.js → knowledge-BDoJh3Me.js} +5 -5
- package/dist/{knowledge-DM-i40b9.js.map → knowledge-BDoJh3Me.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-pD5WJuqJ.js → loop-runner-bin-DyoELXnJ.js} +4 -4
- package/dist/{loop-runner-bin-pD5WJuqJ.js.map → loop-runner-bin-DyoELXnJ.js.map} +1 -1
- package/dist/{loop-runner-bin-D-BW51yr.d.ts → loop-runner-bin-mX79dLj2.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/{materialization-Bo6j3Hg9.js → materialization-Ct3I4wu3.js} +48 -4
- package/dist/materialization-Ct3I4wu3.js.map +1 -0
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +5 -5
- package/dist/{openai-tools-CWBywy-e.js → openai-tools-DUOEbKMV.js} +2 -2
- package/dist/{openai-tools-CWBywy-e.js.map → openai-tools-DUOEbKMV.js.map} +1 -1
- package/dist/{prepare-C3eFd3UA.js → prepare-DcMjMdj-.js} +19 -14
- package/dist/prepare-DcMjMdj-.js.map +1 -0
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-Dn2b6peS.js → protected-model-port-BzUkspPP.js} +2 -2
- package/dist/{protected-model-port-Dn2b6peS.js.map → protected-model-port-BzUkspPP.js.map} +1 -1
- package/dist/{redact-NAptmqKw.d.ts → redact-BT7-mX8G.d.ts} +3 -3
- package/dist/{runtime-RY_rvv7t.js → runtime-DW9t84HW.js} +60 -30
- package/dist/runtime-DW9t84HW.js.map +1 -0
- package/dist/{runtime-B-5dp5Iz.d.ts → runtime-DuueBLeO.d.ts} +4 -4
- package/dist/{sandbox-events-DMijDq2p.js → sandbox-events-BVjstFgb.js} +23 -3
- package/dist/sandbox-events-BVjstFgb.js.map +1 -0
- package/dist/{snapshot-cK9K420n.js → snapshot-CTAf4uuA.js} +8 -3
- package/dist/snapshot-CTAf4uuA.js.map +1 -0
- package/dist/{spawn-journal-CLguaA2A.js → spawn-journal-duo0EkOp.js} +31 -66
- package/dist/spawn-journal-duo0EkOp.js.map +1 -0
- package/dist/{stream-agent-turn-BGyszuPH.d.ts → stream-agent-turn-BbcwWw_J.d.ts} +2 -2
- package/dist/{stream-agent-turn-D6HoaRPV.js → stream-agent-turn-FRZAuXAL.js} +5 -6
- package/dist/stream-agent-turn-FRZAuXAL.js.map +1 -0
- package/dist/{structural-rollout-P1YxFRfl.js → structural-rollout-B1TocSdq.js} +24 -10
- package/dist/structural-rollout-B1TocSdq.js.map +1 -0
- package/dist/{supervise-BezbzKiJ.js → supervise-gZ3xYJs3.js} +54 -127
- package/dist/supervise-gZ3xYJs3.js.map +1 -0
- package/dist/{supervisor-DBVlPONC.js → supervisor-BmXD0WCJ.js} +109 -288
- package/dist/supervisor-BmXD0WCJ.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/{top-app-tKo9OrON.js → top-app-3rYfFPTW.js} +4 -62
- package/dist/top-app-3rYfFPTW.js.map +1 -0
- package/dist/tui/bin.js +1 -1
- package/dist/tui/index.d.ts +0 -1
- package/dist/tui/index.js +1 -1
- package/dist/{types-BPQhQRrC.d.ts → types-Cz5mCGlY.d.ts} +4 -4
- package/dist/{util-Bncw0o_F.js → util-D6ZEuBMi.js} +32 -2
- package/dist/util-D6ZEuBMi.js.map +1 -0
- package/dist/{workspace-archive-Dm73lTfB.js → workspace-archive-bugA3OwU.js} +2 -13
- package/dist/workspace-archive-bugA3OwU.js.map +1 -0
- package/package.json +4 -4
- package/dist/environment-provider-D_MXw3jK.js.map +0 -1
- package/dist/materialization-Bo6j3Hg9.js.map +0 -1
- package/dist/prepare-C3eFd3UA.js.map +0 -1
- package/dist/runtime-RY_rvv7t.js.map +0 -1
- package/dist/sandbox-events-DMijDq2p.js.map +0 -1
- package/dist/snapshot-cK9K420n.js.map +0 -1
- package/dist/spawn-journal-CLguaA2A.js.map +0 -1
- package/dist/stream-agent-turn-D6HoaRPV.js.map +0 -1
- package/dist/structural-rollout-P1YxFRfl.js.map +0 -1
- package/dist/supervise-BezbzKiJ.js.map +0 -1
- package/dist/supervisor-DBVlPONC.js.map +0 -1
- package/dist/top-app-tKo9OrON.js.map +0 -1
- package/dist/util-Bncw0o_F.js.map +0 -1
- package/dist/workspace-archive-Dm73lTfB.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as runtimeOwnedScopeOwnerRuntime, S as runtimeOwnedPendingExecutorMaterialization, b as runtimeOwnedExecutorMaterialization, d as providerAttemptEvidence, f as recordRuntimeOwnedDriveHarnessProviderEvidence, i as attestRuntimeOwnedScopeOwner, s as inheritRuntimeOwnedExecutorAttestation, v as runtimeOwnedDriveHarnessProviderEvidence, x as runtimeOwnedExecutorProviderEvidence, y as runtimeOwnedExecutorExecutionBinding } from "./materialization-Ct3I4wu3.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError, o as NotFoundError, r as BackendTransportError, t as AgentEvalError$1 } from "./errors-CDZ8XsVj.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as chargedTokens } from "./util-
|
|
3
|
+
import { n as detachedSnapshot, t as detachedFrozen } from "./snapshot-CTAf4uuA.js";
|
|
4
|
+
import { b as workerTraceAnalysisStore, i as InMemorySpawnJournal, n as FileSpawnJournal, r as InMemoryResultBlobStore, t as FileResultBlobStore, x as contentAddress, y as parseWorkerToolTraceArtifact } from "./spawn-journal-duo0EkOp.js";
|
|
5
|
+
import { _ as unmeteredSpend, r as chargedTokens, u as promptCacheTokenClasses } from "./util-D6ZEuBMi.js";
|
|
6
|
+
import { i as writeAllBytes, n as parseCommittedJsonLines, r as prepareJsonlAppend, t as isNoEntError } from "./jsonl-file-CDfsCI5s.js";
|
|
6
7
|
import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, f as harnessRunsAgent, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-Sw4ywhtL.js";
|
|
7
|
-
import { B as createExecutorRegistry, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as bridgeRuntimeAttachmentsKey,
|
|
8
|
+
import { B as createExecutorRegistry, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, F as bridgeRuntimeAttachmentsKey, I as bridgeStopSignalKey, L as captureReusableExecutorConfig, Lt as generateSpanId, M as bindReusableExecutorExecutionId, N as bridgeAdmissionRead, O as teardownExecutor, P as bridgeModelRouteRefusal, Pt as createOtelExporter, St as runBrainLoop, U as WORKER_TRACE_PROPAGATION, V as snapshotExecutorConfig, Vt as toOtelAttributes, _n as unsupportedProfileDimensions, a as pickBestDelivered, an as assertProfileMaterialization, c as driverChild, cn as fullProfileMaterialization, d as deriveNodeExecutionIdentity, dn as promptModelProfileMaterialization, dt as isLiveNodeStatus, f as meterRuntimeOwnedAccounting, ft as isTerminalNodeStatus, h as scopeOwnerExecutorNodeContext, hn as renderUnsupported, j as spendFromUsageEvents, jt as buildLoopSpanNodes, k as assertValidBudget, l as withDriverExecutor, ln as profileMaterializationAxes$1, m as recordScopeOwnerMaterialization, n as createSupervisor, nt as createInbox, o as runFinalizer, on as controlProfileMaterialization, p as meterRuntimeOwnedProviderAttempt, r as bestDelivered, s as runTree, sn as defineProfileMaterializationContract, st as createPeerMailbox, t as createRootHandle, un as promptControlProfileMaterialization, w as freeSlots, xt as routerBrain, yn as worktreeCliProfileMaterialization, z as createExecutor } from "./supervisor-BmXD0WCJ.js";
|
|
8
9
|
import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
9
10
|
import { C as writeWorkerCancellation, S as writeRunCancellation, a as readRunCancelRequest, c as readWorkerCancellation, o as readRunCancellation, s as readWorkerCancelRequests } from "./run-layout-C2jgwsCq.js";
|
|
10
11
|
import { t as createStdioToolServer } from "./tool-server-DEmLr9YY.js";
|
|
@@ -200,6 +201,23 @@ const coordinationVerbNames = [
|
|
|
200
201
|
"list_analysts",
|
|
201
202
|
"run_analyst"
|
|
202
203
|
];
|
|
204
|
+
/**
|
|
205
|
+
* The `CoordinationEvent` kinds a driver may name in `await_event`. The pull queue carries the
|
|
206
|
+
* UP-leg only: `steer` / `answer` / `instruction` / `delivery-attempt` are recorded `queue: false`
|
|
207
|
+
* (history and subscribers, never pulled back), and `mail` is delivered to its addressee's inbox.
|
|
208
|
+
*
|
|
209
|
+
* Declared once because the tool advertises this list in its JSON Schema AND filters on it at
|
|
210
|
+
* dispatch. Written twice, the two drift and the schema promises a kind the filter drops — a
|
|
211
|
+
* driver then blocks on a queue that already holds its event.
|
|
212
|
+
*/
|
|
213
|
+
const awaitableEventKinds = [
|
|
214
|
+
"settled",
|
|
215
|
+
"question",
|
|
216
|
+
"finding"
|
|
217
|
+
];
|
|
218
|
+
function isAwaitableEventKind(value) {
|
|
219
|
+
return awaitableEventKinds.includes(value);
|
|
220
|
+
}
|
|
203
221
|
const idArg = {
|
|
204
222
|
type: "string",
|
|
205
223
|
description: "The workerId returned by spawn_agent."
|
|
@@ -362,7 +380,7 @@ let spawnProfileArgCache;
|
|
|
362
380
|
* keeps the conversion total: the canonical schema contains transforms with no JSON Schema form,
|
|
363
381
|
* and zod's default is to throw on them, which would leave the tool with no published shape. */
|
|
364
382
|
function spawnProfileArg() {
|
|
365
|
-
if (!spawnProfileArgCache) spawnProfileArgCache =
|
|
383
|
+
if (!spawnProfileArgCache) spawnProfileArgCache = detachedFrozen(deriveSpawnProfileArg(agentProfileSchema.toJSONSchema({
|
|
366
384
|
io: "input",
|
|
367
385
|
target: "draft-07",
|
|
368
386
|
unrepresentable: "any"
|
|
@@ -414,7 +432,7 @@ function createCoordinationTools(opts) {
|
|
|
414
432
|
trace,
|
|
415
433
|
...resumed ? { resumed: true } : {}
|
|
416
434
|
};
|
|
417
|
-
return
|
|
435
|
+
return detachedFrozen(settled.kind === "done" ? {
|
|
418
436
|
...common,
|
|
419
437
|
status: "done",
|
|
420
438
|
spent: settled.spent,
|
|
@@ -439,7 +457,7 @@ function createCoordinationTools(opts) {
|
|
|
439
457
|
const cb = opts.onEvent;
|
|
440
458
|
bus.subscribe((rec) => cb(rec.event, rec));
|
|
441
459
|
}
|
|
442
|
-
const resumeEvents = opts.replaySettlements ? resumedWorkers.map((worker) =>
|
|
460
|
+
const resumeEvents = opts.replaySettlements ? resumedWorkers.map((worker) => detachedFrozen({
|
|
443
461
|
type: "settled",
|
|
444
462
|
worker
|
|
445
463
|
})) : [];
|
|
@@ -510,7 +528,7 @@ function createCoordinationTools(opts) {
|
|
|
510
528
|
let analystRunOrdinal = 0;
|
|
511
529
|
/** The `finding` event an analyst-agent settlement becomes: its settle OUTPUT is the findings
|
|
512
530
|
* (a failed run publishes the failure as findings — degraded beats vanished). */
|
|
513
|
-
const analystRunFinding = (run, settled) =>
|
|
531
|
+
const analystRunFinding = (run, settled) => detachedFrozen({
|
|
514
532
|
type: "finding",
|
|
515
533
|
finding: canonicalFindingEvent({
|
|
516
534
|
fromWorker: run.sourceWorker,
|
|
@@ -592,10 +610,10 @@ function createCoordinationTools(opts) {
|
|
|
592
610
|
};
|
|
593
611
|
/** The LIVE worker a route destination names, by profile name first, label second. */
|
|
594
612
|
const liveWorkerIdNamed = (destination) => {
|
|
595
|
-
const live = opts.scope.view.nodes.filter((node) =>
|
|
613
|
+
const live = opts.scope.view.nodes.filter((node) => isLiveNodeStatus(node.status));
|
|
596
614
|
return live.find((node) => profileNameByWorker.get(node.id) === destination)?.id ?? live.find((node) => node.label === destination)?.id;
|
|
597
615
|
};
|
|
598
|
-
const liveWorkerForNode = (name) => opts.scope.view.nodes.find((node) =>
|
|
616
|
+
const liveWorkerForNode = (name) => opts.scope.view.nodes.find((node) => isLiveNodeStatus(node.status) && profileNameByWorker.get(node.id) === name)?.id;
|
|
599
617
|
const latestSettledWorkerForNode = (name) => {
|
|
600
618
|
for (let i = ledger.length - 1; i >= 0; i -= 1) {
|
|
601
619
|
const worker = ledger[i];
|
|
@@ -672,7 +690,7 @@ function createCoordinationTools(opts) {
|
|
|
672
690
|
if (targetId === void 0) {
|
|
673
691
|
await bus.publish({
|
|
674
692
|
type: "steer",
|
|
675
|
-
down:
|
|
693
|
+
down: detachedFrozen({
|
|
676
694
|
receiptId: randomUUID(),
|
|
677
695
|
toWorker: destination,
|
|
678
696
|
instruction: text,
|
|
@@ -690,7 +708,7 @@ function createCoordinationTools(opts) {
|
|
|
690
708
|
await recordInstruction(instruction);
|
|
691
709
|
} catch (cause) {
|
|
692
710
|
try {
|
|
693
|
-
await sendDown("steer",
|
|
711
|
+
await sendDown("steer", detachedFrozen({
|
|
694
712
|
receiptId: randomUUID(),
|
|
695
713
|
toWorker: targetId,
|
|
696
714
|
instruction: text,
|
|
@@ -766,7 +784,7 @@ function createCoordinationTools(opts) {
|
|
|
766
784
|
} : {
|
|
767
785
|
settled,
|
|
768
786
|
worker,
|
|
769
|
-
event:
|
|
787
|
+
event: detachedFrozen({
|
|
770
788
|
type: "settled",
|
|
771
789
|
worker
|
|
772
790
|
}),
|
|
@@ -792,7 +810,7 @@ function createCoordinationTools(opts) {
|
|
|
792
810
|
} : {
|
|
793
811
|
settled,
|
|
794
812
|
worker,
|
|
795
|
-
event:
|
|
813
|
+
event: detachedFrozen({
|
|
796
814
|
type: "settled",
|
|
797
815
|
worker
|
|
798
816
|
}),
|
|
@@ -822,7 +840,7 @@ function createCoordinationTools(opts) {
|
|
|
822
840
|
let authorizedInstruction = instruction;
|
|
823
841
|
if (opts.authorizeDownMessage) {
|
|
824
842
|
if (workerIdentity === void 0) throw new Error(`coordination tools: cannot authorize ${kind} for worker ${JSON.stringify(workerId)} without durable identity`);
|
|
825
|
-
const decision =
|
|
843
|
+
const decision = detachedFrozen(opts.authorizeDownMessage(detachedFrozen({
|
|
826
844
|
kind,
|
|
827
845
|
workerId,
|
|
828
846
|
workerIdentity,
|
|
@@ -833,7 +851,7 @@ function createCoordinationTools(opts) {
|
|
|
833
851
|
if (typeof decision !== "object" || decision === null || Array.isArray(decision) || typeof decision.instruction !== "string" || decision.instruction.length === 0) throw new Error("coordination tools: authorizeDownMessage must return an instruction");
|
|
834
852
|
authorizedInstruction = decision.instruction;
|
|
835
853
|
}
|
|
836
|
-
return
|
|
854
|
+
return detachedFrozen({
|
|
837
855
|
receiptId: randomUUID(),
|
|
838
856
|
kind,
|
|
839
857
|
toWorker: workerId,
|
|
@@ -855,7 +873,7 @@ function createCoordinationTools(opts) {
|
|
|
855
873
|
/** Commit delivery intent after the authorization receipt and before `Scope.send`. An attempt with
|
|
856
874
|
* no matching outcome after a crash is explicitly unknown and must never be replayed. */
|
|
857
875
|
const recordDeliveryAttempt = async (instruction) => {
|
|
858
|
-
const attempt =
|
|
876
|
+
const attempt = detachedFrozen({
|
|
859
877
|
receiptId: instruction.receiptId,
|
|
860
878
|
kind: instruction.kind,
|
|
861
879
|
toWorker: instruction.toWorker,
|
|
@@ -874,7 +892,7 @@ function createCoordinationTools(opts) {
|
|
|
874
892
|
if (opts.scope.signal.aborted) return "scope-stopped";
|
|
875
893
|
const node = opts.scope.view.nodes.find((candidate) => candidate.id === workerId);
|
|
876
894
|
if (!node) return "unknown-worker";
|
|
877
|
-
if (!
|
|
895
|
+
if (!isLiveNodeStatus(node.status)) return "already-settled";
|
|
878
896
|
return "runtime-has-no-inbox";
|
|
879
897
|
};
|
|
880
898
|
const attemptDelivery = async (instruction, message, origin) => {
|
|
@@ -889,7 +907,7 @@ function createCoordinationTools(opts) {
|
|
|
889
907
|
outcome = "runtime-error";
|
|
890
908
|
error = cause instanceof Error ? cause.message : String(cause);
|
|
891
909
|
}
|
|
892
|
-
const down =
|
|
910
|
+
const down = detachedFrozen({
|
|
893
911
|
receiptId: instruction.receiptId,
|
|
894
912
|
toWorker: instruction.toWorker,
|
|
895
913
|
instruction: instruction.instruction,
|
|
@@ -1023,8 +1041,7 @@ function createCoordinationTools(opts) {
|
|
|
1023
1041
|
});
|
|
1024
1042
|
};
|
|
1025
1043
|
const maxLiveWorkers = opts.maxLiveWorkers;
|
|
1026
|
-
const
|
|
1027
|
-
const localLiveWorkerCount = () => opts.scope.view.nodes.filter((n) => isLive(n.status)).length;
|
|
1044
|
+
const localLiveWorkerCount = () => opts.scope.view.nodes.filter((n) => isLiveNodeStatus(n.status)).length;
|
|
1028
1045
|
const sharedWorkerCapacity = () => {
|
|
1029
1046
|
return opts.scope.workerCapacity;
|
|
1030
1047
|
};
|
|
@@ -1046,7 +1063,7 @@ function createCoordinationTools(opts) {
|
|
|
1046
1063
|
...node.trace === void 0 ? {} : { trace: node.trace },
|
|
1047
1064
|
...resumed ? { resumed: true } : {}
|
|
1048
1065
|
});
|
|
1049
|
-
const liveSnapshot = () => opts.scope.view.nodes.filter((n) =>
|
|
1066
|
+
const liveSnapshot = () => opts.scope.view.nodes.filter((n) => isLiveNodeStatus(n.status)).map((n) => projectNodeEvidence(n));
|
|
1050
1067
|
const freeWorkerSlots = () => usesTreeWideLimit() ? sharedWorkerCapacity()?.freeSlots ?? null : freeSlots(localLiveWorkerCount(), maxLiveWorkers);
|
|
1051
1068
|
const readProgress = (id) => {
|
|
1052
1069
|
const scope = opts.scope;
|
|
@@ -1190,7 +1207,7 @@ function createCoordinationTools(opts) {
|
|
|
1190
1207
|
message: issue.message
|
|
1191
1208
|
}))
|
|
1192
1209
|
});
|
|
1193
|
-
const profile =
|
|
1210
|
+
const profile = detachedFrozen(parsedProfile.data);
|
|
1194
1211
|
const continuity = resolveContinuity(parseContinuity(a.continuity), profile.name, key);
|
|
1195
1212
|
if ("error" in continuity) return Promise.resolve({
|
|
1196
1213
|
error: continuity.error,
|
|
@@ -1198,7 +1215,7 @@ function createCoordinationTools(opts) {
|
|
|
1198
1215
|
live: liveWorkerCount(),
|
|
1199
1216
|
freeSlots: freeWorkerSlots()
|
|
1200
1217
|
});
|
|
1201
|
-
const task =
|
|
1218
|
+
const task = detachedFrozen(a.task);
|
|
1202
1219
|
const label = typeof a.label === "string" ? a.label : "worker";
|
|
1203
1220
|
if (opts.preflightSpawn) {
|
|
1204
1221
|
const refusal = await opts.preflightSpawn(profile, {
|
|
@@ -1362,18 +1379,14 @@ function createCoordinationTools(opts) {
|
|
|
1362
1379
|
type: "array",
|
|
1363
1380
|
items: {
|
|
1364
1381
|
type: "string",
|
|
1365
|
-
enum: [
|
|
1366
|
-
"settled",
|
|
1367
|
-
"question",
|
|
1368
|
-
"finding"
|
|
1369
|
-
]
|
|
1382
|
+
enum: [...awaitableEventKinds]
|
|
1370
1383
|
},
|
|
1371
1384
|
description: "Restrict to these event kinds (any if omitted)."
|
|
1372
1385
|
} }
|
|
1373
1386
|
},
|
|
1374
1387
|
handler: async (raw) => {
|
|
1375
1388
|
const k = obj(raw).kinds;
|
|
1376
|
-
const kinds = Array.isArray(k) ? k.filter(
|
|
1389
|
+
const kinds = Array.isArray(k) ? k.filter(isAwaitableEventKind) : void 0;
|
|
1377
1390
|
let ev = bus.pull(kinds);
|
|
1378
1391
|
if (ev) return {
|
|
1379
1392
|
...projectEvent(ev),
|
|
@@ -1618,7 +1631,7 @@ function createCoordinationTools(opts) {
|
|
|
1618
1631
|
const id = str(a.workerId, "workerId");
|
|
1619
1632
|
const node = nodeForWorker(id);
|
|
1620
1633
|
if (!node) return { error: `unknown workerId ${JSON.stringify(id)}` };
|
|
1621
|
-
if (
|
|
1634
|
+
if (isLiveNodeStatus(node.status)) return { error: `worker ${JSON.stringify(id)} has not settled — no trace to analyze yet` };
|
|
1622
1635
|
const trace = ledger.find((worker) => worker.id === id)?.trace ?? node.trace ?? {
|
|
1623
1636
|
status: "unavailable",
|
|
1624
1637
|
reason: "legacy-settlement-without-trace-evidence"
|
|
@@ -1637,7 +1650,7 @@ function createCoordinationTools(opts) {
|
|
|
1637
1650
|
});
|
|
1638
1651
|
}
|
|
1639
1652
|
const abortWorker = (ref, reason) => {
|
|
1640
|
-
const live = opts.scope.view.nodes.filter((node) =>
|
|
1653
|
+
const live = opts.scope.view.nodes.filter((node) => isLiveNodeStatus(node.status));
|
|
1641
1654
|
const target = live.find((node) => node.id === ref) ?? live.find((node) => profileNameByWorker.get(node.id) === ref) ?? live.find((node) => node.label === ref);
|
|
1642
1655
|
if (target === void 0) return void 0;
|
|
1643
1656
|
const handle = liveHandles.get(target.id);
|
|
@@ -1686,9 +1699,6 @@ function nextUnkeyedAssignmentOrdinal(scope) {
|
|
|
1686
1699
|
if (!Number.isSafeInteger(next)) throw new Error("coordination: durable assignment ordinal space is exhausted");
|
|
1687
1700
|
return next;
|
|
1688
1701
|
}
|
|
1689
|
-
function deepFreezeDetached(value) {
|
|
1690
|
-
return deepFreeze(structuredClone(value));
|
|
1691
|
-
}
|
|
1692
1702
|
/** Stringify a findings payload for a routed delivery; never throws (a cyclic payload degrades to
|
|
1693
1703
|
* its String form rather than killing the settle path). */
|
|
1694
1704
|
function safeJsonText(value) {
|
|
@@ -1699,12 +1709,6 @@ function safeJsonText(value) {
|
|
|
1699
1709
|
return String(value);
|
|
1700
1710
|
}
|
|
1701
1711
|
}
|
|
1702
|
-
function deepFreeze(value, seen = /* @__PURE__ */ new Set()) {
|
|
1703
|
-
if (value === null || typeof value !== "object" || seen.has(value)) return value;
|
|
1704
|
-
seen.add(value);
|
|
1705
|
-
for (const child of Object.values(value)) deepFreeze(child, seen);
|
|
1706
|
-
return Object.freeze(value);
|
|
1707
|
-
}
|
|
1708
1712
|
//#endregion
|
|
1709
1713
|
//#region src/runtime/supervise/completion-gate.ts
|
|
1710
1714
|
/**
|
|
@@ -2283,9 +2287,6 @@ function emptyPriorCoordination(ownerId) {
|
|
|
2283
2287
|
records: []
|
|
2284
2288
|
};
|
|
2285
2289
|
}
|
|
2286
|
-
function isNoEntError(err) {
|
|
2287
|
-
return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
|
|
2288
|
-
}
|
|
2289
2290
|
//#endregion
|
|
2290
2291
|
//#region src/runtime/supervise/run-context.ts
|
|
2291
2292
|
/**
|
|
@@ -2570,7 +2571,7 @@ function createProgressTracker(opts = {}) {
|
|
|
2570
2571
|
const treeView = scope?.view;
|
|
2571
2572
|
const workers = [];
|
|
2572
2573
|
if (scope && treeView) for (const node of treeView.nodes) {
|
|
2573
|
-
if (node.status
|
|
2574
|
+
if (isTerminalNodeStatus(node.status)) continue;
|
|
2574
2575
|
if (node.status === "waiting") continue;
|
|
2575
2576
|
const p = scope.progress(node.id, viewOpts?.stallAfterMs !== void 0 ? {
|
|
2576
2577
|
now: now(),
|
|
@@ -2795,20 +2796,6 @@ function deadlinePassed(scope, now) {
|
|
|
2795
2796
|
const b = scope.budget;
|
|
2796
2797
|
return b.deadlineMs > 0 && now() >= b.deadlineMs;
|
|
2797
2798
|
}
|
|
2798
|
-
function providerAttemptEvidence$1(model) {
|
|
2799
|
-
const attempts = Object.freeze([Object.freeze({ observations: Object.freeze(model === void 0 ? [] : [model]) })]);
|
|
2800
|
-
const models = Object.freeze(model === void 0 ? [] : [model]);
|
|
2801
|
-
return Object.freeze(model === void 0 ? {
|
|
2802
|
-
status: "unknown",
|
|
2803
|
-
attempts,
|
|
2804
|
-
models,
|
|
2805
|
-
reason: "provider-model-missing"
|
|
2806
|
-
} : {
|
|
2807
|
-
status: "known",
|
|
2808
|
-
attempts,
|
|
2809
|
-
models
|
|
2810
|
-
});
|
|
2811
|
-
}
|
|
2812
2799
|
/** The USD-denominated members of {@link PromptCacheUsage} — the schema, not a guess. Every
|
|
2813
2800
|
* other known member (`readTokens`, `writeTokens`, `missTokens`) is a token COUNT. */
|
|
2814
2801
|
const PROMPT_CACHE_USD_FIELDS = /* @__PURE__ */ new Set(["readSavingsUsd"]);
|
|
@@ -2916,7 +2903,7 @@ function createCancelAcknowledger(deps) {
|
|
|
2916
2903
|
});
|
|
2917
2904
|
return;
|
|
2918
2905
|
}
|
|
2919
|
-
const goneId = deps.scope.view.nodes.find((n) => (n.id === request.worker || n.label === request.worker) && (n.status
|
|
2906
|
+
const goneId = deps.scope.view.nodes.find((n) => (n.id === request.worker || n.label === request.worker) && isTerminalNodeStatus(n.status))?.id ?? deps.coord.settled().find((w) => w.id === request.worker)?.id;
|
|
2920
2907
|
if (goneId !== void 0) write({
|
|
2921
2908
|
...base,
|
|
2922
2909
|
effect: "not_live",
|
|
@@ -3204,17 +3191,7 @@ function driverAgent(opts) {
|
|
|
3204
3191
|
res = await opts.brain(messages, tools, callContext);
|
|
3205
3192
|
} catch (error) {
|
|
3206
3193
|
opts.onProviderModel?.(void 0);
|
|
3207
|
-
await meterRuntimeOwnedProviderAttempt(scope, {
|
|
3208
|
-
iterations: 0,
|
|
3209
|
-
tokens: {
|
|
3210
|
-
input: 0,
|
|
3211
|
-
output: 0
|
|
3212
|
-
},
|
|
3213
|
-
tokensKnown: false,
|
|
3214
|
-
usd: 0,
|
|
3215
|
-
usdKnown: false,
|
|
3216
|
-
ms: 0
|
|
3217
|
-
}, providerAttemptEvidence$1(void 0), {
|
|
3194
|
+
await meterRuntimeOwnedProviderAttempt(scope, unmeteredSpend(0), providerAttemptEvidence(void 0), {
|
|
3218
3195
|
driver: opts.name,
|
|
3219
3196
|
inferenceFailed: true,
|
|
3220
3197
|
call,
|
|
@@ -3233,7 +3210,7 @@ function driverAgent(opts) {
|
|
|
3233
3210
|
if (res.transportAttempts !== void 0 && (!Number.isSafeInteger(res.transportAttempts) || res.transportAttempts < 1)) evidenceError = new ValidationError("driverAgent: transportAttempts must be a positive safe integer when reported");
|
|
3234
3211
|
evidenceError = validateDriverPromptCache(res.promptCache) ?? evidenceError;
|
|
3235
3212
|
const trustedCost = res.costProvenance === "provider-receipt" || res.costProvenance === "billing-receipt";
|
|
3236
|
-
const cacheUsage =
|
|
3213
|
+
const cacheUsage = promptCacheTokenClasses(res.usage?.input, res.promptCache);
|
|
3237
3214
|
await meterRuntimeOwnedProviderAttempt(scope, {
|
|
3238
3215
|
iterations: 0,
|
|
3239
3216
|
tokens: {
|
|
@@ -3245,7 +3222,7 @@ function driverAgent(opts) {
|
|
|
3245
3222
|
usd: trustedCost ? res.costUsd ?? 0 : 0,
|
|
3246
3223
|
...trustedCost && res.costUsd !== void 0 ? {} : { usdKnown: false },
|
|
3247
3224
|
ms: 0
|
|
3248
|
-
}, providerAttemptEvidence
|
|
3225
|
+
}, providerAttemptEvidence(res.model), {
|
|
3249
3226
|
driver: opts.name,
|
|
3250
3227
|
call,
|
|
3251
3228
|
callId: callContext.callId,
|
|
@@ -3441,22 +3418,6 @@ async function finalizeBestDelivered(settled, blobs) {
|
|
|
3441
3418
|
if (best === void 0) return void 0;
|
|
3442
3419
|
return best.outRef ? await blobs.get(best.outRef) : void 0;
|
|
3443
3420
|
}
|
|
3444
|
-
/** Preserve a complete provider cache split; any partial split remains explicitly unknown. */
|
|
3445
|
-
function driverPromptCacheUsage(input, promptCache) {
|
|
3446
|
-
if (promptCache === void 0) return {};
|
|
3447
|
-
const read = promptCache.readTokens;
|
|
3448
|
-
const write = promptCache.writeTokens;
|
|
3449
|
-
if (!(read !== void 0 || write !== void 0)) return {};
|
|
3450
|
-
if (input === void 0 || !isTokenCount(read) || !isTokenCount(write) || read + write > input) return { cacheBreakdownKnown: false };
|
|
3451
|
-
return {
|
|
3452
|
-
freshInput: input - read - write,
|
|
3453
|
-
cacheRead: read,
|
|
3454
|
-
cacheWrite: write
|
|
3455
|
-
};
|
|
3456
|
-
}
|
|
3457
|
-
function isTokenCount(value) {
|
|
3458
|
-
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
3459
|
-
}
|
|
3460
3421
|
function stringifyTask(task) {
|
|
3461
3422
|
return typeof task === "string" ? task : safeJson(task);
|
|
3462
3423
|
}
|
|
@@ -6583,33 +6544,13 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
6583
6544
|
if (failed && started && !terminalAccountingCaptured) try {
|
|
6584
6545
|
for (;;) {
|
|
6585
6546
|
if ((runtimeOwnedExecutorProviderEvidence(executor)?.attempts.length ?? 0) <= meteredProviderAttempts) break;
|
|
6586
|
-
await meterRuntimeOwnedProviderAttempt(scope, {
|
|
6587
|
-
iterations: 0,
|
|
6588
|
-
tokens: {
|
|
6589
|
-
input: 0,
|
|
6590
|
-
output: 0
|
|
6591
|
-
},
|
|
6592
|
-
tokensKnown: false,
|
|
6593
|
-
usd: 0,
|
|
6594
|
-
usdKnown: false,
|
|
6595
|
-
ms: 0
|
|
6596
|
-
}, providerEvidenceForNextMeter(), {
|
|
6547
|
+
await meterRuntimeOwnedProviderAttempt(scope, unmeteredSpend(0), providerEvidenceForNextMeter(), {
|
|
6597
6548
|
role: "driver",
|
|
6598
6549
|
runtime: executor.runtime,
|
|
6599
6550
|
telemetry: "unknown-after-failure"
|
|
6600
6551
|
});
|
|
6601
6552
|
}
|
|
6602
|
-
if (meteredProviderAttempts === 0) await meterRuntimeOwnedProviderAttempt(scope, {
|
|
6603
|
-
iterations: 0,
|
|
6604
|
-
tokens: {
|
|
6605
|
-
input: 0,
|
|
6606
|
-
output: 0
|
|
6607
|
-
},
|
|
6608
|
-
tokensKnown: false,
|
|
6609
|
-
usd: 0,
|
|
6610
|
-
usdKnown: false,
|
|
6611
|
-
ms: 0
|
|
6612
|
-
}, providerEvidenceForNextMeter(), {
|
|
6553
|
+
if (meteredProviderAttempts === 0) await meterRuntimeOwnedProviderAttempt(scope, unmeteredSpend(0), providerEvidenceForNextMeter(), {
|
|
6613
6554
|
role: "driver",
|
|
6614
6555
|
runtime: executor.runtime,
|
|
6615
6556
|
telemetry: "unknown-after-failure"
|
|
@@ -6640,20 +6581,6 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
6640
6581
|
function isAsyncIterable(value) {
|
|
6641
6582
|
return value !== null && typeof value === "object" && Symbol.asyncIterator in value && typeof value[Symbol.asyncIterator] === "function";
|
|
6642
6583
|
}
|
|
6643
|
-
function providerAttemptEvidence(model) {
|
|
6644
|
-
const attempts = Object.freeze([Object.freeze({ observations: Object.freeze(model === void 0 ? [] : [model]) })]);
|
|
6645
|
-
const models = Object.freeze(model === void 0 ? [] : [model]);
|
|
6646
|
-
return Object.freeze(model === void 0 ? {
|
|
6647
|
-
status: "unknown",
|
|
6648
|
-
attempts,
|
|
6649
|
-
models,
|
|
6650
|
-
reason: "provider-model-missing"
|
|
6651
|
-
} : {
|
|
6652
|
-
status: "known",
|
|
6653
|
-
attempts,
|
|
6654
|
-
models
|
|
6655
|
-
});
|
|
6656
|
-
}
|
|
6657
6584
|
/** Resolve one option that may be given as a value OR as a name into `opts.registry`. Both failure
|
|
6658
6585
|
* modes name the option, the requested name, and the table it was looked up in — a typo must not
|
|
6659
6586
|
* degrade into a silently unconfigured run (which for `deliverable` means "no run can ever
|
|
@@ -7245,4 +7172,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
7245
7172
|
//#endregion
|
|
7246
7173
|
export { DELEGATION_TRACE_MAX_BYTES as $, DELEGATION_HISTORY_INPUT_SCHEMA as A, mapExecutorResult as At, DELEGATE_FEEDBACK_INPUT_SCHEMA as B, createMcpServer as C, plateauLength as Ct, createDelegationStatusHandler as D, FileCoordinationLog as Dt, DELEGATION_STATUS_TOOL_NAME as E, createInMemoryRunContext as Et, DELEGATE_UI_AUDIT_INPUT_SCHEMA as F, createEventBus as Ft, DELEGATE_INPUT_SCHEMA as G, createDelegateFeedbackHandler as H, DELEGATE_UI_AUDIT_TOOL_NAME as I, defaultToolDetectors as It, validateDelegateArgs as J, DELEGATE_TOOL_NAME as K, createDelegateUiAuditHandler as L, watchTrace as Lt, createDelegationHistoryHandler as M, canonicalFindingEvent as Mt, validateDelegationHistoryArgs as N, createCoordinationTools as Nt, validateDelegationStatusArgs as O, createSupervisorSpanRecorder as Ot, DELEGATE_UI_AUDIT_DESCRIPTION as P, normalizeAnalyzeOnSettle as Pt, hashIdempotencyInput as Q, validateDelegateUiAuditArgs as R, createInProcessTransport as S, bestSoFar as St, DELEGATION_STATUS_INPUT_SCHEMA as T, createFileRunContext as Tt, validateDelegateFeedbackArgs as U, DELEGATE_FEEDBACK_TOOL_NAME as V, DELEGATE_DESCRIPTION as W, delegate as X, defaultDelegateBudget as Y, DelegationTaskQueue as Z, promptHandle as _, noProgressFor as _t, assertCoordinationBinding as a, DelegationPersistenceError as at, classifyDriverFailure as b, anytimeReport as bt, supervisorAgentWithTestBrain as c, InMemoryDelegationStore as ct, delegatesWorkerBriefPrompt as d, driverAgent as dt, DELEGATION_TRACE_MAX_SPANS as et, dumbContinuationFailPrompt as f, finalizeBestDelivered as ft, naiveContinuationPrompt as g, createProgressTracker as gt, kernelPromptRegistry as h, anyOf as ht, workerFromBackend as i, createDelegationTraceCollector as it, DELEGATION_HISTORY_TOOL_NAME as j, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as jt, DELEGATION_HISTORY_DESCRIPTION as k, gateOnDeliverable as kt, analyzesFindingsReportPrompt as l, InMemoryFeedbackStore as lt, formatPromptHandle as m, allWorkersStalled as mt, supervise as n, capDelegationTrace as nt, resolveSupervisorProfile as o, DelegationStateCorruptError as ot, dumbContinuationPassPrompt as p, allOf as pt, createDelegateHandler as q, superviseWithTestBrain as r, composeLoopTraceEmitters as rt, supervisorAgent as s, FileDelegationStore as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, buildDelegationTraceSpans as tt, createPromptRegistry as u, eventToSnapshot as ut, supervisorPolicyPrompt as v, plateau as vt, DELEGATION_STATUS_DESCRIPTION as w, renderAnytimeTable as wt, serveCoordinationMcp as x, areaUnderCurve as xt, DriverAttemptsExhaustedError as y, sampleFromSettled as yt, DELEGATE_FEEDBACK_DESCRIPTION as z };
|
|
7247
7174
|
|
|
7248
|
-
//# sourceMappingURL=supervise-
|
|
7175
|
+
//# sourceMappingURL=supervise-gZ3xYJs3.js.map
|