@codex-infinity/pi-infinity 0.62.3 → 0.63.3
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 +80 -0
- package/README.md +2 -2
- package/dist/core/agent-session.d.ts +8 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +98 -54
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +3 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +5 -2
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +27 -26
- 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/model-registry.d.ts +18 -2
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +83 -69
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +4 -4
- package/dist/core/model-resolver.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/resolve-config-value.d.ts +6 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +37 -5
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -22
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +3 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/timings.d.ts +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +6 -0
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +150 -57
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +13 -11
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +44 -77
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +4 -4
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/index.d.ts +9 -6
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +24 -9
- package/dist/main.js.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 +29 -65
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/compaction.md +4 -2
- package/docs/development.md +3 -1
- package/docs/extensions.md +46 -2
- package/docs/models.md +6 -0
- package/docs/settings.md +12 -0
- package/docs/skills.md +3 -2
- package/examples/extensions/custom-compaction.ts +17 -4
- 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/handoff.ts +5 -2
- package/examples/extensions/qna.ts +5 -2
- package/examples/extensions/sandbox/index.ts +4 -0
- package/examples/extensions/summarize.ts +15 -4
- 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 +5 -4
|
@@ -292,7 +292,8 @@ export class InteractiveMode {
|
|
|
292
292
|
hint("app.clipboard.pasteImage", "to paste image"),
|
|
293
293
|
rawKeyHint("drop files", "to attach"),
|
|
294
294
|
].join("\n");
|
|
295
|
-
|
|
295
|
+
const onboarding = theme.fg("dim", `Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.`);
|
|
296
|
+
this.builtInHeader = new Text(`${logo}\n${instructions}\n\n${onboarding}`, 1, 0);
|
|
296
297
|
// Setup UI layout
|
|
297
298
|
this.headerContainer.addChild(new Spacer(1));
|
|
298
299
|
this.headerContainer.addChild(this.builtInHeader);
|
|
@@ -970,6 +971,7 @@ export class InteractiveMode {
|
|
|
970
971
|
modelRegistry: this.session.modelRegistry,
|
|
971
972
|
model: this.session.model,
|
|
972
973
|
isIdle: () => !this.session.isStreaming,
|
|
974
|
+
signal: this.session.agent.signal,
|
|
973
975
|
abort: () => this.session.abort(),
|
|
974
976
|
hasPendingMessages: () => this.session.pendingMessageCount > 0,
|
|
975
977
|
shutdown: () => {
|
|
@@ -979,10 +981,8 @@ export class InteractiveMode {
|
|
|
979
981
|
compact: (options) => {
|
|
980
982
|
void (async () => {
|
|
981
983
|
try {
|
|
982
|
-
const result = await this.
|
|
983
|
-
|
|
984
|
-
options?.onComplete?.(result);
|
|
985
|
-
}
|
|
984
|
+
const result = await this.session.compact(options?.customInstructions);
|
|
985
|
+
options?.onComplete?.(result);
|
|
986
986
|
}
|
|
987
987
|
catch (error) {
|
|
988
988
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1945,54 +1945,54 @@ export class InteractiveMode {
|
|
|
1945
1945
|
await this.checkShutdownRequested();
|
|
1946
1946
|
this.ui.requestRender();
|
|
1947
1947
|
break;
|
|
1948
|
-
case "
|
|
1948
|
+
case "compaction_start": {
|
|
1949
1949
|
// Keep editor active; submissions are queued during compaction.
|
|
1950
|
-
// Set up escape to abort auto-compaction
|
|
1951
1950
|
this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;
|
|
1952
1951
|
this.defaultEditor.onEscape = () => {
|
|
1953
1952
|
this.session.abortCompaction();
|
|
1954
1953
|
};
|
|
1955
|
-
// Show compacting indicator with reason
|
|
1956
1954
|
this.statusContainer.clear();
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1955
|
+
const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
|
|
1956
|
+
const label = event.reason === "manual"
|
|
1957
|
+
? `Compacting context... ${cancelHint}`
|
|
1958
|
+
: `${event.reason === "overflow" ? "Context overflow detected, " : ""}Auto-compacting... ${cancelHint}`;
|
|
1959
|
+
this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
|
|
1959
1960
|
this.statusContainer.addChild(this.autoCompactionLoader);
|
|
1960
1961
|
this.ui.requestRender();
|
|
1961
1962
|
break;
|
|
1962
1963
|
}
|
|
1963
|
-
case "
|
|
1964
|
-
// Restore escape handler
|
|
1964
|
+
case "compaction_end": {
|
|
1965
1965
|
if (this.autoCompactionEscapeHandler) {
|
|
1966
1966
|
this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;
|
|
1967
1967
|
this.autoCompactionEscapeHandler = undefined;
|
|
1968
1968
|
}
|
|
1969
|
-
// Stop loader
|
|
1970
1969
|
if (this.autoCompactionLoader) {
|
|
1971
1970
|
this.autoCompactionLoader.stop();
|
|
1972
1971
|
this.autoCompactionLoader = undefined;
|
|
1973
1972
|
this.statusContainer.clear();
|
|
1974
1973
|
}
|
|
1975
|
-
// Handle result
|
|
1976
1974
|
if (event.aborted) {
|
|
1977
|
-
|
|
1975
|
+
if (event.reason === "manual") {
|
|
1976
|
+
this.showError("Compaction cancelled");
|
|
1977
|
+
}
|
|
1978
|
+
else {
|
|
1979
|
+
this.showStatus("Auto-compaction cancelled");
|
|
1980
|
+
}
|
|
1978
1981
|
}
|
|
1979
1982
|
else if (event.result) {
|
|
1980
|
-
// Rebuild chat to show compacted state
|
|
1981
1983
|
this.chatContainer.clear();
|
|
1982
1984
|
this.rebuildChatFromMessages();
|
|
1983
|
-
|
|
1984
|
-
this.addMessageToChat({
|
|
1985
|
-
role: "compactionSummary",
|
|
1986
|
-
tokensBefore: event.result.tokensBefore,
|
|
1987
|
-
summary: event.result.summary,
|
|
1988
|
-
timestamp: Date.now(),
|
|
1989
|
-
});
|
|
1985
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
|
|
1990
1986
|
this.footer.invalidate();
|
|
1991
1987
|
}
|
|
1992
1988
|
else if (event.errorMessage) {
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1989
|
+
if (event.reason === "manual") {
|
|
1990
|
+
this.showError(event.errorMessage);
|
|
1991
|
+
}
|
|
1992
|
+
else {
|
|
1993
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
1994
|
+
this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
|
|
1995
|
+
}
|
|
1996
1996
|
}
|
|
1997
1997
|
void this.flushCompactionQueue({ willRetry: event.willRetry });
|
|
1998
1998
|
this.ui.requestRender();
|
|
@@ -3827,53 +3827,17 @@ export class InteractiveMode {
|
|
|
3827
3827
|
this.showWarning("Nothing to compact (no messages yet)");
|
|
3828
3828
|
return;
|
|
3829
3829
|
}
|
|
3830
|
-
await this.executeCompaction(customInstructions, false);
|
|
3831
|
-
}
|
|
3832
|
-
async executeCompaction(customInstructions, isAuto = false) {
|
|
3833
|
-
// Stop loading animation
|
|
3834
3830
|
if (this.loadingAnimation) {
|
|
3835
3831
|
this.loadingAnimation.stop();
|
|
3836
3832
|
this.loadingAnimation = undefined;
|
|
3837
3833
|
}
|
|
3838
3834
|
this.statusContainer.clear();
|
|
3839
|
-
// Set up escape handler during compaction
|
|
3840
|
-
const originalOnEscape = this.defaultEditor.onEscape;
|
|
3841
|
-
this.defaultEditor.onEscape = () => {
|
|
3842
|
-
this.session.abortCompaction();
|
|
3843
|
-
};
|
|
3844
|
-
// Show compacting status
|
|
3845
|
-
this.chatContainer.addChild(new Spacer(1));
|
|
3846
|
-
const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
|
|
3847
|
-
const label = isAuto ? `Auto-compacting context... ${cancelHint}` : `Compacting context... ${cancelHint}`;
|
|
3848
|
-
const compactingLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
|
|
3849
|
-
this.statusContainer.addChild(compactingLoader);
|
|
3850
|
-
this.ui.requestRender();
|
|
3851
|
-
let result;
|
|
3852
3835
|
try {
|
|
3853
|
-
|
|
3854
|
-
// Rebuild UI
|
|
3855
|
-
this.rebuildChatFromMessages();
|
|
3856
|
-
// Add compaction component at bottom so user sees it without scrolling
|
|
3857
|
-
const msg = createCompactionSummaryMessage(result.summary, result.tokensBefore, new Date().toISOString());
|
|
3858
|
-
this.addMessageToChat(msg);
|
|
3859
|
-
this.footer.invalidate();
|
|
3860
|
-
}
|
|
3861
|
-
catch (error) {
|
|
3862
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
3863
|
-
if (message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError")) {
|
|
3864
|
-
this.showError("Compaction cancelled");
|
|
3865
|
-
}
|
|
3866
|
-
else {
|
|
3867
|
-
this.showError(`Compaction failed: ${message}`);
|
|
3868
|
-
}
|
|
3836
|
+
await this.session.compact(customInstructions);
|
|
3869
3837
|
}
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
this.statusContainer.clear();
|
|
3873
|
-
this.defaultEditor.onEscape = originalOnEscape;
|
|
3838
|
+
catch {
|
|
3839
|
+
// Ignore, will be emitted as an event
|
|
3874
3840
|
}
|
|
3875
|
-
void this.flushCompactionQueue({ willRetry: false });
|
|
3876
|
-
return result;
|
|
3877
3841
|
}
|
|
3878
3842
|
stop() {
|
|
3879
3843
|
if (this.loadingAnimation) {
|