Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
test(plugins): cover registered remote root delivery
Seraph-x830de6bd916b
diff --git a/apps/pi-host/src/plugin-workspace-files.test.ts b/apps/pi-host/src/plugin-workspace-files.test.tsindex 2b8b47446..cb48ced49 100644--- a/apps/pi-host/src/plugin-workspace-files.test.ts+++ b/apps/pi-host/src/plugin-workspace-files.test.ts@@ -10,10 +10,16 @@ afterEach(async () => {});function projectHost(paths: readonly string[]) {+ const projects = paths.map((path, index) => ({ id: index + 1, path, name: `project-${index + 1}` }));return {- async call<T>(method: string): Promise<T> {+ async call<T>(method: string, params: Record<string, unknown> = {}): Promise<T> {if (method === "projects.list") {- return { projects: paths.map((path, index) => ({ id: index + 1, path, name: `project-${index + 1}` })) } as T;+ return { projects } as T;+ }+ if (method === "projects.create") {+ const project = { id: projects.length + 1, path: String(params.path), name: `project-${projects.length + 1}` };+ projects.push(project);+ return { project } as T;}throw new Error(`unexpected ${method}`);},@@ -106,8 +112,9 @@ it("allows an explicitly registered workspace root outside the browse root", { tawait mkdir(root, { recursive: true });await mkdir(unregistered);await writeFile(join(root, "README.md"), "registered workspace\n");+ const host = projectHost([]);const operations = createHostOperations({- getHost: () => projectHost([root]),+ getHost: () => host,runtime: { compact: async () => ({ accepted: true }), isBusy: () => false },browseRoot,dataDir: join(scratch, "host-data"),@@ -119,6 +126,8 @@ it("allows an explicitly registered workspace root outside the browse root", { tscope: ["**"],});+ await expect(read(root)).rejects.toMatchObject({ code: "REMOTE_PATH_FORBIDDEN" });+ await operations.projects.register(root);expect(await read(root)).toMatchObject({kind: "list",entries: [{ name: "README.md", path: "README.md", isDirectory: false }],diff --git a/scripts/e2e-remote-file-manager.mjs b/scripts/e2e-remote-file-manager.mjsindex d471e6872..05f254f6b 100644--- a/scripts/e2e-remote-file-manager.mjs+++ b/scripts/e2e-remote-file-manager.mjs@@ -3,7 +3,7 @@import assert from "node:assert/strict";import { fork } from "node:child_process";import { createServer } from "node:http";-import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";+import { mkdir, mkdtemp, readFile, realpath, rm, writeFile } from "node:fs/promises";import { createRequire, register } from "node:module";import { tmpdir } from "node:os";import { dirname, join, resolve } from "node:path";@@ -43,9 +43,10 @@ async function capture(page, name) {await page.screenshot({ path: join(process.env.PI_E2E_ARTIFACTS, name) });}try {- const remotePath = join(temp, "remote-repository");+ const remoteDirectory = join(temp, "remote-repository");const localPath = join(temp, "local-control");- await mkdir(join(remotePath, "docs"), { recursive: true });+ await mkdir(join(remoteDirectory, "docs"), { recursive: true });+ const remotePath = await realpath(remoteDirectory);await mkdir(localPath);await mkdir(join(temp, "browse-root"));await mkdir(join(remotePath, "nested"));