@ashx-j/lunr 0.2.21 → 0.2.22

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 (438) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +20 -4
  3. package/dist/builtin-extensions/index.d.ts.map +1 -1
  4. package/dist/builtin-extensions/index.js +1 -0
  5. package/dist/builtin-extensions/index.js.map +1 -1
  6. package/dist/builtin-extensions/lunr-browser.d.ts +3 -0
  7. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  8. package/dist/builtin-extensions/lunr-browser.js +56 -0
  9. package/dist/builtin-extensions/lunr-browser.js.map +1 -0
  10. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  11. package/dist/builtin-extensions/lunr-todos.js +15 -0
  12. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  13. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  14. package/dist/builtin-extensions/pi-intercom/index.js +3 -0
  15. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  16. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
  17. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  18. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
  19. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  20. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +2 -2
  21. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +18 -5
  23. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  24. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
  25. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +3 -0
  27. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
  29. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
  30. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
  31. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
  32. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +4 -11
  34. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +4 -1
  36. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +160 -51
  38. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -1
  40. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +5 -0
  41. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +2 -0
  43. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +3 -2
  45. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +1 -0
  47. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
  49. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +1 -0
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +2 -0
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +3 -0
  56. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  58. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  60. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  65. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  68. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  69. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +47 -0
  70. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  71. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  72. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  73. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  74. package/dist/cli/args.d.ts.map +1 -1
  75. package/dist/cli/args.js +2 -1
  76. package/dist/cli/args.js.map +1 -1
  77. package/dist/cli/install-cli.d.ts.map +1 -1
  78. package/dist/cli/install-cli.js +15 -45
  79. package/dist/cli/install-cli.js.map +1 -1
  80. package/dist/core/agent-session-runtime.d.ts +9 -0
  81. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  82. package/dist/core/agent-session-runtime.js +126 -29
  83. package/dist/core/agent-session-runtime.js.map +1 -1
  84. package/dist/core/agent-session.d.ts +3 -0
  85. package/dist/core/agent-session.d.ts.map +1 -1
  86. package/dist/core/agent-session.js +20 -2
  87. package/dist/core/agent-session.js.map +1 -1
  88. package/dist/core/browser/network.d.ts +9 -0
  89. package/dist/core/browser/network.d.ts.map +1 -0
  90. package/dist/core/browser/network.js +146 -0
  91. package/dist/core/browser/network.js.map +1 -0
  92. package/dist/core/browser/runtime.d.ts +24 -0
  93. package/dist/core/browser/runtime.d.ts.map +1 -0
  94. package/dist/core/browser/runtime.js +289 -0
  95. package/dist/core/browser/runtime.js.map +1 -0
  96. package/dist/core/browser/schema.d.ts +16 -0
  97. package/dist/core/browser/schema.d.ts.map +1 -0
  98. package/dist/core/browser/schema.js +36 -0
  99. package/dist/core/browser/schema.js.map +1 -0
  100. package/dist/core/browser/settings.d.ts +8 -0
  101. package/dist/core/browser/settings.d.ts.map +1 -0
  102. package/dist/core/browser/settings.js +30 -0
  103. package/dist/core/browser/settings.js.map +1 -0
  104. package/dist/core/browser/setup.d.ts +2 -0
  105. package/dist/core/browser/setup.d.ts.map +1 -0
  106. package/dist/core/browser/setup.js +16 -0
  107. package/dist/core/browser/setup.js.map +1 -0
  108. package/dist/core/customize.d.ts.map +1 -1
  109. package/dist/core/customize.js +15 -14
  110. package/dist/core/customize.js.map +1 -1
  111. package/dist/core/export-html/index.d.ts.map +1 -1
  112. package/dist/core/export-html/index.js +1 -1
  113. package/dist/core/export-html/index.js.map +1 -1
  114. package/dist/core/extensions/runner.d.ts +1 -0
  115. package/dist/core/extensions/runner.d.ts.map +1 -1
  116. package/dist/core/extensions/runner.js +1 -1
  117. package/dist/core/extensions/runner.js.map +1 -1
  118. package/dist/core/extensions/types.d.ts +1 -1
  119. package/dist/core/extensions/types.d.ts.map +1 -1
  120. package/dist/core/extensions/types.js.map +1 -1
  121. package/dist/core/install-features.d.ts.map +1 -1
  122. package/dist/core/install-features.js +10 -8
  123. package/dist/core/install-features.js.map +1 -1
  124. package/dist/core/memory-cap.d.ts.map +1 -1
  125. package/dist/core/memory-cap.js +5 -3
  126. package/dist/core/memory-cap.js.map +1 -1
  127. package/dist/core/model-tiers.d.ts.map +1 -1
  128. package/dist/core/model-tiers.js +9 -6
  129. package/dist/core/model-tiers.js.map +1 -1
  130. package/dist/core/permissions.d.ts.map +1 -1
  131. package/dist/core/permissions.js +9 -0
  132. package/dist/core/permissions.js.map +1 -1
  133. package/dist/core/plan-mode.d.ts.map +1 -1
  134. package/dist/core/plan-mode.js +3 -0
  135. package/dist/core/plan-mode.js.map +1 -1
  136. package/dist/core/process-registry.d.ts.map +1 -1
  137. package/dist/core/process-registry.js +6 -4
  138. package/dist/core/process-registry.js.map +1 -1
  139. package/dist/core/runtime-scope.d.ts +11 -0
  140. package/dist/core/runtime-scope.d.ts.map +1 -0
  141. package/dist/core/runtime-scope.js +3 -0
  142. package/dist/core/runtime-scope.js.map +1 -0
  143. package/dist/core/sdk.d.ts.map +1 -1
  144. package/dist/core/sdk.js +13 -0
  145. package/dist/core/sdk.js.map +1 -1
  146. package/dist/core/session-handoff.d.ts +35 -0
  147. package/dist/core/session-handoff.d.ts.map +1 -0
  148. package/dist/core/session-handoff.js +214 -0
  149. package/dist/core/session-handoff.js.map +1 -0
  150. package/dist/core/session-manager.d.ts +20 -0
  151. package/dist/core/session-manager.d.ts.map +1 -1
  152. package/dist/core/session-manager.js +184 -22
  153. package/dist/core/session-manager.js.map +1 -1
  154. package/dist/core/session-ownership.d.ts +28 -0
  155. package/dist/core/session-ownership.d.ts.map +1 -0
  156. package/dist/core/session-ownership.js +138 -0
  157. package/dist/core/session-ownership.js.map +1 -0
  158. package/dist/core/session-retention.d.ts.map +1 -1
  159. package/dist/core/session-retention.js +11 -2
  160. package/dist/core/session-retention.js.map +1 -1
  161. package/dist/core/settings-manager.d.ts +7 -0
  162. package/dist/core/settings-manager.d.ts.map +1 -1
  163. package/dist/core/settings-manager.js +18 -0
  164. package/dist/core/settings-manager.js.map +1 -1
  165. package/dist/core/slash-commands.d.ts.map +1 -1
  166. package/dist/core/slash-commands.js +2 -0
  167. package/dist/core/slash-commands.js.map +1 -1
  168. package/dist/core/system-prompt.d.ts.map +1 -1
  169. package/dist/core/system-prompt.js +5 -2
  170. package/dist/core/system-prompt.js.map +1 -1
  171. package/dist/core/todo-settings.d.ts +5 -0
  172. package/dist/core/todo-settings.d.ts.map +1 -0
  173. package/dist/core/todo-settings.js +7 -0
  174. package/dist/core/todo-settings.js.map +1 -0
  175. package/dist/core/tools/bash.d.ts.map +1 -1
  176. package/dist/core/tools/bash.js +4 -4
  177. package/dist/core/tools/bash.js.map +1 -1
  178. package/dist/core/tools/edit.d.ts.map +1 -1
  179. package/dist/core/tools/edit.js +5 -3
  180. package/dist/core/tools/edit.js.map +1 -1
  181. package/dist/core/tools/find.d.ts.map +1 -1
  182. package/dist/core/tools/find.js +4 -4
  183. package/dist/core/tools/find.js.map +1 -1
  184. package/dist/core/tools/grep.d.ts.map +1 -1
  185. package/dist/core/tools/grep.js +4 -4
  186. package/dist/core/tools/grep.js.map +1 -1
  187. package/dist/core/tools/ls.d.ts.map +1 -1
  188. package/dist/core/tools/ls.js +4 -4
  189. package/dist/core/tools/ls.js.map +1 -1
  190. package/dist/core/tools/read.d.ts.map +1 -1
  191. package/dist/core/tools/read.js +4 -4
  192. package/dist/core/tools/read.js.map +1 -1
  193. package/dist/core/tools/render-utils.d.ts +11 -2
  194. package/dist/core/tools/render-utils.d.ts.map +1 -1
  195. package/dist/core/tools/render-utils.js +31 -4
  196. package/dist/core/tools/render-utils.js.map +1 -1
  197. package/dist/core/tools/write.d.ts.map +1 -1
  198. package/dist/core/tools/write.js +4 -4
  199. package/dist/core/tools/write.js.map +1 -1
  200. package/dist/core/usage-service.d.ts.map +1 -1
  201. package/dist/core/usage-service.js +5 -3
  202. package/dist/core/usage-service.js.map +1 -1
  203. package/dist/gateway/adapters/discord.d.ts +12 -1
  204. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  205. package/dist/gateway/adapters/discord.js +112 -17
  206. package/dist/gateway/adapters/discord.js.map +1 -1
  207. package/dist/gateway/adapters/telegram.d.ts +4 -2
  208. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  209. package/dist/gateway/adapters/telegram.js +34 -11
  210. package/dist/gateway/adapters/telegram.js.map +1 -1
  211. package/dist/gateway/agent-bridge.d.ts +14 -3
  212. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  213. package/dist/gateway/agent-bridge.js +252 -60
  214. package/dist/gateway/agent-bridge.js.map +1 -1
  215. package/dist/gateway/approval.d.ts +1 -0
  216. package/dist/gateway/approval.d.ts.map +1 -1
  217. package/dist/gateway/approval.js +60 -18
  218. package/dist/gateway/approval.js.map +1 -1
  219. package/dist/gateway/authz.d.ts +2 -0
  220. package/dist/gateway/authz.d.ts.map +1 -1
  221. package/dist/gateway/authz.js +13 -0
  222. package/dist/gateway/authz.js.map +1 -1
  223. package/dist/gateway/buttons.d.ts +3 -1
  224. package/dist/gateway/buttons.d.ts.map +1 -1
  225. package/dist/gateway/buttons.js +18 -3
  226. package/dist/gateway/buttons.js.map +1 -1
  227. package/dist/gateway/command.d.ts.map +1 -1
  228. package/dist/gateway/command.js +49 -4
  229. package/dist/gateway/command.js.map +1 -1
  230. package/dist/gateway/commands.d.ts.map +1 -1
  231. package/dist/gateway/commands.js +18 -3
  232. package/dist/gateway/commands.js.map +1 -1
  233. package/dist/gateway/config.d.ts +5 -0
  234. package/dist/gateway/config.d.ts.map +1 -1
  235. package/dist/gateway/config.js +5 -0
  236. package/dist/gateway/config.js.map +1 -1
  237. package/dist/gateway/conversations.d.ts +14 -0
  238. package/dist/gateway/conversations.d.ts.map +1 -0
  239. package/dist/gateway/conversations.js +30 -0
  240. package/dist/gateway/conversations.js.map +1 -0
  241. package/dist/gateway/download.d.ts +2 -0
  242. package/dist/gateway/download.d.ts.map +1 -0
  243. package/dist/gateway/download.js +36 -0
  244. package/dist/gateway/download.js.map +1 -0
  245. package/dist/gateway/index.d.ts.map +1 -1
  246. package/dist/gateway/index.js +85 -26
  247. package/dist/gateway/index.js.map +1 -1
  248. package/dist/gateway/mobile-commands.d.ts +24 -0
  249. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  250. package/dist/gateway/mobile-commands.js +422 -0
  251. package/dist/gateway/mobile-commands.js.map +1 -0
  252. package/dist/gateway/presenter.d.ts +16 -0
  253. package/dist/gateway/presenter.d.ts.map +1 -0
  254. package/dist/gateway/presenter.js +210 -0
  255. package/dist/gateway/presenter.js.map +1 -0
  256. package/dist/gateway/router.d.ts +1 -0
  257. package/dist/gateway/router.d.ts.map +1 -1
  258. package/dist/gateway/router.js +32 -3
  259. package/dist/gateway/router.js.map +1 -1
  260. package/dist/gateway/service.d.ts +46 -0
  261. package/dist/gateway/service.d.ts.map +1 -0
  262. package/dist/gateway/service.js +395 -0
  263. package/dist/gateway/service.js.map +1 -0
  264. package/dist/gateway/setup.d.ts +4 -0
  265. package/dist/gateway/setup.d.ts.map +1 -0
  266. package/dist/gateway/setup.js +146 -0
  267. package/dist/gateway/setup.js.map +1 -0
  268. package/dist/gateway/types.d.ts +4 -2
  269. package/dist/gateway/types.d.ts.map +1 -1
  270. package/dist/gateway/types.js.map +1 -1
  271. package/dist/index.d.ts +2 -0
  272. package/dist/index.d.ts.map +1 -1
  273. package/dist/index.js +2 -0
  274. package/dist/index.js.map +1 -1
  275. package/dist/main.d.ts.map +1 -1
  276. package/dist/main.js +2 -1
  277. package/dist/main.js.map +1 -1
  278. package/dist/modes/interactive/components/assistant-message.d.ts +11 -2
  279. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/assistant-message.js +53 -16
  281. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  282. package/dist/modes/interactive/components/copyable-text.d.ts +31 -0
  283. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  284. package/dist/modes/interactive/components/copyable-text.js +165 -0
  285. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  286. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  287. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  288. package/dist/modes/interactive/components/custom-entry.js +8 -0
  289. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  290. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  291. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  292. package/dist/modes/interactive/components/custom-message.js +8 -0
  293. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  294. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  295. package/dist/modes/interactive/components/session-selector.js +16 -0
  296. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  297. package/dist/modes/interactive/components/settings-selector.d.ts +5 -0
  298. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  299. package/dist/modes/interactive/components/settings-selector.js +38 -0
  300. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  301. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  302. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  303. package/dist/modes/interactive/interactive-mode.js +151 -7
  304. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  305. package/dist/node-runtime/agent-session-services-NQ6GKOIK.js +49 -0
  306. package/dist/node-runtime/{builtin-extensions-JCOPAAB5.js → builtin-extensions-GVC6IFDU.js} +6 -5
  307. package/dist/node-runtime/{chunk-LTYWTR3V.js → chunk-2MI5OPMN.js} +17 -2
  308. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  309. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  310. package/dist/node-runtime/chunk-5BNJ4JUH.js +672 -0
  311. package/dist/node-runtime/{chunk-6N22HULO.js → chunk-5D7LC2ZQ.js} +7 -2
  312. package/dist/node-runtime/{chunk-KBKMCJDU.js → chunk-5ZQXRPMC.js} +19 -4
  313. package/dist/node-runtime/{chunk-6KDIOJL3.js → chunk-6427XAWG.js} +3 -3
  314. package/dist/node-runtime/{chunk-BOHIDQT4.js → chunk-6B2POMK7.js} +1 -1
  315. package/dist/node-runtime/{chunk-RNBHABBA.js → chunk-7QWNYZDI.js} +7 -0
  316. package/dist/node-runtime/chunk-AZJHNQKQ.js +205 -0
  317. package/dist/node-runtime/{chunk-A3KMVBZV.js → chunk-BBUVIEZB.js} +1 -10
  318. package/dist/node-runtime/chunk-BFNXONG3.js +521 -0
  319. package/dist/node-runtime/{chunk-IRPJXI6U.js → chunk-BX2RB477.js} +1 -1
  320. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  321. package/dist/node-runtime/{chunk-25I2BHAA.js → chunk-CSUZVNYE.js} +1 -1
  322. package/dist/node-runtime/{chunk-QZMODZQ2.js → chunk-E24EO34J.js} +2 -1
  323. package/dist/node-runtime/{chunk-2BUAYZ7K.js → chunk-EQ63ANHL.js} +422 -123
  324. package/dist/node-runtime/{chunk-GB2MGFLI.js → chunk-GJSAD4AB.js} +216 -201
  325. package/dist/node-runtime/{chunk-W3SILANP.js → chunk-GMHJCCEN.js} +8 -8
  326. package/dist/node-runtime/{chunk-DDWHZ633.js → chunk-GNN7H3B7.js} +1 -1
  327. package/dist/node-runtime/chunk-GS66LV4M.js +2830 -0
  328. package/dist/node-runtime/{chunk-6BEIBLQ3.js → chunk-H3XF4UVQ.js} +1 -1
  329. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  330. package/dist/node-runtime/{chunk-YMEAYRBE.js → chunk-HTFRRDSF.js} +2 -7
  331. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  332. package/dist/node-runtime/{chunk-Y5KOEMBH.js → chunk-IQIEU7SB.js} +9 -674
  333. package/dist/node-runtime/{chunk-OPEK5RRY.js → chunk-IVXYUAJE.js} +1 -1
  334. package/dist/node-runtime/{chunk-PDNXVXMD.js → chunk-IWOWXRWU.js} +58 -48
  335. package/dist/node-runtime/chunk-KKUTQQV7.js +144 -0
  336. package/dist/node-runtime/{chunk-AWVD5IEY.js → chunk-LMBNLFXQ.js} +23 -12
  337. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-NAY6UUQZ.js} +1 -1
  338. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  339. package/dist/node-runtime/{chunk-STERBGUB.js → chunk-OFKSVRV7.js} +2 -2
  340. package/dist/node-runtime/{chunk-JZQ7F36T.js → chunk-ORH324EP.js} +19 -3
  341. package/dist/node-runtime/{chunk-2SJB2AWP.js → chunk-PC2Z5TKZ.js} +3 -3
  342. package/dist/node-runtime/{chunk-SY2TFMLO.js → chunk-QDGKKKUM.js} +46 -151
  343. package/dist/node-runtime/chunk-R3K2F5GI.js +122 -0
  344. package/dist/node-runtime/chunk-RMQZU2YU.js +117 -0
  345. package/dist/node-runtime/{chunk-XI77KVKA.js → chunk-TDL7UWJ7.js} +283 -2999
  346. package/dist/node-runtime/{chunk-G6LRAP36.js → chunk-TQGPP4SC.js} +1 -1
  347. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  348. package/dist/node-runtime/{chunk-VZR3NCM7.js → chunk-UAFLNHSH.js} +18 -14
  349. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  350. package/dist/node-runtime/chunk-UP2XBVH5.js +40 -0
  351. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-UQUCFAJ3.js} +1 -1
  352. package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
  353. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  354. package/dist/node-runtime/chunk-UWPJL22I.js +341 -0
  355. package/dist/node-runtime/chunk-V2A7CEXK.js +355 -0
  356. package/dist/node-runtime/chunk-VJPTNWAP.js +708 -0
  357. package/dist/node-runtime/{chunk-WKDK4C5P.js → chunk-VSSXXL36.js} +38 -164
  358. package/dist/node-runtime/{chunk-4I23VTC4.js → chunk-VWCE2HSZ.js} +21 -124
  359. package/dist/node-runtime/{chunk-WLLDXJRT.js → chunk-WADV2VDS.js} +22 -1014
  360. package/dist/node-runtime/{chunk-GKLEQ3I4.js → chunk-XLTL257W.js} +126 -27
  361. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  362. package/dist/node-runtime/cli-runtime.js +2 -2
  363. package/dist/node-runtime/command-3JHHXOPX.js +45 -0
  364. package/dist/node-runtime/commands-2JVNFGMQ.js +36 -0
  365. package/dist/node-runtime/{commands-MV5KOZ64.js → commands-KAMO2T6P.js} +10 -10
  366. package/dist/node-runtime/config-RORQUQFG.js +20 -0
  367. package/dist/node-runtime/{customize-LF5VST47.js → customize-VFJV3U6A.js} +2 -1
  368. package/dist/node-runtime/{direct-tool-executor-BK7CLEBX.js → direct-tool-executor-YAVOLDFY.js} +8 -8
  369. package/dist/node-runtime/{export-html-TEXVV5RP.js → export-html-KBFVV63J.js} +4 -3
  370. package/dist/node-runtime/{extension-input-O4HSAEM4.js → extension-input-K24TVKVW.js} +4 -4
  371. package/dist/node-runtime/{extension-selector-X5FCX43D.js → extension-selector-SPNF7EDR.js} +4 -4
  372. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-EQJE7FZZ.js} +2 -2
  373. package/dist/node-runtime/{gateway-BM6NLOH4.js → gateway-VFO6SFKK.js} +275 -994
  374. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-35OCRFLN.js} +1 -1
  375. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-UQY3PHHW.js} +2 -2
  376. package/dist/node-runtime/index.js +104 -65
  377. package/dist/node-runtime/{init-3C7Z24OI.js → init-X2LIUB2H.js} +3 -3
  378. package/dist/node-runtime/{install-cli-EXMJQESX.js → install-cli-C3CF7O7N.js} +21 -82
  379. package/dist/node-runtime/interactive-mode-LOM6AIF6.js +72 -0
  380. package/dist/node-runtime/{interactive-view-ILS6TAN5.js → interactive-view-IDSCPPK7.js} +8 -8
  381. package/dist/node-runtime/lunr-browser-YNW7FTYX.js +87 -0
  382. package/dist/node-runtime/{lunr-cron-4VHP4E4B.js → lunr-cron-BKHGNBKT.js} +19 -5
  383. package/dist/node-runtime/main.js +44 -31
  384. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  385. package/dist/node-runtime/mobile-commands-HMP25WBC.js +32 -0
  386. package/dist/node-runtime/model-runtime-PLQKAG4B.js +16 -0
  387. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  388. package/dist/node-runtime/{package-manager-cli-N37546V5.js → package-manager-cli-VCK4E2RC.js} +22 -15
  389. package/dist/node-runtime/{pi-intercom-NV2LW6X7.js → pi-intercom-HBPK5HSJ.js} +4 -1
  390. package/dist/node-runtime/{pi-mcp-adapter-GUFZWW54.js → pi-mcp-adapter-E6WULBKF.js} +4 -4
  391. package/dist/node-runtime/{pi-subagents-6MUIFNDM.js → pi-subagents-FEUDLJOE.js} +201 -78
  392. package/dist/node-runtime/{pi-web-access-2CQGFLT2.js → pi-web-access-WTGMNZ32.js} +15 -15
  393. package/dist/node-runtime/process-registry-4FAKZQOL.js +31 -0
  394. package/dist/node-runtime/{proxy-modes-V6YVFH3C.js → proxy-modes-OSQCWRBI.js} +9 -9
  395. package/dist/node-runtime/rpc-entry.js +44 -31
  396. package/dist/node-runtime/{rpc-mode-W5ZTLTMZ.js → rpc-mode-P5ODXPEG.js} +2 -2
  397. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  398. package/dist/node-runtime/{runtime-bridges-2VQTLPOZ.js → runtime-bridges-3XUQ46XW.js} +6 -5
  399. package/dist/node-runtime/service-ISSP6VHE.js +36 -0
  400. package/dist/node-runtime/session-handoff-HC7R5E24.js +33 -0
  401. package/dist/node-runtime/{session-manager-E7AREDTV.js → session-manager-CFN4UFM2.js} +2 -1
  402. package/dist/node-runtime/{session-selector-FJ7M2AIX.js → session-selector-LHRMJOKT.js} +5 -4
  403. package/dist/node-runtime/{settings-manager-CUGAZWAB.js → settings-manager-UUZ6NUXI.js} +7 -2
  404. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  405. package/dist/node-runtime/setup-NRXVZBLJ.js +155 -0
  406. package/dist/node-runtime/{subagent-executor-MH4A7CCF.js → subagent-executor-MLUMBWCP.js} +22 -18
  407. package/dist/node-runtime/theme-U7IGOA7O.js +68 -0
  408. package/dist/node-runtime/trust-manager-MMISNCYO.js +17 -0
  409. package/dist/node-runtime/{update-cli-XTZMZGOL.js → update-cli-4TP25CNW.js} +7 -2
  410. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  411. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-OOZHR7SU.js} +2 -2
  412. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-FNPAUNHU.js} +6 -6
  413. package/docs/browser.md +86 -0
  414. package/docs/extensions.md +2 -0
  415. package/docs/features.md +94 -16
  416. package/docs/interactive-startup.md +2 -1
  417. package/docs/sessions.md +10 -0
  418. package/docs/settings.md +1 -0
  419. package/docs/tui.md +2 -0
  420. package/docs/usage.md +16 -0
  421. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  422. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  423. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  424. package/examples/extensions/gondolin/package-lock.json +2 -2
  425. package/examples/extensions/gondolin/package.json +1 -1
  426. package/examples/extensions/sandbox/package-lock.json +2 -2
  427. package/examples/extensions/sandbox/package.json +1 -1
  428. package/examples/extensions/with-deps/package-lock.json +2 -2
  429. package/examples/extensions/with-deps/package.json +1 -1
  430. package/package.json +7 -4
  431. package/scripts/install-browser.mjs +20 -0
  432. package/dist/node-runtime/agent-session-services-C743TYQE.js +0 -37
  433. package/dist/node-runtime/chunk-VGYZ3APQ.js +0 -59
  434. package/dist/node-runtime/command-P4NYCJ2M.js +0 -13
  435. package/dist/node-runtime/interactive-mode-EVVBA64D.js +0 -59
  436. package/dist/node-runtime/{chunk-UWQYRSYQ.js → chunk-YJMMG7C6.js} +25 -25
  437. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  438. package/dist/node-runtime/{src-BPQFJR76.js → src-IVPNZ2BX.js} +9 -9
