@averyyy/pi-coding-agent 0.84.3-piclient.1 → 0.84.4-piclient.2

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 (95) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/README.md +5 -4
  3. package/dist/bundle/chunks/{chunk-GPPBJGBU.js → chunk-2KVJKXS2.js} +1 -1
  4. package/dist/bundle/chunks/{chunk-QI42RBZ4.js → chunk-WJEX5SB4.js} +74 -74
  5. package/dist/bundle/chunks/{google-generative-ai-XDKMGBCJ.js → google-generative-ai-YMUPJBKR.js} +1 -1
  6. package/dist/bundle/chunks/{google-vertex-D5FGEO3Y.js → google-vertex-MPWMV4OF.js} +1 -1
  7. package/dist/bundle/chunks/https-proxy-agent-2VXB7436.js +13 -0
  8. package/dist/bundle/chunks/{mistral-conversations-YK73UAOZ.js → mistral-conversations-Q3AWZJAZ.js} +1 -1
  9. package/dist/bundle/chunks/{openai-completions-JD4WAC3R.js → openai-completions-ERMU2SS7.js} +1 -1
  10. package/dist/bundle/cli.js +1 -1
  11. package/dist/bundle/index.js +1 -1
  12. package/dist/bundle/rpc-entry.js +1 -1
  13. package/dist/cli/startup-ui.d.ts.map +1 -1
  14. package/dist/cli/startup-ui.js +2 -1
  15. package/dist/cli/startup-ui.js.map +1 -1
  16. package/dist/core/agent-session.d.ts +15 -1
  17. package/dist/core/agent-session.d.ts.map +1 -1
  18. package/dist/core/agent-session.js +122 -21
  19. package/dist/core/agent-session.js.map +1 -1
  20. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  21. package/dist/core/compaction/branch-summarization.js +8 -1
  22. package/dist/core/compaction/branch-summarization.js.map +1 -1
  23. package/dist/core/compaction/compaction.d.ts +9 -4
  24. package/dist/core/compaction/compaction.d.ts.map +1 -1
  25. package/dist/core/compaction/compaction.js +42 -22
  26. package/dist/core/compaction/compaction.js.map +1 -1
  27. package/dist/core/extensions/index.d.ts +1 -1
  28. package/dist/core/extensions/index.d.ts.map +1 -1
  29. package/dist/core/extensions/index.js.map +1 -1
  30. package/dist/core/extensions/runner.d.ts +5 -0
  31. package/dist/core/extensions/runner.d.ts.map +1 -1
  32. package/dist/core/extensions/runner.js +45 -1
  33. package/dist/core/extensions/runner.js.map +1 -1
  34. package/dist/core/extensions/types.d.ts +18 -1
  35. package/dist/core/extensions/types.d.ts.map +1 -1
  36. package/dist/core/extensions/types.js.map +1 -1
  37. package/dist/core/pi-server-client.d.ts.map +1 -1
  38. package/dist/core/pi-server-client.js +26 -9
  39. package/dist/core/pi-server-client.js.map +1 -1
  40. package/dist/core/session-manager.d.ts.map +1 -1
  41. package/dist/core/session-manager.js +4 -2
  42. package/dist/core/session-manager.js.map +1 -1
  43. package/dist/core/settings-manager.d.ts +8 -1
  44. package/dist/core/settings-manager.d.ts.map +1 -1
  45. package/dist/core/settings-manager.js +17 -0
  46. package/dist/core/settings-manager.js.map +1 -1
  47. package/dist/index.d.ts +2 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +1 -0
  50. package/dist/index.js.map +1 -1
  51. package/dist/main.d.ts.map +1 -1
  52. package/dist/main.js +2 -0
  53. package/dist/main.js.map +1 -1
  54. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  55. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  56. package/dist/modes/interactive/components/settings-selector.js +10 -0
  57. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  58. package/dist/modes/interactive/interactive-mode.d.ts +5 -0
  59. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  60. package/dist/modes/interactive/interactive-mode.js +65 -28
  61. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  62. package/dist/modes/rpc/rpc-client.d.ts +7 -0
  63. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  64. package/dist/modes/rpc/rpc-client.js +7 -0
  65. package/dist/modes/rpc/rpc-client.js.map +1 -1
  66. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  67. package/dist/modes/rpc/rpc-mode.js +3 -0
  68. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  69. package/dist/modes/rpc/rpc-types.d.ts +12 -0
  70. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  71. package/dist/modes/rpc/rpc-types.js.map +1 -1
  72. package/dist/utils/shell.d.ts.map +1 -1
  73. package/dist/utils/shell.js +6 -4
  74. package/dist/utils/shell.js.map +1 -1
  75. package/docs/compaction.md +2 -0
  76. package/docs/custom-provider.md +7 -7
  77. package/docs/environment-variables.md +3 -0
  78. package/docs/extensions.md +18 -0
  79. package/docs/keybindings.md +1 -1
  80. package/docs/quickstart.md +1 -1
  81. package/docs/rpc.md +23 -0
  82. package/docs/settings.md +12 -4
  83. package/docs/terminal-setup.md +12 -0
  84. package/docs/usage.md +4 -3
  85. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  86. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  87. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  88. package/examples/extensions/gondolin/package-lock.json +2 -2
  89. package/examples/extensions/gondolin/package.json +1 -1
  90. package/examples/extensions/sandbox/package-lock.json +2 -2
  91. package/examples/extensions/sandbox/package.json +1 -1
  92. package/examples/extensions/with-deps/package-lock.json +2 -2
  93. package/examples/extensions/with-deps/package.json +1 -1
  94. package/package.json +6 -6
  95. package/dist/bundle/chunks/dist-RDWOYWHR.js +0 -13
