@tangle-network/agent-runtime 0.135.2 → 0.137.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 (48) hide show
  1. package/dist/{activation-n_QCjFyg.js → activation-BHoMDzMv.js} +2 -2
  2. package/dist/{activation-n_QCjFyg.js.map → activation-BHoMDzMv.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{authoring-Cl5xwuKl.js → authoring-rEOOEWn6.js} +2 -2
  6. package/dist/{authoring-Cl5xwuKl.js.map → authoring-rEOOEWn6.js.map} +1 -1
  7. package/dist/{graph-NKOjYL1z.js → graph-yaEG0ZiR.js} +2 -2
  8. package/dist/{graph-NKOjYL1z.js.map → graph-yaEG0ZiR.js.map} +1 -1
  9. package/dist/{improvement-cycle-B8KrGlT4.js → improvement-cycle-BeVj-EGJ.js} +3 -3
  10. package/dist/{improvement-cycle-B8KrGlT4.js.map → improvement-cycle-BeVj-EGJ.js.map} +1 -1
  11. package/dist/{index-CP1RvdOw.d.ts → index-CcP87vSG.d.ts} +3 -3
  12. package/dist/{index-DjPLpg7-.d.ts → index-DBuSUP9J.d.ts} +61 -44
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.js +7 -7
  15. package/dist/intelligence.d.ts +2 -2
  16. package/dist/intelligence.js +3 -3
  17. package/dist/kernel.d.ts +3 -3
  18. package/dist/kernel.js +7 -7
  19. package/dist/{knowledge-_7FWqPwl.js → knowledge-C1TcOBf6.js} +3 -3
  20. package/dist/{knowledge-_7FWqPwl.js.map → knowledge-C1TcOBf6.js.map} +1 -1
  21. package/dist/knowledge.d.ts +1 -1
  22. package/dist/knowledge.js +1 -1
  23. package/dist/{loop-runner-bin-DndNkp6D.d.ts → loop-runner-bin-Bfl9tm0R.d.ts} +2 -2
  24. package/dist/{loop-runner-bin-CnlVnCM1.js → loop-runner-bin-DhUWzpNp.js} +3 -3
  25. package/dist/{loop-runner-bin-CnlVnCM1.js.map → loop-runner-bin-DhUWzpNp.js.map} +1 -1
  26. package/dist/loop-runner-bin.d.ts +1 -1
  27. package/dist/loop-runner-bin.js +1 -1
  28. package/dist/mcp/bin.js +3 -3
  29. package/dist/mcp/index.d.ts +2 -2
  30. package/dist/mcp/index.js +4 -4
  31. package/dist/{openai-tools-o7jw10Fn.js → openai-tools-K38wcStR.js} +2 -2
  32. package/dist/{openai-tools-o7jw10Fn.js.map → openai-tools-K38wcStR.js.map} +1 -1
  33. package/dist/primeintellect/index.d.ts +1 -1
  34. package/dist/{redact--KfuCwwo.d.ts → redact-BwEdhuVH.d.ts} +2 -2
  35. package/dist/{runtime-WugWo__W.d.ts → runtime-DhPCNvuH.d.ts} +207 -23
  36. package/dist/{runtime-BQTE0RJS.js → runtime-yCuqlhou.js} +6 -6
  37. package/dist/{runtime-BQTE0RJS.js.map → runtime-yCuqlhou.js.map} +1 -1
  38. package/dist/{structural-rollout-keBf4YEc.js → structural-rollout-2Z6J5ttt.js} +2 -2
  39. package/dist/{structural-rollout-keBf4YEc.js.map → structural-rollout-2Z6J5ttt.js.map} +1 -1
  40. package/dist/{supervise-CVP9ku5U.js → supervise-to2ynnCG.js} +105 -8
  41. package/dist/supervise-to2ynnCG.js.map +1 -0
  42. package/dist/{supervisor-mZ9Glkz7.js → supervisor-BfJNS2Z3.js} +394 -13
  43. package/dist/supervisor-BfJNS2Z3.js.map +1 -0
  44. package/dist/testing.d.ts +2 -2
  45. package/dist/testing.js +11 -11
  46. package/package.json +10 -10
  47. package/dist/supervise-CVP9ku5U.js.map +0 -1
  48. package/dist/supervisor-mZ9Glkz7.js.map +0 -1
@@ -4,7 +4,7 @@ import { S as contentAddress, b as parseWorkerToolTraceArtifact, d as prepareJso
4
4
  import { n as chargedTokens } from "./util-C1bv6yog.js";
5
5
  import { a as concreteProfileModel, d as harnessRunsAgent, n as assertModelAllowed, r as assertProfileModelsAllowed, s as profileModelExecutionSettings, t as assertExecutableAgentProfile, u as agentHarness } from "./model-policy-UTTc9Z-A.js";
6
6
  import { S as runtimeOwnedScopeOwnerRuntime, _ as runtimeOwnedDriveHarnessProviderEvidence, b as runtimeOwnedExecutorProviderEvidence, d as recordRuntimeOwnedDriveHarnessProviderEvidence, i as attestRuntimeOwnedScopeOwner, s as inheritRuntimeOwnedExecutorAttestation, v as runtimeOwnedExecutorExecutionBinding, x as runtimeOwnedPendingExecutorMaterialization, y as runtimeOwnedExecutorMaterialization } from "./materialization-BP5zspr2.js";
7
- import { $ as createInbox, B as WORKER_TRACE_PROPAGATION, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, I as createExecutor, Jt as defineProfileMaterializationContract, Kt as assertProfileMaterialization, L as createExecutorRegistry, M as bindReusableExecutorExecutionId, N as bridgeStopSignalKey, O as teardownExecutor, Ot as toOtelAttributes, P as captureReusableExecutorConfig, Qt as promptModelProfileMaterialization, R as snapshotExecutorConfig, Xt as profileMaterializationAxes$1, Yt as fullProfileMaterialization, Zt as promptControlProfileMaterialization, a as pickBestDelivered, c as driverChild, ct as routerBrain, d as deriveNodeExecutionIdentity, f as meterRuntimeOwnedAccounting, h as scopeOwnerExecutorNodeContext, in as worktreeCliProfileMaterialization, j as spendFromUsageEvents, k as assertValidBudget, l as withDriverExecutor, lt as runBrainLoop, m as recordScopeOwnerMaterialization, n as createSupervisor, o as runFinalizer, p as meterRuntimeOwnedProviderAttempt, qt as controlProfileMaterialization, r as bestDelivered, s as runTree, vt as buildLoopSpanNodes, w as freeSlots, wt as generateSpanId, xt as createOtelExporter } from "./supervisor-mZ9Glkz7.js";
7
+ import { $ as createInbox, B as WORKER_TRACE_PROPAGATION, D as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, Et as buildLoopSpanNodes, I as createExecutor, It as toOtelAttributes, L as createExecutorRegistry, M as bindReusableExecutorExecutionId, Mt as generateSpanId, N as bridgeStopSignalKey, O as teardownExecutor, P as captureReusableExecutorConfig, R as snapshotExecutorConfig, _t as runBrainLoop, a as pickBestDelivered, an as promptControlProfileMaterialization, c as driverChild, d as deriveNodeExecutionIdentity, en as assertProfileMaterialization, f as meterRuntimeOwnedAccounting, fn as worktreeCliProfileMaterialization, gt as routerBrain, h as scopeOwnerExecutorNodeContext, in as profileMaterializationAxes$1, it as createPeerMailbox, j as spendFromUsageEvents, k as assertValidBudget, kt as createOtelExporter, l as withDriverExecutor, m as recordScopeOwnerMaterialization, n as createSupervisor, nn as defineProfileMaterializationContract, o as runFinalizer, on as promptModelProfileMaterialization, p as meterRuntimeOwnedProviderAttempt, r as bestDelivered, rn as fullProfileMaterialization, s as runTree, tn as controlProfileMaterialization, w as freeSlots } from "./supervisor-BfJNS2Z3.js";
8
8
  import { t as composeRuntimeHooks } from "./runtime-hooks-C7iJOWm3.js";
9
9
  import { _ as writeWorkerCancellation, a as readWorkerCancellation, i as readWorkerCancelRequests } from "./run-layout-Be_Z0dF8.js";
10
10
  import { t as createStdioToolServer } from "./tool-server-Dh-NcbHr.js";
@@ -536,6 +536,7 @@ var FileCoordinationLog = class {
536
536
  const findings = [];
537
537
  const continuations = [];
538
538
  const deliveryEvidence = [];
539
+ const mail = [];
539
540
  const records = [];
540
541
  let legacySeq = 0;
541
542
  for (const stored of parseCommittedJsonLines(text, this.path)) {
@@ -569,6 +570,7 @@ var FileCoordinationLog = class {
569
570
  }
570
571
  });
571
572
  } else if (ev.type === "instruction") continuations.push(ev.instruction);
573
+ else if (ev.type === "mail") mail.push(ev.mail);
572
574
  }
