@herbertgao/pi-extensions 2026.8.1 → 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 (403) hide show
  1. package/README.md +13 -3
  2. package/node_modules/@czottmann/pi-automode/README.md +16 -2
  3. package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +35 -0
  4. package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +18 -9
  5. package/node_modules/@czottmann/pi-automode/docs/defaults.md +6 -2
  6. package/node_modules/@czottmann/pi-automode/examples/automode.local.json +6 -0
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +11 -7
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +100 -0
  9. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +32 -0
  10. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +78 -3
  11. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +16 -4
  12. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/paths.ts +23 -1
  13. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/permissions.ts +22 -1
  14. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/types.ts +18 -2
  15. package/node_modules/@czottmann/pi-automode/package.json +4 -4
  16. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +5 -0
  17. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +5 -0
  18. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +5 -0
  19. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-help.md +5 -0
  20. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +5 -0
  21. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +5 -0
  22. package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail-frontmatter.cjs +23 -0
  23. package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +99 -0
  24. package/node_modules/@dietrichgebert/ponytail/.qoder/rules/ponytail.md +30 -0
  25. package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +16 -0
  26. package/node_modules/@dietrichgebert/ponytail/AGENTS.md +32 -0
  27. package/node_modules/@dietrichgebert/ponytail/LICENSE +21 -0
  28. package/node_modules/@dietrichgebert/ponytail/README.es.md +298 -0
  29. package/node_modules/@dietrichgebert/ponytail/README.ko.md +315 -0
  30. package/node_modules/@dietrichgebert/ponytail/README.md +351 -0
  31. package/node_modules/@dietrichgebert/ponytail/assets/benchmark-3model.svg +21 -0
  32. package/node_modules/@dietrichgebert/ponytail/assets/benchmark-agentic.svg +62 -0
  33. package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.png +0 -0
  34. package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.svg +115 -0
  35. package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt-dark.svg +27 -0
  36. package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt.svg +27 -0
  37. package/node_modules/@dietrichgebert/ponytail/assets/logo.png +0 -0
  38. package/node_modules/@dietrichgebert/ponytail/assets/social-preview.png +0 -0
  39. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-es.png +0 -0
  40. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-ko.png +0 -0
  41. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner.png +0 -0
  42. package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +44 -0
  43. package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +21 -0
  44. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +96 -0
  45. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +169 -0
  46. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-instructions.js +98 -0
  47. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-mode-tracker.js +130 -0
  48. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +85 -0
  49. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.ps1 +24 -0
  50. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.sh +18 -0
  51. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-subagent.js +77 -0
  52. package/node_modules/@dietrichgebert/ponytail/hooks/qoder-hooks.json +26 -0
  53. package/node_modules/@dietrichgebert/ponytail/package.json +47 -0
  54. package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +211 -0
  55. package/node_modules/@dietrichgebert/ponytail/pi-extension/package.json +8 -0
  56. package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +60 -0
  57. package/node_modules/@dietrichgebert/ponytail/skills/ponytail/SKILL.md +120 -0
  58. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +41 -0
  59. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +44 -0
  60. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +50 -0
  61. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +71 -0
  62. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +57 -0
  63. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +6 -10
  64. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -9
  65. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +101 -0
  66. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -17
  67. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +15 -9
  68. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{utils/agent-summary.ts → feature/agent-summary/core.ts} +37 -35
  69. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-summary.ts → agent-summary/index.ts} +3 -3
  70. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +24 -83
  71. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +1 -1
  72. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference.ts → reference/index.ts} +1 -1
  73. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-autocomplete.ts → reference/subagent.ts} +19 -9
  74. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-startup-header.ts → shell/startup-header.ts} +1 -1
  75. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{working-message.ts → shell/working-message.ts} +5 -2
  76. package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -28
  77. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +452 -94
  78. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +727 -0
  79. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +66 -776
  80. package/node_modules/@herbertgao/pi-cc-extensions/extensions/{feature → renderer}/markdown-enhance.ts +134 -11
  81. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +130 -0
  82. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-interaction.ts → mouse/interaction.ts} +90 -568
  83. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +144 -0
  84. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +143 -0
  85. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +195 -0
  86. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ansi-utils.ts +56 -1
  87. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-renderer.ts +4 -4
  88. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/line-width-safety.ts +1 -1
  89. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +12 -0
  90. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/write-execution.ts +1 -2
  91. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-grouping.ts → tool/grouping.ts} +27 -10
  92. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-result.ts → tool/result.ts} +4 -13
  93. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +91 -0
  94. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +0 -27
  95. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  96. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +1 -0
  97. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +2 -2
  98. package/node_modules/@herbertgao/pi-stash/README.md +9 -9
  99. package/node_modules/@herbertgao/pi-stash/package.json +1 -1
  100. package/node_modules/@herbertgao/pi-stash/src/index.ts +2 -1
  101. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +20 -0
  102. package/node_modules/@herbertgao/pi-subagents/README.md +6 -2
  103. package/node_modules/@herbertgao/pi-subagents/package.json +3 -3
  104. package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +1 -0
  105. package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +3 -1
  106. package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +85 -11
  107. package/node_modules/@herbertgao/pi-subagents/src/index.ts +61 -39
  108. package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +26 -35
  109. package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +15 -1
  110. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +12 -0
  111. package/node_modules/@herbertgao/pi-subagents/src/types.ts +2 -0
  112. package/node_modules/@narumitw/pi-btw/LICENSE +21 -0
  113. package/node_modules/@narumitw/pi-btw/README.md +210 -0
  114. package/node_modules/@narumitw/pi-btw/package.json +53 -0
  115. package/node_modules/@narumitw/pi-btw/src/bring-to-main.ts +632 -0
  116. package/node_modules/@narumitw/pi-btw/src/btw.ts +996 -0
  117. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +339 -0
  118. package/node_modules/@narumitw/pi-btw/src/index.ts +1 -0
  119. package/node_modules/@narumitw/pi-btw/src/menu.ts +296 -0
  120. package/node_modules/@narumitw/pi-btw/src/settings.ts +237 -0
  121. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +238 -0
  122. package/node_modules/@narumitw/pi-btw/src/text.ts +10 -0
  123. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +620 -0
  124. package/node_modules/@pi-plugins/fast-mode/LICENSE +21 -0
  125. package/node_modules/@pi-plugins/fast-mode/README.md +92 -0
  126. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts +6 -0
  127. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -0
  128. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +2026 -0
  129. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -0
  130. package/node_modules/@pi-plugins/fast-mode/package.json +73 -0
  131. package/node_modules/pi-mcp-adapter/CHANGELOG.md +78 -0
  132. package/node_modules/pi-mcp-adapter/README.md +80 -16
  133. package/node_modules/pi-mcp-adapter/agent-dir.ts +40 -0
  134. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +377 -0
  135. package/node_modules/pi-mcp-adapter/commands.ts +21 -9
  136. package/node_modules/pi-mcp-adapter/config.ts +110 -49
  137. package/node_modules/pi-mcp-adapter/direct-tools.ts +40 -27
  138. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +37 -36
  139. package/node_modules/pi-mcp-adapter/errors.ts +21 -17
  140. package/node_modules/pi-mcp-adapter/host-html-template.ts +13 -7
  141. package/node_modules/pi-mcp-adapter/index.ts +52 -17
  142. package/node_modules/pi-mcp-adapter/init.ts +9 -7
  143. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +2 -2
  144. package/node_modules/pi-mcp-adapter/lifecycle.ts +8 -8
  145. package/node_modules/pi-mcp-adapter/logger.ts +1 -1
  146. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +122 -25
  147. package/node_modules/pi-mcp-adapter/mcp-auth.ts +120 -2
  148. package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +138 -61
  149. package/node_modules/pi-mcp-adapter/mcp-code.ts +13 -11
  150. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +62 -17
  151. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +15 -11
  152. package/node_modules/pi-mcp-adapter/mcp-panel.ts +34 -15
  153. package/node_modules/pi-mcp-adapter/mcp-probe.ts +131 -34
  154. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +2 -2
  155. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +7 -4
  156. package/node_modules/pi-mcp-adapter/mcp-trace.ts +59 -64
  157. package/node_modules/pi-mcp-adapter/metadata-cache.ts +34 -26
  158. package/node_modules/pi-mcp-adapter/npx-resolver.ts +6 -4
  159. package/node_modules/pi-mcp-adapter/oauth-handler.ts +1 -1
  160. package/node_modules/pi-mcp-adapter/oauth.ts +48 -0
  161. package/node_modules/pi-mcp-adapter/onboarding-state.ts +19 -11
  162. package/node_modules/pi-mcp-adapter/package.json +20 -9
  163. package/node_modules/pi-mcp-adapter/panel-keys.ts +20 -4
  164. package/node_modules/pi-mcp-adapter/prompts.ts +2 -2
  165. package/node_modules/pi-mcp-adapter/proxy-modes.ts +56 -21
  166. package/node_modules/pi-mcp-adapter/sampling-handler.ts +22 -15
  167. package/node_modules/pi-mcp-adapter/search-ranking.ts +2 -1
  168. package/node_modules/pi-mcp-adapter/server-manager.ts +165 -113
  169. package/node_modules/pi-mcp-adapter/session-recovery.ts +11 -12
  170. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +3 -3
  171. package/node_modules/pi-mcp-adapter/state.ts +3 -1
  172. package/node_modules/pi-mcp-adapter/tool-approval.ts +67 -4
  173. package/node_modules/pi-mcp-adapter/tool-metadata.ts +6 -5
  174. package/node_modules/pi-mcp-adapter/tool-registrar.ts +187 -3
  175. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +14 -2
  176. package/node_modules/pi-mcp-adapter/ts-shape.ts +9 -2
  177. package/node_modules/pi-mcp-adapter/types.ts +111 -22
  178. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +40 -0
  179. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +28 -19
  180. package/node_modules/pi-mcp-adapter/ui-server.ts +90 -58
  181. package/node_modules/pi-mcp-adapter/ui-session.ts +16 -14
  182. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +4 -4
  183. package/node_modules/pi-mcp-adapter/utils.ts +23 -9
  184. package/node_modules/pi-web-access/CHANGELOG.md +45 -0
  185. package/node_modules/pi-web-access/README.md +104 -29
  186. package/node_modules/pi-web-access/bocha.ts +221 -0
  187. package/node_modules/pi-web-access/curator-page.ts +113 -12
  188. package/node_modules/pi-web-access/curator-server.ts +56 -20
  189. package/node_modules/pi-web-access/datalab-pdf-extract.ts +568 -0
  190. package/node_modules/pi-web-access/duckduckgo.ts +123 -0
  191. package/node_modules/pi-web-access/extract.ts +288 -143
  192. package/node_modules/pi-web-access/feature-config.ts +29 -0
  193. package/node_modules/pi-web-access/gemini-api.ts +4 -0
  194. package/node_modules/pi-web-access/gemini-search.ts +45 -12
  195. package/node_modules/pi-web-access/gemini-web.ts +68 -3
  196. package/node_modules/pi-web-access/index.ts +160 -71
  197. package/node_modules/pi-web-access/jina-search.ts +284 -0
  198. package/node_modules/pi-web-access/kagi.ts +12 -12
  199. package/node_modules/pi-web-access/openai-search.ts +12 -2
  200. package/node_modules/pi-web-access/package.json +4 -3
  201. package/node_modules/pi-web-access/pdf-extract.ts +327 -228
  202. package/node_modules/pi-web-access/storage.ts +440 -2
  203. package/node_modules/pi-web-access/summary-model-scope.ts +1 -1
  204. package/node_modules/pi-web-access/summary-review.ts +4 -2
  205. package/node_modules/pi-web-access/video-extract.ts +10 -8
  206. package/node_modules/pi-web-access/xai-search.ts +12 -2
  207. package/node_modules/pi-web-access/youtube-extract.ts +2 -1
  208. package/node_modules/remote-pi/LICENSE +21 -0
  209. package/node_modules/remote-pi/README.md +675 -0
  210. package/node_modules/remote-pi/dist/actions/handlers.d.ts +122 -0
  211. package/node_modules/remote-pi/dist/actions/handlers.js +160 -0
  212. package/node_modules/remote-pi/dist/actions/handlers.js.map +1 -0
  213. package/node_modules/remote-pi/dist/actions/registry.d.ts +39 -0
  214. package/node_modules/remote-pi/dist/actions/registry.js +58 -0
  215. package/node_modules/remote-pi/dist/actions/registry.js.map +1 -0
  216. package/node_modules/remote-pi/dist/bin/supervisord.d.ts +2 -0
  217. package/node_modules/remote-pi/dist/bin/supervisord.js +86 -0
  218. package/node_modules/remote-pi/dist/bin/supervisord.js.map +1 -0
  219. package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +58 -0
  220. package/node_modules/remote-pi/dist/commands/builtin_mirror.js +71 -0
  221. package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +1 -0
  222. package/node_modules/remote-pi/dist/commands/list_commands.d.ts +60 -0
  223. package/node_modules/remote-pi/dist/commands/list_commands.js +73 -0
  224. package/node_modules/remote-pi/dist/commands/list_commands.js.map +1 -0
  225. package/node_modules/remote-pi/dist/config.d.ts +62 -0
  226. package/node_modules/remote-pi/dist/config.js +115 -0
  227. package/node_modules/remote-pi/dist/config.js.map +1 -0
  228. package/node_modules/remote-pi/dist/daemon/client.d.ts +20 -0
  229. package/node_modules/remote-pi/dist/daemon/client.js +131 -0
  230. package/node_modules/remote-pi/dist/daemon/client.js.map +1 -0
  231. package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +176 -0
  232. package/node_modules/remote-pi/dist/daemon/control_protocol.js +63 -0
  233. package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +1 -0
  234. package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +45 -0
  235. package/node_modules/remote-pi/dist/daemon/cron_log.js +72 -0
  236. package/node_modules/remote-pi/dist/daemon/cron_log.js.map +1 -0
  237. package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +80 -0
  238. package/node_modules/remote-pi/dist/daemon/cron_registry.js +194 -0
  239. package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +1 -0
  240. package/node_modules/remote-pi/dist/daemon/id.d.ts +24 -0
  241. package/node_modules/remote-pi/dist/daemon/id.js +36 -0
  242. package/node_modules/remote-pi/dist/daemon/id.js.map +1 -0
  243. package/node_modules/remote-pi/dist/daemon/install.d.ts +170 -0
  244. package/node_modules/remote-pi/dist/daemon/install.js +547 -0
  245. package/node_modules/remote-pi/dist/daemon/install.js.map +1 -0
  246. package/node_modules/remote-pi/dist/daemon/registry.d.ts +63 -0
  247. package/node_modules/remote-pi/dist/daemon/registry.js +153 -0
  248. package/node_modules/remote-pi/dist/daemon/registry.js.map +1 -0
  249. package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +194 -0
  250. package/node_modules/remote-pi/dist/daemon/rpc_child.js +389 -0
  251. package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +1 -0
  252. package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +93 -0
  253. package/node_modules/remote-pi/dist/daemon/supervisor.js +596 -0
  254. package/node_modules/remote-pi/dist/daemon/supervisor.js.map +1 -0
  255. package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +26 -0
  256. package/node_modules/remote-pi/dist/extension_ui_bridge.js +341 -0
  257. package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +1 -0
  258. package/node_modules/remote-pi/dist/index.d.ts +213 -0
  259. package/node_modules/remote-pi/dist/index.js +4996 -0
  260. package/node_modules/remote-pi/dist/index.js.map +1 -0
  261. package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +10 -0
  262. package/node_modules/remote-pi/dist/mcp/mesh_result.js +42 -0
  263. package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +1 -0
  264. package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +16 -0
  265. package/node_modules/remote-pi/dist/mcp/mesh_server.js +327 -0
  266. package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +1 -0
  267. package/node_modules/remote-pi/dist/mesh/canonical.d.ts +30 -0
  268. package/node_modules/remote-pi/dist/mesh/canonical.js +61 -0
  269. package/node_modules/remote-pi/dist/mesh/canonical.js.map +1 -0
  270. package/node_modules/remote-pi/dist/mesh/client.d.ts +18 -0
  271. package/node_modules/remote-pi/dist/mesh/client.js +125 -0
  272. package/node_modules/remote-pi/dist/mesh/client.js.map +1 -0
  273. package/node_modules/remote-pi/dist/mesh/encoding.d.ts +38 -0
  274. package/node_modules/remote-pi/dist/mesh/encoding.js +216 -0
  275. package/node_modules/remote-pi/dist/mesh/encoding.js.map +1 -0
  276. package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +73 -0
  277. package/node_modules/remote-pi/dist/mesh/self_revoke.js +401 -0
  278. package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +1 -0
  279. package/node_modules/remote-pi/dist/mesh/siblings.d.ts +49 -0
  280. package/node_modules/remote-pi/dist/mesh/siblings.js +159 -0
  281. package/node_modules/remote-pi/dist/mesh/siblings.js.map +1 -0
  282. package/node_modules/remote-pi/dist/mesh/types.d.ts +34 -0
  283. package/node_modules/remote-pi/dist/mesh/types.js +11 -0
  284. package/node_modules/remote-pi/dist/mesh/types.js.map +1 -0
  285. package/node_modules/remote-pi/dist/mesh/verify.d.ts +17 -0
  286. package/node_modules/remote-pi/dist/mesh/verify.js +86 -0
  287. package/node_modules/remote-pi/dist/mesh/verify.js.map +1 -0
  288. package/node_modules/remote-pi/dist/pairing/crypto.d.ts +8 -0
  289. package/node_modules/remote-pi/dist/pairing/crypto.js +22 -0
  290. package/node_modules/remote-pi/dist/pairing/crypto.js.map +1 -0
  291. package/node_modules/remote-pi/dist/pairing/handshake.d.ts +28 -0
  292. package/node_modules/remote-pi/dist/pairing/handshake.js +113 -0
  293. package/node_modules/remote-pi/dist/pairing/handshake.js.map +1 -0
  294. package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +16 -0
  295. package/node_modules/remote-pi/dist/pairing/noise-sha256.js +103 -0
  296. package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +1 -0
  297. package/node_modules/remote-pi/dist/pairing/qr.d.ts +59 -0
  298. package/node_modules/remote-pi/dist/pairing/qr.js +125 -0
  299. package/node_modules/remote-pi/dist/pairing/qr.js.map +1 -0
  300. package/node_modules/remote-pi/dist/pairing/storage.d.ts +120 -0
  301. package/node_modules/remote-pi/dist/pairing/storage.js +604 -0
  302. package/node_modules/remote-pi/dist/pairing/storage.js.map +1 -0
  303. package/node_modules/remote-pi/dist/protocol/codec.d.ts +7 -0
  304. package/node_modules/remote-pi/dist/protocol/codec.js +49 -0
  305. package/node_modules/remote-pi/dist/protocol/codec.js.map +1 -0
  306. package/node_modules/remote-pi/dist/protocol/types.d.ts +393 -0
  307. package/node_modules/remote-pi/dist/protocol/types.js +2 -0
  308. package/node_modules/remote-pi/dist/protocol/types.js.map +1 -0
  309. package/node_modules/remote-pi/dist/rooms.d.ts +29 -0
  310. package/node_modules/remote-pi/dist/rooms.js +57 -0
  311. package/node_modules/remote-pi/dist/rooms.js.map +1 -0
  312. package/node_modules/remote-pi/dist/session/address.d.ts +49 -0
  313. package/node_modules/remote-pi/dist/session/address.js +58 -0
  314. package/node_modules/remote-pi/dist/session/address.js.map +1 -0
  315. package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +55 -0
  316. package/node_modules/remote-pi/dist/session/agent_bridge.js +146 -0
  317. package/node_modules/remote-pi/dist/session/agent_bridge.js.map +1 -0
  318. package/node_modules/remote-pi/dist/session/bridge.d.ts +37 -0
  319. package/node_modules/remote-pi/dist/session/bridge.js +130 -0
  320. package/node_modules/remote-pi/dist/session/bridge.js.map +1 -0
  321. package/node_modules/remote-pi/dist/session/broker.d.ts +189 -0
  322. package/node_modules/remote-pi/dist/session/broker.js +507 -0
  323. package/node_modules/remote-pi/dist/session/broker.js.map +1 -0
  324. package/node_modules/remote-pi/dist/session/broker_remote.d.ts +74 -0
  325. package/node_modules/remote-pi/dist/session/broker_remote.js +583 -0
  326. package/node_modules/remote-pi/dist/session/broker_remote.js.map +1 -0
  327. package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +33 -0
  328. package/node_modules/remote-pi/dist/session/cwd_lock.js +126 -0
  329. package/node_modules/remote-pi/dist/session/cwd_lock.js.map +1 -0
  330. package/node_modules/remote-pi/dist/session/envelope.d.ts +33 -0
  331. package/node_modules/remote-pi/dist/session/envelope.js +117 -0
  332. package/node_modules/remote-pi/dist/session/envelope.js.map +1 -0
  333. package/node_modules/remote-pi/dist/session/global_config.d.ts +33 -0
  334. package/node_modules/remote-pi/dist/session/global_config.js +73 -0
  335. package/node_modules/remote-pi/dist/session/global_config.js.map +1 -0
  336. package/node_modules/remote-pi/dist/session/ipc.d.ts +27 -0
  337. package/node_modules/remote-pi/dist/session/ipc.js +22 -0
  338. package/node_modules/remote-pi/dist/session/ipc.js.map +1 -0
  339. package/node_modules/remote-pi/dist/session/leader_election.d.ts +32 -0
  340. package/node_modules/remote-pi/dist/session/leader_election.js +106 -0
  341. package/node_modules/remote-pi/dist/session/leader_election.js.map +1 -0
  342. package/node_modules/remote-pi/dist/session/local_config.d.ts +55 -0
  343. package/node_modules/remote-pi/dist/session/local_config.js +157 -0
  344. package/node_modules/remote-pi/dist/session/local_config.js.map +1 -0
  345. package/node_modules/remote-pi/dist/session/mesh_message.d.ts +20 -0
  346. package/node_modules/remote-pi/dist/session/mesh_message.js +28 -0
  347. package/node_modules/remote-pi/dist/session/mesh_message.js.map +1 -0
  348. package/node_modules/remote-pi/dist/session/mesh_node.d.ts +116 -0
  349. package/node_modules/remote-pi/dist/session/mesh_node.js +573 -0
  350. package/node_modules/remote-pi/dist/session/mesh_node.js.map +1 -0
  351. package/node_modules/remote-pi/dist/session/peer.d.ts +139 -0
  352. package/node_modules/remote-pi/dist/session/peer.js +451 -0
  353. package/node_modules/remote-pi/dist/session/peer.js.map +1 -0
  354. package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +13 -0
  355. package/node_modules/remote-pi/dist/session/peer_inventory.js +48 -0
  356. package/node_modules/remote-pi/dist/session/peer_inventory.js.map +1 -0
  357. package/node_modules/remote-pi/dist/session/peer_limits.d.ts +9 -0
  358. package/node_modules/remote-pi/dist/session/peer_limits.js +21 -0
  359. package/node_modules/remote-pi/dist/session/peer_limits.js.map +1 -0
  360. package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +39 -0
  361. package/node_modules/remote-pi/dist/session/setup_wizard.js +63 -0
  362. package/node_modules/remote-pi/dist/session/setup_wizard.js.map +1 -0
  363. package/node_modules/remote-pi/dist/session/tool_gate.d.ts +5 -0
  364. package/node_modules/remote-pi/dist/session/tool_gate.js +11 -0
  365. package/node_modules/remote-pi/dist/session/tool_gate.js.map +1 -0
  366. package/node_modules/remote-pi/dist/session/tools.d.ts +24 -0
  367. package/node_modules/remote-pi/dist/session/tools.js +252 -0
  368. package/node_modules/remote-pi/dist/session/tools.js.map +1 -0
  369. package/node_modules/remote-pi/dist/session/wizard.d.ts +13 -0
  370. package/node_modules/remote-pi/dist/session/wizard.js +20 -0
  371. package/node_modules/remote-pi/dist/session/wizard.js.map +1 -0
  372. package/node_modules/remote-pi/dist/settings.d.ts +15 -0
  373. package/node_modules/remote-pi/dist/settings.js +52 -0
  374. package/node_modules/remote-pi/dist/settings.js.map +1 -0
  375. package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +37 -0
  376. package/node_modules/remote-pi/dist/transport/peer_channel.js +98 -0
  377. package/node_modules/remote-pi/dist/transport/peer_channel.js.map +1 -0
  378. package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +29 -0
  379. package/node_modules/remote-pi/dist/transport/pi_forward_client.js +62 -0
  380. package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +1 -0
  381. package/node_modules/remote-pi/dist/transport/relay_client.d.ts +91 -0
  382. package/node_modules/remote-pi/dist/transport/relay_client.js +206 -0
  383. package/node_modules/remote-pi/dist/transport/relay_client.js.map +1 -0
  384. package/node_modules/remote-pi/dist/ui/footer.d.ts +32 -0
  385. package/node_modules/remote-pi/dist/ui/footer.js +34 -0
  386. package/node_modules/remote-pi/dist/ui/footer.js.map +1 -0
  387. package/node_modules/remote-pi/docs/daemon.md +289 -0
  388. package/node_modules/remote-pi/package.json +88 -0
  389. package/node_modules/remote-pi/service-templates/launchd.plist.template +35 -0
  390. package/node_modules/remote-pi/service-templates/systemd.service.template +19 -0
  391. package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +10 -0
  392. package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +38 -0
  393. package/node_modules/remote-pi/skills/agent-network/SKILL.md +310 -0
  394. package/package.json +37 -12
  395. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/write-display-utils.ts +0 -29
  396. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference-core.ts → reference/session.ts} +0 -0
  397. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-aliases.ts → shell/aliases.ts} +0 -0
  398. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ATTRIBUTION.md +0 -0
  399. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-presentation.ts +0 -0
  400. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/index.ts +0 -0
  401. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/render-utils.ts +0 -0
  402. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/shiki-highlight.ts +0 -0
  403. /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/types.ts +0 -0
