pi-web-ui 0.114.0 → 0.114.1

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 (195) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +187 -187
  3. package/README.zh-CN.md +227 -227
  4. package/README.zh-TW.md +227 -227
  5. package/bin/device-hub-cli.mjs +577 -577
  6. package/bin/frp-manager.mjs +1573 -1573
  7. package/bin/pi-device-hub.mjs +9 -9
  8. package/bin/pi-web-ui.mjs +4081 -4073
  9. package/deploy/nginx-subpath.conf +100 -100
  10. package/deploy/pi-web-ui.service +36 -36
  11. package/dist/server/agent-service.js +131 -55
  12. package/dist/server/attachments.js +51 -5
  13. package/dist/server/canvas/canvas-agent-tool.js +3 -3
  14. package/dist/server/canvas/canvas-cards.js +1 -1
  15. package/dist/server/canvas/canvas-orchestrator.js +3 -3
  16. package/dist/server/canvas/canvas-scheduled-task.js +45 -0
  17. package/dist/server/canvas/canvas-validation.js +1 -1
  18. package/dist/server/client-state.js +6 -2
  19. package/dist/server/compaction-instructions.js +8 -8
  20. package/dist/server/device-center/connector.js +33 -14
  21. package/dist/server/device-center/desktop-page.js +228 -228
  22. package/dist/server/device-center/hub-page.js +64 -64
  23. package/dist/server/device-center/hub.js +2 -1
  24. package/dist/server/device-center/local-hub.js +92 -0
  25. package/dist/server/device-center/local.js +60 -7
  26. package/dist/server/device-center/native-desktop/macos.js +190 -190
  27. package/dist/server/device-center/native-desktop/windows.js +116 -116
  28. package/dist/server/device-center/path-portal.js +1 -1
  29. package/dist/server/device-center/relay.js +45 -8
  30. package/dist/server/dispatch-domain-handlers.js +1 -0
  31. package/dist/server/dsh/dsh-agent-service.js +5 -1
  32. package/dist/server/dsh/runtime/cordis.yml +1 -1
  33. package/dist/server/dsh/runtime/custom-prompt.mjs +33 -33
  34. package/dist/server/dsh/runtime/goal-rpc.mjs +1309 -1309
  35. package/dist/server/dsh/runtime/launcher.mjs +235 -235
  36. package/dist/server/dsh/runtime/override.patch.yml +89 -89
  37. package/dist/server/dsh/runtime/runtime-root.mjs +405 -405
  38. package/dist/server/engine-probe.js +36 -6
  39. package/dist/server/eval-tool.js +135 -135
  40. package/dist/server/global-loader.js +40 -2
  41. package/dist/server/index.js +56 -32
  42. package/dist/server/patch-bash-process.js +125 -0
  43. package/dist/server/patch-tool.js +9 -9
  44. package/dist/server/patch-turn-end-boundary.js +3 -3
  45. package/dist/server/persona-chain.js +8 -8
  46. package/dist/server/plugins.js +26 -2
  47. package/dist/server/preset-fields.js +7 -0
  48. package/dist/server/preset-share.js +1 -0
  49. package/dist/server/prompt-templates.js +106 -0
  50. package/dist/server/protocol-version.js +1 -1
  51. package/dist/server/remote-ssh-service.js +39 -39
  52. package/dist/server/resolve-global-sdk.js +2 -0
  53. package/dist/server/schedule-agent-tool.js +39 -21
  54. package/dist/server/scheduler-tasks.js +45 -9
  55. package/dist/server/scm-commitmsg.js +10 -10
  56. package/dist/server/settings-service.js +6 -0
  57. package/dist/server/setup-page.js +620 -620
  58. package/dist/server/text-quote.js +9 -0
  59. package/dist/server/tool-manager.js +2 -1
  60. package/dist/server/universal/drivers/claude-code.js +5 -0
  61. package/dist/server/universal/drivers/codex.js +336 -0
  62. package/dist/server/universal/index.js +1 -0
  63. package/dist/server/universal/universal-attachments.js +24 -1
  64. package/dist/server/universal/universal-session.js +23 -0
  65. package/dist/server/vision-bridge.js +18 -18
  66. package/docs/device-center.md +148 -142
  67. package/docs/device-desktop.md +48 -48
  68. package/docs/dsh-engine.md +493 -493
  69. package/extensions/webui.ts +335 -335
  70. package/package.json +2 -2
  71. package/plugin-sdk/README.md +174 -174
  72. package/plugin-sdk/client-utils.mjs +279 -279
  73. package/plugin-sdk/import-check.mjs +210 -210
  74. package/plugin-sdk/index.d.ts +698 -698
  75. package/plugin-sdk/index.mjs +696 -696
  76. package/plugin-sdk/package.json +13 -13
  77. package/plugin-sdk/ssh-host-trust.mjs +225 -225
  78. package/plugins/catalog.json +10 -0
  79. package/themes/aetheris.css +501 -501
  80. package/themes/ayu-light.css +116 -116
  81. package/themes/bases/flow-base.css +1357 -1357
  82. package/themes/bases/obsidian-base.css +895 -895
  83. package/themes/bases/statusbar-flat-base.css +112 -112
  84. package/themes/bases/zhujian-base.css +688 -688
  85. package/themes/bases/zhupi-base.css +660 -660
  86. package/themes/catppuccin-latte.css +119 -119
  87. package/themes/catppuccin.css +116 -116
  88. package/themes/claude-code-dark.css +147 -147
  89. package/themes/codex.css +114 -114
  90. package/themes/cyberpunk.css +50 -50
  91. package/themes/dark-teal.css +264 -264
  92. package/themes/dazzle.css +38 -38
  93. package/themes/everforest-light.css +115 -115
  94. package/themes/flow-light.css +164 -164
  95. package/themes/flow.css +161 -161
  96. package/themes/geist.css +114 -114
  97. package/themes/gruvbox-light.css +115 -115
  98. package/themes/kanagawa-lotus.css +115 -115
  99. package/themes/md-preview.css +24 -24
  100. package/themes/mist.css +166 -166
  101. package/themes/nord.css +107 -107
  102. package/themes/one-dark.css +106 -106
  103. package/themes/paper.css +174 -174
  104. package/themes/rose-pine-dawn.css +114 -114
  105. package/themes/sakura.css +166 -166
  106. package/themes/solarized-light.css +114 -114
  107. package/themes/tokyo-night.css +115 -115
  108. package/themes/translucent.css +85 -85
  109. package/themes/transparent.css +116 -116
  110. package/themes/vs-code-dark.css +147 -147
  111. package/themes/wallpaper-flow.css +382 -382
  112. package/themes/wallpaper-obsidian.css +74 -74
  113. package/themes/white.css +164 -164
  114. package/themes/zhujian-dark.css +115 -115
  115. package/themes/zhujian.css +114 -114
  116. package/themes/zhupi-dark.css +115 -115
  117. package/themes/zhupi.css +114 -114
  118. package/web/dist/.build-assets.json +1 -1
  119. package/web/dist/assets/BgTasksModal-BcXJ20RO.js +1 -0
  120. package/web/dist/assets/BgTasksModal-DjQmiKnE.js +1 -0
  121. package/web/dist/assets/{CanvasStudio-BEJZE5BI.js → CanvasStudio-PI9pid0Y.js} +3 -3
  122. package/web/dist/assets/{CanvasStudio-CgUNHqos.js → CanvasStudio-nf5-HxLM.js} +3 -3
  123. package/web/dist/assets/DeviceCenter-CYttJw2a.js +3 -0
  124. package/web/dist/assets/DeviceCenter-DPe4sz74.js +3 -0
  125. package/web/dist/assets/DeviceGroups-D2rogxEN.js +1 -0
  126. package/web/dist/assets/Dropdown-ZLS04O8p.js +1 -0
  127. package/web/dist/assets/FilePreview-C9Ut4Lq6.js +2 -0
  128. package/web/dist/assets/FilePreview-CvK3ZzX5.js +2 -0
  129. package/web/dist/assets/GlobalSearchModal-C5e-OCw2.js +1 -0
  130. package/web/dist/assets/GlobalSearchModal-H7pFK2UC.js +1 -0
  131. package/web/dist/assets/GroupConversation-C2wNM0dQ.js +1 -0
  132. package/web/dist/assets/GroupConversation-ChN3TWQK.js +1 -0
  133. package/web/dist/assets/ModelConfigModal-DDZccDYt.js +2 -0
  134. package/web/dist/assets/PiSetupModal-DHbqfx8T.js +1 -0
  135. package/web/dist/assets/ProviderOAuthControls-C-MK36Dk.js +1 -0
  136. package/web/dist/assets/SCMPanel-buTGziDB.js +2 -0
  137. package/web/dist/assets/SCMPanel-kx-SCL2s.js +2 -0
  138. package/web/dist/assets/SettingsModal-BsUF8jqr.js +20 -0
  139. package/web/dist/assets/SettingsModal-D357Ky7P.js +20 -0
  140. package/web/dist/assets/{TerminalPanel-DL20uKgU.js → TerminalPanel-BBuM_Sez.js} +2 -2
  141. package/web/dist/assets/{TerminalPanel-D6cPRFei.js → TerminalPanel-D6x6xz8Q.js} +2 -2
  142. package/web/dist/assets/TuiOverlayModal-CdbGV3Za.js +1 -0
  143. package/web/dist/assets/TuiOverlayModal-d6x9u25n.js +1 -0
  144. package/web/dist/assets/app-globals-DcyO0UPi.js +1 -0
  145. package/web/dist/assets/{desktop-DPyTy4M3.js → desktop-YguLbrX1.js} +1 -1
  146. package/web/dist/assets/fi-DaSO0Q-m.js +325 -0
  147. package/web/dist/assets/index-BPvpea8t.js +85 -0
  148. package/web/dist/assets/index-D6u8xH0o.js +85 -0
  149. package/web/dist/assets/index-DDZMv6LO.css +1 -0
  150. package/web/dist/assets/{plugin-host-CqA4yW6w.js → plugin-host-BRBg6zmQ.js} +1 -1
  151. package/web/dist/assets/theme-DDl-Oy1b.js +1 -0
  152. package/web/dist/index.html +37 -36
  153. package/web/dist/sw.js +179 -179
  154. package/web/public/sw.js +179 -179
  155. package/dist/gh-comment-781.md +0 -5
  156. package/dist/server/device-center/local-page.js +0 -17
  157. package/dist/server/device-center/smoke-preview.js +0 -3
  158. package/dist/server/durable/durable-capabilities.js +0 -11
  159. package/dist/server/markers/builtins/services.js +0 -123
  160. package/dist/server/markers/builtins/todo.js +0 -189
  161. package/dist/server/markers-list-tool.js +0 -34
  162. package/dist/server/orchestrator.js +0 -109
  163. package/dist/server/system-prompt-soul.js +0 -41
  164. package/dist/server/univer-service.js +0 -448
  165. package/dist/server/universal/drivers/dsh-driver.js +0 -379
  166. package/dist/test-artifact.md +0 -9
  167. package/dist/test-preview-modal.md +0 -11
  168. package/dist/test-report.html +0 -20
  169. package/web/dist/assets/BgTasksModal-CS7UNzcw.js +0 -1
  170. package/web/dist/assets/BgTasksModal-Dk-tp78W.js +0 -1
  171. package/web/dist/assets/DeviceCenter-C8_CbxQ3.js +0 -3
  172. package/web/dist/assets/DeviceCenter-CVblvhNX.js +0 -3
  173. package/web/dist/assets/Dropdown-Oug0DDte.js +0 -1
  174. package/web/dist/assets/FilePreview-CvdX6nr6.js +0 -2
  175. package/web/dist/assets/FilePreview-kCZhfBAF.js +0 -2
  176. package/web/dist/assets/GlobalSearchModal-BLH63yYP.js +0 -1
  177. package/web/dist/assets/GlobalSearchModal-DAkvlvp6.js +0 -1
  178. package/web/dist/assets/GroupConversation-Cgo4xbpa.js +0 -1
  179. package/web/dist/assets/GroupConversation-DZ71jEi8.js +0 -1
  180. package/web/dist/assets/ModelConfigModal-BpWdFdQC.js +0 -2
  181. package/web/dist/assets/PiSetupModal-mkWPSxMj.js +0 -1
  182. package/web/dist/assets/ProviderOAuthControls-VK_jqXYS.js +0 -1
  183. package/web/dist/assets/SCMPanel-BP1TUT-V.js +0 -2
  184. package/web/dist/assets/SCMPanel-BscPm9kf.js +0 -2
  185. package/web/dist/assets/SettingsModal-C8UgMjVM.js +0 -20
  186. package/web/dist/assets/SettingsModal-VynB7jNb.js +0 -20
  187. package/web/dist/assets/TuiOverlayModal-Dst3BmT8.js +0 -1
  188. package/web/dist/assets/TuiOverlayModal-NCkpNtTp.js +0 -1
  189. package/web/dist/assets/UniversalPathPicker-CfQFc_c3.js +0 -1
  190. package/web/dist/assets/UniversalPathPicker-DwxwNcFw.js +0 -1
  191. package/web/dist/assets/app-globals-CnO6KlEM.js +0 -325
  192. package/web/dist/assets/index-CPgAH5q7.js +0 -83
  193. package/web/dist/assets/index-Cje8iugL.js +0 -83
  194. package/web/dist/assets/index-DnKeiDbj.css +0 -1
  195. package/web/dist/assets/theme-BqdAjEjF.js +0 -1
