@tangle-network/agent-runtime 0.134.8 → 0.135.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 (64) hide show
  1. package/README.md +80 -538
  2. package/dist/{activation-CAexDnXt.js → activation-n_QCjFyg.js} +2 -2
  3. package/dist/{activation-CAexDnXt.js.map → activation-n_QCjFyg.js.map} +1 -1
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/analyst-loop.d.ts +1 -1
  7. package/dist/{authoring-DHVHhbJO.js → authoring-Cl5xwuKl.js} +2 -2
  8. package/dist/{authoring-DHVHhbJO.js.map → authoring-Cl5xwuKl.js.map} +1 -1
  9. package/dist/conversation.d.ts +1 -1
  10. package/dist/{environment-provider-BIZMHOQw.d.ts → environment-provider-DA8LqBV-.d.ts} +3 -3
  11. package/dist/environment-provider.d.ts +1 -1
  12. package/dist/{graph-BWsEZmDL.js → graph-DhSpGi_W.js} +2 -2
  13. package/dist/{graph-BWsEZmDL.js.map → graph-DhSpGi_W.js.map} +1 -1
  14. package/dist/{improvement-cycle-DN0QhoCi.js → improvement-cycle-B8KrGlT4.js} +3 -3
  15. package/dist/{improvement-cycle-DN0QhoCi.js.map → improvement-cycle-B8KrGlT4.js.map} +1 -1
  16. package/dist/{index-RYbM0cUo.d.ts → index-CETQJlqT.d.ts} +3 -3
  17. package/dist/{index-CRauzLFH.d.ts → index-DDDihU_f.d.ts} +30 -7
  18. package/dist/{index-DC7CNU9n.d.ts → index-WwBPewCx.d.ts} +4 -4
  19. package/dist/index.d.ts +9 -9
  20. package/dist/index.js +7 -7
  21. package/dist/intelligence.d.ts +5 -5
  22. package/dist/intelligence.js +3 -3
  23. package/dist/kernel.d.ts +7 -7
  24. package/dist/kernel.js +7 -7
  25. package/dist/{knowledge-DDhcxfdu.js → knowledge-_7FWqPwl.js} +3 -3
  26. package/dist/{knowledge-DDhcxfdu.js.map → knowledge-_7FWqPwl.js.map} +1 -1
  27. package/dist/knowledge.d.ts +1 -1
  28. package/dist/knowledge.js +1 -1
  29. package/dist/{loop-runner-bin-Yp4T-tUJ.d.ts → loop-runner-bin-BCVECt46.d.ts} +3 -3
  30. package/dist/{loop-runner-bin-gw418CFH.js → loop-runner-bin-DalzKZGk.js} +3 -3
  31. package/dist/{loop-runner-bin-gw418CFH.js.map → loop-runner-bin-DalzKZGk.js.map} +1 -1
  32. package/dist/loop-runner-bin.d.ts +1 -1
  33. package/dist/loop-runner-bin.js +1 -1
  34. package/dist/mcp/bin.js +3 -3
  35. package/dist/mcp/index.d.ts +5 -5
  36. package/dist/mcp/index.js +4 -4
  37. package/dist/{openai-tools-BulrPqjW.d.ts → openai-tools-DU3TZvFY.d.ts} +2 -2
  38. package/dist/{openai-tools-ne97uXo0.js → openai-tools-o7jw10Fn.js} +2 -2
  39. package/dist/{openai-tools-ne97uXo0.js.map → openai-tools-o7jw10Fn.js.map} +1 -1
  40. package/dist/primeintellect/index.d.ts +1 -1
  41. package/dist/profiles.d.ts +1 -1
  42. package/dist/{redact-Bojh05mQ.d.ts → redact--KfuCwwo.d.ts} +3 -3
  43. package/dist/{runtime-BZsDYscs.js → runtime-CakFDuE-.js} +7 -7
  44. package/dist/runtime-CakFDuE-.js.map +1 -0
  45. package/dist/{runtime-DHrzFy2v.d.ts → runtime-WugWo__W.d.ts} +4 -4
  46. package/dist/{stream-agent-turn-BEv31Log.d.ts → stream-agent-turn-DhPlvHwp.d.ts} +3 -3
  47. package/dist/{structural-rollout-BMnPPcJP.js → structural-rollout-keBf4YEc.js} +2 -2
  48. package/dist/{structural-rollout-BMnPPcJP.js.map → structural-rollout-keBf4YEc.js.map} +1 -1
  49. package/dist/{supervise-B-nTWUCK.js → supervise-CVP9ku5U.js} +36 -4
  50. package/dist/{supervise-B-nTWUCK.js.map → supervise-CVP9ku5U.js.map} +1 -1
  51. package/dist/{supervisor-Dl9Fk7g5.js → supervisor-mZ9Glkz7.js} +18 -3
  52. package/dist/supervisor-mZ9Glkz7.js.map +1 -0
  53. package/dist/testing.d.ts +2 -2
  54. package/dist/testing.js +11 -11
  55. package/dist/{top-app-CH4cUgpo.js → top-app-BMOSKK06.js} +41 -2
  56. package/dist/top-app-BMOSKK06.js.map +1 -0
  57. package/dist/tui/bin.js +1 -1
  58. package/dist/tui/index.js +1 -1
  59. package/dist/{types-DzZCZcwI.d.ts → types-BBwGSiAj.d.ts} +8 -5
  60. package/dist/{types-C7UNjVce.d.ts → types-BCkweg3w.d.ts} +2 -2
  61. package/package.json +2 -2
  62. package/dist/runtime-BZsDYscs.js.map +0 -1
  63. package/dist/supervisor-Dl9Fk7g5.js.map +0 -1
  64. package/dist/top-app-CH4cUgpo.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, Et as toOtelAttributes, Gt as controlProfileMaterialization, I as createExecutor, Jt as profileMaterializationAxes$1, Kt as defineProfileMaterializationContract, L as createExecutorRegistry, M as bindReusableExecutorExecutionId, N as bridgeStopSignalKey, O as teardownExecutor, P as captureReusableExecutorConfig, R as snapshotExecutorConfig, St as generateSpanId, Wt as assertProfileMaterialization, Xt as promptModelProfileMaterialization, Yt as promptControlProfileMaterialization, a as pickBestDelivered, c as driverChild, d as deriveNodeExecutionIdentity, f as meterRuntimeOwnedAccounting, gt as buildLoopSpanNodes, h as scopeOwnerExecutorNodeContext, j as spendFromUsageEvents, k as assertValidBudget, l as withDriverExecutor, m as recordScopeOwnerMaterialization, n as createSupervisor, nn as worktreeCliProfileMaterialization, o as runFinalizer, ot as routerBrain, p as meterRuntimeOwnedProviderAttempt, qt as fullProfileMaterialization, r as bestDelivered, s as runTree, st as runBrainLoop, w as freeSlots, yt as createOtelExporter } from "./supervisor-Dl9Fk7g5.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";
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";
@@ -5814,21 +5814,39 @@ function routerBrainFromProfile(profile, router) {
5814
5814
  * construction, so a caller may hand back something the run only learns later — which is exactly how
5815
5815
  * `supervise()` gives a traced run's workers their trace context without ordering the span recorder
5816
5816
  * ahead of the worker seam.
5817
+ *
5818
+ * Continuity: the `bridge` backend honors `continuity: 'resume'` by session re-attachment. A
5819
+ * bridge session id IS the harness conversation key (cli-bridge maps it to the CLI's own resume —
5820
+ * opencode `-s <id>`, claude `--resume`), so this seam records the session id each supervised
5821
+ * spawn was bound to, keyed by the worker id the Scope assigned, and a resume spawn binds the
5822
+ * prior worker's recorded session id instead of deriving a fresh one. The record is process-local
5823
+ * by construction, which matches the kernel's resume boundary (a prior process's workers are not
5824
+ * resume targets). Every other backend keeps failing loud: their executors have no re-attachable
5825
+ * session, and accepting the spawn would ledger `continuity: 'resume'` over a brand-new session —
5826
+ * a stamp asserting something that never happened.
5817
5827
  */
