refactor!: remove redundant compatibility layers
Use native browser and Tauri behavior instead of custom selector, dialog, and window-state implementations. Remove obsolete bridge, relay, asset, and dependency paths to keep the supported surface small. BREAKING CHANGE: The Noctalia relay no longer accepts --agent, and the Tauri host no longer exposes the legacy load_agent command.
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { mkdir, mkdtemp } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import test from "node:test";
|
||||
import { startBridgeDaemon } from "../src/bridge/daemon.js";
|
||||
import { createNoctaliaStateRelay } from "../src/client/noctalia-relay.js";
|
||||
|
||||
test("starts a bridge daemon around the local bridge service", async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), "pi-status-bridge-daemon-"));
|
||||
const home = join(root, "home");
|
||||
await mkdir(home);
|
||||
const daemon = await startBridgeDaemon({ homeWorktree: home, runtimeDir: join(root, "runtime"), sessionRoot: join(root, "sessions"), startAdapter: () => ({ send: async () => ({ type: "response", success: true }), respondToExtension: () => {}, stop: async () => {} }) });
|
||||
try { assert.match(daemon.socketPath, /bridge\.sock$/); assert.equal(daemon.listAgents()[0].worktreePath, home); }
|
||||
finally { await daemon.close(); }
|
||||
});
|
||||
|
||||
test("relays aggregate workspace summary as compact Noctalia state", async () => {
|
||||
const updates = [];
|
||||
const relay = createNoctaliaStateRelay({
|
||||
client: { request: async (operation) => { assert.equal(operation, "get_workspace_summary"); return { openCount: 3, workingCount: 1, attentionCount: 2, recoveringCount: 0, errorCount: 1 }; } },
|
||||
onState: (state) => updates.push(state), pollMs: 250,
|
||||
});
|
||||
await relay.start(); relay.stop();
|
||||
assert.deepEqual(updates, [{ state: "error", projectLabel: "3 sessions", attentionCount: 2, detail: "3 open · 1 working · 2 attention · 0 recovering · 1 errors", openCount: 3, workingCount: 1, recoveringCount: 0, errorCount: 1 }]);
|
||||
});
|
||||
|
||||
test("retains agent-scoped relay behavior only when explicitly requested", async () => {
|
||||
let listener; const updates = [];
|
||||
const relay = createNoctaliaStateRelay({ client: { request: async () => ({ data: { isStreaming: false } }), subscribe: async (_agentId, _cursor, callback) => { listener = callback; return () => {}; } }, agent: { id: "agent-1", worktreePath: "/worktrees/feature" }, onState: (state) => updates.push(state) });
|
||||
await relay.start(); listener({ type: "agent_state", data: { state: "streaming" } });
|
||||
assert.equal(updates.at(-1).state, "streaming"); assert.equal(updates.at(-1).projectLabel, "feature");
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { createNoctaliaStateRelay } from "../src/client/noctalia-relay.js";
|
||||
|
||||
test("relays aggregate workspace summary as compact Noctalia state", async () => {
|
||||
const updates = [];
|
||||
const relay = createNoctaliaStateRelay({
|
||||
client: { request: async (operation) => { assert.equal(operation, "get_workspace_summary"); return { openCount: 3, workingCount: 1, attentionCount: 2, recoveringCount: 0, errorCount: 1 }; } },
|
||||
onState: (state) => updates.push(state), pollMs: 250,
|
||||
});
|
||||
await relay.start(); relay.stop();
|
||||
assert.deepEqual(updates, [{ state: "error", projectLabel: "3 sessions", attentionCount: 2, detail: "3 open · 1 working · 2 attention · 0 recovering · 1 errors", openCount: 3, workingCount: 1, recoveringCount: 0, errorCount: 1 }]);
|
||||
});
|
||||
+11
-15
@@ -114,8 +114,14 @@ test("Quick Pane keeps slash-containing model IDs atomic and renews only on pane
|
||||
assert.match(pane, /provider: submittedModel\.provider/);
|
||||
assert.match(pane, /modelId: submittedModel\.modelId/);
|
||||
assert.doesNotMatch(pane, /selectedModel\.split/);
|
||||
assert.match(pane, /listen\("quick-pane-shown"[\s\S]*?void renewChatOnShow\(\)/);
|
||||
assert.match(pane, /onFocusChanged[\s\S]*?if \(event\.payload\) focusInput\(\);/);
|
||||
assert.match(
|
||||
pane,
|
||||
/listen\("quick-pane-shown"[\s\S]*?void renewChatOnShow\(\)/,
|
||||
);
|
||||
assert.match(
|
||||
pane,
|
||||
/onFocusChanged[\s\S]*?if \(event\.payload\) focusInput\(\);/,
|
||||
);
|
||||
assert.match(pane, /const CHAT_RENEWAL_MS = 180_000/);
|
||||
assert.match(pane, /Date\.now\(\) - lastActivity > CHAT_RENEWAL_MS/);
|
||||
assert.match(pane, /event\.ctrlKey && event\.key\.toLowerCase\(\) === "n"/);
|
||||
@@ -131,7 +137,7 @@ test("Quick Pane keeps slash-containing model IDs atomic and renews only on pane
|
||||
assert.match(catalog, /JSON\.parse\(value\)/);
|
||||
});
|
||||
|
||||
test("Quick Pane dismiss and mutually exclusive window visibility stay native-serialized", async () => {
|
||||
test("Quick Pane dismiss and mutually exclusive visibility use native window state", async () => {
|
||||
const [pane, nativeSource] = await Promise.all([
|
||||
readFile(
|
||||
new URL("../ui/src/quick-pane/QuickPane.tsx", import.meta.url),
|
||||
@@ -151,32 +157,26 @@ test("Quick Pane dismiss and mutually exclusive window visibility stay native-se
|
||||
nativeSource,
|
||||
/dismiss_quick_pane,[\s\S]*create_session_runtime/,
|
||||
);
|
||||
assert.match(
|
||||
nativeSource,
|
||||
/struct WindowVisibility\(Mutex<ManagedWindowVisibility>\)/,
|
||||
);
|
||||
assert.doesNotMatch(nativeSource, /ManagedWindowVisibility|WindowVisibility/);
|
||||
assert.match(nativeSource, /window\.is_visible\(\)/);
|
||||
|
||||
const mainShow = nativeSource.slice(
|
||||
nativeSource.indexOf("fn apply_main_window_action"),
|
||||
nativeSource.indexOf("fn get_or_create_quick_pane"),
|
||||
);
|
||||
const mainHideQuick = mainShow.indexOf("quick_pane.hide()");
|
||||
const mainClearQuick = mainShow.indexOf('visibility.hidden("quick-pane")');
|
||||
const showMain = mainShow.indexOf("window.show()");
|
||||
assert.ok(mainShow.indexOf('get_webview_window("quick-pane")') >= 0);
|
||||
assert.ok(mainHideQuick >= 0 && mainHideQuick < showMain);
|
||||
assert.ok(mainClearQuick >= 0 && mainClearQuick < showMain);
|
||||
|
||||
const quickShow = nativeSource.slice(
|
||||
nativeSource.indexOf("fn toggle_quick_pane"),
|
||||
nativeSource.indexOf("fn requested_new_worktree_argument"),
|
||||
);
|
||||
const quickHideMain = quickShow.indexOf("main.hide()");
|
||||
const quickClearMain = quickShow.indexOf('visibility.hidden("main")');
|
||||
const showQuick = quickShow.indexOf("window.show()");
|
||||
assert.ok(quickShow.indexOf('get_webview_window("main")') >= 0);
|
||||
assert.ok(quickHideMain >= 0 && quickHideMain < showQuick);
|
||||
assert.ok(quickClearMain >= 0 && quickClearMain < showQuick);
|
||||
});
|
||||
|
||||
test("native promotion owns visibility and Main consumes pending runtime after startup refresh", async () => {
|
||||
@@ -196,10 +196,6 @@ test("native promotion owns visibility and Main consumes pending runtime after s
|
||||
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/);
|
||||
|
||||
@@ -73,8 +73,9 @@ test("preserves native session naming, compaction, composer, and extension respo
|
||||
assert.match(app, /respond_to_extension/);
|
||||
assert.match(conversation, /event\.key === "Enter" && !event\.shiftKey/);
|
||||
assert.match(conversation, /className="todos-pane"/);
|
||||
assert.match(extension, /role="dialog"/);
|
||||
assert.match(extension, /aria-modal="true"/);
|
||||
assert.match(extension, /<dialog/);
|
||||
assert.match(extension, /showModal\(\)/);
|
||||
assert.match(extension, /onCancel=/);
|
||||
});
|
||||
|
||||
test("configures native window behavior and folder dialog capabilities", async () => {
|
||||
|
||||
Reference in New Issue
Block a user