@@ -7,7 +7,7 @@ import * as fs from "node:fs";
7
7
  import * as os from "node:os";
8
8
  import * as path from "node:path";
9
9
  import * as TuiLayouts from "@earendil-works/pi-tui";
10
- import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
10
+ import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, ProcessTerminal, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
11
11
  import chalk from "chalk";
12
12
  import { spawn } from "child_process";
13
13
  import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
@@ -188,6 +188,7 @@ export function createInteractiveTui(options) {
188
188
  searchCurrentMatchStyle: (text) => theme.bold(theme.inverse(styleSearchMatch(text))),
189
189
  openUrl: openBrowser,
190
190
  onRightClickPaste: options.onRightClickPaste,
191
+ copyOnSelect: options.fullscreenCopyOnSelect,
191
192
  copySelection: async (text) => {
192
193
  try {
193
194
  await copyToClipboard(text);
@@ -351,6 +352,7 @@ export class InteractiveMode {
351
352
  }
352
353
  constructor(runtimeHost, options = {}) {
353
354
  this.runtimeHost = runtimeHost;
355
+ setCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());
354
356
  const tuiMode = options.tuiMode ?? this.settingsManager.getTuiMode();
355
357
  this.options = { ...options, tuiMode };
356
358
  this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;
@@ -367,6 +369,7 @@ export class InteractiveMode {
367
369
  showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
368
370
  logDirectory: getAgentDir(),
369
371
  onRightClickPaste: this.onRightClickPaste,
372
+ fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
370
373
  });
371
374
  this.ui = createInteractiveTuiReference(() => this.renderer);
372
375
  this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
@@ -614,6 +617,7 @@ export class InteractiveMode {
614
617
  logDirectory: getAgentDir(),
615
618
  terminal,
616
619
  onRightClickPaste: this.onRightClickPaste,
620
+ fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
617
621
  });
618
622
  nextUi.setClearOnShrink(clearOnShrink);
619
623
  nextUi.onDebug = onDebug;
@@ -1522,8 +1526,12 @@ export class InteractiveMode {
1522
1526
  this.transcriptScrollView?.setScrollbar(this.settingsManager.getFullscreenScrollbar());
1523
1527
  }
1524
1528
  applyRuntimeSettings() {
1529
+ setCapabilityOverrides(this.settingsManager.getTerminalCapabilityOverrides());
1525
1530
  configureHttpDispatcher(this.settingsManager.getHttpIdleTimeoutMs());
1526
1531
  this.applyFullscreenScrollbarSetting();
1532
+ if (this.renderer instanceof TuiAltScreen) {
1533
+ this.renderer.setCopyOnSelect(this.settingsManager.getFullscreenCopyOnSelect());
1534
+ }
1527
1535
  this.footer.setSession(this.session);
1528
1536
  this.footer.setAutoCompactEnabled(this.session.autoCompactionEnabled);
1529
1537
  this.footerDataProvider.setCwd(this.sessionManager.getCwd());
@@ -1673,6 +1681,20 @@ export class InteractiveMode {
1673
1681
  this.statusContainer.addChild(this.idleStatus);
1674
1682
  }
1675
1683
  }
1684
+ showWorkingStatusIndicator() {
1685
+ this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions));
1686
+ }
1687
+ restoreWorkingStatusIndicatorIfStreaming() {
1688
+ if (!this.session.isStreaming) {
1689
+ return;
1690
+ }
1691
+ if (this.workingVisible && this.activeStatusIndicator?.kind !== "working") {
1692
+ this.showWorkingStatusIndicator();
1693
+ }
1694
+ if (this.settingsManager.getShowTerminalProgress()) {
1695
+ this.ui.terminal.setProgress(true);
1696
+ }
1697
+ }
1676
1698
  setWorkingVisible(visible) {
1677
1699
  this.workingVisible = visible;
1678
1700
  if (!visible) {
@@ -1681,7 +1703,7 @@ export class InteractiveMode {
1681
1703
  return;
1682
1704
  }
1683
1705
  if (this.session.isStreaming && this.activeStatusIndicator?.kind !== "working") {
1684
- this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions));
1706
+ this.showWorkingStatusIndicator();
1685
1707
  }
