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(e2e): cover plugin labels following the app language
vastsa796fb5f23418
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 73bc3c825..5d7e64861 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -76,7 +76,7 @@ levels does not waive the relevant E2E gate.|---|---|---|| **Vitest** | Unit + integration (TS side) | Active (`pnpm test`, shared package) || **Rust #[test]** | Host-core unit tests | Active (`cargo test -p host-core`) |-| **Protocol smoke** | Host RPC + tools + plugins headless | Active (`test:e2e`, 20 checks) |+| **Protocol smoke** | Host RPC + tools + plugins headless | Active (`test:e2e`, 22 checks) || **Electron probes** | Boot bridge, session-list responsiveness, and crash supervision | Active (`test:e2e:boot`, `test:e2e:supervision`) || **Playwright** | Full UI-driven journeys | Planned (post-M5) |diff --git a/scripts/e2e-smoke.mjs b/scripts/e2e-smoke.mjsindex 95d47bfa6..0ed06ca58 100755--- a/scripts/e2e-smoke.mjs+++ b/scripts/e2e-smoke.mjs@@ -344,6 +344,62 @@ async function main() {plugin.id === "demo.hello" && plugin.enabled === true,);+ // E2E-0PLUGIN-I18N: plugin labels follow the pushed app language. The+ // manifest carries both contract locales, and the host — not the renderer —+ // picks the entry, so the row the desktop draws changes with the language+ // while the stored manifest does not.+ {+ const localizedDir = join(dataDir, "labels-i18n");+ mkdirSync(localizedDir, { recursive: true });+ writeFileSync(join(localizedDir, "main.js"), "function onLoad() {}\nfunction onUnload() {}\n");+ writeFileSync(+ join(localizedDir, "manifest.json"),+ JSON.stringify({+ schemaVersion: 1,+ id: "e2e.labels",+ name: "小清新待办",+ version: "0.1.0",+ description: "作者原话",+ main: "main.js",+ permissions: [],+ i18n: {+ en: { name: "Todo List", description: "A calm todo list" },+ "zh-CN": { name: "小清新待办", description: "轻盈的待办清单" },+ },+ }),+ );+ const loadedRow = await loadDevelopmentPlugin(host, localizedDir);+ const enRow = (await host.call("plugins.list")).plugins.find(+ (candidate) => candidate.id === "e2e.labels",+ );+ await host.call("plugins.setLocale", { locale: "zh-CN" });+ const zhRow = (await host.call("plugins.list")).plugins.find(+ (candidate) => candidate.id === "e2e.labels",+ );+ // A plugin is not required to translate itself into every shell locale:+ // zh-TW reads the English entry rather than half a zh-CN guess (ADR 0182).+ await host.call("plugins.setLocale", { locale: "zh-TW" });+ const twRow = (await host.call("plugins.list")).plugins.find(+ (candidate) => candidate.id === "e2e.labels",+ );+ // `auto` is a setting, not a locale: the desktop shell resolves it, and+ // the host must keep reading the locale it was last given.+ const afterAuto = await host.call("plugins.setLocale", { locale: "auto" });+ await host.call("plugins.setLocale", { locale: "en" });+ record(+ "E2E-0PLUGIN-I18N",+ loadedRow.name === "Todo List" &&+ enRow?.description === "A calm todo list" &&+ zhRow?.name === "小清新待办" &&+ zhRow?.description === "轻盈的待办清单" &&+ twRow?.name === "Todo List" &&+ afterAuto?.locale === "zh-TW" &&+ enRow !== undefined &&+ !("i18n" in enRow),+ `en=${enRow?.name} zh=${zhRow?.name} zh-TW=${twRow?.name}`,+ );+ }+// E2E-024: plugin agent tool dispatch roundtrip. The smoke harness acts// as the desktop runner: host emits plugins.execute, we answer via// plugins.resolveExecution, and tools.execute returns the plugin result.