@qt4798/pi-web 0.10.1 → 0.10.5

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.
Files changed (148) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +18 -18
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +0 -1964
  7. package/.next/required-server-files.js +2 -1
  8. package/.next/required-server-files.json +2 -1
  9. package/.next/server/app/_global-error/page.js +3 -3
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/_not-found/page.js +2 -2
  20. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/_not-found.html +1 -1
  22. package/.next/server/app/_not-found.rsc +16 -15
  23. package/.next/server/app/_not-found.segments/_full.segment.rsc +16 -15
  24. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_index.segment.rsc +5 -4
  26. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  29. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  30. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  31. package/.next/server/app/api/agent/[id]/route.js +1 -1
  32. package/.next/server/app/api/agent/new/route.js +1 -1
  33. package/.next/server/app/api/agent/running/events/route.js +1 -1
  34. package/.next/server/app/api/agent/running/route.js +1 -1
  35. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  36. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  37. package/.next/server/app/api/auth/combined/route.js +1 -1
  38. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  39. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  40. package/.next/server/app/api/auth/providers/route.js +1 -1
  41. package/.next/server/app/api/backup/export/route.js +1 -1
  42. package/.next/server/app/api/backup/import/route.js +1 -1
  43. package/.next/server/app/api/cwd/browse/route.js +1 -1
  44. package/.next/server/app/api/cwd/validate/route.js +1 -1
  45. package/.next/server/app/api/deepseek/balance/route.js +1 -1
  46. package/.next/server/app/api/default-cwd/route.js +1 -1
  47. package/.next/server/app/api/events/route.js +2 -2
  48. package/.next/server/app/api/features/route.js +1 -1
  49. package/.next/server/app/api/file-index/route.js +1 -1
  50. package/.next/server/app/api/files/[...path]/route.js +1 -1
  51. package/.next/server/app/api/git/diff/route.js +1 -1
  52. package/.next/server/app/api/git/push/route.js +1 -1
  53. package/.next/server/app/api/git/stash/route.js +1 -1
  54. package/.next/server/app/api/git/status/route.js +2 -2
  55. package/.next/server/app/api/home/route.js +1 -1
  56. package/.next/server/app/api/import/discover/route.js +1 -1
  57. package/.next/server/app/api/import/execute/route.js +1 -1
  58. package/.next/server/app/api/import/status/route.js +1 -1
  59. package/.next/server/app/api/logs/route.js +1 -1
  60. package/.next/server/app/api/mcp/restart/route.js +1 -1
  61. package/.next/server/app/api/mcp/route.js +2 -2
  62. package/.next/server/app/api/models/route.js +1 -1
  63. package/.next/server/app/api/models-config/builtin/route.js +1 -1
  64. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  65. package/.next/server/app/api/models-config/discover/route.js +1 -1
  66. package/.next/server/app/api/models-config/route.js +1 -1
  67. package/.next/server/app/api/models-config/test/route.js +1 -1
  68. package/.next/server/app/api/modes/route.js +1 -1
  69. package/.next/server/app/api/plugins/route.js +1 -1
  70. package/.next/server/app/api/project-aliases/route.js +1 -1
  71. package/.next/server/app/api/project-state/route.js +1 -1
  72. package/.next/server/app/api/project-trust/route.js +1 -1
  73. package/.next/server/app/api/proxy/route.js +1 -1
  74. package/.next/server/app/api/proxy/test/route.js +1 -1
  75. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  76. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  77. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  79. package/.next/server/app/api/sessions/[id]/queue-recovery/route.js +1 -1
  80. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  81. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  82. package/.next/server/app/api/sessions/route.js +1 -1
  83. package/.next/server/app/api/settings/title-model/route.js +1 -1
  84. package/.next/server/app/api/skills/check/route.js +1 -1
  85. package/.next/server/app/api/skills/install/route.js +1 -1
  86. package/.next/server/app/api/skills/route.js +2 -2
  87. package/.next/server/app/api/skills/search/route.js +1 -1
  88. package/.next/server/app/api/skills/update/route.js +1 -1
  89. package/.next/server/app/api/snippets/[id]/route.js +1 -1
  90. package/.next/server/app/api/snippets/route.js +1 -1
  91. package/.next/server/app/api/subagents/agents/[name]/route.js +2 -2
  92. package/.next/server/app/api/subagents/route.js +2 -2
  93. package/.next/server/app/api/subagents/transcript/route.js +1 -1
  94. package/.next/server/app/api/tasks/[id]/[action]/route.js +1 -1
  95. package/.next/server/app/api/tasks/[id]/changed-files/route.js +1 -1
  96. package/.next/server/app/api/tasks/[id]/diff/route.js +2 -2
  97. package/.next/server/app/api/tasks/[id]/events/route.js +1 -1
  98. package/.next/server/app/api/tasks/[id]/route.js +1 -1
  99. package/.next/server/app/api/tasks/batch/route.js +1 -1
  100. package/.next/server/app/api/tasks/events/route.js +2 -2
  101. package/.next/server/app/api/tasks/route.js +1 -1
  102. package/.next/server/app/api/tasks/settings/route.js +1 -1
  103. package/.next/server/app/api/tasks/templates/route.js +1 -1
  104. package/.next/server/app/api/themes/[name]/route.js +1 -1
  105. package/.next/server/app/api/themes/route.js +1 -1
  106. package/.next/server/app/api/usage/route.js +1 -1
  107. package/.next/server/app/api/vision-config/route.js +2 -2
  108. package/.next/server/app/api/worktrees/route.js +1 -1
  109. package/.next/server/app/icon.ico/route.js +1 -1
  110. package/.next/server/app/icon.png/route.js +1 -1
  111. package/.next/server/app/icon.svg/route.js +1 -1
  112. package/.next/server/app/index.html +1 -1
  113. package/.next/server/app/index.rsc +16 -15
  114. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  115. package/.next/server/app/index.segments/_full.segment.rsc +16 -15
  116. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  117. package/.next/server/app/index.segments/_index.segment.rsc +5 -4
  118. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  119. package/.next/server/app/page.js +10 -10
  120. package/.next/server/app/page_client-reference-manifest.js +1 -1
  121. package/.next/server/app-paths-manifest.json +18 -18
  122. package/.next/server/chunks/2498.js +1 -1
  123. package/.next/server/chunks/4253.js +3 -3
  124. package/.next/server/chunks/4564.js +1 -1
  125. package/.next/server/chunks/5582.js +1 -1
  126. package/.next/server/chunks/6429.js +2 -2
  127. package/.next/server/chunks/7915.js +1 -1
  128. package/.next/server/middleware-build-manifest.js +1 -1
  129. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  130. package/.next/server/middleware.js +2 -2
  131. package/.next/server/pages/404.html +1 -1
  132. package/.next/server/pages/500.html +1 -1
  133. package/.next/server/server-reference-manifest.json +1 -1
  134. package/.next/static/chunks/266-afbb4abec8f065f2.js +1 -0
  135. package/.next/static/chunks/app/layout-a5e7239bae5ff472.js +1 -0
  136. package/.next/static/chunks/app/{page-5c710e68640f3145.js → page-1f553bf2c117387b.js} +9 -9
  137. package/.next/static/css/11cd851a9acbcc96.css +1 -0
  138. package/.next/trace +9 -9
  139. package/.next/trace-build +1 -1
  140. package/bin/fix-pi-agent-undici.js +75 -30
  141. package/bin/with-memory-limit.js +2 -2
  142. package/next.config.ts +3 -0
  143. package/package.json +4 -2
  144. package/.next/static/chunks/4539-00fcad0fc9413ea5.js +0 -1
  145. package/.next/static/chunks/app/layout-7b635840991e69cb.js +0 -1
  146. package/.next/static/css/437ace30775068cf.css +0 -1
  147. /package/.next/static/{uSnMpPvz2vTZlLUkAmoxZ → kWqylj4DXUQD6uvs2QXWr}/_buildManifest.js +0 -0
  148. /package/.next/static/{uSnMpPvz2vTZlLUkAmoxZ → kWqylj4DXUQD6uvs2QXWr}/_ssgManifest.js +0 -0
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":45958046,"timestamp":175198281571,"id":14,"parentId":1,"tags":{},"startTime":1786801512491,"traceId":"b3c3522543460ad8"},{"name":"run-typescript","duration":7866202,"timestamp":175244241296,"id":1011,"parentId":1,"tags":{},"startTime":1786801558451,"traceId":"b3c3522543460ad8"},{"name":"static-check","duration":2116191,"timestamp":175252123327,"id":1014,"parentId":1,"tags":{},"startTime":1786801566333,"traceId":"b3c3522543460ad8"},{"name":"static-generation","duration":2288300,"timestamp":175254966990,"id":1192,"parentId":1,"tags":{},"startTime":1786801569177,"traceId":"b3c3522543460ad8"},{"name":"collect-build-traces","duration":18774821,"timestamp":175254243355,"id":1189,"parentId":1,"tags":{},"startTime":1786801568453,"traceId":"b3c3522543460ad8"},{"name":"telemetry-flush","duration":17,"timestamp":175273028017,"id":1201,"parentId":1,"tags":{},"startTime":1786801587238,"traceId":"b3c3522543460ad8"},{"name":"next-build","duration":75101309,"timestamp":175197926730,"id":1,"tags":{"buildMode":"default","version":"16.2.12","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1786801512136,"traceId":"b3c3522543460ad8"}]
1
+ [{"name":"run-webpack","duration":57803718,"timestamp":601173715570,"id":14,"parentId":1,"tags":{},"startTime":1787227488514,"traceId":"c4e8cdc81c758c63"},{"name":"run-typescript","duration":6646529,"timestamp":601231520535,"id":996,"parentId":1,"tags":{},"startTime":1787227546317,"traceId":"c4e8cdc81c758c63"},{"name":"static-check","duration":1254069,"timestamp":601238187460,"id":999,"parentId":1,"tags":{},"startTime":1787227552983,"traceId":"c4e8cdc81c758c63"},{"name":"static-generation","duration":1941657,"timestamp":601239800716,"id":1177,"parentId":1,"tags":{},"startTime":1787227554597,"traceId":"c4e8cdc81c758c63"},{"name":"collect-build-traces","duration":17784999,"timestamp":601239443458,"id":1174,"parentId":1,"tags":{},"startTime":1787227554239,"traceId":"c4e8cdc81c758c63"},{"name":"output-standalone","duration":2229931,"timestamp":601257234824,"id":1185,"parentId":1,"tags":{},"startTime":1787227572030,"traceId":"c4e8cdc81c758c63"},{"name":"telemetry-flush","duration":14,"timestamp":601259466326,"id":1188,"parentId":1,"tags":{},"startTime":1787227574262,"traceId":"c4e8cdc81c758c63"},{"name":"next-build","duration":86277123,"timestamp":601173189221,"id":1,"tags":{"buildMode":"default","version":"16.2.12","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1787227487987,"traceId":"c4e8cdc81c758c63"}]
@@ -4,7 +4,17 @@
4
4
  // that pins undici to 8.5.0, which has 7+ known CVEs. npm overrides cannot
5
5
  // penetrate shrinkwrap. This script:
6
6
  // 1. Removes the shrinkwrap (so future reinstalls respect overrides)
7
- // 2. Symlinks the nested undici to the top-level undici@^8.10.0
7
+ // 2. Replaces the nested undici with the top-level undici@^8.10.0
8
+ //
9
+ // Two modes:
10
+ // - applyUndiciFix (runtime, dev/CLI): replaces the nested undici with a
11
+ // **symlink** to the top-level undici. The dir is writable here, and a
12
+ // symlink keeps future reinstalls pointing at the fixed version.
13
+ // - solidifyUndiciFix (build time, packaging): replaces the nested undici
14
+ // (whether a real dir or a symlink) with a **physical copy** of the fixed
15
+ // version so the standalone output (`.next/standalone`) is fully
16
+ // self-contained with no symlinks — the installed, read-only bundle never
17
+ // needs to write anything at runtime and survives NSIS/macOS bundle copying.
8
18
  //
9
19
  // Note: npm audit will still report undici CVEs because the lockfile
10
20
  // references the old version. This is a cosmetic false positive — the
@@ -19,7 +29,16 @@
19
29
  const fs = require("fs");
20
30
  const path = require("path");
21
31
 
22
- function applyUndiciFix(rootDir = path.join(__dirname, "..")) {
32
+ /**
33
+ * Apply the undici fix under `rootDir`.
34
+ * @param {string} [rootDir] package root (contains node_modules/)
35
+ * @param {{copy?: boolean, topUndici?: string}} [opts]
36
+ * - copy: when true, copy the fixed undici into place instead of symlinking
37
+ * - topUndici: explicit path to the fixed undici directory (defaults to
38
+ * <rootDir>/node_modules/undici)
39
+ */
40
+ function applyUndiciFix(rootDir = path.join(__dirname, ".."), opts = {}) {
41
+ const copy = opts.copy === true;
23
42
  const agentDir = path.join(
24
43
  rootDir,
25
44
  "node_modules",
@@ -30,7 +49,7 @@ function applyUndiciFix(rootDir = path.join(__dirname, "..")) {
30
49
 
31
50
  const shrinkwrap = path.join(agentDir, "npm-shrinkwrap.json");
32
51
  const nestedUndici = path.join(agentDir, "node_modules", "undici");
33
- const topUndici = path.join(rootDir, "node_modules", "undici");
52
+ const topUndici = opts.topUndici || path.join(rootDir, "node_modules", "undici");
34
53
 
35
54
  // 1. Remove shrinkwrap
36
55
  if (fs.existsSync(shrinkwrap)) {
@@ -38,39 +57,65 @@ function applyUndiciFix(rootDir = path.join(__dirname, "..")) {
38
57
  fs.rmSync(shrinkwrap);
39
58
  }
40
59
 
41
- // 2. Replace nested undici@8.5.0 with symlink to top-level undici@^8.10.0
42
- if (
43
- fs.existsSync(topUndici) &&
44
- fs.existsSync(nestedUndici) &&
45
- // Only replace if it's a real directory, not already a symlink
46
- fs.lstatSync(nestedUndici).isDirectory() &&
47
- !fs.lstatSync(nestedUndici).isSymbolicLink()
48
- ) {
49
- try {
50
- const nestedVersion = require(path.join(nestedUndici, "package.json")).version;
51
- const topVersion = require(path.join(topUndici, "package.json")).version;
60
+ // 2. Inspect the nested undici (may be a real dir or an existing symlink)
61
+ let nestedIsSymlink = false;
62
+ let nestedIsDir = false;
63
+ try {
64
+ const st = fs.lstatSync(nestedUndici);
65
+ nestedIsSymlink = st.isSymbolicLink();
66
+ nestedIsDir = st.isDirectory();
67
+ } catch {
68
+ return; // nested undici missing — nothing to replace
69
+ }
70
+ if (!nestedIsSymlink && !nestedIsDir) return;
71
+ // Runtime symlink mode is idempotent: an existing symlink means already fixed.
72
+ if (nestedIsSymlink && !copy) return;
73
+ if (!fs.existsSync(topUndici)) return;
74
+
75
+ try {
76
+ const nestedVersion = require(path.join(nestedUndici, "package.json")).version;
77
+ const topVersion = require(path.join(topUndici, "package.json")).version;
78
+ // Already a real dir with the correct version → nothing to do.
79
+ if (!nestedIsSymlink && nestedVersion === topVersion) return;
52
80
 
53
- if (nestedVersion !== topVersion) {
54
- console.log(
55
- `[pi-web] Replacing pi-coding-agent's undici@${nestedVersion} ` +
56
- `→ symlink to undici@${topVersion}`,
57
- );
58
- fs.rmSync(nestedUndici, { recursive: true, force: true });
81
+ fs.rmSync(nestedUndici, { recursive: true, force: true });
59
82
 
60
- const rel = path.relative(path.dirname(nestedUndici), topUndici);
61
- fs.symlinkSync(
62
- rel,
63
- nestedUndici,
64
- process.platform === "win32" ? "junction" : "dir",
65
- );
66
- }
67
- } catch (err) {
68
- console.warn("[pi-web] Symlink fix skipped:", err.message);
83
+ if (copy) {
84
+ fs.cpSync(topUndici, nestedUndici, { recursive: true });
85
+ console.log(
86
+ `[pi-web] Copied undici@${topVersion} into pi-coding-agent (solidified)`,
87
+ );
88
+ } else {
89
+ const rel = path.relative(path.dirname(nestedUndici), topUndici);
90
+ fs.symlinkSync(
91
+ rel,
92
+ nestedUndici,
93
+ process.platform === "win32" ? "junction" : "dir",
94
+ );
95
+ console.log(
96
+ `[pi-web] Replacing pi-coding-agent's undici@${nestedVersion} ` +
97
+ `→ symlink to undici@${topVersion}`,
98
+ );
69
99
  }
100
+ } catch (err) {
101
+ console.warn("[pi-web] undici fix skipped:", err.message);
70
102
  }
71
103
  }
72
104
 
73
- module.exports = { applyUndiciFix };
105
+ /**
106
+ * Build-time solidification for packaging: physically copy the fixed undici
107
+ * into the standalone output so the read-only installed bundle needs no
108
+ * runtime writes and contains no symlinks.
109
+ * @param {string} [rootDir] standalone root (contains node_modules/)
110
+ * @param {string} [topUndiciDir] path to the fixed undici to copy in
111
+ */
112
+ function solidifyUndiciFix(rootDir = path.join(__dirname, ".."), topUndiciDir) {
113
+ const source = topUndiciDir || path.join(rootDir, "node_modules", "undici");
114
+ if (!fs.existsSync(source)) return; // nothing to copy from
115
+ applyUndiciFix(rootDir, { copy: true, topUndici: source });
116
+ }
117
+
118
+ module.exports = { applyUndiciFix, solidifyUndiciFix };
74
119
 
75
120
  if (require.main === module) {
76
121
  applyUndiciFix();
@@ -5,10 +5,10 @@ const { spawnSync } = require("child_process");
5
5
 
6
6
  /** Keep the V8 heap from ballooning during local runs. Next.js dev auto-sets
7
7
  * --max-old-space-size to 50% of physical RAM (12GB on a 24GB machine)
8
- * unless the user already capped it. A 4GB cap makes GC engage earlier and
8
+ * unless the user already capped it. A 3GB cap makes GC engage earlier and
9
9
  * bounds RSS growth for both dev and production start.
10
10
  */
11
- const MEMORY_LIMIT_MB = 4096;
11
+ const MEMORY_LIMIT_MB = 3072;
12
12
  const SEMI_SPACE_MB = 128;
13
13
 
14
14
  /**
package/next.config.ts CHANGED
@@ -13,6 +13,9 @@ try {
13
13
  } catch { /* package not found, use default */ }
14
14
 
15
15
  const nextConfig: NextConfig = {
16
+ // M1 内置打包:产出 .next/standalone(自包含 server.js + 最小 node_modules),
17
+ // 桌面壳随包拉起 node <standalone/server.js>,免本机 npm/CLI。
18
+ output: "standalone",
16
19
  allowedDevOrigins,
17
20
  devIndicators: false,
18
21
  // proxy.ts clones the request body for /api/*; the Next.js default of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qt4798/pi-web",
3
- "version": "0.10.1",
3
+ "version": "0.10.5",
4
4
  "description": "Web workspace for the pi coding agent",
5
5
  "homepage": "https://github.com/t479842598/pi-web-QT#readme",
6
6
  "repository": {
@@ -22,6 +22,7 @@
22
22
  ".next",
23
23
  "!.next/cache",
24
24
  "!.next/dev",
25
+ "!.next/standalone",
25
26
  "!.next/**/*.js.map",
26
27
  "lib/theme",
27
28
  "public",
@@ -31,7 +32,8 @@
31
32
  "scripts": {
32
33
  "dev": "node bin/fix-pi-agent-undici.js && node bin/with-memory-limit.js node_modules/.bin/next dev -H 127.0.0.1 -p 0 --turbopack",
33
34
  "dev:lan": "node bin/fix-pi-agent-undici.js && node bin/with-memory-limit.js node_modules/.bin/next dev -H 0.0.0.0 -p 0 --turbopack",
34
- "build": "env -u TURBOPACK next build --webpack",
35
+ "build": "env -u TURBOPACK -u __NEXT_PRIVATE_STANDALONE_CONFIG next build --webpack",
36
+ "bundle:backend": "node scripts/bundle-backend.mjs",
35
37
  "start": "node bin/fix-pi-agent-undici.js && node bin/with-memory-limit.js node_modules/.bin/next start -H 127.0.0.1 -p 0",
36
38
  "start:lan": "node bin/fix-pi-agent-undici.js && node bin/with-memory-limit.js node_modules/.bin/next start -H 0.0.0.0 -p 0",
37
39
  "lint": "eslint .",