@adhdev/daemon-core 0.9.77-rc.59 → 0.9.77-rc.60
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.d.ts +0 -2
- package/dist/index.js +63 -227
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -226
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +68 -0
- package/src/index.ts +5 -2
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -2714,6 +2714,74 @@ export class DaemonCommandRouter {
|
|
|
2714
2714
|
}
|
|
2715
2715
|
}
|
|
2716
2716
|
|
|
2717
|
+
case 'mesh_status': {
|
|
2718
|
+
const meshId = typeof args?.meshId === 'string' ? args.meshId.trim() : '';
|
|
2719
|
+
if (!meshId) return { success: false, error: 'meshId required' };
|
|
2720
|
+
try {
|
|
2721
|
+
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
|
|
2722
|
+
const mesh = meshRecord?.mesh;
|
|
2723
|
+
if (!mesh) return { success: false, error: 'Mesh not found' };
|
|
2724
|
+
|
|
2725
|
+
const { getMeshQueueStats, getQueue } = await import('../mesh/mesh-work-queue.js');
|
|
2726
|
+
const queue = getQueue(meshId);
|
|
2727
|
+
const queueSummary = getMeshQueueStats(meshId);
|
|
2728
|
+
|
|
2729
|
+
const { readLedgerEntries, getLedgerSummary } = await import('../mesh/mesh-ledger.js');
|
|
2730
|
+
const ledgerEntries = readLedgerEntries(meshId, { tail: 20 });
|
|
2731
|
+
const ledgerSummary = getLedgerSummary(meshId);
|
|
2732
|
+
|
|
2733
|
+
const nodeStatuses = [];
|
|
2734
|
+
for (const node of mesh.nodes || []) {
|
|
2735
|
+
const status: Record<string, unknown> = {
|
|
2736
|
+
nodeId: node.id || node.nodeId,
|
|
2737
|
+
workspace: node.workspace,
|
|
2738
|
+
repoRoot: node.repoRoot,
|
|
2739
|
+
isLocalWorktree: node.isLocalWorktree,
|
|
2740
|
+
worktreeBranch: node.worktreeBranch,
|
|
2741
|
+
daemonId: node.daemonId,
|
|
2742
|
+
machineId: node.machineId,
|
|
2743
|
+
health: 'unknown',
|
|
2744
|
+
};
|
|
2745
|
+
if (node.workspace && typeof node.workspace === 'string') {
|
|
2746
|
+
try {
|
|
2747
|
+
const { execFile } = await import('node:child_process');
|
|
2748
|
+
const { promisify } = await import('node:util');
|
|
2749
|
+
const execFileAsync = promisify(execFile);
|
|
2750
|
+
const branch = await execFileAsync('git', ['-C', node.workspace, 'branch', '--show-current'], {
|
|
2751
|
+
encoding: 'utf8',
|
|
2752
|
+
timeout: 10_000,
|
|
2753
|
+
}).then(r => r.stdout.trim()).catch(() => '');
|
|
2754
|
+
const porc = await execFileAsync('git', ['-C', node.workspace, 'status', '--porcelain'], {
|
|
2755
|
+
encoding: 'utf8',
|
|
2756
|
+
timeout: 10_000,
|
|
2757
|
+
}).then(r => r.stdout.trim()).catch(() => '');
|
|
2758
|
+
const dirty = porc.length > 0;
|
|
2759
|
+
status.branch = branch;
|
|
2760
|
+
status.isDirty = dirty;
|
|
2761
|
+
status.uncommittedChanges = porc ? porc.split('\n').filter(Boolean).length : 0;
|
|
2762
|
+
status.health = branch ? (dirty ? 'dirty' : 'online') : 'degraded';
|
|
2763
|
+
} catch {
|
|
2764
|
+
status.health = 'degraded';
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
nodeStatuses.push(status);
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
return {
|
|
2771
|
+
success: true,
|
|
2772
|
+
meshId: mesh.id,
|
|
2773
|
+
meshName: mesh.name,
|
|
2774
|
+
repoIdentity: mesh.repoIdentity,
|
|
2775
|
+
defaultBranch: mesh.defaultBranch,
|
|
2776
|
+
nodes: nodeStatuses,
|
|
2777
|
+
queue: { tasks: queue, summary: queueSummary },
|
|
2778
|
+
ledger: { entries: ledgerEntries, summary: ledgerSummary },
|
|
2779
|
+
};
|
|
2780
|
+
} catch (e: any) {
|
|
2781
|
+
return { success: false, error: e.message };
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2717
2785
|
default:
|
|
2718
2786
|
break;
|
|
2719
2787
|
}
|
package/src/index.ts
CHANGED
|
@@ -160,8 +160,11 @@ export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTa
|
|
|
160
160
|
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
|
|
161
161
|
|
|
162
162
|
// ── Mesh Visualization ──
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
// buildMeshGraph and MeshGraph types moved to @adhdev/web-core to avoid
|
|
164
|
+
// bundling Node.js built-ins (fs, path, etc.) into browser builds.
|
|
165
|
+
// Import from '@adhdev/web-core' instead.
|
|
166
|
+
// export { buildMeshGraph } from './mesh/mesh-visualization.js';
|
|
167
|
+
// export type { MeshGraph, MeshGraphNode, MeshGraphEdge, MeshGraphNodeType, MeshGraphEdgeType } from './mesh/mesh-visualization.js';
|
|
165
168
|
|
|
166
169
|
// ── Mesh Events ──
|
|
167
170
|
export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents } from './mesh/mesh-events.js';
|