@tangle-network/agent-runtime 0.188.1 → 0.189.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 (60) hide show
  1. package/dist/{activation-C39nGToq.js → activation-DuYIFVQm.js} +3 -3
  2. package/dist/{activation-C39nGToq.js.map → activation-DuYIFVQm.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +1 -1
  5. package/dist/{authoring-fsUwd9hg.js → authoring-CIE6rF8N.js} +2 -2
  6. package/dist/{authoring-fsUwd9hg.js.map → authoring-CIE6rF8N.js.map} +1 -1
  7. package/dist/candidate-execution/index.d.ts +4 -4
  8. package/dist/candidate-execution/index.js +4 -4
  9. package/dist/{candidate-execution-CehLeZmx.js → candidate-execution-CQYU8E5a.js} +4 -4
  10. package/dist/{candidate-execution-CehLeZmx.js.map → candidate-execution-CQYU8E5a.js.map} +1 -1
  11. package/dist/coordination-driver-CtbyZv5d.js.map +1 -1
  12. package/dist/durable.d.ts +1 -1
  13. package/dist/durable.js +1 -1
  14. package/dist/{graph-Cox_7pht.js → graph-DzkWh1BI.js} +2 -2
  15. package/dist/{graph-Cox_7pht.js.map → graph-DzkWh1BI.js.map} +1 -1
  16. package/dist/graph.d.ts +1 -1
  17. package/dist/graph.js +2 -2
  18. package/dist/{improvement-cycle-CnHGNT5r.js → improvement-cycle-DP9zf-IL.js} +2 -2
  19. package/dist/{improvement-cycle-CnHGNT5r.js.map → improvement-cycle-DP9zf-IL.js.map} +1 -1
  20. package/dist/{index-DQv7iCeE.d.ts → index-DCqHTdmp.d.ts} +3 -3
  21. package/dist/{index-DVob1IA1.d.ts → index-k5bcID4t.d.ts} +18 -7
  22. package/dist/{index-DdmozvB8.d.ts → index-tf6g2B27.d.ts} +3 -3
  23. package/dist/index.d.ts +7 -7
  24. package/dist/index.js +9 -9
  25. package/dist/intelligence.d.ts +2 -2
  26. package/dist/intelligence.js +4 -4
  27. package/dist/kernel.d.ts +1 -1
  28. package/dist/kernel.js +4 -4
  29. package/dist/{knowledge-BZDVXRCl.js → knowledge-C5lODZQC.js} +5 -5
  30. package/dist/{knowledge-BZDVXRCl.js.map → knowledge-C5lODZQC.js.map} +1 -1
  31. package/dist/knowledge.d.ts +1 -1
  32. package/dist/knowledge.js +1 -1
  33. package/dist/{loop-runner-bin-hXqgNrPN.js → loop-runner-bin-BKsjoaVu.js} +2 -2
  34. package/dist/{loop-runner-bin-hXqgNrPN.js.map → loop-runner-bin-BKsjoaVu.js.map} +1 -1
  35. package/dist/{loop-runner-bin-g9fWDuOh.d.ts → loop-runner-bin-ncN_8Msd.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 +2 -2
  39. package/dist/mcp/index.d.ts +1 -1
  40. package/dist/mcp/index.js +3 -3
  41. package/dist/{openai-tools-Cz04RKfD.js → openai-tools-x83CTnJM.js} +2 -2
  42. package/dist/{openai-tools-Cz04RKfD.js.map → openai-tools-x83CTnJM.js.map} +1 -1
  43. package/dist/{prepare-BpIGs5Tc.js → prepare-BtXhV0qj.js} +107 -29
  44. package/dist/prepare-BtXhV0qj.js.map +1 -0
  45. package/dist/{protected-model-port-B8ssMyUg.d.ts → protected-model-port-BtXp2dUY.d.ts} +2 -2
  46. package/dist/{protected-model-port-YclORl0x.js → protected-model-port-DHrayPt4.js} +19 -7
  47. package/dist/protected-model-port-DHrayPt4.js.map +1 -0
  48. package/dist/{runtime-CFltmoiL.js → runtime-C98JsP83.js} +4 -4
  49. package/dist/{runtime-CFltmoiL.js.map → runtime-C98JsP83.js.map} +1 -1
  50. package/dist/{supervise-BUy1cr2L.js → supervise-DSu4d0b6.js} +104 -7
  51. package/dist/{supervise-BUy1cr2L.js.map → supervise-DSu4d0b6.js.map} +1 -1
  52. package/dist/testing.d.ts +1 -1
  53. package/dist/testing.js +12 -12
  54. package/dist/tui/index.d.ts +1 -1
  55. package/dist/{types-19ZOddS3.d.ts → types-1s_29INY.d.ts} +15 -10
  56. package/dist/{workspace-archive-5K72EnlT.js → workspace-archive-SVeiWLNE.js} +2 -2
  57. package/dist/{workspace-archive-5K72EnlT.js.map → workspace-archive-SVeiWLNE.js.map} +1 -1
  58. package/package.json +2 -2
  59. package/dist/prepare-BpIGs5Tc.js.map +0 -1
  60. package/dist/protected-model-port-YclORl0x.js.map +0 -1
@@ -3321,16 +3321,22 @@ function workerFromBackend(backend, deliverable, seams) {
3321
3321
  ...executionScope === void 0 ? {} : { scope: executionScope }
3322
3322
  }));
