@herbertgao/pi-extensions 2026.8.2 → 2026.8.3

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 (272) hide show
  1. package/README.md +9 -2
  2. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +6 -8
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -7
  4. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +101 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -17
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +5 -3
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{utils/agent-summary.ts → feature/agent-summary/core.ts} +37 -35
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-summary.ts → agent-summary/index.ts} +2 -6
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference.ts → reference/index.ts} +1 -1
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-autocomplete.ts → reference/subagent.ts} +19 -9
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-startup-header.ts → shell/startup-header.ts} +1 -1
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{working-message.ts → shell/working-message.ts} +5 -2
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -28
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +379 -85
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +727 -0
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +65 -775
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{feature → renderer}/markdown-enhance.ts +35 -31
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-hover.ts → mouse/hover.ts} +5 -5
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-interaction.ts → mouse/interaction.ts} +34 -35
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-layout.ts → mouse/layout.ts} +5 -21
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-packets.ts → mouse/packets.ts} +1 -1
  22. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-scroll.ts → mouse/scroll.ts} +48 -37
  23. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ansi-utils.ts +56 -1
  24. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-renderer.ts +2 -2
  25. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/line-width-safety.ts +1 -1
  26. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +12 -0
  27. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/write-execution.ts +1 -2
  28. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-grouping.ts → tool/grouping.ts} +18 -8
  29. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-result.ts → tool/result.ts} +4 -13
  30. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +0 -27
  31. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  32. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  33. package/node_modules/@herbertgao/pi-subagents/package.json +2 -2
  34. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +1 -0
  35. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +3 -1
  36. package/node_modules/@herbertgao/pi-subagents/src/index.ts +33 -35
  37. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +26 -35
  38. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +15 -1
  39. package/node_modules/pi-mcp-adapter/CHANGELOG.md +19 -0
  40. package/node_modules/pi-mcp-adapter/README.md +19 -4
  41. package/node_modules/pi-mcp-adapter/agent-dir.ts +40 -0
  42. package/node_modules/pi-mcp-adapter/commands.ts +12 -2
  43. package/node_modules/pi-mcp-adapter/direct-tools.ts +6 -8
  44. package/node_modules/pi-mcp-adapter/index.ts +15 -3
  45. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +87 -4
  46. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +138 -61
  47. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +43 -4
  48. package/node_modules/pi-mcp-adapter/oauth.ts +48 -0
  49. package/node_modules/pi-mcp-adapter/package.json +8 -2
  50. package/node_modules/pi-mcp-adapter/proxy-modes.ts +8 -10
  51. package/node_modules/pi-mcp-adapter/tool-registrar.ts +187 -3
  52. package/node_modules/pi-mcp-adapter/types.ts +2 -0
  53. package/node_modules/pi-web-access/CHANGELOG.md +45 -0
  54. package/node_modules/pi-web-access/README.md +104 -29
  55. package/node_modules/pi-web-access/bocha.ts +221 -0
  56. package/node_modules/pi-web-access/curator-page.ts +113 -12
  57. package/node_modules/pi-web-access/curator-server.ts +56 -20
  58. package/node_modules/pi-web-access/datalab-pdf-extract.ts +568 -0
  59. package/node_modules/pi-web-access/duckduckgo.ts +123 -0
  60. package/node_modules/pi-web-access/extract.ts +288 -143
  61. package/node_modules/pi-web-access/feature-config.ts +29 -0
  62. package/node_modules/pi-web-access/gemini-api.ts +4 -0
  63. package/node_modules/pi-web-access/gemini-search.ts +45 -12
  64. package/node_modules/pi-web-access/gemini-web.ts +68 -3
  65. package/node_modules/pi-web-access/index.ts +160 -71
  66. package/node_modules/pi-web-access/jina-search.ts +284 -0
  67. package/node_modules/pi-web-access/kagi.ts +12 -12
  68. package/node_modules/pi-web-access/openai-search.ts +12 -2
  69. package/node_modules/pi-web-access/package.json +4 -3
  70. package/node_modules/pi-web-access/pdf-extract.ts +327 -228
  71. package/node_modules/pi-web-access/storage.ts +440 -2
  72. package/node_modules/pi-web-access/summary-model-scope.ts +1 -1
  73. package/node_modules/pi-web-access/summary-review.ts +4 -2
  74. package/node_modules/pi-web-access/video-extract.ts +10 -8
  75. package/node_modules/pi-web-access/xai-search.ts +12 -2
  76. package/node_modules/pi-web-access/youtube-extract.ts +2 -1
  77. package/node_modules/remote-pi/LICENSE +21 -0
  78. package/node_modules/remote-pi/README.md +675 -0
  79. package/node_modules/remote-pi/dist/actions/handlers.d.ts +122 -0
  80. package/node_modules/remote-pi/dist/actions/handlers.js +160 -0
  81. package/node_modules/remote-pi/dist/actions/handlers.js.map +1 -0
  82. package/node_modules/remote-pi/dist/actions/registry.d.ts +39 -0
  83. package/node_modules/remote-pi/dist/actions/registry.js +58 -0
  84. package/node_modules/remote-pi/dist/actions/registry.js.map +1 -0
  85. package/node_modules/remote-pi/dist/bin/supervisord.d.ts +2 -0
  86. package/node_modules/remote-pi/dist/bin/supervisord.js +86 -0
  87. package/node_modules/remote-pi/dist/bin/supervisord.js.map +1 -0
  88. package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +58 -0
  89. package/node_modules/remote-pi/dist/commands/builtin_mirror.js +71 -0
  90. package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +1 -0
  91. package/node_modules/remote-pi/dist/commands/list_commands.d.ts +60 -0
  92. package/node_modules/remote-pi/dist/commands/list_commands.js +73 -0
  93. package/node_modules/remote-pi/dist/commands/list_commands.js.map +1 -0
  94. package/node_modules/remote-pi/dist/config.d.ts +62 -0
  95. package/node_modules/remote-pi/dist/config.js +115 -0
  96. package/node_modules/remote-pi/dist/config.js.map +1 -0
  97. package/node_modules/remote-pi/dist/daemon/client.d.ts +20 -0
  98. package/node_modules/remote-pi/dist/daemon/client.js +131 -0
  99. package/node_modules/remote-pi/dist/daemon/client.js.map +1 -0
  100. package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +176 -0
  101. package/node_modules/remote-pi/dist/daemon/control_protocol.js +63 -0
  102. package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +1 -0
  103. package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +45 -0
  104. package/node_modules/remote-pi/dist/daemon/cron_log.js +72 -0
  105. package/node_modules/remote-pi/dist/daemon/cron_log.js.map +1 -0
  106. package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +80 -0
  107. package/node_modules/remote-pi/dist/daemon/cron_registry.js +194 -0
  108. package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +1 -0
  109. package/node_modules/remote-pi/dist/daemon/id.d.ts +24 -0
  110. package/node_modules/remote-pi/dist/daemon/id.js +36 -0
  111. package/node_modules/remote-pi/dist/daemon/id.js.map +1 -0
  112. package/node_modules/remote-pi/dist/daemon/install.d.ts +170 -0
  113. package/node_modules/remote-pi/dist/daemon/install.js +547 -0
  114. package/node_modules/remote-pi/dist/daemon/install.js.map +1 -0
  115. package/node_modules/remote-pi/dist/daemon/registry.d.ts +63 -0
  116. package/node_modules/remote-pi/dist/daemon/registry.js +153 -0
  117. package/node_modules/remote-pi/dist/daemon/registry.js.map +1 -0
  118. package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +194 -0
  119. package/node_modules/remote-pi/dist/daemon/rpc_child.js +389 -0
  120. package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +1 -0
  121. package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +93 -0
  122. package/node_modules/remote-pi/dist/daemon/supervisor.js +596 -0
  123. package/node_modules/remote-pi/dist/daemon/supervisor.js.map +1 -0
  124. package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +26 -0
  125. package/node_modules/remote-pi/dist/extension_ui_bridge.js +341 -0
  126. package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +1 -0
  127. package/node_modules/remote-pi/dist/index.d.ts +213 -0
  128. package/node_modules/remote-pi/dist/index.js +4996 -0
  129. package/node_modules/remote-pi/dist/index.js.map +1 -0
  130. package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +10 -0
  131. package/node_modules/remote-pi/dist/mcp/mesh_result.js +42 -0
  132. package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +1 -0
  133. package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +16 -0
  134. package/node_modules/remote-pi/dist/mcp/mesh_server.js +327 -0
  135. package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +1 -0
  136. package/node_modules/remote-pi/dist/mesh/canonical.d.ts +30 -0
  137. package/node_modules/remote-pi/dist/mesh/canonical.js +61 -0
  138. package/node_modules/remote-pi/dist/mesh/canonical.js.map +1 -0
  139. package/node_modules/remote-pi/dist/mesh/client.d.ts +18 -0
  140. package/node_modules/remote-pi/dist/mesh/client.js +125 -0
  141. package/node_modules/remote-pi/dist/mesh/client.js.map +1 -0
  142. package/node_modules/remote-pi/dist/mesh/encoding.d.ts +38 -0
  143. package/node_modules/remote-pi/dist/mesh/encoding.js +216 -0
  144. package/node_modules/remote-pi/dist/mesh/encoding.js.map +1 -0
  145. package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +73 -0
  146. package/node_modules/remote-pi/dist/mesh/self_revoke.js +401 -0
  147. package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +1 -0
  148. package/node_modules/remote-pi/dist/mesh/siblings.d.ts +49 -0
  149. package/node_modules/remote-pi/dist/mesh/siblings.js +159 -0
  150. package/node_modules/remote-pi/dist/mesh/siblings.js.map +1 -0
  151. package/node_modules/remote-pi/dist/mesh/types.d.ts +34 -0
  152. package/node_modules/remote-pi/dist/mesh/types.js +11 -0
  153. package/node_modules/remote-pi/dist/mesh/types.js.map +1 -0
  154. package/node_modules/remote-pi/dist/mesh/verify.d.ts +17 -0
  155. package/node_modules/remote-pi/dist/mesh/verify.js +86 -0
  156. package/node_modules/remote-pi/dist/mesh/verify.js.map +1 -0
  157. package/node_modules/remote-pi/dist/pairing/crypto.d.ts +8 -0
  158. package/node_modules/remote-pi/dist/pairing/crypto.js +22 -0
  159. package/node_modules/remote-pi/dist/pairing/crypto.js.map +1 -0
  160. package/node_modules/remote-pi/dist/pairing/handshake.d.ts +28 -0
  161. package/node_modules/remote-pi/dist/pairing/handshake.js +113 -0
  162. package/node_modules/remote-pi/dist/pairing/handshake.js.map +1 -0
  163. package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +16 -0
  164. package/node_modules/remote-pi/dist/pairing/noise-sha256.js +103 -0
  165. package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +1 -0
  166. package/node_modules/remote-pi/dist/pairing/qr.d.ts +59 -0
  167. package/node_modules/remote-pi/dist/pairing/qr.js +125 -0
  168. package/node_modules/remote-pi/dist/pairing/qr.js.map +1 -0
  169. package/node_modules/remote-pi/dist/pairing/storage.d.ts +120 -0
  170. package/node_modules/remote-pi/dist/pairing/storage.js +604 -0
  171. package/node_modules/remote-pi/dist/pairing/storage.js.map +1 -0
  172. package/node_modules/remote-pi/dist/protocol/codec.d.ts +7 -0
  173. package/node_modules/remote-pi/dist/protocol/codec.js +49 -0
  174. package/node_modules/remote-pi/dist/protocol/codec.js.map +1 -0
  175. package/node_modules/remote-pi/dist/protocol/types.d.ts +393 -0
  176. package/node_modules/remote-pi/dist/protocol/types.js +2 -0
  177. package/node_modules/remote-pi/dist/protocol/types.js.map +1 -0
  178. package/node_modules/remote-pi/dist/rooms.d.ts +29 -0
  179. package/node_modules/remote-pi/dist/rooms.js +57 -0
  180. package/node_modules/remote-pi/dist/rooms.js.map +1 -0
  181. package/node_modules/remote-pi/dist/session/address.d.ts +49 -0
  182. package/node_modules/remote-pi/dist/session/address.js +58 -0
  183. package/node_modules/remote-pi/dist/session/address.js.map +1 -0
  184. package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +55 -0
  185. package/node_modules/remote-pi/dist/session/agent_bridge.js +146 -0
  186. package/node_modules/remote-pi/dist/session/agent_bridge.js.map +1 -0
  187. package/node_modules/remote-pi/dist/session/bridge.d.ts +37 -0
  188. package/node_modules/remote-pi/dist/session/bridge.js +130 -0
  189. package/node_modules/remote-pi/dist/session/bridge.js.map +1 -0
  190. package/node_modules/remote-pi/dist/session/broker.d.ts +189 -0
  191. package/node_modules/remote-pi/dist/session/broker.js +507 -0
  192. package/node_modules/remote-pi/dist/session/broker.js.map +1 -0
  193. package/node_modules/remote-pi/dist/session/broker_remote.d.ts +74 -0
  194. package/node_modules/remote-pi/dist/session/broker_remote.js +583 -0
  195. package/node_modules/remote-pi/dist/session/broker_remote.js.map +1 -0
  196. package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +33 -0
  197. package/node_modules/remote-pi/dist/session/cwd_lock.js +126 -0
  198. package/node_modules/remote-pi/dist/session/cwd_lock.js.map +1 -0
  199. package/node_modules/remote-pi/dist/session/envelope.d.ts +33 -0
  200. package/node_modules/remote-pi/dist/session/envelope.js +117 -0
  201. package/node_modules/remote-pi/dist/session/envelope.js.map +1 -0
  202. package/node_modules/remote-pi/dist/session/global_config.d.ts +33 -0
  203. package/node_modules/remote-pi/dist/session/global_config.js +73 -0
  204. package/node_modules/remote-pi/dist/session/global_config.js.map +1 -0
  205. package/node_modules/remote-pi/dist/session/ipc.d.ts +27 -0
  206. package/node_modules/remote-pi/dist/session/ipc.js +22 -0
  207. package/node_modules/remote-pi/dist/session/ipc.js.map +1 -0
  208. package/node_modules/remote-pi/dist/session/leader_election.d.ts +32 -0
  209. package/node_modules/remote-pi/dist/session/leader_election.js +106 -0
  210. package/node_modules/remote-pi/dist/session/leader_election.js.map +1 -0
  211. package/node_modules/remote-pi/dist/session/local_config.d.ts +55 -0
  212. package/node_modules/remote-pi/dist/session/local_config.js +157 -0
  213. package/node_modules/remote-pi/dist/session/local_config.js.map +1 -0
  214. package/node_modules/remote-pi/dist/session/mesh_message.d.ts +20 -0
  215. package/node_modules/remote-pi/dist/session/mesh_message.js +28 -0
  216. package/node_modules/remote-pi/dist/session/mesh_message.js.map +1 -0
  217. package/node_modules/remote-pi/dist/session/mesh_node.d.ts +116 -0
  218. package/node_modules/remote-pi/dist/session/mesh_node.js +573 -0
  219. package/node_modules/remote-pi/dist/session/mesh_node.js.map +1 -0
  220. package/node_modules/remote-pi/dist/session/peer.d.ts +139 -0
  221. package/node_modules/remote-pi/dist/session/peer.js +451 -0
  222. package/node_modules/remote-pi/dist/session/peer.js.map +1 -0
  223. package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +13 -0
  224. package/node_modules/remote-pi/dist/session/peer_inventory.js +48 -0
  225. package/node_modules/remote-pi/dist/session/peer_inventory.js.map +1 -0
  226. package/node_modules/remote-pi/dist/session/peer_limits.d.ts +9 -0
  227. package/node_modules/remote-pi/dist/session/peer_limits.js +21 -0
  228. package/node_modules/remote-pi/dist/session/peer_limits.js.map +1 -0
  229. package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +39 -0
  230. package/node_modules/remote-pi/dist/session/setup_wizard.js +63 -0
  231. package/node_modules/remote-pi/dist/session/setup_wizard.js.map +1 -0
  232. package/node_modules/remote-pi/dist/session/tool_gate.d.ts +5 -0
  233. package/node_modules/remote-pi/dist/session/tool_gate.js +11 -0
  234. package/node_modules/remote-pi/dist/session/tool_gate.js.map +1 -0
  235. package/node_modules/remote-pi/dist/session/tools.d.ts +24 -0
  236. package/node_modules/remote-pi/dist/session/tools.js +252 -0
  237. package/node_modules/remote-pi/dist/session/tools.js.map +1 -0
  238. package/node_modules/remote-pi/dist/session/wizard.d.ts +13 -0
  239. package/node_modules/remote-pi/dist/session/wizard.js +20 -0
  240. package/node_modules/remote-pi/dist/session/wizard.js.map +1 -0
  241. package/node_modules/remote-pi/dist/settings.d.ts +15 -0
  242. package/node_modules/remote-pi/dist/settings.js +52 -0
  243. package/node_modules/remote-pi/dist/settings.js.map +1 -0
  244. package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +37 -0
  245. package/node_modules/remote-pi/dist/transport/peer_channel.js +98 -0
  246. package/node_modules/remote-pi/dist/transport/peer_channel.js.map +1 -0
  247. package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +29 -0
  248. package/node_modules/remote-pi/dist/transport/pi_forward_client.js +62 -0
  249. package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +1 -0
  250. package/node_modules/remote-pi/dist/transport/relay_client.d.ts +91 -0
  251. package/node_modules/remote-pi/dist/transport/relay_client.js +206 -0
  252. package/node_modules/remote-pi/dist/transport/relay_client.js.map +1 -0
  253. package/node_modules/remote-pi/dist/ui/footer.d.ts +32 -0
  254. package/node_modules/remote-pi/dist/ui/footer.js +34 -0
  255. package/node_modules/remote-pi/dist/ui/footer.js.map +1 -0
  256. package/node_modules/remote-pi/docs/daemon.md +289 -0
  257. package/node_modules/remote-pi/package.json +88 -0
  258. package/node_modules/remote-pi/service-templates/launchd.plist.template +35 -0
  259. package/node_modules/remote-pi/service-templates/systemd.service.template +19 -0
  260. package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +10 -0
  261. package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +38 -0
  262. package/node_modules/remote-pi/skills/agent-network/SKILL.md +310 -0
  263. package/package.json +19 -9
  264. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/write-display-utils.ts +0 -29
  265. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference-core.ts → reference/session.ts} +0 -0
  266. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-aliases.ts → shell/aliases.ts} +0 -0
  267. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ATTRIBUTION.md +0 -0
  268. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-presentation.ts +0 -0
  269. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/index.ts +0 -0
  270. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/render-utils.ts +0 -0
  271. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/shiki-highlight.ts +0 -0
  272. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/types.ts +0 -0
