@adhdev/daemon-standalone 0.9.82-rc.339 → 0.9.82-rc.340

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
@@ -30036,10 +30036,10 @@ var require_dist3 = __commonJS({
30036
30036
  }
30037
30037
  function getDaemonBuildInfo() {
30038
30038
  if (cached2) return cached2;
30039
- const commit = readInjected(true ? "042075899bbd2feb9c22f9ccd01990408323443d" : void 0) ?? "unknown";
30040
- const commitShort = readInjected(true ? "04207589" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
- const version2 = readInjected(true ? "0.9.82-rc.339" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
- const builtAt = readInjected(true ? "2026-06-20T12:41:45.001Z" : void 0);
30039
+ const commit = readInjected(true ? "4208ff17576c4e0d480e0773908bb522545f006f" : void 0) ?? "unknown";
30040
+ const commitShort = readInjected(true ? "4208ff17" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30041
+ const version2 = readInjected(true ? "0.9.82-rc.340" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30042
+ const builtAt = readInjected(true ? "2026-06-20T14:30:56.278Z" : void 0);
30043
30043
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30044
30044
  return cached2;
30045
30045
  }
@@ -74002,6 +74002,16 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
74002
74002
  startedAt: readStringValue(fallbackSession.startedAt, fallbackSession.started_at) ?? null,
74003
74003
  lastActivityAt: readStringValue(fallbackSession.lastActivityAt, fallbackSession.last_activity_at) ?? null,
74004
74004
  recoveryState: readStringValue(fallbackSession.recoveryState, fallbackSession.recovery_state) ?? null,
74005
+ // [T2] Carry the worker-computed last-message preview through the cached inline-mesh
74006
+ // active-session entry. The worker's get_status_metadata slim now ships these
74007
+ // (mesh-tools.ts), and this is the surface the coordinator's inbox-preview path reads
74008
+ // (buildDaemonMetadataUpdateForSubscription → stampLocalAssistantPreviewOnCachedEntry).
74009
+ // Without carrying them here, the coordinator could only derive the preview from a live
74010
+ // in-process instance it doesn't host for a remote worker, so the inbox stuck on the
74011
+ // dispatched user task. Only present when the worker reported them.
74012
+ ...readStringValue(fallbackSession.lastMessagePreview, fallbackSession.last_message_preview) ? { lastMessagePreview: readStringValue(fallbackSession.lastMessagePreview, fallbackSession.last_message_preview) } : {},
74013
+ ...readStringValue(fallbackSession.lastMessageRole, fallbackSession.last_message_role) ? { lastMessageRole: readStringValue(fallbackSession.lastMessageRole, fallbackSession.last_message_role) } : {},
74014
+ ...readNumberValue(fallbackSession.lastMessageAt, fallbackSession.last_message_at) !== void 0 ? { lastMessageAt: readNumberValue(fallbackSession.lastMessageAt, fallbackSession.last_message_at) } : {},
74005
74015
  isCached: true
74006
74016
  }];
74007
74017
  }
@@ -75491,6 +75501,13 @@ ${mergeTreeErr?.stderr || ""}`;
75491
75501
  "set_mode",
75492
75502
  "change_model"
75493
75503
  ];
75504
+ var MESH_FORWARDABLE_SESSION_COMMANDS = /* @__PURE__ */ new Set([
75505
+ "invoke_provider_script",
75506
+ "resolve_action",
75507
+ "set_mode",
75508
+ "change_model",
75509
+ "set_thought_level"
75510
+ ]);
75494
75511
  var READ_DEBUG_ENABLED2 = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
75495
75512
  function normalizeCommandSource(source) {
75496
75513
  switch (source) {
@@ -75807,6 +75824,38 @@ ${mergeTreeErr?.stderr || ""}`;
75807
75824
  }
75808
75825
  return nodes;
75809
75826
  }