3323
3323
  const boundSessionId = boundBackend.backend === "bridge" ? boundBackend.sessionId : void 0;
3324
+ const peerMailAttachment = peerMailRuntimeAttachment(profile, capturedBackend, spawnContext);
3324
3325
  const baseFactory = createExecutor(boundBackend);
3325
3326
  const executorFactory = (spec, ctx) => {
3326
3327
  if (boundSessionId !== void 0 && ctx.node?.nodeId !== void 0) bridgeSessionByWorker.set(ctx.node.nodeId, boundSessionId);
3327
3328
  const extraSeams = seams?.();
3328
- const built = baseFactory(spec, extraSeams === void 0 ? ctx : {
3329
+ const seamsForChild = extraSeams === void 0 && peerMailAttachment === void 0 ? ctx.seams : {
3330
+ ...extraSeams,
3331
+ ...ctx.seams,
3332
+ ...peerMailAttachment === void 0 ? {} : { [bridgeRuntimeAttachmentsKey]: {
3333
+ ...readCallerRuntimeAttachments(ctx.seams),
3334
+ ...peerMailAttachment
3335
+ } }
3336
+ };
3337
+ const built = baseFactory(spec, seamsForChild === ctx.seams ? ctx : {
3329
3338
  ...ctx,
3330
- seams: {
3331
- ...extraSeams,
3332
- ...ctx.seams
3333
- }
3339
+ seams: seamsForChild
3334
3340
  });
3335
3341
  return deliverable ? gateOnDeliverable(built, deliverable) : built;
3336
3342
  };
@@ -3346,6 +3352,63 @@ function workerFromBackend(backend, deliverable, seams) {
3346
3352
  };
3347
3353
  };
3348
3354
  }
