pi-web-ui 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -28,7 +28,9 @@ your existing pi auth/config/extensions — nothing extra to install or configur
28
28
 
29
29
  ## Quick start
30
30
 
31
- Requires Node.js ≥ 20.11 and a configured pi install (run `pi` once to log in).
31
+ Requires Node.js ≥ 22.19 (the pi SDK requires it; older Node fails with
32
+ `Unexpected token 'with'` when loading the SDK) and a configured pi install
33
+ (run `pi` once to log in).
32
34
 
33
35
  ```bash
34
36
  npm install
package/bin/pi-web-ui.mjs CHANGED
@@ -68,6 +68,24 @@ server 选项:
68
68
  PORT / PI_WEB_CWD / PI_WEB_DATA_DIR / PI_CODING_AGENT_DIR
69
69
  `;
70
70
 
71
+ /** Minimum Node required by the pi SDK (its dist uses `import … with { type: "json" }`). */
72
+ const NODE_MIN = [22, 19, 0];
73
+ function checkNodeVersion() {
74
+ const v = process.versions.node.split(".").map(Number);
75
+ const tooOld =
76
+ v[0] < NODE_MIN[0] ||
77
+ (v[0] === NODE_MIN[0] && v[1] < NODE_MIN[1]) ||
78
+ (v[0] === NODE_MIN[0] && v[1] === NODE_MIN[1] && v[2] < NODE_MIN[2]);
79
+ if (tooOld) {
80
+ console.error(
81
+ `✖ pi-web-ui 需要 Node.js >= ${NODE_MIN.join(".")}(当前 ${process.versions.node})。\n` +
82
+ ` pi SDK 的代码使用了 import attributes(with)语法,旧版 Node 无法解析。\n` +
83
+ ` 请升级 Node:https://nodejs.org(或 nvm-windows / fnm)后重装:npm i -g pi-web-ui`,
84
+ );
85
+ process.exit(1);
86
+ }
87
+ }
88
+
71
89
  function fail(msg) {
72
90
  console.error(`✖ ${msg}`);
73
91
  process.exit(1);
@@ -712,6 +730,7 @@ async function serverCmd(argv) {
712
730
  }
713
731
 
714
732
  async function main() {
733
+ checkNodeVersion();
715
734
  const argv = process.argv.slice(2);
716
735
  if (argv.length === 0) {
717
736
  await startForeground({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
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
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
31
31
  },
32
32
  "engines": {
33
- "node": ">=20.11"
33
+ "node": ">=22.19.0"
34
34
  },
35
35
  "scripts": {
36
36
  "prepublishOnly": "npm run build",