@averyyy/pi-coding-agent 0.81.1-piclient.1 → 0.82.0-piclient.1
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 +41 -0
- package/README.md +13 -0
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +1 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session.d.ts +11 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +11 -3
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-config.d.ts +30 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +6 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -2
- 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 +7 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +3 -5
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +5 -10
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- 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 +1 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +1 -2
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +1 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +16 -46
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts +12 -0
- package/dist/modes/interactive/external-editor.d.ts.map +1 -0
- package/dist/modes/interactive/external-editor.js +37 -0
- package/dist/modes/interactive/external-editor.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +24 -42
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +19 -8
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -1
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +1 -1
- package/docs/custom-provider.md +5 -2
- package/docs/environment-variables.md +88 -0
- package/docs/extensions.md +11 -3
- package/docs/index.md +1 -0
- package/docs/models.md +6 -2
- package/docs/providers.md +8 -1
- package/docs/rpc.md +23 -6
- package/docs/settings.md +1 -1
- package/docs/usage.md +0 -13
- package/examples/extensions/custom-compaction.ts +3 -0
- 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/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/handoff.ts +9 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/summarize.ts +3 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +5 -4
|
@@ -65,6 +65,7 @@ import { TreeSelectorComponent } from "./components/tree-selector.js";
|
|
|
65
65
|
import { TrustSelectorComponent } from "./components/trust-selector.js";
|
|
66
66
|
import { UserMessageComponent } from "./components/user-message.js";
|
|
67
67
|
import { UserMessageSelectorComponent } from "./components/user-message-selector.js";
|
|
68
|
+
import { editInExternalEditor } from "./external-editor.js";
|
|
68
69
|
import { getModelSearchText } from "./model-search.js";
|
|
69
70
|
import { getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, onThemeChange, setRegisteredThemes, stopThemeWatcher, Theme, theme, } from "./theme/theme.js";
|
|
70
71
|
import { InteractiveThemeController } from "./theme/theme-controller.js";
|
|
@@ -273,7 +274,7 @@ export class InteractiveMode {
|
|
|
273
274
|
await this.rebindCurrentSession({ renderBeforeBind: true });
|
|
274
275
|
});
|
|
275
276
|
this.version = VERSION;
|
|
276
|
-
this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor());
|
|
277
|
+
this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor(), getAgentDir());
|
|
277
278
|
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
278
279
|
this.headerContainer = new Container();
|
|
279
280
|
this.loadedResourcesContainer = new Container();
|
|
@@ -798,8 +799,15 @@ export class InteractiveMode {
|
|
|
798
799
|
* Get a short path relative to the package root for display.
|
|
799
800
|
*/
|
|
800
801
|
getShortPath(fullPath, sourceInfo) {
|
|
802
|
+
const normalizedFullPath = fullPath.replace(/\\/g, "/");
|
|
801
803
|
const baseDir = sourceInfo?.baseDir;
|
|
802
804
|
if (baseDir && this.isPackageSource(sourceInfo)) {
|
|
805
|
+
const normalizedBaseDir = baseDir.replace(/\\/g, "/");
|
|
806
|
+
const npmRootMatch = normalizedBaseDir.match(/^(.*\/node_modules)\/(@?[^/]+(?:\/[^/]+)?)$/);
|
|
807
|
+
// If fullPath is under the same node_modules root as baseDir, preserve that relative topology.
|
|
808
|
+
if (npmRootMatch?.[1] && normalizedFullPath.startsWith(`${npmRootMatch[1]}/`)) {
|
|
809
|
+
return path.posix.relative(normalizedBaseDir, normalizedFullPath);
|
|
810
|
+
}
|
|
803
811
|
const relativePath = path.relative(path.resolve(baseDir), path.resolve(fullPath));
|
|
804
812
|
if (relativePath &&
|
|
805
813
|
relativePath !== "." &&
|
|
@@ -810,11 +818,11 @@ export class InteractiveMode {
|
|
|
810
818
|
}
|
|
811
819
|
}
|
|
812
820
|
const source = sourceInfo?.source ?? "";
|
|
813
|
-
const npmMatch =
|
|
821
|
+
const npmMatch = normalizedFullPath.match(/node_modules\/(@?[^/]+(?:\/[^/]+)?)\/(.*)/);
|
|
814
822
|
if (npmMatch && source.startsWith("npm:")) {
|
|
815
823
|
return npmMatch[2];
|
|
816
824
|
}
|
|
817
|
-
const gitMatch =
|
|
825
|
+
const gitMatch = normalizedFullPath.match(/git\/[^/]+\/[^/]+\/(.*)/);
|
|
818
826
|
if (gitMatch && source.startsWith("git:")) {
|
|
819
827
|
return gitMatch[1];
|
|
820
828
|
}
|
|
@@ -1354,6 +1362,7 @@ export class InteractiveMode {
|
|
|
1354
1362
|
sessionManager: this.sessionManager,
|
|
1355
1363
|
modelRegistry: extensionRunner.getModelRegistry(),
|
|
1356
1364
|
model: this.session.model,
|
|
1365
|
+
thinkingLevel: this.session.thinkingLevel,
|
|
1357
1366
|
isIdle: () => this.session.isIdle,
|
|
1358
1367
|
isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
|
|
1359
1368
|
signal: this.session.agent.signal,
|
|
@@ -2039,7 +2048,7 @@ export class InteractiveMode {
|
|
|
2039
2048
|
this.defaultEditor.onAction("app.model.select", () => this.showModelSelector());
|
|
2040
2049
|
this.defaultEditor.onAction("app.tools.expand", () => this.toggleToolOutputExpansion());
|
|
2041
2050
|
this.defaultEditor.onAction("app.thinking.toggle", () => this.toggleThinkingBlockVisibility());
|
|
2042
|
-
this.defaultEditor.onAction("app.editor.external", () => this.
|
|
2051
|
+
this.defaultEditor.onAction("app.editor.external", () => void this.handleOpenExternalEditor());
|
|
2043
2052
|
this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand());
|
|
2044
2053
|
this.defaultEditor.onAction("app.message.followUp", () => this.handleFollowUp());
|
|
2045
2054
|
this.defaultEditor.onAction("app.message.dequeue", () => this.handleDequeue());
|
|
@@ -2407,6 +2416,9 @@ export class InteractiveMode {
|
|
|
2407
2416
|
}
|
|
2408
2417
|
this.ui.requestRender();
|
|
2409
2418
|
break;
|
|
2419
|
+
case "bash_execution_update":
|
|
2420
|
+
// The bash execution callback handles TUI output rendering.
|
|
2421
|
+
break;
|
|
2410
2422
|
case "tool_execution_start": {
|
|
2411
2423
|
let component = this.pendingTools.get(event.toolCallId);
|
|
2412
2424
|
if (!component) {
|
|
@@ -3129,51 +3141,21 @@ export class InteractiveMode {
|
|
|
3129
3141
|
}
|
|
3130
3142
|
this.showStatus(`Thinking blocks: ${this.hideThinkingBlock ? "hidden" : "visible"}`);
|
|
3131
3143
|
}
|
|
3132
|
-
async
|
|
3144
|
+
async handleOpenExternalEditor() {
|
|
3133
3145
|
const editorCmd = this.settingsManager.getExternalEditorCommand();
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
return;
|
|
3137
|
-
}
|
|
3138
|
-
const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();
|
|
3139
|
-
const tmpFile = path.join(os.tmpdir(), `pi-editor-${Date.now()}.pi.md`);
|
|
3146
|
+
const content = this.editor.getExpandedText?.() ?? this.editor.getText();
|
|
3147
|
+
this.ui.stop();
|
|
3140
3148
|
try {
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
this.ui.stop();
|
|
3145
|
-
// Split by space to support editor arguments (e.g., "code --wait")
|
|
3146
|
-
const [editor, ...editorArgs] = editorCmd.split(" ");
|
|
3147
|
-
process.stdout.write(`Launching external editor: ${editorCmd}\nPi will resume when the editor exits.\n`);
|
|
3148
|
-
// Do not use spawnSync here. On Windows, synchronous child_process calls can keep
|
|
3149
|
-
// Node/libuv's console input read active after ui.stop() pauses stdin, racing
|
|
3150
|
-
// vim/nvim for the console input buffer until Ctrl+C cancels the pending read.
|
|
3151
|
-
const status = await new Promise((resolve) => {
|
|
3152
|
-
const child = spawn(editor, [...editorArgs, tmpFile], {
|
|
3153
|
-
stdio: "inherit",
|
|
3154
|
-
shell: process.platform === "win32",
|
|
3155
|
-
});
|
|
3156
|
-
child.on("error", () => resolve(null));
|
|
3157
|
-
child.on("close", (code) => resolve(code));
|
|
3149
|
+
const result = await editInExternalEditor({
|
|
3150
|
+
command: editorCmd,
|
|
3151
|
+
content,
|
|
3158
3152
|
});
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
const newContent = fs.readFileSync(tmpFile, "utf-8").replace(/\n$/, "");
|
|
3162
|
-
this.editor.setText(newContent);
|
|
3153
|
+
if (result.status === "complete") {
|
|
3154
|
+
this.editor.setText(result.content);
|
|
3163
3155
|
}
|
|
3164
|
-
// On non-zero exit, keep original text (no action needed)
|
|
3165
3156
|
}
|
|
3166
3157
|
finally {
|
|
3167
|
-
// Clean up temp file
|
|
3168
|
-
try {
|
|
3169
|
-
fs.unlinkSync(tmpFile);
|
|
3170
|
-
}
|
|
3171
|
-
catch {
|
|
3172
|
-
// Ignore cleanup errors
|
|
3173
|
-
}
|
|
3174
|
-
// Restart TUI
|
|
3175
3158
|
this.ui.start();
|
|
3176
|
-
// Force full re-render since external editor uses alternate screen
|
|
3177
3159
|
this.ui.requestRender(true);
|
|
3178
3160
|
}
|
|
3179
3161
|
}
|