@adhdev/daemon-standalone 1.0.8 → 1.0.10-rc.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.
package/dist/index.js CHANGED
@@ -29817,6 +29817,9 @@ var require_dist3 = __commonJS({
29817
29817
  function resolveAutoConvergeCodeChange(policy) {
29818
29818
  return policy?.autoConvergeCodeChange === true;
29819
29819
  }
29820
+ function resolveCoordinatorIdlePushPolicy(meshPolicy) {
29821
+ return meshPolicy?.coordinatorIdlePushPolicy === "auto_silent_on_dispatch" ? "auto_silent_on_dispatch" : "always";
29822
+ }
29820
29823
  function resolveMagiSessionCleanupMode(value) {
29821
29824
  if (value === void 0 || value === null) return DEFAULT_MESH_POLICY.magiSessionCleanup;
29822
29825
  if (typeof value === "boolean") return value ? "stop_and_delete" : "preserve";
@@ -29887,6 +29890,11 @@ var require_dist3 = __commonJS({
29887
29890
  } else {
29888
29891
  delete policy.autoConvergeCodeChange;
29889
29892
  }
29893
+ if (policy.coordinatorIdlePushPolicy === "auto_silent_on_dispatch") {
29894
+ policy.coordinatorIdlePushPolicy = "auto_silent_on_dispatch";
29895
+ } else {
29896
+ delete policy.coordinatorIdlePushPolicy;
29897
+ }
29890
29898
  return policy;
29891
29899
  }
29892
29900
  function resolveDelegatedWorkerAutoApprove(meshPolicy, nodePolicy) {
@@ -29927,6 +29935,7 @@ var require_dist3 = __commonJS({
29927
29935
  var MESH_CONVERGE_REFINE_TAG;
29928
29936
  var MESH_CONVERGE_FAST_FORWARD_TAG;
29929
29937
  var DEFAULT_MESH_POLICY;
29938
+ var SILENT_IDLE_PUSH_TTL_MS;
29930
29939
  var SESSION_CLEANUP_MODES;
29931
29940
  var SPAWNED_SESSION_VISIBILITY_MODES;
29932
29941
  var DIRTY_WORKSPACE_BEHAVIORS;
@@ -29973,8 +29982,14 @@ var require_dist3 = __commonJS({
29973
29982
  maxTaskRetries: 1,
29974
29983
  // Nudge the coordinator when the mesh is fully idle but active missions linger,
29975
29984
  // so a mission is never left drifting in `active` after its work is really done.
29976
- idleActiveMissionReminder: true
29985
+ idleActiveMissionReminder: true,
29986
+ // Conservative default: every coordinator-dispatched worker completion still
29987
+ // notifies the owner. Opt into 'auto_silent_on_dispatch' to one-shot-silence the
29988
+ // routine idle push for a coordinator-driven task (approval/failure notifications
29989
+ // are never affected — see coordinatorIdlePushPolicy).
29990
+ coordinatorIdlePushPolicy: "always"
29977
29991
  };
29992
+ SILENT_IDLE_PUSH_TTL_MS = 10 * 60 * 1e3;
29978
29993
  SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set([
29979
29994
  "preserve",
29980
29995
  "stop",
@@ -30217,10 +30232,10 @@ var require_dist3 = __commonJS({
30217
30232
  }
30218
30233
  function getDaemonBuildInfo() {
30219
30234
  if (cached2) return cached2;
30220
- const commit = readInjected(true ? "d87ed13992cd87934e3ba8347ec5ff70e5f5252c" : void 0) ?? "unknown";
30221
- const commitShort = readInjected(true ? "d87ed13" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30222
- const version2 = readInjected(true ? "1.0.8" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30223
- const builtAt = readInjected(true ? "2026-07-20T06:28:05.139Z" : void 0);
30235
+ const commit = readInjected(true ? "0eb6e094bf393362ce12dee81e2b08683f7b16b0" : void 0) ?? "unknown";
30236
+ const commitShort = readInjected(true ? "0eb6e094" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30237
+ const version2 = readInjected(true ? "1.0.10-rc.1" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30238
+ const builtAt = readInjected(true ? "2026-07-20T10:57:38.565Z" : void 0);
30224
30239
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30225
30240
  return cached2;
30226
30241
  }
@@ -33884,6 +33899,9 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
33884
33899
  }[policy.dirtyWorkspaceBehavior] || "";
33885
33900
  if (dirtyBehavior) rules.push(dirtyBehavior);
33886
33901
  rules.push(`- Maximum **${policy.maxParallelTasks}** tasks running in parallel`);
33902
+ if (policy.coordinatorIdlePushPolicy === "auto_silent_on_dispatch") {
33903
+ rules.push("- Delegated-worker completions are **auto-silenced**: the routine idle/completion push for a task you dispatch is suppressed once (approval-needed, failure, and long-running alerts still notify the owner normally)");
33904
+ }
33887
33905
  return `## Policy
33888
33906
  ${rules.join("\n")}`;
33889
33907
  }
@@ -39349,7 +39367,12 @@ Next step: ${nextStep}`;
39349
39367
  }
39350
39368
  }
39351
39369
  } catch (e) {
39352
- LOG2.warn("MeshEvents", `SQLite pending-event drain failed for mesh ${meshId}; JSONL fallback only: ${e?.message || e}`);
39370
+ if (!loggedSqlitePendingDrainFailure) {
39371
+ loggedSqlitePendingDrainFailure = true;
39372
+ LOG2.warn("MeshEvents", `SQLite pending-event drain failed for mesh ${meshId}; JSONL fallback only (further occurrences at debug): ${e?.message || e}`);
39373
+ } else {
39374
+ LOG2.debug("MeshEvents", `SQLite pending-event drain failed for mesh ${meshId}; JSONL fallback only: ${e?.message || e}`);
39375
+ }
39353
39376
  }
39354
39377
  const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
39355
39378
  for (const path45 of paths) {
@@ -39546,6 +39569,7 @@ Next step: ${nextStep}`;
39546
39569
  var REFINE_TERMINAL_EVENTS;
39547
39570
  var meshV2DrainCounters;
39548
39571
  var warnedV2Violations;
39572
+ var loggedSqlitePendingDrainFailure;
39549
39573
  var TERMINAL_COMPLETION_EVENTS;
39550
39574
  var MAX_PENDING_EVENTS_BYTES;
39551
39575
  var MAX_PENDING_EVENTS_KEEP;
@@ -39591,6 +39615,7 @@ Next step: ${nextStep}`;
39591
39615
  v1UnversionedQuarantined: 0
39592
39616
  };
39593
39617
  warnedV2Violations = /* @__PURE__ */ new Set();
39618
+ loggedSqlitePendingDrainFailure = false;
39594
39619
  TERMINAL_COMPLETION_EVENTS = /* @__PURE__ */ new Set(["agent:generating_completed", "agent:stopped"]);
39595
39620
  MAX_PENDING_EVENTS_BYTES = 100 * 1024;
39596
39621
  MAX_PENDING_EVENTS_KEEP = 50;
@@ -46248,6 +46273,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
46248
46273
  LOG2.info("MeshQueue", `Node ${nodeId} (${sessionId}) pulled task ${task.id}`);
46249
46274
  retractActionableSkipIfPreviouslyNotified(meshId, task.id);
46250
46275
  beginTaskDispatchInFlight(meshId, task.id);
46276
+ const silentIdlePushOnDispatch = resolveCoordinatorIdlePushPolicy(mesh?.policy) === "auto_silent_on_dispatch";
46251
46277
  const remoteDaemonId = readMeshNodeDaemonId(node ?? {});
46252
46278
  if (remoteDaemonId && components.dispatchMeshCommand) {
46253
46279
  const isLocalNode = components.cliManager.adapters.has(sessionId);
@@ -46270,7 +46296,8 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
46270
46296
  // already-in-flight stale inject rejectable on arrival.
46271
46297
  ...typeof task.dispatchNonce === "number" ? { dispatchNonce: task.dispatchNonce } : {},
46272
46298
  ...localDaemonIdForDispatch ? { coordinatorDaemonId: localDaemonIdForDispatch } : {},
46273
- ...sourceCoordinatorSessionId ? { coordinatorSessionId: sourceCoordinatorSessionId } : {}
46299
+ ...sourceCoordinatorSessionId ? { coordinatorSessionId: sourceCoordinatorSessionId } : {},
46300
+ ...silentIdlePushOnDispatch ? { silentIdlePush: true } : {}
46274
46301
  }
46275
46302
  }),
46276
46303
  {
@@ -46330,7 +46357,8 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
46330
46357
  // REDRIVE-DUP: carry the current dispatch nonce (see remote branch above).
46331
46358
  ...typeof task.dispatchNonce === "number" ? { dispatchNonce: task.dispatchNonce } : {},
46332
46359
  ...localCoordinatorDaemonId() ? { coordinatorDaemonId: localCoordinatorDaemonId() } : {},
46333
- ...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { coordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {}
46360
+ ...readNonEmptyString2(task.sourceCoordinatorSessionId) ? { coordinatorSessionId: readNonEmptyString2(task.sourceCoordinatorSessionId) } : {},
46361
+ ...silentIdlePushOnDispatch ? { silentIdlePush: true } : {}
46334
46362
  }
46335
46363
  }),
46336
46364
  {
@@ -49417,8 +49445,18 @@ ${cleanBody}`;
49417
49445
  if (settings.userHidden === false) return false;
49418
49446
  return settings.spawnedSessionVisibility === "hidden" || isCoordinatorSpawnedHiddenWorker(settings);
49419
49447
  }
49420
- function resolveMuted(settings) {
49448
+ function isSilentIdlePushArmActive(settings, status) {
49449
+ if (!settings || settings.silentNextIdlePush !== true) return false;
49450
+ if (status !== "idle") return false;
49451
+ const armedAt = Number(settings.silentNextIdlePushArmedAt);
49452
+ if (!Number.isFinite(armedAt) || armedAt <= 0) {
49453
+ return true;
49454
+ }
49455
+ return Date.now() - armedAt <= SILENT_IDLE_PUSH_TTL_MS;
49456
+ }
49457
+ function resolveMuted(settings, status) {
49421
49458
  if (!settings) return false;
49459
+ if (isSilentIdlePushArmActive(settings, status)) return true;
49422
49460
  if (settings.userMuted === true) return true;
49423
49461
  if (settings.userMuted === false) return false;
49424
49462
  return isCoordinatorSpawnedHiddenWorker(settings);
@@ -49592,6 +49630,7 @@ ${cleanBody}`;
49592
49630
  const effectiveMeshId = meshCoordinatorFor || registryEntry?.meshId;
49593
49631
  const coordinator = effectiveMeshId ? { meshId: effectiveMeshId, role: "coordinator" } : void 0;
49594
49632
  const meshQueueStats = effectiveMeshId ? getMeshQueueStats(effectiveMeshId) : void 0;
49633
+ const resolvedStatus = resolveSessionStatus(activeChat, state.status);
49595
49634
  return {
49596
49635
  id: state.instanceId,
49597
49636
  parentId: null,
@@ -49600,7 +49639,7 @@ ${cleanBody}`;
49600
49639
  providerSessionId: state.providerSessionId,
49601
49640
  kind: "agent",
49602
49641
  transport: "pty",
49603
- status: resolveSessionStatus(activeChat, state.status),
49642
+ status: resolvedStatus,
49604
49643
  title: activeChat?.title || state.name,
49605
49644
  workspace,
49606
49645
  ...git && { git },
@@ -49639,7 +49678,9 @@ ${cleanBody}`;
49639
49678
  // `!== undefined` fields, so an absent field on false never overwrote a prior true —
49640
49679
  // the toggle-off direction silently stuck. See session-entry-merge.ts.
49641
49680
  surfaceHidden: resolveSurfaceHidden(state.settings),
49642
- muted: resolveMuted(state.settings)
49681
+ // status-gated so a one-shot silent-idle arm mutes ONLY the idle/completion
49682
+ // snapshot, never an approval/generating frame in the same turn.
49683
+ muted: resolveMuted(state.settings, resolvedStatus)
49643
49684
  };
49644
49685
  }
49645
49686
  function buildAcpSession(state, options) {
@@ -49656,6 +49697,7 @@ ${cleanBody}`;
49656
49697
  const effectiveMeshId = meshCoordinatorFor || registryEntry?.meshId;
49657
49698
  const coordinator = effectiveMeshId ? { meshId: effectiveMeshId, role: "coordinator" } : void 0;
49658
49699
  const meshQueueStats = effectiveMeshId ? getMeshQueueStats(effectiveMeshId) : void 0;
49700
+ const resolvedStatus = resolveSessionStatus(activeChat, state.status);
49659
49701
  return {
49660
49702
  id: state.instanceId,
49661
49703
  parentId: null,
@@ -49663,7 +49705,7 @@ ${cleanBody}`;
49663
49705
  providerName: state.name,
49664
49706
  kind: "agent",
49665
49707
  transport: "acp",
49666
- status: resolveSessionStatus(activeChat, state.status),
49708
+ status: resolvedStatus,
49667
49709
  title: activeChat?.title || state.name,
49668
49710
  workspace,
49669
49711
  ...git && { git },
@@ -49683,7 +49725,8 @@ ${cleanBody}`;
49683
49725
  // Emit explicitly (including false) so un-hide/un-mute clears a prior true downstream —
49684
49726
  // see buildCliSession above and session-entry-merge.ts.
49685
49727
  surfaceHidden: resolveSurfaceHidden(state.settings),
49686
- muted: resolveMuted(state.settings)
49728
+ // status-gated one-shot silent-idle arm — see buildCliSession above.
49729
+ muted: resolveMuted(state.settings, resolvedStatus)
49687
49730
  };
49688
49731
  }
49689
49732
  function buildSessionEntries(allStates, cdpManagers, options = {}) {
@@ -49724,6 +49767,7 @@ ${cleanBody}`;
49724
49767
  "use strict";
49725
49768
  init_normalize();
49726
49769
  init_mesh_work_queue();
49770
+ init_repo_mesh_types();
49727
49771
  init_coordinator_registry();
49728
49772
  init_provider_patch_state();
49729
49773
  init_summary_metadata();
@@ -52686,19 +52730,19 @@ ${cleanBody}`;
52686
52730
  }
52687
52731
  }
52688
52732
  }
52689
- for (const mesh of listMeshes()) {
52690
- const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
52691
- if (!daemonHostsMesh(mesh, selfIds)) continue;
52692
- if (store) {
52733
+ if (store) {
52734
+ for (const mesh of listMeshes()) {
52735
+ const selfIds = resolveCoordinatorSelfIds(mesh, drainDaemonIds);
52736
+ if (!daemonHostsMesh(mesh, selfIds)) continue;
52693
52737
  try {
52694
52738
  if (store.pendingQueueTaskCount(mesh.id) === 0) continue;
52695
52739
  } catch {
52696
52740
  }
52697
- }
52698
- try {
52699
- await triggerMeshQueue(components, mesh.id);
52700
- } catch (e) {
52701
- LOG2.warn("MeshReconcile", `Pending-claim recovery trigger failed for mesh ${mesh.id}: ${e?.message || e}`);
52741
+ try {
52742
+ await triggerMeshQueue(components, mesh.id);
52743
+ } catch (e) {
52744
+ LOG2.warn("MeshReconcile", `Pending-claim recovery trigger failed for mesh ${mesh.id}: ${e?.message || e}`);
52745
+ }
52702
52746
  }
52703
52747
  }
52704
52748
  for (const mesh of listMeshes()) {
@@ -79480,6 +79524,9 @@ ${body}
79480
79524
  ...opts.evidenceLevel !== void 0 ? { evidenceLevel: opts.evidenceLevel } : {},
79481
79525
  ...opts.completionDiagnostic !== void 0 ? { completionDiagnostic: opts.completionDiagnostic } : {}
79482
79526
  });
79527
+ if (this.settings?.silentNextIdlePush === true) {
79528
+ this.updateSettings({ silentNextIdlePush: void 0, silentNextIdlePushArmedAt: void 0 });
79529
+ }
79483
79530
  }
79484
79531
  /**
79485
79532
  * AUTOAPPROVE-FLAP-INBOX-MISSING sticky-approval overlay. Returns the adapterStatus a
@@ -83001,6 +83048,18 @@ Run 'adhdev doctor' for detailed diagnostics.`
83001
83048
  if (stampResult && stampResult.stamped === false && stampResult.reason === "task_already_stamped_on_live_instance") {
83002
83049
  throw new Error(`Refusing duplicate mesh dispatch: task ${meshContext.taskId} is already being worked by a live session on this daemon`);
83003
83050
  }
83051
+ if (meshContext.silentIdlePush === true) {
83052
+ try {
83053
+ const workerInst = this.deps.getInstanceManager()?.getInstance(targetInstanceId);
83054
+ if (workerInst && typeof workerInst.updateSettings === "function") {
83055
+ workerInst.updateSettings({
83056
+ silentNextIdlePush: true,
83057
+ silentNextIdlePushArmedAt: Date.now()
83058
+ });
83059
+ }
83060
+ } catch {
83061
+ }
83062
+ }
83004
83063
  }
83005
83064
  const input = normalizeInputEnvelope(args?.input ? { input: args.input } : args);
83006
83065
  const provider = this.providerLoader.resolve(agentType) || this.providerLoader.getMeta(agentType);