@tangle-network/agent-runtime 0.246.0 → 0.249.1

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/dist/{activation-Df-ae5Uq.d.ts → activation-CZz7kkgd.d.ts} +2 -2
  2. package/dist/{activation-C6d-NTWk.js → activation-ygjQvYwG.js} +33 -3
  3. package/dist/activation-ygjQvYwG.js.map +1 -0
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +2 -2
  6. package/dist/{coordination-driver-De8pyM57.js → coordination-driver-B61Hh6B1.js} +161 -16
  7. package/dist/coordination-driver-B61Hh6B1.js.map +1 -0
  8. package/dist/{delegate-DE6hNhbD.js → delegate-A6EYmMxy.js} +2 -2
  9. package/dist/{delegate-DE6hNhbD.js.map → delegate-A6EYmMxy.js.map} +1 -1
  10. package/dist/durable.d.ts +2 -2
  11. package/dist/durable.js +2 -2
  12. package/dist/{graph-s57f-VCR.js → graph-CXwmMtTx.js} +3 -3
  13. package/dist/{graph-s57f-VCR.js.map → graph-CXwmMtTx.js.map} +1 -1
  14. package/dist/{improvement-cycle-BE3gIJwL.js → improvement-cycle-B049YmQ8.js} +3 -3
  15. package/dist/{improvement-cycle-BE3gIJwL.js.map → improvement-cycle-B049YmQ8.js.map} +1 -1
  16. package/dist/{index-CAG31NtK.d.ts → index-BV5EmjCL.d.ts} +15 -7
  17. package/dist/index.d.ts +8 -6
  18. package/dist/index.js +30 -47
  19. package/dist/index.js.map +1 -1
  20. package/dist/intelligence.d.ts +22 -13
  21. package/dist/intelligence.js +96 -40
  22. package/dist/intelligence.js.map +1 -1
  23. package/dist/kernel.d.ts +3 -3
  24. package/dist/kernel.js +9 -9
  25. package/dist/{loop-runner-bin-Bp8Mih20.js → loop-runner-bin-C1O16oIq.js} +3 -3
  26. package/dist/{loop-runner-bin-Bp8Mih20.js.map → loop-runner-bin-C1O16oIq.js.map} +1 -1
  27. package/dist/{loop-runner-bin-B_oSVrE7.d.ts → loop-runner-bin-q0akFXYX.d.ts} +3 -3
  28. package/dist/loop-runner-bin.d.ts +1 -1
  29. package/dist/loop-runner-bin.js +1 -1
  30. package/dist/mcp/bin.js +3 -3
  31. package/dist/mcp/index.d.ts +5 -5
  32. package/dist/mcp/index.js +4 -4
  33. package/dist/{openai-tools-B1GMKDjW.d.ts → openai-tools-zrajPyXe.d.ts} +2 -2
  34. package/dist/profiles.d.ts +2 -2
  35. package/dist/{provision-supervisor-D0X9KUv-.js → provision-supervisor-D7gC-Veu.js} +4 -4
  36. package/dist/{provision-supervisor-D0X9KUv-.js.map → provision-supervisor-D7gC-Veu.js.map} +1 -1
  37. package/dist/{run-layout-B8-Gqhpg.js → run-layout-hKAJGF4g.js} +6 -1
  38. package/dist/run-layout-hKAJGF4g.js.map +1 -0
  39. package/dist/{runtime-CHbVv5UI.js → runtime-BVZIbtyL.js} +9 -9
  40. package/dist/{runtime-CHbVv5UI.js.map → runtime-BVZIbtyL.js.map} +1 -1
  41. package/dist/{server-DwsC_FyV.js → server-DHS1Gxt2.js} +3 -3
  42. package/dist/{server-DwsC_FyV.js.map → server-DHS1Gxt2.js.map} +1 -1
  43. package/dist/{stream-agent-turn-DQ-W8mHf.d.ts → stream-agent-turn-D9IbZMys.d.ts} +2 -2
  44. package/dist/{structural-rollout-DasmuuUp.js → structural-rollout-z1A0okaB.js} +2 -2
  45. package/dist/{structural-rollout-DasmuuUp.js.map → structural-rollout-z1A0okaB.js.map} +1 -1
  46. package/dist/{substrate-DJOnuoa_.d.ts → substrate-Ctmos75o.d.ts} +2 -2
  47. package/dist/{supervise-o6CzD2Rt.js → supervise-CnFk7_wb.js} +25 -5
  48. package/dist/supervise-CnFk7_wb.js.map +1 -0
  49. package/dist/{supervisor-tGq-TPIv.js → supervisor-BIBWUFUr.js} +165 -48
  50. package/dist/supervisor-BIBWUFUr.js.map +1 -0
  51. package/dist/testing.d.ts +2 -2
  52. package/dist/testing.js +12 -12
  53. package/dist/{top-app-DL-sjv7K.js → top-app-d-bmwO7O.js} +2 -2
  54. package/dist/{top-app-DL-sjv7K.js.map → top-app-d-bmwO7O.js.map} +1 -1
  55. package/dist/tui/bin.js +1 -1
  56. package/dist/tui/index.d.ts +1 -1
  57. package/dist/tui/index.js +2 -2
  58. package/dist/{types-BoEzH8V6.d.ts → types-BmxS-W-f.d.ts} +44 -20
  59. package/package.json +4 -4
  60. package/dist/activation-C6d-NTWk.js.map +0 -1
  61. package/dist/coordination-driver-De8pyM57.js.map +0 -1
  62. package/dist/run-layout-B8-Gqhpg.js.map +0 -1
  63. package/dist/supervise-o6CzD2Rt.js.map +0 -1
  64. package/dist/supervisor-tGq-TPIv.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Ur as Driver, Vr as AgentRunSpec, hi as Validator, ui as OutputAdapter } from "./types-BoEzH8V6.js";
