feat(quick-pane): promote active runtime
This commit is contained in:
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import test from "node:test";
|
||||
|
||||
test("Quick Pane polls snapshots, renders answers, and gates manual transcript handoff", async () => {
|
||||
test("Quick Pane polls snapshots, renders answers, and promotes runtime without a handoff", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
||||
"utf8",
|
||||
@@ -13,7 +13,12 @@ test("Quick Pane polls snapshots, renders answers, and gates manual transcript h
|
||||
assert.match(source, /className="quick-pane-notice escalation"/);
|
||||
assert.match(source, /className="quick-pane-assistant-footer"/);
|
||||
assert.match(source, /Continue in full session/);
|
||||
assert.match(source, /Quick Pane transcript:/);
|
||||
assert.match(
|
||||
source,
|
||||
/await invoke<\{ runtime: Runtime \}>\("promote_quick_runtime", \{\s+runtimeId: current\.runtimeId,/,
|
||||
);
|
||||
assert.doesNotMatch(source, /Quick Pane transcript:/);
|
||||
assert.doesNotMatch(source, /create_session_runtime/);
|
||||
assert.doesNotMatch(source, /maximumSeconds|Quick time budget/);
|
||||
});
|
||||
|
||||
@@ -166,6 +171,27 @@ test("Quick Pane dismiss and mutually exclusive window visibility stay native-se
|
||||
assert.ok(quickClearMain >= 0 && quickClearMain < showQuick);
|
||||
});
|
||||
|
||||
test("native promotion owns visibility and Main consumes pending runtime after startup refresh", async () => {
|
||||
const [nativeSource, workspaceSource] = await Promise.all([
|
||||
readFile(new URL("../ui/src-tauri/src/lib.rs", import.meta.url), "utf8"),
|
||||
readFile(new URL("../ui/src/workspace/useWorkspace.ts", import.meta.url), "utf8"),
|
||||
]);
|
||||
const promotion = nativeSource.slice(
|
||||
nativeSource.indexOf("fn show_main_for_promoted_runtime"),
|
||||
nativeSource.indexOf("fn toggle_quick_pane"),
|
||||
);
|
||||
assert.match(promotion, /get_or_create_main_with_visibility\(app, false\)/);
|
||||
assert.ok(promotion.indexOf("quick_pane\n .hide()") < promotion.indexOf("window\n .show()"));
|
||||
assert.ok(promotion.indexOf('visibility.hidden("quick-pane")') < promotion.indexOf("window\n .show()"));
|
||||
assert.match(promotion, /\*pending = Some\(runtime_id\)/);
|
||||
assert.match(nativeSource, /fn get_pending_promoted_runtime/);
|
||||
assert.match(nativeSource, /fn consume_pending_promoted_runtime/);
|
||||
assert.match(workspaceSource, /await promotedListenerReady/);
|
||||
assert.match(workspaceSource, /await refresh\(loaded\)/);
|
||||
assert.match(workspaceSource, /get_pending_promoted_runtime/);
|
||||
assert.match(workspaceSource, /consume_pending_promoted_runtime/);
|
||||
});
|
||||
|
||||
test("Quick Pane routes extension responses through existing bridge command", async () => {
|
||||
const source = await readFile(
|
||||
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
||||
|
||||
Reference in New Issue
Block a user