@ashx-j/lunr 0.2.21 → 0.2.23

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 (461) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/README.md +23 -5
  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 +9 -0
  7. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  8. package/dist/builtin-extensions/lunr-browser.js +169 -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 +3 -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 +11 -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/background/wait-tool.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +41 -3
  56. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +4 -0
  59. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +3 -0
  62. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  64. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  65. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  66. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +1 -1
  69. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  71. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  73. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  74. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  75. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +48 -0
  76. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  77. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  78. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  79. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  80. package/dist/cli/args.d.ts.map +1 -1
  81. package/dist/cli/args.js +2 -1
  82. package/dist/cli/args.js.map +1 -1
  83. package/dist/cli/install-cli.d.ts.map +1 -1
  84. package/dist/cli/install-cli.js +15 -45
  85. package/dist/cli/install-cli.js.map +1 -1
  86. package/dist/core/agent-session-runtime.d.ts +9 -0
  87. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  88. package/dist/core/agent-session-runtime.js +126 -29
  89. package/dist/core/agent-session-runtime.js.map +1 -1
  90. package/dist/core/agent-session.d.ts +22 -0
  91. package/dist/core/agent-session.d.ts.map +1 -1
  92. package/dist/core/agent-session.js +250 -105
  93. package/dist/core/agent-session.js.map +1 -1
  94. package/dist/core/browser/network.d.ts +9 -0
  95. package/dist/core/browser/network.d.ts.map +1 -0
  96. package/dist/core/browser/network.js +146 -0
  97. package/dist/core/browser/network.js.map +1 -0
  98. package/dist/core/browser/runtime.d.ts +24 -0
  99. package/dist/core/browser/runtime.d.ts.map +1 -0
  100. package/dist/core/browser/runtime.js +289 -0
  101. package/dist/core/browser/runtime.js.map +1 -0
  102. package/dist/core/browser/schema.d.ts +16 -0
  103. package/dist/core/browser/schema.d.ts.map +1 -0
  104. package/dist/core/browser/schema.js +36 -0
  105. package/dist/core/browser/schema.js.map +1 -0
  106. package/dist/core/browser/settings.d.ts +8 -0
  107. package/dist/core/browser/settings.d.ts.map +1 -0
  108. package/dist/core/browser/settings.js +30 -0
  109. package/dist/core/browser/settings.js.map +1 -0
  110. package/dist/core/browser/setup.d.ts +2 -0
  111. package/dist/core/browser/setup.d.ts.map +1 -0
  112. package/dist/core/browser/setup.js +16 -0
  113. package/dist/core/browser/setup.js.map +1 -0
  114. package/dist/core/customize.d.ts.map +1 -1
  115. package/dist/core/customize.js +15 -14
  116. package/dist/core/customize.js.map +1 -1
  117. package/dist/core/export-html/index.d.ts.map +1 -1
  118. package/dist/core/export-html/index.js +1 -1
  119. package/dist/core/export-html/index.js.map +1 -1
  120. package/dist/core/extensions/runner.d.ts +1 -0
  121. package/dist/core/extensions/runner.d.ts.map +1 -1
  122. package/dist/core/extensions/runner.js +1 -1
  123. package/dist/core/extensions/runner.js.map +1 -1
  124. package/dist/core/extensions/types.d.ts +1 -1
  125. package/dist/core/extensions/types.d.ts.map +1 -1
  126. package/dist/core/extensions/types.js.map +1 -1
  127. package/dist/core/install-features.d.ts.map +1 -1
  128. package/dist/core/install-features.js +10 -8
  129. package/dist/core/install-features.js.map +1 -1
  130. package/dist/core/memory-cap.d.ts.map +1 -1
  131. package/dist/core/memory-cap.js +5 -3
  132. package/dist/core/memory-cap.js.map +1 -1
  133. package/dist/core/model-tiers.d.ts.map +1 -1
  134. package/dist/core/model-tiers.js +9 -6
  135. package/dist/core/model-tiers.js.map +1 -1
  136. package/dist/core/permissions.d.ts.map +1 -1
  137. package/dist/core/permissions.js +9 -0
  138. package/dist/core/permissions.js.map +1 -1
  139. package/dist/core/plan-mode.d.ts.map +1 -1
  140. package/dist/core/plan-mode.js +3 -0
  141. package/dist/core/plan-mode.js.map +1 -1
  142. package/dist/core/process-registry.d.ts.map +1 -1
  143. package/dist/core/process-registry.js +6 -4
  144. package/dist/core/process-registry.js.map +1 -1
  145. package/dist/core/runtime-scope.d.ts +11 -0
  146. package/dist/core/runtime-scope.d.ts.map +1 -0
  147. package/dist/core/runtime-scope.js +3 -0
  148. package/dist/core/runtime-scope.js.map +1 -0
  149. package/dist/core/sdk.d.ts.map +1 -1
  150. package/dist/core/sdk.js +13 -0
  151. package/dist/core/sdk.js.map +1 -1
  152. package/dist/core/session-handoff.d.ts +35 -0
  153. package/dist/core/session-handoff.d.ts.map +1 -0
  154. package/dist/core/session-handoff.js +214 -0
  155. package/dist/core/session-handoff.js.map +1 -0
  156. package/dist/core/session-manager.d.ts +20 -0
  157. package/dist/core/session-manager.d.ts.map +1 -1
  158. package/dist/core/session-manager.js +184 -22
  159. package/dist/core/session-manager.js.map +1 -1
  160. package/dist/core/session-ownership.d.ts +28 -0
  161. package/dist/core/session-ownership.d.ts.map +1 -0
  162. package/dist/core/session-ownership.js +138 -0
  163. package/dist/core/session-ownership.js.map +1 -0
  164. package/dist/core/session-retention.d.ts.map +1 -1
  165. package/dist/core/session-retention.js +11 -2
  166. package/dist/core/session-retention.js.map +1 -1
  167. package/dist/core/settings-manager.d.ts +11 -0
  168. package/dist/core/settings-manager.d.ts.map +1 -1
  169. package/dist/core/settings-manager.js +27 -0
  170. package/dist/core/settings-manager.js.map +1 -1
  171. package/dist/core/slash-commands.d.ts.map +1 -1
  172. package/dist/core/slash-commands.js +2 -0
  173. package/dist/core/slash-commands.js.map +1 -1
  174. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  175. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  176. package/dist/core/subagent-wait-interruption.js +19 -0
  177. package/dist/core/subagent-wait-interruption.js.map +1 -0
  178. package/dist/core/system-prompt.d.ts.map +1 -1
  179. package/dist/core/system-prompt.js +7 -2
  180. package/dist/core/system-prompt.js.map +1 -1
  181. package/dist/core/todo-settings.d.ts +5 -0
  182. package/dist/core/todo-settings.d.ts.map +1 -0
  183. package/dist/core/todo-settings.js +7 -0
  184. package/dist/core/todo-settings.js.map +1 -0
  185. package/dist/core/tools/bash.d.ts.map +1 -1
  186. package/dist/core/tools/bash.js +4 -4
  187. package/dist/core/tools/bash.js.map +1 -1
  188. package/dist/core/tools/edit.d.ts.map +1 -1
  189. package/dist/core/tools/edit.js +5 -3
  190. package/dist/core/tools/edit.js.map +1 -1
  191. package/dist/core/tools/find.d.ts.map +1 -1
  192. package/dist/core/tools/find.js +4 -4
  193. package/dist/core/tools/find.js.map +1 -1
  194. package/dist/core/tools/grep.d.ts.map +1 -1
  195. package/dist/core/tools/grep.js +4 -4
  196. package/dist/core/tools/grep.js.map +1 -1
  197. package/dist/core/tools/ls.d.ts.map +1 -1
  198. package/dist/core/tools/ls.js +4 -4
  199. package/dist/core/tools/ls.js.map +1 -1
  200. package/dist/core/tools/read.d.ts.map +1 -1
  201. package/dist/core/tools/read.js +4 -4
  202. package/dist/core/tools/read.js.map +1 -1
  203. package/dist/core/tools/render-utils.d.ts +14 -5
  204. package/dist/core/tools/render-utils.d.ts.map +1 -1
  205. package/dist/core/tools/render-utils.js +34 -7
  206. package/dist/core/tools/render-utils.js.map +1 -1
  207. package/dist/core/tools/write.d.ts.map +1 -1
  208. package/dist/core/tools/write.js +4 -4
  209. package/dist/core/tools/write.js.map +1 -1
  210. package/dist/core/usage-service.d.ts.map +1 -1
  211. package/dist/core/usage-service.js +5 -3
  212. package/dist/core/usage-service.js.map +1 -1
  213. package/dist/gateway/adapters/discord.d.ts +12 -1
  214. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  215. package/dist/gateway/adapters/discord.js +112 -17
  216. package/dist/gateway/adapters/discord.js.map +1 -1
  217. package/dist/gateway/adapters/telegram.d.ts +4 -2
  218. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  219. package/dist/gateway/adapters/telegram.js +34 -11
  220. package/dist/gateway/adapters/telegram.js.map +1 -1
  221. package/dist/gateway/agent-bridge.d.ts +14 -3
  222. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  223. package/dist/gateway/agent-bridge.js +252 -60
  224. package/dist/gateway/agent-bridge.js.map +1 -1
  225. package/dist/gateway/approval.d.ts +1 -0
  226. package/dist/gateway/approval.d.ts.map +1 -1
  227. package/dist/gateway/approval.js +60 -18
  228. package/dist/gateway/approval.js.map +1 -1
  229. package/dist/gateway/authz.d.ts +2 -0
  230. package/dist/gateway/authz.d.ts.map +1 -1
  231. package/dist/gateway/authz.js +13 -0
  232. package/dist/gateway/authz.js.map +1 -1
  233. package/dist/gateway/buttons.d.ts +3 -1
  234. package/dist/gateway/buttons.d.ts.map +1 -1
  235. package/dist/gateway/buttons.js +18 -3
  236. package/dist/gateway/buttons.js.map +1 -1
  237. package/dist/gateway/command.d.ts.map +1 -1
  238. package/dist/gateway/command.js +49 -4
  239. package/dist/gateway/command.js.map +1 -1
  240. package/dist/gateway/commands.d.ts.map +1 -1
  241. package/dist/gateway/commands.js +18 -3
  242. package/dist/gateway/commands.js.map +1 -1
  243. package/dist/gateway/config.d.ts +5 -0
  244. package/dist/gateway/config.d.ts.map +1 -1
  245. package/dist/gateway/config.js +5 -0
  246. package/dist/gateway/config.js.map +1 -1
  247. package/dist/gateway/conversations.d.ts +14 -0
  248. package/dist/gateway/conversations.d.ts.map +1 -0
  249. package/dist/gateway/conversations.js +30 -0
  250. package/dist/gateway/conversations.js.map +1 -0
  251. package/dist/gateway/download.d.ts +2 -0
  252. package/dist/gateway/download.d.ts.map +1 -0
  253. package/dist/gateway/download.js +36 -0
  254. package/dist/gateway/download.js.map +1 -0
  255. package/dist/gateway/index.d.ts.map +1 -1
  256. package/dist/gateway/index.js +85 -26
  257. package/dist/gateway/index.js.map +1 -1
  258. package/dist/gateway/mobile-commands.d.ts +24 -0
  259. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  260. package/dist/gateway/mobile-commands.js +422 -0
  261. package/dist/gateway/mobile-commands.js.map +1 -0
  262. package/dist/gateway/presenter.d.ts +16 -0
  263. package/dist/gateway/presenter.d.ts.map +1 -0
  264. package/dist/gateway/presenter.js +210 -0
  265. package/dist/gateway/presenter.js.map +1 -0
  266. package/dist/gateway/router.d.ts +1 -0
  267. package/dist/gateway/router.d.ts.map +1 -1
  268. package/dist/gateway/router.js +32 -3
  269. package/dist/gateway/router.js.map +1 -1
  270. package/dist/gateway/service.d.ts +46 -0
  271. package/dist/gateway/service.d.ts.map +1 -0
  272. package/dist/gateway/service.js +395 -0
  273. package/dist/gateway/service.js.map +1 -0
  274. package/dist/gateway/setup.d.ts +4 -0
  275. package/dist/gateway/setup.d.ts.map +1 -0
  276. package/dist/gateway/setup.js +146 -0
  277. package/dist/gateway/setup.js.map +1 -0
  278. package/dist/gateway/types.d.ts +4 -2
  279. package/dist/gateway/types.d.ts.map +1 -1
  280. package/dist/gateway/types.js.map +1 -1
  281. package/dist/index.d.ts +2 -0
  282. package/dist/index.d.ts.map +1 -1
  283. package/dist/index.js +2 -0
  284. package/dist/index.js.map +1 -1
  285. package/dist/main.d.ts.map +1 -1
  286. package/dist/main.js +2 -1
  287. package/dist/main.js.map +1 -1
  288. package/dist/modes/interactive/components/assistant-message.d.ts +19 -2
  289. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  290. package/dist/modes/interactive/components/assistant-message.js +78 -17
  291. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  292. package/dist/modes/interactive/components/copyable-text.d.ts +27 -0
  293. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  294. package/dist/modes/interactive/components/copyable-text.js +156 -0
  295. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  296. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  297. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  298. package/dist/modes/interactive/components/custom-entry.js +8 -0
  299. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  300. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  301. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  302. package/dist/modes/interactive/components/custom-message.js +8 -0
  303. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  304. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  305. package/dist/modes/interactive/components/session-selector.js +16 -0
  306. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  307. package/dist/modes/interactive/components/settings-selector.d.ts +8 -1
  308. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  309. package/dist/modes/interactive/components/settings-selector.js +51 -0
  310. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  311. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  312. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  314. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  315. package/dist/modes/interactive/components/tool-execution.d.ts +4 -3
  316. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  317. package/dist/modes/interactive/components/tool-execution.js +34 -45
  318. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  319. package/dist/modes/interactive/interactive-mode.d.ts +9 -0
  320. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  321. package/dist/modes/interactive/interactive-mode.js +267 -44
  322. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  323. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  324. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  325. package/dist/modes/interactive/theme/theme.js +23 -0
  326. package/dist/modes/interactive/theme/theme.js.map +1 -1
  327. package/dist/node-runtime/agent-session-services-GZVSOGYR.js +49 -0
  328. package/dist/node-runtime/{builtin-extensions-JCOPAAB5.js → builtin-extensions-QVCXNQT4.js} +6 -5
  329. package/dist/node-runtime/{chunk-LTYWTR3V.js → chunk-2MI5OPMN.js} +17 -2
  330. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  331. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  332. package/dist/node-runtime/{chunk-6N22HULO.js → chunk-5D7LC2ZQ.js} +7 -2
  333. package/dist/node-runtime/{chunk-KBKMCJDU.js → chunk-5ZQXRPMC.js} +19 -4
  334. package/dist/node-runtime/{chunk-BOHIDQT4.js → chunk-6VYZ5UFP.js} +1 -1
  335. package/dist/node-runtime/chunk-AZJHNQKQ.js +205 -0
  336. package/dist/node-runtime/{chunk-A3KMVBZV.js → chunk-BBUVIEZB.js} +1 -10
  337. package/dist/node-runtime/{chunk-IRPJXI6U.js → chunk-BX2RB477.js} +1 -1
  338. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  339. package/dist/node-runtime/{chunk-25I2BHAA.js → chunk-CSUZVNYE.js} +1 -1
  340. package/dist/node-runtime/chunk-DD5YWFSJ.js +708 -0
  341. package/dist/node-runtime/chunk-DQMGU675.js +3409 -0
  342. package/dist/node-runtime/{chunk-QZMODZQ2.js → chunk-E24EO34J.js} +2 -1
  343. package/dist/node-runtime/chunk-EKVFP6YF.js +355 -0
  344. package/dist/node-runtime/chunk-GJ2RDBRL.js +672 -0
  345. package/dist/node-runtime/{chunk-W3SILANP.js → chunk-GMHJCCEN.js} +8 -8
  346. package/dist/node-runtime/{chunk-DDWHZ633.js → chunk-GS42T6MX.js} +1 -1
  347. package/dist/node-runtime/chunk-GS66LV4M.js +2830 -0
  348. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  349. package/dist/node-runtime/{chunk-2SJB2AWP.js → chunk-HMBGROQK.js} +3 -3
  350. package/dist/node-runtime/{chunk-GB2MGFLI.js → chunk-HPUP7E4T.js} +216 -201
  351. package/dist/node-runtime/{chunk-YMEAYRBE.js → chunk-HTFRRDSF.js} +2 -7
  352. package/dist/node-runtime/{chunk-OPEK5RRY.js → chunk-IF24A3FH.js} +1 -1
  353. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  354. package/dist/node-runtime/chunk-KKUTQQV7.js +144 -0
  355. package/dist/node-runtime/chunk-LFZDVKSP.js +521 -0
  356. package/dist/node-runtime/{chunk-2BUAYZ7K.js → chunk-LLUIPGDR.js} +581 -197
  357. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-NAY6UUQZ.js} +1 -1
  358. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  359. package/dist/node-runtime/{chunk-STERBGUB.js → chunk-OFKSVRV7.js} +2 -2
  360. package/dist/node-runtime/{chunk-JZQ7F36T.js → chunk-PCEW76PM.js} +19 -3
  361. package/dist/node-runtime/{chunk-WLLDXJRT.js → chunk-QAZOULTU.js} +29 -1014
  362. package/dist/node-runtime/{chunk-6KDIOJL3.js → chunk-QH6YL7VK.js} +3 -3
  363. package/dist/node-runtime/chunk-R3K2F5GI.js +122 -0
  364. package/dist/node-runtime/{chunk-RNBHABBA.js → chunk-RDDAZOMU.js} +23 -0
  365. package/dist/node-runtime/{chunk-SY2TFMLO.js → chunk-RIR5EDDJ.js} +46 -151
  366. package/dist/node-runtime/chunk-RMQZU2YU.js +117 -0
  367. package/dist/node-runtime/{chunk-6BEIBLQ3.js → chunk-RWTKOC3B.js} +1 -1
  368. package/dist/node-runtime/{chunk-G6LRAP36.js → chunk-TQGPP4SC.js} +1 -1
  369. package/dist/node-runtime/{chunk-Y5KOEMBH.js → chunk-TVJUOJZJ.js} +9 -674
  370. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  371. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  372. package/dist/node-runtime/chunk-UP2XBVH5.js +40 -0
  373. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-UQUCFAJ3.js} +1 -1
  374. package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
  375. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  376. package/dist/node-runtime/chunk-UWPJL22I.js +341 -0
  377. package/dist/node-runtime/{chunk-4I23VTC4.js → chunk-VWCE2HSZ.js} +21 -124
  378. package/dist/node-runtime/{chunk-VZR3NCM7.js → chunk-W64JC4E7.js} +18 -14
  379. package/dist/node-runtime/{chunk-AWVD5IEY.js → chunk-X3URCYCU.js} +23 -12
  380. package/dist/node-runtime/{chunk-GKLEQ3I4.js → chunk-XLTL257W.js} +126 -27
  381. package/dist/node-runtime/{chunk-WKDK4C5P.js → chunk-YDO2F2IA.js} +38 -164
  382. package/dist/node-runtime/{chunk-PDNXVXMD.js → chunk-YHQ3NBB3.js} +58 -48
  383. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  384. package/dist/node-runtime/cli-runtime.js +2 -2
  385. package/dist/node-runtime/command-PDVTBRWA.js +45 -0
  386. package/dist/node-runtime/{commands-MV5KOZ64.js → commands-KAMO2T6P.js} +10 -10
  387. package/dist/node-runtime/commands-XDCFGIGW.js +36 -0
  388. package/dist/node-runtime/config-RORQUQFG.js +20 -0
  389. package/dist/node-runtime/{customize-LF5VST47.js → customize-VFJV3U6A.js} +2 -1
  390. package/dist/node-runtime/{direct-tool-executor-BK7CLEBX.js → direct-tool-executor-YAVOLDFY.js} +8 -8
  391. package/dist/node-runtime/{export-html-TEXVV5RP.js → export-html-KSOIMVPI.js} +4 -3
  392. package/dist/node-runtime/{extension-input-O4HSAEM4.js → extension-input-E7BJZ35H.js} +4 -4
  393. package/dist/node-runtime/{extension-selector-X5FCX43D.js → extension-selector-WU42XDTU.js} +4 -4
  394. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-EQJE7FZZ.js} +2 -2
  395. package/dist/node-runtime/{gateway-BM6NLOH4.js → gateway-AYWM5DIO.js} +275 -994
  396. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-35OCRFLN.js} +1 -1
  397. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-UQY3PHHW.js} +2 -2
  398. package/dist/node-runtime/index.js +104 -65
  399. package/dist/node-runtime/{init-3C7Z24OI.js → init-X2LIUB2H.js} +3 -3
  400. package/dist/node-runtime/{install-cli-EXMJQESX.js → install-cli-3BO4MMQ6.js} +21 -82
  401. package/dist/node-runtime/interactive-mode-4MFRKAHG.js +72 -0
  402. package/dist/node-runtime/{interactive-view-ILS6TAN5.js → interactive-view-TUZHCQM3.js} +8 -8
  403. package/dist/node-runtime/lunr-browser-RYFIIVJN.js +174 -0
  404. package/dist/node-runtime/{lunr-cron-4VHP4E4B.js → lunr-cron-YWXEPZMQ.js} +19 -5
  405. package/dist/node-runtime/main.js +44 -31
  406. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  407. package/dist/node-runtime/mobile-commands-LVHDAUDP.js +32 -0
  408. package/dist/node-runtime/model-runtime-PLQKAG4B.js +16 -0
  409. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  410. package/dist/node-runtime/{package-manager-cli-N37546V5.js → package-manager-cli-6GT3Z3CK.js} +22 -15
  411. package/dist/node-runtime/{pi-intercom-NV2LW6X7.js → pi-intercom-HBPK5HSJ.js} +4 -1
  412. package/dist/node-runtime/{pi-mcp-adapter-GUFZWW54.js → pi-mcp-adapter-E6WULBKF.js} +4 -4
  413. package/dist/node-runtime/{pi-subagents-6MUIFNDM.js → pi-subagents-CDWK2AKY.js} +236 -79
  414. package/dist/node-runtime/{pi-web-access-2CQGFLT2.js → pi-web-access-WTGMNZ32.js} +15 -15
  415. package/dist/node-runtime/process-registry-4FAKZQOL.js +31 -0
  416. package/dist/node-runtime/{proxy-modes-V6YVFH3C.js → proxy-modes-OSQCWRBI.js} +9 -9
  417. package/dist/node-runtime/rpc-entry.js +44 -31
  418. package/dist/node-runtime/{rpc-mode-W5ZTLTMZ.js → rpc-mode-O3XV4SID.js} +2 -2
  419. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  420. package/dist/node-runtime/{runtime-bridges-2VQTLPOZ.js → runtime-bridges-3XUQ46XW.js} +6 -5
  421. package/dist/node-runtime/service-ISSP6VHE.js +36 -0
  422. package/dist/node-runtime/session-handoff-HC7R5E24.js +33 -0
  423. package/dist/node-runtime/{session-manager-E7AREDTV.js → session-manager-CFN4UFM2.js} +2 -1
  424. package/dist/node-runtime/{session-selector-FJ7M2AIX.js → session-selector-GIM4DHQ2.js} +5 -4
  425. package/dist/node-runtime/{settings-manager-CUGAZWAB.js → settings-manager-6VEMXRDL.js} +7 -2
  426. package/dist/node-runtime/setup-5SR2J35A.js +155 -0
  427. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  428. package/dist/node-runtime/{subagent-executor-MH4A7CCF.js → subagent-executor-M5VWB3D3.js} +26 -18
  429. package/dist/node-runtime/theme-UOO5RVFN.js +68 -0
  430. package/dist/node-runtime/trust-manager-MMISNCYO.js +17 -0
  431. package/dist/node-runtime/{update-cli-XTZMZGOL.js → update-cli-UVKJWRRJ.js} +7 -2
  432. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  433. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-OOZHR7SU.js} +2 -2
  434. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-FNPAUNHU.js} +6 -6
  435. package/docs/browser.md +86 -0
  436. package/docs/extensions.md +2 -0
  437. package/docs/features.md +96 -16
  438. package/docs/interactive-startup.md +2 -1
  439. package/docs/sessions.md +10 -0
  440. package/docs/settings.md +2 -0
  441. package/docs/tui.md +2 -0
  442. package/docs/usage.md +16 -0
  443. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  444. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  445. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  446. package/examples/extensions/gondolin/package-lock.json +2 -2
  447. package/examples/extensions/gondolin/package.json +1 -1
  448. package/examples/extensions/sandbox/package-lock.json +2 -2
  449. package/examples/extensions/sandbox/package.json +1 -1
  450. package/examples/extensions/with-deps/package-lock.json +2 -2
  451. package/examples/extensions/with-deps/package.json +1 -1
  452. package/package.json +7 -4
  453. package/scripts/install-browser.mjs +20 -0
  454. package/dist/node-runtime/agent-session-services-C743TYQE.js +0 -37
  455. package/dist/node-runtime/chunk-VGYZ3APQ.js +0 -59
  456. package/dist/node-runtime/chunk-XI77KVKA.js +0 -6009
  457. package/dist/node-runtime/command-P4NYCJ2M.js +0 -13
  458. package/dist/node-runtime/interactive-mode-EVVBA64D.js +0 -59
  459. package/dist/node-runtime/{chunk-UWQYRSYQ.js → chunk-YJMMG7C6.js} +25 -25
  460. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  461. package/dist/node-runtime/{src-BPQFJR76.js → src-IVPNZ2BX.js} +9 -9
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-I6R76AG7.js";
5
5
  import {
6
6
  DynamicBorder
7
- } from "./chunk-BOHIDQT4.js";
7
+ } from "./chunk-6VYZ5UFP.js";
8
8
  import {
9
9
  keyHint,
10
10
  rawKeyHint
11
- } from "./chunk-DDWHZ633.js";
11
+ } from "./chunk-GS42T6MX.js";
12
12
  import {
13
13
  theme
14
- } from "./chunk-RNBHABBA.js";
14
+ } from "./chunk-RDDAZOMU.js";
15
15
 