1686
1708
  this.ui.requestRender();
1687
1709
  }
@@ -2301,7 +2323,7 @@ export class InteractiveMode {
2301
2323
  this.defaultEditor.onAction("app.tools.expand", () => this.toggleToolOutputExpansion());
2302
2324
  this.defaultEditor.onAction("app.thinking.toggle", () => this.toggleThinkingBlockVisibility());
2303
2325
  this.defaultEditor.onAction("app.editor.external", () => void this.handleOpenExternalEditor());
2304
- this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand({ flashConfirmation: true }));
2326
+ this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand({ flashConfirmation: true, preferSelection: true }));
2305
2327
  this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
2306
2328
  this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
2307
2329
  this.defaultEditor.onAction("app.session.new", () => this.handleClearCommand());
@@ -2568,17 +2590,21 @@ export class InteractiveMode {
2568
2590
  switch (event.type) {
2569
2591
  case "agent_start":
2570
2592
  this.pendingTools.clear();
2571
- if (this.settingsManager.getShowTerminalProgress()) {
2572
- this.ui.terminal.setProgress(true);
2573
- }
2574
2593
  // Restore main escape handler if retry handler is still active
2575
2594
  // (retry success event fires later, but we need main handler now)
2576
2595
  if (this.retryEscapeHandler) {
2577
2596
  this.defaultEditor.onEscape = this.retryEscapeHandler;
2578
2597
  this.retryEscapeHandler = undefined;
2579
2598
  }
2599
+ break;
2600
+ case "turn_start":
2601
+ if (this.settingsManager.getShowTerminalProgress()) {
2602
+ this.ui.terminal.setProgress(true);
2603
+ }
2580
2604
  if (this.workingVisible) {
2581
- this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions));
2605
+ if (this.activeStatusIndicator?.kind !== "working") {
2606
+ this.showWorkingStatusIndicator();
2607
+ }
2582
2608
  }
2583
2609
  else {
2584
2610
  this.clearStatusIndicator();
@@ -2724,10 +2750,6 @@ export class InteractiveMode {
2724
2750
  break;
2725
2751
  }
2726
2752
  case "agent_end":
2727
- if (this.settingsManager.getShowTerminalProgress()) {
2728
- this.ui.terminal.setProgress(false);
2729
- }
2730
- this.clearStatusIndicator("working");
2731
2753
  if (this.streamingComponent) {
2732
2754
  this.chatContainer.removeChild(this.streamingComponent);
2733
2755
  this.streamingComponent = undefined;
@@ -2737,6 +2759,10 @@ export class InteractiveMode {
2737
2759
  this.ui.requestRender();
2738
2760
  break;
2739
2761
  case "agent_settled":
2762
+ if (this.settingsManager.getShowTerminalProgress()) {
2763
+ this.ui.terminal.setProgress(false);
2764
+ }
2765
+ this.clearStatusIndicator("working");
2740
2766
  await this.checkShutdownRequested();
2741
2767
  break;
2742
2768
  case "compaction_start": {
@@ -2796,6 +2822,7 @@ export class InteractiveMode {
2796
2822
  this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
2797
2823
  }
2798
2824
  }
2825
+ this.restoreWorkingStatusIndicatorIfStreaming();
2799
2826
  void this.flushCompactionQueue({ willRetry: event.willRetry });
2800
2827
  this.ui.requestRender();
2801
2828
  break;
@@ -2821,6 +2848,7 @@ export class InteractiveMode {
2821
2848
  if (!event.success) {
2822
2849
  this.showError(`Retry failed after ${event.attempt} attempts: ${event.finalError || "Unknown error"}`);
2823
2850
  }
2851
+ this.restoreWorkingStatusIndicatorIfStreaming();
2824
2852
  this.ui.requestRender();
2825
2853
  break;
2826
2854
  }
@@ -3448,18 +3476,19 @@ export class InteractiveMode {
3448
3476
  }
3449
3477
  this.showStatus(`Tool output: ${expanded ? "expanded" : "collapsed"}`);
3450
3478
  }
3479
+ /** Update rendered assistant messages without rebuilding live tool components. */
3480
+ updateThinkingBlockVisibility() {
3481
+ for (const child of this.chatContainer.children) {
3482
+ if (child instanceof AssistantMessageComponent) {
3483
+ child.setHideThinkingBlock(this.hideThinkingBlock);
3484
+ }
3485
+ }
3486
+ this.ui.requestRender();
3487
+ }
3451
3488
  toggleThinkingBlockVisibility() {
3452
3489
  this.hideThinkingBlock = !this.hideThinkingBlock;
3453
3490
  this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock);
3454
- // Rebuild chat from session messages
3455
- this.chatContainer.clear();
3456
- this.rebuildChatFromMessages();
3457
- // If streaming, re-add the streaming component with updated visibility and re-render
3458
- if (this.streamingComponent && this.streamingMessage) {
3459
- this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock);
3460
- this.streamingComponent.updateContent(this.streamingMessage);
3461
- this.chatContainer.addChild(this.streamingComponent);
3462
- }
3491
+ this.updateThinkingBlockVisibility();
3463
3492
  this.showStatus(`Thinking blocks: ${this.hideThinkingBlock ? "hidden" : "visible"}`);
3464
3493
  }
