pi-web-ui 0.117.0 → 0.118.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.
Files changed (512) hide show
  1. package/CHANGELOG.md +48 -2
  2. package/README.md +69 -138
  3. package/README.zh-CN.md +70 -179
  4. package/README.zh-TW.md +3 -1
  5. package/bin/device-hub-cli.mjs +147 -43
  6. package/bin/frp-manager.mjs +4 -80
  7. package/bin/hub-upgrade.mjs +561 -0
  8. package/bin/pi-device-hub.mjs +0 -1
  9. package/bin/pi-web-ui.mjs +56 -444
  10. package/deploy/nginx-subpath.conf +0 -33
  11. package/deploy/pi-web-ui.service +0 -20
  12. package/dist/server/agent-formatters.js +4 -38
  13. package/dist/server/agent-service-daemon.js +160 -374
  14. package/dist/server/agent-service.js +875 -2978
  15. package/dist/server/approval-audit.js +2 -23
  16. package/dist/server/approval-default-rules.js +0 -6
  17. package/dist/server/approval-rules.js +7 -105
  18. package/dist/server/ask-user-question-tool.js +1 -12
  19. package/dist/server/atomic-file.js +33 -5
  20. package/dist/server/attachment-store.js +0 -36
  21. package/dist/server/attachments.js +3 -112
  22. package/dist/server/auth-cookie.js +0 -21
  23. package/dist/server/bash-tool.js +1 -32
  24. package/dist/server/bg-servers.js +0 -96
  25. package/dist/server/browser-page-tool.js +11 -62
  26. package/dist/server/builtin-modules.js +7 -0
  27. package/dist/server/canvas/canvas-agent-tool.js +58 -47
  28. package/dist/server/canvas/canvas-cards.js +0 -14
  29. package/dist/server/canvas/canvas-dispatch.js +7 -4
  30. package/dist/server/canvas/canvas-orchestrator.js +167 -181
  31. package/dist/server/canvas/canvas-runtime-messages.js +30 -0
  32. package/dist/server/canvas/canvas-scheduled-task.js +0 -3
  33. package/dist/server/canvas/canvas-scheduler.js +5 -7
  34. package/dist/server/canvas/canvas-store.js +24 -35
  35. package/dist/server/canvas/canvas-validation.js +17 -14
  36. package/dist/server/canvas/canvas-workspace.js +26 -30
  37. package/dist/server/canvas/pstack-skills-data.js +0 -5
  38. package/dist/server/claim-files-tool.js +1 -15
  39. package/dist/server/claim-store.js +5 -49
  40. package/dist/server/client-id-utils.js +0 -16
  41. package/dist/server/client-state.js +6 -213
  42. package/dist/server/communicate-tool.js +0 -3
  43. package/dist/server/compact-context-tool.js +0 -30
  44. package/dist/server/compacted-history.js +0 -35
  45. package/dist/server/compaction-instructions.js +0 -13
  46. package/dist/server/compaction-markers.js +3 -76
  47. package/dist/server/compaction-state.js +0 -21
  48. package/dist/server/composer-drafts.js +0 -34
  49. package/dist/server/context-budget-runner.js +0 -11
  50. package/dist/server/context-budget.js +1 -70
  51. package/dist/server/context-evidence.js +0 -14
  52. package/dist/server/context-usage.js +0 -12
  53. package/dist/server/control-socket.js +4 -48
  54. package/dist/server/conversation-communication.js +0 -10
  55. package/dist/server/conversation-identity.js +0 -1
  56. package/dist/server/conversation-read-tool.js +0 -58
  57. package/dist/server/conversation-tool-names.js +0 -1
  58. package/dist/server/conversation-tool.js +0 -1
  59. package/dist/server/conversation-touches.js +4 -75
  60. package/dist/server/dangling-tools.js +0 -82
  61. package/dist/server/delegate-mode.js +0 -36
  62. package/dist/server/delegate-task.js +2 -28
  63. package/dist/server/device-center/approval-summary.js +0 -1
  64. package/dist/server/device-center/bot-catalog.js +0 -3
  65. package/dist/server/device-center/bot-execution.js +0 -8
  66. package/dist/server/device-center/bot-presets.js +0 -1
  67. package/dist/server/device-center/bots.js +0 -1
  68. package/dist/server/device-center/collab-service.js +1 -3
  69. package/dist/server/device-center/collab-tool.js +0 -10
  70. package/dist/server/device-center/connector.js +21 -11
  71. package/dist/server/device-center/delivery-authority.js +0 -3
  72. package/dist/server/device-center/delivery-subject.js +0 -1
  73. package/dist/server/device-center/desktop-linux.js +3 -15
  74. package/dist/server/device-center/desktop-native.js +1 -10
  75. package/dist/server/device-center/desktop-page.js +2 -3
  76. package/dist/server/device-center/desktop-setup.js +1 -3
  77. package/dist/server/device-center/desktop.js +1 -7
  78. package/dist/server/device-center/device-integration.js +1 -27
  79. package/dist/server/device-center/device-lan-access.js +403 -0
  80. package/dist/server/device-center/device-lan.js +484 -0
  81. package/dist/server/device-center/device-portals.js +0 -3
  82. package/dist/server/device-center/execution-failure.js +0 -2
  83. package/dist/server/device-center/execution-guides.js +0 -1
  84. package/dist/server/device-center/execution-instructions.js +0 -1
  85. package/dist/server/device-center/execution-settings.js +0 -1
  86. package/dist/server/device-center/execution-system-prompt.js +0 -3
  87. package/dist/server/device-center/execution-workspace.js +1 -4
  88. package/dist/server/device-center/executor.js +0 -27
  89. package/dist/server/device-center/file-sync-paths.js +0 -5
  90. package/dist/server/device-center/file-sync.js +0 -10
  91. package/dist/server/device-center/group-context-delta.js +0 -8
  92. package/dist/server/device-center/group-context-message.js +0 -14
  93. package/dist/server/device-center/group-context.js +0 -19
  94. package/dist/server/device-center/group-events.js +0 -2
  95. package/dist/server/device-center/group-plan-guard.js +1 -35
  96. package/dist/server/device-center/group-router-runtime.js +182 -0
  97. package/dist/server/device-center/group-router-worker.js +178 -0
  98. package/dist/server/device-center/group-router.js +359 -0
  99. package/dist/server/device-center/hub-auth.js +24 -2
  100. package/dist/server/device-center/hub-conversations.js +0 -12
  101. package/dist/server/device-center/hub-deliveries.js +0 -1
  102. package/dist/server/device-center/hub-integration.js +0 -8
  103. package/dist/server/device-center/hub-locks.js +1 -5
  104. package/dist/server/device-center/hub-mobile.js +147 -0
  105. package/dist/server/device-center/hub-orchestration.js +400 -0
  106. package/dist/server/device-center/hub-page.js +25 -7
  107. package/dist/server/device-center/hub-setup.js +0 -6
  108. package/dist/server/device-center/hub-transaction-log.js +0 -22
  109. package/dist/server/device-center/hub-upgrade.js +162 -0
  110. package/dist/server/device-center/hub-webhooks.js +1 -3
  111. package/dist/server/device-center/hub.js +210 -86
  112. package/dist/server/device-center/human-interaction.js +1 -4
  113. package/dist/server/device-center/integration-errors.js +0 -2
  114. package/dist/server/device-center/integration-verification.js +0 -2
  115. package/dist/server/device-center/local-hub.js +0 -2
  116. package/dist/server/device-center/local-publication.js +1 -8
  117. package/dist/server/device-center/local-verification-job.js +0 -2
  118. package/dist/server/device-center/local-verification.js +0 -1
  119. package/dist/server/device-center/local.js +267 -39
  120. package/dist/server/device-center/main.js +14 -1
  121. package/dist/server/device-center/mobile-notification-forwarder.js +292 -0
  122. package/dist/server/device-center/native-desktop/macos.js +0 -1
  123. package/dist/server/device-center/native-desktop/windows.js +0 -1
  124. package/dist/server/device-center/partition-log.js +0 -31
  125. package/dist/server/device-center/path-portal.js +42 -12
  126. package/dist/server/device-center/publication-journal.js +0 -7
  127. package/dist/server/device-center/publish-intent.js +0 -5
  128. package/dist/server/device-center/relay.js +85 -30
  129. package/dist/server/device-center/report-upload.js +0 -1
  130. package/dist/server/device-center/runtime.js +1 -18
  131. package/dist/server/device-center/store.js +13 -33
  132. package/dist/server/device-center/task-context-budget.js +0 -3
  133. package/dist/server/device-center/task-error.js +0 -1
  134. package/dist/server/device-center/task-journal.js +6 -23
  135. package/dist/server/device-center/task-outcome.js +0 -13
  136. package/dist/server/device-center/task-plan.js +0 -1
  137. package/dist/server/device-center/task-progress.js +0 -16
  138. package/dist/server/device-center/task-recovery.js +5 -88
  139. package/dist/server/device-center/task-report-outbox.js +0 -4
  140. package/dist/server/device-center/task-report.js +2 -10
  141. package/dist/server/device-center/task-scheduler.js +1 -35
  142. package/dist/server/device-center/task-settlement.js +0 -18
  143. package/dist/server/device-center/task-state.js +0 -12
  144. package/dist/server/device-center/task-workspace.js +0 -50
  145. package/dist/server/device-center/transfer-stream.js +5 -45
  146. package/dist/server/device-center/transfers.js +2 -10
  147. package/dist/server/device-center/verification-limits.js +0 -1
  148. package/dist/server/device-center/work-contract.js +1 -73
  149. package/dist/server/device-center/work-items.js +317 -0
  150. package/dist/server/device-center/workspaces.js +0 -1
  151. package/dist/server/dispatch-domain-handlers.js +190 -32
  152. package/dist/server/dispatch-plugin-handlers.js +2 -19
  153. package/dist/server/dsh/dsh-agent-service.js +69 -599
  154. package/dist/server/dsh/dsh-client.js +7 -111
  155. package/dist/server/dsh/dsh-market-service.js +4 -25
  156. package/dist/server/dsh/dsh-serialize.js +0 -49
  157. package/dist/server/dsh/dsh-sessions.js +0 -37
  158. package/dist/server/dsh/dsh-usage.js +0 -37
  159. package/dist/server/dsh/preset-clones.js +1 -65
  160. package/dist/server/dsh/runtime/custom-prompt.mjs +0 -14
  161. package/dist/server/dsh/runtime/goal-rpc.mjs +7 -176
  162. package/dist/server/dsh/runtime/launcher.mjs +2 -53
  163. package/dist/server/dsh/runtime/override.patch.yml +0 -29
  164. package/dist/server/dsh/runtime/runtime-root.mjs +0 -54
  165. package/dist/server/durable/durable-agent-service.js +5 -23
  166. package/dist/server/durable/durable-driver.js +12 -73
  167. package/dist/server/durable/durable-event-projector.js +1 -50
  168. package/dist/server/durable/durable-loader.js +0 -12
  169. package/dist/server/durable/durable-models.js +11 -80
  170. package/dist/server/durable/durable-storage.js +1 -17
  171. package/dist/server/durable/durable-tools.js +2 -20
  172. package/dist/server/durable/index.js +0 -3
  173. package/dist/server/edit-soft-tool.js +2 -81
  174. package/dist/server/engine-capabilities.js +0 -13
  175. package/dist/server/engine-catalog.js +74 -0
  176. package/dist/server/engine-cli.js +89 -0
  177. package/dist/server/engine-probe.js +35 -217
  178. package/dist/server/ensure-bash.js +2 -28
  179. package/dist/server/eval-tool.js +1 -50
  180. package/dist/server/evidence-tool-hooks.js +0 -2
  181. package/dist/server/file-archives.js +0 -10
  182. package/dist/server/file-save.js +1 -12
  183. package/dist/server/file-transfer-routes.js +0 -11
  184. package/dist/server/files-service.js +18 -271
  185. package/dist/server/global-loader.js +9 -89
  186. package/dist/server/goal-evidence.js +1 -35
  187. package/dist/server/goal-review-gate.js +0 -58
  188. package/dist/server/goal-service.js +19 -422
  189. package/dist/server/hashline-engine.js +8 -112
  190. package/dist/server/host-guard.js +0 -24
  191. package/dist/server/host-metrics.js +0 -6
  192. package/dist/server/http-proxy.js +1 -7
  193. package/dist/server/i18n.js +5 -72
  194. package/dist/server/icon-svg.js +0 -15
  195. package/dist/server/index.js +177 -680
  196. package/dist/server/json-utils.js +0 -12
  197. package/dist/server/launch-origin.js +0 -44
  198. package/dist/server/left-panel-running.js +0 -9
  199. package/dist/server/load-timing.js +1 -4
  200. package/dist/server/load-tools-tool.js +0 -20
  201. package/dist/server/locales.js +1 -46
  202. package/dist/server/lsp-tool.js +13 -126
  203. package/dist/server/managed.js +0 -48
  204. package/dist/server/marker-service.js +1 -22
  205. package/dist/server/markers/builtins/action.js +0 -19
  206. package/dist/server/markers/builtins/notify.js +1 -9
  207. package/dist/server/markers/builtins/rename.js +0 -13
  208. package/dist/server/markers/index.js +0 -3
  209. package/dist/server/markers/marker.js +0 -13
  210. package/dist/server/markers/registry.js +0 -3
  211. package/dist/server/markers/store.js +1 -12
  212. package/dist/server/market-service.js +7 -43
  213. package/dist/server/mcp-agent-tool.js +0 -10
  214. package/dist/server/mcp-bridge.js +6 -138
  215. package/dist/server/mcp-hot-reload.js +0 -25
  216. package/dist/server/mcp-manager.js +2 -44
  217. package/dist/server/mcp-oauth-login.js +0 -2
  218. package/dist/server/mcp-oauth-ui.js +1 -4
  219. package/dist/server/mcp-oauth.js +5 -79
  220. package/dist/server/mcp-project-runtime.js +0 -4
  221. package/dist/server/message-deletion.js +0 -2
  222. package/dist/server/message-entry-resolver.js +0 -8
  223. package/dist/server/message-window.js +0 -71
  224. package/dist/server/mobile-notification-events.js +16 -0
  225. package/dist/server/mobile-origin.js +79 -0
  226. package/dist/server/mobile-push.js +523 -0
  227. package/dist/server/model-admin.js +19 -358
  228. package/dist/server/model-enrich.js +0 -19
  229. package/dist/server/model-resolver.js +2 -61
  230. package/dist/server/native-cli-discovery.js +115 -0
  231. package/dist/server/native-cli-model.js +71 -0
  232. package/dist/server/native-cli-references.js +214 -0
  233. package/dist/server/native-cli-remote-cleanup.js +58 -0
  234. package/dist/server/native-cli-remote-files.js +282 -0
  235. package/dist/server/native-cli-routes.js +68 -0
  236. package/dist/server/native-cli-runtime.js +1 -0
  237. package/dist/server/native-cli-session-hooks.js +170 -0
  238. package/dist/server/native-cli-session.js +585 -0
  239. package/dist/server/native-cli-state.js +82 -0
  240. package/dist/server/native-cli.js +210 -0
  241. package/dist/server/net-guard.js +9 -71
  242. package/dist/server/office-parse.js +0 -50
  243. package/dist/server/orphan-manager.js +0 -18
  244. package/dist/server/patch-bash-process.js +0 -4
  245. package/dist/server/patch-executable-lookup.js +0 -77
  246. package/dist/server/patch-node-pty.js +3 -43
  247. package/dist/server/patch-remote-catalog.js +1 -32
  248. package/dist/server/patch-tool.js +0 -15
  249. package/dist/server/payload-limits.js +0 -5
  250. package/dist/server/pending-question.js +0 -5
  251. package/dist/server/permission-preset.js +4 -33
  252. package/dist/server/persona-chain.js +0 -26
  253. package/dist/server/pkg-info.js +1 -17
  254. package/dist/server/plan-manager.js +2 -49
  255. package/dist/server/plan-mode.js +0 -97
  256. package/dist/server/plan-update-tool.js +1 -15
  257. package/dist/server/plugin-api-catalog.js +6 -4
  258. package/dist/server/plugin-assets.js +1 -35
  259. package/dist/server/plugin-bundled.js +68 -0
  260. package/dist/server/plugin-catalog-sync.js +0 -37
  261. package/dist/server/plugin-catalog.js +13 -67
  262. package/dist/server/plugin-chat-attachments.js +0 -1
  263. package/dist/server/plugin-conversation-view.js +0 -20
  264. package/dist/server/plugin-dom.js +1 -23
  265. package/dist/server/plugin-facilities.js +4 -115
  266. package/dist/server/plugin-grants.js +2 -90
  267. package/dist/server/plugin-install-spec.js +0 -43
  268. package/dist/server/plugin-installer.js +34 -75
  269. package/dist/server/plugin-llm.js +4 -38
  270. package/dist/server/plugin-manifest-validate.js +0 -31
  271. package/dist/server/plugin-permissions.js +1 -24
  272. package/dist/server/plugin-project.js +7 -129
  273. package/dist/server/plugin-removal.js +1 -8
  274. package/dist/server/plugin-schedule.js +1 -38
  275. package/dist/server/plugin-secrets.js +3 -16
  276. package/dist/server/plugin-tool-guard.js +1 -28
  277. package/dist/server/plugin-ui-slots.js +0 -4
  278. package/dist/server/plugin-updater.js +15 -90
  279. package/dist/server/plugins.js +71 -619
  280. package/dist/server/present-files-tool.js +0 -57
  281. package/dist/server/preset-fields.js +9 -62
  282. package/dist/server/preset-plugin-dependencies.js +0 -2
  283. package/dist/server/preset-share.js +3 -172
  284. package/dist/server/process-utils.js +4 -80
  285. package/dist/server/prompt-assembler.js +2 -30
  286. package/dist/server/prompt-base-store.js +0 -47
  287. package/dist/server/prompt-composer.js +21 -98
  288. package/dist/server/prompt-templates.js +0 -2
  289. package/dist/server/protocol-version.js +1 -11
  290. package/dist/server/protocol.js +0 -5
  291. package/dist/server/queue-modes.js +0 -3
  292. package/dist/server/queue-utils.js +0 -40
  293. package/dist/server/quick-ask-context.js +384 -0
  294. package/dist/server/quick-ask-settings.js +34 -1
  295. package/dist/server/quick-ask.js +123 -27
  296. package/dist/server/read-tool.js +0 -65
  297. package/dist/server/reasoning-registry.js +1 -29
  298. package/dist/server/remote-cli-persistence.js +373 -0
  299. package/dist/server/remote-native-cli.js +78 -0
  300. package/dist/server/remote-ssh-service.js +481 -190
  301. package/dist/server/request-context.js +0 -9
  302. package/dist/server/resolve-global-sdk.js +0 -26
  303. package/dist/server/sandbox-data.js +0 -1
  304. package/dist/server/sandbox-engines.js +0 -1
  305. package/dist/server/sandbox-runtime-gate.js +0 -3
  306. package/dist/server/sandbox-service.js +0 -41
  307. package/dist/server/sandbox-tool.js +0 -20
  308. package/dist/server/schedule-agent-tool.js +2 -31
  309. package/dist/server/scheduler-tasks.js +3 -54
  310. package/dist/server/scm-commitmsg.js +0 -53
  311. package/dist/server/scm.js +3 -48
  312. package/dist/server/sdk-builtin-extensions.js +2 -29
  313. package/dist/server/sdk-origin.js +0 -45
  314. package/dist/server/serialize.js +2 -92
  315. package/dist/server/server-config.js +0 -11
  316. package/dist/server/session-branch.js +1 -87
  317. package/dist/server/session-list-scan.js +17 -25
  318. package/dist/server/session-open.js +2 -26
  319. package/dist/server/session-parser.js +1 -55
  320. package/dist/server/session-scan.js +1 -17
  321. package/dist/server/session-search.js +0 -56
  322. package/dist/server/settings-service.js +11 -126
  323. package/dist/server/setup-config.js +0 -2
  324. package/dist/server/setup-page.js +0 -9
  325. package/dist/server/skill-content-filler.js +0 -17
  326. package/dist/server/skill-discovery.js +5 -92
  327. package/dist/server/skill-maintenance.js +1 -28
  328. package/dist/server/skill-tool.js +0 -30
  329. package/dist/server/slash-commands.js +5 -50
  330. package/dist/server/soft-cap.js +0 -42
  331. package/dist/server/startup-banner.js +0 -8
  332. package/dist/server/subagent-handoff.js +0 -11
  333. package/dist/server/subagent-helpers.js +2 -17
  334. package/dist/server/subagent-notify.js +0 -19
  335. package/dist/server/subagent-security-gate.js +0 -50
  336. package/dist/server/subagent-task.js +0 -9
  337. package/dist/server/subagent-templates-hant.js +0 -10
  338. package/dist/server/subagent-templates.js +3 -103
  339. package/dist/server/subagents.js +1 -87
  340. package/dist/server/system-screenshot-windows.js +259 -0
  341. package/dist/server/system-screenshot.js +77 -0
  342. package/dist/server/tabs.js +3 -48
  343. package/dist/server/terminals.js +559 -586
  344. package/dist/server/text-quote.js +0 -12
  345. package/dist/server/text-sniff.js +2 -52
  346. package/dist/server/themes.js +2 -41
  347. package/dist/server/tool-approval.js +0 -47
  348. package/dist/server/tool-guards.js +0 -90
  349. package/dist/server/tool-host-factories.js +1 -16
  350. package/dist/server/tool-info.js +0 -13
  351. package/dist/server/tool-manager.js +1 -229
  352. package/dist/server/tool-overrides.js +1 -46
  353. package/dist/server/tool-prompt-overrides.js +1 -30
  354. package/dist/server/tool-prompts.js +0 -14
  355. package/dist/server/tool-signature.js +0 -25
  356. package/dist/server/transcript-prepare.js +1 -19
  357. package/dist/server/tts-routes.js +58 -0
  358. package/dist/server/tts-service.js +106 -0
  359. package/dist/server/tts-system.js +160 -0
  360. package/dist/server/turn-timing.js +0 -1
  361. package/dist/server/unauthorized-page.js +0 -8
  362. package/dist/server/universal/driver-base.js +2 -31
  363. package/dist/server/universal/drivers/claude-code.js +12 -172
  364. package/dist/server/universal/drivers/codex.js +12 -35
  365. package/dist/server/universal/drivers/mock-driver.js +1 -11
  366. package/dist/server/universal/index.js +0 -3
  367. package/dist/server/universal/session-store.js +4 -21
  368. package/dist/server/universal/universal-attachments.js +2 -36
  369. package/dist/server/universal/universal-service.js +5 -24
  370. package/dist/server/universal/universal-session.js +26 -148
  371. package/dist/server/universal/universal-types.js +0 -3
  372. package/dist/server/update-check.js +6 -182
  373. package/dist/server/uploads.js +4 -43
  374. package/dist/server/virtual-tui.js +2 -27
  375. package/dist/server/vision-bridge.js +0 -27
  376. package/dist/server/wait-subscription-scan.js +13 -115
  377. package/dist/server/webui-context.js +2 -87
  378. package/dist/server/workspace-handle.js +1 -56
  379. package/dist/server/workspace-snapshot.js +7 -113
  380. package/dist/server/worktree-service.js +2 -53
  381. package/dist/server/worktree-tool.js +0 -11
  382. package/dist/server/ws-client-id.js +0 -18
  383. package/dist/server/ws-pending-queue.js +0 -7
  384. package/dist/server/ws-unknown-types.js +0 -17
  385. package/docs/README.md +24 -17
  386. package/docs/architecture-plugins.md +37 -1
  387. package/docs/device-center.md +28 -2
  388. package/docs/device-desktop.md +3 -3
  389. package/docs/group-orchestration.md +142 -0
  390. package/docs/hub-upgrade-release-testing.md +46 -0
  391. package/extensions/webui.ts +3 -74
  392. package/package.json +7 -3
  393. package/plugin-sdk/README.md +6 -0
  394. package/plugin-sdk/client-utils.mjs +0 -7
  395. package/plugin-sdk/client.d.ts +0 -1
  396. package/plugin-sdk/client.mjs +1 -31
  397. package/plugin-sdk/import-check.mjs +4 -51
  398. package/plugin-sdk/index.d.ts +120 -119
  399. package/plugin-sdk/index.mjs +0 -6
  400. package/plugin-sdk/ssh-host-trust.mjs +0 -12
  401. package/plugin-sdk/testing.d.ts +0 -1
  402. package/plugin-sdk/testing.mjs +31 -86
  403. package/plugins/catalog.json +52 -4
  404. package/plugins/superagent/README.md +110 -0
  405. package/plugins/superagent/client/entry.mjs +21 -0
  406. package/plugins/superagent/index.mjs +8 -0
  407. package/plugins/superagent/main.mjs +218 -0
  408. package/plugins/superagent/manifest.json +15 -0
  409. package/plugins/superagent/server.mjs +572 -0
  410. package/plugins/superagent/style.css +167 -0
  411. package/themes/aetheris.css +1 -31
  412. package/themes/ayu-light.css +0 -1
  413. package/themes/bases/flow-base.css +2 -83
  414. package/themes/bases/obsidian-base.css +2 -37
  415. package/themes/bases/statusbar-flat-base.css +0 -1
  416. package/themes/bases/zhujian-base.css +0 -63
  417. package/themes/bases/zhupi-base.css +0 -64
  418. package/themes/catppuccin-latte.css +0 -1
  419. package/themes/catppuccin.css +0 -1
  420. package/themes/claude-code-dark.css +0 -1
  421. package/themes/codex.css +0 -1
  422. package/themes/dark-teal.css +22 -54
  423. package/themes/everforest-light.css +0 -1
  424. package/themes/flow-cristallo.css +1 -9
  425. package/themes/flow-ink.css +1 -10
  426. package/themes/flow-light.css +1 -10
  427. package/themes/flow-obsidian.css +1 -10
  428. package/themes/flow-zurich.css +1 -10
  429. package/themes/flow.css +1 -9
  430. package/themes/geist.css +0 -1
  431. package/themes/gruvbox-light.css +0 -1
  432. package/themes/kanagawa-lotus.css +0 -1
  433. package/themes/md-preview.css +1 -2
  434. package/themes/mist.css +0 -1
  435. package/themes/nord.css +0 -1
  436. package/themes/one-dark.css +0 -1
  437. package/themes/paper.css +0 -1
  438. package/themes/rose-pine-dawn.css +0 -1
  439. package/themes/sakura.css +0 -1
  440. package/themes/solarized-light.css +0 -1
  441. package/themes/tokyo-night.css +0 -1
  442. package/themes/translucent.css +4 -35
  443. package/themes/transparent.css +4 -41
  444. package/themes/vs-code-dark.css +0 -1
  445. package/themes/wallpaper-flow.css +3 -17
  446. package/themes/wallpaper-obsidian.css +1 -4
  447. package/themes/white.css +0 -1
  448. package/web/dist/.build-assets.json +1 -1
  449. package/web/dist/assets/{BgTasksModal-BjNRIUIc.js → BgTasksModal-D-x7kA63.js} +1 -1
  450. package/web/dist/assets/CanvasStudio-CAWcs9tm.js +1579 -0
  451. package/web/dist/assets/DeviceCenter-Dc0whRcu.js +3 -0
  452. package/web/dist/assets/DeviceExecutionSettings-BoX7-0h7.js +1 -0
  453. package/web/dist/assets/DeviceGroups-C_fZMNeK.js +1 -0
  454. package/web/dist/assets/{Dropdown-CQtstPGv.js → Dropdown-CTgVLUbp.js} +1 -1
  455. package/web/dist/assets/FilePreview-C6W0PvaK.js +2 -0
  456. package/web/dist/assets/GlobalSearchModal-HR9LSspC.js +1 -0
  457. package/web/dist/assets/GroupConversation-C81YjF2C.js +61 -0
  458. package/web/dist/assets/GroupWorkItems-BIvZtr10.js +1 -0
  459. package/web/dist/assets/{HintTip-ChTW8o1m.js → HintTip-Da6qc566.js} +1 -1
  460. package/web/dist/assets/ModelConfigModal-DhSyuIuV.js +2 -0
  461. package/web/dist/assets/NativeCliPanel-CU1rZmyu.js +5 -0
  462. package/web/dist/assets/{PiSetupModal-BX5rUuoI.js → PiSetupModal-DZKY5Wiw.js} +1 -1
  463. package/web/dist/assets/ProviderOAuthControls-CIL85nA7.js +1 -0
  464. package/web/dist/assets/{SCMPanel-DPAyY2sW.js → SCMPanel-CuEgzAlO.js} +2 -2
  465. package/web/dist/assets/SettingsModal-Cdu5h29p.js +33 -0
  466. package/web/dist/assets/TermXterm-Bt5WKAxP.js +3 -0
  467. package/web/dist/assets/TerminalPanel-BCIBV8se.js +1 -0
  468. package/web/dist/assets/TuiOverlayModal-3NDd9T97.js +1 -0
  469. package/web/dist/assets/app-globals-CZjFtI4F.js +129 -0
  470. package/web/dist/assets/canvas-client-WkhM55mR.js +1 -0
  471. package/web/dist/assets/composer-bridge-CImnjDHq.js +1 -0
  472. package/web/dist/assets/desktop-B8NZ3KW-.js +1 -0
  473. package/web/dist/assets/index-CQc3VrWa.css +1 -0
  474. package/web/dist/assets/index-D_AGu4Zv.js +404 -0
  475. package/web/dist/assets/plugin-host-uqZGpvCs.js +1 -0
  476. package/web/dist/assets/{remote-ssh-client-Dzi-eEyE.js → remote-ssh-client-Cdf-cTUe.js} +1 -1
  477. package/web/dist/assets/theme-DGL7hLUs.js +1 -0
  478. package/web/dist/index.html +11 -10
  479. package/web/dist/sw.js +15 -61
  480. package/web/public/sw.js +14 -60
  481. package/web/dist/assets/BgTasksModal-C0zuU8FE.js +0 -1
  482. package/web/dist/assets/CanvasStudio-BWvdmJ0M.js +0 -1579
  483. package/web/dist/assets/CanvasStudio-VQFjmTGq.js +0 -1579
  484. package/web/dist/assets/DeviceCenter-DI9_0aBB.js +0 -3
  485. package/web/dist/assets/DeviceCenter-DsNtXqzY.js +0 -3
  486. package/web/dist/assets/DeviceExecutionSettings-BLP1Su5G.js +0 -1
  487. package/web/dist/assets/DeviceGroups-2Pvk0Cds.js +0 -1
  488. package/web/dist/assets/DeviceGroups-CP7CcyPD.js +0 -1
  489. package/web/dist/assets/FilePreview-BMB2tNyT.js +0 -2
  490. package/web/dist/assets/FilePreview-RGFQUbJo.js +0 -2
  491. package/web/dist/assets/GlobalSearchModal-BM5wxiqU.js +0 -1
  492. package/web/dist/assets/GlobalSearchModal-DGv_WINq.js +0 -1
  493. package/web/dist/assets/GroupConversation-B7SnuXj1.js +0 -61
  494. package/web/dist/assets/GroupConversation-Dda69q-2.js +0 -61
  495. package/web/dist/assets/ModelConfigModal-C-0Z4hUZ.js +0 -2
  496. package/web/dist/assets/ModelConfigModal-yqeadyab.js +0 -2
  497. package/web/dist/assets/ProviderOAuthControls-DY4SCfXg.js +0 -1
  498. package/web/dist/assets/SCMPanel-C4KbQvvK.js +0 -2
  499. package/web/dist/assets/SettingsModal-DxZp6D_g.js +0 -32
  500. package/web/dist/assets/SettingsModal-WhQzaOPt.js +0 -32
  501. package/web/dist/assets/TerminalPanel-D4By_RVc.js +0 -3
  502. package/web/dist/assets/TerminalPanel-lZw8-i3j.js +0 -3
  503. package/web/dist/assets/TuiOverlayModal-C3pAVuC8.js +0 -1
  504. package/web/dist/assets/TuiOverlayModal-D7_rEXcJ.js +0 -1
  505. package/web/dist/assets/app-globals-KqOVtmp1.js +0 -123
  506. package/web/dist/assets/canvas-client-BY6ojmle.js +0 -1
  507. package/web/dist/assets/desktop-CV6KKp9R.js +0 -1
  508. package/web/dist/assets/index-BawF7ZP5.js +0 -397
  509. package/web/dist/assets/index-BoGCoq5X.js +0 -397
  510. package/web/dist/assets/index-CVW9FoY2.css +0 -1
  511. package/web/dist/assets/plugin-host-Dn8Dd6SC.js +0 -1
  512. package/web/dist/assets/theme-D_bihpdN.js +0 -1
