@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.
- package/CHANGELOG.md +82 -0
- package/README.md +1 -1
- package/dist/bundle/chunks/{anthropic-messages-CA3HHOL3.js → anthropic-messages-WAFIHSF7.js} +3 -3
- package/dist/bundle/chunks/{azure-openai-responses-76TWS6DT.js → azure-openai-responses-EB4MRIM4.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
- package/dist/bundle/chunks/{chunk-FMPAMX2W.js → chunk-E6LJTZYC.js} +1 -1
- package/dist/bundle/chunks/chunk-EEBRZED2.js +44 -0
- package/dist/bundle/chunks/chunk-EVSO24NP.js +2 -0
- package/dist/bundle/chunks/{chunk-M6TSYZBS.js → chunk-EXXWEFU5.js} +67 -64
- package/dist/bundle/chunks/{chunk-ZBIZYD6W.js → chunk-F7LEMV2T.js} +1 -1
- package/dist/bundle/chunks/{chunk-VKJQ6CME.js → chunk-I6HYYNH6.js} +1 -1
- package/dist/bundle/chunks/{chunk-BAC3QPNW.js → chunk-ILDLA2JW.js} +1 -1
- package/dist/bundle/chunks/chunk-INODY4DR.js +2 -0
- package/dist/bundle/chunks/{chunk-COKMCNCW.js → chunk-KREOSXD7.js} +1 -1
- package/dist/bundle/chunks/chunk-LWG2CUTI.js +31 -0
- package/dist/bundle/chunks/{chunk-WL4TUXY7.js → chunk-NRLRGOCX.js} +1 -1
- package/dist/bundle/chunks/{chunk-AUUCDC7R.js → chunk-NRY4NBZW.js} +1 -1
- package/dist/bundle/chunks/{chunk-4KSTFUIK.js → chunk-NV3NPOPF.js} +3 -2
- package/dist/bundle/chunks/{chunk-IQUU5XIT.js → chunk-RCNEHRMW.js} +1 -1
- package/dist/bundle/chunks/{chunk-FF6XOTWB.js → chunk-X26YOAEH.js} +11 -10
- package/dist/bundle/chunks/chunk-X6RQRO3L.js +16 -0
- package/dist/bundle/chunks/{chunk-4UNPP53I.js → chunk-XGGZYFNG.js} +2 -2
- package/dist/bundle/chunks/chunk-XJ2YV77J.js +30 -0
- package/dist/bundle/chunks/{chunk-RKNK4Y6L.js → chunk-YOWSKVK7.js} +1 -1
- package/dist/bundle/chunks/{cli-2MK3TR7P.js → cli-QMJEURSM.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-U4J7D646.js → cloudflare-workers-ai-system-one-AMCR7QEI.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-GEVPKQF6.js → easter-egg-3d-7CBVPJQ3.js} +1 -1
- package/dist/bundle/chunks/{execute-L2EEDV3L.js → execute-XDNPBEMU.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/google-generative-ai-43M4N5LK.js +2 -0
- package/dist/bundle/chunks/google-vertex-2B3PASK2.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-EJXCQRUQ.js → llama-cpp-classify-XXZYF3RR.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-S277EKLB.js → mistral-conversations-E3D5ZQKB.js} +2 -2
- package/dist/bundle/chunks/openai-codex-responses-MSQDSDUR.js +10 -0
- package/dist/bundle/chunks/{openai-completions-HRZOSLBO.js → openai-completions-4IC6AGTR.js} +2 -2
- package/dist/bundle/chunks/{openai-decisions-F66BDLOM.js → openai-decisions-LZ2RLVRX.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-BAKFWTGE.js → openai-responses-MCO3BHCC.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-VXF5TVIK.js → openrouter-images-SHUJ3VSG.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-UBJKNDRN.js → pi-messages-NIKOQ4O7.js} +1 -1
- package/dist/bundle/chunks/{runtime-J5ZSBGTX.js → runtime-F3SXQONS.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-56TEMIHL.js → typesafe-system-one-R2CDUWNO.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-MRQHQVIQ.js → virtual-modules-2WYTGPJ3.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +9 -6
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +9 -6
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +4 -0
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +11 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +19 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +6 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +21 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/exec.d.ts +1 -0
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +4 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts +6 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js +57 -20
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -3
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +18 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -8
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +3 -67
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +16 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +45 -2
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +7 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +5 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +45 -36
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-ownership.js +15 -1
- package/dist/core/session-ownership.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +27 -16
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +5 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +10 -15
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/read.d.ts.map +1 -1
- package/dist/core/tools/renderers/read.js +6 -2
- package/dist/core/tools/renderers/read.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -4
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +4 -7
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +39 -16
- package/dist/main.js.map +1 -1
- package/dist/modes/diagnostics-stderr.d.ts +4 -0
- package/dist/modes/diagnostics-stderr.d.ts.map +1 -0
- package/dist/modes/diagnostics-stderr.js +11 -0
- package/dist/modes/diagnostics-stderr.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +9 -3
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +5 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +5 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +7 -3
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/radius-login-selector.js +2 -1
- package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +8 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +41 -9
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +5 -1
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts +1 -1
- package/dist/modes/interactive/components/themed-text.d.ts.map +1 -1
- package/dist/modes/interactive/components/themed-text.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +5 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +3 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +2 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +9 -3
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +2 -2
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +71 -36
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/session-share.js +2 -0
- package/dist/modes/interactive/session-share.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +16 -13
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +15 -23
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +14 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +3 -2
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/flush-stdout.d.ts +8 -0
- package/dist/utils/flush-stdout.d.ts.map +1 -0
- package/dist/utils/flush-stdout.js +23 -0
- package/dist/utils/flush-stdout.js.map +1 -0
- package/docs/extensions.md +4 -4
- package/docs/models-configuration.md +4 -3
- package/docs/nvidia-rtx-llama-cpp.md +5 -5
- package/docs/providers.md +4 -2
- package/docs/rpc-commands.md +1 -1
- package/docs/tui.md +2 -0
- package/examples/extensions/gondolin/index.ts +4 -7
- package/package.json +10 -10
- package/schemas/models.schema.json +2 -2
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +0 -31
- package/dist/bundle/chunks/chunk-GFUN2N5K.js +0 -2
- package/dist/bundle/chunks/chunk-QN4TOIZN.js +0 -16
- package/dist/bundle/chunks/chunk-V7SLUK6A.js +0 -44
- package/dist/bundle/chunks/chunk-YTPJCXUB.js +0 -30
- package/dist/bundle/chunks/chunk-ZGYS4UTC.js +0 -2
- package/dist/bundle/chunks/google-generative-ai-D5B6W47J.js +0 -2
- package/dist/bundle/chunks/google-vertex-U4H5YDEW.js +0 -2
- package/dist/bundle/chunks/openai-codex-responses-TEQRB65N.js +0 -10
- package/dist/utils/deprecation.d.ts +0 -4
- package/dist/utils/deprecation.d.ts.map +0 -1
- package/dist/utils/deprecation.js +0 -13
- 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
|
-
|
|
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
|
|
3509
|
-
if (
|
|
3538
|
+
const dropped = getDroppedReasoning(message);
|
|
3539
|
+
if (!dropped)
|
|
3510
3540
|
return;
|
|
3511
|
-
|
|
3512
|
-
//
|
|
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
|
-
|
|
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
|
-
|
|
3523
|
-
|
|
3524
|
-
const
|
|
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",
|
|
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
|
-
|
|
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() {
|