@tangle-network/agent-runtime 0.313.1 → 0.313.3
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-DEtkkjNW.js → activation-Cbjng19L.js} +2 -2
- package/dist/{activation-DEtkkjNW.js.map → activation-Cbjng19L.js.map} +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-CeXe3km2.js → coordination-driver-DKoxt1wL.js} +2 -2
- package/dist/{coordination-driver-CeXe3km2.js.map → coordination-driver-DKoxt1wL.js.map} +1 -1
- package/dist/{delegate-CG_iTxla.js → delegate-CpWZOxuA.js} +2 -2
- package/dist/{delegate-CG_iTxla.js.map → delegate-CpWZOxuA.js.map} +1 -1
- package/dist/durable.js +2 -2
- package/dist/{graph-ua9uUqkA.js → graph-Cjplvg8L.js} +5 -5
- package/dist/{graph-ua9uUqkA.js.map → graph-Cjplvg8L.js.map} +1 -1
- package/dist/{improvement-cycle-Buz8X_hE.js → improvement-cycle-BcnpQZOP.js} +4 -4
- package/dist/{improvement-cycle-Buz8X_hE.js.map → improvement-cycle-BcnpQZOP.js.map} +1 -1
- package/dist/index.js +8 -8
- package/dist/intelligence.js +3 -3
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-DVqUUMrG.js → loop-runner-bin-bAbpeDOp.js} +3 -3
- package/dist/{loop-runner-bin-DVqUUMrG.js.map → loop-runner-bin-bAbpeDOp.js.map} +1 -1
- package/dist/loop-runner-bin.js +1 -1
- package/dist/mcp/bin.js +3 -3
- package/dist/mcp/index.js +5 -5
- package/dist/{model-policy-DydyWTQg.js → model-policy-DhvyZ8-O.js} +9 -2
- package/dist/model-policy-DhvyZ8-O.js.map +1 -0
- package/dist/profiles.js +1 -1
- package/dist/{provision-supervisor-_dpcZKRl.js → provision-supervisor-DyIZEbwJ.js} +4 -4
- package/dist/{provision-supervisor-_dpcZKRl.js.map → provision-supervisor-DyIZEbwJ.js.map} +1 -1
- package/dist/{runtime-UQT_8tFV.js → runtime-DqGhWHhs.js} +9 -9
- package/dist/{runtime-UQT_8tFV.js.map → runtime-DqGhWHhs.js.map} +1 -1
- package/dist/{search-executor-CTPMXtJ8.js → search-executor-Q8W7n1Tg.js} +3 -3
- package/dist/{search-executor-CTPMXtJ8.js.map → search-executor-Q8W7n1Tg.js.map} +1 -1
- package/dist/{server-DjzdO6s6.js → server-Brh9r0MK.js} +3 -3
- package/dist/{server-DjzdO6s6.js.map → server-Brh9r0MK.js.map} +1 -1
- package/dist/{supervise-DUR_nu2t.js → supervise-QObMv9Hy.js} +4 -4
- package/dist/{supervise-DUR_nu2t.js.map → supervise-QObMv9Hy.js.map} +1 -1
- package/dist/{supervisor-CBBb97-G.js → supervisor-DwfUsy8w.js} +120 -52
- package/dist/supervisor-DwfUsy8w.js.map +1 -0
- package/dist/testing.js +12 -12
- package/dist/tui/index.js +1 -1
- package/package.json +1 -1
- package/dist/model-policy-DydyWTQg.js.map +0 -1
- package/dist/supervisor-CBBb97-G.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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
2
|
import { $ as randomUuid, B as addTokenUsage, Ct as singleFlightTeardown, G as errorMessage, H as cloneSpend, K as fnv1a32Hex, N as deepFreezeCandidate, O as verifyWorkspaceSnapshotArtifacts, Q as randomSuffix, St as isDeadlineAbortReason, Tt as teardownSurfaces, U as cloneTokenUsage, V as chargedTokens, W as deleteBoxSafe, X as mapWithConcurrency, Y as isAsyncIterable$1, Z as promptCacheTokenClasses, a as verifyAgentCandidateWorkspaceArtifacts, at as unmeteredSpend, bt as boundedChildDeadlineAt, ct as zeroTokenUsage, dt as resourceTelemetry, et as roundBoxMinutes, ft as withBudgetResources, i as readAgentCandidateWorkspaceArtifactFiles, it as throwIfAborted, k as verifiedArtifactChunks, lt as addResourceSpend, mt as CHILD_DEADLINE_REASON, nt as stringifySafe, o as verifyAgentCandidateWorkspaceTree, ot as withTimeout, pt as ACCEPTED_RESULT_GRACE_MS, q as hasCompleteCacheBreakdown, rt as throwAbort, st as zeroSpend, tt as sleep, u as verifyAgentCandidateWorkspaceArchive, ut as assertResources, vt as ROOT_DEADLINE_REASON, wt as teardownExecutor, xt as checkInIdleMs, yt as armDeadlineTimer, z as addSpend } from "./workspace-streams-BEvSX97P.js";
|
|
3
3
|
import { runTaskQueue } from "./task-queue.js";
|
|
4
|
-
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-
|
|
4
|
+
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-DhvyZ8-O.js";
|
|
5
5
|
import { n as assertNoSymlinkDescendant, r as publishExclusiveDurableFile } from "./durable-file-DWQA4ooo.js";
|
|
6
6
|
import { i as notifyRuntimeHookEvent } from "./runtime-hooks-tXpAarhW.js";
|
|
7
7
|
import { AGENT_PROFILE_MATERIALIZATION_AXES, AgentEnvironmentCapabilitiesSchema, AgentExactRunControlRefSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStatusSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentNativeContextContinuationResultSchema, AgentRunCancellationAcknowledgementSchema, AgentRunCancellationRequestSchema, AgentTurnInputSchema, AgentTurnResultSchema, CanonicalStreamEventSchema, ContextTransferRequestSchema, InteractionAcknowledgementSchema, InteractionResponseCommandSchema, NativeContextBoundaryProofSchema, NativeContextContinuationRequestSchema, REASONING_EFFORTS, RuntimeEventEnvelopeSchema, TerminalReplayWindowSchema, TerminalSessionRefSchema, agentCandidateArtifactRefSchema, agentCandidateWorkspaceManifestMaterialSchema, agentCandidateWorkspaceSnapshotEvidenceSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentNativeContextContinuationResultMatchesRequest, agentProfileSchema, agentRunCancellationAcknowledgementMatchesRequest, agentRunCancellationRequestDigest, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalWorkspaceCwd, exactAgentInteractiveSessionStart, harnessTypeSchema, nativeContextContinuationTurnDigest, nativeReasoningControl, profileMaterializationAxes, profileMaterializationAxes as profileMaterializationAxes$1, renderInputPartsAsText, sha256DigestSchema, workspaceCheckpointRequestDigest, workspaceCheckpointResultMatchesRequest, workspaceCleanupAcknowledgementMatches, workspaceCleanupRequestDigest, workspaceForkRequestDigest, workspaceForkResultMatchesRequest } from "@tangle-network/agent-interface";
|
|
@@ -13570,10 +13570,30 @@ async function runBrainLoop(opts) {
|
|
|
13570
13570
|
async function routerChatWithUsage(cfg, messages, opts) {
|
|
13571
13571
|
const url = `${cfg.routerBaseUrl.replace(/\/$/, "")}/chat/completions`;
|
|
13572
13572
|
const headers = routerRequestHeaders(cfg, opts);
|
|
13573
|
+
const body = () => chatCompletionBody(cfg, messages, opts);
|
|
13574
|
+
const retry = resolveRouterRetryPolicy(cfg.retry, "RouterConfig.retry");
|
|
13575
|
+
const complete = cfg.complete;
|
|
13576
|
+
if (complete) {
|
|
13577
|
+
const { value, attempts } = await retryRouterOperation(retry, opts?.signal, (signal) => complete(body(), {
|
|
13578
|
+
headers,
|
|
13579
|
+
signal
|
|
13580
|
+
}));
|
|
13581
|
+
return parseChatResult(value, cfg.model, attempts);
|
|
13582
|
+
}
|
|
13583
|
+
const { response, attempts } = await fetchRouterResponse(url, {
|
|
13584
|
+
method: "POST",
|
|
13585
|
+
headers,
|
|
13586
|
+
body: JSON.stringify(body())
|
|
13587
|
+
}, opts?.signal, retry);
|
|
13588
|
+
return parseChatResult(await routerResponseJson(response, attempts), cfg.model, attempts);
|
|
13589
|
+
}
|
|
13590
|
+
/** The OpenAI-shape request body both plain-chat transports send. One builder so the streamed
|
|
13591
|
+
* completion cannot drift from the buffered one on model, ceilings, seed, or reasoning effort. */
|
|
13592
|
+
function chatCompletionBody(cfg, messages, opts) {
|
|
13573
13593
|
const temperature = opts?.temperature;
|
|
13574
13594
|
const maxTokens = opts?.maxTokens ?? cfg.maxTokens;
|
|
13575
13595
|
const maxCompletionTokens = opts?.maxCompletionTokens ?? cfg.maxCompletionTokens;
|
|
13576
|
-
|
|
13596
|
+
return {
|
|
13577
13597
|
...providerRequestExtras(opts?.extraBody, [
|
|
13578
13598
|
"model",
|
|
13579
13599
|
"messages",
|
|
@@ -13592,22 +13612,7 @@ async function routerChatWithUsage(cfg, messages, opts) {
|
|
|
13592
13612
|
...maxCompletionTokens !== void 0 ? { max_completion_tokens: maxCompletionTokens } : {},
|
|
13593
13613
|
...opts?.seed !== void 0 ? { seed: opts.seed } : {},
|
|
13594
13614
|
...opts?.reasoningEffort ? { reasoning_effort: opts.reasoningEffort } : {}
|
|
13595
|
-
}
|
|
13596
|
-
const retry = resolveRouterRetryPolicy(cfg.retry, "RouterConfig.retry");
|
|
13597
|
-
const complete = cfg.complete;
|
|
13598
|
-
if (complete) {
|
|
13599
|
-
const { value, attempts } = await retryRouterOperation(retry, opts?.signal, (signal) => complete(body(), {
|
|
13600
|
-
headers,
|
|
13601
|
-
signal
|
|
13602
|
-
}));
|
|
13603
|
-
return parseChatResult(value, cfg.model, attempts);
|
|
13604
|
-
}
|
|
13605
|
-
const { response, attempts } = await fetchRouterResponse(url, {
|
|
13606
|
-
method: "POST",
|
|
13607
|
-
headers,
|
|
13608
|
-
body: JSON.stringify(body())
|
|
13609
|
-
}, opts?.signal, retry);
|
|
13610
|
-
return parseChatResult(await routerResponseJson(response, attempts), cfg.model, attempts);
|
|
13615
|
+
};
|
|
13611
13616
|
}
|
|
13612
13617
|
function parseChatResult(json, model, transportAttempts) {
|
|
13613
13618
|
const data = json;
|
|
@@ -13831,10 +13836,76 @@ function readPromptCache(raw) {
|
|
|
13831
13836
|
* why the streamed transport says so explicitly and the buffered one has no equivalent claim to make.
|
|
13832
13837
|
*/
|
|
13833
13838
|
async function streamRouterChatWithTools(cfg, messages, tools, opts) {
|
|
13839
|
+
const streamed = await streamChatCompletion("streamRouterChatWithTools", cfg, toolCompletionBody(cfg, messages, tools, opts), opts);
|
|
13840
|
+
const toolCalls = [...streamed.calls.entries()].sort((a, b) => a[0] - b[0]).map(([index, call]) => ({
|
|
13841
|
+
id: call.id ?? `call_${index}`,
|
|
13842
|
+
name: call.name ?? "",
|
|
13843
|
+
arguments: call.arguments || "{}"
|
|
13844
|
+
}));
|
|
13845
|
+
const { usage, resources, costUsd, costProvenance, billedCostUsd, cache } = meterTurn(streamed.rawUsage, cfg.model, streamed.transportAttempts);
|
|
13846
|
+
return {
|
|
13847
|
+
content: streamed.sawContent ? streamed.content : null,
|
|
13848
|
+
toolCalls,
|
|
13849
|
+
transportAttempts: streamed.transportAttempts,
|
|
13850
|
+
...streamed.model !== void 0 ? { model: streamed.model } : {},
|
|
13851
|
+
...streamed.reasoning ? { reasoning: streamed.reasoning } : {},
|
|
13852
|
+
...streamed.finishReason !== void 0 ? { finishReason: streamed.finishReason } : {},
|
|
13853
|
+
...usage ? { usage } : {},
|
|
13854
|
+
...resources ? { resources } : {},
|
|
13855
|
+
...costUsd !== void 0 ? { costUsd } : {},
|
|
13856
|
+
...costProvenance ? { costProvenance } : {},
|
|
13857
|
+
...billedCostUsd !== void 0 ? { billedCostUsd } : {},
|
|
13858
|
+
...cache ? { cache } : {},
|
|
13859
|
+
...usage ? {} : { usageUnknown: true }
|
|
13860
|
+
};
|
|
13861
|
+
}
|
|
13862
|
+
/**
|
|
13863
|
+
* The SAME completion as `routerChatWithUsage`, taken over SSE (`stream: true`) and reassembled
|
|
13864
|
+
* into the identical `RouterChatResult`: content with any inline `<think>` split out, reasoning,
|
|
13865
|
+
* finish reason, reported model, usage, catalog estimate, billed cost, and prompt cache.
|
|
13866
|
+
*
|
|
13867
|
+
* What it buys: the Tangle Router bounds a request by a deadline that ends when response headers
|
|
13868
|
+
* are committed. A buffered completion commits headers only after the whole generation, so a long
|
|
13869
|
+
* thinking-model answer outlives that deadline and fails with `request_deadline_exceeded`. A
|
|
13870
|
+
* streamed response commits headers at the first byte, so generation length is no longer bounded
|
|
13871
|
+
* by the Router's request deadline.
|
|
13872
|
+
*
|
|
13873
|
+
* Usage that never arrives stays `undefined` (never a fabricated 0), which the executor records as
|
|
13874
|
+
* unknown tokens. A stream that ends without a single choice is refused, matching the buffered
|
|
13875
|
+
* path's refusal of a completion with no `choices[0].message`.
|
|
13876
|
+
*/
|
|
13877
|
+
async function streamRouterChatWithUsage(cfg, messages, opts) {
|
|
13878
|
+
const streamed = await streamChatCompletion("streamRouterChatWithUsage", cfg, chatCompletionBody(cfg, messages, opts), opts);
|
|
13879
|
+
if (!streamed.sawChoice) throwRouterFailureWithAttempts(new ValidationError$1("router stream: completion carried no choices"), streamed.transportAttempts);
|
|
13880
|
+
const { usage, resources, costUsd, costProvenance, billedCostUsd, cache } = meterTurn(streamed.rawUsage, cfg.model, streamed.transportAttempts);
|
|
13881
|
+
return {
|
|
13882
|
+
content: streamed.content,
|
|
13883
|
+
transportAttempts: streamed.transportAttempts,
|
|
13884
|
+
...streamed.model !== void 0 ? { model: streamed.model } : {},
|
|
13885
|
+
...streamed.reasoning ? { reasoning: streamed.reasoning } : {},
|
|
13886
|
+
...usage ? { usage } : {},
|
|
13887
|
+
...resources ? { resources } : {},
|
|
13888
|
+
...costUsd !== void 0 ? { costUsd } : {},
|
|
13889
|
+
...costProvenance ? { costProvenance } : {},
|
|
13890
|
+
...billedCostUsd !== void 0 ? { billedCostUsd } : {},
|
|
13891
|
+
...cache ? { cache } : {},
|
|
13892
|
+
...streamed.finishReason !== void 0 ? { finishReason: streamed.finishReason } : {}
|
|
13893
|
+
};
|
|
13894
|
+
}
|
|
13895
|
+
/**
|
|
13896
|
+
* POST `body` with `stream: true` and fold the SSE chunks into one completion. Both streamed
|
|
13897
|
+
* transports share this reader so content, reasoning, model identity, finish reason, usage, and
|
|
13898
|
+
* tool-call assembly cannot drift between them.
|
|
13899
|
+
*
|
|
13900
|
+
* The caller signal stays attached through the body read: the retry layer's request deadline
|
|
13901
|
+
* covers only response headers, and cancelling the caller must still stop a completion that is
|
|
13902
|
+
* mid-stream rather than leave it reading until the provider finishes.
|
|
13903
|
+
*/
|
|
13904
|
+
async function streamChatCompletion(context, cfg, requestBody, opts) {
|
|
13834
13905
|
const retry = resolveRouterRetryPolicy(cfg.retry, "RouterConfig.retry");
|
|
13835
|
-
if (cfg.complete) throw new ValidationError$1(
|
|
13906
|
+
if (cfg.complete) throw new ValidationError$1(`${context}: RouterConfig.complete is a BUFFERED transport (it returns one parsed completion body) and cannot serve a stream. Drop \`stream\` to use the injected transport, or drop \`complete\` to stream from the router.`);
|
|
13836
13907
|
const body = {
|
|
13837
|
-
...
|
|
13908
|
+
...requestBody,
|
|
13838
13909
|
stream: true,
|
|
13839
13910
|
stream_options: { include_usage: true }
|
|
13840
13911
|
};
|
|
@@ -13846,25 +13917,27 @@ async function streamRouterChatWithTools(cfg, messages, tools, opts) {
|
|
|
13846
13917
|
},
|
|
13847
13918
|
body: JSON.stringify(body)
|
|
13848
13919
|
}, opts?.signal, retry);
|
|
13849
|
-
if (!res.body)
|
|
13920
|
+
if (!res.body) throwRouterFailureWithAttempts(new ValidationError$1(`router ${res.status}: streamed completion returned no response body to read`), transportAttempts);
|
|
13850
13921
|
let content = "";
|
|
13851
13922
|
let sawContent = false;
|
|
13923
|
+
let sawChoice = false;
|
|
13852
13924
|
let fieldReasoning = "";
|
|
13853
13925
|
let finishReason;
|
|
13854
13926
|
let rawUsage;
|
|
13855
13927
|
let observedModel;
|
|
13856
13928
|
const calls = /* @__PURE__ */ new Map();
|
|
13857
13929
|
let lastCallIndex = -1;
|
|
13858
|
-
for await (const chunk of readChatCompletionChunksWithAttempts(res.body, transportAttempts)) {
|
|
13859
|
-
if (chunk.error)
|
|
13930
|
+
for await (const chunk of readChatCompletionChunksWithAttempts(res.body, transportAttempts, opts?.signal)) {
|
|
13931
|
+
if (chunk.error) throwRouterFailureWithAttempts(new ValidationError$1(`router stream error: ${chunk.error.message ?? chunk.error.type ?? "unknown"}`), transportAttempts);
|
|
13860
13932
|
const chunkModel = reportedModel(chunk.model);
|
|
13861
13933
|
if (chunkModel !== void 0) {
|
|
13862
|
-
if (observedModel !== void 0 && observedModel !== chunkModel)
|
|
13934
|
+
if (observedModel !== void 0 && observedModel !== chunkModel) throwRouterFailureWithAttempts(new ValidationError$1(`router stream changed reported model from ${JSON.stringify(observedModel)} to ${JSON.stringify(chunkModel)}`), transportAttempts);
|
|
13863
13935
|
observedModel = chunkModel;
|
|
13864
13936
|
}
|
|
13865
13937
|
if (chunk.usage) rawUsage = chunk.usage;
|
|
13866
13938
|
const choice = chunk.choices?.[0];
|
|
13867
13939
|
if (!choice) continue;
|
|
13940
|
+
sawChoice = true;
|
|
13868
13941
|
if (typeof choice.finish_reason === "string") finishReason = choice.finish_reason;
|
|
13869
13942
|
const delta = choice.delta;
|
|
13870
13943
|
if (!delta) continue;
|
|
@@ -13885,26 +13958,16 @@ async function streamRouterChatWithTools(cfg, messages, tools, opts) {
|
|
|
13885
13958
|
}
|
|
13886
13959
|
}
|
|
13887
13960
|
const split = splitReasoning(content, fieldReasoning.length > 0 ? fieldReasoning : void 0);
|
|
13888
|
-
const toolCalls = [...calls.entries()].sort((a, b) => a[0] - b[0]).map(([index, call]) => ({
|
|
13889
|
-
id: call.id ?? `call_${index}`,
|
|
13890
|
-
name: call.name ?? "",
|
|
13891
|
-
arguments: call.arguments || "{}"
|
|
13892
|
-
}));
|
|
13893
|
-
const { usage, resources, costUsd, costProvenance, billedCostUsd, cache } = meterTurn(rawUsage, cfg.model, transportAttempts);
|
|
13894
13961
|
return {
|
|
13895
|
-
content:
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
...observedModel !== void 0 ? { model: observedModel } : {},
|
|
13962
|
+
content: split.content,
|
|
13963
|
+
sawContent,
|
|
13964
|
+
sawChoice,
|
|
13899
13965
|
...split.reasoning ? { reasoning: split.reasoning } : {},
|
|
13900
13966
|
...finishReason !== void 0 ? { finishReason } : {},
|
|
13901
|
-
...
|
|
13902
|
-
...
|
|
13903
|
-
|
|
13904
|
-
|
|
13905
|
-
...billedCostUsd !== void 0 ? { billedCostUsd } : {},
|
|
13906
|
-
...cache ? { cache } : {},
|
|
13907
|
-
...usage ? {} : { usageUnknown: true }
|
|
13967
|
+
...rawUsage ? { rawUsage } : {},
|
|
13968
|
+
...observedModel !== void 0 ? { model: observedModel } : {},
|
|
13969
|
+
calls,
|
|
13970
|
+
transportAttempts
|
|
13908
13971
|
};
|
|
13909
13972
|
}
|
|
13910
13973
|
function routerRequestHeaders(cfg, opts) {
|
|
@@ -14121,14 +14184,20 @@ function idAlreadyOpen(calls, id) {
|
|
|
14121
14184
|
* body is CANCELLED rather than merely unlocked: releasing the lock alone leaves the connection
|
|
14122
14185
|
* held open until the socket times out, which under a connection pool starves later turns.
|
|
14123
14186
|
*/
|
|
14124
|
-
async function* readChatCompletionChunks(body) {
|
|
14187
|
+
async function* readChatCompletionChunks(body, signal) {
|
|
14188
|
+
signal?.throwIfAborted();
|
|
14125
14189
|
const reader = body.getReader();
|
|
14126
14190
|
const decoder = new TextDecoder();
|
|
14127
14191
|
let buf = "";
|
|
14128
14192
|
let drained = false;
|
|
14193
|
+
const onAbort = () => {
|
|
14194
|
+
reader.cancel(signal?.reason).catch(() => void 0);
|
|
14195
|
+
};
|
|
14196
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
14129
14197
|
try {
|
|
14130
14198
|
for (;;) {
|
|
14131
14199
|
const { done, value } = await reader.read();
|
|
14200
|
+
signal?.throwIfAborted();
|
|
14132
14201
|
buf = normalizeSseLineEndings(done ? buf : buf + decoder.decode(value, { stream: true }), !done);
|
|
14133
14202
|
let sep = buf.indexOf("\n\n");
|
|
14134
14203
|
while (sep !== -1) {
|
|
@@ -14144,13 +14213,14 @@ async function* readChatCompletionChunks(body) {
|
|
|
14144
14213
|
const tail = parseChunkFrame(buf);
|
|
14145
14214
|
if (tail && tail !== "done") yield tail;
|
|
14146
14215
|
} finally {
|
|
14216
|
+
signal?.removeEventListener("abort", onAbort);
|
|
14147
14217
|
if (!drained) await reader.cancel().catch(() => void 0);
|
|
14148
14218
|
reader.releaseLock();
|
|
14149
14219
|
}
|
|
14150
14220
|
}
|
|
14151
|
-
async function* readChatCompletionChunksWithAttempts(body, attempts) {
|
|
14221
|
+
async function* readChatCompletionChunksWithAttempts(body, attempts, signal) {
|
|
14152
14222
|
try {
|
|
14153
|
-
yield* readChatCompletionChunks(body);
|
|
14223
|
+
yield* readChatCompletionChunks(body, signal);
|
|
14154
14224
|
} catch (error) {
|
|
14155
14225
|
throwRouterFailureWithAttempts(error, attempts);
|
|
14156
14226
|
}
|
|
@@ -19774,10 +19844,6 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
19774
19844
|
transcript.observe(messages);
|
|
19775
19845
|
const started = Date.now();
|
|
19776
19846
|
const linked = linkAbort(signal, controller.signal).signal;
|
|
19777
|
-
const extraBody = {
|
|
19778
|
-
...profileExecution.extraBody ?? {},
|
|
19779
|
-
...profileExecution.reasoningEffort ? { reasoning_effort: profileExecution.reasoningEffort } : {}
|
|
19780
|
-
};
|
|
19781
19847
|
recordRuntimeOwnedProviderAttemptStart(executor);
|
|
19782
19848
|
const r = await runRouterTransport("routerInlineExecutor", () => seam.tools ? (profileExecution.stream === true ? streamRouterChatWithTools : routerChatWithTools)({
|
|
19783
19849
|
routerBaseUrl: seam.routerBaseUrl,
|
|
@@ -19791,9 +19857,10 @@ const routerInlineExecutor = (spec, ctx) => {
|
|
|
19791
19857
|
...profileExecution.toolChoice ? { toolChoice: profileExecution.toolChoice } : {},
|
|
19792
19858
|
...profileExecution.tokenLimits.applied,
|
|
19793
19859
|
...profileExecution.seed !== void 0 ? { seed: profileExecution.seed } : {},
|
|
19794
|
-
...
|
|
19860
|
+
...profileExecution.reasoningEffort ? { reasoningEffort: profileExecution.reasoningEffort } : {},
|
|
19861
|
+
...profileExecution.extraBody ? { extraBody: profileExecution.extraBody } : {},
|
|
19795
19862
|
...requestIdentity
|
|
19796
|
-
}) : routerChatWithUsage({
|
|
19863
|
+
}) : (profileExecution.stream === true ? streamRouterChatWithUsage : routerChatWithUsage)({
|
|
19797
19864
|
routerBaseUrl: seam.routerBaseUrl,
|
|
19798
19865
|
routerKey: seam.routerKey,
|
|
19799
19866
|
model,
|
|
@@ -19941,6 +20008,7 @@ const routerToolsInlineExecutor = (spec, ctx) => {
|
|
|
19941
20008
|
const profileExecution = routerProfileExecution(spec.profile, {
|
|
19942
20009
|
routerBaseUrl: seam.routerBaseUrl,
|
|
19943
20010
|
routerKey: seam.routerKey,
|
|
20011
|
+
...seam.complete ? { complete: seam.complete } : {},
|
|
19944
20012
|
tools: seam.tools
|
|
19945
20013
|
}, { multiTurn: true });
|
|
19946
20014
|
if (model === "tangle/auto") assertRouterAutoDeclaration(profileExecution.extraBody?.auto, profileExecution.stream);
|
|
@@ -21397,7 +21465,7 @@ function routerProfileExecution(profile, seam, mode) {
|
|
|
21397
21465
|
const profileEffort = profile.model?.reasoningEffort;
|
|
21398
21466
|
const settings = profileModelExecutionSettings(profile, "routerInlineExecutor");
|
|
21399
21467
|
if (!mode.multiTurn && settings.maxTurns !== void 0) throw new ValidationError$1("routerInlineExecutor: AgentProfile.model.metadata.maxTurns requires the router-tools backend");
|
|
21400
|
-
if (settings.stream === true && seam.
|
|
21468
|
+
if (settings.stream === true && seam.complete !== void 0) throw new ValidationError$1("routerInlineExecutor: AgentProfile.model.metadata.stream requires the HTTP Router transport; RouterSeam.complete returns one buffered completion and cannot serve a stream");
|
|
21401
21469
|
const declaredTools = profile.tools ?? {};
|
|
21402
21470
|
const suppliedTools = seam.tools ?? [];
|
|
21403
21471
|
if (settings.toolChoice !== void 0 && suppliedTools.length === 0) throw new ValidationError$1("routerInlineExecutor: AgentProfile.model.metadata.toolChoice requires at least one enabled tool");
|
|
@@ -30110,4 +30178,4 @@ function isNonEmptySpend(s) {
|
|
|
30110
30178
|
//#endregion
|
|
30111
30179
|
export { environmentReader as $, executableAgentSpecSnapshot as $i, parseWorkerToolTraceArtifact as $n, toOtelAttributes as $r, PEER_MAIL_WIRE_KEY as $t, scopeOwnerExecutorNodeContext as A, sandboxActProfileMaterialization as Ai, resolveAgentEnvironmentProvider as An, resolveHarnessTranscriptCapture as Ar, captureReusableExecutorConfig as At, consumeScopeRetainedOwnerResult as B, knownMaterializationReceipt as Bi, InMemoryResultBlobStore as Bn, defaultRedactor as Br, createInPlaceCliExecutor as Bt, deriveNodeExecutionIdentity as C, profileMaterializationAxes$1 as Ci, readPromptOptions as Cn, abortError as Cr, createContinuationKeeper as Ct, recordScopeOwnerMaterialization as D, promptResourceProfileMaterialization as Di, createAgentEnvironmentProviderRegistry as Dn, harnessTranscriptArtifact as Dr, passedItems as Dt, recordScopeOwnerDriverAttempt as E, promptOnlyProfileMaterialization as Ei, LEAF_CONTINUATION_TASK as En, captureHarnessTranscript as Er, failedItems as Et, seatExecutionProfile as F, attestRuntimeOwnedScopeOwner as Fi, retainedExecutorSeamKey as Fn, ROUTER_PRICE_SOURCE as Fr, snapshotExecutorConfig as Ft, scopeRetainedOwnerContext as G, runtimeOwnedExecutorExecutionBinding as Gi, replaySpawnTree as Gn, buildRuntimeEventOtelSpans as Gr, workerTraceSeamKey as Gt, prepareScopeRetainedOwnerSeatSwitch as H, providerAttemptEvidence as Hi, insideCursorNamespace as Hn, resolveRedactor as Hr, readWorkerTraceContext as Ht, abandonScopeRetainedOwnerInvocation as I, authoredProfileDigest as Ii, unavailablePauseMs as In, createPropagatingTraceEmitter as Ir, createWorktreeCliExecutor as It, scopeRetainedOwnerResourceReader as J, runtimeOwnedPendingExecutorMaterialization as Ji, readCommittedJsonLines as Jn, flatOtelSpan as Jr, createActivityLog as Jt, scopeRetainedOwnerJournalRoot as K, runtimeOwnedExecutorMaterialization as Ki, isNoEntError as Kn, createOpenInferenceFileExporter as Kr, taskToPrompt as Kt, beginScopeRetainedOwnerDrive as L, finalizeRuntimeOwnedPendingExecutor as Li, unavailableSignalOfFailure as Ln, mergeTraceEnv as Lr, DEFAULT_SANDBOX_STEERING_MAX_TURNS as Lt, SeatChain as M, validateProfileMaterialization as Mi, decodeToolPart as Mn, contentAddress as Mr, cliWorktreeExecutor as Mt, SeatChainExhaustedError as N, worktreeCliProfileMaterialization as Ni, sandboxSessionTraceSource as Nn, priceTokens as Nr, createExecutor as Nt, recordScopeOwnerPause as O, renderProfileMaterializationIssues as Oi, providerAsExecutor as On, persistHarnessTranscript as Or, verdictFromJudgeScore as Ot, authoredSeatStages as P, attestRuntimeOwnedPendingExecutor as Pi, registerRetainedExecutorPreparation as Pn, routerTokenPrice as Pr, createExecutorRegistry as Pt, SPAWN_RESOURCE_PATH_MAX_BYTES as Q, executableAgentProfileSnapshot as Qi, isTraceAnalysisStore as Qn, padTraceId as Qr, DEFAULT_PEER_MAIL_LIMITS as Qt, bindScopeRetainedOwnerEnvironmentId as R, inheritRuntimeOwnedExecutorAttestation as Ri, FileResultBlobStore as Rn, readTraceContextFromEnv as Rr, createSteerableSandboxSession as Rt, createScope as S, fullProfileMaterialization as Si, assertBoxlessPromptOptions as Sn, RunCancellationReason as Sr, checkVerdictOf as St, meterRuntimeOwnedProviderAttempt as T, promptModelProfileMaterialization as Ti, runBrainLoop as Tn, runAbortable as Tr, expandQuestions as Tt, prepareScopeRetainedOwnerTask as U, recordRuntimeOwnedDriveHarnessProviderEvidence as Ui, loadSpawnForest as Un, buildLoopOtelSpans as Ur, workerTraceEnv as Ut, noteScopeRetainedOwnerCoordination as V, newExecutionAttemptId as Vi, InMemorySpawnJournal as Vn, defaultRedactorIdentityMaterial as Vr, WORKER_TRACE_PROPAGATION as Vt, reconcileScopeRetainedOwnerEnvironment as W, runtimeOwnedDriveHarnessProviderEvidence as Wi, materializeTreeView as Wn, buildLoopSpanNodes as Wr, workerTraceHeaders as Wt, scopeRetainedOwnerResult as X, unknownExecutionBindingReceipt as Xi, WORKER_TOOL_TRACE_SCHEMA_VERSION as Xn, loopEventToOtelSpan as Xr, createInbox as Xt, scopeRetainedOwnerRestorePoint as Y, runtimeOwnedScopeOwnerRuntime as Yi, writeAllBytes as Yn, generateSpanId as Yr, readWorkerProgress as Yt, scopeRetainedOwnerTurnEnded as Z, unknownMaterializationReceipt as Zi, captureWorkerTraceEvidence as Zn, padSpanId as Zr, AUTHORITY_MARKERS as Zt, isDriverSpec as _, abortError$1 as _a, terminateProcessTreeAndConfirm as _i, runAgentRounds as _n, retainedCreateMaterial as _r, CONTINUATION_FACTS as _t, collectDelivered as a, canonicalStreamEventFromSandboxEvent as aa, runSettledCommand as ai, isLiveNodeStatus as an, createBudgetPool as ar, interactiveAdmissionSeamKey as at, assertRecursiveReservationPolicy as b, promptOptionsFromAgentTurnInput as ba, controlProfileMaterialization as bi, SandboxEvidenceRetentionError as bn, createWorkerSlots as br, admitFinding as bt, runTree as c, extractLlmCallEvent as ca, createWorktree as ci, bridgeModelRouteRefusal as cn, spendFromUsageEvents as cr, reconnectRetainedInteractiveRun as ct, classifyDriverFailure as d, mapSandboxToolEvent as da, LOCAL_HARNESSES as di, harnessUsageIsEmpty as dn, bridgeStopSignalKey as dr, freeSlots as dt, detachedFrozen as ea, createRuntimeEventCollector as ei, claimsAuthority as en, workerTraceAnalysisStore as er, hostDirectoryReader as et, runDriverWithRetry as f, notifySandboxEventObserver as fa, harnessInvocation as fi, readCodexRolloutSession as fn, errMessage as fr, queueOf as ft, driverExecutorFactory as g, decodeHarnessUsage as ga, CodexExecutionDiagnosticError as gi, isTerminalDecision as gn, startRetainedRunInEnvironment as gr, CONTINUATIONS_DIR as gt, driverChild as h, sumSandboxUsage as ha, parseCodexTokenUsage as hi, defaultSelectWinner as hn, startRetainedRun as hr, mapExecutorResult as ht, bestDelivered as i, assertSandboxServedModel as ia, sanitizeRuntimeStreamEvent as ii, peerMailVerbNames as in, assertValidBudget as ir, providerVisibleProfile as it, settledToIteration as j, unsupportedProfileDimensions as ji, createPushTraceSource as jn, retainHarnessTranscript as jr, cliInPlaceExecutor as jt, restoreScopeOwnerAcceptedExecution as k, renderUnsupported as ki, providerAsSandboxClient as kn, readHarnessTranscript as kr, bindReusableExecutorExecutionId as kt, DriverAttemptsExhaustedError as l, isSandboxTerminalEvent as la, removeWorktree as li, addHarnessUsage as ln, spendFromUsageTotals as lr, recoverRetainedInteractiveRun as lt, upstreamUnavailableSignal as m, sandboxProgressEvents as ma, localHarnessExecutable as mi, createSandboxForSpec as mn, recoverRetainedRun as mr, gateOnDeliverable as mt, createRootHandle as n, projectSandboxOutcome as na, sanitizeAgentRuntimeEvent as ni, isPeerMailEnvelope as nn, BudgetReconcileFault as nr, coordinationMcpAlias as nt, pickBestDelivered as o, createSandboxToolPartState as oa, runWorktreeHarness as oi, isTerminalNodeStatus as on, meterUsageEvent as or, attachWorker as ot, summarizeDriverAttempts as p, sandboxEventServedBackend as pa, harnessSupportsReasoningEffort as pi, TERMINAL_DECISIONS as pn, reconnectRetainedRun as pr, rollingDispatch as pt, scopeRetainedOwnerPriorSpend as q, runtimeOwnedExecutorProviderEvidence as qi, prepareJsonlAppend as qn, createOtelExporter as qr, DEFAULT_STALL_AFTER_MS as qt, createSupervisor as r, readSandboxOutcome as ra, sanitizeKnowledgeReadinessReport as ri, peerMailTools as rn, ReservationWaitRefused as rr, coordinationProfileToolPrefix as rt, runFinalizer as s, createSandboxUsageLedger as sa, captureWorktreeDiff as si, bridgeAdmissionRefusal as sn, newUsageTotals as sr, readWorkerInteractiveBinding as st, DEFAULT_MAX_DEPTH as t, detachedSnapshot as ta, createRuntimeStreamEventCollector as ti, createPeerMailbox as tn, executorFailure as tr, resolveSpawnResourcePaths as tt, HarnessTurnFailedError as u, mapSandboxEvent as ua, DEFAULT_LOCAL_HARNESS as ui, createCodexRolloutStoreReader as un, bridgeRuntimeAttachmentsKey as ur, startRetainedInteractiveRun as ut, withDriverExecutor as v, awaitAbortable$1 as va, AGENT_PROFILE_MATERIALIZATION_AXES as vi, createSandboxLineage as vn, destroyInteractiveEnvironment as vr, CheckUnavailableError as vt, meterRuntimeOwnedAccounting as w, promptControlProfileMaterialization as wi, routerBrain as wn, linkAbort as wr, distillFindings as wt, beginScopeOwnerAttempt as x, providerMessageText as xa, defineProfileMaterializationContract as xi, captureBeforeDestroy as xn, openSlotGroup as xr, bestComposite as xt, SUBTREE_RESULT_LIMIT as y, promptFromAgentTurnInput as ya, assertProfileMaterialization as yi, acquireSandbox as yn, environmentGone as yr, admitContinuationPolicy as yt, bindScopeRetainedOwnerProvider as z, knownExecutionBindingReceipt as zi, FileSpawnJournal as zn, traceContextToEnv as zr, createRouterTranscript as zt };
|
|
30112
30180
|
|
|
30113
|
-
//# sourceMappingURL=supervisor-
|
|
30181
|
+
//# sourceMappingURL=supervisor-DwfUsy8w.js.map
|