@mariozechner/pi-coding-agent 0.48.0 → 0.49.0

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 (71) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +9 -1
  3. package/dist/core/agent-session.d.ts +2 -1
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +19 -1
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/compaction/compaction.d.ts +11 -0
  8. package/dist/core/compaction/compaction.d.ts.map +1 -1
  9. package/dist/core/compaction/compaction.js +50 -3
  10. package/dist/core/compaction/compaction.js.map +1 -1
  11. package/dist/core/extensions/index.d.ts +1 -1
  12. package/dist/core/extensions/index.d.ts.map +1 -1
  13. package/dist/core/extensions/index.js.map +1 -1
  14. package/dist/core/extensions/loader.d.ts.map +1 -1
  15. package/dist/core/extensions/loader.js +4 -0
  16. package/dist/core/extensions/loader.js.map +1 -1
  17. package/dist/core/extensions/runner.d.ts +2 -0
  18. package/dist/core/extensions/runner.d.ts.map +1 -1
  19. package/dist/core/extensions/runner.js +7 -0
  20. package/dist/core/extensions/runner.js.map +1 -1
  21. package/dist/core/extensions/types.d.ts +23 -0
  22. package/dist/core/extensions/types.d.ts.map +1 -1
  23. package/dist/core/extensions/types.js.map +1 -1
  24. package/dist/core/settings-manager.d.ts +3 -0
  25. package/dist/core/settings-manager.d.ts.map +1 -1
  26. package/dist/core/settings-manager.js +7 -0
  27. package/dist/core/settings-manager.js.map +1 -1
  28. package/dist/core/system-prompt.d.ts.map +1 -1
  29. package/dist/core/system-prompt.js +16 -21
  30. package/dist/core/system-prompt.js.map +1 -1
  31. package/dist/core/tools/path-utils.d.ts +0 -1
  32. package/dist/core/tools/path-utils.d.ts.map +1 -1
  33. package/dist/core/tools/path-utils.js +0 -7
  34. package/dist/core/tools/path-utils.js.map +1 -1
  35. package/dist/core/tools/read.d.ts.map +1 -1
  36. package/dist/core/tools/read.js +2 -12
  37. package/dist/core/tools/read.js.map +1 -1
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/index.js.map +1 -1
  42. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  43. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  44. package/dist/modes/interactive/components/settings-selector.js +13 -1
  45. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  46. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  47. package/dist/modes/interactive/interactive-mode.js +48 -2
  48. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  49. package/dist/modes/print-mode.d.ts.map +1 -1
  50. package/dist/modes/print-mode.js +16 -0
  51. package/dist/modes/print-mode.js.map +1 -1
  52. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  53. package/dist/modes/rpc/rpc-mode.js +16 -0
  54. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  55. package/dist/utils/image-convert.d.ts.map +1 -1
  56. package/dist/utils/image-convert.js +4 -3
  57. package/dist/utils/image-convert.js.map +1 -1
  58. package/dist/utils/image-resize.d.ts.map +1 -1
  59. package/dist/utils/image-resize.js +2 -2
  60. package/dist/utils/image-resize.js.map +1 -1
  61. package/dist/utils/photon.d.ts +5 -13
  62. package/dist/utils/photon.d.ts.map +1 -1
  63. package/dist/utils/photon.js +19 -31
  64. package/dist/utils/photon.js.map +1 -1
  65. package/docs/extensions.md +67 -1
  66. package/examples/extensions/README.md +1 -0
  67. package/examples/extensions/custom-header.ts +2 -1
  68. package/examples/extensions/trigger-compact.ts +40 -0
  69. package/examples/extensions/with-deps/package-lock.json +2 -2
  70. package/examples/extensions/with-deps/package.json +1 -1
  71. package/package.json +4 -4
@@ -131,7 +131,7 @@ export class InteractiveMode {
131
131
  this.options = options;
132
132
  this.session = session;
133
133
  this.version = VERSION;
134
- this.ui = new TUI(new ProcessTerminal());
134
+ this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor());
135
135
  this.chatContainer = new Container();
136
136
  this.pendingMessagesContainer = new Container();
137
137
  this.statusContainer = new Container();
