@adhdev/daemon-core 0.9.82-rc.550 → 0.9.82-rc.552
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/boot/daemon-lifecycle.d.ts +8 -0
- package/dist/commands/router.d.ts +10 -0
- package/dist/index.js +23 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/boot/daemon-lifecycle.ts +9 -0
- package/src/commands/med-family/cli-agent.ts +46 -5
- package/src/commands/router.ts +10 -0
|
@@ -64,6 +64,14 @@ export interface DaemonInitConfig {
|
|
|
64
64
|
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
65
65
|
/** Cloud-only: P2P dashboard metadata sync after the core forwarder handles a mesh event. */
|
|
66
66
|
onMeshCoordinatorEventForwarded?: (payload: Record<string, unknown>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Cloud-only: refresh THIS daemon's own coordinator mirror for a self-hosted mesh session
|
|
69
|
+
* (coordinator == this daemon), used by the SELF-DIAL branch of set_conversation_prefs so a
|
|
70
|
+
* locally coordinated session updates its mirror in-process instead of P2P-dialing its own id
|
|
71
|
+
* (refused as SELF_DIAL). Injected by daemon-cloud (updateMeshOwnedSession + dashboard flush);
|
|
72
|
+
* absent on standalone (no coordinator mirror).
|
|
73
|
+
*/
|
|
74
|
+
updateLocalMeshOwnedSession?: (payload: Record<string, unknown>) => void;
|
|
67
75
|
}
|
|
68
76
|
export interface DaemonComponents {
|
|
69
77
|
providerLoader: ProviderLoader;
|
|
@@ -83,6 +83,16 @@ export interface CommandRouterDeps {
|
|
|
83
83
|
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
84
84
|
/** Dispatch a command to a remote mesh node via P2P/relay. Injected by cloud runtime; absent in standalone. */
|
|
85
85
|
dispatchMeshCommand?: (daemonId: string, cmd: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Refresh THIS daemon's own coordinator mirror (adhdev-daemon meshOwnedSessions) for a
|
|
88
|
+
* self-hosted mesh session, applying the same `mesh_forward_event`-shaped payload the remote
|
|
89
|
+
* relay would carry — used by the SELF-DIAL branch of set_conversation_prefs so a locally
|
|
90
|
+
* coordinated session (coordinatorDaemonId == this daemon) updates its mirror directly instead
|
|
91
|
+
* of dispatching a P2P command to its own id (which the mesh manager refuses as SELF_DIAL).
|
|
92
|
+
* Injected by the cloud runtime (calls updateMeshOwnedSession + flushes the dashboard
|
|
93
|
+
* subscription); absent in standalone (no coordinator mirror there).
|
|
94
|
+
*/
|
|
95
|
+
updateLocalMeshOwnedSession?: (payload: Record<string, unknown>) => void;
|
|
86
96
|
}
|
|
87
97
|
export interface CommandRouterResult {
|
|
88
98
|
success: boolean;
|
package/dist/index.js
CHANGED
|
@@ -419,10 +419,10 @@ function readInjected(value) {
|
|
|
419
419
|
}
|
|
420
420
|
function getDaemonBuildInfo() {
|
|
421
421
|
if (cached) return cached;
|
|
422
|
-
const commit = readInjected(true ? "
|
|
423
|
-
const commitShort = readInjected(true ? "
|
|
424
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
425
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
422
|
+
const commit = readInjected(true ? "178a437592e2f9544675a54768b48281804bdddb" : void 0) ?? "unknown";
|
|
423
|
+
const commitShort = readInjected(true ? "178a4375" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
424
|
+
const version = readInjected(true ? "0.9.82-rc.552" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
425
|
+
const builtAt = readInjected(true ? "2026-07-17T04:25:41.391Z" : void 0);
|
|
426
426
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
427
427
|
return cached;
|
|
428
428
|
}
|
|
@@ -52454,6 +52454,20 @@ async function forwardConversationPrefsToCoordinator(ctx, sessionId, patch) {
|
|
|
52454
52454
|
...nodeId ? { nodeId } : {},
|
|
52455
52455
|
sessionSettings: { ...patch }
|
|
52456
52456
|
};
|
|
52457
|
+
const selfDaemonId = readNonEmptyString2(ctx.deps.statusInstanceId);
|
|
52458
|
+
if (selfDaemonId && daemonIdsEquivalent(coordinatorDaemonId, selfDaemonId)) {
|
|
52459
|
+
const refreshLocal = ctx.deps.updateLocalMeshOwnedSession;
|
|
52460
|
+
if (refreshLocal) {
|
|
52461
|
+
try {
|
|
52462
|
+
refreshLocal(payload);
|
|
52463
|
+
return "refreshed-local";
|
|
52464
|
+
} catch (e) {
|
|
52465
|
+
LOG.warn("Mesh", `[Mesh] set_conversation_prefs local coordinator-mirror refresh failed: ${e?.message || e}`);
|
|
52466
|
+
return "failed";
|
|
52467
|
+
}
|
|
52468
|
+
}
|
|
52469
|
+
return "refreshed-local";
|
|
52470
|
+
}
|
|
52457
52471
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
52458
52472
|
try {
|
|
52459
52473
|
await dispatch(coordinatorDaemonId, "mesh_forward_event", payload);
|
|
@@ -52522,10 +52536,12 @@ var cliAgentHandlers = {
|
|
|
52522
52536
|
success: true,
|
|
52523
52537
|
sessionId,
|
|
52524
52538
|
...patch,
|
|
52525
|
-
// Only surface the mirror status for a genuine mesh
|
|
52539
|
+
// Only surface the mirror status for a genuine mesh session (refreshed/failed);
|
|
52526
52540
|
// a non-mesh session ('skipped') carries no mirror field, so nothing changes for it.
|
|
52541
|
+
// A self-hosted session ('refreshed-local' — coordinator == this daemon) refreshed its
|
|
52542
|
+
// own mirror in-process and is reported as fresh so the dashboard never rolls back.
|
|
52527
52543
|
...mirror === "failed" ? { mirrorStale: true } : {},
|
|
52528
|
-
...mirror === "refreshed" ? { mirrorRefreshed: true } : {}
|
|
52544
|
+
...mirror === "refreshed" || mirror === "refreshed-local" ? { mirrorRefreshed: true } : {}
|
|
52529
52545
|
};
|
|
52530
52546
|
},
|
|
52531
52547
|
agent_command: async (ctx, args) => {
|
|
@@ -72603,6 +72619,7 @@ async function initDaemonComponents(config) {
|
|
|
72603
72619
|
statusVersion: config.statusVersion,
|
|
72604
72620
|
getMeshPeerConnectionStatus: config.getMeshPeerConnectionStatus,
|
|
72605
72621
|
dispatchMeshCommand: config.dispatchMeshCommand,
|
|
72622
|
+
updateLocalMeshOwnedSession: config.updateLocalMeshOwnedSession,
|
|
72606
72623
|
getCdpLogFn: config.getCdpLogFn || ((ideType) => LOG.forComponent(`CDP:${ideType}`).asLogFn())
|
|
72607
72624
|
});
|
|
72608
72625
|
poller = new AgentStreamPoller({
|