@herbertgao/pi-extensions 2026.8.2 → 2026.8.4

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 (392) hide show
  1. package/README.md +50 -2
  2. package/examples/pi-footer.json +275 -0
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +6 -8
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -7
  5. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +101 -0
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -17
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +5 -3
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{utils/agent-summary.ts → feature/agent-summary/core.ts} +37 -35
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-summary.ts → agent-summary/index.ts} +2 -6
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference.ts → reference/index.ts} +1 -1
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-autocomplete.ts → reference/subagent.ts} +19 -9
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-startup-header.ts → shell/startup-header.ts} +1 -1
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{working-message.ts → shell/working-message.ts} +5 -2
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -28
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +379 -85
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +727 -0
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +65 -775
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{feature → renderer}/markdown-enhance.ts +35 -31
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-hover.ts → mouse/hover.ts} +5 -5
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-interaction.ts → mouse/interaction.ts} +34 -35
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-layout.ts → mouse/layout.ts} +5 -21
  22. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-packets.ts → mouse/packets.ts} +1 -1
  23. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-scroll.ts → mouse/scroll.ts} +48 -37
  24. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ansi-utils.ts +56 -1
  25. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-renderer.ts +2 -2
  26. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/line-width-safety.ts +1 -1
  27. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +12 -0
  28. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/write-execution.ts +1 -2
  29. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-grouping.ts → tool/grouping.ts} +18 -8
  30. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-result.ts → tool/result.ts} +4 -13
  31. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +0 -27
  32. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  33. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  34. package/node_modules/@herbertgao/pi-subagents/package.json +2 -2
  35. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +1 -0
  36. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +3 -1
  37. package/node_modules/@herbertgao/pi-subagents/src/index.ts +33 -35
  38. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +26 -35
  39. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +15 -1
  40. package/node_modules/pi-footer/CHANGELOG.md +145 -0
  41. package/node_modules/pi-footer/LICENSE +21 -0
  42. package/node_modules/pi-footer/README.md +354 -0
  43. package/node_modules/pi-footer/package.json +68 -0
  44. package/node_modules/pi-footer/src/cache.ts +106 -0
  45. package/node_modules/pi-footer/src/colors.ts +237 -0
  46. package/node_modules/pi-footer/src/config.ts +202 -0
  47. package/node_modules/pi-footer/src/event-widgets.ts +41 -0
  48. package/node_modules/pi-footer/src/extension-statuses.ts +102 -0
  49. package/node_modules/pi-footer/src/git.ts +135 -0
  50. package/node_modules/pi-footer/src/index.ts +268 -0
  51. package/node_modules/pi-footer/src/metrics.ts +141 -0
  52. package/node_modules/pi-footer/src/presets.ts +383 -0
  53. package/node_modules/pi-footer/src/render.ts +114 -0
  54. package/node_modules/pi-footer/src/separators.ts +52 -0
  55. package/node_modules/pi-footer/src/types.ts +122 -0
  56. package/node_modules/pi-footer/src/ui/color-level-confirm.ts +22 -0
  57. package/node_modules/pi-footer/src/ui/color-options.ts +195 -0
  58. package/node_modules/pi-footer/src/ui/config-lifecycle.ts +61 -0
  59. package/node_modules/pi-footer/src/ui/edit-colors.ts +13 -0
  60. package/node_modules/pi-footer/src/ui/events.ts +35 -0
  61. package/node_modules/pi-footer/src/ui/extension-status-picker.ts +60 -0
  62. package/node_modules/pi-footer/src/ui/extension-statuses.ts +73 -0
  63. package/node_modules/pi-footer/src/ui/fields.ts +252 -0
  64. package/node_modules/pi-footer/src/ui/global-menu.ts +126 -0
  65. package/node_modules/pi-footer/src/ui/helpers.ts +44 -0
  66. package/node_modules/pi-footer/src/ui/layout.ts +17 -0
  67. package/node_modules/pi-footer/src/ui/line-list.ts +19 -0
  68. package/node_modules/pi-footer/src/ui/model.ts +64 -0
  69. package/node_modules/pi-footer/src/ui/navigation.ts +29 -0
  70. package/node_modules/pi-footer/src/ui/option-edit.ts +93 -0
  71. package/node_modules/pi-footer/src/ui/overlay-render.ts +103 -0
  72. package/node_modules/pi-footer/src/ui/screen-context.ts +18 -0
  73. package/node_modules/pi-footer/src/ui/screen-controller.ts +27 -0
  74. package/node_modules/pi-footer/src/ui/screen-render.ts +32 -0
  75. package/node_modules/pi-footer/src/ui/screen-state.ts +20 -0
  76. package/node_modules/pi-footer/src/ui/screen.ts +243 -0
  77. package/node_modules/pi-footer/src/ui/screens/add-widget.ts +92 -0
  78. package/node_modules/pi-footer/src/ui/screens/confirm-exit.ts +52 -0
  79. package/node_modules/pi-footer/src/ui/screens/controller.ts +12 -0
  80. package/node_modules/pi-footer/src/ui/screens/edit-colors.ts +68 -0
  81. package/node_modules/pi-footer/src/ui/screens/edit-widget.ts +115 -0
  82. package/node_modules/pi-footer/src/ui/screens/extension-status-row.ts +61 -0
  83. package/node_modules/pi-footer/src/ui/screens/global.ts +75 -0
  84. package/node_modules/pi-footer/src/ui/screens/line-list.ts +108 -0
  85. package/node_modules/pi-footer/src/ui/screens/main.ts +99 -0
  86. package/node_modules/pi-footer/src/ui/screens/terminal.ts +121 -0
  87. package/node_modules/pi-footer/src/ui/screens/widget-list.ts +154 -0
  88. package/node_modules/pi-footer/src/ui/terminal-menu.ts +32 -0
  89. package/node_modules/pi-footer/src/ui/theme.ts +48 -0
  90. package/node_modules/pi-footer/src/ui/title-bar.ts +100 -0
  91. package/node_modules/pi-footer/src/ui/widget-actions.ts +76 -0
  92. package/node_modules/pi-footer/src/ui.ts +66 -0
  93. package/node_modules/pi-footer/src/widgets/context.ts +28 -0
  94. package/node_modules/pi-footer/src/widgets/core/active-tools.ts +17 -0
  95. package/node_modules/pi-footer/src/widgets/core/context-window.ts +24 -0
  96. package/node_modules/pi-footer/src/widgets/core/cwd-basename.ts +19 -0
  97. package/node_modules/pi-footer/src/widgets/core/cwd.ts +108 -0
  98. package/node_modules/pi-footer/src/widgets/core/event.ts +34 -0
  99. package/node_modules/pi-footer/src/widgets/core/external-status.ts +102 -0
  100. package/node_modules/pi-footer/src/widgets/core/model-provider.ts +20 -0
  101. package/node_modules/pi-footer/src/widgets/core/model.ts +35 -0
  102. package/node_modules/pi-footer/src/widgets/core/provider.ts +17 -0
  103. package/node_modules/pi-footer/src/widgets/core/session-name.ts +17 -0
  104. package/node_modules/pi-footer/src/widgets/core/text-verbosity.ts +17 -0
  105. package/node_modules/pi-footer/src/widgets/core/thinking-level.ts +17 -0
  106. package/node_modules/pi-footer/src/widgets/git/ahead-behind.ts +17 -0
  107. package/node_modules/pi-footer/src/widgets/git/branch.ts +81 -0
  108. package/node_modules/pi-footer/src/widgets/git/clean.ts +19 -0
  109. package/node_modules/pi-footer/src/widgets/git/deletions.ts +17 -0
  110. package/node_modules/pi-footer/src/widgets/git/diff.ts +38 -0
  111. package/node_modules/pi-footer/src/widgets/git/insertions.ts +17 -0
  112. package/node_modules/pi-footer/src/widgets/git/remote.ts +17 -0
  113. package/node_modules/pi-footer/src/widgets/git/root.ts +17 -0
  114. package/node_modules/pi-footer/src/widgets/git/sha.ts +17 -0
  115. package/node_modules/pi-footer/src/widgets/git/staged.ts +17 -0
  116. package/node_modules/pi-footer/src/widgets/git/status.ts +19 -0
  117. package/node_modules/pi-footer/src/widgets/git/unstaged.ts +17 -0
  118. package/node_modules/pi-footer/src/widgets/git/untracked.ts +17 -0
  119. package/node_modules/pi-footer/src/widgets/instance.ts +118 -0
  120. package/node_modules/pi-footer/src/widgets/layout/custom-text.ts +18 -0
  121. package/node_modules/pi-footer/src/widgets/layout/flex-separator.ts +32 -0
  122. package/node_modules/pi-footer/src/widgets/layout/separator.ts +57 -0
  123. package/node_modules/pi-footer/src/widgets/layout/spacer.ts +31 -0
  124. package/node_modules/pi-footer/src/widgets/options.ts +122 -0
  125. package/node_modules/pi-footer/src/widgets/project/runtime.ts +361 -0
  126. package/node_modules/pi-footer/src/widgets/registry.ts +223 -0
  127. package/node_modules/pi-footer/src/widgets/session/assistant-messages.ts +17 -0
  128. package/node_modules/pi-footer/src/widgets/session/compactions.ts +17 -0
  129. package/node_modules/pi-footer/src/widgets/session/elapsed.ts +18 -0
  130. package/node_modules/pi-footer/src/widgets/session/last-activity.ts +18 -0
  131. package/node_modules/pi-footer/src/widgets/session/messages.ts +19 -0
  132. package/node_modules/pi-footer/src/widgets/session/session-id.ts +17 -0
  133. package/node_modules/pi-footer/src/widgets/session/session-start.ts +18 -0
  134. package/node_modules/pi-footer/src/widgets/session/tool-results.ts +17 -0
  135. package/node_modules/pi-footer/src/widgets/session/total-messages.ts +19 -0
  136. package/node_modules/pi-footer/src/widgets/session/total-time.ts +18 -0
  137. package/node_modules/pi-footer/src/widgets/session/user-messages.ts +17 -0
  138. package/node_modules/pi-footer/src/widgets/store.ts +26 -0
  139. package/node_modules/pi-footer/src/widgets/tokens/cache-hit-rate.ts +55 -0
  140. package/node_modules/pi-footer/src/widgets/tokens/cache-read.ts +18 -0
  141. package/node_modules/pi-footer/src/widgets/tokens/cache-write.ts +18 -0
  142. package/node_modules/pi-footer/src/widgets/tokens/context-bar.ts +108 -0
  143. package/node_modules/pi-footer/src/widgets/tokens/context-length.ts +26 -0
  144. package/node_modules/pi-footer/src/widgets/tokens/context-remaining.ts +29 -0
  145. package/node_modules/pi-footer/src/widgets/tokens/context.ts +29 -0
  146. package/node_modules/pi-footer/src/widgets/tokens/cost.ts +51 -0
  147. package/node_modules/pi-footer/src/widgets/tokens/input-speed.ts +25 -0
  148. package/node_modules/pi-footer/src/widgets/tokens/input-tokens.ts +18 -0
  149. package/node_modules/pi-footer/src/widgets/tokens/output-speed.ts +25 -0
  150. package/node_modules/pi-footer/src/widgets/tokens/output-tokens.ts +18 -0
  151. package/node_modules/pi-footer/src/widgets/tokens/tokens.ts +20 -0
  152. package/node_modules/pi-footer/src/widgets/tokens/total-speed.ts +25 -0
  153. package/node_modules/pi-footer/src/widgets/tokens/total-tokens.ts +18 -0
  154. package/node_modules/pi-footer/src/widgets/types.ts +181 -0
  155. package/node_modules/pi-footer/src/widgets/utils/colors.ts +11 -0
  156. package/node_modules/pi-footer/src/widgets/utils/context.ts +112 -0
  157. package/node_modules/pi-footer/src/widgets/utils/session.ts +19 -0
  158. package/node_modules/pi-footer/src/widgets/utils/token-format.ts +78 -0
  159. package/node_modules/pi-mcp-adapter/CHANGELOG.md +19 -0
  160. package/node_modules/pi-mcp-adapter/README.md +19 -4
  161. package/node_modules/pi-mcp-adapter/agent-dir.ts +40 -0
  162. package/node_modules/pi-mcp-adapter/commands.ts +12 -2
  163. package/node_modules/pi-mcp-adapter/direct-tools.ts +6 -8
  164. package/node_modules/pi-mcp-adapter/index.ts +15 -3
  165. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +87 -4
  166. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +138 -61
  167. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +43 -4
  168. package/node_modules/pi-mcp-adapter/oauth.ts +48 -0
  169. package/node_modules/pi-mcp-adapter/package.json +8 -2
  170. package/node_modules/pi-mcp-adapter/proxy-modes.ts +8 -10
  171. package/node_modules/pi-mcp-adapter/tool-registrar.ts +187 -3
  172. package/node_modules/pi-mcp-adapter/types.ts +2 -0
  173. package/node_modules/pi-web-access/CHANGELOG.md +45 -0
  174. package/node_modules/pi-web-access/README.md +104 -29
  175. package/node_modules/pi-web-access/bocha.ts +221 -0
  176. package/node_modules/pi-web-access/curator-page.ts +113 -12
  177. package/node_modules/pi-web-access/curator-server.ts +56 -20
  178. package/node_modules/pi-web-access/datalab-pdf-extract.ts +568 -0
  179. package/node_modules/pi-web-access/duckduckgo.ts +123 -0
  180. package/node_modules/pi-web-access/extract.ts +288 -143
  181. package/node_modules/pi-web-access/feature-config.ts +29 -0
  182. package/node_modules/pi-web-access/gemini-api.ts +4 -0
  183. package/node_modules/pi-web-access/gemini-search.ts +45 -12
  184. package/node_modules/pi-web-access/gemini-web.ts +68 -3
  185. package/node_modules/pi-web-access/index.ts +160 -71
  186. package/node_modules/pi-web-access/jina-search.ts +284 -0
  187. package/node_modules/pi-web-access/kagi.ts +12 -12
  188. package/node_modules/pi-web-access/openai-search.ts +12 -2
  189. package/node_modules/pi-web-access/package.json +4 -3
  190. package/node_modules/pi-web-access/pdf-extract.ts +327 -228
  191. package/node_modules/pi-web-access/storage.ts +440 -2
  192. package/node_modules/pi-web-access/summary-model-scope.ts +1 -1
  193. package/node_modules/pi-web-access/summary-review.ts +4 -2
  194. package/node_modules/pi-web-access/video-extract.ts +10 -8
  195. package/node_modules/pi-web-access/xai-search.ts +12 -2
  196. package/node_modules/pi-web-access/youtube-extract.ts +2 -1
  197. package/node_modules/remote-pi/LICENSE +21 -0
  198. package/node_modules/remote-pi/README.md +675 -0
  199. package/node_modules/remote-pi/dist/actions/handlers.d.ts +122 -0
  200. package/node_modules/remote-pi/dist/actions/handlers.js +160 -0
  201. package/node_modules/remote-pi/dist/actions/handlers.js.map +1 -0
  202. package/node_modules/remote-pi/dist/actions/registry.d.ts +39 -0
  203. package/node_modules/remote-pi/dist/actions/registry.js +58 -0
  204. package/node_modules/remote-pi/dist/actions/registry.js.map +1 -0
  205. package/node_modules/remote-pi/dist/bin/supervisord.d.ts +2 -0
  206. package/node_modules/remote-pi/dist/bin/supervisord.js +86 -0
  207. package/node_modules/remote-pi/dist/bin/supervisord.js.map +1 -0
  208. package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +58 -0
  209. package/node_modules/remote-pi/dist/commands/builtin_mirror.js +71 -0
  210. package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +1 -0
  211. package/node_modules/remote-pi/dist/commands/list_commands.d.ts +60 -0
  212. package/node_modules/remote-pi/dist/commands/list_commands.js +73 -0
  213. package/node_modules/remote-pi/dist/commands/list_commands.js.map +1 -0
  214. package/node_modules/remote-pi/dist/config.d.ts +62 -0
  215. package/node_modules/remote-pi/dist/config.js +115 -0
  216. package/node_modules/remote-pi/dist/config.js.map +1 -0
  217. package/node_modules/remote-pi/dist/daemon/client.d.ts +20 -0
  218. package/node_modules/remote-pi/dist/daemon/client.js +131 -0
  219. package/node_modules/remote-pi/dist/daemon/client.js.map +1 -0
  220. package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +176 -0
  221. package/node_modules/remote-pi/dist/daemon/control_protocol.js +63 -0
  222. package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +1 -0
  223. package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +45 -0
  224. package/node_modules/remote-pi/dist/daemon/cron_log.js +72 -0
  225. package/node_modules/remote-pi/dist/daemon/cron_log.js.map +1 -0
  226. package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +80 -0
  227. package/node_modules/remote-pi/dist/daemon/cron_registry.js +194 -0
  228. package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +1 -0
  229. package/node_modules/remote-pi/dist/daemon/id.d.ts +24 -0
  230. package/node_modules/remote-pi/dist/daemon/id.js +36 -0
  231. package/node_modules/remote-pi/dist/daemon/id.js.map +1 -0
  232. package/node_modules/remote-pi/dist/daemon/install.d.ts +170 -0
  233. package/node_modules/remote-pi/dist/daemon/install.js +547 -0
  234. package/node_modules/remote-pi/dist/daemon/install.js.map +1 -0
  235. package/node_modules/remote-pi/dist/daemon/registry.d.ts +63 -0
  236. package/node_modules/remote-pi/dist/daemon/registry.js +153 -0
  237. package/node_modules/remote-pi/dist/daemon/registry.js.map +1 -0
  238. package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +194 -0
  239. package/node_modules/remote-pi/dist/daemon/rpc_child.js +389 -0
  240. package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +1 -0
  241. package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +93 -0
  242. package/node_modules/remote-pi/dist/daemon/supervisor.js +596 -0
  243. package/node_modules/remote-pi/dist/daemon/supervisor.js.map +1 -0
  244. package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +26 -0
  245. package/node_modules/remote-pi/dist/extension_ui_bridge.js +341 -0
  246. package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +1 -0
  247. package/node_modules/remote-pi/dist/index.d.ts +213 -0
  248. package/node_modules/remote-pi/dist/index.js +4996 -0
  249. package/node_modules/remote-pi/dist/index.js.map +1 -0
  250. package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +10 -0
  251. package/node_modules/remote-pi/dist/mcp/mesh_result.js +42 -0
  252. package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +1 -0
  253. package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +16 -0
  254. package/node_modules/remote-pi/dist/mcp/mesh_server.js +327 -0
  255. package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +1 -0
  256. package/node_modules/remote-pi/dist/mesh/canonical.d.ts +30 -0
  257. package/node_modules/remote-pi/dist/mesh/canonical.js +61 -0
  258. package/node_modules/remote-pi/dist/mesh/canonical.js.map +1 -0
  259. package/node_modules/remote-pi/dist/mesh/client.d.ts +18 -0
  260. package/node_modules/remote-pi/dist/mesh/client.js +125 -0
  261. package/node_modules/remote-pi/dist/mesh/client.js.map +1 -0
  262. package/node_modules/remote-pi/dist/mesh/encoding.d.ts +38 -0
  263. package/node_modules/remote-pi/dist/mesh/encoding.js +216 -0
  264. package/node_modules/remote-pi/dist/mesh/encoding.js.map +1 -0
  265. package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +73 -0
  266. package/node_modules/remote-pi/dist/mesh/self_revoke.js +401 -0
  267. package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +1 -0
  268. package/node_modules/remote-pi/dist/mesh/siblings.d.ts +49 -0
  269. package/node_modules/remote-pi/dist/mesh/siblings.js +159 -0
  270. package/node_modules/remote-pi/dist/mesh/siblings.js.map +1 -0
  271. package/node_modules/remote-pi/dist/mesh/types.d.ts +34 -0
  272. package/node_modules/remote-pi/dist/mesh/types.js +11 -0
  273. package/node_modules/remote-pi/dist/mesh/types.js.map +1 -0
  274. package/node_modules/remote-pi/dist/mesh/verify.d.ts +17 -0
  275. package/node_modules/remote-pi/dist/mesh/verify.js +86 -0
  276. package/node_modules/remote-pi/dist/mesh/verify.js.map +1 -0
  277. package/node_modules/remote-pi/dist/pairing/crypto.d.ts +8 -0
  278. package/node_modules/remote-pi/dist/pairing/crypto.js +22 -0
  279. package/node_modules/remote-pi/dist/pairing/crypto.js.map +1 -0
  280. package/node_modules/remote-pi/dist/pairing/handshake.d.ts +28 -0
  281. package/node_modules/remote-pi/dist/pairing/handshake.js +113 -0
  282. package/node_modules/remote-pi/dist/pairing/handshake.js.map +1 -0
  283. package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +16 -0
  284. package/node_modules/remote-pi/dist/pairing/noise-sha256.js +103 -0
  285. package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +1 -0
  286. package/node_modules/remote-pi/dist/pairing/qr.d.ts +59 -0
  287. package/node_modules/remote-pi/dist/pairing/qr.js +125 -0
  288. package/node_modules/remote-pi/dist/pairing/qr.js.map +1 -0
  289. package/node_modules/remote-pi/dist/pairing/storage.d.ts +120 -0
  290. package/node_modules/remote-pi/dist/pairing/storage.js +604 -0
  291. package/node_modules/remote-pi/dist/pairing/storage.js.map +1 -0
  292. package/node_modules/remote-pi/dist/protocol/codec.d.ts +7 -0
  293. package/node_modules/remote-pi/dist/protocol/codec.js +49 -0
  294. package/node_modules/remote-pi/dist/protocol/codec.js.map +1 -0
  295. package/node_modules/remote-pi/dist/protocol/types.d.ts +393 -0
  296. package/node_modules/remote-pi/dist/protocol/types.js +2 -0
  297. package/node_modules/remote-pi/dist/protocol/types.js.map +1 -0
  298. package/node_modules/remote-pi/dist/rooms.d.ts +29 -0
  299. package/node_modules/remote-pi/dist/rooms.js +57 -0
  300. package/node_modules/remote-pi/dist/rooms.js.map +1 -0
  301. package/node_modules/remote-pi/dist/session/address.d.ts +49 -0
  302. package/node_modules/remote-pi/dist/session/address.js +58 -0
  303. package/node_modules/remote-pi/dist/session/address.js.map +1 -0
  304. package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +55 -0
  305. package/node_modules/remote-pi/dist/session/agent_bridge.js +146 -0
  306. package/node_modules/remote-pi/dist/session/agent_bridge.js.map +1 -0
  307. package/node_modules/remote-pi/dist/session/bridge.d.ts +37 -0
  308. package/node_modules/remote-pi/dist/session/bridge.js +130 -0
  309. package/node_modules/remote-pi/dist/session/bridge.js.map +1 -0
  310. package/node_modules/remote-pi/dist/session/broker.d.ts +189 -0
  311. package/node_modules/remote-pi/dist/session/broker.js +507 -0
  312. package/node_modules/remote-pi/dist/session/broker.js.map +1 -0
  313. package/node_modules/remote-pi/dist/session/broker_remote.d.ts +74 -0
  314. package/node_modules/remote-pi/dist/session/broker_remote.js +583 -0
  315. package/node_modules/remote-pi/dist/session/broker_remote.js.map +1 -0
  316. package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +33 -0
  317. package/node_modules/remote-pi/dist/session/cwd_lock.js +126 -0
  318. package/node_modules/remote-pi/dist/session/cwd_lock.js.map +1 -0
  319. package/node_modules/remote-pi/dist/session/envelope.d.ts +33 -0
  320. package/node_modules/remote-pi/dist/session/envelope.js +117 -0
  321. package/node_modules/remote-pi/dist/session/envelope.js.map +1 -0
  322. package/node_modules/remote-pi/dist/session/global_config.d.ts +33 -0
  323. package/node_modules/remote-pi/dist/session/global_config.js +73 -0
  324. package/node_modules/remote-pi/dist/session/global_config.js.map +1 -0
  325. package/node_modules/remote-pi/dist/session/ipc.d.ts +27 -0
  326. package/node_modules/remote-pi/dist/session/ipc.js +22 -0
  327. package/node_modules/remote-pi/dist/session/ipc.js.map +1 -0
  328. package/node_modules/remote-pi/dist/session/leader_election.d.ts +32 -0
  329. package/node_modules/remote-pi/dist/session/leader_election.js +106 -0
  330. package/node_modules/remote-pi/dist/session/leader_election.js.map +1 -0
  331. package/node_modules/remote-pi/dist/session/local_config.d.ts +55 -0
  332. package/node_modules/remote-pi/dist/session/local_config.js +157 -0
  333. package/node_modules/remote-pi/dist/session/local_config.js.map +1 -0
  334. package/node_modules/remote-pi/dist/session/mesh_message.d.ts +20 -0
  335. package/node_modules/remote-pi/dist/session/mesh_message.js +28 -0
  336. package/node_modules/remote-pi/dist/session/mesh_message.js.map +1 -0
  337. package/node_modules/remote-pi/dist/session/mesh_node.d.ts +116 -0
  338. package/node_modules/remote-pi/dist/session/mesh_node.js +573 -0
  339. package/node_modules/remote-pi/dist/session/mesh_node.js.map +1 -0
  340. package/node_modules/remote-pi/dist/session/peer.d.ts +139 -0
  341. package/node_modules/remote-pi/dist/session/peer.js +451 -0
  342. package/node_modules/remote-pi/dist/session/peer.js.map +1 -0
  343. package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +13 -0
  344. package/node_modules/remote-pi/dist/session/peer_inventory.js +48 -0
  345. package/node_modules/remote-pi/dist/session/peer_inventory.js.map +1 -0
  346. package/node_modules/remote-pi/dist/session/peer_limits.d.ts +9 -0
  347. package/node_modules/remote-pi/dist/session/peer_limits.js +21 -0
  348. package/node_modules/remote-pi/dist/session/peer_limits.js.map +1 -0
  349. package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +39 -0
  350. package/node_modules/remote-pi/dist/session/setup_wizard.js +63 -0
  351. package/node_modules/remote-pi/dist/session/setup_wizard.js.map +1 -0
  352. package/node_modules/remote-pi/dist/session/tool_gate.d.ts +5 -0
  353. package/node_modules/remote-pi/dist/session/tool_gate.js +11 -0
  354. package/node_modules/remote-pi/dist/session/tool_gate.js.map +1 -0
  355. package/node_modules/remote-pi/dist/session/tools.d.ts +24 -0
  356. package/node_modules/remote-pi/dist/session/tools.js +252 -0
  357. package/node_modules/remote-pi/dist/session/tools.js.map +1 -0
  358. package/node_modules/remote-pi/dist/session/wizard.d.ts +13 -0
  359. package/node_modules/remote-pi/dist/session/wizard.js +20 -0
  360. package/node_modules/remote-pi/dist/session/wizard.js.map +1 -0
  361. package/node_modules/remote-pi/dist/settings.d.ts +15 -0
  362. package/node_modules/remote-pi/dist/settings.js +52 -0
  363. package/node_modules/remote-pi/dist/settings.js.map +1 -0
  364. package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +37 -0
  365. package/node_modules/remote-pi/dist/transport/peer_channel.js +98 -0
  366. package/node_modules/remote-pi/dist/transport/peer_channel.js.map +1 -0
  367. package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +29 -0
  368. package/node_modules/remote-pi/dist/transport/pi_forward_client.js +62 -0
  369. package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +1 -0
  370. package/node_modules/remote-pi/dist/transport/relay_client.d.ts +91 -0
  371. package/node_modules/remote-pi/dist/transport/relay_client.js +206 -0
  372. package/node_modules/remote-pi/dist/transport/relay_client.js.map +1 -0
  373. package/node_modules/remote-pi/dist/ui/footer.d.ts +32 -0
  374. package/node_modules/remote-pi/dist/ui/footer.js +34 -0
  375. package/node_modules/remote-pi/dist/ui/footer.js.map +1 -0
  376. package/node_modules/remote-pi/docs/daemon.md +289 -0
  377. package/node_modules/remote-pi/package.json +88 -0
  378. package/node_modules/remote-pi/service-templates/launchd.plist.template +35 -0
  379. package/node_modules/remote-pi/service-templates/systemd.service.template +19 -0
  380. package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +10 -0
  381. package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +38 -0
  382. package/node_modules/remote-pi/skills/agent-network/SKILL.md +310 -0
  383. package/package.json +25 -10
  384. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/write-display-utils.ts +0 -29
  385. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference-core.ts → reference/session.ts} +0 -0
  386. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-aliases.ts → shell/aliases.ts} +0 -0
  387. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ATTRIBUTION.md +0 -0
  388. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-presentation.ts +0 -0
  389. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/index.ts +0 -0
  390. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/render-utils.ts +0 -0
  391. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/shiki-highlight.ts +0 -0
  392. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/types.ts +0 -0
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Plan/28 Wave B — typed action handlers.
3
+ *
4
+ * Each handler maps one `ClientMessage` action to a public Pi SDK call,
5
+ * and replies with `action_ok` or `action_error`. Handlers take their
6
+ * dependencies as parameters so the index.ts wiring is one-liner and
7
+ * unit tests can pass fakes without touching global state.
8
+ *
9
+ * `models_list` lives next door because it shares the `ModelRegistry`
10
+ * helper and the same wire vocabulary.
11
+ *
12
+ * SDK API surface used (see plan/28 Wave 0 for the full table):
13
+ *
14
+ * - `ctx.compact()` — non-blocking, fires `session_compact`
15
+ * event when done
16
+ * - `ctx.newSession()` — only on `ExtensionCommandContext`;
17
+ * resolves with `{cancelled}` flag
18
+ * - `pi.setModel(model)` — returns `false` if no auth configured
19
+ * - `pi.setThinkingLevel(lvl)` — synchronous
20
+ * - `ctx.getModel()` — optional, undefined before first turn
21
+ * - `ModelRegistry.{refresh,getAvailable,find}` — see `registry.ts`
22
+ */
23
+ import type { ClientMessage, ServerMessage, WireModel } from "../protocol/types.js";
24
+ /**
25
+ * Structural subset of the SDK's `Model<Api>` interface (defined in
26
+ * `@earendil-works/pi-ai`, which is a transitive dep — not re-exported by
27
+ * `@earendil-works/pi-coding-agent`'s main entry). Capturing just the
28
+ * fields we touch keeps the handler decoupled from the SDK's full Model
29
+ * surface and avoids a direct dep on `pi-ai`.
30
+ */
31
+ export interface SdkModelLike {
32
+ id: string;
33
+ name: string;
34
+ provider: string;
35
+ reasoning: boolean;
36
+ contextWindow: number;
37
+ /** Plan/30: accepted input modalities. The SDK's `Model.input` is
38
+ * `("text" | "image")[]`; we read `includes("image")` for the `vision`
39
+ * flag. Optional here so tests can omit it (treated as text-only). */
40
+ input?: ("text" | "image")[];
41
+ }
42
+ type Model<_TApi = unknown> = SdkModelLike;
43
+ /**
44
+ * Minimal channel surface needed to reply. Mirrors `PlainPeerChannel`'s
45
+ * `.send` signature; tests pass an array-backed fake.
46
+ */
47
+ export interface ActionReplySender {
48
+ send(msg: ServerMessage): void;
49
+ }
50
+ /**
51
+ * Narrow shape of the `ExtensionAPI` surface action handlers actually
52
+ * call. Lets the test layer stub just these without rebuilding the full
53
+ * SDK type (which has 30+ methods we don't use here).
54
+ */
55
+ export interface ActionPi {
56
+ setModel(model: Model<any>): Promise<boolean>;
57
+ setThinkingLevel(level: import("../protocol/types.js").ThinkingLevel): void;
58
+ }
59
+ /**
60
+ * Narrow shape of the per-call context. Drawn from the union of
61
+ * `ExtensionContextActions` (compact, getModel) and
62
+ * `ExtensionCommandContextActions` (newSession), since index.ts caches
63
+ * the most-recent ctx and that's typically the command one.
64
+ *
65
+ * All fields are optional so a missing method (e.g. when only a plain
66
+ * `ExtensionContext` was seen) becomes a typed `action_error` instead of
67
+ * a runtime TypeError.
68
+ */
69
+ export interface ActionCtx {
70
+ compact?: (options?: object) => void;
71
+ /**
72
+ * Starts a new session. `withSession` is the SDK's blessed hook for
73
+ * post-replacement work: it receives a FRESH, command-capable ctx bound to
74
+ * the new session. The SDK marks any ctx captured BEFORE this call stale, so
75
+ * callers must re-capture via `withSession` rather than reuse the old ctx.
76
+ */
77
+ newSession?: (options?: {
78
+ withSession?: (ctx: ActionCtx) => Promise<void>;
79
+ }) => Promise<{
80
+ cancelled: boolean;
81
+ }>;
82
+ getModel?: () => Model<any> | undefined;
83
+ /**
84
+ * Live session registry from Pi's extension ctx. Includes providers/models
85
+ * registered dynamically via `pi.registerProvider(...)`, unlike the fallback
86
+ * disk-backed registry remote-pi can build on its own.
87
+ */
88
+ modelRegistry?: ActionModelRegistry;
89
+ }
90
+ /**
91
+ * Minimal shape of the registry surface. Maps 1:1 onto `ModelRegistry`
92
+ * but lets tests fake catalogs without instantiating the real one.
93
+ */
94
+ export interface ActionModelRegistry {
95
+ refresh(): void;
96
+ getAvailable(): Model<any>[];
97
+ find(provider: string, modelId: string): Model<any> | undefined;
98
+ }
99
+ /** Project a SDK `Model<Api>` onto the wire schema. Shared by list_models
100
+ * and the `current` echo, so both stay in lockstep. */
101
+ export declare function wireFromModel(model: Model<any>): WireModel;
102
+ type SessionCompactMsg = Extract<ClientMessage, {
103
+ type: "session_compact";
104
+ }>;
105
+ type SessionNewMsg = Extract<ClientMessage, {
106
+ type: "session_new";
107
+ }>;
108
+ type ModelSetMsg = Extract<ClientMessage, {
109
+ type: "model_set";
110
+ }>;
111
+ type ThinkingSetMsg = Extract<ClientMessage, {
112
+ type: "thinking_set";
113
+ }>;
114
+ type ListModelsMsg = Extract<ClientMessage, {
115
+ type: "list_models";
116
+ }>;
117
+ export declare function handleSessionCompact(ctx: ActionCtx | null, sender: ActionReplySender, msg: SessionCompactMsg): void;
118
+ export declare function handleSessionNew(ctx: ActionCtx | null, sender: ActionReplySender, msg: SessionNewMsg, onReplaced?: (freshCtx: ActionCtx) => void): Promise<boolean>;
119
+ export declare function handleThinkingSet(pi: ActionPi, sender: ActionReplySender, msg: ThinkingSetMsg): void;
120
+ export declare function handleModelSet(pi: ActionPi, ctx: ActionCtx | null, reg: ActionModelRegistry, sender: ActionReplySender, msg: ModelSetMsg, onPersist?: (provider: string, modelId: string) => void): Promise<void>;
121
+ export declare function handleListModels(ctx: ActionCtx | null, reg: ActionModelRegistry, sender: ActionReplySender, msg: ListModelsMsg): void;
122
+ export {};
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Plan/28 Wave B — typed action handlers.
3
+ *
4
+ * Each handler maps one `ClientMessage` action to a public Pi SDK call,
5
+ * and replies with `action_ok` or `action_error`. Handlers take their
6
+ * dependencies as parameters so the index.ts wiring is one-liner and
7
+ * unit tests can pass fakes without touching global state.
8
+ *
9
+ * `models_list` lives next door because it shares the `ModelRegistry`
10
+ * helper and the same wire vocabulary.
11
+ *
12
+ * SDK API surface used (see plan/28 Wave 0 for the full table):
13
+ *
14
+ * - `ctx.compact()` — non-blocking, fires `session_compact`
15
+ * event when done
16
+ * - `ctx.newSession()` — only on `ExtensionCommandContext`;
17
+ * resolves with `{cancelled}` flag
18
+ * - `pi.setModel(model)` — returns `false` if no auth configured
19
+ * - `pi.setThinkingLevel(lvl)` — synchronous
20
+ * - `ctx.getModel()` — optional, undefined before first turn
21
+ * - `ModelRegistry.{refresh,getAvailable,find}` — see `registry.ts`
22
+ */
23
+ /** Project a SDK `Model<Api>` onto the wire schema. Shared by list_models
24
+ * and the `current` echo, so both stay in lockstep. */
25
+ export function wireFromModel(model) {
26
+ return {
27
+ id: model.id,
28
+ name: model.name,
29
+ provider: model.provider,
30
+ reasoning: model.reasoning,
31
+ context_window: model.contextWindow,
32
+ // Plan/30: vision = model accepts image input. `Model.input` is
33
+ // `("text" | "image")[]` at runtime (confirmed against pi-ai). `?.` guards
34
+ // a fake/partial model in tests → treated as text-only.
35
+ vision: model.input?.includes("image") ?? false,
36
+ };
37
+ }
38
+ // ── ack helpers ────────────────────────────────────────────────────────────
39
+ function ok(sender, msg, action) {
40
+ sender.send({ type: "action_ok", in_reply_to: msg.id, action });
41
+ }
42
+ function fail(sender, msg, action, err) {
43
+ const error = err instanceof Error ? err.message : String(err);
44
+ sender.send({ type: "action_error", in_reply_to: msg.id, action, error });
45
+ }
46
+ /** Run a synchronous action with uniform success/failure replies. */
47
+ function runSync(sender, msg, action, body) {
48
+ try {
49
+ body();
50
+ ok(sender, msg, action);
51
+ }
52
+ catch (e) {
53
+ fail(sender, msg, action, e);
54
+ }
55
+ }
56
+ /** Run an async action with uniform success/failure replies. */
57
+ async function runAsync(sender, msg, action, body) {
58
+ try {
59
+ await body();
60
+ ok(sender, msg, action);
61
+ return true;
62
+ }
63
+ catch (e) {
64
+ fail(sender, msg, action, e);
65
+ return false;
66
+ }
67
+ }
68
+ export function handleSessionCompact(ctx, sender, msg) {
69
+ runSync(sender, msg, "session_compact", () => {
70
+ if (!ctx?.compact)
71
+ throw new Error("compact unavailable (no active session ctx)");
72
+ // Force the summary to English regardless of the conversation language —
73
+ // the summary is surfaced to the app via the `compaction` message, which
74
+ // is an English-only surface. `customInstructions` is appended to the SDK's
75
+ // compaction prompt (best-effort: the model writes the summary).
76
+ ctx.compact({
77
+ customInstructions: "Always write the compaction summary in English, even if the conversation is in another language.",
78
+ });
79
+ });
80
+ }
81
+ export async function handleSessionNew(ctx, sender, msg, onReplaced) {
82
+ // Returns true only when a fresh session was actually created. index.ts
83
+ // keys the Pi-side reset (clear _messageBuffer, restamp _sessionStartedAt,
84
+ // fan out an empty session_history) off this signal — a `cancelled`/errored
85
+ // new-session must NOT reset, so we return runAsync's success boolean.
86
+ return runAsync(sender, msg, "session_new", async () => {
87
+ if (!ctx?.newSession)
88
+ throw new Error("newSession unavailable (no command ctx yet)");
89
+ // newSession marks the caller's captured ctx (index.ts's `_lastCtx`) STALE
90
+ // — reusing it later throws "stale after session replacement" (the
91
+ // compact-after-New-session crash). `withSession` hands back a fresh,
92
+ // command-capable ctx bound to the new session; forward it via onReplaced
93
+ // so the caller re-captures and keeps later actions off the stale ctx.
94
+ const result = await ctx.newSession({
95
+ withSession: async (freshCtx) => { onReplaced?.(freshCtx); },
96
+ });
97
+ // `cancelled: true` happens when the SDK's hook chain vetoes the new
98
+ // session (e.g. an extension's `session_before_switch` returned a
99
+ // refusal). Surface as a typed error rather than silent success.
100
+ if (result.cancelled)
101
+ throw new Error("cancelled by extension hook");
102
+ });
103
+ }
104
+ export function handleThinkingSet(pi, sender, msg) {
105
+ runSync(sender, msg, "thinking_set", () => {
106
+ pi.setThinkingLevel(msg.level);
107
+ });
108
+ }
109
+ export async function handleModelSet(pi, ctx, reg, sender, msg, onPersist) {
110
+ await runAsync(sender, msg, "model_set", async () => {
111
+ // Prefer Pi's LIVE session registry when available so the app sees models
112
+ // registered dynamically by extensions via `pi.registerProvider(...)`.
113
+ // Fall back to remote-pi's own disk-backed registry when no ctx exists.
114
+ const liveReg = ctx?.modelRegistry ?? reg;
115
+ // Refresh first so a model just-added via `/login` is visible.
116
+ liveReg.refresh();
117
+ const model = liveReg.find(msg.provider, msg.model_id);
118
+ if (!model) {
119
+ throw new Error(`model "${msg.provider}/${msg.model_id}" not in registry`);
120
+ }
121
+ const success = await pi.setModel(model);
122
+ if (!success)
123
+ throw new Error("no auth configured for this model");
124
+ // `pi.setModel` only sets the LIVE model — it does NOT persist. Without
125
+ // this, a model picked from the app reverts to the saved default on the
126
+ // next Pi/daemon restart (the TUI persists because AgentSession.setModel
127
+ // writes the default; this path doesn't). `onPersist` writes the new
128
+ // default so the app's choice survives. Best-effort — the caller's writer
129
+ // must not throw, so a failed settings write never fails the model change.
130
+ onPersist?.(model.provider, model.id);
131
+ });
132
+ }
133
+ export function handleListModels(ctx, reg, sender, msg) {
134
+ // refresh() can throw if `models.json` is malformed — wrap in try so the
135
+ // app gets an explicit error reply instead of a silent drop.
136
+ try {
137
+ // Prefer Pi's LIVE session registry when available so the app sees models
138
+ // registered dynamically by extensions via `pi.registerProvider(...)`.
139
+ // Fall back to remote-pi's own disk-backed registry when no ctx exists.
140
+ const liveReg = ctx?.modelRegistry ?? reg;
141
+ liveReg.refresh();
142
+ const models = liveReg.getAvailable().map(wireFromModel);
143
+ const current = ctx?.getModel?.();
144
+ sender.send({
145
+ type: "models_list",
146
+ in_reply_to: msg.id,
147
+ models,
148
+ current: current ? wireFromModel(current) : undefined,
149
+ });
150
+ }
151
+ catch (e) {
152
+ sender.send({
153
+ type: "error",
154
+ in_reply_to: msg.id,
155
+ code: "internal_error",
156
+ message: e instanceof Error ? e.message : String(e),
157
+ });
158
+ }
159
+ }
160
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/actions/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA2FH;wDACwD;AACxD,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,OAAO;QACL,EA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,wEAAwE;QACxE,yEAAyE;QACzE,qEAAqE;QACrE,0EAA0E;QAC1E,2EAA2E;QAC3E,SAAS,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,GAAqB,EACrB,GAAwB,EACxB,MAAyB,EACzB,GAAkB;IAElB,yEAAyE;IACzE,6DAA6D;IAC7D,IAAI,CAAC;QACH,0EAA0E;QAC1E,uEAAuE;QACvE,wEAAwE;QACxE,MAAM,OAAO,GAAG,GAAG,EAAE,aAAa,IAAI,GAAG,CAAC;QAC1C,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC;QAClC,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,GAAG,CAAC,EAAE;YACnB,MAAM;YACN,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;SACtD,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,GAAG,CAAC,EAAE;YACnB,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Plan/28 — ModelRegistry access for the action handlers.
3
+ *
4
+ * The host hands every extension a ready `ModelRegistry` on
5
+ * `ExtensionContext.modelRegistry` — the same instance `AgentSession` uses
6
+ * internally. That is the ONLY source we read.
7
+ *
8
+ * History (issue #112): this module used to build its own registry via
9
+ * `ModelRegistry.create(AuthStorage.create())`. Both factories were removed
10
+ * from `@earendil-works/pi-coding-agent` in pi 0.83, so the import crashed the
11
+ * whole pi process on the first `model_set`/`list_models` from the app
12
+ * (`undefined is not an object (evaluating 'AuthStorage.create')`, thrown from
13
+ * the WebSocket line handler). Reading the registry off the live ctx drops the
14
+ * dependency on that package's factory surface entirely, so a future breaking
15
+ * change there cannot crash the extension the same way again.
16
+ *
17
+ * Two hazards this handles:
18
+ *
19
+ * 1. A ctx captured before a session replacement/reload is **stale**, and even
20
+ * *reading* `.modelRegistry` on it throws (`assertActive`). Every read is
21
+ * wrapped.
22
+ * 2. There may be no live ctx at all (daemon boot, control channel). Rather
23
+ * than throw from a WS callback — an uncaught exception that exits pi — we
24
+ * fall back to the last registry that worked, then to a stub whose methods
25
+ * never throw and report an empty catalog.
26
+ */
27
+ import type { ActionModelRegistry } from "./handlers.js";
28
+ /** Anything carrying the host registry — `ExtensionContext` and friends. */
29
+ interface RegistryBearingCtx {
30
+ modelRegistry?: ActionModelRegistry;
31
+ }
32
+ /**
33
+ * Resolve the live host `ModelRegistry` from the most recent extension ctx.
34
+ * Falls back to the last one that worked, then to an inert stub.
35
+ */
36
+ export declare function ensureModelRegistry(ctx?: RegistryBearingCtx | null): ActionModelRegistry;
37
+ /** Test seam — drop the cached registry so tests can rebuild with fakes. */
38
+ export declare function _resetModelRegistryForTests(): void;
39
+ export {};
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Plan/28 — ModelRegistry access for the action handlers.
3
+ *
4
+ * The host hands every extension a ready `ModelRegistry` on
5
+ * `ExtensionContext.modelRegistry` — the same instance `AgentSession` uses
6
+ * internally. That is the ONLY source we read.
7
+ *
8
+ * History (issue #112): this module used to build its own registry via
9
+ * `ModelRegistry.create(AuthStorage.create())`. Both factories were removed
10
+ * from `@earendil-works/pi-coding-agent` in pi 0.83, so the import crashed the
11
+ * whole pi process on the first `model_set`/`list_models` from the app
12
+ * (`undefined is not an object (evaluating 'AuthStorage.create')`, thrown from
13
+ * the WebSocket line handler). Reading the registry off the live ctx drops the
14
+ * dependency on that package's factory surface entirely, so a future breaking
15
+ * change there cannot crash the extension the same way again.
16
+ *
17
+ * Two hazards this handles:
18
+ *
19
+ * 1. A ctx captured before a session replacement/reload is **stale**, and even
20
+ * *reading* `.modelRegistry` on it throws (`assertActive`). Every read is
21
+ * wrapped.
22
+ * 2. There may be no live ctx at all (daemon boot, control channel). Rather
23
+ * than throw from a WS callback — an uncaught exception that exits pi — we
24
+ * fall back to the last registry that worked, then to a stub whose methods
25
+ * never throw and report an empty catalog.
26
+ */
27
+ let _lastGoodRegistry = null;
28
+ /**
29
+ * Never-throwing empty catalog. Used only when no ctx has ever been seen —
30
+ * callers get an empty model list instead of a crashed agent.
31
+ */
32
+ const _stubRegistry = {
33
+ refresh() { },
34
+ getAvailable() { return []; },
35
+ find() { return undefined; },
36
+ };
37
+ /**
38
+ * Resolve the live host `ModelRegistry` from the most recent extension ctx.
39
+ * Falls back to the last one that worked, then to an inert stub.
40
+ */
41
+ export function ensureModelRegistry(ctx) {
42
+ try {
43
+ const live = ctx?.modelRegistry;
44
+ if (live) {
45
+ _lastGoodRegistry = live;
46
+ return live;
47
+ }
48
+ }
49
+ catch {
50
+ // stale ctx after session replacement — reading the property throws.
51
+ }
52
+ return _lastGoodRegistry ?? _stubRegistry;
53
+ }
54
+ /** Test seam — drop the cached registry so tests can rebuild with fakes. */
55
+ export function _resetModelRegistryForTests() {
56
+ _lastGoodRegistry = null;
57
+ }
58
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/actions/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AASH,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AAEzD;;;GAGG;AACH,MAAM,aAAa,GAAwB;IACzC,OAAO,KAAI,CAAC;IACZ,YAAY,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,OAAO,SAAS,CAAC,CAAC,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAA+B;IACjE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,EAAE,aAAa,CAAC;QAChC,IAAI,IAAI,EAAE,CAAC;YACT,iBAAiB,GAAG,IAAI,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;IACvE,CAAC;IACD,OAAO,iBAAiB,IAAI,aAAa,CAAC;AAC5C,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,2BAA2B;IACzC,iBAAiB,GAAG,IAAI,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `pi-supervisord` — long-running daemon supervisor.
4
+ *
5
+ * Entry point of the `pi-supervisord` binary (plan/26 W2). Run by
6
+ * systemd/launchd in production, or directly during dev:
7
+ *
8
+ * pnpm build
9
+ * node dist/bin/supervisord.js
10
+ *
11
+ * Once running, it:
12
+ * - Reads `~/.pi/remote/daemons.json`
13
+ * - Spawns `pi --mode rpc -e <remote-pi/dist/index.js>` per entry
14
+ * - Listens on `~/.pi/remote/supervisor.sock` for CLI control requests
15
+ * - Restarts crashed children with exponential backoff
16
+ *
17
+ * Exits cleanly on SIGTERM/SIGINT (used by `remote-pi uninstall`).
18
+ */
19
+ import { fileURLToPath } from "node:url";
20
+ import { dirname, join } from "node:path";
21
+ import { Supervisor, SupervisorAlreadyRunningError } from "../daemon/supervisor.js";
22
+ const HELP_TEXT = `pi-supervisord — Remote Pi daemon supervisor
23
+
24
+ Usage: pi-supervisord
25
+
26
+ Runs the long-lived supervisor: reads ~/.pi/remote/daemons.json, spawns one
27
+ \`pi --mode rpc\` child per entry, and listens on ~/.pi/remote/supervisor.sock
28
+ for control requests from the \`remote-pi\` CLI.
29
+
30
+ This binary takes NO arguments — it is normally launched by systemd/launchd
31
+ (via \`remote-pi install\`), not by hand. Manage the fleet with:
32
+ remote-pi daemon start | stop | restart | status
33
+ remote-pi daemons
34
+
35
+ Options:
36
+ -h, --help Show this help and exit
37
+ -v, --version Print version and exit
38
+ `;
39
+ async function main() {
40
+ // Guard: any stray argument used to fall through and start a FULL
41
+ // supervisor (a `pi-supervisord --help` once ran for days). Handle the
42
+ // conventional flags explicitly and reject unknown args instead of
43
+ // silently spawning the daemon fleet.
44
+ const args = process.argv.slice(2);
45
+ if (args.includes("-h") || args.includes("--help")) {
46
+ process.stdout.write(HELP_TEXT);
47
+ return;
48
+ }
49
+ if (args.includes("-v") || args.includes("--version")) {
50
+ process.stdout.write("pi-supervisord (remote-pi)\n");
51
+ return;
52
+ }
53
+ if (args.length > 0) {
54
+ process.stderr.write(`pi-supervisord: unexpected argument(s): ${args.join(" ")}\n` +
55
+ "This binary takes no arguments. Run `pi-supervisord --help`.\n");
56
+ process.exit(2);
57
+ }
58
+ // The supervisor needs to point each spawned Pi at the extension
59
+ // entry it's bundled with. We're at `dist/bin/supervisord.js` after
60
+ // build; the extension is the sibling `dist/index.js`.
61
+ const here = fileURLToPath(import.meta.url);
62
+ const distRoot = dirname(dirname(here)); // dist/bin → dist
63
+ const extensionPath = join(distRoot, "index.js");
64
+ const supervisor = new Supervisor({ extensionPath });
65
+ await supervisor.start();
66
+ process.stderr.write(`[pi-supervisord] up — UDS: ~/.pi/remote/supervisor.sock, extension: ${extensionPath}\n`);
67
+ const shutdown = async (signal) => {
68
+ process.stderr.write(`[pi-supervisord] received ${signal}, shutting down\n`);
69
+ await supervisor.stop();
70
+ process.exit(0);
71
+ };
72
+ process.on("SIGTERM", () => void shutdown("SIGTERM"));
73
+ process.on("SIGINT", () => void shutdown("SIGINT"));
74
+ }
75
+ main().catch((err) => {
76
+ // "Already running" is a normal, expected condition (systemd/launchd may
77
+ // race a manual start, or the user double-launches) — not a crash. Report
78
+ // it calmly and exit 0 so service managers don't flag a failure loop.
79
+ if (err instanceof SupervisorAlreadyRunningError) {
80
+ process.stderr.write(`[pi-supervisord] ${err.message}\n`);
81
+ process.exit(0);
82
+ }
83
+ process.stderr.write(`[pi-supervisord] fatal: ${String(err)}\n`);
84
+ process.exit(1);
85
+ });
86
+ //# sourceMappingURL=supervisord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supervisord.js","sourceRoot":"","sources":["../../src/bin/supervisord.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAEpF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,kEAAkE;IAClE,uEAAuE;IACvE,mEAAmE;IACnE,sCAAsC;IACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO;IACT,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACtD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IACD,IAAI,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EAA0E;IAC1E,sEAAsE;IACtE,IAAI,GAAG,YAAY,6BAA6B,EAAE,CAAC;QACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Plan/28 — Mirror of the Pi SDK's built-in slash commands.
3
+ *
4
+ * The SDK `@mariozechner/pi-coding-agent` defines `BUILTIN_SLASH_COMMANDS`
5
+ * in `dist/core/slash-commands.js` but does NOT re-export it from the main
6
+ * package entry, and the `exports` field of its `package.json` blocks deep
7
+ * imports. So pi-extension carries this manually-maintained mirror until
8
+ * an upstream PR exposes the constant publicly.
9
+ *
10
+ * **Maintenance**: when bumping `@mariozechner/pi-coding-agent`, diff the
11
+ * runtime's `BUILTIN_SLASH_COMMANDS` against this file and update names,
12
+ * descriptions, and the invokable / takes_args flags. The Wave 0 scout of
13
+ * plan/28 captured the 0.73.1 baseline; later bumps should leave a
14
+ * one-liner note here documenting which SDK version was synced.
15
+ *
16
+ * Synced from SDK version: **0.73.1**.
17
+ *
18
+ * **Invokability**: a builtin is `invokable: true` only when an entry in
19
+ * `ExtensionContextActions` lets the extension run it without simulating
20
+ * keyboard input in the TUI. The full mapping lives in `dispatcher.ts`
21
+ * (Wave B Slice 2). When more upstream APIs land, flip more flags to
22
+ * `true` here and add the corresponding dispatch in `dispatcher.ts`.
23
+ */
24
+ import type { WireCommand } from "../protocol/types.js";
25
+ /**
26
+ * A built-in slash command as exposed by the Pi TUI. Mirror of the SDK's
27
+ * `BuiltinSlashCommand` interface, kept local to avoid the deep-import.
28
+ */
29
+ export interface BuiltinMirrorEntry {
30
+ /** Slash name without the leading `/`. */
31
+ name: string;
32
+ /** One-line description shown in the app picker. */
33
+ description: string;
34
+ /**
35
+ * Whether the extension API can invoke this builtin programmatically
36
+ * via `ExtensionContextActions`. Stays `false` until plan/28 Wave B
37
+ * Slice 2 wires the dispatcher AND the underlying SDK action exists.
38
+ */
39
+ invokable: boolean;
40
+ /**
41
+ * Whether the builtin meaningfully accepts free-text arguments after
42
+ * its name (e.g. `/model claude-opus-4-7`, `/name <session-name>`).
43
+ * Used by the app to decide whether to keep the input editable after
44
+ * the chip is placed.
45
+ */
46
+ takes_args: boolean;
47
+ }
48
+ export declare const BUILTIN_SLASH_COMMANDS_MIRROR: readonly BuiltinMirrorEntry[];
49
+ /**
50
+ * Lookup helper used by the dispatcher. Returns the mirror entry for a
51
+ * builtin name, or `undefined` if `name` is not a known builtin.
52
+ */
53
+ export declare function findBuiltin(name: string): BuiltinMirrorEntry | undefined;
54
+ /**
55
+ * Project a mirror entry to the wire schema. Shared by the list_commands
56
+ * handler so the mirror and the wire stay in lockstep.
57
+ */
58
+ export declare function builtinToWire(entry: BuiltinMirrorEntry): WireCommand;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Plan/28 — Mirror of the Pi SDK's built-in slash commands.
3
+ *
4
+ * The SDK `@mariozechner/pi-coding-agent` defines `BUILTIN_SLASH_COMMANDS`
5
+ * in `dist/core/slash-commands.js` but does NOT re-export it from the main
6
+ * package entry, and the `exports` field of its `package.json` blocks deep
7
+ * imports. So pi-extension carries this manually-maintained mirror until
8
+ * an upstream PR exposes the constant publicly.
9
+ *
10
+ * **Maintenance**: when bumping `@mariozechner/pi-coding-agent`, diff the
11
+ * runtime's `BUILTIN_SLASH_COMMANDS` against this file and update names,
12
+ * descriptions, and the invokable / takes_args flags. The Wave 0 scout of
13
+ * plan/28 captured the 0.73.1 baseline; later bumps should leave a
14
+ * one-liner note here documenting which SDK version was synced.
15
+ *
16
+ * Synced from SDK version: **0.73.1**.
17
+ *
18
+ * **Invokability**: a builtin is `invokable: true` only when an entry in
19
+ * `ExtensionContextActions` lets the extension run it without simulating
20
+ * keyboard input in the TUI. The full mapping lives in `dispatcher.ts`
21
+ * (Wave B Slice 2). When more upstream APIs land, flip more flags to
22
+ * `true` here and add the corresponding dispatch in `dispatcher.ts`.
23
+ */
24
+ export const BUILTIN_SLASH_COMMANDS_MIRROR = [
25
+ // Session lifecycle
26
+ { name: "compact", description: "Manually compact the session context", invokable: true, takes_args: false },
27
+ { name: "new", description: "Start a new session", invokable: false, takes_args: false },
28
+ { name: "resume", description: "Resume a different session", invokable: false, takes_args: false },
29
+ { name: "fork", description: "Create a new fork from a previous user message", invokable: false, takes_args: false },
30
+ { name: "clone", description: "Duplicate the current session at the current position", invokable: false, takes_args: false },
31
+ { name: "tree", description: "Navigate session tree (switch branches)", invokable: false, takes_args: false },
32
+ { name: "name", description: "Set session display name", invokable: false, takes_args: true },
33
+ { name: "session", description: "Show session info and stats", invokable: false, takes_args: false },
34
+ // Model / providers
35
+ { name: "model", description: "Select model", invokable: true, takes_args: true },
36
+ { name: "scoped-models", description: "Enable/disable models for Ctrl+P cycling", invokable: false, takes_args: false },
37
+ { name: "login", description: "Configure provider authentication", invokable: false, takes_args: false },
38
+ { name: "logout", description: "Remove provider authentication", invokable: false, takes_args: false },
39
+ // Import / export / share
40
+ { name: "export", description: "Export session (HTML default, or specify path)", invokable: false, takes_args: true },
41
+ { name: "import", description: "Import and resume a session from a JSONL file", invokable: false, takes_args: true },
42
+ { name: "share", description: "Share session as a secret GitHub gist", invokable: false, takes_args: false },
43
+ { name: "copy", description: "Copy last agent message to clipboard", invokable: false, takes_args: false },
44
+ // UI / settings
45
+ { name: "settings", description: "Open settings menu", invokable: false, takes_args: false },
46
+ { name: "hotkeys", description: "Show all keyboard shortcuts", invokable: false, takes_args: false },
47
+ { name: "changelog", description: "Show changelog entries", invokable: false, takes_args: false },
48
+ { name: "reload", description: "Reload keybindings, extensions, skills, prompts, themes", invokable: false, takes_args: false },
49
+ { name: "quit", description: "Quit pi", invokable: true, takes_args: false },
50
+ ];
51
+ /**
52
+ * Lookup helper used by the dispatcher. Returns the mirror entry for a
53
+ * builtin name, or `undefined` if `name` is not a known builtin.
54
+ */
55
+ export function findBuiltin(name) {
56
+ return BUILTIN_SLASH_COMMANDS_MIRROR.find((c) => c.name === name);
57
+ }
58
+ /**
59
+ * Project a mirror entry to the wire schema. Shared by the list_commands
60
+ * handler so the mirror and the wire stay in lockstep.
61
+ */
62
+ export function builtinToWire(entry) {
63
+ return {
64
+ name: entry.name,
65
+ description: entry.description,
66
+ source: "builtin",
67
+ invokable: entry.invokable,
68
+ takes_args: entry.takes_args,
69
+ };
70
+ }
71
+ //# sourceMappingURL=builtin_mirror.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin_mirror.js","sourceRoot":"","sources":["../../src/commands/builtin_mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA4BH,MAAM,CAAC,MAAM,6BAA6B,GAAkC;IAC1E,oBAAoB;IACpB,EAAE,IAAI,EAAE,SAAS,EAAQ,WAAW,EAAE,sCAAsC,EAAiB,SAAS,EAAE,IAAI,EAAG,UAAU,EAAE,KAAK,EAAE;IAClI,EAAE,IAAI,EAAE,KAAK,EAAY,WAAW,EAAE,qBAAqB,EAAkC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;IAClI,EAAE,IAAI,EAAE,QAAQ,EAAS,WAAW,EAAE,4BAA4B,EAA2B,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;IAClI,EAAE,IAAI,EAAE,MAAM,EAAW,WAAW,EAAE,gDAAgD,EAAO,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;IAClI,EAAE,IAAI,EAAE,OAAO,EAAU,WAAW,EAAE,uDAAuD,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;IACp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