16
16
  // packages/coding-agent/dist/modes/interactive/components/extension-selector.js
17
17
  import { Container, getKeybindings, Spacer, Text } from "@ashx-j/lunr-tui";
@@ -0,0 +1,122 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ getAgentDir
4
+ } from "./chunk-FQMM2EZ2.js";
5
+
6
+ // packages/coding-agent/dist/gateway/config.js
7
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ function gatewayConfigPath() {
10
+ return join(getAgentDir(), "gateway.json");
11
+ }
12
+ function defaultPlatformConfig(requireMention) {
13
+ return {
14
+ enabled: !1,
15
+ allowedUsers: [],
16
+ allowedChats: [],
17
+ requireMention,
18
+ freeResponseChats: []
19
+ };
20
+ }
21
+ function defaultGatewayConfig() {
22
+ return {
23
+ owners: { telegram: [], discord: [] },
24
+ projectRoots: [],
25
+ telegram: defaultPlatformConfig(!1),
26
+ discord: { ...defaultPlatformConfig(!0), ignoredChannels: [], autoThread: !0 },
27
+ groupSessionsPerUser: !0,
28
+ unauthorizedDmBehavior: "pair",
29
+ streaming: { enabled: !0, editIntervalMs: 800, bufferThreshold: 24 }
30
+ };
31
+ }
32
+ function asStringArray(value) {
33
+ if (Array.isArray(value))
34
+ return value.every((v) => typeof v == "string") ? value : void 0;
35
+ }
36
+ function asBoolean(value) {
37
+ return typeof value == "boolean" ? value : void 0;
38
+ }
39
+ function asNumber(value) {
40
+ return typeof value == "number" && Number.isFinite(value) ? value : void 0;
41
+ }
42
+ function sanitizePlatform(raw, base) {
43
+ if (raw == null || typeof raw != "object" || Array.isArray(raw))
44
+ return base;
45
+ let r = raw;
46
+ return {
47
+ enabled: asBoolean(r.enabled) ?? base.enabled,
48
+ token: typeof r.token == "string" ? r.token : base.token,
49
+ allowedUsers: asStringArray(r.allowedUsers) ?? base.allowedUsers,
50
+ allowedChats: asStringArray(r.allowedChats) ?? base.allowedChats,
51
+ requireMention: asBoolean(r.requireMention) ?? base.requireMention,
52
+ freeResponseChats: asStringArray(r.freeResponseChats) ?? base.freeResponseChats,
53
+ homeChannel: typeof r.homeChannel == "string" ? r.homeChannel : base.homeChannel
54
+ };
55
+ }
56
+ function sanitizeDiscord(raw, base) {
57
+ let platform = sanitizePlatform(raw, base), r = raw != null && typeof raw == "object" && !Array.isArray(raw) ? raw : {};
58
+ return {
59
+ ...platform,
60
+ ignoredChannels: asStringArray(r.ignoredChannels) ?? base.ignoredChannels,
61
+ autoThread: asBoolean(r.autoThread) ?? base.autoThread
62
+ };
63
+ }
64
+ function sanitizeConfig(raw) {
65
+ let base = defaultGatewayConfig();
66
+ if (raw == null || typeof raw != "object" || Array.isArray(raw))
67
+ return base;
68
+ let r = raw, streamingRaw = r.streaming != null && typeof r.streaming == "object" && !Array.isArray(r.streaming) ? r.streaming : {}, owners = r.owners && typeof r.owners == "object" ? r.owners : {};
69
+ return {
70
+ owners: { telegram: asStringArray(owners.telegram) ?? [], discord: asStringArray(owners.discord) ?? [] },
71
+ projectRoots: asStringArray(r.projectRoots) ?? [],
72
+ telegram: sanitizePlatform(r.telegram, base.telegram),
73
+ discord: sanitizeDiscord(r.discord, base.discord),
74
+ groupSessionsPerUser: asBoolean(r.groupSessionsPerUser) ?? base.groupSessionsPerUser,
75
+ unauthorizedDmBehavior: r.unauthorizedDmBehavior === "ignore" ? "ignore" : "pair",
76
+ streaming: {
77
+ enabled: asBoolean(streamingRaw.enabled) ?? base.streaming.enabled,
78
+ editIntervalMs: asNumber(streamingRaw.editIntervalMs) ?? base.streaming.editIntervalMs,
79
+ bufferThreshold: asNumber(streamingRaw.bufferThreshold) ?? base.streaming.bufferThreshold
80
+ }
81
+ };
82
+ }
83
+ function loadGatewayConfig() {
84
+ let path = gatewayConfigPath();
85
+ if (!existsSync(path))
86
+ return defaultGatewayConfig();
87
+ try {
88
+ return sanitizeConfig(JSON.parse(readFileSync(path, "utf-8")));
89
+ } catch (err) {
90
+ return console.error(`[gateway] Failed to load config from ${path}: ${err}`), defaultGatewayConfig();
91
+ }
92
+ }
93
+ function saveGatewayConfig(config) {
94
+ let path = gatewayConfigPath(), dir = getAgentDir();
95
+ existsSync(dir) || mkdirSync(dir, { recursive: !0 });
96
+ let tmp = `${path}.tmp-${process.pid}`;
97
+ writeFileSync(tmp, `${JSON.stringify(config, null, 2)}
98
+ `, "utf-8"), renameSync(tmp, path);
99
+ try {
100
+ chmodSync(path, 384);
101
+ } catch {
102
+ }
103
+ }
104
+ function resolvePlatformToken(platform, platformCfg) {
105
+ let upper = platform.toUpperCase();
106
+ return process.env[`LUNR_${upper}_BOT_TOKEN`] ?? process.env[`${upper}_BOT_TOKEN`] ?? platformCfg.token;
107
+ }
108
+ function platformConfigFor(cfg, platform) {
109
+ if (platform === "telegram")
110
+ return cfg.telegram;
111
+ if (platform === "discord")
112
+ return cfg.discord;
113
+ }
114
+
115
+ export {
116
+ gatewayConfigPath,
117
+ defaultGatewayConfig,
118
+ loadGatewayConfig,
119
+ saveGatewayConfig,
120
+ resolvePlatformToken,
121
+ platformConfigFor
122
+ };
@@ -388,6 +388,22 @@ var DEFAULT_THEME_GLYPHS = {
388
388
  throw new Error(`Unknown theme color: ${color}`);
389
389
  return ansi;
390
390
  }
