@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.mjs CHANGED
@@ -21352,14 +21352,33 @@ var DaemonCommandRouter = class {
21352
21352
  const requestedSessionIds = Array.isArray(args.sessionIds) ? new Set(args.sessionIds.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean)) : void 0;
21353
21353
  const sessions = await this.deps.sessionHostControl.listSessions();
21354
21354
  const matched = sessions.filter((record) => this.sessionMatchesMeshNode(record, args.node, args.nodeId, requestedSessionIds));
21355
+ const hasExplicitSessionIds = !!requestedSessionIds?.size;
21355
21356
  const stoppedSessionIds = [];
21356
21357
  const deletedSessionIds = [];
21357
21358
  const skippedSessionIds = [];
21359
+ const skippedLiveSessionIds = [];
21358
21360
  const deleteUnsupportedSessionIds = [];
21361
+ const recordsRemainSessionIds = [];
21359
21362
  const errors = [];
21363
+ const matchedBySurfaceKind = {
21364
+ live_runtime: 0,
21365
+ recovery_snapshot: 0,
21366
+ inactive_record: 0
21367
+ };
21368
+ for (const record of matched) {
21369
+ const surfaceKind = getSessionHostSurfaceKind(record);
21370
+ matchedBySurfaceKind[surfaceKind] += 1;
21371
+ }
21360
21372
  for (const record of matched) {
21361
21373
  const sessionId = String(record.sessionId);
21362
21374
  const completed = this.isCompletedHostedSession(record);
21375
+ const surfaceKind = getSessionHostSurfaceKind(record);
21376
+ const liveRuntime = surfaceKind === "live_runtime";
21377
+ if (!hasExplicitSessionIds && liveRuntime) {
21378
+ skippedSessionIds.push(sessionId);
21379
+ skippedLiveSessionIds.push(sessionId);
21380
+ continue;
21381
+ }
21363
21382
  try {
21364
21383
  if (args.mode === "stop") {
21365
21384
  if (!completed) {
@@ -21388,6 +21407,7 @@ var DaemonCommandRouter = class {
21388
21407
  const message = e?.message || String(e);
21389
21408
  if (message.includes("Unsupported session host request: delete_session") && (args.mode === "delete_stopped" || args.mode === "stop_and_delete")) {
21390
21409
  deleteUnsupportedSessionIds.push(sessionId);
21410
+ recordsRemainSessionIds.push(sessionId);
21391
21411
  if (args.mode === "stop_and_delete" && !completed) {
21392
21412
  try {
21393
21413
  await this.deps.sessionHostControl.stopSession(sessionId);
@@ -21403,15 +21423,23 @@ var DaemonCommandRouter = class {
21403
21423
  errors.push({ sessionId, error: message });
21404
21424
  }
21405
21425
  }
21426
+ const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
21406
21427
  return {
21407
21428
  success: errors.length === 0,
21408
21429
  mode: args.mode,
21409
21430
  dryRun: args.dryRun === true,
21410
21431
  matchedCount: matched.length,
21432
+ matchedBySurfaceKind,
21411
21433
  stoppedSessionIds,
21412
21434
  deletedSessionIds,
21413
21435
  skippedSessionIds,
21414
- ...deleteUnsupportedSessionIds.length ? { deleteUnsupportedSessionIds } : {},
21436
+ skippedLiveSessionIds,
21437
+ ...deleteUnsupported ? {
21438
+ deleteUnsupported: true,
21439
+ effectiveCleanup: args.mode === "stop_and_delete" ? "stopped_only_records_remain" : "delete_unsupported_records_remain",
21440
+ deleteUnsupportedSessionIds,
21441
+ recordsRemainSessionIds
21442
+ } : {},
21415
21443
  ...errors.length ? { errors } : {}
21416
21444
  };
21417
21445
  }