pi-web-ui 0.29.3 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/agent-service.js +4 -2
- package/dist/server/client-state.js +29 -0
- package/package.json +96 -96
- package/themes/light.css +6900 -6749
- package/web/dist/assets/{TerminalPanel-D7lQ3g5k.js → TerminalPanel-CMBWruhs.js} +1 -1
- package/web/dist/assets/index-C8YkKrP3.css +10 -0
- package/web/dist/assets/index-DpzPCOcG.js +19 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-BiJTtKxQ.js +0 -18
- package/web/dist/assets/index-DxO8_hl1.css +0 -10
|
@@ -22,7 +22,7 @@ import { GoalService } from "./goal-service.js";
|
|
|
22
22
|
import { SlashCommandsService, parseSlash } from "./slash-commands.js";
|
|
23
23
|
import { ModelAdminService } from "./model-admin.js";
|
|
24
24
|
import { FilesService, workspacePath } from "./files-service.js";
|
|
25
|
-
import {
|
|
25
|
+
import { isExtensionDisabled, ClientStateStore, } from "./client-state.js";
|
|
26
26
|
import { saveUpload } from "./uploads.js";
|
|
27
27
|
import { makePersistentTerminalTools } from "./terminals.js";
|
|
28
28
|
import { WebUIContext } from "./webui-context.js";
|
|
@@ -528,9 +528,11 @@ export class ClientSession {
|
|
|
528
528
|
skills: res.skills.filter((s) => !this.settingsSvc.current.disabledSkills.includes(s.name)),
|
|
529
529
|
}),
|
|
530
530
|
// 插件开关:禁用的扩展整个卸载(工具 / 命令随之消失)。
|
|
531
|
+
// 注意 SDK 在 extensionsOverride 之后才补 sourceInfo,包扩展此处只能靠路径
|
|
532
|
+
// 匹配 —— isExtensionDisabled 同时比对 npm:<pkg> 候选键。
|
|
531
533
|
extensionsOverride: (res) => ({
|
|
532
534
|
...res,
|
|
533
|
-
extensions: res.extensions.filter((e) => !this.settingsSvc.current.disabledExtensions
|
|
535
|
+
extensions: res.extensions.filter((e) => !isExtensionDisabled(e, this.settingsSvc.current.disabledExtensions)),
|
|
534
536
|
}),
|
|
535
537
|
},
|
|
536
538
|
});
|
|
@@ -17,6 +17,35 @@ export function extensionKey(e) {
|
|
|
17
17
|
return src.source;
|
|
18
18
|
return src?.path ?? e.path;
|
|
19
19
|
}
|
|
20
|
+
/** All identities an extension may be disabled by. The SDK applies
|
|
21
|
+
* `sourceInfo` only AFTER extensionsOverride runs (resource-loader reload():
|
|
22
|
+
* override first, applyExtensionSourceInfo second), so inside the override a
|
|
23
|
+
* package extension still has no sourceInfo and extensionKey() falls back to
|
|
24
|
+
* the raw entry path — which never matches the "npm:<pkg>" id the settings
|
|
25
|
+
* panel stores. Derive the package name from the entry path
|
|
26
|
+
* (.../node_modules/<pkg>/... or .../node_modules/@scope/<pkg>/...) so both
|
|
27
|
+
* sides agree. */
|
|
28
|
+
export function extensionKeyCandidates(e) {
|
|
29
|
+
const keys = new Set([extensionKey(e)]);
|
|
30
|
+
const norm = e.path.replace(/\\/g, "/");
|
|
31
|
+
const marker = "/node_modules/";
|
|
32
|
+
const idx = norm.lastIndexOf(marker);
|
|
33
|
+
if (idx !== -1) {
|
|
34
|
+
const segs = norm.slice(idx + marker.length).split("/");
|
|
35
|
+
// Scoped package @scope/name spans two segments.
|
|
36
|
+
const name = segs[0]?.startsWith("@") && segs[1] ? `${segs[0]}/${segs[1]}` : segs[0];
|
|
37
|
+
if (name)
|
|
38
|
+
keys.add(`npm:${name}`);
|
|
39
|
+
}
|
|
40
|
+
return [...keys];
|
|
41
|
+
}
|
|
42
|
+
/** Whether an extension is covered by the disabled list (any identity match). */
|
|
43
|
+
export function isExtensionDisabled(e, disabled) {
|
|
44
|
+
if (disabled.length === 0)
|
|
45
|
+
return false;
|
|
46
|
+
const keys = extensionKeyCandidates(e);
|
|
47
|
+
return disabled.some((d) => keys.includes(d));
|
|
48
|
+
}
|
|
20
49
|
/**
|
|
21
50
|
* Persists which workspace each browser client last used + which workspaces it
|
|
22
51
|
* has opened, so a server restart / page reload restores the same project and
|
package/package.json
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-web-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"pi-web-ui": "bin/pi-web-ui.mjs"
|
|
9
|
-
},
|
|
10
|
-
"main": "dist/server/index.js",
|
|
11
|
-
"files": [
|
|
12
|
-
"bin/",
|
|
13
|
-
"dist/",
|
|
14
|
-
"web/dist/",
|
|
15
|
-
"web/public/",
|
|
16
|
-
"themes/",
|
|
17
|
-
"deploy/",
|
|
18
|
-
"extensions/",
|
|
19
|
-
"README.md",
|
|
20
|
-
"LICENSE"
|
|
21
|
-
],
|
|
22
|
-
"keywords": [
|
|
23
|
-
"pi",
|
|
24
|
-
"pi-package",
|
|
25
|
-
"coding-agent",
|
|
26
|
-
"ai",
|
|
27
|
-
"chat",
|
|
28
|
-
"web-ui",
|
|
29
|
-
"terminal",
|
|
30
|
-
"llm"
|
|
31
|
-
],
|
|
32
|
-
"repository": {
|
|
33
|
-
"type": "git",
|
|
34
|
-
"url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
|
|
35
|
-
},
|
|
36
|
-
"pi": {
|
|
37
|
-
"extensions": [
|
|
38
|
-
"./extensions"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": ">=22.19.0"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"prepublishOnly": "npm run build",
|
|
46
|
-
"dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
|
|
47
|
-
"dev:server": "cross-env PORT=8788 PI_WEB_ALLOW_ORIGINS=http://localhost:5173,http://127.0.0.1:5173 node --watch --import tsx server/index.ts",
|
|
48
|
-
"dev:web": "vite --config web/vite.config.ts",
|
|
49
|
-
"build": "npm run build:web && npm run build:server",
|
|
50
|
-
"build:web": "vite build --config web/vite.config.ts",
|
|
51
|
-
"build:server": "tsc -p tsconfig.server.json",
|
|
52
|
-
"typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
|
|
53
|
-
"test": "vitest run",
|
|
54
|
-
"test:unit": "vitest run",
|
|
55
|
-
"test:smoke": "node tests/run-smoke.mjs",
|
|
56
|
-
"check:protocol": "node scripts/check-protocol-sync.mjs",
|
|
57
|
-
"test:freeze": "node tests/freeze-test.mjs",
|
|
58
|
-
"start": "node dist/server/index.js"
|
|
59
|
-
},
|
|
60
|
-
"dependencies": {
|
|
61
|
-
"@earendil-works/pi-coding-agent": "^0.84.2",
|
|
62
|
-
"@xterm/addon-fit": "^0.11.0",
|
|
63
|
-
"@xterm/xterm": "^6.0.0",
|
|
64
|
-
"compression": "^1.8.1",
|
|
65
|
-
"express": "^4.21.2",
|
|
66
|
-
"highlight.js": "^11.10.0",
|
|
67
|
-
"node-pty": "^1.1.0",
|
|
68
|
-
"react": "^18.3.1",
|
|
69
|
-
"react-dom": "^18.3.1",
|
|
70
|
-
"react-icons": "^5.7.0",
|
|
71
|
-
"react-markdown": "^9.0.1",
|
|
72
|
-
"rehype-highlight": "^7.0.1",
|
|
73
|
-
"remark-gfm": "^4.0.0",
|
|
74
|
-
"typebox": "^1.3.14",
|
|
75
|
-
"ws": "^8.18.0"
|
|
76
|
-
},
|
|
77
|
-
"devDependencies": {
|
|
78
|
-
"@types/compression": "^1.8.1",
|
|
79
|
-
"@types/express": "^4.17.21",
|
|
80
|
-
"@types/node": "^22.10.0",
|
|
81
|
-
"@types/react": "^18.3.12",
|
|
82
|
-
"@types/react-dom": "^18.3.1",
|
|
83
|
-
"@types/ws": "^8.5.13",
|
|
84
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
85
|
-
"concurrently": "^9.1.0",
|
|
86
|
-
"cross-env": "^10.1.0",
|
|
87
|
-
"playwright-core": "^1.62.1",
|
|
88
|
-
"tsx": "^4.19.2",
|
|
89
|
-
"typescript": "^5.7.2",
|
|
90
|
-
"vite": "^6.0.3",
|
|
91
|
-
"vitest": "^4.1.11"
|
|
92
|
-
},
|
|
93
|
-
"allowScripts": {
|
|
94
|
-
"node-pty@1.1.0": true
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-web-ui",
|
|
3
|
+
"version": "0.30.0",
|
|
4
|
+
"description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pi-web-ui": "bin/pi-web-ui.mjs"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/server/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"dist/",
|
|
14
|
+
"web/dist/",
|
|
15
|
+
"web/public/",
|
|
16
|
+
"themes/",
|
|
17
|
+
"deploy/",
|
|
18
|
+
"extensions/",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"pi",
|
|
24
|
+
"pi-package",
|
|
25
|
+
"coding-agent",
|
|
26
|
+
"ai",
|
|
27
|
+
"chat",
|
|
28
|
+
"web-ui",
|
|
29
|
+
"terminal",
|
|
30
|
+
"llm"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
|
|
35
|
+
},
|
|
36
|
+
"pi": {
|
|
37
|
+
"extensions": [
|
|
38
|
+
"./extensions"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22.19.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"prepublishOnly": "npm run build",
|
|
46
|
+
"dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
|
|
47
|
+
"dev:server": "cross-env PORT=8788 PI_WEB_ALLOW_ORIGINS=http://localhost:5173,http://127.0.0.1:5173 node --watch --import tsx server/index.ts",
|
|
48
|
+
"dev:web": "vite --config web/vite.config.ts",
|
|
49
|
+
"build": "npm run build:web && npm run build:server",
|
|
50
|
+
"build:web": "vite build --config web/vite.config.ts",
|
|
51
|
+
"build:server": "tsc -p tsconfig.server.json",
|
|
52
|
+
"typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
|
|
53
|
+
"test": "vitest run",
|
|
54
|
+
"test:unit": "vitest run",
|
|
55
|
+
"test:smoke": "node tests/run-smoke.mjs",
|
|
56
|
+
"check:protocol": "node scripts/check-protocol-sync.mjs",
|
|
57
|
+
"test:freeze": "node tests/freeze-test.mjs",
|
|
58
|
+
"start": "node dist/server/index.js"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@earendil-works/pi-coding-agent": "^0.84.2",
|
|
62
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
63
|
+
"@xterm/xterm": "^6.0.0",
|
|
64
|
+
"compression": "^1.8.1",
|
|
65
|
+
"express": "^4.21.2",
|
|
66
|
+
"highlight.js": "^11.10.0",
|
|
67
|
+
"node-pty": "^1.1.0",
|
|
68
|
+
"react": "^18.3.1",
|
|
69
|
+
"react-dom": "^18.3.1",
|
|
70
|
+
"react-icons": "^5.7.0",
|
|
71
|
+
"react-markdown": "^9.0.1",
|
|
72
|
+
"rehype-highlight": "^7.0.1",
|
|
73
|
+
"remark-gfm": "^4.0.0",
|
|
74
|
+
"typebox": "^1.3.14",
|
|
75
|
+
"ws": "^8.18.0"
|
|
76
|
+
},
|
|
77
|
+
"devDependencies": {
|
|
78
|
+
"@types/compression": "^1.8.1",
|
|
79
|
+
"@types/express": "^4.17.21",
|
|
80
|
+
"@types/node": "^22.10.0",
|
|
81
|
+
"@types/react": "^18.3.12",
|
|
82
|
+
"@types/react-dom": "^18.3.1",
|
|
83
|
+
"@types/ws": "^8.5.13",
|
|
84
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
85
|
+
"concurrently": "^9.1.0",
|
|
86
|
+
"cross-env": "^10.1.0",
|
|
87
|
+
"playwright-core": "^1.62.1",
|
|
88
|
+
"tsx": "^4.19.2",
|
|
89
|
+
"typescript": "^5.7.2",
|
|
90
|
+
"vite": "^6.0.3",
|
|
91
|
+
"vitest": "^4.1.11"
|
|
92
|
+
},
|
|
93
|
+
"allowScripts": {
|
|
94
|
+
"node-pty@1.1.0": true
|
|
95
|
+
}
|
|
96
|
+
}
|