@tangle-network/agent-runtime 0.322.4 → 0.324.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.
Files changed (87) hide show
  1. package/dist/{activation-Bw6S7lI1.d.ts → activation-CB2npL7F.d.ts} +2 -2
  2. package/dist/{activation-ClHYiUF-.js → activation-CmWGOW1x.js} +3 -3
  3. package/dist/{activation-ClHYiUF-.js.map → activation-CmWGOW1x.js.map} +1 -1
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{bundle-Cw-QdGmH.js → bundle-BJJmfEsw.js} +2 -2
  7. package/dist/{bundle-Cw-QdGmH.js.map → bundle-BJJmfEsw.js.map} +1 -1
  8. package/dist/candidate-execution/index.js +5 -5
  9. package/dist/{coordination-driver-xq1y2G6E.js → coordination-driver-CNEeqMoh.js} +60 -21
  10. package/dist/coordination-driver-CNEeqMoh.js.map +1 -0
  11. package/dist/{delegate-C9dMTZ8s.js → delegate-C6oOTFB6.js} +2 -2
  12. package/dist/{delegate-C9dMTZ8s.js.map → delegate-C6oOTFB6.js.map} +1 -1
  13. package/dist/{durable-file-DWQA4ooo.js → durable-file-B_eJr6Mb.js} +40 -8
  14. package/dist/durable-file-B_eJr6Mb.js.map +1 -0
  15. package/dist/durable.d.ts +1 -1
  16. package/dist/durable.js +12 -21
  17. package/dist/durable.js.map +1 -1
  18. package/dist/{graph-DLgIEaDB.js → graph-BKmo7d42.js} +7 -5
  19. package/dist/graph-BKmo7d42.js.map +1 -0
  20. package/dist/{graph-registry-BuJbzTzF.js → graph-registry-DAI6KNXB.js} +19 -34
  21. package/dist/graph-registry-DAI6KNXB.js.map +1 -0
  22. package/dist/{improvement-cycle-C0N4tt1G.js → improvement-cycle-U74a-YKi.js} +10 -10
  23. package/dist/{improvement-cycle-C0N4tt1G.js.map → improvement-cycle-U74a-YKi.js.map} +1 -1
  24. package/dist/index.d.ts +7 -7
  25. package/dist/index.js +18 -15
  26. package/dist/index.js.map +1 -1
  27. package/dist/intelligence.d.ts +3 -3
  28. package/dist/intelligence.js +7 -7
  29. package/dist/jsonl-file-DBv31uPi.js +206 -0
  30. package/dist/jsonl-file-DBv31uPi.js.map +1 -0
  31. package/dist/kernel.d.ts +2 -2
  32. package/dist/kernel.js +13 -13
  33. package/dist/{loop-runner-bin-B4QRhI5z.js → loop-runner-bin-BfcTX4-n.js} +3 -3
  34. package/dist/{loop-runner-bin-B4QRhI5z.js.map → loop-runner-bin-BfcTX4-n.js.map} +1 -1
  35. package/dist/{loop-runner-bin-DeT99QWD.d.ts → loop-runner-bin-CkchKbaB.d.ts} +2 -2
  36. package/dist/loop-runner-bin.d.ts +1 -1
  37. package/dist/loop-runner-bin.js +1 -1
  38. package/dist/mcp/bin.js +3 -3
  39. package/dist/mcp/index.d.ts +3 -3
  40. package/dist/mcp/index.js +6 -6
  41. package/dist/{model-policy-CNe257pB.js → model-policy-CyCUwHed.js} +2 -2
  42. package/dist/model-policy-CyCUwHed.js.map +1 -0
  43. package/dist/{openai-tools-C80KeWl4.d.ts → openai-tools-BR3rRmmC.d.ts} +2 -2
  44. package/dist/{prepare-CFQLx9e3.js → prepare-DpavgJT8.js} +4 -4
  45. package/dist/{prepare-CFQLx9e3.js.map → prepare-DpavgJT8.js.map} +1 -1
  46. package/dist/{profile-BTbpdL9h.js → profile-ZS7_KLwK.js} +2 -2
  47. package/dist/{profile-BTbpdL9h.js.map → profile-ZS7_KLwK.js.map} +1 -1
  48. package/dist/profiles.d.ts +1 -1
  49. package/dist/profiles.js +1 -1
  50. package/dist/{protected-model-port-f1N2f0Uq.js → protected-model-port-BLyyfL3l.js} +4 -4
  51. package/dist/{protected-model-port-f1N2f0Uq.js.map → protected-model-port-BLyyfL3l.js.map} +1 -1
  52. package/dist/{protected-redaction-DylCC_ot.js → protected-redaction-DFCeo4vg.js} +2 -2
  53. package/dist/{protected-redaction-DylCC_ot.js.map → protected-redaction-DFCeo4vg.js.map} +1 -1
  54. package/dist/{provision-supervisor-C40ye4h2.js → provision-supervisor-DhPJqazM.js} +7 -7
  55. package/dist/{provision-supervisor-C40ye4h2.js.map → provision-supervisor-DhPJqazM.js.map} +1 -1
  56. package/dist/{run-layout-DSCWdbX2.js → run-layout-Cu8H7aeh.js} +2 -2
  57. package/dist/{run-layout-DSCWdbX2.js.map → run-layout-Cu8H7aeh.js.map} +1 -1
  58. package/dist/{runtime-zv5GK0m4.js → runtime-B9-ZiYFa.js} +84 -80
  59. package/dist/runtime-B9-ZiYFa.js.map +1 -0
  60. package/dist/{search-executor-BtJktjPt.js → search-executor-CtNb_lIB.js} +13 -5
  61. package/dist/search-executor-CtNb_lIB.js.map +1 -0
  62. package/dist/{server-DNnLa4KU.js → server-BLYiq6fK.js} +4 -4
  63. package/dist/{server-DNnLa4KU.js.map → server-BLYiq6fK.js.map} +1 -1
  64. package/dist/{supervise-DLezpJcp.js → supervise-FOCAUADN.js} +81 -18
  65. package/dist/supervise-FOCAUADN.js.map +1 -0
  66. package/dist/{supervisor-dlufUXys.js → supervisor-DnKhkhKc.js} +10932 -10815
  67. package/dist/supervisor-DnKhkhKc.js.map +1 -0
  68. package/dist/testing.d.ts +1 -1
  69. package/dist/testing.js +14 -14
  70. package/dist/{top-app-DaiR4LXM.js → top-app-BaMw1W2z.js} +2 -2
  71. package/dist/{top-app-DaiR4LXM.js.map → top-app-BaMw1W2z.js.map} +1 -1
  72. package/dist/tui/bin.js +1 -1
  73. package/dist/tui/index.d.ts +1 -1
  74. package/dist/tui/index.js +2 -2
  75. package/dist/{index-BE5-_p0B.d.ts → types-ytkoP4VV.d.ts} +17199 -17097
  76. package/dist/{workspace-streams-DFAhW7hF.js → workspace-streams-CcoARX4v.js} +2 -2
  77. package/dist/{workspace-streams-DFAhW7hF.js.map → workspace-streams-CcoARX4v.js.map} +1 -1
  78. package/package.json +3 -3
  79. package/dist/coordination-driver-xq1y2G6E.js.map +0 -1
  80. package/dist/durable-file-DWQA4ooo.js.map +0 -1
  81. package/dist/graph-DLgIEaDB.js.map +0 -1
  82. package/dist/graph-registry-BuJbzTzF.js.map +0 -1
  83. package/dist/model-policy-CNe257pB.js.map +0 -1
  84. package/dist/runtime-zv5GK0m4.js.map +0 -1
  85. package/dist/search-executor-BtJktjPt.js.map +0 -1
  86. package/dist/supervise-DLezpJcp.js.map +0 -1
  87. package/dist/supervisor-dlufUXys.js.map +0 -1
