@maxmo74/pi-coding-agent 1.5.2-max.15 → 1.6.0-max.16

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 (228) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/README.md +1 -1
  3. package/dist/bundle/chunks/{anthropic-messages-CA3HHOL3.js → anthropic-messages-WAFIHSF7.js} +3 -3
  4. package/dist/bundle/chunks/{azure-openai-responses-76TWS6DT.js → azure-openai-responses-EB4MRIM4.js} +1 -1
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
  6. package/dist/bundle/chunks/{chunk-FMPAMX2W.js → chunk-E6LJTZYC.js} +1 -1
  7. package/dist/bundle/chunks/chunk-EEBRZED2.js +44 -0
  8. package/dist/bundle/chunks/chunk-EVSO24NP.js +2 -0
  9. package/dist/bundle/chunks/{chunk-M6TSYZBS.js → chunk-EXXWEFU5.js} +67 -64
  10. package/dist/bundle/chunks/{chunk-ZBIZYD6W.js → chunk-F7LEMV2T.js} +1 -1
  11. package/dist/bundle/chunks/{chunk-VKJQ6CME.js → chunk-I6HYYNH6.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-BAC3QPNW.js → chunk-ILDLA2JW.js} +1 -1
  13. package/dist/bundle/chunks/chunk-INODY4DR.js +2 -0
  14. package/dist/bundle/chunks/{chunk-COKMCNCW.js → chunk-KREOSXD7.js} +1 -1
  15. package/dist/bundle/chunks/chunk-LWG2CUTI.js +31 -0
  16. package/dist/bundle/chunks/{chunk-WL4TUXY7.js → chunk-NRLRGOCX.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-AUUCDC7R.js → chunk-NRY4NBZW.js} +1 -1
  18. package/dist/bundle/chunks/{chunk-4KSTFUIK.js → chunk-NV3NPOPF.js} +3 -2
  19. package/dist/bundle/chunks/{chunk-IQUU5XIT.js → chunk-RCNEHRMW.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-FF6XOTWB.js → chunk-X26YOAEH.js} +11 -10
  21. package/dist/bundle/chunks/chunk-X6RQRO3L.js +16 -0
  22. package/dist/bundle/chunks/{chunk-4UNPP53I.js → chunk-XGGZYFNG.js} +2 -2
  23. package/dist/bundle/chunks/chunk-XJ2YV77J.js +30 -0
  24. package/dist/bundle/chunks/{chunk-RKNK4Y6L.js → chunk-YOWSKVK7.js} +1 -1
  25. package/dist/bundle/chunks/{cli-2MK3TR7P.js → cli-QMJEURSM.js} +1 -1
  26. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-U4J7D646.js → cloudflare-workers-ai-system-one-AMCR7QEI.js} +1 -1
  27. package/dist/bundle/chunks/{easter-egg-3d-GEVPKQF6.js → easter-egg-3d-7CBVPJQ3.js} +1 -1
  28. package/dist/bundle/chunks/{execute-L2EEDV3L.js → execute-XDNPBEMU.js} +1 -1
  29. package/dist/bundle/chunks/github-copilot.js +1 -1
  30. package/dist/bundle/chunks/google-generative-ai-43M4N5LK.js +2 -0
  31. package/dist/bundle/chunks/google-vertex-2B3PASK2.js +2 -0
  32. package/dist/bundle/chunks/{llama-cpp-classify-EJXCQRUQ.js → llama-cpp-classify-XXZYF3RR.js} +1 -1
  33. package/dist/bundle/chunks/{mistral-conversations-S277EKLB.js → mistral-conversations-E3D5ZQKB.js} +2 -2
  34. package/dist/bundle/chunks/openai-codex-responses-MSQDSDUR.js +10 -0
  35. package/dist/bundle/chunks/{openai-completions-HRZOSLBO.js → openai-completions-4IC6AGTR.js} +2 -2
  36. package/dist/bundle/chunks/{openai-decisions-F66BDLOM.js → openai-decisions-LZ2RLVRX.js} +1 -1
  37. package/dist/bundle/chunks/{openai-responses-BAKFWTGE.js → openai-responses-MCO3BHCC.js} +1 -1
  38. package/dist/bundle/chunks/{openrouter-images-VXF5TVIK.js → openrouter-images-SHUJ3VSG.js} +1 -1
  39. package/dist/bundle/chunks/{pi-messages-UBJKNDRN.js → pi-messages-NIKOQ4O7.js} +1 -1
  40. package/dist/bundle/chunks/{runtime-J5ZSBGTX.js → runtime-F3SXQONS.js} +1 -1
  41. package/dist/bundle/chunks/{typesafe-system-one-56TEMIHL.js → typesafe-system-one-R2CDUWNO.js} +1 -1
  42. package/dist/bundle/chunks/{virtual-modules-MRQHQVIQ.js → virtual-modules-2WYTGPJ3.js} +1 -1
  43. package/dist/bundle/cli-runtime.js +1 -1
  44. package/dist/bundle/index.js +1 -1
  45. package/dist/bundle/rpc-entry.js +1 -1
  46. package/dist/cli/args.d.ts.map +1 -1
  47. package/dist/cli/args.js +4 -2
  48. package/dist/cli/args.js.map +1 -1
  49. package/dist/cli/config-selector.d.ts.map +1 -1
  50. package/dist/cli/config-selector.js +9 -6
  51. package/dist/cli/config-selector.js.map +1 -1
  52. package/dist/cli/session-picker.d.ts.map +1 -1
  53. package/dist/cli/session-picker.js +9 -6
  54. package/dist/cli/session-picker.js.map +1 -1
  55. package/dist/cli/startup-ui.d.ts.map +1 -1
  56. package/dist/cli/startup-ui.js +4 -0
  57. package/dist/cli/startup-ui.js.map +1 -1
  58. package/dist/core/agent-session-runtime.d.ts +11 -0
  59. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  60. package/dist/core/agent-session-runtime.js +19 -0
  61. package/dist/core/agent-session-runtime.js.map +1 -1
  62. package/dist/core/agent-session.d.ts +6 -3
  63. package/dist/core/agent-session.d.ts.map +1 -1
  64. package/dist/core/agent-session.js +21 -13
  65. package/dist/core/agent-session.js.map +1 -1
  66. package/dist/core/exec.d.ts +1 -0
  67. package/dist/core/exec.d.ts.map +1 -1
  68. package/dist/core/exec.js +4 -1
  69. package/dist/core/exec.js.map +1 -1
  70. package/dist/core/export-html/ansi-to-html.d.ts +6 -1
  71. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  72. package/dist/core/export-html/ansi-to-html.js +57 -20
  73. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  74. package/dist/core/export-html/template.js +1 -1
  75. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  76. package/dist/core/export-html/tool-renderer.js +2 -3
  77. package/dist/core/export-html/tool-renderer.js.map +1 -1
  78. package/dist/core/extensions/loader.d.ts.map +1 -1
  79. package/dist/core/extensions/loader.js +18 -1
  80. package/dist/core/extensions/loader.js.map +1 -1
  81. package/dist/core/extensions/runner.d.ts.map +1 -1
  82. package/dist/core/extensions/runner.js +5 -0
  83. package/dist/core/extensions/runner.js.map +1 -1
  84. package/dist/core/extensions/types.d.ts +5 -0
  85. package/dist/core/extensions/types.d.ts.map +1 -1
  86. package/dist/core/extensions/types.js.map +1 -1
  87. package/dist/core/model-resolver.d.ts +0 -8
  88. package/dist/core/model-resolver.d.ts.map +1 -1
  89. package/dist/core/model-resolver.js +3 -67
  90. package/dist/core/model-resolver.js.map +1 -1
  91. package/dist/core/package-manager.d.ts +16 -0
  92. package/dist/core/package-manager.d.ts.map +1 -1
  93. package/dist/core/package-manager.js +45 -2
  94. package/dist/core/package-manager.js.map +1 -1
  95. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  96. package/dist/core/remote-catalog-provider.js +7 -0
  97. package/dist/core/remote-catalog-provider.js.map +1 -1
  98. package/dist/core/resource-loader.d.ts +5 -1
  99. package/dist/core/resource-loader.d.ts.map +1 -1
  100. package/dist/core/resource-loader.js +2 -0
  101. package/dist/core/resource-loader.js.map +1 -1
  102. package/dist/core/session-manager.d.ts.map +1 -1
  103. package/dist/core/session-manager.js +45 -36
  104. package/dist/core/session-manager.js.map +1 -1
  105. package/dist/core/session-ownership.js +15 -1
  106. package/dist/core/session-ownership.js.map +1 -1
  107. package/dist/core/tools/find.d.ts.map +1 -1
  108. package/dist/core/tools/find.js +27 -16
  109. package/dist/core/tools/find.js.map +1 -1
  110. package/dist/core/tools/grep.js +1 -1
  111. package/dist/core/tools/grep.js.map +1 -1
  112. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  113. package/dist/core/tools/output-accumulator.js +4 -1
  114. package/dist/core/tools/output-accumulator.js.map +1 -1
  115. package/dist/core/tools/read.d.ts +5 -0
  116. package/dist/core/tools/read.d.ts.map +1 -1
  117. package/dist/core/tools/read.js +10 -15
  118. package/dist/core/tools/read.js.map +1 -1
  119. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  120. package/dist/core/tools/renderers/read.js +6 -2
  121. package/dist/core/tools/renderers/read.js.map +1 -1
  122. package/dist/extensions/llama/provider.d.ts +1 -1
  123. package/dist/extensions/llama/provider.d.ts.map +1 -1
  124. package/dist/extensions/llama/provider.js +6 -4
  125. package/dist/extensions/llama/provider.js.map +1 -1
  126. package/dist/extensions/mcp/index.d.ts.map +1 -1
  127. package/dist/extensions/mcp/index.js +4 -7
  128. package/dist/extensions/mcp/index.js.map +1 -1
  129. package/dist/main.d.ts.map +1 -1
  130. package/dist/main.js +39 -16
  131. package/dist/main.js.map +1 -1
  132. package/dist/modes/diagnostics-stderr.d.ts +4 -0
  133. package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
  134. package/dist/modes/diagnostics-stderr.js +11 -0
  135. package/dist/modes/diagnostics-stderr.js.map +1 -0
  136. package/dist/modes/interactive/components/assistant-message.d.ts +2 -1
  137. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  138. package/dist/modes/interactive/components/assistant-message.js +9 -3
  139. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  140. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  141. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  142. package/dist/modes/interactive/components/config-selector.js +5 -2
  143. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  144. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  145. package/dist/modes/interactive/components/model-selector.js +5 -2
  146. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  147. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
  148. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  149. package/dist/modes/interactive/components/oauth-selector.js +7 -3
  150. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  151. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  152. package/dist/modes/interactive/components/radius-login-selector.js +2 -1
  153. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  154. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  155. package/dist/modes/interactive/components/scoped-models-selector.js +9 -1
  156. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  157. package/dist/modes/interactive/components/session-selector.d.ts +8 -1
  158. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  159. package/dist/modes/interactive/components/session-selector.js +41 -9
  160. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  161. package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
  162. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  163. package/dist/modes/interactive/components/settings-submenu.js +5 -1
  164. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  165. package/dist/modes/interactive/components/themed-text.d.ts +1 -1
  166. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
  167. package/dist/modes/interactive/components/themed-text.js.map +1 -1
  168. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  169. package/dist/modes/interactive/components/thinking-selector.js +5 -1
  170. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  171. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  172. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  173. package/dist/modes/interactive/components/tool-execution.js +3 -1
  174. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  175. package/dist/modes/interactive/components/user-message.d.ts +2 -1
  176. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  177. package/dist/modes/interactive/components/user-message.js +9 -3
  178. package/dist/modes/interactive/components/user-message.js.map +1 -1
  179. package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
  180. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  181. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  182. package/dist/modes/interactive/interactive-mode.d.ts +1 -1
  183. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  184. package/dist/modes/interactive/interactive-mode.js +71 -36
  185. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  186. package/dist/modes/interactive/session-share.js +2 -0
  187. package/dist/modes/interactive/session-share.js.map +1 -1
  188. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  189. package/dist/modes/interactive/theme/theme.js +1 -0
  190. package/dist/modes/interactive/theme/theme.js.map +1 -1
  191. package/dist/modes/print-mode.d.ts.map +1 -1
  192. package/dist/modes/print-mode.js +16 -13
  193. package/dist/modes/print-mode.js.map +1 -1
  194. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  195. package/dist/modes/rpc/rpc-mode.js +15 -23
  196. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  197. package/dist/package-manager-cli.d.ts.map +1 -1
  198. package/dist/package-manager-cli.js +14 -1
  199. package/dist/package-manager-cli.js.map +1 -1
  200. package/dist/utils/changelog.d.ts.map +1 -1
  201. package/dist/utils/changelog.js +3 -2
  202. package/dist/utils/changelog.js.map +1 -1
  203. package/dist/utils/flush-stdout.d.ts +8 -0
  204. package/dist/utils/flush-stdout.d.ts.map +1 -0
  205. package/dist/utils/flush-stdout.js +23 -0
  206. package/dist/utils/flush-stdout.js.map +1 -0
  207. package/docs/extensions.md +4 -4
  208. package/docs/models-configuration.md +4 -3
  209. package/docs/nvidia-rtx-llama-cpp.md +5 -5
  210. package/docs/providers.md +4 -2
  211. package/docs/rpc-commands.md +1 -1
  212. package/docs/tui.md +2 -0
  213. package/examples/extensions/gondolin/index.ts +4 -7
  214. package/package.json +10 -10
  215. package/schemas/models.schema.json +2 -2
  216. package/dist/bundle/chunks/chunk-CF5GWZHW.js +0 -31
  217. package/dist/bundle/chunks/chunk-GFUN2N5K.js +0 -2
  218. package/dist/bundle/chunks/chunk-QN4TOIZN.js +0 -16
  219. package/dist/bundle/chunks/chunk-V7SLUK6A.js +0 -44
  220. package/dist/bundle/chunks/chunk-YTPJCXUB.js +0 -30
  221. package/dist/bundle/chunks/chunk-ZGYS4UTC.js +0 -2
  222. package/dist/bundle/chunks/google-generative-ai-D5B6W47J.js +0 -2
  223. package/dist/bundle/chunks/google-vertex-U4H5YDEW.js +0 -2
  224. package/dist/bundle/chunks/openai-codex-responses-TEQRB65N.js +0 -10
  225. package/dist/utils/deprecation.d.ts +0 -4
  226. package/dist/utils/deprecation.d.ts.map +0 -1
  227. package/dist/utils/deprecation.js +0 -13
  228. package/dist/utils/deprecation.js.map +0 -1