573
575
  return {
574
576
  ...ownerId !== void 0 ? { ownerId } : {},
@@ -576,6 +578,7 @@ var FileCoordinationLog = class {
576
578
  findings,
577
579
  continuations,
578
580
  deliveryEvidence,
581
+ mail,
579
582
  records
580
583
  };
581
584
  }
@@ -587,6 +590,7 @@ function emptyPriorCoordination(ownerId) {
587
590
  findings: [],
588
591
  continuations: [],
589
592
  deliveryEvidence: [],
593
+ mail: [],
590
594
  records: []
591
595
  };
592
596
  }
@@ -1565,11 +1569,23 @@ function createCoordinationTools(opts) {
1565
1569
  type: "delivery-attempt",
1566
1570
  ...ev.attempt
1567
1571
  };
1572
+ if (ev.type === "mail") return {
1573
+ type: "mail",
1574
+ ...ev.mail
1575
+ };
1568
1576
  return {
1569
1577
  type: ev.type,
1570
1578
  ...ev.down
1571
1579
  };
1572
1580
  };
1581
+ const peerMail = opts.peerMail ? createPeerMailbox({
1582
+ scope: opts.scope,
1583
+ publish: (mail) => bus.publish({
1584
+ type: "mail",
1585
+ mail
1586
+ }, { queue: false }).then(() => void 0),
1587
+ ...opts.peerMail.limits ? { limits: opts.peerMail.limits } : {}
1588
+ }) : void 0;
1573
1589
  const nextQuestionId = (from) => {
1574
1590
  for (;;) {
1575
1591
  const id = `${from}:q${questionSeq++}`;
@@ -1821,6 +1837,7 @@ function createCoordinationTools(opts) {
1821
1837
  const label = typeof a.label === "string" ? a.label : "worker";
1822
1838
  const budget = Object.freeze(a.budget === void 0 ? opts.perWorker : mergeBudget(opts.perWorker, a.budget));
1823
1839
  const assignmentId = key !== void 0 ? `key:${key}` : `ordinal:${unkeyedAssignmentOrdinal++}`;
1840
+ const peerMailUrl = peerMail?.mintCapability(assignmentId);
1824
1841
  const context = Object.freeze({
1825
1842
  assignmentId,
1826
1843
  parentNodeId: opts.scope.view.root,
@@ -1829,7 +1846,8 @@ function createCoordinationTools(opts) {
1829
1846
  label,
1830
1847
  ...key !== void 0 ? { key } : {},
1831
1848
  continuity: continuity.continuity,
1832
- ...continuity.continuity === "resume" ? { resume: continuity.resume } : {}
1849
+ ...continuity.continuity === "resume" ? { resume: continuity.resume } : {},
1850
+ ...peerMailUrl !== void 0 ? { peerMailUrl } : {}
1833
1851
  });
1834
1852
  const res = opts.scope.spawn(() => opts.makeWorkerAgent(profile, context), task, {
1835
1853
  budget,
@@ -1853,6 +1871,7 @@ function createCoordinationTools(opts) {
1853
1871
  if (res.ok) {
1854
1872
  watchWorker(res.handle.id);
1855
1873
  liveHandles.set(res.handle.id, res.handle);
1874
+ peerMail?.bindCapability(assignmentId, res.handle.id);
1856
1875
  if (key !== void 0) keyByWorker.set(res.handle.id, key);
1857
1876
  if (typeof profile.name === "string" && profile.name.length > 0) profileNameByWorker.set(res.handle.id, profile.name);
1858
1877
  }
@@ -2262,7 +2281,8 @@ function createCoordinationTools(opts) {
2262
2281
  settled: () => ledger,
2263
2282
  questions: () => questions,
2264
2283
  drainResolved,
2265
- abortWorker
2284
+ abortWorker,
2285
+ ...peerMail ? { peerMail } : {}
2266
2286
  };
2267
2287
  }
2268
2288
  function nextUnkeyedAssignmentOrdinal(scope) {
@@ -5031,7 +5051,8 @@ async function serveCoordinationMcp(opts) {
5031
5051
  ...opts.onEvent ? { onEvent: opts.onEvent } : {},
5032
5052
  ...opts.replaySettlements ? { replaySettlements: true } : {},
5033
5053
  ...opts.questionPolicy ? { questionPolicy: opts.questionPolicy } : {},
5034
- ...opts.priorQuestions?.length ? { priorQuestions: opts.priorQuestions } : {}
5054
+ ...opts.priorQuestions?.length ? { priorQuestions: opts.priorQuestions } : {},
5055
+ ...opts.peerMail ? { peerMail: typeof opts.peerMail === "object" && opts.peerMail.limits ? { limits: opts.peerMail.limits } : {} } : {}
5035
5056
  });
5036
5057
  await coord.ready();
5037
5058
  const mcp = createMcpServer({
@@ -5080,6 +5101,8 @@ async function serveCoordinationMcp(opts) {
5080
5101
  resolve(typeof addr === "object" && addr ? addr.port : opts.port ?? 0);
5081
5102
  });
5082
5103
  });
5104
+ const mailbox = coord.peerMail;
5105
+ const mailListener = mailbox === void 0 ? void 0 : await servePeerMail(mailbox, host);
5083
5106
  return {
5084
5107
  url: `http://${host}:${port}/mcp`,
5085
5108
  port,
@@ -5090,10 +5113,84 @@ async function serveCoordinationMcp(opts) {
5090
5113
  history: () => coord.history(),
5091
5114
  stats: () => coord.stats(),
5092
5115
  raiseFinding: (finding) => coord.raiseFinding(finding),
5093
- close: () => new Promise((resolve) => {
5094
- server.close(() => resolve());
5095
- })
5116
+ mailHistory: () => mailbox?.history() ?? [],
5117
+ stopMailThread: (threadId) => mailbox?.stopThread(threadId) ?? false,
5118
+ close: async () => {
5119
+ await new Promise((resolve) => {
5120
+ server.close(() => resolve());
5121
+ });
5122
+ await mailListener?.close();
5123
+ }
5124
+ };
5125
+ }
5126
+ /**
5127
+ * Stand up the peer-mail capability listener: one HTTP server, one secret path per worker, and on
5128
+ * each path a tool server carrying ONLY `send_mail` / `read_mail` with that worker's identity
5129
+ * closed over. An unknown path is a flat 404 — the path is the credential, so a request that does
5130
+ * not present a minted one is not a client to reason with.
5131
+ *
5132
+ * The host is the coordination host, which the caller has already had to justify: the loopback gate
5133
+ * above governs both listeners, and there is deliberately no way to bind mail somewhere else.
5134
+ */
5135
+ async function servePeerMail(mailbox, host) {
5136
+ const servers = /* @__PURE__ */ new Map();
5137
+ const forCapability = (capabilityId) => {
5138
+ const existing = servers.get(capabilityId);
5139
+ if (existing) return existing;
5140
+ const created = createStdioToolServer({
5141
+ serverName: "peer-mail",
5142
+ serverVersion: "1",
5143
+ tools: mailbox.tools(capabilityId)
5144
+ });
5145
+ servers.set(capabilityId, created);
5146
+ return created;
5096
5147
  };
5148
+ const listener = createServer((req, res) => {
5149
+ const capabilityId = /^\/mail\/([0-9a-f]{32})$/.exec(req.url ?? "")?.[1];
5150
+ if (req.method !== "POST" || capabilityId === void 0 || !mailbox.hasCapability(capabilityId)) {
5151
+ res.writeHead(404).end();
5152
+ return;
5153
+ }
5154
+ let body = "";
5155
+ req.on("data", (chunk) => {
5156
+ body += chunk;
5157
+ });
5158
+ req.on("end", () => {
5159
+ (async () => {
5160
+ try {
5161
+ const message = JSON.parse(body);
5162
+ const response = await forCapability(capabilityId).handle(message);
5163
+ if (response === null) {
5164
+ res.writeHead(202).end();
5165
+ return;
5166
+ }
5167
+ res.writeHead(200, { "content-type": "application/json" });
5168
+ res.end(JSON.stringify(response));
5169
+ } catch (e) {
5170
+ res.writeHead(200, { "content-type": "application/json" });
5171
+ res.end(JSON.stringify({
5172
+ jsonrpc: "2.0",
5173
+ id: null,
5174
+ error: {
5175
+ code: -32700,
5176
+ message: e instanceof Error ? e.message : "parse error"
5177
+ }
5178
+ }));
5179
+ }
5180
+ })();
5181
+ });
5182
+ });
5183
+ const port = await new Promise((resolve, reject) => {
5184
+ listener.once("error", reject);
5185
+ listener.listen(0, host, () => {
5186
+ const addr = listener.address();
5187
+ resolve(typeof addr === "object" && addr ? addr.port : 0);
5188
+ });
5189
+ });
5190
+ mailbox.setEndpoint(`http://${host}:${port}/mail`);
5191
+ return { close: () => new Promise((resolve) => {
5192
+ listener.close(() => resolve());
5193
+ }) };
5097
5194
  }
5098
5195
  //#endregion
5099
5196
  //#region src/runtime/supervise/driver-retry.ts
@@ -6784,4 +6881,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
6784
6881
  //#endregion
6785
6882
  export { DELEGATION_TRACE_MAX_BYTES as $, DELEGATION_HISTORY_INPUT_SCHEMA as A, defaultToolDetectors as At, DELEGATE_FEEDBACK_INPUT_SCHEMA as B, createMcpServer as C, plateauLength as Ct, createDelegationStatusHandler as D, createCoordinationTools as Dt, DELEGATION_STATUS_TOOL_NAME as E, canonicalFindingEvent as Et, DELEGATE_UI_AUDIT_INPUT_SCHEMA as F, createSupervisorSpanRecorder as Ft, DELEGATE_INPUT_SCHEMA as G, createDelegateFeedbackHandler as H, DELEGATE_UI_AUDIT_TOOL_NAME as I, gateOnDeliverable as It, validateDelegateArgs as J, DELEGATE_TOOL_NAME as K, createDelegateUiAuditHandler as L, mapExecutorResult as Lt, createDelegationHistoryHandler as M, createFileRunContext as Mt, validateDelegationHistoryArgs as N, createInMemoryRunContext as Nt, validateDelegationStatusArgs as O, normalizeAnalyzeOnSettle as Ot, DELEGATE_UI_AUDIT_DESCRIPTION as P, FileCoordinationLog as Pt, hashIdempotencyInput as Q, validateDelegateUiAuditArgs as R, createInProcessTransport as S, bestSoFar as St, DELEGATION_STATUS_INPUT_SCHEMA as T, DEFAULT_AWAIT_EVENT_TIMEOUT_MS as Tt, validateDelegateFeedbackArgs as U, DELEGATE_FEEDBACK_TOOL_NAME as V, DELEGATE_DESCRIPTION as W, delegate as X, defaultDelegateBudget as Y, DelegationTaskQueue as Z, promptHandle as _, noProgressFor as _t, assertCoordinationBinding as a, DelegationPersistenceError as at, classifyDriverFailure as b, anytimeReport as bt, supervisorAgentWithTestBrain as c, InMemoryDelegationStore as ct, delegatesWorkerBriefPrompt as d, driverAgent as dt, DELEGATION_TRACE_MAX_SPANS as et, dumbContinuationFailPrompt as f, finalizeBestDelivered as ft, naiveContinuationPrompt as g, createProgressTracker as gt, kernelPromptRegistry as h, anyOf as ht, workerFromBackend as i, createDelegationTraceCollector as it, DELEGATION_HISTORY_TOOL_NAME as j, watchTrace as jt, DELEGATION_HISTORY_DESCRIPTION as k, createEventBus as kt, analyzesFindingsReportPrompt as l, InMemoryFeedbackStore as lt, formatPromptHandle as m, allWorkersStalled as mt, supervise as n, capDelegationTrace as nt, resolveSupervisorProfile as o, DelegationStateCorruptError as ot, dumbContinuationPassPrompt as p, allOf as pt, createDelegateHandler as q, superviseWithTestBrain as r, composeLoopTraceEmitters as rt, supervisorAgent as s, FileDelegationStore as st, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, buildDelegationTraceSpans as tt, createPromptRegistry as u, eventToSnapshot as ut, supervisorPolicyPrompt as v, plateau as vt, DELEGATION_STATUS_DESCRIPTION as w, renderAnytimeTable as wt, serveCoordinationMcp as x, areaUnderCurve as xt, DriverAttemptsExhaustedError as y, sampleFromSettled as yt, DELEGATE_FEEDBACK_DESCRIPTION as z };
6786
6883
 
6787
- //# sourceMappingURL=supervise-CVP9ku5U.js.map
6884
+ //# sourceMappingURL=supervise-to2ynnCG.js.map