@@ -83,6 +83,7 @@ import { SubagentScheduler } from "./schedule.js"
83
83
  import { resolveStorePath, ScheduleStore } from "./schedule-store.js"
84
84
  import {
85
85
  applyAndEmitLoaded,
86
+ loadSettings,
86
87
  type SubagentsSettings,
87
88
  saveAndEmitChanged,
88
89
  type ToolDescriptionMode,
@@ -426,14 +427,18 @@ export default function (pi: ExtensionAPI) {
426
427
  },
427
428
  )
428
429
 
430
+ // This setting controls the initial load, which runs before the normal settings
431
+ // application below. Later per-call reloads deliberately remain tolerant.
432
+ let strictAgentFiles = loadSettings(process.cwd()).strictAgentFiles === true
433
+
429
434
  /** Reload agents from project/global custom agent dirs and merge with defaults (called on init and each Agent invocation). */
430
- const reloadCustomAgents = () => {
431
- const userAgents = loadCustomAgents(process.cwd())
435
+ const reloadCustomAgents = (strict = false) => {
436
+ const userAgents = loadCustomAgents(process.cwd(), strict)
432
437
  registerAgents(userAgents)
433
438
  }
434
439
 
435
- // Initial load
436
- reloadCustomAgents()
440
+ // Initial load — the only strict one.
441
+ reloadCustomAgents(strictAgentFiles)
437
442
 
438
443
  // ---- Agent activity tracking + widget ----
439
444
  const agentActivity = new Map<string, AgentActivity>()
@@ -990,6 +995,9 @@ export default function (pi: ExtensionAPI) {
990
995
  setDefaultJoinMode,
991
996
  setSchedulingEnabled,
992
997
  setScopeModels: setScopeModelsEnabled,
998
+ setStrictAgentFiles: (enabled) => {
999
+ strictAgentFiles = enabled
1000
+ },
993
1001
  setDisableDefaultAgents: setDisableDefaultAgents,
994
1002
  setToolDescriptionMode: setToolDescriptionMode,
995
1003
  setFleetView: setFleetViewEnabled,
@@ -1233,12 +1241,12 @@ Terse command-style prompts produce shallow, generic work.
1233
1241
  )
1234
1242
  },
