pi-namespace-patch 1.0.2-namespace.2 → 1.0.4-namespace.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 +50 -0
- package/README.md +8 -8
- package/dist/bundle/chunks/{anthropic-messages-MVG2FL56.js → anthropic-messages-Y22YDKSW.js} +1 -1
- package/dist/bundle/chunks/azure-openai-responses-YJDJIIDQ.js +2 -0
- package/dist/bundle/chunks/chunk-22CYIUS4.js +2 -0
- package/dist/bundle/chunks/{chunk-WCQZGZ6I.js → chunk-2QSWSXFK.js} +4 -4
- package/dist/bundle/chunks/{chunk-6FX7UEPL.js → chunk-64GOPQSC.js} +6 -4
- package/dist/bundle/chunks/{chunk-OSKPX3Z5.js → chunk-C47CLQZK.js} +1 -1
- package/dist/bundle/chunks/{chunk-OLBCNJCL.js → chunk-ERIW6MDO.js} +51 -47
- package/dist/bundle/chunks/chunk-F4TCZWQO.js +20 -0
- package/dist/bundle/chunks/{chunk-2KAZSACP.js → chunk-FKGBRPJC.js} +1 -1
- package/dist/bundle/chunks/{chunk-IKZJX7ZT.js → chunk-HQHD6PZI.js} +1 -1
- package/dist/bundle/chunks/chunk-KJUDFE6Y.js +11 -0
- package/dist/bundle/chunks/{chunk-G7EDXK4D.js → chunk-TAOL3JFA.js} +1 -1
- package/dist/bundle/chunks/chunk-VLMAON6X.js +15 -0
- package/dist/bundle/chunks/{chunk-BYB6ZAAQ.js → chunk-WE4MXUQS.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZSI3BL5Q.js → chunk-XXKX4I4Z.js} +1 -1
- package/dist/bundle/chunks/{chunk-SYF2TF6W.js → chunk-YKYP4C4A.js} +9 -6
- package/dist/bundle/chunks/{chunk-DN3QEIXS.js → chunk-YTMEKMOC.js} +1 -1
- package/dist/bundle/chunks/chunk-ZBURYEWF.js +2 -0
- package/dist/bundle/chunks/{cli-KILDDGW3.js → cli-FRW732V6.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-X5PVWWYJ.js → cloudflare-workers-ai-system-one-NM3JRRWQ.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +99 -4
- package/dist/bundle/chunks/{easter-egg-3d-T5FFWIBR.js → easter-egg-3d-GBYHZI2E.js} +1 -1
- package/dist/bundle/chunks/execute-MNHU53Y5.js +484 -0
- package/dist/bundle/chunks/{google-generative-ai-ZOK6CV7D.js → google-generative-ai-XMFHGQC5.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-VKWZQ3AY.js → google-vertex-4XRRNP74.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-7DAUEE4N.js → mistral-conversations-Q22M3IBG.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-TC3OK7B4.js → openai-codex-responses-4MYQSO5E.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-GWHGMQ3T.js → openai-completions-OSRCWAAA.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-EZ7FJ2KL.js → openai-responses-UHF3DHNG.js} +1 -1
- package/dist/bundle/chunks/{runtime-D5I2NTIF.js → runtime-FW2HXAJ6.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-A4CZTQWZ.js → typesafe-system-one-PRR5K6CI.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-3HQKVCRO.js +2 -0
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +11 -4
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts +18 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +44 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +26 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +47 -14
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +2 -7
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +4 -4
- package/dist/core/mcp-servers.d.ts +8 -0
- package/dist/core/mcp-servers.d.ts.map +1 -1
- package/dist/core/mcp-servers.js +30 -7
- package/dist/core/mcp-servers.js.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +4 -3
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +9 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -2
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/skills.d.ts +4 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +6 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +9 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +4 -10
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts +13 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +18 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +51 -9
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +1 -0
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +9 -2
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +13 -5
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/mcp/resources.d.ts +3 -4
- package/dist/extensions/mcp/resources.d.ts.map +1 -1
- package/dist/extensions/mcp/resources.js +3 -4
- package/dist/extensions/mcp/resources.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +4 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +22 -5
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts +2 -1
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +6 -10
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +42 -6
- 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 +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/output-files.d.ts +15 -0
- package/dist/utils/output-files.d.ts.map +1 -0
- package/dist/utils/output-files.js +30 -0
- package/dist/utils/output-files.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/cli.md +15 -3
- package/docs/codemode.md +6 -5
- package/docs/extensions.md +1 -1
- package/docs/keybindings.md +4 -4
- package/docs/mcp.md +3 -1
- 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/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +10 -10
- package/dist/bundle/chunks/azure-openai-responses-7AMFUIWJ.js +0 -2
- package/dist/bundle/chunks/chunk-7JGR3GZN.js +0 -11
- package/dist/bundle/chunks/chunk-OYBSLV7Y.js +0 -16
- package/dist/bundle/chunks/chunk-PDFMCAOZ.js +0 -19
- package/dist/bundle/chunks/chunk-VIV3CWXG.js +0 -2
- package/dist/bundle/chunks/execute-RYVK27GT.js +0 -388
- package/dist/bundle/chunks/virtual-modules-J2M3WAR2.js +0 -2
|
@@ -11,7 +11,7 @@ import * as TuiLayouts from "@earendil-works/pi-tui";
|
|
|
11
11
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Markdown, matchesKey, Spacer, setCapabilityOverrides, setKeybindings, Text, TruncatedText, TuiAltScreen, TuiMainScreen, visibleWidth, } from "@earendil-works/pi-tui";
|
|
12
12
|
import chalk from "chalk";
|
|
13
13
|
import { spawn } from "child_process";
|
|
14
|
-
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
14
|
+
import { APP_NAME, APP_TITLE, CONFIG_DIR_NAME, detectInstallChange, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, VERSION, } from "../../config.js";
|
|
15
15
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
16
16
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
17
17
|
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
@@ -129,7 +129,9 @@ function isCompactionCostNotice(item) {
|
|
|
129
129
|
function isUsageSessionEntry(item) {
|
|
130
130
|
return "type" in item && item.type === "usage";
|
|
131
131
|
}
|
|
132
|
-
|
|
132
|
+
// EIO: tty reads/ioctls from an orphaned background process group, or writes after hangup.
|
|
133
|
+
// ENOTTY: the tty was revoked (macOS) and stdin is no longer a terminal.
|
|
134
|
+
const DEAD_TERMINAL_ERROR_CODES = new Set(["EIO", "EPIPE", "ENOTCONN", "ENOTTY"]);
|
|
133
135
|
function isDeadTerminalError(error) {
|
|
134
136
|
if (!error || typeof error !== "object" || !("code" in error)) {
|
|
135
137
|
return false;
|
|
@@ -314,6 +316,7 @@ export class InteractiveMode {
|
|
|
314
316
|
shutdownRequested = false;
|
|
315
317
|
/** The `/bug` hint is shown at most once per session so error output stays readable. */
|
|
316
318
|
bugReportHintShown = false;
|
|
319
|
+
installChangeWarningShown = false;
|
|
317
320
|
// Extension UI state
|
|
318
321
|
extensionSelector = undefined;
|
|
319
322
|
extensionInput = undefined;
|
|
@@ -1661,8 +1664,32 @@ export class InteractiveMode {
|
|
|
1661
1664
|
return;
|
|
1662
1665
|
if (/\b(?:abort(?:ed)?|cancel(?:l?ed)?)\b/i.test(message.errorMessage ?? ""))
|
|
1663
1666
|
return;
|
|
1667
|
+
if (this.maybeShowInstallChangeWarning())
|
|
1668
|
+
return;
|
|
1664
1669
|
this.suggestBugReport();
|
|
1665
1670
|
}
|
|
1671
|
+
/**
|
|
1672
|
+
* After an error, check whether an update replaced or removed this install while the session ran.
|
|
1673
|
+
* Code loaded on demand then fails with missing modules until restart (#10439). Returns true when
|
|
1674
|
+
* the install changed.
|
|
1675
|
+
*/
|
|
1676
|
+
maybeShowInstallChangeWarning() {
|
|
1677
|
+
if (this.installChangeWarningShown)
|
|
1678
|
+
return true;
|
|
1679
|
+
const change = detectInstallChange();
|
|
1680
|
+
if (!change)
|
|
1681
|
+
return false;
|
|
1682
|
+
this.installChangeWarningShown = true;
|
|
1683
|
+
const cause = change.kind === "updated"
|
|
1684
|
+
? `${APP_NAME} was updated to ${change.version} while this session was running (${VERSION})`
|
|
1685
|
+
: `The ${APP_NAME} installation this session runs from was removed or replaced`;
|
|
1686
|
+
const resumeCommand = formatResumeCommand(this.sessionManager);
|
|
1687
|
+
const restart = resumeCommand
|
|
1688
|
+
? `Restart with \`${resumeCommand}\` to continue this session.`
|
|
1689
|
+
: `Restart ${APP_NAME}.`;
|
|
1690
|
+
this.showWarning(`${cause}. Features that load code on demand can fail until restart. ${restart}`);
|
|
1691
|
+
return true;
|
|
1692
|
+
}
|
|
1666
1693
|
renderCurrentSessionState() {
|
|
1667
1694
|
this.loadedResourcesContainer.clear();
|
|
1668
1695
|
this.chatContainer.clear();
|
|
@@ -2905,6 +2932,8 @@ export class InteractiveMode {
|
|
|
2905
2932
|
break;
|
|
2906
2933
|
}
|
|
2907
2934
|
case "tool_execution_end": {
|
|
2935
|
+
if (event.isError)
|
|
2936
|
+
this.maybeShowInstallChangeWarning();
|
|
2908
2937
|
const component = this.pendingTools.get(event.toolCallId);
|
|
2909
2938
|
if (component) {
|
|
2910
2939
|
component.updateResult({ ...event.result, isError: event.isError });
|
|
@@ -3489,6 +3518,10 @@ export class InteractiveMode {
|
|
|
3489
3518
|
* paste / Kitty / modifyOtherKeys sequences.
|
|
3490
3519
|
*/
|
|
3491
3520
|
uncaughtCrash(error) {
|
|
3521
|
+
// A dead terminal is not a pi crash. Do not try to restore it or record it.
|
|
3522
|
+
if (isDeadTerminalError(error)) {
|
|
3523
|
+
this.emergencyTerminalExit();
|
|
3524
|
+
}
|
|
3492
3525
|
if (this.isShuttingDown) {
|
|
3493
3526
|
process.exit(1);
|
|
3494
3527
|
}
|
|
@@ -3547,10 +3580,13 @@ export class InteractiveMode {
|
|
|
3547
3580
|
}
|
|
3548
3581
|
throw error;
|
|
3549
3582
|
};
|
|
3550
|
-
|
|
3551
|
-
process
|
|
3552
|
-
|
|
3553
|
-
|
|
3583
|
+
// stdin needs the handler too: once the terminal is gone, reads and setRawMode
|
|
3584
|
+
// fail with EIO (orphaned background process group) or ENOTTY (revoked tty).
|
|
3585
|
+
// Node emits these as stream errors, which are uncaught without a listener.
|
|
3586
|
+
for (const stream of [process.stdin, process.stdout, process.stderr]) {
|
|
3587
|
+
stream.on("error", terminalErrorHandler);
|
|
3588
|
+
this.signalCleanupHandlers.push(() => stream.off("error", terminalErrorHandler));
|
|
3589
|
+
}
|
|
3554
3590
|
// Restore the terminal before the process dies on any uncaught throw.
|
|
3555
3591
|
// Without this, an unhandled exception from extension code (or anywhere
|
|
3556
3592
|
// in pi) leaves the terminal in raw mode with no cursor.
|