3465
3494
  async handleOpenExternalEditor() {
@@ -3776,6 +3805,7 @@ export class InteractiveMode {
3776
3805
  tuiMode: this.ui.mode,
3777
3806
  fullscreenExitOutput: this.settingsManager.getFullscreenExitOutput(),
3778
3807
  fullscreenScrollbar: this.settingsManager.getFullscreenScrollbar(),
3808
+ fullscreenCopyOnSelect: this.settingsManager.getFullscreenCopyOnSelect(),
3779
3809
  warnings: this.settingsManager.getWarnings(),
3780
3810
  }, {
3781
3811
  onAutoCompactChange: (enabled) => {
@@ -3852,13 +3882,7 @@ export class InteractiveMode {
3852
3882
  onHideThinkingBlockChange: (hidden) => {
3853
3883
  this.hideThinkingBlock = hidden;
3854
3884
  this.settingsManager.setHideThinkingBlock(hidden);
3855
- for (const child of this.chatContainer.children) {
3856
- if (child instanceof AssistantMessageComponent) {
3857
- child.setHideThinkingBlock(hidden);
3858
- }
3859
- }
3860
- this.chatContainer.clear();
3861
- this.rebuildChatFromMessages();
3885
+ this.updateThinkingBlockVisibility();
3862
3886
  },
3863
3887
  onMermaidRenderingModeChange: (mode) => {
3864
3888
  this.settingsManager.setMermaidRenderingMode(mode);
@@ -3952,6 +3976,11 @@ export class InteractiveMode {
3952
3976
  this.settingsManager.setFullscreenScrollbar(mode);
3953
3977
  this.applyFullscreenScrollbarSetting();
3954
3978
  },
3979
+ onFullscreenCopyOnSelectChange: (enabled) => {
3980
+ this.settingsManager.setFullscreenCopyOnSelect(enabled);
3981
+ if (this.renderer instanceof TuiAltScreen)
3982
+ this.renderer.setCopyOnSelect(enabled);
3983
+ },
3955
3984
  onWarningsChange: (warnings) => {
3956
3985
  this.settingsManager.setWarnings(warnings);
3957
3986
  },
@@ -4141,6 +4170,7 @@ export class InteractiveMode {
4141
4170
  const selectModel = async (model, persist) => {
4142
4171
  try {
4143
4172
  await this.session.setModel(model, { persist });
4173
+ this.updateAvailableProviderCount();
4144
4174
  this.footer.invalidate();
4145
4175
  this.updateEditorBorderColor();
4146
4176
  done();
@@ -4989,8 +5019,8 @@ export class InteractiveMode {
4989
5019
  activeHeader.setExpanded(this.toolOutputExpanded);
4990
5020
  }
4991
5021
  setRegisteredThemes(this.session.resourceLoader.getThemes().themes);
4992
- await this.themeController.applyFromSettings();
4993
5022
  this.applyRuntimeSettings();
5023
+ await this.themeController.applyFromSettings();
4994
5024
  this.setupAutocompleteProvider();
4995
5025
  const runner = this.session.extensionRunner;
4996
5026
  this.setupExtensionShortcuts(runner);
@@ -5112,6 +5142,13 @@ export class InteractiveMode {
5112
5142
  });
5113
5143
  }
5114
5144
  async handleCopyCommand(options = {}) {
5145
+ if (options.preferSelection &&
5146
+ this.ui instanceof TuiAltScreen &&
5147
+ !this.ui.getCopyOnSelect() &&
5148
+ this.ui.hasActiveSelection()) {
5149
+ await this.ui.copyActiveSelectionToClipboard();
5150
+ return;
5151
+ }
5115
5152
  const text = this.session.getLastAssistantText();
5116
5153
  if (!text) {
5117
5154
  this.showError("No agent messages to copy yet.");