1235
1243
 
1236
- renderResult(result, { expanded, isPartial }, theme) {
1244
+ renderResult(result, { expanded, isPartial }, theme, renderContext) {
1245
+ const resultText =
1246
+ result.content[0]?.type === "text" ? result.content[0].text : ""
1237
1247
  const details = result.details as AgentDetails | undefined
1238
- if (!details) {
1239
- const text =
1240
- result.content[0]?.type === "text" ? result.content[0].text : ""
1241
- return new Text(text, 0, 0)
1248
+ if (renderContext?.isError || !details?.status) {
1249
+ return new Text(resultText, 0, 0)
1242
1250
  }
1243
1251
 
1244
1252
  // Helper: build "haiku · thinking: high · ↻5≤30 · 3 tool uses · 33.8k tokens" stats string
@@ -1293,8 +1301,6 @@ Terse command-style prompts produce shallow, generic work.
1293
1301
  line += " " + theme.fg("dim", "·") + " " + theme.fg("dim", duration)
1294
1302
 
1295
1303
  if (expanded) {
1296
- const resultText =
1297
- result.content[0]?.type === "text" ? result.content[0].text : ""
1298
1304
  if (resultText) {
1299
1305
  const lines = resultText.split("\n").slice(0, 50)
1300
1306
  for (const l of lines) {
@@ -1324,6 +1330,10 @@ Terse command-style prompts produce shallow, generic work.
1324
1330
  return new Text(line, 0, 0)
1325
1331
  }
1326
1332
 
1333
+ if (details.status !== "error" && details.status !== "aborted") {
1334
+ return new Text(resultText, 0, 0)
1335
+ }
1336
+
1327
1337
  // ---- Error / Aborted (hard max_turns) ----
1328
1338
  const s = stats(details)
1329
1339
  let line = theme.fg("error", "✗") + (s ? " " + s : "")
@@ -1590,23 +1600,22 @@ Terse command-style prompts produce shallow, generic work.
1590
1600
  }
1591
1601
  }
1592
1602
 
1593
- try {
1594
- id = manager.spawn(pi, ctx, subagentType, params.prompt, {
1595
- description: params.description,
1596
- model,
1597
- maxTurns: effectiveMaxTurns,
1598
- isolated,
1599
- inheritContext,
1600
- thinkingLevel: thinking,
1601
- isBackground: true,
1602
- isolation,
1603
- invocation: agentInvocation,
1604
- rootSessionId: ctx.sessionManager.getSessionId(),
1605
- ...bgCallbacks,
1606
- })
1607
- } catch (err) {
1608
- return textResult(err instanceof Error ? err.message : String(err))
1609
- }
1603
+ // A throw here means the agent never started. Let it out: Pi marks a
1604
+ // tool call failed only when execute throws, while a returned message
1605
+ // reads to the model as a subagent that ran and reported this.
1606
+ id = manager.spawn(pi, ctx, subagentType, params.prompt, {
1607
+ description: params.description,
1608
+ model,
1609
+ maxTurns: effectiveMaxTurns,
1610
+ isolated,
1611
+ inheritContext,
1612
+ thinkingLevel: thinking,
1613
+ isBackground: true,
1614
+ isolation,
1615
+ invocation: agentInvocation,
1616
+ rootSessionId: ctx.sessionManager.getSessionId(),
1617
+ ...bgCallbacks,
1618
+ })
1610
1619
 
1611
1620
  // Set output file + join mode synchronously after spawn, before the
1612
1621
  // event loop yields — onSessionCreated is async so this is safe.
@@ -1766,18 +1775,15 @@ Terse command-style prompts produce shallow, generic work.
1766
1775
  },
1767
1776
  )
1768
1777
  record = fgResult.record
1769
- } catch (err) {
1778
+ } finally {
1779
+ // A startup throw propagates as a failed tool call without leaving
1780
+ // the spinner running or a finished agent in the widget.
1770
1781
  clearInterval(spinnerInterval)
1771
- return textResult(err instanceof Error ? err.message : String(err))
1772
- }
1773
-
1774
- clearInterval(spinnerInterval)
1775
-
1776
- // Clean up foreground agent from widget
1777
- if (fgId) {
1778
- agentActivity.delete(fgId)
1779
- widget.markFinished(fgId)
1780
- fleet.onAgentFinished(fgId)
1782
+ if (fgId) {
1783
+ agentActivity.delete(fgId)
1784
+ widget.markFinished(fgId)
1785
+ fleet.onAgentFinished(fgId)
1786
+ }
1781
1787
  }
