@ashx-j/lunr 0.2.22 → 0.2.23

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 (132) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/README.md +5 -3
  3. package/dist/builtin-extensions/lunr-browser.d.ts +7 -1
  4. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -1
  5. package/dist/builtin-extensions/lunr-browser.js +116 -3
  6. package/dist/builtin-extensions/lunr-browser.js.map +1 -1
  7. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +1 -1
  9. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  10. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +2 -0
  11. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  12. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +9 -0
  13. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  14. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +41 -3
  16. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  17. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  18. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +4 -0
  19. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  20. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +1 -1
  21. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +3 -2
  23. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -1
  24. package/dist/core/agent-session.d.ts +19 -0
  25. package/dist/core/agent-session.d.ts.map +1 -1
  26. package/dist/core/agent-session.js +230 -103
  27. package/dist/core/agent-session.js.map +1 -1
  28. package/dist/core/settings-manager.d.ts +4 -0
  29. package/dist/core/settings-manager.d.ts.map +1 -1
  30. package/dist/core/settings-manager.js +9 -0
  31. package/dist/core/settings-manager.js.map +1 -1
  32. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  33. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  34. package/dist/core/subagent-wait-interruption.js +19 -0
  35. package/dist/core/subagent-wait-interruption.js.map +1 -0
  36. package/dist/core/system-prompt.d.ts.map +1 -1
  37. package/dist/core/system-prompt.js +3 -1
  38. package/dist/core/system-prompt.js.map +1 -1
  39. package/dist/core/tools/render-utils.d.ts +3 -3
  40. package/dist/core/tools/render-utils.d.ts.map +1 -1
  41. package/dist/core/tools/render-utils.js +3 -3
  42. package/dist/core/tools/render-utils.js.map +1 -1
  43. package/dist/modes/interactive/components/assistant-message.d.ts +10 -2
  44. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  45. package/dist/modes/interactive/components/assistant-message.js +29 -5
  46. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  47. package/dist/modes/interactive/components/copyable-text.d.ts +2 -6
  48. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -1
  49. package/dist/modes/interactive/components/copyable-text.js +26 -35
  50. package/dist/modes/interactive/components/copyable-text.js.map +1 -1
  51. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  52. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  53. package/dist/modes/interactive/components/settings-selector.js +13 -0
  54. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  55. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  56. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  57. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  58. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  59. package/dist/modes/interactive/components/tool-execution.d.ts +4 -3
  60. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  61. package/dist/modes/interactive/components/tool-execution.js +34 -45
  62. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  63. package/dist/modes/interactive/interactive-mode.d.ts +6 -0
  64. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  65. package/dist/modes/interactive/interactive-mode.js +118 -39
  66. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  67. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  68. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  69. package/dist/modes/interactive/theme/theme.js +23 -0
  70. package/dist/modes/interactive/theme/theme.js.map +1 -1
  71. package/dist/node-runtime/{agent-session-services-NQ6GKOIK.js → agent-session-services-GZVSOGYR.js} +7 -7
  72. package/dist/node-runtime/{builtin-extensions-GVC6IFDU.js → builtin-extensions-QVCXNQT4.js} +3 -3
  73. package/dist/node-runtime/{chunk-6B2POMK7.js → chunk-6VYZ5UFP.js} +1 -1
  74. package/dist/node-runtime/{chunk-VJPTNWAP.js → chunk-DD5YWFSJ.js} +1 -1
  75. package/dist/node-runtime/{chunk-TDL7UWJ7.js → chunk-DQMGU675.js} +173 -57
  76. package/dist/node-runtime/{chunk-V2A7CEXK.js → chunk-EKVFP6YF.js} +2 -2
  77. package/dist/node-runtime/{chunk-5BNJ4JUH.js → chunk-GJ2RDBRL.js} +1 -1
  78. package/dist/node-runtime/{chunk-GNN7H3B7.js → chunk-GS42T6MX.js} +1 -1
  79. package/dist/node-runtime/{chunk-PC2Z5TKZ.js → chunk-HMBGROQK.js} +3 -3
  80. package/dist/node-runtime/{chunk-GJSAD4AB.js → chunk-HPUP7E4T.js} +10 -10
  81. package/dist/node-runtime/{chunk-IVXYUAJE.js → chunk-IF24A3FH.js} +1 -1
  82. package/dist/node-runtime/{chunk-BFNXONG3.js → chunk-LFZDVKSP.js} +2 -2
  83. package/dist/node-runtime/{chunk-EQ63ANHL.js → chunk-LLUIPGDR.js} +210 -125
  84. package/dist/node-runtime/{chunk-ORH324EP.js → chunk-PCEW76PM.js} +3 -3
  85. package/dist/node-runtime/{chunk-WADV2VDS.js → chunk-QAZOULTU.js} +7 -0
  86. package/dist/node-runtime/{chunk-6427XAWG.js → chunk-QH6YL7VK.js} +3 -3
  87. package/dist/node-runtime/{chunk-7QWNYZDI.js → chunk-RDDAZOMU.js} +16 -0
  88. package/dist/node-runtime/{chunk-QDGKKKUM.js → chunk-RIR5EDDJ.js} +1 -1
  89. package/dist/node-runtime/{chunk-H3XF4UVQ.js → chunk-RWTKOC3B.js} +1 -1
  90. package/dist/node-runtime/{chunk-IQIEU7SB.js → chunk-TVJUOJZJ.js} +2 -2
  91. package/dist/node-runtime/{chunk-UAFLNHSH.js → chunk-W64JC4E7.js} +8 -8
  92. package/dist/node-runtime/{chunk-LMBNLFXQ.js → chunk-X3URCYCU.js} +4 -4
  93. package/dist/node-runtime/{chunk-VSSXXL36.js → chunk-YDO2F2IA.js} +2 -2
  94. package/dist/node-runtime/{chunk-IWOWXRWU.js → chunk-YHQ3NBB3.js} +15 -15
  95. package/dist/node-runtime/cli-runtime.js +1 -1
  96. package/dist/node-runtime/{command-3JHHXOPX.js → command-PDVTBRWA.js} +3 -3
  97. package/dist/node-runtime/{commands-2JVNFGMQ.js → commands-XDCFGIGW.js} +5 -5
  98. package/dist/node-runtime/{export-html-KBFVV63J.js → export-html-KSOIMVPI.js} +1 -1
  99. package/dist/node-runtime/{extension-input-K24TVKVW.js → extension-input-E7BJZ35H.js} +4 -4
  100. package/dist/node-runtime/{extension-selector-SPNF7EDR.js → extension-selector-WU42XDTU.js} +4 -4
  101. package/dist/node-runtime/{gateway-VFO6SFKK.js → gateway-AYWM5DIO.js} +7 -7
  102. package/dist/node-runtime/index.js +17 -17
  103. package/dist/node-runtime/{install-cli-C3CF7O7N.js → install-cli-3BO4MMQ6.js} +1 -1
  104. package/dist/node-runtime/{interactive-mode-LOM6AIF6.js → interactive-mode-4MFRKAHG.js} +13 -13
  105. package/dist/node-runtime/{interactive-view-IDSCPPK7.js → interactive-view-TUZHCQM3.js} +5 -5
  106. package/dist/node-runtime/{lunr-browser-YNW7FTYX.js → lunr-browser-RYFIIVJN.js} +91 -4
  107. package/dist/node-runtime/{lunr-cron-BKHGNBKT.js → lunr-cron-YWXEPZMQ.js} +4 -4
  108. package/dist/node-runtime/main.js +14 -14
  109. package/dist/node-runtime/{mobile-commands-HMP25WBC.js → mobile-commands-LVHDAUDP.js} +4 -4
  110. package/dist/node-runtime/{package-manager-cli-VCK4E2RC.js → package-manager-cli-6GT3Z3CK.js} +9 -9
  111. package/dist/node-runtime/{pi-subagents-FEUDLJOE.js → pi-subagents-CDWK2AKY.js} +44 -10
  112. package/dist/node-runtime/rpc-entry.js +14 -14
  113. package/dist/node-runtime/{rpc-mode-P5ODXPEG.js → rpc-mode-O3XV4SID.js} +2 -2
  114. package/dist/node-runtime/{session-selector-LHRMJOKT.js → session-selector-GIM4DHQ2.js} +4 -4
  115. package/dist/node-runtime/{settings-manager-UUZ6NUXI.js → settings-manager-6VEMXRDL.js} +1 -1
  116. package/dist/node-runtime/{setup-NRXVZBLJ.js → setup-5SR2J35A.js} +1 -1
  117. package/dist/node-runtime/{subagent-executor-MLUMBWCP.js → subagent-executor-M5VWB3D3.js} +8 -4
  118. package/dist/node-runtime/{theme-U7IGOA7O.js → theme-UOO5RVFN.js} +1 -1
  119. package/dist/node-runtime/{update-cli-4TP25CNW.js → update-cli-UVKJWRRJ.js} +1 -1
  120. package/docs/features.md +2 -0
  121. package/docs/settings.md +1 -0
  122. package/docs/usage.md +2 -2
  123. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  124. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  125. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  126. package/examples/extensions/gondolin/package-lock.json +2 -2
  127. package/examples/extensions/gondolin/package.json +1 -1
  128. package/examples/extensions/sandbox/package-lock.json +2 -2
  129. package/examples/extensions/sandbox/package.json +1 -1
  130. package/examples/extensions/with-deps/package-lock.json +2 -2
  131. package/examples/extensions/with-deps/package.json +1 -1
  132. package/package.json +4 -4
