@adhdev/daemon-core 0.9.77-rc.46 → 0.9.77-rc.47
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 +27 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +8 -0
- package/dist/shared-types.d.ts +18 -0
- package/package.json +1 -1
- package/src/commands/router.ts +13 -2
- package/src/mesh/mesh-work-queue.ts +18 -0
- package/src/shared-types.ts +18 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export type MeshTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
2
|
+
export type MeshActiveTaskStatus = Extract<MeshTaskStatus, 'pending' | 'assigned'>;
|
|
3
|
+
export type MeshHistoricalTaskStatus = Extract<MeshTaskStatus, 'completed' | 'failed' | 'cancelled'>;
|
|
4
|
+
export declare const ACTIVE_MESH_QUEUE_STATUSES: MeshActiveTaskStatus[];
|
|
5
|
+
export declare const HISTORICAL_MESH_QUEUE_STATUSES: MeshHistoricalTaskStatus[];
|
|
2
6
|
export interface MeshWorkQueueEntry {
|
|
3
7
|
id: string;
|
|
4
8
|
meshId: string;
|
|
@@ -84,6 +88,10 @@ export interface MeshWorkQueueStats {
|
|
|
84
88
|
completed: number;
|
|
85
89
|
failed: number;
|
|
86
90
|
cancelled: number;
|
|
91
|
+
/** Source-of-truth active queue counters; only pending/assigned are live work. */
|
|
92
|
+
activeCounts: Record<MeshActiveTaskStatus, number>;
|
|
93
|
+
/** Terminal ledger records kept for audit/history; never count as active work. */
|
|
94
|
+
historicalCounts: Record<MeshHistoricalTaskStatus, number>;
|
|
87
95
|
activeAssignments: Array<{
|
|
88
96
|
id: string;
|
|
89
97
|
nodeId?: string;
|
package/dist/shared-types.d.ts
CHANGED
|
@@ -301,6 +301,15 @@ export interface SessionEntry {
|
|
|
301
301
|
completed: number;
|
|
302
302
|
failed: number;
|
|
303
303
|
cancelled?: number;
|
|
304
|
+
activeCounts?: {
|
|
305
|
+
pending: number;
|
|
306
|
+
assigned: number;
|
|
307
|
+
};
|
|
308
|
+
historicalCounts?: {
|
|
309
|
+
completed: number;
|
|
310
|
+
failed: number;
|
|
311
|
+
cancelled: number;
|
|
312
|
+
};
|
|
304
313
|
activeAssignments?: Array<{
|
|
305
314
|
id: string;
|
|
306
315
|
nodeId?: string;
|
|
@@ -355,6 +364,15 @@ export interface CompactSessionEntry {
|
|
|
355
364
|
completed: number;
|
|
356
365
|
failed: number;
|
|
357
366
|
cancelled?: number;
|
|
367
|
+
activeCounts?: {
|
|
368
|
+
pending: number;
|
|
369
|
+
assigned: number;
|
|
370
|
+
};
|
|
371
|
+
historicalCounts?: {
|
|
372
|
+
completed: number;
|
|
373
|
+
failed: number;
|
|
374
|
+
cancelled: number;
|
|
375
|
+
};
|
|
358
376
|
activeAssignments?: Array<{
|
|
359
377
|
id: string;
|
|
360
378
|
nodeId?: string;
|
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -1825,12 +1825,23 @@ export class DaemonCommandRouter {
|
|
|
1825
1825
|
const meshId = typeof args?.meshId === 'string' ? args.meshId.trim() : '';
|
|
1826
1826
|
if (!meshId) return { success: false, error: 'meshId required' };
|
|
1827
1827
|
try {
|
|
1828
|
-
const { getQueue } = await import('../mesh/mesh-work-queue.js');
|
|
1828
|
+
const { getMeshQueueStats, getQueue } = await import('../mesh/mesh-work-queue.js');
|
|
1829
1829
|
const status = Array.isArray(args?.status)
|
|
1830
1830
|
? args.status.map((s: any) => typeof s === 'string' ? s.trim() : '').filter(Boolean)
|
|
1831
1831
|
: undefined;
|
|
1832
1832
|
const queue = getQueue(meshId, { status: status as any });
|
|
1833
|
-
|
|
1833
|
+
const summary = getMeshQueueStats(meshId);
|
|
1834
|
+
return {
|
|
1835
|
+
success: true,
|
|
1836
|
+
queue,
|
|
1837
|
+
summary,
|
|
1838
|
+
sourceOfTruth: {
|
|
1839
|
+
kind: 'mesh_work_queue_file',
|
|
1840
|
+
activeStatuses: ['pending', 'assigned'],
|
|
1841
|
+
historicalStatuses: ['completed', 'failed', 'cancelled'],
|
|
1842
|
+
notes: 'pending/assigned are active work; completed/failed/cancelled are historical records.',
|
|
1843
|
+
},
|
|
1844
|
+
};
|
|
1834
1845
|
} catch (e: any) {
|
|
1835
1846
|
return { success: false, error: e.message };
|
|
1836
1847
|
}
|
|
@@ -4,6 +4,11 @@ import { randomUUID } from 'crypto';
|
|
|
4
4
|
import { getLedgerDir } from './mesh-ledger.js';
|
|
5
5
|
|
|
6
6
|
export type MeshTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
7
|
+
export type MeshActiveTaskStatus = Extract<MeshTaskStatus, 'pending' | 'assigned'>;
|
|
8
|
+
export type MeshHistoricalTaskStatus = Extract<MeshTaskStatus, 'completed' | 'failed' | 'cancelled'>;
|
|
9
|
+
|
|
10
|
+
export const ACTIVE_MESH_QUEUE_STATUSES: MeshActiveTaskStatus[] = ['pending', 'assigned'];
|
|
11
|
+
export const HISTORICAL_MESH_QUEUE_STATUSES: MeshHistoricalTaskStatus[] = ['completed', 'failed', 'cancelled'];
|
|
7
12
|
|
|
8
13
|
export interface MeshWorkQueueEntry {
|
|
9
14
|
id: string;
|
|
@@ -260,6 +265,10 @@ export interface MeshWorkQueueStats {
|
|
|
260
265
|
completed: number;
|
|
261
266
|
failed: number;
|
|
262
267
|
cancelled: number;
|
|
268
|
+
/** Source-of-truth active queue counters; only pending/assigned are live work. */
|
|
269
|
+
activeCounts: Record<MeshActiveTaskStatus, number>;
|
|
270
|
+
/** Terminal ledger records kept for audit/history; never count as active work. */
|
|
271
|
+
historicalCounts: Record<MeshHistoricalTaskStatus, number>;
|
|
263
272
|
activeAssignments: Array<{
|
|
264
273
|
id: string;
|
|
265
274
|
nodeId?: string;
|
|
@@ -287,6 +296,15 @@ export function getMeshQueueStats(meshId: string): MeshWorkQueueStats {
|
|
|
287
296
|
completed,
|
|
288
297
|
failed,
|
|
289
298
|
cancelled,
|
|
299
|
+
activeCounts: {
|
|
300
|
+
pending,
|
|
301
|
+
assigned,
|
|
302
|
+
},
|
|
303
|
+
historicalCounts: {
|
|
304
|
+
completed,
|
|
305
|
+
failed,
|
|
306
|
+
cancelled,
|
|
307
|
+
},
|
|
290
308
|
activeAssignments: queue
|
|
291
309
|
.filter(q => q.status === 'assigned')
|
|
292
310
|
.map(q => ({
|
package/src/shared-types.ts
CHANGED
|
@@ -398,6 +398,15 @@ export interface SessionEntry {
|
|
|
398
398
|
completed: number;
|
|
399
399
|
failed: number;
|
|
400
400
|
cancelled?: number;
|
|
401
|
+
activeCounts?: {
|
|
402
|
+
pending: number;
|
|
403
|
+
assigned: number;
|
|
404
|
+
};
|
|
405
|
+
historicalCounts?: {
|
|
406
|
+
completed: number;
|
|
407
|
+
failed: number;
|
|
408
|
+
cancelled: number;
|
|
409
|
+
};
|
|
401
410
|
activeAssignments?: Array<{
|
|
402
411
|
id: string;
|
|
403
412
|
nodeId?: string;
|
|
@@ -453,6 +462,15 @@ export interface CompactSessionEntry {
|
|
|
453
462
|
completed: number;
|
|
454
463
|
failed: number;
|
|
455
464
|
cancelled?: number;
|
|
465
|
+
activeCounts?: {
|
|
466
|
+
pending: number;
|
|
467
|
+
assigned: number;
|
|
468
|
+
};
|
|
469
|
+
historicalCounts?: {
|
|
470
|
+
completed: number;
|
|
471
|
+
failed: number;
|
|
472
|
+
cancelled: number;
|
|
473
|
+
};
|
|
456
474
|
activeAssignments?: Array<{
|
|
457
475
|
id: string;
|
|
458
476
|
nodeId?: string;
|