1782
1788
 
1783
1789
  // Get final token count
@@ -2673,6 +2679,7 @@ ${systemPrompt}
2673
2679
  defaultJoinMode: getDefaultJoinMode(),
2674
2680
  schedulingEnabled: isSchedulingEnabled(),
2675
2681
  scopeModels: isScopeModelsEnabled(),
2682
+ strictAgentFiles,
2676
2683
  disableDefaultAgents: isDefaultsDisabled(),
2677
2684
  toolDescriptionMode: getToolDescriptionMode(),
2678
2685
  fleetView: isFleetViewEnabled(),
@@ -2762,6 +2769,14 @@ ${systemPrompt}
2762
2769
  currentValue: isScopeModelsEnabled() ? "on" : "off",
2763
2770
  values: ["on", "off"],
2764
2771
  },
2772
+ {
2773
+ id: "strictAgentFiles",
2774
+ label: "Strict agent files",
2775
+ description:
2776
+ "Fail startup on an unreadable or unparseable agent .md instead of skipping it with a warning",
2777
+ currentValue: strictAgentFiles ? "on" : "off",
2778
+ values: ["on", "off"],
2779
+ },
2765
2780
  {
2766
2781
  id: "disableDefaultAgents",
2767
2782
  label: "Disable defaults",
@@ -2867,6 +2882,13 @@ ${systemPrompt}
2867
2882
  const enabled = value === "on"
2868
2883
  setScopeModelsEnabled(enabled)
2869
2884
  notifyApplied(ctx, `Scope models ${enabled ? "enabled" : "disabled"}`)
2885
+ } else if (id === "strictAgentFiles") {
2886
+ const enabled = value === "on"
2887
+ strictAgentFiles = enabled
2888
+ notifyApplied(
2889
+ ctx,
2890
+ `Strict agent files ${enabled ? "enabled" : "disabled"}. Takes effect on next pi session.`,
2891
+ )
2870
2892
  } else if (id === "disableDefaultAgents") {
2871
2893
  const enabled = value === "on"
2872
2894
  setDisableDefaultAgents(enabled)
@@ -399,47 +399,38 @@ export function createNestedSubagentTools(
399
399
  // one earlier would silently give a grandchild the wrong worktree base, the
400
400
  // wrong conversation under inherit_context, and the wrong inherited model.
401
401
  //
402
- // spawn() throws on strict worktree-isolation failure and cwd validation —
403
- // report it as a tool error, like the top-level Agent tool does, instead of
404
- // letting it escape into the child's turn.
405
- try {
406
- if (invocation.runInBackground) {
407
- const id = context.manager.spawn(
408
- context.pi,
409
- ctx,
410
- resolvedType,
411
- params.prompt,
412
- {
413
- ...options,
414
- isBackground: true,
415
- },
416
- )
417
- // Synchronous, before the event loop yields — onSessionCreated fires
418
- // asynchronously inside runAgent, so the file is attached in time.
419
- attachTranscript(id)
420
- return textResult(
421
- `Nested agent started in background. Agent ID: ${id}`,
422
- )
423
- }
424
-
425
- const { record } = await context.manager.spawnAndWait(
402
+ // Startup throws mean no child ran. Let them propagate so Pi marks the
403
+ // nested Agent tool call failed instead of presenting the message as a
404
+ // successful child result.
405
+ if (invocation.runInBackground) {
406
+ const id = context.manager.spawn(
426
407
  context.pi,
427
408
  ctx,
428
409
  resolvedType,
429
410
  params.prompt,
430
- { ...options, signal },
431
- attachTranscript,
432
- )
433
- return textResult(
434
- formatRecord(record, "inline"),
435
- record.status === "error",
436
- )
437
- } catch (err) {
438
- return textResult(
439
- err instanceof Error ? err.message : String(err),
440
- true,
411
+ {
412
+ ...options,
413
+ isBackground: true,
414
+ },
441
415
  )
416
+ // Synchronous, before the event loop yields — onSessionCreated fires
417
+ // asynchronously inside runAgent, so the file is attached in time.
418
+ attachTranscript(id)
419
+ return textResult(`Nested agent started in background. Agent ID: ${id}`)
442
420
  }
421
+
422
+ const { record } = await context.manager.spawnAndWait(
423
+ context.pi,
424
+ ctx,
425
+ resolvedType,
426
+ params.prompt,
427
+ { ...options, signal },
428
+ attachTranscript,
429
+ )
430
+ return textResult(
431
+ formatRecord(record, "inline"),
432
+ record.status === "error",
433
+ )
443
434
  },
444
435
  })
445
436
 
@@ -10,6 +10,8 @@ export interface PromptExtras {
10
10
  memoryBlock?: string
11
11
  /** Preloaded skill contents to inject. */
12
12
  skillBlocks?: { name: string; content: string }[]
13
+ /** Original checkout path when cwd is an isolated worktree copy. */
14
+ worktreeBase?: string
13
15
  }
14
16
 
15
17
  /**
@@ -55,6 +57,12 @@ Platform: ${env.platform}`
55
57
  }
56
58
  const extrasSuffix =
57
59
  extraSections.length > 0 ? "\n\n" + extraSections.join("\n") : ""
60
+ const worktreeSection = extras?.worktreeBase
61
+ ? `\n\n<worktree_isolation>
62
+ Your working directory is an isolated git worktree copy of ${extras.worktreeBase}.
63
+ Work only inside it — never in ${extras.worktreeBase}, even if other instructions name that path as your working directory.
64
+ </worktree_isolation>`
65
+ : ""
58
66
 
59
67
  if (config.promptMode === "append") {
60
68
  const identity = parentSystemPrompt || genericBase
@@ -88,6 +96,7 @@ You are operating as a sub-agent invoked to handle a specific task.
88
96
  "\n\n" +
89
97
  activeAgentTag +
90
98
  envBlock +
99
+ worktreeSection +
91
100
  customSection +
92
101
  extrasSuffix
93
102
  )
@@ -100,7 +109,12 @@ You have been invoked to handle a specific task autonomously.
100
109
  ${envBlock}`
101
110
 
102
111
  return (
103
- activeAgentTag + replaceHeader + "\n\n" + config.systemPrompt + extrasSuffix
112
+ activeAgentTag +
113
+ replaceHeader +
114
+ worktreeSection +
115
+ "\n\n" +
116
+ config.systemPrompt +
117
+ extrasSuffix
104
118
  )
105
119
  }
106
120
 
@@ -49,6 +49,12 @@ export interface SubagentsSettings {
49
49
  * against. Defaults to false: subagents may use any model.
50
50
  */
51
51
  scopeModels?: boolean
52
+ /**
53
+ * When true, an unreadable or unparseable agent `.md` aborts extension load
54
+ * instead of being skipped with a warning. This applies only during startup;
55
+ * later per-call reloads remain tolerant. Defaults to false.
56
+ */
57
+ strictAgentFiles?: boolean
52
58
  /**
53
59
  * When true, the three built-in default agents (general-purpose, Explore, Plan)
54
60
  * are not registered at startup. User-defined agents from project/global custom
@@ -129,6 +135,7 @@ export interface SettingsAppliers {
129
135
  setDefaultJoinMode: (mode: JoinMode) => void
130
136
  setSchedulingEnabled: (b: boolean) => void
131
137
  setScopeModels: (enabled: boolean) => void
138
+ setStrictAgentFiles: (b: boolean) => void
132
139
  setDisableDefaultAgents: (b: boolean) => void
133
140
  setToolDescriptionMode: (mode: ToolDescriptionMode) => void
134
141
  setFleetView: (b: boolean) => void
@@ -207,6 +214,9 @@ function sanitize(raw: unknown): SubagentsSettings {
207
214
  if (typeof r.scopeModels === "boolean") {
208
215
  out.scopeModels = r.scopeModels
209
216
  }
217
+ if (typeof r.strictAgentFiles === "boolean") {
218
+ out.strictAgentFiles = r.strictAgentFiles
219
+ }
210
220
  if (typeof r.disableDefaultAgents === "boolean") {
211
221
  out.disableDefaultAgents = r.disableDefaultAgents
212
222
  }
@@ -315,6 +325,8 @@ export function applySettings(
315
325
  if (typeof s.schedulingEnabled === "boolean")
316
326
  appliers.setSchedulingEnabled(s.schedulingEnabled)
317
327
  if (typeof s.scopeModels === "boolean") appliers.setScopeModels(s.scopeModels)
328
+ if (typeof s.strictAgentFiles === "boolean")
329
+ appliers.setStrictAgentFiles(s.strictAgentFiles)
318
330
  if (typeof s.disableDefaultAgents === "boolean")
319
331
  appliers.setDisableDefaultAgents(s.disableDefaultAgents)
320
332
  if (s.toolDescriptionMode)
@@ -77,6 +77,8 @@ export interface AgentConfig {
77
77
  enabled?: boolean
78
78
  /** Where this agent was loaded from */
79
79
  source?: "default" | "project" | "global"
80
+ /** Path of the .md it was loaded from. Unset for embedded defaults. */
81
+ sourcePath?: string
80
82
  }
