@adhdev/daemon-core 0.9.77-rc.35 → 0.9.77-rc.37

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.
@@ -71,6 +71,12 @@ export interface MeshWorkQueueStats {
71
71
  completed: number;
72
72
  failed: number;
73
73
  cancelled: number;
74
+ activeAssignments: Array<{
75
+ id: string;
76
+ nodeId?: string;
77
+ sessionId?: string;
78
+ message: string;
79
+ }>;
74
80
  }
75
81
  /**
76
82
  * Return aggregate queue statistics for the given mesh.
@@ -297,6 +297,13 @@ export interface SessionEntry {
297
297
  assigned: number;
298
298
  completed: number;
299
299
  failed: number;
300
+ cancelled?: number;
301
+ activeAssignments?: Array<{
302
+ id: string;
303
+ nodeId?: string;
304
+ sessionId?: string;
305
+ message: string;
306
+ }>;
300
307
  };
301
308
  }
302
309
  /**
@@ -341,6 +348,13 @@ export interface CompactSessionEntry {
341
348
  assigned: number;
342
349
  completed: number;
343
350
  failed: number;
351
+ cancelled?: number;
352
+ activeAssignments?: Array<{
353
+ id: string;
354
+ nodeId?: string;
355
+ sessionId?: string;
356
+ message: string;
357
+ }>;
344
358
  };
345
359
  }
346
360
  export type VersionUpdateReason = 'force_update_below' | 'major_minor_mismatch' | 'patch_mismatch' | 'daemon_ahead';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.77-rc.35",
3
+ "version": "0.9.77-rc.37",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -225,6 +225,7 @@ export class ProviderCliAdapter implements CliAdapter {
225
225
  currentTurnScope: TurnParseScope | null;
226
226
  recentOutputBuffer: string;
227
227
  accumulatedBuffer: string;
228
+ accumulatedRawBuffer: string;
228
229
  screenText: string;
229
230
  currentStatus: CliSessionStatus['status'];
230
231
  activeModal: { message: string; buttons: string[] } | null;
@@ -307,6 +308,7 @@ export class ProviderCliAdapter implements CliAdapter {
307
308
  && cached.currentTurnScope === this.currentTurnScope
308
309
  && cached.recentOutputBuffer === this.recentOutputBuffer
309
310
  && cached.accumulatedBuffer === this.accumulatedBuffer
311
+ && cached.accumulatedRawBuffer === this.accumulatedRawBuffer
310
312
  && cached.screenText === this.lastScreenText
311
313
  && cached.currentStatus === this.currentStatus
312
314
  && cached.activeModal === this.activeModal
@@ -1593,6 +1595,7 @@ export class ProviderCliAdapter implements CliAdapter {
1593
1595
  && cached.currentTurnScope === this.currentTurnScope
1594
1596
  && cached.recentOutputBuffer === this.recentOutputBuffer
1595
1597
  && cached.accumulatedBuffer === this.accumulatedBuffer
1598
+ && cached.accumulatedRawBuffer === this.accumulatedRawBuffer
1596
1599
  && cached.screenText === parseScreenText
1597
1600
  && cached.currentStatus === this.currentStatus
1598
1601
  && cached.activeModal === this.activeModal
@@ -1632,6 +1635,7 @@ export class ProviderCliAdapter implements CliAdapter {
1632
1635
  currentTurnScope: this.currentTurnScope,
1633
1636
  recentOutputBuffer: this.recentOutputBuffer,
1634
1637
  accumulatedBuffer: this.accumulatedBuffer,
1638
+ accumulatedRawBuffer: this.accumulatedRawBuffer,
1635
1639
  screenText: parseScreenText,
1636
1640
  currentStatus: this.currentStatus,
1637
1641
  activeModal: this.activeModal,
@@ -50,6 +50,8 @@ export interface ResolveMeshCoordinatorSetupOptions {
50
50
  adhdevMcpCommand?: string
51
51
  adhdevMcpEntryPath?: string
52
52
  nodeExecutable?: string
53
+ adhdevMcpTransport?: 'local' | 'ipc'
54
+ adhdevMcpPort?: number
53
55
  }
54
56
 
55
57
  const DEFAULT_SERVER_NAME = 'adhdev-mesh'
@@ -67,6 +69,8 @@ function resolveHermesMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetupO
67
69
  meshId: options.meshId,
68
70
  nodeExecutable: options.nodeExecutable,
69
71
  adhdevMcpEntryPath: options.adhdevMcpEntryPath,
72
+ adhdevMcpTransport: options.adhdevMcpTransport,
73
+ adhdevMcpPort: options.adhdevMcpPort,
70
74
  })
71
75
  if (!mcpServer) {
72
76
  return {
@@ -139,6 +143,8 @@ export function resolveMeshCoordinatorSetup(options: ResolveMeshCoordinatorSetup
139
143
  meshId,
140
144
  nodeExecutable: options.nodeExecutable,
141
145
  adhdevMcpEntryPath: options.adhdevMcpEntryPath,
146
+ adhdevMcpTransport: options.adhdevMcpTransport,
147
+ adhdevMcpPort: options.adhdevMcpPort,
142
148
  })
143
149
  if (!mcpServer) {
144
150
  return {
@@ -218,17 +224,37 @@ function resolveAdhdevMcpServerLaunch(options: {
218
224
  meshId: string
219
225
  nodeExecutable?: string
220
226
  adhdevMcpEntryPath?: string
227
+ adhdevMcpTransport?: 'local' | 'ipc'
228
+ adhdevMcpPort?: number
221
229
  }): MeshCoordinatorMcpServerLaunch | null {
222
230
  const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath)
223
231
  if (!entryPath) return null
224
232
  const nodeExecutable = resolveMcpNodeExecutable(options.nodeExecutable)
225
233
  if (!nodeExecutable) return null
234
+ const transport = resolveMcpTransport(options.adhdevMcpTransport)
235
+ const args = [entryPath, '--mode', transport, '--repo-mesh', options.meshId]
236
+ const port = resolveMcpPort(options.adhdevMcpPort)
237
+ if (port !== undefined) args.push('--port', String(port))
226
238
  return {
227
239
  command: nodeExecutable,
228
- args: [entryPath, '--mode', 'ipc', '--repo-mesh', options.meshId],
240
+ args,
229
241
  }
230
242
  }
231
243
 
244
+ function resolveMcpTransport(explicitTransport?: 'local' | 'ipc'): 'local' | 'ipc' {
245
+ if (explicitTransport === 'local' || explicitTransport === 'ipc') return explicitTransport
246
+ const envTransport = process.env.ADHDEV_COORDINATOR_MCP_TRANSPORT?.trim()
247
+ return envTransport === 'local' ? 'local' : 'ipc'
248
+ }
249
+
250
+ function resolveMcpPort(explicitPort?: number): number | undefined {
251
+ if (typeof explicitPort === 'number' && Number.isInteger(explicitPort) && explicitPort > 0) return explicitPort
252
+ const raw = process.env.ADHDEV_COORDINATOR_MCP_PORT?.trim()
253
+ if (!raw) return undefined
254
+ const parsed = Number(raw)
255
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined
256
+ }
257
+
232
258
  function resolveMcpNodeExecutable(explicitExecutable?: string): string | null {
233
259
  const explicit = explicitExecutable?.trim()
234
260
  if (explicit) return explicit
@@ -1932,9 +1932,11 @@ export class DaemonCommandRouter {
1932
1932
  args: coordinatorSetup.mcpServer.args,
1933
1933
  };
1934
1934
  if (args?.inlineMesh) {
1935
+ const modeArgIndex = coordinatorSetup.mcpServer.args.findIndex((value: string) => value === '--mode');
1936
+ const mcpTransport = modeArgIndex >= 0 ? coordinatorSetup.mcpServer.args[modeArgIndex + 1] : 'ipc';
1935
1937
  mcpServerEntry.env = {
1936
1938
  ADHDEV_INLINE_MESH: JSON.stringify(mesh),
1937
- ADHDEV_MCP_TRANSPORT: 'ipc',
1939
+ ADHDEV_MCP_TRANSPORT: mcpTransport === 'local' ? 'local' : 'ipc',
1938
1940
  };
1939
1941
  }
1940
1942
 
package/src/index.ts CHANGED
@@ -154,8 +154,8 @@ export { appendLedgerEntry, readLedgerEntries, getLedgerSummary, getLedgerDir, g
154
154
  export type { MeshLedgerEntry, MeshLedgerKind, MeshLedgerSummary, ReadLedgerOptions, SessionRecoveryContext } from './mesh/mesh-ledger.js';
155
155
 
156
156
  // ── Mesh Work Queue (GUPP) ──
157
- export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask } from './mesh/mesh-work-queue.js';
158
- export type { MeshWorkQueueEntry, MeshTaskStatus } from './mesh/mesh-work-queue.js';
157
+ export { enqueueTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats } from './mesh/mesh-work-queue.js';
158
+ export type { MeshWorkQueueEntry, MeshTaskStatus, MeshWorkQueueStats } from './mesh/mesh-work-queue.js';
159
159
 
160
160
  // ── Mesh Events ──
161
161
  export { triggerMeshQueue } from './mesh/mesh-events.js';
@@ -230,6 +230,12 @@ export interface MeshWorkQueueStats {
230
230
  completed: number;
231
231
  failed: number;
232
232
  cancelled: number;
233
+ activeAssignments: Array<{
234
+ id: string;
235
+ nodeId?: string;
236
+ sessionId?: string;
237
+ message: string;
238
+ }>;
233
239
  }
234
240
 
235
241
  /**
@@ -243,5 +249,13 @@ export function getMeshQueueStats(meshId: string): MeshWorkQueueStats {
243
249
  completed: queue.filter(q => q.status === 'completed').length,
244
250
  failed: queue.filter(q => q.status === 'failed').length,
245
251
  cancelled: queue.filter(q => q.status === 'cancelled').length,
252
+ activeAssignments: queue
253
+ .filter(q => q.status === 'assigned')
254
+ .map(q => ({
255
+ id: q.id,
256
+ nodeId: q.assignedNodeId,
257
+ sessionId: q.assignedSessionId,
258
+ message: q.message,
259
+ })),
246
260
  };
247
261
  }
@@ -394,6 +394,13 @@ export interface SessionEntry {
394
394
  assigned: number;
395
395
  completed: number;
396
396
  failed: number;
397
+ cancelled?: number;
398
+ activeAssignments?: Array<{
399
+ id: string;
400
+ nodeId?: string;
401
+ sessionId?: string;
402
+ message: string;
403
+ }>;
397
404
  };
398
405
  }
399
406
 
@@ -439,6 +446,13 @@ export interface CompactSessionEntry {
439
446
  assigned: number;
440
447
  completed: number;
441
448
  failed: number;
449
+ cancelled?: number;
450
+ activeAssignments?: Array<{
451
+ id: string;
452
+ nodeId?: string;
453
+ sessionId?: string;
454
+ message: string;
455
+ }>;
442
456
  };
443
457
  }
444
458