@tangle-network/agent-runtime 0.290.1 → 0.291.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-BdvuHbTG.js → activation-BPZL1WCG.js} +2 -2
- package/dist/{activation-BdvuHbTG.js.map → activation-BPZL1WCG.js.map} +1 -1
- package/dist/{activation-qNAqp9BD.d.ts → activation-D8DOMMZc.d.ts} +2 -2
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-CTw92HIk.js → coordination-driver-CUnF7gfN.js} +3 -2
- package/dist/coordination-driver-CUnF7gfN.js.map +1 -0
- package/dist/{delegate-DhAvvPIP.js → delegate-B0j4915d.js} +2 -2
- package/dist/{delegate-DhAvvPIP.js.map → delegate-B0j4915d.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +2 -2
- package/dist/{graph-2Iea0PDT.js → graph-ByPZb_xc.js} +5 -5
- package/dist/{graph-2Iea0PDT.js.map → graph-ByPZb_xc.js.map} +1 -1
- package/dist/{improvement-cycle-CdT1IClg.js → improvement-cycle-DipoyAM3.js} +4 -4
- package/dist/{improvement-cycle-CdT1IClg.js.map → improvement-cycle-DipoyAM3.js.map} +1 -1
- package/dist/{index-CNHHOhRS.d.ts → index-D-5e8mss.d.ts} +10 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -8
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +4 -4
- package/dist/kernel.d.ts +3 -3
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-liVnm-Gi.d.ts → loop-runner-bin-Bkw-_LkG.d.ts} +2 -2
- package/dist/{loop-runner-bin-BuEFaR7Z.js → loop-runner-bin-DhPBdCux.js} +3 -3
- package/dist/{loop-runner-bin-BuEFaR7Z.js.map → loop-runner-bin-DhPBdCux.js.map} +1 -1
- 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 +5 -5
- package/dist/{model-policy-CA5d1YUP.js → model-policy-DydyWTQg.js} +186 -2
- package/dist/model-policy-DydyWTQg.js.map +1 -0
- package/dist/profiles.js +1 -1
- package/dist/{provision-supervisor-Cm2-dL4F.js → provision-supervisor-DvEpuocs.js} +4 -4
- package/dist/{provision-supervisor-Cm2-dL4F.js.map → provision-supervisor-DvEpuocs.js.map} +1 -1
- package/dist/{runtime-DJ_ISfL-.js → runtime-Ba7oK4M1.js} +9 -9
- package/dist/{runtime-DJ_ISfL-.js.map → runtime-Ba7oK4M1.js.map} +1 -1
- package/dist/{search-method-Q7X92VD3.js → search-method-Cs6SLt8I.js} +3 -3
- package/dist/{search-method-Q7X92VD3.js.map → search-method-Cs6SLt8I.js.map} +1 -1
- package/dist/{server-CRTAzqiD.js → server-CVRFM3ZF.js} +3 -3
- package/dist/{server-CRTAzqiD.js.map → server-CVRFM3ZF.js.map} +1 -1
- package/dist/{stream-agent-turn-kseOD-Ma.d.ts → stream-agent-turn-n3kOukD_.d.ts} +19 -2
- package/dist/{supervise-CClk-m6Y.js → supervise-dYioyGT-.js} +27 -7
- package/dist/supervise-dYioyGT-.js.map +1 -0
- package/dist/{supervisor-CQFcQhlo.js → supervisor-DpUCJtKC.js} +117 -152
- package/dist/supervisor-DpUCJtKC.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 +5 -5
- package/dist/coordination-driver-CTw92HIk.js.map +0 -1
- package/dist/model-policy-CA5d1YUP.js.map +0 -1
- package/dist/supervise-CClk-m6Y.js.map +0 -1
- package/dist/supervisor-CQFcQhlo.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as RetainedInteractiveAdmissionError, d as RetainedRunDispatchBindingError, f as RuntimeRunStateError, i as ConfigError, l as RetainedInteractiveBindingError, m as ValidationError$1, r as BackendTransportError, t as AgentEvalError$1, u as RetainedRunAdmissionError } from "./errors-DodWX-cb.js";
|
|
2
|
-
import { a as concreteProfileModel, c as profileModelExecutionSettings, d as
|
|
2
|
+
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, d as assertRouterAutoDeclaration, f as assertRouterAutoResponse, g as observedModelMatchesDeclared, h as observedModelHasSnapshot, l as profileProviderModel, m as mergeObservedModelIdentity, o as enforceTokenLimits, s as profileBridgeWireModel, t as assertExecutableAgentProfile, u as resolveRouterRetryPolicy } from "./model-policy-DydyWTQg.js";
|
|
3
3
|
import { S as verifyWorkspaceSnapshotArtifacts, i as verifyAgentCandidateWorkspaceArchive } from "./workspace-archive-MhowMCmp.js";
|
|
4
4
|
import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-DWQA4ooo.js";
|
|
5
5
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
@@ -12187,143 +12187,6 @@ function contentRef(prefix, value) {
|
|
|
12187
12187
|
return `${prefix}:${(hash >>> 0).toString(16).padStart(8, "0")}`;
|
|
12188
12188
|
}
|
|
12189
12189
|
//#endregion
|
|
12190
|
-
//#region src/runtime/model-identity.ts
|
|
12191
|
-
const SNAPSHOT_TOKEN = /^[A-Za-z0-9._-]+$/u;
|
|
12192
|
-
const datedIsoSuffix = /^(.*)-(\d{4})-(\d{2})-(\d{2})$/u;
|
|
12193
|
-
const datedCompactSuffix = /^(.*)-(\d{4})(\d{2})(\d{2})$/u;
|
|
12194
|
-
const datedMonthSuffix = /^(.*)-(\d{4})-(\d{2})$/u;
|
|
12195
|
-
/** Match equivalent bare and provider-qualified spellings without discarding observed identity. */
|
|
12196
|
-
function observedModelMatchesDeclared(observed, declared) {
|
|
12197
|
-
const observedIdentity = modelIdentityParts(observed);
|
|
12198
|
-
const declaredIdentity = modelIdentityParts(declared);
|
|
12199
|
-
if (!observedIdentity || !declaredIdentity) return false;
|
|
12200
|
-
if (declaredIdentity.snapshot !== void 0 && (observedIdentity.snapshot !== declaredIdentity.snapshot || observedIdentity.snapshotKind !== declaredIdentity.snapshotKind)) return false;
|
|
12201
|
-
return equivalentModelBase(observedIdentity.base, declaredIdentity.base);
|
|
12202
|
-
}
|
|
12203
|
-
/** Merge two observations of one served model while retaining a snapshot-bearing raw identity. */
|
|
12204
|
-
function mergeObservedModelIdentity(current, next) {
|
|
12205
|
-
const currentIdentity = modelIdentityParts(current);
|
|
12206
|
-
const nextIdentity = modelIdentityParts(next);
|
|
12207
|
-
if (!currentIdentity || !nextIdentity) return void 0;
|
|
12208
|
-
if (!equivalentModelBase(currentIdentity.base, nextIdentity.base)) return void 0;
|
|
12209
|
-
if (currentIdentity.snapshot !== void 0 && nextIdentity.snapshot !== void 0 && (currentIdentity.snapshot !== nextIdentity.snapshot || currentIdentity.snapshotKind !== nextIdentity.snapshotKind)) return;
|
|
12210
|
-
return currentIdentity.snapshot === void 0 && nextIdentity.snapshot !== void 0 ? next : current;
|
|
12211
|
-
}
|
|
12212
|
-
/** Return the canonical model and its validated snapshot kind for runtime evidence reduction. */
|
|
12213
|
-
function canonicalObservedModelParts(model) {
|
|
12214
|
-
const identity = modelIdentityParts(model);
|
|
12215
|
-
if (!identity) return void 0;
|
|
12216
|
-
const base = identity.base.slice(identity.base.lastIndexOf("/") + 1);
|
|
12217
|
-
const canonical = identity.snapshot === void 0 ? base : identity.snapshotKind === "date" ? `${base}-${identity.snapshot}` : `${base}@${identity.snapshot}`;
|
|
12218
|
-
return {
|
|
12219
|
-
base,
|
|
12220
|
-
...identity.snapshot !== void 0 ? { snapshot: identity.snapshot } : {},
|
|
12221
|
-
...identity.snapshotKind !== void 0 ? { snapshotKind: identity.snapshotKind } : {},
|
|
12222
|
-
canonical
|
|
12223
|
-
};
|
|
12224
|
-
}
|
|
12225
|
-
/** Return whether an observed identity includes a provider snapshot. */
|
|
12226
|
-
function observedModelHasSnapshot(model) {
|
|
12227
|
-
return modelIdentityParts(model)?.snapshot !== void 0;
|
|
12228
|
-
}
|
|
12229
|
-
function modelIdentityParts(model) {
|
|
12230
|
-
if (model.length === 0) return null;
|
|
12231
|
-
const at = model.lastIndexOf("@");
|
|
12232
|
-
if (at < 0) {
|
|
12233
|
-
const dated = datedModelIdentity(model);
|
|
12234
|
-
if (dated !== void 0) return dated;
|
|
12235
|
-
return modelLeaf(model).length === 0 ? null : { base: model };
|
|
12236
|
-
}
|
|
12237
|
-
const base = model.slice(0, at);
|
|
12238
|
-
const snapshot = model.slice(at + 1);
|
|
12239
|
-
if (base.length === 0 || modelLeaf(base).length === 0 || !SNAPSHOT_TOKEN.test(snapshot)) return null;
|
|
12240
|
-
return {
|
|
12241
|
-
base,
|
|
12242
|
-
snapshot,
|
|
12243
|
-
snapshotKind: "opaque"
|
|
12244
|
-
};
|
|
12245
|
-
}
|
|
12246
|
-
function equivalentModelBase(observed, declared) {
|
|
12247
|
-
const observedPath = modelBaseParts(observed);
|
|
12248
|
-
const declaredPath = modelBaseParts(declared);
|
|
12249
|
-
if (!samePath(observedPath.path, declaredPath.path)) return false;
|
|
12250
|
-
if (observedPath.provider === void 0 || declaredPath.provider === void 0 || observedPath.provider === declaredPath.provider) return true;
|
|
12251
|
-
if (observedPath.provider === "tangle-router" || declaredPath.provider === "tangle-router") {
|
|
12252
|
-
const router = observedPath.provider === "tangle-router" ? observedPath : declaredPath;
|
|
12253
|
-
const upstream = observedPath.provider === "tangle-router" ? declaredPath : observedPath;
|
|
12254
|
-
if (upstream.provider === void 0) return false;
|
|
12255
|
-
return samePath(router.path, upstream.path) || router.path[0] === upstream.provider && samePath(router.path.slice(1), upstream.path);
|
|
12256
|
-
}
|
|
12257
|
-
return false;
|
|
12258
|
-
}
|
|
12259
|
-
function modelBaseParts(model) {
|
|
12260
|
-
const segments = model.split("/");
|
|
12261
|
-
const normalized = segments.length > 1 && isHarnessPrefix(segments[0]) ? segments.slice(1) : segments;
|
|
12262
|
-
if (normalized.length === 1) return {
|
|
12263
|
-
provider: void 0,
|
|
12264
|
-
path: normalized
|
|
12265
|
-
};
|
|
12266
|
-
return {
|
|
12267
|
-
provider: normalized[0],
|
|
12268
|
-
path: normalized.slice(1)
|
|
12269
|
-
};
|
|
12270
|
-
}
|
|
12271
|
-
function isHarnessPrefix(segment) {
|
|
12272
|
-
return segment !== void 0 && harnessTypeSchema.safeParse(segment).success;
|
|
12273
|
-
}
|
|
12274
|
-
function samePath(left, right) {
|
|
12275
|
-
return left.length === right.length && left.every((segment, index) => segment === right[index]);
|
|
12276
|
-
}
|
|
12277
|
-
function modelLeaf(model) {
|
|
12278
|
-
return model.slice(model.lastIndexOf("/") + 1);
|
|
12279
|
-
}
|
|
12280
|
-
/**
|
|
12281
|
-
* Parse the provider's documented dated snapshot forms.
|
|
12282
|
-
*
|
|
12283
|
-
* `undefined` means that the model has no dated shape and must be treated as a normal base.
|
|
12284
|
-
* `null` means that it has a dated shape but the date is invalid, so identity matching fails.
|
|
12285
|
-
*/
|
|
12286
|
-
function datedModelIdentity(model) {
|
|
12287
|
-
const iso = datedIsoSuffix.exec(model);
|
|
12288
|
-
if (iso) {
|
|
12289
|
-
const [, base, yearText, monthText, dayText] = iso;
|
|
12290
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}-${dayText}`, isValidCalendarDate(yearText, monthText, dayText));
|
|
12291
|
-
}
|
|
12292
|
-
const compact = datedCompactSuffix.exec(model);
|
|
12293
|
-
if (compact) {
|
|
12294
|
-
const [, base, yearText, monthText, dayText] = compact;
|
|
12295
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}-${dayText}`, isValidCalendarDate(yearText, monthText, dayText));
|
|
12296
|
-
}
|
|
12297
|
-
const month = datedMonthSuffix.exec(model);
|
|
12298
|
-
if (month) {
|
|
12299
|
-
const [, base, yearText, monthText] = month;
|
|
12300
|
-
return buildDatedIdentity(base, `${yearText}-${monthText}`, isValidCalendarMonth(yearText, monthText));
|
|
12301
|
-
}
|
|
12302
|
-
}
|
|
12303
|
-
function buildDatedIdentity(base, snapshot, valid) {
|
|
12304
|
-
if (base === void 0 || base.length === 0 || base.endsWith("/")) return void 0;
|
|
12305
|
-
return valid ? {
|
|
12306
|
-
base,
|
|
12307
|
-
snapshot,
|
|
12308
|
-
snapshotKind: "date"
|
|
12309
|
-
} : null;
|
|
12310
|
-
}
|
|
12311
|
-
function isValidCalendarDate(yearText, monthText, dayText) {
|
|
12312
|
-
if (yearText === void 0 || monthText === void 0 || dayText === void 0) return false;
|
|
12313
|
-
const year = Number(yearText);
|
|
12314
|
-
const month = Number(monthText);
|
|
12315
|
-
const day = Number(dayText);
|
|
12316
|
-
if (year < 2e3 || year > 2099 || month < 1 || month > 12 || day < 1 || day > 31) return false;
|
|
12317
|
-
const date = new Date(Date.UTC(year, month - 1, day));
|
|
12318
|
-
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;
|
|
12319
|
-
}
|
|
12320
|
-
function isValidCalendarMonth(yearText, monthText) {
|
|
12321
|
-
if (yearText === void 0 || monthText === void 0) return false;
|
|
12322
|
-
const year = Number(yearText);
|
|
12323
|
-
const month = Number(monthText);
|
|
12324
|
-
return year >= 2e3 && year <= 2099 && month >= 1 && month <= 12;
|
|
12325
|
-
}
|
|
12326
|
-
//#endregion
|
|
12327
12190
|
//#region src/runtime/tool-loop.ts
|
|
12328
12191
|
/**
|
|
12329
12192
|
* THE canonical agentic tool-loop. One inference turn → run any requested tools → fold the
|
|
@@ -12588,7 +12451,7 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
12588
12451
|
let transportAttempts = 1;
|
|
12589
12452
|
const headers = routerRequestHeaders(cfg, opts);
|
|
12590
12453
|
const complete = cfg.complete;
|
|
12591
|
-
const
|
|
12454
|
+
const raw = complete ? await (async () => {
|
|
12592
12455
|
const result = await retryRouterOperation(retry, opts?.signal, (signal) => complete(structuredClone(body), {
|
|
12593
12456
|
headers,
|
|
12594
12457
|
signal
|
|
@@ -12600,10 +12463,11 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
12600
12463
|
method: "POST",
|
|
12601
12464
|
headers,
|
|
12602
12465
|
body: JSON.stringify(body)
|
|
12603
|
-
}, opts?.signal, retry);
|
|
12466
|
+
}, opts?.signal, retry, opts?.onResponse);
|
|
12604
12467
|
transportAttempts = result.attempts;
|
|
12605
12468
|
return routerResponseJson(result.response, result.attempts);
|
|
12606
12469
|
})();
|
|
12470
|
+
const data = raw;
|
|
12607
12471
|
const msg = data.choices?.[0]?.message;
|
|
12608
12472
|
if (!msg) throw new ValidationError$1("router completion: no choices[0].message");
|
|
12609
12473
|
const toolCalls = (msg?.tool_calls ?? []).map((tc, i) => ({
|
|
@@ -12613,6 +12477,7 @@ async function routerChatWithTools(cfg, messages, tools, opts) {
|
|
|
12613
12477
|
}));
|
|
12614
12478
|
const { usage, resources, costUsd, costProvenance, billedCostUsd, cache } = meterTurn(data.usage, cfg.model, transportAttempts);
|
|
12615
12479
|
return {
|
|
12480
|
+
response: raw,
|
|
12616
12481
|
content: msg?.content ?? null,
|
|
12617
12482
|
toolCalls,
|
|
12618
12483
|
transportAttempts,
|
|
@@ -12839,12 +12704,64 @@ function routerRequestHeaders(cfg, opts) {
|
|
|
12839
12704
|
function reportedModel(value) {
|
|
12840
12705
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
12841
12706
|
}
|
|
12842
|
-
async function fetchRouterResponse(url, init, callerSignal, retry) {
|
|
12707
|
+
async function fetchRouterResponse(url, init, callerSignal, retry, onResponse) {
|
|
12708
|
+
let attempt = 0;
|
|
12843
12709
|
const result = await retryRouterOperation(retry, callerSignal, async (signal) => {
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12710
|
+
attempt += 1;
|
|
12711
|
+
const startedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
12712
|
+
let candidate;
|
|
12713
|
+
try {
|
|
12714
|
+
candidate = await fetch(url, {
|
|
12715
|
+
...init,
|
|
12716
|
+
signal
|
|
12717
|
+
});
|
|
12718
|
+
} catch (error) {
|
|
12719
|
+
await observeRouterResponse(onResponse, {
|
|
12720
|
+
endpoint: url,
|
|
12721
|
+
callId: new Headers(init.headers).get("idempotency-key") ?? "",
|
|
12722
|
+
attempt,
|
|
12723
|
+
startedAt,
|
|
12724
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12725
|
+
status: null,
|
|
12726
|
+
headers: {},
|
|
12727
|
+
body: null,
|
|
12728
|
+
error: {
|
|
12729
|
+
name: error instanceof Error ? error.name : "Error",
|
|
12730
|
+
message: error instanceof Error ? error.message : String(error)
|
|
12731
|
+
}
|
|
12732
|
+
}, signal);
|
|
12733
|
+
throw error;
|
|
12734
|
+
}
|
|
12735
|
+
if (onResponse) {
|
|
12736
|
+
const headers = Object.fromEntries([...candidate.headers].filter(([name]) => ![
|
|
12737
|
+
"authorization",
|
|
12738
|
+
"proxy-authorization",
|
|
12739
|
+
"set-cookie",
|
|
12740
|
+
"cookie"
|
|
12741
|
+
].includes(name.toLowerCase())));
|
|
12742
|
+
let body = null;
|
|
12743
|
+
let bodyError;
|
|
12744
|
+
try {
|
|
12745
|
+
body = await candidate.clone().text();
|
|
12746
|
+
} catch (error) {
|
|
12747
|
+
bodyError = error;
|
|
12748
|
+
}
|
|
12749
|
+
await observeRouterResponse(onResponse, {
|
|
12750
|
+
endpoint: url,
|
|
12751
|
+
callId: new Headers(init.headers).get("idempotency-key") ?? "",
|
|
12752
|
+
attempt,
|
|
12753
|
+
startedAt,
|
|
12754
|
+
endedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
12755
|
+
status: candidate.status,
|
|
12756
|
+
headers,
|
|
12757
|
+
body,
|
|
12758
|
+
...bodyError === void 0 ? {} : { error: {
|
|
12759
|
+
name: bodyError instanceof Error ? bodyError.name : "Error",
|
|
12760
|
+
message: bodyError instanceof Error ? bodyError.message : String(bodyError)
|
|
12761
|
+
} }
|
|
12762
|
+
}, signal);
|
|
12763
|
+
if (bodyError !== void 0) throw bodyError;
|
|
12764
|
+
}
|
|
12848
12765
|
if (candidate.ok) return candidate;
|
|
12849
12766
|
const text = await candidate.text().catch(() => "<failed to read response body>");
|
|
12850
12767
|
throw new SDKError(`router ${candidate.status}: ${text.slice(0, 200)}`, {
|
|
@@ -12859,6 +12776,28 @@ async function fetchRouterResponse(url, init, callerSignal, retry) {
|
|
|
12859
12776
|
attempts: result.attempts
|
|
12860
12777
|
};
|
|
12861
12778
|
}
|
|
12779
|
+
/** Evidence failure cannot authorize a second inference, even after the request deadline. */
|
|
12780
|
+
async function observeRouterResponse(observer, receipt, signal) {
|
|
12781
|
+
if (!observer) return;
|
|
12782
|
+
let onAbort;
|
|
12783
|
+
try {
|
|
12784
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
12785
|
+
onAbort = () => reject(signal.reason ?? /* @__PURE__ */ new Error("Response observation aborted"));
|
|
12786
|
+
if (signal.aborted) onAbort();
|
|
12787
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
12788
|
+
});
|
|
12789
|
+
await Promise.race([Promise.resolve().then(() => observer(receipt)), aborted]);
|
|
12790
|
+
} catch (error) {
|
|
12791
|
+
throw new SDKError("Router response observation failed", {
|
|
12792
|
+
code: "UNKNOWN",
|
|
12793
|
+
retryable: false,
|
|
12794
|
+
cause: error instanceof Error ? error : new Error(String(error)),
|
|
12795
|
+
context: { phase: "response_observation" }
|
|
12796
|
+
});
|
|
12797
|
+
} finally {
|
|
12798
|
+
if (onAbort) signal.removeEventListener("abort", onAbort);
|
|
12799
|
+
}
|
|
12800
|
+
}
|
|
12862
12801
|
async function retryRouterOperation(retry, callerSignal, operation) {
|
|
12863
12802
|
let attempts = 0;
|
|
12864
12803
|
try {
|
|
@@ -12869,6 +12808,7 @@ async function retryRouterOperation(retry, callerSignal, operation) {
|
|
|
12869
12808
|
try {
|
|
12870
12809
|
return await operation(attemptSignal.signal);
|
|
12871
12810
|
} catch (error) {
|
|
12811
|
+
if (error instanceof SDKError && error.context?.phase === "response_observation") throw error;
|
|
12872
12812
|
if (callerSignal?.aborted) throw callerSignal.reason ?? error;
|
|
12873
12813
|
if (attemptSignal.signal.aborted) throw new SDKError(`router request timeout after ${retry.requestTimeoutMs}ms`, {
|
|
12874
12814
|
code: "TIMEOUT",
|
|
@@ -18113,6 +18053,7 @@ const ROUTER_TRANSCRIPT_HARNESS = "router";
|
|
|
18113
18053
|
const TURN_CONTENT_BYTES = 256 * 1024;
|
|
18114
18054
|
function createRouterTranscript() {
|
|
18115
18055
|
const kept = [];
|
|
18056
|
+
const records = [];
|
|
18116
18057
|
const seen = /* @__PURE__ */ new WeakSet();
|
|
18117
18058
|
let turnStart = 0;
|
|
18118
18059
|
let replyEchoPending = false;
|
|
@@ -18127,10 +18068,17 @@ function createRouterTranscript() {
|
|
|
18127
18068
|
if (message.role === "assistant") continue;
|
|
18128
18069
|
}
|
|
18129
18070
|
kept.push(message);
|
|
18071
|
+
records.push(message);
|
|
18130
18072
|
}
|
|
18131
18073
|
};
|
|
18132
18074
|
return {
|
|
18133
18075
|
observe,
|
|
18076
|
+
response(receipt) {
|
|
18077
|
+
records.push({
|
|
18078
|
+
type: "provider.response",
|
|
18079
|
+
...receipt
|
|
18080
|
+
});
|
|
18081
|
+
},
|
|
18134
18082
|
reply(reply) {
|
|
18135
18083
|
const message = {
|
|
18136
18084
|
role: "assistant",
|
|
@@ -18145,6 +18093,7 @@ function createRouterTranscript() {
|
|
|
18145
18093
|
})) } : {}
|
|
18146
18094
|
};
|
|
18147
18095
|
kept.push(message);
|
|
18096
|
+
records.push(message);
|
|
18148
18097
|
replyEchoPending = true;
|
|
18149
18098
|
const added = kept.slice(turnStart).map(forTurnEvent);
|
|
18150
18099
|
turnStart = kept.length;
|
|
@@ -18153,7 +18102,7 @@ function createRouterTranscript() {
|
|
|
18153
18102
|
capture() {
|
|
18154
18103
|
if (live !== void 0) observe(live);
|
|
18155
18104
|
if (kept.length === 0) return harnessTranscriptUnavailable("execution-never-started");
|
|
18156
|
-
return harnessTranscriptFromLines(ROUTER_TRANSCRIPT_HARNESS, "conversation",
|
|
18105
|
+
return harnessTranscriptFromLines(ROUTER_TRANSCRIPT_HARNESS, "conversation", records.map((record) => JSON.stringify(record)));
|
|
18157
18106
|
}
|
|
18158
18107
|
};
|
|
18159
18108
|
}
|
|
@@ -18991,6 +18940,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
18991
18940
|
routerKey: seam.routerKey,
|
|
18992
18941
|
tools: seam.tools
|
|
18993
18942
|
}, { multiTurn: true });
|
|
18943
|
+
if (model === "tangle/auto") assertRouterAutoDeclaration(profileExecution.extraBody?.auto, profileExecution.stream);
|
|
18994
18944
|
const enabledToolNames = new Set(seam.tools.map((tool) => tool.function.name));
|
|
18995
18945
|
const maxTurns = profileExecution.maxTurns ?? 0;
|
|
18996
18946
|
const requestIdentity = routerRequestIdentity(ctx);
|
|
@@ -19019,6 +18969,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19019
18969
|
let resources;
|
|
19020
18970
|
let transportAttempts = 0;
|
|
19021
18971
|
let observedModel;
|
|
18972
|
+
const providerResponses = [];
|
|
19022
18973
|
let reasoningTokens = 0;
|
|
19023
18974
|
let reasoningKnown = true;
|
|
19024
18975
|
const promptCache = {};
|
|
@@ -19055,6 +19006,11 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19055
19006
|
}, messages, seam.tools, {
|
|
19056
19007
|
...profileExecution.temperature !== void 0 ? { temperature: profileExecution.temperature } : {},
|
|
19057
19008
|
signal: turnController.signal,
|
|
19009
|
+
onResponse: async (receipt) => {
|
|
19010
|
+
providerResponses.push(receipt);
|
|
19011
|
+
transcript.response(receipt);
|
|
19012
|
+
await seam.onProviderResponse?.(structuredClone(receipt));
|
|
19013
|
+
},
|
|
19058
19014
|
...profileExecution.toolChoice ? { toolChoice: profileExecution.toolChoice } : {},
|
|
19059
19015
|
...profileExecution.tokenLimits.applied,
|
|
19060
19016
|
...profileExecution.seed !== void 0 ? { seed: profileExecution.seed } : {},
|
|
@@ -19092,7 +19048,12 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19092
19048
|
}]))).resources;
|
|
19093
19049
|
transportAttempts += res.transportAttempts;
|
|
19094
19050
|
if (res.model !== void 0) recordRuntimeOwnedProviderModel(executor, res.model);
|
|
19095
|
-
|
|
19051
|
+
if (model === "tangle/auto") {
|
|
19052
|
+
assertRouterAutoResponse(profileExecution.extraBody?.auto, res.response, res.model);
|
|
19053
|
+
tokensKnown = false;
|
|
19054
|
+
reasoningKnown = false;
|
|
19055
|
+
usdKnown = false;
|
|
19056
|
+
} else assertObservedRouterModel(res.model, model, "routerToolsInlineExecutor");
|
|
19096
19057
|
if (res.model !== void 0) observedModel = res.model;
|
|
19097
19058
|
mergePromptCache(promptCache, res.cache);
|
|
19098
19059
|
if (res.usage) {
|
|
@@ -19214,6 +19175,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19214
19175
|
turns,
|
|
19215
19176
|
toolCalls: executedToolCalls,
|
|
19216
19177
|
transportAttempts,
|
|
19178
|
+
providerResponses,
|
|
19217
19179
|
...estimatedUsd !== void 0 ? { estimatedCostUsd: estimatedUsd } : {},
|
|
19218
19180
|
...Object.keys(promptCache).length > 0 ? { promptCache } : {},
|
|
19219
19181
|
...reasoningKnown && turns > 0 ? { reasoningTokens } : {}
|
|
@@ -20042,12 +20004,13 @@ const cliInPlaceExecutor = (spec, ctx) => {
|
|
|
20042
20004
|
function snapshotExecutorConfig(config) {
|
|
20043
20005
|
switch (config.backend) {
|
|
20044
20006
|
case "router-tools": {
|
|
20045
|
-
const { complete, executeToolCall, onMessages, onToolStep, ...decisionData } = config;
|
|
20007
|
+
const { complete, executeToolCall, onMessages, onToolStep, onProviderResponse, ...decisionData } = config;
|
|
20046
20008
|
const snapshot = detachedSnapshot(decisionData, "createExecutor router-tools config");
|
|
20047
20009
|
return Object.freeze({
|
|
20048
20010
|
...snapshot,
|
|
20049
20011
|
...complete === void 0 ? {} : { complete },
|
|
20050
20012
|
executeToolCall,
|
|
20013
|
+
...onProviderResponse === void 0 ? {} : { onProviderResponse },
|
|
20051
20014
|
...onMessages === void 0 ? {} : { onMessages },
|
|
20052
20015
|
...onToolStep === void 0 ? {} : { onToolStep }
|
|
20053
20016
|
});
|
|
@@ -25998,7 +25961,7 @@ function isInfraError(err) {
|
|
|
25998
25961
|
* journal so the executor can run its `act` inside a nested scope. `act` fails loud if
|
|
25999
25962
|
* called directly — a driver child runs THROUGH its nested-scope executor, never as a root.
|
|
26000
25963
|
*/
|
|
26001
|
-
function driverChild(profile, driver, journal, execution, acceptedSubmission, recoverExecutor) {
|
|
25964
|
+
function driverChild(profile, driver, journal, execution, acceptedSubmission, recoverExecutor, unassessedOutput) {
|
|
26002
25965
|
const name = profile.name ?? driver.name;
|
|
26003
25966
|
const traceSource = driver.traceSource;
|
|
26004
25967
|
const progress = driver.progress;
|
|
@@ -26011,6 +25974,7 @@ function driverChild(profile, driver, journal, execution, acceptedSubmission, re
|
|
|
26011
25974
|
driver,
|
|
26012
25975
|
journal,
|
|
26013
25976
|
...acceptedSubmission ? { acceptedSubmission } : {},
|
|
25977
|
+
...unassessedOutput ? { unassessedOutput } : {},
|
|
26014
25978
|
...recoverExecutor ? { recoverExecutor } : {},
|
|
26015
25979
|
...traceSource ? { traceSource } : {},
|
|
26016
25980
|
...progress ? { progress } : {},
|
|
@@ -26134,7 +26098,8 @@ const driverExecutorFactory = (rawSpec, ctx) => {
|
|
|
26134
26098
|
reported: childWork,
|
|
26135
26099
|
reservation: addSpend(childWork, totalMetered)
|
|
26136
26100
|
};
|
|
26137
|
-
const
|
|
26101
|
+
const acceptedSubmission = spec.acceptedSubmission?.() === true;
|
|
26102
|
+
const verdict = !acceptedSubmission && spec.unassessedOutput?.() === true ? void 0 : deriveDeliveryVerdict(events.filter((event) => event.kind === "settled"), out, acceptedSubmission);
|
|
26138
26103
|
artifact = {
|
|
26139
26104
|
outRef: `${driverRuntime}:${nestedRoot}`,
|
|
26140
26105
|
out: out === void 0 ? null : out,
|
|
@@ -28422,6 +28387,6 @@ function isNonEmptySpend(s) {
|
|
|
28422
28387
|
return s.iterations > 0 || s.tokens.input > 0 || s.tokens.output > 0 || s.usd > 0 || s.ms > 0 || s.tokensKnown === false || s.usdKnown === false || Object.values(s.resources ?? {}).some((resource) => resource.amount > 0 || !resource.known);
|
|
28423
28388
|
}
|
|
28424
28389
|
//#endregion
|
|
28425
|
-
export { waitUntil as $,
|
|
28390
|
+
export { waitUntil as $, projectSandboxOutcome as $i, captureWorkerTraceEvidence as $n, runWorktreeHarness as $r, claimsAuthority as $t, driverExecutorFactory as A, withBudgetResources as Aa, writeAllBytes as Ai, providerAsExecutor as An, mergeTraceEnv as Ar, cliInPlaceExecutor as At, recordScopeOwnerDriverAttempt as B, providerMessageText as Ba, recordRuntimeOwnedDriveHarnessProviderEvidence as Bi, FileResultBlobStore as Bn, createOtelExporter as Br, WORKER_TRACE_PROPAGATION as Bt, createContinuationKeeper as C, throwAbort as Ca, sandboxActProfileMaterialization as Ci, captureBeforeDestroy as Cn, runAbortable as Cr, recoverRetainedInteractiveRun as Ct, passedItems as D, zeroSpend as Da, isNoEntError as Di, runBrainLoop as Dn, readHarnessTranscript as Dr, rollingDispatch as Dt, failedItems as E, withTimeout as Ea, worktreeCliProfileMaterialization as Ei, routerBrain as En, persistHarnessTranscript as Er, queueOf as Et, beginScopeOwnerAttempt as F, armDeadlineTimer as Fa, inheritRuntimeOwnedExecutorAttestation as Fi, createPushTraceSource as Fn, resolveRedactor as Fr, createWorktreeCliExecutor as Ft, settledToIteration as G, runtimeOwnedPendingExecutorMaterialization as Gi, assertContentAddress as Gn, padTraceId as Gr, taskToPrompt as Gt, recordScopeOwnerPause as H, runtimeOwnedExecutorExecutionBinding as Hi, InMemoryResultBlobStore as Hn, generateSpanId as Hr, workerTraceEnv as Ht, createScope as I, teardownExecutor as Ia, knownExecutionBindingReceipt as Ii, decodeToolPart as In, buildLoopOtelSpans as Ir, DEFAULT_SANDBOX_STEERING_MAX_TURNS as It, createWaitProbes as J, unknownMaterializationReceipt as Ji, loadSpawnForest as Jn, createRuntimeStreamEventCollector as Jr, readWorkerProgress as Jt, createWorkerSlots as K, runtimeOwnedScopeOwnerRuntime as Ki, encodeResultBlob as Kn, toOtelAttributes as Kr, DEFAULT_STALL_AFTER_MS as Kt, deriveNodeExecutionIdentity as L, teardownSurfaces as La, knownMaterializationReceipt as Li, sandboxSessionTraceSource as Ln, buildLoopSpanNodes as Lr, createSteerableSandboxSession as Lt, withDriverExecutor as M, abortError$2 as Ma, attestRuntimeOwnedScopeOwner as Mi, resolveAgentEnvironmentProvider as Mn, traceContextToEnv as Mr, createExecutor as Mt, SUBTREE_RESULT_LIMIT as N, awaitAbortable$1 as Na, authoredProfileDigest as Ni, unavailablePauseMs as Nn, defaultRedactor as Nr, createExecutorRegistry as Nt, verdictFromJudgeScore as O, addResourceSpend as Oa, prepareJsonlAppend as Oi, LEAF_CONTINUATION_TASK as On, contentAddress as Or, bindReusableExecutorExecutionId as Ot, assertRecursiveReservationPolicy as P, DEFAULT_SUCCESSFUL_SHUTDOWN_MS as Pa, finalizeRuntimeOwnedPendingExecutor as Pi, unavailableSignalOfFailure as Pn, defaultRedactorIdentityMaterial as Pr, snapshotExecutorConfig as Pt, validateWaitSpec as Q, detachedSnapshot as Qi, WORKER_TOOL_TRACE_SCHEMA_VERSION as Qn, runSettledCommand as Qr, PEER_MAIL_WIRE_KEY as Qt, meterRuntimeOwnedAccounting as R, promptFromAgentTurnInput as Ra, newExecutionAttemptId as Ri, registerRetainedExecutorPreparation as Rn, buildRuntimeEventOtelSpans as Rr, createRouterTranscript as Rt, composeContinuationNote as S, stringifySafe as Sa, renderUnsupported as Si, SandboxEvidenceRetentionError as Sn, linkAbort as Sr, reconnectRetainedInteractiveRun as St, expandQuestions as T, unmeteredSpend as Ta, validateProfileMaterialization as Ti, readPromptOptions as Tn, harnessTranscriptArtifact as Tr, freeSlots as Tt, restoreScopeOwnerAcceptedExecution as U, runtimeOwnedExecutorMaterialization as Ui, InMemorySpawnJournal as Un, loopEventToOtelSpan as Ur, workerTraceHeaders as Ut, recordScopeOwnerMaterialization as V, runtimeOwnedDriveHarnessProviderEvidence as Vi, FileSpawnJournal as Vn, flatOtelSpan as Vr, readWorkerTraceContext as Vt, scopeOwnerExecutorNodeContext as W, runtimeOwnedExecutorProviderEvidence as Wi, SpawnEventIndex as Wn, padSpanId as Wr, workerTraceSeamKey as Wt, pollFor as X, executableAgentSpecSnapshot as Xi, pendingWaits as Xn, sanitizeKnowledgeReadinessReport as Xr, AUTHORITY_MARKERS as Xt, isWaitOutcome as Y, executableAgentProfileSnapshot as Yi, materializeTreeView as Yn, sanitizeAgentRuntimeEvent as Yr, createInbox as Yt, timerAt as Z, detachedFrozen as Zi, replaySpawnTree as Zn, sanitizeRuntimeStreamEvent as Zr, DEFAULT_PEER_MAIL_LIMITS as Zt, CheckUnavailableError as _, hasCompleteCacheBreakdown as _a, promptControlProfileMaterialization as _i, isTerminalDecision as _n, retainedCreateMaterial as _r, workerInteractiveAdmissionFile as _t, collectDelivered as a, extractLlmCallEvent as aa, harnessInvocation as ai, isTerminalNodeStatus as an, ReservationWaitRefused as ar, reconcileScopeRetainedOwnerEnvironment as at, bestComposite as b, randomSuffix as ba, promptResourceProfileMaterialization as bi, probeSandboxCapabilities as bn, RunCancellationReason as br, workerInteractiveBindingFile as bt, runTree as c, mapSandboxToolEvent as ca, parseCodexTokenUsage as ci, addHarnessUsage as cn, meterUsageEvent as cr, scopeRetainedOwnerResourceReader as ct, classifyDriverFailure as d, sandboxProgressEvents as da, AGENT_PROFILE_MATERIALIZATION_AXES as di, readCodexRolloutSession as dn, spendFromUsageTotals as dr, SPAWN_RESOURCE_PATH_MAX_BYTES as dt, readSandboxOutcome as ea, captureWorktreeDiff as ei, createPeerMailbox as en, isTraceAnalysisStore as er, bindScopeRetainedOwnerEnvironmentId as et, runDriverWithRetry as f, sumSandboxUsage as fa, assertProfileMaterialization as fi, bridgeRuntimeAttachmentsKey as fn, errMessage as fr, environmentReader as ft, CONTINUATION_FACTS as g, deleteBoxSafe as ga, profileMaterializationAxes$1 as gi, defaultSelectWinner as gn, startRetainedRunInEnvironment as gr, readWorkerInteractiveAdmissions as gt, CONTINUATIONS_DIR as h, cloneSpend as ha, fullProfileMaterialization as hi, createSandboxForSpec as hn, startRetainedRun as hr, interactiveAdmissionSeamKey as ht, bestDelivered as i, createSandboxUsageLedger as ia, LOCAL_HARNESSES as ii, isLiveNodeStatus as in, BudgetReconcileFault as ir, prepareScopeRetainedOwnerTask as it, isDriverSpec as j, decodeHarnessUsage as ja, attestRuntimeOwnedPendingExecutor as ji, providerAsSandboxClient as jn, readTraceContextFromEnv as jr, cliWorktreeExecutor as jt, driverChild as k, resourceTelemetry as ka, readCommittedJsonLines as ki, createAgentEnvironmentProviderRegistry as kn, createPropagatingTraceEmitter as kr, captureReusableExecutorConfig as kt, DriverAttemptsExhaustedError as l, notifySandboxEventObserver as la, CodexExecutionDiagnosticError as li, createCodexRolloutStoreReader as ln, newUsageTotals as lr, scopeRetainedOwnerRestorePoint as lt, upstreamUnavailableSignal as m, chargedTokens as ma, defineProfileMaterializationContract as mi, TERMINAL_DECISIONS as mn, recoverRetainedRun as mr, resolveSpawnResourcePaths as mt, createRootHandle as n, canonicalStreamEventFromSandboxEvent as na, removeWorktree as ni, peerMailTools as nn, workerTraceAnalysisStore as nr, consumeScopeRetainedOwnerResult as nt, pickBestDelivered as o, isSandboxTerminalEvent as oa, harnessSupportsReasoningEffort as oi, bridgeAdmissionRefusal as on, assertValidBudget as or, scopeRetainedOwnerContext as ot, summarizeDriverAttempts as p, addSpend as pa, controlProfileMaterialization as pi, bridgeStopSignalKey as pn, reconnectRetainedRun as pr, hostDirectoryReader as pt, openSlotGroup as q, unknownExecutionBindingReceipt as qi, insideCursorNamespace as qn, createRuntimeEventCollector as qr, createActivityLog as qt, createSupervisor as r, createSandboxToolPartState as ra, DEFAULT_LOCAL_HARNESS as ri, peerMailVerbNames as rn, executorFailure as rr, noteScopeRetainedOwnerCoordination as rt, runFinalizer as s, mapSandboxEvent as sa, localHarnessExecutable as si, bridgeModelRouteRefusal as sn, createBudgetPool as sr, scopeRetainedOwnerPriorSpend as st, DEFAULT_MAX_DEPTH as t, assertSandboxServedModel as ta, createWorktree as ti, isPeerMailEnvelope as tn, parseWorkerToolTraceArtifact as tr, bindScopeRetainedOwnerProvider as tt, HarnessTurnFailedError as u, sandboxEventServedBackend as ua, terminateProcessTreeAndConfirm as ui, harnessUsageIsEmpty as un, spendFromUsageEvents as ur, scopeRetainedOwnerResult as ut, admitContinuationPolicy as v, isAbortError$2 as va, promptModelProfileMaterialization as vi, runAgentRounds as vn, destroyInteractiveEnvironment as vr, attachWorker as vt, distillFindings as w, throwIfAborted as wa, unsupportedProfileDimensions as wi, assertBoxlessPromptOptions as wn, captureHarnessTranscript as wr, startRetainedInteractiveRun as wt, checkVerdictOf as x, sleep as xa, renderProfileMaterializationIssues as xi, acquireSandbox as xn, abortError as xr, workerInteractiveBindingsDir as xt, admitFinding as y, promptCacheTokenClasses as ya, promptOnlyProfileMaterialization as yi, createSandboxLineage as yn, environmentGone as yr, readWorkerInteractiveBinding as yt, meterRuntimeOwnedProviderAttempt as z, promptOptionsFromAgentTurnInput as za, providerAttemptEvidence as zi, retainedExecutorSeamKey as zn, createOpenInferenceFileExporter as zr, createInPlaceCliExecutor as zt };
|
|
28426
28391
|
|
|
28427
|
-
//# sourceMappingURL=supervisor-
|
|
28392
|
+
//# sourceMappingURL=supervisor-DpUCJtKC.js.map
|