@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.mjs CHANGED
@@ -20402,7 +20402,7 @@ function formatCompletionMetadata(event) {
20402
20402
  function buildMeshSystemMessage(args) {
20403
20403
  const metadata = formatCompletionMetadata(args.metadataEvent);
20404
20404
  if (args.event === "agent:generating_completed") {
20405
- return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
20405
+ 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.`;
20406
20406
  }
20407
20407
  if (args.event === "agent:waiting_approval") {
20408
20408
  return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
@@ -21352,13 +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 = [];
21360
+ const deleteUnsupportedSessionIds = [];
21361
+ const recordsRemainSessionIds = [];
21358
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
+ }
21359
21372
  for (const record of matched) {
21360
21373
  const sessionId = String(record.sessionId);
21361
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
+ }
21362
21382
  try {
21363
21383
  if (args.mode === "stop") {
21364
21384
  if (!completed) {
@@ -21384,17 +21404,42 @@ var DaemonCommandRouter = class {
21384
21404
  continue;
21385
21405
  }
21386
21406
  } catch (e) {
21387
- errors.push({ sessionId, error: e?.message || String(e) });
21407
+ const message = e?.message || String(e);
21408
+ if (message.includes("Unsupported session host request: delete_session") && (args.mode === "delete_stopped" || args.mode === "stop_and_delete")) {
21409
+ deleteUnsupportedSessionIds.push(sessionId);
21410
+ recordsRemainSessionIds.push(sessionId);
21411
+ if (args.mode === "stop_and_delete" && !completed) {
21412
+ try {
21413
+ await this.deps.sessionHostControl.stopSession(sessionId);
21414
+ stoppedSessionIds.push(sessionId);
21415
+ } catch (stopError) {
21416
+ errors.push({ sessionId, error: stopError?.message || String(stopError) });
21417
+ continue;
21418
+ }
21419
+ }
21420
+ skippedSessionIds.push(sessionId);
21421
+ continue;
21422
+ }
21423
+ errors.push({ sessionId, error: message });
21388
21424
  }
21389
21425
  }
21426
+ const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
21390
21427
  return {
21391
21428
  success: errors.length === 0,
21392
21429
  mode: args.mode,
21393
21430
  dryRun: args.dryRun === true,
21394
21431
  matchedCount: matched.length,
21432
+ matchedBySurfaceKind,
21395
21433
  stoppedSessionIds,
21396
21434
  deletedSessionIds,
21397
21435
  skippedSessionIds,
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
+ } : {},
21398
21443
  ...errors.length ? { errors } : {}
21399
21444
  };
21400
21445
  }