391
+ getFgGradient(from, to, steps) {
392
+ let start = this.getFgAnsi(from), end = this.getFgAnsi(to), toRgb = (ansi) => {
393
+ let rgb = ansi.match(/\x1b\[38;2;(\d+);(\d+);(\d+)m/);
394
+ if (rgb)
395
+ return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]) };
396
+ let indexed = ansi.match(/\x1b\[38;5;(\d+)m/);
397
+ return indexed ? hexToRgb(ansi256ToHex(Number(indexed[1]))) : void 0;
398
+ }, a = toRgb(start), b = toRgb(end);
399
+ return Array.from({ length: steps }, (_, index) => {
400
+ let amount = index / Math.max(1, steps - 1);
401
+ if (!a || !b)
402
+ return amount < 0.5 ? start : end;
403
+ let r = Math.round(a.r + (b.r - a.r) * amount), g = Math.round(a.g + (b.g - a.g) * amount), blue = Math.round(a.b + (b.b - a.b) * amount);
404
+ return this.mode === "truecolor" ? `\x1B[38;2;${r};${g};${blue}m` : fgAnsi(rgbTo256(r, g, blue), this.mode);
405
+ });
406
+ }
391
407
  getBgAnsi(color) {
392
408
  let ansi = this.bgColors.get(color);
393
409
  if (!ansi)
@@ -753,6 +769,9 @@ function getResolvedThemeColors(themeName) {
753
769
  typeof value == "number" ? cssColors[key] = ansi256ToHex(value) : value === "" ? cssColors[key] = defaultText : cssColors[key] = value;
754
770
  return cssColors;
755
771
  }
772
+ function isLightTheme(themeName) {
773
+ return themeName === "light";
774
+ }
756
775
  function getThemeExportColors(themeName) {
757
776
  let name = themeName ?? currentThemeName ?? getDefaultTheme();
758
777
  try {
@@ -957,6 +976,7 @@ export {
957
976
  FS_WATCH_RETRY_DELAY_MS,
958
977
  closeWatcher,
959
978
  watchWithErrorHandler,
979
+ DEFAULT_THEME_GLYPHS,
960
980
  Theme,
961
981
  getAvailableThemes,
962
982
  getAvailableThemesWithPaths,
@@ -964,7 +984,9 @@ export {
964
984
  getThemeByName,
965
985
  parseAutoThemeSetting,
966
986
  resolveThemeSetting,
987
+ getThemeForRgbColor,
967
988
  detectTerminalBackgroundFromEnv,
989
+ detectTerminalBackgroundTheme,
968
990
  detectTerminalThemeForAuto,
969
991
  getDefaultTheme,
970
992
  theme,
@@ -976,6 +998,7 @@ export {
976
998
  getThemeName,
977
999
  stopThemeWatcher,
978
1000
  getResolvedThemeColors,
1001
+ isLightTheme,
979
1002
  getThemeExportColors,
980
1003
  highlightCode,
981
1004
  getLanguageFromPath,
@@ -1,11 +1,16 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ controlNotificationKey,
4
+ formatControlNoticeMessage,
5
+ isDiagnosticControlEvent
6
+ } from "./chunk-OAR4TYZE.js";
2
7
  import {
3
8
  PLAN_MODE_WRITE_SPAWN_ERROR,
4
9
  resolveChildPermissions
5
- } from "./chunk-25I2BHAA.js";
10
+ } from "./chunk-CSUZVNYE.js";
6
11
  import {
7
12
  createReadOnlyTools
8
- } from "./chunk-WKDK4C5P.js";
13
+ } from "./chunk-YDO2F2IA.js";
9
14
  import {
10
15
  convertToLlm
11
16
  } from "./chunk-FVDOXRUD.js";
@@ -1921,6 +1926,30 @@ function resolveWaitToolConfig(config, env = process.env) {
1921
1926
  };
1922
1927
  }
1923
1928
 
1929
+ // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/intercom/communication.js
1930
+ var SUPERVISOR_PROTOCOL_ENV = "PI_SUBAGENT_SUPERVISOR_PROTOCOL", CHILD_DESCRIPTION_ENV = "PI_SUBAGENT_CHILD_DESCRIPTION";
1931
+ var SUPERVISOR_REQUEST_TYPE = "subagent_supervisor_request", SUPERVISOR_PROGRESS_TYPE = "subagent_supervisor_progress";
1932
+ function readCommunication(value) {
1933
+ if (!value || typeof value != "object")
1934
+ return;
1935
+ let input = value;
1936
+ if (!(input.direction !== "from" && input.direction !== "to") && !(typeof input.peer != "string" || typeof input.message != "string") && ["request", "interview", "progress", "handoff", "question", "reply", "answer", "steer"].includes(input.kind ?? ""))
1937
+ return input;
1938
+ }
1939
+ function resolveCommunicationPeer(state, runId, childIndex, childId, fallback) {
1940
+ let job = state.asyncJobs.get(runId) ?? state.fleetJobs?.get(runId), step = job?.steps?.find((candidate, index) => (candidate.index ?? index) === childIndex && (!childId || (candidate.childId ?? candidate.agent) === childId)), label = step?.description ?? (step?.agent !== childId ? step?.agent : void 0);
1941
+ if (label)
1942
+ return (job?.steps?.filter((candidate) => (candidate.description ?? candidate.agent) === label).length ?? 0) > 1 ? `${label} \xB7 ${childIndex + 1}` : label;
1943
+ let foreground = state.foregroundControls.get(runId);
1944
+ if (foreground?.currentIndex === childIndex && (!childId || foreground.currentChildId === childId) && foreground.currentAgent && foreground.currentAgent !== childId)
1945
+ return foreground.currentAgent;
1946
+ let remembered = state.foregroundRuns?.get(runId)?.children.find((child) => child.index === childIndex);
1947
+ return remembered?.agent && remembered.agent !== childId ? remembered.agent : fallback?.trim() || `Subagent ${childIndex + 1}`;
1948
+ }
1949
+ function legacySupervisorBody(content) {
1950
+ return content.replace(/^Subagent (?:progress update\.|needs a supervisor decision\.|requests a structured supervisor interview\.)\r?\nRun: [^\n]*\r?\nAgent: [^\n]*\r?\nChild index: [^\n]*\r?\n(?:Child intercom target: [^\n]*\r?\n)?\r?\n/, "").replace(/^Subagent answer \([^\n]*\)\r?\nRun: [^\n]*\r?\nChild: [^\n]*\r?\nDecision: [^\n]*\r?\n\r?\n/, "").replace(/\r?\n\r?\nReply with: subagent_supervisor\([^\n]*\)\s*$/, "");
1951
+ }
1952
+
1924
1953
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js
1925
1954
  var TASK_ARG_LIMIT = 8e3;
1926
1955
  function resolveRuntimeScriptPath(basePathWithoutExt) {
@@ -1984,7 +2013,7 @@ function buildPiArgs(input) {
1984
2013
  ...input.childAgentName ? { agent: input.childAgentName } : {}
1985
2014
  }] : []
1986
2015
  ];
1987
- if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = input.supervisorSessionId ?? "", input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
2016
+ if (env[SUBAGENT_PARENT_EVENT_SINK_ENV] = fanoutAuthorized ? input.parentEventSink ?? process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] ?? "" : "", env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = fanoutAuthorized ? input.parentControlInbox ?? process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] ?? "" : "", env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = fanoutAuthorized ? input.parentRootRunId ?? process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] ?? input.runId ?? "" : "", env[SUBAGENT_PARENT_RUN_ID_ENV] = fanoutAuthorized ? parentRunId : "", env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = fanoutAuthorized ? parentChildIndex : "", env[SUBAGENT_PARENT_DEPTH_ENV] = fanoutAuthorized ? String(parentDepth) : "", env[SUBAGENT_PARENT_PATH_ENV] = fanoutAuthorized ? encodeNestedPathEnv(parentPath) : "", env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = fanoutAuthorized ? input.parentCapabilityToken ?? process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] ?? "" : "", env.PI_SUBAGENT_INHERIT_PROJECT_CONTEXT = input.inheritProjectContext ? "1" : "0", env.PI_SUBAGENT_INHERIT_SKILLS = input.inheritSkills ? "1" : "0", input.intercomSessionName && (env.PI_SUBAGENT_INTERCOM_SESSION_NAME = input.intercomSessionName), input.orchestratorIntercomTarget && (env[SUBAGENT_ORCHESTRATOR_TARGET_ENV] = input.orchestratorIntercomTarget), input.parentSessionId && (env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV] = input.parentSessionId), env[SUBAGENT_SUPERVISOR_SESSION_ID_ENV] = input.supervisorSessionId ?? "", env[SUPERVISOR_PROTOCOL_ENV] = String(2), env[CHILD_DESCRIPTION_ENV] = input.childDescription ?? input.childAgentName ?? "", input.parentSessionId && input.runId && (input.childId || input.childAgentName)) {
1988
2017
  let childIndex = input.childIndex ?? 0, channelAgent = input.childId ?? input.childAgentName, channelDir = supervisorChannelDir(input.runId, channelAgent, childIndex);
1989
2018
  fs9.mkdirSync(path10.join(channelDir, "requests"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "replies"), { recursive: !0 }), fs9.mkdirSync(path10.join(channelDir, "questions"), { recursive: !0 }), env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] = channelDir, env[SUBAGENT_CHILD_INDEX_ENV] = String(childIndex);
