@moxt-ai/mobius 0.0.471 → 0.0.473

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.
Files changed (83) hide show
  1. package/dist/{chunk-7XY5VCQJ.js → chunk-MYBYMYDN.js} +1544 -142
  2. package/dist/{chunk-7XY5VCQJ.js.map → chunk-MYBYMYDN.js.map} +4 -4
  3. package/dist/{chunk-HPFAJPEN.js → chunk-ZNDBQ5XO.js} +2 -2
  4. package/dist/{chunk-HPFAJPEN.js.map → chunk-ZNDBQ5XO.js.map} +1 -1
  5. package/dist/{cli-6OLHX3IS.js → cli-52AEF4WX.js} +3 -3
  6. package/dist/cli.js +2 -2
  7. package/dist/engine/acp/adapter/antigravity/adapter.d.ts +1 -0
  8. package/dist/engine/acp/adapter/antigravity/adapter.d.ts.map +1 -1
  9. package/dist/engine/acp/adapter/antigravity/adapter.js +17 -5
  10. package/dist/engine/acp/adapter/antigravity/adapter.js.map +1 -1
  11. package/dist/engine/acp/adapter/antigravity/agent-connection.d.ts +12 -0
  12. package/dist/engine/acp/adapter/antigravity/agent-connection.d.ts.map +1 -1
  13. package/dist/engine/acp/adapter/antigravity/agent-connection.js +100 -0
  14. package/dist/engine/acp/adapter/antigravity/agent-connection.js.map +1 -1
  15. package/dist/engine/acp/adapter/antigravity/background-wakeup.d.ts +26 -0
  16. package/dist/engine/acp/adapter/antigravity/background-wakeup.d.ts.map +1 -1
  17. package/dist/engine/acp/adapter/antigravity/background-wakeup.js +592 -0
  18. package/dist/engine/acp/adapter/antigravity/background-wakeup.js.map +1 -1
  19. package/dist/engine/acp/adapter/antigravity/session-artifacts.d.ts +39 -0
  20. package/dist/engine/acp/adapter/antigravity/session-artifacts.d.ts.map +1 -0
  21. package/dist/engine/acp/adapter/antigravity/session-artifacts.js +409 -0
  22. package/dist/engine/acp/adapter/antigravity/session-artifacts.js.map +1 -0
  23. package/dist/engine/acp/adapter/claude/adapter.d.ts.map +1 -1
  24. package/dist/engine/acp/adapter/claude/adapter.js +3 -2
  25. package/dist/engine/acp/adapter/claude/adapter.js.map +1 -1
  26. package/dist/engine/acp/adapter/codex/adapter.d.ts.map +1 -1
  27. package/dist/engine/acp/adapter/codex/adapter.js +3 -2
  28. package/dist/engine/acp/adapter/codex/adapter.js.map +1 -1
  29. package/dist/engine/acp/adapter/lifecycle-output.d.ts +4 -1
  30. package/dist/engine/acp/adapter/lifecycle-output.d.ts.map +1 -1
  31. package/dist/engine/acp/adapter/lifecycle-output.js +5 -0
  32. package/dist/engine/acp/adapter/lifecycle-output.js.map +1 -1
  33. package/dist/engine/acp/harness/claude/turn-tokens.d.ts +8 -0
  34. package/dist/engine/acp/harness/claude/turn-tokens.d.ts.map +1 -0
  35. package/dist/engine/acp/harness/claude/turn-tokens.js +57 -0
  36. package/dist/engine/acp/harness/claude/turn-tokens.js.map +1 -0
  37. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts +18 -0
  38. package/dist/engine/acp/harness/codex/app-server-protocol.d.ts.map +1 -1
  39. package/dist/engine/acp/harness/codex/app-server-protocol.js +18 -0
  40. package/dist/engine/acp/harness/codex/app-server-protocol.js.map +1 -1
  41. package/dist/engine/acp/harness/codex/owned-agent.d.ts.map +1 -1
  42. package/dist/engine/acp/harness/codex/owned-agent.js +41 -4
  43. package/dist/engine/acp/harness/codex/owned-agent.js.map +1 -1
  44. package/dist/engine/acp/harness/codex/turn-tokens.d.ts +8 -0
  45. package/dist/engine/acp/harness/codex/turn-tokens.d.ts.map +1 -0
  46. package/dist/engine/acp/harness/codex/turn-tokens.js +20 -0
  47. package/dist/engine/acp/harness/codex/turn-tokens.js.map +1 -0
  48. package/dist/engine/acp/native-history/preview-contract.d.ts +10 -1
  49. package/dist/engine/acp/native-history/preview-contract.d.ts.map +1 -1
  50. package/dist/engine/runtime/command/registry/prompt.d.ts.map +1 -1
  51. package/dist/engine/runtime/command/registry/prompt.js +1 -0
  52. package/dist/engine/runtime/command/registry/prompt.js.map +1 -1
  53. package/dist/engine/session/live/agent-session.d.ts +2 -0
  54. package/dist/engine/session/live/agent-session.d.ts.map +1 -1
  55. package/dist/engine/session/live/agent-session.js +34 -4
  56. package/dist/engine/session/live/agent-session.js.map +1 -1
  57. package/dist/engine/session/manager/session-manager.d.ts +5 -0
  58. package/dist/engine/session/manager/session-manager.d.ts.map +1 -1
  59. package/dist/engine/session/manager/session-manager.js +16 -2
  60. package/dist/engine/session/manager/session-manager.js.map +1 -1
  61. package/dist/engine/session/prompt/execute-prompt.d.ts +3 -1
  62. package/dist/engine/session/prompt/execute-prompt.d.ts.map +1 -1
  63. package/dist/engine/session/prompt/execute-prompt.js +57 -26
  64. package/dist/engine/session/prompt/execute-prompt.js.map +1 -1
  65. package/dist/engine/session/turn/active-turn.d.ts +5 -0
  66. package/dist/engine/session/turn/active-turn.d.ts.map +1 -1
  67. package/dist/engine/session/turn/active-turn.js +7 -0
  68. package/dist/engine/session/turn/active-turn.js.map +1 -1
  69. package/dist/engine/session/turn/session-execution.d.ts +5 -0
  70. package/dist/engine/session/turn/session-execution.d.ts.map +1 -1
  71. package/dist/engine/session/turn/session-execution.js +17 -0
  72. package/dist/engine/session/turn/session-execution.js.map +1 -1
  73. package/dist/engine/session/turn/session-turns.d.ts +1 -0
  74. package/dist/engine/session/turn/session-turns.d.ts.map +1 -1
  75. package/dist/engine/session/turn/session-turns.js +1 -0
  76. package/dist/engine/session/turn/session-turns.js.map +1 -1
  77. package/dist/engine/storage/files/local-files.d.ts +11 -0
  78. package/dist/engine/storage/files/local-files.d.ts.map +1 -1
  79. package/dist/engine/storage/files/local-files.js +141 -0
  80. package/dist/engine/storage/files/local-files.js.map +1 -1
  81. package/dist/engine.js +2 -2
  82. package/package.json +1 -1
  83. /package/dist/{cli-6OLHX3IS.js.map → cli-52AEF4WX.js.map} +0 -0