@@ -0,0 +1,74 @@
1
+ export const ENGINE_CATALOG = {
2
+ pi: {
3
+ id: "pi",
4
+ name: "Pi",
5
+ packageName: "@earendil-works/pi-coding-agent",
6
+ installCommand: "npm i -g @earendil-works/pi-coding-agent",
7
+ cliCommand: "pi",
8
+ cliModelArgs: "provider-model",
9
+ cliRequiresArgs: false,
10
+ },
11
+ dsh: {
12
+ id: "dsh",
13
+ name: "DSH",
14
+ packageName: "@deepseek-ai/dsh",
15
+ installCommand: "npm i -g @deepseek-ai/dsh",
16
+ cliCommand: null,
17
+ cliModelArgs: null,
18
+ cliRequiresArgs: false,
19
+ },
20
+ claude: {
21
+ id: "claude",
22
+ name: "Claude Code",
23
+ packageName: "@anthropic-ai/claude-code",
24
+ installCommand: "npm i -g @anthropic-ai/claude-code",
25
+ cliCommand: "claude",
26
+ cliModelArgs: "model",
27
+ cliRequiresArgs: false,
28
+ },
29
+ codex: {
30
+ id: "codex",
31
+ name: "Codex",
32
+ packageName: "@openai/codex",
33
+ installCommand: "npm i -g @openai/codex",
34
+ cliCommand: "codex",
35
+ cliModelArgs: "model",
36
+ cliRequiresArgs: false,
37
+ },
38
+ agy: {
39
+ id: "agy",
40
+ name: "Antigravity",
41
+ packageName: null,
42
+ installCommand: "https://antigravity.google/docs/getting-started?tab=cli",
43
+ cliCommand: "agy",
44
+ cliModelArgs: "model",
45
+ cliRequiresArgs: false,
46
+ },
47
+ durable: {
48
+ id: "durable",
49
+ name: "Pi Durable",
50
+ packageName: "@earendil-works/pi-durable",
51
+ installCommand: "npm i -g @earendil-works/pi-durable",
52
+ cliCommand: null,
53
+ cliModelArgs: null,
54
+ cliRequiresArgs: false,
55
+ },
56
+ };
57
+ export function normalizeNativeCliInheritModel(value) {
58
+ if (!value || typeof value !== "object" || Array.isArray(value))
59
+ return {};
60
+ const result = {};
61
+ for (const engine of Object.values(ENGINE_CATALOG)) {
62
+ const enabled = value[engine.id];
63
+ if (engine.cliModelArgs && Object.hasOwn(value, engine.id) && typeof enabled === "boolean") {
64
+ result[engine.id] = enabled;
65
+ }
66
+ }
67
+ return result;
68
+ }
69
+ export function isNativeCliEngineId(value) {
70
+ return typeof value === "string" && Object.hasOwn(ENGINE_CATALOG, value);
71
+ }
72
+ export function isBuiltinEngineId(value) {
73
+ return isNativeCliEngineId(value) && ENGINE_CATALOG[value].packageName !== null;
74
+ }
@@ -0,0 +1,89 @@
1
+ import { execFile } from "node:child_process";
2
+ import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
3
+ import { posix, resolve, win32 } from "node:path";
4
+ import { ENGINE_CATALOG } from "./engine-catalog.js";
5
+ import { probeGlobalPackage } from "./global-loader.js";
6
+ import { findNativeCliExecutable } from "./native-cli-discovery.js";
7
+ function unwrapExecutable(file, args, options) {
8
+ const windows = (options.platform ?? process.platform) === "win32";
9
+ if (!windows) {
10
+ const script = realpathSync(file);
11
+ if (/\.[cm]?js$/i.test(script)) {
12
+ const node = findNativeCliExecutable(posix.join(posix.dirname(file), "node"), options);
13
+ return { file: node ?? options.nodeExecutable ?? process.execPath, args: [script, ...args] };
14
+ }
15
+ return { file, args: [...args] };
16
+ }
17
+ const extension = win32.extname(file).toLowerCase();
18
+ if (extension === ".exe" || extension === ".com")
19
+ return { file, args: [...args] };
20
+ if (/^\.[cm]?js$/.test(extension))
21
+ return { file: options.nodeExecutable ?? process.execPath, args: [file, ...args] };
22
+ if (extension !== ".cmd")
23
+ throw new Error("CLI requires an executable or an npm .cmd shim on Windows");
24
+ if (statSync(file).size > 64 * 1024)
25
+ throw new Error("CLI npm shim is too large");
26
+ const shim = readFileSync(file, "utf8");
27
+ const nodeTarget = /^\s*(?:endLocal\s*&\s*goto\s+#_undefined_#\s+2>NUL\s*\|\|\s*title\s+%COMSPEC%\s*&\s*)?(?:"%_prog%"|"%dp0%[\\/]node\.exe"|node(?:\.exe)?)\s+"%dp0%[\\/]([^"\r\n]+)"\s+%\*\s*$/im.exec(shim)?.[1];
28
+ const nativeTarget = /^\s*"%dp0%[\\/]([^"\r\n]+\.(?:exe|com))"\s+%\*\s*$/im.exec(shim)?.[1];
29
+ const target = nodeTarget ?? nativeTarget;
30
+ if (!target || (nodeTarget && !/\.(?:[cm]?js)$/i.test(nodeTarget)) || /[%\x00-\x1f]/.test(target))
31
+ throw new Error("Unsupported CLI .cmd shim; configure its executable directly");
32
+ const entryPoint = win32.resolve(win32.dirname(file), target);
33
+ if (!statSync(entryPoint).isFile())
34
+ throw new Error("CLI npm entry point is not a file");
35
+ if (!nodeTarget)
36
+ return { file: entryPoint, args: [...args] };
37
+ const localNode = win32.join(win32.dirname(file), "node.exe");
38
+ return {
39
+ file: existsSync(localNode) ? localNode : (options.nodeExecutable ?? process.execPath),
40
+ args: [entryPoint, ...args],
41
+ };
42
+ }
43
+ export function resolveCliExecutableLaunch(executable, args = [], options = {}) {
44
+ if ((options.platform ?? process.platform) !== "win32" && !options.autoDetect)
45
+ return { file: executable, args: [...args] };
46
+ const file = findNativeCliExecutable(executable, options);
47
+ if (!file)
48
+ throw new Error(`CLI executable not found: ${executable}`);
49
+ return unwrapExecutable(file, args, options);
50
+ }
51
+ /** PATH/native installs first, then the same global package resolver used by engine detection. */
52
+ export function resolveEngineCliLaunch(id, options = {}) {
53
+ const meta = ENGINE_CATALOG[id];
54
+ if (!meta.cliCommand)
55
+ throw new Error(`${meta.name} has no standalone CLI`);
56
+ const args = options.args ?? [];
57
+ if (options.executablePath)
58
+ return resolveCliExecutableLaunch(options.executablePath, args, { ...options, autoDetect: false });
59
+ const file = findNativeCliExecutable(meta.cliCommand, { ...options, autoDetect: true });
60
+ if (file)
61
+ return unwrapExecutable(file, args, options);
62
+ const pkg = meta.packageName ? probeGlobalPackage(meta.packageName, { refresh: options.refresh }) : undefined;
63
+ if (pkg?.packagePath) {
64
+ try {
65
+ const manifest = JSON.parse(readFileSync(resolve(pkg.packagePath, "package.json"), "utf8"));
66
+ const bin = typeof manifest.bin === "string" ? manifest.bin : manifest.bin?.[meta.cliCommand];
67
+ if (typeof bin === "string") {
68
+ const entry = resolve(pkg.packagePath, bin);
69
+ if (statSync(entry).isFile())
70
+ return unwrapExecutable(entry, args, options);
71
+ }
72
+ }
73
+ catch { }
74
+ }
75
+ throw new Error(`${meta.name} CLI executable not found. Install it on the machine running pi-web-ui (${meta.installCommand}) or select Custom and configure its executable path.`);
76
+ }
77
+ export async function probeEngineCliVersion(id, executablePath) {
78
+ try {
79
+ const launch = resolveEngineCliLaunch(id, { executablePath, args: ["--version"] });
80
+ return await new Promise((done) => {
81
+ execFile(launch.file, launch.args, { timeout: 4000, windowsHide: true, maxBuffer: 8192 }, (error, stdout) => {
82
+ done(error ? { available: false, error: error.message } : { available: true, version: stdout.trim() || undefined });
83
+ });
84
+ });
85
+ }
86
+ catch (error) {
87
+ return { available: false, error: error instanceof Error ? error.message : String(error) };
88
+ }
89
+ }
@@ -1,4 +1,4 @@
1
- import { execFile, spawn } from "node:child_process";
1
+ import { spawn } from "node:child_process";
2
2
  import { existsSync, readFileSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { VERSION } from "@earendil-works/pi-coding-agent";
@@ -8,86 +8,28 @@ import { probeClaudeCode } from "./universal/drivers/claude-code.js";
8
8
  import { probeCodex } from "./universal/drivers/codex.js";
9
9
  import { compareVersions, defaultFetcher, fetchLatest, NPM_DEFAULT_REGISTRY, } from "./update-check.js";
10
10
  import { probeGlobalPackage } from "./global-loader.js";
11
- export const ENGINE_PACKAGES = {
12
- pi: {
13
- id: "pi",
14
- packageName: "@earendil-works/pi-coding-agent",
15
- installCommand: "npm i -g @earendil-works/pi-coding-agent",
16
- },
17
- dsh: {
18
- id: "dsh",
19
- packageName: "@deepseek-ai/dsh",
20
- installCommand: "npm i -g @deepseek-ai/dsh",
21
- },
22
- claude: {
23
- id: "claude",
24
- packageName: "@anthropic-ai/claude-code",
25
- installCommand: "npm i -g @anthropic-ai/claude-code",
26
- },
27
- codex: {
28
- id: "codex",
29
- packageName: "@openai/codex",
30
- installCommand: "npm i -g @openai/codex",
31
- },
32
- durable: {
33
- id: "durable",
34
- packageName: "@earendil-works/pi-durable",
35
- installCommand: "npm i -g @earendil-works/pi-durable",
36
- },
37
- };
38
- /** 探针缓存 TTL:5 秒(短时多次连接或 UI 打开时免除重复频繁执行进程调用) */
11
+ import { ENGINE_CATALOG } from "./engine-catalog.js";
12
+ import { probeEngineCliVersion } from "./engine-cli.js";
13
+ export const ENGINE_PACKAGES = Object.fromEntries(Object.values(ENGINE_CATALOG)
14
+ .filter((engine) => engine.packageName !== null)
15
+ .map((engine) => [engine.id, engine]));
39
16
  const CACHE_TTL_MS = 5000;
40
- /** 远端 npm registry 查询缓存:5 分钟 */
41
17
  const REGISTRY_CACHE_TTL_MS = 5 * 60 * 1000;
42
18
  const registryCache = new Map();
43
- /** 引擎状态原子字典:单一事实源,收敛 status / probedAt / updating / uninstalling,杜绝独立状态撕裂 */
44
- const engineRegistry = new Map([
45
- [
46
- "pi",
47
- {
48
- status: { id: "pi", installed: true, packageName: ENGINE_PACKAGES.pi.packageName, version: VERSION },
49
- probedAt: 0,
50
- updating: false,
51
- uninstalling: false,
19
+ const engineRegistry = new Map(Object.values(ENGINE_PACKAGES).map((engine) => [
20
+ engine.id,
21
+ {
22
+ status: {
23
+ id: engine.id,
24
+ installed: engine.id === "pi",
25
+ packageName: engine.packageName,
26
+ ...(engine.id === "pi" ? { version: VERSION } : {}),
52
27
  },
53
- ],
54
- [
55
- "dsh",
56
- {
57
- status: { id: "dsh", installed: false, packageName: ENGINE_PACKAGES.dsh.packageName },
58
- probedAt: 0,
59
- updating: false,
60
- uninstalling: false,
61
- },
62
- ],
63
- [
64
- "claude",
65
- {
66
- status: { id: "claude", installed: false, packageName: ENGINE_PACKAGES.claude.packageName },
67
- probedAt: 0,
68
- updating: false,
69
- uninstalling: false,
70
- },
71
- ],
72
- [
73
- "codex",
74
- {
75
- status: { id: "codex", installed: false, packageName: ENGINE_PACKAGES.codex.packageName },
76
- probedAt: 0,
77
- updating: false,
78
- uninstalling: false,
79
- },
80
- ],
81
- [
82
- "durable",
83
- {
84
- status: { id: "durable", installed: false, packageName: ENGINE_PACKAGES.durable.packageName },
85
- probedAt: 0,
86
- updating: false,
87
- uninstalling: false,
88
- },
89
- ],
90
- ]);
28
+ probedAt: 0,
29
+ updating: false,
30
+ uninstalling: false,
31
+ },
32
+ ]));
91
33
  function toPublicStatus(entry) {
92
34
  return {
93
35
  ...entry.status,
@@ -95,9 +37,6 @@ function toPublicStatus(entry) {
95
37
  ...(entry.uninstalling ? { uninstalling: true } : {}),
96
38
  };
97
39
  }
98
- /**
99
- * 查询全局包在 npm 远端的最新版本号(带 5 分钟缓存)。
100
- */
101
40
  export async function checkPackageLatest(packageName, force = false) {
102
41
  const now = Date.now();
103
42
  const cached = registryCache.get(packageName);
@@ -113,9 +52,6 @@ export async function checkPackageLatest(packageName, force = false) {
113
52
  return cached?.latest ?? null;
114
53
  }
115
54
  }
116
- /**
117
- * 为已安装的引擎注入 npm 远端更新检测结果(latestVersion 与 hasUpdate 标记)。
118
- */
119
55
  export async function enrichWithUpdateInfo(status, force = false) {
120
56
  if (!status.installed || !status.packageName || !status.version) {
121
57
  return status;
@@ -127,14 +63,9 @@ export async function enrichWithUpdateInfo(status, force = false) {
127
63
  status.hasUpdate = compareVersions(latest, status.version) > 0;
128
64
  }
129
65
  }
130
- catch {
131
- /* best effort */
132
- }
66
+ catch { }
133
67
  return status;
134
68
  }
135
- /**
136
- * 探测 Pi 原生引擎状态(作为内置/捆绑引擎恒存在)。
137
- */
138
69
  export function probePi() {
139
70
  return {
140
71
  id: "pi",
@@ -143,29 +74,19 @@ export function probePi() {
143
74
  version: VERSION,
144
75
  };
145
76
  }
146
- /**
147
- * 快速探测 DSH 引擎全局包/运行时树是否已安装。
148
- * 1. 优先检查常见全局 node_modules / 候选路径中的 @deepseek-ai/dsh package.json 与 dsh-base;
149
- * 2. 回退通过命令行探针执行 `dsh --version`。
150
- */
151
77
  export async function probeDsh(force = false) {
152
78
  const pkgName = ENGINE_PACKAGES.dsh.packageName;
153
- // 0. 通用全局包探测器(覆盖 fnm / nvm / pnpm / 全局 prefix 等)
154
79
  try {
155
80
  const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
156
81
  if (globalProbe.installed) {
157
82
  return { id: "dsh", installed: true, packageName: pkgName, version: globalProbe.version };
158
83
  }
159
84
  }
160
- catch {
161
- /* ignore */
162
- }
163
- // 1. 路径快速探测(纯 fs 访问,无进程派生开销)
85
+ catch { }
164
86
  try {
165
87
  for (const root of runtimeBaseCandidates()) {
166
88
  if (!root)
167
89
  continue;
168
- // A. 直接在全局或候选 node_modules 中找到 @deepseek-ai/dsh 包目录
169
90
  const dshPkgJson = join(root, "@deepseek-ai", "dsh", "package.json");
170
91
  if (existsSync(dshPkgJson)) {
171
92
  try {
@@ -176,13 +97,11 @@ export async function probeDsh(force = false) {
176
97
  return { id: "dsh", installed: true, packageName: pkgName };
177
98
  }
178
99
  }
179
- // B. 检查平铺运行树(@deepseek-ai/dsh-base)
180
100
  const flatBase = join(root, "@deepseek-ai", "dsh-base", "cordis.patch.yml");
181
101
  const flatBoot = join(root, "@deepseek-ai", "dsh-app-boot", "lib", "index.js");
182
102
  if (existsSync(flatBase) && existsSync(flatBoot)) {
183
103
  return { id: "dsh", installed: true, packageName: pkgName };
184
104
  }
185
- // C. 检查嵌套运行树(@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-base)
186
105
  const nestedBase = join(root, "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-base", "cordis.patch.yml");
187
106
  const nestedBoot = join(root, "@deepseek-ai", "dsh", "node_modules", "@deepseek-ai", "dsh-app-boot", "lib", "index.js");
188
107
  if (existsSync(nestedBase) && existsSync(nestedBoot)) {
@@ -190,42 +109,12 @@ export async function probeDsh(force = false) {
190
109
  }
191
110
  }
192
111
  }
193
- catch {
194
- /* ignore fs errors */
195
- }
196
- // 2. 命令行回退探测(检查 PATH 中是否有可用的 dsh CLI)
197
- try {
198
- const cliProbe = await new Promise((resolve) => {
199
- execFile("dsh", ["--version"], {
200
- timeout: 3000,
201
- shell: process.platform === "win32",
202
- }, (err, stdout) => {
203
- if (err) {
204
- resolve({ installed: false });
205
- }
206
- else {
207
- const v = stdout.trim();
208
- resolve({ installed: true, version: v || undefined });
209
- }
210
- });
211
- });
212
- if (cliProbe.installed) {
213
- return {
214
- id: "dsh",
215
- installed: true,
216
- packageName: pkgName,
217
- version: cliProbe.version,
218
- };
219
- }
220
- }
221
- catch {
222
- /* ignore cli error */
223
- }
112
+ catch { }
113
+ const cliProbe = await probeEngineCliVersion("dsh");
114
+ if (cliProbe.available)
115
+ return { id: "dsh", installed: true, packageName: pkgName, version: cliProbe.version };
224
116
  return { id: "dsh", installed: false, packageName: pkgName };
225
117
  }
226
- /**
227
- * 探测 Claude Code 引擎状态。
228
- */
229
118
  export async function probeClaude(force = false) {
230
119
  const pkgName = ENGINE_PACKAGES.claude.packageName;
231
120
  try {
@@ -239,11 +128,7 @@ export async function probeClaude(force = false) {
239
128
  };
240
129
  }
241
130
  }
242
- catch {
243
- /* ignore */
244
- }
245
- // 降级兜底:某些环境(如 fnm/nvm 目录未生成直接软链,或全局通过 npm 安装了包但 postinstall 尚未就绪)
246
- // 尝试通过全局包管理器探测是否已安装该包
131
+ catch { }
247
132
  try {
248
133
  const globalProbe = probeGlobalPackage(pkgName, { refresh: force });
249
134
  if (globalProbe.installed) {
@@ -255,15 +140,9 @@ export async function probeClaude(force = false) {
255
140
  };
256
141
  }
257
142
  }
258
- catch {
259
- /* ignore */
260
- }
143
+ catch { }
261
144
  return { id: "claude", installed: false, packageName: pkgName };
262
145
  }
263
- /**
264
- * 探测 Pi Durable 引擎状态。
265
- * 检查当前项目或全局环境(npm -g, fnm, nvm 等)下是否安装了 @earendil-works/pi-durable。
266
- */
267
146
  export async function probeDurable(force = false) {
268
147
  const pkgName = ENGINE_PACKAGES.durable.packageName;
269
148
  try {
@@ -277,23 +156,19 @@ export async function probeDurable(force = false) {
277
156
  };
278
157
  }
279
158
  }
280
- catch {
281
- /* ignore */
282
- }
159
+ catch { }
283
160
  return { id: "durable", installed: false, packageName: pkgName };
284
161
  }
285
- /**
286
- * 按引擎 ID 单独探测状态。
287
- */
288
162
  export async function probeEngine(id, force = false) {
289
- if (id === "pi")
290
- return probePi();
291
163
  const entry = engineRegistry.get(id);
292
164
  if (!force && entry && entry.probedAt > 0 && Date.now() - entry.probedAt < CACHE_TTL_MS) {
293
165
  return toPublicStatus(entry);
294
166
  }
295
167
  let result;
296
- if (id === "dsh") {
168
+ if (id === "pi") {
169
+ result = probePi();
170
+ }
171
+ else if (id === "dsh") {
297
172
  result = await probeDsh(force);
298
173
  }
299
174
  else if (id === "claude") {
@@ -324,9 +199,6 @@ export async function probeEngine(id, force = false) {
324
199
  engineRegistry.set(id, updatedEntry);
325
200
  return toPublicStatus(updatedEntry);
326
201
  }
327
- /**
328
- * 探测全部已知引擎并返回最新状态列表(带 TTL 缓存防抖)。
329
- */
330
202
  export async function probeAllEngines(force = false) {
331
203
  const now = Date.now();
332
204
  const entries = Array.from(engineRegistry.values());
@@ -334,59 +206,18 @@ export async function probeAllEngines(force = false) {
334
206
  if (!force && allFresh && entries.length > 0) {
335
207
  return entries.map(toPublicStatus);
336
208
  }
337
- const [pi, dsh, claude, durable, codex] = await Promise.all([
338
- probePi(),
339
- probeDsh(force),
340
- probeClaude(force),
341
- probeDurable(force),
342
- probeCodex().then((probe) => ({
343
- id: "codex",
344
- installed: probe.available,
345
- version: probe.version,
346
- packageName: ENGINE_PACKAGES.codex.packageName,
347
- })),
348
- ]);
349
- await Promise.all([
350
- enrichWithUpdateInfo(pi, force),
351
- enrichWithUpdateInfo(dsh, force),
352
- enrichWithUpdateInfo(claude, force),
353
- enrichWithUpdateInfo(durable, force),
354
- enrichWithUpdateInfo(codex, force),
355
- ]);
356
- const timestamp = Date.now();
357
- const results = [pi, dsh, claude, durable, codex];
358
- for (const res of results) {
359
- const existing = engineRegistry.get(res.id);
360
- engineRegistry.set(res.id, {
361
- status: res,
362
- probedAt: timestamp,
363
- updating: existing?.updating ?? false,
364
- uninstalling: existing?.uninstalling ?? false,
365
- });
366
- }
209
+ await Promise.all(Object.keys(ENGINE_PACKAGES).map((id) => probeEngine(id, force)));
367
210
  return Array.from(engineRegistry.values()).map(toPublicStatus);
368
211
  }
369
- /**
370
- * 同步获取当前缓存的引擎探测结果(握手帧或即时读取使用)。
371
- */
372
212
  export function getCachedEngineStatuses() {
373
213
  return Array.from(engineRegistry.values()).map(toPublicStatus);
374
214
  }
375
- /**
376
- * 查询指定引擎是否正在执行后台更新子进程。
377
- */
378
215
  export function isEngineUpdating(engineId) {
379
216
  return engineRegistry.get(engineId)?.updating ?? false;
380
217
  }
381
- /**
382
- * 查询指定引擎是否正在执行后台卸载子进程。
383
- */
384
218
  export function isEngineUninstalling(engineId) {
385
219
  return engineRegistry.get(engineId)?.uninstalling ?? false;
386
220
  }
387
- /**
388
- * 在后台子进程中执行引擎全局包卸载(npm uninstall -g <pkg>)。
389
- */
390
221
  export async function uninstallEngineBackground(engineId, options) {
391
222
  if (engineId === "pi") {
392
223
  return { ok: false, error: "Pi 为内置核心引擎,不支持卸载" };
@@ -459,9 +290,7 @@ export async function uninstallEngineBackground(engineId, options) {
459
290
  try {
460
291
  await probeAllEngines(true);
461
292
  }
462
- catch {
463
- /* best effort */
464
- }
293
+ catch { }
465
294
  }
466
295
  return {
467
296
  ok: res.ok,
@@ -481,10 +310,6 @@ export async function uninstallEngineBackground(engineId, options) {
481
310
  finalEntry.uninstalling = false;
482
311
  }
483
312
  }
484
- /**
485
- * 在后台子进程中执行引擎全局包更新(npm i -g <pkg>@latest)。
486
- * 避免在可见终端中通过 PTY 模拟输入导致命令首字母丢失或输入不全的问题。
487
- */
488
313
  export async function updateEngineBackground(engineId, options) {
489
314
  const meta = ENGINE_PACKAGES[engineId];
490
315
  if (!meta || !meta.packageName) {
@@ -551,9 +376,7 @@ export async function updateEngineBackground(engineId, options) {
551
376
  try {
552
377
  await probeAllEngines(true);
553
378
  }
554
- catch {
555
- /* best effort */
556
- }
379
+ catch { }
557
380
  }
558
381
  return {
559
382
  ok: res.ok,
@@ -573,14 +396,10 @@ export async function updateEngineBackground(engineId, options) {
573
396
  finalEntry.updating = false;
574
397
  }
575
398
  }
576
- /**
577
- * 收集已安装的第三方全局引擎包,供全量更新检查(check_updates_all)纳入统一检查名录。
578
- */
579
399
  export function collectInstalledEngineTargets() {
580
400
  const out = [];
581
401
  for (const entry of engineRegistry.values()) {
582
402
  const status = entry.status;
583
- // pi-core 在 collectTargets 中已有独立专属条目(PI_CORE_PACKAGE),此处收纳其他已安装引擎全局包
584
403
  if (status.id !== "pi" && status.installed && status.packageName && status.version) {
585
404
  out.push({
586
405
  name: status.packageName,
@@ -591,5 +410,4 @@ export function collectInstalledEngineTargets() {
591
410
  }
592
411
  return out;
593
412
  }
594
- // 模块加载时预热后台探测
595
413
  void probeAllEngines(true).catch(() => { });
@@ -1,35 +1,16 @@
1
- /**
2
- * Lightweight bash fallback for Windows.
3
- *
4
- * When neither Git Bash nor a bash on PATH exists, download busybox-w32
5
- * (single self-contained ~1.5MB exe, no installer) into <home>/.pi-web/bin/
6
- * and expose it as bash.exe — busybox dispatches on argv[0], so `bash.exe`
7
- * runs its bash (ash) applet. The terminal panel (terminals.ts) and the SDK
8
- * bash tool (via PATH) then both resolve to it, so the agent never silently
9
- * falls back to cmd/PowerShell syntax on a bare Windows box.
10
- *
11
- * Download is fire-and-forget at server start and never throws: on failure
12
- * the terminal simply falls back to $COMSPEC (cmd.exe) as before.
13
- */
14
1
  import { copyFileSync, existsSync, mkdirSync } from "node:fs";
15
2
  import { homedir } from "node:os";
16
3
  import { join } from "node:path";
17
4
  import { writeAtomicSync } from "./atomic-file.js";
18
- /** Official busybox-w32 64-bit Unicode build (Win10 1903+ / Win11). */
19
5
  const BUSYBOX_URL = "https://frippery.org/files/busybox/busybox64u.exe";
20
- /** busybox.exe is ~660KB; anything far smaller is an error page, not a binary. */
21
6
  const MIN_SIZE = 500_000;
22
- /** Download cap — a stalled connection must not block startup forever. */
23
7
  const DOWNLOAD_TIMEOUT_MS = 60_000;
24
- /** Directory holding the busybox fallback (shared with terminals.ts / PATH). */
25
8
  export function windowsBashDir() {
26
9
  return join(homedir(), ".pi-web", "bin");
27
10
  }
28
- /** bash.exe (busybox bash applet) used by the terminal and the SDK bash tool. */
29
11
  export function windowsBashPath() {
30
12
  return join(windowsBashDir(), "bash.exe");
31
13
  }
32
- /** True when a standard Git Bash install exists (SDK's preferred shell). */
33
14
  export function hasGitBash() {
34
15
  const pf = process.env.ProgramFiles;
35
16
  const pf86 = process.env["ProgramFiles(x86)"];
@@ -44,13 +25,6 @@ export function hasGitBash() {
44
25
  }
45
26
  return false;
46
27
  }
47
- /**
48
- * Ensure a bash.exe exists on Windows. No-op when Git Bash is already
49
- * installed (it is strictly preferred) or the fallback is already present.
50
- * Never throws — failures degrade silently to the previous behaviour.
51
- *
52
- * @returns the bash.exe path when ready, null otherwise.
53
- */
54
28
  export async function ensureWindowsBash() {
55
29
  if (process.platform !== "win32")
56
30
  return null;
@@ -58,7 +32,7 @@ export async function ensureWindowsBash() {
58
32
  if (existsSync(target))
59
33
  return target;
60
34
  if (hasGitBash())
61
- return null; // Git Bash preferred — nothing to install.
35
+ return null;
62
36
  const dir = windowsBashDir();
63
37
  mkdirSync(dir, { recursive: true });
64
38
  try {
@@ -69,7 +43,7 @@ export async function ensureWindowsBash() {
69
43
  return null;
70
44
  const buf = Buffer.from(await res.arrayBuffer());
71
45
  if (buf.length < MIN_SIZE)
72
- return null; // error/HTML page, not the exe.
46
+ return null;
73
47
  writeAtomicSync(join(dir, "busybox.exe"), buf);
74
48
  copyFileSync(join(dir, "busybox.exe"), target);
75
49
  return target;