@@ -509,6 +509,9 @@ export class InteractiveMode {
509
509
  getSessionName: () => {
510
510
  return this.sessionManager.getSessionName();
511
511
  },
512
+ setLabel: (entryId, label) => {
513
+ this.sessionManager.appendLabelChange(entryId, label);
514
+ },
512
515
  getActiveTools: () => this.session.getActiveToolNames(),
513
516
  getAllTools: () => this.session.getAllTools(),
514
517
  setActiveTools: (toolNames) => this.session.setActiveToolsByName(toolNames),
@@ -531,6 +534,21 @@ export class InteractiveMode {
531
534
  shutdown: () => {
532
535
  this.shutdownRequested = true;
533
536
  },
537
+ getContextUsage: () => this.session.getContextUsage(),
538
+ compact: (options) => {
539
+ void (async () => {
540
+ try {
541
+ const result = await this.executeCompaction(options?.customInstructions, false);
542
+ if (result) {
543
+ options?.onComplete?.(result);
544
+ }
545
+ }
546
+ catch (error) {
547
+ const err = error instanceof Error ? error : new Error(String(error));
548
+ options?.onError?.(err);
549
+ }
550
+ })();
551
+ },
534
552
  },
535
553
  // ExtensionCommandContextActions - for ctx.* in command handlers
536
554
  {
@@ -638,6 +656,21 @@ export class InteractiveMode {
638
656
  shutdown: () => {
639
657
  this.shutdownRequested = true;
640
658
  },
659
+ getContextUsage: () => this.session.getContextUsage(),
660
+ compact: (options) => {
661
+ void (async () => {
662
+ try {
663
+ const result = await this.executeCompaction(options?.customInstructions, false);
664
+ if (result) {
665
+ options?.onComplete?.(result);
666
+ }
667
+ }
668
+ catch (error) {
669
+ const err = error instanceof Error ? error : new Error(String(error));
670
+ options?.onError?.(err);
671
+ }
672
+ })();
673
+ },
641
674
  });
642
675
  // Set up the extension shortcut handler on the default editor
643
676
  this.defaultEditor.onExtensionShortcut = (data) => {
@@ -2144,6 +2177,7 @@ export class InteractiveMode {
2144
2177
  hideThinkingBlock: this.hideThinkingBlock,
2145
2178
  collapseChangelog: this.settingsManager.getCollapseChangelog(),
2146
2179
  doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
2180
+ showHardwareCursor: this.settingsManager.getShowHardwareCursor(),
2147
2181
  editorPaddingX: this.settingsManager.getEditorPaddingX(),
2148
2182
  }, {
2149
2183
  onAutoCompactChange: (enabled) => {
@@ -2211,6 +2245,10 @@ export class InteractiveMode {
2211
2245
  onDoubleEscapeActionChange: (action) => {
2212
2246
  this.settingsManager.setDoubleEscapeAction(action);
2213
2247
  },
2248
+ onShowHardwareCursorChange: (enabled) => {
2249
+ this.settingsManager.setShowHardwareCursor(enabled);
2250
+ this.ui.setShowHardwareCursor(enabled);
2251
+ },
2214
2252
  onEditorPaddingXChange: (padding) => {
2215
2253
  this.settingsManager.setEditorPaddingX(padding);
2216
2254
  this.defaultEditor.setPaddingX(padding);
@@ -2906,8 +2944,11 @@ export class InteractiveMode {
2906
2944
  const submit = this.getEditorKeyDisplay("submit");
2907
2945
  const newLine = this.getEditorKeyDisplay("newLine");
2908
2946
  const deleteWordBackward = this.getEditorKeyDisplay("deleteWordBackward");
2947
+ const deleteWordForward = this.getEditorKeyDisplay("deleteWordForward");
2909
2948
  const deleteToLineStart = this.getEditorKeyDisplay("deleteToLineStart");
2910
2949
  const deleteToLineEnd = this.getEditorKeyDisplay("deleteToLineEnd");
2950
+ const yank = this.getEditorKeyDisplay("yank");
2951
+ const yankPop = this.getEditorKeyDisplay("yankPop");
2911
2952
  const tab = this.getEditorKeyDisplay("tab");
2912
2953
  // App keybindings
2913
2954
  const interrupt = this.getAppKeyDisplay("interrupt");
@@ -2936,8 +2977,11 @@ export class InteractiveMode {
2936
2977
  | \`${submit}\` | Send message |
2937
2978
  | \`${newLine}\` | New line${process.platform === "win32" ? " (Ctrl+Enter on Windows Terminal)" : ""} |
2938
2979
  | \`${deleteWordBackward}\` | Delete word backwards |
2980
+ | \`${deleteWordForward}\` | Delete word forwards |
2939
2981
  | \`${deleteToLineStart}\` | Delete to start of line |
2940
2982
  | \`${deleteToLineEnd}\` | Delete to end of line |
2983
+ | \`${yank}\` | Paste the most-recently-deleted text |
2984
+ | \`${yankPop}\` | Cycle through the deleted text after pasting |
2941
2985
 
2942
2986
  **Other**
2943
2987
  | Key | Action |
@@ -3129,8 +3173,9 @@ export class InteractiveMode {
3129
3173
  const compactingLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
3130
3174
  this.statusContainer.addChild(compactingLoader);
3131
3175
  this.ui.requestRender();
3176
+ let result;
3132
3177
  try {
3133
- const result = await this.session.compact(customInstructions);
3178
+ result = await this.session.compact(customInstructions);
3134
3179
  // Rebuild UI
3135
3180
  this.rebuildChatFromMessages();
3136
3181
  // Add compaction component at bottom so user sees it without scrolling
@@ -3153,6 +3198,7 @@ export class InteractiveMode {
3153
3198
  this.defaultEditor.onEscape = originalOnEscape;
3154
3199
  }
3155
3200
  void this.flushCompactionQueue({ willRetry: false });
3201
+ return result;
3156
3202
  }
3157
3203
  stop() {
3158
3204
  if (this.loadingAnimation) {