@code-yeongyu/senpi 2026.5.13-4 → 2026.5.14
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 +10 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +12 -5
- 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 +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +2 -2
- 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 +8 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/anthropic-web-search/index.js +20 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +0 -18
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/openai-web-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/openai-web-search/index.js +28 -0
- package/dist/core/extensions/builtin/openai-web-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.js +1 -1
- package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +0 -9
- package/dist/core/resource-loader.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 +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +1 -1
- package/dist/core/tools/render-utils.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/modes/interactive/components/assistant-message.d.ts +0 -3
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +3 -22
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +1 -1
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +6 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +12 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +43 -5
- 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 +2 -2
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +3 -11
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/provider-native-rendering.d.ts +5 -0
- package/dist/modes/provider-native-rendering.d.ts.map +1 -0
- package/dist/modes/provider-native-rendering.js +247 -0
- package/dist/modes/provider-native-rendering.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +59 -16
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +118 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +76 -7
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/sdk.md +25 -43
- package/examples/sdk/01-minimal.ts +14 -10
- package/examples/sdk/02-custom-model.ts +12 -8
- package/examples/sdk/03-custom-prompt.ts +24 -16
- package/examples/sdk/04-skills.ts +2 -2
- package/examples/sdk/05-tools.ts +8 -4
- package/examples/sdk/06-extensions.ts +11 -7
- package/examples/sdk/07-context-files.ts +2 -2
- package/examples/sdk/08-prompt-templates.ts +2 -2
- package/examples/sdk/09-api-keys-and-oauth.ts +8 -4
- package/examples/sdk/10-settings.ts +4 -4
- package/examples/sdk/11-sessions.ts +4 -0
- package/examples/sdk/12-full-control.ts +11 -7
- package/examples/sdk/README.md +6 -9
- package/package.json +5 -10
- package/dist/core/extensions/builtin/anthropic-code-execution/index.d.ts +0 -7
- package/dist/core/extensions/builtin/anthropic-code-execution/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/anthropic-code-execution/index.js +0 -79
- package/dist/core/extensions/builtin/anthropic-code-execution/index.js.map +0 -1
- package/dist/core/extensions/builtin/anthropic-computer-use/index.d.ts +0 -53
- package/dist/core/extensions/builtin/anthropic-computer-use/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/anthropic-computer-use/index.js +0 -676
- package/dist/core/extensions/builtin/anthropic-computer-use/index.js.map +0 -1
- package/dist/core/extensions/builtin/anthropic-text-editor/index.d.ts +0 -25
- package/dist/core/extensions/builtin/anthropic-text-editor/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/anthropic-text-editor/index.js +0 -244
- package/dist/core/extensions/builtin/anthropic-text-editor/index.js.map +0 -1
- package/dist/core/extensions/builtin/anthropic-tool-search/index.d.ts +0 -6
- package/dist/core/extensions/builtin/anthropic-tool-search/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/anthropic-tool-search/index.js +0 -112
- package/dist/core/extensions/builtin/anthropic-tool-search/index.js.map +0 -1
- package/dist/core/extensions/builtin/google-code-execution/index.d.ts +0 -7
- package/dist/core/extensions/builtin/google-code-execution/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/google-code-execution/index.js +0 -73
- package/dist/core/extensions/builtin/google-code-execution/index.js.map +0 -1
- package/dist/core/extensions/builtin/google-google-search/index.d.ts +0 -7
- package/dist/core/extensions/builtin/google-google-search/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/google-google-search/index.js +0 -83
- package/dist/core/extensions/builtin/google-google-search/index.js.map +0 -1
- package/dist/core/extensions/builtin/google-url-context/index.d.ts +0 -7
- package/dist/core/extensions/builtin/google-url-context/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/google-url-context/index.js +0 -82
- package/dist/core/extensions/builtin/google-url-context/index.js.map +0 -1
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.d.ts +0 -6
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.js +0 -57
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.js.map +0 -1
- package/dist/core/extensions/builtin/openai-code-interpreter/index.d.ts +0 -10
- package/dist/core/extensions/builtin/openai-code-interpreter/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/openai-code-interpreter/index.js +0 -95
- package/dist/core/extensions/builtin/openai-code-interpreter/index.js.map +0 -1
|
@@ -9,7 +9,7 @@ import * as path from "node:path";
|
|
|
9
9
|
import { getProviders, } from "@earendil-works/pi-ai";
|
|
10
10
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "@earendil-works/pi-tui";
|
|
11
11
|
import { spawn, spawnSync } from "child_process";
|
|
12
|
-
import { APP_NAME, APP_TITLE, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
12
|
+
import { APP_NAME, APP_TITLE, expandTildePath, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
13
13
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
14
14
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
15
15
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
@@ -1594,7 +1594,7 @@ export class InteractiveMode {
|
|
|
1594
1594
|
opts?.signal?.removeEventListener("abort", onAbort);
|
|
1595
1595
|
this.hideExtensionSelector();
|
|
1596
1596
|
resolve(undefined);
|
|
1597
|
-
}, { tui: this.ui, timeout: opts?.timeout });
|
|
1597
|
+
}, { tui: this.ui, timeout: opts?.timeout, onToggleToolsExpanded: () => this.toggleToolOutputExpansion() });
|
|
1598
1598
|
this.editorContainer.clear();
|
|
1599
1599
|
this.editorContainer.addChild(this.extensionSelector);
|
|
1600
1600
|
this.ui.setFocus(this.extensionSelector);
|
|
@@ -2653,6 +2653,38 @@ export class InteractiveMode {
|
|
|
2653
2653
|
// extension cleanup can write restore sequences and re-trigger EIO.
|
|
2654
2654
|
process.exit(129);
|
|
2655
2655
|
}
|
|
2656
|
+
/**
|
|
2657
|
+
* Last-resort handler for uncaught exceptions. The TUI puts stdin into raw
|
|
2658
|
+
* mode and hides the cursor; without this handler, an uncaught throw from
|
|
2659
|
+
* anywhere (e.g. an extension's async `ChildProcess.on("exit")` callback)
|
|
2660
|
+
* tears down the process while leaving the terminal in raw mode with no
|
|
2661
|
+
* cursor, requiring `stty sane && reset` to recover.
|
|
2662
|
+
*
|
|
2663
|
+
* Unlike emergencyTerminalExit, the terminal is still alive here, so we
|
|
2664
|
+
* call ui.stop() to restore cooked mode, the cursor, and disable bracketed
|
|
2665
|
+
* paste / Kitty / modifyOtherKeys sequences.
|
|
2666
|
+
*/
|
|
2667
|
+
uncaughtCrash(error) {
|
|
2668
|
+
if (this.isShuttingDown) {
|
|
2669
|
+
process.exit(1);
|
|
2670
|
+
}
|
|
2671
|
+
this.isShuttingDown = true;
|
|
2672
|
+
try {
|
|
2673
|
+
this.unregisterSignalHandlers();
|
|
2674
|
+
}
|
|
2675
|
+
catch { }
|
|
2676
|
+
try {
|
|
2677
|
+
killTrackedDetachedChildren();
|
|
2678
|
+
}
|
|
2679
|
+
catch { }
|
|
2680
|
+
try {
|
|
2681
|
+
this.ui.stop();
|
|
2682
|
+
}
|
|
2683
|
+
catch { }
|
|
2684
|
+
console.error("pi exiting due to uncaughtException:");
|
|
2685
|
+
console.error(error);
|
|
2686
|
+
process.exit(1);
|
|
2687
|
+
}
|
|
2656
2688
|
/**
|
|
2657
2689
|
* Check if shutdown was requested and perform shutdown if so.
|
|
2658
2690
|
*/
|
|
@@ -2688,6 +2720,12 @@ export class InteractiveMode {
|
|
|
2688
2720
|
process.stderr.on("error", terminalErrorHandler);
|
|
2689
2721
|
this.signalCleanupHandlers.push(() => process.stdout.off("error", terminalErrorHandler));
|
|
2690
2722
|
this.signalCleanupHandlers.push(() => process.stderr.off("error", terminalErrorHandler));
|
|
2723
|
+
// Restore the terminal before the process dies on any uncaught throw.
|
|
2724
|
+
// Without this, an unhandled exception from extension code (or anywhere
|
|
2725
|
+
// in pi) leaves the terminal in raw mode with no cursor.
|
|
2726
|
+
const uncaughtExceptionHandler = (error) => this.uncaughtCrash(error);
|
|
2727
|
+
process.prependListener("uncaughtException", uncaughtExceptionHandler);
|
|
2728
|
+
this.signalCleanupHandlers.push(() => process.off("uncaughtException", uncaughtExceptionHandler));
|
|
2691
2729
|
}
|
|
2692
2730
|
unregisterSignalHandlers() {
|
|
2693
2731
|
for (const cleanup of this.signalCleanupHandlers) {
|
|
@@ -4082,13 +4120,13 @@ export class InteractiveMode {
|
|
|
4082
4120
|
if (closingQuoteIndex < 0) {
|
|
4083
4121
|
return undefined;
|
|
4084
4122
|
}
|
|
4085
|
-
return argsString.slice(1, closingQuoteIndex);
|
|
4123
|
+
return expandTildePath(argsString.slice(1, closingQuoteIndex));
|
|
4086
4124
|
}
|
|
4087
4125
|
const firstWhitespaceIndex = argsString.search(/\s/);
|
|
4088
4126
|
if (firstWhitespaceIndex < 0) {
|
|
4089
|
-
return argsString;
|
|
4127
|
+
return expandTildePath(argsString);
|
|
4090
4128
|
}
|
|
4091
|
-
return argsString.slice(0, firstWhitespaceIndex);
|
|
4129
|
+
return expandTildePath(argsString.slice(0, firstWhitespaceIndex));
|
|
4092
4130
|
}
|
|
4093
4131
|
async handleImportCommand(text) {
|
|
4094
4132
|
const inputPath = this.getPathCommandArgument(text, "/import");
|