pop-agent 0.0.0-stage → 0.1.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 (375) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +620 -2
  3. package/README.zh.md +622 -0
  4. package/dist/server/approval/read-only.js +107 -0
  5. package/dist/server/approval/rules.js +73 -0
  6. package/dist/server/approval/scope.js +164 -0
  7. package/dist/server/approval/unattended.js +25 -0
  8. package/dist/server/asr/bridge.js +244 -0
  9. package/dist/server/asr/install.js +188 -0
  10. package/dist/server/asr/paths.js +101 -0
  11. package/dist/server/asr/routes.js +62 -0
  12. package/dist/server/brand.js +2 -0
  13. package/dist/server/cli-config.js +65 -0
  14. package/dist/server/cli-info.js +169 -0
  15. package/dist/server/cli.js +602 -0
  16. package/dist/server/computer/apps.js +152 -0
  17. package/dist/server/computer/cli.js +322 -0
  18. package/dist/server/computer/framing.js +36 -0
  19. package/dist/server/computer/helper-client.js +268 -0
  20. package/dist/server/computer/paths.js +114 -0
  21. package/dist/server/computer/routes.js +118 -0
  22. package/dist/server/computer/settings.js +169 -0
  23. package/dist/server/computer/skill.js +131 -0
  24. package/dist/server/computer/status.js +134 -0
  25. package/dist/server/cron/agent-run.js +121 -0
  26. package/dist/server/cron/index.js +539 -0
  27. package/dist/server/cron/tool.js +155 -0
  28. package/dist/server/engine/builtin.js +180 -0
  29. package/dist/server/engine/catalog-probe.js +34 -0
  30. package/dist/server/engine/catalog.js +8 -0
  31. package/dist/server/engine/claude-map.js +297 -0
  32. package/dist/server/engine/claude-sessions.js +581 -0
  33. package/dist/server/engine/claude-transport.js +75 -0
  34. package/dist/server/engine/claude.js +414 -0
  35. package/dist/server/engine/cli-version.js +119 -0
  36. package/dist/server/engine/codex-approvals.js +45 -0
  37. package/dist/server/engine/codex-map.js +298 -0
  38. package/dist/server/engine/codex-sessions.js +159 -0
  39. package/dist/server/engine/codex-subagents.js +349 -0
  40. package/dist/server/engine/codex-transport.js +49 -0
  41. package/dist/server/engine/codex.js +530 -0
  42. package/dist/server/engine/dsh-history.js +195 -0
  43. package/dist/server/engine/dsh-log.js +256 -0
  44. package/dist/server/engine/dsh-map.js +223 -0
  45. package/dist/server/engine/dsh-prompt-patch.js +48 -0
  46. package/dist/server/engine/dsh-sessions.js +206 -0
  47. package/dist/server/engine/dsh-transport.js +37 -0
  48. package/dist/server/engine/dsh.js +329 -0
  49. package/dist/server/engine/engine-install.js +182 -0
  50. package/dist/server/engine/engine-routes.js +54 -0
  51. package/dist/server/engine/engine-specs.js +65 -0
  52. package/dist/server/engine/engine-versions.js +41 -0
  53. package/dist/server/engine/export-html-tree-patch.js +89 -0
  54. package/dist/server/engine/fake.js +263 -0
  55. package/dist/server/engine/jsonrpc-stdio.js +275 -0
  56. package/dist/server/engine/model-registry-reload.js +115 -0
  57. package/dist/server/engine/narrate-guidance.js +25 -0
  58. package/dist/server/engine/opencode-map.js +500 -0
  59. package/dist/server/engine/opencode-projects.js +61 -0
  60. package/dist/server/engine/opencode-sessions.js +201 -0
  61. package/dist/server/engine/opencode-transport.js +48 -0
  62. package/dist/server/engine/opencode.js +434 -0
  63. package/dist/server/engine/pi-appearance-tool.js +101 -0
  64. package/dist/server/engine/pi-canvas-tool.js +181 -0
  65. package/dist/server/engine/pi-cron-tool.js +196 -0
  66. package/dist/server/engine/pi-events.js +153 -0
  67. package/dist/server/engine/pi-plugins.js +312 -0
  68. package/dist/server/engine/pi-rename.js +14 -0
  69. package/dist/server/engine/pi-retry.js +124 -0
  70. package/dist/server/engine/pi-sdk.js +1272 -0
  71. package/dist/server/engine/pi-session-model.js +23 -0
  72. package/dist/server/engine/pi-stop.js +28 -0
  73. package/dist/server/engine/pi-subagent-tool.js +188 -0
  74. package/dist/server/engine/pi-subagents.js +445 -0
  75. package/dist/server/engine/pi-thinking.js +34 -0
  76. package/dist/server/engine/pi-transcript.js +247 -0
  77. package/dist/server/engine/pi-turn-outcome.js +25 -0
  78. package/dist/server/engine/pi-version.js +11 -0
  79. package/dist/server/engine/port.js +1 -0
  80. package/dist/server/engine/registry.js +61 -0
  81. package/dist/server/engine/resource-signature.js +55 -0
  82. package/dist/server/engine/scratch.js +13 -0
  83. package/dist/server/engine/subagent-guidance.js +22 -0
  84. package/dist/server/engine/suggestion-guidance.js +24 -0
  85. package/dist/server/engine/switchable.js +22 -0
  86. package/dist/server/engine/wiring.js +225 -0
  87. package/dist/server/files/content-search.js +187 -0
  88. package/dist/server/files/dir-routes.js +104 -0
  89. package/dist/server/files/file-search.js +64 -0
  90. package/dist/server/files/file-service.js +286 -0
  91. package/dist/server/files/files-routes.js +278 -0
  92. package/dist/server/files/git-info.js +428 -0
  93. package/dist/server/files/path-resolve.js +176 -0
  94. package/dist/server/files/pick-path-routes.js +162 -0
  95. package/dist/server/http/auth-routes.js +454 -0
  96. package/dist/server/http/auth.js +306 -0
  97. package/dist/server/http/aux-routes.js +98 -0
  98. package/dist/server/http/client-log-routes.js +49 -0
  99. package/dist/server/http/compress.js +102 -0
  100. package/dist/server/http/file-headers.js +75 -0
  101. package/dist/server/http/health-and-static.js +46 -0
  102. package/dist/server/http/live-routes.js +116 -0
  103. package/dist/server/http/login-activity.js +76 -0
  104. package/dist/server/http/login-guard.js +185 -0
  105. package/dist/server/http/login-page.js +347 -0
  106. package/dist/server/http/password-store.js +88 -0
  107. package/dist/server/http/voice-settings-routes.js +30 -0
  108. package/dist/server/http/ws-routes.js +141 -0
  109. package/dist/server/index.js +1085 -0
  110. package/dist/server/markers/actions.js +281 -0
  111. package/dist/server/mcp/codex-mcp-store.js +190 -0
  112. package/dist/server/mcp/json-mcp-store.js +276 -0
  113. package/dist/server/mcp/mcp-auth.js +194 -0
  114. package/dist/server/mcp/mcp-command.js +137 -0
  115. package/dist/server/mcp/mcp-engine-shared.js +112 -0
  116. package/dist/server/mcp/mcp-import.js +289 -0
  117. package/dist/server/mcp/mcp-market-sources.js +192 -0
  118. package/dist/server/mcp/mcp-market-types.js +5 -0
  119. package/dist/server/mcp/mcp-market.js +174 -0
  120. package/dist/server/mcp/mcp-probe.js +170 -0
  121. package/dist/server/mcp/mcp-routes.js +71 -0
  122. package/dist/server/mcp/mcp-store.js +286 -0
  123. package/dist/server/mcp/none-mcp-store.js +27 -0
  124. package/dist/server/mcp/pi-mcp-config.js +308 -0
  125. package/dist/server/pi-gate.js +106 -0
  126. package/dist/server/plugins/engine-plugin-stores.js +265 -0
  127. package/dist/server/plugins/plugin-routes.js +22 -0
  128. package/dist/server/protocol-parse.js +533 -0
  129. package/dist/server/protocol-settings.js +1 -0
  130. package/dist/server/protocol.js +8 -0
  131. package/dist/server/providers/catalog-store.js +89 -0
  132. package/dist/server/providers/catalog-writes.js +199 -0
  133. package/dist/server/providers/catalog.js +77 -0
  134. package/dist/server/providers/codex-models.js +96 -0
  135. package/dist/server/providers/codex-test.js +124 -0
  136. package/dist/server/providers/enabled-models.js +110 -0
  137. package/dist/server/providers/import-models.js +69 -0
  138. package/dist/server/providers/import-routes.js +266 -0
  139. package/dist/server/providers/model-kind.js +35 -0
  140. package/dist/server/providers/model-test.js +113 -0
  141. package/dist/server/providers/one-shot.js +218 -0
  142. package/dist/server/providers/probe-routes.js +26 -0
  143. package/dist/server/providers/probe.js +84 -0
  144. package/dist/server/providers/provider-handlers.js +240 -0
  145. package/dist/server/providers/provider-pool.js +63 -0
  146. package/dist/server/providers/provider-store.js +502 -0
  147. package/dist/server/providers/request-headers.js +7 -0
  148. package/dist/server/providers/subscription-routes.js +183 -0
  149. package/dist/server/providers/validate.js +249 -0
  150. package/dist/server/push/push-routes.js +171 -0
  151. package/dist/server/push/push.js +239 -0
  152. package/dist/server/push/vapid-config.js +179 -0
  153. package/dist/server/session/appearance.js +79 -0
  154. package/dist/server/session/approval-bridge.js +119 -0
  155. package/dist/server/session/attachment-resolve.js +21 -0
  156. package/dist/server/session/canvas-artifacts.js +108 -0
  157. package/dist/server/session/canvas-store.js +137 -0
  158. package/dist/server/session/canvas-suggest.js +70 -0
  159. package/dist/server/session/canvas.js +323 -0
  160. package/dist/server/session/client-view.js +82 -0
  161. package/dist/server/session/close-ephemeral.js +23 -0
  162. package/dist/server/session/conversation-create.js +87 -0
  163. package/dist/server/session/cron-prompt-routes.js +25 -0
  164. package/dist/server/session/cron-prompt.js +59 -0
  165. package/dist/server/session/delete-session.js +125 -0
  166. package/dist/server/session/engine-switch.js +118 -0
  167. package/dist/server/session/fork-session.js +38 -0
  168. package/dist/server/session/lock.js +82 -0
  169. package/dist/server/session/model-controller.js +149 -0
  170. package/dist/server/session/move-session.js +40 -0
  171. package/dist/server/session/notices.js +33 -0
  172. package/dist/server/session/one-shot.js +95 -0
  173. package/dist/server/session/persist-ephemeral.js +48 -0
  174. package/dist/server/session/pi-opener.js +163 -0
  175. package/dist/server/session/pi-refresh.js +51 -0
  176. package/dist/server/session/pi-sessions-provider.js +41 -0
  177. package/dist/server/session/pi-sessions.js +431 -0
  178. package/dist/server/session/refresh-actions.js +58 -0
  179. package/dist/server/session/rename-session.js +23 -0
  180. package/dist/server/session/runtime-services.js +37 -0
  181. package/dist/server/session/runtime-types.js +1 -0
  182. package/dist/server/session/runtime.js +844 -0
  183. package/dist/server/session/session-stats.js +91 -0
  184. package/dist/server/session/settings.js +526 -0
  185. package/dist/server/session/snapshot-for.js +9 -0
  186. package/dist/server/session/stats-refresher.js +55 -0
  187. package/dist/server/session/subagents.js +119 -0
  188. package/dist/server/session/suggest-title.js +33 -0
  189. package/dist/server/session/switch-conversation.js +111 -0
  190. package/dist/server/session/template-prompt-routes.js +26 -0
  191. package/dist/server/session/template-prompt.js +110 -0
  192. package/dist/server/session/throttle.js +14 -0
  193. package/dist/server/session/title-prompt.js +128 -0
  194. package/dist/server/session/turn-events.js +198 -0
  195. package/dist/server/session/turn-finish.js +97 -0
  196. package/dist/server/session/turn-markers.js +31 -0
  197. package/dist/server/session/turn-queue.js +264 -0
  198. package/dist/server/session/turn-send.js +138 -0
  199. package/dist/server/session/turn-watchdog.js +77 -0
  200. package/dist/server/session/voice-settings.js +39 -0
  201. package/dist/server/sessions/session-routes.js +97 -0
  202. package/dist/server/skills/skill-install.js +184 -0
  203. package/dist/server/skills/skill-routes.js +134 -0
  204. package/dist/server/skills/skill-store.js +163 -0
  205. package/dist/server/skills/skillhub.js +213 -0
  206. package/dist/server/skills/zip.js +121 -0
  207. package/dist/server/snapshot/fan-out.js +12 -0
  208. package/dist/server/snapshot/messages.js +117 -0
  209. package/dist/server/snapshot/sender.js +53 -0
  210. package/dist/server/snapshot/state.js +274 -0
  211. package/dist/server/subagents/profile-store.js +305 -0
  212. package/dist/server/terminal/terminal-routes.js +223 -0
  213. package/dist/server/terminal/terminal-session.js +197 -0
  214. package/dist/server/tts/edge-worker-source.js +48 -0
  215. package/dist/server/tts/edge.js +143 -0
  216. package/dist/server/tts/local-voices.js +35 -0
  217. package/dist/server/tts/local.js +192 -0
  218. package/dist/server/tts/routes.js +56 -0
  219. package/dist/server/tts/service.js +97 -0
  220. package/dist/server/tts/types.js +7 -0
  221. package/dist/server/tts/voices.js +21 -0
  222. package/dist/server/update-check.js +147 -0
  223. package/dist/server/update-prompt.js +131 -0
  224. package/dist/server/uploads/upload-routes.js +67 -0
  225. package/dist/server/uploads/upload-store.js +113 -0
  226. package/dist/server/util/atomic-write.js +18 -0
  227. package/dist/server/util/data-dir.js +36 -0
  228. package/dist/server/util/desktop.js +216 -0
  229. package/dist/server/util/env.js +202 -0
  230. package/dist/server/util/file-mode.js +57 -0
  231. package/dist/server/util/ids.js +28 -0
  232. package/dist/server/util/json-file.js +38 -0
  233. package/dist/server/util/log-file.js +67 -0
  234. package/dist/server/util/log.js +52 -0
  235. package/dist/server/util/origin.js +117 -0
  236. package/dist/server/util/paths.js +187 -0
  237. package/dist/server/util/pricing-index.js +117 -0
  238. package/dist/server/util/pricing.js +214 -0
  239. package/dist/server/util/prune-pty.js +72 -0
  240. package/dist/server/util/spawn-cli.js +147 -0
  241. package/dist/server/util/startup.js +34 -0
  242. package/dist/server/util/upstream-version.js +177 -0
  243. package/dist/server/util/usage.js +19 -0
  244. package/dist/server/util/version.js +59 -0
  245. package/dist/server/web-proxy/picker-script.js +495 -0
  246. package/dist/server/web-proxy/proxy-routes.js +205 -0
  247. package/dist/server/web-proxy/proxy-url.js +76 -0
  248. package/dist/server/web-proxy/rewrite.js +98 -0
  249. package/dist/server/web-proxy/wrapper.js +92 -0
  250. package/dist/server/ws/handle-message.js +182 -0
  251. package/dist/server/ws/reply-frame.js +5 -0
  252. package/helper/asr/Info.plist +24 -0
  253. package/helper/asr/build.sh +59 -0
  254. package/helper/asr/main.swift +279 -0
  255. package/helper/asr/release/ASRBridge.zip +0 -0
  256. package/package.json +120 -5
  257. package/web/dist/apple-touch-icon-precomposed.png +0 -0
  258. package/web/dist/apple-touch-icon.png +0 -0
  259. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_abnfDiagram-WEYOIA3C-Cxf7yoVn.js +1 -0
  260. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_architectureDiagram-ZHVYKT53-BtmjGlGq.js +1 -0
  261. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_c4Diagram-XDPPPE54-CMVGVtIk.js +1 -0
  262. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_cynefinDiagram-WF24UDRP-7i0BPrM8.js +1 -0
  263. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_diagram-CBK3MWTC-G70wUrpC.js +1 -0
  264. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_diagram-ODIL2UCW-DG5xxpj4.js +1 -0
  265. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_diagram-PFBEJUXE-TVSrX2lz.js +1 -0
  266. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_diagram-TYUNFSNR-B5kj_W4w.js +1 -0
  267. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_ebnfDiagram-V4P3TTPT-CYDlMnIy.js +1 -0
  268. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_ishikawaDiagram-HPEHV2GE-Bwle1LQ4.js +1 -0
  269. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_mindmap-definition-6OY57UG3-Dp_r4po3.js +1 -0
  270. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_pegDiagram-ECIUJNBX-D0XH8M0y.js +1 -0
  271. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_railroadDiagram-Y72NRBL7-BYBIBrHp.js +1 -0
  272. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_swimlanes-B3ENRKFQ-Bj4-4hK8.js +1 -0
  273. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_swimlanesDiagram-AYQRV4AK-Cr0JbDyV.js +1 -0
  274. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_usecaseDiagram-WPOLBNNX-BN92OiEn.js +1 -0
  275. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_vennDiagram-Q3Y3IDCW--PhbzdU_.js +1 -0
  276. package/web/dist/assets/_pop-agent-mermaid-pruned_chunk_wardleyDiagram-IVAIDKWA-nObiqZ0S.js +1 -0
  277. package/web/dist/assets/_pop-agent-mermaid-pruned_katex_katex-Zojedrce.js +1 -0
  278. package/web/dist/assets/approval.en-BFhMPNWP.mp3 +0 -0
  279. package/web/dist/assets/approval.zh-DWqP6Pcu.mp3 +0 -0
  280. package/web/dist/assets/arc-Dn7mfTUL.js +1 -0
  281. package/web/dist/assets/architecture-WOLXFQ4H-DwHKr8GA.js +1 -0
  282. package/web/dist/assets/array-BifhSqXX.js +1 -0
  283. package/web/dist/assets/blockDiagram-RJAE7QA3-CA2AOM6-.js +140 -0
  284. package/web/dist/assets/channel-PVcvMEH-.js +1 -0
  285. package/web/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  286. package/web/dist/assets/chunk-55XCU76K-DlITu1ZH.js +1 -0
  287. package/web/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  288. package/web/dist/assets/chunk-7S6XSTFO-DzX1XF3_.js +2 -0
  289. package/web/dist/assets/chunk-AQDTSKZB-BdEDejS-.js +72 -0
  290. package/web/dist/assets/chunk-DSNLSHJZ-Chj2PD0m.js +129 -0
  291. package/web/dist/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  292. package/web/dist/assets/chunk-HNE4Q36P-V3jylrEv.js +1 -0
  293. package/web/dist/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  294. package/web/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  295. package/web/dist/assets/chunk-NGNAAXSQ-DuHRe0y2.js +136 -0
  296. package/web/dist/assets/chunk-VQ5W62QI-BiWZxVe5.js +1 -0
  297. package/web/dist/assets/chunk-WQQL4CDK-BtyaHLI7.js +10 -0
  298. package/web/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  299. package/web/dist/assets/chunk-ZAUX2LTX-DS3wpSTy.js +62 -0
  300. package/web/dist/assets/chunk-ZCHMQSOR-at82jgqF.js +2 -0
  301. package/web/dist/assets/classDiagram-v2-4MYWR3UA-CTgR1e3M.js +217 -0
  302. package/web/dist/assets/cose-bilkent-JH36ORCC-DW-hnOsq.js +1 -0
  303. package/web/dist/assets/cynefin-EF2NZ3EQ-Pg-c-yVE.js +1 -0
  304. package/web/dist/assets/dagre-NK4GIZVX-B0Ivt5Pn.js +4 -0
  305. package/web/dist/assets/diagram-I5XIIV2D-jE6SNlbX.js +24 -0
  306. package/web/dist/assets/diagram-RJA3I4VV-DQJNgW0u.js +41 -0
  307. package/web/dist/assets/done.en-s1tZOg6A.mp3 +0 -0
  308. package/web/dist/assets/done.zh-Dq-Os4NS.mp3 +0 -0
  309. package/web/dist/assets/elk-QONTBCTQ-KOJVoDyP.js +27 -0
  310. package/web/dist/assets/erDiagram-KYQIGQAA-DNUqfe2J.js +99 -0
  311. package/web/dist/assets/error.en-BGPHdZVi.mp3 +0 -0
  312. package/web/dist/assets/error.zh-DdFp64-u.mp3 +0 -0
  313. package/web/dist/assets/eventmodeling-K75KTNOO-DnxXCUaf.js +1 -0
  314. package/web/dist/assets/flowDiagram-IUGLLWBU-CRLc8ozS.js +213 -0
  315. package/web/dist/assets/ganttDiagram-R7GPNTJY-DDLhSPGT.js +292 -0
  316. package/web/dist/assets/gitGraph-VSP46ZUC-BjfoZeXP.js +1 -0
  317. package/web/dist/assets/gitGraphDiagram-PDYL7XHY-6uZGw3lU.js +106 -0
  318. package/web/dist/assets/graphlib-DS17s2tU.js +1 -0
  319. package/web/dist/assets/highlight-DMv0JmTA.js +5 -0
  320. package/web/dist/assets/i18n-en-H5OrSHR5.js +1 -0
  321. package/web/dist/assets/index-CQ1VhLwx.js +79 -0
  322. package/web/dist/assets/index-DB6jJFLf.css +1 -0
  323. package/web/dist/assets/info-OHQRW6UA-BMDHcIvy.js +1 -0
  324. package/web/dist/assets/infoDiagram-MVDRKAX5-C2d1Uwhn.js +2 -0
  325. package/web/dist/assets/init-C-OQMol4.js +1 -0
  326. package/web/dist/assets/journeyDiagram-BOSHW7O7-BAE_nPCd.js +139 -0
  327. package/web/dist/assets/kanban-definition-FNSA4HC5-C2Z3ejvx.js +89 -0
  328. package/web/dist/assets/line-DHlXL-f4.js +1 -0
  329. package/web/dist/assets/linear-B363vzIx.js +1 -0
  330. package/web/dist/assets/markdown-Bcx45PNe.js +31 -0
  331. package/web/dist/assets/math-Dh0H2mym.js +1 -0
  332. package/web/dist/assets/mermaid-parser.core-CxD9DMnU.js +7 -0
  333. package/web/dist/assets/mermaid.core-CdVzG6_M.js +44 -0
  334. package/web/dist/assets/ordinal-BDEzSJ7C.js +1 -0
  335. package/web/dist/assets/packet-JDAUHWVQ-Cx23kBS5.js +1 -0
  336. package/web/dist/assets/path-fybaL0A-.js +1 -0
  337. package/web/dist/assets/pie-XZMESJXO-BDdtcaza.js +1 -0
  338. package/web/dist/assets/pieDiagram-GNMPY74T-DRqt_o8d.js +39 -0
  339. package/web/dist/assets/quadrantDiagram-D57K4MC3-Cq3-_E3T.js +7 -0
  340. package/web/dist/assets/radar-ABXABTNO-yJ_gp7Uq.js +1 -0
  341. package/web/dist/assets/railroad-I3PHUGI6-BFVVDyfL.js +1 -0
  342. package/web/dist/assets/railroad-abnf-LNEFI6M7-BhhpD6rl.js +1 -0
  343. package/web/dist/assets/railroad-ebnf-DWYD2UWJ-os_iV6TA.js +1 -0
  344. package/web/dist/assets/railroad-peg-JR7BVNR7-kex9mDBE.js +1 -0
  345. package/web/dist/assets/react-TO3cgmuO.js +9 -0
  346. package/web/dist/assets/requirementDiagram-EQYSW5RA-BnDM54-F.js +84 -0
  347. package/web/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
  348. package/web/dist/assets/sankeyDiagram-SY24JHO5-CMQmL2Tu.js +40 -0
  349. package/web/dist/assets/sequenceDiagram-BLEHNHQU-Dqhxl46T.js +169 -0
  350. package/web/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
  351. package/web/dist/assets/src-BWF7jMDv.js +1 -0
  352. package/web/dist/assets/stateDiagram-v2-A6IESKWZ-D1u1qdD7.js +291 -0
  353. package/web/dist/assets/steer.en-1RIP4K_0.mp3 +0 -0
  354. package/web/dist/assets/steer.zh-BCINYQs7.mp3 +0 -0
  355. package/web/dist/assets/stopped.en-CFPMi6oy.mp3 +0 -0
  356. package/web/dist/assets/stopped.zh-D2CUs-KZ.mp3 +0 -0
  357. package/web/dist/assets/timeline-definition-JXYKGLGB-DEjsSeWV.js +120 -0
  358. package/web/dist/assets/treeView-D4JQ5SDB-BXYISxgj.js +1 -0
  359. package/web/dist/assets/treemap-SAJKECNS-B6BJK2c0.js +1 -0
  360. package/web/dist/assets/wardley-7MLQ67FV-DsjBYeKs.js +1 -0
  361. package/web/dist/assets/xterm-BrP-ENHg.css +1 -0
  362. package/web/dist/assets/xterm-C3-Bm0Yw.js +16 -0
  363. package/web/dist/assets/xychartDiagram-4URNHDU4-CBbRqTE2.js +7 -0
  364. package/web/dist/favicon-32.png +0 -0
  365. package/web/dist/favicon.ico +0 -0
  366. package/web/dist/favicon.svg +25 -0
  367. package/web/dist/icons/apple-touch-icon-180.png +0 -0
  368. package/web/dist/icons/icon-1024.png +0 -0
  369. package/web/dist/icons/icon-192.png +0 -0
  370. package/web/dist/icons/icon-512.png +0 -0
  371. package/web/dist/icons/icon-maskable-512.png +0 -0
  372. package/web/dist/index.html +62 -0
  373. package/web/dist/manifest.webmanifest +17 -0
  374. package/web/dist/maskable.svg +25 -0
  375. package/web/dist/sw.js +40 -0
