@tangle-network/agent-runtime 0.314.2 → 0.317.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/README.md +6 -0
- package/dist/{activation-BpMnOlw5.d.ts → activation-BFDmjaKP.d.ts} +2 -2
- package/dist/{activation-Ci20OAsG.js → activation-CvdE2HIU.js} +3 -3
- package/dist/{activation-Ci20OAsG.js.map → activation-CvdE2HIU.js.map} +1 -1
- package/dist/agent.d.ts +2 -1
- package/dist/agent.js +2 -2
- package/dist/{bundle-BK3XBY6q.js → bundle-RgHpAFDY.js} +2 -2
- package/dist/{bundle-BK3XBY6q.js.map → bundle-RgHpAFDY.js.map} +1 -1
- package/dist/candidate-execution/index.js +5 -5
- package/dist/{coordination-driver-CyJF37L8.js → coordination-driver-DGhN8GO9.js} +3 -3
- package/dist/{coordination-driver-CyJF37L8.js.map → coordination-driver-DGhN8GO9.js.map} +1 -1
- package/dist/{delegate-CTezpiM2.js → delegate-B5pmSbQa.js} +2 -2
- package/dist/{delegate-CTezpiM2.js.map → delegate-B5pmSbQa.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +4 -4
- package/dist/{graph-DGDrO_ZW.js → graph-G0j1ysqe.js} +4 -4
- package/dist/{graph-DGDrO_ZW.js.map → graph-G0j1ysqe.js.map} +1 -1
- package/dist/{improvement-cycle-DReg-Qi4.js → improvement-cycle-D7yR6GC2.js} +6 -6
- package/dist/{improvement-cycle-DReg-Qi4.js.map → improvement-cycle-D7yR6GC2.js.map} +1 -1
- package/dist/{index-B89bMKhD.d.ts → index-CUh40yUJ.d.ts} +13 -90
- package/dist/index.d.ts +4 -4
- package/dist/index.js +9 -9
- package/dist/integrations-DopfCC2a.d.ts +190 -0
- package/dist/integrations-dFi-ALk7.js +132 -0
- package/dist/integrations-dFi-ALk7.js.map +1 -0
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +7 -7
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-eoycPwY3.js → loop-runner-bin-CFVX4oi0.js} +3 -3
- package/dist/{loop-runner-bin-eoycPwY3.js.map → loop-runner-bin-CFVX4oi0.js.map} +1 -1
- package/dist/{loop-runner-bin-BM1in-RT.d.ts → loop-runner-bin-DQKLUt0l.d.ts} +2 -2
- 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 +74 -33
- package/dist/mcp/index.js +129 -6
- package/dist/mcp/index.js.map +1 -1
- package/dist/{openai-tools-xPO6dzf4.d.ts → openai-tools-u3gWBi3x.d.ts} +2 -2
- package/dist/placement.d.ts +132 -0
- package/dist/placement.js +319 -0
- package/dist/placement.js.map +1 -0
- package/dist/platform.d.ts +1 -188
- package/dist/platform.js +1 -129
- package/dist/platform.js.map +1 -1
- package/dist/{prepare-8A1CAWG8.js → prepare-CD9kR0gS.js} +3 -3
- package/dist/{prepare-8A1CAWG8.js.map → prepare-CD9kR0gS.js.map} +1 -1
- package/dist/{profile-BhQShsM1.js → profile-CHXYmpGd.js} +2 -2
- package/dist/{profile-BhQShsM1.js.map → profile-CHXYmpGd.js.map} +1 -1
- package/dist/profile-materialization-Cca615eu.d.ts +90 -0
- package/dist/profiles.d.ts +1 -1
- package/dist/{protected-model-port-ug52OmvB.js → protected-model-port-B0pHd65J.js} +4 -4
- package/dist/{protected-model-port-ug52OmvB.js.map → protected-model-port-B0pHd65J.js.map} +1 -1
- package/dist/{provision-supervisor-B6D3XRbL.js → provision-supervisor-BQLLrUtn.js} +4 -4
- package/dist/{provision-supervisor-B6D3XRbL.js.map → provision-supervisor-BQLLrUtn.js.map} +1 -1
- package/dist/{runtime-NlIVxRXu.js → runtime-B9BOFyEp.js} +10 -9
- package/dist/runtime-B9BOFyEp.js.map +1 -0
- package/dist/{search-executor-DFs-79tK.js → search-executor-B5ZVFsDV.js} +3 -3
- package/dist/{search-executor-DFs-79tK.js.map → search-executor-B5ZVFsDV.js.map} +1 -1
- package/dist/{server-B8ubWXpW.js → server-TwpH9aik.js} +4 -4
- package/dist/{server-B8ubWXpW.js.map → server-TwpH9aik.js.map} +1 -1
- package/dist/{supervise-BE9ta8bl.js → supervise-CU6AuxWY.js} +119 -29
- package/dist/supervise-CU6AuxWY.js.map +1 -0
- package/dist/{supervisor-DmSuKksw.js → supervisor-CbFyf48U.js} +3 -3
- package/dist/{supervisor-DmSuKksw.js.map → supervisor-CbFyf48U.js.map} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +14 -14
- package/dist/tool-loop.d.ts +45 -6
- package/dist/tool-loop.js +49 -21
- package/dist/tool-loop.js.map +1 -1
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/dist/workspace-store/index.d.ts +206 -0
- package/dist/workspace-store/index.js +855 -0
- package/dist/workspace-store/index.js.map +1 -0
- package/dist/{workspace-streams-BEvSX97P.js → workspace-streams-DkijayqX.js} +16 -3
- package/dist/workspace-streams-DkijayqX.js.map +1 -0
- package/package.json +11 -1
- package/skills/profile-authoring/SKILL.md +114 -171
- package/dist/runtime-NlIVxRXu.js.map +0 -1
- package/dist/supervise-BE9ta8bl.js.map +0 -1
- package/dist/workspace-streams-BEvSX97P.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $n as parseWorkerToolTraceArtifact, $r as toOtelAttributes, A as scopeOwnerExecutorNodeContext, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ci as profileMaterializationAxes$1, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, F as seatExecutionProfile, Fi as attestRuntimeOwnedScopeOwner, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as runtimeOwnedExecutorExecutionBinding, H as prepareScopeRetainedOwnerSeatSwitch, Hi as providerAttemptEvidence, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Ji as runtimeOwnedPendingExecutorMaterialization, Jn as readCommittedJsonLines, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Ki as runtimeOwnedExecutorMaterialization, Kn as isNoEntError, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mr as contentAddress, N as SeatChainExhaustedError, Ni as worktreeCliProfileMaterialization, Nt as createExecutor, O as recordScopeOwnerPause, Or as persistHarnessTranscript, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, R as bindScopeRetainedOwnerEnvironmentId, Ri as inheritRuntimeOwnedExecutorAttestation, Si as fullProfileMaterialization, Sr as RunCancellationReason, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, Ti as promptModelProfileMaterialization, Tr as runAbortable, U as prepareScopeRetainedOwnerTask, Ui as recordRuntimeOwnedDriveHarnessProviderEvidence, V as noteScopeRetainedOwnerCoordination, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wi as runtimeOwnedDriveHarnessProviderEvidence, X as scopeRetainedOwnerResult, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Yi as runtimeOwnedScopeOwnerRuntime, Yr as generateSpanId, Z as scopeRetainedOwnerTurnEnded, _ as isDriverSpec, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, bi as controlProfileMaterialization, c as runTree, cn as bridgeModelRouteRefusal, dr as bridgeStopSignalKey, f as runDriverWithRetry, fr as errMessage, g as driverExecutorFactory, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ir as assertValidBudget, it as providerVisibleProfile, ji as unsupportedProfileDimensions, k as restoreScopeOwnerAcceptedExecution, ki as renderUnsupported, kr as readHarnessTranscript, kt as bindReusableExecutorExecutionId, lr as spendFromUsageTotals, mt as gateOnDeliverable, n as createRootHandle, nt as coordinationMcpAlias, or as meterUsageEvent, p as summarizeDriverAttempts, q as scopeRetainedOwnerPriorSpend, qi as runtimeOwnedExecutorProviderEvidence, qn as prepareJsonlAppend, qr as createOtelExporter, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, sr as newUsageTotals, ta as detachedSnapshot, tr as executorFailure, u as HarnessTurnFailedError, ur as bridgeRuntimeAttachmentsKey, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wi as promptControlProfileMaterialization, wn as routerBrain, wr as linkAbort, x as beginScopeOwnerAttempt, xi as defineProfileMaterializationContract, xt as bestComposite, yi as assertProfileMaterialization, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zt as createRouterTranscript } from "./supervisor-
|
|
1
|
+
import { $n as parseWorkerToolTraceArtifact, $r as toOtelAttributes, A as scopeOwnerExecutorNodeContext, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ci as profileMaterializationAxes$1, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, F as seatExecutionProfile, Fi as attestRuntimeOwnedScopeOwner, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as runtimeOwnedExecutorExecutionBinding, H as prepareScopeRetainedOwnerSeatSwitch, Hi as providerAttemptEvidence, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Ji as runtimeOwnedPendingExecutorMaterialization, Jn as readCommittedJsonLines, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Ki as runtimeOwnedExecutorMaterialization, Kn as isNoEntError, L as beginScopeRetainedOwnerDrive, M as SeatChain, Mr as contentAddress, N as SeatChainExhaustedError, Ni as worktreeCliProfileMaterialization, Nt as createExecutor, O as recordScopeOwnerPause, Or as persistHarnessTranscript, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, R as bindScopeRetainedOwnerEnvironmentId, Ri as inheritRuntimeOwnedExecutorAttestation, Si as fullProfileMaterialization, Sr as RunCancellationReason, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, Ti as promptModelProfileMaterialization, Tr as runAbortable, U as prepareScopeRetainedOwnerTask, Ui as recordRuntimeOwnedDriveHarnessProviderEvidence, V as noteScopeRetainedOwnerCoordination, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wi as runtimeOwnedDriveHarnessProviderEvidence, X as scopeRetainedOwnerResult, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Yi as runtimeOwnedScopeOwnerRuntime, Yr as generateSpanId, Z as scopeRetainedOwnerTurnEnded, _ as isDriverSpec, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, bi as controlProfileMaterialization, c as runTree, cn as bridgeModelRouteRefusal, dr as bridgeStopSignalKey, f as runDriverWithRetry, fr as errMessage, g as driverExecutorFactory, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ir as assertValidBudget, it as providerVisibleProfile, ji as unsupportedProfileDimensions, k as restoreScopeOwnerAcceptedExecution, ki as renderUnsupported, kr as readHarnessTranscript, kt as bindReusableExecutorExecutionId, lr as spendFromUsageTotals, mt as gateOnDeliverable, n as createRootHandle, nt as coordinationMcpAlias, or as meterUsageEvent, p as summarizeDriverAttempts, q as scopeRetainedOwnerPriorSpend, qi as runtimeOwnedExecutorProviderEvidence, qn as prepareJsonlAppend, qr as createOtelExporter, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, sr as newUsageTotals, ta as detachedSnapshot, tr as executorFailure, u as HarnessTurnFailedError, ur as bridgeRuntimeAttachmentsKey, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wi as promptControlProfileMaterialization, wn as routerBrain, wr as linkAbort, x as beginScopeOwnerAttempt, xi as defineProfileMaterializationContract, xt as bestComposite, yi as assertProfileMaterialization, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zt as createRouterTranscript } from "./supervisor-CbFyf48U.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
|
-
import {
|
|
3
|
+
import { B as addSpend, Et as teardownSurfaces, K as errorMessage, Tt as teardownExecutor, X as isAsyncIterable$1, ct as zeroSpend, ft as resourceTelemetry, nt as sleep, ot as unmeteredSpend, pt as withBudgetResources, st as withTimeout, ut as addResourceSpend, vt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS } from "./workspace-streams-DkijayqX.js";
|
|
4
4
|
import { _ as agentHarness, a as concreteProfileModel, c as profileModelExecutionSettings, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile, v as harnessRunsAgent } from "./model-policy-DhvyZ8-O.js";
|
|
5
5
|
import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
|
|
6
6
|
import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
|
|
7
|
-
import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-
|
|
7
|
+
import { C as createInMemoryRunContext, D as applyRunCancellation, M as coordinationVerbNames, O as watchRunCancellation, P as createCoordinationToolsForManager, S as createFileRunContext, c as resolveWakePolicy, f as createProgressTracker, h as progressStop, m as plateau, n as createSteerAcknowledger, o as composeWakeInput, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as withRunContext } from "./coordination-driver-DGhN8GO9.js";
|
|
8
8
|
import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
|
|
9
9
|
import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-DSCWdbX2.js";
|
|
10
10
|
import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
|
|
@@ -25,6 +25,35 @@ import { withProfileKb } from "@tangle-network/agent-interface/profile-kb";
|
|
|
25
25
|
const COORDINATION_CLIENT_TOOL_TIMEOUT_MS = 3e5;
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/runtime/supervise/coordination-http.ts
|
|
28
|
+
/** The JSON-RPC error a refusal carries. MCP clients put a non-2xx body into the error the agent
|
|
29
|
+
* sees, so without it the agent reads only `Error POSTing to endpoint:` and a status at best. The
|
|
30
|
+
* messages are fixed text: never a credential, a request body or an arbitrary error string. */
|
|
31
|
+
function rejectionBody(reason, limits) {
|
|
32
|
+
return {
|
|
33
|
+
jsonrpc: "2.0",
|
|
34
|
+
id: null,
|
|
35
|
+
error: {
|
|
36
|
+
code: -32e3,
|
|
37
|
+
message: {
|
|
38
|
+
"method-not-allowed": "coordination accepts only POST",
|
|
39
|
+
"unknown-path": "no coordination endpoint at this path",
|
|
40
|
+
"wrong-host": "this coordination endpoint does not serve the requested host",
|
|
41
|
+
"origin-refused": "coordination refuses requests from this browser origin",
|
|
42
|
+
"listener-closed": "this coordination endpoint is closed: the manager it served has ended",
|
|
43
|
+
"scope-stopped": "the manager this coordination endpoint serves has been stopped",
|
|
44
|
+
"credential-refused": "the coordination credential is missing, invalid, expired or revoked",
|
|
45
|
+
"unsupported-content-type": "coordination requests must be application/json",
|
|
46
|
+
"body-too-large": `coordination request bodies are limited to ${limits.maxRequestBytes} bytes`,
|
|
47
|
+
"malformed-request": "the request is not one JSON-RPC 2.0 message",
|
|
48
|
+
"request-limit": `coordination admits ${limits.maxConcurrentRequests} concurrent requests and ${limits.requestsPerMinute} a minute; retry shortly`,
|
|
49
|
+
"body-timeout": `the request body did not arrive within ${limits.requestTimeoutMs} ms`,
|
|
50
|
+
"action-timeout": `the action did not finish within ${limits.requestTimeoutMs} ms and may still complete; read its outcome before repeating it`,
|
|
51
|
+
"handler-failed": "the coordination handler failed"
|
|
52
|
+
}[reason],
|
|
53
|
+
data: { reason }
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
28
57
|
function coordinationHttpLimits(options) {
|
|
29
58
|
const positive = (name, value, fallback) => {
|
|
30
59
|
const resolved = value ?? fallback;
|
|
@@ -54,12 +83,13 @@ function coordinationHttpHandler(input) {
|
|
|
54
83
|
let controlRequests = 0;
|
|
55
84
|
let windowStart = Date.now();
|
|
56
85
|
let requests = 0;
|
|
57
|
-
const audit = async (outcome, status, action) => {
|
|
86
|
+
const audit = async (outcome, status, action, reason) => {
|
|
58
87
|
await input.options.onAudit?.({
|
|
59
88
|
...input.identity,
|
|
60
89
|
outcome,
|
|
61
90
|
status,
|
|
62
|
-
...action ? { action } : {}
|
|
91
|
+
...action ? { action } : {},
|
|
92
|
+
...reason ? { reason } : {}
|
|
63
93
|
});
|
|
64
94
|
};
|
|
65
95
|
return (req, res) => {
|
|
@@ -90,12 +120,15 @@ function coordinationHttpHandler(input) {
|
|
|
90
120
|
res.end(value === void 0 ? void 0 : JSON.stringify(value));
|
|
91
121
|
if (!executing) release();
|
|
92
122
|
};
|
|
93
|
-
const reject = (status) => {
|
|
94
|
-
respond(status);
|
|
95
|
-
audit("rejected", status, action).catch(() => void 0);
|
|
123
|
+
const reject = ({ status, reason }) => {
|
|
124
|
+
respond(status, rejectionBody(reason, limits));
|
|
125
|
+
audit("rejected", status, action, reason).catch(() => void 0);
|
|
96
126
|
req.resume();
|
|
97
127
|
};
|
|
98
|
-
req.on("error", () => reject(
|
|
128
|
+
req.on("error", () => reject({
|
|
129
|
+
status: 400,
|
|
130
|
+
reason: "malformed-request"
|
|
131
|
+
}));
|
|
99
132
|
req.on("aborted", () => {
|
|
100
133
|
finished = true;
|
|
101
134
|
if (!executing) release();
|
|
@@ -105,7 +138,10 @@ function coordinationHttpHandler(input) {
|
|
|
105
138
|
if (!executing) release();
|
|
106
139
|
});
|
|
107
140
|
if (req.method !== "POST") {
|
|
108
|
-
reject(
|
|
141
|
+
reject({
|
|
142
|
+
status: 405,
|
|
143
|
+
reason: "method-not-allowed"
|
|
144
|
+
});
|
|
109
145
|
return;
|
|
110
146
|
}
|
|
111
147
|
const authorization = input.authorize(req);
|
|
@@ -115,16 +151,25 @@ function coordinationHttpHandler(input) {
|
|
|
115
151
|
}
|
|
116
152
|
const origin = req.headers.origin;
|
|
117
153
|
if (origin !== void 0 && !limits.origins.has(origin)) {
|
|
118
|
-
reject(
|
|
154
|
+
reject({
|
|
155
|
+
status: 403,
|
|
156
|
+
reason: "origin-refused"
|
|
157
|
+
});
|
|
119
158
|
return;
|
|
120
159
|
}
|
|
121
160
|
if (req.headers["content-type"]?.split(";", 1)[0]?.trim().toLowerCase() !== "application/json") {
|
|
122
|
-
reject(
|
|
161
|
+
reject({
|
|
162
|
+
status: 415,
|
|
163
|
+
reason: "unsupported-content-type"
|
|
164
|
+
});
|
|
123
165
|
return;
|
|
124
166
|
}
|
|
125
167
|
const length = req.headers["content-length"];
|
|
126
168
|
if (length !== void 0 && (!/^\d+$/.test(length) || Number(length) > limits.maxRequestBytes)) {
|
|
127
|
-
reject(
|
|
169
|
+
reject({
|
|
170
|
+
status: 413,
|
|
171
|
+
reason: "body-too-large"
|
|
172
|
+
});
|
|
128
173
|
return;
|
|
129
174
|
}
|
|
130
175
|
const now = Date.now();
|
|
@@ -136,7 +181,10 @@ function coordinationHttpHandler(input) {
|
|
|
136
181
|
controlAdmission = active + input.backgroundActions() >= limits.maxConcurrentRequests || requests >= limits.requestsPerMinute;
|
|
137
182
|
if (controlAdmission) {
|
|
138
183
|
if (controlActive >= 2 || controlRequests >= 60) {
|
|
139
|
-
reject(
|
|
184
|
+
reject({
|
|
185
|
+
status: 429,
|
|
186
|
+
reason: "request-limit"
|
|
187
|
+
});
|
|
140
188
|
return;
|
|
141
189
|
}
|
|
142
190
|
controlActive++;
|
|
@@ -147,7 +195,13 @@ function coordinationHttpHandler(input) {
|
|
|
147
195
|
admitted = true;
|
|
148
196
|
timer = setTimeout(() => {
|
|
149
197
|
timedOut = true;
|
|
150
|
-
reject(executing ?
|
|
198
|
+
reject(executing ? {
|
|
199
|
+
status: 504,
|
|
200
|
+
reason: "action-timeout"
|
|
201
|
+
} : {
|
|
202
|
+
status: 408,
|
|
203
|
+
reason: "body-timeout"
|
|
204
|
+
});
|
|
151
205
|
}, limits.requestTimeoutMs);
|
|
152
206
|
timer.unref();
|
|
153
207
|
let size = 0;
|
|
@@ -156,7 +210,10 @@ function coordinationHttpHandler(input) {
|
|
|
156
210
|
if (finished) return;
|
|
157
211
|
size += chunk.length;
|
|
158
212
|
if (size > limits.maxRequestBytes) {
|
|
159
|
-
reject(
|
|
213
|
+
reject({
|
|
214
|
+
status: 413,
|
|
215
|
+
reason: "body-too-large"
|
|
216
|
+
});
|
|
160
217
|
return;
|
|
161
218
|
}
|
|
162
219
|
chunks.push(chunk);
|
|
@@ -167,12 +224,18 @@ function coordinationHttpHandler(input) {
|
|
|
167
224
|
try {
|
|
168
225
|
const value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(Buffer.concat(chunks)));
|
|
169
226
|
if (!value || typeof value !== "object" || Array.isArray(value) || !("jsonrpc" in value) || value.jsonrpc !== "2.0" || !("method" in value) || typeof value.method !== "string" || "id" in value && value.id !== null && typeof value.id !== "string" && (typeof value.id !== "number" || !Number.isFinite(value.id))) {
|
|
170
|
-
reject(
|
|
227
|
+
reject({
|
|
228
|
+
status: 400,
|
|
229
|
+
reason: "malformed-request"
|
|
230
|
+
});
|
|
171
231
|
return;
|
|
172
232
|
}
|
|
173
233
|
message = value;
|
|
174
234
|
} catch {
|
|
175
|
-
reject(
|
|
235
|
+
reject({
|
|
236
|
+
status: 400,
|
|
237
|
+
reason: "malformed-request"
|
|
238
|
+
});
|
|
176
239
|
return;
|
|
177
240
|
}
|
|
178
241
|
const authorization = input.authorize(req);
|
|
@@ -183,7 +246,10 @@ function coordinationHttpHandler(input) {
|
|
|
183
246
|
if (message.method === "tools/call" && message.params && typeof message.params === "object" && "name" in message.params && typeof message.params.name === "string" && input.toolNames.has(message.params.name)) action = message.params.name;
|
|
184
247
|
if (controlAdmission) {
|
|
185
248
|
if (!(message.method === "initialize" || message.method === "tools/list" || action === "stop" || action === "observe_agent" || action === "read_journal")) {
|
|
186
|
-
reject(
|
|
249
|
+
reject({
|
|
250
|
+
status: 429,
|
|
251
|
+
reason: "request-limit"
|
|
252
|
+
});
|
|
187
253
|
return;
|
|
188
254
|
}
|
|
189
255
|
controlRequests++;
|
|
@@ -202,7 +268,7 @@ function coordinationHttpHandler(input) {
|
|
|
202
268
|
if (!finished) respond(response === null ? 202 : 200, response ?? void 0);
|
|
203
269
|
await audit(timedOut ? "completed-after-deadline" : "completed", timedOut ? 504 : response === null ? 202 : 200, action);
|
|
204
270
|
} catch {
|
|
205
|
-
respond(500);
|
|
271
|
+
respond(500, rejectionBody("handler-failed", limits));
|
|
206
272
|
} finally {
|
|
207
273
|
executing = false;
|
|
208
274
|
release();
|
|
@@ -511,8 +577,7 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
511
577
|
const rotateCredential = () => {
|
|
512
578
|
if (!opts.authentication) throw new ConfigError("coordination authentication is not configured");
|
|
513
579
|
if (closed) throw new ConfigError("coordination server is closed");
|
|
514
|
-
const
|
|
515
|
-
const expiresAt = auth?.ttlMs === void 0 ? deadline > 0 ? deadline : void 0 : Date.now() + auth.ttlMs;
|
|
580
|
+
const expiresAt = auth?.ttlMs === void 0 ? void 0 : Date.now() + auth.ttlMs;
|
|
516
581
|
if (expiresAt !== void 0 && !Number.isSafeInteger(expiresAt)) throw new ConfigError("coordination credential expiry must remain a safe integer");
|
|
517
582
|
for (const [credential, expiry] of revoked) if (expiry <= Date.now()) revoked.delete(credential);
|
|
518
583
|
if (token) revoked.set(token.toString(), credentialExpiresAt ?? Number.POSITIVE_INFINITY);
|
|
@@ -534,9 +599,21 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
534
599
|
token = Buffer.from(text);
|
|
535
600
|
headers = Object.freeze({ Authorization: `Bearer ${text}` });
|
|
536
601
|
};
|
|
602
|
+
/**
|
|
603
|
+
* Why a supplied credential is refused, or undefined when it is valid. A credential lives as
|
|
604
|
+
* long as the scope it fronts: until the scope's signal aborts, within an explicit `ttlMs`, and
|
|
605
|
+
* until rotation revokes it. Every stop aborts that signal: cancellation, the run's deadline, and
|
|
606
|
+
* a lead stopping its child. A child's own time box does not: its lead checks it in and keeps it
|
|
607
|
+
* running (`deadline.ts` `DeadlineCheckIn`), and the check-in asks it to record its state and
|
|
608
|
+
* submit through these very tools. Refusing at the time box left a checked-in child unable to do
|
|
609
|
+
* either (2026-10-10: eu-datacenter-power-2030-20261010b:s3, every call for its last 41 minutes).
|
|
610
|
+
*/
|
|
611
|
+
const refusedCredential = (supplied) => {
|
|
612
|
+
if (opts.scope.signal.aborted) return "scope-stopped";
|
|
613
|
+
return validCredential(supplied) ? void 0 : "credential-refused";
|
|
614
|
+
};
|
|
537
615
|
const validCredential = (supplied) => {
|
|
538
|
-
|
|
539
|
-
if (closed || opts.scope.signal.aborted || deadline > 0 && Date.now() >= deadline || revoked.has(supplied.toString())) return false;
|
|
616
|
+
if (revoked.has(supplied.toString())) return false;
|
|
540
617
|
if (!signingKeys) return token !== void 0 && (credentialExpiresAt === void 0 || Date.now() < credentialExpiresAt) && supplied.length === token.length && timingSafeEqual(supplied, token);
|
|
541
618
|
if (supplied.length > 8192) return false;
|
|
542
619
|
try {
|
|
@@ -632,16 +709,29 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
632
709
|
},
|
|
633
710
|
backgroundActions: () => nodeTools.background() + fencedVerbs.background(),
|
|
634
711
|
authorize: (req) => {
|
|
635
|
-
if (!paths.has(req.url ?? "")) return
|
|
712
|
+
if (!paths.has(req.url ?? "")) return {
|
|
713
|
+
status: 404,
|
|
714
|
+
reason: "unknown-path"
|
|
715
|
+
};
|
|
636
716
|
const address = req.socket.localAddress?.replace(/^::ffff:/, "");
|
|
637
717
|
const localAuthority = address?.includes(":") ? `[${address}]:${req.socket.localPort}` : `${address}:${req.socket.localPort}`;
|
|
638
718
|
const boundAuthority = audiences.size > 0 && (host === "0.0.0.0" || host === "::") && address !== void 0 && req.socket.localPort !== void 0 && req.headers.host === localAuthority;
|
|
639
|
-
if (!audiences.has(req.headers.host ?? "") && !boundAuthority) return
|
|
640
|
-
|
|
719
|
+
if (!audiences.has(req.headers.host ?? "") && !boundAuthority) return {
|
|
720
|
+
status: 403,
|
|
721
|
+
reason: "wrong-host"
|
|
722
|
+
};
|
|
723
|
+
if (closed) return {
|
|
724
|
+
status: 401,
|
|
725
|
+
reason: "listener-closed"
|
|
726
|
+
};
|
|
641
727
|
if (!opts.authentication) return void 0;
|
|
642
728
|
const authorization = req.headers.authorization;
|
|
643
729
|
const supplied = typeof authorization === "string" && authorization.startsWith("Bearer ") ? Buffer.from(authorization.slice(7)) : Buffer.alloc(0);
|
|
644
|
-
|
|
730
|
+
const refused = refusedCredential(supplied);
|
|
731
|
+
return refused === void 0 ? void 0 : {
|
|
732
|
+
status: 401,
|
|
733
|
+
reason: refused
|
|
734
|
+
};
|
|
645
735
|
}
|
|
646
736
|
}));
|
|
647
737
|
server.requestTimeout = requestTimeoutMs;
|
|
@@ -4747,4 +4837,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
4747
4837
|
//#endregion
|
|
4748
4838
|
export { readRootStreamReceipt as _, superviseWithTestBrain as a, createSupervisorSpanRecorder as b, resolveWorkerSpawnRetry as c, assertCoordinationBinding as d, resolveSupervisorProfile as f, readRootStream as g, ROOT_STREAM_FILE as h, superviseRootProfile as i, retryPreSpawnRefusals as l, supervisorAgentWithTestBrain as m, profileGuidanceComposer as n, workerFromBackend as o, supervisorAgent as p, supervise as r, isPreSpawnExecutorFailure as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, withWorkerSpawnRetry as u, UNPROVEN_CONTINUITY as v, serveCoordinationMcp as x, composeReentryTask as y };
|
|
4749
4839
|
|
|
4750
|
-
//# sourceMappingURL=supervise-
|
|
4840
|
+
//# sourceMappingURL=supervise-CU6AuxWY.js.map
|