@@ -1,12 +1,13 @@
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-dlufUXys.js";
1
+ import { n as assertNoSymlinkDescendant } from "./durable-file-B_eJr6Mb.js";
2
+ import { $t as PEER_MAIL_WIRE_KEY, A as scopeOwnerExecutorNodeContext, Ai as registerRetainedExecutorPreparation, An as resolveAgentEnvironmentProvider, At as captureReusableExecutorConfig, B as consumeScopeRetainedOwnerResult, C as deriveNodeExecutionIdentity, Ct as createContinuationKeeper, D as recordScopeOwnerMaterialization, E as recordScopeOwnerDriverAttempt, F as seatExecutionProfile, Fn as bridgeStopSignalKey, Ft as snapshotExecutorConfig, G as scopeRetainedOwnerContext, Gn as RunCancellationReason, Gr as fullProfileMaterialization, H as prepareScopeRetainedOwnerSeatSwitch, I as abandonScopeRetainedOwnerInvocation, J as scopeRetainedOwnerResourceReader, Jn as runAbortable, Jr as promptModelProfileMaterialization, Jt as createActivityLog, K as scopeRetainedOwnerJournalRoot, Kr as profileMaterializationAxes$1, L as beginScopeRetainedOwnerDrive, M as SeatChain, N as SeatChainExhaustedError, Nt as createExecutor, O as recordScopeOwnerPause, P as authoredSeatStages, Pn as bridgeRuntimeAttachmentsKey, Qn as readHarnessTranscript, Qr as renderUnsupported, R as bindScopeRetainedOwnerEnvironmentId, St as checkVerdictOf, T as meterRuntimeOwnedProviderAttempt, U as prepareScopeRetainedOwnerTask, Ur as controlProfileMaterialization, V as noteScopeRetainedOwnerCoordination, Vr as assertProfileMaterialization, Vt as WORKER_TRACE_PROPAGATION, W as reconcileScopeRetainedOwnerEnvironment, Wr as defineProfileMaterializationContract, X as scopeRetainedOwnerResult, Xt as createInbox, Y as scopeRetainedOwnerRestorePoint, Z as scopeRetainedOwnerTurnEnded, Zn as persistHarnessTranscript, _ as isDriverSpec, _a as meterUsageEvent, _i as runtimeOwnedExecutorProviderEvidence, _r as generateSpanId, ai as authoredAgentIdentity, an as isLiveNodeStatus, b as assertRecursiveReservationPolicy, ba as spendFromUsageTotals, c as runTree, ca as contentAddress, ci as inheritRuntimeOwnedExecutorAttestation, cn as bridgeModelRouteRefusal, da as executorFailure, ei as unsupportedProfileDimensions, f as runDriverWithRetry, fa as errMessage, fi as providerAttemptEvidence, g as driverExecutorFactory, gi as runtimeOwnedExecutorMaterialization, gt as CONTINUATIONS_DIR, h as driverChild, ha as assertValidBudget, hi as runtimeOwnedExecutorExecutionBinding, hr as createOtelExporter, i as bestDelivered, ii as attestRuntimeOwnedScopeOwner, it as providerVisibleProfile, ji as retainedExecutorSeamKey, k as restoreScopeOwnerAcceptedExecution, kt as bindReusableExecutorExecutionId, mi as runtimeOwnedDriveHarnessProviderEvidence, mt as gateOnDeliverable, n as createRootHandle, ni as worktreeCliProfileMaterialization, nn as isPeerMailEnvelope, nt as coordinationMcpAlias, oa as parseWorkerToolTraceArtifact, p as summarizeDriverAttempts, pi as recordRuntimeOwnedDriveHarnessProviderEvidence, q as scopeRetainedOwnerPriorSpend, qn as linkAbort, qr as promptControlProfileMaterialization, r as createSupervisor, rt as coordinationProfileToolPrefix, s as runFinalizer, sn as bridgeAdmissionRefusal, u as HarnessTurnFailedError, ua as detachedSnapshot, va as newUsageTotals, vi as runtimeOwnedPendingExecutorMaterialization, vt as CheckUnavailableError, w as meterRuntimeOwnedAccounting, wn as routerBrain, x as beginScopeOwnerAttempt, xr as toOtelAttributes, xt as bestComposite, yi as runtimeOwnedScopeOwnerRuntime, yt as admitContinuationPolicy, z as bindScopeRetainedOwnerProvider, zt as createRouterTranscript } from "./supervisor-DnKhkhKc.js";
2
3
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } from "./errors-DodWX-cb.js";
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
- 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
- import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
4
+ 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-CcoARX4v.js";
5
+ import { a as readCommittedJsonLines, n as isNoEntError, r as prepareJsonlAppend } from "./jsonl-file-DBv31uPi.js";
6
+ 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-CyCUwHed.js";
6
7
  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-xq1y2G6E.js";
