@tangle-network/agent-runtime 0.203.2 → 0.204.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 (49) hide show
  1. package/dist/{activation-Df4XxGKc.js → activation-C4FzfZdf.js} +2 -2
  2. package/dist/{activation-Df4XxGKc.js.map → activation-C4FzfZdf.js.map} +1 -1
  3. package/dist/agent.d.ts +1 -1
  4. package/dist/agent.js +2 -2
  5. package/dist/{coordination-driver-DXrdrMRp.js → coordination-driver-CeORgR_y.js} +54 -54
  6. package/dist/coordination-driver-CeORgR_y.js.map +1 -0
  7. package/dist/{delegate-BRXVGuRw.js → delegate-Y8HERQ-0.js} +2 -2
  8. package/dist/{delegate-BRXVGuRw.js.map → delegate-Y8HERQ-0.js.map} +1 -1
  9. package/dist/durable.d.ts +1 -1
  10. package/dist/durable.js +26 -3
  11. package/dist/durable.js.map +1 -1
  12. package/dist/{graph-DADb6ITM.js → graph-BeKgH5yz.js} +3 -3
  13. package/dist/{graph-DADb6ITM.js.map → graph-BeKgH5yz.js.map} +1 -1
  14. package/dist/{improvement-cycle-C8giFe0g.js → improvement-cycle-Bgm5fYr0.js} +3 -3
  15. package/dist/{improvement-cycle-C8giFe0g.js.map → improvement-cycle-Bgm5fYr0.js.map} +1 -1
  16. package/dist/{index-prZR0SAw.d.ts → index-JwBrfEmf.d.ts} +7 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.js +3 -3
  20. package/dist/kernel.d.ts +1 -1
  21. package/dist/kernel.js +8 -8
  22. package/dist/{loop-runner-bin-C9v5_OFP.js → loop-runner-bin-DAzvKFYG.js} +3 -3
  23. package/dist/{loop-runner-bin-C9v5_OFP.js.map → loop-runner-bin-DAzvKFYG.js.map} +1 -1
  24. package/dist/{loop-runner-bin-CdLhMvhw.d.ts → loop-runner-bin-DD3mqY76.d.ts} +2 -2
  25. package/dist/loop-runner-bin.d.ts +1 -1
  26. package/dist/loop-runner-bin.js +1 -1
  27. package/dist/mcp/bin.js +3 -3
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp/index.js +4 -4
  30. package/dist/{provision-supervisor-BPPumGwV.js → provision-supervisor-CZ_YEGAm.js} +3 -3
  31. package/dist/{provision-supervisor-BPPumGwV.js.map → provision-supervisor-CZ_YEGAm.js.map} +1 -1
  32. package/dist/{redact-hBRYKHwa.js → redact-73IRu8-T.js} +4 -1
  33. package/dist/{redact-hBRYKHwa.js.map → redact-73IRu8-T.js.map} +1 -1
  34. package/dist/{runtime-DRAhMoBO.js → runtime-pw6TGY_D.js} +8 -8
  35. package/dist/{runtime-DRAhMoBO.js.map → runtime-pw6TGY_D.js.map} +1 -1
  36. package/dist/{server-5fDDTEgZ.js → server-CrU79Grl.js} +3 -3
  37. package/dist/{server-5fDDTEgZ.js.map → server-CrU79Grl.js.map} +1 -1
  38. package/dist/{structural-rollout-BO6sHlE7.js → structural-rollout-Bzkfmwuo.js} +27 -5
  39. package/dist/structural-rollout-Bzkfmwuo.js.map +1 -0
  40. package/dist/{supervise-CcvZjMAP.js → supervise-Cr3ZtFyh.js} +25 -14
  41. package/dist/supervise-Cr3ZtFyh.js.map +1 -0
  42. package/dist/testing.d.ts +1 -1
  43. package/dist/testing.js +12 -12
  44. package/dist/tui/index.d.ts +1 -1
  45. package/dist/tui/index.js +1 -1
  46. package/package.json +4 -4
  47. package/dist/coordination-driver-DXrdrMRp.js.map +0 -1
  48. package/dist/structural-rollout-BO6sHlE7.js.map +0 -1
  49. package/dist/supervise-CcvZjMAP.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { $ as bridgeAdmissionRefusal, $r as providerAttemptEvidence, $t as spendFromUsageEvents, A as consumeScopeRetainedOwnerResult, Ar as profileMaterializationAxes$1, Br as worktreeCliProfileMaterialization, Ct as createInbox, Dr as controlProfileMaterialization, Er as assertProfileMaterialization, Ir as renderUnsupported, Kr as attestRuntimeOwnedScopeOwner, M as scopeRetainedOwnerContext, Mn as zeroSpend, Mr as promptModelProfileMaterialization, N as scopeRetainedOwnerPriorSpend, Nn as registerRetainedExecutorPreparation, Or as defineProfileMaterializationContract, P as scopeRetainedOwnerResult, Pn as retainedExecutorSeamKey, Q as bindReusableExecutorExecutionId, Rr as unsupportedProfileDimensions, S as scopeOwnerExecutorNodeContext, X as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, Xt as contentAddress, Yr as inheritRuntimeOwnedExecutorAttestation, Z as teardownExecutor, Zt as assertValidBudget, _ as deriveNodeExecutionIdentity, _n as resolveAgentEnvironmentProvider, a as createSupervisor, ai as runtimeOwnedPendingExecutorMaterialization, b as recordScopeOwnerMaterialization, cr as toOtelAttributes, ct as snapshotExecutorConfig, d as driverChild, ei as recordRuntimeOwnedDriveHarnessProviderEvidence, et as bridgeModelRouteRefusal, f as driverExecutorFactory, fi as detachedSnapshot, h as beginScopeOwnerAttempt, i as createRootHandle, ii as runtimeOwnedExecutorProviderEvidence, ir as generateSpanId, j as prepareScopeRetainedOwnerTask, jn as unmeteredSpend, jr as promptControlProfileMaterialization, kr as fullProfileMaterialization, l as runFinalizer, ni as runtimeOwnedExecutorExecutionBinding, nt as bridgeStopSignalKey, o as bestDelivered, oi as runtimeOwnedScopeOwnerRuntime, ot as createExecutor, p as isDriverSpec, ri as runtimeOwnedExecutorMaterialization, rt as captureReusableExecutorConfig, ti as runtimeOwnedDriveHarnessProviderEvidence, tr as createOtelExporter, tt as bridgeRuntimeAttachmentsKey, u as runTree, un as routerBrain, ut as WORKER_TRACE_PROPAGATION, v as meterRuntimeOwnedAccounting, x as restoreScopeOwnerAcceptedExecution, y as meterRuntimeOwnedProviderAttempt, yn as addSpend } from "./redact-hBRYKHwa.js";
