@adhdev/daemon-standalone 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
@@ -51613,7 +51613,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
51613
51613
  function buildMeshSystemMessage(args) {
51614
51614
  const metadata = formatCompletionMetadata(args.metadataEvent);
51615
51615
  if (args.event === "agent:generating_completed") {
51616
- return `[System] ${args.nodeLabel} has completed its task and is now idle${metadata}. You may use mesh_read_chat to review its progress.`;
51616
+ 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.`;
51617
51617
  }
51618
51618
  if (args.event === "agent:waiting_approval") {
51619
51619
  return `[System] ${args.nodeLabel} is waiting for approval to proceed${metadata}. You may use mesh_read_chat and mesh_approve to handle it.`;
@@ -52557,13 +52557,33 @@ Run 'adhdev doctor' for detailed diagnostics.`
52557
52557
  const requestedSessionIds = Array.isArray(args.sessionIds) ? new Set(args.sessionIds.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean)) : void 0;
52558
52558
  const sessions = await this.deps.sessionHostControl.listSessions();
52559
52559
  const matched = sessions.filter((record2) => this.sessionMatchesMeshNode(record2, args.node, args.nodeId, requestedSessionIds));
52560
+ const hasExplicitSessionIds = !!requestedSessionIds?.size;
52560
52561
  const stoppedSessionIds = [];
52561
52562
  const deletedSessionIds = [];
52562
52563
  const skippedSessionIds = [];
52564
+ const skippedLiveSessionIds = [];
52565
+ const deleteUnsupportedSessionIds = [];
52566
+ const recordsRemainSessionIds = [];
52563
52567
  const errors = [];
52568
+ const matchedBySurfaceKind = {
52569
+ live_runtime: 0,
52570
+ recovery_snapshot: 0,
52571
+ inactive_record: 0
52572
+ };
52573
+ for (const record2 of matched) {
52574
+ const surfaceKind = getSessionHostSurfaceKind(record2);
52575
+ matchedBySurfaceKind[surfaceKind] += 1;
52576
+ }
52564
52577
  for (const record2 of matched) {
52565
52578
  const sessionId = String(record2.sessionId);
52566
52579
  const completed = this.isCompletedHostedSession(record2);
52580
+ const surfaceKind = getSessionHostSurfaceKind(record2);
52581
+ const liveRuntime = surfaceKind === "live_runtime";
52582
+ if (!hasExplicitSessionIds && liveRuntime) {
52583
+ skippedSessionIds.push(sessionId);
52584
+ skippedLiveSessionIds.push(sessionId);
52585
+ continue;
52586
+ }
52567
52587
  try {
52568
52588
  if (args.mode === "stop") {
52569
52589
  if (!completed) {
@@ -52589,17 +52609,42 @@ Run 'adhdev doctor' for detailed diagnostics.`
52589
52609
  continue;
52590
52610
  }
52591
52611
  } catch (e) {
52592
- errors.push({ sessionId, error: e?.message || String(e) });
52612
+ const message = e?.message || String(e);
52613
+ if (message.includes("Unsupported session host request: delete_session") && (args.mode === "delete_stopped" || args.mode === "stop_and_delete")) {
52614
+ deleteUnsupportedSessionIds.push(sessionId);
52615
+ recordsRemainSessionIds.push(sessionId);
52616
+ if (args.mode === "stop_and_delete" && !completed) {
52617
+ try {
52618
+ await this.deps.sessionHostControl.stopSession(sessionId);
52619
+ stoppedSessionIds.push(sessionId);
52620
+ } catch (stopError) {
52621
+ errors.push({ sessionId, error: stopError?.message || String(stopError) });
52622
+ continue;
52623
+ }
52624
+ }
52625
+ skippedSessionIds.push(sessionId);
52626
+ continue;
52627
+ }
52628
+ errors.push({ sessionId, error: message });
52593
52629
  }
52594
52630
  }
52631
+ const deleteUnsupported = deleteUnsupportedSessionIds.length > 0;
52595
52632
  return {
52596
52633
  success: errors.length === 0,
52597
52634
  mode: args.mode,
52598
52635
  dryRun: args.dryRun === true,
52599
52636
  matchedCount: matched.length,
52637
+ matchedBySurfaceKind,
52600
52638
  stoppedSessionIds,
52601
52639
  deletedSessionIds,
52602
52640
  skippedSessionIds,
52641
+ skippedLiveSessionIds,
52642
+ ...deleteUnsupported ? {
52643
+ deleteUnsupported: true,
52644
+ effectiveCleanup: args.mode === "stop_and_delete" ? "stopped_only_records_remain" : "delete_unsupported_records_remain",
52645
+ deleteUnsupportedSessionIds,
52646
+ recordsRemainSessionIds
52647
+ } : {},
52603
52648
  ...errors.length ? { errors } : {}
52604
52649
  };
52605
52650
  }