@adhdev/daemon-core 0.9.82-rc.4 → 0.9.82-rc.41
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 +2 -0
- package/dist/commands/router.d.ts +11 -0
- package/dist/git/git-commands.d.ts +1 -0
- package/dist/git/git-status.d.ts +5 -0
- package/dist/git/git-types.d.ts +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1363 -311
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1362 -311
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-events.d.ts +17 -5
- package/dist/mesh/mesh-work-queue.d.ts +3 -1
- package/dist/providers/chat-message-normalization.d.ts +1 -0
- package/dist/repo-mesh-types.d.ts +128 -0
- package/package.json +1 -1
- package/src/boot/daemon-lifecycle.ts +3 -0
- package/src/commands/router.ts +1200 -169
- package/src/git/git-commands.ts +3 -3
- package/src/git/git-status.ts +97 -6
- package/src/git/git-summary.ts +3 -0
- package/src/git/git-types.ts +11 -0
- package/src/index.ts +9 -1
- package/src/mesh/mesh-events.ts +168 -30
- package/src/mesh/mesh-work-queue.ts +135 -119
- package/src/providers/chat-message-normalization.ts +3 -1
- package/src/repo-mesh-types.ts +138 -0
|
@@ -3,15 +3,18 @@ export interface PendingMeshCoordinatorEvent {
|
|
|
3
3
|
event: string;
|
|
4
4
|
meshId: string;
|
|
5
5
|
nodeLabel: string;
|
|
6
|
+
nodeId?: string;
|
|
7
|
+
workspace?: string;
|
|
6
8
|
metadataEvent: Record<string, unknown>;
|
|
7
9
|
queuedAt: number;
|
|
8
10
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
12
|
+
/** Drain and return all pending coordinator events for meshId, removing them from disk. */
|
|
13
|
+
export declare function drainPendingMeshCoordinatorEvents(meshId?: string): PendingMeshCoordinatorEvent[];
|
|
11
14
|
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
12
|
-
export declare function getPendingMeshCoordinatorEvents(): readonly PendingMeshCoordinatorEvent[];
|
|
13
|
-
/** Explicitly clear all pending coordinator events. */
|
|
14
|
-
export declare function clearPendingMeshCoordinatorEvents(): void;
|
|
15
|
+
export declare function getPendingMeshCoordinatorEvents(meshId?: string): readonly PendingMeshCoordinatorEvent[];
|
|
16
|
+
/** Explicitly clear all pending coordinator events for a mesh. */
|
|
17
|
+
export declare function clearPendingMeshCoordinatorEvents(meshId?: string): void;
|
|
15
18
|
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
16
19
|
/**
|
|
17
20
|
* Triggers a queue check for all nodes in the mesh.
|
|
@@ -23,12 +26,21 @@ export declare function handleMeshForwardEvent(components: DaemonComponents, pay
|
|
|
23
26
|
forwarded: number;
|
|
24
27
|
suppressed: boolean;
|
|
25
28
|
intentionalCleanupStop: boolean;
|
|
29
|
+
duplicateCompletion?: undefined;
|
|
30
|
+
error?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
success: boolean;
|
|
33
|
+
forwarded: number;
|
|
34
|
+
suppressed: boolean;
|
|
35
|
+
duplicateCompletion: boolean;
|
|
36
|
+
intentionalCleanupStop?: undefined;
|
|
26
37
|
error?: undefined;
|
|
27
38
|
} | {
|
|
28
39
|
success: boolean;
|
|
29
40
|
forwarded: number;
|
|
30
41
|
suppressed?: undefined;
|
|
31
42
|
intentionalCleanupStop?: undefined;
|
|
43
|
+
duplicateCompletion?: undefined;
|
|
32
44
|
error?: undefined;
|
|
33
45
|
} | {
|
|
34
46
|
success: boolean;
|
|
@@ -80,7 +80,9 @@ export declare function requeueTask(meshId: string, taskId: string, opts?: {
|
|
|
80
80
|
/**
|
|
81
81
|
* Update the status of the task currently assigned to a specific session.
|
|
82
82
|
*/
|
|
83
|
-
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus
|
|
83
|
+
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus, opts?: {
|
|
84
|
+
occurredAt?: string;
|
|
85
|
+
}): MeshWorkQueueEntry | null;
|
|
84
86
|
export interface MeshWorkQueueStats {
|
|
85
87
|
total: number;
|
|
86
88
|
active: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChatMessage } from '../types.js';
|
|
2
|
+
export declare const DEFAULT_FINAL_SUMMARY_MAX_CHARS = 4000;
|
|
2
3
|
export declare function extractFinalSummaryFromMessages(messages: ChatMessage[] | null | undefined, maxChars?: number): string;
|
|
3
4
|
export declare const BUILTIN_CHAT_MESSAGE_KINDS: readonly ["standard", "thought", "tool", "terminal", "system"];
|
|
4
5
|
export type BuiltinChatMessageKind = typeof BUILTIN_CHAT_MESSAGE_KINDS[number];
|
|
@@ -211,16 +211,144 @@ export interface RepoMeshStatus {
|
|
|
211
211
|
meshId: string;
|
|
212
212
|
meshName: string;
|
|
213
213
|
repoIdentity: string;
|
|
214
|
+
defaultBranch?: string;
|
|
214
215
|
refreshedAt: string;
|
|
215
216
|
nodes: RepoMeshNodeStatus[];
|
|
217
|
+
queue?: RepoMeshQueueStatus;
|
|
218
|
+
ledger?: RepoMeshLedgerStatus;
|
|
219
|
+
}
|
|
220
|
+
export interface RepoMeshSessionStatus {
|
|
221
|
+
sessionId: string;
|
|
222
|
+
providerType?: string;
|
|
223
|
+
state?: string;
|
|
224
|
+
lifecycle?: 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'interrupted';
|
|
225
|
+
surfaceKind?: 'live_runtime' | 'recovery_snapshot' | 'inactive_record';
|
|
226
|
+
recoveryState?: string | null;
|
|
227
|
+
workspace?: string | null;
|
|
228
|
+
title?: string | null;
|
|
229
|
+
lastActivityAt?: string | null;
|
|
230
|
+
isCached?: boolean;
|
|
231
|
+
}
|
|
232
|
+
export type RepoMeshPeerConnectionState = 'self' | 'connected' | 'connecting' | 'disconnected' | 'failed' | 'closed' | 'unknown';
|
|
233
|
+
export type RepoMeshPeerConnectionTransport = 'local' | 'direct' | 'relay' | 'unknown';
|
|
234
|
+
export interface RepoMeshPeerConnectionStatus {
|
|
235
|
+
perspective: 'selected_coordinator';
|
|
236
|
+
source: 'mesh_peer_status' | 'not_reported';
|
|
237
|
+
state: RepoMeshPeerConnectionState;
|
|
238
|
+
transport: RepoMeshPeerConnectionTransport;
|
|
239
|
+
reported: boolean;
|
|
240
|
+
reason?: string;
|
|
241
|
+
lastStateChangeAt?: string;
|
|
242
|
+
lastConnectedAt?: string;
|
|
243
|
+
lastCommandAt?: string;
|
|
216
244
|
}
|
|
217
245
|
export interface RepoMeshNodeStatus {
|
|
218
246
|
nodeId: string;
|
|
219
247
|
machineLabel: string;
|
|
220
248
|
workspace: string;
|
|
249
|
+
repoRoot?: string;
|
|
250
|
+
daemonId?: string;
|
|
251
|
+
machineId?: string;
|
|
252
|
+
machineStatus?: string;
|
|
253
|
+
isLocalWorktree?: boolean;
|
|
254
|
+
worktreeBranch?: string;
|
|
221
255
|
health: RepoMeshNodeHealth;
|
|
222
256
|
git?: GitRepoStatus;
|
|
257
|
+
/**
|
|
258
|
+
* True when the selected coordinator has evidence that a peer git probe is still
|
|
259
|
+
* in flight or just timed out during initial mesh handshake, so callers should
|
|
260
|
+
* treat missing git data as pending instead of authoritative absence.
|
|
261
|
+
*/
|
|
262
|
+
gitProbePending?: boolean;
|
|
223
263
|
providers: string[];
|
|
224
264
|
activeSessions: string[];
|
|
265
|
+
activeSessionDetails?: RepoMeshSessionStatus[];
|
|
266
|
+
providerPriority?: string[];
|
|
267
|
+
launchReady?: boolean;
|
|
268
|
+
lastSeenAt?: string;
|
|
269
|
+
updatedAt?: string;
|
|
270
|
+
connection?: RepoMeshPeerConnectionStatus;
|
|
225
271
|
error?: string;
|
|
226
272
|
}
|
|
273
|
+
export type RepoMeshQueueTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
274
|
+
export interface RepoMeshQueueTask {
|
|
275
|
+
id: string;
|
|
276
|
+
meshId: string;
|
|
277
|
+
message: string;
|
|
278
|
+
status: RepoMeshQueueTaskStatus;
|
|
279
|
+
targetNodeId?: string;
|
|
280
|
+
targetSessionId?: string;
|
|
281
|
+
assignedNodeId?: string;
|
|
282
|
+
assignedSessionId?: string;
|
|
283
|
+
cancelReason?: string;
|
|
284
|
+
cancelledAt?: string;
|
|
285
|
+
requeueReason?: string;
|
|
286
|
+
requeuedAt?: string;
|
|
287
|
+
requeueCount?: number;
|
|
288
|
+
autoLaunch?: {
|
|
289
|
+
status: 'skipped' | 'started' | 'failed' | 'completed';
|
|
290
|
+
reason?: string;
|
|
291
|
+
nodeId?: string;
|
|
292
|
+
providerType?: string;
|
|
293
|
+
sessionId?: string;
|
|
294
|
+
updatedAt: string;
|
|
295
|
+
};
|
|
296
|
+
dispatchTimestamp?: string;
|
|
297
|
+
createdAt: string;
|
|
298
|
+
updatedAt: string;
|
|
299
|
+
}
|
|
300
|
+
export interface RepoMeshQueueSummary {
|
|
301
|
+
total: number;
|
|
302
|
+
active: number;
|
|
303
|
+
historical: number;
|
|
304
|
+
pending: number;
|
|
305
|
+
assigned: number;
|
|
306
|
+
completed: number;
|
|
307
|
+
failed: number;
|
|
308
|
+
cancelled: number;
|
|
309
|
+
activeCounts: {
|
|
310
|
+
pending: number;
|
|
311
|
+
assigned: number;
|
|
312
|
+
};
|
|
313
|
+
historicalCounts: {
|
|
314
|
+
completed: number;
|
|
315
|
+
failed: number;
|
|
316
|
+
cancelled: number;
|
|
317
|
+
};
|
|
318
|
+
activeAssignments: Array<{
|
|
319
|
+
id: string;
|
|
320
|
+
nodeId?: string;
|
|
321
|
+
sessionId?: string;
|
|
322
|
+
message: string;
|
|
323
|
+
}>;
|
|
324
|
+
}
|
|
325
|
+
export interface RepoMeshQueueStatus {
|
|
326
|
+
tasks: RepoMeshQueueTask[];
|
|
327
|
+
summary: RepoMeshQueueSummary;
|
|
328
|
+
}
|
|
329
|
+
export interface RepoMeshLedgerEntryStatus {
|
|
330
|
+
id: string;
|
|
331
|
+
meshId: string;
|
|
332
|
+
timestamp: string;
|
|
333
|
+
kind: string;
|
|
334
|
+
nodeId?: string;
|
|
335
|
+
sessionId?: string;
|
|
336
|
+
providerType?: string;
|
|
337
|
+
payload: Record<string, unknown>;
|
|
338
|
+
}
|
|
339
|
+
export interface RepoMeshLedgerSummaryStatus {
|
|
340
|
+
meshId: string;
|
|
341
|
+
totalEntries: number;
|
|
342
|
+
taskDispatched: number;
|
|
343
|
+
taskCompleted: number;
|
|
344
|
+
taskFailed: number;
|
|
345
|
+
taskStalled: number;
|
|
346
|
+
sessionLaunched: number;
|
|
347
|
+
checkpointCreated: number;
|
|
348
|
+
lastActivityAt: string | null;
|
|
349
|
+
recentFailures: number;
|
|
350
|
+
}
|
|
351
|
+
export interface RepoMeshLedgerStatus {
|
|
352
|
+
entries: RepoMeshLedgerEntryStatus[];
|
|
353
|
+
summary: RepoMeshLedgerSummaryStatus;
|
|
354
|
+
}
|
package/package.json
CHANGED
|
@@ -86,6 +86,8 @@ export interface DaemonInitConfig {
|
|
|
86
86
|
|
|
87
87
|
/** Relays a command to a remote mesh node daemon */
|
|
88
88
|
dispatchMeshCommand?: (daemonId: string, command: string, args: Record<string, unknown>) => Promise<any>;
|
|
89
|
+
/** Returns selected-coordinator mesh peer telemetry for a target daemon when available. */
|
|
90
|
+
getMeshPeerConnectionStatus?: (daemonId: string) => Record<string, unknown> | null;
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
// ─── Result ───
|
|
@@ -306,6 +308,7 @@ export async function initDaemonComponents(config: DaemonInitConfig): Promise<Da
|
|
|
306
308
|
sessionHostControl: config.sessionHostControl,
|
|
307
309
|
statusInstanceId: config.statusInstanceId,
|
|
308
310
|
statusVersion: config.statusVersion,
|
|
311
|
+
getMeshPeerConnectionStatus: config.getMeshPeerConnectionStatus,
|
|
309
312
|
getCdpLogFn: config.getCdpLogFn || ((ideType: string) => LOG.forComponent(`CDP:${ideType}`).asLogFn()),
|
|
310
313
|
});
|
|
311
314
|
|