@@ -10,7 +10,7 @@ import { combineAbortSignals, isAbortError } from "./runtime-owner.ts";
10
10
  import { buildToolMetadata, getToolNames, findToolByName, formatSchema } from "./tool-metadata.ts";
11
11
  import { renderTsShape } from "./ts-shape.ts";
12
12
  import { reconstructPromptMetadata } from "./metadata-cache.ts";
13
- import { resolveMcpResultContent, transformMcpContent } from "./tool-registrar.ts";
13
+ import { resolveMcpResultContent, transformMcpContent, transformMcpResourceContents } from "./tool-registrar.ts";
14
14
  import { guardMcpOutput, guardedMcpDetails, resolveMcpOutputGuardOptions } from "./mcp-output-guard.ts";
15
15
  import { maybeStartUiSession, summarizeUiSessionResult, type UiSessionRuntime } from "./ui-session.ts";
16
16
  import { formatAuthRequiredMessage, formatMcpStatus, resolveServerUrl, truncateAtWord } from "./utils.ts";
@@ -21,6 +21,7 @@ import { ensureToolCallApproved, isToolCallApprovalRequired } from "./tool-appro
21
21
 
22
22
  type ProxyToolResult = AgentToolResult<Record<string, unknown>>;
23
23
  type ClientCallToolResult = Awaited<ReturnType<Client["callTool"]>>;