1990
2019
  }
@@ -2531,135 +2560,6 @@ function resolveSubagentRequestParams(params) {
2531
2560
  return omitConflictingControlAction(omitExecutionModeActionAlias(params));
2532
2561
  }
2533
2562
 
2534
- // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js
2535
- var CONTROL_EVENT_TYPES = ["active_long_running", "needs_attention"], CONTROL_NOTIFICATION_CHANNELS = ["event", "async", "intercom"], DEFAULT_NOTIFY_ON = ["active_long_running", "needs_attention"], DEFAULT_CONTROL_CONFIG = {
2536
- enabled: !0,
2537
- needsAttentionAfterMs: 6e4,
2538
- activeNoticeAfterMs: 24e4,
2539
- failedToolAttemptsBeforeAttention: 3,
2540
- notifyOn: DEFAULT_NOTIFY_ON,
2541
- notifyChannels: CONTROL_NOTIFICATION_CHANNELS
2542
- };
2543
- function parsePositiveInt(value) {
2544
- if (typeof value == "number" && !(!Number.isFinite(value) || !Number.isInteger(value) || value < 1))
2545
- return value;
2546
- }
2547
- function parseControlList(value, allowed) {
2548
- if (!Array.isArray(value))
2549
- return;
2550
- if (value.length === 0)
2551
- return [];
2552
- let allowedSet = new Set(allowed), parsed = value.filter((entry) => typeof entry == "string" && allowedSet.has(entry));
2553
- return parsed.length > 0 ? Array.from(new Set(parsed)) : void 0;
2554
- }
2555
- function resolveControlConfig(globalConfig, override) {
2556
- let enabled = override?.enabled ?? globalConfig?.enabled ?? DEFAULT_CONTROL_CONFIG.enabled, needsAttentionAfterMs = parsePositiveInt(override?.needsAttentionAfterMs) ?? parsePositiveInt(globalConfig?.needsAttentionAfterMs) ?? DEFAULT_CONTROL_CONFIG.needsAttentionAfterMs, activeNoticeAfterMs = parsePositiveInt(override?.activeNoticeAfterMs) ?? parsePositiveInt(globalConfig?.activeNoticeAfterMs) ?? DEFAULT_CONTROL_CONFIG.activeNoticeAfterMs, activeNoticeAfterTurns = parsePositiveInt(override?.activeNoticeAfterTurns) ?? parsePositiveInt(globalConfig?.activeNoticeAfterTurns), activeNoticeAfterTokens = parsePositiveInt(override?.activeNoticeAfterTokens) ?? parsePositiveInt(globalConfig?.activeNoticeAfterTokens), failedToolAttemptsBeforeAttention = parsePositiveInt(override?.failedToolAttemptsBeforeAttention) ?? parsePositiveInt(globalConfig?.failedToolAttemptsBeforeAttention) ?? DEFAULT_CONTROL_CONFIG.failedToolAttemptsBeforeAttention, notifyOn = parseControlList(override?.notifyOn, CONTROL_EVENT_TYPES) ?? parseControlList(globalConfig?.notifyOn, CONTROL_EVENT_TYPES) ?? DEFAULT_CONTROL_CONFIG.notifyOn, notifyChannels = parseControlList(override?.notifyChannels, CONTROL_NOTIFICATION_CHANNELS) ?? parseControlList(globalConfig?.notifyChannels, CONTROL_NOTIFICATION_CHANNELS) ?? DEFAULT_CONTROL_CONFIG.notifyChannels;
2557
- return {
2558
- enabled,
2559
- needsAttentionAfterMs,
2560
- activeNoticeAfterMs,
2561
- activeNoticeAfterTurns,
2562
- activeNoticeAfterTokens,
2563
- failedToolAttemptsBeforeAttention,
2564
- notifyOn: [...notifyOn],
2565
- notifyChannels: [...notifyChannels]
2566
- };
2567
- }
2568
- function deriveActivityState(input) {
2569
- if (!input.config.enabled)
2570
- return;
2571
- let now = input.now ?? Date.now(), lastActivity = input.lastActivityAt ?? input.startedAt;
2572
- return Math.max(0, now - lastActivity) > input.config.needsAttentionAfterMs ? "needs_attention" : void 0;
2573
- }
2574
- function buildControlEvent(input) {
2575
- let ts = input.ts ?? Date.now(), type = input.type ?? (input.to === "active_long_running" ? "active_long_running" : "needs_attention"), elapsedMs = input.elapsedMs ?? (input.lastActivityAt ? Math.max(0, ts - input.lastActivityAt) : void 0), elapsedSeconds = elapsedMs !== void 0 ? Math.floor(elapsedMs / 1e3) : void 0, message = input.message ?? (type === "active_long_running" ? `${input.agent} is still active but long-running` : elapsedSeconds !== void 0 ? `${input.agent} needs attention (no observed activity for ${elapsedSeconds}s)` : `${input.agent} needs attention`);
2576
- return {
2577
- type,
2578
- ...input.from ? { from: input.from } : {},
2579
- to: input.to,
2580
- ts,
2581
- runId: input.runId,
2582
- agent: input.agent,
2583
- ...input.index !== void 0 ? { index: input.index } : {},
2584
- message,
2585
- reason: input.reason ?? (type === "active_long_running" ? "active_long_running" : "idle"),
2586
- ...input.turns !== void 0 ? { turns: input.turns } : {},
2587
- ...input.tokens !== void 0 ? { tokens: input.tokens } : {},
2588
- ...input.toolCount !== void 0 ? { toolCount: input.toolCount } : {},
2589
- ...input.currentTool ? { currentTool: input.currentTool } : {},
2590
- ...input.currentToolDurationMs !== void 0 ? { currentToolDurationMs: input.currentToolDurationMs } : {},
2591
- ...input.currentPath ? { currentPath: input.currentPath } : {},
2592
- ...elapsedMs !== void 0 ? { elapsedMs } : {},
2593
- ...input.recentFailureSummary ? { recentFailureSummary: input.recentFailureSummary } : {}
2594
- };
2595
- }
2596
- function shouldNotifyControlEvent(config, event) {
2597
- return config.enabled && config.notifyOn.includes(event.type);
2598
- }
2599
- function controlNotificationKey(event, childIntercomTarget) {
2600
- return `${childIntercomTarget ?? (event.index !== void 0 ? `${event.runId}:${event.index}` : event.runId)}:${event.type}:${event.reason ?? "idle"}`;
2601
- }
2602
- function claimControlNotification(config, event, seenKeys, childIntercomTarget) {
2603
- if (!shouldNotifyControlEvent(config, event))
2604
- return !1;
2605
- let key = controlNotificationKey(event, childIntercomTarget);
2606
- return seenKeys.has(key) ? !1 : (seenKeys.add(key), !0);
2607
- }
2608
- function formatLongRunningFacts(event) {
2609
- let facts = [];
2610
- return event.elapsedMs !== void 0 && facts.push(`elapsed ${Math.floor(Math.max(0, event.elapsedMs) / 1e3)}s`), event.turns !== void 0 && facts.push(`${event.turns} turns`), event.tokens !== void 0 && facts.push(`${event.tokens} tokens`), event.toolCount !== void 0 && facts.push(`${event.toolCount} tools`), event.currentTool && facts.push(`tool ${event.currentTool}${event.currentToolDurationMs !== void 0 ? ` ${Math.floor(Math.max(0, event.currentToolDurationMs) / 1e3)}s` : ""}`), event.currentPath && facts.push(`path ${event.currentPath}`), facts.length > 0 ? facts.join(" | ") : void 0;
2611
- }
2612
- function formatControlNoticeMessage(event, childIntercomTarget) {
2613
- let runTarget = event.runId;
2614
- if (event.reason === "completion_guard")
2615
- return [
2616
- `Subagent failed: ${event.agent}`,
2617
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2618
- `Signal: ${event.message}`,
2619
- "Next: read the output artifact or session from the subagent result, then retry with a more explicit implementation prompt or handle the fix directly.",
2620
- childIntercomTarget ? `Run intercom target (may be inactive): ${childIntercomTarget}` : void 0
2621
- ].filter((line) => !!line).join(`
2622
- `);
2623
- let nudgeCommand = `subagent({ action: "resume", id: "${runTarget}", ${event.index !== void 0 ? `index: ${event.index}, ` : ""}message: "What are you blocked on? Reply with the smallest next step or ask for a decision." })`;
2624
- if (event.type === "active_long_running") {
2625
- let facts = formatLongRunningFacts(event);
2626
- return [
2627
- `Subagent active but long-running: ${event.agent}`,
2628
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2629
- `Signal: ${event.message}`,
2630
- facts ? `Facts: ${facts}` : void 0,
2631
- "Hint: Inspect status, then nudge if the work seems stuck. Live async nudges interrupt the child before sending the follow-up.",
2632
- `Nudge: ${nudgeCommand}`,
2633
- childIntercomTarget ? `Direct intercom target: ${childIntercomTarget}` : void 0,
2634
- `Status: subagent({ action: "status", id: "${runTarget}" })`,
2635
- `Interrupt: subagent({ action: "interrupt", id: "${runTarget}" })`
2636
- ].filter((line) => !!line).join(`
2637
- `);
2638
- }
2639
- return [
2640
- `Subagent needs attention: ${event.agent}`,
2641
- `Run: ${runTarget}${event.index !== void 0 ? ` step ${event.index + 1}` : ""}`,
2642
- `Signal: ${event.message}`,
2643
- event.recentFailureSummary ? `Recent failures: ${event.recentFailureSummary}` : void 0,
2644
- "Hint: Inspect status first unless the run is clearly blocked. Live async nudges interrupt the child before sending the follow-up.",
2645
- `Nudge: ${nudgeCommand}`,
2646
- childIntercomTarget ? `Direct intercom target: ${childIntercomTarget}` : void 0,
2647
- `Status: subagent({ action: "status", id: "${runTarget}" })`,
2648
- `Interrupt: subagent({ action: "interrupt", id: "${runTarget}" })`
2649
- ].filter((line) => !!line).join(`
2650
- `);
2651
- }
2652
- function formatControlIntercomMessage(event, childIntercomTarget) {
2653
- return [
2654
- event.reason === "completion_guard" ? "subagent failed" : event.type === "active_long_running" ? "subagent active but long-running" : "subagent needs attention",
2655
- "",
2656
- event.reason === "completion_guard" ? `${event.agent} failed in run ${event.runId}.` : event.type === "active_long_running" ? `${event.agent} is still active but long-running in run ${event.runId}.` : `${event.agent} needs attention in run ${event.runId}.`,
2657
- "",
2658
- formatControlNoticeMessage(event, childIntercomTarget)
2659
- ].join(`
2660
- `);
2661
- }
2662
-
2663
2563
  // packages/coding-agent/dist/builtin-extensions/pi-subagents/src/runs/shared/nested-events.js
