@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.
- package/CHANGELOG.md +29 -0
- package/README.md +9 -1
- package/dist/core/agent-session.d.ts +2 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +19 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +11 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +50 -3
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +7 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +23 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +7 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +16 -21
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +0 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +0 -7
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +2 -12
- package/dist/core/tools/read.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +13 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +48 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +16 -0
- 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 +16 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +4 -3
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +2 -2
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/photon.d.ts +5 -13
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +19 -31
- package/dist/utils/photon.js.map +1 -1
- package/docs/extensions.md +67 -1
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/custom-header.ts +2 -1
- package/examples/extensions/trigger-compact.ts +40 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- 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
|
-
|
|
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) {
|