@mariozechner/pi-coding-agent 0.63.0 → 0.63.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.
- package/CHANGELOG.md +35 -0
- package/README.md +2 -2
- package/dist/core/agent-session.d.ts +4 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +65 -10
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +18 -17
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +10 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +34 -18
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +3 -3
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +50 -25
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +7 -17
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +23 -98
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts +5 -10
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -7
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +27 -64
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +44 -1
- package/docs/skills.md +3 -2
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/trigger-compact.ts +11 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -991,6 +991,7 @@ export class InteractiveMode {
|
|
|
991
991
|
modelRegistry: this.session.modelRegistry,
|
|
992
992
|
model: this.session.model,
|
|
993
993
|
isIdle: () => !this.session.isStreaming,
|
|
994
|
+
signal: this.session.agent.signal,
|
|
994
995
|
abort: () => this.session.abort(),
|
|
995
996
|
hasPendingMessages: () => this.session.pendingMessageCount > 0,
|
|
996
997
|
shutdown: () => {
|
|
@@ -1000,10 +1001,8 @@ export class InteractiveMode {
|
|
|
1000
1001
|
compact: (options) => {
|
|
1001
1002
|
void (async () => {
|
|
1002
1003
|
try {
|
|
1003
|
-
const result = await this.
|
|
1004
|
-
|
|
1005
|
-
options?.onComplete?.(result);
|
|
1006
|
-
}
|
|
1004
|
+
const result = await this.session.compact(options?.customInstructions);
|
|
1005
|
+
options?.onComplete?.(result);
|
|
1007
1006
|
}
|
|
1008
1007
|
catch (error) {
|
|
1009
1008
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1966,54 +1965,54 @@ export class InteractiveMode {
|
|
|
1966
1965
|
await this.checkShutdownRequested();
|
|
1967
1966
|
this.ui.requestRender();
|
|
1968
1967
|
break;
|
|
1969
|
-
case "
|
|
1968
|
+
case "compaction_start": {
|
|
1970
1969
|
// Keep editor active; submissions are queued during compaction.
|
|
1971
|
-
// Set up escape to abort auto-compaction
|
|
1972
1970
|
this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;
|
|
1973
1971
|
this.defaultEditor.onEscape = () => {
|
|
1974
1972
|
this.session.abortCompaction();
|
|
1975
1973
|
};
|
|
1976
|
-
// Show compacting indicator with reason
|
|
1977
1974
|
this.statusContainer.clear();
|
|
1978
|
-
const
|
|
1979
|
-
|
|
1975
|
+
const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
|
|
1976
|
+
const label = event.reason === "manual"
|
|
1977
|
+
? `Compacting context... ${cancelHint}`
|
|
1978
|
+
: `${event.reason === "overflow" ? "Context overflow detected, " : ""}Auto-compacting... ${cancelHint}`;
|
|
1979
|
+
this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
|
|
1980
1980
|
this.statusContainer.addChild(this.autoCompactionLoader);
|
|
1981
1981
|
this.ui.requestRender();
|
|
1982
1982
|
break;
|
|
1983
1983
|
}
|
|
1984
|
-
case "
|
|
1985
|
-
// Restore escape handler
|
|
1984
|
+
case "compaction_end": {
|
|
1986
1985
|
if (this.autoCompactionEscapeHandler) {
|
|
1987
1986
|
this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;
|
|
1988
1987
|
this.autoCompactionEscapeHandler = undefined;
|
|
1989
1988
|
}
|
|
1990
|
-
// Stop loader
|
|
1991
1989
|
if (this.autoCompactionLoader) {
|
|
1992
1990
|
this.autoCompactionLoader.stop();
|
|
1993
1991
|
this.autoCompactionLoader = undefined;
|
|
1994
1992
|
this.statusContainer.clear();
|
|
1995
1993
|
}
|
|
1996
|
-
// Handle result
|
|
1997
1994
|
if (event.aborted) {
|
|
1998
|
-
|
|
1995
|
+
if (event.reason === "manual") {
|
|
1996
|
+
this.showError("Compaction cancelled");
|
|
1997
|
+
}
|
|
1998
|
+
else {
|
|
1999
|
+
this.showStatus("Auto-compaction cancelled");
|
|
2000
|
+
}
|
|
1999
2001
|
}
|
|
2000
2002
|
else if (event.result) {
|
|
2001
|
-
// Rebuild chat to show compacted state
|
|
2002
2003
|
this.chatContainer.clear();
|
|
2003
2004
|
this.rebuildChatFromMessages();
|
|
2004
|
-
|
|
2005
|
-
this.addMessageToChat({
|
|
2006
|
-
role: "compactionSummary",
|
|
2007
|
-
tokensBefore: event.result.tokensBefore,
|
|
2008
|
-
summary: event.result.summary,
|
|
2009
|
-
timestamp: Date.now(),
|
|
2010
|
-
});
|
|
2005
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
|
|
2011
2006
|
this.footer.invalidate();
|
|
2012
2007
|
}
|
|
2013
2008
|
else if (event.errorMessage) {
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2009
|
+
if (event.reason === "manual") {
|
|
2010
|
+
this.showError(event.errorMessage);
|
|
2011
|
+
}
|
|
2012
|
+
else {
|
|
2013
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
2014
|
+
this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
|
|
2015
|
+
}
|
|
2017
2016
|
}
|
|
2018
2017
|
void this.flushCompactionQueue({ willRetry: event.willRetry });
|
|
2019
2018
|
this.ui.requestRender();
|
|
@@ -3853,53 +3852,17 @@ export class InteractiveMode {
|
|
|
3853
3852
|
this.showWarning("Nothing to compact (no messages yet)");
|
|
3854
3853
|
return;
|
|
3855
3854
|
}
|
|
3856
|
-
await this.executeCompaction(customInstructions, false);
|
|
3857
|
-
}
|
|
3858
|
-
async executeCompaction(customInstructions, isAuto = false) {
|
|
3859
|
-
// Stop loading animation
|
|
3860
3855
|
if (this.loadingAnimation) {
|
|
3861
3856
|
this.loadingAnimation.stop();
|
|
3862
3857
|
this.loadingAnimation = undefined;
|
|
3863
3858
|
}
|
|
3864
3859
|
this.statusContainer.clear();
|
|
3865
|
-
// Set up escape handler during compaction
|
|
3866
|
-
const originalOnEscape = this.defaultEditor.onEscape;
|
|
3867
|
-
this.defaultEditor.onEscape = () => {
|
|
3868
|
-
this.session.abortCompaction();
|
|
3869
|
-
};
|
|
3870
|
-
// Show compacting status
|
|
3871
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3872
|
-
const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
|
|
3873
|
-
const label = isAuto ? `Auto-compacting context... ${cancelHint}` : `Compacting context... ${cancelHint}`;
|
|
3874
|
-
const compactingLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
|
|
3875
|
-
this.statusContainer.addChild(compactingLoader);
|
|
3876
|
-
this.ui.requestRender();
|
|
3877
|
-
let result;
|
|
3878
3860
|
try {
|
|
3879
|
-
|
|
3880
|
-
// Rebuild UI
|
|
3881
|
-
this.rebuildChatFromMessages();
|
|
3882
|
-
// Add compaction component at bottom so user sees it without scrolling
|
|
3883
|
-
const msg = createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString());
|
|
3884
|
-
this.addMessageToChat(msg);
|
|
3885
|
-
this.footer.invalidate();
|
|
3886
|
-
}
|
|
3887
|
-
catch (error) {
|
|
3888
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3889
|
-
if (message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError")) {
|
|
3890
|
-
this.showError("Compaction cancelled");
|
|
3891
|
-
}
|
|
3892
|
-
else {
|
|
3893
|
-
this.showError(`Compaction failed: ${message}`);
|
|
3894
|
-
}
|
|
3861
|
+
await this.session.compact(customInstructions);
|
|
3895
3862
|
}
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
this.statusContainer.clear();
|
|
3899
|
-
this.defaultEditor.onEscape = originalOnEscape;
|
|
3863
|
+
catch {
|
|
3864
|
+
// Ignore, will be emitted as an event
|
|
3900
3865
|
}
|
|
3901
|
-
void this.flushCompactionQueue({ willRetry: false });
|
|
3902
|
-
return result;
|
|
3903
3866
|
}
|
|
3904
3867
|
stop() {
|
|
3905
3868
|
if (this.loadingAnimation) {
|