2664
2564
  import { randomUUID } from "node:crypto";
2665
2565
  import * as fs11 from "node:fs";
@@ -4980,17 +4880,10 @@ function defaultAgentDir() {
4980
4880
  function defaultSubagentConfigDir(agentDir = defaultAgentDir()) {
4981
4881
  return path16.join(agentDir, "extensions", "subagent");
4982
4882
  }
4983
- var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `The inherited thread is reference-only. Do not continue that conversation or send questions, status updates, or completion handoffs to the supervisor in normal assistant text.
4984
-
4985
- Use contact_supervisor first. It resolves the supervisor session "{orchestratorTarget}" and run metadata automatically.
4986
- - Need a decision, blocked, approval, or product/API/scope ambiguity: contact_supervisor({ reason: "need_decision", message: "<question>" })
4987
- - Need structured supervisor input rather than a freeform reply: contact_supervisor({ reason: "interview_request", message: "<what input is needed>", interview: { title: "...", questions: [] } })
4988
- - After contact_supervisor with reason "need_decision" or "interview_request", stay alive and continue only after the reply arrives. Do not finish your final response with a choose-one question.
4989
- - Do not ask for clarification when the only conflict is review-only/no-edit versus progress-writing or artifact-writing instructions. If an output path is configured but no write-capable tool is available, return the complete artifact in your final response; the runtime will persist it. Do not contact the supervisor merely because you cannot write that output path directly.
4990
- - Meaningful progress or unexpected discoveries that change the plan: contact_supervisor({ reason: "progress_update", message: "UPDATE: <summary>" })
4991
- - Generic intercom is lower-level plumbing/fallback only: intercom({ action: "ask", to: "{orchestratorTarget}", message: "<question>" })
4992
-
4993
- Do not use contact_supervisor or intercom for routine completion handoffs. If no coordination is needed, return a focused task result.`;
4883
+ var DEFAULT_INTERCOM_TARGET_PREFIX = "subagent-chat", INTERCOM_BRIDGE_MARKER = "Intercom orchestration channel:", DEFAULT_INTERCOM_BRIDGE_TEMPLATE = `You own reversible implementation decisions within your assigned scope. Use contact_supervisor for coordination with "{orchestratorTarget}"; its tool description defines delivery and reply behavior.
4884
+ Consolidate dependency findings into one handoff when another task needs them before completion. Escalate permission, safety, scope changes, or a blocked decision with evidence and your recommended choice. Continue independent work before opening a blocking request.
4885
+ Native intercom reaches only the supervisor, not siblings. Use the supplied contracts and artifacts instead of discovering sibling sessions.
4886
+ Return one self-contained final result; the runtime delivers it. If you cannot write a configured output artifact with your available tools, return its complete contents for the runtime to persist.`;
4994
4887
  function resolveIntercomSessionTarget(sessionName, sessionId) {
4995
4888
  let trimmedName = sessionName?.trim();
4996
4889
  if (trimmedName)
@@ -5645,6 +5538,10 @@ function deliverControlNotice(input) {
5645
5538
  return;
5646
5539
  input.visibleControlNotices.add(key);
5647
5540
  let noticeText = input.details.noticeText ?? formatControlNoticeMessage(input.details.event, childIntercomTarget);
5541
+ if (isDiagnosticControlEvent(input.details.event)) {
5542
+ input.pi.appendEntry(SUBAGENT_CONTROL_MESSAGE_TYPE, { ...input.details, childIntercomTarget, noticeText });
5543
+ return;
5544
+ }
5648
5545
  input.pi.sendMessage({
5649
5546
  customType: SUBAGENT_CONTROL_MESSAGE_TYPE,
5650
5547
  content: noticeText,
@@ -8540,6 +8437,11 @@ export {
8540
8437
  childWatchdogIsActive,
8541
8438
  acceptChildWatchdogEvent,
8542
8439
  resolveWaitToolConfig,
8440
+ SUPERVISOR_REQUEST_TYPE,
8441
+ SUPERVISOR_PROGRESS_TYPE,
8442
+ readCommunication,
8443
+ resolveCommunicationPeer,
8444
+ legacySupervisorBody,
8543
8445
  SUBAGENT_CHILD_ENV,
8544
8446
  SUBAGENT_FANOUT_CHILD_ENV,
8545
8447
  SUBAGENT_PARENT_SESSION_ENV,
@@ -8564,14 +8466,6 @@ export {
8564
8466
  formatNestedAggregate,
8565
8467
  formatNestedRunStatusLines,
8566
8468
  resolveSubagentRequestParams,
8567
- DEFAULT_CONTROL_CONFIG,
8568
- resolveControlConfig,
8569
- deriveActivityState,
8570
- buildControlEvent,
8571
- shouldNotifyControlEvent,
8572
- claimControlNotification,
8573
- formatControlNoticeMessage,
8574
- formatControlIntercomMessage,
8575
8469
  writeAtomicJson,
8576
8470
  writePrivateAtomicJson,
8577
8471
  createNestedRoute,
@@ -8636,6 +8530,7 @@ export {
8636
8530
  resolveWatchdogConfig,
8637
8531
  buildWatchdogStatus,
8638
8532
  registerMainWatchdog,
8533
+ stopRequestPath,
8639
8534
  requestAsyncSteer,
8640
8535
  readSteerCapability,
8641
8536
  consumeSteerAcks,
@@ -0,0 +1,117 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ getAgentDir
4
+ } from "./chunk-FQMM2EZ2.js";
5
+
6
+ // packages/coding-agent/dist/gateway/pairing.js
7
+ import { randomInt } from "node:crypto";
8
+ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
9
+ import { join } from "node:path";
10
+ var CODE_ALPHABET = "ABCDEFGHJKMNPQRSTUVWXYZ23456789", CODE_LENGTH = 8, DEFAULT_TTL_MS = 3600 * 1e3, DEFAULT_RATE_LIMIT_MS = 600 * 1e3, DEFAULT_MAX_PENDING = 3, DEFAULT_MAX_FAILS = 5, DEFAULT_LOCKOUT_MS = 3600 * 1e3;
11
+ function normalizeCode(code) {
12
+ return code.replace(/-/g, "").trim().toUpperCase();
13
+ }
14
+ function generateCode() {
15
+ let code = "";
16
+ for (let i = 0; i < CODE_LENGTH; i++)
17
+ code += CODE_ALPHABET[randomInt(0, CODE_ALPHABET.length)];
18
+ return code;
19
+ }
20
+ function createPairingStore(options = {}) {
21
+ let dir = options.dir ?? join(getAgentDir(), "pairing"), ttlMs = options.ttlMs ?? DEFAULT_TTL_MS, rateLimitMs = options.rateLimitMs ?? DEFAULT_RATE_LIMIT_MS, maxPending = options.maxPending ?? DEFAULT_MAX_PENDING, maxFails = options.maxFails ?? DEFAULT_MAX_FAILS, lockoutMs = options.lockoutMs ?? DEFAULT_LOCKOUT_MS, now = options.now ?? (() => Date.now());
22
+ function storeFile() {
23
+ return join(dir, "store.json");
24
+ }
25
+ function read() {
26
+ let path = storeFile();
27
+ if (!existsSync(path))
28
+ return { pending: [], approved: [] };
29
+ try {
30
+ let parsed = JSON.parse(readFileSync(path, "utf-8"));
31
+ if (parsed == null || typeof parsed != "object" || Array.isArray(parsed))
32
+ return { pending: [], approved: [] };
33
+ let p = parsed, pending = Array.isArray(p.pending) ? p.pending : [], approved = Array.isArray(p.approved) ? p.approved : [];
34
+ return {
35
+ pending: pending.filter((c) => typeof c?.code == "string" && typeof c?.platform == "string" && typeof c?.userId == "string"),
36
+ approved: approved.filter((u) => typeof u?.platform == "string" && typeof u?.userId == "string"),
37
+ failedAttempts: typeof p.failedAttempts == "object" && p.failedAttempts !== null && !Array.isArray(p.failedAttempts) ? p.failedAttempts : void 0,
38
+ lockedOutUntil: typeof p.lockedOutUntil == "object" && p.lockedOutUntil !== null && !Array.isArray(p.lockedOutUntil) ? p.lockedOutUntil : void 0
39
+ };
40
+ } catch {
41
+ return { pending: [], approved: [] };
42
+ }
43
+ }
44
+ function write(data) {
45
+ existsSync(dir) || mkdirSync(dir, { recursive: !0 });
46
+ let path = storeFile(), tmp = `${path}.tmp-${process.pid}`;
47
+ writeFileSync(tmp, `${JSON.stringify(data, null, 2)}
48
+ `, "utf-8"), renameSync(tmp, path);
49
+ try {
50
+ chmodSync(path, 384);
51
+ } catch {
52
+ }
53
+ }
54
+ function isLockedOut(platform) {
55
+ let until = read().lockedOutUntil?.[platform] ?? 0;
56
+ return now() < until;
57
+ }
58
+ function recordFailedAttempt(platform) {
59
+ let data = read(), failed = data.failedAttempts ?? {};
60
+ if (failed[platform] = (failed[platform] ?? 0) + 1, failed[platform] >= maxFails) {
61
+ let locked = data.lockedOutUntil ?? {};
62
+ locked[platform] = now() + lockoutMs, failed[platform] = 0, data.lockedOutUntil = locked;
63
+ }
64
+ data.failedAttempts = failed, write(data);
65
+ }
66
+ function livePending(data) {
67
+ let cutoff = now() - ttlMs;
68
+ return data.pending.filter((c) => c.issuedAt >= cutoff);
69
+ }
70
+ return {
71
+ issueCode(platform, userId) {
72
+ if (isLockedOut(platform))
73
+ return null;
74
+ let data = read(), lastIssued = data.pending.filter((c) => c.platform === platform && c.userId === userId).reduce((max, c) => Math.max(max, c.issuedAt), 0);
75
+ if (lastIssued > 0 && now() - lastIssued < rateLimitMs)
76
+ return null;
77
+ let live = livePending(data);
78
+ if (live.filter((c) => c.platform === platform).length >= maxPending)
79
+ return null;
80
+ let entry = {
81
+ code: generateCode(),
82
+ platform,
83
+ userId,
84
+ issuedAt: now()
85
+ };
86
+ return data.pending = [...live, entry], write(data), entry.code;
87
+ },
88
+ approve(platform, code) {
89
+ if (isLockedOut(platform))
90
+ return null;
91
+ let data = read(), live = livePending(data), normalized = normalizeCode(code), match = live.find((c) => c.platform === platform && c.code === normalized);
92
+ return match ? (data.pending = live.filter((c) => c !== match), data.approved = [
93
+ ...data.approved.filter((u) => !(u.platform === platform && u.userId === match.userId)),
94
+ { platform, userId: match.userId, approvedAt: now() }
95
+ ], write(data), match.userId) : (recordFailedAttempt(platform), null);
96
+ },
97
+ isPaired(platform, userId) {
98
+ return read().approved.some((u) => u.platform === platform && u.userId === userId);
99
+ },
100
+ listPending() {
101
+ let data = read();
102
+ return livePending(data).map((c) => ({
103
+ code: c.code,
104
+ platform: c.platform,
105
+ userId: c.userId,
106
+ expiresAt: c.issuedAt + ttlMs
107
+ }));
108
+ },
109
+ listApproved() {
110
+ return read().approved.map((u) => ({ platform: u.platform, userId: u.userId, approvedAt: u.approvedAt }));
111
+ }
112
+ };
113
+ }
114
+
115
+ export {
116
+ createPairingStore
117
+ };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  theme
4
- } from "./chunk-RNBHABBA.js";
4
+ } from "./chunk-RDDAZOMU.js";
5
5
 
6
6
  // packages/coding-agent/dist/core/permission-mode.js
7
7
  var PERMISSION_MODE_BRIDGE_SYMBOL = /* @__PURE__ */ Symbol.for("@lunr/permission-mode"), getModeFn, bridge = {
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  estimateTokens
4
- } from "./chunk-STERBGUB.js";
4
+ } from "./chunk-OFKSVRV7.js";
5
5
 
6
6
  // packages/coding-agent/dist/core/context-breakdown.js
7
7
  var CHARS_PER_TOKEN = 4, PROJECT_CONTEXT_RE = /<project_context>[\s\S]*?<\/project_context>/, PROJECT_INSTRUCTIONS_RE = /<project_instructions(?:\s+path="([^"]*)")?>([\s\S]*?)<\/project_instructions>/g, SKILLS_BLOCK_RE = /\n\nThe following skills provide specialized instructions for specific tasks\.[\s\S]*<\/available_skills>/;