1
+ import { $ as bridgeAdmissionRefusal, $r as providerAttemptEvidence, $t as spendFromUsageEvents, A as consumeScopeRetainedOwnerResult, Ar as profileMaterializationAxes$1, Br as worktreeCliProfileMaterialization, Ct as createInbox, Dr as controlProfileMaterialization, Er as assertProfileMaterialization, Ir as renderUnsupported, Kr as attestRuntimeOwnedScopeOwner, M as scopeRetainedOwnerContext, Mn as zeroSpend, Mr as promptModelProfileMaterialization, N as scopeRetainedOwnerPriorSpend, Nn as registerRetainedExecutorPreparation, Or as defineProfileMaterializationContract, P as scopeRetainedOwnerResult, Pn as retainedExecutorSeamKey, Q as bindReusableExecutorExecutionId, Rr as unsupportedProfileDimensions, S as scopeOwnerExecutorNodeContext, X as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, Xt as contentAddress, Yr as inheritRuntimeOwnedExecutorAttestation, Z as teardownExecutor, Zt as assertValidBudget, _ as deriveNodeExecutionIdentity, _n as resolveAgentEnvironmentProvider, a as createSupervisor, ai as runtimeOwnedPendingExecutorMaterialization, b as recordScopeOwnerMaterialization, cr as toOtelAttributes, ct as snapshotExecutorConfig, d as driverChild, ei as recordRuntimeOwnedDriveHarnessProviderEvidence, et as bridgeModelRouteRefusal, f as driverExecutorFactory, fi as detachedSnapshot, h as beginScopeOwnerAttempt, i as createRootHandle, ii as runtimeOwnedExecutorProviderEvidence, ir as generateSpanId, j as prepareScopeRetainedOwnerTask, jn as unmeteredSpend, jr as promptControlProfileMaterialization, kr as fullProfileMaterialization, l as runFinalizer, ni as runtimeOwnedExecutorExecutionBinding, nt as bridgeStopSignalKey, o as bestDelivered, oi as runtimeOwnedScopeOwnerRuntime, ot as createExecutor, p as isDriverSpec, ri as runtimeOwnedExecutorMaterialization, rt as captureReusableExecutorConfig, ti as runtimeOwnedDriveHarnessProviderEvidence, tr as createOtelExporter, tt as bridgeRuntimeAttachmentsKey, u as runTree, un as routerBrain, ut as WORKER_TRACE_PROPAGATION, v as meterRuntimeOwnedAccounting, x as restoreScopeOwnerAcceptedExecution, y as meterRuntimeOwnedProviderAttempt, yn as addSpend } from "./redact-73IRu8-T.js";
2
2
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError, r as BackendTransportError, t as AgentEvalError } from "./errors-DodWX-cb.js";
3
3
  import { a as concreteProfileModel, c as profileModelExecutionSettings, d as agentHarness, f as harnessRunsAgent, n as assertModelAllowed, o as enforceTokenLimits, r as assertProfileModelsAllowed, s as profileBridgeWireModel, t as assertExecutableAgentProfile } from "./model-policy-DKDyr-fc.js";