@@ -6,6 +6,7 @@ import { readScopedFileTail } from "../../../storage/files/local-files.js";
6
6
  import { systemTimer } from "../../../util/timer.js";
7
7
  import { isRecord, truncate } from "../../../util/value-utils.js";
8
8
  import { AGENT_TURN_META, BACKGROUND_TASKS_META, } from "../../agent/in-process-endpoint.js";
9
+ import { readAntigravityConversationTerminalError, readAntigravityPendingReply, readAntigravitySubagentSnapshot, readAntigravityTaskLogSignature, } from "./session-artifacts.js";
9
10
  const TRANSCRIPT_TAIL_BYTES = 65_536;
10
11
  // Bounded wider tail used only when tracked subagents remain unresolved and the turn outgrew 64 KiB.
11
12
  const SUBAGENT_RECONCILE_TAIL_BYTES = 1_048_576;
@@ -13,6 +14,14 @@ const TRANSCRIPT_INITIAL_DELAY_MS = 40;
13
14
  const TRANSCRIPT_POLL_INTERVAL_MS = 150;
14
15
  const MAX_PARTIAL_SETTLED_TEXT_DEFERRALS = 2;
15
16
  export const WAKEUP_INACTIVITY_TIMEOUT_MS = 300_000;
17
+ /** Sliced watchdog tick interval so host sleep only advances one slice instead of expiring immediately. */
18
+ export const WATCHDOG_SLICE_MS = 60_000;
19
+ /** Consecutive silent slices after a settled reply before an orphan background shell command auto-settles. */
20
+ export const ORPHAN_SHELL_SILENCE_SLICES = 5;
21
+ /** Hard ceiling (in slices) for holding a finished reply open on shell-only background tasks. */
22
+ export const ORPHAN_SHELL_MAX_HOLD_SLICES = 30;
23
+ /** Consecutive silent slices on an open client prompt with no active tools or children before timing out. */
24
+ export const OPEN_PROMPT_INACTIVITY_SLICES = 15;
16
25
  const SESSION_UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
17
26
  const SUBAGENT_CONVERSATION_ID_PATTERN = /"conversationId"\s*:\s*"([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})"/giu;
18
27
  const SUBAGENT_IDLE_ID_PATTERN = /\bSubagent ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}) (?:has gone|went) idle\b/giu;
