@codex-infinity/pi-infinity 0.62.2 → 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 +66 -0
- package/README.md +67 -67
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- 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 +97 -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/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +5 -4
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +7 -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 +18 -6
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +108 -59
- 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 +12 -4
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +28 -10
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +18 -4
- package/dist/modes/interactive/components/bash-execution.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 +32 -69
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +83 -71
- package/dist/modes/print-mode.js.map +1 -1
- package/docs/development.md +3 -1
- package/docs/extensions.md +13 -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/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
|
@@ -8,7 +8,7 @@ import * as os from "node:os";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "@mariozechner/pi-tui";
|
|
10
10
|
import { spawn, spawnSync } from "child_process";
|
|
11
|
-
import { APP_NAME, getAgentDir, getAuthPath, getDebugLogPath, getShareViewerUrl, getUpdateInstruction, VERSION, } from "../../config.js";
|
|
11
|
+
import { APP_NAME, getAgentDir, getAuthPath, getDebugLogPath, getShareViewerUrl, getUpdateInstruction, PACKAGE_NAME, VERSION, } from "../../config.js";
|
|
12
12
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
13
13
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
14
14
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
@@ -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);
|
|
@@ -452,7 +453,7 @@ export class InteractiveMode {
|
|
|
452
453
|
if (process.env.PI_SKIP_VERSION_CHECK || process.env.PI_OFFLINE)
|
|
453
454
|
return undefined;
|
|
454
455
|
try {
|
|
455
|
-
const response = await fetch(
|
|
456
|
+
const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`, {
|
|
456
457
|
signal: AbortSignal.timeout(10000),
|
|
457
458
|
});
|
|
458
459
|
if (!response.ok)
|
|
@@ -979,10 +980,8 @@ export class InteractiveMode {
|
|
|
979
980
|
compact: (options) => {
|
|
980
981
|
void (async () => {
|
|
981
982
|
try {
|
|
982
|
-
const result = await this.
|
|
983
|
-
|
|
984
|
-
options?.onComplete?.(result);
|
|
985
|
-
}
|
|
983
|
+
const result = await this.session.compact(options?.customInstructions);
|
|
984
|
+
options?.onComplete?.(result);
|
|
986
985
|
}
|
|
987
986
|
catch (error) {
|
|
988
987
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
@@ -1945,54 +1944,54 @@ export class InteractiveMode {
|
|
|
1945
1944
|
await this.checkShutdownRequested();
|
|
1946
1945
|
this.ui.requestRender();
|
|
1947
1946
|
break;
|
|
1948
|
-
case "
|
|
1947
|
+
case "compaction_start": {
|
|
1949
1948
|
// Keep editor active; submissions are queued during compaction.
|
|
1950
|
-
// Set up escape to abort auto-compaction
|
|
1951
1949
|
this.autoCompactionEscapeHandler = this.defaultEditor.onEscape;
|
|
1952
1950
|
this.defaultEditor.onEscape = () => {
|
|
1953
1951
|
this.session.abortCompaction();
|
|
1954
1952
|
};
|
|
1955
|
-
// Show compacting indicator with reason
|
|
1956
1953
|
this.statusContainer.clear();
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1954
|
+
const cancelHint = `(${keyText("app.interrupt")} to cancel)`;
|
|
1955
|
+
const label = event.reason === "manual"
|
|
1956
|
+
? `Compacting context... ${cancelHint}`
|
|
1957
|
+
: `${event.reason === "overflow" ? "Context overflow detected, " : ""}Auto-compacting... ${cancelHint}`;
|
|
1958
|
+
this.autoCompactionLoader = new Loader(this.ui, (spinner) => theme.fg("accent", spinner), (text) => theme.fg("muted", text), label);
|
|
1959
1959
|
this.statusContainer.addChild(this.autoCompactionLoader);
|
|
1960
1960
|
this.ui.requestRender();
|
|
1961
1961
|
break;
|
|
1962
1962
|
}
|
|
1963
|
-
case "
|
|
1964
|
-
// Restore escape handler
|
|
1963
|
+
case "compaction_end": {
|
|
1965
1964
|
if (this.autoCompactionEscapeHandler) {
|
|
1966
1965
|
this.defaultEditor.onEscape = this.autoCompactionEscapeHandler;
|
|
1967
1966
|
this.autoCompactionEscapeHandler = undefined;
|
|
1968
1967
|
}
|
|
1969
|
-
// Stop loader
|
|
1970
1968
|
if (this.autoCompactionLoader) {
|
|
1971
1969
|
this.autoCompactionLoader.stop();
|
|
1972
1970
|
this.autoCompactionLoader = undefined;
|
|
1973
1971
|
this.statusContainer.clear();
|
|
1974
1972
|
}
|
|
1975
|
-
// Handle result
|
|
1976
1973
|
if (event.aborted) {
|
|
1977
|
-
|
|
1974
|
+
if (event.reason === "manual") {
|
|
1975
|
+
this.showError("Compaction cancelled");
|
|
1976
|
+
}
|
|
1977
|
+
else {
|
|
1978
|
+
this.showStatus("Auto-compaction cancelled");
|
|
1979
|
+
}
|
|
1978
1980
|
}
|
|
1979
1981
|
else if (event.result) {
|
|
1980
|
-
// Rebuild chat to show compacted state
|
|
1981
1982
|
this.chatContainer.clear();
|
|
1982
1983
|
this.rebuildChatFromMessages();
|
|
1983
|
-
|
|
1984
|
-
this.addMessageToChat({
|
|
1985
|
-
role: "compactionSummary",
|
|
1986
|
-
tokensBefore: event.result.tokensBefore,
|
|
1987
|
-
summary: event.result.summary,
|
|
1988
|
-
timestamp: Date.now(),
|
|
1989
|
-
});
|
|
1984
|
+
this.addMessageToChat(createCompactionSummaryMessage(event.result.summary, event.result.tokensBefore, new Date().toISOString()));
|
|
1990
1985
|
this.footer.invalidate();
|
|
1991
1986
|
}
|
|
1992
1987
|
else if (event.errorMessage) {
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1988
|
+
if (event.reason === "manual") {
|
|
1989
|
+
this.showError(event.errorMessage);
|
|
1990
|
+
}
|
|
1991
|
+
else {
|
|
1992
|
+
this.chatContainer.addChild(new Spacer(1));
|
|
1993
|
+
this.chatContainer.addChild(new Text(theme.fg("error", event.errorMessage), 1, 0));
|
|
1994
|
+
}
|
|
1996
1995
|
}
|
|
1997
1996
|
void this.flushCompactionQueue({ willRetry: event.willRetry });
|
|
1998
1997
|
this.ui.requestRender();
|
|
@@ -2462,9 +2461,9 @@ export class InteractiveMode {
|
|
|
2462
2461
|
this.ui.requestRender();
|
|
2463
2462
|
}
|
|
2464
2463
|
showNewVersionNotification(newVersion) {
|
|
2465
|
-
const action = theme.fg("accent", getUpdateInstruction(
|
|
2464
|
+
const action = theme.fg("accent", getUpdateInstruction(PACKAGE_NAME));
|
|
2466
2465
|
const updateInstruction = theme.fg("muted", `New version ${newVersion} is available. `) + action;
|
|
2467
|
-
const changelogUrl = theme.fg("accent", "https://github.com/
|
|
2466
|
+
const changelogUrl = theme.fg("accent", "https://github.com/lee101/pi-infinity/blob/main/packages/coding-agent/CHANGELOG.md");
|
|
2468
2467
|
const changelogLine = theme.fg("muted", "Changelog: ") + changelogUrl;
|
|
2469
2468
|
this.chatContainer.addChild(new Spacer(1));
|
|
2470
2469
|
this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
|
|
@@ -3827,53 +3826,17 @@ export class InteractiveMode {
|
|
|
3827
3826
|
this.showWarning("Nothing to compact (no messages yet)");
|
|
3828
3827
|
return;
|
|
3829
3828
|
}
|
|
3830
|
-
await this.executeCompaction(customInstructions, false);
|
|
3831
|
-
}
|
|
3832
|
-
async executeCompaction(customInstructions, isAuto = false) {
|
|
3833
|
-
// Stop loading animation
|
|
3834
3829
|
if (this.loadingAnimation) {
|
|
3835
3830
|
this.loadingAnimation.stop();
|
|
3836
3831
|
this.loadingAnimation = undefined;
|
|
3837
3832
|
}
|
|
3838
3833
|
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
3834
|
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
|
-
}
|
|
3835
|
+
await this.session.compact(customInstructions);
|
|
3869
3836
|
}
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
this.statusContainer.clear();
|
|
3873
|
-
this.defaultEditor.onEscape = originalOnEscape;
|
|
3837
|
+
catch {
|
|
3838
|
+
// Ignore, will be emitted as an event
|
|
3874
3839
|
}
|
|
3875
|
-
void this.flushCompactionQueue({ willRetry: false });
|
|
3876
|
-
return result;
|
|
3877
3840
|
}
|
|
3878
3841
|
stop() {
|
|
3879
3842
|
if (this.loadingAnimation) {
|