diff --git a/Agent.md b/Agent.md index 950cef453..4aabfcfb9 100644 --- a/Agent.md +++ b/Agent.md @@ -60,7 +60,7 @@ What EMRG does today — capabilities, not a changelog. Foreground daemon: `python -m emrg`. - Python: `uv run pytest tests/ -v` — re-count with `uv run --no-sync python3 scripts/check-doc-count.py --measure`. Import check: `uv run python -c "from emrg.client.app import run_client"` -GUI: `cd emrg/gui && npm test` (279: 107 daemon_client + 22 conn-manager + 7 integration + 7 nav-policy + 11 gui-state + 9 build-config + 10 config_fields + 16 boot-contract + 3 preload-api + 2 theme-guard + 2 image-hash + 8 switch-session + 19 atp_login + 4 gui-op-log + 9 theme-setting + 5 window-title + 4 frame-route + 11 browser-policy + 5 browser-wiring + 13 settings_store + 5 preview-annotation-wiring) — syntax: `node --check main.js preload.js daemon_client.js` +GUI: `cd emrg/gui && npm test` (280: 107 daemon_client + 22 conn-manager + 7 integration + 7 nav-policy + 11 gui-state + 10 build-config + 10 config_fields + 16 boot-contract + 3 preload-api + 2 theme-guard + 2 image-hash + 8 switch-session + 19 atp_login + 4 gui-op-log + 9 theme-setting + 5 window-title + 4 frame-route + 11 browser-policy + 5 browser-wiring + 13 settings_store + 5 preview-annotation-wiring) — syntax: `node --check main.js preload.js daemon_client.js` Renderer: `cd emrg/gui/renderer && npm run typecheck && npm test` (1283: 5 snapshot-store + 13 utils + 3 ErrorBoundary + 2 App + 12 commands + 4 copywriting + 14 i18n + 33 markdown + 22 selection + 41 transcript + 11 conversationType + 4 MarkdownText + 65 TranscriptView + 22 history + 30 historyReplay + 8 userImages + 43 composer + 97 Composer + 14 sidebar + 32 workspaceView + 18 WorkspaceView + 10 dialog + 6 Dialog + 9 ConfirmDialog + 9 RenameDialog + 13 dialogLists + 3 HelpDialog + 9 MemoryDialog + 8 SkillsDialog + 8 openSession + 6 WelcomeDialog + 20 OpenSessionDialog + 14 NewSessionDialog + 7 rewind + 8 RewindDialog + 7 GithubDeviceDialog + 82 daemonBridge + 13 DaemonBridgeProvider + 69 Shell + 19 page + 51 EditorPanel + 25 DialogHost + 48 SettingsPanel + 18 TaskFormDialog + 5 RantDialog + 8 vendorMarkdown + 10 highlightTheme + 8 ApprovalDialog + 20 SandboxRootsDialog + 42 cockpit + 4 editorSelectionCascade + 9 fileTree + 24 FileTree + 5 contextMenu + 1 residue + 24 StatusBand + 24 UsageRanking + 9 usageRanking + 6 SearchOverlay + 5 ResizeHandle + 8 IconRail + 6 SessionColumn + 5 EmrgMark + 38 editorDoc + 27 CodeEditor + 26 annotation + 14 AnnotationMode) - CI: pytest on ubuntu **and windows-2025**, the GUI suites, and an actionlint gate over `.github/workflows/`; re-trigger a dropped push with `scripts/re-trigger-ci.sh `, never an empty commit - Merge gates, run before merging — `uv run --no-sync python3 scripts/check-vote-count.py` · `scripts/check-pr-base.py` · `scripts/check-merge-freshness.py` · `scripts/check-merge-order.py` · `scripts/check-merge-landing-diff.py` · `scripts/check-merge-pairs.py` / `scripts/check-merge-sequence.py` · `scripts/check-merge-tree-health.py` (the merged tree passes one guard) · `scripts/check-merge-plan-suite.py` — all under `uv run --no-sync python3` diff --git a/emrg/gui/package.json b/emrg/gui/package.json index 02b86891d..a0c86182a 100644 --- a/emrg/gui/package.json +++ b/emrg/gui/package.json @@ -35,6 +35,7 @@ "files": [ "main.js", "preload.js", + "preview-preload.js", "renderer/**", "!renderer/node_modules{,/**/*}", "!renderer/src{,/**/*}", diff --git a/emrg/gui/test/build-config.test.js b/emrg/gui/test/build-config.test.js index e8258cd79..f57e87d9a 100644 --- a/emrg/gui/test/build-config.test.js +++ b/emrg/gui/test/build-config.test.js @@ -102,6 +102,28 @@ test("every main.js/preload.js local require is covered by files whitelist", () }); +test("every preload named by a path.join(__dirname, ...) in main.js is covered by files whitelist", () => { + // 一个 preload 不是被 `require` 载入的,所以上面那条扫描看不见它:main.js 写的是 + // `preload: path.join(__dirname, "preview-preload.js")`,文件在仓里、构建时却没进包。 + // 实测 2026-12-03:v0.3.88 装好的 app.asar 里 `asar list | grep -c preview-preload` = 0, + // 预览页因此没有批注界面,而当时所有测试都是绿的——它漏在清单外,不在代码里。 + const files = (PKG.build && PKG.build.files) || []; + const src = fs.readFileSync(path.join(GUI_ROOT, "main.js"), "utf-8"); + const found = []; + const re = /path\.join\(\s*__dirname\s*,\s*"([^"]+\.js)"\s*\)/g; + let m; + while ((m = re.exec(src)) !== null) found.push(m[1]); + assert.ok(found.length > 0, "no path.join(__dirname, \"*.js\") found — scan is broken"); + const uncovered = found.filter((rel) => !whitelistCovers(files, rel)); + assert.deepStrictEqual( + uncovered, + [], + `files named by main.js but MISSING from build.files whitelist: ${JSON.stringify(uncovered)} — ` + + `they exist in the repo and would be absent from app.asar, so the packaged app silently ` + + `loses whatever they do` + ); +}); + test("preload exposes workspace-panel APIs (listFiles/readFile)", () => { // 右栏工作区面板 P1(rant 2026-08-11T12:20:35 P1.2):preload 桥必须暴露两个新 API, // 否则 renderer 无法触达 daemon 的 list_files/read_file 命令。