@@ -182,6 +191,12 @@ function readToolCategory(update, inputs, previous) {
182
191
  if (name === "manage_subagents") {
183
192
  return "manage-subagents";
184
193
  }
194
+ if (name === "manage_task") {
195
+ return "manage-task";
196
+ }
197
+ if (name === "swarm") {
198
+ return "swarm";
199
+ }
185
200
  const title = readString(update, "title");
186
201
  if (title === "Run invoke_subagent" ||
187
202
  title === "Running invoke_subagent" ||
@@ -196,6 +211,12 @@ function readToolCategory(update, inputs, previous) {
196
211
  if (title === "Run manage_subagents") {
197
212
  return "manage-subagents";
198
213
  }
214
+ if (title === "Run manage_task" || title === "Running manage_task") {
215
+ return "manage-task";
216
+ }
217
+ if (title === "Run swarm" || title === "Running swarm") {
218
+ return "swarm";
219
+ }
199
220
  if (previous?.category !== undefined && previous.category !== null) {
200
221
  return previous.category;
201
222
  }
@@ -204,12 +225,25 @@ function readToolCategory(update, inputs, previous) {
204
225
  }
205
226
  return null;
206
227
  }
228
+ function normalizeManageTaskKillId(rawTaskId) {
229
+ if (rawTaskId === undefined) {
230
+ return undefined;
231
+ }
232
+ const trimmed = rawTaskId.trim();
233
+ if (trimmed.length === 0) {
234
+ return undefined;
235
+ }
236
+ const slashIndex = trimmed.lastIndexOf("/");
237
+ return slashIndex === -1 ? trimmed : trimmed.slice(slashIndex + 1);
238
+ }
207
239
  function inspectToolMetadata(update, previous) {
208
240
  const inputs = extractToolInputRecords(update);
209
241
  const category = readToolCategory(update, inputs, previous);
210
242
  let isDaemon = previous?.isDaemon ?? false;
211
243
  const subagentKillIds = new Set(previous?.subagentKillIds ?? []);
212
244
  let subagentKillAll = previous?.subagentKillAll ?? false;
245
+ let killTaskId = previous?.killTaskId;
246
+ let swarmAction = previous?.swarmAction;
213
247
  for (const record of inputs) {
214
248
  if (record["IsDaemon"] === true) {
215
249
  isDaemon = true;
@@ -234,6 +268,18 @@ function inspectToolMetadata(update, previous) {
234
268
  }
235
269
  }
236
270
  }
271
+ if (category === "manage-task") {
272
+ const action = readString(record, "Action");
273
+ if (action === "kill") {
274
+ killTaskId = normalizeManageTaskKillId(readString(record, "TaskId")) ?? killTaskId;
275
+ }
276
+ }
277
+ if (category === "swarm") {
278
+ const action = readString(record, "action");
279
+ if (action === "add" || action === "kill") {
280
+ swarmAction = action;
281
+ }
282
+ }
237
283
  }
238
284
  const matchText = readInputString(inputs, "CommandLine") ??
239
285
  readInputString(inputs, "Prompt") ??
@@ -242,6 +288,7 @@ function inspectToolMetadata(update, previous) {
242
288
  const description = readInputString(inputs, "toolSummary") ??
243
289
  readInputString(inputs, "Description") ??
244
290
  readInputString(inputs, "Role") ??
291
+ readInputString(inputs, "name") ??
245
292
  readInputString(inputs, "CommandLine") ??
246
293
  readInputString(inputs, "Prompt") ??
247
294
  readString(update, "title") ??
@@ -250,9 +297,11 @@ function inspectToolMetadata(update, previous) {
250
297
  category,
251
298
  description: description === undefined ? undefined : truncate(description, MAXIMUM_TOOL_DESCRIPTION_CHARS),
252
299
  isDaemon,
300
+ killTaskId,
253
301
  matchText,
254
302
  subagentKillAll,
255
303
  subagentKillIds: [...subagentKillIds],
304
+ swarmAction,
256
305
  };
257
306
  }
258
307
  function isBackgroundableCategory(category) {
@@ -366,6 +415,28 @@ function extractTaskResultSenderIds(sessionId, steps, minStepExclusive, maxStepI
366
415
  }
367
416
  return received;
368
417
  }
418
+ const RESTART_SYSTEM_MESSAGE_MARKER = "All your subagents and background tasks have been stopped due to server restart";
419
+ function findTrailingSettledReply(steps, minStepExclusive) {
420
+ for (let index = steps.length - 1; index >= 0; index -= 1) {
421
+ const step = steps[index];
422
+ if (step === undefined || step.step_index <= minStepExclusive) {
423
+ break;
424
+ }
425
+ if (step.type === "USER_INPUT") {
426
+ return null;
427
+ }
428
+ if (step.type === "SYSTEM_MESSAGE" && !(step.content?.includes(RESTART_SYSTEM_MESSAGE_MARKER) ?? false)) {
429
+ return null;
430
+ }
431
+ if (step.type === "PLANNER_RESPONSE") {
432
+ if (step.status === "DONE" && (step.tool_calls === undefined || step.tool_calls.length === 0)) {
433
+ return { content: step.content, stepIndex: step.step_index };
434
+ }
435
+ return null;
436
+ }
437
+ }
438
+ return null;
439
+ }
369
440
  function backgroundKindFor(category) {
370
441
  switch (category) {
371
442
  case "command":
@@ -376,6 +447,8 @@ function backgroundKindFor(category) {
376
447
  case "workflow":
377
448
  return "other";
378
449
  case "manage-subagents":
450
+ case "manage-task":
451
+ case "swarm":
379
452
  case null:
380
453
  return null;
381
454
  }
@@ -415,6 +488,8 @@ function isWakeupChunkUpdateKind(updateKind) {
415
488
  export class AntigravityBackgroundWakeup {
416
489
  #emitMetaUpdate;
417
490
  #launchEnvironment;
491
+ #onOpenPromptTimeout;
492
+ #onOrphanShellPromptSettle;
418
493
  #timer;
419
494
  #sessions = new Map();
420
495
  #pendingRequests = new Map();
@@ -422,6 +497,8 @@ export class AntigravityBackgroundWakeup {
422
497
  constructor(options) {
423
498
  this.#emitMetaUpdate = options.emitMetaUpdate;
424
499
  this.#launchEnvironment = options.launchEnvironment;
500
+ this.#onOpenPromptTimeout = options.onOpenPromptTimeout;
501
+ this.#onOrphanShellPromptSettle = options.onOrphanShellPromptSettle;
425
502
  this.#timer = options.timer ?? systemTimer;
426
503
  }
427
504
  #ensureSession = (sessionId) => {
@@ -442,6 +519,7 @@ export class AntigravityBackgroundWakeup {
442
519
  backgroundTasks: new Map(),
443
520
  baselineStepIndex: -1,
444
521
  lastEmittedBackgroundKey: "[]",
522
+ openNonShellToolIds: new Set(),
445
523
  phase: { cancelRequested: false, kind: "idle" },
446
524
  sessionOpenStepIndex: -1,
447
525
  subagents: {
@@ -458,10 +536,416 @@ export class AntigravityBackgroundWakeup {
458
536
  wakeupSettledStepIndex: null,
459
537
  wakeupStageSeq: 0,
460
538
  wakeupStreamedMessageText: "",
539
+ watchdog: null,
540
+ watchdogSeq: 0,
461
541
  };
462
542
  this.#sessions.set(sessionId, created);
463
543
  return created;
464
544
  };
545
+ #cancelWatchdog = (session) => {
546
+ if (session.watchdog !== null) {
547
+ session.watchdog.task.cancel();
548
+ session.watchdog = null;
549
+ }
550
+ session.watchdogSeq += 1;
551
+ };
552
+ #isShellOnlyBackground = (session) => {
553
+ if (session.backgroundTasks.size === 0) {
554
+ return false;
555
+ }
556
+ for (const task of session.backgroundTasks.values()) {
557
+ if (task.kind !== "shell" || task.state !== "running") {
558
+ return false;
559
+ }
560
+ }
561
+ return true;
562
+ };
563
+ #activeShellNativeTaskIds = (session) => {
564
+ const ids = [];
565
+ for (const [toolCallId, task] of session.backgroundTasks) {
566
+ if (task.kind !== "shell") {
567
+ continue;
568
+ }
569
+ const nativeTaskId = session.backgroundCorrelation.nativeTaskIdByToolCallId.get(toolCallId);
570
+ if (nativeTaskId !== undefined) {
571
+ ids.push(nativeTaskId);
572
+ }
573
+ }
574
+ return ids;
575
+ };
576
+ #killBackgroundTaskByNativeId = (session, killTaskId) => {
577
+ const mappedToolCallId = session.backgroundCorrelation.toolCallIdByNativeTaskId.get(killTaskId);
578
+ if (mappedToolCallId !== undefined && session.backgroundTasks.has(mappedToolCallId)) {
579
+ this.#deleteBackgroundTask(session, mappedToolCallId);
580
+ return true;
581
+ }
582
+ if (session.backgroundTasks.has(killTaskId)) {
583
+ this.#deleteBackgroundTask(session, killTaskId);
584
+ return true;
585
+ }
586
+ return false;
587
+ };
588
+ #reconcileStructuredArtifacts = async (sessionId, session, lastTranscriptStep, clearCompletedBackground) => {
589
+ const geminiHome = resolveGeminiHome(this.#launchEnvironment);
590
+ const snapshot = await readAntigravitySubagentSnapshot(geminiHome, sessionId);
591
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
592
+ return false;
593
+ }
594
+ for (const [toolCallId, childId] of snapshot.conversationIdByToolCallId) {
595
+ if (session.backgroundTasks.has(toolCallId)) {
596
+ session.subagents.conversationIdByToolCallId.set(toolCallId, childId);
597
+ const pendingIndex = session.subagents.pendingToolCallIds.indexOf(toolCallId);
598
+ if (pendingIndex !== -1) {
599
+ session.subagents.pendingToolCallIds.splice(pendingIndex, 1);
600
+ }
601
+ }
602
+ }
603
+ for (const nativeTaskId of snapshot.deliveredNativeTaskIds) {
604
+ session.backgroundCorrelation.deliveredNativeTaskIds.add(nativeTaskId);
605
+ }
606
+ if (!clearCompletedBackground) {
607
+ return true;
608
+ }
609
+ for (const [toolCallId, task] of [...session.backgroundTasks.entries()]) {
610
+ if (task.kind === "subagent") {
611
+ const childId = session.subagents.conversationIdByToolCallId.get(toolCallId);
612
+ if (childId !== undefined && snapshot.resolvedChildIds.has(childId)) {
613
+ this.#deleteSubagentTask(session, toolCallId);
614
+ }
615
+ continue;
616
+ }
617
+ const nativeTaskId = session.backgroundCorrelation.nativeTaskIdByToolCallId.get(toolCallId);
618
+ if (snapshot.deliveredToolCallIds.has(toolCallId) ||
619
+ (nativeTaskId !== undefined && snapshot.deliveredNativeTaskIds.has(nativeTaskId))) {
620
+ this.#deleteBackgroundTask(session, toolCallId);
621
+ }
622
+ }
623
+ if (snapshot.available && snapshot.activeChildIds.size === 0 && this.#hasSubagentTasks(session)) {
624
+ const pendingReply = await readAntigravityPendingReply(geminiHome, sessionId, lastTranscriptStep);
625
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
626
+ return false;
627
+ }
628
+ if (!pendingReply) {
629
+ this.#deleteAllSubagentTasks(session);
630
+ }
631
+ }
632
+ return true;
633
+ };
634
+ #inspectPostReplyShellState = async (sessionId, session) => {
635
+ if (session.activeInteractions > 0 ||
636
+ session.openNonShellToolIds.size > 0 ||
637
+ !this.#isShellOnlyBackground(session)) {
638
+ return { kind: "not-applicable" };
639
+ }
640
+ if (session.phase.kind === "client-prompt" && session.phase.cancelled) {
641
+ return { kind: "not-applicable" };
642
+ }
643
+ if (session.phase.kind === "idle" && session.phase.cancelRequested) {
644
+ return { kind: "not-applicable" };
645
+ }
646
+ if (session.phase.kind !== "client-prompt" && session.phase.kind !== "idle") {
647
+ return { kind: "not-applicable" };
648
+ }
649
+ const prePromptStepIndex = session.phase.kind === "client-prompt" ? session.phase.prePromptStepIndex : session.baselineStepIndex;
650
+ const tail = await readTranscriptTailState(this.#launchEnvironment, sessionId, prePromptStepIndex);
651
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
652
+ return { kind: "not-applicable" };
653
+ }
654
+ if (tail !== null) {
655
+ this.#syncBackgroundTaskCreations(sessionId, session, tail.steps);
656
+ }
657
+ if (session.phase.kind === "client-prompt") {
658
+ if (tail === null || findTrailingSettledReply(tail.steps, session.phase.prePromptStepIndex) === null) {
659
+ return { kind: "not-applicable" };
660
+ }
661
+ }
662
+ const geminiHome = resolveGeminiHome(this.#launchEnvironment);
663
+ const snapshot = await readAntigravitySubagentSnapshot(geminiHome, sessionId);
664
+ if (this.#disposed || this.#sessions.get(sessionId) !== session || snapshot.activeChildIds.size > 0) {
665
+ return { kind: "not-applicable" };
666
+ }
667
+ const pendingReply = await readAntigravityPendingReply(geminiHome, sessionId, tail?.steps.at(-1));
668
+ if (this.#disposed || this.#sessions.get(sessionId) !== session || pendingReply) {
669
+ return { kind: "not-applicable" };
670
+ }
671
+ const logSignature = await readAntigravityTaskLogSignature(geminiHome, sessionId, this.#activeShellNativeTaskIds(session));
672
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
673
+ return { kind: "not-applicable" };
674
+ }
675
+ return { kind: "shell-only-after-reply", logSignature };
676
+ };
677
+ #armClientPromptWatchdog = (sessionId, session) => {
678
+ this.#cancelWatchdog(session);
679
+ const epoch = session.watchdogSeq;
680
+ const scheduleNext = () => this.#timer.schedule(() => {
681
+ void this.#handleClientPromptWatchdogTick(sessionId, session, epoch);
682
+ }, WATCHDOG_SLICE_MS);
683
+ session.watchdog = {
684
+ epoch,
685
+ inactivitySlices: 0,
686
+ kind: "client-prompt",
687
+ lastLogSignature: null,
688
+ sawAcpActivity: false,
689
+ shellHoldSlices: 0,
690
+ silentShellSlices: 0,
691
+ task: scheduleNext(),
692
+ };
693
+ };
694
+ #syncIdleShellWatchdog = (sessionId, session) => {
695
+ const shouldArm = session.phase.kind === "idle" &&
696
+ !session.phase.cancelRequested &&
697
+ session.activeInteractions === 0 &&
698
+ this.#isShellOnlyBackground(session);
699
+ if (!shouldArm) {
700
+ if (session.watchdog?.kind === "idle-shell") {
701
+ this.#cancelWatchdog(session);
702
+ }
703
+ return;
704
+ }
705
+ if (session.watchdog?.kind === "idle-shell") {
706
+ return;
707
+ }
708
+ this.#cancelWatchdog(session);
709
+ const epoch = session.watchdogSeq;
710
+ session.watchdog = {
711
+ epoch,
712
+ kind: "idle-shell",
713
+ lastLogSignature: null,
714
+ shellHoldSlices: 0,
715
+ silentShellSlices: 0,
716
+ task: this.#timer.schedule(() => {
717
+ void this.#handleIdleShellWatchdogTick(sessionId, session, epoch);
718
+ }, WATCHDOG_SLICE_MS),
719
+ };
720
+ };
721
+ #handleClientPromptWatchdogTick = async (sessionId, session, epoch) => {
722
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
723
+ return;
724
+ }
725
+ const handle = session.watchdog;
726
+ if (handle === null ||
727
+ handle.kind !== "client-prompt" ||
728
+ handle.epoch !== epoch ||
729
+ session.phase.kind !== "client-prompt" ||
730
+ session.phase.cancelled) {
731
+ return;
732
+ }
733
+ const reschedule = () => {
734
+ if (this.#disposed ||
735
+ this.#sessions.get(sessionId) !== session ||
736
+ session.watchdog !== handle ||
737
+ handle.epoch !== epoch ||
738
+ session.phase.kind !== "client-prompt" ||
739
+ session.phase.cancelled) {
740
+ return;
741
+ }
742
+ handle.task = this.#timer.schedule(() => {
743
+ void this.#handleClientPromptWatchdogTick(sessionId, session, epoch);
744
+ }, WATCHDOG_SLICE_MS);
745
+ };
746
+ const hadAcpActivity = handle.sawAcpActivity;
747
+ handle.sawAcpActivity = false;
748
+ if (session.activeInteractions > 0) {
749
+ handle.inactivitySlices = 0;
750
+ handle.silentShellSlices = 0;
751
+ reschedule();
752
+ return;
753
+ }
754
+ const shellState = await this.#inspectPostReplyShellState(sessionId, session);
755
+ if (this.#disposed ||
756
+ this.#sessions.get(sessionId) !== session ||
757
+ session.watchdog !== handle ||
758
+ handle.epoch !== epoch ||
759
+ session.phase.kind !== "client-prompt" ||
760
+ session.phase.cancelled) {
761
+ return;
762
+ }
763
+ if (shellState.kind === "shell-only-after-reply") {
764
+ handle.inactivitySlices = 0;
765
+ handle.shellHoldSlices += 1;
766
+ const logChanged = handle.lastLogSignature !== null && shellState.logSignature !== handle.lastLogSignature;
767
+ handle.lastLogSignature = shellState.logSignature;
768
+ if (hadAcpActivity || logChanged) {
769
+ handle.silentShellSlices = 0;
770
+ }
771
+ else {
772
+ handle.silentShellSlices += 1;
773
+ }
774
+ if (handle.silentShellSlices >= ORPHAN_SHELL_SILENCE_SLICES ||
775
+ handle.shellHoldSlices >= ORPHAN_SHELL_MAX_HOLD_SLICES) {
776
+ this.#cancelWatchdog(session);
777
+ this.#onOrphanShellPromptSettle?.(sessionId);
778
+ return;
779
+ }
780
+ reschedule();
781
+ return;
782
+ }
783
+ handle.shellHoldSlices = 0;
784
+ handle.silentShellSlices = 0;
785
+ handle.lastLogSignature = null;
786
+ if (!hadAcpActivity &&
787
+ session.openNonShellToolIds.size === 0 &&
788
+ session.backgroundTasks.size === 0 &&
789
+ session.activeInteractions === 0) {
790
+ handle.inactivitySlices += 1;
791
+ if (handle.inactivitySlices >= OPEN_PROMPT_INACTIVITY_SLICES) {
792
+ const geminiHome = resolveGeminiHome(this.#launchEnvironment);
793
+ const snapshot = await readAntigravitySubagentSnapshot(geminiHome, sessionId);
794
+ if (this.#disposed ||
795
+ this.#sessions.get(sessionId) !== session ||
796
+ session.watchdog !== handle ||
797
+ handle.epoch !== epoch ||
798
+ session.phase.kind !== "client-prompt" ||
799
+ session.phase.cancelled) {
800
+ return;
801
+ }
802
+ if (snapshot.activeChildIds.size > 0) {
803
+ handle.inactivitySlices = 0;
804
+ reschedule();
805
+ return;
806
+ }
807
+ const prePromptStepIndex = session.phase.prePromptStepIndex;
808
+ const tail = await readTranscriptTailState(this.#launchEnvironment, sessionId, prePromptStepIndex);
809
+ const pendingReply = await readAntigravityPendingReply(geminiHome, sessionId, tail?.steps.at(-1));
810
+ if (this.#disposed ||
811
+ this.#sessions.get(sessionId) !== session ||
812
+ session.watchdog !== handle ||
813
+ handle.epoch !== epoch ||
814
+ session.phase.kind !== "client-prompt" ||
815
+ session.phase.cancelled) {
816
+ return;
817
+ }
818
+ if (tail !== null &&
819
+ findTrailingSettledReply(tail.steps, prePromptStepIndex) !== null &&
820
+ !pendingReply) {
821
+ this.#cancelWatchdog(session);
822
+ this.#onOpenPromptTimeout?.(sessionId, { kind: "settled" });
823
+ return;
824
+ }
825
+ const recordedError = await readAntigravityConversationTerminalError(geminiHome, sessionId);
826
+ if (this.#disposed ||
827
+ this.#sessions.get(sessionId) !== session ||
828
+ session.watchdog !== handle ||
829
+ handle.epoch !== epoch ||
830
+ session.phase.kind !== "client-prompt" ||
831
+ session.phase.cancelled) {
832
+ return;
833
+ }
834
+ this.#cancelWatchdog(session);
835
+ this.#onOpenPromptTimeout?.(sessionId, {
836
+ kind: "failed",
837
+ message: recordedError ?? "Antigravity stopped responding during the turn",
838
+ });
839
+ return;
840
+ }
841
+ }
842
+ else {
843
+ handle.inactivitySlices = 0;
844
+ }
845
+ reschedule();
846
+ };
847
+ #handleIdleShellWatchdogTick = async (sessionId, session, epoch) => {
848
+ if (this.#disposed || this.#sessions.get(sessionId) !== session) {
849
+ return;
850
+ }
851
+ const handle = session.watchdog;
852
+ if (handle === null ||
853
+ handle.kind !== "idle-shell" ||
854
+ handle.epoch !== epoch ||
855
+ session.phase.kind !== "idle" ||
856
+ session.phase.cancelRequested) {
857
+ return;
858
+ }
859
+ const reschedule = () => {
860
+ if (this.#disposed ||
861
+ this.#sessions.get(sessionId) !== session ||
862
+ session.watchdog !== handle ||
863
+ handle.epoch !== epoch ||
864
+ session.phase.kind !== "idle" ||
865
+ session.phase.cancelRequested) {
866
+ return;
867
+ }
868
+ handle.task = this.#timer.schedule(() => {
869
+ void this.#handleIdleShellWatchdogTick(sessionId, session, epoch);
870
+ }, WATCHDOG_SLICE_MS);
871
+ };
872
+ const shellState = await this.#inspectPostReplyShellState(sessionId, session);
873
+ if (this.#disposed ||
874
+ this.#sessions.get(sessionId) !== session ||
875
+ session.watchdog !== handle ||
876
+ handle.epoch !== epoch ||
877
+ session.phase.kind !== "idle" ||
878
+ session.phase.cancelRequested) {
879
+ return;
880
+ }
881
+ if (shellState.kind !== "shell-only-after-reply") {
882
+ handle.silentShellSlices = 0;
883
+ reschedule();
884
+ return;
885
+ }
886
+ handle.shellHoldSlices += 1;
887
+ const logChanged = handle.lastLogSignature !== null && shellState.logSignature !== handle.lastLogSignature;
888
+ handle.lastLogSignature = shellState.logSignature;
889
+ if (logChanged) {
890
+ handle.silentShellSlices = 0;
891
+ }
892
+ else {
893
+ handle.silentShellSlices += 1;
894
+ }
895
+ if (handle.silentShellSlices >= ORPHAN_SHELL_SILENCE_SLICES ||
896
+ handle.shellHoldSlices >= ORPHAN_SHELL_MAX_HOLD_SLICES) {
897
+ this.#cancelWatchdog(session);
898
+ for (const [toolCallId, task] of [...session.backgroundTasks.entries()]) {
899
+ if (task.kind === "shell") {
900
+ this.#deleteBackgroundTask(session, toolCallId);
901
+ }
902
+ }
903
+ const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
904
+ if (bg !== null) {
905
+ this.#emitMetaUpdate(bg);
906
+ }
907
+ return;
908
+ }
909
+ reschedule();
910
+ };
911
+ /**
912
+ * Whether `sessionId` currently has an open client prompt whose final reply is already settled
913
+ * in the native transcript and is only kept open by non-daemon background shell command(s).
914
+ */
915
+ isReplyDoneWithOnlyShellTasks = async (sessionId) => {
916
+ if (this.#disposed) {
917
+ return false;
918
+ }
919
+ const session = this.#sessions.get(sessionId);
920
+ if (session === undefined || session.phase.kind !== "client-prompt" || session.phase.cancelled) {
921
+ return false;
922
+ }
923
+ return (await this.#inspectPostReplyShellState(sessionId, session)).kind === "shell-only-after-reply";
924
+ };
925
+ /**
926
+ * Transitions a client prompt that the proxy settled directly back to idle and clears its
927
+ * background tasks before the proxy answers the client's `session/prompt` request.
928
+ */
929
+ completeClientPromptByProxy = (sessionId) => {
930
+ if (this.#disposed) {
931
+ return null;
932
+ }
933
+ const session = this.#sessions.get(sessionId);
934
+ if (session === undefined) {
935
+ return null;
936
+ }
937
+ for (const [key, pending] of [...this.#pendingRequests.entries()]) {
938
+ if (pending.sessionId === sessionId && pending.kind === "prompt") {
939
+ this.#pendingRequests.delete(key);
940
+ }
941
+ }
942
+ this.#cancelWatchdog(session);
943
+ this.#cancelWakeupTimers(session.phase);
944
+ session.openNonShellToolIds.clear();
945
+ this.#clearAllBackgroundTasks(session);
946
+ session.phase = { cancelRequested: false, kind: "idle" };
947
+ return this.#takeBackgroundTasksUpdate(sessionId, session);
948
+ };
465
949
  #cancelWakeupTimers = (phase) => {
466
950
  if (phase.kind !== "wakeup") {
467
951
  return;
@@ -873,6 +1357,7 @@ export class AntigravityBackgroundWakeup {
873
1357
  };
874
1358
  };
875
1359
  #enterWakeup = (sessionId, session, taskIds) => {
1360
+ this.#cancelWatchdog(session);
876
1361
  const notifications = [];
877
1362
  const bgNotification = this.#takeBackgroundTasksUpdate(sessionId, session);
878
1363
  if (bgNotification !== null) {
@@ -909,6 +1394,7 @@ export class AntigravityBackgroundWakeup {
909
1394
  session.wakeupDeferredSettledStep = null;
910
1395
  session.wakeupStreamedMessageText = "";
911
1396
  this.#dropAwaitingResultTasks(session);
1397
+ this.#syncIdleShellWatchdog(sessionId, session);
912
1398
  const notifications = [];
913
1399
  const bgNotification = this.#takeBackgroundTasksUpdate(sessionId, session);
914
1400
  if (bgNotification !== null) {
@@ -931,6 +1417,7 @@ export class AntigravityBackgroundWakeup {
931
1417
  session.wakeupDeferredSettledStep = null;
932
1418
  session.wakeupStreamedMessageText = "";
933
1419
  this.#dropAwaitingResultTasks(session);
1420
+ this.#syncIdleShellWatchdog(sessionId, session);
934
1421
  const notifications = [];
935
1422
  const bgNotification = this.#takeBackgroundTasksUpdate(sessionId, session);
936
1423
  if (bgNotification !== null) {
@@ -1053,6 +1540,16 @@ export class AntigravityBackgroundWakeup {
1053
1540
  this.#consumeSubagentIdlesThrough(current, widerTail.steps, tail.settledStep.stepIndex);
1054
1541
  }
1055
1542
  }
1543
+ if (this.#hasSubagentTasks(current)) {
1544
+ const stillActive = await this.#reconcileStructuredArtifacts(sessionId, current, tail.steps.at(-1), true);
1545
+ if (!stillActive ||
1546
+ current.phase.kind !== "wakeup" ||
1547
+ current.phase.generation !== generation ||
1548
+ current.phase.stage.stageEpoch !== stageEpoch ||
1549
+ (current.phase.stage.kind !== "streaming" && current.phase.stage.kind !== "awaiting-output")) {
1550
+ return;
1551
+ }
1552
+ }
1056
1553
  this.#consumeSettledReplyText(current, tail.settledStep);
1057
1554
  if (this.#settleWakeupReply(sessionId, current, tail, tail.settledStep.stepIndex)) {
1058
1555
  this.#emitNotifications(this.#finishWakeup(sessionId, current, "end_turn", false));
@@ -1252,13 +1749,37 @@ export class AntigravityBackgroundWakeup {
1252
1749
  const meta = inspectToolMetadata(update, session.toolMetadata.get(toolCallId));
1253
1750
  session.toolMetadata.set(toolCallId, meta);
1254
1751
  if (meta.isDaemon) {
1752
+ session.openNonShellToolIds.delete(toolCallId);
1255
1753
  this.#deleteBackgroundTask(session, toolCallId);
1256
1754
  return;
1257
1755
  }
1756
+ const isShellTool = meta.category === "command";
1757
+ if (!isShellTool) {
1758
+ if (status === "in_progress" || status === "pending") {
1759
+ session.openNonShellToolIds.add(toolCallId);
1760
+ }
1761
+ else if (status === "completed" || status === "failed" || status === "cancelled") {
1762
+ session.openNonShellToolIds.delete(toolCallId);
1763
+ }
1764
+ }
1258
1765
  if (meta.category === "manage-subagents" && status === "completed") {
1259
1766
  await this.#killSubagentsByMetadata(sessionId, session, meta);
1260
1767
  return;
1261
1768
  }
1769
+ if (meta.category === "manage-task" && status === "completed" && meta.killTaskId !== undefined) {
1770
+ this.#killBackgroundTaskByNativeId(session, meta.killTaskId);
1771
+ return;
1772
+ }
1773
+ if (meta.category === "swarm") {
1774
+ if (!cancelled && meta.swarmAction === "add" && status === "completed") {
1775
+ this.#registerSubagentTask(session, toolCallId, meta.description);
1776
+ await this.#reconcileStructuredArtifacts(sessionId, session, undefined, false);
1777
+ }
1778
+ else if (meta.swarmAction === "kill" && status === "completed") {
1779
+ await this.#reconcileStructuredArtifacts(sessionId, session, undefined, true);
1780
+ }
1781
+ return;
1782
+ }
1262
1783
  if (meta.category === "subagent") {
1263
1784
  if (!cancelled && status === "completed") {
1264
1785
  this.#registerSubagentTask(session, toolCallId, meta.description);
@@ -1388,6 +1909,37 @@ export class AntigravityBackgroundWakeup {
1388
1909
  notifications.push(bg);
1389
1910
  }
1390
1911
  }
1912
+ else if (meta.category === "manage-task" && status === "completed" && meta.killTaskId !== undefined) {
1913
+ if (this.#killBackgroundTaskByNativeId(session, meta.killTaskId)) {
1914
+ const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
1915
+ if (bg !== null) {
1916
+ notifications.push(bg);
1917
+ }
1918
+ }
1919
+ }
1920
+ else if (meta.category === "swarm" && status === "completed") {
1921
+ if (meta.swarmAction === "add") {
1922
+ this.#registerSubagentTask(session, toolCallId, meta.description);
1923
+ const active = await this.#reconcileStructuredArtifacts(sessionId, session, undefined, false);
1924
+ if (!active) {
1925
+ return;
1926
+ }
1927
+ const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
1928
+ if (bg !== null) {
1929
+ notifications.push(bg);
1930
+ }
1931
+ }
1932
+ else if (meta.swarmAction === "kill") {
1933
+ const active = await this.#reconcileStructuredArtifacts(sessionId, session, undefined, true);
1934
+ if (!active) {
1935
+ return;
1936
+ }
1937
+ const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
1938
+ if (bg !== null) {
1939
+ notifications.push(bg);
1940
+ }
1941
+ }
1942
+ }
1391
1943
  this.#pauseOrResumeWakeupTimers(sessionId, session);
1392
1944
  }
1393
1945
  };
@@ -1404,7 +1956,9 @@ export class AntigravityBackgroundWakeup {
1404
1956
  return;
1405
1957
  }
1406
1958
  const session = this.#ensureSession(sessionId);
1959
+ this.#cancelWatchdog(session);
1407
1960
  this.#cancelWakeupTimers(session.phase);
1961
+ session.openNonShellToolIds.clear();
1408
1962
  session.phase = { kind: "loading", requestKey: key };
1409
1963
  if (key !== undefined) {
1410
1964
  this.#pendingRequests.set(key, { kind: "load", sessionId });
@@ -1423,6 +1977,8 @@ export class AntigravityBackgroundWakeup {
1423
1977
  return;
1424
1978
  }
1425
1979
  const session = this.#ensureSession(sessionId);
1980
+ this.#cancelWatchdog(session);
1981
+ session.openNonShellToolIds.clear();
1426
1982
  if (session.phase.kind === "wakeup") {
1427
1983
  this.#emitNotifications(this.#finishWakeup(sessionId, session, "end_turn", false));
1428
1984
  }
@@ -1435,6 +1991,7 @@ export class AntigravityBackgroundWakeup {
1435
1991
  prePromptStepIndex,
1436
1992
  requestKey: key,
1437
1993
  };
1994
+ this.#armClientPromptWatchdog(sessionId, session);
1438
1995
  if (key !== undefined) {
1439
1996
  this.#pendingRequests.set(key, { kind: "prompt", sessionId });
1440
1997
  }
@@ -1522,10 +2079,21 @@ export class AntigravityBackgroundWakeup {
1522
2079
  }
1523
2080
  }
1524
2081
  }
2082
+ this.#cancelWatchdog(session);
2083
+ session.openNonShellToolIds.clear();
2084
+ if (!promptCancelled && session.backgroundTasks.size > 0) {
2085
+ await this.#reconcileStructuredArtifacts(tracked.sessionId, session, tail?.steps.at(-1), true);
2086
+ promptCancelled =
2087
+ this.#disposed ||
2088
+ (session.phase.kind === "client-prompt" && session.phase.cancelled) ||
2089
+ (session.phase.kind === "idle" && session.phase.cancelRequested) ||
2090
+ responseStopReason === "cancelled";
2091
+ }
1525
2092
  if (promptCancelled) {
1526
2093
  this.#clearAllBackgroundTasks(session);
1527
2094
  }
1528
2095
  session.phase = { cancelRequested: promptCancelled, kind: "idle" };
2096
+ this.#syncIdleShellWatchdog(tracked.sessionId, session);
1529
2097
  const bg = this.#takeBackgroundTasksUpdate(tracked.sessionId, session);
1530
2098
  const rewritePromptCancelled = promptCancelled &&
1531
2099
  "result" in message &&
@@ -1559,6 +2127,9 @@ export class AntigravityBackgroundWakeup {
1559
2127
  case "loading":
1560
2128
  return EMPTY_INCOMING_OUTCOME;
1561
2129
  case "client-prompt": {
2130
+ if (session.watchdog?.kind === "client-prompt") {
2131
+ session.watchdog.sawAcpActivity = true;
2132
+ }
1562
2133
  if (updateKind === "tool_call" || updateKind === "tool_call_update") {
1563
2134
  await this.#applyClientPromptToolUpdate(sessionId, session, update, session.phase.cancelled);
1564
2135
  }
@@ -1578,6 +2149,7 @@ export class AntigravityBackgroundWakeup {
1578
2149
  else {
1579
2150
  this.#deleteBackgroundTask(session, toolCallId);
1580
2151
  }
2152
+ this.#syncIdleShellWatchdog(sessionId, session);
1581
2153
  const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
1582
2154
  return bg === null ? EMPTY_INCOMING_OUTCOME : { afterUpdates: [bg], beforeUpdates: [] };
1583
2155
  }
@@ -1589,6 +2161,7 @@ export class AntigravityBackgroundWakeup {
1589
2161
  else {
1590
2162
  this.#deleteBackgroundTask(session, toolCallId);
1591
2163
  }
2164
+ this.#syncIdleShellWatchdog(sessionId, session);
1592
2165
  const bg = this.#takeBackgroundTasksUpdate(sessionId, session);
1593
2166
  return bg === null
1594
2167
  ? EMPTY_INCOMING_OUTCOME
@@ -1672,6 +2245,18 @@ export class AntigravityBackgroundWakeup {
1672
2245
  if (session.phase.openToolIds.size === 0 && session.activeInteractions === 0) {
1673
2246
  this.#setWakeupStreaming(sessionId, session, session.phase.generation, session.phase.openToolIds, executorError);
1674
2247
  }
2248
+ return;
2249
+ }
2250
+ if (updateKind === "usage_update" &&
2251
+ session.phase.openToolIds.size === 0 &&
2252
+ session.activeInteractions === 0 &&
2253
+ (session.phase.stage.kind === "streaming" || session.phase.stage.kind === "awaiting-output")) {
2254
+ session.phase.stage.transcriptCheck.cancel();
2255
+ const nextCheck = this.#scheduleTranscriptPoll(sessionId, session.phase.generation, session.phase.stage.stageEpoch, TRANSCRIPT_INITIAL_DELAY_MS);
2256
+ session.phase = {
2257
+ ...session.phase,
2258
+ stage: { ...session.phase.stage, transcriptCheck: nextCheck },
2259
+ };
1675
2260
  }
1676
2261
  };
1677
2262
  beginInteraction = (sessionId) => {
@@ -1680,6 +2265,9 @@ export class AntigravityBackgroundWakeup {
1680
2265
  }
1681
2266
  const session = this.#ensureSession(sessionId);
1682
2267
  session.activeInteractions += 1;
2268
+ if (session.watchdog?.kind === "idle-shell") {
2269
+ this.#cancelWatchdog(session);
2270
+ }
1683
2271
  this.#pauseOrResumeWakeupTimers(sessionId, session);
1684
2272
  };
1685
2273
  endInteraction = (sessionId) => {
@@ -1691,6 +2279,7 @@ export class AntigravityBackgroundWakeup {
1691
2279
  return;
1692
2280
  }
1693
2281
  session.activeInteractions = Math.max(0, session.activeInteractions - 1);
2282
+ this.#syncIdleShellWatchdog(sessionId, session);
1694
2283
  this.#pauseOrResumeWakeupTimers(sessionId, session);
1695
2284
  };
1696
2285
  cancelSession = (sessionId) => {
@@ -1698,6 +2287,7 @@ export class AntigravityBackgroundWakeup {
1698
2287
  return "retain";
1699
2288
  }
1700
2289
  const session = this.#ensureSession(sessionId);
2290
+ this.#cancelWatchdog(session);
1701
2291
  const mustClose = session.phase.kind === "wakeup" || this.#hasSubagentTasks(session);
1702
2292
  if (mustClose) {
1703
2293
  // Process teardown in AgentSession.#endAgentWork owns emitting terminal
@@ -1724,6 +2314,7 @@ export class AntigravityBackgroundWakeup {
1724
2314
  }
1725
2315
  for (const [sessionId, session] of this.#sessions) {
1726
2316
  const wasWakeup = session.phase.kind === "wakeup";
2317
+ this.#cancelWatchdog(session);
1727
2318
  this.#cancelWakeupTimers(session.phase);
1728
2319
  this.#clearAllBackgroundTasks(session);
1729
2320
  if (wasWakeup) {
@@ -1748,6 +2339,7 @@ export class AntigravityBackgroundWakeup {
1748
2339
  }
1749
2340
  this.#disposed = true;
1750
2341
  for (const session of this.#sessions.values()) {
2342
+ this.#cancelWatchdog(session);
1751
2343
  this.#cancelWakeupTimers(session.phase);
1752
2344
  }
1753
2345
  this.#sessions.clear();