1
+ import { Ur as Driver, Vr as AgentRunSpec, hi as Validator, ui as OutputAdapter } from "./types-BmxS-W-f.js";
2
2
  import { AgentProfile } from "@tangle-network/agent-interface";
3
3
  //#region src/profiles/coder.d.ts
4
4
  /**
@@ -281,4 +281,4 @@ interface UiFinding {
281
281
  }
282
282
  //#endregion
283
283
  export { CoderTask as _, UiFindingSeverity as a, KnowledgeUpdate as c, ResearchSource as d, ResearchTask as f, researcherProfile as g, multiHarnessResearcherFanout as h, UiFindingScreenshot as i, MultiHarnessResearcherFanoutOptions as l, createResearcherValidator as m, UI_LENSES as n, UiLens as o, ResearcherProfileOptions as p, UiFinding as r, KnowledgeItem as s, UI_FINDING_SEVERITIES as t, ResearchOutput as u, coderTaskToPrompt as v };
284
- //# sourceMappingURL=substrate-DJOnuoa_.d.ts.map
284
+ //# sourceMappingURL=substrate-Ctmos75o.d.ts.map
@@ -1,11 +1,11 @@
1
- import { $i as withBudgetResources, $n as contentAddress, Bn as linkAbort, Br as promptControlProfileMaterialization, C as restoreScopeOwnerAcceptedExecution, Cn as routerBrain, F as prepareScopeRetainedOwnerTask, Fr as assertProfileMaterialization, Ft as newUsageTotals, Gr as renderUnsupported, I as scopeRetainedOwnerContext, Ii as addSpend, In as registerRetainedExecutorPreparation, Ir as controlProfileMaterialization, Ji as unmeteredSpend, L as scopeRetainedOwnerPriorSpend, Ln as retainedExecutorSeamKey, Lr as defineProfileMaterializationContract, Lt as spendFromUsageTotals, M as bindScopeRetainedOwnerEnvironmentId, Mt as assertValidBudget, N as bindScopeRetainedOwnerProvider, P as consumeScopeRetainedOwnerResult, Pt as meterUsageEvent, Qi as resourceTelemetry, Qr as readCommittedJsonLines, R as scopeRetainedOwnerResourceReader, Rn as RunCancellationReason, Rr as fullProfileMaterialization, Rt as WORKER_TRACE_PROPAGATION, S as recordScopeOwnerMaterialization, Vn as runAbortable, Vr as promptModelProfileMaterialization, Wi as sleep, Xi as zeroSpend, Xr as isNoEntError, Yi as withTimeout, Yr as worktreeCliProfileMaterialization, Zi as addResourceSpend, Zr as prepareJsonlAppend, _ as beginScopeOwnerAttempt, aa as teardownExecutor, an as bridgeAdmissionRefusal, b as meterRuntimeOwnedAccounting, ci as providerAttemptEvidence, d as defaultUnmetContractSteer, di as runtimeOwnedExecutorExecutionBinding, dn as bridgeRuntimeAttachmentsKey, f as runDriverWithRetry, fi as runtimeOwnedExecutorMaterialization, fn as bridgeStopSignalKey, fr as generateSpanId, ft as snapshotExecutorConfig, gr as toOtelAttributes, h as isDriverSpec, hi as runtimeOwnedScopeOwnerRuntime, ii as inheritRuntimeOwnedExecutorAttestation, in as executorFailure, jn as resolveAgentEnvironmentProvider, l as HarnessTurnFailedError, li as recordRuntimeOwnedDriveHarnessProviderEvidence, lr as createOtelExporter, m as driverExecutorFactory, mi as runtimeOwnedPendingExecutorMaterialization, n as createSupervisor, o as runFinalizer, on as bridgeModelRouteRefusal, ot as bindReusableExecutorExecutionId, p as driverChild, pi as runtimeOwnedExecutorProviderEvidence, qr as unsupportedProfileDimensions, qt as createInbox, r as bestDelivered, ra as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, s as runTree, st as captureReusableExecutorConfig, t as createRootHandle, ti as attestRuntimeOwnedScopeOwner, tt as errMessage, ui as runtimeOwnedDriveHarnessProviderEvidence, ut as createExecutor, w as scopeOwnerExecutorNodeContext, x as meterRuntimeOwnedProviderAttempt, xi as detachedSnapshot, y as deriveNodeExecutionIdentity, z as scopeRetainedOwnerResult, zr as profileMaterializationAxes$1 } from "./supervisor-tGq-TPIv.js";
1
+ import { $i as withBudgetResources, $n as contentAddress, Bn as linkAbort, Br as promptControlProfileMaterialization, C as restoreScopeOwnerAcceptedExecution, Cn as routerBrain, F as prepareScopeRetainedOwnerTask, Fr as assertProfileMaterialization, Ft as newUsageTotals, Gr as renderUnsupported, I as scopeRetainedOwnerContext, Ii as addSpend, In as registerRetainedExecutorPreparation, Ir as controlProfileMaterialization, Ji as unmeteredSpend, L as scopeRetainedOwnerPriorSpend, Ln as retainedExecutorSeamKey, Lr as defineProfileMaterializationContract, Lt as spendFromUsageTotals, M as bindScopeRetainedOwnerEnvironmentId, Mt as assertValidBudget, N as bindScopeRetainedOwnerProvider, P as consumeScopeRetainedOwnerResult, Pt as meterUsageEvent, Qi as resourceTelemetry, Qr as readCommittedJsonLines, R as scopeRetainedOwnerResourceReader, Rn as RunCancellationReason, Rr as fullProfileMaterialization, Rt as WORKER_TRACE_PROPAGATION, S as recordScopeOwnerMaterialization, Vn as runAbortable, Vr as promptModelProfileMaterialization, Wi as sleep, Xi as zeroSpend, Xr as isNoEntError, Yi as withTimeout, Yr as worktreeCliProfileMaterialization, Zi as addResourceSpend, Zr as prepareJsonlAppend, _ as beginScopeOwnerAttempt, aa as teardownExecutor, an as bridgeAdmissionRefusal, b as meterRuntimeOwnedAccounting, ci as providerAttemptEvidence, d as defaultUnmetContractSteer, di as runtimeOwnedExecutorExecutionBinding, dn as bridgeRuntimeAttachmentsKey, f as runDriverWithRetry, fi as runtimeOwnedExecutorMaterialization, fn as bridgeStopSignalKey, fr as generateSpanId, ft as snapshotExecutorConfig, gr as toOtelAttributes, h as isDriverSpec, hi as runtimeOwnedScopeOwnerRuntime, ii as inheritRuntimeOwnedExecutorAttestation, in as executorFailure, jn as resolveAgentEnvironmentProvider, l as HarnessTurnFailedError, li as recordRuntimeOwnedDriveHarnessProviderEvidence, lr as createOtelExporter, m as driverExecutorFactory, mi as runtimeOwnedPendingExecutorMaterialization, n as createSupervisor, o as runFinalizer, on as bridgeModelRouteRefusal, ot as bindReusableExecutorExecutionId, p as driverChild, pi as runtimeOwnedExecutorProviderEvidence, qr as unsupportedProfileDimensions, qt as createInbox, r as bestDelivered, ra as DEFAULT_SUCCESSFUL_SHUTDOWN_MS, s as runTree, st as captureReusableExecutorConfig, t as createRootHandle, ti as attestRuntimeOwnedScopeOwner, tt as errMessage, ui as runtimeOwnedDriveHarnessProviderEvidence, ut as createExecutor, w as scopeOwnerExecutorNodeContext, x as meterRuntimeOwnedProviderAttempt, xi as detachedSnapshot, y as deriveNodeExecutionIdentity, z as scopeRetainedOwnerResult, zr as profileMaterializationAxes$1 } from "./supervisor-BIBWUFUr.js";
2
2
  import { f as RuntimeRunStateError, i as ConfigError, m as ValidationError } 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-BbSCSak0.js";
4
4
  import { t as composeRuntimeHooks } from "./runtime-hooks-tXpAarhW.js";
5
5
  import { n as assertNoSymlinkDescendant } from "./durable-file-DWQA4ooo.js";
6
6
  import { n as createStdioToolServer, t as PROTOCOL_VERSION } from "./tool-server-x9NEhvHZ.js";
7
- import { D as coordinationVerbNames, S as watchRunCancellation, c as createProgressTracker, d as progressStop, k as createCoordinationToolsForManager, n as createSteerAcknowledger, r as driverAgent, t as createCancelAcknowledger, v as createFileRunContext, w as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, x as applyRunCancellation, y as createInMemoryRunContext } from "./coordination-driver-De8pyM57.js";
8
- import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-B8-Gqhpg.js";
7
+ import { D as coordinationVerbNames, S as watchRunCancellation, c as createProgressTracker, d as progressStop, k as createCoordinationToolsForManager, n as createSteerAcknowledger, r as driverAgent, t as createCancelAcknowledger, v as createFileRunContext, w as DEFAULT_AWAIT_EVENT_TIMEOUT_MS, x as applyRunCancellation, y as createInMemoryRunContext } from "./coordination-driver-B61Hh6B1.js";
8
+ import { k as writeRunCancellation, o as readRunCancelRequest, s as readRunCancellation } from "./run-layout-hKAJGF4g.js";
9
9
  import { agentProfileSchema, canonicalAgentProfileDigest, canonicalCandidateDigest, canonicalCandidateJson, validateAgentProfileSecurity } from "@tangle-network/agent-interface";
10
10
  import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
11
11
  import { closeSync, constants, fsyncSync, openSync, writeSync } from "node:fs";
@@ -1387,7 +1387,11 @@ function observeWorkerControls(options) {
1387
1387
  ownerId: scope.view.root,
1388
1388
  controlScope
1389
1389
  };
1390
- const steers = createSteerAcknowledger(deps);
1390
+ const steers = createSteerAcknowledger({
1391
+ ...deps,
1392
+ deliverRoot: options.deliverRoot,
1393
+ deliverRootReady: options.deliverRootReady
1394
+ });
1391
1395
  const cancellations = createCancelAcknowledger(deps);
1392
1396
  let active = true;
1393
1397
  let timer;
@@ -1714,6 +1718,9 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1714
1718
  const driveHarness = deps.driveHarness;
1715
1719
  if (!driveHarness) throw new ValidationError(`supervisorAgent: profile.harness="${harness}" needs deps.driveHarness (how to run the harness with the coordination MCP mounted)`);
1716
1720
  const deliver = driveHarness.deliver?.bind(driveHarness);
1721
+ const rawDeliverReady = driveHarness.deliverReady;
1722
+ if (rawDeliverReady !== void 0 && typeof rawDeliverReady !== "function") throw new ValidationError("supervisorAgent: driveHarness.deliverReady must be a function when provided");
1723
+ const deliverReady = rawDeliverReady?.bind(driveHarness);
1717
1724
  const externalAgent = {
1718
1725
  name,
1719
1726
  ...deliver ? { deliver(message) {
@@ -1729,6 +1736,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1729
1736
  const nodeObserver = bindSupervisorNodeObserver(context, observeNodeEvent, deps.onEvent);
1730
1737
  const stopController = new AbortController();
1731
1738
  const coordinationLifetime = linkAbort(scope.signal);
1739
+ let harnessInvocationActive = false;
1732
1740
  const tracker = deps.stopRule ? createProgressTracker({ now: Date.now }) : void 0;
1733
1741
  let progressStopReason;
1734
1742
  let ledger;
@@ -1798,6 +1806,10 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1798
1806
  scope,
1799
1807
  signal: coordinationLifetime.signal,
1800
1808
  controlScope: deps.controlScope ?? "run",
1809
+ ...deps.controlScope === "subtree" ? {} : {
1810
+ deliverRoot: (message) => deliver?.(message) ?? false,
1811
+ deliverRootReady: () => deliver === void 0 || harnessInvocationActive && (deliverReady === void 0 || deliverReady())
1812
+ },
1801
1813
  onError: (error) => {
1802
1814
  coordinationLifetime.abort(error);
1803
1815
  stopController.abort(error);
@@ -1837,6 +1849,7 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1837
1849
  if (deps.controlDir !== void 0 && deps.abortRun !== void 0) applyRunCancellation(deps.controlDir, deps.abortRun, () => (/* @__PURE__ */ new Date()).toISOString());
