@adhdev/daemon-core 0.9.82-rc.462 → 0.9.82-rc.463
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-aggregate-status.d.ts +24 -0
- package/dist/commands/router-mesh-session-owner.d.ts +59 -0
- package/dist/commands/router.d.ts +7 -47
- package/dist/index.js +281 -215
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +281 -215
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +9 -0
- package/dist/providers/spec/types.d.ts +22 -0
- package/package.json +3 -3
- package/src/commands/router-aggregate-status.ts +209 -0
- package/src/commands/router-mesh-session-owner.ts +114 -0
- package/src/commands/router.ts +27 -255
- package/src/providers/cli-provider-instance.ts +17 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +54 -2
- package/src/providers/spec/native-history-executor.ts +73 -6
- package/src/providers/spec/types.ts +22 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregate mesh-status cache — extracted from router.ts (behavior-preserving code move).
|
|
3
|
+
*
|
|
4
|
+
* These functions were `DaemonCommandRouter` methods; they now take the router
|
|
5
|
+
* instance as `self`. The class keeps thin delegating wrappers
|
|
6
|
+
* (getCachedAggregateMeshStatus / rememberAggregateMeshStatus are bound into
|
|
7
|
+
* HighFamilyContext — intra-cluster calls therefore go through `self.` so instance
|
|
8
|
+
* dispatch is preserved). No log string, error message, refusal condition, or
|
|
9
|
+
* result shape changed — only physical location + `this.` → `self.`.
|
|
10
|
+
*
|
|
11
|
+
* The group is self-contained: it reads only `self.aggregateMeshStatusCache` and
|
|
12
|
+
* imported mesh-node-identity / mesh-work-queue helpers. It does NOT touch the
|
|
13
|
+
* inline-mesh cache cluster, so the move is a pure lift.
|
|
14
|
+
*/
|
|
15
|
+
import type { DaemonCommandRouter } from './router.js';
|
|
16
|
+
export declare function cloneJsonValue<T>(value: T): T;
|
|
17
|
+
export declare function hydrateCachedAggregateMeshStatusFromInline(self: DaemonCommandRouter, snapshot: any, mesh: any, options?: {
|
|
18
|
+
requireDirectPeerTruth?: boolean;
|
|
19
|
+
}): any;
|
|
20
|
+
export declare function getCachedAggregateMeshStatus(self: DaemonCommandRouter, meshId: string, mesh?: any, options?: {
|
|
21
|
+
requireDirectPeerTruth?: boolean;
|
|
22
|
+
allowStalePending?: boolean;
|
|
23
|
+
}): any | null;
|
|
24
|
+
export declare function rememberAggregateMeshStatus(self: DaemonCommandRouter, meshId: string, snapshot: any, refreshReason: string): any;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remote mesh-session owner resolution — extracted from router.ts (behavior-preserving code move).
|
|
3
|
+
*
|
|
4
|
+
* These functions were `DaemonCommandRouter` methods; they now take the router
|
|
5
|
+
* instance as `self`. resolveRemoteMeshSessionOwnerDaemonId stays reachable as a
|
|
6
|
+
* public method (the [Z] session-scoped forward in executeDaemonCommand and the
|
|
7
|
+
* mesh-session-scoped-remote-forward test call it), so the class keeps a thin
|
|
8
|
+
* delegating wrapper. No log string, error message, refusal condition, or result
|
|
9
|
+
* shape changed — only physical location + `this.` → `self.`.
|
|
10
|
+
*
|
|
11
|
+
* The group is read-only: it reads self.deps.statusInstanceId, the cached inline-mesh
|
|
12
|
+
* nodes, and the aggregate-status snapshot nodes. It never mutates router state.
|
|
13
|
+
*/
|
|
14
|
+
import type { DaemonCommandRouter } from './router.js';
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the REMOTE worker daemonId that owns a given session, when the session
|
|
17
|
+
* belongs to a mesh node hosted on a DIFFERENT daemon than this coordinator.
|
|
18
|
+
*
|
|
19
|
+
* The coordinator does not host remote-worker session instances in its own
|
|
20
|
+
* instanceManager/sessionRegistry — only their cached mesh-node metadata. A
|
|
21
|
+
* dashboard-issued session-scoped command (invoke_provider_script / resolve_action /
|
|
22
|
+
* set_mode / …) lands on the coordinator with a targetSessionId the coordinator can't
|
|
23
|
+
* find locally, and without forwarding it dies as "Live session not found". send_chat
|
|
24
|
+
* happens to survive (its target resolves to the worker by another route), but the
|
|
25
|
+
* controlbar commands do not — so the controlbar buttons appear to do nothing.
|
|
26
|
+
*
|
|
27
|
+
* Mirror the existing node-level remote-forward pattern (fast_forward_mesh_node etc.):
|
|
28
|
+
* scan the candidate mesh nodes for the one hosting the targetSessionId, and return its
|
|
29
|
+
* daemonId when that daemonId is a remote daemon (i.e. not this coordinator's own
|
|
30
|
+
* statusInstanceId). Returns undefined for a locally-hosted session (no forward — execute
|
|
31
|
+
* locally as before) or when ownership can't be resolved.
|
|
32
|
+
*
|
|
33
|
+
* The candidate set spans BOTH the cached inline-mesh nodes and the live aggregate
|
|
34
|
+
* mesh-status snapshots. The inline cache reliably carries only each node's single primary
|
|
35
|
+
* session (cachedStatus.activeSession), so a worker hosting more than one session exposes its
|
|
36
|
+
* non-primary sessions only on the aggregate snapshot nodes (status.activeSessions /
|
|
37
|
+
* activeSessionDetails, built from live session records). collectMeshNodeHostedSessionIds does
|
|
38
|
+
* the wider plural-shape scan so a controlbar/modal command targeting a non-primary remote
|
|
39
|
+
* session still resolves its owner — the singular readCachedInlineMeshActiveSessions semantics
|
|
40
|
+
* other consumers depend on stay untouched.
|
|
41
|
+
*
|
|
42
|
+
* CANCEL-STOP-RELAY: the session-id cache scan above only matches when the coordinator's
|
|
43
|
+
* cached status snapshot already lists the worker's session id in a recognized active-sessions
|
|
44
|
+
* shape. A worktree-clone worker session whose id form/timing differs from the cached snapshot
|
|
45
|
+
* (or is simply not yet reflected) misses the scan, so a stop that carries the authoritative
|
|
46
|
+
* owning nodeId (mesh_queue_cancel knows assignedNodeId) used to silently fail to forward.
|
|
47
|
+
* `ownerNodeIdHint` adds a deterministic fallback: when the session-id scan misses, resolve the
|
|
48
|
+
* owner daemonId by matching the node by id (meshNodeIdMatches — same form-tolerant compare the
|
|
49
|
+
* rest of the router uses, no new raw compare). The same self-loopback guard applies to both
|
|
50
|
+
* paths, so a coordinator-hosted node is still never force-forwarded to a remote form of itself.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveRemoteMeshSessionOwnerDaemonId(self: DaemonCommandRouter, sessionId: string, ownerNodeIdHint?: string): string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Candidate nodes for remote-session owner resolution: the cached inline-mesh nodes (which
|
|
55
|
+
* carry each node's primary session) plus the nodes from every cached aggregate mesh-status
|
|
56
|
+
* snapshot (which carry each node's full live session list). getCachedInlineMeshNodes()
|
|
57
|
+
* returns a fresh array, so appending the aggregate nodes never mutates cached state.
|
|
58
|
+
*/
|
|
59
|
+
export declare function collectMeshSessionOwnerCandidateNodes(self: DaemonCommandRouter): any[];
|
|
@@ -113,8 +113,13 @@ export declare class DaemonCommandRouter {
|
|
|
113
113
|
* on disk) clears the tombstone and merges normally, preserving clone
|
|
114
114
|
* worktree visibility and legitimate node re-creation. */
|
|
115
115
|
private removedInlineMeshNodeIds;
|
|
116
|
-
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default.
|
|
117
|
-
|
|
116
|
+
/** Coordinator-owned whole-mesh aggregate status snapshots. Browser callers read this by default.
|
|
117
|
+
* Public (not private) so the extracted ./router-aggregate-status.ts orchestration can reach it via `self`. */
|
|
118
|
+
aggregateMeshStatusCache: Map<string, {
|
|
119
|
+
builtAt: number;
|
|
120
|
+
snapshot: any;
|
|
121
|
+
queueRevision: string;
|
|
122
|
+
}>;
|
|
118
123
|
/** Shared per-peer git_status probe dedup + recently-probed reuse gate.
|
|
119
124
|
* Spans separate mesh_status/get_mesh calls so the dashboard auto-retry
|
|
120
125
|
* loop cannot storm a slow peer with back-to-back refreshUpstream probes. */
|
|
@@ -133,56 +138,11 @@ export declare class DaemonCommandRouter {
|
|
|
133
138
|
/** Terminal async batch Refinery jobs preserve the last batch outcome for late readers. */
|
|
134
139
|
terminalRefineBatchJobs: Map<string, MeshRefineBatchTerminalJob>;
|
|
135
140
|
constructor(deps: CommandRouterDeps);
|
|
136
|
-
private cloneJsonValue;
|
|
137
141
|
private hydrateCachedAggregateMeshStatusFromInline;
|
|
138
142
|
private getCachedAggregateMeshStatus;
|
|
139
143
|
private rememberAggregateMeshStatus;
|
|
140
144
|
getCachedInlineMeshNodes(): any[];
|
|
141
|
-
/**
|
|
142
|
-
* Resolve the REMOTE worker daemonId that owns a given session, when the session
|
|
143
|
-
* belongs to a mesh node hosted on a DIFFERENT daemon than this coordinator.
|
|
144
|
-
*
|
|
145
|
-
* The coordinator does not host remote-worker session instances in its own
|
|
146
|
-
* instanceManager/sessionRegistry — only their cached mesh-node metadata. A
|
|
147
|
-
* dashboard-issued session-scoped command (invoke_provider_script / resolve_action /
|
|
148
|
-
* set_mode / …) lands on the coordinator with a targetSessionId the coordinator can't
|
|
149
|
-
* find locally, and without forwarding it dies as "Live session not found". send_chat
|
|
150
|
-
* happens to survive (its target resolves to the worker by another route), but the
|
|
151
|
-
* controlbar commands do not — so the controlbar buttons appear to do nothing.
|
|
152
|
-
*
|
|
153
|
-
* Mirror the existing node-level remote-forward pattern (fast_forward_mesh_node etc.):
|
|
154
|
-
* scan the candidate mesh nodes for the one hosting the targetSessionId, and return its
|
|
155
|
-
* daemonId when that daemonId is a remote daemon (i.e. not this coordinator's own
|
|
156
|
-
* statusInstanceId). Returns undefined for a locally-hosted session (no forward — execute
|
|
157
|
-
* locally as before) or when ownership can't be resolved.
|
|
158
|
-
*
|
|
159
|
-
* The candidate set spans BOTH the cached inline-mesh nodes and the live aggregate
|
|
160
|
-
* mesh-status snapshots. The inline cache reliably carries only each node's single primary
|
|
161
|
-
* session (cachedStatus.activeSession), so a worker hosting more than one session exposes its
|
|
162
|
-
* non-primary sessions only on the aggregate snapshot nodes (status.activeSessions /
|
|
163
|
-
* activeSessionDetails, built from live session records). collectMeshNodeHostedSessionIds does
|
|
164
|
-
* the wider plural-shape scan so a controlbar/modal command targeting a non-primary remote
|
|
165
|
-
* session still resolves its owner — the singular readCachedInlineMeshActiveSessions semantics
|
|
166
|
-
* other consumers depend on stay untouched.
|
|
167
|
-
*
|
|
168
|
-
* CANCEL-STOP-RELAY: the session-id cache scan above only matches when the coordinator's
|
|
169
|
-
* cached status snapshot already lists the worker's session id in a recognized active-sessions
|
|
170
|
-
* shape. A worktree-clone worker session whose id form/timing differs from the cached snapshot
|
|
171
|
-
* (or is simply not yet reflected) misses the scan, so a stop that carries the authoritative
|
|
172
|
-
* owning nodeId (mesh_queue_cancel knows assignedNodeId) used to silently fail to forward.
|
|
173
|
-
* `ownerNodeIdHint` adds a deterministic fallback: when the session-id scan misses, resolve the
|
|
174
|
-
* owner daemonId by matching the node by id (meshNodeIdMatches — same form-tolerant compare the
|
|
175
|
-
* rest of the router uses, no new raw compare). The same self-loopback guard applies to both
|
|
176
|
-
* paths, so a coordinator-hosted node is still never force-forwarded to a remote form of itself.
|
|
177
|
-
*/
|
|
178
145
|
resolveRemoteMeshSessionOwnerDaemonId(sessionId: string, ownerNodeIdHint?: string): string | undefined;
|
|
179
|
-
/**
|
|
180
|
-
* Candidate nodes for remote-session owner resolution: the cached inline-mesh nodes (which
|
|
181
|
-
* carry each node's primary session) plus the nodes from every cached aggregate mesh-status
|
|
182
|
-
* snapshot (which carry each node's full live session list). getCachedInlineMeshNodes()
|
|
183
|
-
* returns a fresh array, so appending the aggregate nodes never mutates cached state.
|
|
184
|
-
*/
|
|
185
|
-
private collectMeshSessionOwnerCandidateNodes;
|
|
186
146
|
getCachedInlineMesh(meshId: string, inlineMesh?: unknown): any | undefined;
|
|
187
147
|
private warmInlineMeshCache;
|
|
188
148
|
getMeshForCommand(meshId: string, inlineMesh?: unknown, options?: {
|