@tangle-network/agent-runtime 0.322.4 → 0.323.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-Bw6S7lI1.d.ts → activation-D4hHi27J.d.ts} +2 -2
- package/dist/{activation-ClHYiUF-.js → activation-DpipXGti.js} +2 -2
- package/dist/{activation-ClHYiUF-.js.map → activation-DpipXGti.js.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/agent.js +2 -2
- package/dist/{coordination-driver-xq1y2G6E.js → coordination-driver-COSL19sL.js} +31 -4
- package/dist/coordination-driver-COSL19sL.js.map +1 -0
- package/dist/{delegate-C9dMTZ8s.js → delegate-silSKPSB.js} +2 -2
- package/dist/{delegate-C9dMTZ8s.js.map → delegate-silSKPSB.js.map} +1 -1
- package/dist/durable.d.ts +1 -1
- package/dist/durable.js +2 -2
- package/dist/{graph-DLgIEaDB.js → graph-DbQ-BXKr.js} +6 -4
- package/dist/graph-DbQ-BXKr.js.map +1 -0
- package/dist/{improvement-cycle-C0N4tt1G.js → improvement-cycle-BeN9wahG.js} +3 -3
- package/dist/{improvement-cycle-C0N4tt1G.js.map → improvement-cycle-BeN9wahG.js.map} +1 -1
- package/dist/{index-BE5-_p0B.d.ts → index-7h7-L6Tk.d.ts} +30 -17
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/intelligence.d.ts +2 -2
- package/dist/intelligence.js +3 -3
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +9 -9
- package/dist/{loop-runner-bin-DeT99QWD.d.ts → loop-runner-bin-Bsux_MGx.d.ts} +2 -2
- package/dist/{loop-runner-bin-B4QRhI5z.js → loop-runner-bin-DkhIbFBp.js} +3 -3
- package/dist/{loop-runner-bin-B4QRhI5z.js.map → loop-runner-bin-DkhIbFBp.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 +3 -3
- package/dist/mcp/index.js +4 -4
- package/dist/{openai-tools-C80KeWl4.d.ts → openai-tools-e02ABKl0.d.ts} +2 -2
- package/dist/profiles.d.ts +1 -1
- package/dist/{provision-supervisor-C40ye4h2.js → provision-supervisor-DdWu6mqu.js} +3 -3
- package/dist/{provision-supervisor-C40ye4h2.js.map → provision-supervisor-DdWu6mqu.js.map} +1 -1
- package/dist/{runtime-zv5GK0m4.js → runtime-DhPIc7XV.js} +8 -8
- package/dist/{runtime-zv5GK0m4.js.map → runtime-DhPIc7XV.js.map} +1 -1
- package/dist/{search-executor-BtJktjPt.js → search-executor-BS-WJpti.js} +2 -2
- package/dist/{search-executor-BtJktjPt.js.map → search-executor-BS-WJpti.js.map} +1 -1
- package/dist/{server-DNnLa4KU.js → server-CEDOUOdz.js} +3 -3
- package/dist/{server-DNnLa4KU.js.map → server-CEDOUOdz.js.map} +1 -1
- package/dist/{supervise-DLezpJcp.js → supervise-CwWI7kIk.js} +76 -14
- package/dist/supervise-CwWI7kIk.js.map +1 -0
- package/dist/{supervisor-dlufUXys.js → supervisor-CSKkm-e1.js} +9 -28
- package/dist/{supervisor-dlufUXys.js.map → supervisor-CSKkm-e1.js.map} +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +12 -12
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +1 -1
- package/dist/coordination-driver-xq1y2G6E.js.map +0 -1
- package/dist/graph-DLgIEaDB.js.map +0 -1
- package/dist/supervise-DLezpJcp.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $i as runtimeOwnedExecutorMaterialization, A as scopeOwnerExecutorNodeContext, Ai as promptControlProfileMaterialization, An as resolveAgentEnvironmentProvider, Ar as persistHarnessTranscript, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, Di as defineProfileMaterializationContract, Dr as runAbortable, E as recordScopeOwnerDriverAttempt, Ei as controlProfileMaterialization, Er as linkAbort, F as seatExecutionProfile, Fi as renderUnsupported, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as inheritRuntimeOwnedExecutorAttestation, H as prepareScopeRetainedOwnerSeatSwitch, Hi as authoredAgentIdentity, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Jn as isNoEntError, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, L as beginScopeRetainedOwnerDrive, Li as unsupportedProfileDimensions, M as SeatChain, N as SeatChainExhaustedError, Nt as createExecutor, O as recordScopeOwnerPause, Oi as fullProfileMaterialization, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, Pr as contentAddress, Qi as runtimeOwnedExecutorExecutionBinding, Qr as createOtelExporter, R as bindScopeRetainedOwnerEnvironmentId, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, U as prepareScopeRetainedOwnerTask, V as noteScopeRetainedOwnerCoordination, Vi as attestRuntimeOwnedScopeOwner, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, X as scopeRetainedOwnerResult, Xi as recordRuntimeOwnedDriveHarnessProviderEvidence, Xn as readCommittedJsonLines, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Yi as providerAttemptEvidence, Yn as prepareJsonlAppend, Z as scopeRetainedOwnerTurnEnded, Zi as runtimeOwnedDriveHarnessProviderEvidence, _ as isDriverSpec, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, c as runTree, ca as detachedSnapshot, cn as bridgeModelRouteRefusal, cr as meterUsageEvent, dr as spendFromUsageTotals, ea as runtimeOwnedExecutorProviderEvidence, ei as generateSpanId, f as runDriverWithRetry, fr as bridgeRuntimeAttachmentsKey, g as driverExecutorFactory, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ii as toOtelAttributes, it as providerVisibleProfile, ji as promptModelProfileMaterialization, jr as readHarnessTranscript, k as restoreScopeOwnerAcceptedExecution, ki as profileMaterializationAxes$1, kt as bindReusableExecutorExecutionId, lr as newUsageTotals, mr as errMessage, mt as gateOnDeliverable, n as createRootHandle, na as runtimeOwnedScopeOwnerRuntime, nt as coordinationMcpAlias, or as assertValidBudget, p as summarizeDriverAttempts, pr as bridgeStopSignalKey, q as scopeRetainedOwnerPriorSpend, r as createSupervisor, rr as executorFailure, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, ta as runtimeOwnedPendingExecutorMaterialization, tr as parseWorkerToolTraceArtifact, u as HarnessTurnFailedError, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wi as assertProfileMaterialization, wn as routerBrain, wr as RunCancellationReason, x as beginScopeOwnerAttempt, xt as bestComposite, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zi as worktreeCliProfileMaterialization, zt as createRouterTranscript } from "./supervisor-
|
|
1
|
+
import { $i as runtimeOwnedExecutorMaterialization, $t as PEER_MAIL_WIRE_KEY, A as scopeOwnerExecutorNodeContext, Ai as promptControlProfileMaterialization, An as resolveAgentEnvironmentProvider, Ar as persistHarnessTranscript, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, Di as defineProfileMaterializationContract, Dr as runAbortable, E as recordScopeOwnerDriverAttempt, Ei as controlProfileMaterialization, Er as linkAbort, F as seatExecutionProfile, Fi as renderUnsupported, Fn as retainedExecutorSeamKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gi as inheritRuntimeOwnedExecutorAttestation, H as prepareScopeRetainedOwnerSeatSwitch, Hi as authoredAgentIdentity, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Jn as isNoEntError, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, L as beginScopeRetainedOwnerDrive, Li as unsupportedProfileDimensions, M as SeatChain, N as SeatChainExhaustedError, Nt as createExecutor, O as recordScopeOwnerPause, Oi as fullProfileMaterialization, P as authoredSeatStages, Pn as registerRetainedExecutorPreparation, Pr as contentAddress, Qi as runtimeOwnedExecutorExecutionBinding, Qr as createOtelExporter, R as bindScopeRetainedOwnerEnvironmentId, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, U as prepareScopeRetainedOwnerTask, V as noteScopeRetainedOwnerCoordination, Vi as attestRuntimeOwnedScopeOwner, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, X as scopeRetainedOwnerResult, Xi as recordRuntimeOwnedDriveHarnessProviderEvidence, Xn as readCommittedJsonLines, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Yi as providerAttemptEvidence, Yn as prepareJsonlAppend, Z as scopeRetainedOwnerTurnEnded, Zi as runtimeOwnedDriveHarnessProviderEvidence, _ as isDriverSpec, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, c as runTree, ca as detachedSnapshot, cn as bridgeModelRouteRefusal, cr as meterUsageEvent, dr as spendFromUsageTotals, ea as runtimeOwnedExecutorProviderEvidence, ei as generateSpanId, f as runDriverWithRetry, fr as bridgeRuntimeAttachmentsKey, g as driverExecutorFactory, gt as CONTINUATIONS_DIR, h as driverChild, i as bestDelivered, ii as toOtelAttributes, it as providerVisibleProfile, ji as promptModelProfileMaterialization, jr as readHarnessTranscript, k as restoreScopeOwnerAcceptedExecution, ki as profileMaterializationAxes$1, kt as bindReusableExecutorExecutionId, lr as newUsageTotals, mr as errMessage, mt as gateOnDeliverable, n as createRootHandle, na as runtimeOwnedScopeOwnerRuntime, nn as isPeerMailEnvelope, nt as coordinationMcpAlias, or as assertValidBudget, p as summarizeDriverAttempts, pr as bridgeStopSignalKey, q as scopeRetainedOwnerPriorSpend, r as createSupervisor, rr as executorFailure, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, ta as runtimeOwnedPendingExecutorMaterialization, tr as parseWorkerToolTraceArtifact, u as HarnessTurnFailedError, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wi as assertProfileMaterialization, wn as routerBrain, wr as RunCancellationReason, x as beginScopeOwnerAttempt, xt as bestComposite, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zi as worktreeCliProfileMaterialization, zt as createRouterTranscript } from "./supervisor-CSKkm-e1.js";
|
|
2
2
|
import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
|
|
3
3
|
import { Dt as teardownSurfaces, Et as teardownExecutor, V as addSpend, Z as isAsyncIterable$1, ct as withTimeout, dt as addResourceSpend, lt as zeroSpend, mt as withBudgetResources, pt as resourceTelemetry, q as errorMessage, rt as sleep, st as unmeteredSpend, yt as DEFAULT_SUCCESSFUL_SHUTDOWN_MS } from "./workspace-streams-DFAhW7hF.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-CNe257pB.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 createFileRunContext, F as createCoordinationToolsForManager, N as coordinationVerbNames, O as applyRunCancellation, T as withRunContext, c as refreshedWake, g as progressStop, h as plateau, k as watchRunCancellation, l as resolveWakePolicy, n as createSteerAcknowledger, o as composeWakeInput, p as createProgressTracker, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as createInMemoryRunContext } from "./coordination-driver-
|
|
7
|
+
import { C as createFileRunContext, F as createCoordinationToolsForManager, N as coordinationVerbNames, O as applyRunCancellation, T as withRunContext, c as refreshedWake, g as progressStop, h as plateau, k as watchRunCancellation, l as resolveWakePolicy, n as createSteerAcknowledger, o as composeWakeInput, p as createProgressTracker, r as driverAgent, s as deadlineWarningAt, t as createCancelAcknowledger, w as createInMemoryRunContext } from "./coordination-driver-COSL19sL.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";
|
|
@@ -648,6 +648,7 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
|
|
|
648
648
|
...opts.analysts ? { analysts: opts.analysts } : {},
|
|
649
649
|
...opts.analyzeOnSettle ? { analyzeOnSettle: opts.analyzeOnSettle } : {},
|
|
650
650
|
...opts.sourceEvidenceRefs ? { sourceEvidenceRefs: opts.sourceEvidenceRefs } : {},
|
|
651
|
+
...opts.peerAudit ? { peerAudit: opts.peerAudit } : {},
|
|
651
652
|
...opts.watchWorkers ? { watchWorkers: opts.watchWorkers } : {},
|
|
652
653
|
...opts.stallAfterMs !== void 0 ? { stallAfterMs: opts.stallAfterMs } : {},
|
|
653
654
|
...opts.continuityByProfile ? { continuityByProfile: opts.continuityByProfile } : {},
|
|
@@ -1952,6 +1953,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
1952
1953
|
...deps.analysts ? { analysts: deps.analysts } : {},
|
|
1953
1954
|
...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
|
|
1954
1955
|
...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
|
|
1956
|
+
...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
|
|
1955
1957
|
...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
|
|
1956
1958
|
...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
|
|
1957
1959
|
...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
|
|
@@ -2026,6 +2028,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2026
2028
|
const context = nodeContextSeed ? supervisorNodeContext(nodeContextSeed, stableProfile, task, scope) : void 0;
|
|
2027
2029
|
const priorCoordination = deps.loadPriorCoordination ? await deps.loadPriorCoordination() : deps.priorCoordination;
|
|
2028
2030
|
const slot = createVerbSlot();
|
|
2031
|
+
const peerInbox = createInbox();
|
|
2029
2032
|
const nodeTools = resolveTools && context ? await bindSupervisorTools(resolveTools, context, scope.signal, slot) : void 0;
|
|
2030
2033
|
const nodeObserver = bindSupervisorNodeObserver(context, observeNodeEvent, deps.onEvent);
|
|
2031
2034
|
const stopController = new AbortController();
|
|
@@ -2068,6 +2071,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2068
2071
|
...deps.analysts ? { analysts: deps.analysts } : {},
|
|
2069
2072
|
...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
|
|
2070
2073
|
...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
|
|
2074
|
+
...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
|
|
2071
2075
|
...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
|
|
2072
2076
|
...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
|
|
2073
2077
|
...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
|
|
@@ -2100,6 +2104,8 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2100
2104
|
liveCoordinator = mcp;
|
|
2101
2105
|
managerInbox = (message) => {
|
|
2102
2106
|
if (deliver !== void 0 && harnessInvocationActive && (deliverReady === void 0 || deliverReady()) && deliver(message)) return true;
|
|
2107
|
+
const envelope = message !== null && typeof message === "object" ? message[PEER_MAIL_WIRE_KEY] : void 0;
|
|
2108
|
+
if (deps.peerMailUrl && isPeerMailEnvelope(envelope)) return peerInbox.deliver({ [PEER_MAIL_WIRE_KEY]: envelope });
|
|
2103
2109
|
return controls.receiveLeadMessage(message);
|
|
2104
2110
|
};
|
|
2105
2111
|
const coordinationTools = slot.descriptors();
|
|
@@ -2291,6 +2297,9 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2291
2297
|
state: controls.reentryState(),
|
|
2292
2298
|
attempt
|
|
2293
2299
|
});
|
|
2300
|
+
const peerMessages = peerInbox.drain();
|
|
2301
|
+
const peerText = peerMessages.length === 0 ? void 0 : peerInbox.fold(peerMessages);
|
|
2302
|
+
const withPeerMail = (input) => peerText === void 0 ? input : `${typeof input === "string" ? input : JSON.stringify(input) ?? String(input)}\n\n${peerText}`;
|
|
2294
2303
|
harnessInvocationActive = true;
|
|
2295
2304
|
let completed = false;
|
|
2296
2305
|
try {
|
|
@@ -2300,10 +2309,10 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2300
2309
|
...registeredProfile === stableProfile ? {} : { registeredProfile },
|
|
2301
2310
|
...profilePrompt !== void 0 ? { systemPrompt: profilePrompt } : {},
|
|
2302
2311
|
...session === void 0 ? {} : { session },
|
|
2303
|
-
task: compose === void 0 ? task : compose(UNPROVEN_CONTINUITY),
|
|
2312
|
+
task: withPeerMail(compose === void 0 ? task : compose(UNPROVEN_CONTINUITY)),
|
|
2304
2313
|
...compose === void 0 ? {} : { reentry: {
|
|
2305
2314
|
reason: reentry,
|
|
2306
|
-
compose,
|
|
2315
|
+
compose: (continuity) => withPeerMail(compose(continuity)),
|
|
2307
2316
|
...refresh === void 0 ? {} : { refresh },
|
|
2308
2317
|
onContinuity: (continuity) => {
|
|
2309
2318
|
if (continuity.environment === "replaced") environmentReplacements += 1;
|
|
@@ -2313,6 +2322,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2313
2322
|
scope,
|
|
2314
2323
|
coordinationMcpUrl: mcp.url,
|
|
2315
2324
|
coordinationMcpHeaders: mcp.headers,
|
|
2325
|
+
...deps.peerMailUrl ? { peerMailUrl: deps.peerMailUrl } : {},
|
|
2316
2326
|
stopSignal: stopController.signal,
|
|
2317
2327
|
coordinationTools
|
|
2318
2328
|
});
|
|
@@ -2346,6 +2356,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
|
|
|
2346
2356
|
attempt: nextAttempt,
|
|
2347
2357
|
signal: AbortSignal.any([scope.signal, stopController.signal]),
|
|
2348
2358
|
heartbeatMs: wakePolicy.heartbeatMs,
|
|
2359
|
+
...deps.peerMailUrl ? { alsoWakeOn: peerInbox.pending() > 0 ? Promise.resolve() : peerInbox.nextDelivery() } : {},
|
|
2349
2360
|
debounceMs: wakePolicy.debounceMs,
|
|
2350
2361
|
...warnAt === void 0 ? {} : { deadlineAt: warnAt }
|
|
2351
2362
|
});
|
|
@@ -3270,7 +3281,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3270
3281
|
let seatChain;
|
|
3271
3282
|
let activeSeat;
|
|
3272
3283
|
let switchedProviderCheckpointAt;
|
|
3273
|
-
const drive = async ({ profile, authoredProfile, registeredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, stopSignal, coordinationTools, reentry, session }) => {
|
|
3284
|
+
const drive = async ({ profile, authoredProfile, registeredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, peerMailUrl, stopSignal, coordinationTools, reentry, session }) => {
|
|
3274
3285
|
const priorCommittedArtifact = managerArtifact;
|
|
3275
3286
|
managerArtifact = void 0;
|
|
3276
3287
|
switchedProviderCheckpointAt = void 0;
|
|
@@ -3392,6 +3403,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3392
3403
|
};
|
|
3393
3404
|
const turnStop = turnCap > 0 ? new AbortController() : void 0;
|
|
3394
3405
|
const effectiveStopSignal = turnStop === void 0 ? stopSignal : stopSignal === void 0 ? turnStop.signal : AbortSignal.any([stopSignal, turnStop.signal]);
|
|
3406
|
+
const peerMailAttachment = peerMailRuntimeAttachment(authoredProfile, boundBackend, { peerMailUrl });
|
|
3395
3407
|
const attachment = {
|
|
3396
3408
|
transport: "http",
|
|
3397
3409
|
url: coordinationMcpUrl,
|
|
@@ -3408,6 +3420,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3408
3420
|
if (!authorization?.startsWith("Bearer ")) throw new ValidationError("driveHarnessFromBackend: provider coordination requires a bearer credential");
|
|
3409
3421
|
if (Object.hasOwn(boundBackend.defaults?.env ?? {}, credentialName)) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved coordination credential name");
|
|
3410
3422
|
if (Object.hasOwn(boundBackend.defaults?.runtimeAttachments?.mcp ?? {}, "agent-runtime-coordination")) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved coordination attachment alias");
|
|
3423
|
+
if (peerMailUrl && Object.hasOwn(boundBackend.defaults?.runtimeAttachments?.mcp ?? {}, peerMailMcpAlias)) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved peer-mail attachment alias");
|
|
3411
3424
|
if (!await providerAcceptsCoordinationAttachments(boundBackend)) throw new ValidationError("driveHarnessFromBackend: provider does not advertise create.runtimeAttachments.mcp; no environment was created");
|
|
3412
3425
|
factory = createExecutor({
|
|
3413
3426
|
...boundBackend,
|
|
@@ -3420,6 +3433,10 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3420
3433
|
},
|
|
3421
3434
|
runtimeAttachments: { mcp: {
|
|
3422
3435
|
...boundBackend.defaults?.runtimeAttachments?.mcp ?? {},
|
|
3436
|
+
...peerMailUrl ? { [peerMailMcpAlias]: {
|
|
3437
|
+
transport: "http",
|
|
3438
|
+
url: peerMailUrl
|
|
3439
|
+
} } : {},
|
|
3423
3440
|
[coordinationMcpAlias]: {
|
|
3424
3441
|
transport: "http",
|
|
3425
3442
|
url: coordinationMcpUrl,
|
|
@@ -3443,7 +3460,10 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
|
|
|
3443
3460
|
onResult: async (result) => commitOwnerResult(result)
|
|
3444
3461
|
} } : {},
|
|
3445
3462
|
...effectiveStopSignal === void 0 ? {} : { [bridgeStopSignalKey]: effectiveStopSignal },
|
|
3446
|
-
[bridgeRuntimeAttachmentsKey]: {
|
|
3463
|
+
[bridgeRuntimeAttachmentsKey]: {
|
|
3464
|
+
...peerMailAttachment ?? {},
|
|
3465
|
+
[coordinationMcpAlias]: attachment
|
|
3466
|
+
}
|
|
3447
3467
|
}
|
|
3448
3468
|
});
|
|
3449
3469
|
keepTranscript(lastExecutor?.harnessTranscript?.());
|
|
@@ -3876,6 +3896,11 @@ async function verifyProfilePromotions(table) {
|
|
|
3876
3896
|
const { verifySealedExperiment } = await import("@tangle-network/agent-eval/experiment");
|
|
3877
3897
|
for (const [name, entry] of promoted) if (!await verifySealedExperiment(entry.promotion.experiment)) throw new ValidationError(`supervise: opts.registry.profiles ${JSON.stringify(name)} cites a sealed play whose digest does not match its spec`);
|
|
3878
3898
|
}
|
|
3899
|
+
/** Capabilities a data-only consumer may require before building an opted-in run. */
|
|
3900
|
+
const superviseFleetCapabilities = Object.freeze({
|
|
3901
|
+
peerAudit: true,
|
|
3902
|
+
traceTools: true
|
|
3903
|
+
});
|
|
3879
3904
|
const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
3880
3905
|
"allowedModels",
|
|
3881
3906
|
"analysts",
|
|
@@ -3915,6 +3940,8 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
|
|
|
3915
3940
|
"onProgressStop",
|
|
3916
3941
|
"otel",
|
|
3917
3942
|
"peerMail",
|
|
3943
|
+
"peerAudit",
|
|
3944
|
+
"traceTools",
|
|
3918
3945
|
"perWorker",
|
|
3919
3946
|
"reservationPolicy",
|
|
3920
3947
|
"deadlineCheckIn",
|
|
@@ -4398,8 +4425,36 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4398
4425
|
if (options.backend?.backend !== "provider" || options.makeWorkerAgent || options.makeLeafAgent) throw new ValidationError("supervise: SQL runContext requires backend-derived retained provider workers");
|
|
4399
4426
|
}
|
|
4400
4427
|
assertValidBudget(options.budget, "supervise budget");
|
|
4401
|
-
const
|
|
4402
|
-
const
|
|
4428
|
+
const guidanceComposer = profileGuidanceComposer(options.profileGuidance);
|
|
4429
|
+
const applyTraceTools = (profile) => {
|
|
4430
|
+
if (options.traceTools !== false || profile.tools === void 0) return profile;
|
|
4431
|
+
const tools = Object.fromEntries(Object.entries(profile.tools).filter(([name]) => name !== `${coordinationProfileToolPrefix}observe_agent` && name !== `${coordinationProfileToolPrefix}read_journal`));
|
|
4432
|
+
return agentProfileSchema.parse({
|
|
4433
|
+
...profile,
|
|
4434
|
+
tools
|
|
4435
|
+
});
|
|
4436
|
+
};
|
|
4437
|
+
const composeSpawnProfile = options.traceTools === false ? (profile) => applyTraceTools(guidanceComposer?.(profile) ?? profile) : guidanceComposer;
|
|
4438
|
+
const auditPeers = /* @__PURE__ */ new Map();
|
|
4439
|
+
const peerAuditFor = (parent) => options.peerAudit ? {
|
|
4440
|
+
register: (nodeId, tools) => {
|
|
4441
|
+
auditPeers.set(nodeId, {
|
|
4442
|
+
parent,
|
|
4443
|
+
tools
|
|
4444
|
+
});
|
|
4445
|
+
},
|
|
4446
|
+
read: async (peerId, name, args) => {
|
|
4447
|
+
const peer = auditPeers.get(peerId);
|
|
4448
|
+
if (peer?.parent !== parent) return { error: "unknown-peer" };
|
|
4449
|
+
const rootRead = name === "observe_agent" && args.tree !== true && args.outRef === void 0 && (args.workerId === void 0 || args.workerId === peerId);
|
|
4450
|
+
const tool = (rootRead ? auditPeers.get(parent)?.tools : peer.tools)?.find((tool) => tool.name === name);
|
|
4451
|
+
return tool ? tool.handler(rootRead ? {
|
|
4452
|
+
...args,
|
|
4453
|
+
workerId: peerId
|
|
4454
|
+
} : args) : { error: "peer-tool-unavailable" };
|
|
4455
|
+
}
|
|
4456
|
+
} : void 0;
|
|
4457
|
+
const registeredProfile = applyTraceTools(superviseRootProfile(profile, options.profileGuidance));
|
|
4403
4458
|
if (options.segment !== void 0) admitSegment(options.segment);
|
|
4404
4459
|
const canonicalProfile = options.segment === void 0 ? registeredProfile : withRootSegment(registeredProfile, options.segment);
|
|
4405
4460
|
assertExecutableAgentProfile(canonicalProfile, "supervise root");
|
|
@@ -4554,7 +4609,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4554
4609
|
const withRetry = (make) => withWorkerSpawnRetry(make, options.workerRetry, { ...options.onWorkerRetry ? { onRetry: options.onWorkerRetry } : {} });
|
|
4555
4610
|
const makeLeaf = withRetry(options.makeLeafAgent ?? workerFromBackend(options.backend, deliverable));
|
|
4556
4611
|
const securityPolicy = options.profileSecurity ?? DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY;
|
|
4557
|
-
const makeRecursiveWorkerFor = (parent, parentIdentity, depth, parentOwnerId, analystLineage = false) => {
|
|
4612
|
+
const makeRecursiveWorkerFor = (parent, parentIdentity, depth, parentOwnerId, analystLineage = false, peerRootOwnerId) => {
|
|
4558
4613
|
const makeRecursiveWorker = (authoredProfile, spawnContext, recovering = false) => {
|
|
4559
4614
|
if (!spawnContext) throw new ValidationError("supervise: backend-derived workers require spawn context");
|
|
4560
4615
|
const input = freezeDetachedProfile(authoredProfile);
|
|
@@ -4577,7 +4632,7 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4577
4632
|
...spawnContext.execution ? { execution: spawnContext.execution } : {}
|
|
4578
4633
|
});
|
|
4579
4634
|
if (typeof decision !== "object" || decision === null || Array.isArray(decision)) throw new ValidationError("supervise: authorizeSpawn must return an AuthorizedSpawn");
|
|
4580
|
-
const authorized = freezeDetachedProfile(decision.profile);
|
|
4635
|
+
const authorized = freezeDetachedProfile(applyTraceTools(decision.profile));
|
|
4581
4636
|
const childExecution = canonicalExecution(authorized, spawnContext.task, decision.execution, `supervise spawn ${JSON.stringify(spawnContext.label)}`);
|
|
4582
4637
|
const authorizedContext = Object.freeze({
|
|
4583
4638
|
...spawnContext,
|
|
@@ -4623,12 +4678,16 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4623
4678
|
if (isExternalSupervisor(authorized) && !nestedDriveHarness) throw new ValidationError(`supervise: authored external supervisor profile.harness=${JSON.stringify(authorized.harness)} requires a local bridge, a provider with authenticated coordination.publicUrl and runtime MCP attachments, or an explicit driveHarness with reachable coordination transport`);
|
|
4624
4679
|
assertProfileContract(authorized, isExternalSupervisor(authorized) ? driverMaterialization : promptModelProfileMaterialization, `supervise driver ${JSON.stringify(spawnContext.label)}`, true);
|
|
4625
4680
|
if (managerBackend) assertBridgeProfileMaterializes(profileWithoutDeclaredRuntimeCoordinationTools(authorized), managerBackend, `supervise driver ${JSON.stringify(spawnContext.label)}`);
|
|
4626
|
-
const
|
|
4681
|
+
const rootPeerOwner = options.peerAudit ? depth === 1 ? ownerId : peerRootOwnerId : void 0;
|
|
4682
|
+
const childFactory = makeRecursiveWorkerFor(authorized, childExecution.identity, depth + 1, ownerId, analystLineage || spawnContext.analyst !== void 0 || spawnContext.assignmentId.startsWith("analyst:"), rootPeerOwner);
|
|
4627
4683
|
const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare);
|
|
4628
4684
|
const authorizeNestedMessage = authorizeDownFor(authorized, depth + 1);
|
|
4629
4685
|
let acceptedSubmission = false;
|
|
4630
4686
|
let unassessedOutput = false;
|
|
4687
|
+
const peerAudit = depth === 1 ? peerAuditFor(spawnContext.parentNodeId) : void 0;
|
|
4631
4688
|
return driverChild(authorized, supervisorAgent(authorized, {
|
|
4689
|
+
...spawnContext.peerMailUrl ? { peerMailUrl: spawnContext.peerMailUrl } : {},
|
|
4690
|
+
...peerAudit ? { peerAudit } : {},
|
|
4632
4691
|
blobs,
|
|
4633
4692
|
onUnassessedOutput: () => {
|
|
4634
4693
|
unassessedOutput = true;
|
|
@@ -4648,7 +4707,8 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4648
4707
|
ownerId,
|
|
4649
4708
|
depth,
|
|
4650
4709
|
identity: childExecution.identity,
|
|
4651
|
-
assignmentId: spawnContext.assignmentId
|
|
4710
|
+
assignmentId: spawnContext.assignmentId,
|
|
4711
|
+
...rootPeerOwner ? { peerRootOwnerId: rootPeerOwner } : {}
|
|
4652
4712
|
},
|
|
4653
4713
|
...options.resolveSupervisorTools ? { resolveSupervisorTools: options.resolveSupervisorTools } : {},
|
|
4654
4714
|
...observeNodeEvent ? {
|
|
@@ -4739,7 +4799,9 @@ function superviseInternal(profile, task, opts, testBrain) {
|
|
|
4739
4799
|
await verifyProfilePromotions(profileTable);
|
|
4740
4800
|
const priorCoordination = log ? await log.load(runId, rootOwnerId) : void 0;
|
|
4741
4801
|
const authorizeRootMessage = authorizeDownFor(canonicalProfile, 1);
|
|
4802
|
+
const rootPeerAudit = peerAuditFor("");
|
|
4742
4803
|
const agentDeps = {
|
|
4804
|
+
...rootPeerAudit ? { peerAudit: rootPeerAudit } : {},
|
|
4743
4805
|
blobs,
|
|
4744
4806
|
makeWorkerAgent: workerFactory,
|
|
4745
4807
|
...authorizeRootMessage ? { authorizeDownMessage: authorizeRootMessage } : {},
|
|
@@ -4936,6 +4998,6 @@ function rootProviderModelEvidenceFromExecution(evidence) {
|
|
|
4936
4998
|
return evidence ?? rootProviderModelEvidence([]);
|
|
4937
4999
|
}
|
|
4938
5000
|
//#endregion
|
|
4939
|
-
export {
|
|
5001
|
+
export { serveCoordinationMcp as S, readRootStream as _, superviseRootProfile as a, composeReentryTask as b, isPreSpawnExecutorFailure as c, withWorkerSpawnRetry as d, assertCoordinationBinding as f, ROOT_STREAM_FILE as g, supervisorAgentWithTestBrain as h, superviseFleetCapabilities as i, resolveWorkerSpawnRetry as l, supervisorAgent as m, profileGuidanceComposer as n, superviseWithTestBrain as o, resolveSupervisorProfile as p, supervise as r, workerFromBackend as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, retryPreSpawnRefusals as u, readRootStreamReceipt as v, createSupervisorSpanRecorder as x, UNPROVEN_CONTINUITY as y };
|
|
4940
5002
|
|
|
4941
|
-
//# sourceMappingURL=supervise-
|
|
5003
|
+
//# sourceMappingURL=supervise-CwWI7kIk.js.map
|