@adhdev/daemon-core 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/commands/router.d.ts +19 -0
- package/dist/index.js +71 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/commands/router.ts +97 -0
package/dist/index.mjs
CHANGED
|
@@ -311,10 +311,10 @@ function readInjected(value) {
|
|
|
311
311
|
}
|
|
312
312
|
function getDaemonBuildInfo() {
|
|
313
313
|
if (cached) return cached;
|
|
314
|
-
const commit = readInjected(true ? "
|
|
315
|
-
const commitShort = readInjected(true ? "
|
|
316
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
317
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
314
|
+
const commit = readInjected(true ? "4208ff17576c4e0d480e0773908bb522545f006f" : void 0) ?? "unknown";
|
|
315
|
+
const commitShort = readInjected(true ? "4208ff17" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
316
|
+
const version = readInjected(true ? "0.9.82-rc.340" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
317
|
+
const builtAt = readInjected(true ? "2026-06-20T14:30:26.030Z" : void 0);
|
|
318
318
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
319
319
|
return cached;
|
|
320
320
|
}
|
|
@@ -44086,6 +44086,16 @@ function readCachedInlineMeshActiveSessionDetails(node) {
|
|
|
44086
44086
|
startedAt: readStringValue(fallbackSession.startedAt, fallbackSession.started_at) ?? null,
|
|
44087
44087
|
lastActivityAt: readStringValue(fallbackSession.lastActivityAt, fallbackSession.last_activity_at) ?? null,
|
|
44088
44088
|
recoveryState: readStringValue(fallbackSession.recoveryState, fallbackSession.recovery_state) ?? null,
|
|
44089
|
+
// [T2] Carry the worker-computed last-message preview through the cached inline-mesh
|
|
44090
|
+
// active-session entry. The worker's get_status_metadata slim now ships these
|
|
44091
|
+
// (mesh-tools.ts), and this is the surface the coordinator's inbox-preview path reads
|
|
44092
|
+
// (buildDaemonMetadataUpdateForSubscription → stampLocalAssistantPreviewOnCachedEntry).
|
|
44093
|
+
// Without carrying them here, the coordinator could only derive the preview from a live
|
|
44094
|
+
// in-process instance it doesn't host for a remote worker, so the inbox stuck on the
|
|
44095
|
+
// dispatched user task. Only present when the worker reported them.
|
|
44096
|
+
...readStringValue(fallbackSession.lastMessagePreview, fallbackSession.last_message_preview) ? { lastMessagePreview: readStringValue(fallbackSession.lastMessagePreview, fallbackSession.last_message_preview) } : {},
|
|
44097
|
+
...readStringValue(fallbackSession.lastMessageRole, fallbackSession.last_message_role) ? { lastMessageRole: readStringValue(fallbackSession.lastMessageRole, fallbackSession.last_message_role) } : {},
|
|
44098
|
+
...readNumberValue(fallbackSession.lastMessageAt, fallbackSession.last_message_at) !== void 0 ? { lastMessageAt: readNumberValue(fallbackSession.lastMessageAt, fallbackSession.last_message_at) } : {},
|
|
44089
44099
|
isCached: true
|
|
44090
44100
|
}];
|
|
44091
44101
|
}
|
|
@@ -45575,6 +45585,13 @@ var CHAT_COMMANDS = [
|
|
|
45575
45585
|
"set_mode",
|
|
45576
45586
|
"change_model"
|
|
45577
45587
|
];
|
|
45588
|
+
var MESH_FORWARDABLE_SESSION_COMMANDS = /* @__PURE__ */ new Set([
|
|
45589
|
+
"invoke_provider_script",
|
|
45590
|
+
"resolve_action",
|
|
45591
|
+
"set_mode",
|
|
45592
|
+
"change_model",
|
|
45593
|
+
"set_thought_level"
|
|
45594
|
+
]);
|
|
45578
45595
|
var READ_DEBUG_ENABLED2 = process.argv.includes("--dev") || process.env.ADHDEV_READ_DEBUG === "1";
|
|
45579
45596
|
function normalizeCommandSource(source) {
|
|
45580
45597
|
switch (source) {
|
|
@@ -45891,6 +45908,38 @@ var DaemonCommandRouter = class {
|
|
|
45891
45908
|
}
|
|
45892
45909
|
return nodes;
|
|
45893
45910
|
}
|
|
45911
|
+
/**
|
|
45912
|
+
* Resolve the REMOTE worker daemonId that owns a given session, when the session
|
|
45913
|
+
* belongs to a mesh node hosted on a DIFFERENT daemon than this coordinator.
|
|
45914
|
+
*
|
|
45915
|
+
* The coordinator does not host remote-worker session instances in its own
|
|
45916
|
+
* instanceManager/sessionRegistry — only their cached mesh-node metadata. A
|
|
45917
|
+
* dashboard-issued session-scoped command (invoke_provider_script / resolve_action /
|
|
45918
|
+
* set_mode / …) lands on the coordinator with a targetSessionId the coordinator can't
|
|
45919
|
+
* find locally, and without forwarding it dies as "Live session not found". send_chat
|
|
45920
|
+
* happens to survive (its target resolves to the worker by another route), but the
|
|
45921
|
+
* controlbar commands do not — so the controlbar buttons appear to do nothing.
|
|
45922
|
+
*
|
|
45923
|
+
* Mirror the existing node-level remote-forward pattern (fast_forward_mesh_node etc.):
|
|
45924
|
+
* scan the cached inline-mesh nodes for the one whose active session matches the
|
|
45925
|
+
* targetSessionId, and return its daemonId when that daemonId is a remote daemon (i.e.
|
|
45926
|
+
* not this coordinator's own statusInstanceId). Returns undefined for a locally-hosted
|
|
45927
|
+
* session (no forward — execute locally as before) or when ownership can't be resolved.
|
|
45928
|
+
*/
|
|
45929
|
+
resolveRemoteMeshSessionOwnerDaemonId(sessionId) {
|
|
45930
|
+
const trimmed = typeof sessionId === "string" ? sessionId.trim() : "";
|
|
45931
|
+
if (!trimmed) return void 0;
|
|
45932
|
+
const selfDaemonId = this.deps.statusInstanceId;
|
|
45933
|
+
for (const node of this.getCachedInlineMeshNodes()) {
|
|
45934
|
+
const nodeSessions = readCachedInlineMeshActiveSessions(node);
|
|
45935
|
+
if (!nodeSessions.includes(trimmed)) continue;
|
|
45936
|
+
const nodeDaemonId = readMeshNodeDaemonId(readObjectRecord(node));
|
|
45937
|
+
if (!nodeDaemonId) return void 0;
|
|
45938
|
+
if (selfDaemonId && nodeDaemonId === selfDaemonId) return void 0;
|
|
45939
|
+
return nodeDaemonId;
|
|
45940
|
+
}
|
|
45941
|
+
return void 0;
|
|
45942
|
+
}
|
|
45894
45943
|
getCachedInlineMesh(meshId, inlineMesh) {
|
|
45895
45944
|
if (inlineMesh && typeof inlineMesh === "object") {
|
|
45896
45945
|
return this.warmInlineMeshCache(meshId, inlineMesh);
|
|
@@ -47836,6 +47885,24 @@ ${hintLines.join("\n")}` : "",
|
|
|
47836
47885
|
* Returns null if not handled at this level → caller delegates to CommandHandler.
|
|
47837
47886
|
*/
|
|
47838
47887
|
async executeDaemonCommand(cmd, args) {
|
|
47888
|
+
if (MESH_FORWARDABLE_SESSION_COMMANDS.has(cmd) && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
|
|
47889
|
+
const targetSessionId = readStringValue(args?.targetSessionId, args?.sessionId, args?.instanceId);
|
|
47890
|
+
if (targetSessionId) {
|
|
47891
|
+
const localInstance = this.deps.instanceManager?.getInstance(targetSessionId);
|
|
47892
|
+
const localRegistry = this.deps.sessionRegistry?.get?.(targetSessionId);
|
|
47893
|
+
if (!localInstance && !localRegistry) {
|
|
47894
|
+
const ownerDaemonId = this.resolveRemoteMeshSessionOwnerDaemonId(targetSessionId);
|
|
47895
|
+
if (ownerDaemonId) {
|
|
47896
|
+
LOG.info("Mesh", `[Mesh] Forwarding session-scoped '${cmd}' for remote worker session ${targetSessionId.split("_")[0]} \u2192 daemon ${ownerDaemonId.slice(0, 12)}`);
|
|
47897
|
+
const forwarded = await this.deps.dispatchMeshCommand(ownerDaemonId, cmd, {
|
|
47898
|
+
...typeof args === "object" && args !== null ? args : {},
|
|
47899
|
+
_meshDirectDispatch: true
|
|
47900
|
+
});
|
|
47901
|
+
return forwarded ?? { success: false, error: "no response from remote worker daemon" };
|
|
47902
|
+
}
|
|
47903
|
+
}
|
|
47904
|
+
}
|
|
47905
|
+
}
|
|
47839
47906
|
switch (cmd) {
|
|
47840
47907
|
// ─── CLI / ACP commands ───
|
|
47841
47908
|
case "mesh_forward_event": {
|