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
package/README.md CHANGED
@@ -1,3 +1,621 @@
1
- # Temporary Holding Version
1
+ # PopAgent
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![version](https://img.shields.io/badge/version-0.1.0-4f7cff?style=flat-square)](https://github.com/duzhenxun/pop-agent/releases)
4
+ [![npm downloads](https://img.shields.io/npm/dm/pop-agent?style=flat-square&label=downloads%2Fmonth&color=2f5fe0)](https://www.npmjs.com/package/pop-agent)
5
+ [![GitHub stars](https://img.shields.io/github/stars/duzhenxun/pop-agent?style=flat-square&color=f5c542&label=stars)](https://github.com/duzhenxun/pop-agent/stargazers)
6
+ [![node](https://img.shields.io/badge/node-%E2%89%A522.19-3c873a?style=flat-square&logo=nodedotjs&logoColor=white)](https://nodejs.org)
7
+ [![license](https://img.shields.io/badge/license-MIT-2f5fe0?style=flat-square)](LICENSE)
8
+ [![site](https://img.shields.io/badge/site-live-7b5cf0?style=flat-square)](https://duzhenxun.github.io/pop-agent/)
9
+
10
+ > This project is a fork of [oh-my-agent-web](https://github.com/duzhenxun/oh-my-agent-web). Versioning restarts at **0.1.0** (upstream was on 1.5.x at fork time); version numbers mentioned in the README and ADRs refer to that upstream history.
11
+
12
+ [中文](README.zh.md) · **English** · [Website](https://duzhenxun.github.io/pop-agent/)
13
+
14
+ One line: **an external control surface for the agent you're already running.** The engine keeps running on your own machine; the web page is where you watch it work, manage its tools and models, cut in to correct it whenever you like, and — when the moment comes — read files, open a terminal, or highlight a passage and ask for a change.
15
+
16
+ Single user, loopback only, and **the engine's own on-disk files are always the source of truth for a conversation** — no database, no account system, no second copy of the session in our own store. One `pop-agent` process is one person's workbench.
17
+
18
+ ![A real session: projects and sessions on the left, thinking blocks and tool cards in the middle, a file preview of the same repo on the right](docs/site/assets/en/hero.webp)
19
+
20
+ > Every screenshot below is a real UI capture of this repo — pi engine + DeepSeek, on a small `demo-app` project.
21
+ > Most are the 1.1.0 build (shared with the landing page under `docs/site/assets/en/`); the terminal and side-chat shots are from the 0.8.0 run under `docs/screenshots/`; the voice, scheduled-task and computer-control shots are the 1.5.x build.
22
+ > Directories, commands, diffs, tokens and cost all come from actual runs — no collages, no mockups.
23
+ > How the 1.1.0 shots were taken: [`docs/site/README.md`](docs/site/README.md).
24
+
25
+ ---
26
+
27
+ ## Install
28
+
29
+ Requires **Node.js ≥ 22.19** and **npm ≥ 9**; macOS / Linux / Windows all work. You end up with an `pop-agent` command (short aliases: `pop`, `pop-agent` — all equivalent).
30
+
31
+ ### Install globally with npm (recommended)
32
+
33
+ ```bash
34
+ npm -g install pop-agent
35
+ ```
36
+
37
+ No version tag means the current release. To pin a version or use a mirror:
38
+
39
+ ```bash
40
+ npm -g install pop-agent@latest
41
+ npm -g install pop-agent@<version> --registry=https://registry.npmmirror.com
42
+ ```
43
+
44
+ You get three commands that all point at the same entry point: **`pop-agent`** (used throughout this README),
45
+ `pop` (the short alias you'll probably type), and `pop-agent`.
46
+
47
+ Upgrade and uninstall:
48
+
49
+ ```bash
50
+ pop-agent upgrade # same as npm -g install pop-agent@latest
51
+ npm -g uninstall pop-agent # uninstall; data in ~/.pop-agent is left alone
52
+ ```
53
+
54
+ On Linux, `node-pty` (the embedded terminal) ships prebuilds only for macOS / Windows, so Linux compiles it in place: you need `make`, `g++` and `python3`. When those are missing, both the page and the install script say exactly what's missing — the terminal won't open until then.
55
+
56
+ > **`allow-scripts` notices from npm 11.16+**: newer npm lists every dependency install script you haven't approved yet (`npm warn allow-scripts ...`). This package **ships no install scripts of its own** (the old one only pruned `node-pty` prebuilds for other platforms; that now happens lazily on startup), so anything listed is a transitive dependency such as `node-pty` (native build), `protobufjs`, or `@google/genai`. It is only a notice — the install still completes. To silence it after a review: `npm approve-scripts node-pty protobufjs @google/genai` (or `npm approve-scripts --all`).
57
+
58
+ ### One-line install (never touches global npm)
59
+
60
+ macOS / Linux:
61
+
62
+ ```bash
63
+ curl -fsSL https://raw.githubusercontent.com/duzhenxun/pop-agent/main/scripts/install.sh | sh
64
+ ```
65
+
66
+ Windows (PowerShell):
67
+
68
+ ```powershell
69
+ powershell -c "irm https://raw.githubusercontent.com/duzhenxun/pop-agent/main/scripts/install.ps1 | iex"
70
+ ```
71
+
72
+ The script does four things: **finds a new enough Node** (downloads an official build into `~/.pop-agent/node` and checks its sha256 if needed), **`npm install -g --prefix ~/.pop-agent`** (never the system-wide prefix, no sudo), **links `pop` / `pop-agent` / `pop-agent` into `~/.local/bin`** (patching PATH if necessary), and **smoke-tests once** (version string + whether `node-pty` can be required, i.e. whether the terminal will open).
73
+
74
+ That `~/.pop-agent` is also the **data directory**: what gets installed (`node/`, `lib/`, `bin/`) sits next to your `settings.json`, `password`, `uploads/` and `logs/`.
75
+
76
+ | What you want to change | How (`sh` version; PowerShell uses env vars) |
77
+ |---|---|
78
+ | Version | `POP_AGENT_VERSION=<version>` (or `--version <version>`) |
79
+ | Install elsewhere | `POP_AGENT_HOME=/opt/pop-agent` (or `--home /opt/pop-agent`) |
80
+ | Registry mirror | `POP_AGENT_REGISTRY=https://registry.npmmirror.com` (or `--registry …`) |
81
+ | Leave PATH alone | `POP_AGENT_NO_PATH=1` (or `--no-modify-path`) |
82
+ | Install build tools | `POP_AGENT_BUILD_TOOLS=1` (or `--with-build-tools`) |
83
+ | Uninstall | `… \| sh -s -- --uninstall` (removes only what was installed; `settings.json` / password / uploads / logs stay) |
84
+
85
+ ---
86
+
87
+ ## Commands
88
+
89
+ The three commands are completely equivalent; everything below is written as `pop-agent` (`pop` is its short alias).
90
+
91
+ | Command | What it does |
92
+ |---|---|
93
+ | `pop-agent` | **Start (default)**: runs in the foreground and opens the browser, logs right in the terminal, `Ctrl-C` to quit; default workspace = current directory |
94
+ | `pop-agent start -d` | Run in the background (detached, logs go to `daemon.log`), handing the terminal straight back |
95
+ | `pop-agent status` | pid / port / uptime / engine / session count / workspace |
96
+ | `pop-agent restart` | Stop then start (foreground by default; `-d` for background) |
97
+ | `pop-agent stop` | Stop the running instance (foreground or background — it reads the lock file in the data dir instead of guessing a port) |
98
+ | `pop-agent version` | Version string (`-v` / `--version` are synonyms) |
99
+ | `pop-agent upgrade` | Upgrade to the latest release (it runs `npm -g install pop-agent@latest`) |
100
+ | `pop-agent help` | Show help (`-h` / `--help` are synonyms) |
101
+
102
+ Two behavioural rules:
103
+
104
+ - **Starting twice is detected first**: if an instance is already running it only prints the URL (and opens the page) instead of starting a second one — identical for `pop` / `pop-agent` / `pop-agent`.
105
+ - **The foreground run stays quiet**: the terminal only gets one `已启动:…` line plus warn / error; normal logs (session index loading, SSE connections) still go in full to `logs/pop-agent.log`. Watch them with `POP_AGENT_LOG=info pop`; in the background (`-d`) they land in `daemon.log`.
106
+ - **It asks whether to upgrade**: on start (and on `pop status`) it asks npm once per six hours (cached in `update-check.json`) and, when a newer release exists, asks `现在升级吗?[Y/n]` — **plain Enter upgrades** and restarts into the new version (`pop-agent -d` asks before detaching too); `n` skips and asks again next start. Non-interactive runs (CI / `pop > log`) never prompt, they just print `有新版本 vX(当前 vY)→ 升级:pop upgrade`. `POP_AGENT_UPDATE_PROMPT=off` drops only the prompt, `POP_AGENT_UPDATE_CHECK=off` turns the check off entirely.
107
+
108
+ ### Flags
109
+
110
+ | Flag | Env var | Default | Notes |
111
+ |---|---|---|---|
112
+ | `-p, --port` | `POP_AGENT_PORT` | `9090` | Listen port |
113
+ | `-H, --host` | `POP_AGENT_HOST` | `127.0.0.1` | Listen address; only change it for remote access |
114
+ | `-P, --password` | `POP_AGENT_PASSWORD` | none | Login password; unset = loopback only (remote cannot enter). A value given here is saved into `<dataDir>/password`, **and that file is the single source of truth afterwards** (the env var is only used when the file does not exist yet); Settings → Remote edits the same file |
115
+ | `-d, --detach` | — | off (foreground by default) | Background run, detached, logs go to `~/.pop-agent/daemon.log`; `-f` / `--foreground` is the old spelling and now equals the default |
116
+ | `--no-open` | — | on | Don't open the browser |
117
+ | `--allow-host` | `POP_AGENT_ALLOWED_HOSTS` | none | Rarely needed: extra cross-origin hosts for requests **addressed to this machine** only |
118
+ | `--data-dir` | `POP_AGENT_DATA_DIR` | `~/.pop-agent` | Settings, password, uploads, logs and the lock file live here |
119
+ | — | `POP_AGENT_CWD` | `process.cwd()` | Default workspace (before any session exists) |
120
+ | — | `POP_AGENT_ENGINE` | `pi` | Default engine |
121
+ | — | `POP_AGENT_APPROVAL_MODE` | `allow` | Default approval mode for new sessions; `ask` confirms every tool call |
122
+ | — | `POP_AGENT_TURN_TIMEOUT_MS` | 20 minutes | Per-turn watchdog timeout |
123
+ | — | `POP_AGENT_LOG` | `info` (foreground terminal: warn / error only) | `debug` / `info` / `warn` / `error`; setting it explicitly also prints that level to the terminal |
124
+ | — | `POP_AGENT_UPDATE_PROMPT` | `on` | Whether to ask `现在升级吗?` in the terminal when a newer release exists (Enter = upgrade); `off` keeps only the passive notice line |
125
+ | — | `POP_AGENT_UPDATE_CHECK` | `on` | `off` disables the startup release check (offline / intranet / CI) |
126
+
127
+ ### Common examples
128
+
129
+ ```bash
130
+ pop-agent # foreground + open the page (the usual one, Ctrl-C to quit)
131
+ pop-agent -d # background, terminal handed straight back
132
+ pop-agent -p 9191 # different port (when 9090 is taken)
133
+ pop-agent status && pop-agent restart # check, then restart
134
+ pop-agent stop # stop it (works for foreground and background)
135
+ pop-agent --data-dir ~/pop-agent-data # different data directory
136
+ POP_AGENT_CWD=~/code/my-proj pop-agent # set the default workspace
137
+ pop-agent -H 0.0.0.0 # reachable outside (set the password locally first)
138
+ pop-agent -H 0.0.0.0 -P 'my-pass' # start with a password — saved, so restarts keep it
139
+ ```
140
+
141
+ > **Reaching it from your phone**: `pop-agent -H 0.0.0.0`. Set the password **on the machine running it first**: open `http://127.0.0.1:9090/` and use the field in **Settings → Remote** (or open `/setup`, or start with `-P`).
142
+ > The password lives in the data directory's `password` file (default `~/.pop-agent/password`) — no environment variable needed. Afterwards **a LAN IP, a public IP or a domain** all work by entering that password; **no `--allow-host` allowlist** is required.
143
+ > It can only be set locally: while unset, remote visitors just see "set it on the host machine" (`/setup`, `/api/auth/setup` and `/api/auth/password` return 403 for remote). Otherwise whoever scanned the port first would take over. Reverse proxies / tunnels should pass `X-Forwarded-For` (origin checking looks at it).
144
+ > **Login protection**: after **3** wrong passwords from the same source, sign-in is paused for **30 minutes** (the password is not even compared while locked). Change both numbers in **Settings → Remote** (1–20 tries, 1–1440 minutes); the policy and any live locks are stored in `<data dir>/login-guard.json`, so a restart does not unlock anyone. Settings → Remote also lists recent **login activity** (source IP, success, which wrong try, lockouts — newest first), kept in `<data dir>/login-activity.json` (last 200 events).
145
+ >
146
+ > **Running `pop-agent` from your home directory** works, but home is an unsafe workspace (the file tree, search and the agent's cwd would be your whole home). In that case it falls back to `<data dir>/workspace` and prints a line about it; to point at a project use `POP_AGENT_CWD=/path/to/project`.
147
+
148
+ Each engine also has its own escape hatches (all have defaults; you normally don't touch them): `POP_AGENT_CODEX_BIN` / `_HOME`, `POP_AGENT_DSH_BIN` / `_HOME` / `_MODEL` / `_PATCH`, `POP_AGENT_OPENCODE_BIN` / `_ARGS` / `_MODEL`, `POP_AGENT_CLAUDE_BIN` / `_ARGS` / `_MODEL` (it auto-detects `claude-code-acp` / `claude-agent-acp` and says so when neither is installed).
149
+
150
+ ---
151
+
152
+ ## What it is, what it isn't
153
+
154
+ **It is**: a front end that spreads the agent's *process* out in front of you. Thinking blocks, tool calls, changed files, tokens and cost all live in the conversation stream. You can cut in mid-turn, highlight a passage to file a comment on it, or open a scratch chat that never touches disk just to ask one question.
155
+
156
+ **It is not**: a new agent engine, and it is not a SaaS that moves your sessions into the cloud. It does not rewrite prompts and does not take over tool implementations — what you install is pi / Codex / Claude Code / opencode / DeepSeek Harness, and the workbench just gives them a readable UI, clickable buttons, and a session list that survives restarts.
157
+
158
+ Three hard rules:
159
+
160
+ 1. **No database**: a conversation *is* the JSONL / thread the engine wrote. The web UI reads it, renames it, and deletes it when asked.
161
+ 2. **No pretending**: anything an engine can't do is hidden in the UI (the capability matrix); a panel that can't get data says so, and no other engine's config is passed off as this one's.
162
+ 3. **No overreach**: it listens on `127.0.0.1` only by default; exposing it remotely takes `-H` plus a password set locally (**Settings → Remote**, or `-P`).
163
+
164
+ ---
165
+
166
+ ## Conversation
167
+
168
+ **Streaming text + collapsible thinking blocks + tool cards.** A tool card shows arguments, the full command (copyable), output, duration and pass/fail. While the turn runs, thinking and tool calls **show only the one line of narration from the newest group** (no thinking rows, no tool cards — the command that is actually running is reported by the status line at the very bottom; the "N thinking · N tools · Xs" stopwatch sits on top), then **fold into that row when the turn ends** (everything before the final conclusion) — click it to get the full timeline back, so only the final answer stays on screen.
169
+
170
+ ![The footer of one reply: a markdown table, the changed-files chip, and this turn's tokens / cache / cost](docs/site/assets/en/answer.webp)
171
+
172
+ The footer of every reply is the usage **for that turn**: input (cache miss) / output / cache read / cost, with a "Copy" that takes the whole block. The running total for the session is behind the context ring in the status bar (subagents are separate sessions billed separately and are not counted there).
173
+
174
+ A few things in the conversation are clickable:
175
+
176
+ - **Changed-files chip**: which files this reply touched (the chip at the bottom of the screenshot above shows `store.ts`); one click lands you straight on the diff in the right pane.
177
+ - **Branch icon**: "Branch from here", which starts a new conversation at this message; the original stays byte-for-byte unchanged.
178
+ - **File paths**: a path like `web/src/App.tsx` in the body opens in the preview.
179
+
180
+ ### Cutting in, queueing, stopping
181
+
182
+ While a turn is running, the composer does not lock up:
183
+
184
+ | Action | Meaning |
185
+ |---|---|
186
+ | **Steer** | Takes effect immediately, inserted into the current turn as the next instruction |
187
+ | **Queue** | Wait until this turn ends; you can see what's at the head of the queue and retract anything |
188
+ | **Stop** | Interrupt the turn and keep whatever was already produced |
189
+
190
+ Steering is pi-only (its SDK has `streamingBehavior: "steer"`). Other engines have no such notion, so the host **degrades it to queueing** rather than firing a second message that would flush the active turn.
191
+
192
+ ---
193
+
194
+ ## Notes: highlight a passage and comment on it
195
+
196
+ **Select some text in the conversation** and a small toolbar floats up: `Add to session` / `Annotate` / `Ask in a temp session`.
197
+
198
+ <table><tr>
199
+ <td width="50%"><img src="docs/site/assets/en/selection.webp" alt="The toolbar that floats up after you select a passage"></td>
200
+ <td width="50%"><img src="docs/site/assets/en/annotations.webp" alt="After annotating: a numbered badge stays in the body, and a 1-note pill shows up in the composer"></td>
201
+ </tr></table>
202
+
203
+ "Annotate" attaches a comment to that text. The body keeps a **①②③ numbered badge**, and an "N notes" pill appears in the composer — open it to read, edit or delete each comment, or `Quote it`.
204
+
205
+ On send it is assembled into a block like this (you can also hit `Quote it` yourself, in which case only your own words go out):
206
+
207
+ ```
208
+ Note 1:
209
+ > The panel starts at y=0, but the top bar's z-index is 45
210
+
211
+ This needs to be one sentence shorter
212
+ ```
213
+
214
+ Notes are **local anchors**: they locate themselves by "quoted text + surrounding context", so badges still find their place after the body reflows or a stream appends more text. They live in this browser's `localStorage`, isolated per session — never on the server, never in the cloud, invisible from another device.
215
+
216
+ **Line references in files** are the other road: select lines in the preview (`Shift+click` for a range, `Ctrl/Cmd+click` to add, right-click for the line menu) and "Add to conversation" writes a **path plus line numbers** such as `@web/src/App.tsx:120-138`, leaving the agent to read it.
217
+
218
+ ---
219
+
220
+ ## Side chat: ask one question and go
221
+
222
+ ![The "side chat" on the right is a channel of its own: never saved, while the main conversation keeps running](docs/screenshots/13-tempchat.png)
223
+
224
+ The `Temp session` button in the top bar (or the first card on the right pane's landing page) opens another conversation **in the right pane**:
225
+
226
+ - **Not persisted**: it lives in memory, dies with the tab, never enters the sidebar and leaves no file;
227
+ - the main conversation keeps running; the two don't interrupt each other;
228
+ - to keep it, hit `Save as a regular chat` — only then is a session file written (history the ephemeral chat never had is preserved too);
229
+ - you can have several open at once, each on its own channel and its own tab.
230
+
231
+ > This depends on the engine having an in-memory session: pi supports it; a Codex thread already lives in Codex's own store, so there is no "save" button. It is not "a new session in a different skin", and it is not a subagent — **an ephemeral chat is a window you opened, a subagent is a subtask the agent dispatched**.
232
+
233
+ ---
234
+
235
+ ## Files, diffs, git, search
236
+
237
+ The files area sits at the bottom of the sidebar and also works as a tab in the right pane. **The web side is read-only**: you can look, compare, reference and search; editing files in place and saving them is not this layer's job — give that to the agent's tools or the terminal, and use the diff here to review it.
238
+
239
+ | Capability | Notes |
240
+ |---|---|
241
+ | Directory tree | Switchable root (follow the session / pick a project), lazy loaded, at most 500 entries per directory, `node_modules` / `.git` / `dist` hidden by default, "show hidden files" reveals `.env` and friends |
242
+ | Search by file name | Matches names only, never reads contents, 250 ms debounce, at most 200 hits |
243
+ | Preview | markdown (tables / code highlighting / mermaid), source with line numbers, images, PDF, audio and video streams; multiple tabs, drag to reorder, right-click to close left / right / all, and it can be spread over the full width |
244
+ | Line references | Select lines → "Add to conversation" writes `@path:line`; a text selection can also be "copy selected text" |
245
+ | Reveal in Finder | macOS `open -R`, Windows `explorer.exe /select,`, Linux opens the parent directory |
246
+ | Uncommitted changes | Status dots in the file tree, plus `M` / `U` / `D` after the filename |
247
+
248
+ ### Diff
249
+
250
+ ![The diff view: against HEAD, a `+6 −1` summary plus line-level red/green](docs/site/assets/en/diff.webp)
251
+
252
+ The "diff" toggle at the top of the preview is a comparison against `HEAD`: a `+285 −78` summary, line-level red/green, and a switch between "changes only" and the full file. Coming in from a changed-files chip lands directly on the diff.
253
+
254
+ ### git
255
+
256
+ The branch chip at the top of the files area lists local branches and switches them (a dirty working tree asks first). It only shells out to `git` for reads and branch switches — it never commits. Committing stays with the agent, or with you in a terminal.
257
+
258
+ ### Content search
259
+
260
+ "Search file contents" in the toolbar is a full-text search: add a **path mask** (such as `web/src/**`) to narrow it, results show `file:line` plus a snippet of the source, and clicking one jumps to that line. When there are too many hits it truncates at the cap and says so.
261
+
262
+ ---
263
+
264
+ ## Terminal
265
+
266
+ ![The right-pane terminal is a real PTY: zsh, colors, git output, and a cwd that matches the session](docs/screenshots/04-terminal.png)
267
+
268
+ The terminal in the right pane is a **real PTY** (`node-pty` + xterm.js): vim / top / Ctrl-C / colors / line editing all behave, the cwd matches the session's project, and you can pass one initial command (the upgrade flow uses exactly that).
269
+
270
+ Reloading the page does not restore a terminal session (the PTY exits with the page); switching tabs does not break it. On Linux `node-pty` has to be compiled in place, and when the tools are missing the UI says exactly what to install.
271
+
272
+ ### Built-in web page
273
+
274
+ The right pane also opens web pages: type a URL and view it in an iframe, with requests going through **a local proxy** (`/web/p/<url>`) — it fetches the document and strips the `X-Frame-Options` / CSP framing restrictions, so sites like Baidu open too. The proxy has boundaries: HTML/CSS documents only, **no cookies in and none out**, a 12 MB upstream cap, and an iframe sandbox without `allow-same-origin`. For sites that need a login or heavy JS, hit `⧉` to jump to the system browser.
275
+
276
+ ---
277
+
278
+ ## Engines: each runs its own native loop
279
+
280
+ The engines are not "the same prompt in different costumes" — each is that vendor's own agent loop:
281
+
282
+ | Engine | How it's wired | Notes |
283
+ |---|---|---|
284
+ | **pi** (default) | Native SDK | The full plugin / skill ecosystem, lazy tool loading, the approval gate, subagents, steering; models and providers are managed by this workbench |
285
+ | **Codex** | app-server (JSON-RPC) | Its own loop and sandbox; sessions are shared with Codex Desktop / CLI; approvals are command- and file-level |
286
+ | **DeepSeek Harness** | ACP | Model and thinking level are switchable; permissions confirmed one by one |
287
+ | **opencode** | ACP | Its own tools / MCP / plugin ecosystem; sessions are shared with the opencode CLI / TUI; approvals follow opencode's own `permission` config |
288
+ | **Claude Code** | ACP (the `claude-code-acp` adapter) | Switchable models, per-call tool confirmation; sessions are shared with the `claude` CLI; this ACP surface exposes neither thinking levels nor subagents |
289
+ | **fake** | Built-in scripted engine | Zero tokens, only for exercising the protocol / tools / approval flow (not in the picker by default) |
290
+
291
+ The differences (the capability matrix in `server/engine/registry.ts`, which the UI uses to hide buttons):
292
+
293
+ | Capability | pi | codex | dsh | opencode | claude |
294
+ |---|:-:|:-:|:-:|:-:|:-:|
295
+ | Approvals | ✅ | ✅ | ✅ | per config | ✅ |
296
+ | Model / thinking level | ✅ | ✅ | ✅ | ✅ | model only / no levels |
297
+ | Resume past sessions | ✅ | ✅ | ✅ | ✅ | ✅ |
298
+ | Steering | ✅ | — | — | — | — |
299
+ | Subagent panel | ✅ | — | — | — | — |
300
+ | Workbench-managed providers | ✅ | — | — | — | — |
301
+ | Side chat (in memory) | ✅ | — | — | — | — |
302
+
303
+ **The models / plugins / MCP panels follow the active engine**: switch to Codex and the panels read Codex's own data (`model/list`, `plugin/list`, `config/read`); claude reads `~/.claude.json` and `~/.claude/settings.json`; opencode reads `opencode.json`. A panel that has nothing wired says so instead of borrowing pi's config.
304
+
305
+ Engines are switched in the **bottom status bar** (not the top bar), and every session remembers its own engine, model and thinking level.
306
+
307
+ ---
308
+
309
+ ## Models and providers
310
+
311
+ ![The models panel: the providers with a key or a signed-in subscription on the left, and that provider's endpoint, API shape and model allowlist on the right](docs/site/assets/en/models.webp)
312
+
313
+ - **Subscriptions**: OAuth login (9 providers), usable right after signing in — no key to copy by hand.
314
+ - **Official built-ins**: the ones pi's catalog carries models for — **paste one key and it works**; endpoints and model tables come from the catalog.
315
+ - **Bring your own**: change the API shape (openai-completions / responses / anthropic-messages / codex / typesafe), the base URL and custom headers, and add models one by one.
316
+ - Tick models individually (only ticked ones are saved), batch-test connectivity, pull the list from `/models`, and save the ticked set as the allowlist.
317
+
318
+ **Keys never leave the server**: the API returns only `hasKey` and the last 4 digits; writes are serialized inside the process so concurrent edits can't corrupt a file.
319
+
320
+ The truth is spread across `~/.pi/agent/models.json` (the provider catalog), `models-store.json` (the legacy location) and `auth.json` (`api_key` or OAuth credentials), with the allowlist in `settings.json.enabledModels`.
321
+
322
+ ---
323
+
324
+ ## Skills
325
+
326
+ ![The skills panel: installed / enabled / disabled on the left, this skill's SKILL.md summary and its directory files on the right](docs/site/assets/en/skills.webp)
327
+
328
+ Reads `~/.agents/skills/<dir>/SKILL.md`; the list parses frontmatter only (no yaml dependency). **Enabling or disabling means renaming `SKILL.md` to `.SKILL.md.disabled`** — there is no second state file, so what you see in the CLI agrees with what you see here.
329
+
330
+ **Skill Hub**: search by category plus one-click install (200k+ index); it can also install a specific `skills/<name>` from a Git repo, or create one by hand.
331
+
332
+ ---
333
+
334
+ ## MCP
335
+
336
+ ![The MCP panel: global and project configs, enable/disable and exposure, test connection, OAuth](docs/site/assets/en/mcp.webp)
337
+
338
+ Reads and writes two config files: `~/.pi/agent/mcp.json` (global) and `<workspace>/.pi/mcp.json` (project), where **a project entry with the same name overrides the global one**, and writes preserve indentation and CRLF.
339
+
340
+ - exposure has four levels: **codemode (default) / deferred / direct / hidden**;
341
+ - **Test connection**: a real handshake plus `tools/list`, then disconnect; it reports the connection state and the tool count;
342
+ - OAuth login, pick a server from a marketplace, paste a command / URL / JSON and let it be parsed;
343
+ - **the config is the truth**: pi connects at session start, so edits apply to **new sessions**.
344
+
345
+ ---
346
+
347
+ ## Plugins
348
+
349
+ ![The plugins panel: the four states of a pi package, and disabling per package](docs/site/assets/en/plugins.webp)
350
+
351
+ Plugins are pi packages: the `packages` entry in `settings.json` (npm / git / local directory) plus the loose `~/.pi/agent/extensions/` and `<ws>/.pi/extensions/`.
352
+
353
+ State comes from the pi SDK's `resolve()` (**querying never triggers `npm install`**), with four states `loaded / installed / missing / disabled`; disabling per package writes `autoload:false` and deletes nothing.
354
+
355
+ ---
356
+
357
+ ## Subagents: run many, manage each
358
+
359
+ ![The subagents panel: built-in templates, default concurrency, the master switch](docs/site/assets/en/agents.webp)
360
+
361
+ Once the main agent has the `Agent` tool it can run several subagents in parallel, and each one is **a real session** (its own context, session file and tool allowlist).
362
+
363
+ - **Watch**: the subagent card strip above the composer — status, duration, tool count, tokens, cost. "View result" expands the raw result and the session file path in place, and any single run can be stopped. The heading gives the at-a-glance count (`2 running` / `8 finished`).
364
+ - **Manage**: the top-bar "subagents" panel manages **templates** (built in: explore / general-purpose / plan, each disableable; you can also create, edit and delete your own): `name / display_name / description / tools / model / thinking / max_turns`. They land in `~/.pi/agent/agents/*.md`, in the same format as pi's agent files — readable, editable, git-friendly.
365
+ - **Concurrency**: 1–12 (default 4); anything beyond that queues. Turn the master switch off and the model no longer sees the `Agent` tool.
366
+ - **Isolation**: subagents load no skills / plugins / themes / context files by default (fast and predictable); a subagent that doesn't pin a model keeps using the parent session's model.
367
+
368
+ A subagent's session file is archived next to the parent session (`<parent session dir>/<parent name>/subagents/`) and never shows up in the sidebar's project list.
369
+
370
+ ---
371
+
372
+ ## Push
373
+
374
+ ![Push: local push state, target devices, test push](docs/site/assets/en/push.webp)
375
+
376
+ **Push**: Web Push (VAPID) subscriptions, one notification per finished turn — title is the project, body is the session, with a ❌ / ⏹ prefix for failures and interrupts. Multiple devices, a test push, and a one-click clear-all. Needs https or localhost.
377
+
378
+ The VAPID key pair and the contact (subject) are managed in the same panel: the pair is generated on first start into `<dataDir>/vapid-keys.json` (0600, overridable with `VAPID_PUBLIC_KEY` / `VAPID_PRIVATE_KEY`), the contact is stored in `<dataDir>/push-config.json` (overridable with `VAPID_SUBJECT`).
379
+ **The subject must be a real email or an https site**: the default `mailto:noreply@localhost` is rejected by Apple with `403 BadJwtToken` (Chrome/FCM ignores it, so the usual symptom is “works on the desktop, silent on the iPhone”). Replacing the key pair invalidates every subscription (the panel clears them; re-register each device). Changing the contact invalidates nothing.
380
+
381
+ ## Voice
382
+
383
+ ![The voice panel: four event sounds with preview and volume, cue volume and rate, speech in and out](docs/site/assets/en/voice.webp)
384
+
385
+ Four event sounds (start / finish / error / waiting for approval) with preview and adjustable volume; TTS reads the final reply, with adjustable rate and voice. By default speech output is the **browser's built-in voices** — offline, nothing leaves the machine; switch the speech engine to `edge` (Microsoft, needs network) or point it at your own `kokoro` / `qwen3` in the same panel.
386
+
387
+ Speech input lives here too: tap the mic bubble to dictate and the text lands in the composer as you speak (drag the bubble anywhere); "send when I stop talking", the silence threshold, how long to wait before sending and continuous dictation are all in this panel.
388
+
389
+ ### Which engines are the default (read this before handing the project to someone)
390
+
391
+ | | Default | What the other machine needs |
392
+ |---|---|---|
393
+ | **Voice input** (speech → text) | `Auto`: local on-device first (macOS `SFSpeechRecognizer`); when the local engine isn't installed or fails it goes **straight to Chrome's built-in** recognizer (no toast, no wasted round) | Local: the machine **running the server** is macOS — click **Install it** in Settings → Voice once (it downloads a small helper app; no Xcode needed), one “Speech Recognition” prompt on first use. Chrome: the browser can reach Google |
394
+ | **Voice output** (text → speech) | The **browser's built-in** voices (macOS system voices / Windows SAPI), offline | Pick `edge` (Microsoft, needs network) or host `kokoro` / `qwen3` yourself (Voice → Remote) |
395
+
396
+ So “the defaults are Google + Microsoft” is only half true: input is **not** Google by default (local first, Google is the fallback), and output is **not** Microsoft by default (system voices; edge-tts is opt-in).
397
+
398
+ Three things people trip on:
399
+
400
+ - **Local recognition runs on the server machine** (the browser only streams audio), so on a Linux / Windows host the local engine simply isn't available and Chrome's engine is all that's left;
401
+ - Opening the app over plain LAN `http://` on a phone gives you **no microphone** (`getUserMedia` requires `localhost` or HTTPS);
402
+ - Voice-input settings (near-field gate, silence threshold, keep-listening…) are stored **once per server**, shared by everyone using it — the last edit wins; voice and rate preferences stay in each browser's `localStorage`.
403
+
404
+ ---
405
+
406
+ ## Scheduled tasks: say it once, it runs every morning
407
+
408
+ ![The scheduled-tasks panel: three tasks with mode, next run time and switch, plus the run history on the right](docs/site/assets/en/cron.webp)
409
+
410
+ A task is a prompt plus a five-field cron expression and a timezone. The panel's schedule picker covers every-N-minutes / every-N-hours / daily / weekdays / weekly / monthly, and anything else goes in as a raw expression (`0 9 * * *` = 09:00 every day).
411
+
412
+ - **Two kinds of task**: `Text` calls the model directly — no tools, no repo access, the cheapest way to draft something; `Agent` runs a real turn in the workspace (read files, run commands, change code).
413
+ - **Where it runs**: every run can open a new session, or continue an existing one you pick from the list (same context, model and workspace); the model follows that session's model, or the project default.
414
+ - **Unattended means unattended**: an agent run is registered as `deny-writes`, because an approval prompt at 3 a.m. has nobody to answer it. Writes are refused unless the task explicitly ticks "allow file writes", and a run that reaches the 20-minute timeout is interrupted and recorded as a **failure** — never as half a result.
415
+ - **Created from the chat as well**: on the pi engine the agent has a `cron` tool (`add / list / update / remove / enable / disable / run_now / preview`). Say "check this repo's changes every morning at 9" and it fills in name, workspace and timezone from the conversation — defaulting to **this** session, so the task keeps your context. `list` / `preview` are read-only, the rest ask for approval, and `run_now` is always explicit: it won't "just try it once".
416
+ - **One source of data**: `<dataDir>/cron.json` (`jobs` + `runs`). The panel refreshes every 5 s, so tasks the agent created appear on their own, and each run keeps its trigger (manual / scheduled), status and text result.
417
+
418
+ > The `cron` tool is pi-only (ACP engines have no `registerTool`); the panel itself works with every engine. And a task's own turn can't create tasks — unattended cron calls are denied.
419
+
420
+ ---
421
+
422
+ ## Computer control: let the agent drive your Mac
423
+
424
+ ![The computer-control panel: master switch, helper status with its two permissions, and what shows on screen while it works](docs/site/assets/en/computer.webp)
425
+
426
+ **macOS only**, and it needs a local helper — *Agent Computer.app* — which the panel looks for in `/Applications` and `~/Applications`. When it's missing the panel says so and links the download; when it's there you get a real status block: installed path, running + version, **Accessibility**, **Screen recording**.
427
+
428
+ - **The master switch is the skill**: turning it on writes `~/.agents/skills/agent-computer`, so *any* engine that has bash can drive the Mac — not just pi. Turning it off renames the skill to disabled; nothing is deleted.
429
+ - **What it can do**: read the numbered accessibility tree plus a window screenshot, click by element number (`AXPress`, coordinates as fallback), type / fill / paste (long text goes through the clipboard and your clipboard is restored afterwards), send key combos (`cmd+s`), scroll, drag in steps, run menu commands, and wait for the UI to settle between steps.
430
+ - **What it refuses**: password fields (`AXSubrole` is secure, or the placeholder looks like a password) are never typed for you; apps that system authentication and System Settings protect stay protected unless you list them under "unprotected apps", and password managers still ask you inside the helper.
431
+ - **What shows on screen**: an optional live preview window, an activity watermark and a pointer ring following the cursor, plus "borrow the foreground briefly" and "activate the target app while you are idle". Pointer speed and the delay between typed keys are adjustable — too fast is exactly what makes an app drop input.
432
+ - **Settings live with the helper**: the panel writes the helper's own `~/Library/Application Support/AgentComputer/settings.json`, with no second copy. The file is the truth and the panel is just a form.
433
+
434
+ ---
435
+
436
+ ## Settings
437
+
438
+ ![Settings → Appearance: three font sizes, content width in 4 steps, 6 palettes](docs/site/assets/en/settings.webp)
439
+
440
+ The top bar is the entry point for every panel, and **each entry can be hidden in Settings → Interface**. A fresh install ticks only **models / scheduled tasks (cron) / skills**; push, voice, plugins, MCP, subagents, settings and the temp session are ticked back on when you want them (the top-bar Settings button starts hidden — the leftmost chip in the bottom status bar opens the same panel). The bottom status bar starts with **settings / engine / approval mode** only; queued, running, context, full history, system prompt, terminal and the top toggle come back from Settings → Interface → Bottom, where you can also drag to reorder. The sidebar and the right pane both drag wider and collapse, and their widths are remembered locally in `localStorage`.
441
+
442
+ The "settings" button opens six pages, and the tabs themselves drag to reorder — **whichever sits first is the page that opens next time**:
443
+
444
+ | Page | Contents |
445
+ |---|---|
446
+ | **Interface** | The frame: which top-bar entries show (text and icon ticked separately), which status-bar chunks show (queue / working / context usage), how many sessions each project lists in the sidebar, and the max width of images in the chat |
447
+ | **Conversation** | What the chat area itself looks like: which blocks sit above the composer (templates / think / quick commands), the text of your quick phrases and the default thinking level (these two are saved server-side, identical on every device), whether cost shows in the conversation, and whether thinking blocks and tool cards start expanded. **Built-in prompt templates and the default quick phrases (Continue / Summarize) are stored twice — Chinese original plus English**: an English UI shows the English copy (and inserts / sends it, not just the card titles); templates and phrases you edited or created yourself are never auto-translated |
448
+ | **Appearance** | Sizes only: three font sizes (chat body / sidebar project names / sidebar session names, slider 2–30px, default “Default” 14px), content width in 4 steps (720 / 900 / 1100 / full, default “Default” 900px), top-bar height (default 100% = standard), and the top-bar logo and name (both hideable, logo replaceable; custom renaming is gone — the bar shows the product name) |
449
+ | **Theme** | 6 palettes (bright white, warm paper, mist teal, Tokyo night, mocha, nord) — one click and it applies |
450
+ | **Language** | Chinese / English, applied immediately |
451
+ | **Shortcuts** | 12 actions, rebindable, clearable and restorable to defaults, plus a cheat sheet |
452
+
453
+ A seventh tab, **Remote**, is where the access password, the login guard (3 tries / 30 minutes by default) and the sign-in activity list live — see the phone and security sections.
454
+
455
+ Appearance, theme, interface and language preferences stay on the device only (`localStorage`, with the `pop-agent.` prefix) — one copy per phone, tablet and desktop. Only the quick phrases in "Conversation" are shared across devices.
456
+
457
+ ---
458
+
459
+ ## Mobile
460
+
461
+ <table><tr>
462
+ <td width="34%"><img src="docs/site/assets/en/mobile.webp" alt="Mobile single column: icon-only top-bar entries, 18px composer"></td>
463
+ <td width="34%"><img src="docs/site/assets/en/mobile-drawer.webp" alt="On a phone the project sidebar is an overlay drawer"></td>
464
+ </tr></table>
465
+
466
+ On narrow screens (mobile UA or ≤400px) the layout collapses to a single column:
467
+
468
+ - the sidebar becomes an overlay drawer (`clamp(260px, 76vw, 340px)`, tap the scrim to close, closes on its own after you pick a session);
469
+ - the top bar wraps, keeps icons only, and scrolls horizontally;
470
+ - the right-pane workspace becomes a full-screen second page that starts below the top bar using `100dvh` (dodging the iOS toolbars);
471
+ - the composer is 18px so iOS doesn't zoom on focus; the model menu becomes a bottom sheet;
472
+ - the status bar scrolls horizontally, and the context-usage popover becomes a full-width sheet.
473
+
474
+ ---
475
+
476
+ ## Sessions: pin, archive, fork, move project
477
+
478
+ The sidebar groups sessions into "projects" by directory:
479
+
480
+ | Action | Behaviour |
481
+ |---|---|
482
+ | Pin | Lifts a session or a project to the top |
483
+ | Rename | For pi: append `session_info.name` to the end of the jsonl |
484
+ | Archive | Into "archived", undoable |
485
+ | Delete | Renames to `.deleted-<timestamp>` (the engine's native delete is preferred when it has one) — **the file is still on disk** |
486
+ | Fork | Derive a new session from one message (the title becomes `Branch · …`), the original untouched |
487
+ | Move project | Drag a session row onto another project; the id and history stay, only the `cwd` in the file header changes and the directory is moved |
488
+
489
+ Sorting is a deliberate choice: **newest-created first inside a group** — a new session lands on top, and updating an old one doesn't move it (sort by last activity instead and a single message in an old session shoots it to the top, dragging the whole list along).
490
+
491
+ ---
492
+
493
+ ## Shortcuts and slash commands
494
+
495
+ **Every shortcut** is rebindable in Settings → Shortcuts (a combo needs `Mod`/`Alt`; a single key only works for one modifier alone — right ⌘ / right ⌥ / ⌃ / Alt — or a function key F1–F12; bare letters are rejected). On macOS `Mod` is ⌘, elsewhere it's Ctrl.
496
+
497
+ | Action | Default | Action | Default |
498
+ |---|---|---|---|
499
+ | New session | `Mod+K` | Open right panel | `Mod+Alt+O` |
500
+ | New project | `Mod+M` | Close right panel | `Mod+Alt+W` |
501
+ | Temp session | `Mod+Shift+K` | Toggle left sidebar | `Mod+Alt+L` |
502
+ | Settings | `Mod+Alt+S` | Files | `Mod+Alt+F` |
503
+ | New terminal | `Mod+Alt+T` | Search file contents | `Mod+Shift+F` |
504
+ | Shortcut cheat sheet | `Mod+/` | | |
505
+
506
+ The mic key does both, with no extra setting: **press to keep listening, press again to stop**; or **hold it, say one short thing, release to stop**.
507
+
508
+ **Slash commands** pop up when you type `/` in the composer. There are two kinds — `local` ones the workbench runs itself, and `to the agent` ones handed to the engine verbatim as a message:
509
+
510
+ | Command | Kind | What it does |
511
+ |---|---|---|
512
+ | `/new [first message]` | local | New conversation, optionally with its first message |
513
+ | `/name <name>` | local | Rename the current session |
514
+ | `/model <name>` | local | Switch model (fuzzy match on id or display name) |
515
+ | `/thinking <level>` | local | Set the thinking level (off / low / … / max) |
516
+ | `/copy` | local | Copy the last assistant message |
517
+ | `/session` | local | Message count / tokens / cost for the session |
518
+ | `/resume` | local | Refresh the session list (sessions another terminal just opened) |
519
+ | `/skill <skill name>` | to the agent | Use a skill (the panel lists the installed ones) |
520
+ | `/compact [note]` | to the agent | Compact the context |
521
+ | `/plan [on\|off]` | to the agent | Turn plan mode on or off |
522
+ | `/cwd <path>` | to the agent | Change the working directory |
523
+
524
+ ---
525
+
526
+ ## Architecture: SSE + RPC, no WebSocket
527
+
528
+ ```
529
+ browser ──GET /api/events (SSE)──▶ server one snapshot first, deltas afterwards
530
+ ──POST /api/rpc (JSON)──▶ ClientRequest → { reply } consumed in place
531
+ ```
532
+
533
+ - **Downstream**: one complete snapshot first, then deltas only. Text arrives as `message_delta` chunks appended block by block; structural changes (tool cards, errors, state) push a fresh snapshot, coalesced in a 60 ms window — snapshots are droppable, events are not. SSE heartbeats every 25 s.
534
+ - **Upstream**: `send_message`, `interrupt`, `approve`, `new_chat` (optionally with `ephemeral`), `switch_conversation`, `set_engine` / `set_model` / `set_thinking_level` / `set_approval_mode`, `persist_conversation`, `close_ephemeral`, `fork_session`, `move_session`, `cancel_queued`, `rename_session` and more.
535
+ - **The protocol has a single source** in `server/protocol.ts`; the frontend reuses its types, so one definition serves both ends.
536
+ - **The snapshot is the only source of truth**: `store.ts` uses `useSyncExternalStore` and replaces everything when a snapshot arrives. Locally only optimistic state survives (`preview` / `draft` / `pendingActive`).
537
+ - **Each client sees its own session** (ADR-0033): one server, two devices, each parked on a different conversation; bulk data such as the session list is only sent to a client when that client needs it.
538
+
539
+ Process model: `cli.ts` parses the flags → `session/lock.ts` grabs `<dataDir>/server.lock` (a live pid refuses to start, a dead pid means taking over a stale lock) → `runtime.init()` → `listen`. `SIGINT` / `SIGTERM` / `/api/shutdown` all go through the same graceful exit (flush, disconnect engines, release the lock).
540
+
541
+ ---
542
+
543
+ ## Where data lives
544
+
545
+ | Content | Location |
546
+ |---|---|
547
+ | pi sessions | `~/.pi/agent/sessions/<encoded cwd>/<ISO>_<uuid>.jsonl` (first line `{type:"session",id,timestamp,cwd}`) |
548
+ | Codex sessions | Codex's own thread store (`thread/list \| resume \| delete`) |
549
+ | opencode / DSH / claude sessions | Their own data dirs (opencode lists per cwd with `session/list`; DSH reads `~/.dsh`; claude reads `~/.claude`) |
550
+ | Session titles | For pi, the first user message (reads only the first 60 lines); renaming appends `session_info.name` |
551
+ | Workbench state | `<dataDir>/settings.json`, `approval-rules.json`, `cron.json`, `server.lock`, `logs/`, `uploads/`, `push-subscriptions.json`, `vapid-keys.json`, `push-config.json` |
552
+ | Skills / subagent templates / MCP | `~/.agents/skills/`, `~/.pi/agent/agents/`, `~/.pi/agent/mcp.json` |
553
+ | Computer control | `~/.agents/skills/agent-computer/` (the skill), `~/Library/Application Support/AgentComputer/` (helper config, allowlist, socket, screenshots) |
554
+ | Local UI preferences | Browser `localStorage` (`pop-agent.` prefix: theme, font sizes, widths, shortcuts, notes, tabs) |
555
+
556
+ ---
557
+
558
+ ## Security model
559
+
560
+ - Binds `127.0.0.1` by default and decides identity from the real peer address (`X-Forwarded-For` when a local proxy is in front) plus the `Host` header.
561
+ - Identity: a loopback peer **and** a loopback Host → allowed. With no password set, remote requests always get 403. The password is stored in `<data dir>/password` (one plaintext line, 0600) and can be set/changed **only locally** (Settings → Remote, `/setup`, or `-P`); changes apply immediately without a restart. With a password, either the cookie (`pop-agent-auth`, 7 days, HttpOnly) or HTTP Basic will do; failed logins are paused for 30 minutes after 3 wrong tries by default (change it in Settings → Remote: 1–20 tries, 1–1440 minutes; locks are persisted and survive a restart).
562
+ - **No domain / IP allowlist**: any domain, public IP, LAN IP or tunnel works once the password is in. The cross-origin check only guards requests that genuinely come from **this machine** (loopback needs no password, so that is the CSRF target); remote requests are already behind the password gate. It judges by the real source address (`X-Forwarded-For` included), so a reverse proxy that rewrites `Host` to `127.0.0.1` does not lock out its own domain.
563
+ - Tools and commands go through approvals: **read-only tools** (read / grep / find / ls) and read-only commands pass automatically, everything else is asked per `scopeKey` (tool + executable name or target directory). Choosing "always allow" writes the rule into `approval-rules.json` (atomic write; a corrupt file counts as empty).
564
+ - When a turn ends, every pending approval for that session is cleared, so nothing hangs waiting for a human.
565
+ - Uploaded temp files and session caches live in the data directory, never in your project.
566
+ - The built-in web page's proxy carries no cookies, and its iframe sandbox omits `allow-same-origin` (otherwise remote JS could reach `localStorage` and the RPC endpoint).
567
+
568
+ > Exposing it remotely is an explicit act: `-H` to be reachable plus a password set locally (Settings → Remote, or `-P`). Domain/IP allowlists are not needed.
569
+
570
+ ---
571
+
572
+ ## Development
573
+
574
+ From the repo root, run `npm install` first, then:
575
+
576
+ ```bash
577
+ npm run dev # starts both processes with one command
578
+ ```
579
+
580
+ - Externally there is still a single port **9090** (Vite listens and proxies); the backend hides on internal **9091**, so dev and production use the same address.
581
+ - Frontend HMR via Vite; the backend auto-restarts through `tsx --watch`.
582
+ - Phone debugging: `npm run dev -- --host 0.0.0.0`.
583
+
584
+ | Command | Purpose |
585
+ |---|---|
586
+ | `npm run typecheck` | Two `tsc --noEmit` runs: server + web |
587
+ | `npm run lint` | oxlint over `server` / `web/src` / `scripts` |
588
+ | `npm run format` | Prettier across the repo (`format:check` only checks; `*.md` is deliberately skipped) |
589
+ | `npm run build` | Server `tsc` + frontend `vite build` into `web/dist` |
590
+ | `npm run icons` | Regenerate the PWA icons with playwright-core |
591
+
592
+ Two workflows, no separate `ci.yml`:
593
+
594
+ - `.github/workflows/release.yml` (on `v*` tags, or manual): `npm ci` → typecheck → lint → build → `npm pack --dry-run` → `npm publish` (OIDC). Unit tests and `format:check` are **not** gating yet.
595
+ - `.github/workflows/pages.yml` (on `docs/site/**`): publishes the landing page to GitHub Pages as-is.
596
+
597
+ Unit tests are run locally: `node --import tsx --test tests/unit/*.test.ts`.
598
+
599
+ ---
600
+
601
+ ## Troubleshooting
602
+
603
+ > **Why `npm ci` and not `npm install`**: the direct dependencies are all very new, and `npm install` re-resolves the version ranges against the registry — if your mirror (corporate Nexus, npmmirror, …) hasn't synced those versions you get `npm error notarget`. `npm ci` uses the exact versions from the lockfile.
604
+
605
+ 1. `npm error notarget No matching version found` → the mirror is behind. Check `npm config get registry`, then fall back to the official one: `npm -g install pop-agent --registry=https://registry.npmjs.org/`.
606
+ 2. `EBADENGINE` / a Node version complaint at startup → you need Node ≥ 22.19 (check with `node -v`).
607
+ 3. `node-pty` fails to build (mostly on Linux) → install `python3` / `make` / `g++` before `npm -g install`, or let the one-line installer handle it with `--with-build-tools`.
608
+ 4. It won't start but `pop-agent status` mentions a stale lock → a previous process didn't exit cleanly; the next `start` takes over automatically. If it's truly stuck, delete `<dataDir>/server.lock`.
609
+ 5. Port already in use → `pop-agent -p 9191`, or run `pop-agent stop` first.
610
+ 6. The built-in web page is blank → that site needs a login or heavy scripts, and the proxy does not tunnel cookies; hit `⧉` to use the system browser.
611
+ 7. `engine.provider_error: This operation was aborted` (occasional) → the **transport** was cut (the model had just connected, a proxy swapped connections, the request body was reclaimed), not the model refusing. Transient errors like this are now retried twice automatically (1 s / 3 s backoff, with only one "retrying" line in the UI) and a successful retry ends with no error at all. If it still fails, search `<dataDir>/logs/pop-agent.log` for `provider 报错` / `模型调用失败` — every entry carries `sessionId`, `attempt`, `code` and the raw `message` (before this, such errors left nothing in the log at all). Interrupts you caused by pressing Stop are never retried and never turn into a red bar.
612
+ 8. To see what the engine is actually doing → `POP_AGENT_LOG=info pop`: the SDK's own retry (`pi 自动重试`), a successful retry (`自动重试成功`) and `这一轮被中断` all land in the log.
613
+ 9. `请求失败:HTTP 502` (or "the backend is restarting or not up yet (HTTP 502)") → this is the **frontend → backend** hop, not a model error: under `npm run dev`, Vite (9090) proxies the backend (9091), and saving a file under `server/` restarts the backend — in that one-or-two-second window `POST /api/rpc` returns 502 (the terminal shows `http proxy error: connect ECONNREFUSED 127.0.0.1:9091`), and the running turn is cut with it (the tell: the last message in the session is a `toolUse` with no `errorMessage`). In dev the backend now retries for 6 seconds when the port isn't released yet, and the red bar clears itself once SSE reconnects; **run long turns with `pop`** (the built `dist`, with no watch restart).
614
+
615
+ Windows differences in shell resolution, process-tree teardown, path handling, permissions and CRLF are all centralised in three modules: `server/util/spawn-cli.ts` (PATH/PATHEXT, `.cmd` via `cmd.exe`, `killTree`), `server/util/paths.ts` and `web/src/path-utils.ts` (separators and absolute paths), and `server/util/file-mode.ts` (`icacls` on Windows). Read those headers before touching cross-platform code.
616
+
617
+ ---
618
+
619
+ ## License
620
+
621
+ MIT