@adhdev/daemon-core 0.9.82-rc.370 → 0.9.82-rc.371

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.
@@ -0,0 +1,2 @@
1
+ import type { MedFamilyHandler } from './types.js';
2
+ export declare const meshRestartHandlers: Record<string, MedFamilyHandler>;
package/dist/index.d.ts CHANGED
@@ -84,7 +84,7 @@ export { DaemonCdpInitializer } from './cdp/initializer.js';
84
84
  export type { CdpInitializerConfig } from './cdp/initializer.js';
85
85
  export { DaemonCommandHandler } from './commands/handler.js';
86
86
  export type { CommandResult, CommandContext } from './commands/handler.js';
87
- export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails, resolveMeshNodeAttribution } from './commands/router.js';
87
+ export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails, resolveMeshNodeAttribution, buildMeshNodeDataFreshness, MESH_NODE_LIVE_TRUTH_MARKER } from './commands/router.js';
88
88
  export type { CommandRouterDeps, CommandRouterResult } from './commands/router.js';
89
89
  export { maybeRunDaemonUpgradeHelperFromEnv, spawnDetachedDaemonUpgradeHelper, resolveCurrentGlobalInstallSurface, buildPinnedGlobalInstallCommand, execNpmCommandSync, getNpmExecOptions, } from './commands/upgrade-helper.js';
90
90
  export type { DaemonUpgradeHelperPayload, CurrentGlobalInstallSurface, PinnedGlobalInstallCommand, NpmExecOptions, } from './commands/upgrade-helper.js';
package/dist/index.js CHANGED
@@ -316,10 +316,10 @@ function readInjected(value) {
316
316
  }
