mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
feat: integrate Pi backend and Pi Web
This commit is contained in:
@@ -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\(\)/);
|
||||
});
|
||||
Reference in New Issue
Block a user