@@ -27,6 +27,8 @@ import {
27
27
  SUBAGENT_PARENT_SESSION_ENV,
28
28
  SUBAGENT_RESULT_INTERCOM_EVENT,
29
29
  SUBAGENT_STEERING_NOTICE_EVENT,
30
+ SUPERVISOR_PROGRESS_TYPE,
31
+ SUPERVISOR_REQUEST_TYPE,
30
32
  TEMP_ROOT_DIR,
31
33
  WIDGET_KEY,
32
34
  assertJsonSchemaObject,
@@ -45,7 +47,6 @@ import {
45
47
  formatAsyncRunProgressLabel,
46
48
  formatAsyncRunTranscript,
47
49
  formatCompactModelBadge,
48
- formatControlNoticeMessage,
49
50
  formatDuration,
50
51
  formatModelSelection,
51
52
  formatNestedAggregate,
@@ -61,10 +62,12 @@ import {
61
62
  handleSubagentControlNotice,
62
63
  hasLiveNestedDescendants,
63
64
  isAsyncSubagentExecution,
65
+ legacySupervisorBody,
64
66
  listAsyncRuns,
65
67
  normalizeAsyncLaunchConfig,
66
68
  normalizeParallelGroups,
67
69
  projectNestedRegistryForRoot,
70
+ readCommunication,
68
71
  readStatus,
69
72
  readSteerCapability,
70
73
  reconcileAsyncRun,
@@ -72,6 +75,7 @@ import {
72
75
  registerMainWatchdog,
73
76
  requestAsyncSteer,
74
77
  resolveAsyncRunLocation,
78
+ resolveCommunicationPeer,
75
79
  resolveCurrentSessionId,
76
80
  resolveSubagentRequestParams,
77
81
  resolveSubagentResultStatus,
@@ -82,6 +86,7 @@ import {
82
86
  sanitizeChildDescription,
83
87
  sanitizeSummary,
84
88
  shortenPath,
89
+ stopRequestPath,
85
90
  subagentLaunchRunsAsync,
86
91
  summarizeAsyncStatus,
87
92
  updateAsyncJobNestedProjection,
@@ -89,30 +94,36 @@ import {
89
94
  validateExecutionAcceptance,
90
95
  validateToolBudgetConfig,
91
96
  writeAtomicJson
92
- } from "./chunk-SY2TFMLO.js";
97
+ } from "./chunk-QDGKKKUM.js";
93
98
  import {
94
- createSubagentCancellation,
95
- getSubagentSpinnerDefinition,
96
- registerSubagentCancellation
97
- } from "./chunk-A3KMVBZV.js";
99
+ formatControlNoticeMessage
100
+ } from "./chunk-OAR4TYZE.js";
101
+ import {
102
+ getSubagentSpinnerDefinition
103
+ } from "./chunk-US544NN6.js";
98
104
  import "./chunk-5ZH3ZFIZ.js";
99
- import "./chunk-25I2BHAA.js";
100
- import "./chunk-WKDK4C5P.js";
105
+ import "./chunk-CSUZVNYE.js";
106
+ import "./chunk-VSSXXL36.js";
101
107
  import "./chunk-53YJI7JU.js";
102
- import "./chunk-KBKMCJDU.js";
103
- import "./chunk-CSFI6YXL.js";
104
- import "./chunk-LISUTZS3.js";
105
- import "./chunk-FVDOXRUD.js";
108
+ import "./chunk-5ZQXRPMC.js";
106
109
  import "./chunk-AD6VXAO7.js";
107
- import "./chunk-6N22HULO.js";
110
+ import "./chunk-LISUTZS3.js";
111
+ import {
112
+ createSubagentCancellation,
113
+ registerSubagentCancellation
114
+ } from "./chunk-BBUVIEZB.js";
115
+ import "./chunk-5D7LC2ZQ.js";
108
116
  import "./chunk-M3LZLQW2.js";
117
+ import "./chunk-KKUTQQV7.js";
118
+ import "./chunk-CSFI6YXL.js";
119
+ import "./chunk-FVDOXRUD.js";
109
120
  import "./chunk-RQ2Q5IYR.js";
110
121
  import {
111
122
  keyText
112
- } from "./chunk-DDWHZ633.js";
123
+ } from "./chunk-GNN7H3B7.js";
113
124
  import {
114
125
  getMarkdownTheme
115
- } from "./chunk-RNBHABBA.js";
126
+ } from "./chunk-7QWNYZDI.js";
116
127
  import "./chunk-FQMM2EZ2.js";
117
128
  import "./chunk-Q4Q6D4IY.js";
118
129
  import "./chunk-BRJX2PRC.js";
@@ -122,7 +133,7 @@ import { randomUUID as randomUUID4 } from "node:crypto";
122
133
  import * as fs10 from "node:fs";
123
134
  import * as os from "node:os";
124
135
  import * as path12 from "node:path";
125
- import { Box, Container as Container2, Spacer as Spacer2, Text as Text2, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth3, wrapTextWithAnsi as wrapTextWithAnsi2 } from "@ashx-j/lunr-tui";
136
+ import { Box as Box2, Container as Container3, Spacer as Spacer2, Text as Text3, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth3, wrapTextWithAnsi as wrapTextWithAnsi2 } from "@ashx-j/lunr-tui";
126
137
 
127
138
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/tui/render.js
128
139
  import { Container, Markdown, Spacer, Text, visibleWidth } from "@ashx-j/lunr-tui";
@@ -4467,6 +4478,7 @@ function parseQuestionRecord(raw) {
4467
4478
  runId: input.runId.trim(),
4468
4479
  childIndex,
4469
4480
  childId: input.childId.trim(),
4481
+ ...typeof input.childDescription == "string" && input.childDescription.trim() ? { childDescription: input.childDescription.trim() } : {},
4470
4482
  parentSessionId: input.parentSessionId.trim(),
4471
4483
  parentGeneration,
4472
4484
  ...incarnation ? { childIncarnation: incarnation } : {}
@@ -4575,6 +4587,7 @@ function createSupervisorQuestion(input) {
4575
4587
  runId: input.runId,
4576
4588
  childIndex: input.childIndex,
4577
4589
  childId: input.childId,
4590
+ ...input.childDescription ? { childDescription: input.childDescription } : {},
4578
4591
  parentSessionId: input.parentSessionId,
4579
4592
  parentGeneration: input.parentGeneration,
4580
4593
  ...input.childIncarnation ? { childIncarnation: input.childIncarnation } : {}
@@ -4640,8 +4653,7 @@ function formatParentQuestionForChild(question) {
4640
4653
  function formatSupervisorQuestionAnswer(question) {
4641
4654
  let state = supervisorQuestionPublicState(question), lines = [
4642
4655
  state === "answered" ? `Subagent answer (${question.id})` : `Subagent question ${state} (${question.id})`,
4643
- `Run: ${question.runId}`,
4644
- `Child: ${question.childId} [#${question.childIndex}]`,
4656
+ `From: ${question.childDescription ?? `Subagent ${question.childIndex + 1}`}`,
4645
4657
  `Decision: ${question.reason}`
4646
4658
  ];
4647
4659
  return state === "answered" && question.answer?.trim() ? lines.push("", question.answer.trim()) : question.cancelReason && lines.push("", question.cancelReason), lines.join(`
@@ -4798,8 +4810,9 @@ function askRunningAsyncChild(input) {
4798
4810
  let capability = readSteerCapability(resolved.location.asyncDir, child.index);
4799
4811
  if (!capability?.supported)
4800
4812
  throw new Error("This child is not ready to receive questions. Continue other work until it is ready; no question was queued.");
4801
- let incarnation = { pid: capability.pid, readyAt: capability.readyAt }, question = createSupervisorQuestion({
4813
+ let incarnation = { pid: capability.pid, readyAt: capability.readyAt }, step = status.steps?.[child.index], childDescription = resolveCommunicationPeer(input.state, status.runId, child.index, child.childId, step?.description ?? child.agent), question = createSupervisorQuestion({
4802
4814
  channelDir,
4815
+ childDescription,
4803
4816
  reason,
4804
4817
  message,
4805
4818
  runId: status.runId,
@@ -4829,12 +4842,50 @@ function askRunningAsyncChild(input) {
4829
4842
  runId: status.runId,
4830
4843
  childIndex: child.index,
4831
4844
  childId: child.childId,
4845
+ communication: { direction: "to", peer: childDescription, message, kind: "question" },
4832
4846
  delivered: !1,
4833
4847
  answered: !1
4834
4848
  }
4835
4849
  };
4836
4850
  }
4837
4851
 
4852
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/tui/communication.js
4853
+ import { Box, Container as Container2, Text as Text2 } from "@ashx-j/lunr-tui";
4854
+ function renderCommunicationBody(communication, theme) {
4855
+ let direction = communication.direction === "from" ? "From" : "To";
4856
+ return new Text2(`${theme.fg("muted", `${direction}: ${communication.peer}`)}
4857
+
4858
+ ${communication.message}`, 0, 0);
4859
+ }
4860
+ function renderCommunicationCard(communication, expanded, theme) {
4861
+ let box = new Box(1, 1, (text) => theme.bg("toolSuccessBg", text));
4862
+ return box.addChild(new Text2(theme.fg("toolTitle", theme.bold(`\u25CF subagent ${communication.kind}`)), 0, 0)), expanded && box.addChild(renderCommunicationBody(communication, theme)), box;
4863
+ }
4864
+ function renderCommunicationCall(name, args, theme, context, communication) {
4865
+ let container = new Container2(), details = context?.result?.details, saved = readCommunication(details?.communication) ?? communication, action = args.action ?? (args.reason === "need_decision" ? "request" : args.reason === "interview_request" ? "interview" : args.reason === "progress_update" ? "progress" : args.reason);
4866
+ return container.addChild(new Text2(theme.fg("toolTitle", theme.bold(`${name}${action ? ` ${action}` : ""}`)), 0, 0)), context?.expanded && saved && container.addChild(renderCommunicationBody(saved, theme)), container;
4867
+ }
4868
+ function renderCommunicationResult(content, details, expanded, isError, theme) {
4869
+ let container = new Container2();
4870
+ if (!expanded)
4871
+ return container;
4872
+ if (isError)
4873
+ container.addChild(new Text2(theme.fg("error", content.filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
4874
+ `)), 0, 0));
4875
+ else {
4876
+ let saved = details;
4877
+ saved?.response ? container.addChild(new Text2(`
4878
+ ${theme.fg("muted", "From: Supervisor")}
4879
+
4880
+ ${saved.response}`, 0, 0)) : saved?.steering?.state ? container.addChild(new Text2(`
4881
+ Delivery: ${saved.steering.state === "recovered" ? "recovered; replacement launched" : saved.steering.state}`, 0, 0)) : saved?.asyncId && saved.communication ? container.addChild(new Text2(`
4882
+ Continuation launched.`, 0, 0)) : saved?.state && saved.communication ? container.addChild(new Text2(`
4883
+ ${saved.state === "pending" ? "Question queued; awaiting an answer." : saved.state}`, 0, 0)) : saved?.communication || container.addChild(new Text2(content.filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
4884
+ `), 0, 0));
4885
+ }
4886
+ return container;
4887
+ }
4888
+
4838
4889
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js
4839
4890
  var REQUESTS_DIR = "requests", REPLIES_DIR = "replies", NATIVE_SUPERVISOR_TOOL_NAME = "subagent_supervisor";
4840
4891
  var MAX_MESSAGE_BYTES2 = 64 * 1024, DEFAULT_ASK_TIMEOUT_MS2 = 600 * 1e3, CHANNEL_POLL_MS = Math.min(POLL_INTERVAL_MS, 500), STALE_EMPTY_CHANNEL_AGE_MS = 60 * 1e3, STALE_EMPTY_CHANNEL_CLEANUP_INTERVAL_MS = 60 * 1e3, PARENT_ASK_DESCRIPTION = [
@@ -4846,11 +4897,13 @@ var MAX_MESSAGE_BYTES2 = 64 * 1024, DEFAULT_ASK_TIMEOUT_MS2 = 600 * 1e3, CHANNEL
4846
4897
  "Use pending or list to find child requests awaiting your reply; status reports channel availability. Free-form send is unsupported. Asking never revives a child or changes its assignment.",
4847
4898
  'Reply: { action: "reply", replyTo: "<requestId>", message: "..." }'
4848
4899
  ].join(" "), CHILD_CONTACT_DESCRIPTION = [
4849
- "Contact the parent/supervisor session for a blocking decision, structured interview, progress update, or reply to a parent question.",
4900
+ "Contact the supervisor for decisions outside your assigned authority, safety concerns, or blockers. Make reversible implementation choices within your scope yourself.",
4901
+ "need_decision/interview_request wait for a reply: state the blocked decision, evidence, and recommended choice. Consolidate related questions; continue independent work before opening a blocking request.",
4902
+ "Return one self-contained final report with outcomes, verification, blockers, and artifact paths; the runtime delivers it. Routine work already appears in activity indicators.",
4850
4903
  "For parent questions use action='reply' with replyTo set to the question id. Answer from current findings and uncertainty; do not start extra investigation just to reply. Continue the assigned task after replying.",
4851
4904
  "Do not open a blocking need_decision while a parent question is already outstanding for this child."
4852
4905
  ].join(" "), ContactSupervisorParamsSchema = Type2.Object({
4853
- reason: Type2.Optional(Type2.String({ enum: ["need_decision", "interview_request", "progress_update"] })),
4906
+ reason: Type2.Optional(Type2.String({ enum: ["need_decision", "interview_request", "progress_update", "handoff"] })),
4854
4907
  message: Type2.Optional(Type2.String()),
4855
4908
  interview: Type2.Optional(Type2.Unsafe({ type: "object", additionalProperties: !0 })),
4856
4909
  action: Type2.Optional(Type2.String({ enum: ["reply"] })),
@@ -4874,6 +4927,40 @@ function safeSegment2(value) {
4874
4927
  function replyPath(channelDir, requestId) {
4875
4928
  return path8.join(channelDir, REPLIES_DIR, `${safeSegment2(requestId)}.json`);
4876
4929
  }
4930
+ function communicationKind(reason) {
4931
+ return reason === "progress_update" ? "progress" : reason === "handoff" ? "handoff" : reason === "interview_request" ? "interview" : "request";
4932
+ }
4933
+ function communicationBody(message, interview, protocolVersion) {
4934
+ let body = protocolVersion === 2 ? message : legacySupervisorBody(message);
4935
+ return interview !== void 0 && protocolVersion === 2 ? `${body}
4936
+
4937
+ ${JSON.stringify(interview, null, 2)}` : body;
4938
+ }
4939
+ function requestCommunication(request, state) {
4940
+ return {
4941
+ direction: "from",
4942
+ peer: resolveCommunicationPeer(state, request.runId, request.childIndex, request.agent, request.description),
4943
+ message: communicationBody(request.message, request.interview, request.protocolVersion),
4944
+ kind: communicationKind(request.reason)
4945
+ };
4946
+ }
4947
+ function registerSupervisorRenderers(pi, state) {
4948
+ for (let customType of [SUPERVISOR_REQUEST_TYPE, SUBAGENT_SUPERVISOR_ANSWER_TYPE])
4949
+ pi.registerMessageRenderer(customType, (message, options, theme) => {
4950
+ let details = message.details, communication = readCommunication(details?.communication) ?? {
4951
+ direction: "from",
4952
+ peer: details?.runId ? resolveCommunicationPeer(state, details.runId, details.childIndex ?? 0, details.childId ?? details.agent) : "Subagent",
4953
+ message: legacySupervisorBody(typeof message.content == "string" ? message.content : message.content.filter((part) => part.type === "text").map((part) => part.text).join(`
4954
+ `)),
4955
+ kind: customType === SUBAGENT_SUPERVISOR_ANSWER_TYPE ? "answer" : communicationKind(details?.reason)
4956
+ };
4957
+ return renderCommunicationCard(communication, options.expanded, theme);
4958
+ });
4959
+ pi.registerEntryRenderer(SUPERVISOR_PROGRESS_TYPE, (entry, options, theme) => {
4960
+ let communication = readCommunication(entry.data?.communication);
4961
+ return communication ? renderCommunicationCard(communication, options.expanded, theme) : void 0;
4962
+ });
4963
+ }
4877
4964
  function askTimeoutMs2() {
4878
4965
  let parsed = Number(process.env.PI_INTERCOM_ASK_TIMEOUT_MS);
4879
4966
  return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_ASK_TIMEOUT_MS2;
@@ -4888,7 +4975,7 @@ function hasTool(pi, name) {
4888
4975
  function parseRequestFile(file, channelDir) {
4889
4976
  try {
4890
4977
  let parsed = JSON.parse(fs7.readFileSync(file, "utf-8"));
4891
- return parsed.type !== "subagent.supervisor.request" || parsed.supervisorSessionId !== void 0 && (typeof parsed.supervisorSessionId != "string" || !parsed.supervisorSessionId.trim()) || typeof parsed.id != "string" || !parsed.id || parsed.reason !== "need_decision" && parsed.reason !== "interview_request" && parsed.reason !== "progress_update" || typeof parsed.message != "string" || !parsed.message || typeof parsed.runId != "string" || typeof parsed.agent != "string" || typeof parsed.childIndex != "number" ? void 0 : { ...parsed, channelDir, requestFile: file };
4978
+ return parsed.type !== "subagent.supervisor.request" || parsed.supervisorSessionId !== void 0 && (typeof parsed.supervisorSessionId != "string" || !parsed.supervisorSessionId.trim()) || typeof parsed.id != "string" || !parsed.id || parsed.reason !== "need_decision" && parsed.reason !== "interview_request" && parsed.reason !== "progress_update" && parsed.reason !== "handoff" || parsed.protocolVersion !== void 0 && parsed.protocolVersion !== 2 || parsed.protocolVersion === 2 && parsed.expectsReply !== (parsed.reason === "need_decision" || parsed.reason === "interview_request") || parsed.reason === "handoff" && parsed.protocolVersion !== 2 || parsed.description !== void 0 && typeof parsed.description != "string" || typeof parsed.message != "string" || !parsed.message || typeof parsed.runId != "string" || typeof parsed.agent != "string" || typeof parsed.childIndex != "number" ? void 0 : { ...parsed, channelDir, requestFile: file };
4892
4979
  } catch {
4893
4980
  return;
4894
4981
  }
@@ -5014,22 +5101,26 @@ function requestExpiresAt(request, now) {
5014
5101
  let expiresAt = request.expiresAt;
5015
5102
  return typeof expiresAt == "number" && Number.isFinite(expiresAt) ? expiresAt : Number.isFinite(request.createdAt) ? request.createdAt + askTimeoutMs2() : now;
5016
5103
  }
5017
- function requestRunInactive(request, state) {
5104
+ function requestRunState(request, state) {
5018
5105
  if (state.foregroundControls.has(request.runId))
5019
- return !1;
5106
+ return "active";
5020
5107
  let foregroundRun = state.foregroundRuns?.get(request.runId), foregroundChild = foregroundRun?.children.find((child) => child.index === request.childIndex && child.agent === request.agent) ?? foregroundRun?.children[request.childIndex];
5021
5108
  if (foregroundChild)
5022
- return foregroundChild.status !== "detached";
5023
- let asyncJob = state.asyncJobs.get(request.runId);
5024
- if (!asyncJob)
5025
- return !1;
5026
- if (asyncJob.status === "complete" || asyncJob.status === "failed" || asyncJob.status === "paused")
5027
- return !0;
5028
- let stepStatus = asyncJob.steps?.[request.childIndex]?.status;
5029
- return stepStatus === "complete" || stepStatus === "completed" || stepStatus === "failed" || stepStatus === "paused";
5109
+ return foregroundChild.status === "stopped" ? "stopped" : foregroundChild.status === "detached" ? "active" : "inactive";
5110
+ let job = state.asyncJobs.get(request.runId) ?? state.fleetJobs?.get(request.runId), asyncDir = job?.asyncDir ?? path8.join(ASYNC_DIR, safeSegment2(request.runId)), status = readStatus(asyncDir), runStatus = status?.state ?? job?.status, stepStatus = (status?.steps ?? job?.steps)?.[request.childIndex]?.status;
5111
+ return fs7.existsSync(stopRequestPath(asyncDir)) || runStatus === "stopped" || job?.status === "stopped" || status?.stopped || stepStatus === "stopped" ? "stopped" : ["complete", "failed", "paused"].includes(runStatus ?? "") || ["complete", "completed", "failed", "paused"].includes(stepStatus ?? "") ? "inactive" : "active";
5030
5112
  }
5031
5113
  function requestLifecycle(request, state, ctx, now) {
5032
- return ctx && !requestMatchesContext(request, state, ctx) ? "wrong-session" : fs7.existsSync(request.requestFile) ? request.expectsReply && fs7.existsSync(replyPath(request.channelDir, request.id)) ? "resolved" : request.expectsReply && now > requestExpiresAt(request, now) ? "expired" : request.expectsReply && requestRunInactive(request, state) ? "inactive" : "pending" : "missing";
5114
+ if (ctx && !requestMatchesContext(request, state, ctx))
5115
+ return "wrong-session";
5116
+ if (!fs7.existsSync(request.requestFile))
5117
+ return "missing";
5118
+ if (request.expectsReply && fs7.existsSync(replyPath(request.channelDir, request.id)))
5119
+ return "resolved";
5120
+ if (request.expectsReply && now > requestExpiresAt(request, now))
5121
+ return "expired";
5122
+ let runState = requestRunState(request, state);
5123
+ return runState === "stopped" || request.expectsReply && runState === "inactive" ? "inactive" : "pending";
5033
5124
  }
5034
5125
  function cleanupRequestLifecycle(request, lifecycle) {
5035
5126
  (lifecycle === "resolved" || lifecycle === "expired" || lifecycle === "inactive") && removeRequestFile(request.requestFile);
@@ -5045,9 +5136,9 @@ function formatPendingLine(request) {
5045
5136
  let replyHint = request.expectsReply ? ` Reply: ${NATIVE_SUPERVISOR_TOOL_NAME}({ action: "reply", replyTo: "${request.id}", message: "..." })` : "";
5046
5137
  return `- ${request.id}: ${request.agent} [${request.runId}#${request.childIndex}] ${request.reason}.${replyHint}`;
5047
5138
  }
5048
- function requestVisibleText(request) {
5049
- let lines = [request.message];
5050
- return request.expectsReply && lines.push("", `Reply with: ${NATIVE_SUPERVISOR_TOOL_NAME}({ action: "reply", replyTo: "${request.id}", message: "..." })`), lines.join(`
5139
+ function requestVisibleText(request, communication) {
5140
+ let lines = [`From: ${communication.peer}`, "", communication.message];
5141
+ return request.reason === "interview_request" && lines.push("", "Reply with JSON matching the requested interview shape."), request.expectsReply && lines.push("", `Reply with: ${NATIVE_SUPERVISOR_TOOL_NAME}({ action: "reply", replyTo: "${request.id}", message: "..." })`), lines.join(`
5051
5142
  `);
5052
5143
  }
5053
5144
  function writeReply(request, message) {
@@ -5096,6 +5187,13 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
5096
5187
  label: name === "intercom" ? "Intercom" : "Subagent Supervisor",
5097
5188
  description: PARENT_ASK_DESCRIPTION,
5098
5189
  parameters: ParentSupervisorParamsSchema,
5190
+ renderCall(args, theme, context) {
5191
+ let request = args.action === "reply" ? pending.get(args.replyTo) : void 0, peer = request ? requestCommunication(request, state).peer : args.id ? resolveCommunicationPeer(state, args.id, args.index ?? 0, args.childId) : "Subagent";
5192
+ return renderCommunicationCall(name, args, theme, context, args.message ? { direction: "to", peer, message: args.message, kind: args.action === "ask" ? "question" : "reply" } : void 0);
5193
+ },
5194
+ renderResult(result2, options, theme, context) {
5195
+ return renderCommunicationResult(result2.content, result2.details, options.expanded, context.isError, theme);
5196
+ },
5099
5197
  async execute(_id, params) {
5100
5198
  refreshPendingRequests(pending, state, state.lastUiContext ?? void 0);
5101
5199
  let input = params;
@@ -5108,7 +5206,7 @@ function buildParentIntercomTool(pending, state, name = "intercom") {
5108
5206
  }
5109
5207
  if (input.action === "reply") {
5110
5208
  let request = resolvePendingRequest(pending, input);
5111
- return writeReply(request, input.message ?? ""), pending.delete(request.id), { content: [{ type: "text", text: `Replied to supervisor request ${request.id}.` }], details: { replyTo: request.id, runId: request.runId, agent: request.agent } };
5209
+ return writeReply(request, input.message ?? ""), pending.delete(request.id), { content: [{ type: "text", text: `Replied to ${requestCommunication(request, state).peer}.` }], details: { replyTo: request.id, runId: request.runId, agent: request.agent, communication: { ...requestCommunication(request, state), direction: "to", kind: "reply", message: input.message } } };
5112
5210
  }
5113
5211
  if (input.action === "ask")
5114
5212
  return askRunningAsyncChild({
@@ -5130,29 +5228,30 @@ function questionMatchesParentContext(question, state, ctx) {
5130
5228
  let sessionId = currentSupervisorSessionId(state, ctx);
5131
5229
  return !(!sessionId || question.parentSessionId !== sessionId || (state.sessionGeneration ?? 0) !== question.parentGeneration);
5132
5230
  }
5133
- function notifyQuestionTerminal(pi, question, channelDir) {
5231
+ function notifyQuestionTerminal(pi, question, channelDir, state) {
5134
5232
  if (!supervisorQuestionIsTerminal(question) || question.notifiedAt || (pi.events?.emit(SUBAGENT_QUESTION_EVENT, {
5135
5233
  questionId: question.id,
5136
5234
  state: supervisorQuestionPublicState(question),
5137
5235
  runId: question.runId
5138
5236
  }), isQuestionWaitActive(question.id)) || !claimQuestionNotification(channelDir, question.id))
5139
5237
  return;
5140
- let state = supervisorQuestionPublicState(question);
5238
+ let outcome = supervisorQuestionPublicState(question), communication = { direction: "from", peer: question.childDescription ?? resolveCommunicationPeer(state, question.runId, question.childIndex, question.childId), message: question.answer ?? question.cancelReason ?? outcome, kind: "answer" };
5141
5239
  pi.sendMessage({
5142
5240
  customType: SUBAGENT_SUPERVISOR_ANSWER_TYPE,
5143
5241
  content: formatSupervisorQuestionAnswer(question),
5144
- display: state === "answered",
5242
+ display: outcome === "answered",
5145
5243
  details: {
5146
5244
  questionId: question.id,
5147
- state,
5245
+ state: outcome,
5246
+ communication,
5148
5247
  runId: question.runId,
5149
5248
  childIndex: question.childIndex,
5150
5249
  childId: question.childId,
5151
5250
  reason: question.reason,
5152
- answered: state === "answered",
5251
+ answered: outcome === "answered",
5153
5252
  delivered: !!question.deliveredAt
5154
5253
  }
5155
- }, { triggerTurn: state === "answered" });
5254
+ }, { triggerTurn: outcome === "answered" });
5156
5255
  }
5157
5256
  function pollSupervisorQuestions(pi, state, ctx) {
5158
5257
  for (let channelDir of listSupervisorChannelDirs())
@@ -5160,11 +5259,11 @@ function pollSupervisorQuestions(pi, state, ctx) {
5160
5259
  if (!questionMatchesParentContext(question, state, ctx))
5161
5260
  continue;
5162
5261
  let current = reconcileAsyncQuestion(channelDir, question, state);
5163
- notifyQuestionTerminal(pi, current, channelDir);
5262
+ notifyQuestionTerminal(pi, current, channelDir, state);
5164
5263
  }
5165
5264
  }
5166
5265
  function createNativeSupervisorChannel(pi, state) {
5167
- let pending = /* @__PURE__ */ new Map(), seenFiles = /* @__PURE__ */ new Set(), poller, lastStaleCleanupAt = 0, registerParentTools = () => {
5266
+ let pending = /* @__PURE__ */ new Map(), seenFiles = /* @__PURE__ */ new Set(), deliveredRequests = /* @__PURE__ */ new Set(), poller, lastStaleCleanupAt = 0, registerParentTools = () => {
5168
5267
  hasTool(pi, NATIVE_SUPERVISOR_TOOL_NAME) || pi.registerTool(buildParentIntercomTool(pending, state, NATIVE_SUPERVISOR_TOOL_NAME)), hasTool(pi, "intercom") || pi.registerTool(buildParentIntercomTool(pending, state));
5169
5268
  }, cleanupStaleChannelsIfDue = () => {
5170
5269
  let nowMs = Date.now();
@@ -5205,19 +5304,25 @@ function createNativeSupervisorChannel(pi, state) {
5205
5304
  seenFiles.add(file), cleanupRequestLifecycle(request, lifecycle);
5206
5305
  continue;
5207
5306
  }
5208
- if (seenFiles.add(file), request.expectsReply ? pending.set(request.id, request) : removeRequestFile(request.requestFile), pi.sendMessage({
5209
- customType: "subagent_supervisor_request",
5210
- content: requestVisibleText(request),
5307
+ if (request.expectsReply && pending.set(request.id, request), deliveredRequests.has(request.id)) {
5308
+ seenFiles.add(file);
5309
+ continue;
5310
+ }
5311
+ let communication = requestCommunication(request, state), details = {
5312
+ id: request.id,
5313
+ reason: request.reason,
5314
+ expectsReply: request.expectsReply,
5315
+ runId: request.runId,
5316
+ agent: request.agent,
5317
+ childIndex: request.childIndex,
5318
+ communication
5319
+ };
5320
+ if (request.reason === "progress_update" && request.protocolVersion === 2 ? pi.appendEntry(SUPERVISOR_PROGRESS_TYPE, details) : pi.sendMessage({
5321
+ customType: SUPERVISOR_REQUEST_TYPE,
5322
+ content: requestVisibleText(request, communication),
5211
5323
  display: !0,
5212
- details: {
5213
- id: request.id,
5214
- reason: request.reason,
5215
- expectsReply: request.expectsReply,
5216
- runId: request.runId,
5217
- agent: request.agent,
5218
- childIndex: request.childIndex
5219
- }
5220
- }), request.expectsReply) {
5324
+ details
5325
+ }, { triggerTurn: request.expectsReply || request.reason === "handoff" }), deliveredRequests.add(request.id), seenFiles.add(file), request.expectsReply || removeRequestFile(request.requestFile), request.expectsReply) {
5221
5326
  let job = state.asyncJobs.get(request.runId);
5222
5327
  job && (job.activityState = "needs_attention");
5223
5328
  let events = pi.events;
@@ -5238,10 +5343,17 @@ function createNativeSupervisorChannel(pi, state) {
5238
5343
  };
5239
5344
  return {
5240
5345
  start: () => {
5241
- poller || (registerParentTools(), poll(), poller = setInterval(poll, CHANNEL_POLL_MS), poller.unref?.());
5346
+ if (!poller) {
5347
+ registerParentTools();
5348
+ for (let entry of state.lastUiContext?.sessionManager.getBranch?.() ?? []) {
5349
+ let data = entry.type === "custom_message" && entry.customType === SUPERVISOR_REQUEST_TYPE ? entry.details : entry.type === "custom" && entry.customType === SUPERVISOR_PROGRESS_TYPE ? entry.data : void 0;
5350
+ data && typeof data == "object" && "id" in data && typeof data.id == "string" && deliveredRequests.add(data.id);
5351
+ }
5352
+ poll(), poller = setInterval(poll, CHANNEL_POLL_MS), poller.unref?.();
5353
+ }
5242
5354
  },
5243
5355
  dispose: () => {
5244
- cancelOwnedQuestions("parent supervisor channel disposed"), poller && clearInterval(poller), poller = void 0, pending.clear(), seenFiles.clear();
5356
+ cancelOwnedQuestions("parent supervisor channel disposed"), poller && clearInterval(poller), poller = void 0, pending.clear(), seenFiles.clear(), deliveredRequests.clear();
5245
5357
  },
5246
5358
  pending,
5247
5359
  cancelOwnedQuestions,
@@ -5813,6 +5925,8 @@ async function waitForSubagents(params, signal, deps) {
5813
5925
  ].join(", ");
5814
5926
  if (signal?.aborted)
5815
5927
  return result(`Wait aborted after ${formatDuration(now() - startedAt)}. Still active: ${stillActive}.`, !0);
5928
+ if (deps.shouldYield?.())
5929
+ return result("Wait yielded for pending session messages; background work remains active.");
5816
5930
  if (now() - startedAt >= timeoutMs)
5817
5931
  return result(`Wait timed out after ${formatDuration(timeoutMs)} with ${activeInitialRuns.length} async run(s) and ${activeInitialProviderItems.length} provider item(s) still active: ${stillActive}. The work keeps going; call subagent_wait again or inspect subagent status.`, !0);
5818
5932
  try {
@@ -5888,7 +6002,7 @@ async function drainOutstandingWork(deps) {
5888
6002
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
5889
6003
  throw new Error("Auto-drain timeoutMs must be a positive finite number.");
5890
6004
  let deadlineAt = now() + timeoutMs, hasWork = deps.hasWork ?? hasOutstandingWork, wait = deps.wait ?? waitForSubagents;
5891
- for (; hasWork(sessionId, now()); ) {
6005
+ for (; !deps.hasPendingMessages?.() && hasWork(sessionId, now()); ) {
5892
6006
  let remainingMs = deadlineAt - now();
5893
6007
  if (remainingMs <= 0)
5894
6008
  throw new Error(`Auto-drain timed out after ${timeoutMs}ms with background work still active in session '${sessionId}'.`);
@@ -5897,6 +6011,7 @@ async function drainOutstandingWork(deps) {
5897
6011
  events: deps.events,
5898
6012
  now,
5899
6013
  stopOnAttention: !1,
6014
+ shouldYield: deps.hasPendingMessages,
5900
6015
  failOnFailedRuns: !0
5901
6016
  });
5902
6017
  if (waitResult.isError)
@@ -6186,7 +6301,7 @@ var CUSTOM_TOOL_DESCRIPTION_FILE = "subagent-tool-description.md", CUSTOM_TOOL_D
6186
6301
  \u2022 Choose the lowest tier that can reliably complete the task.
6187
6302
  \u2022 light: Use for simple, straightforward tasks that require little reasoning. Good for quick checks, finding information, collecting facts for research, inspecting a small amount of code, or verifying a specific fact.
6188
6303
  \u2022 standard: Use for moderately difficult work and everyday coding tasks. Good for writing simple code, fixing a clearly described bug, reviewing a focused change, or completing work with clear requirements. Use heavy when the task requires deep architectural understanding or complex reasoning.
6189
- \u2022 heavy: Use for complex or ambiguous tasks that require deep reasoning and strong code understanding. Good for implementing complex plans, debugging difficult or poorly understood problems, reviewing large or high-risk changes, and making architectural decisions.`, SUBAGENT_SAFETY_GUIDANCE = `SAFETY-CRITICAL SUBAGENT GUIDANCE:
6304
+ \u2022 heavy: Use for complex or ambiguous tasks that require deep reasoning and strong code understanding. Good for implementing complex plans, debugging difficult or poorly understood problems, reviewing large or high-risk changes, and making architectural decisions.`, SUBAGENT_COORDINATION_GUIDANCE = "Define file ownership, local decision authority, and required outputs at launch. Establish shared contracts before dependent parallel work; use chains and artifacts to pass results. Native child intercom reaches the supervisor only, not siblings. Reserve parent relays for actionable exceptions, not routine progress or implementation approvals.", SUBAGENT_SAFETY_GUIDANCE = `SAFETY-CRITICAL SUBAGENT GUIDANCE:
6190
6305
  \u2022 Prompt children directly. There is no agent roster. Every execution task needs task (the full child prompt) and description (a concise UI label).
6191
6306
  \u2022 Every executable child chooses exactly one of tier: "light"|"standard"|"heavy" (default) or model: "provider/id" when the user names a model. Do not pass both, and do not use inherit. Missing, disabled, unconfigured, unavailable, or unauthenticated selections fail before launch.
6192
6307
  \u2022 Optional thinking (off/minimal/low/medium/high/xhigh/max) is only valid with an explicit model. Tier launches use the configured tier thinking level.
@@ -6196,6 +6311,7 @@ ${SUBAGENT_TIER_GUIDANCE}
6196
6311
  \u2022 ${SUBAGENT_ASYNC_GUIDANCE}
6197
6312
  \u2022 Child-safety boundary: ordinary children are not orchestrators and must not run subagents. Only explicitly configured fanout children may use the child-safe subagent tool, still bounded by depth/session limits.
6198
6313
  \u2022 Writing/review safety: keep one full-access writer for the same cwd/worktree. Use fresh-context permissions: "read-only" children for independent review, then have the parent synthesize and apply fixes as the sole writer unless an isolated worktree was intentionally requested.
6314
+ \u2022 ${SUBAGENT_COORDINATION_GUIDANCE}
6199
6315
  \u2022 Artifacts/status essentials: chain outputs live under {chain_dir}; async runs expose asyncId/asyncDir with status.json, events.jsonl, output logs, and status via { action: "status", id }. Include output paths and residual risks when reporting results.`, FULL_SUBAGENT_TOOL_DESCRIPTION = `Delegate work to generic children by prompting them directly. There are no named agent types.
6200
6316
 
6201
6317
  EXECUTION (use exactly ONE mode):
@@ -6247,6 +6363,7 @@ EXECUTE:
6247
6363
  \u2022 description is required (single-line, max 80 chars, UI only). task is the full child prompt. permissions omitted = full. Plan-mode parents must pass permissions:"read-only".
6248
6364
  \u2022 Exactly one of tier:"light"|"standard"|"heavy" (default) or model:"provider/id" when the user names a model. thinking only with model. No inherit; fail closed on unavailable selections. Children always start fresh. timeoutMs/maxRuntimeMs apply to foreground and async/background runs.
6249
6365
  ${SUBAGENT_TIER_GUIDANCE}
6366
+ \u2022 ${SUBAGENT_COORDINATION_GUIDANCE}
6250
6367
  \u2022 Chain templates may use {task}, {previous}, {chain_dir}, and named outputs. Parallel worktree isolation requires a clean git repo.
6251
6368
  \u2022 Chain example: { chain: [{task:"Analyze {task}", description:"Analyze request", tier:"standard"}, {parallel: [{task:"Check {previous}", description:"Check prior result", tier:"light", permissions:"read-only", count: 3}]}] }
6252
6369
 
@@ -6419,20 +6536,20 @@ function resolveSubagentActionDisplayTitle(args, state) {
6419
6536
  function renderSubagentCall(rawArgs, theme, context, options) {
6420
6537
  let args = resolveSubagentRequestParams(rawArgs);
6421
6538
  if (args.action) {
6422
- let target = context?.result?.details?.displayTitle || options?.resolveActionTitle?.(args) || args.id || args.runId || "";
6423
- return new Text2(`${theme.fg("toolTitle", theme.bold("subagent "))}${args.action}${target ? ` ${theme.fg("accent", target)}` : ""}`, 0, 0);
6539
+ let resolvedTitle = context?.result?.details?.displayTitle || options?.resolveActionTitle?.(args), target = resolvedTitle || args.id || args.runId || "";
6540
+ return (args.action === "steer" || args.action === "resume") && args.message ? renderCommunicationCall("subagent", args, theme, context, { direction: "to", peer: resolvedTitle || "Subagent", kind: "steer", message: args.message }) : new Text3(`${theme.fg("toolTitle", theme.bold("subagent "))}${args.action}${target ? ` ${theme.fg("accent", target)}` : ""}`, 0, 0);
6424
6541
  }
6425
6542
  let isParallel = (args.tasks?.length ?? 0) > 0, parallelCount = effectiveParallelTaskCount(args.tasks), asyncMark = subagentLaunchRunsAsync(args) ? `${theme.fg("warning", "async")} ` : "";
6426
6543
  if (args.chain?.length)
6427
- return new Text2(`${theme.fg("toolTitle", theme.bold("subagent "))}${asyncMark}chain (${args.chain.length})`, 0, 0);
6544
+ return new Text3(`${theme.fg("toolTitle", theme.bold("subagent "))}${asyncMark}chain (${args.chain.length})`, 0, 0);
6428
6545
  if (isParallel)
6429
- return new Text2(`${theme.fg("toolTitle", theme.bold("subagent "))}${asyncMark}parallel (${parallelCount})`, 0, 0);
6546
+ return new Text3(`${theme.fg("toolTitle", theme.bold("subagent "))}${asyncMark}parallel (${parallelCount})`, 0, 0);
6430
6547
  let description = !context?.result && !context?.isPartial && !context?.expanded && !context?.isError ? theme.fg("accent", args.description || args.task || "?") : "", title = theme.fg("toolTitle", theme.bold("subagent")), rest = [asyncMark.trim() ? theme.fg("warning", "async") : "", description].filter(Boolean).join(" ");
6431
- return new Text2(rest ? `${title} ${rest}` : title, 0, 0);
6548
+ return new Text3(rest ? `${title} ${rest}` : title, 0, 0);
6432
6549
  }
6433
6550
  function renderSubagentNotify(details, theme) {
6434
6551
  let status = typeof details?.status == "string" ? details.status : "", icon = status === "completed" ? theme.fg("success", "\u2713") : status === "failed" ? theme.fg("error", "\u2717") : theme.fg("warning", "\u25A0"), title = details?.agent || "child";
6435
- return new Text2(`${icon} ${theme.bold(title)} ${theme.fg("dim", status)}`, 0, 0);
6552
+ return new Text3(`${icon} ${theme.bold(title)} ${theme.fg("dim", status)}`, 0, 0);
6436
6553
  }
6437
6554
  function ensureSubagentResultAnimation(context) {
6438
6555
  let state = context.state;
@@ -6459,14 +6576,14 @@ function isStaleExtensionContextError(error) {
6459
6576
  }
6460
6577
  function rebuildSlashResultContainer(container, result2, options, theme) {
6461
6578
  container.clear(), container.addChild(new Spacer2(1));
6462
- let boxTheme = isSlashResultRunning(result2) ? "toolPendingBg" : isSlashResultError(result2) ? "toolErrorBg" : "toolSuccessBg", box = new Box(1, 1, (text) => theme.bg(boxTheme, text));
6579
+ let boxTheme = isSlashResultRunning(result2) ? "toolPendingBg" : isSlashResultError(result2) ? "toolErrorBg" : "toolSuccessBg", box = new Box2(1, 1, (text) => theme.bg(boxTheme, text));
6463
6580
  box.addChild(renderSubagentResult(result2, options, theme)), container.addChild(box);
6464
6581
  }
6465
6582
  function createSlashResultComponent(details, options, theme) {
6466
- let container = new Container2(), lastVersion = -1;
6583
+ let container = new Container3(), lastVersion = -1;
6467
6584
  return container.render = (width) => {
6468
6585
  let snapshot = getSlashRenderableSnapshot(details);
6469
- return (snapshot.version !== lastVersion || isSlashResultRunning(snapshot.result)) && (lastVersion = snapshot.version, rebuildSlashResultContainer(container, snapshot.result, options, theme)), Container2.prototype.render.call(container, width);
6586
+ return (snapshot.version !== lastVersion || isSlashResultRunning(snapshot.result)) && (lastVersion = snapshot.version, rebuildSlashResultContainer(container, snapshot.result, options, theme)), Container3.prototype.render.call(container, width);
6470
6587
  }, container;
6471
6588
  }
6472
6589
  function registerSubagentExtension(pi) {
@@ -6534,7 +6651,7 @@ function registerSubagentExtension(pi) {
6534
6651
  try {
6535
6652
  let currentGeneration = generation;
6536
6653
  if (signal?.throwIfAborted(), !executorPromise) {
6537
- let pending = import("./subagent-executor-MH4A7CCF.js").then(({ createSubagentExecutor }) => {
6654
+ let pending = import("./subagent-executor-MLUMBWCP.js").then(({ createSubagentExecutor }) => {
6538
6655
  if (generation !== currentGeneration)
6539
6656
  throw new Error("Subagent session changed before initialization");
6540
6657
  return createSubagentExecutor({
@@ -6563,27 +6680,31 @@ function registerSubagentExtension(pi) {
6563
6680
  }
6564
6681
  }
6565
6682
  };
6566
- executorExecute = executor.execute, pi.registerMessageRenderer(SLASH_RESULT_TYPE, (message, options, theme) => {
6683
+ executorExecute = executor.execute, registerSupervisorRenderers(pi, state), pi.registerMessageRenderer(SLASH_RESULT_TYPE, (message, options, theme) => {
6567
6684
  let details = resolveSlashMessageDetails(message.details);
6568
6685
  if (details)
6569
6686
  return createSlashResultComponent(details, options, theme);
6570
6687
  }), pi.registerMessageRenderer(SLASH_TEXT_RESULT_TYPE, (message, _options, _theme) => {
6571
6688
  let content = typeof message.content == "string" ? message.content : message.content.filter((entry) => entry.type === "text").map((entry) => entry.text).join(`
6572
6689
  `);
6573
- return new Text2(content, 0, 0);
6690
+ return new Text3(content, 0, 0);
6574
6691
  }), pi.registerMessageRenderer("subagent-notify", (message, _options, theme) => {
6575
6692
  let content = typeof message.content == "string" ? message.content : "", details = message.details ?? parseSubagentNotifyContent(content);
6576
- return details ? renderSubagentNotify(details, theme) : new Text2(content, 0, 0);
6693
+ return details ? renderSubagentNotify(details, theme) : new Text3(content, 0, 0);
6577
6694
  }), pi.registerMessageRenderer(SUBAGENT_STEERING_MESSAGE_TYPE, (message, _options, theme) => {
6578
6695
  let details = message.details;
6579
6696
  if (details)
6580
- return new Text2(theme.fg(details.state === "recovered" ? "warning" : "error", formatSteeringNotice(details)), 0, 0);
6697
+ return new Text3(theme.fg(details.state === "recovered" ? "warning" : "error", formatSteeringNotice(details)), 0, 0);
6581
6698
  }), pi.registerMessageRenderer(SUBAGENT_CONTROL_MESSAGE_TYPE, () => {
6582
6699
  });
6583
6700
  let executeSubagentCollapsed = async (id, params, signal, onUpdate, ctx) => {
6584
6701
  ctx.hasUI && ctx.ui.setToolsExpanded(!1);
6585
- let displayTitle = params.action === "steer" ? resolveSubagentActionDisplayTitle(params, state) : void 0, result2 = await executor.execute(id, params, signal, onUpdate, ctx);
6586
- return displayTitle && result2.details && (result2.details.displayTitle = displayTitle), result2;
6702
+ let isCommunication = (params.action === "steer" || params.action === "resume") && typeof params.message == "string", displayTitle = isCommunication ? resolveSubagentActionDisplayTitle(params, state) : void 0, jobs = isCommunication ? matchingActionJobs(state, (params.id || params.runId || "").trim()) : [], targetNames = new Map(jobs.length === 1 ? jobs[0].steps?.map((step, index) => [step.index ?? index, childRowLabel(step)]) : []), result2 = await executor.execute(id, params, signal, onUpdate, ctx);
6703
+ if (displayTitle && result2.details && (result2.details.displayTitle = displayTitle), isCommunication && result2.details) {
6704
+ let targets = result2.details.steering?.targets.map((target) => targetNames.get(target.index) ?? `Subagent ${target.index + 1}`), peer = targets?.length ? targets.join(", ") : displayTitle || "Subagent";
6705
+ result2.details.communication = { direction: "to", peer, kind: "steer", message: params.message };
6706
+ }
6707
+ return result2;
6587
6708
  }, slashBridge = registerSlashSubagentBridge({
6588
6709
  events: pi.events,
6589
6710
  getContext: () => state.lastUiContext,
@@ -6613,6 +6734,8 @@ function registerSubagentExtension(pi) {
6613
6734
  resolveActionTitle: (params) => resolveSubagentActionDisplayTitle(params, state)
6614
6735
  }),
6615
6736
  renderResult(result2, options, theme, context) {
6737
+ if (result2.details?.communication)
6738
+ return renderCommunicationResult(result2.content, result2.details, options.expanded, context.isError, theme);
6616
6739
  subagentResultIsRunning(result2) ? ensureSubagentResultAnimation(context) : clearLegacyResultAnimationTimer(context);
6617
6740
  let state2 = context.state, entries = [];
6618
6741
  state2.animEntries = entries, subagentAnimSink.current = entries;
@@ -6630,7 +6753,7 @@ function registerSubagentExtension(pi) {
6630
6753
  launches.length !== 0 && await awaitWithAbort(Promise.all(launches).then(() => {
6631
6754
  }), signal);
6632
6755
  }), pi.on("agent_end", async (_event, ctx) => {
6633
- ctx.hasUI || await drainOutstandingWork({ state, events: pi.events });
6756
+ ctx.hasUI || await drainOutstandingWork({ state, events: pi.events, hasPendingMessages: () => ctx.hasPendingMessages() });
6634
6757
  }), registerSlashCommands(pi, state);
6635
6758
  let eventUnsubscribeStoreKey = "__piSubagentEventUnsubscribes", controlNoticeSeenStoreKey = "__piSubagentVisibleControlNotices", previousEventUnsubscribes = globalStore[eventUnsubscribeStoreKey];
6636
6759
  if (Array.isArray(previousEventUnsubscribes)) {