75827
+ /**
75828
+ * Resolve the REMOTE worker daemonId that owns a given session, when the session
75829
+ * belongs to a mesh node hosted on a DIFFERENT daemon than this coordinator.
75830
+ *
75831
+ * The coordinator does not host remote-worker session instances in its own
75832
+ * instanceManager/sessionRegistry — only their cached mesh-node metadata. A
75833
+ * dashboard-issued session-scoped command (invoke_provider_script / resolve_action /
75834
+ * set_mode / …) lands on the coordinator with a targetSessionId the coordinator can't
75835
+ * find locally, and without forwarding it dies as "Live session not found". send_chat
75836
+ * happens to survive (its target resolves to the worker by another route), but the
75837
+ * controlbar commands do not — so the controlbar buttons appear to do nothing.
75838
+ *
75839
+ * Mirror the existing node-level remote-forward pattern (fast_forward_mesh_node etc.):
75840
+ * scan the cached inline-mesh nodes for the one whose active session matches the
75841
+ * targetSessionId, and return its daemonId when that daemonId is a remote daemon (i.e.
75842
+ * not this coordinator's own statusInstanceId). Returns undefined for a locally-hosted
75843
+ * session (no forward — execute locally as before) or when ownership can't be resolved.
75844
+ */
75845
+ resolveRemoteMeshSessionOwnerDaemonId(sessionId) {
75846
+ const trimmed = typeof sessionId === "string" ? sessionId.trim() : "";
75847
+ if (!trimmed) return void 0;
75848
+ const selfDaemonId = this.deps.statusInstanceId;
75849
+ for (const node of this.getCachedInlineMeshNodes()) {
75850
+ const nodeSessions = readCachedInlineMeshActiveSessions(node);
75851
+ if (!nodeSessions.includes(trimmed)) continue;
75852
+ const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
75853
+ if (!nodeDaemonId) return void 0;
75854
+ if (selfDaemonId && nodeDaemonId === selfDaemonId) return void 0;
75855
+ return nodeDaemonId;
75856
+ }
75857
+ return void 0;
75858
+ }
75810
75859
  getCachedInlineMesh(meshId, inlineMesh) {
75811
75860
  if (inlineMesh && typeof inlineMesh === "object") {
75812
75861
  return this.warmInlineMeshCache(meshId, inlineMesh);
@@ -77752,6 +77801,24 @@ ${hintLines.join("\n")}` : "",
77752
77801
  * Returns null if not handled at this level → caller delegates to CommandHandler.
77753
77802
  */
77754
77803
  async executeDaemonCommand(cmd, args) {
77804
+ if (MESH_FORWARDABLE_SESSION_COMMANDS.has(cmd) && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
77805
+ const targetSessionId = readStringValue(args?.targetSessionId, args?.sessionId, args?.instanceId);
77806
+ if (targetSessionId) {
77807
+ const localInstance = this.deps.instanceManager?.getInstance(targetSessionId);
77808
+ const localRegistry = this.deps.sessionRegistry?.get?.(targetSessionId);
77809
+ if (!localInstance && !localRegistry) {
77810
+ const ownerDaemonId = this.resolveRemoteMeshSessionOwnerDaemonId(targetSessionId);
77811
+ if (ownerDaemonId) {
77812
+ LOG2.info("Mesh", `[Mesh] Forwarding session-scoped '${cmd}' for remote worker session ${targetSessionId.split("_")[0]} \u2192 daemon ${ownerDaemonId.slice(0, 12)}`);
77813
+ const forwarded = await this.deps.dispatchMeshCommand(ownerDaemonId, cmd, {
77814
+ ...typeof args === "object" && args !== null ? args : {},
77815
+ _meshDirectDispatch: true
77816
+ });
77817
+ return forwarded ?? { success: false, error: "no response from remote worker daemon" };
77818
+ }
77819
+ }
77820
+ }
77821
+ }
77755
77822
  switch (cmd) {
77756
77823
  // ─── CLI / ACP commands ───
77757
77824
  case "mesh_forward_event": {