@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 CHANGED
@@ -20593,7 +20593,7 @@ function formatCompletionMetadata(event) {
20593
20593
  function buildMeshSystemMessage(args) {
20594
20594
  const metadata = formatCompletionMetadata(args.metadataEvent);
20595
20595
  if (args.event === "agent:generating_completed") {
20596
- return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
20596
+ 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.`;
20597
20597
  }
20598
20598
  if (args.event === "agent:waiting_approval") {
20599
20599
  return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
@@ -21543,13 +21543,33 @@ var DaemonCommandRouter = class {
21543
21543
  const requestedSessionIds = Array.isArray(args.sessionIds) ? new Set(args.sessionIds.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean)) : void 0;
21544
21544
  const sessions = await this.deps.sessionHostControl.listSessions();
21545
21545
  const matched = sessions.filter((record) => this.sessionMatchesMeshNode(record, args.node, args.nodeId, requestedSessionIds));
21546
+ const hasExplicitSessionIds = !!requestedSessionIds?.size;
21546
21547
  const stoppedSessionIds = [];
21547
21548
  const deletedSessionIds = [];
21548
21549
  const skippedSessionIds = [];
21550
+ const skippedLiveSessionIds = [];
21551
+ const deleteUnsupportedSessionIds = [];
21552
+ const recordsRemainSessionIds = [];
21549
21553
  const errors = [];
21554
+ const matchedBySurfaceKind = {
21555
+ live_runtime: 0,
21556
+ recovery_snapshot: 0,
21557
+ inactive_record: 0
21558
+ };
21559
+ for (const record of matched) {
21560
+ const surfaceKind = getSessionHostSurfaceKind(record);
21561
+ matchedBySurfaceKind[surfaceKind] += 1;
21562
+ }
21550
21563
  for (const record of matched) {
21551
21564
  const sessionId = String(record.sessionId);
21552
21565
  const completed = this.isCompletedHostedSession(record);
21566
+ const surfaceKind = getSessionHostSurfaceKind(record);
21567
+ const liveRuntime = surfaceKind === "live_runtime";
21568
+ if (!hasExplicitSessionIds && liveRuntime) {
21569
+ skippedSessionIds.push(sessionId);
21570
+ skippedLiveSessionIds.push(sessionId);
21571
+ continue;
21572
+ }
21553
21573
  try {
21554
21574
  if (args.mode === "stop") {
21555
21575
  if (!completed) {
@@ -21575,17 +21595,42 @@ var DaemonCommandRouter = class {
21575
21595
  continue;
21576
21596
  }
21577
21597
  } catch (e) {
21578
- errors.push({ sessionId, error: e?.message || String(e) });
21598
+ const message = e?.message || String(e);
21599
+ if (message.includes("Unsupported session host request: delete_session") && (args.mode === "delete_stopped" || args.mode === "stop_and_delete")) {
21600
+ deleteUnsupportedSessionIds.push(sessionId);
21601
+ recordsRemainSessionIds.push(sessionId);
21602
+ if (args.mode === "stop_and_delete" && !completed) {
21603
+ try {
21604
+ await this.deps.sessionHostControl.stopSession(sessionId);
21605
+ stoppedSessionIds.push(sessionId);
21606
+ } catch (stopError) {
21607
+ errors.push({ sessionId, error: stopError?.message || String(stopError) });
21608
+ continue;
21609
+ }
21610
+ }
21611
+ skippedSessionIds.push(sessionId);
21612
+ continue;
21613
+ }
21614
+ errors.push({ sessionId, error: message });
21579
21615
  }
21580
21616
  }
21617
+ const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
21581
21618
  return {
21582
21619
  success: errors.length === 0,
21583
21620
  mode: args.mode,
21584
21621
  dryRun: args.dryRun === true,
21585
21622
  matchedCount: matched.length,
21623
+ matchedBySurfaceKind,
21586
21624
  stoppedSessionIds,
21587
21625
  deletedSessionIds,
21588
21626
  skippedSessionIds,
21627
+ skippedLiveSessionIds,
21628
+ ...deleteUnsupported ? {
21629
+ deleteUnsupported: true,
21630
+ effectiveCleanup: args.mode === "stop_and_delete" ? "stopped_only_records_remain" : "delete_unsupported_records_remain",
21631
+ deleteUnsupportedSessionIds,
21632
+ recordsRemainSessionIds
21633
+ } : {},
21589
21634
  ...errors.length ? { errors } : {}
21590
21635
  };
21591
21636
  }