317
317
  function getDaemonBuildInfo() {
318
318
  if (cached) return cached;
319
- const commit = readInjected(true ? "84d52e533859a9dd3c3bc8bc11a2541911f7bd0c" : void 0) ?? "unknown";
320
- const commitShort = readInjected(true ? "84d52e53" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
- const version = readInjected(true ? "0.9.82-rc.370" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
- const builtAt = readInjected(true ? "2026-06-24T10:07:48.772Z" : void 0);
319
+ const commit = readInjected(true ? "0e66043bc2858f114fbdd7b1edeb7774f33bfd2d" : void 0) ?? "unknown";
320
+ const commitShort = readInjected(true ? "0e66043b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
321
+ const version = readInjected(true ? "0.9.82-rc.371" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
322
+ const builtAt = readInjected(true ? "2026-06-24T12:30:13.850Z" : void 0);
323
323
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
324
324
  return cached;
325
325
  }
@@ -20712,6 +20712,7 @@ __export(index_exports, {
20712
20712
  MESH_CONVERGE_FAST_FORWARD_TAG: () => MESH_CONVERGE_FAST_FORWARD_TAG,
20713
20713
  MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
20714
20714
  MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
20715
+ MESH_NODE_LIVE_TRUTH_MARKER: () => MESH_NODE_LIVE_TRUTH_MARKER,
20715
20716
  MESH_REFINE_CONFIG_LOCATIONS: () => MESH_REFINE_CONFIG_LOCATIONS,
20716
20717
  MESH_REFINE_CONFIG_SCHEMA: () => MESH_REFINE_CONFIG_SCHEMA,
20717
20718
  MESH_SCHEDULING_STRATEGIES: () => MESH_SCHEDULING_STRATEGIES,
@@ -20758,6 +20759,7 @@ __export(index_exports, {
20758
20759
  buildMeshLedgerReconciliationEvidence: () => buildMeshLedgerReconciliationEvidence,
20759
20760
  buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
20760
20761
  buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
20762
+ buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
20761
20763
  buildMissionPromptSection: () => buildMissionPromptSection,
20762
20764
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
20763
20765
  buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
@@ -47696,6 +47698,52 @@ var fastForwardHandlers = {
47696
47698
  }
47697
47699
  };
47698
47700
 
47701
+ // src/commands/med-family/mesh-restart.ts
47702
+ init_dist();
47703
+ var RESTART_BLOCKING_STATES = /* @__PURE__ */ new Set(["generating", "waiting_approval", "starting"]);
47704
+ function hasBlockingSessions(ctx) {
47705
+ const states = ctx.deps.instanceManager.collectAllStates();
47706
+ for (const state of states) {
47707
+ if (RESTART_BLOCKING_STATES.has(String(state.status || ""))) return true;
47708
+ const childStates = "extensions" in state && Array.isArray(state.extensions) ? state.extensions : [];
47709
+ for (const child of childStates) {
47710
+ if (RESTART_BLOCKING_STATES.has(String(child?.status || ""))) return true;
47711
+ }
47712
+ }
47713
+ return false;
47714
+ }
47715
+ var meshRestartHandlers = {
47716
+ restart_daemon_node: async (ctx, args) => {
47717
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
47718
+ const nodeId = typeof args?.nodeId === "string" ? args.nodeId.trim() : "";
47719
+ let nodeDaemonId;
47720
+ if (meshId && nodeId) {
47721
+ const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
47722
+ const node = meshRecord?.mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
47723
+ nodeDaemonId = typeof node?.daemonId === "string" ? node.daemonId.trim() : void 0;
47724
+ }
47725
+ const selfDaemonId = ctx.deps.statusInstanceId;
47726
+ const isRemote = nodeDaemonId && selfDaemonId && !daemonIdsEquivalent(nodeDaemonId, selfDaemonId);
47727
+ if (isRemote && ctx.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
47728
+ const forwarded = await ctx.deps.dispatchMeshCommand(nodeDaemonId, "restart_daemon_node", {
47729
+ ...typeof args === "object" && args !== null ? args : {},
47730
+ _meshDirectDispatch: true
47731
+ });
47732
+ return forwarded ?? { success: false, error: "no response from remote node" };
47733
+ }
47734
+ if (hasBlockingSessions(ctx)) {
47735
+ return {
47736
+ success: false,
47737
+ restarted: false,
47738
+ code: "blocking_sessions",
47739
+ reason: "Daemon has an active session (generating / waiting_approval / starting); restart refused to avoid interrupting in-flight work. Retry when the node is idle."
47740
+ };
47741
+ }
47742
+ const result = await daemonLifecycleHandlers.daemon_upgrade({ deps: ctx.deps }, args);
47743
+ return { ...result, restarted: result?.restarting === true };
47744
+ }
47745
+ };
47746
+
47699
47747
  // src/commands/med-family/index.ts
47700
47748
  var medFamilyRegistry = new Map(
47701
47749
  Object.entries({
@@ -47704,7 +47752,8 @@ var medFamilyRegistry = new Map(
47704
47752
  ...meshCrudHandlers,
47705
47753
  ...meshHostPairingHandlers,
47706
47754
  ...meshQueueHandlers,
47707
- ...fastForwardHandlers
47755
+ ...fastForwardHandlers,
47756
+ ...meshRestartHandlers
47708
47757
  })
47709
47758
  );
47710
47759
 
@@ -61910,6 +61959,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
61910
61959
  MESH_CONVERGE_FAST_FORWARD_TAG,
61911
61960
  MESH_CONVERGE_REFINE_TAG,
61912
61961
  MESH_MISSION_STATUSES,
61962
+ MESH_NODE_LIVE_TRUTH_MARKER,
61913
61963
  MESH_REFINE_CONFIG_LOCATIONS,
61914
61964
  MESH_REFINE_CONFIG_SCHEMA,
61915
61965
  MESH_SCHEDULING_STRATEGIES,
@@ -61956,6 +62006,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
61956
62006
  buildMeshLedgerReconciliationEvidence,
61957
62007
  buildMeshLedgerReplicaEvidence,
61958
62008
  buildMeshNodeCapabilityTags,
62009
+ buildMeshNodeDataFreshness,
61959
62010
  buildMissionPromptSection,
61960
62011
  buildP2pRelayFailurePayload,
61961
62012
  buildPinnedGlobalInstallCommand,