5818
5828
  function workerFromBackend(backend, deliverable, seams) {
5819
5829
  const capturedBackend = captureReusableExecutorConfig(backend, "workerFromBackend");
5820
5830
  const unscopedNamespace = randomUUID();
5821
5831
  let unscopedOrdinal = 0;
5832
+ const bridgeSessionByWorker = /* @__PURE__ */ new Map();
5822
5833
  return (rawProfile, spawnContext) => {
5823
5834
  const parsed = agentProfileSchema.safeParse(rawProfile);
5824
5835
  if (!parsed.success) throw new ValidationError(`workerFromBackend: invalid AgentProfile: ${parsed.error.message}`);
5825
5836
  const profile = parsed.data;
5826
5837
  assertBackendProfileMaterialization(profile, capturedBackend, "workerFromBackend");
5827
- if (spawnContext?.continuity === "resume") throw new ValidationError("workerFromBackend: this backend seam does not re-attach sessions and cannot honor continuity: 'resume' — provide a makeWorkerAgent that resumes (it receives spawnContext.resume.ofWorker), or use continuity: 'fresh'");
5838
+ const resumeSessionId = bridgeResumeSessionId(capturedBackend, spawnContext, bridgeSessionByWorker);
5828
5839
  const name = profile.name ?? "worker";
5829
5840
  const assignmentId = spawnContext?.assignmentId ?? `unscoped:${unscopedNamespace}:${unscopedOrdinal++}`;
5830
- const baseFactory = createExecutor(bindReusableExecutorExecutionId(capturedBackend, externalExecutionId("supervised-worker", { assignmentId })));
5841
+ const executionScope = spawnContext?.parentNodeId;
5842
+ const boundBackend = bindReusableExecutorExecutionId(capturedBackend, resumeSessionId ?? externalExecutionId("supervised-worker", {
5843
+ assignmentId,
5844
+ ...executionScope === void 0 ? {} : { scope: executionScope }
5845
+ }));
5846
+ const boundSessionId = boundBackend.backend === "bridge" ? boundBackend.sessionId : void 0;
5847
+ const baseFactory = createExecutor(boundBackend);
5831
5848
  const executorFactory = (spec, ctx) => {
5849
+ if (boundSessionId !== void 0 && ctx.node?.nodeId !== void 0) bridgeSessionByWorker.set(ctx.node.nodeId, boundSessionId);
5832
5850
  const extraSeams = seams?.();
5833
5851
  const built = baseFactory(spec, extraSeams === void 0 ? ctx : {
5834
5852
  ...ctx,
@@ -5858,6 +5876,20 @@ function externalExecutionId(kind, identity) {
5858
5876
  }).slice(7)}`;
5859
5877
  }
5860
5878
  /**
5879
+ * The bridge session id a `'resume'` spawn re-attaches, or `undefined` for a fresh spawn.
5880
+ * Every refusal throws BEFORE a worker exists, which is what keeps the kernel's continuity
5881
+ * ledger true: a `'resume'` stamp can only appear over a session that was actually re-attached.
5882
+ */
5883
+ function bridgeResumeSessionId(backend, spawnContext, sessions) {
5884
+ if (spawnContext?.continuity !== "resume") return void 0;
5885
+ if (backend.backend !== "bridge") throw new ValidationError(`workerFromBackend: the '${backend.backend}' backend seam does not re-attach sessions and cannot honor continuity: 'resume' — only the 'bridge' backend resumes here (cli-bridge keys the harness conversation by session id). Provide a makeWorkerAgent that resumes (it receives spawnContext.resume.ofWorker), or use continuity: 'fresh'`);
5886
+ const ofWorker = spawnContext.resume?.ofWorker;
5887
+ if (ofWorker === void 0) throw new ValidationError("workerFromBackend: a 'resume' spawn carries no resume lineage — the kernel stamps spawnContext.resume for ledgered spawns; a direct caller must pass { ofWorker, sequence }");
5888
+ const prior = sessions.get(ofWorker);
5889
+ if (prior === void 0) throw new ValidationError(`workerFromBackend: no recorded bridge session for worker '${ofWorker}' — this seam re-attaches only sessions it bound in this process (the kernel resume boundary). Spawn the node fresh first, or use continuity: 'fresh'`);
5890
+ return prior;
5891
+ }
5892
+ /**
5861
5893
  * The `trace-unpropagated` declaration for a worker backend, or `undefined` when the backend HAS a
5862
5894
  * propagation channel. The census (`WORKER_TRACE_PROPAGATION`) says WHETHER a backend propagates;
5863
5895
  * this maps the non-propagating arms to WHY: `router`/`router-tools`/`provider` have no worker
@@ -6752,4 +6784,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
6752
6784
  //#endregion
6753
6785
  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 };
6754
6786
 
6755
- //# sourceMappingURL=supervise-B-nTWUCK.js.map
6787
+ //# sourceMappingURL=supervise-CVP9ku5U.js.map