@@ -0,0 +1,106 @@
1
+ /**
2
+ * 「pi 都没装」时的兜底页面 —— ADR-0052 §4。
3
+ *
4
+ * 为什么需要单独一个文件:pi 是以 **模块** 被 `server/index.ts` 静态 import 的
5
+ * (`engine/pi-sdk.ts`),所以「没有 pi」的时候整个服务根本起不来 —— 连一个能弹出
6
+ * 「点一下安装」的界面都没有。这里就是那个界面:自己只用 node 内置的 http,
7
+ * 不 import 任何 pi 相关的东西,专门负责把 pi 装好。
8
+ *
9
+ * 只在这一种情况下被 `cli.ts` 拉起来,装完之后照常启动真正的服务。
10
+ *
11
+ * 装的落点与其它引擎一致:`<dataDir>` 这个 npm prefix(`install.sh` 同款),
12
+ * 不碰系统全局、不用 sudo。
13
+ */
14
+ import { createServer } from "node:http";
15
+ import { BRAND_NAME } from "./brand.js";
16
+ import { engineStatus, installEngine, piModulePath } from "./engine/engine-install.js";
17
+ const PAGE = (brand, engineWord) => `<!doctype html>
18
+ <html lang="zh-CN"><head><meta charset="utf-8"><title>${brand} · 安装 ${engineWord}</title>
19
+ <meta name="viewport" content="width=device-width,initial-scale=1">
20
+ <style>
21
+ :root { color-scheme: dark; }
22
+ body { margin:0; min-height:100vh; display:grid; place-items:center; background:#141414; color:#e8e8e8;
23
+ font:15px/1.7 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif; }
24
+ .card { width:min(560px,92vw); padding:32px; border-radius:16px; background:#1d1d1f; border:1px solid #2c2c2e; }
25
+ h1 { margin:0 0 8px; font-size:20px; }
26
+ p { margin:12px 0; color:#a1a1a6; }
27
+ code { background:#000; padding:2px 6px; border-radius:6px; color:#e8e8e8; }
28
+ button { margin-top:8px; padding:10px 20px; border-radius:10px; border:0; background:#4f7cff; color:#fff;
29
+ font-size:15px; cursor:pointer; }
30
+ button[disabled] { background:#3a3a3c; cursor:default; }
31
+ .ok { color:#4ade80; } .err { color:#f87171; } .log { white-space:pre-wrap; font-size:12px; color:#6b6b70;
32
+ max-height:180px; overflow:auto; margin-top:12px; }
33
+ </style></head>
34
+ <body><div class="card">
35
+ <h1>还差一步:装一下 ${engineWord}</h1>
36
+ <p>${brand} 的默认智能体是 <b>${engineWord}</b>,但这台机器上没有找到它。</p>
37
+ <p>点下面的按钮,我会把它装到 <code>~/.pop-agent</code>(你自己的 npm 目录,不碰系统、不用 sudo):</p>
38
+ <button id="go">安装 ${engineWord}</button>
39
+ <div id="out"></div>
40
+ </div>
41
+ <script>
42
+ const go = document.getElementById('go'), out = document.getElementById('out');
43
+ go.onclick = async () => {
44
+ go.disabled = true; out.innerHTML = '<p>正在安装,需要联网,通常 1–2 分钟…</p>';
45
+ try {
46
+ const response = await fetch('/api/engines/install', {
47
+ method: 'POST', headers: { 'content-type': 'application/json' },
48
+ body: JSON.stringify({ name: 'pi' }),
49
+ });
50
+ const body = await response.json();
51
+ out.innerHTML = response.ok
52
+ ? '<p class="ok">' + body.message + '</p><p>关掉这个页面,重新打开 ${brand} 即可。</p>'
53
+ : '<p class="err">' + body.message + '</p>';
54
+ } catch (error) {
55
+ out.innerHTML = '<p class="err">安装请求失败:' + error.message + '</p>';
56
+ } finally { go.disabled = false; }
57
+ };
58
+ </script>
59
+ </body></html>`;
60
+ /**
61
+ * 启动兜底页面服务。返回后进程就停在这里 —— 真正的服务要等用户把 pi 装完再启动。
62
+ */
63
+ export function startPiGate(options) {
64
+ const log = options.log ?? (() => { });
65
+ const server = createServer((request, response) => {
66
+ const url = request.url ?? "/";
67
+ if (request.method === "GET" && (url === "/" || url.startsWith("/?"))) {
68
+ response.writeHead(200, { "content-type": "text/html; charset=utf-8" });
69
+ response.end(PAGE(BRAND_NAME, "Pi Agent"));
70
+ return;
71
+ }
72
+ if (request.method === "GET" && url === "/api/engines") {
73
+ response.writeHead(200, { "content-type": "application/json; charset=utf-8" });
74
+ response.end(JSON.stringify({ engines: [engineStatus("pi", { dataDir: options.dataDir })] }));
75
+ return;
76
+ }
77
+ if (request.method === "POST" && url === "/api/engines/install") {
78
+ void (async () => {
79
+ const outcome = await installEngine("pi", { dataDir: options.dataDir, log });
80
+ if (outcome.ok)
81
+ log(`pi 已装好:${outcome.path ?? "(入口待重启确认)"}`);
82
+ else
83
+ log(`pi 安装失败:${outcome.message}`);
84
+ response.writeHead(outcome.ok ? 200 : 502, { "content-type": "application/json; charset=utf-8" });
85
+ response.end(JSON.stringify(outcome));
86
+ })();
87
+ return;
88
+ }
89
+ response.writeHead(404, { "content-type": "text/plain; charset=utf-8" });
90
+ response.end("not found");
91
+ });
92
+ // 只听本机:这是个「装机页面」,不该让局域网里的人点得到
93
+ return new Promise((resolve, reject) => {
94
+ server.once("error", reject);
95
+ server.listen(options.port, "127.0.0.1", () => {
96
+ const url = `http://127.0.0.1:${options.port}`;
97
+ log(`${BRAND_NAME} 还没装 Pi Agent(默认智能体)。先装它:${url}`);
98
+ options.openUrl?.(url);
99
+ resolve();
100
+ });
101
+ });
102
+ }
103
+ /** 当前这份安装里有没有 pi 模块(没有 → 该走兜底页面而不是启动服务) */
104
+ export function piMissing() {
105
+ return piModulePath() === null;
106
+ }
@@ -0,0 +1,265 @@
1
+ /**
2
+ * 非 pi 引擎的「插件」面板后端(ADR-0045):**照各家自己的口径显示**,不硬套 pi 的 package 概念。
3
+ *
4
+ * 三家现实(决定了 `can` 那张表,界面据此隐藏按不出来的按钮):
5
+ * - **codex**:0.16x 起有真正的插件系统(marketplace + plugin,`~/.codex/config.toml` 的
6
+ * `[plugins."id@market"]`)。app-server 直接给了 `plugin/list`(含 installed / enabled /
7
+ * 版本 / 描述)与 `plugin/install`、`plugin/uninstall`;启停走 `config/value/write`。
8
+ * 这是三家里最完整的一份,所以 install / remove / toggle 全开。
9
+ * - **claude**:插件是「插件@市场」,只有开关列表(`settings.json` 的 `enabledPlugins`),
10
+ * 安装/卸载在 Claude Code 自己的 `/plugin` 流程里 → 这里只做**开关**。
11
+ * - **opencode**:`opencode.json` 的 `plugin` 数组(npm 包名或本地路径),没有启停状态,
12
+ * 也没有 CLI 写它 → 只读展示,改文件请自己在编辑器里加/删。
13
+ * - **dsh / 其它**:没有插件概念 → 空视图 + 一句说明。
14
+ */
15
+ import { existsSync, readdirSync } from "node:fs";
16
+ import { homedir } from "node:os";
17
+ import { join } from "node:path";
18
+ import { readJsonObject, tableOf, writeJsonObject } from "../util/json-file.js";
19
+ const EMPTY_COUNTS = { extensions: 0, skills: 0, prompts: 0, themes: 0 };
20
+ function packageRow(input) {
21
+ return {
22
+ source: input.source,
23
+ scope: "global",
24
+ ...(input.name ? { name: input.name } : {}),
25
+ ...(input.version ? { version: input.version } : {}),
26
+ ...(input.description ? { description: input.description } : {}),
27
+ disabled: input.disabled,
28
+ filtered: false,
29
+ ...(input.installedPath ? { installedPath: input.installedPath } : {}),
30
+ // 「装没装」跟「开没开」是两件事:codex / claude 都分得出来
31
+ status: input.installed ? (input.disabled ? "disabled" : "installed") : "missing",
32
+ counts: { ...EMPTY_COUNTS },
33
+ resources: [],
34
+ };
35
+ }
36
+ function view(input) {
37
+ return {
38
+ packages: input.packages,
39
+ extensions: [],
40
+ totals: { ...EMPTY_COUNTS },
41
+ diagnostics: input.diagnostics ?? [],
42
+ projectLoaded: false,
43
+ engine: input.engine,
44
+ source: input.source,
45
+ can: input.can,
46
+ note: input.note,
47
+ ...(input.error ? { error: input.error } : {}),
48
+ };
49
+ }
50
+ /** 这个引擎没有插件概念(dsh / 未接的引擎):空列表 + 一句能看懂的话 */
51
+ export function createNonePluginStore(engine, note) {
52
+ const empty = () => view({
53
+ engine,
54
+ source: note,
55
+ can: { install: false, remove: false, toggle: false, update: false },
56
+ note,
57
+ packages: [],
58
+ diagnostics: [{ type: "warning", message: note }],
59
+ });
60
+ return {
61
+ async view() {
62
+ return empty();
63
+ },
64
+ async act() {
65
+ return { ...empty(), actionError: note };
66
+ },
67
+ };
68
+ }
69
+ export function createCodexPluginStore(options) {
70
+ const engine = "codex";
71
+ const can = { install: true, remove: true, toggle: true, update: false };
72
+ const note = 'Codex 插件来自 marketplace:manifest 在 `~/.codex/config.toml` 的 [plugins."id@market"],安装缓存在 ~/.codex/plugins';
73
+ const build = async () => {
74
+ try {
75
+ const listed = await options.client.request("plugin/list", {}, { timeoutMs: 25_000 });
76
+ const packages = [];
77
+ const diagnostics = [];
78
+ for (const market of listed?.marketplaces ?? []) {
79
+ for (const plugin of market.plugins ?? []) {
80
+ const id = plugin.id ?? plugin.name;
81
+ if (!id)
82
+ continue;
83
+ packages.push(packageRow({
84
+ source: id,
85
+ name: plugin.interface?.displayName ?? plugin.name ?? id,
86
+ version: plugin.localVersion ?? plugin.version ?? undefined,
87
+ description: plugin.interface?.shortDescription ?? undefined,
88
+ // 「装了但没开」与「没装」分开:界面上的按钮不同
89
+ disabled: plugin.enabled !== true,
90
+ installedPath: plugin.source?.path,
91
+ installed: plugin.installed === true,
92
+ }));
93
+ if (typeof plugin.disabledReason === "string" && plugin.disabledReason !== "") {
94
+ diagnostics.push({ type: "warning", source: id, message: plugin.disabledReason });
95
+ }
96
+ }
97
+ }
98
+ return view({ engine, source: `Codex · plugin/list(${options.configPath})`, can, note, packages, diagnostics });
99
+ }
100
+ catch (error) {
101
+ const message = error instanceof Error ? error.message : String(error);
102
+ options.log?.(`codex:读插件清单失败:${message}`);
103
+ return view({
104
+ engine,
105
+ source: `Codex · ${options.configPath}`,
106
+ can,
107
+ note,
108
+ packages: [],
109
+ error: `读不到 codex 的插件清单:${message}`,
110
+ });
111
+ }
112
+ };
113
+ return {
114
+ view: async () => build(),
115
+ async act(input) {
116
+ const base = await build();
117
+ try {
118
+ if (input.action === "install") {
119
+ if (!input.source)
120
+ return { ...base, actionError: "要装哪个插件?(写 id@market)" };
121
+ await options.client.request("plugin/install", { pluginName: input.source }, { timeoutMs: 120_000 });
122
+ return { ...(await build()), notice: `已安装 ${input.source}` };
123
+ }
124
+ if (input.action === "remove") {
125
+ if (!input.source)
126
+ return { ...base, actionError: "要删哪个插件?" };
127
+ await options.client.request("plugin/uninstall", { pluginId: input.source }, { timeoutMs: 60_000 });
128
+ return { ...(await build()), notice: `已卸载 ${input.source}` };
129
+ }
130
+ if (input.action === "enable" || input.action === "disable") {
131
+ if (!input.source)
132
+ return { ...base, actionError: "要改哪个插件?" };
133
+ await options.client.request("config/value/write", {
134
+ keyPath: `plugins.${input.source}.enabled`,
135
+ value: input.action === "enable",
136
+ mergeStrategy: "replace",
137
+ }, { timeoutMs: 30_000 });
138
+ return {
139
+ ...(await build()),
140
+ notice: `${input.source}:${input.action === "enable" ? "已启用" : "已停用"}`,
141
+ };
142
+ }
143
+ return { ...base, actionError: "codex 面板不支持「更新」:用 `codex plugin marketplace upgrade`" };
144
+ }
145
+ catch (error) {
146
+ const message = error instanceof Error ? error.message : String(error);
147
+ options.log?.(`codex:插件操作失败(${input.action}):${message}`);
148
+ return { ...base, actionError: `codex 拒绝了这次操作:${message}` };
149
+ }
150
+ },
151
+ };
152
+ }
153
+ // ---------------------------------------------------------------------------
154
+ // claude
155
+ // ---------------------------------------------------------------------------
156
+ function claudeSettingsPath(home) {
157
+ const dir = home?.trim() || process.env.CLAUDE_CONFIG_DIR?.trim() || join(homedir(), ".claude");
158
+ return join(dir, "settings.json");
159
+ }
160
+ export function createClaudePluginStore(options = {}) {
161
+ const engine = "claude";
162
+ const can = { install: false, remove: false, toggle: true, update: false };
163
+ const settingsPath = claudeSettingsPath(options.home);
164
+ const note = "Claude Code 的插件是「插件@市场」,开关写在 `~/.claude/settings.json` 的 enabledPlugins;安装/卸载在 Claude Code 自己的 /plugin 流程里";
165
+ const build = () => {
166
+ const read = readJsonObject(settingsPath);
167
+ if ("error" in read) {
168
+ return view({ engine, source: settingsPath, can, note, packages: [], error: read.error });
169
+ }
170
+ const enabledPlugins = tableOf(read.json, "enabledPlugins");
171
+ const packages = Object.entries(enabledPlugins).map(([id, value]) => packageRow({
172
+ source: id,
173
+ name: id,
174
+ disabled: value !== true,
175
+ installed: true,
176
+ }));
177
+ const diagnostics = [];
178
+ // `~/.claude/plugins` 里是缓存/市场,数一下让用户知道「文件在哪」
179
+ const pluginsDir = join(settingsPath, "..", "plugins");
180
+ if (existsSync(pluginsDir)) {
181
+ try {
182
+ const count = readdirSync(pluginsDir).length;
183
+ diagnostics.push({
184
+ type: "warning",
185
+ message: `插件缓存目录 ${pluginsDir}(${count} 项):本面板只改开关,不动缓存`,
186
+ });
187
+ }
188
+ catch {
189
+ /* 读不了就算了,不影响开关 */
190
+ }
191
+ }
192
+ return view({ engine, source: `Claude Code · ${settingsPath}`, can, note, packages, diagnostics });
193
+ };
194
+ return {
195
+ async view() {
196
+ return build();
197
+ },
198
+ async act(input) {
199
+ const base = build();
200
+ if (input.action !== "enable" && input.action !== "disable") {
201
+ return { ...base, actionError: "Claude Code 的插件安装/卸载不在这个面板里(用 Claude Code 的 /plugin)" };
202
+ }
203
+ if (!input.source)
204
+ return { ...base, actionError: "要改哪个插件?" };
205
+ const read = readJsonObject(settingsPath);
206
+ if ("error" in read)
207
+ return { ...base, actionError: read.error };
208
+ const enabledPlugins = { ...tableOf(read.json, "enabledPlugins") };
209
+ enabledPlugins[input.source] = input.action === "enable";
210
+ try {
211
+ writeJsonObject(settingsPath, { ...read.json, enabledPlugins });
212
+ }
213
+ catch (error) {
214
+ return { ...base, actionError: error instanceof Error ? error.message : String(error) };
215
+ }
216
+ return {
217
+ ...build(),
218
+ notice: `${input.source}:${input.action === "enable" ? "已启用" : "已停用"}`,
219
+ };
220
+ },
221
+ };
222
+ }
223
+ // ---------------------------------------------------------------------------
224
+ // opencode(只读:插件列表在 opencode.json 的 plugin 数组里)
225
+ // ---------------------------------------------------------------------------
226
+ function opencodeConfigFile(workspace) {
227
+ if (workspace)
228
+ return join(workspace, "opencode.json");
229
+ const base = process.env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config");
230
+ return join(base, "opencode", "opencode.json");
231
+ }
232
+ export function createOpencodePluginStore(_options = {}) {
233
+ const engine = "opencode";
234
+ const can = { install: false, remove: false, toggle: false, update: false };
235
+ const note = "opencode 的插件写在 `opencode.json` 的 `plugin` 数组(npm 包名或本地路径);本面板只读,改文件即可";
236
+ const build = (workspace) => {
237
+ const files = [opencodeConfigFile(), opencodeConfigFile(workspace)];
238
+ const packages = [];
239
+ const diagnostics = [];
240
+ for (const file of files) {
241
+ const read = readJsonObject(file);
242
+ if ("error" in read) {
243
+ diagnostics.push({ type: "error", source: file, message: read.error });
244
+ continue;
245
+ }
246
+ const plugin = read.json.plugin;
247
+ if (!Array.isArray(plugin))
248
+ continue;
249
+ for (const entry of plugin) {
250
+ if (typeof entry !== "string" || entry.trim() === "")
251
+ continue;
252
+ packages.push(packageRow({ source: entry, name: entry, disabled: false, installed: true }));
253
+ }
254
+ }
255
+ return view({ engine, source: `opencode · ${files[0]}`, can, note, packages, diagnostics });
256
+ };
257
+ return {
258
+ async view(workspace) {
259
+ return build(workspace);
260
+ },
261
+ async act(input) {
262
+ return { ...build(input.workspace), actionError: note };
263
+ },
264
+ };
265
+ }
@@ -0,0 +1,22 @@
1
+ const ACTIONS = ["install", "remove", "update", "enable", "disable"];
2
+ export function registerPluginRoutes(app, options) {
3
+ const { storeFor, engineOf, workspaceOf } = options;
4
+ const workspace = () => workspaceOf() ?? process.cwd();
5
+ const store = () => storeFor(engineOf());
6
+ app.get("/api/plugins", async (_request, response) => {
7
+ response.json(await store().view(workspace()));
8
+ });
9
+ app.post("/api/plugins", async (request, response) => {
10
+ const body = request.body;
11
+ const action = ACTIONS.includes(body?.action) ? body?.action : null;
12
+ if (!action) {
13
+ response.status(400).json({ error: { code: "plugins.bad_action", message: "不认识的插件操作" } });
14
+ return;
15
+ }
16
+ const source = typeof body?.source === "string" ? body.source : undefined;
17
+ const scope = body?.scope === "project" ? "project" : body?.scope === "global" ? "global" : undefined;
18
+ const result = await store().act({ workspace: workspace(), action, source, scope });
19
+ // 操作失败但列表本身读得出来:照常 200 回列表 + actionError,界面不需要分辨两种 400
20
+ response.json(result);
21
+ });
22
+ }