8
+ 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-CNEeqMoh.js";
8
9
  import { r as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-Dqer2M4_.js";
9
- import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-DSCWdbX2.js";
10
+ import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-Cu8H7aeh.js";
10
11
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
11
12
  import { toolSpansToTraceAnalysisStore } from "@tangle-network/agent-eval";
12
13
  import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -648,6 +649,7 @@ async function serveCoordinationMcpForManager(opts, lifetime) {
648
649
  ...opts.analysts ? { analysts: opts.analysts } : {},
649
650
  ...opts.analyzeOnSettle ? { analyzeOnSettle: opts.analyzeOnSettle } : {},
650
651
  ...opts.sourceEvidenceRefs ? { sourceEvidenceRefs: opts.sourceEvidenceRefs } : {},
652
+ ...opts.peerAudit ? { peerAudit: opts.peerAudit } : {},
651
653
  ...opts.watchWorkers ? { watchWorkers: opts.watchWorkers } : {},
652
654
  ...opts.stallAfterMs !== void 0 ? { stallAfterMs: opts.stallAfterMs } : {},
653
655
  ...opts.continuityByProfile ? { continuityByProfile: opts.continuityByProfile } : {},
@@ -1952,6 +1954,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1952
1954
  ...deps.analysts ? { analysts: deps.analysts } : {},
1953
1955
  ...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
1954
1956
  ...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
1957
+ ...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
1955
1958
  ...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
1956
1959
  ...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
1957
1960
  ...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
@@ -2026,6 +2029,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2026
2029
  const context = nodeContextSeed ? supervisorNodeContext(nodeContextSeed, stableProfile, task, scope) : void 0;
2027
2030
  const priorCoordination = deps.loadPriorCoordination ? await deps.loadPriorCoordination() : deps.priorCoordination;
2028
2031
  const slot = createVerbSlot();
2032
+ const peerInbox = createInbox();
2029
2033
  const nodeTools = resolveTools && context ? await bindSupervisorTools(resolveTools, context, scope.signal, slot) : void 0;
2030
2034
  const nodeObserver = bindSupervisorNodeObserver(context, observeNodeEvent, deps.onEvent);
2031
2035
  const stopController = new AbortController();
@@ -2068,6 +2072,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2068
2072
  ...deps.analysts ? { analysts: deps.analysts } : {},
2069
2073
  ...deps.analyzeOnSettle ? { analyzeOnSettle: deps.analyzeOnSettle } : {},
2070
2074
  ...deps.sourceEvidenceRefs ? { sourceEvidenceRefs: deps.sourceEvidenceRefs } : {},
2075
+ ...deps.peerAudit ? { peerAudit: deps.peerAudit } : {},
2071
2076
  ...deps.escalateQuestion ? { escalateQuestion: deps.escalateQuestion } : {},
2072
2077
  ...deps.watchWorkers ? { watchWorkers: deps.watchWorkers } : {},
2073
2078
  ...deps.stallAfterMs !== void 0 ? { stallAfterMs: deps.stallAfterMs } : {},
@@ -2100,6 +2105,8 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2100
2105
  liveCoordinator = mcp;
2101
2106
  managerInbox = (message) => {
2102
2107
  if (deliver !== void 0 && harnessInvocationActive && (deliverReady === void 0 || deliverReady()) && deliver(message)) return true;
2108
+ const envelope = message !== null && typeof message === "object" ? message[PEER_MAIL_WIRE_KEY] : void 0;
2109
+ if (deps.peerMailUrl && isPeerMailEnvelope(envelope)) return peerInbox.deliver({ [PEER_MAIL_WIRE_KEY]: envelope });
2103
2110
  return controls.receiveLeadMessage(message);
2104
2111
  };
2105
2112
  const coordinationTools = slot.descriptors();
@@ -2291,6 +2298,9 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2291
2298
  state: controls.reentryState(),
2292
2299
  attempt
2293
2300
  });
