@fleetagent/pi-coding-agent 0.0.6 → 0.0.8
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 +3 -3
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +2 -3
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -2
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +12 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +123 -18
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/export-html/template.js +6 -3
- package/dist/core/extensions/runner.d.ts +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +8 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +4 -2
- 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.map +1 -1
- package/dist/core/model-registry.js +65 -13
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/output-guard.d.ts +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +52 -22
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +31 -12
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-agent.d.ts.map +1 -1
- package/dist/core/pi-agent.js +12 -3
- package/dist/core/pi-agent.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +9 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +134 -11
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/session/jsonl-helpers.d.ts +2 -1
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
- package/dist/core/session/jsonl-helpers.js +6 -3
- package/dist/core/session/jsonl-helpers.js.map +1 -1
- package/dist/core/session/local-session-manager.d.ts +1 -0
- package/dist/core/session/local-session-manager.d.ts.map +1 -1
- package/dist/core/session/local-session-manager.js +12 -4
- package/dist/core/session/local-session-manager.js.map +1 -1
- package/dist/core/session/session-manager.d.ts +1 -0
- package/dist/core/session/session-manager.d.ts.map +1 -1
- package/dist/core/session/session-manager.js.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.d.ts +2 -1
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.js +105 -78
- package/dist/core/session/stores/jsonl-session-store.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 +14 -9
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +73 -63
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +45 -76
- 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 +27 -12
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +11 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +3 -3
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +13 -4
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +1 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js +37 -0
- 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 +7 -6
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +24 -32
- package/dist/core/tools/write.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +118 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +14 -5
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +34 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +10 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +64 -7
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +15 -3
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts +3 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js +14 -8
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +124 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +6 -27
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +60 -116
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +10 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/custom-provider.md +22 -9
- package/docs/extensions.md +4 -3
- package/docs/models.md +34 -12
- package/docs/packages.md +5 -4
- package/docs/providers.md +13 -5
- package/docs/sdk.md +56 -0
- package/docs/settings.md +4 -2
- package/docs/terminal-setup.md +6 -0
- package/docs/usage.md +3 -3
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +54 -3
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +13 -12
- package/package.json +5 -5
|
@@ -9,7 +9,7 @@ import * as path from "node:path";
|
|
|
9
9
|
import { getProviders, } from "@fleetagent/pi-ai";
|
|
10
10
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "@fleetagent/pi-tui";
|
|
11
11
|
import { spawn, spawnSync } from "child_process";
|
|
12
|
-
import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
12
|
+
import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, PACKAGE_NAME, VERSION, } from "../../config.js";
|
|
13
13
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
14
14
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
15
15
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
@@ -125,6 +125,7 @@ export class InteractiveMode {
|
|
|
125
125
|
version;
|
|
126
126
|
isInitialized = false;
|
|
127
127
|
onInputCallback;
|
|
128
|
+
pendingUserInputs = [];
|
|
128
129
|
loadingAnimation = undefined;
|
|
129
130
|
workingMessage = undefined;
|
|
130
131
|
workingVisible = true;
|
|
@@ -2158,6 +2159,9 @@ export class InteractiveMode {
|
|
|
2158
2159
|
if (this.onInputCallback) {
|
|
2159
2160
|
this.onInputCallback(text);
|
|
2160
2161
|
}
|
|
2162
|
+
else {
|
|
2163
|
+
this.pendingUserInputs.push(text);
|
|
2164
|
+
}
|
|
2161
2165
|
this.editor.addToHistory?.(text);
|
|
2162
2166
|
};
|
|
2163
2167
|
}
|
|
@@ -2636,6 +2640,10 @@ export class InteractiveMode {
|
|
|
2636
2640
|
}
|
|
2637
2641
|
}
|
|
2638
2642
|
async getUserInput() {
|
|
2643
|
+
const queuedInput = this.pendingUserInputs.shift();
|
|
2644
|
+
if (queuedInput !== undefined) {
|
|
2645
|
+
return queuedInput;
|
|
2646
|
+
}
|
|
2639
2647
|
return new Promise((resolve) => {
|
|
2640
2648
|
this.onInputCallback = (text) => {
|
|
2641
2649
|
this.onInputCallback = undefined;
|
|
@@ -2671,11 +2679,27 @@ export class InteractiveMode {
|
|
|
2671
2679
|
* repaint the final frame while the process is exiting.
|
|
2672
2680
|
*/
|
|
2673
2681
|
isShuttingDown = false;
|
|
2674
|
-
async shutdown() {
|
|
2682
|
+
async shutdown(options) {
|
|
2675
2683
|
if (this.isShuttingDown)
|
|
2676
2684
|
return;
|
|
2677
2685
|
this.isShuttingDown = true;
|
|
2678
2686
|
this.unregisterSignalHandlers();
|
|
2687
|
+
if (options?.fromSignal) {
|
|
2688
|
+
// Signal-triggered shutdown (SIGTERM/SIGHUP). Emit extension cleanup
|
|
2689
|
+
// (session_shutdown) BEFORE touching the terminal. Extension teardown
|
|
2690
|
+
// such as removing sockets does not write to the tty, so it must not be
|
|
2691
|
+
// skipped if a later terminal-restore write fails on a dead or stalled
|
|
2692
|
+
// terminal. If the terminal is gone, the restore writes below emit EIO,
|
|
2693
|
+
// which the stdout/stderr error handler turns into emergencyTerminalExit;
|
|
2694
|
+
// the render loop is already idle, so this cannot hot-spin (see #4144).
|
|
2695
|
+
await this.runtimeHost.dispose();
|
|
2696
|
+
await this.ui.terminal.drainInput(1000);
|
|
2697
|
+
this.stop();
|
|
2698
|
+
process.exit(0);
|
|
2699
|
+
}
|
|
2700
|
+
// Interactive quit (Ctrl+D, Ctrl+C, /quit, extension shutdown()). Stop the
|
|
2701
|
+
// TUI before emitting shutdown events so extension UI cleanup cannot repaint
|
|
2702
|
+
// the final frame while the process is exiting.
|
|
2679
2703
|
// Drain any in-flight Kitty key release events before stopping.
|
|
2680
2704
|
// This prevents escape sequences from leaking to the parent shell over slow SSH.
|
|
2681
2705
|
await this.ui.terminal.drainInput(1000);
|
|
@@ -2739,11 +2763,12 @@ export class InteractiveMode {
|
|
|
2739
2763
|
}
|
|
2740
2764
|
for (const signal of signals) {
|
|
2741
2765
|
const handler = () => {
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2766
|
+
// SIGHUP no longer hard-exits: graceful shutdown emits session_shutdown
|
|
2767
|
+
// first, then attempts terminal restore. A genuinely dead terminal
|
|
2768
|
+
// surfaces as an EIO on the restore writes, which the stdout/stderr
|
|
2769
|
+
// error handler converts into emergencyTerminalExit (see #4144, #5080).
|
|
2745
2770
|
killTrackedDetachedChildren();
|
|
2746
|
-
void this.shutdown();
|
|
2771
|
+
void this.shutdown({ fromSignal: true });
|
|
2747
2772
|
};
|
|
2748
2773
|
process.prependListener(signal, handler);
|
|
2749
2774
|
this.signalCleanupHandlers.push(() => process.off(signal, handler));
|
|
@@ -2982,8 +3007,9 @@ export class InteractiveMode {
|
|
|
2982
3007
|
}
|
|
2983
3008
|
showNewVersionNotification(release) {
|
|
2984
3009
|
const action = theme.fg("accent", `${APP_NAME} update`);
|
|
2985
|
-
const
|
|
2986
|
-
const
|
|
3010
|
+
const packageName = release.packageName ?? PACKAGE_NAME;
|
|
3011
|
+
const updateInstruction = theme.fg("muted", `New ${packageName} version ${release.version} is available. Run `) + action;
|
|
3012
|
+
const changelogUrl = "https://github.com/fleetagent/pi/blob/main/packages/coding-agent/CHANGELOG.md";
|
|
2987
3013
|
const changelogLink = getCapabilities().hyperlinks
|
|
2988
3014
|
? hyperlink(theme.fg("accent", "open changelog"), changelogUrl)
|
|
2989
3015
|
: theme.fg("accent", changelogUrl);
|