fix: refresh pi dependency compatibility

Update Pi packages to 0.79.9 and align pi-ask with current TUI/RPC behavior.

- guard custom ask/settings flows to TUI mode with a clear non-TUI fallback

- reset config cache on extension reload so edited settings are picked up

- clean up remote ask flow listeners on session shutdown

- forward editor focus/invalidation and keep @ file autocomplete explicit

- document the non-TUI contract and cover the compatibility fixes with tests
This commit is contained in:
Erik Kotsiuba
2026-06-22 16:41:37 +02:00
parent 69e8bab6ef
commit d6db94a39d
20 changed files with 457 additions and 137 deletions
+22 -3
View File
@@ -4,7 +4,7 @@ import { registerAskTool } from "../src/ask-tool.ts";
import type { AskParams } from "../src/types.ts";
const NON_INTERACTIVE_MESSAGE_RE =
/Needs user input: ask_user requires interactive UI\./;
/Needs user input: ask_user requires interactive TUI mode\./;
const FIRST_QUESTION_RE = /1\. Goal: What should I optimize for\?/;
const SPEED_OPTION_RE = /- Speed \[speed\]/;
const CUSTOM_OPTION_RE = /- Type your own \[custom\]/;
@@ -47,8 +47,8 @@ function registerMockTool() {
};
}
function makeCtx(hasUi: boolean): unknown {
return { [HAS_UI]: hasUi };
function makeCtx(hasUi: boolean, mode = hasUi ? "tui" : "print"): unknown {
return { [HAS_UI]: hasUi, mode };
}
function sampleParams(): AskParams {
@@ -113,6 +113,25 @@ test("ask tool returns pending questions in non-interactive mode", async () => {
assert.match(result.content[0].text, CUSTOM_OPTION_RE);
});
test("ask tool does not open custom UI outside TUI mode", async () => {
const { tool } = registerMockTool();
let customOpened = false;
const result = await tool.execute("call-1", sampleParams(), undefined, noop, {
[HAS_UI]: true,
mode: "rpc",
ui: {
custom() {
customOpened = true;
},
},
});
assert.equal(customOpened, false);
assert.equal(result.details.cancelled, true);
assert.match(result.content[0].text, NON_INTERACTIVE_MESSAGE_RE);
});
test("ask tool includes custom answer fallback for preview questions", async () => {
const { tool } = registerMockTool();