@@ -42,6 +42,7 @@ import { addMcpServerConfig } from "../../extensions/mcp/config.js";
42
42
  import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
43
43
  import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
44
44
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
45
+ import { flushStdout } from "../../utils/flush-stdout.js";
45
46
  import { parseGitUrl } from "../../utils/git.js";
46
47
  import { ensurePngTranscoder } from "../../utils/image-convert.js";
47
48
  import { getCwdRelativePath, shortenHomePath } from "../../utils/paths.js";
@@ -239,6 +240,41 @@ function formatLoginProviderCompletionDescription(provider) {
239
240
  .join("/");
240
241
  return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
241
242
  }
243
+ /** Assistant diagnostics that list reasoning a provider withheld from the model, by diagnostic type. */
244
+ const REASONING_DROP_DIAGNOSTICS = new Map([
245
+ [
246
+ "anthropic_input_transformations",
247
+ { provider: "Anthropic", droppedType: "thinking_dropped", noun: ["thinking block", "thinking blocks"] },
248
+ ],
249
+ [
250
+ "openai_input_transformations",
251
+ { provider: "OpenAI", droppedType: "reasoning", noun: ["reasoning item", "reasoning items"] },
252
+ ],
253
+ ]);
254
+ /** Count the reasoning blocks a provider reported as withheld from the request that produced `message`. */
255
+ function getDroppedReasoning(message) {
256
+ for (const diagnostic of message.diagnostics ?? []) {
257
+ const kind = REASONING_DROP_DIAGNOSTICS.get(diagnostic.type);
258
+ if (!kind)
259
+ continue;
260
+ // Session data: diagnostics details are untyped JSON.
261
+ const transformations = diagnostic.details?.transformations;
262
+ if (!Array.isArray(transformations))
263
+ continue;
264
+ const dropped = transformations.filter((transformation) => typeof transformation === "object" &&
265
+ transformation !== null &&
266
+ transformation.type === kind.droppedType);
267
+ if (dropped.length === 0)
268
+ continue;
269
+ const reasons = new Set();
270
+ for (const transformation of dropped) {
271
+ if (typeof transformation.reason === "string")
272
+ reasons.add(transformation.reason);
273
+ }
274
+ return { diagnostic: kind, count: dropped.length, reasons: [...reasons] };
275
+ }
276
+ return undefined;
277
+ }
242
278
  export class InteractiveMode {
243
279
  runtimeHost;
244
280
  renderer;
@@ -386,6 +422,7 @@ export class InteractiveMode {
386
422
  this.runtimeHost.setRebindSession(async () => {
387
423
  await this.rebindCurrentSession({ renderBeforeBind: true });
388
424
  this.themeController.applyFromSettings();
425
+ this.showRuntimeDiagnostics(this.runtimeHost.takeUnreportedDiagnostics());
389
426
  });
390
427
  this.version = VERSION;
391
428
  this.renderer = createInteractiveTui({
@@ -670,6 +707,7 @@ export class InteractiveMode {
670
707
  });
671
708
  nextUi.setClearOnShrink(clearOnShrink);
672
709
  nextUi.onDebug = onDebug;
710
+ nextUi.setSuspendSignalHandler(() => this.handleCtrlZ());
673
711
  if (nextUi instanceof TuiMainScreen && this.mainScreenRenderState) {
674
712
  nextUi.restoreRenderState(this.mainScreenRenderState);
675
713
  }
@@ -734,6 +772,8 @@ export class InteractiveMode {
734
772
  this.defaultEditor.onCtrlD = () => this.handleCtrlD();
735
773
  this.defaultEditor.onSubmit = (text) => this.handleStartupSubmit(text);
736
774
  this.ui.setFocus(this.editor);
775
+ // An external SIGTSTP (kill -TSTP) restores the terminal like Ctrl+Z (#12272).
776
+ this.ui.setSuspendSignalHandler(() => this.handleCtrlZ());
737
777
  // Start the UI before initializing extensions so session_start handlers can use interactive dialogs
738
778
  this.ui.start();
739
779
  this.isInitialized = true;
@@ -900,17 +940,7 @@ export class InteractiveMode {
900
940
  });
901
941
  // Show startup warnings
902
942
  const { migratedProviders, startupDiagnostics, modelFallbackMessage, initialMessage, initialImages, initialMessages, } = this.options;
903
- for (const diagnostic of startupDiagnostics ?? []) {
904
- if (diagnostic.type === "error") {
905
- this.showError(diagnostic.message);
906
- }
907
- else if (diagnostic.type === "warning") {
908
- this.showWarning(diagnostic.message);
909
- }
910
- else {
911
- this.showStatus(diagnostic.message);
912
- }
913
- }
943
+ this.showRuntimeDiagnostics(startupDiagnostics ?? []);
914
944
  if (migratedProviders && migratedProviders.length > 0) {
915
945
  this.showWarning(`Migrated credentials to auth.json: ${migratedProviders.join(", ")}`);
916
946
  }
@@ -1699,6 +1729,19 @@ export class InteractiveMode {
1699
1729
  this.editor.setAutocompleteMaxVisible?.(autocompleteMaxVisible);
1700
1730
  }
1701
1731
  }
1732
+ showRuntimeDiagnostics(diagnostics) {
1733
+ for (const diagnostic of diagnostics) {
1734
+ if (diagnostic.type === "error") {
1735
+ this.showError(diagnostic.message);
1736
+ }
1737
+ else if (diagnostic.type === "warning") {
1738
+ this.showWarning(diagnostic.message);
1739
+ }
1740
+ else {
1741
+ this.showStatus(diagnostic.message);
1742
+ }
1743
+ }
1744
+ }
1702
1745
  async rebindCurrentSession(options = {}) {
1703
1746
  const session = this.session;
1704
1747
  this.unsubscribe?.();
@@ -1733,6 +1776,7 @@ export class InteractiveMode {
1733
1776
  }
1734
1777
  stopThemeWatcher();
1735
1778
  this.stop("transcript");
1779
+ await flushStdout();
1736
1780
  process.exit(1);
1737
1781
  }
1738
1782
  getCrashExtensionHint(error) {
@@ -3488,42 +3532,30 @@ export class InteractiveMode {
3488
3532
  this.chatContainer.addChild(new Spacer(1));
3489
3533
  this.chatContainer.addChild(new ThemedText(() => theme.fg("warning", `${label}: ${formatTokens(tokens)} tokens billed${cost}`), 1, 0));
3490
3534
  }
3491
- static countDroppedThinkingBlocks(message) {
3492
- let count = 0;
3493
- for (const diagnostic of message.diagnostics ?? []) {
3494
- if (diagnostic.type !== "anthropic_input_transformations")
3495
- continue;
3496
- const transformations = diagnostic.details?.transformations;
3497
- if (!Array.isArray(transformations))
3498
- continue;
3499
- count += transformations.filter((transformation) => typeof transformation === "object" &&
3500
- transformation !== null &&
3501
- transformation.type === "thinking_dropped").length;
3502
- }
3503
- return count;
3504
- }
3505
3535
  maybeShowThinkingDropNotice(message) {
3506
3536
  if (!this.settingsManager.getShowCacheMissNotices())
3507
3537
  return;
3508
- const droppedCount = InteractiveMode.countDroppedThinkingBlocks(message);
3509
- if (droppedCount === 0)
3538
+ const dropped = getDroppedReasoning(message);
3539
+ if (!dropped)
3510
3540
  return;
3511
- let previousDroppedCount = 0;
3512
- // message_end reaches the UI before the current message is persisted,
3513
- // so the branch's last assistant message is the previous response.
3541
+ // Providers report a withheld block again on every later request that replays it, so only
3542
+ // a count above the previous response's means new losses. message_end reaches the UI before
3543
+ // the current message is persisted, so the branch's last assistant message is the previous response.
3514
3544
  const branch = this.sessionManager.getBranch();
3515
3545
  for (let i = branch.length - 1; i >= 0; i--) {
3516
3546
  const entry = branch[i];
3517
3547
  if (entry.type === "message" && entry.message.role === "assistant") {
3518
- previousDroppedCount = InteractiveMode.countDroppedThinkingBlocks(entry.message);
3548
+ const previous = getDroppedReasoning(entry.message);
3549
+ if (previous?.diagnostic === dropped.diagnostic && dropped.count <= previous.count)
3550
+ return;
3519
3551
  break;
3520
3552
  }
3521
3553
  }
3522
- if (droppedCount <= previousDroppedCount)
3523
- return;
3524
- const noun = droppedCount === 1 ? "thinking block" : "thinking blocks";
3554
+ const { provider, noun: nouns } = dropped.diagnostic;
3555
+ const noun = nouns[dropped.count === 1 ? 0 : 1];
3556
+ const reasons = dropped.reasons.length > 0 ? `: ${dropped.reasons.join(", ")}` : "";
3525
3557
  this.chatContainer.addChild(new Spacer(1));
3526
- this.chatContainer.addChild(new ThemedText(() => theme.fg("warning", `Anthropic dropped ${droppedCount} ${noun} (details in session)`), 1, 0));
3558
+ this.chatContainer.addChild(new ThemedText(() => theme.fg("warning", `${provider} dropped ${dropped.count} ${noun}${reasons} (details in session)`), 1, 0));
3527
3559
  }
3528
3560
  /**
3529
3561
  * Show a transcript notice when a completed assistant message paid for a
@@ -3635,6 +3667,7 @@ export class InteractiveMode {
3635
3667
  this.themeController.disableAutoSync();
3636
3668
  await this.ui.terminal.drainInput(1000);
3637
3669
  this.stop();
3670
+ await flushStdout();
3638
3671
  process.exit(0);
3639
3672
  }
3640
3673
  // Interactive quit (Ctrl+D, Ctrl+C, /quit, extension shutdown()). Stop the
@@ -3648,8 +3681,10 @@ export class InteractiveMode {
3648
3681
  await this.runtimeHost.dispose();
3649
3682
  const resumeCommand = formatResumeCommand(this.sessionManager);
3650
3683
  if (resumeCommand) {
3651
- process.stdout.write(`${chalk.dim("To resume this session:")} ${resumeCommand}\n`);
3684
+ // Own line so the command can be selected with a triple-click (#12237).
3685
+ process.stdout.write(`${chalk.dim("To resume this session:")}\n${resumeCommand}\n`);
3652
3686
  }
3687
+ await flushStdout();
3653
3688
  process.exit(0);
3654
3689
  }
3655
3690
  emergencyTerminalExit() {