@adhdev/daemon-standalone 1.0.56-rc.20 → 1.0.56-rc.21

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.
package/dist/index.js CHANGED
@@ -36622,10 +36622,10 @@ var require_dist3 = __commonJS({
36622
36622
  }
36623
36623
  function getDaemonBuildInfo() {
36624
36624
  if (cached2) return cached2;
36625
- const commit = readInjected(true ? "cc85ef744099479d57036518cd809b2c0a2ea5dc" : void 0) ?? "unknown";
36626
- const commitShort = readInjected(true ? "cc85ef74" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36627
- const version2 = readInjected(true ? "1.0.56-rc.20" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36628
- const builtAt = readInjected(true ? "2026-08-21T01:12:48.071Z" : void 0);
36625
+ const commit = readInjected(true ? "0d0957b8df8dfc47e3897cca3a8cadef086df356" : void 0) ?? "unknown";
36626
+ const commitShort = readInjected(true ? "0d0957b8" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
36627
+ const version2 = readInjected(true ? "1.0.56-rc.21" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
36628
+ const builtAt = readInjected(true ? "2026-08-21T06:55:35.436Z" : void 0);
36629
36629
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
36630
36630
  return cached2;
36631
36631
  }
@@ -37920,8 +37920,16 @@ var require_dist3 = __commonJS({
37920
37920
  function resolveConfigDir(env2 = process.env, homeDir) {
37921
37921
  const override = env2.ADHDEV_CONFIG_DIR;
37922
37922
  if (override && override.trim()) return override.trim();
37923
+ assertConfigDirPinnedInTestRuntime(env2);
37923
37924
  return (0, import_path3.join)(homeDir ?? (0, import_os2.homedir)(), getTrackIdentity(resolveBuildTrack(env2)).configDirName);
37924
37925
  }
37926
+ function assertConfigDirPinnedInTestRuntime(env2) {
37927
+ if (env2 !== process.env) return;
37928
+ if (!env2.VITEST && env2.NODE_ENV !== "test") return;
37929
+ throw new Error(
37930
+ "resolveConfigDir() reached the real-home fallback in a test runtime with ADHDEV_CONFIG_DIR unset: a test is about to touch the LIVE ~/.adhdev(-preview) state dir. Pin ADHDEV_CONFIG_DIR to a tmp dir in test setup, or pass an explicit env/homeDir to resolveConfigDir."
37931
+ );
37932
+ }
37925
37933
  function resolveConfigLogsDir(env2 = process.env, homeDir) {
37926
37934
  return (0, import_path3.join)(resolveConfigDir(env2, homeDir), "logs");
37927
37935
  }
@@ -38431,8 +38439,8 @@ var require_dist3 = __commonJS({
38431
38439
  changed: true
38432
38440
  };
38433
38441
  }
38434
- function getConfigDir2() {
38435
- const dir = resolveConfigDir();
38442
+ function getConfigDir2(env2, homeDir) {
38443
+ const dir = resolveConfigDir(env2, homeDir);
38436
38444
  if (!(0, import_fs3.existsSync)(dir)) {
38437
38445
  (0, import_fs3.mkdirSync)(dir, { recursive: true });
38438
38446
  }
@@ -49994,6 +50002,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
49994
50002
  resolveNotBefore: () => resolveNotBefore,
49995
50003
  takeCancelledTaskAssignment: () => takeCancelledTaskAssignment,
49996
50004
  taskDependenciesSatisfied: () => taskDependenciesSatisfied,
50005
+ terminalizeSiblingDispatch: () => terminalizeSiblingDispatch,
49997
50006
  updateDirectDispatchStatus: () => updateDirectDispatchStatus,
49998
50007
  updateSessionTaskStatus: () => updateSessionTaskStatus,
49999
50008
  updateTaskStatus: () => updateTaskStatus,
@@ -50476,6 +50485,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
50476
50485
  delete entry.attemptId;
50477
50486
  MeshRuntimeStore.getInstance().updateQueueEntry(entry);
50478
50487
  endTaskDispatchInFlight(meshId, taskId);
50488
+ terminalizeSiblingDispatch(meshId, taskId, "queue_task_cancelled");
50479
50489
  try {
50480
50490
  proposeTurnCompletion({
50481
50491
  meshId,
@@ -50515,6 +50525,11 @@ The instruction it carried was never delivered to anyone. If it still matters, r
50515
50525
  return { entry, cascaded: [], missionAffected: false };
50516
50526
  }
50517
50527
  endTaskDispatchInFlight(meshId, taskId);
50528
+ terminalizeSiblingDispatch(
50529
+ meshId,
50530
+ taskId,
50531
+ opts?.dispatchFailure && !opts?.force ? "queue_task_dispatch_failed" : "queue_task_requeued"
50532
+ );
50518
50533
  if (opts?.dispatchFailure && !opts?.force) {
50519
50534
  const dispatchFailures = (entry.dispatchFailureCount || 0) + 1;
50520
50535
  if (dispatchFailures > MAX_DISPATCH_FAILURES) {
@@ -50645,6 +50660,7 @@ The instruction it carried was never delivered to anyone. If it still matters, r
50645
50660
  }
50646
50661
  delete entry.attemptId;
50647
50662
  endTaskDispatchInFlight(meshId, taskId);
50663
+ terminalizeSiblingDispatch(meshId, taskId, "queue_task_stranded_reclaimed");
50648
50664
  let cascaded = [];
50649
50665
  if (reclaims > MAX_STRANDED_RECLAIMS) {
50650
50666
  entry.status = "failed";
@@ -50788,6 +50804,33 @@ The instruction it carried was never delivered to anyone. If it still matters, r
50788
50804
  } catch {
50789
50805
  }
50790
50806
  }
50807
+ function terminalizeSiblingDispatch(meshId, taskId, reason) {
50808
+ try {
50809
+ const store = MeshRuntimeStore.getInstance();
50810
+ const sibling = store.getActiveDirectDispatches(meshId).find((d) => d.taskId === taskId);
50811
+ if (!sibling) return;
50812
+ store.updateDirectDispatchStatus(meshId, sibling.sessionId ?? "", "stale", taskId);
50813
+ LOG2.info("MeshQueue", `SIBLING-DISPATCH-ORPHAN: task ${taskId} (mesh ${meshId}) was abandoned (${reason}) while its direct-dispatch row was still '${sibling.status}'; marked that row stale so it stops rendering as active work.`);
50814
+ try {
50815
+ appendLedgerEntry(meshId, {
50816
+ kind: "sibling_dispatch_terminalized",
50817
+ taskId,
50818
+ ...sibling.nodeId ? { nodeId: sibling.nodeId } : {},
50819
+ ...sibling.sessionId ? { sessionId: sibling.sessionId } : {},
50820
+ ...sibling.providerType ? { providerType: sibling.providerType } : {},
50821
+ payload: {
50822
+ taskId,
50823
+ reason,
50824
+ dispatchStatus: sibling.status,
50825
+ ...sibling.sessionId ? { sessionId: sibling.sessionId } : {},
50826
+ ...sibling.nodeId ? { nodeId: sibling.nodeId } : {}
50827
+ }
50828
+ });
50829
+ } catch {
50830
+ }
50831
+ } catch {
50832
+ }
50833
+ }
50791
50834
  function cleanupTerminalDirectDispatches(olderThanMs = 7 * 24 * 60 * 6e4) {
50792
50835
  try {
50793
50836
  MeshRuntimeStore.getInstance().cleanupTerminalDirectDispatches(olderThanMs);
@@ -67137,6 +67180,15 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
67137
67180
  function clearClaimRefusalState(meshId, nodeId, sessionId) {
67138
67181
  lastClaimRefusalLog.delete(claimRefusalKey(meshId, nodeId, sessionId));
67139
67182
  }
67183
+ function logWorktreeBootstrapStaleBypass(meshId, nodeId, sessionId) {
67184
+ const key2 = `${meshId}:${nodeId}:${sessionId}`;
67185
+ if (lastWorktreeBootstrapBypassLog.has(key2)) return;
67186
+ rememberBounded(lastWorktreeBootstrapBypassLog, key2, "bypassed");
67187
+ LOG2.warn("MeshQueue", `Worktree node ${nodeId} (${sessionId}) bootstrap stuck 'running' beyond the stale backstop and its worktree is git-clean \u2014 treating bootstrap as silently complete and allowing the claim (the terminal-state stamp likely never reached this daemon's mesh view)`);
67188
+ }
67189
+ function clearWorktreeBootstrapStaleBypassState(meshId, nodeId, sessionId) {
67190
+ lastWorktreeBootstrapBypassLog.delete(`${meshId}:${nodeId}:${sessionId}`);
67191
+ }
67140
67192
  function logAutoLaunchQuotaFallbackSuccess(resolved, taskId, nodeId, sessionId) {
67141
67193
  if (!resolved.providerType || !resolved.quotaGated?.length) return;
67142
67194
  const detail = resolved.quotaGated.map((item) => quotaClaimBlockDescription(item.providerType, item.block)).join("; ");
@@ -67178,6 +67230,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
67178
67230
  var lastQuotaClaimBlockLog;
67179
67231
  var lastAllQuotaClaimBlockedLog;
67180
67232
  var lastClaimRefusalLog;
67233
+ var lastWorktreeBootstrapBypassLog;
67181
67234
  var lastAutoLaunchLedgerKey;
67182
67235
  var AUTO_LAUNCH_LEDGER_DEDUP_MAX;
67183
67236
  var init_mesh_queue_observability = __esm2({
@@ -67189,6 +67242,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
67189
67242
  lastQuotaClaimBlockLog = /* @__PURE__ */ new Map();
67190
67243
  lastAllQuotaClaimBlockedLog = /* @__PURE__ */ new Map();
67191
67244
  lastClaimRefusalLog = /* @__PURE__ */ new Map();
67245
+ lastWorktreeBootstrapBypassLog = /* @__PURE__ */ new Map();
67192
67246
  lastAutoLaunchLedgerKey = /* @__PURE__ */ new Map();
67193
67247
  AUTO_LAUNCH_LEDGER_DEDUP_MAX = 2e3;
67194
67248
  }
@@ -68563,11 +68617,13 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
68563
68617
  const bootstrapGateNode = inlineBootstrapNode ?? node;
68564
68618
  if (bootstrapGateNode?.worktreeBootstrap?.status === "running") {
68565
68619
  if (!shouldDeferDispatchForBootstrap(bootstrapGateNode)) {
68566
- LOG2.warn("MeshQueue", `Worktree node ${nodeId} (${sessionId}) bootstrap stuck 'running' beyond the stale backstop and its worktree is git-clean \u2014 treating bootstrap as silently complete and allowing the claim (the terminal-state stamp likely never reached this daemon's mesh view)`);
68620
+ logWorktreeBootstrapStaleBypass(meshId, nodeId, sessionId);
68567
68621
  } else {
68568
68622
  LOG2.info("MeshQueue", `Gating queue claim for worktree node ${nodeId} (${sessionId}): worktree bootstrap still running \u2014 task left pending; claim re-fires once bootstrap reaches a terminal state (guards against dispatching into a half-built worktree \u2192 empty session)`);
68569
68623
  return false;
68570
68624
  }
68625
+ } else {
68626
+ clearWorktreeBootstrapStaleBypassState(meshId, nodeId, sessionId);
68571
68627
  }
68572
68628
  const localClaimAdapter = components.cliManager?.adapters?.get(sessionId);
68573
68629
  let claimInstanceWorkspace = "";
@@ -73421,7 +73477,7 @@ ${cleanBody}`;
73421
73477
  if (bootstrapNodeId) {
73422
73478
  try {
73423
73479
  const bootstrapWorkspace = readNonEmptyString(args.metadataEvent.worktreePath) || readNonEmptyString(args.metadataEvent.workspace);
73424
- components.router?.markWorktreeBootstrapTerminalState?.(
73480
+ components.router.markWorktreeBootstrapTerminalState(
73425
73481
  args.meshId,
73426
73482
  bootstrapNodeId,
73427
73483
  args.event === "worktree_bootstrap_failed" ? "failed" : "complete",
@@ -85546,6 +85602,7 @@ ${e?.stderr || ""}`;
85546
85602
  sweepMeshGraphGateTimeouts: () => sweepMeshGraphGateTimeouts,
85547
85603
  taskDependenciesSatisfied: () => taskDependenciesSatisfied,
85548
85604
  taskIsParked: () => taskIsParked,
85605
+ terminalizeSiblingDispatch: () => terminalizeSiblingDispatch,
85549
85606
  tombstoneOperatingNote: () => tombstoneOperatingNote,
85550
85607
  totalTokens: () => totalTokens,
85551
85608
  triggerMeshQueue: () => triggerMeshQueue,
@@ -113022,6 +113079,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
113022
113079
  `\u21B7 Skipping workspace coordinator rebind for ${record2.runtimeKey || record2.runtimeId} (${record2.cliType} @ ${record2.workspace}): ${coordinatorPresentById ? "registered coordinator is restoring under its own id \u2014 this is a delegated worker" : `ambiguous (${siblingCount} sessions share this workspace+cliType)`}`
113023
113080
  );
113024
113081
  }
113082
+ } else if (workspaceCoordinators.length === 0) {
113083
+ LOG2.debug(
113084
+ "CLI",
113085
+ `No registered coordinator for workspace ${record2.workspace} \u2014 workspace rebind fallback empty for ${record2.runtimeKey || record2.runtimeId} (${record2.cliType}); the session stays unmarked`
113086
+ );
113025
113087
  }
113026
113088
  }
113027
113089
  if (coordinatorEntry?.meshId) {