4
4
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
5
- import { C as coordinationVerbNames, M as createFileRunContext, N as createInMemoryRunContext, c as createProgressTracker, d as progressStop, r as driverAgent, v as watchRunCancellation, w as createCoordinationTools } from "./coordination-driver-DXrdrMRp.js";
6
5
  import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-B8I_LXN-.js";
6
+ import { C as createCoordinationTools, F as watchRunCancellation, M as createInMemoryRunContext, P as applyRunCancellation, S as coordinationVerbNames, c as createProgressTracker, d as progressStop, j as createFileRunContext, r as driverAgent } from "./coordination-driver-CeORgR_y.js";
7
7
  import { t as createStdioToolServer } from "./tool-server-BJbCPhoW.js";
8
8
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
9
9
  import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
@@ -1599,14 +1599,12 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1599
1599
  ledger = mcp;
1600
1600
  const coordinationTools = slot.descriptors();
1601
1601
  const providerProfile = detachedSnapshot(providerVisibleProfile(stableProfile), "supervisorAgent provider-visible profile");
1602
- let cancellation;
1603
1602
  try {
1604
1603
  const recoveredSubmission = mcp.submittedResult();
1605
1604
  if (recoveredSubmission) {
1606
1605
  deps.onAcceptedSubmission?.(recoveredSubmission.result);
1607
1606
  return recoveredSubmission.result;
1608
1607
  }
1609
- if (deps.controlDir !== void 0 && deps.abortRun !== void 0 && deps.controlScope !== "subtree") cancellation = watchRunCancellation(deps.controlDir, deps.abortRun);
1610
1608
  const baseTokensLeft = scope.budget.tokensLeft;
1611
1609
  const contractDeclared = deps.deliverable !== void 0;
1612
1610
  const maxReprompts = deps.repromptOnUnmet ?? 0;
@@ -1624,7 +1622,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1624
1622
  };
1625
1623
  await runDriverWithRetry({
1626
1624
  drive: async (attempt, reentry) => {
1627
- cancellation?.check();
1625
+ if (deps.controlDir !== void 0 && deps.abortRun !== void 0) applyRunCancellation(deps.controlDir, deps.abortRun, () => (/* @__PURE__ */ new Date()).toISOString());
1628
1626
  scope.signal.throwIfAborted();
1629
1627
  beginScopeOwnerAttempt(scope, attempt);
1630
1628
  try {
@@ -1657,7 +1655,6 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1657
1655
  } } : {},
1658
1656
  ...deps.onDriverAttempt ? { onAttempt: deps.onDriverAttempt } : {}
1659
1657
  });
1660
- cancellation?.close();
1661
1658
  await mcp.drainResolved();
1662
1659
  const submitted = mcp.submittedResult();
1663
1660
  if (submitted) {
@@ -1671,7 +1668,6 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1671
1668
  budget: scope.budget
1672
1669
  });
1673
1670
  } finally {
1674
- cancellation?.close();
1675
1671
  await mcp.close();
1676
1672
  }
1677
1673
  }
@@ -2933,9 +2929,9 @@ function captureSuperviseOptions(opts) {
2933
2929
  * Record what a run-scoped cancel actually did, at the ONE place that observes the run's terminal
2934
2930
  * state: the `supervise()` settle path.
2935
2931
  *
2936
- * The root manager writes `cancel_requested` when it issues the abort; only here is the run's own
2937
- * outcome known. A run that ends `aborted` after that request reads `cancelled`; a run that
2938
- * reached any other terminal state despite the request terminated nothing and reads `not_live`,
2932
+ * The observer writes `cancel_requested` when it issues the abort; only here is the run's own
2933
+ * outcome known. An aborted run reads `cancelled` only with confirmed teardown, otherwise `unknown`.
2934
+ * A run that reached any other terminal state despite the request terminated nothing and reads `not_live`,
2939
2935
  * never a success. A request the run ended before applying is expired here too, so a reader can
2940
2936
  * tell run-over from in-progress and a stale request cannot outlive its run.
2941
2937
  */
@@ -2962,6 +2958,14 @@ function recordRunCancellationOutcome(runDir, result, now) {
2962
2958
  });
