Code blocks are drawn in the same pass as the Markdown, so a streaming reply no longer flickers. Two fixes from the review on 40eb3027:
- An unlabelled fence is detected by highlight.js again (`highlightAuto`, behind a 128-entry LRU). Only a fence that is still open at the end of a streaming message stays plain "text" (`isClosedFence`, which follows marked's fence rule).
- DOMPurify is back to the html profile only. The code-block icons are per-load random placeholders until after sanitize, and `codeBlockKey` is gone.
The Windows desktop reconnect is also fixed. `safeBackUrl` (gate, wrapper and web) takes loopback Magpie pages only, never `http://wails.localhost`. WebView2 can't route a 127.0.0.1 frame's request there, so it showed its gray error page. In the desktop window the wrapper, or an unwrapped daemon page, posts `{magpie:1, method:"error"}` instead, and Magpie's pluginpages.js answers with its Try again card. A stale stored wails back URL is dropped.
Reviewed at c520fa46 (merge base 1eb9473f = main) on mote (mote-run, HOME=$(mktemp -d), package copied out of the workspace):
- npm ci; `npm run check` clean; `npm run verify:build` OK for all 5 files.
- `npx vitest run` with CHROME_PATH set to Playwright's Chromium 1248: 77 files, 567 passed, 17 skipped, 0 failed. markdown-render-browser ran (it went red under the hand-breaks).
- `bun scripts/check.mjs agent-console` ok. Repo `bun test`: 6449 pass, 0 fail.
- Broken by hand, each red:
- autoDetect forced on while streaming: markdown-render-browser red.
- `svg: true` put back in the profile: markdown-render-browser red.
- Auto-detection removed: codeBlock and markdown-render-browser red.
- LRU eviction removed: codeBlock red.
- `isClosedFence` accepting any backtick run: codeBlock red.
- wails.localhost accepted again in gate.mjs, then in backToMagpie.ts: ac11 red (3 and 2 tests).
- The same in wrapper.mjs: wrapper red (4 tests).
- The stale stored back kept: wrapper red.
- Read magpie's pluginpages.js on main: `method:"error"` from the page's own frame calls `broke(key, why)`.
Not tried: a real WebView2 on Windows (the reconnect path), or a real streaming reply in the desktop app.
106 lines
3.7 KiB
JSON
106 lines
3.7 KiB
JSON
{
|
||
"name": "@magpie-community/page-agent-console",
|
||
"version": "1.3.7",
|
||
"description": "在 magpie 窗口里加一个「Agent 控制台」页面:用常驻本地服务驱动本机的 Agent CLI(Claude Code、Codex、Cursor 等),带结构化时间线。A Magpie page that drives local Agent CLIs (Claude Code, Codex, Cursor, and others) with a persistent local daemon and a structured timeline.",
|
||
"author": "qingnian108 (https://github.com/qingnian108)",
|
||
"homepage": "https://github.com/qingnian108/magpie-agent-console",
|
||
"bugs": {
|
||
"url": "https://github.com/magpie-community/plugins/issues"
|
||
},
|
||
"repository": {
|
||
"type": "git",
|
||
"url": "git+https://github.com/magpie-community/plugins.git",
|
||
"directory": "packages/agent-console"
|
||
},
|
||
"files": [
|
||
"index.mjs",
|
||
"lib",
|
||
"page/index.html",
|
||
"page/boot.js",
|
||
"app",
|
||
"daemon/dist",
|
||
"assets",
|
||
"README.md",
|
||
"LICENSE",
|
||
"THIRD-PARTY-NOTICES.md"
|
||
],
|
||
"keywords": [
|
||
"magpie",
|
||
"magpie-page",
|
||
"magpie-plugin",
|
||
"opencode",
|
||
"opencode-plugin",
|
||
"agent",
|
||
"claude",
|
||
"codex"
|
||
],
|
||
"license": "MIT",
|
||
"magpie": {
|
||
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0Ij48cmVjdCB3aWR0aD0iNjQiIGhlaWdodD0iNjQiIHJ4PSIxNSIgZmlsbD0iIzI2MjkyYiIvPjxnIGZpbGw9Im5vbmUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSI0Ij48cGF0aCBkPSJNMTQgMjAuNSAyNSAzMSAxNCA0MS41IiBzdHJva2U9IiNmZmYiLz48cGF0aCBkPSJNMjkuMTQgMjMuNjFBMTIgMTIgMCAxIDEgNDYuNjMgMzkuOTJMNDguNiA0Ny42IDM5Ljg1IDQyLjkzQTEyIDEyIDAgMCAxIDI5LjE0IDM4LjM5IiBzdHJva2U9IiNmZmYiLz48cGF0aCBkPSJNMzUuNiAzNS40aDYiIHN0cm9rZT0iIzJkZDRiZiIvPjwvZz48L3N2Zz4=",
|
||
"page": {
|
||
"title": "Agent Console",
|
||
"titles": {
|
||
"zh": "Agent 控制台",
|
||
"zh-TW": "Agent 控制台"
|
||
},
|
||
"file": "page/index.html",
|
||
"icon": "assets/icon.svg"
|
||
},
|
||
"permissions": []
|
||
},
|
||
"main": "./index.mjs",
|
||
"type": "module",
|
||
"scripts": {
|
||
"dev": "node daemon/dist/main.js --port 3499 --data _tmp/xdg-dev",
|
||
"start": "node daemon/dist/main.js",
|
||
"test": "vitest run",
|
||
"build": "node scripts/build-v1.mjs",
|
||
"check": "tsc -p tsconfig.daemon.json --noEmit && tsc -p tsconfig.web.json --noEmit",
|
||
"build:v1": "node scripts/build-v1.mjs",
|
||
"dev:v1": "node scripts/build-v1.mjs --watch",
|
||
"daemon:v1": "node daemon/dist/main.js --port 3499 --data _tmp/xdg-dev",
|
||
"test:v1": "vitest run",
|
||
"check:v1": "tsc -p tsconfig.daemon.json --noEmit && tsc -p tsconfig.web.json --noEmit",
|
||
"e2e:v1": "node scripts/e2e-v1.mjs",
|
||
"shot:v1": "node scripts/shot-v1.mjs",
|
||
"verify:build": "node scripts/verify-build.mjs",
|
||
"test:real": "vitest run --config vitest.real.config.ts",
|
||
"test:preview-attack": "node scripts/preview-attack.mjs"
|
||
},
|
||
"engines": {
|
||
"node": ">=20",
|
||
"magpie": ">=0.1.1340"
|
||
},
|
||
"dependencies": {
|
||
"@agentclientprotocol/sdk": "2.1.0",
|
||
"ignore": "7.0.14",
|
||
"ws": "8.22.0",
|
||
"zod": "4.6.7"
|
||
},
|
||
"optionalDependencies": {
|
||
"node-pty": "1.2.0-beta.15"
|
||
},
|
||
"devDependencies": {
|
||
"@tanstack/react-virtual": "3.14.24",
|
||
"@types/dompurify": "3.0.5",
|
||
"@types/node": "26.6.6",
|
||
"@types/react": "19.3.0",
|
||
"@types/react-dom": "19.3.0",
|
||
"@types/ws": "8.18.2",
|
||
"@xterm/addon-fit": "0.11.0",
|
||
"@xterm/xterm": "6.0.0",
|
||
"clsx": "2.1.1",
|
||
"dompurify": "3.4.17",
|
||
"esbuild": "0.28.2",
|
||
"highlight.js": "11.12.0",
|
||
"lucide-react": "1.64.0",
|
||
"marked": "18.1.2",
|
||
"playwright-core": "1.64.1",
|
||
"react": "19.3.1",
|
||
"react-dom": "19.3.1",
|
||
"typescript": "7.0.2",
|
||
"vitest": "5.0.5",
|
||
"zustand": "5.0.16"
|
||
}
|
||
}
|