@tangle-network/agent-runtime 0.208.1 → 0.209.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-B86jXbpE.js → activation-Cjhm5Tds.js} +2 -2
- package/dist/{activation-B86jXbpE.js.map → activation-Cjhm5Tds.js.map} +1 -1
- package/dist/{activation-Dan50rKs.d.ts → activation-tFdeirCa.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-D9dbnSA0.js → coordination-driver-C-hPz1zy.js} +33 -6
- package/dist/coordination-driver-C-hPz1zy.js.map +1 -0
- package/dist/{delegate-DP3QsLAy.js → delegate-CB4CkJdV.js} +2 -2
- package/dist/{delegate-DP3QsLAy.js.map → delegate-CB4CkJdV.js.map} +1 -1
- package/dist/durable.d.ts +2 -2
- package/dist/durable.js +2 -2
- package/dist/{graph-BXa0AN64.js → graph-Ud2-Ytos.js} +3 -3
- package/dist/{graph-BXa0AN64.js.map → graph-Ud2-Ytos.js.map} +1 -1
- package/dist/{improvement-cycle-BFg94oh7.js → improvement-cycle-B7ia6rTj.js} +3 -3
- package/dist/{improvement-cycle-BFg94oh7.js.map → improvement-cycle-B7ia6rTj.js.map} +1 -1
- package/dist/{index-CHkf3b2C.d.ts → index-0p5DiJoy.d.ts} +3 -124
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +8 -8
- package/dist/{loop-runner-bin-Cv-sYY_b.js → loop-runner-bin-B30d3Yla.js} +3 -3
- package/dist/{loop-runner-bin-Cv-sYY_b.js.map → loop-runner-bin-B30d3Yla.js.map} +1 -1
- package/dist/{loop-runner-bin-BUVcdgNU.d.ts → loop-runner-bin-q-xGzEK9.d.ts} +3 -3
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +4 -4
- package/dist/{provision-supervisor-DARqIVIZ.js → provision-supervisor-C-nLaaQ_.js} +3 -3
- package/dist/{provision-supervisor-DARqIVIZ.js.map → provision-supervisor-C-nLaaQ_.js.map} +1 -1
- package/dist/{redact-DXxGazcg.js → redact-va_1mmv8.js} +256 -35
- package/dist/redact-va_1mmv8.js.map +1 -0
- package/dist/{runtime-DXz65UHu.js → runtime-D0_b9wFH.js} +12 -8
- package/dist/{runtime-DXz65UHu.js.map → runtime-D0_b9wFH.js.map} +1 -1
- package/dist/{server-DLxegwGE.js → server-pq1x3C2i.js} +3 -3
- package/dist/{server-DLxegwGE.js.map → server-pq1x3C2i.js.map} +1 -1
- package/dist/{stream-agent-turn-B3NfR48z.d.ts → stream-agent-turn-BaKYHbHg.d.ts} +161 -20
- package/dist/{structural-rollout-D3Su8Dla.js → structural-rollout-BaYBLUeI.js} +2 -2
- package/dist/{structural-rollout-D3Su8Dla.js.map → structural-rollout-BaYBLUeI.js.map} +1 -1
- package/dist/{supervise-B5kRyFJj.js → supervise-CMWpmY_1.js} +54 -16
- package/dist/supervise-CMWpmY_1.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +4 -4
- package/dist/coordination-driver-D9dbnSA0.js.map +0 -1
- package/dist/redact-DXxGazcg.js.map +0 -1
- package/dist/supervise-B5kRyFJj.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as bridgeAdmissionRefusal, $t as spendFromUsageEvents, A as consumeScopeRetainedOwnerResult, Ar as
|
|
1
|
+
import { $ as bridgeAdmissionRefusal, $r as inheritRuntimeOwnedExecutorAttestation, $t as spendFromUsageEvents, A as consumeScopeRetainedOwnerResult, Ar as assertProfileMaterialization, Br as renderUnsupported, Ct as createInbox, Fn as RunCancellationReason, Fr as promptControlProfileMaterialization, Hr as unsupportedProfileDimensions, Ir as promptModelProfileMaterialization, M as scopeRetainedOwnerContext, Mn as zeroSpend, Mr as defineProfileMaterializationContract, N as scopeRetainedOwnerPriorSpend, Nn as registerRetainedExecutorPreparation, Nr as fullProfileMaterialization, P as scopeRetainedOwnerResult, Pn as retainedExecutorSeamKey, Pr as profileMaterializationAxes$1, Q as bindReusableExecutorExecutionId, S as scopeOwnerExecutorNodeContext, Wr as worktreeCliProfileMaterialization, X as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, Xr as attestRuntimeOwnedScopeOwner, Xt as contentAddress, Z as teardownExecutor, Zt as assertValidBudget, _ as deriveNodeExecutionIdentity, _n as resolveAgentEnvironmentProvider, _r as withBudgetResources, a as createSupervisor, ai as runtimeOwnedDriveHarnessProviderEvidence, ar as generateSpanId, b as recordScopeOwnerMaterialization, ci as runtimeOwnedExecutorProviderEvidence, ct as snapshotExecutorConfig, d as driverChild, et as bridgeModelRouteRefusal, f as driverExecutorFactory, gi as detachedSnapshot, gr as resourceTelemetry, h as beginScopeOwnerAttempt, hr as addResourceSpend, i as createRootHandle, ii as recordRuntimeOwnedDriveHarnessProviderEvidence, j as prepareScopeRetainedOwnerTask, jn as unmeteredSpend, jr as controlProfileMaterialization, l as runFinalizer, li as runtimeOwnedPendingExecutorMaterialization, lr as toOtelAttributes, nr as createOtelExporter, nt as bridgeStopSignalKey, o as bestDelivered, oi as runtimeOwnedExecutorExecutionBinding, ot as createExecutor, p as isDriverSpec, ri as providerAttemptEvidence, rt as captureReusableExecutorConfig, si as runtimeOwnedExecutorMaterialization, tt as bridgeRuntimeAttachmentsKey, u as runTree, ui as runtimeOwnedScopeOwnerRuntime, un as routerBrain, ut as WORKER_TRACE_PROPAGATION, v as meterRuntimeOwnedAccounting, x as restoreScopeOwnerAcceptedExecution, y as meterRuntimeOwnedProviderAttempt, yn as addSpend } from "./redact-va_1mmv8.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError, r as BackendTransportError, t as AgentEvalError } from "./errors-DodWX-cb.js";
|
|
3
3
|
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-DKDyr-fc.js";
|
|
4
4
|
import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
5
5
|
import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-hZREkcfu.js";
|
|
6
|
-
import { C as createCoordinationTools, F as watchRunCancellation, M as createInMemoryRunContext, P as applyRunCancellation, S as coordinationVerbNames, c as createProgressTracker, d as progressStop, j as createFileRunContext, r as driverAgent } from "./coordination-driver-
|
|
6
|
+
import { C as createCoordinationTools, F as watchRunCancellation, M as createInMemoryRunContext, P as applyRunCancellation, S as coordinationVerbNames, c as createProgressTracker, d as progressStop, j as createFileRunContext, r as driverAgent } from "./coordination-driver-C-hPz1zy.js";
|
|
7
7
|
import { t as createStdioToolServer } from "./tool-server-BJbCPhoW.js";
|
|
8
8
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
9
9
|
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -1068,6 +1068,7 @@ function budgetStop(budget, atMs) {
|
|
|
1068
1068
|
if (budget.tokensLeft <= 0 || budget.iterationsLeft <= 0) return "budget-exhausted";
|
|
1069
1069
|
if (budget.usdCapped && budget.usdLeft <= 0) return "budget-exhausted";
|
|
1070
1070
|
if (budget.usdCapped && budget.usdKnown === false) return "budget-exhausted";
|
|
1071
|
+
if (Object.values(budget.resources ?? {}).some((resource) => !resource.known || resource.remaining <= 0)) return "budget-exhausted";
|
|
1071
1072
|
}
|
|
1072
1073
|
function contractOf(mark) {
|
|
1073
1074
|
return mark.contract ?? "none";
|
|
@@ -2393,7 +2394,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2393
2394
|
return;
|
|
2394
2395
|
}
|
|
2395
2396
|
const initialBudget = scope.budget;
|
|
2396
|
-
if (!(scope.view.inFlight > 0 || scope.view.waiting > 0) && (initialBudget.tokensLeft <= 0 || initialBudget.iterationsLeft <= 0 || initialBudget.usdCapped && initialBudget.usdLeft <= 0 || initialBudget.deadlineMs > 0 && now() >= initialBudget.deadlineMs)) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
|
|
2397
|
+
if (!(scope.view.inFlight > 0 || scope.view.waiting > 0) && (initialBudget.tokensLeft <= 0 || initialBudget.iterationsLeft <= 0 || initialBudget.usdCapped && initialBudget.usdLeft <= 0 || Object.values(initialBudget.resources ?? {}).some((resource) => !resource.known || resource.remaining <= 0) || initialBudget.deadlineMs > 0 && now() >= initialBudget.deadlineMs)) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
|
|
2397
2398
|
const canonicalDriverProfile = agentProfileSchema.parse(authoredProfile);
|
|
2398
2399
|
assertNoReservedCoordinationMcpAlias(canonicalDriverProfile, "driveHarnessFromBackend");
|
|
2399
2400
|
const stableCoordinationTools = detachedSnapshot(coordinationTools, "driveHarnessFromBackend coordination tools");
|
|
@@ -2462,6 +2463,15 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2462
2463
|
let observedOwnerSpend = zeroSpend();
|
|
2463
2464
|
let committedOwnerSpend = retainedOwner ? await scopeRetainedOwnerPriorSpend(scope) : zeroSpend();
|
|
2464
2465
|
const ownerDelta = (total) => ({
|
|
2466
|
+
...addResourceSpend(total.resources === void 0 ? void 0 : Object.fromEntries(Object.entries(total.resources).map(([name, value]) => {
|
|
2467
|
+
const prior = committedOwnerSpend.resources?.[name];
|
|
2468
|
+
if (prior && prior.unit !== value.unit) throw new ValidationError(`resource ${name}: unit mismatch`);
|
|
2469
|
+
return [name, {
|
|
2470
|
+
...value,
|
|
2471
|
+
amount: Math.max(0, value.amount - (prior?.amount ?? 0)),
|
|
2472
|
+
known: value.known && (prior?.known ?? true)
|
|
2473
|
+
}];
|
|
2474
|
+
}))),
|
|
2465
2475
|
iterations: Math.max(0, total.iterations - committedOwnerSpend.iterations),
|
|
2466
2476
|
tokens: {
|
|
2467
2477
|
input: Math.max(0, total.tokens.input - committedOwnerSpend.tokens.input),
|
|
@@ -2526,7 +2536,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2526
2536
|
});
|
|
2527
2537
|
if (retainedOwner) committedOwnerSpend = addSpend(committedOwnerSpend, charge);
|
|
2528
2538
|
const budget = scope.budget;
|
|
2529
|
-
if (budget.tokensLeft <= 0 || budget.usdCapped && budget.usdLeft <= 0 || budget.deadlineMs > 0 && now() >= budget.deadlineMs) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
|
|
2539
|
+
if (budget.tokensLeft <= 0 || budget.usdCapped && budget.usdLeft <= 0 || Object.values(budget.resources ?? {}).some((resource) => !resource.known || resource.remaining <= 0) || budget.deadlineMs > 0 && now() >= budget.deadlineMs) throw new ValidationError("driveHarnessFromBackend: supervisor budget exhausted");
|
|
2530
2540
|
};
|
|
2531
2541
|
const pending = runtimeOwnedPendingExecutorMaterialization(executor);
|
|
2532
2542
|
let failed = false;
|
|
@@ -2567,10 +2577,11 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2567
2577
|
ownerMaterializationPublished = true;
|
|
2568
2578
|
}
|
|
2569
2579
|
await meterPending();
|
|
2570
|
-
const total = {
|
|
2580
|
+
const total = withBudgetResources({
|
|
2571
2581
|
...result.spent,
|
|
2582
|
+
...resourceTelemetry(observedOwnerSpend, result.spent),
|
|
2572
2583
|
iterations: 0
|
|
2573
|
-
};
|
|
2584
|
+
}, scope.budget);
|
|
2574
2585
|
const delta = ownerDelta(total);
|
|
2575
2586
|
await meterRuntimeOwnedAccounting(scope, delta, {
|
|
2576
2587
|
role: "driver",
|
|
@@ -2604,8 +2615,16 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2604
2615
|
} else if (event.kind !== "progress") pendingUsage.push(event);
|
|
2605
2616
|
await meterPending();
|
|
2606
2617
|
const artifact = executor.resultArtifact();
|
|
2607
|
-
|
|
2608
|
-
|
|
2618
|
+
const terminalResources = withBudgetResources({
|
|
2619
|
+
...artifact.spent,
|
|
2620
|
+
...resourceTelemetry(observedOwnerSpend, artifact.spent)
|
|
2621
|
+
}, scope.budget).resources;
|
|
2622
|
+
const resourceCorrection = addResourceSpend(terminalResources === void 0 ? void 0 : Object.fromEntries(Object.entries(terminalResources).map(([name, value]) => [name, {
|
|
2623
|
+
...value,
|
|
2624
|
+
amount: Math.max(0, value.amount - (observedOwnerSpend.resources?.[name]?.amount ?? 0))
|
|
2625
|
+
}])));
|
|
2626
|
+
if (!retainedOwner && (artifact.spent.tokensKnown === false || artifact.spent.usdKnown === false || resourceCorrection.resources !== void 0)) await meterRuntimeOwnedAccounting(scope, {
|
|
2627
|
+
...resourceCorrection,
|
|
2609
2628
|
iterations: 0,
|
|
2610
2629
|
tokens: {
|
|
2611
2630
|
input: 0,
|
|
@@ -2620,16 +2639,16 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2620
2639
|
runtime: executor.runtime,
|
|
2621
2640
|
telemetry: "unknown"
|
|
2622
2641
|
});
|
|
2623
|
-
} else {
|
|
2624
|
-
const artifact = await run;
|
|
2625
2642
|
terminalAccountingCaptured = true;
|
|
2626
|
-
|
|
2627
|
-
|
|
2643
|
+
} else {
|
|
2644
|
+
await meterRuntimeOwnedProviderAttempt(scope, withBudgetResources({
|
|
2645
|
+
...(await run).spent,
|
|
2628
2646
|
iterations: 0
|
|
2629
|
-
}, providerEvidenceForNextMeter(), {
|
|
2647
|
+
}, scope.budget), providerEvidenceForNextMeter(), {
|
|
2630
2648
|
role: "driver",
|
|
2631
2649
|
runtime: executor.runtime
|
|
2632
2650
|
});
|
|
2651
|
+
terminalAccountingCaptured = true;
|
|
2633
2652
|
}
|
|
2634
2653
|
if (pending !== void 0 && !ownerMaterializationPublished) {
|
|
2635
2654
|
const acknowledged = runtimeOwnedExecutorMaterialization(executor);
|
|
@@ -2670,13 +2689,20 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns)
|
|
|
2670
2689
|
const evidence = runtimeOwnedExecutorProviderEvidence(executor);
|
|
2671
2690
|
if ((evidence?.attempts.length ?? 0) <= meteredProviderAttempts) break;
|
|
2672
2691
|
const providerDispatchDidNotStart = evidence?.attempts[meteredProviderAttempts]?.providerDispatch === "not_started";
|
|
2673
|
-
await meterRuntimeOwnedProviderAttempt(scope, providerDispatchDidNotStart ? zeroSpend() : unmeteredSpend(0), providerEvidenceForNextMeter(), {
|
|
2692
|
+
await meterRuntimeOwnedProviderAttempt(scope, withBudgetResources(providerDispatchDidNotStart ? zeroSpend() : unmeteredSpend(0), scope.budget, providerDispatchDidNotStart), providerEvidenceForNextMeter(), {
|
|
2674
2693
|
role: "driver",
|
|
2675
2694
|
runtime: executor.runtime,
|
|
2676
2695
|
telemetry: providerDispatchDidNotStart ? "known-zero-before-dispatch" : "unknown-after-failure"
|
|
2677
2696
|
});
|
|
2678
2697
|
}
|
|
2679
|
-
if (meteredProviderAttempts === 0) await meterRuntimeOwnedProviderAttempt(scope, unmeteredSpend(0), providerEvidenceForNextMeter(), {
|
|
2698
|
+
if (meteredProviderAttempts === 0) await meterRuntimeOwnedProviderAttempt(scope, withBudgetResources(unmeteredSpend(0), scope.budget), providerEvidenceForNextMeter(), {
|
|
2699
|
+
role: "driver",
|
|
2700
|
+
runtime: executor.runtime,
|
|
2701
|
+
telemetry: "unknown-after-failure"
|
|
2702
|
+
});
|
|
2703
|
+
const attempts = runtimeOwnedExecutorProviderEvidence(executor)?.attempts;
|
|
2704
|
+
const provenNotStarted = attempts !== void 0 && attempts.length > 0 && attempts.every((attempt) => attempt.providerDispatch === "not_started");
|
|
2705
|
+
if (scope.budget.resources !== void 0 && !provenNotStarted) await meterRuntimeOwnedAccounting(scope, withBudgetResources(zeroSpend(), scope.budget), {
|
|
2680
2706
|
role: "driver",
|
|
2681
2707
|
runtime: executor.runtime,
|
|
2682
2708
|
telemetry: "unknown-after-failure"
|
|
@@ -2983,6 +3009,14 @@ function recordRunCancellationOutcome(runDir, result, now) {
|
|
|
2983
3009
|
/** A per-child budget may not exceed the conserved pool it is reserved from. */
|
|
2984
3010
|
function assertPerWorkerWithinPool(perWorker, pool) {
|
|
2985
3011
|
const over = (child, total, field) => child > total ? `supervise perWorker.${field} (${child}) exceeds budget.${field} (${total})` : null;
|
|
3012
|
+
for (const [name, resource] of Object.entries(pool.resources ?? {})) {
|
|
3013
|
+
const child = perWorker.resources?.[name];
|
|
3014
|
+
if (!child) throw new ValidationError(`supervise perWorker resource ${name}: child must declare its limit`);
|
|
3015
|
+
if (child.unit !== resource.unit) throw new ValidationError(`supervise perWorker resource ${name}: unit mismatch`);
|
|
3016
|
+
const problem = over(child.limit, resource.limit, `resources.${name}.limit`);
|
|
3017
|
+
if (problem) throw new ValidationError(problem);
|
|
3018
|
+
}
|
|
3019
|
+
for (const name of Object.keys(perWorker.resources ?? {})) if (!Object.hasOwn(pool.resources ?? {}, name)) throw new ValidationError(`supervise perWorker resource ${name}: root must declare its limit`);
|
|
2986
3020
|
const problems = [
|
|
2987
3021
|
over(perWorker.maxTokens, pool.maxTokens, "maxTokens"),
|
|
2988
3022
|
over(perWorker.maxIterations, pool.maxIterations, "maxIterations"),
|
|
@@ -2992,6 +3026,10 @@ function assertPerWorkerWithinPool(perWorker, pool) {
|
|
|
2992
3026
|
}
|
|
2993
3027
|
function defaultPerWorker(budget) {
|
|
2994
3028
|
return {
|
|
3029
|
+
...budget.resources === void 0 ? {} : { resources: Object.fromEntries(Object.entries(budget.resources).map(([name, value]) => [name, {
|
|
3030
|
+
unit: value.unit,
|
|
3031
|
+
limit: Math.floor(value.limit / 4)
|
|
3032
|
+
}])) },
|
|
2995
3033
|
maxIterations: Math.max(1, Math.floor(budget.maxIterations / 4)),
|
|
2996
3034
|
maxTokens: Math.max(1, Math.floor(budget.maxTokens / 4)),
|
|
2997
3035
|
...budget.maxUsd !== void 0 ? { maxUsd: budget.maxUsd / 4 } : {}
|
|
@@ -3497,4 +3535,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
3497
3535
|
//#endregion
|
|
3498
3536
|
export { serveCoordinationMcp as _, isPreSpawnExecutorFailure as a, mapExecutorResult as b, withWorkerSpawnRetry as c, resolveSupervisorProfile as d, supervisorAgent as f, defaultUnmetContractSteer as g, classifyDriverFailure as h, workerFromBackend as i, assertCoordinationBinding as l, DriverAttemptsExhaustedError as m, supervise as n, resolveWorkerSpawnRetry as o, supervisorAgentWithTestBrain as p, superviseWithTestBrain as r, retryPreSpawnRefusals as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, coordinationProfileToolPrefix as u, createSupervisorSpanRecorder as v, gateOnDeliverable as y };
|
|
3499
3537
|
|
|
3500
|
-
//# sourceMappingURL=supervise-
|
|
3538
|
+
//# sourceMappingURL=supervise-CMWpmY_1.js.map
|