@@ -1,100 +1,100 @@
1
- # pi-web-ui behind nginx at a sub-path: http://<host>:83/pi/
2
- # Backend app: http://127.0.0.1:8787 (default PI_WEB_PORT env)
3
- #
4
- # IMPORTANT: pi-web-ui 0.23+ checks the WebSocket Origin against the request
5
- # Host (hostname AND port). Every proxied location MUST forward the original
6
- # Host with $http_host (keeps the port). Using $host (drops the port) or
7
- # leaving Host unset (defaults to 127.0.0.1:8787) makes the upgrade fail with
8
- # 403 — the page loads but chat/terminal keep reconnecting.
9
- #
10
- # Topology (two listeners on one port: frp + LAN coexist):
11
- # frp (public) -> <PUBLIC_IP>:<PUBLIC_PORT> -> 127.0.0.1:83 (PROXY protocol v2)
12
- # LAN users -> http://<LAN_IP>:83/pi/ (plain HTTP listener)
13
- #
14
- # frpc sends PROXY v2 to nginx (transport.proxyProtocolVersion = "v2"):
15
- # * 127.0.0.1:83 proxy_protocol — only the local frp client connects
16
- # here (it speaks PROXY v2; nginx then sees the real visitor IP).
17
- # * <LAN_IP>:83 plain HTTP — LAN browsers, no PROXY header needed.
18
- #
19
- # Simpler alternative (no real client IPs): drop proxy_protocol entirely and
20
- # use a single `listen 83;` — then frpc must NOT set proxyProtocolVersion.
21
- #
22
- # The frontend uses absolute paths (/ws WebSocket, /assets/*, /favicon.svg,
23
- # /api/file…) so those get their own proxied locations next to /pi/.
24
-
25
- # Reuse for Upgrade/Connection headers (WebSocket).
26
- map $http_upgrade $connection_upgrade {
27
- default upgrade;
28
- '' close;
29
- }
30
-
31
- server {
32
- listen 127.0.0.1:83 proxy_protocol;
33
- listen <LAN_IP>:83;
34
-
35
- server_name _;
36
-
37
- # Trust PROXY-protocol headers only from the local frp client; plain
38
- # (LAN) connections keep their real $remote_addr untouched.
39
- set_real_ip_from 127.0.0.1;
40
- real_ip_header proxy_protocol;
41
-
42
- # ---- main entry: strip /pi/ and forward to the app root ----
43
- location /pi/ {
44
- proxy_pass http://127.0.0.1:8787/;
45
- proxy_http_version 1.1;
46
- # $http_host keeps the port — origin check compares hostname AND port.
47
- proxy_set_header Host $http_host;
48
- proxy_set_header X-Real-IP $remote_addr;
49
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
50
- proxy_set_header X-Forwarded-Proto $scheme;
51
- proxy_set_header Upgrade $http_upgrade;
52
- proxy_set_header Connection $connection_upgrade;
53
- proxy_read_timeout 3600s;
54
- proxy_send_timeout 3600s;
55
- }
56
-
57
- # ---- subpath WebSocket (frontend connects to ws://<host>/pi/ws under /pi/ base) ----
58
- location /pi/ws {
59
- proxy_pass http://127.0.0.1:8787/ws;
60
- proxy_http_version 1.1;
61
- proxy_set_header Host $http_host;
62
- proxy_set_header Upgrade $http_upgrade;
63
- proxy_set_header Connection $connection_upgrade;
64
- proxy_read_timeout 3600s;
65
- proxy_send_timeout 3600s;
66
- proxy_set_header X-Real-IP $remote_addr;
67
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
68
- }
69
-
70
- # ---- root WebSocket fallback (for direct ws://<host>/ws connections) ----
71
- location /ws {
72
- proxy_pass http://127.0.0.1:8787;
73
- proxy_http_version 1.1;
74
- proxy_set_header Host $http_host;
75
- proxy_set_header Upgrade $http_upgrade;
76
- proxy_set_header Connection $connection_upgrade;
77
- proxy_read_timeout 3600s;
78
- proxy_send_timeout 3600s;
79
- proxy_set_header X-Real-IP $remote_addr;
80
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
81
- }
82
-
83
- # ---- absolute asset paths baked into index.html ----
84
- location /assets/ {
85
- proxy_pass http://127.0.0.1:8787;
86
- }
87
- location = /favicon.svg {
88
- proxy_pass http://127.0.0.1:8787;
89
- }
90
-
91
- # ---- media preview / download / health API ----
92
- location /api/ {
93
- proxy_pass http://127.0.0.1:8787;
94
- }
95
-
96
- # bare root → app entry
97
- location = / {
98
- return 302 /pi/;
99
- }
100
- }
1
+ # pi-web-ui behind nginx at a sub-path: http://<host>:83/pi/
2
+ # Backend app: http://127.0.0.1:8787 (default PI_WEB_PORT env)
3
+ #
4
+ # IMPORTANT: pi-web-ui 0.23+ checks the WebSocket Origin against the request
5
+ # Host (hostname AND port). Every proxied location MUST forward the original
6
+ # Host with $http_host (keeps the port). Using $host (drops the port) or
7
+ # leaving Host unset (defaults to 127.0.0.1:8787) makes the upgrade fail with
8
+ # 403 — the page loads but chat/terminal keep reconnecting.
9
+ #
10
+ # Topology (two listeners on one port: frp + LAN coexist):
11
+ # frp (public) -> <PUBLIC_IP>:<PUBLIC_PORT> -> 127.0.0.1:83 (PROXY protocol v2)
12
+ # LAN users -> http://<LAN_IP>:83/pi/ (plain HTTP listener)
13
+ #
14
+ # frpc sends PROXY v2 to nginx (transport.proxyProtocolVersion = "v2"):
15
+ # * 127.0.0.1:83 proxy_protocol — only the local frp client connects
16
+ # here (it speaks PROXY v2; nginx then sees the real visitor IP).
17
+ # * <LAN_IP>:83 plain HTTP — LAN browsers, no PROXY header needed.
18
+ #
19
+ # Simpler alternative (no real client IPs): drop proxy_protocol entirely and
20
+ # use a single `listen 83;` — then frpc must NOT set proxyProtocolVersion.
21
+ #
22
+ # The frontend uses absolute paths (/ws WebSocket, /assets/*, /favicon.svg,
23
+ # /api/file…) so those get their own proxied locations next to /pi/.
24
+
25
+ # Reuse for Upgrade/Connection headers (WebSocket).
26
+ map $http_upgrade $connection_upgrade {
27
+ default upgrade;
28
+ '' close;
29
+ }
30
+
31
+ server {
32
+ listen 127.0.0.1:83 proxy_protocol;
33
+ listen <LAN_IP>:83;
34
+
35
+ server_name _;
36
+
37
+ # Trust PROXY-protocol headers only from the local frp client; plain
38
+ # (LAN) connections keep their real $remote_addr untouched.
39
+ set_real_ip_from 127.0.0.1;
40
+ real_ip_header proxy_protocol;
41
+
42
+ # ---- main entry: strip /pi/ and forward to the app root ----
43
+ location /pi/ {
44
+ proxy_pass http://127.0.0.1:8787/;
45
+ proxy_http_version 1.1;
46
+ # $http_host keeps the port — origin check compares hostname AND port.
47
+ proxy_set_header Host $http_host;
48
+ proxy_set_header X-Real-IP $remote_addr;
49
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
50
+ proxy_set_header X-Forwarded-Proto $scheme;
51
+ proxy_set_header Upgrade $http_upgrade;
52
+ proxy_set_header Connection $connection_upgrade;
53
+ proxy_read_timeout 3600s;
54
+ proxy_send_timeout 3600s;
55
+ }
56
+
57
+ # ---- subpath WebSocket (frontend connects to ws://<host>/pi/ws under /pi/ base) ----
58
+ location /pi/ws {
59
+ proxy_pass http://127.0.0.1:8787/ws;
60
+ proxy_http_version 1.1;
61
+ proxy_set_header Host $http_host;
62
+ proxy_set_header Upgrade $http_upgrade;
63
+ proxy_set_header Connection $connection_upgrade;
64
+ proxy_read_timeout 3600s;
65
+ proxy_send_timeout 3600s;
66
+ proxy_set_header X-Real-IP $remote_addr;
67
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
68
+ }
69
+
70
+ # ---- root WebSocket fallback (for direct ws://<host>/ws connections) ----
71
+ location /ws {
72
+ proxy_pass http://127.0.0.1:8787;
73
+ proxy_http_version 1.1;
74
+ proxy_set_header Host $http_host;
75
+ proxy_set_header Upgrade $http_upgrade;
76
+ proxy_set_header Connection $connection_upgrade;
77
+ proxy_read_timeout 3600s;
78
+ proxy_send_timeout 3600s;
79
+ proxy_set_header X-Real-IP $remote_addr;
80
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
81
+ }
82
+
83
+ # ---- absolute asset paths baked into index.html ----
84
+ location /assets/ {
85
+ proxy_pass http://127.0.0.1:8787;
86
+ }
87
+ location = /favicon.svg {
88
+ proxy_pass http://127.0.0.1:8787;
89
+ }
90
+
91
+ # ---- media preview / download / health API ----
92
+ location /api/ {
93
+ proxy_pass http://127.0.0.1:8787;
94
+ }
95
+
96
+ # bare root → app entry
97
+ location = / {
98
+ return 302 /pi/;
99
+ }
100
+ }
@@ -1,36 +1,36 @@
1
- # pi-web-ui systemd unit — Linux auto-start on boot.
2
- #
3
- # Install (adjust User/WorkingDirectory/Environment to taste):
4
- # sudo npm i -g pi-web-ui
5
- # sudo cp deploy/pi-web-ui.service /etc/systemd/system/
6
- # sudo systemctl daemon-reload
7
- # sudo systemctl enable --now pi-web-ui
8
- # sudo systemctl status pi-web-ui
9
- #
10
- # Logs: journalctl -u pi-web-ui -f
11
-
12
- [Unit]
13
- Description=pi-web-ui — web chat for the pi coding agent
14
- After=network.target
15
-
16
- [Service]
17
- Type=simple
18
- # Run as an unprivileged user (change to your user, e.g. yourname)
19
- User=YOUR_USER
20
- # The workspace the agent operates in (read/edit/bash/write)
21
- WorkingDirectory=/home/YOUR_USER
22
- Environment=PI_WEB_PORT=8787
23
- # For privileged ports (1-1023, e.g. 80/443), uncomment both lines:
24
- #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
25
- #AmbientCapabilities=CAP_NET_BIND_SERVICE
26
- # Optional authentication; protect this file if you store a token here.
27
- #Environment="PI_WEB_TOKEN=replace-with-your-token"
28
- # Point at your pi config dir if it's not the default ~/.pi/agent
29
- #Environment=PI_CODING_AGENT_DIR=/home/YOUR_USER/.pi/agent
30
- ExecStart=/usr/bin/pi-web-ui
31
- Restart=on-failure
32
- RestartSec=5
33
- # npm global bin may live elsewhere (nvm, etc.) — find with: which pi-web-ui
34
-
35
- [Install]
36
- WantedBy=multi-user.target
1
+ # pi-web-ui systemd unit — Linux auto-start on boot.
2
+ #
3
+ # Install (adjust User/WorkingDirectory/Environment to taste):
4
+ # sudo npm i -g pi-web-ui
5
+ # sudo cp deploy/pi-web-ui.service /etc/systemd/system/
6
+ # sudo systemctl daemon-reload
7
+ # sudo systemctl enable --now pi-web-ui
8
+ # sudo systemctl status pi-web-ui
9
+ #
10
+ # Logs: journalctl -u pi-web-ui -f
11
+
12
+ [Unit]
13
+ Description=pi-web-ui — web chat for the pi coding agent
14
+ After=network.target
15
+
16
+ [Service]
17
+ Type=simple
18
+ # Run as an unprivileged user (change to your user, e.g. yourname)
19
+ User=YOUR_USER
20
+ # The workspace the agent operates in (read/edit/bash/write)
21
+ WorkingDirectory=/home/YOUR_USER
22
+ Environment=PI_WEB_PORT=8787
23
+ # For privileged ports (1-1023, e.g. 80/443), uncomment both lines:
24
+ #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
25
+ #AmbientCapabilities=CAP_NET_BIND_SERVICE
26
+ # Optional authentication; protect this file if you store a token here.
27
+ #Environment="PI_WEB_TOKEN=replace-with-your-token"
28
+ # Point at your pi config dir if it's not the default ~/.pi/agent
29
+ #Environment=PI_CODING_AGENT_DIR=/home/YOUR_USER/.pi/agent
30
+ ExecStart=/usr/bin/pi-web-ui
31
+ Restart=on-failure
32
+ RestartSec=5
33
+ # npm global bin may live elsewhere (nvm, etc.) — find with: which pi-web-ui
34
+
35
+ [Install]
36
+ WantedBy=multi-user.target
@@ -95,7 +95,7 @@ import { goalReviewDenial, shouldDeferPromptForReview } from "./goal-review-gate
95
95
  import { readPlanModeFromSession, readPlanFromSession } from "./permission-preset.js";
