dal-code 1.0.0 → 1.0.7

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 (166) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/dist/core/auth-guidance.d.ts +1 -0
  3. package/dist/core/auth-guidance.d.ts.map +1 -1
  4. package/dist/core/auth-guidance.js +6 -0
  5. package/dist/core/auth-guidance.js.map +1 -1
  6. package/dist/core/compaction/compaction.d.ts.map +1 -1
  7. package/dist/core/compaction/compaction.js +4 -7
  8. package/dist/core/compaction/compaction.js.map +1 -1
  9. package/dist/core/extensions/index.d.ts +1 -1
  10. package/dist/core/extensions/index.d.ts.map +1 -1
  11. package/dist/core/extensions/index.js.map +1 -1
  12. package/dist/core/extensions/loader.d.ts.map +1 -1
  13. package/dist/core/extensions/loader.js +13 -1
  14. package/dist/core/extensions/loader.js.map +1 -1
  15. package/dist/core/extensions/runner.d.ts.map +1 -1
  16. package/dist/core/extensions/runner.js +47 -48
  17. package/dist/core/extensions/runner.js.map +1 -1
  18. package/dist/core/extensions/types.d.ts +46 -43
  19. package/dist/core/extensions/types.d.ts.map +1 -1
  20. package/dist/core/extensions/types.js.map +1 -1
  21. package/dist/core/keybindings.d.ts +10 -0
  22. package/dist/core/keybindings.d.ts.map +1 -1
  23. package/dist/core/keybindings.js +13 -0
  24. package/dist/core/keybindings.js.map +1 -1
  25. package/dist/core/tools/bash.d.ts +3 -1
  26. package/dist/core/tools/bash.d.ts.map +1 -1
  27. package/dist/core/tools/bash.js +61 -8
  28. package/dist/core/tools/bash.js.map +1 -1
  29. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  30. package/dist/core/tools/renderers/bash.js +43 -6
  31. package/dist/core/tools/renderers/bash.js.map +1 -1
  32. package/dist/dal/builtins.d.ts.map +1 -1
  33. package/dist/dal/builtins.js +1 -0
  34. package/dist/dal/builtins.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/main.d.ts.map +1 -1
  39. package/dist/main.js +6 -0
  40. package/dist/main.js.map +1 -1
  41. package/dist/modes/interactive/components/assistant-message.d.ts +12 -0
  42. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  43. package/dist/modes/interactive/components/assistant-message.js +22 -1
  44. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  45. package/dist/modes/interactive/components/footer.d.ts +2 -0
  46. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  47. package/dist/modes/interactive/components/footer.js +24 -7
  48. package/dist/modes/interactive/components/footer.js.map +1 -1
  49. package/dist/modes/interactive/components/tool-execution.d.ts +39 -2
  50. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  51. package/dist/modes/interactive/components/tool-execution.js +200 -29
  52. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  53. package/dist/modes/interactive/interactive-mode.d.ts +35 -0
  54. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  55. package/dist/modes/interactive/interactive-mode.js +177 -23
  56. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  57. package/dist/modes/interactive/theme/dark.json +1 -1
  58. package/dist/modes/interactive/theme/light.json +1 -1
  59. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  60. package/dist/modes/interactive/tui-renderer.js +2 -2
  61. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  62. package/dist/node_modules/@dalcode/dal-bridge/package.json +3 -3
  63. package/dist/node_modules/@dalcode/dal-gateway/package.json +3 -3
  64. package/dist/node_modules/@dalcode/dal-guard/package.json +5 -5
  65. package/dist/node_modules/@dalcode/dal-halo/package.json +2 -2
  66. package/dist/node_modules/@dalcode/dal-lang/package.json +4 -4
  67. package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
  68. package/dist/node_modules/@dalcode/dal-mcp/package.json +9 -6
  69. package/dist/node_modules/@dalcode/dal-mcp/src/add-wizard.ts +142 -0
  70. package/dist/node_modules/@dalcode/dal-mcp/src/command-parser.ts +218 -0
  71. package/dist/node_modules/@dalcode/dal-mcp/src/config-edit.ts +99 -0
  72. package/dist/node_modules/@dalcode/dal-mcp/src/index.ts +161 -18
  73. package/dist/node_modules/@dalcode/dal-mcp/src/stdio-client.ts +8 -3
  74. package/dist/node_modules/@dalcode/dal-office/LICENSE +21 -0
  75. package/dist/node_modules/@dalcode/dal-office/package.json +37 -0
  76. package/dist/node_modules/@dalcode/dal-office/src/extract/csv.ts +84 -0
  77. package/dist/node_modules/@dalcode/dal-office/src/extract/index.ts +111 -0
  78. package/dist/node_modules/@dalcode/dal-office/src/extract/ooxml.ts +109 -0
  79. package/dist/node_modules/@dalcode/dal-office/src/extract/pdf.ts +43 -0
  80. package/dist/node_modules/@dalcode/dal-office/src/index.ts +43 -0
  81. package/dist/node_modules/@dalcode/dal-office/src/paths.ts +107 -0
  82. package/dist/node_modules/@dalcode/dal-office/src/render/chart.ts +111 -0
  83. package/dist/node_modules/@dalcode/dal-office/src/render/docx.ts +155 -0
  84. package/dist/node_modules/@dalcode/dal-office/src/render/pptx.ts +386 -0
  85. package/dist/node_modules/@dalcode/dal-office/src/render/xlsx.ts +99 -0
  86. package/dist/node_modules/@dalcode/dal-office/src/scenes.ts +197 -0
  87. package/dist/node_modules/@dalcode/dal-office/src/scratchpad.ts +49 -0
  88. package/dist/node_modules/@dalcode/dal-office/src/themes.ts +240 -0
  89. package/dist/node_modules/@dalcode/dal-office/src/tools/chart-generate.ts +122 -0
  90. package/dist/node_modules/@dalcode/dal-office/src/tools/doc-generate.ts +123 -0
  91. package/dist/node_modules/@dalcode/dal-office/src/tools/drawio-generate.ts +99 -0
  92. package/dist/node_modules/@dalcode/dal-office/src/tools/md-generate.ts +76 -0
  93. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-generate.ts +106 -0
  94. package/dist/node_modules/@dalcode/dal-office/src/tools/ppt-plan.ts +91 -0
  95. package/dist/node_modules/@dalcode/dal-office/src/tools/read-file.ts +71 -0
  96. package/dist/node_modules/@dalcode/dal-office/src/tools/shared.ts +54 -0
  97. package/dist/node_modules/@dalcode/dal-office/src/tools/sheet-generate.ts +101 -0
  98. package/dist/node_modules/@dalcode/dal-office/src/truncate.ts +27 -0
  99. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.d.ts.map +1 -1
  100. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js +233 -1
  101. package/dist/node_modules/@dalcode/dal-pi-kit/dist/i18n.js.map +1 -1
  102. package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
  103. package/dist/node_modules/@dalcode/dal-pi-kit/src/i18n.ts +322 -1
  104. package/dist/node_modules/@dalcode/dal-skills/package.json +4 -4
  105. package/dist/node_modules/@dalcode/dal-skills/src/discover.ts +101 -0
  106. package/dist/node_modules/@dalcode/dal-skills/src/index.ts +71 -9
  107. package/dist/node_modules/@dalcode/dal-skills/src/install.ts +140 -0
  108. package/dist/node_modules/@dalcode/dal-skills/src/manage.ts +446 -0
  109. package/dist/node_modules/@dalcode/dal-skills/src/packages.ts +39 -1
  110. package/dist/node_modules/@dalcode/dal-subagent/package.json +6 -6
  111. package/dist/node_modules/@dalcode/dal-subagent/src/index.ts +46 -4
  112. package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
  113. package/dist/node_modules/@dalcode/deepailab/package.json +4 -4
  114. package/dist/node_modules/@dalcode/deepailab/src/index.ts +7 -1
  115. package/dist/node_modules/@dalcode/deepailab/src/model-defaults.ts +42 -6
  116. package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  117. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  118. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  119. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  120. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  121. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
  122. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
  123. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  124. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  125. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  126. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
  127. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
  128. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  129. package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  130. package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
  131. package/dist/node_modules/@earendil-works/pi-client/package.json +2 -2
  132. package/dist/node_modules/@earendil-works/pi-protocol/package.json +1 -1
  133. package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  134. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  135. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +3 -1
  136. package/dist/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  137. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
  138. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js +3 -1
  139. package/dist/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
  140. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +1 -1
  141. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
  142. package/dist/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +1 -1
  143. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +4 -3
  144. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  145. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +4 -2
  146. package/dist/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  147. package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
  148. package/dist/utils/changelog.d.ts +37 -4
  149. package/dist/utils/changelog.d.ts.map +1 -1
  150. package/dist/utils/changelog.js +80 -17
  151. package/dist/utils/changelog.js.map +1 -1
  152. package/dist/utils/clipboard.d.ts.map +1 -1
  153. package/dist/utils/clipboard.js +13 -1
  154. package/dist/utils/clipboard.js.map +1 -1
  155. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  156. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  157. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  158. package/examples/extensions/gondolin/package-lock.json +2 -2
  159. package/examples/extensions/gondolin/package.json +1 -1
  160. package/examples/extensions/sandbox/package-lock.json +2 -2
  161. package/examples/extensions/sandbox/package.json +1 -1
  162. package/examples/extensions/with-deps/package-lock.json +2 -2
  163. package/examples/extensions/with-deps/package.json +1 -1
  164. package/examples/plugins/pi-example-plugin/package.json +1 -1
  165. package/npm-shrinkwrap.json +1511 -25
  166. package/package.json +8 -2
