@adhdev/daemon-core 0.9.76-rc.47 → 0.9.76-rc.49
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 +47 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +47 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +50 -1
- package/src/mesh/mesh-events.ts +1 -1
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -378,14 +378,35 @@ export class DaemonCommandRouter {
|
|
|
378
378
|
: undefined;
|
|
379
379
|
const sessions = await this.deps.sessionHostControl.listSessions();
|
|
380
380
|
const matched = sessions.filter(record => this.sessionMatchesMeshNode(record, args.node, args.nodeId, requestedSessionIds));
|
|
381
|
+
const hasExplicitSessionIds = !!requestedSessionIds?.size;
|
|
381
382
|
const stoppedSessionIds: string[] = [];
|
|
382
383
|
const deletedSessionIds: string[] = [];
|
|
383
384
|
const skippedSessionIds: string[] = [];
|
|
385
|
+
const skippedLiveSessionIds: string[] = [];
|
|
386
|
+
const deleteUnsupportedSessionIds: string[] = [];
|
|
387
|
+
const recordsRemainSessionIds: string[] = [];
|
|
384
388
|
const errors: Array<{ sessionId: string; error: string }> = [];
|
|
389
|
+
const matchedBySurfaceKind = {
|
|
390
|
+
live_runtime: 0,
|
|
391
|
+
recovery_snapshot: 0,
|
|
392
|
+
inactive_record: 0,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
for (const record of matched) {
|
|
396
|
+
const surfaceKind = getSessionHostSurfaceKind(record);
|
|
397
|
+
matchedBySurfaceKind[surfaceKind] += 1;
|
|
398
|
+
}
|
|
385
399
|
|
|
386
400
|
for (const record of matched) {
|
|
387
401
|
const sessionId = String(record.sessionId);
|
|
388
402
|
const completed = this.isCompletedHostedSession(record);
|
|
403
|
+
const surfaceKind = getSessionHostSurfaceKind(record);
|
|
404
|
+
const liveRuntime = surfaceKind === 'live_runtime';
|
|
405
|
+
if (!hasExplicitSessionIds && liveRuntime) {
|
|
406
|
+
skippedSessionIds.push(sessionId);
|
|
407
|
+
skippedLiveSessionIds.push(sessionId);
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
389
410
|
try {
|
|
390
411
|
if (args.mode === 'stop') {
|
|
391
412
|
if (!completed) {
|
|
@@ -413,18 +434,46 @@ export class DaemonCommandRouter {
|
|
|
413
434
|
continue;
|
|
414
435
|
}
|
|
415
436
|
} catch (e: any) {
|
|
416
|
-
|
|
437
|
+
const message = e?.message || String(e);
|
|
438
|
+
if (message.includes('Unsupported session host request: delete_session')
|
|
439
|
+
&& (args.mode === 'delete_stopped' || args.mode === 'stop_and_delete')) {
|
|
440
|
+
deleteUnsupportedSessionIds.push(sessionId);
|
|
441
|
+
recordsRemainSessionIds.push(sessionId);
|
|
442
|
+
if (args.mode === 'stop_and_delete' && !completed) {
|
|
443
|
+
try {
|
|
444
|
+
await this.deps.sessionHostControl.stopSession(sessionId);
|
|
445
|
+
stoppedSessionIds.push(sessionId);
|
|
446
|
+
} catch (stopError: any) {
|
|
447
|
+
errors.push({ sessionId, error: stopError?.message || String(stopError) });
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
skippedSessionIds.push(sessionId);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
errors.push({ sessionId, error: message });
|
|
417
455
|
}
|
|
418
456
|
}
|
|
419
457
|
|
|
458
|
+
const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
|
|
420
459
|
return {
|
|
421
460
|
success: errors.length === 0,
|
|
422
461
|
mode: args.mode,
|
|
423
462
|
dryRun: args.dryRun === true,
|
|
424
463
|
matchedCount: matched.length,
|
|
464
|
+
matchedBySurfaceKind,
|
|
425
465
|
stoppedSessionIds,
|
|
426
466
|
deletedSessionIds,
|
|
427
467
|
skippedSessionIds,
|
|
468
|
+
skippedLiveSessionIds,
|
|
469
|
+
...(deleteUnsupported ? {
|
|
470
|
+
deleteUnsupported: true,
|
|
471
|
+
effectiveCleanup: args.mode === 'stop_and_delete'
|
|
472
|
+
? 'stopped_only_records_remain'
|
|
473
|
+
: 'delete_unsupported_records_remain',
|
|
474
|
+
deleteUnsupportedSessionIds,
|
|
475
|
+
recordsRemainSessionIds,
|
|
476
|
+
} : {}),
|
|
428
477
|
...(errors.length ? { errors } : {}),
|
|
429
478
|
};
|
|
430
479
|
}
|
package/src/mesh/mesh-events.ts
CHANGED
|
@@ -22,7 +22,7 @@ function buildMeshSystemMessage(args: {
|
|
|
22
22
|
}): string {
|
|
23
23
|
const metadata = formatCompletionMetadata(args.metadataEvent);
|
|
24
24
|
if (args.event === 'agent:generating_completed') {
|
|
25
|
-
return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}.
|
|
25
|
+
return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. This completion came from the agent status event path; use mesh_read_chat once to review its final progress, but do not poll repeatedly.`;
|
|
26
26
|
}
|
|
27
27
|
if (args.event === 'agent:waiting_approval') {
|
|
28
28
|
return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
|