2963
2959
  return;
2964
2960
  }
2961
+ if (aborted && result.teardownUnconfirmed?.length) {
2962
+ writeRunCancellation(dir, {
2963
+ ...base,
2964
+ effect: "unknown",
2965
+ detail: `run aborted but teardown remains unconfirmed for: ${result.teardownUnconfirmed.map((node) => node.id).join(", ")}`
2966
+ });
2967
+ return;
2968
+ }
2965
2969
  writeRunCancellation(dir, aborted ? {
2966
2970
  ...base,
2967
2971
  effect: "cancelled",
@@ -3304,7 +3308,8 @@ function superviseInternal(profile, task, opts, testBrain) {
3304
3308
  ...finalizer ? { finalizer } : {},
3305
3309
  ...options.runDir === void 0 ? {} : {
3306
3310
  controlDir: resolve(options.runDir),
3307
- controlScope: "subtree"
3311
+ controlScope: "subtree",
3312
+ abortRun: (reason) => runControl?.abort(reason)
3308
3313
  }
3309
3314
  }), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory));
3310
3315
  };
@@ -3336,11 +3341,11 @@ function superviseInternal(profile, task, opts, testBrain) {
3336
3341
  };
3337
3342
  makeWorkerAgent = makeRecursiveWorkerFor(canonicalProfile, rootExecution.identity, 1, rootOwnerId);
3338
3343
  }
3344
+ const runControl = options.rootHandle ?? (options.runDir === void 0 ? void 0 : createRootHandle());
3339
3345
  const workerFactory = makeWorkerAgent;
3340
3346
  const start = async () => {
3341
3347
  const priorCoordination = log ? await log.load(runId, rootOwnerId) : void 0;
3342
3348
  const authorizeRootMessage = authorizeDownFor(canonicalProfile, 1);
3343
- const runControl = options.rootHandle ?? (options.runDir === void 0 ? void 0 : createRootHandle());
3344
3349
  const agentDeps = {
3345
3350
  blobs,
3346
3351
  makeWorkerAgent: workerFactory,
@@ -3405,6 +3410,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3405
3410
  const hooks = recorder ? composeRuntimeHooks(options.hooks, recorder.hooks) : options.hooks;
3406
3411
  const supervisor = createSupervisor();
3407
3412
  if (runControl !== void 0) supervisor.attach(runControl);
3413
+ const cancellation = options.runDir !== void 0 && runControl !== void 0 ? watchRunCancellation(resolve(options.runDir), (reason) => runControl.abort(reason)) : void 0;
3408
3414
  const run = supervisor.run(agent, canonicalTask, {
3409
3415
  budget: options.budget,
3410
3416
  runId,
@@ -3431,7 +3437,12 @@ function superviseInternal(profile, task, opts, testBrain) {
3431
3437
  ...options.runDir === void 0 ? {} : { interactiveBindingDir: resolve(options.runDir) }
3432
3438
  });
3433
3439
  const settle = async () => {
3434
- const result = await run;
3440
+ let result;
3441
+ try {
3442
+ result = await run;
3443
+ } finally {
3444
+ cancellation?.close();
3445
+ }
3435
3446
  recordRunCancellationOutcome(options.runDir, result, now);
3436
3447
  const rootProviderModel = ctx.resume === true ? rootProviderModelEvidence([]) : rootProviderModels.length > 0 ? rootProviderModelEvidence(rootProviderModels) : rootDriveHarness === void 0 ? rootProviderModelEvidence([]) : rootProviderModelEvidenceFromExecution(runtimeOwnedDriveHarnessProviderEvidence(rootDriveHarness));
3437
3448
  return {
@@ -3472,4 +3483,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
3472
3483
  //#endregion
3473
3484
  export { serveCoordinationMcp as _, isPreSpawnExecutorFailure as a, mapExecutorResult as b, withWorkerSpawnRetry as c, resolveSupervisorProfile as d, supervisorAgent as f, defaultUnmetContractSteer as g, classifyDriverFailure as h, workerFromBackend as i, assertCoordinationBinding as l, DriverAttemptsExhaustedError as m, supervise as n, resolveWorkerSpawnRetry as o, supervisorAgentWithTestBrain as p, superviseWithTestBrain as r, retryPreSpawnRefusals as s, DEFAULT_AUTHORED_PROFILE_SECURITY_POLICY as t, coordinationProfileToolPrefix as u, createSupervisorSpanRecorder as v, gateOnDeliverable as y };
3474
3485
 
3475
- //# sourceMappingURL=supervise-CcvZjMAP.js.map
3486
+ //# sourceMappingURL=supervise-Cr3ZtFyh.js.map