3355
+ /**
3356
+ * The reserved MCP alias one worker's PEER MAIL capability endpoint mounts under.
3357
+ *
3358
+ * Distinct from the driver's coordination alias on purpose: the two servers carry different
3359
+ * authority. Coordination mounts spawn_worker / steer_agent / stop; mail mounts send_mail and
3360
+ * read_mail and nothing else, on a per-worker secret path bound to that worker's identity.
3361
+ */
3362
+ const peerMailMcpAlias = "agent-runtime-peer-mail";
3363
+ /**
3364
+ * The Runtime-owned MCP attachment that carries this spawn's peer-mail endpoint into the worker,
3365
+ * or `undefined` when this backend runs no MCP client at all.
3366
+ *
3367
+ * The endpoint rides the SAME out-of-band channel the driver's coordination MCP rides
3368
+ * (`runtime_attachments` on the bridge wire), for the same reason: the capability path carries
3369
+ * fresh random bytes per process, so writing it into `AgentProfile.mcp` would move the canonical
3370
+ * profile digest a durable session is bound to, and a keyed re-spawn would then fail its identity
3371
+ * check against the journal. Nothing in the authored profile changes, and this runs inside the
3372
+ * leaf factory — after `authorizeSpawn` has already decided the profile — so the authorization
3373
+ * chain is unchanged.
3374
+ *
3375
+ * Three backend classes, three honest answers:
3376
+ *
3377
+ * - `bridge` MOUNTS it. cli-bridge advertises `capabilities.runtimeAttachments.mcp` and mounts
3378
+ * the named servers for the run without binding them into the session profile.
3379
+ * - `router`, `router-tools` and `provider` mount NOTHING. Those workers are in-process tool
3380
+ * loops with no MCP client; their tool surface is the caller's own array, and
3381
+ * `WorkerSpawnContext.peerMailUrl` is the deliverable a caller uses directly.
3382
+ * - Every other backend REFUSES the spawn. A sandbox box or a local CLI harness receives tools
3383
+ * only through its materialized `AgentProfile`, and the runtime has no channel that reaches it
3384
+ * out of band, so minting a capability it can never call would ledger a channel that does not
3385
+ * exist. This is the same rule `bridgeResumeSessionId` applies to `continuity: 'resume'`.
3386
+ */
3387
+ function peerMailRuntimeAttachment(profile, backend, spawnContext) {
3388
+ const url = spawnContext?.peerMailUrl;
3389
+ if (url === void 0) return void 0;
3390
+ switch (backend.backend) {
3391
+ case "router":
3392
+ case "router-tools":
3393
+ case "provider": return;
3394
+ case "bridge": break;
3395
+ default: throw new ValidationError(`workerFromBackend: the '${backend.backend}' backend seam cannot mount a peer-mail endpoint — it materializes tools only through the AgentProfile, and writing a per-process capability URL there would move the canonical profile digest. Run peer-mail workers on the 'bridge' backend, mount the endpoint yourself from WorkerSpawnContext.peerMailUrl through makeLeafAgent or makeWorkerAgent, or drop peerMail for this run`);
3396
+ }
3397
+ if (profile.mcp?.[peerMailMcpAlias] !== void 0) throw new ValidationError(`workerFromBackend: profile MCP alias ${JSON.stringify(peerMailMcpAlias)} is reserved`);
3398
+ return Object.freeze({ [peerMailMcpAlias]: Object.freeze({
3399
+ transport: "http",
3400
+ url
3401
+ }) });
3402
+ }
3403
+ /**
3404
+ * Runtime attachments a caller already put on the child's `ExecutorContext`, so mounting peer mail
3405
+ * ADDS one server rather than replacing the map. An absent or malformed value contributes nothing;
3406
+ * the executor that reads the seam owns its validation and refuses a malformed map there.
3407
+ */
3408
+ function readCallerRuntimeAttachments(seams) {
3409
+ const existing = seams[bridgeRuntimeAttachmentsKey];
3410
+ return existing !== null && typeof existing === "object" && !Array.isArray(existing) ? existing : {};
3411
+ }
3349
3412
  function externalExecutionId(kind, identity) {
3350
3413
  return `${kind}-${canonicalCandidateDigest({
3351
3414
  kind,
@@ -3877,13 +3940,46 @@ function captureDeliverable(deliverable, context) {
3877
3940
  check: deliverable.check
3878
3941
  });
3879
3942
  }
3943
+ Object.freeze([...[
3944
+ "authorizeMessage",
3945
+ "authorizeSpawn",
3946
+ "driveHarness",
3947
+ "executeExtraTool",
3948
+ "finalizer",
3949
+ "isDriverProfile",
3950
+ "makeLeafAgent",
3951
+ "makeWorkerAgent",
3952
+ "now",
3953
+ "onCoordinationEvent",
3954
+ "onDriverAttempt",
3955
+ "onProgressStop",
3956
+ "onUnmetContract",
3957
+ "resolveDeliverable",
3958
+ "resolveDriveHarness",
3959
+ "resolveSpawnProfile",
3960
+ "resolveSupervisorTools",
3961
+ "stopRule"
3962
+ ]]);
3963
+ /**
3964
+ * Refuse a callback that reached the decision-data remainder, naming the option.
3965
+ *
3966
+ * The type test above cannot see a callback nested inside an object-valued option, and
3967
+ * `detachedSnapshot` would report only that its input is not structured-cloneable. This says which
3968
+ * key carries the callback and what to do about it, so the next occurrence is a five-second fix
3969
+ * instead of a bisect over every option a caller passed.
3970
+ */
3971
+ function assertNoUncapturedExecutableOption(decisionData) {
3972
+ const carried = Object.entries(decisionData).filter(([, value]) => typeof value === "function").map(([key]) => key);
3973
+ if (carried.length > 0) throw new ValidationError(`supervise: option ${carried.sort().join(", ")} carries a callback that the option capture does not forward, so the run would fail on a structured-clone refusal that names the snapshot instead of the option; lift the key out of the decision data in captureSuperviseOptions and add it to superviseExecutableOptionKeys`);
3974
+ }
3880
3975
  /** Capture the public one-call configuration before any asynchronous work starts. Decision data is
3881
3976
  * detached and frozen; executable ports are copied as the exact references selected at intake.
3882
3977
  * Service internals intentionally remain live, while replacing a callback/service on the caller's
3883
3978
  * mutable options object can no longer change an in-flight run. */
3884
3979
  function captureSuperviseOptions(opts) {
3885
3980
  assertSuperviseOptionKeys(opts, "supervise");
3886
- const { backend, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, resolveSpawnProfile, blobs, journal, probes, registry, hooks, otel, authorizeSpawn, authorizeMessage, isDriverProfile, driveHarness, resolveDriveHarness, resolveSupervisorTools, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, finalizer, now, signal, rootHandle, ...decisionData } = opts;
3981
+ const { backend, driverBackend, deliverable, resolveDeliverable, router, compaction, watchWorkers, analysts, makeWorkerAgent, makeLeafAgent, resolveSpawnProfile, blobs, journal, probes, registry, hooks, otel, authorizeSpawn, authorizeMessage, isDriverProfile, driveHarness, resolveDriveHarness, resolveSupervisorTools, onCoordinationEvent, executeExtraTool, stopRule, onProgressStop, onDriverAttempt, onUnmetContract, finalizer, now, signal, rootHandle, ...decisionData } = opts;
3982
+ assertNoUncapturedExecutableOption(decisionData);
3887
3983
  const capturedData = detachedSnapshot(decisionData, "supervise options");
3888
3984
  const capturedBackend = backend === void 0 ? void 0 : snapshotExecutorConfig(backend);
3889
3985
  const capturedDriverBackend = driverBackend === void 0 ? void 0 : snapshotExecutorConfig(driverBackend);
@@ -3939,6 +4035,7 @@ function captureSuperviseOptions(opts) {
3939
4035
  ...stopRule === void 0 ? {} : { stopRule },
3940
4036
  ...onProgressStop === void 0 ? {} : { onProgressStop },
3941
4037
  ...onDriverAttempt === void 0 ? {} : { onDriverAttempt },
4038
+ ...onUnmetContract === void 0 ? {} : { onUnmetContract },
3942
4039
  ...finalizer === void 0 ? {} : { finalizer },
3943
4040
  ...now === void 0 ? {} : { now },
3944
4041
  ...signal === void 0 ? {} : { signal },
@@ -4461,4 +4558,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
4461
4558
  //#endregion
4462
4559
  export { DelegationTaskQueue as $, DELEGATION_HISTORY_DESCRIPTION as A, validateDelegateUiAuditArgs as B, createInProcessTransport as C, DELEGATION_STATUS_TOOL_NAME as D, DELEGATION_STATUS_INPUT_SCHEMA as E, delegationProfiles as F, validateDelegateFeedbackArgs as G, DELEGATE_FEEDBACK_INPUT_SCHEMA as H, DELEGATE_UI_AUDIT_DESCRIPTION as I, DELEGATE_TOOL_NAME as J, DELEGATE_DESCRIPTION as K, DELEGATE_UI_AUDIT_INPUT_SCHEMA as L, DELEGATION_HISTORY_TOOL_NAME as M, createDelegationHistoryHandler as N, createDelegationStatusHandler as O, validateDelegationHistoryArgs as P, delegate as Q, DELEGATE_UI_AUDIT_TOOL_NAME as R, serveCoordinationMcp as S, DELEGATION_STATUS_DESCRIPTION as T, DELEGATE_FEEDBACK_TOOL_NAME as U, DELEGATE_FEEDBACK_DESCRIPTION as V, createDelegateFeedbackHandler as W, validateDelegateArgs as X, createDelegateHandler as Y, defaultDelegateBudget as Z, promptHandle as _, assertCoordinationBinding as a, composeLoopTraceEmitters as at, classifyDriverFailure as b, supervisorAgentWithTestBrain as c, DelegationStateCorruptError as ct, delegatesWorkerBriefPrompt as d, InMemoryFeedbackStore as dt, hashIdempotencyInput as et, dumbContinuationFailPrompt as f, eventToSnapshot as ft, naiveContinuationPrompt as g, kernelPromptRegistry as h, mapExecutorResult as ht, workerFromBackend as i, capDelegationTrace as it, DELEGATION_HISTORY_INPUT_SCHEMA as j, validateDelegationStatusArgs as k, analyzesFindingsReportPrompt as l, FileDelegationStore as lt, formatPromptHandle as m, gateOnDeliverable as mt, supervise as n, DELEGATION_TRACE_MAX_SPANS as nt, resolveSupervisorProfile as o, createDelegationTraceCollector as ot, dumbContinuationPassPrompt as p, createSupervisorSpanRecorder as pt, DELEGATE_INPUT_SCHEMA as q, superviseWithTestBrain as r, buildDelegationTraceSpans as rt, supervisorAgent as s, DelegationPersistenceError as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, DELEGATION_TRACE_MAX_BYTES as tt, createPromptRegistry as u, InMemoryDelegationStore as ut, supervisorPolicyPrompt as v, createMcpServer as w, defaultUnmetContractSteer as x, DriverAttemptsExhaustedError as y, createDelegateUiAuditHandler as z };
4463
4560
 
4464
- //# sourceMappingURL=supervise-BUy1cr2L.js.map
4561
+ //# sourceMappingURL=supervise-DSu4d0b6.js.map