96
96
  import { readDelegateModeFromSession } from "./permission-preset.js";
97
97
  import { applyHeadTail, makePersistentTerminalTools, makeTerminalBashTool, stripAnsi, TERMINAL_TOOLS_GUIDANCE, } from "./terminals.js";
98
- import { applyAgentToolsGating, ASK_USER_QUESTION_TOOL_NAME, effectiveDisabledAgentTools, filterToolsByPreset, isAgentToolEnabled, isTerminalGuidanceOn, LAZY_CORE_TOOL_NAMES, lazyLoadingDisabledTools, LOAD_TOOLS_TOOL_NAME, localizedName, PI_AGENT_PRESETS, PI_PERMISSION_OPTIONS, PRESENT_FILES_TOOL_NAME, presetAllowsPluginTools, presetHasQuestionnaire, presetShowsSkillCatalog, } from "./tool-manager.js";
98
+ import { applyAgentToolsGating, ASK_USER_QUESTION_TOOL_NAME, effectiveDisabledAgentTools, filterToolsByPreset, isAgentToolEnabled, isTerminalGuidanceOn, LAZY_CORE_TOOL_NAMES, lazyLoadingDisabledTools, LOAD_TOOLS_TOOL_NAME, CANVAS_TOOL_NAME, localizedName, PI_AGENT_PRESETS, PI_PERMISSION_OPTIONS, PRESENT_FILES_TOOL_NAME, presetAllowsPluginTools, presetHasQuestionnaire, presetShowsSkillCatalog, } from "./tool-manager.js";
99
99
  import { makeLoadToolsTool } from "./load-tools-tool.js";
