@tangle-network/agent-runtime 0.206.1 → 0.208.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 (62) hide show
  1. package/dist/{activation-D8FvmCf5.js → activation-9wJniom2.js} +2 -2
  2. package/dist/{activation-D8FvmCf5.js.map → activation-9wJniom2.js.map} +1 -1
  3. package/dist/{activation-3drfS9_j.d.ts → activation-Dan50rKs.d.ts} +2 -2
  4. package/dist/agent.d.ts +1 -1
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-CwT-9dXa.js → coordination-driver-CqZGBqdt.js} +22 -8
  7. package/dist/coordination-driver-CqZGBqdt.js.map +1 -0
  8. package/dist/{delegate-yLW9_OGW.js → delegate-CU7bWMuW.js} +2 -2
  9. package/dist/{delegate-yLW9_OGW.js.map → delegate-CU7bWMuW.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-Dcb2PVEB.js → graph-B0cNCFmD.js} +4 -4
  13. package/dist/{graph-Dcb2PVEB.js.map → graph-B0cNCFmD.js.map} +1 -1
  14. package/dist/{improvement-cycle-ByIC070x.js → improvement-cycle-Bsm8TBDT.js} +3 -3
  15. package/dist/{improvement-cycle-ByIC070x.js.map → improvement-cycle-Bsm8TBDT.js.map} +1 -1
  16. package/dist/{index-B62R6dL9.d.ts → index-CHkf3b2C.d.ts} +4171 -4095
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.js +7 -7
  19. package/dist/intelligence.d.ts +2 -2
  20. package/dist/intelligence.js +3 -3
  21. package/dist/kernel.d.ts +3 -3
  22. package/dist/kernel.js +10 -10
  23. package/dist/{loop-runner-bin-CArH3v2c.d.ts → loop-runner-bin-BUVcdgNU.d.ts} +3 -3
  24. package/dist/{loop-runner-bin-CNNq7tcp.js → loop-runner-bin-CLxG15ta.js} +3 -3
  25. package/dist/{loop-runner-bin-CNNq7tcp.js.map → loop-runner-bin-CLxG15ta.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/platform.d.ts +4 -2
  32. package/dist/platform.js +34 -3
  33. package/dist/platform.js.map +1 -1
  34. package/dist/{provision-supervisor-B8zEk1-7.js → provision-supervisor-CEMk0grI.js} +5 -5
  35. package/dist/{provision-supervisor-B8zEk1-7.js.map → provision-supervisor-CEMk0grI.js.map} +1 -1
  36. package/dist/{redact-CLRRxkXF.js → redact-BMwd8IBm.js} +243 -31
  37. package/dist/redact-BMwd8IBm.js.map +1 -0
  38. package/dist/{run-layout-B8I_LXN-.js → run-layout-hZREkcfu.js} +10 -5
  39. package/dist/run-layout-hZREkcfu.js.map +1 -0
  40. package/dist/{runtime-C-oKXuHJ.js → runtime-ByeeZbA3.js} +264 -13
  41. package/dist/runtime-ByeeZbA3.js.map +1 -0
  42. package/dist/{server-CLtEdwo_.js → server-Bl1F2Y3v.js} +3 -3
  43. package/dist/{server-CLtEdwo_.js.map → server-Bl1F2Y3v.js.map} +1 -1
  44. package/dist/{stream-agent-turn-CpRKkS19.d.ts → stream-agent-turn-B3NfR48z.d.ts} +34 -4
  45. package/dist/{structural-rollout-Bnewh9dN.js → structural-rollout-DsGWoyj4.js} +2 -2
  46. package/dist/{structural-rollout-Bnewh9dN.js.map → structural-rollout-DsGWoyj4.js.map} +1 -1
  47. package/dist/{supervise-BN5VMhRq.js → supervise-D3r_gEyO.js} +24 -22
  48. package/dist/supervise-D3r_gEyO.js.map +1 -0
  49. package/dist/testing.d.ts +2 -2
  50. package/dist/testing.js +12 -12
  51. package/dist/{top-app-KgIFpD9H.js → top-app-CMMd8DgR.js} +6 -2
  52. package/dist/top-app-CMMd8DgR.js.map +1 -0
  53. package/dist/tui/bin.js +1 -1
  54. package/dist/tui/index.d.ts +2 -1
  55. package/dist/tui/index.js +2 -2
  56. package/package.json +1 -1
  57. package/dist/coordination-driver-CwT-9dXa.js.map +0 -1
  58. package/dist/redact-CLRRxkXF.js.map +0 -1
  59. package/dist/run-layout-B8I_LXN-.js.map +0 -1
  60. package/dist/runtime-C-oKXuHJ.js.map +0 -1
  61. package/dist/supervise-BN5VMhRq.js.map +0 -1
  62. package/dist/top-app-KgIFpD9H.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-CLRRxkXF.js";
1
+ import { $ as bridgeAdmissionRefusal, $t as spendFromUsageEvents, A as consumeScopeRetainedOwnerResult, Ar as fullProfileMaterialization, Ct as createInbox, Dr as assertProfileMaterialization, Fn as RunCancellationReason, Lr as renderUnsupported, M as scopeRetainedOwnerContext, Mn as zeroSpend, Mr as promptControlProfileMaterialization, N as scopeRetainedOwnerPriorSpend, Nn as registerRetainedExecutorPreparation, Nr as promptModelProfileMaterialization, Or as controlProfileMaterialization, P as scopeRetainedOwnerResult, Pn as retainedExecutorSeamKey, Q as bindReusableExecutorExecutionId, S as scopeOwnerExecutorNodeContext, Vr as worktreeCliProfileMaterialization, X as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, Xr as inheritRuntimeOwnedExecutorAttestation, Xt as contentAddress, Z as teardownExecutor, Zt as assertValidBudget, _ as deriveNodeExecutionIdentity, _n as resolveAgentEnvironmentProvider, a as createSupervisor, ai as runtimeOwnedExecutorProviderEvidence, ar as generateSpanId, b as recordScopeOwnerMaterialization, ct as snapshotExecutorConfig, d as driverChild, ei as providerAttemptEvidence, et as bridgeModelRouteRefusal, f as driverExecutorFactory, h as beginScopeOwnerAttempt, i as createRootHandle, ii as runtimeOwnedExecutorMaterialization, j as prepareScopeRetainedOwnerTask, jn as unmeteredSpend, jr as profileMaterializationAxes$1, kr as defineProfileMaterializationContract, l as runFinalizer, lr as toOtelAttributes, ni as runtimeOwnedDriveHarnessProviderEvidence, nr as createOtelExporter, nt as bridgeStopSignalKey, o as bestDelivered, oi as runtimeOwnedPendingExecutorMaterialization, ot as createExecutor, p as isDriverSpec, pi as detachedSnapshot, qr as attestRuntimeOwnedScopeOwner, ri as runtimeOwnedExecutorExecutionBinding, rt as captureReusableExecutorConfig, si as runtimeOwnedScopeOwnerRuntime, ti as recordRuntimeOwnedDriveHarnessProviderEvidence, 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, zr as unsupportedProfileDimensions } from "./redact-BMwd8IBm.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 { 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-CwT-9dXa.js";
5
+ import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-hZREkcfu.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-CqZGBqdt.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";
@@ -2942,12 +2942,15 @@ function recordRunCancellationOutcome(runDir, result, now) {
2942
2942
  if (request === void 0) return;
2943
2943
  const record = readRunCancellation(dir, request.operationId);
2944
2944
  if (record !== void 0 && record.effect !== "cancel_requested") return;
2945
- const aborted = result.kind === "no-winner" && result.reason === "aborted";
2945
+ const aborted = result.kind === "no-winner" && result.reason === "cancelled" && result.operationId === request.operationId;
2946
2946
  const observedAt = new Date(now()).toISOString();
2947
2947
  const base = {
2948
2948
  operationId: request.operationId,
2949
2949
  requestedAt: request.at,
2950
2950
  observedAt,
2951
+ ...record?.path === void 0 ? {} : { path: record.path },
2952
+ ...record?.appliedAfterMs === void 0 ? {} : { appliedAfterMs: record.appliedAfterMs },
2953
+ ...record?.deadlineExceeded === void 0 ? {} : { deadlineExceeded: record.deadlineExceeded },
2951
2954
  ...request.reason === void 0 ? {} : { reason: request.reason }
2952
2955
  };
2953
2956
  if (record === void 0) {
@@ -2969,7 +2972,7 @@ function recordRunCancellationOutcome(runDir, result, now) {
2969
2972
  writeRunCancellation(dir, aborted ? {
2970
2973
  ...base,
2971
2974
  effect: "cancelled",
2972
- detail: "the run reached its terminal aborted state"
2975
+ detail: "the run reached its terminal cancelled state"
2973
2976
  } : {
2974
2977
  ...base,
2975
2978
  effect: "not_live",
@@ -3309,7 +3312,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3309
3312
  ...options.runDir === void 0 ? {} : {
3310
3313
  controlDir: resolve(options.runDir),
3311
3314
  controlScope: "subtree",
3312
- abortRun: (reason) => runControl?.abort(reason)
3315
+ abortRun: cancelDurableRun
3313
3316
  }
3314
3317
  }), journal, childExecution.ref, () => acceptedSubmission, recoveryFactories.get(childFactory));
3315
3318
  };
@@ -3342,6 +3345,10 @@ function superviseInternal(profile, task, opts, testBrain) {
3342
3345
  makeWorkerAgent = makeRecursiveWorkerFor(canonicalProfile, rootExecution.identity, 1, rootOwnerId);
3343
3346
  }
3344
3347
  const runControl = options.rootHandle ?? (options.runDir === void 0 ? void 0 : createRootHandle());
3348
+ const durableCancellation = new AbortController();
3349
+ const cancelDurableRun = (reason, request) => {
3350
+ durableCancellation.abort(request === void 0 ? new Error(reason) : new RunCancellationReason(request.source, reason, request.operationId));
3351
+ };
3345
3352
  const workerFactory = makeWorkerAgent;
3346
3353
  const start = async () => {
3347
3354
  const priorCoordination = log ? await log.load(runId, rootOwnerId) : void 0;
@@ -3394,13 +3401,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3394
3401
  ...options.onUnmetContract ? { onUnmetContract: options.onUnmetContract } : {},
3395
3402
  ...options.runDir === void 0 || runControl === void 0 ? {} : {
3396
3403
  controlDir: resolve(options.runDir),
3397
- abortRun: (reason) => {
3398
- try {
3399
- runControl.abort(reason);
3400
- } catch (error) {
3401
- if (!(error instanceof RuntimeRunStateError)) throw error;
3402
- }
3403
- }
3404
+ abortRun: cancelDurableRun
3404
3405
  }
3405
3406
  };
3406
3407
  const agent = testBrain === void 0 ? supervisorAgent(canonicalProfile, agentDeps) : supervisorAgentWithTestBrain(canonicalProfile, {
@@ -3416,13 +3417,13 @@ function superviseInternal(profile, task, opts, testBrain) {
3416
3417
  const hooks = recorder ? composeRuntimeHooks(options.hooks, recorder.hooks) : options.hooks;
3417
3418
  const supervisor = createSupervisor();
3418
3419
  if (runControl !== void 0) supervisor.attach(runControl);
3419
- const cancellation = options.runDir !== void 0 && runControl !== void 0 ? watchRunCancellation(resolve(options.runDir), (reason) => {
3420
- try {
3421
- runControl.abort(reason);
3422
- } catch (error) {
3423
- if (!(error instanceof RuntimeRunStateError)) throw error;
3424
- }
3425
- }) : void 0;
3420
+ const cancellation = options.runDir !== void 0 && runControl !== void 0 ? watchRunCancellation(resolve(options.runDir), cancelDurableRun) : void 0;
3421
+ try {
3422
+ cancellation?.check();
3423
+ } catch (error) {
3424
+ cancellation?.close();
3425
+ throw error;
3426
+ }
3426
3427
  const run = supervisor.run(agent, canonicalTask, {
3427
3428
  budget: options.budget,
3428
3429
  runId,
@@ -3442,7 +3443,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3442
3443
  ...probes ? { probes } : {},
3443
3444
  ...ctx.resume === true ? { resume: true } : {},
3444
3445
  ...options.now ? { now: options.now } : {},
3445
- ...options.signal ? { signal: options.signal } : {},
3446
+ signal: options.signal ? AbortSignal.any([options.signal, durableCancellation.signal]) : durableCancellation.signal,
3446
3447
  ...hooks ? { hooks } : {},
3447
3448
  ...recorder ? { workerTrace: recorder.workerTrace } : {},
3448
3449
  ...recorder && traceUnpropagated ? { workerTraceUnpropagated: traceUnpropagated } : {},
@@ -3454,6 +3455,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3454
3455
  result = await run;
3455
3456
  } finally {
3456
3457
  cancellation?.close();
3458
+ cancellation?.check();
3457
3459
  }
3458
3460
  recordRunCancellationOutcome(options.runDir, result, now);
3459
3461
  const rootProviderModel = ctx.resume === true ? rootProviderModelEvidence([]) : rootProviderModels.length > 0 ? rootProviderModelEvidence(rootProviderModels) : rootDriveHarness === void 0 ? rootProviderModelEvidence([]) : rootProviderModelEvidenceFromExecution(runtimeOwnedDriveHarnessProviderEvidence(rootDriveHarness));
@@ -3495,4 +3497,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
3495
3497
  //#endregion
3496
3498
  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 };
3497
3499
 
3498
- //# sourceMappingURL=supervise-BN5VMhRq.js.map
3500
+ //# sourceMappingURL=supervise-D3r_gEyO.js.map