@adhdev/daemon-core 0.9.76-rc.48 → 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 +29 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/router.ts +32 -1
package/package.json
CHANGED
package/src/commands/router.ts
CHANGED
|
@@ -378,15 +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[] = [];
|
|
384
386
|
const deleteUnsupportedSessionIds: string[] = [];
|
|
387
|
+
const recordsRemainSessionIds: string[] = [];
|
|
385
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
|
+
}
|
|
386
399
|
|
|
387
400
|
for (const record of matched) {
|
|
388
401
|
const sessionId = String(record.sessionId);
|
|
389
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
|
+
}
|
|
390
410
|
try {
|
|
391
411
|
if (args.mode === 'stop') {
|
|
392
412
|
if (!completed) {
|
|
@@ -418,6 +438,7 @@ export class DaemonCommandRouter {
|
|
|
418
438
|
if (message.includes('Unsupported session host request: delete_session')
|
|
419
439
|
&& (args.mode === 'delete_stopped' || args.mode === 'stop_and_delete')) {
|
|
420
440
|
deleteUnsupportedSessionIds.push(sessionId);
|
|
441
|
+
recordsRemainSessionIds.push(sessionId);
|
|
421
442
|
if (args.mode === 'stop_and_delete' && !completed) {
|
|
422
443
|
try {
|
|
423
444
|
await this.deps.sessionHostControl.stopSession(sessionId);
|
|
@@ -434,15 +455,25 @@ export class DaemonCommandRouter {
|
|
|
434
455
|
}
|
|
435
456
|
}
|
|
436
457
|
|
|
458
|
+
const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
|
|
437
459
|
return {
|
|
438
460
|
success: errors.length === 0,
|
|
439
461
|
mode: args.mode,
|
|
440
462
|
dryRun: args.dryRun === true,
|
|
441
463
|
matchedCount: matched.length,
|
|
464
|
+
matchedBySurfaceKind,
|
|
442
465
|
stoppedSessionIds,
|
|
443
466
|
deletedSessionIds,
|
|
444
467
|
skippedSessionIds,
|
|
445
|
-
|
|
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
|
+
} : {}),
|
|
446
477
|
...(errors.length ? { errors } : {}),
|
|
447
478
|
};
|
|
448
479
|
}
|