@tangle-network/agent-runtime 0.133.0 → 0.133.2
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-B4nhh8w3.js → activation-ChGJ2T70.js} +3 -3
- package/dist/{activation-B4nhh8w3.js.map → activation-ChGJ2T70.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{authoring-Dt5lGaM7.js → authoring-CCzHzhCy.js} +2 -2
- package/dist/{authoring-Dt5lGaM7.js.map → authoring-CCzHzhCy.js.map} +1 -1
- package/dist/candidate-execution/index.js +4 -4
- package/dist/{candidate-execution-BUhnNcyt.js → candidate-execution-gDXl7pGk.js} +4 -4
- package/dist/{candidate-execution-BUhnNcyt.js.map → candidate-execution-gDXl7pGk.js.map} +1 -1
- package/dist/{conversation-CiO00rgm.js → conversation-kPowfA_A.js} +3 -3
- package/dist/{conversation-CiO00rgm.js.map → conversation-kPowfA_A.js.map} +1 -1
- package/dist/conversation.d.ts +1 -1
- package/dist/conversation.js +1 -1
- package/dist/{environment-provider-BnioYoPQ.d.ts → environment-provider-B-w9VYcF.d.ts} +2 -2
- package/dist/environment-provider.d.ts +1 -1
- package/dist/{graph-CEFPJQRh.js → graph-DiFPPTdk.js} +3 -3
- package/dist/{graph-CEFPJQRh.js.map → graph-DiFPPTdk.js.map} +1 -1
- package/dist/{improvement-cycle-Bf9V8cj8.js → improvement-cycle-d0O_nkmj.js} +5 -5
- package/dist/{improvement-cycle-Bf9V8cj8.js.map → improvement-cycle-d0O_nkmj.js.map} +1 -1
- package/dist/{index-BzP_EK1N.d.ts → index-B7qKWyMV.d.ts} +17 -11
- package/dist/{index-Cw0RMLao.d.ts → index-BNz-BzLt.d.ts} +4 -4
- package/dist/{index-Cdf9NET5.d.ts → index-DqJa9jGF.d.ts} +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +13 -13
- package/dist/intelligence.d.ts +4 -4
- package/dist/intelligence.js +5 -5
- package/dist/kernel.d.ts +6 -6
- package/dist/kernel.js +8 -8
- package/dist/{knowledge-Dj7e4Pg8.js → knowledge-CtFA0_YY.js} +5 -5
- package/dist/{knowledge-Dj7e4Pg8.js.map → knowledge-CtFA0_YY.js.map} +1 -1
- package/dist/knowledge.d.ts +1 -1
- package/dist/knowledge.js +1 -1
- package/dist/{loop-runner-bin-rmUSJ0jy.d.ts → loop-runner-bin-CBW9ri20.d.ts} +3 -3
- package/dist/{loop-runner-bin-DJDMsJus.js → loop-runner-bin-Cak-SbgO.js} +3 -3
- package/dist/{loop-runner-bin-DJDMsJus.js.map → loop-runner-bin-Cak-SbgO.js.map} +1 -1
- package/dist/loop-runner-bin.d.ts +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/{materialization-BkL7gRP6.js → materialization-D2bdTfkK.js} +75 -14
- package/dist/materialization-D2bdTfkK.js.map +1 -0
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-MB5xyj1D.js → openai-tools-BeYChImD.js} +2 -2
- package/dist/{openai-tools-MB5xyj1D.js.map → openai-tools-BeYChImD.js.map} +1 -1
- package/dist/{prepare-DggAvkbq.js → prepare-DWH0J5z2.js} +2 -2
- package/dist/{prepare-DggAvkbq.js.map → prepare-DWH0J5z2.js.map} +1 -1
- package/dist/primeintellect/index.d.ts +1 -1
- package/dist/{protected-model-port-BpQeW-0j.js → protected-model-port-djV8FMXc.js} +2 -2
- package/dist/{protected-model-port-BpQeW-0j.js.map → protected-model-port-djV8FMXc.js.map} +1 -1
- package/dist/{redact-BTKr5YLO.d.ts → redact-BSD-nvTf.d.ts} +3 -3
- package/dist/{runtime-DtRTgm3B.js → runtime-B6YK6v3I.js} +85 -76
- package/dist/runtime-B6YK6v3I.js.map +1 -0
- package/dist/{runtime-BRErB7lm.d.ts → runtime-D-26vxJt.d.ts} +3 -3
- package/dist/{spawn-journal-CNg5-D9p.js → spawn-journal-BX3-4WDm.js} +183 -5
- package/dist/spawn-journal-BX3-4WDm.js.map +1 -0
- package/dist/{stream-agent-turn-B4Mvk5G-.js → stream-agent-turn-D8YHY0oO.js} +2 -2
- package/dist/{stream-agent-turn-B4Mvk5G-.js.map → stream-agent-turn-D8YHY0oO.js.map} +1 -1
- package/dist/{stream-agent-turn-By46GZlo.d.ts → stream-agent-turn-NFWCv1X1.d.ts} +2 -2
- package/dist/{structural-rollout-OPAUocq7.js → structural-rollout-BQh7Rzoa.js} +5 -5
- package/dist/{structural-rollout-OPAUocq7.js.map → structural-rollout-BQh7Rzoa.js.map} +1 -1
- package/dist/{supervise-Da_e1GgK.js → supervise-C_P4yxA4.js} +98 -29
- package/dist/supervise-C_P4yxA4.js.map +1 -0
- package/dist/{supervisor-BwU40H4n.js → supervisor-C5pAAPb5.js} +96 -27
- package/dist/supervisor-C5pAAPb5.js.map +1 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +12 -12
- package/dist/{types-BjUQODeG.d.ts → types-DJ7k6vHE.d.ts} +30 -6
- package/dist/{workspace-archive-Cm3rtP4F.js → workspace-archive-DdrlLnIj.js} +2 -2
- package/dist/{workspace-archive-Cm3rtP4F.js.map → workspace-archive-DdrlLnIj.js.map} +1 -1
- package/package.json +1 -1
- package/dist/materialization-BkL7gRP6.js.map +0 -1
- package/dist/runtime-DtRTgm3B.js.map +0 -1
- package/dist/spawn-journal-CNg5-D9p.js.map +0 -1
- package/dist/supervise-Da_e1GgK.js.map +0 -1
- package/dist/supervisor-BwU40H4n.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { f as ValidationError, r as BackendTransportError, u as RuntimeRunStateError } from "./errors-DRoXIc7E.js";
|
|
2
2
|
import { t as detachedSnapshot } from "./snapshot-DY6VGliG.js";
|
|
3
|
-
import {
|
|
3
|
+
import { S as contentAddress, a as aggregateProviderModelEvidence, c as pendingWaits, g as runtimeOwnedNestedDriverTreeRoot, h as nestedDriverTreeRoot, l as replaySpawnTree, m as driverRuntime, o as loadSpawnForest, p as attestNestedDriverTreeOwner, s as materializeTreeView, v as captureWorkerTraceEvidence } from "./spawn-journal-BX3-4WDm.js";
|
|
4
4
|
import { c as randomUuid, d as throwAbort, f as throwIfAborted, l as sleep, m as zeroTokenUsage, n as cloneTokenUsage, o as mapWithConcurrency, p as withTimeout, r as deleteBoxSafe, s as randomSuffix, t as addTokenUsage, u as stringifySafe } from "./util-Dr--8wAL.js";
|
|
5
5
|
import { a as notifySandboxEventObserver, n as extractLlmCallEvent } from "./sandbox-events-vIwmuPdl.js";
|
|
6
6
|
import { a as concreteProfileModel, l as resolveRouterRetryPolicy, o as profileBridgeWireModel, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-Bv1DU2fw.js";
|
|
7
|
-
import { _ as
|
|
7
|
+
import { C as unknownMaterializationReceipt, S as unknownExecutionBindingReceipt, T as executableAgentSpecSnapshot, _ as runtimeOwnedExecutorExecutionBinding, a as authoredProfileDigest, b as runtimeOwnedPendingExecutorMaterialization, c as knownExecutionBindingReceipt, f as recordRuntimeOwnedProviderAttemptStart, h as runtimeOwnedDeferredExecutorRuntime, l as knownMaterializationReceipt, m as recordRuntimeOwnedProviderModel, n as attestRuntimeOwnedExecutor, o as finalizeRuntimeOwnedPendingExecutor, p as recordRuntimeOwnedProviderIdentityConflict, r as attestRuntimeOwnedPendingExecutor, t as attestRuntimeOwnedDeferredExecutor, u as newExecutionAttemptId, v as runtimeOwnedExecutorMaterialization, w as executableAgentProfileSnapshot, x as runtimeOwnedScopeOwnerRuntime, y as runtimeOwnedExecutorProviderEvidence } from "./materialization-D2bdTfkK.js";
|
|
8
8
|
import { i as resolveAgentEnvironmentProvider, n as providerAsExecutor, r as providerAsSandboxClient } from "./environment-provider-mDsjfGjY.js";
|
|
9
9
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-C7iJOWm3.js";
|
|
10
10
|
import { estimateCost, isModelPriced } from "@tangle-network/agent-eval";
|
|
@@ -3120,20 +3120,39 @@ function observedModelMatchesDeclared(observed, declared) {
|
|
|
3120
3120
|
if (declaredIdentity.snapshot !== void 0 && observedIdentity.snapshot !== declaredIdentity.snapshot) return false;
|
|
3121
3121
|
return equivalentModelBase(observedIdentity.base, declaredIdentity.base);
|
|
3122
3122
|
}
|
|
3123
|
+
/** Merge two observations of one served model while retaining a snapshot-bearing raw identity. */
|
|
3124
|
+
function mergeObservedModelIdentity(current, next) {
|
|
3125
|
+
const currentIdentity = modelIdentityParts(current);
|
|
3126
|
+
const nextIdentity = modelIdentityParts(next);
|
|
3127
|
+
if (!currentIdentity || !nextIdentity) return void 0;
|
|
3128
|
+
if (!equivalentModelBase(currentIdentity.base, nextIdentity.base)) return void 0;
|
|
3129
|
+
if (currentIdentity.snapshot !== void 0 && nextIdentity.snapshot !== void 0 && currentIdentity.snapshot !== nextIdentity.snapshot) return;
|
|
3130
|
+
return currentIdentity.snapshot === void 0 && nextIdentity.snapshot !== void 0 ? next : current;
|
|
3131
|
+
}
|
|
3132
|
+
/** Canonicalize a served model for cross-route identity comparisons. */
|
|
3133
|
+
function canonicalObservedModel(model) {
|
|
3134
|
+
const identity = modelIdentityParts(model);
|
|
3135
|
+
if (!identity) return void 0;
|
|
3136
|
+
const base = identity.base.slice(identity.base.lastIndexOf("/") + 1);
|
|
3137
|
+
return identity.snapshot === void 0 ? base : `${base}@${identity.snapshot}`;
|
|
3138
|
+
}
|
|
3123
3139
|
function modelIdentityParts(model) {
|
|
3124
3140
|
if (model.length === 0) return null;
|
|
3125
3141
|
const at = model.lastIndexOf("@");
|
|
3126
|
-
if (at < 0) return { base: model };
|
|
3142
|
+
if (at < 0) return modelLeaf(model).length === 0 ? null : { base: model };
|
|
3127
3143
|
const base = model.slice(0, at);
|
|
3128
3144
|
const snapshot = model.slice(at + 1);
|
|
3129
|
-
if (base.length === 0 || !SNAPSHOT_TOKEN.test(snapshot)) return null;
|
|
3145
|
+
if (base.length === 0 || modelLeaf(base).length === 0 || !SNAPSHOT_TOKEN.test(snapshot)) return null;
|
|
3130
3146
|
return {
|
|
3131
3147
|
base,
|
|
3132
3148
|
snapshot
|
|
3133
3149
|
};
|
|
3134
3150
|
}
|
|
3135
3151
|
function equivalentModelBase(observed, declared) {
|
|
3136
|
-
return observed ===
|
|
3152
|
+
return modelLeaf(observed) === modelLeaf(declared);
|
|
3153
|
+
}
|
|
3154
|
+
function modelLeaf(model) {
|
|
3155
|
+
return model.slice(model.lastIndexOf("/") + 1);
|
|
3137
3156
|
}
|
|
3138
3157
|
//#endregion
|
|
3139
3158
|
//#region src/runtime/tool-loop.ts
|
|
@@ -6109,7 +6128,8 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
6109
6128
|
let artifact;
|
|
6110
6129
|
const executionId = ctx.node?.nodeId ?? `router-request-${randomUUID()}`;
|
|
6111
6130
|
const attemptId = ctx.node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
6112
|
-
|
|
6131
|
+
let executor;
|
|
6132
|
+
executor = attestRuntimeOwnedExecutor({
|
|
6113
6133
|
runtime: "router",
|
|
6114
6134
|
async execute(task, signal) {
|
|
6115
6135
|
const messages = taskToMessages(task, spec, profileExecution.systemPrompt);
|
|
@@ -6119,6 +6139,7 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
6119
6139
|
...profileExecution.extraBody ?? {},
|
|
6120
6140
|
...profileExecution.reasoningEffort ? { reasoning_effort: profileExecution.reasoningEffort } : {}
|
|
6121
6141
|
};
|
|
6142
|
+
recordRuntimeOwnedProviderAttemptStart(executor);
|
|
6122
6143
|
const r = await runRouterTransport("routerInlineExecutor", () => seam.tools ? (profileExecution.stream === true ? streamRouterChatWithTools : routerChatWithTools)({
|
|
6123
6144
|
routerBaseUrl: seam.routerBaseUrl,
|
|
6124
6145
|
routerKey: seam.routerKey,
|
|
@@ -6148,6 +6169,7 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
6148
6169
|
...profileExecution.extraBody ? { extraBody: profileExecution.extraBody } : {},
|
|
6149
6170
|
...requestIdentity
|
|
6150
6171
|
}));
|
|
6172
|
+
if (r.model !== void 0) recordRuntimeOwnedProviderModel(executor, r.model);
|
|
6151
6173
|
const spent = {
|
|
6152
6174
|
iterations: 1,
|
|
6153
6175
|
tokens: r.usage ? cloneTokenUsage({
|
|
@@ -6232,6 +6254,7 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
6232
6254
|
backend: "router"
|
|
6233
6255
|
}
|
|
6234
6256
|
});
|
|
6257
|
+
return executor;
|
|
6235
6258
|
};
|
|
6236
6259
|
const routerToolsSeamKey = "router-tools";
|
|
6237
6260
|
function mergePromptCache(target, cache) {
|
|
@@ -6300,7 +6323,8 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
6300
6323
|
let artifact;
|
|
6301
6324
|
const executionId = ctx.node?.nodeId ?? `router-tools-run-${randomUUID()}`;
|
|
6302
6325
|
const attemptId = ctx.node?.attemptId ?? newExecutionAttemptId(executionId);
|
|
6303
|
-
|
|
6326
|
+
let executor;
|
|
6327
|
+
executor = attestRuntimeOwnedExecutor({
|
|
6304
6328
|
runtime: "router",
|
|
6305
6329
|
deliver: (m) => inbox.deliver(m),
|
|
6306
6330
|
async execute(task, signal) {
|
|
@@ -6341,6 +6365,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
6341
6365
|
const cleanup = () => external.removeEventListener("abort", abortTurn);
|
|
6342
6366
|
let res;
|
|
6343
6367
|
try {
|
|
6368
|
+
recordRuntimeOwnedProviderAttemptStart(executor);
|
|
6344
6369
|
res = await (profileExecution.stream === true ? streamRouterChatWithTools : routerChatWithTools)({
|
|
6345
6370
|
routerBaseUrl: seam.routerBaseUrl,
|
|
6346
6371
|
routerKey: seam.routerKey,
|
|
@@ -6372,6 +6397,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
6372
6397
|
cleanup();
|
|
6373
6398
|
turns += 1;
|
|
6374
6399
|
transportAttempts += res.transportAttempts;
|
|
6400
|
+
if (res.model !== void 0) recordRuntimeOwnedProviderModel(executor, res.model);
|
|
6375
6401
|
assertObservedRouterModel(res.model, model, "routerToolsInlineExecutor");
|
|
6376
6402
|
if (res.model !== void 0) observedModel = res.model;
|
|
6377
6403
|
mergePromptCache(promptCache, res.cache);
|
|
@@ -6552,6 +6578,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
6552
6578
|
backend: "router-tools"
|
|
6553
6579
|
}
|
|
6554
6580
|
});
|
|
6581
|
+
return executor;
|
|
6555
6582
|
};
|
|
6556
6583
|
function assertObservedRouterModel(observed, expected, context) {
|
|
6557
6584
|
if (observed !== void 0 && !observedModelMatchesDeclared(observed, expected)) throw new ValidationError(`${context}: provider reported model ${JSON.stringify(observed)} but AgentProfile requires ${JSON.stringify(expected)}`);
|
|
@@ -6981,11 +7008,14 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
6981
7008
|
const modelCredential = validateBridgeModelCredential(base.modelCredential, base.bridgeUrl, "bridgeExecutor");
|
|
6982
7009
|
const effectiveProfile = agentProfileSchema.parse(spec.profile);
|
|
6983
7010
|
const model = bridgeProfileModel(effectiveProfile, "bridgeExecutor");
|
|
7011
|
+
const harness = agentHarness(effectiveProfile.harness);
|
|
7012
|
+
const providerModel = harness !== void 0 && model.startsWith(`${harness}/`) ? model.slice(harness.length + 1) : model;
|
|
6984
7013
|
const profileExecution = profileModelExecutionSettings(effectiveProfile, "bridgeExecutor");
|
|
6985
7014
|
const seam = {
|
|
6986
7015
|
...base,
|
|
6987
7016
|
...modelCredential === void 0 ? {} : { modelCredential },
|
|
6988
7017
|
model,
|
|
7018
|
+
providerModel,
|
|
6989
7019
|
...profileExecution.maxTokens !== void 0 ? { maxTokens: profileExecution.maxTokens } : {}
|
|
6990
7020
|
};
|
|
6991
7021
|
if (!seam.bridgeUrl || !seam.bridgeBearer) throw new ValidationError("bridgeExecutor: bridgeUrl + bridgeBearer are required");
|
|
@@ -7097,6 +7127,9 @@ const bridgeExecutor = (spec, ctx) => {
|
|
|
7097
7127
|
record: (step) => {
|
|
7098
7128
|
trace.record(step);
|
|
7099
7129
|
},
|
|
7130
|
+
onProviderAttemptStart: () => recordRuntimeOwnedProviderAttemptStart(executor),
|
|
7131
|
+
onProviderModel: (model) => recordRuntimeOwnedProviderModel(executor, model),
|
|
7132
|
+
onProviderIdentityConflict: () => recordRuntimeOwnedProviderIdentityConflict(executor),
|
|
7100
7133
|
onArtifact: (a) => {
|
|
7101
7134
|
artifact = a;
|
|
7102
7135
|
},
|
|
@@ -7319,6 +7352,7 @@ async function* streamBridgeSession(args) {
|
|
|
7319
7352
|
let turnEstimatedCostSubtotal = 0;
|
|
7320
7353
|
let interrupted = false;
|
|
7321
7354
|
try {
|
|
7355
|
+
args.onProviderAttemptStart();
|
|
7322
7356
|
for await (const chunk of streamDurableBridgeRun({
|
|
7323
7357
|
seam,
|
|
7324
7358
|
profile: args.profile,
|
|
@@ -7329,9 +7363,24 @@ async function* streamBridgeSession(args) {
|
|
|
7329
7363
|
maxReconnects: args.maxReconnects,
|
|
7330
7364
|
traceHeaders: args.traceHeaders
|
|
7331
7365
|
})) {
|
|
7332
|
-
if (chunk.model !== void 0)
|
|
7366
|
+
if (chunk.model !== void 0) {
|
|
7367
|
+
args.onProviderModel(chunk.model);
|
|
7368
|
+
try {
|
|
7369
|
+
if (!observedModelMatchesDeclared(chunk.model, seam.providerModel)) {
|
|
7370
|
+
args.onProviderIdentityConflict();
|
|
7371
|
+
throw new ValidationError(`bridgeExecutor: bridge reported model ${JSON.stringify(chunk.model)} but the profile requires ${JSON.stringify(seam.providerModel)}`);
|
|
7372
|
+
}
|
|
7373
|
+
observedModel = mergeBridgeObservedModel(observedModel, chunk.model);
|
|
7374
|
+
} catch (error) {
|
|
7375
|
+
args.onProviderIdentityConflict();
|
|
7376
|
+
throw error;
|
|
7377
|
+
}
|
|
7378
|
+
}
|
|
7333
7379
|
if (chunk.systemFingerprint !== void 0) {
|
|
7334
|
-
if (observedSystemFingerprint !== void 0 && observedSystemFingerprint !== chunk.systemFingerprint)
|
|
7380
|
+
if (observedSystemFingerprint !== void 0 && observedSystemFingerprint !== chunk.systemFingerprint) {
|
|
7381
|
+
args.onProviderIdentityConflict();
|
|
7382
|
+
throw new ValidationError(`bridgeExecutor: bridge changed system fingerprint from ${JSON.stringify(observedSystemFingerprint)} to ${JSON.stringify(chunk.systemFingerprint)}`);
|
|
7383
|
+
}
|
|
7335
7384
|
observedSystemFingerprint = chunk.systemFingerprint;
|
|
7336
7385
|
}
|
|
7337
7386
|
if (chunk.content) turnText += chunk.content;
|
|
@@ -7741,13 +7790,9 @@ function errorMessage(error) {
|
|
|
7741
7790
|
}
|
|
7742
7791
|
function mergeBridgeObservedModel(current, next) {
|
|
7743
7792
|
if (current === void 0 || current === next) return next;
|
|
7744
|
-
|
|
7745
|
-
if (
|
|
7746
|
-
return
|
|
7747
|
-
}
|
|
7748
|
-
function bridgeModelIdentityBase(model) {
|
|
7749
|
-
const at = model.lastIndexOf("@");
|
|
7750
|
-
return at > 0 ? model.slice(0, at) : model;
|
|
7793
|
+
const merged = mergeObservedModelIdentity(current, next);
|
|
7794
|
+
if (merged === void 0) throw new ValidationError(`bridgeExecutor: bridge changed response model from ${JSON.stringify(current)} to ${JSON.stringify(next)}`);
|
|
7795
|
+
return merged;
|
|
7751
7796
|
}
|
|
7752
7797
|
function assertBridgeProfileMaterialization(value, profile, wireModel) {
|
|
7753
7798
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new ValidationError("bridgeExecutor: profile materialization receipt must be an object");
|
|
@@ -9570,6 +9615,8 @@ function defaultSleep(ms, signal) {
|
|
|
9570
9615
|
*
|
|
9571
9616
|
* @stable
|
|
9572
9617
|
*/
|
|
9618
|
+
/** Runtime-owned provider evidence is written through this private scope capability. */
|
|
9619
|
+
const runtimeOwnedProviderMeters = /* @__PURE__ */ new WeakMap();
|
|
9573
9620
|
/**
|
|
9574
9621
|
* The recursion seam key. A `Scope` seeds a value of this on each child's
|
|
9575
9622
|
* `ExecutorContext.seams` so a child whose executor is a DRIVER can mount a NESTED `Scope`
|
|
@@ -10245,7 +10292,7 @@ function createScope(args) {
|
|
|
10245
10292
|
return;
|
|
10246
10293
|
}
|
|
10247
10294
|
}
|
|
10248
|
-
async function
|
|
10295
|
+
async function meterInternal(spend, detail, providerModel) {
|
|
10249
10296
|
if (args.signal.aborted) throw new ValidationError("scope.meter: cannot record new driver work after scope abort");
|
|
10250
10297
|
const seq = meterSeq++;
|
|
10251
10298
|
let observeError;
|
|
@@ -10258,6 +10305,7 @@ function createScope(args) {
|
|
|
10258
10305
|
kind: "metered",
|
|
10259
10306
|
id: args.parentId,
|
|
10260
10307
|
spend,
|
|
10308
|
+
...providerModel === void 0 ? {} : { providerModel: detachedSnapshot(providerModel, "runtime provider model evidence") },
|
|
10261
10309
|
seq,
|
|
10262
10310
|
at: new Date(now()).toISOString()
|
|
10263
10311
|
});
|
|
@@ -10291,7 +10339,7 @@ function createScope(args) {
|
|
|
10291
10339
|
progress,
|
|
10292
10340
|
traceSource,
|
|
10293
10341
|
signal: args.signal,
|
|
10294
|
-
meter,
|
|
10342
|
+
meter: (spend, detail) => meterInternal(spend, detail),
|
|
10295
10343
|
...resume ? { resume } : {},
|
|
10296
10344
|
get view() {
|
|
10297
10345
|
return makeTreeView(args.parentId, children);
|
|
@@ -10306,6 +10354,7 @@ function createScope(args) {
|
|
|
10306
10354
|
};
|
|
10307
10355
|
}
|
|
10308
10356
|
};
|
|
10357
|
+
runtimeOwnedProviderMeters.set(scope, async (spend, providerModel, detail) => meterInternal(spend, detail, providerModel));
|
|
10309
10358
|
if (args.ownerMaterialization !== void 0) {
|
|
10310
10359
|
const authoredProfile = args.ownerMaterialization.authoredProfile === void 0 ? void 0 : detachedSnapshot(args.ownerMaterialization.authoredProfile, "scope owner authored profile");
|
|
10311
10360
|
ownerMaterializationStates.set(scope, {
|
|
@@ -10327,6 +10376,12 @@ function createScope(args) {
|
|
|
10327
10376
|
}
|
|
10328
10377
|
return scope;
|
|
10329
10378
|
}
|
|
10379
|
+
/** @internal Meter one Runtime-owned provider attempt into the durable scope journal. */
|
|
10380
|
+
function meterRuntimeOwnedProviderAttempt(scope, spend, providerModel, detail) {
|
|
10381
|
+
const meter = runtimeOwnedProviderMeters.get(scope);
|
|
10382
|
+
if (meter === void 0) throw new ValidationError("scope: Runtime-owned provider meter is not bound to this scope");
|
|
10383
|
+
return meter(spend, providerModel, detail);
|
|
10384
|
+
}
|
|
10330
10385
|
const ownerMaterializationStates = /* @__PURE__ */ new WeakMap();
|
|
10331
10386
|
/**
|
|
10332
10387
|
* @internal Publish exact root-manager materialization from a runtime-owned adapter after dynamic
|
|
@@ -10496,6 +10551,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10496
10551
|
if (settlement.kind === "down") {
|
|
10497
10552
|
child.status = "failed";
|
|
10498
10553
|
child.trace = settlement.trace;
|
|
10554
|
+
child.providerModel = settlement.providerModel;
|
|
10499
10555
|
await args.journal.appendEvent(args.root, {
|
|
10500
10556
|
kind: "settled",
|
|
10501
10557
|
id: child.id,
|
|
@@ -10503,6 +10559,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10503
10559
|
spent: child.spent,
|
|
10504
10560
|
infra: settlement.infra,
|
|
10505
10561
|
reason: settlement.reason,
|
|
10562
|
+
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
10506
10563
|
trace: settlement.trace,
|
|
10507
10564
|
seq,
|
|
10508
10565
|
at
|
|
@@ -10536,6 +10593,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10536
10593
|
reason: settlement.reason,
|
|
10537
10594
|
infra: settlement.infra,
|
|
10538
10595
|
restartCount: settlement.restartCount,
|
|
10596
|
+
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
10539
10597
|
trace: settlement.trace,
|
|
10540
10598
|
settledAt,
|
|
10541
10599
|
seq
|
|
@@ -10545,6 +10603,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10545
10603
|
child.outRef = settlement.outRef;
|
|
10546
10604
|
child.spent = settlement.spent;
|
|
10547
10605
|
child.trace = settlement.trace;
|
|
10606
|
+
child.providerModel = settlement.providerModel;
|
|
10548
10607
|
await args.journal.appendEvent(args.root, {
|
|
10549
10608
|
kind: "settled",
|
|
10550
10609
|
id: child.id,
|
|
@@ -10552,6 +10611,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10552
10611
|
outRef: settlement.outRef,
|
|
10553
10612
|
...settlement.verdict ? { verdict: settlement.verdict } : {},
|
|
10554
10613
|
spent: settlement.spent,
|
|
10614
|
+
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
10555
10615
|
trace: settlement.trace,
|
|
10556
10616
|
seq,
|
|
10557
10617
|
at
|
|
@@ -10587,6 +10647,7 @@ async function finalizeSettlement(child, settlement, seq, args, now) {
|
|
|
10587
10647
|
outRef: settlement.outRef,
|
|
10588
10648
|
...settlement.verdict ? { verdict: settlement.verdict } : {},
|
|
10589
10649
|
spent: settlement.spent,
|
|
10650
|
+
...settlement.providerModel ? { providerModel: settlement.providerModel } : {},
|
|
10590
10651
|
trace: settlement.trace,
|
|
10591
10652
|
settledAt,
|
|
10592
10653
|
seq
|
|
@@ -10730,7 +10791,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
10730
10791
|
const trace = await captureTraceOnce();
|
|
10731
10792
|
if (childAbort.signal.aborted) {
|
|
10732
10793
|
await teardownOnce(opts.shutdown ?? "brutalKill");
|
|
10733
|
-
return downRecord("aborted before settle", true, trace, ownMetered);
|
|
10794
|
+
return downRecord("aborted before settle", true, trace, ownMetered, runtimeOwnedExecutorProviderEvidence(executor));
|
|
10734
10795
|
}
|
|
10735
10796
|
const outRef = contentAddress(artifact.out);
|
|
10736
10797
|
await blobs.put(outRef, artifact.out);
|
|
@@ -10742,6 +10803,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
10742
10803
|
...artifact.verdict ? { verdict: artifact.verdict } : {},
|
|
10743
10804
|
spent: live.spent,
|
|
10744
10805
|
trace,
|
|
10806
|
+
providerModel: runtimeOwnedExecutorProviderEvidence(executor),
|
|
10745
10807
|
...ownMetered ? { metered: ownMetered } : {}
|
|
10746
10808
|
};
|
|
10747
10809
|
} catch (err) {
|
|
@@ -10761,6 +10823,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
10761
10823
|
}
|
|
10762
10824
|
const accounting = executor.accounting?.();
|
|
10763
10825
|
if (accounting) live.spent = accounting.reported;
|
|
10826
|
+
const providerModel = runtimeOwnedExecutorProviderEvidence(executor);
|
|
10764
10827
|
const aborted = childAbort.signal.aborted || isAbortError(err);
|
|
10765
10828
|
if (started && !terminalTelemetryCaptured && accounting === void 0) live.spent = {
|
|
10766
10829
|
...live.spent,
|
|
@@ -10768,7 +10831,7 @@ async function runChild(live, executor, childAbort, task, opts, pool, ticket, bl
|
|
|
10768
10831
|
usdKnown: false
|
|
10769
10832
|
};
|
|
10770
10833
|
const reconcileError = reconcileOnce(accounting?.reservation ?? live.spent);
|
|
10771
|
-
return downRecord(errMessage(err), evidenceError !== void 0 || teardownError !== void 0 || reconcileError !== void 0 || aborted || isInfraError(err), trace, executor.metered?.());
|
|
10834
|
+
return downRecord(errMessage(err), evidenceError !== void 0 || teardownError !== void 0 || reconcileError !== void 0 || aborted || isInfraError(err), trace, executor.metered?.(), providerModel);
|
|
10772
10835
|
}
|
|
10773
10836
|
}
|
|
10774
10837
|
/**
|
|
@@ -10832,7 +10895,8 @@ function makeTreeView(root, children) {
|
|
|
10832
10895
|
spent: c.spent,
|
|
10833
10896
|
...c.settledAt === void 0 ? {} : { settledAt: c.settledAt },
|
|
10834
10897
|
...c.outRef ? { outRef: c.outRef } : {},
|
|
10835
|
-
...c.trace ? { trace: c.trace } : {}
|
|
10898
|
+
...c.trace ? { trace: c.trace } : {},
|
|
10899
|
+
...c.providerModel ? { providerModel: c.providerModel } : {}
|
|
10836
10900
|
}));
|
|
10837
10901
|
return {
|
|
10838
10902
|
root,
|
|
@@ -10994,13 +11058,14 @@ function abortError(signal) {
|
|
|
10994
11058
|
error.name = "AbortError";
|
|
10995
11059
|
return error;
|
|
10996
11060
|
}
|
|
10997
|
-
function downRecord(reason, infra, trace, metered) {
|
|
11061
|
+
function downRecord(reason, infra, trace, metered, providerModel) {
|
|
10998
11062
|
return {
|
|
10999
11063
|
kind: "down",
|
|
11000
11064
|
reason,
|
|
11001
11065
|
infra,
|
|
11002
11066
|
restartCount: 0,
|
|
11003
11067
|
trace,
|
|
11068
|
+
...providerModel ? { providerModel } : {},
|
|
11004
11069
|
...metered ? { metered } : {}
|
|
11005
11070
|
};
|
|
11006
11071
|
}
|
|
@@ -11867,13 +11932,14 @@ function createSupervisor() {
|
|
|
11867
11932
|
if (out !== void 0) {
|
|
11868
11933
|
const outRef = contentAddress(out);
|
|
11869
11934
|
await opts.blobs.put(outRef, out);
|
|
11870
|
-
const { spentTotal, childWork, driverInference, gaps } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
11935
|
+
const { spentTotal, childWork, driverInference, gaps, providerModel } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
11871
11936
|
return {
|
|
11872
11937
|
kind: "winner",
|
|
11873
11938
|
out,
|
|
11874
11939
|
outRef,
|
|
11875
11940
|
tree,
|
|
11876
11941
|
spentTotal,
|
|
11942
|
+
providerModel,
|
|
11877
11943
|
...gaps.length > 0 ? { spendGaps: gaps } : {},
|
|
11878
11944
|
...isNonEmptySpend(driverInference) ? { spentBreakdown: {
|
|
11879
11945
|
driverInference,
|
|
@@ -11885,12 +11951,13 @@ function createSupervisor() {
|
|
|
11885
11951
|
}
|
|
11886
11952
|
return noWinner({ error: actOutcome.error });
|
|
11887
11953
|
async function noWinner(rejection) {
|
|
11888
|
-
const { spentTotal, gaps } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
11954
|
+
const { spentTotal, gaps, providerModel } = await terminalAccounting(journal, opts.runId, now() - runEpochMs);
|
|
11889
11955
|
const common = {
|
|
11890
11956
|
kind: "no-winner",
|
|
11891
11957
|
tree,
|
|
11892
11958
|
downCount: breaker.downCount(),
|
|
11893
11959
|
spentTotal,
|
|
11960
|
+
providerModel,
|
|
11894
11961
|
...gaps.length > 0 ? { spendGaps: gaps } : {}
|
|
11895
11962
|
};
|
|
11896
11963
|
const lifecycle = classifyNoWinner(executionAborted, pool, opts, breaker, deadlineExceeded, allChildrenDownAtSettle, downCountAtSettle);
|
|
@@ -12153,6 +12220,7 @@ async function terminalAccounting(journal, root, elapsedMs) {
|
|
|
12153
12220
|
if (events === void 0) throw new RuntimeRunStateError(`supervisor: spawn tree '${root}' is missing from the journal after run (corrupted log)`);
|
|
12154
12221
|
const { childWork, driverInference } = sumSpendFromEvents(events);
|
|
12155
12222
|
const gaps = spendGapsFromEvents(events);
|
|
12223
|
+
const providerModel = aggregateProviderModelEvidence(await loadSpawnForest(journal, root));
|
|
12156
12224
|
const summed = addSpend(childWork, driverInference);
|
|
12157
12225
|
return {
|
|
12158
12226
|
spentTotal: {
|
|
@@ -12163,7 +12231,8 @@ async function terminalAccounting(journal, root, elapsedMs) {
|
|
|
12163
12231
|
},
|
|
12164
12232
|
childWork,
|
|
12165
12233
|
driverInference,
|
|
12166
|
-
gaps
|
|
12234
|
+
gaps,
|
|
12235
|
+
providerModel
|
|
12167
12236
|
};
|
|
12168
12237
|
}
|
|
12169
12238
|
/** The journaled nodes whose usage accounting is incomplete — one `SpendGap` per node+kind,
|
|
@@ -12278,6 +12347,6 @@ function isNonEmptySpend(s) {
|
|
|
12278
12347
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false;
|
|
12279
12348
|
}
|
|
12280
12349
|
//#endregion
|
|
12281
|
-
export {
|
|
12350
|
+
export { defaultSelectWinner as $, validateProfileMaterialization as $t, spendFromUsageEvents as A, runSettledCommand as At, workerTraceEnv as B, CodexExecutionDiagnosticError as Bt, freeSlots as C, padTraceId as Ct, teardownExecutor as D, sanitizeAgentRuntimeEvent as Dt, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as E, createRuntimeStreamEventCollector as Et, createExecutorRegistry as F, DEFAULT_LOCAL_HARNESS as Ft, createPushTraceSource as G, fullProfileMaterialization as Gt, workerTraceSeamKey as H, assertProfileMaterialization as Ht, snapshotExecutorConfig as I, LOCAL_HARNESSES as It, DEFAULT_STALL_AFTER_MS as J, promptModelProfileMaterialization as Jt, decodeToolPart as K, profileMaterializationAxes$1 as Kt, createWorktreeCliExecutor as L, harnessSupportsReasoningEffort as Lt, captureReusableExecutorConfig as M, captureWorktreeDiff as Mt, cliWorktreeExecutor as N, createWorktree as Nt, assertValidBudget as O, sanitizeKnowledgeReadinessReport as Ot, createExecutor as P, removeWorktree as Pt, createSandboxForSpec as Q, sandboxActProfileMaterialization as Qt, WORKER_TRACE_PROPAGATION as R, localHarnessExecutable as Rt, effectiveConcurrency as S, padSpanId as St, rollingDispatch as T, createRuntimeEventCollector as Tt, DEFAULT_SANDBOX_STEERING_MAX_TURNS as U, controlProfileMaterialization as Ut, workerTraceHeaders as V, AGENT_PROFILE_MATERIALIZATION_AXES as Vt, createSteerableSandboxSession as W, defineProfileMaterializationContract as Wt, readWorkerProgress as X, promptResourceProfileMaterialization as Xt, createActivityLog as Y, promptOnlyProfileMaterialization as Yt, createInbox as Z, renderProfileMaterializationIssues as Zt, isWaitOutcome as _, createOtelExporter as _t, pickBestDelivered as a, runBrainLoop as at, validateWaitSpec as b, generateSpanId as bt, driverChild as c, createPropagatingTraceEmitter as ct, deriveNodeExecutionIdentity as d, traceContextToEnv as dt, worktreeCliProfileMaterialization as en, runAgentRounds as et, meterRuntimeOwnedProviderAttempt as f, INTELLIGENCE_WIRE_VERSION as ft, createWaitProbes as g, createOpenInferenceFileExporter as gt, settledToIteration as h, buildRuntimeEventOtelSpans as ht, collectDelivered as i, routerBrain as it, bindReusableExecutorExecutionId as j, runWorktreeHarness as jt, createBudgetPool as k, sanitizeRuntimeStreamEvent as kt, withDriverExecutor as l, mergeTraceEnv as lt, scopeOwnerExecutorNodeContext as m, buildLoopSpanNodes as mt, createSupervisor as n, probeSandboxCapabilities as nt, runFinalizer as o, canonicalObservedModel as ot, recordScopeOwnerMaterialization as p, buildLoopOtelSpans as pt, sandboxSessionTraceSource as q, promptControlProfileMaterialization as qt, bestDelivered as r, acquireSandbox as rt, runTree as s, observedModelMatchesDeclared as st, createRootHandle as t, createSandboxLineage as tt, createScope as u, readTraceContextFromEnv as ut, pollFor as v, exportEvalRuns as vt, queueOf as w, toOtelAttributes as wt, waitUntil as x, loopEventToOtelSpan as xt, timerAt as y, flatOtelSpan as yt, readWorkerTraceContext as z, parseCodexTokenUsage as zt };
|
|
12282
12351
|
|
|
12283
|
-
//# sourceMappingURL=supervisor-
|
|
12352
|
+
//# sourceMappingURL=supervisor-C5pAAPb5.js.map
|