@adhdev/daemon-core 0.9.77-rc.45 → 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 +43 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -9
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +11 -0
- package/dist/shared-types.d.ts +24 -0
- package/package.json +1 -1
- package/src/commands/router.ts +13 -2
- package/src/config/config.ts +2 -1
- package/src/config/workspaces.ts +1 -1
- package/src/mesh/mesh-work-queue.ts +34 -5
- package/src/shared-types.ts +24 -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;
|
|
@@ -76,11 +80,18 @@ export declare function requeueTask(meshId: string, taskId: string, opts?: {
|
|
|
76
80
|
*/
|
|
77
81
|
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
|
|
78
82
|
export interface MeshWorkQueueStats {
|
|
83
|
+
total: number;
|
|
84
|
+
active: number;
|
|
85
|
+
historical: number;
|
|
79
86
|
pending: number;
|
|
80
87
|
assigned: number;
|
|
81
88
|
completed: number;
|
|
82
89
|
failed: number;
|
|
83
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>;
|
|
84
95
|
activeAssignments: Array<{
|
|
85
96
|
id: string;
|
|
86
97
|
nodeId?: string;
|
package/dist/shared-types.d.ts
CHANGED
|
@@ -293,11 +293,23 @@ export interface SessionEntry {
|
|
|
293
293
|
surfaceHidden?: boolean;
|
|
294
294
|
settings?: Record<string, any>;
|
|
295
295
|
meshQueueStats?: {
|
|
296
|
+
total?: number;
|
|
297
|
+
active?: number;
|
|
298
|
+
historical?: number;
|
|
296
299
|
pending: number;
|
|
297
300
|
assigned: number;
|
|
298
301
|
completed: number;
|
|
299
302
|
failed: number;
|
|
300
303
|
cancelled?: number;
|
|
304
|
+
activeCounts?: {
|
|
305
|
+
pending: number;
|
|
306
|
+
assigned: number;
|
|
307
|
+
};
|
|
308
|
+
historicalCounts?: {
|
|
309
|
+
completed: number;
|
|
310
|
+
failed: number;
|
|
311
|
+
cancelled: number;
|
|
312
|
+
};
|
|
301
313
|
activeAssignments?: Array<{
|
|
302
314
|
id: string;
|
|
303
315
|
nodeId?: string;
|
|
@@ -344,11 +356,23 @@ export interface CompactSessionEntry {
|
|
|
344
356
|
summaryMetadata?: ProviderSummaryMetadata;
|
|
345
357
|
settings?: Record<string, any>;
|
|
346
358
|
meshQueueStats?: {
|
|
359
|
+
total?: number;
|
|
360
|
+
active?: number;
|
|
361
|
+
historical?: number;
|
|
347
362
|
pending: number;
|
|
348
363
|
assigned: number;
|
|
349
364
|
completed: number;
|
|
350
365
|
failed: number;
|
|
351
366
|
cancelled?: number;
|
|
367
|
+
activeCounts?: {
|
|
368
|
+
pending: number;
|
|
369
|
+
assigned: number;
|
|
370
|
+
};
|
|
371
|
+
historicalCounts?: {
|
|
372
|
+
completed: number;
|
|
373
|
+
failed: number;
|
|
374
|
+
cancelled: number;
|
|
375
|
+
};
|
|
352
376
|
activeAssignments?: Array<{
|
|
353
377
|
id: string;
|
|
354
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
|
}
|
package/src/config/config.ts
CHANGED
|
@@ -264,7 +264,8 @@ function ensureMachineId(config: ADHDevConfig): { config: ADHDevConfig; changed:
|
|
|
264
264
|
* Get the config directory path
|
|
265
265
|
*/
|
|
266
266
|
export function getConfigDir(): string {
|
|
267
|
-
const
|
|
267
|
+
const override = process.env.ADHDEV_CONFIG_DIR;
|
|
268
|
+
const dir = override && override.trim() ? override.trim() : join(homedir(), '.adhdev');
|
|
268
269
|
if (!existsSync(dir)) {
|
|
269
270
|
mkdirSync(dir, { recursive: true });
|
|
270
271
|
}
|
package/src/config/workspaces.ts
CHANGED
|
@@ -201,7 +201,7 @@ export function addWorkspaceEntry(
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
const v = validateWorkspacePath(abs);
|
|
204
|
-
if (
|
|
204
|
+
if (v.ok !== true) return { error: v.error };
|
|
205
205
|
|
|
206
206
|
const list = [...(config.workspaces || [])];
|
|
207
207
|
if (list.some(w => path.resolve(w.path) === abs)) {
|
|
@@ -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;
|
|
@@ -252,11 +257,18 @@ export function updateSessionTaskStatus(
|
|
|
252
257
|
}
|
|
253
258
|
|
|
254
259
|
export interface MeshWorkQueueStats {
|
|
260
|
+
total: number;
|
|
261
|
+
active: number;
|
|
262
|
+
historical: number;
|
|
255
263
|
pending: number;
|
|
256
264
|
assigned: number;
|
|
257
265
|
completed: number;
|
|
258
266
|
failed: number;
|
|
259
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>;
|
|
260
272
|
activeAssignments: Array<{
|
|
261
273
|
id: string;
|
|
262
274
|
nodeId?: string;
|
|
@@ -270,12 +282,29 @@ export interface MeshWorkQueueStats {
|
|
|
270
282
|
*/
|
|
271
283
|
export function getMeshQueueStats(meshId: string): MeshWorkQueueStats {
|
|
272
284
|
const queue = readQueue(meshId);
|
|
285
|
+
const pending = queue.filter(q => q.status === 'pending').length;
|
|
286
|
+
const assigned = queue.filter(q => q.status === 'assigned').length;
|
|
287
|
+
const completed = queue.filter(q => q.status === 'completed').length;
|
|
288
|
+
const failed = queue.filter(q => q.status === 'failed').length;
|
|
289
|
+
const cancelled = queue.filter(q => q.status === 'cancelled').length;
|
|
273
290
|
return {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
291
|
+
total: queue.length,
|
|
292
|
+
active: pending + assigned,
|
|
293
|
+
historical: completed + failed + cancelled,
|
|
294
|
+
pending,
|
|
295
|
+
assigned,
|
|
296
|
+
completed,
|
|
297
|
+
failed,
|
|
298
|
+
cancelled,
|
|
299
|
+
activeCounts: {
|
|
300
|
+
pending,
|
|
301
|
+
assigned,
|
|
302
|
+
},
|
|
303
|
+
historicalCounts: {
|
|
304
|
+
completed,
|
|
305
|
+
failed,
|
|
306
|
+
cancelled,
|
|
307
|
+
},
|
|
279
308
|
activeAssignments: queue
|
|
280
309
|
.filter(q => q.status === 'assigned')
|
|
281
310
|
.map(q => ({
|
package/src/shared-types.ts
CHANGED
|
@@ -390,11 +390,23 @@ export interface SessionEntry {
|
|
|
390
390
|
surfaceHidden?: boolean;
|
|
391
391
|
settings?: Record<string, any>;
|
|
392
392
|
meshQueueStats?: {
|
|
393
|
+
total?: number;
|
|
394
|
+
active?: number;
|
|
395
|
+
historical?: number;
|
|
393
396
|
pending: number;
|
|
394
397
|
assigned: number;
|
|
395
398
|
completed: number;
|
|
396
399
|
failed: number;
|
|
397
400
|
cancelled?: number;
|
|
401
|
+
activeCounts?: {
|
|
402
|
+
pending: number;
|
|
403
|
+
assigned: number;
|
|
404
|
+
};
|
|
405
|
+
historicalCounts?: {
|
|
406
|
+
completed: number;
|
|
407
|
+
failed: number;
|
|
408
|
+
cancelled: number;
|
|
409
|
+
};
|
|
398
410
|
activeAssignments?: Array<{
|
|
399
411
|
id: string;
|
|
400
412
|
nodeId?: string;
|
|
@@ -442,11 +454,23 @@ export interface CompactSessionEntry {
|
|
|
442
454
|
summaryMetadata?: ProviderSummaryMetadata;
|
|
443
455
|
settings?: Record<string, any>;
|
|
444
456
|
meshQueueStats?: {
|
|
457
|
+
total?: number;
|
|
458
|
+
active?: number;
|
|
459
|
+
historical?: number;
|
|
445
460
|
pending: number;
|
|
446
461
|
assigned: number;
|
|
447
462
|
completed: number;
|
|
448
463
|
failed: number;
|
|
449
464
|
cancelled?: number;
|
|
465
|
+
activeCounts?: {
|
|
466
|
+
pending: number;
|
|
467
|
+
assigned: number;
|
|
468
|
+
};
|
|
469
|
+
historicalCounts?: {
|
|
470
|
+
completed: number;
|
|
471
|
+
failed: number;
|
|
472
|
+
cancelled: number;
|
|
473
|
+
};
|
|
450
474
|
activeAssignments?: Array<{
|
|
451
475
|
id: string;
|
|
452
476
|
nodeId?: string;
|