@@ -13,6 +13,7 @@ import { spawn } from "child_process";
13
13
  import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, DAL_RELEASES_URL, getAgentDir, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
14
14
  import { parseSkillBlock } from "../../core/agent-session.js";
15
15
  import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
16
+ import { isNoModelsAvailableMessage } from "../../core/auth-guidance.js";
16
17
  import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
17
18
  import { DEFAULT_THINKING_LEVEL, THINKING_LEVEL_OPTIONS } from "../../core/defaults.js";
18
19
  import { extensionPanelLines, resolveExtensionNotify } from "../../core/extensions/index.js";
@@ -33,7 +34,7 @@ import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
33
34
  import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
34
35
  import { getUsageCostBreakdown } from "../../core/usage-totals.js";
35
36
  import { t } from "../../dal/i18n.js";
36
- import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
37
+ import { getChangelogPath, getNewEntries, getProductEntries, normalizeChangelogLinks, parseChangelog, } from "../../utils/changelog.js";
37
38
  import { copyToClipboard, readClipboardText } from "../../utils/clipboard.js";
38
39
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
39
40
  import { parseGitUrl } from "../../utils/git.js";
@@ -104,6 +105,9 @@ export function isLoginProviderAllowed(providerId) {
104
105
  function isExpandable(obj) {
105
106
  return typeof obj === "object" && obj !== null && "setExpanded" in obj && typeof obj.setExpanded === "function";
106
107
  }
108
+ function isFocusableTool(obj) {
109
+ return isExpandable(obj) && "setFocused" in obj && typeof obj.setFocused === "function";
110
+ }
107
111
  class ExpandableText extends Text {
108
112
  getCollapsedText;
109
113
  getExpandedText;
@@ -196,6 +200,14 @@ function formatLoginProviderCompletionDescription(provider) {
196
200
  const authTypes = provider.authTypes.map(formatAuthSelectorProviderType).join("/");
197
201
  return provider.name === provider.id ? authTypes : `${provider.name} · ${authTypes}`;
198
202
  }
203
+ /**
204
+ * Structural, not textual: every OAuth device flow in this repo throws an error
205
+ * carrying `code`, and matching on the rendered message would break the moment
206
+ * it is translated — the same trap that leaked the zh no-models warning.
207
+ */
208
+ function isDeviceCodeExpired(error) {
209
+ return typeof error === "object" && error !== null && error.code === "expired_token";
210
+ }
199
211
  export class InteractiveMode {
200
212
  runtimeHost;
201
213
  renderer;
@@ -251,6 +263,19 @@ export class InteractiveMode {
251
263
  pendingTools = new Map();
252
264
  // Tool output expansion state
253
265
  toolOutputExpanded = false;
266
+ /**
267
+ * Which tool call the cursor is on, as an index into the transcript's
268
+ * focusable entries, or null when the cursor is parked.
269
+ *
270
+ * Stored as an index rather than a component reference because the
271
+ * transcript keeps growing underneath it; re-resolving against the current
272
+ * children each time is what keeps the cursor pointing at a live entry.
273
+ */
274
+ focusedToolIndex = null;
275
+ /** The startup wordmark, held so it can be taken back out once it is done. */
276
+ splash;
277
+ /** Indices the user expanded one at a time, so the global toggle does not undo them silently. */
278
+ expandedToolIds = new Set();
254
279
  // Thinking block visibility state
255
280
  hideThinkingBlock = false;
256
281
  outputPad = 1;
@@ -544,7 +569,8 @@ export class InteractiveMode {
544
569
  else {
545
570
  this.builtInHeader = new Text("", 0, 0);
546
571
  }
547
- this.headerContainer.addChild(new DalSplashAnimation(this.ui, theme, this.version));
572
+ this.splash = new DalSplashAnimation(this.ui, theme, this.version);
573
+ this.headerContainer.addChild(this.splash);
548
574
  if (this.options.verbose) {
549
575
  this.headerContainer.addChild(this.builtInHeader);
550
576
  }
@@ -562,12 +588,14 @@ export class InteractiveMode {
562
588
  if (this.chatContainer.children.length > 0) {
563
589
  this.chatContainer.addChild(new Spacer(1));
564
590
  }
565
- this.chatContainer.addChild(new DynamicBorder());
591
+ // One muted line, no rules around it. This fires once per upgrade, but it
592
+ // shares the top of the screen with everything else a session opens with,
593
+ // and two full-width borders for a single sentence made a footnote look
594
+ // like an alert.
566
595
  const versionMatch = this.changelogMarkdown.match(/##\s+\[?(\d+\.\d+\.\d+)\]?/);
567
596
  const latestVersion = versionMatch ? versionMatch[1] : this.version;
568
- const condensedText = `Updated to v${latestVersion}. Use ${theme.bold("/changelog")} to view full changelog.`;
597
+ const condensedText = `${t("已更新到 v{version},").replace("{version}", latestVersion ?? this.version)}${theme.bold("/changelog")}${t(" 查看更新内容。")}`;
569
598
  this.chatContainer.addChild(new Text(theme.fg("muted", condensedText), 1, 0));
570
- this.chatContainer.addChild(new DynamicBorder());
571
599
  }
572
600
  mountInteractiveTui(tui, components) {
573
601
  for (const component of components)
@@ -807,7 +835,7 @@ export class InteractiveMode {
807
835
  if (modelsJsonError) {
808
836
  this.showError(`models.json error: ${modelsJsonError}`);
809
837
  }
810
- if (modelFallbackMessage && !modelFallbackMessage.startsWith("No models available.")) {
838
+ if (modelFallbackMessage && !isNoModelsAvailableMessage(modelFallbackMessage)) {
811
839
  this.showWarning(modelFallbackMessage);
812
840
  }
813
841
  void this.maybeWarnAboutAnthropicSubscriptionAuth();
@@ -1702,6 +1730,14 @@ export class InteractiveMode {
1702
1730
  this.clearStatusIndicator("working");
1703
1731
  return;
1704
1732
  }
1733
+ // Re-checked on every refresh, not only when the indicator is created.
1734
+ // The inline "Thinking..." pulse starts after "Working..." is already up,
1735
+ // and the early return below meant nothing ever took Working back down —
1736
+ // so both spun at once, saying the same thing twice.
1737
+ if (this.hasInlineActivity()) {
1738
+ this.clearStatusIndicator("working");
1739
+ return;
1740
+ }
1705
1741
  if (this.activeStatusIndicator) {
1706
1742
  return;
1707
1743
  }
@@ -2348,6 +2384,8 @@ export class InteractiveMode {
2348
2384
  this.ui.onDebug = () => this.handleDebugCommand();
2349
2385
  this.defaultEditor.onAction("app.model.select", () => this.showModelSelector());
2350
2386
  this.defaultEditor.onAction("app.tools.expand", () => this.toggleToolOutputExpansion());
2387
+ this.defaultEditor.onAction("app.tools.focusPrev", () => this.focusTool(-1));
2388
+ this.defaultEditor.onAction("app.tools.focusNext", () => this.focusTool(1));
2351
2389
  this.defaultEditor.onAction("app.thinking.toggle", () => this.toggleThinkingBlockVisibility());
2352
2390
  this.defaultEditor.onAction("app.editor.external", () => void this.handleOpenExternalEditor());
2353
2391
  this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand({ flashConfirmation: true, preferSelection: true }));
@@ -2671,6 +2709,11 @@ export class InteractiveMode {
2671
2709
  this.ui.requestRender();
2672
2710
  break;
2673
2711
  case "turn_start":
2712
+ // Park the cursor when a new turn starts. Leaving it on an entry
2713
+ // from three questions ago means the next ctrl+o silently acts on
2714
+ // something scrolled far off screen.
2715
+ this.clearToolFocus();
2716
+ this.retireSplash();
2674
2717
  if (this.settingsManager.getShowTerminalProgress()) {
2675
2718
  this.ui.terminal.setProgress(true);
2676
2719
  }
@@ -3300,7 +3343,14 @@ export class InteractiveMode {
3300
3343
  rebuildChatFromMessages() {
3301
3344
  this.chatContainer.clear();
3302
3345
  this.renderSessionEntries(this.sessionManager.buildContextEntries());
3303
- foldQuietToolStreak(this.chatContainer.children);
3346
+ // "all" is safe here and only here: the transcript was just rebuilt from
3347
+ // scratch, so there is no previous viewport for a full repaint to
3348
+ // disturb. Everywhere else folding must stay at the tail.
3349
+ foldQuietToolStreak(this.chatContainer.children, "all");
3350
+ // A resumed session arrives with a full transcript and no turn yet, so
3351
+ // waiting for turn_start would leave the wordmark sitting on top of it.
3352
+ if (this.chatContainer.children.length > 0)
3353
+ this.retireSplash();
3304
3354
  }
3305
3355
  // =========================================================================
3306
3356
  // Key handlers
@@ -3562,8 +3612,85 @@ export class InteractiveMode {
3562
3612
  this.showError(error instanceof Error ? error.message : String(error));
3563
3613
  }
3564
3614
  }
3615
+ /** The transcript's tool calls, in the order they were appended. */
3616
+ focusableTools() {
3617
+ return this.chatContainer.children.filter((child) => isFocusableTool(child));
3618
+ }
3619
+ /**
3620
+ * Move the cursor across tool calls.
3621
+ *
3622
+ * Entering from nowhere lands on the most recent call rather than the first,
3623
+ * because the thing a reader wants to open is almost always what just
3624
+ * happened, and the transcript can be thousands of entries long.
3625
+ */
3626
+ focusTool(delta) {
3627
+ const tools = this.focusableTools();
3628
+ if (tools.length === 0) {
3629
+ this.showStatus(t("还没有工具调用可以展开"));
3630
+ return;
3631
+ }
3632
+ const next = this.focusedToolIndex === null
3633
+ ? tools.length - 1
3634
+ : Math.min(tools.length - 1, Math.max(0, this.focusedToolIndex + delta));
3635
+ this.focusedToolIndex = next;
3636
+ tools.forEach((tool, index) => {
3637
+ tool.setFocused(index === next);
3638
+ });
3639
+ this.showStatus(`${t("工具调用")} ${next + 1}/${tools.length} — ${this.getAppKeyDisplay("app.tools.expand")} ${t("展开")}`);
3640
+ this.ui.requestRender();
3641
+ }
3642
+ /**
3643
+ * Take the startup wordmark out of the document once there is a conversation.
3644
+ *
3645
+ * It was added at the top and never removed, so it stayed part of the
3646
+ * rendered document forever — re-rendered on every frame, above a transcript
3647
+ * that grows past the viewport. In VS Code's terminal that left the banner
3648
+ * painted across the top of the screen with live output running underneath
3649
+ * it. It has done its job by the time the first prompt is sent.
3650
+ */
3651
+ retireSplash() {
3652
+ if (!this.splash)
3653
+ return;
3654
+ const index = this.headerContainer.children.indexOf(this.splash);
3655
+ if (index !== -1)
3656
+ this.headerContainer.children.splice(index, 1);
3657
+ this.splash.dispose();
3658
+ this.splash = undefined;
3659
+ this.ui.requestRender();
3660
+ }
3661
+ /** Drop the cursor; ctrl+o goes back to meaning "all tool output". */
3662
+ clearToolFocus() {
3663
+ if (this.focusedToolIndex === null)
3664
+ return;
3665
+ this.focusedToolIndex = null;
3666
+ for (const tool of this.focusableTools())
3667
+ tool.setFocused(false);
3668
+ this.ui.requestRender();
3669
+ }
3565
3670
  toggleToolOutputExpansion() {
3566
- this.setToolsExpanded(!this.toolOutputExpanded);
3671
+ // With the cursor parked this is the global toggle it has always been.
3672
+ // With a call picked out it acts on that one only — otherwise picking a
3673
+ // call out would do nothing, which is the whole point of picking it.
3674
+ if (this.focusedToolIndex === null) {
3675
+ this.setToolsExpanded(!this.toolOutputExpanded);
3676
+ return;
3677
+ }
3678
+ const tools = this.focusableTools();
3679
+ const tool = tools[this.focusedToolIndex];
3680
+ if (!tool) {
3681
+ this.clearToolFocus();
3682
+ this.setToolsExpanded(!this.toolOutputExpanded);
3683
+ return;
3684
+ }
3685
+ const expanded = !this.expandedToolIds.has(this.focusedToolIndex);
3686
+ if (expanded)
3687
+ this.expandedToolIds.add(this.focusedToolIndex);
3688
+ else
3689
+ this.expandedToolIds.delete(this.focusedToolIndex);
3690
+ tool.setExpanded(expanded);
3691
+ tool.setFocused(true);
3692
+ this.showStatus(`${t("工具调用")} ${this.focusedToolIndex + 1}/${tools.length}: ${expanded ? t("已展开") : t("已收起")}`);
3693
+ this.ui.requestRender();
3567
3694
  }
3568
3695
  setToolsExpanded(expanded) {
3569
3696
  if (expanded === this.toolOutputExpanded)
@@ -3580,7 +3707,10 @@ export class InteractiveMode {
3580
3707
  }
3581
3708
  }
3582
3709
  }
3583
- foldQuietToolStreak(this.chatContainer.children);
3710
+ // "all": ctrl+o has just changed every row in the document anyway, so a
3711
+ // full repaint is already unavoidable and folding only the tail would
3712
+ // leave the rest of the history in the wrong state.
3713
+ foldQuietToolStreak(this.chatContainer.children, "all");
3584
3714
  this.showStatus(`Tool output: ${expanded ? "expanded" : "collapsed"}`);
3585
3715
  }
3586
3716
  /** Update rendered assistant messages without rebuilding live tool components. */
@@ -5124,6 +5254,14 @@ export class InteractiveMode {
5124
5254
  if (error instanceof CredentialSynchronizationError) {
5125
5255
  this.showError(`Logged in to ${providerName}, but local model state could not be synchronized: ${errorMsg}`);
5126
5256
  }
5257
+ else if (isDeviceCodeExpired(error)) {
5258
+ // Not a failure of anything: the device code has a deadline and the
5259
+ // user did not finish in the browser before it passed. Any credential
5260
+ // they already had is untouched, so a red "Failed to login" reads as
5261
+ // if something broke and sends people looking for a problem that is
5262
+ // not there.
5263
+ this.showStatus(t("登录未完成(验证码已过期),原有登录不受影响。可再次 /login。"));
5264
+ }
5127
5265
  else if (errorMsg !== "Login cancelled") {
5128
5266
  this.showError(`Failed to login to ${providerName}: ${errorMsg}`);
5129
5267
  }
@@ -5429,18 +5567,24 @@ export class InteractiveMode {
5429
5567
  }
5430
5568
  handleChangelogCommand() {
5431
5569
  const changelogPath = getChangelogPath();
5432
- const allEntries = parseChangelog(changelogPath);
5433
- const changelogMarkdown = allEntries.length > 0
5434
- ? allEntries
5435
- .reverse()
5436
- .map((e) => normalizeChangelogLinks(e.content, e))
5437
- .join("\n\n")
5438
- : "No changelog entries found.";
5570
+ const entries = parseChangelog(changelogPath);
5571
+ const productEntries = getProductEntries(entries, VERSION);
5572
+ // Pi sections stay in the shipped CHANGELOG.md for attribution and
5573
+ // upgrade archaeology; they are just not what "What's New" means to a
5574
+ // DAL user. Say where they went instead of silently dropping them.
5575
+ const inheritedCount = entries.filter((entry) => entry.upstream).length;
5576
+ const changelogMarkdown = productEntries.length > 0
5577
+ ? productEntries.map((e) => normalizeChangelogLinks(e.content, e)).join("\n\n")
5578
+ : t("没有找到更新记录。");
5439
5579
  this.chatContainer.addChild(new Spacer(1));
5440
5580
  this.chatContainer.addChild(new DynamicBorder());
5441
5581
  this.chatContainer.addChild(new Text(theme.bold(theme.fg("accent", "What's New")), 1, 0));
5442
5582
  this.chatContainer.addChild(new Spacer(1));
5443
5583
  this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
5584
+ if (inheritedCount > 0) {
5585
+ this.chatContainer.addChild(new Spacer(1));
5586
+ this.chatContainer.addChild(new Text(theme.fg("dim", `${t("另有 ")}${inheritedCount}${t(" 段继承自上游 Pi 的历史记录,仅保留在随包发出的 CHANGELOG.md 中,此处不列出。")}`), 1, 0));
5587
+ }
5444
5588
  this.chatContainer.addChild(new DynamicBorder());
5445
5589
  this.ui.requestRender();
5446
5590
  }
@@ -5490,6 +5634,8 @@ export class InteractiveMode {
5490
5634
  const cycleModelForward = this.getAppKeyDisplay("app.model.cycleForward");
5491
5635
  const selectModel = this.getAppKeyDisplay("app.model.select");
5492
5636
  const expandTools = this.getAppKeyDisplay("app.tools.expand");
5637
+ const focusPrevTool = this.getAppKeyDisplay("app.tools.focusPrev");
5638
+ const focusNextTool = this.getAppKeyDisplay("app.tools.focusNext");
5493
5639
  const toggleThinking = this.getAppKeyDisplay("app.thinking.toggle");
5494
5640
  const externalEditor = this.getAppKeyDisplay("app.editor.external");
5495
5641
  const cycleModelBackward = this.getAppKeyDisplay("app.model.cycleBackward");
@@ -5534,7 +5680,8 @@ export class InteractiveMode {
5534
5680
  | \`${cycleThinkingLevel}\` | Cycle thinking level |
5535
5681
  | \`${cycleModelForward}\` / \`${cycleModelBackward}\` | Cycle models |
5536
5682
  | \`${selectModel}\` | Open model selector |
5537
- | \`${expandTools}\` | Toggle tool output expansion |
5683
+ | \`${expandTools}\` | Toggle tool output expansion (the focused call only, when one is focused) |
5684
+ | \`${focusPrevTool}\` / \`${focusNextTool}\` | Move the cursor between tool calls |
5538
5685
  | \`${toggleThinking}\` | Toggle thinking block visibility |
5539
5686
  | \`${externalEditor}\` | Edit message in external editor |
5540
5687
  | \`${copyMessage}\` | Copy last assistant message |
@@ -5633,12 +5780,19 @@ ${screenshot ? `| \`${screenshot}\` | Capture a region screenshot |\n` : ""}| \`
5633
5780
  async handleBashCommand(command, excludeFromContext = false) {
5634
5781
  const extensionRunner = this.session.extensionRunner;
5635
5782
  // Emit user_bash event to let extensions intercept
5636
- const eventResult = await extensionRunner.emitUserBash({
5637
- type: "user_bash",
5638
- command,
5639
- excludeFromContext,
5640
- cwd: this.sessionManager.getCwd(),
5641
- });
5783
+ let eventResult;
5784
+ try {
5785
+ eventResult = await extensionRunner.emitUserBash({
5786
+ type: "user_bash",
5787
+ command,
5788
+ excludeFromContext,
5789
+ cwd: this.sessionManager.getCwd(),
5790
+ });
5791
+ }
5792
+ catch {
5793
+ // The extension runner already reported the error. Do not fall back to local execution.
5794
+ return;
5795
+ }
5642
5796
  // If extension returned a full result, use it directly
5643
5797
  if (eventResult?.result) {
5644
5798
  const result = eventResult.result;