2301
+ const peerMessages = peerInbox.drain();
2302
+ const peerText = peerMessages.length === 0 ? void 0 : peerInbox.fold(peerMessages);
2303
+ const withPeerMail = (input) => peerText === void 0 ? input : `${typeof input === "string" ? input : JSON.stringify(input) ?? String(input)}\n\n${peerText}`;
2294
2304
  harnessInvocationActive = true;
2295
2305
  let completed = false;
2296
2306
  try {
@@ -2300,10 +2310,10 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2300
2310
  ...registeredProfile === stableProfile ? {} : { registeredProfile },
2301
2311
  ...profilePrompt !== void 0 ? { systemPrompt: profilePrompt } : {},
2302
2312
  ...session === void 0 ? {} : { session },
2303
- task: compose === void 0 ? task : compose(UNPROVEN_CONTINUITY),
2313
+ task: withPeerMail(compose === void 0 ? task : compose(UNPROVEN_CONTINUITY)),
2304
2314
  ...compose === void 0 ? {} : { reentry: {
2305
2315
  reason: reentry,
2306
- compose,
2316
+ compose: (continuity) => withPeerMail(compose(continuity)),
2307
2317
  ...refresh === void 0 ? {} : { refresh },
2308
2318
  onContinuity: (continuity) => {
2309
2319
  if (continuity.environment === "replaced") environmentReplacements += 1;
@@ -2313,6 +2323,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2313
2323
  scope,
2314
2324
  coordinationMcpUrl: mcp.url,
2315
2325
  coordinationMcpHeaders: mcp.headers,
2326
+ ...deps.peerMailUrl ? { peerMailUrl: deps.peerMailUrl } : {},
2316
2327
  stopSignal: stopController.signal,
2317
2328
  coordinationTools
2318
2329
  });
@@ -2346,6 +2357,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
2346
2357
  attempt: nextAttempt,
2347
2358
  signal: AbortSignal.any([scope.signal, stopController.signal]),
2348
2359
  heartbeatMs: wakePolicy.heartbeatMs,
2360
+ ...deps.peerMailUrl ? { alsoWakeOn: peerInbox.pending() > 0 ? Promise.resolve() : peerInbox.nextDelivery() } : {},
2349
2361
  debounceMs: wakePolicy.debounceMs,
2350
2362
  ...warnAt === void 0 ? {} : { deadlineAt: warnAt }
2351
2363
  });