100
100
  import { formatCompactSignature } from "./tool-signature.js";
101
101
  import { WebUIContext } from "./webui-context.js";
@@ -335,9 +335,10 @@ export class ClientSession {
335
335
  * considered stopped once its agent_end event arrives. If it doesn't
336
336
  * (model stream stuck before the run even started), force-reset. */
337
337
  static HARD_ABORT_SETTLE_MS = 8_000;
338
- /** Live AbortControllers of THIS client's running bash tool calls — aborting
339
- * them kills only the command (agent run and conversation continue). */
340
- bashKills = new Set();
338
+ /** Resolve only an explicit execution owner; never borrow the active conversation. */
339
+ bashKillsOf(conv) {
340
+ return (conv.bashKills ??= new Set());
341
+ }
341
342
  /** Background-server tracking (port snapshots + 后台任务 panel state) —
342
343
  * 自包含模块,见 bg-servers.ts。列表按 CLIENT 存活,不随对话切换/结束消失。 */
343
344
  /** 用户直接创建的交互式终端(按 CLIENT/工作区 存活,始终显示,不受单个对话切换、生命周期与过滤影响) */
@@ -1892,6 +1893,19 @@ export class ClientSession {
1892
1893
  }
1893
1894
  return { loaded, rejected };
1894
1895
  }
