feat: integrate Pi backend and Pi Web

This commit is contained in:
luckyyzh
2026-07-30 19:37:53 +08:00
commit 7392ab9dd7
1390 changed files with 337197 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
test("RPC session startup preloads extension-registered providers before restoring models", async () => {
const source = await readFile(new URL("./rpc-manager.ts", import.meta.url), "utf8");
const startupSource = source.slice(source.indexOf("export async function startRpcSession"));
assert.match(startupSource, /createAgentSessionServices\(/);
assert.match(startupSource, /createAgentSessionFromServices\(/);
assert.doesNotMatch(startupSource, /await createAgentSession\(/);
});
test("custom extension UI receives the fixed headless terminal facade", async () => {
const source = await readFile(new URL("./rpc-manager.ts", import.meta.url), "utf8");
const customUiSource = source.slice(
source.indexOf("private requestExtensionCustomUi"),
source.indexOf("private requestExtensionUi"),
);
assert.match(customUiSource, /createHeadlessCustomUiTui\(/);
assert.match(customUiSource, /width,/);
});
test("reloading a session invalidates the models cache", async () => {
const source = await readFile(new URL("./rpc-manager.ts", import.meta.url), "utf8");
const reloadSource = source.slice(
source.indexOf('case "reload"'),
source.indexOf('case "abort_compaction"'),
);
assert.match(reloadSource, /await this\.inner\.reload\(\)/);
assert.match(reloadSource, /this\.applyForcedEmptySystemPrompt\(\);\s*invalidateModelsCache\(\)/);
});