@@ -3270,7 +3282,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3270
3282
  let seatChain;
3271
3283
  let activeSeat;
3272
3284
  let switchedProviderCheckpointAt;
3273
- const drive = async ({ profile, authoredProfile, registeredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, stopSignal, coordinationTools, reentry, session }) => {
3285
+ const drive = async ({ profile, authoredProfile, registeredProfile, task, scope, coordinationMcpUrl, coordinationMcpHeaders, peerMailUrl, stopSignal, coordinationTools, reentry, session }) => {
3274
3286
  const priorCommittedArtifact = managerArtifact;
3275
3287
  managerArtifact = void 0;
3276
3288
  switchedProviderCheckpointAt = void 0;
@@ -3392,6 +3404,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3392
3404
  };
3393
3405
  const turnStop = turnCap > 0 ? new AbortController() : void 0;
3394
3406
  const effectiveStopSignal = turnStop === void 0 ? stopSignal : stopSignal === void 0 ? turnStop.signal : AbortSignal.any([stopSignal, turnStop.signal]);
3407
+ const peerMailAttachment = peerMailRuntimeAttachment(authoredProfile, boundBackend, { peerMailUrl });
3395
3408
  const attachment = {
3396
3409
  transport: "http",
3397
3410
  url: coordinationMcpUrl,
@@ -3408,6 +3421,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3408
3421
  if (!authorization?.startsWith("Bearer ")) throw new ValidationError("driveHarnessFromBackend: provider coordination requires a bearer credential");
3409
3422
  if (Object.hasOwn(boundBackend.defaults?.env ?? {}, credentialName)) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved coordination credential name");
3410
3423
  if (Object.hasOwn(boundBackend.defaults?.runtimeAttachments?.mcp ?? {}, "agent-runtime-coordination")) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved coordination attachment alias");
3424
+ if (peerMailUrl && Object.hasOwn(boundBackend.defaults?.runtimeAttachments?.mcp ?? {}, peerMailMcpAlias)) throw new ValidationError("driveHarnessFromBackend: provider defaults contain the reserved peer-mail attachment alias");
3411
3425
  if (!await providerAcceptsCoordinationAttachments(boundBackend)) throw new ValidationError("driveHarnessFromBackend: provider does not advertise create.runtimeAttachments.mcp; no environment was created");
3412
3426
  factory = createExecutor({
3413
3427
  ...boundBackend,
@@ -3420,6 +3434,10 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3420
3434
  },
3421
3435
  runtimeAttachments: { mcp: {
3422
3436
  ...boundBackend.defaults?.runtimeAttachments?.mcp ?? {},
3437
+ ...peerMailUrl ? { [peerMailMcpAlias]: {
3438
+ transport: "http",
3439
+ url: peerMailUrl
3440
+ } } : {},
3423
3441
  [coordinationMcpAlias]: {
3424
3442
  transport: "http",
3425
3443
  url: coordinationMcpUrl,
@@ -3443,7 +3461,10 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
3443
3461
  onResult: async (result) => commitOwnerResult(result)
3444
3462
  } } : {},
3445
3463
  ...effectiveStopSignal === void 0 ? {} : { [bridgeStopSignalKey]: effectiveStopSignal },
3446
- [bridgeRuntimeAttachmentsKey]: { [coordinationMcpAlias]: attachment }
3464
+ [bridgeRuntimeAttachmentsKey]: {
3465
+ ...peerMailAttachment ?? {},
3466
+ [coordinationMcpAlias]: attachment
3467
+ }
3447
3468
  }
3448
3469
  });
3449
3470
  keepTranscript(lastExecutor?.harnessTranscript?.());
@@ -3876,6 +3897,11 @@ async function verifyProfilePromotions(table) {
3876
3897
  const { verifySealedExperiment } = await import("@tangle-network/agent-eval/experiment");
3877
3898
  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
3899
  }
3900
+ /** Capabilities a data-only consumer may require before building an opted-in run. */
3901
+ const superviseFleetCapabilities = Object.freeze({
3902
+ peerAudit: true,
3903
+ traceTools: true
3904
+ });
3879
3905
  const superviseOptionKeySet = /* @__PURE__ */ new Set([
3880
3906
  "allowedModels",
3881
3907
  "analysts",
@@ -3915,6 +3941,8 @@ const superviseOptionKeySet = /* @__PURE__ */ new Set([
3915
3941
  "onProgressStop",
3916
3942
  "otel",
3917
3943
  "peerMail",
3944
+ "peerAudit",
3945
+ "traceTools",
3918
3946
  "perWorker",
3919
3947
  "reservationPolicy",
3920
3948
  "deadlineCheckIn",
@@ -4398,8 +4426,36 @@ function superviseInternal(profile, task, opts, testBrain) {
4398
4426
  if (options.backend?.backend !== "provider" || options.makeWorkerAgent || options.makeLeafAgent) throw new ValidationError("supervise: SQL runContext requires backend-derived retained provider workers");
4399
4427
  }
4400
4428
  assertValidBudget(options.budget, "supervise budget");
4401
- const composeSpawnProfile = profileGuidanceComposer(options.profileGuidance);
4402
- const registeredProfile = superviseRootProfile(profile, options.profileGuidance);
4429
+ const guidanceComposer = profileGuidanceComposer(options.profileGuidance);
4430
+ const applyTraceTools = (profile) => {
4431
+ if (options.traceTools !== false || profile.tools === void 0) return profile;
4432
+ const tools = Object.fromEntries(Object.entries(profile.tools).filter(([name]) => name !== `${coordinationProfileToolPrefix}observe_agent` && name !== `${coordinationProfileToolPrefix}read_journal`));
4433
+ return agentProfileSchema.parse({
4434
+ ...profile,
4435
+ tools
4436
+ });
4437
+ };
4438
+ const composeSpawnProfile = options.traceTools === false ? (profile) => applyTraceTools(guidanceComposer?.(profile) ?? profile) : guidanceComposer;
4439
+ const auditPeers = /* @__PURE__ */ new Map();
4440
+ const peerAuditFor = (parent) => options.peerAudit ? {
4441
+ register: (nodeId, tools) => {
4442
+ auditPeers.set(nodeId, {
4443
+ parent,
4444
+ tools
4445
+ });
4446
+ },
4447
+ read: async (peerId, name, args) => {
4448
+ const peer = auditPeers.get(peerId);
4449
+ if (peer?.parent !== parent) return { error: "unknown-peer" };
4450
+ const rootRead = name === "observe_agent" && args.tree !== true && args.outRef === void 0 && (args.workerId === void 0 || args.workerId === peerId);
4451
+ const tool = (rootRead ? auditPeers.get(parent)?.tools : peer.tools)?.find((tool) => tool.name === name);
4452
+ return tool ? tool.handler(rootRead ? {
4453
+ ...args,
4454
+ workerId: peerId
4455
+ } : args) : { error: "peer-tool-unavailable" };
4456
+ }
4457
+ } : void 0;
4458
+ const registeredProfile = applyTraceTools(superviseRootProfile(profile, options.profileGuidance));
4403
4459
  if (options.segment !== void 0) admitSegment(options.segment);
4404
4460
  const canonicalProfile = options.segment === void 0 ? registeredProfile : withRootSegment(registeredProfile, options.segment);
4405
4461
  assertExecutableAgentProfile(canonicalProfile, "supervise root");
@@ -4554,7 +4610,7 @@ function superviseInternal(profile, task, opts, testBrain) {
4554
4610
  const withRetry = (make) => withWorkerSpawnRetry(make, options.workerRetry, { ...options.onWorkerRetry ? { onRetry: options.onWorkerRetry } : {} });
4555
4611
  const makeLeaf = withRetry(options.makeLeafAgent ?? workerFromBackend(options.backend, deliverable));
4556
4612
  const securityPolicy = options.profileSecurity ?? DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY;
4557
- const makeRecursiveWorkerFor = (parent, parentIdentity, depth, parentOwnerId, analystLineage = false) => {
4613
+ const makeRecursiveWorkerFor = (parent, parentIdentity, depth, parentOwnerId, analystLineage = false, peerRootOwnerId) => {
4558
4614
  const makeRecursiveWorker = (authoredProfile, spawnContext, recovering = false) => {
4559
4615
  if (!spawnContext) throw new ValidationError("supervise: backend-derived workers require spawn context");
4560
4616
  const input = freezeDetachedProfile(authoredProfile);
@@ -4577,7 +4633,7 @@ function superviseInternal(profile, task, opts, testBrain) {
4577
4633
  ...spawnContext.execution ? { execution: spawnContext.execution } : {}
4578
4634
  });
4579
4635
  if (typeof decision !== "object" || decision === null || Array.isArray(decision)) throw new ValidationError("supervise: authorizeSpawn must return an AuthorizedSpawn");
4580
- const authorized = freezeDetachedProfile(decision.profile);
4636
+ const authorized = freezeDetachedProfile(applyTraceTools(decision.profile));
4581
4637
  const childExecution = canonicalExecution(authorized, spawnContext.task, decision.execution, `supervise spawn ${JSON.stringify(spawnContext.label)}`);
4582
4638
  const authorizedContext = Object.freeze({
4583
4639
  ...spawnContext,
@@ -4623,12 +4679,16 @@ function superviseInternal(profile, task, opts, testBrain) {
4623
4679
  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
4680
  assertProfileContract(authorized, isExternalSupervisor(authorized) ? driverMaterialization : promptModelProfileMaterialization, `supervise driver ${JSON.stringify(spawnContext.label)}`, true);
4625
4681
  if (managerBackend) assertBridgeProfileMaterializes(profileWithoutDeclaredRuntimeCoordinationTools(authorized), managerBackend, `supervise driver ${JSON.stringify(spawnContext.label)}`);
4626
- const childFactory = makeRecursiveWorkerFor(authorized, childExecution.identity, depth + 1, ownerId, analystLineage || spawnContext.analyst !== void 0 || spawnContext.assignmentId.startsWith("analyst:"));
4682
+ const rootPeerOwner = options.peerAudit ? depth === 1 ? ownerId : peerRootOwnerId : void 0;
4683
+ const childFactory = makeRecursiveWorkerFor(authorized, childExecution.identity, depth + 1, ownerId, analystLineage || spawnContext.analyst !== void 0 || spawnContext.assignmentId.startsWith("analyst:"), rootPeerOwner);
4627
4684
  const nestedPerWorker = defaultPerWorker(spawnContext.budget, ownerShare);
4628
4685
  const authorizeNestedMessage = authorizeDownFor(authorized, depth + 1);
4629
4686
  let acceptedSubmission = false;
4630
4687
  let unassessedOutput = false;
4688
+ const peerAudit = depth === 1 ? peerAuditFor(spawnContext.parentNodeId) : void 0;
4631
4689
  return driverChild(authorized, supervisorAgent(authorized, {
4690
+ ...spawnContext.peerMailUrl ? { peerMailUrl: spawnContext.peerMailUrl } : {},
4691
+ ...peerAudit ? { peerAudit } : {},
4632
4692
  blobs,
4633
4693
  onUnassessedOutput: () => {
4634
4694
  unassessedOutput = true;
@@ -4648,7 +4708,8 @@ function superviseInternal(profile, task, opts, testBrain) {
4648
4708
  ownerId,
4649
4709
  depth,
4650
4710
  identity: childExecution.identity,
4651
- assignmentId: spawnContext.assignmentId
4711
+ assignmentId: spawnContext.assignmentId,
4712
+ ...rootPeerOwner ? { peerRootOwnerId: rootPeerOwner } : {}
4652
4713
  },
4653
4714
  ...options.resolveSupervisorTools ? { resolveSupervisorTools: options.resolveSupervisorTools } : {},
4654
4715
  ...observeNodeEvent ? {
@@ -4739,7 +4800,9 @@ function superviseInternal(profile, task, opts, testBrain) {
4739
4800
  await verifyProfilePromotions(profileTable);
4740
4801
  const priorCoordination = log ? await log.load(runId, rootOwnerId) : void 0;
4741
4802
  const authorizeRootMessage = authorizeDownFor(canonicalProfile, 1);
4803
+ const rootPeerAudit = peerAuditFor("");
4742
4804
  const agentDeps = {
4805
+ ...rootPeerAudit ? { peerAudit: rootPeerAudit } : {},
4743
4806
  blobs,
4744
4807
  makeWorkerAgent: workerFactory,
4745
4808
  ...authorizeRootMessage ? { authorizeDownMessage: authorizeRootMessage } : {},
@@ -4936,6 +4999,6 @@ function rootProviderModelEvidenceFromExecution(evidence) {
4936
4999
  return evidence ?? rootProviderModelEvidence([]);
4937
5000
  }
4938
5001
  //#endregion
4939
- 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 };
5002
+ 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
5003
 
4941
- //# sourceMappingURL=supervise-DLezpJcp.js.map
5004
+ //# sourceMappingURL=supervise-FOCAUADN.js.map