81
83
 
82
84
  export type JoinMode = "async" | "group" | "smart"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 narumiruna
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,210 @@
1
+ # 💬 pi-btw — Side Questions for the Pi Coding Agent
2
+
3
+ [![npm](https://img.shields.io/npm/v/@narumitw/pi-btw)](https://www.npmjs.com/package/@narumitw/pi-btw) [![Pi extension](https://img.shields.io/badge/Pi-extension-blue)](https://pi.dev) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
4
+
5
+ `@narumitw/pi-btw` is a native [Pi coding agent](https://pi.dev) extension that adds `/btw`, a side-question command for quick clarifications that should not interrupt or pollute the main agent conversation.
6
+
7
+ Use it when you want to ask a temporary question, inspect context, or get a short explanation while keeping the primary coding task focused.
8
+
9
+ ## ✨ Features
10
+
11
+ - Adds a `/btw` menu for starting or resuming an in-memory side thread or changing pi-btw settings.
12
+ - Keeps `/btw <question>` as a direct fast path that always starts a fresh side thread.
13
+ - Answers side questions in a dedicated, scrollable full-screen UI.
14
+ - Keeps mouse-drag copying stable while the main agent continues running in the background.
15
+ - Supports follow-up questions in the same ephemeral side thread.
16
+ - Resumes any non-empty side thread retained by the current Pi session, listed by its first question.
17
+ - Queues Pi-style `Steering` questions while an answer is running and processes them one at a time.
18
+ - Optionally brings the latest answer, a question-to-end suffix, an exact line range, or the entire side thread into the main editor.
19
+ - Uses the current session branch as context.
20
+ - Uses Pi's current model or an independent model selected in `pi-btw.json`.
21
+ - Uses a pi-btw thinking level that can be changed with Pi's configured thinking shortcut and remembered for next time.
22
+ - Does not append the side question or answer to the main conversation.
23
+ - Works as an independently installable npm Pi extension package.
24
+
25
+ ## 📦 Install
26
+
27
+ ```bash
28
+ pi install npm:@narumitw/pi-btw
29
+ ```
30
+
31
+ Try without installing permanently:
32
+
33
+ ```bash
34
+ pi -e npm:@narumitw/pi-btw
35
+ ```
36
+
37
+ Try this package locally from the repository root:
38
+
39
+ ```bash
40
+ pi -e ./packages/pi-btw
41
+ ```
42
+
43
+ ## 🚀 Usage
44
+
45
+ Open the pi-btw menu or provide the first question immediately:
46
+
47
+ ```text
48
+ /btw
49
+ /btw <your side question>
50
+ ```
51
+
52
+ Examples:
53
+
54
+ ```text
55
+ /btw
56
+ /btw what does this TypeScript error mean?
57
+ /btw summarize the current implementation before we continue
58
+ /btw is this API name idiomatic?
59
+ ```
60
+
61
+ Running `/btw` alone opens a menu with **Start side thread** selected first. When the current Pi
62
+ session has non-empty side threads in memory, **Resume side thread** opens a bounded choice list;
63
+ **Settings** changes the starting thinking level and whether shortcut changes are remembered.
64
+ Each Resume row keeps the first question as its fixed title, shows its question count, and the list
65
+ is ordered by the newest recorded answer or visible error. Opening and closing a thread without a
66
+ new result does not reorder it. `/btw <question>` bypasses this menu and always starts a fresh side
67
+ thread. Its answer opens above the side-thread editor. The side thread uses a dedicated full-screen
68
+ terminal view.
69
+ The main agent continues running in the background, but its screen rendering stays suspended until
70
+ `/btw` closes, so new main-thread output cannot move a mouse selection inside the side thread.
71
+ Drag the primary mouse button across side-thread text to select and copy it through Pi's terminal
72
+ clipboard support. Returning from `/btw` redraws the main view with everything produced while it
73
+ was hidden. A compact `btw · side thread` header stays fixed above the content so the ephemeral
74
+ workspace remains recognizable while scrolling. Messages use Pi's normal
75
+ user and assistant presentation without numbered turns or role labels. Type each question and press
76
+ `Enter`; no follow-up shortcut is required.
77
+ Previous side questions and answers remain available to the model and visible for that
78
+ invocation. The side-thread header shows its current thinking level. Press Pi's configured
79
+ `app.thinking.cycle` shortcut (`Shift+Tab` by default) in the composer to cycle the levels
80
+ supported by the side-thread model; every later question uses the displayed level until it is
81
+ changed again. By default, each shortcut change is also written to `pi-btw.json` for the next
82
+ invocation. Turn **Remember thinking level changes** off in Settings to keep changes local to the
83
+ current side thread. Neither path changes the main session's thinking level.
84
+ While a response is running, the transcript and composer remain visible above an `Answering…`
85
+ status.
86
+ Type another question and press `Enter` to queue it as `Steering`; queued questions are shown in
87
+ submission order and answered one at a time after the active response completes.
88
+ A queued question uses the side thread's thinking level when its turn begins.
89
+ A failed active response is shown in the transcript and does not discard later steering questions.
90
+ The footer shows `PgUp`/`PgDn` only when history can scroll; press `Ctrl+C` to cancel the active
91
+ response and discard the ephemeral side-thread draft and steering queue. Completed questions,
92
+ answers, and visible errors remain available through Resume until the current extension instance
93
+ ends. Steering remains entirely inside pi-btw and never appends to the main conversation or editor.
94
+
95
+ After at least one successful answer, press `Ctrl+R` to bring selected context to the main
96
+ editor. The scope menu shows the size of the latest question and answer and the entire side
97
+ thread before you choose. Bring the latest question and answer, everything from a chosen
98
+ question onward, an exact text range, or the entire side thread. Question-suffix, exact-range,
99
+ and entire-thread choices preview the exact editable context block before the side thread closes;
100
+ `Escape` returns and `Ctrl+C` closes without bringing anything to main.
101
+
102
+ The text-range selector supports both fast line selection and editor-style character selection.
103
+ It reports whether anything is selected plus the selected line, message, and approximate token
104
+ counts. Press `Space` to select the current raw source line, then use `Up`/`Down` to extend by
105
+ whole lines; press `Space` again to clear it. Alternatively, use the arrow keys to move the cursor
106
+ and `Shift`+arrow keys to extend a character-level selection. Starting a Shift selection replaces
107
+ any active line selection. Selected lines include a visible `●` marker in addition to highlighting.
108
+ Pi's configured keys control vertical navigation, bringing, and going back (`Up`/`Down`, `Enter`,
109
+ and `Escape` by default), and the selector displays the active keys. Selection follows raw source
110
+ text rather than terminal-wrapped visual rows.
111
+
112
+ Bringing context to main closes the side thread and loads a deterministic, editable context block
113
+ into Pi's main editor. It never sends the draft automatically. If the main editor already has a
114
+ draft, append is the recommended default. Replace is labeled as destructive and requires a second
115
+ confirmation; Cancel returns to the side thread without changing either draft. Concurrent editor
116
+ updates made while these menus are open are preserved. A success message reports whether context
117
+ was loaded, appended, or replaced and its approximate size.
118
+ Without an explicit bring-to-main action, closing `/btw` never adds the side thread to the main
119
+ conversation. Non-empty threads remain only in memory for Resume within the current Pi session.
120
+ `/new`, Pi `/resume`, `/reload`, extension replacement, and process restart discard every retained
121
+ thread. Unsent drafts, steering queues, interrupted answers, and model credentials are never retained.
122
+
123
+ ## ⚙️ Model and thinking level
124
+
125
+ By default, `/btw` uses the current session model. To use an independent model for side
126
+ questions, create:
127
+
128
+ ```text
129
+ $PI_CODING_AGENT_DIR/pi-btw.json
130
+ ```
131
+
132
+ The normal location is `~/.pi/agent/pi-btw.json`. `PI_CODING_AGENT_DIR` is an existing Pi
133
+ setting; pi-btw does not add any environment variables.
134
+
135
+ ```json
136
+ {
137
+ "model": "anthropic/claude-sonnet-4-5",
138
+ "thinkingLevel": "low",
139
+ "rememberThinkingLevelChanges": true
140
+ }
141
+ ```
142
+
143
+ The `model` value uses `provider/model-id` format. Only the first `/` is the separator, so
144
+ model IDs may contain additional slashes, such as `openrouter/anthropic/claude-sonnet`.
145
+ The configured model must exist in Pi's model registry and have usable credentials. If it
146
+ cannot be found or authenticated, pi-btw warns and falls back to the current session model.
147
+ If neither model is available, `/btw` reports an error and stops. This selection affects only
148
+ `/btw`; it does not change the main session model.
149
+
150
+ Pi calls its reasoning setting the **thinking level**. `thinkingLevel` sets pi-btw's starting
151
+ level; accepted values are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. When the
152
+ field is absent for backward compatibility, the next invocation starts from the current session
153
+ level. The initial value and shortcut cycle are clamped to the selected side model's capabilities
154
+ using Pi's model rules. Pi-btw does not read, write, or change the main session's
155
+ `defaultThinkingLevel`.
156
+
157
+ `rememberThinkingLevelChanges` controls only persistence and defaults to `true` when omitted. A
158
+ side-thread shortcut always changes that side thread immediately. When remembering is on, the
159
+ concrete level is written for the next invocation; when off, `pi-btw.json` stays unchanged. If a
160
+ shortcut write fails, the local change remains active and pi-btw warns that it was not remembered.
161
+ A failed Settings-screen save instead restores the previous displayed value.
162
+
163
+ A missing settings file is a side-effect-free read: pi-btw creates it only after a Settings change
164
+ or a remembered shortcut change. Saves are ordered within the Pi process and published atomically
165
+ with a same-directory temporary file and rename. They preserve `model` and unknown fields; malformed
166
+ or invalid files block saves and remain unchanged. Settings must be valid UTF-8 and no larger than
167
+ 64 KiB, so unexpectedly large or invalidly encoded files are rejected without being rewritten.
168
+ Separate Pi processes and external editors are outside this in-process ordering boundary. The file
169
+ is read for each `/btw` invocation, so edits apply without `/reload`.
170
+
171
+ ## 🧠 Why use pi-btw?
172
+
173
+ Normal assistant messages become part of the main Pi conversation and can distract the coding agent from the task. `pi-btw` creates a lightweight side channel for context-aware questions, making it useful for pair programming, debugging, code review, and repository exploration.
174
+
175
+ ## 🗂️ Package layout
176
+
177
+ ```txt
178
+ packages/pi-btw/
179
+ ├── src/
180
+ │ ├── index.ts
181
+ │ ├── btw.ts
182
+ │ ├── bring-to-main.ts
183
+ │ ├── menu.ts
184
+ │ ├── settings.ts
185
+ │ ├── side-thread.ts
186
+ │ ├── text.ts
187
+ │ └── transcript-pager.ts
188
+ ├── README.md
189
+ ├── LICENSE
190
+ ├── tsconfig.json
191
+ └── package.json
192
+ ```
193
+
194
+ The package exposes its Pi extension through `package.json`:
195
+
196
+ ```json
197
+ {
198
+ "pi": {
199
+ "extensions": ["./src/index.ts"]
200
+ }
201
+ }
202
+ ```
203
+
204
+ ## 🔎 Keywords
205
+
206
+ Pi extension, Pi coding agent, AI coding agent, side question command, agent chat workflow, TypeScript Pi package, npm Pi extension.
207
+
208
+ ## 📄 License
209
+
210
+ MIT. See [`LICENSE`](./LICENSE).
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@narumitw/pi-btw",
3
+ "version": "0.50.0",
4
+ "description": "Pi extension that adds a /btw side-question command.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "private": false,
8
+ "keywords": [
9
+ "pi-package",
10
+ "pi-extension",
11
+ "pi",
12
+ "btw",
13
+ "side-question"
14
+ ],
15
+ "files": [
16
+ "src",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "pi": {
21
+ "extensions": [
22
+ "./src/index.ts"
23
+ ]
24
+ },
25
+ "piExtension": {
26
+ "lifecycle": "stable"
27
+ },
28
+ "scripts": {
29
+ "check": "biome check . && npm run typecheck",
30
+ "format": "biome check --write .",
31
+ "typecheck": "tsc --noEmit"
32
+ },
33
+ "devDependencies": {
34
+ "@biomejs/biome": "2.5.7",
35
+ "@earendil-works/pi-ai": "0.84.1",
36
+ "@earendil-works/pi-coding-agent": "0.84.1",
37
+ "@earendil-works/pi-tui": "0.84.1",
38
+ "typescript": "7.0.2"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/narumiruna/pi-extensions",
43
+ "directory": "packages/pi-btw"
44
+ },
45
+ "dependencies": {
46
+ "@narumitw/pi-tui-kit": "^0.49.1"
47
+ },
48
+ "peerDependencies": {
49
+ "@earendil-works/pi-ai": "*",
50
+ "@earendil-works/pi-coding-agent": "*",
51
+ "@earendil-works/pi-tui": "*"
52
+ }
53
+ }