1838
1850
  scope.signal.throwIfAborted();
1839
1851
  beginScopeOwnerAttempt(scope, attempt);
1852
+ harnessInvocationActive = true;
1840
1853
  try {
1841
1854
  await driveHarness({
1842
1855
  profile: providerProfile,
@@ -1851,6 +1864,8 @@ function buildSupervisorAgent(profile, deps, testBrain) {
1851
1864
  });
1852
1865
  } catch (error) {
1853
1866
  if (!mcp.submittedResult() && !mcp.isStopped()) throw error;
1867
+ } finally {
1868
+ harnessInvocationActive = false;
1854
1869
  }
1855
1870
  if (contractDeclared && !mcp.submittedResult()) {
1856
1871
  await mcp.drainResolved();
@@ -2961,6 +2976,7 @@ function driveHarnessFromBackend(backend, executionId, now = Date.now, maxTurns,
2961
2976
  if (!deliver) return false;
2962
2977
  return deliver.call(activeExecutor, message) !== false;
2963
2978
  };
2979
+ drive.deliverReady = () => activeExecutor !== void 0;
2964
2980
  drive.traceSource = () => activeExecutor?.traceSource?.();
2965
2981
  drive.progress = () => activeExecutor?.progress?.();
2966
2982
  return attestRuntimeOwnedScopeOwner(drive, ownerRuntime);
@@ -3438,6 +3454,8 @@ function superviseInternal(profile, task, opts, testBrain) {
3438
3454
  const harness = rawHarness;
3439
3455
  const deliver = harness.deliver;
3440
3456
  if (deliver !== void 0 && typeof deliver !== "function") throw new ValidationError("supervise: driveHarness.deliver must be a function when provided");
3457
+ const deliverReady = harness.deliverReady;
3458
+ if (deliverReady !== void 0 && typeof deliverReady !== "function") throw new ValidationError("supervise: driveHarness.deliverReady must be a function when provided");
3441
3459
  const claim = harnessClaims.get(harness);
3442
3460
  const conflictingOwner = claim ? [...claim.owners].find((claimedOwner) => claimedOwner !== ownerId) : void 0;
3443
3461
  const steerable = typeof deliver === "function";
@@ -3574,6 +3592,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3574
3592
  replaySettlements: true
3575
3593
  } : {},
3576
3594
  ...analysts ? { analysts } : {},
3595
+ ...options.escalateQuestion ? { escalateQuestion: options.escalateQuestion } : {},
3577
3596
  ...options.analyzeOnSettle ? { analyzeOnSettle: options.analyzeOnSettle } : {},
3578
3597
  ...options.watchWorkers ? { watchWorkers: options.watchWorkers } : {},
3579
3598
  ...options.stallAfterMs !== void 0 ? { stallAfterMs: options.stallAfterMs } : {},
@@ -3677,6 +3696,7 @@ function superviseInternal(profile, task, opts, testBrain) {
3677
3696
  ...options.extraTools ? { extraTools: options.extraTools } : {},
3678
3697
  ...options.executeExtraTool ? { executeExtraTool: options.executeExtraTool } : {},
3679
3698
  ...analysts ? { analysts } : {},
3699
+ ...options.escalateQuestion ? { escalateQuestion: options.escalateQuestion } : {},
3680
3700
  ...options.analyzeOnSettle ? { analyzeOnSettle: options.analyzeOnSettle } : {},
3681
3701
  ...options.watchWorkers ? { watchWorkers: options.watchWorkers } : {},
3682
3702
  ...options.stallAfterMs !== void 0 ? { stallAfterMs: options.stallAfterMs } : {},
@@ -3807,4 +3827,4 @@ function rootProviderModelEvidenceFromExecution(evidence) {
3807
3827
  //#endregion
3808
3828
  export { createSupervisorSpanRecorder as _, isPreSpawnExecutorFailure as a, mapExecutorResult as b, withWorkerSpawnRetry as c, resolveSupervisorProfile as d, supervisorAgent as f, readRootStreamReceipt as g, readRootStream as h, workerFromBackend as i, assertCoordinationBinding as l, ROOT_STREAM_FILE 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, serveCoordinationMcp as v, gateOnDeliverable as y };
3809
3829
 
3810
- //# sourceMappingURL=supervise-o6CzD2Rt.js.map
3830
+ //# sourceMappingURL=supervise-CnFk7_wb.js.map