@@ -257,8 +257,10 @@ export class InteractiveMode {
257
257
  streamingTargetMessage = undefined;
258
258
  streamingDisplayedLength = 0;
259
259
  smoothStreamingTimer = undefined;
260
+ thinkingAnimationTimer;
260
261
  // Tool execution tracking: toolCallId -> component
261
262
  pendingTools = new Map();
263
+ browserActivityComponent;
262
264
  // Tool output expansion state
263
265
  toolOutputExpanded = false;
264
266
  // Thinking block visibility state
@@ -1386,7 +1388,7 @@ export class InteractiveMode {
1386
1388
  if (result.cancelled) {
1387
1389
  return { cancelled: true };
1388
1390
  }
1389
- this.chatContainer.clear();
1391
+ this.clearChatContainer();
1390
1392
  this.renderInitialMessages();
1391
1393
  if (result.editorText && !this.editor.getText().trim()) {
1392
1394
  this.restoreEditorFromTreeResult(result);
@@ -1505,7 +1507,7 @@ export class InteractiveMode {
1505
1507
  renderCurrentSessionState() {
1506
1508
  this.ui.setChatScroll(0);
1507
1509
  this.loadedResourcesContainer.clear();
1508
- this.chatContainer.clear();
1510
+ this.clearChatContainer();
1509
1511
  this.pendingMessagesContainer.clear();
1510
1512
  this.compactionQueuedMessages = [];
1511
1513
  this.pendingCompactionRender = undefined;
@@ -2687,15 +2689,30 @@ export class InteractiveMode {
2687
2689
  }
2688
2690
  return;
2689
2691
  }
2690
- // If streaming, use prompt() with steer behavior
2691
- // This handles extension commands (execute immediately), prompt template expansion, and queueing
2692
- if (this.session.isStreaming) {
2693
- this.editor.addToHistory?.(text);
2694
- this.editor.setText("");
2695
- await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images });
2696
- this.updatePendingMessagesDisplay();
2697
- this.ui.requestRender();
2698
- return;
2692
+ // While streaming or settling a wait handoff, reserve normal Enter for subagent_wait when possible.
2693
+ // Extension commands keep their existing path.
2694
+ if (this.session.isStreaming || this.session.isWaitPromptHandoffActive) {
2695
+ if (!this.isExtensionCommand(text)) {
2696
+ await this.awaitDeferredBuiltinsForPrompt();
2697
+ const handoff = await this.session.interruptSubagentWaitWithPrompt(text, { images });
2698
+ if (handoff) {
2699
+ this.editor.addToHistory?.(text);
2700
+ this.editor.setText("");
2701
+ void handoff.completion.catch((error) => {
2702
+ this.showError(error instanceof Error ? error.message : String(error));
2703
+ });
2704
+ this.ui.requestRender();
2705
+ return;
2706
+ }
2707
+ }
2708
+ if (this.session.isStreaming) {
2709
+ this.editor.addToHistory?.(text);
2710
+ this.editor.setText("");
2711
+ await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images });
2712
+ this.updatePendingMessagesDisplay();
2713
+ this.ui.requestRender();
2714
+ return;
2715
+ }
2699
2716
  }
2700
2717
  // Normal message submission
2701
2718
  // First, move any pending bash components to chat
@@ -2714,6 +2731,18 @@ export class InteractiveMode {
2714
2731
  getSmoothStreamingOptions() {
2715
2732
  return { hideThinking: this.hideThinkingBlock };
2716
2733
  }
2734
+ setThinkingAnimation(active) {
2735
+ if (!active) {
2736
+ if (this.thinkingAnimationTimer)
2737
+ clearInterval(this.thinkingAnimationTimer);
2738
+ this.thinkingAnimationTimer = undefined;
2739
+ return;
2740
+ }
2741
+ if (this.thinkingAnimationTimer)
2742
+ return;
2743
+ this.thinkingAnimationTimer = setInterval(() => this.ui.requestRender(), 33);
2744
+ this.thinkingAnimationTimer.unref?.();
2745
+ }
2717
2746
  clearSmoothStreamingTimer() {
2718
2747
  if (this.smoothStreamingTimer) {
2719
2748
  clearInterval(this.smoothStreamingTimer);
@@ -2754,12 +2783,9 @@ export class InteractiveMode {
2754
2783
  if (content.type !== "toolCall" || !revealedIds.has(content.id))
2755
2784
  continue;
2756
2785
  if (!this.pendingTools.has(content.id)) {
2757
- const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
2758
- showImages: this.settingsManager.getShowImages(),
2759
- imageWidthCells: this.settingsManager.getImageWidthCells(),
2760
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
2761
- component.setExpanded(this.toolOutputExpanded);
2762
- this.addToolComponentToChat(component);
2786
+ const component = content.name === "browser" && this.browserActivityComponent
2787
+ ? this.browserActivityComponent
2788
+ : this.createToolExecutionComponent(content.name, content.id, content.arguments);
2763
2789
  this.pendingTools.set(content.id, component);
2764
2790
  }
2765
2791
  else {
@@ -2794,6 +2820,7 @@ export class InteractiveMode {
2794
2820
  }
2795
2821
  }
2796
2822
  stopSmoothStreaming() {
2823
+ this.setThinkingAnimation(false);
2797
2824
  this.clearSmoothStreamingTimer();
2798
2825
  this.streamingTargetMessage = undefined;
2799
2826
  this.streamingDisplayedLength = 0;
@@ -2833,6 +2860,7 @@ export class InteractiveMode {
2833
2860
  switch (event.type) {
2834
2861
  case "agent_start":
2835
2862
  this.pendingTools.clear();
2863
+ this.browserActivityComponent = undefined;
2836
2864
  if (this.settingsManager.getShowTerminalProgress()) {
2837
2865
  this.ui.terminal.setProgress(true);
2838
2866
  }
@@ -2885,7 +2913,11 @@ export class InteractiveMode {
2885
2913
  this.ui.requestRender();
2886
2914
  }
2887
2915
  else if (event.message.role === "assistant") {
2888
- this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, { requestRender: () => this.ui.requestRender() });
2916
+ this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, {
2917
+ requestRender: () => this.ui.requestRender(),
2918
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
2919
+ onThinkingAnimationChange: (active) => this.setThinkingAnimation(active),
2920
+ });
2889
2921
  // lunr: collapsible reasoning — fresh timing array for this message.
2890
2922
  this.thinkingRunTimings = [];
2891
2923
  this.streamingComponent.setThinkingTimings(this.thinkingRunTimings);
@@ -2992,14 +3024,12 @@ export class InteractiveMode {
2992
3024
  }
2993
3025
  let component = this.pendingTools.get(event.toolCallId);
2994
3026
  if (!component) {
2995
- component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
2996
- showImages: this.settingsManager.getShowImages(),
2997
- imageWidthCells: this.settingsManager.getImageWidthCells(),
2998
- }, this.getRegisteredToolDefinition(event.toolName), this.ui, this.sessionManager.getCwd());
2999
- component.setExpanded(this.toolOutputExpanded);
3000
- this.addToolComponentToChat(component);
3027
+ component = this.createToolExecutionComponent(event.toolName, event.toolCallId, event.args);
3001
3028
  this.pendingTools.set(event.toolCallId, component);
3002
3029
  }
3030
+ else if (event.toolName === "browser" && !component.matchesToolCall(event.toolCallId)) {
3031
+ component.beginNextExecution(event.toolCallId, event.args);
3032
+ }
3003
3033
  component.markExecutionStarted();
3004
3034
  this.ui.requestRender();
3005
3035
  break;
@@ -3034,6 +3064,7 @@ export class InteractiveMode {
3034
3064
  this.streamingMessage = undefined;
3035
3065
  }
3036
3066
  this.pendingTools.clear();
3067
+ this.browserActivityComponent = undefined;
3037
3068
  this.maybeAutoNameSession();
3038
3069
  // lunr: capture tree-scope changes at turn boundary (bash side-effects).
3039
3070
  captureTreeChanges(this.sessionManager.getCwd(), this.sessionManager.getSessionId());
@@ -3252,7 +3283,10 @@ export class InteractiveMode {
3252
3283
  break;
3253
3284
  }
3254
3285
  case "assistant": {
3255
- const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, { requestRender: () => this.ui.requestRender() });
3286
+ const assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, {
3287
+ requestRender: () => this.ui.requestRender(),
3288
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
3289
+ });
3256
3290
  // lunr: collapsible reasoning — re-attach live timings when this
3257
3291
  // message was streamed in this session (undefined = history).
3258
3292
  assistantComponent.setThinkingTimings(this.thinkingTimingsByMessage.get(message));
@@ -3272,6 +3306,7 @@ export class InteractiveMode {
3272
3306
  }
3273
3307
  renderSessionItems(items, options = {}) {
3274
3308
  this.pendingTools.clear();
3309
+ let browserActivityComponent;
3275
3310
  const renderedPendingTools = new Map();
3276
3311
  // Cache-miss notices are not persisted; re-derive them from the full entry
3277
3312
  // list and re-inject them after the assistant messages that paid for them.
@@ -3294,12 +3329,20 @@ export class InteractiveMode {
3294
3329
  // Render tool call components
3295
3330
  for (const content of message.content) {
3296
3331
  if (content.type === "toolCall") {
3297
- const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
3298
- showImages: this.settingsManager.getShowImages(),
3299
- imageWidthCells: this.settingsManager.getImageWidthCells(),
3300
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
3301
- component.setExpanded(this.toolOutputExpanded);
3302
- this.addToolComponentToChat(component);
3332
+ let component = content.name === "browser" ? browserActivityComponent : undefined;
3333
+ if (component) {
3334
+ component.beginNextExecution(content.id, content.arguments);
3335
+ }
3336
+ else {
3337
+ component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
3338
+ showImages: this.settingsManager.getShowImages(),
3339
+ imageWidthCells: this.settingsManager.getImageWidthCells(),
3340
+ }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
3341
+ component.setExpanded(this.toolOutputExpanded);
3342
+ this.addToolComponentToChat(component);
3343
+ if (content.name === "browser")
3344
+ browserActivityComponent = component;
3345
+ }
3303
3346
  if (message.stopReason === "aborted" || message.stopReason === "error") {
3304
3347
  let errorMessage;
3305
3348
  if (message.stopReason === "aborted") {
@@ -3334,6 +3377,8 @@ export class InteractiveMode {
3334
3377
  }
3335
3378
  }
3336
3379
  else {
3380
+ if (message.role === "user")
3381
+ browserActivityComponent = undefined;
3337
3382
  // All other messages use standard rendering
3338
3383
  this.addMessageToChat(message, options);
3339
3384
  }
@@ -3424,7 +3469,7 @@ export class InteractiveMode {
3424
3469
  });
3425
3470
  }
3426
3471
  rebuildChatFromMessages() {
3427
- this.chatContainer.clear();
3472
+ this.clearChatContainer();
3428
3473
  this.renderSessionEntries(this.sessionManager.buildContextEntries());
3429
3474
  }
3430
3475
  // =========================================================================
@@ -3755,6 +3800,32 @@ export class InteractiveMode {
3755
3800
  globalThis[Symbol.for("@lunr/tools-expanded-changed")]?.(expanded);
3756
3801
  this.ui.requestRender();
3757
3802
  }
3803
+ createToolExecutionComponent(toolName, toolCallId, args) {
3804
+ if (toolName === "browser" && this.browserActivityComponent) {
3805
+ this.browserActivityComponent.beginNextExecution(toolCallId, args);
3806
+ return this.browserActivityComponent;
3807
+ }
3808
+ const component = new ToolExecutionComponent(toolName, toolCallId, args, {
3809
+ showImages: this.settingsManager.getShowImages(),
3810
+ imageWidthCells: this.settingsManager.getImageWidthCells(),
3811
+ }, this.getRegisteredToolDefinition(toolName), this.ui, this.sessionManager.getCwd());
3812
+ component.setExpanded(this.toolOutputExpanded);
3813
+ this.addToolComponentToChat(component);
3814
+ if (toolName === "browser")
3815
+ this.browserActivityComponent = component;
3816
+ return component;
3817
+ }
3818
+ disposeChatToolComponents() {
3819
+ for (const child of this.chatContainer.children) {
3820
+ if (child instanceof ToolExecutionComponent)
3821
+ child.dispose();
3822
+ }
3823
+ this.browserActivityComponent = undefined;
3824
+ }
3825
+ clearChatContainer() {
3826
+ this.disposeChatToolComponents();
3827
+ this.chatContainer.clear();
3828
+ }
3758
3829
  // lunr: consecutive same-tool grouping — a tool component appended right after
3759
3830
  // another component for the SAME tool becomes a group continuation (no top
3760
3831
  // spacer / top pad); the previous card drops its bottom pad. Mixed neighbors
@@ -3768,7 +3839,6 @@ export class InteractiveMode {
3768
3839
  this.hideThinkingBlock = !this.hideThinkingBlock;
3769
3840
  this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);
3770
3841
  // Rebuild chat from session messages
3771
- this.chatContainer.clear();
3772
3842
  this.rebuildChatFromMessages();
3773
3843
  // If streaming, re-add the streaming component with updated visibility and re-render.
3774
3844
  // Re-slice to the current revealed length so hide-thinking does not dump the tail.
@@ -3946,7 +4016,6 @@ export class InteractiveMode {
3946
4016
  return !!extensionRunner.getCommand(commandName);
3947
4017
  }
3948
4018
  renderCompactionResult(result) {
3949
- this.chatContainer.clear();
3950
4019
  this.rebuildChatFromMessages();
3951
4020
  this.addMessageToChat(createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString()));
3952
4021
  this.footer.invalidate();
@@ -4072,6 +4141,7 @@ export class InteractiveMode {
4072
4141
  availableThemes: getAvailableThemes(),
4073
4142
  hideThinkingBlock: this.hideThinkingBlock,
4074
4143
  thinkingCollapse: this.thinkingCollapse,
4144
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
4075
4145
  cacheRetention: this.settingsManager.getCacheRetention() ?? "short",
4076
4146
  doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
4077
4147
  treeFilterMode: this.settingsManager.getTreeFilterMode(),
@@ -4185,7 +4255,6 @@ export class InteractiveMode {
4185
4255
  child.setHideThinkingBlock(hidden);
4186
4256
  }
4187
4257
  }
4188
- this.chatContainer.clear();
4189
4258
  this.rebuildChatFromMessages();
4190
4259
  },
4191
4260
  onThinkingCollapseChange: (collapse) => {
@@ -4196,9 +4265,17 @@ export class InteractiveMode {
4196
4265
  child.setThinkingCollapse(collapse);
4197
4266
  }
4198
4267
  }
4199
- this.chatContainer.clear();
4200
4268
  this.rebuildChatFromMessages();
4201
4269
  },
4270
+ onReasoningDisplayChange: (display) => {
4271
+ this.settingsManager.setReasoningDisplay(display);
4272
+ for (const child of this.chatContainer.children) {
4273
+ if (child instanceof AssistantMessageComponent) {
4274
+ child.setReasoningDisplay(this.settingsManager.getReasoningDisplay());
4275
+ }
4276
+ }
4277
+ this.ui.requestRender();
4278
+ },
4202
4279
  onShowCacheMissNoticesChange: (shown) => {
4203
4280
  this.settingsManager.setShowCacheMissNotices(shown);
4204
4281
  this.rebuildChatFromMessages();
@@ -4935,7 +5012,7 @@ export class InteractiveMode {
4935
5012
  return;
4936
5013
  }
4937
5014
  // Update UI
4938
- this.chatContainer.clear();
5015
+ this.clearChatContainer();
4939
5016
  this.renderInitialMessages();
4940
5017
  if (result.editorText && !this.editor.getText().trim()) {
4941
5018
  this.restoreEditorFromTreeResult(result);
@@ -5795,7 +5872,7 @@ export class InteractiveMode {
5795
5872
  if (leafId) {
5796
5873
  this.redoStack.push(leafId);
5797
5874
  }
5798
- this.chatContainer.clear();
5875
+ this.clearChatContainer();
5799
5876
  this.renderInitialMessages();
5800
5877
  void this.flushCompactionQueue({ willRetry: false });
5801
5878
  return { editorText: result.editorText, editorImages: result.editorImages };
@@ -5838,7 +5915,7 @@ export class InteractiveMode {
5838
5915
  this.showStatus("Navigation cancelled");
5839
5916
  return;
5840
5917
  }
5841
- this.chatContainer.clear();
5918
+ this.clearChatContainer();
5842
5919
  this.renderInitialMessages();
5843
5920
  if (result.editorText && !this.editor.getText().trim()) {
5844
5921
  this.restoreEditorFromTreeResult(result);
@@ -6949,6 +7026,7 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
6949
7026
  }
6950
7027
  }
6951
7028
  stop() {
7029
+ this.setThinkingAnimation(false);
6952
7030
  this.stopCatalogRefresh?.();
6953
7031
  this.stopCatalogRefresh = undefined;
6954
7032
  if (this.settingsManager.getShowTerminalProgress()) {
@@ -6959,6 +7037,7 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
6959
7037
  this.clearExtensionTerminalInputListeners();
6960
7038
  this.footer.dispose();
6961
7039
  this.footerDataProvider.dispose();
7040
+ this.disposeChatToolComponents();
6962
7041
  if (this.unsubscribe) {
6963
7042
  this.unsubscribe();
6964
7043
  }