1896
+ /** A canvas reference loads the existing tool only within this session's permissions. */
1897
+ prepareCanvasReference(session, conv) {
1898
+ if (this.lazyLoadingOn())
1899
+ this.loadLazyTools(session, conv, [CANVAS_TOOL_NAME]);
1900
+ if (!session.getActiveToolNames().includes(CANVAS_TOOL_NAME)) {
1901
+ this.emit({
1902
+ type: "notice",
1903
+ level: "warning",
1904
+ text: "当前会话无法调用画布工具,请检查工具开关、预设与执行权限。",
1905
+ textEn: "Canvas is unavailable in this conversation. Check tool settings, preset, and execution permissions.",
1906
+ });
1907
+ }
1908
+ }
1895
1909
  /**
1896
1910
  * JIT Auto-activation: if an allowed catalog tool is executed without prior load_tools,
1897
1911
  * automatically mark it as loaded so subsequent turns track it as fully active.
@@ -5333,6 +5347,7 @@ export class ClientSession {
5333
5347
  pendingQuestion: this.pendingQuestionForSnapshot(),
5334
5348
  actionSuggestions: this.markerSvc.getActionSuggestions(this.activeId) ?? null,
5335
5349
  pendingApproval: this.pendingApprovalForSnapshot(),
5350
+ pendingApprovals: this.pendingApprovalsForSnapshot(),
5336
5351
  // 任务计划看板状态同样是会话级:快照恒给 PlanState 或 null(不用 undefined),
5337
5352
  // 否则 snapshot_delta 里 key 缺席 → 前端 spread 浅合并会残留上一对话的 plan。
5338
5353
  plan: this.planManager.getPlan(this.activeId) ?? null,
@@ -5636,6 +5651,12 @@ export class ClientSession {
5636
5651
  };
5637
5652
  return {
5638
5653
  ...this.subagentHost,
5654
+ spawnSubagent: (prompt, type, cwd, templateName, model, _parentId, persist, thinking, notifyOnDone, isolation, extra, signal) => {
5655
+ // Resolve by runtime identity: a moved parent's new id can also name
5656
+ // the replacement conversation in the original client.
5657
+ const home = current();
5658
+ return home.session.spawnSubagentViaHost(prompt, type, cwd, templateName, model, home.convId, persist, thinking, notifyOnDone, isolation, extra, signal);
5659
+ },
5639
5660
  handoffSubagent: async (_from, to, payload) => {
5640
5661
  const home = current();
5641
5662
  await home.session.communicate(home.convId, "send", { to, message: payload });
@@ -6297,6 +6318,24 @@ export class ClientSession {
6297
6318
  this.settingsSvc.push();
6298
6319
  this.flushSnapshot();
6299
6320
  }
6321
+ pendingApprovalsForSnapshot() {
6322
+ return [...this.convs.values()]
6323
+ .flatMap((conv) => [...(conv.pendingApprovals?.values() ?? [])].map((entry) => ({
6324
+ id: entry.id,
6325
+ toolCallId: entry.toolCallId,
6326
+ toolName: entry.toolName,
6327
+ params: entry.params,
6328
+ reason: entry.reason,
6329
+ reasonEn: entry.reasonEn,
6330
+ category: entry.category,
6331
+ hits: entry.hits,
6332
+ parentTool: entry.parentTool,
6333
+ conversationId: entry.conversationId,
6334
+ conversationTitle: entry.conversationTitle,
6335
+ createdAt: entry.createdAt,
6336
+ })))
6337
+ .sort((a, b) => a.createdAt - b.createdAt);
6338
+ }
6300
6339
  pendingApprovalForSnapshot() {
6301
6340
  const conv = this.conv;
6302
6341
  if (!conv?.pendingApprovals || conv.pendingApprovals.size === 0)
@@ -8260,45 +8299,63 @@ export class ClientSession {
8260
8299
  const composeWrite = (base) => planGate(wrapWriteToolWithPermission(cwd, currentPermission, () => this.roots, () => this.getLang(), approve, () => ownerId, () => this.approvalRules.list(), base));
8261
8300
  const composeEdit = (base) => planGate(wrapEditToolWithPermission(cwd, currentPermission, () => this.roots, () => this.getLang(), approve, () => ownerId, () => this.approvalRules.list(), base));
8262
8301
  const composeBash = (base) => {
8263
- let core;
8264
- if (base) {
8265
- // 扩展提供了同名 bash:以扩展定义为基底,保留其 schema/描述/guidelines,
8266
- // 同时挂载 abort_bash 信号中断支持与 head/tail 输出后处理。
8267
- core = {
8268
- ...base,
8269
- execute: async (toolCallId, params, signal, onUpdate, ctx) => {
8270
- const ac = new AbortController();
8271
- this.bashKills.add(ac);
8272
- try {
8273
- const signals = [signal, ac.signal].filter((s) => s !== undefined);
8274
- const combinedSignal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
8275
- const result = (await base.execute(toolCallId, params, combinedSignal, onUpdate, ctx));
8276
- const p = params;
8277
- if ((p?.head || p?.tail) && result?.content?.[0]?.text != null) {
8278
- result.content[0].text = applyHeadTail(result.content[0].text, p.head, p.tail, this.getLang());
8302
+ const makeCore = (convKills) => {
8303
+ let core;
8304
+ if (base) {
8305
+ // 扩展提供了同名 bash:以扩展定义为基底,保留其 schema/描述/guidelines,
8306
+ // 同时挂载 abort_bash 信号中断支持与 head/tail 输出后处理。
8307
+ core = {
8308
+ ...base,
8309
+ execute: async (toolCallId, params, signal, onUpdate, ctx) => {
8310
+ const ac = new AbortController();
8311
+ convKills.add(ac);
8312
+ try {
8313
+ const signals = [signal, ac.signal].filter((s) => s !== undefined);
8314
+ const combinedSignal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
8315
+ const result = (await base.execute(toolCallId, params, combinedSignal, onUpdate, ctx));
8316
+ const p = params;
8317
+ if ((p?.head || p?.tail) && result?.content?.[0]?.text != null) {
8318
+ result.content[0].text = applyHeadTail(result.content[0].text, p.head, p.tail, this.getLang());
8319
+ }
8320
+ return result;
8279
8321
  }
8280
- return result;
8281
- }
8282
- finally {
8283
- this.bashKills.delete(ac);
8284
- }
8285
- },
8286
- };
8287
- }
8288
- else {
8289
- // 没有扩展 bash:完整的原生与终端自适应分流 bash(行为与改动前逐字一致)。
8290
- core = makeAdaptiveBashTool(makeKillableBashTool(cwd, this.bashKills, () => this.getLang()), terminals
8291
- ? makeTerminalBashTool(terminals, {
8292
- cwd,
8293
- defaultPersist: () => false,
8294
- idleMs: () => Math.max(0, Math.floor(this.settingsSvc.current.terminalBashIdleMs) || 0),
8295
- maxForegroundMs: () => Math.max(0, Math.floor(this.settingsSvc.current.terminalBashMaxForegroundMs) || 0),
8296
- kills: this.bashKills,
8297
- notifyBackgroundDone: (info) => this.notifyTerminalBashDone(terminals, info),
8298
- lang: () => this.getLang(),
8299
- })
8300
- : makeKillableBashTool(cwd, this.bashKills, () => this.getLang()), () => Boolean(terminals && this.settingsSvc.current.terminalBash));
8301
- }
8322
+ finally {
8323
+ convKills.delete(ac);
8324
+ }
8325
+ },
8326
+ };
8327
+ }
8328
+ else {
8329
+ // 没有扩展 bash:完整的原生与终端自适应分流 bash(行为与改动前逐字一致)。
8330
+ core = makeAdaptiveBashTool(makeKillableBashTool(cwd, convKills, () => this.getLang()), terminals
8331
+ ? makeTerminalBashTool(terminals, {
8332
+ cwd,
8333
+ defaultPersist: () => false,
8334
+ idleMs: () => Math.max(0, Math.floor(this.settingsSvc.current.terminalBashIdleMs) || 0),
8335
+ maxForegroundMs: () => Math.max(0, Math.floor(this.settingsSvc.current.terminalBashMaxForegroundMs) || 0),
8336
+ kills: convKills,
8337
+ notifyBackgroundDone: (info) => this.notifyTerminalBashDone(terminals, info),
8338
+ lang: () => this.getLang(),
8339
+ })
8340
+ : makeKillableBashTool(cwd, convKills, () => this.getLang()), () => Boolean(terminals && this.settingsSvc.current.terminalBash));
8341
+ }
8342
+ return core;
8343
+ };
8344
+ // SDK constructs tools before registering the Conversation. Resolve ownership
8345
+ // when execution begins; bindOwner supplies the current holder/session after takeover.
8346
+ const core = {
8347
+ ...makeCore(new Set()),
8348
+ execute: (...args) => {
8349
+ const conv = evidenceSession
8350
+ ? this.toolConversationHome(evidenceSession)?.conv
8351
+ : ownerId
8352
+ ? this.convs.get(ownerId)
8353
+ : undefined;
8354
+ if (!conv)
8355
+ throw new Error("Tool conversation is no longer available");
8356
+ return makeCore(this.bashKillsOf(conv)).execute(...args);
8357
+ },
8358
+ };
8302
8359
  const guarded = withToolGuard(withWorkspaceSnapshotGate(core, () => this.awaitPendingWorkspaceSnapshot(ownerId)), {
8303
8360
  toolName: "bash",
8304
8361
  guard: this.lateToolGuard,
@@ -9887,6 +9944,9 @@ export class ClientSession {
9887
9944
  });
9888
9945
  return;
9889
9946
  }
9947
+ if (asides.some((aside) => aside.message.details?.mode === "canvas")) {
9948
+ this.prepareCanvasReference(s, conv);
9949
+ }
9890
9950
  // 空闲前置:若当前未处于流式运行且上下文超标,提早在注入附件前执行软上限主动压缩(issue #716)。
9891
9951
  // 必须在任何 nextTurn 注入之前完成,避免耗时压缩期间发生状态变化导致附件残留泄漏(fixes #717)。
9892
9952
  if (!s.isStreaming) {
@@ -10365,12 +10425,17 @@ export class ClientSession {
10365
10425
  const thresholdMs = (minutes > 0 ? minutes : BG_CLEANUP_FALLBACK_MIN) * 60_000;
10366
10426
  return this.bg.cleanStale(thresholdMs, { manual: true });
10367
10427
  }
10368
- /** Kill only the running bash command(s) — the agent run itself continues
10369
- * (the bash tool returns an aborted error and the model moves on). Uses
10370
- * the per-client AbortController set registered by the bash tool paths
10371
- * ({@link makeKillableBashTool} / {@link makeTerminalBashTool}). */
10372
- async abortBash() {
10373
- if (this.bashKills.size === 0) {
10428
+ /** Kill only the running bash command(s) of ONE conversation — the agent run and
10429
+ * every other conversation continue (the bash tool returns an aborted error and
10430
+ * the model moves on). Targets the per-conversation bucket registered by the
10431
+ * bash tool paths ({@link makeKillableBashTool} / {@link makeTerminalBashTool});
10432
+ * without an explicit id it targets only the active conversation. */
10433
+ async abortBash(convId) {
10434
+ const ownerConv = this.convs.get(convId ?? this.activeId);
10435
+ // Abort listeners run synchronously and may detach, replace, or reset the owner.
10436
+ const runtime = ownerConv?.runtime;
10437
+ const kills = ownerConv?.bashKills;
10438
+ if (!kills || kills.size === 0) {
10374
10439
  this.emit({
10375
10440
  type: "notice",
10376
10441
  level: "info",
@@ -10381,7 +10446,7 @@ export class ClientSession {
10381
10446
  return;
10382
10447
  }
10383
10448
  // eslint-disable-next-line unicorn/no-useless-spread -- snapshot: handlers may unsubscribe mid-emit
10384
- for (const ac of [...this.bashKills])
10449
+ for (const ac of [...kills])
10385
10450
  ac.abort();
10386
10451
  this.emit({
10387
10452
  type: "notice",
@@ -10392,9 +10457,11 @@ export class ClientSession {
10392
10457
  // 让 AI 明确知道是用户手动停止:sendUserMessage 触发下一轮,agent
10393
10458
  // 会看到「命令被用户中止」而不是普通失败,并据此继续(不会困惑于
10394
10459
  // 为什么命令失败了)。
10460
+ // 停止提示发给命令真正所属的那个对话,别写进用户正在看的另一个对话。
10395
10461
  try {
10396
- this.assertSubagentWorktreeAdmission(this.conv);
10397
- await this.conv.runtime.session.sendUserMessage("(系统:用户手动停止了刚才的 bash 命令——命令被中止,终止前已输出的内容在对应工具结果里。请据此继续,不要重跑被中止的命令,除非确实必要。)");
10462
+ if (ownerConv)
10463
+ this.assertSubagentWorktreeAdmission(ownerConv);
10464
+ await runtime?.session.sendUserMessage("(系统:用户手动停止了刚才的 bash 命令——命令被中止,终止前已输出的内容在对应工具结果里。请据此继续,不要重跑被中止的命令,除非确实必要。)");
10398
10465
  }
10399
10466
  catch {
10400
10467
  // best effort — 消息注入失败不影响命令已停止的事实
@@ -11112,7 +11179,10 @@ export class ClientSession {
11112
11179
  // points at it: dropping an idle in-memory parent orphans the child row
11113
11180
  // (the child vanishes from Running Chats with no result available).
11114
11181
  const hasLiveChild = [...this.convs.values()].some((child) => child.parentId === conv.id);
11115
- const retainFinished = Boolean(this.settingsSvc?.current.retainFinishedConversations) && this.isConversationStarted(conv);
11182
+ // Ephemeral transcripts have no history fallback: once started, only an
11183
+ // explicit close may discard them, even after revisiting without a prompt.
11184
+ const retainFinished = (Boolean(conv.isEphemeral) || Boolean(this.settingsSvc?.current.retainFinishedConversations)) &&
11185
+ this.isConversationStarted(conv);
11116
11186
  const retained = hasLiveChild ||
11117
11187
  retainFinished ||
11118
11188
  shouldRetainActive({
@@ -12244,9 +12314,14 @@ export class ClientSession {
12244
12314
  return;
12245
12315
  conv.title = trimmed;
12246
12316
  try {
12247
- const file = conv.session.sessionFile;
12248
- if (file !== undefined)
12249
- SessionManager.open(resolve(file)).appendSessionInfo(trimmed);
12317
+ // Write through the LIVE session manager, not a throwaway SessionManager.open().
12318
+ // Only the live manager keeps its in-memory entry list and the transcript in
12319
+ // sync, so the title also rides along when the file is created later: a
12320
+ // brand-new conversation has no .jsonl yet (pi's _persist() refuses to write
12321
+ // before the first user/assistant message), and a freshly opened manager on a
12322
+ // missing path silently drops appendSessionInfo(). That made a rename of a
12323
+ // not-yet-flushed conversation disappear after a server restart.
12324
+ conv.session.setSessionName(trimmed);
12250
12325
  }
12251
12326
  catch {
12252
12327
  // in-memory title still updated; transcript write is best-effort
@@ -13036,6 +13111,7 @@ export class ClientSession {
13036
13111
  const conv = this.makeConversation(openedRuntime, conversationId, openedTerminals);
13037
13112
  // Deliberately resumed — must not be dismissed when the user later
13038
13113
  // switches away without sending a new message.
13114
+ conv.listed = true;
13039
13115
  conv.promptedSinceActive = true;
13040
13116
  if (this.stateStore?.isSessionPinned(targetCwd, targetPath)) {
13041
13117
  conv.pinned = true;
@@ -1,11 +1,25 @@
1
1
  import { uploadLimitBytes, isUploadDataTooLong } from "./payload-limits.js";
2
2
  import { formatTextQuote, readTextQuote } from "./text-quote.js";
3
3
  import { sniffImageMime } from "./text-sniff.js";
4
- import { saveUpload, uploadsRoot } from "./uploads.js";
4
+ import { resolveDataDir, saveUpload, uploadsRoot } from "./uploads.js";
5
+ import { isSafeGraphId, loadCanvasGraph } from "./canvas/canvas-store.js";
6
+ import { existsSync } from "node:fs";
7
+ import { join } from "node:path";
5
8
  import { isAbsoluteWirePath, wireToAbs } from "./files-service.js";
6
9
  import { buildVisionBridgePrompt, findVisionModels, transcribeImages } from "./vision-bridge.js";
7
10
  import { saveAttachment } from "./attachment-store.js";
8
11
  import { getGlobalRemoteSshService, isRemoteWorkspaceUri, parseRemoteWorkspaceUri, resolveRemoteWorkspacePath, } from "./remote-ssh-service.js";
12
+ /** Resolve reference metadata without creating the store's implicit default graph. */
13
+ export function getCanvasReference(graphId) {
14
+ const dataDir = resolveDataDir();
15
+ if (!isSafeGraphId(graphId) || !existsSync(join(dataDir, "canvas", `${graphId}.json`))) {
16
+ throw new Error("Invalid or missing canvas reference");
17
+ }
18
+ const graph = loadCanvasGraph(dataDir, graphId);
19
+ if (graph.id !== graphId)
20
+ throw new Error("Canvas graph id mismatch");
21
+ return { id: graphId, title: graph.name || graphId };
22
+ }
9
23
  /** 跨快照的视觉转写缓存:批次 hash(名称 + base64 头 + 提示词)→ 转写文本。
10
24
  * 编辑重问重发相同图片不再重复耗视觉 token。进程级共享即可。
11
25
  * 长驻进程下无界 Map 会随图片种类缓慢吃内存(单条转写可达数十 KB),
@@ -138,7 +152,7 @@ export async function buildAttachmentMessages(ctx, attachments) {
138
152
  }
139
153
  continue;
140
154
  }
141
- if (att.fileData || !att.path)
155
+ if (att.mode === "canvas" || att.fileData || !att.path)
142
156
  continue;
143
157
  const ext = extname(att.path).toLowerCase();
144
158
  if (!IMAGE_EXT.has(ext) || ext === ".svg")
@@ -342,6 +356,38 @@ export async function buildAttachmentMessages(ctx, attachments) {
342
356
  });
343
357
  continue;
344
358
  }
359
+ // Canvas identifiers are not filesystem paths. Resolve only through the canvas store.
360
+ if (att.mode === "canvas") {
361
+ const graphId = att.path;
362
+ try {
363
+ const { title } = getCanvasReference(graphId);
364
+ out.push({
365
+ message: {
366
+ customType: "file",
367
+ content: [
368
+ {
369
+ type: "text",
370
+ text: `
371
+ <canvas-ref id="${attr(graphId)}" title="${attr(title)}">
372
+ The user referenced this canvas. First use canvas(action="get", graphId="${attr(graphId)}") to inspect its topology and status. Only when the user requests execution, use canvas(action="run_all", graphId="${attr(graphId)}", prompt="the user requirements"); prompt supplies the run initialPrompt. Use canvas(action="get_log", graphId="${attr(graphId)}") for logs, and action="get" for status. This reference alone does not authorize or start a run.
373
+ </canvas-ref>`,
374
+ },
375
+ ],
376
+ display: true,
377
+ details: { mode: "canvas", path: graphId, name: title, title },
378
+ },
379
+ });
380
+ }
381
+ catch {
382
+ ctx.emit({
383
+ type: "notice",
384
+ level: "warning",
385
+ text: `画布引用无效或不存在,已跳过:${graphId}`,
386
+ textEn: `Invalid or missing canvas reference, skipped: ${graphId}`,
387
+ });
388
+ }
389
+ continue;
390
+ }
345
391
  // Granted web page (page-picker extension): `path` is the page origin,
346
392
  // NOT a workspace path — never stat/read it. The model gets the exact
347
393
  // browser_page target plus the fact that this page is already granted,
@@ -663,9 +709,9 @@ export async function buildAttachmentMessages(ctx, attachments) {
663
709
  content: [
664
710
  {
665
711
  type: "text",
666
- text: `
667
- <vision-bridge>
668
- ${transcript}
712
+ text: `
713
+ <vision-bridge>
714
+ ${transcript}
669
715
  </vision-bridge>`,
670
716
  },
671
717
  ...(pathImg