24
+ type ClientReadResourceResult = Awaited<ReturnType<Client["readResource"]>>;
24
25
 
25
26
  const require = createRequire(import.meta.url);
26
27
  const MAX_REGEX_SEARCH_QUERY_LENGTH = 256;
@@ -1112,7 +1113,7 @@ export async function executeCall(
1112
1113
  state.manager.incrementInFlight(serverName);
1113
1114
 
1114
1115
  if (toolMeta.resourceUri) {
1115
- const result = await withSessionRecovery(
1116
+ const result = await withSessionRecovery<ClientReadResourceResult>(
1116
1117
  {
1117
1118
  manager: state.manager,
1118
1119
  config: state.config,
@@ -1122,10 +1123,7 @@ export async function executeCall(
1122
1123
  serverName,
1123
1124
  (conn) => conn.client.readResource({ uri: toolMeta.resourceUri! }, requestOptions),
1124
1125
  );
1125
- const content = (result.contents ?? []).map(c => ({
1126
- type: "text" as const,
1127
- text: "text" in c ? c.text : ("blob" in c ? `[Binary data: ${(c as { mimeType?: string }).mimeType ?? "unknown"}]` : JSON.stringify(c)),
1128
- }));
1126
+ const content = transformMcpResourceContents(result.contents ?? [], state.owner?.signal);
1129
1127
  const guarded = await guardMcpOutput(content.length > 0 ? content : [{ type: "text" as const, text: "(empty resource)" }], outputGuardOptions);
1130
1128
  return {
1131
1129
  content: guarded.content,
@@ -1165,7 +1163,7 @@ export async function executeCall(
1165
1163
 
1166
1164
  if (result.isError) {
1167
1165
  const mcpContent = (result.content ?? []) as McpContent[];
1168
- const content = transformMcpContent(mcpContent);
1166
+ const content = transformMcpContent(mcpContent, state.owner?.signal);
1169
1167
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
1170
1168
  const schemaText = toolMeta.inputSchema ? `\n\nExpected parameters:\n${formatSchema(toolMeta.inputSchema)}` : "";
1171
1169
  const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, prefix: "Error: ", suffix: schemaText, emptyTextFallback: "Tool execution failed", rawMcpResult: result });
@@ -1175,7 +1173,7 @@ export async function executeCall(
1175
1173
  };
1176
1174
  }
1177
1175
 
1178
- const content = resolveMcpResultContent(result as Record<string, unknown>);
1176
+ const content = resolveMcpResultContent(result as Record<string, unknown>, state.owner?.signal);
1179
1177
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
1180
1178
  const uiSummary = summarizeUiSessionResult(uiSession);
1181
1179
  const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, suffix: `\n\n${uiSummary.message}`, rawMcpResult: result });
@@ -1194,7 +1192,7 @@ export async function executeCall(
1194
1192
 
1195
1193
  if (result.isError) {
1196
1194
  const mcpContent = (result.content ?? []) as McpContent[];
1197
- const content = transformMcpContent(mcpContent);
1195
+ const content = transformMcpContent(mcpContent, state.owner?.signal);
1198
1196
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
1199
1197
  const schemaText = toolMeta.inputSchema ? `\n\nExpected parameters:\n${formatSchema(toolMeta.inputSchema)}` : "";
1200
1198
  const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, prefix: "Error: ", suffix: schemaText, emptyTextFallback: "Tool execution failed", rawMcpResult: result });
@@ -1204,7 +1202,7 @@ export async function executeCall(
1204
1202
  };
1205
1203
  }
1206
1204
 
1207
- const content = resolveMcpResultContent(result as Record<string, unknown>);
1205
+ const content = resolveMcpResultContent(result as Record<string, unknown>, state.owner?.signal);
1208
1206
  const outputContent = content.length > 0 ? content : [{ type: "text" as const, text: "(empty result)" }];
1209
1207
  const guarded = await guardMcpOutput(outputContent, { ...outputGuardOptions, rawMcpResult: result });
1210
1208
  return {
@@ -2,12 +2,189 @@
2
2
  // NOTE: Tools are NOT registered with Pi - only the unified `mcp` proxy tool is registered.
3
3
  // This keeps the LLM context small (1 tool instead of 100s).
4
4
 
5
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
6
+ import { tmpdir } from "node:os";
7
+ import { join } from "node:path";
5
8
  import type { McpContent, ContentBlock } from "./types.ts";
6
9
 
10
+ const MAX_BINARY_RESOURCE_BYTES = 10 * 1024 * 1024;
11
+ const MAX_SESSION_RESOURCE_BYTES = 100 * 1024 * 1024;
12
+ const MAX_SESSION_RESOURCE_FILES = 10_000; // Bounds metadata from empty or tiny resources.
13
+ const CLEANUP_RETRY_DELAY_MS = 30_000;
14
+ const MAX_CLEANUP_RETRY_ATTEMPTS = 3;
15
+ type MaterializedResourceSession = {
16
+ directory: string | undefined;
17
+ bytes: number;
18
+ files: number;
19
+ sequence: number;
20
+ };
21
+
22
+ function createMaterializedResourceSession(): MaterializedResourceSession {
23
+ return {
24
+ directory: undefined,
25
+ bytes: 0,
26
+ files: 0,
27
+ sequence: 0,
28
+ };
29
+ }
30
+
31
+ const defaultMaterializedResourceSession = createMaterializedResourceSession();
32
+ const scopedMaterializedResourceSessions = new WeakMap<object, MaterializedResourceSession>();
33
+ const pendingCleanupDirectories = new Set<string>();
34
+ const cleanupRetryAttempts = new Map<string, number>();
35
+ let pendingCleanupRetry: ReturnType<typeof setTimeout> | undefined;
36
+
37
+ function isAbortedScope(scope: object | undefined): boolean {
38
+ return !!scope && "aborted" in scope && (scope as { aborted?: unknown }).aborted === true;
39
+ }
40
+
41
+ function getMaterializedResourceSession(scope?: object): MaterializedResourceSession | undefined {
42
+ if (isAbortedScope(scope)) return undefined;
43
+ if (!scope) return defaultMaterializedResourceSession;
44
+ let session = scopedMaterializedResourceSessions.get(scope);
45
+ if (!session) {
46
+ session = createMaterializedResourceSession();
47
+ scopedMaterializedResourceSessions.set(scope, session);
48
+ }
49
+ return session;
50
+ }
51
+
52
+ type BinaryResource = { uri?: string | undefined; text?: string | undefined; mimeType?: string | undefined; blob: string };
53
+ type McpResourceContent = {
54
+ uri: string;
55
+ text?: string | undefined;
56
+ blob?: string | undefined;
57
+ mimeType?: string | undefined;
58
+ [key: string]: unknown;
59
+ };
60
+
61
+ function hasRetryableCleanupDirectory(): boolean {
62
+ for (const directory of pendingCleanupDirectories) {
63
+ if ((cleanupRetryAttempts.get(directory) ?? 0) < MAX_CLEANUP_RETRY_ATTEMPTS) return true;
64
+ }
65
+ return false;
66
+ }
67
+
68
+ function schedulePendingCleanupRetry(): void {
69
+ if (pendingCleanupRetry || !hasRetryableCleanupDirectory()) return;
70
+ for (const directory of pendingCleanupDirectories) {
71
+ const attempts = cleanupRetryAttempts.get(directory) ?? 0;
72
+ if (attempts < MAX_CLEANUP_RETRY_ATTEMPTS) cleanupRetryAttempts.set(directory, attempts + 1);
73
+ }
74
+ pendingCleanupRetry = setTimeout(() => {
75
+ pendingCleanupRetry = undefined;
76
+ try {
77
+ drainPendingCleanupDirectories();
78
+ } catch {
79
+ // drainPendingCleanupDirectories already retained the paths and rescheduled another retry.
80
+ }
81
+ }, CLEANUP_RETRY_DELAY_MS);
82
+ }
83
+
84
+ function drainPendingCleanupDirectories(): void {
85
+ const failures: unknown[] = [];
86
+ for (const directory of Array.from(pendingCleanupDirectories)) {
87
+ try {
88
+ rmSync(directory, { recursive: true, force: true });
89
+ pendingCleanupDirectories.delete(directory);
90
+ cleanupRetryAttempts.delete(directory);
91
+ } catch (error) {
92
+ failures.push(error);
93
+ }
94
+ }
95
+ if (pendingCleanupDirectories.size === 0 && pendingCleanupRetry) {
96
+ clearTimeout(pendingCleanupRetry);
97
+ pendingCleanupRetry = undefined;
98
+ }
99
+ if (failures.length > 0) {
100
+ schedulePendingCleanupRetry();
101
+ throw new AggregateError(failures, "Failed to clean materialized MCP resources");
102
+ }
103
+ }
104
+
105
+ export function cleanupMaterializedBinaryResources(scope?: object): void {
106
+ const session = scope ? scopedMaterializedResourceSessions.get(scope) : defaultMaterializedResourceSession;
107
+ if (session?.directory) pendingCleanupDirectories.add(session.directory);
108
+ if (session) {
109
+ session.directory = undefined;
110
+ session.bytes = 0;
111
+ session.files = 0;
112
+ session.sequence = 0;
113
+ if (scope) scopedMaterializedResourceSessions.delete(scope);
114
+ }
115
+
116
+ drainPendingCleanupDirectories();
117
+ }
118
+
119
+ function replaceBlob(resource: BinaryResource, text: string): string {
120
+ delete (resource as Partial<BinaryResource>).blob;
121
+ resource.text = text;
122
+ return text;
123
+ }
124
+
125
+ function omitBinaryResource(resource: BinaryResource, reason: string): string {
126
+ return replaceBlob(resource, [
127
+ `[Resource: ${resource.uri ?? "(no URI)"}]`,
128
+ `Binary content omitted: ${reason}`,
129
+ `MIME type: ${resource.mimeType ?? "application/octet-stream"}`,
130
+ ].join("\n"));
131
+ }
132
+
133
+ function materializeBinaryResource(resource: BinaryResource, scope?: object): string {
134
+ const session = getMaterializedResourceSession(scope);
135
+ if (!session) return omitBinaryResource(resource, "runtime stopped");
136
+ const decodedBytes = Buffer.byteLength(resource.blob, "base64");
137
+ if (decodedBytes > MAX_BINARY_RESOURCE_BYTES) {
138
+ return omitBinaryResource(resource, "decoded size exceeds 10 MiB");
139
+ }
140
+ if (
141
+ session.bytes + decodedBytes > MAX_SESSION_RESOURCE_BYTES ||
142
+ session.files >= MAX_SESSION_RESOURCE_FILES
143
+ ) {
144
+ return omitBinaryResource(resource, "session resource limit reached");
145
+ }
146
+
147
+ try {
148
+ session.directory ??= mkdtempSync(join(tmpdir(), "pi-mcp-resource-"));
149
+ } catch {
150
+ return omitBinaryResource(resource, "could not be saved");
151
+ }
152
+
153
+ const filePath = join(session.directory, `resource-${++session.sequence}.bin`);
154
+ session.bytes += decodedBytes;
155
+ session.files += 1;
156
+ try {
157
+ writeFileSync(filePath, Buffer.from(resource.blob, "base64"), { flag: "wx", mode: 0o600 });
158
+ } catch {
159
+ try {
160
+ rmSync(filePath, { force: true });
161
+ session.bytes -= decodedBytes;
162
+ session.files -= 1;
163
+ } catch {
164
+ // Keep the reservation when a partial file cannot be removed.
165
+ }
166
+ return omitBinaryResource(resource, "could not be saved");
167
+ }
168
+
169
+ return replaceBlob(resource, [
170
+ `[Resource: ${resource.uri ?? "(no URI)"}]`,
171
+ `Binary content saved to ${filePath}`,
172
+ `MIME type: ${resource.mimeType ?? "application/octet-stream"}`,
173
+ ].join("\n"));
174
+ }
175
+
7
176
  /**
8
177
  * Transform MCP content types to Pi content blocks.
9
178
  */
10
- export function transformMcpContent(content: McpContent[]): ContentBlock[] {
179
+ export function transformMcpResourceContents(contents: McpResourceContent[], scope?: object): ContentBlock[] {
180
+ return contents.map(resource => {
181
+ if (typeof resource.text === "string") return { type: "text" as const, text: resource.text };
182
+ if (typeof resource.blob === "string") return { type: "text" as const, text: materializeBinaryResource(resource as BinaryResource, scope) };
183
+ return { type: "text" as const, text: JSON.stringify(resource) };
184
+ });
185
+ }
186
+
187
+ export function transformMcpContent(content: McpContent[], scope?: object): ContentBlock[] {
11
188
  return content.map(c => {
12
189
  if (c.type === "text") {
13
190
  return { type: "text" as const, text: c.text ?? "" };
@@ -21,6 +198,13 @@ export function transformMcpContent(content: McpContent[]): ContentBlock[] {
21
198
  }
22
199
  if (c.type === "resource") {
23
200
  const resourceUri = c.resource?.uri ?? "(no URI)";
201
+ if (c.resource && "blob" in c.resource && typeof c.resource.blob === "string") {
202
+ const binaryResource = c.resource as typeof c.resource & { mimeType?: string; blob: string };
203
+ return {
204
+ type: "text" as const,
205
+ text: materializeBinaryResource(binaryResource, scope),
206
+ };
207
+ }
24
208
  const resourceContent = c.resource?.text ?? (c.resource ? JSON.stringify(c.resource) : "(no content)");
25
209
  return {
26
210
  type: "text" as const,
@@ -49,8 +233,8 @@ export function transformMcpContent(content: McpContent[]): ContentBlock[] {
49
233
  * Resolve a tool result's content blocks, falling back to structuredContent
50
234
  * when content is empty.
51
235
  */
52
- export function resolveMcpResultContent(result: Record<string, unknown>): ContentBlock[] {
53
- const blocks = transformMcpContent((Array.isArray(result.content) ? result.content : []) as McpContent[]);
236
+ export function resolveMcpResultContent(result: Record<string, unknown>, scope?: object): ContentBlock[] {
237
+ const blocks = transformMcpContent((Array.isArray(result.content) ? result.content : []) as McpContent[], scope);
54
238
  if (blocks.length > 0) return blocks;
55
239
 
56
240
  if (result.structuredContent !== undefined && result.structuredContent !== null) {
@@ -350,6 +350,8 @@ export interface OAuthConfig {
350
350
  clientName?: string;
351
351
  /** Client homepage URI for dynamic registration */
352
352
  clientUri?: string;
353
+ /** Client logo URL for dynamic registration; shown on consent screens */
354
+ logoUri?: string;
353
355
  /** Security-weakening escape hatch for known-misconfigured authorization servers. */
354
356
  skipIssuerMetadataValidation?: boolean;
355
357
  }
@@ -4,6 +4,51 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.22.0] - 2026-08-11
8
+
9
+ ### Added
10
+ - Added Bocha web search provider support. Thanks @jingyulong for PR #243.
11
+ - Added `maxInlineContentChars` to configure the direct content and stored-content slice limit, with a 200,000-character maximum. Thanks @be4zad for issue #244.
12
+
13
+ ### Fixed
14
+ - Hardened the fetched-content cache against symlink traversal and unsafe permissions, and bounded it to 128 entries and 128 MiB with oldest-entry eviction. Thanks `@HerbertGao` for issue #240 and PR #241.
15
+
16
+ ## [0.21.0] - 2026-08-10
17
+
18
+ ### Added
19
+ - Added per-tool and per-command registration gates plus image and PDF extraction gates. Thanks @jaudiger for issue #234.
20
+ - Added `summaryGenerationDeadlineMs` to configure the summary model deadline for curator and auto-summary workflows. Thanks @cataldoc for issue #237.
21
+
22
+ ### Fixed
23
+ - Store full fetched content in an external cache instead of embedding it in session JSONL entries, preventing large search-heavy sessions from ballooning on restore. Thanks Igor Samokhovets (`@samohovets`) for issue #236.
24
+ - Document `get_search_content` parameter constraints in the tool schema. Thanks `@iwangjie` for PR #233.
25
+
26
+ ## [0.20.0] - 2026-08-10
27
+
28
+ ### Added
29
+ - Added keyless DuckDuckGo HTML search as an explicit and routing provider. Thanks @lmilojevicc for issue #228.
30
+ - Added Datalab hosted PDF-to-Markdown extraction as an optional PDF provider. Thanks José Antonio Galiano Sandoval (`@jagaliano`) for PR #226.
31
+
32
+ ### Changed
33
+ - Tightened Datalab JSON response validation and Gemini Web fetch initialization internals.
34
+
35
+ ### Fixed
36
+ - Fix Gemini Web "fetch failed" (`UND_ERR_HEADERS_OVERFLOW`) when running inside a host agent whose global undici dispatcher uses HTTP/1.1 with the default 16 KiB `maxHeaderSize`: Google's `/app` page exceeds that budget. Gemini Web requests now use a dedicated undici agent with a 4 MiB header budget. Thanks José Antonio Galiano Sandoval (`@jagaliano`) for PR #230.
37
+ - Preserve collapsed `web_search` result background padding. Thanks `@SheffeyG` for PR #224.
38
+
39
+ ## [0.19.0] - 2026-08-08
40
+
41
+ ### Added
42
+ - Added Jina Search as a normal configured `web_search` provider with `jinaApiKey` / `JINA_API_KEY`, explicit/auto/routing/all-provider support, domain and recency constraints, optional inline page content, and Curator integration. Thanks Orbio Agent (`@Gabrielgvl`) for PR #214.
43
+
44
+ ### Fixed
45
+ - Added a tracked npm lockfile for reproducible contributor installs, and updated model-registry auth header typing for current Pi peer packages. Thanks `@dougEfresh` for PR #218.
46
+ - Keep manual `/websearch` curator pages in sync if the live SSE stream disconnects or misses events while searches are still running. Thanks `@Whisperfall` for issue #215.
47
+ - Updated Kagi Search and Extract requests for the current v1 API contracts. Thanks `@mattgaff` for PR #217.
48
+ - Recognize `:max` thinking suffixes when matching scoped summary models. Thanks `@justin8ty` for PR #219.
49
+ - Route local video Gemini upload, polling, and deletion requests through configured `geminiBaseUrl` / `GOOGLE_GEMINI_BASE_URL` relays. Thanks Mr. (`@Liemo99`) for PR #213.
50
+ - Classify xAI `403` spending-limit and quota-exhaustion responses as quota errors so configured search routing can fall back, while preserving ordinary `403` responses as authentication errors. Thanks `@0xmarcinz` for PR #212.
51
+
7
52
  ## [0.18.0] - 2026-08-03
8
53
 
9
54
  ### Added