@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
@@ -4,6 +4,12 @@ import {
4
4
  createCompactionSummaryMessage,
5
5
  createCustomMessage
6
6
  } from "./chunk-FVDOXRUD.js";
7
+ import {
8
+ SessionOwnership,
9
+ SessionOwnershipError,
10
+ canonicalSessionPath,
11
+ writeSessionJson
12
+ } from "./chunk-UAEOTO52.js";
7
13
  import {
8
14
  getAgentDir,
9
15
  getSessionsDir,
@@ -13,8 +19,8 @@ import {
13
19
 
14
20
  // packages/coding-agent/dist/core/session-manager.js
15
21
  import { uuidv7 } from "@ashx-j/lunr-agent";
16
- import { randomUUID } from "crypto";
17
- import { appendFileSync, closeSync, createReadStream, existsSync, mkdirSync, openSync, readdirSync, readSync, statSync, writeFileSync } from "fs";
22
+ import { createHash, randomUUID } from "crypto";
23
+ import { appendFileSync, closeSync, createReadStream, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, statSync, writeFileSync } from "fs";
18
24
  import { readdir, stat } from "fs/promises";
19
25
  import { join, resolve } from "path";
20
26
  import { createInterface } from "readline";
@@ -332,29 +338,107 @@ var SessionManager = class _SessionManager {
332
338
  labelsById = /* @__PURE__ */ new Map();
333
339
  labelTimestampsById = /* @__PURE__ */ new Map();
334
340
  leafId = null;
341
+ ownership;
342
+ readOnly = !1;
343
+ disposed = !1;
344
+ permissionMode;
345
+ getPermissionMode() {
346
+ return this.permissionMode;
347
+ }
348
+ setPermissionMode(mode) {
349
+ this.assertWritable(), this.permissionMode = mode, this.saveLeaf();
350
+ }
351
+ assertWritable() {
352
+ if (this.readOnly || this.disposed)
353
+ throw new SessionOwnershipError(this.sessionFile ?? "in-memory", "Session is read-only or released.");
354
+ if (this.persist && (this.ownership?.assert(), this.ownership && this.sessionFile && canonicalSessionPath(this.sessionFile) !== this.ownership.owner.file))
355
+ throw new SessionOwnershipError(this.sessionFile, "Session ownership does not match the write target.");
356
+ }
357
+ getOwnership() {
358
+ return this.ownership;
359
+ }
360
+ copyInMemory() {
361
+ let copy = _SessionManager.inMemory(this.cwd);
362
+ return copy.sessionId = this.sessionId, copy.fileEntries = structuredClone(this.fileEntries), copy._buildIndex(), copy.leafId = this.leafId, copy;
363
+ }
364
+ dispose() {
365
+ this.disposed || (this.readOnly || this.saveLeaf(), this.ownership?.release(), this.disposed = !0);
366
+ }
367
+ flush() {
368
+ this.assertWritable(), this.persist && (this._rewriteFile(), this.flushed = !0, this.saveLeaf());
369
+ }
370
+ claim(file) {
371
+ this.assertWritable();
372
+ let canonical = canonicalSessionPath(file);
373
+ if (this.ownership?.owner.file === canonical)
374
+ return;
375
+ let next = new SessionOwnership(canonical);
376
+ this.saveLeaf(), this.ownership?.release(), this.ownership = next;
377
+ }
378
+ saveLeaf() {
379
+ !this.persist || !this.sessionFile || !this.flushed || (this.assertWritable(), writeSessionJson(`${this.sessionFile}.leaf.json`, {
380
+ id: this.sessionId,
381
+ leafId: this.leafId,
382
+ permissionMode: this.permissionMode,
383
+ revision: createHash("sha256").update(readFileSync(this.sessionFile)).digest("hex")
384
+ }));
385
+ }
386
+ restoreLeaf() {
387
+ if (this.sessionFile)
388
+ try {
389
+ let saved = JSON.parse(readFileSync(`${this.sessionFile}.leaf.json`, "utf8"));
390
+ saved.id === this.sessionId && ["manual", "yolo", "plan", "auto"].includes(saved.permissionMode) && (this.permissionMode = saved.permissionMode), saved.id === this.sessionId && (saved.leafId === null || this.byId.has(saved.leafId)) && saved.revision === createHash("sha256").update(readFileSync(this.sessionFile)).digest("hex") && (this.leafId = saved.leafId);
391
+ } catch {
392
+ }
393
+ }
335
394
  constructor(cwd, sessionDir, sessionFile, persist, newSessionOptions) {
336
- this.cwd = resolvePath(cwd), this.sessionDir = normalizePath(sessionDir), this.persist = persist, persist && this.sessionDir && !existsSync(this.sessionDir) && mkdirSync(this.sessionDir, { recursive: !0 }), sessionFile ? this.setSessionFile(sessionFile) : this.newSession(newSessionOptions);
395
+ this.cwd = resolvePath(cwd), this.sessionDir = normalizePath(sessionDir), this.persist = persist, persist && this.sessionDir && !existsSync(this.sessionDir) && mkdirSync(this.sessionDir, { recursive: !0 });
396
+ try {
397
+ sessionFile ? this.loadSessionFile(sessionFile) : this.newSession(newSessionOptions), this.ownership?.bindSession(this.sessionId);
398
+ } catch (error) {
399
+ throw this.ownership?.release(), error;
400
+ }
337
401
  }
338
402
  /** Switch to a different session file (used for resume and branching) */
339
403
  setSessionFile(sessionFile) {
340
- if (this.sessionFile = resolvePath(sessionFile), existsSync(this.sessionFile)) {
404
+ if (this.assertWritable(), this.sessionFile && canonicalSessionPath(sessionFile) === canonicalSessionPath(this.sessionFile)) {
405
+ this.loadSessionFile(sessionFile);
406
+ return;
407
+ }
408
+ let next = new _SessionManager(this.cwd, this.sessionDir, sessionFile, this.persist);
409
+ try {
410
+ this.dispose();
411
+ } catch (error) {
412
+ throw next.dispose(), error;
413
+ }
414
+ Object.assign(this, next);
415
+ }
416
+ loadSessionFile(sessionFile) {
417
+ if (this.claim(sessionFile), this.sessionFile = resolvePath(sessionFile), existsSync(this.sessionFile)) {
341
418
  if (this.fileEntries = loadEntriesFromFile(this.sessionFile), this.fileEntries.length === 0) {
342
419
  let explicitPath = this.sessionFile;
343
420
  if (statSync(explicitPath).size > 0)
344
421
  throw new Error(`Session file is not a valid pi session: ${explicitPath}`);
345
- this.newSession(), this.sessionFile = explicitPath, this._rewriteFile(), this.flushed = !0;
422
+ this.initializeSession(), this.sessionFile = explicitPath, this._rewriteFile(), this.flushed = !0;
346
423
  return;
347
424
  }
348
425
  let header = this.fileEntries.find((e) => e.type === "session");
349
- this.sessionId = header?.id ?? createSessionId(), migrateToCurrentVersion(this.fileEntries) && this._rewriteFile(), this._buildIndex(), this.flushed = !0;
426
+ this.sessionId = header?.id ?? createSessionId(), migrateToCurrentVersion(this.fileEntries) && this._rewriteFile(), this._buildIndex(), this.restoreLeaf(), this.flushed = !0;
350
427
  } else {
351
428
  let explicitPath = this.sessionFile;
352
- this.newSession(), this.sessionFile = explicitPath;
429
+ this.initializeSession(), this.sessionFile = explicitPath;
353
430
  }
354
431
  }
355
432
  newSession(options) {
433
+ this.assertWritable();
434
+ let id = options?.id ?? createSessionId();
435
+ assertValidSessionId(id);
436
+ let timestamp = (/* @__PURE__ */ new Date()).toISOString();
437
+ return this.persist && this.claim(join(this.getSessionDir(), `${timestamp.replace(/[:.]/g, "-")}_${id}.jsonl`)), this.initializeSession({ ...options, id }, timestamp), this.ownership?.bindSession(this.sessionId), this.sessionFile;
438
+ }
439
+ initializeSession(options, timestamp = (/* @__PURE__ */ new Date()).toISOString()) {
356
440
  options?.id !== void 0 && assertValidSessionId(options.id), this.sessionId = options?.id ?? createSessionId();
357
- let timestamp = (/* @__PURE__ */ new Date()).toISOString(), header = {
441
+ let header = {
358
442
  type: "session",
359
443
  version: CURRENT_SESSION_VERSION,
360
444
  id: this.sessionId,
@@ -362,7 +446,7 @@ var SessionManager = class _SessionManager {
362
446
  cwd: this.cwd,
363
447
  parentSession: options?.parentSession
364
448
  };
365
- if (this.fileEntries = [header], this.byId.clear(), this.labelsById.clear(), this.labelTimestampsById.clear(), this.leafId = null, this.flushed = !1, this.persist) {
449
+ if (this.fileEntries = [header], this.byId.clear(), this.labelsById.clear(), this.labelTimestampsById.clear(), this.leafId = null, this.flushed = !1, this.permissionMode = void 0, this.persist) {
366
450
  let fileTimestamp = timestamp.replace(/[:.]/g, "-");
367
451
  this.sessionFile = join(this.getSessionDir(), `${fileTimestamp}_${this.sessionId}.jsonl`);
368
452
  }
@@ -374,7 +458,7 @@ var SessionManager = class _SessionManager {
374
458
  entry.type !== "session" && (this.byId.set(entry.id, entry), this.leafId = entry.id, entry.type === "label" && (entry.label ? (this.labelsById.set(entry.targetId, entry.label), this.labelTimestampsById.set(entry.targetId, entry.timestamp)) : (this.labelsById.delete(entry.targetId), this.labelTimestampsById.delete(entry.targetId))));
375
459
  }
376
460
  _rewriteFile() {
377
- if (!this.persist || !this.sessionFile)
461
+ if (this.assertWritable(), !this.persist || !this.sessionFile)
378
462
  return;
379
463
  let fd = openSync(this.sessionFile, "w");
380
464
  try {
@@ -404,7 +488,7 @@ var SessionManager = class _SessionManager {
404
488
  return this.sessionFile;
405
489
  }
406
490
  _persist(entry) {
407
- if (!this.persist || !this.sessionFile)
491
+ if (this.assertWritable(), !this.persist || !this.sessionFile)
408
492
  return;
409
493
  if (!this.fileEntries.some((e) => e.type === "message" && e.message.role === "assistant")) {
410
494
  this.flushed ? appendFileSync(this.sessionFile, `${JSON.stringify(entry)}
@@ -427,7 +511,7 @@ var SessionManager = class _SessionManager {
427
511
  }
428
512
  }
429
513
  _appendEntry(entry) {
430
- this.fileEntries.push(entry), this.byId.set(entry.id, entry), this.leafId = entry.id, this._persist(entry);
514
+ this.assertWritable(), this.fileEntries.push(entry), this.byId.set(entry.id, entry), this.leafId = entry.id, this._persist(entry);
431
515
  }
432
516
  /** Append a message as child of current leaf, then advance leaf. Returns entry id.
433
517
  * Does not allow writing CompactionSummaryMessage and BranchSummaryMessage directly.
@@ -658,9 +742,9 @@ var SessionManager = class _SessionManager {
658
742
  * are not modified or deleted.
659
743
  */
660
744
  branch(branchFromId) {
661
- if (!this.byId.has(branchFromId))
745
+ if (this.assertWritable(), !this.byId.has(branchFromId))
662
746
  throw new Error(`Entry ${branchFromId} not found`);
663
- this.leafId = branchFromId;
747
+ this.leafId = branchFromId, this.flush();
664
748
  }
665
749
  /**
666
750
  * Reset the leaf pointer to null (before any entries).
@@ -668,7 +752,7 @@ var SessionManager = class _SessionManager {
668
752
  * Use this when navigating to re-edit the first user message.
669
753
  */
670
754
  resetLeaf() {
671
- this.leafId = null;
755
+ this.assertWritable(), this.leafId = null, this.flush();
672
756
  }
673
757
  /**
674
758
  * Start a new branch with a summary of the abandoned path.
@@ -676,7 +760,7 @@ var SessionManager = class _SessionManager {
676
760
  * context from the abandoned conversation path.
677
761
  */
678
762
  branchWithSummary(branchFromId, summary, details, fromHook) {
679
- if (branchFromId !== null && !this.byId.has(branchFromId))
763
+ if (this.assertWritable(), branchFromId !== null && !this.byId.has(branchFromId))
680
764
  throw new Error(`Entry ${branchFromId} not found`);
681
765
  this.leafId = branchFromId;
682
766
  let entry = {
@@ -697,6 +781,7 @@ var SessionManager = class _SessionManager {
697
781
  * Returns the new session file path, or undefined if not persisting.
698
782
  */
699
783
  createBranchedSession(leafId) {
784
+ this.assertWritable();
700
785
  let previousSessionFile = this.sessionFile, path = this.getBranch(leafId);
701
786
  if (path.length === 0)
702
787
  throw new Error(`Entry ${leafId} not found`);
@@ -726,7 +811,7 @@ var SessionManager = class _SessionManager {
726
811
  };
727
812
  pathEntryIds.add(labelEntry.id), labelEntries2.push(labelEntry), parentId2 = labelEntry.id;
728
813
  }
729
- return this.fileEntries = [header, ...pathWithoutLabels, ...labelEntries2], this.sessionId = newSessionId, this.sessionFile = newSessionFile, this._buildIndex(), this.fileEntries.some((e) => e.type === "message" && e.message.role === "assistant") ? (this._rewriteFile(), this.flushed = !0) : this.flushed = !1, newSessionFile;
814
+ return this.claim(newSessionFile), this.fileEntries = [header, ...pathWithoutLabels, ...labelEntries2], this.sessionId = newSessionId, this.ownership?.bindSession(this.sessionId), this.sessionFile = newSessionFile, this._buildIndex(), this.fileEntries.some((e) => e.type === "message" && e.message.role === "assistant") ? (this._rewriteFile(), this.flushed = !0) : this.flushed = !1, newSessionFile;
730
815
  }
731
816
  let labelEntries = [], parentId = pathWithoutLabels[pathWithoutLabels.length - 1]?.id || null;
732
817
  for (let { targetId, label, timestamp: labelTimestamp } of labelsToWrite) {
@@ -758,8 +843,21 @@ var SessionManager = class _SessionManager {
758
843
  * @param cwdOverride Optional cwd override instead of the session header cwd.
759
844
  */
760
845
  static open(path, sessionDir, cwdOverride) {
761
- let resolvedPath = resolvePath(path), header = loadEntriesFromFile(resolvedPath).find((e) => e.type === "session"), cwd = cwdOverride ?? header?.cwd ?? process.cwd(), dir = sessionDir ? normalizePath(sessionDir) : resolve(resolvedPath, "..");
762
- return new _SessionManager(cwd, dir, resolvedPath, !0);
846
+ let resolvedPath = resolvePath(path), dir = sessionDir ? normalizePath(sessionDir) : resolve(resolvedPath, ".."), manager = new _SessionManager(cwdOverride ?? process.cwd(), dir, resolvedPath, !0);
847
+ return manager.cwd = resolvePath(cwdOverride ?? manager.getHeader()?.cwd ?? process.cwd()), manager;
848
+ }
849
+ static forkBranch(path, leafId, sessionDir) {
850
+ let manager = _SessionManager.openReadOnly(path);
851
+ return manager.readOnly = !1, manager.persist = !0, sessionDir && (manager.sessionDir = sessionDir), manager.createBranchedSession(leafId), manager;
852
+ }
853
+ static openReadOnly(path) {
854
+ let file = canonicalSessionPath(path), entries = loadEntriesFromFile(file);
855
+ migrateToCurrentVersion(entries);
856
+ let header = entries.find((entry) => entry.type === "session");
857
+ if (!header)
858
+ throw new Error(`Invalid session: ${file}`);
859
+ let manager = _SessionManager.inMemory(header.cwd);
860
+ return manager.sessionFile = file, manager.sessionDir = resolve(file, ".."), manager.sessionId = header.id, manager.fileEntries = entries, manager._buildIndex(), manager.restoreLeaf(), manager.readOnly = !0, manager;
763
861
  }
764
862
  /**
765
863
  * Continue the most recent session, or create new if none.
@@ -789,20 +887,21 @@ var SessionManager = class _SessionManager {
789
887
  throw new Error(`Cannot fork: source session has no header: ${resolvedSourcePath}`);
790
888
  let dir = sessionDir ? normalizePath(sessionDir) : getDefaultSessionDir(resolvedTargetCwd);
791
889
  existsSync(dir) || mkdirSync(dir, { recursive: !0 }), options?.id !== void 0 && assertValidSessionId(options.id);
792
- let newSessionId = options?.id ?? createSessionId(), timestamp = (/* @__PURE__ */ new Date()).toISOString(), fileTimestamp = timestamp.replace(/[:.]/g, "-"), newSessionFile = join(dir, `${fileTimestamp}_${newSessionId}.jsonl`);
793
- writeFileSync(newSessionFile, `${JSON.stringify({
890
+ let newSessionId = options?.id ?? createSessionId(), timestamp = (/* @__PURE__ */ new Date()).toISOString(), fileTimestamp = timestamp.replace(/[:.]/g, "-"), newSessionFile = join(dir, `${fileTimestamp}_${newSessionId}.jsonl`), newHeader = {
794
891
  type: "session",
795
892
  version: CURRENT_SESSION_VERSION,
796
893
  id: newSessionId,
797
894
  timestamp,
798
895
  cwd: resolvedTargetCwd,
799
896
  parentSession: resolvedSourcePath
800
- })}
801
- `, { flag: "wx" });
802
- for (let entry of sourceEntries)
803
- entry.type !== "session" && appendFileSync(newSessionFile, `${JSON.stringify(entry)}
804
- `);
805
- return new _SessionManager(resolvedTargetCwd, dir, newSessionFile, !0);
897
+ }, manager = new _SessionManager(resolvedTargetCwd, dir, newSessionFile, !0);
898
+ try {
899
+ manager.fileEntries = [newHeader, ...sourceEntries.filter((entry) => entry.type !== "session")], manager.sessionId = newSessionId, manager.ownership?.bindSession(newSessionId), manager._buildIndex();
900
+ let snapshot = _SessionManager.openReadOnly(sourcePath);
901
+ return manager.leafId = snapshot.getLeafId(), manager.flush(), manager;
902
+ } catch (error) {
903
+ throw manager.dispose(), error;
904
+ }
806
905
  }
807
906
  /**
808
907
  * List all sessions for a directory.
@@ -0,0 +1,10 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+
3
+ // packages/coding-agent/dist/core/experimental.js
4
+ function areExperimentalFeaturesEnabled() {
5
+ return process.env.PI_EXPERIMENTAL === "1";
6
+ }
7
+
8
+ export {
9
+ areExperimentalFeaturesEnabled
10
+ };
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
3
3
  import {
4
4
  parseArgs
5
- } from "./chunk-QZMODZQ2.js";
5
+ } from "./chunk-E24EO34J.js";
6
6
  import {
7
7
  markStartupMilestone
8
8
  } from "./chunk-CCZJ3PYY.js";
@@ -57,7 +57,7 @@ var args = process.argv.slice(2), startupBenchmark = process.env.PI_STARTUP_BENC
57
57
  markStartupMilestone("mode_routed");
58
58
  var startupView;
59
59
  if (preloadMode === "interactive") {
60
- let { InteractiveView } = await import("./interactive-view-ILS6TAN5.js");
60
+ let { InteractiveView } = await import("./interactive-view-IDSCPPK7.js");
61
61
  startupView = new InteractiveView(), startupView.start(), await startupView.waitForFirstFrame(), startupView.isExitRequested && process.exit(0);
62
62
  }
63
63
  var startRuntime = async () => {
@@ -0,0 +1,45 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import "./chunk-BRJX2PRC.js";
3
+
4
+ // packages/coding-agent/dist/gateway/command.js
5
+ async function handleGatewayCommand(args) {
6
+ if (args[0] !== "gateway")
7
+ return !1;
8
+ try {
9
+ let sub = args[1];
10
+ if (sub === "setup")
11
+ await (await import("./setup-NRXVZBLJ.js")).setupGateway();
12
+ else if (sub === "pair" && args[2] === "approve" && args.includes("--owner"))
13
+ console.log((await import("./setup-NRXVZBLJ.js")).approveGatewayOwner(args[3], args[4]));
14
+ else if (["start", "stop", "restart", "status", "logs", "doctor", "autostart"].includes(sub)) {
15
+ let service = await import("./service-ISSP6VHE.js");
16
+ if (sub === "start" && console.log(await service.startGatewayService()), sub === "stop" && console.log(await service.stopGatewayService()), sub === "restart" && (await service.stopGatewayService(), console.log(await service.startGatewayService())), (sub === "status" || sub === "doctor") && console.log(service.serviceStatusText()), sub === "logs" && console.log(service.readGatewayLog()), sub === "autostart") {
17
+ let mode = args[2];
18
+ if (mode !== "off" && mode !== "login" && mode !== "boot")
19
+ throw new Error("Usage: lunr gateway autostart off|login|boot");
20
+ await service.configureStartup(mode), console.log(`Automatic startup: ${mode}`);
21
+ }
22
+ if (sub === "doctor") {
23
+ let { loadGatewayConfig, resolvePlatformToken } = await import("./config-RORQUQFG.js"), cfg = loadGatewayConfig();
24
+ for (let platform of ["telegram", "discord"])
25
+ console.log(`${platform}: ${cfg[platform].enabled ? "enabled" : "disabled"}, token ${resolvePlatformToken(platform, cfg[platform]) ? "configured" : "missing"}, owners ${cfg.owners?.[platform].length ?? 0}`);
26
+ console.log(`Project roots: ${cfg.projectRoots?.length ?? 0}. Run lunr gateway setup to change these.
27
+ If startup is not responding, inspect lunr gateway logs. Do not delete a lock while its process is alive.`);
28
+ }
29
+ } else if (sub === "--help" || sub === "help" || sub === "-h")
30
+ console.log(`lunr gateway setup|start|stop|restart|status|logs|doctor|run
31
+ lunr gateway autostart off|login|boot
32
+ lunr gateway pair approve <platform> <code> [--owner]
33
+ lunr gateway pair list`);
34
+ else {
35
+ let { runGateway } = await import("./gateway-VFO6SFKK.js");
36
+ process.exitCode = await runGateway(sub === "run" ? args.slice(2) : args.slice(1));
37
+ }
38
+ } catch (error) {
39
+ console.error(error instanceof Error ? error.message : String(error)), process.exitCode = 1;
40
+ }
41
+ return !0;
42
+ }
43
+ export {
44
+ handleGatewayCommand
45
+ };
@@ -0,0 +1,36 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ CHAT_COMMANDS,
4
+ botCommandSpecs,
5
+ formatHelpText,
6
+ runChatCommand,
7
+ sendCommandReply
8
+ } from "./chunk-BFNXONG3.js";
9
+ import "./chunk-V2A7CEXK.js";
10
+ import "./chunk-VJPTNWAP.js";
11
+ import "./chunk-RMQZU2YU.js";
12
+ import "./chunk-UWPJL22I.js";
13
+ import "./chunk-TQGPP4SC.js";
14
+ import "./chunk-OFKSVRV7.js";
15
+ import "./chunk-5BNJ4JUH.js";
16
+ import "./chunk-CGBXPL3E.js";
17
+ import "./chunk-BBUVIEZB.js";
18
+ import "./chunk-5D7LC2ZQ.js";
19
+ import "./chunk-M3LZLQW2.js";
20
+ import "./chunk-XLTL257W.js";
21
+ import "./chunk-FVDOXRUD.js";
22
+ import "./chunk-IMLCWLPI.js";
23
+ import "./chunk-UAEOTO52.js";
24
+ import "./chunk-R3K2F5GI.js";
25
+ import "./chunk-E24EO34J.js";
26
+ import "./chunk-7QWNYZDI.js";
27
+ import "./chunk-FQMM2EZ2.js";
28
+ import "./chunk-Q4Q6D4IY.js";
29
+ import "./chunk-BRJX2PRC.js";
30
+ export {
31
+ CHAT_COMMANDS,
32
+ botCommandSpecs,
33
+ formatHelpText,
34
+ runChatCommand,
35
+ sendCommandReply
36
+ };
@@ -5,7 +5,13 @@ import {
5
5
  lazyConnect,
6
6
  updateMetadataCache,
7
7
  updateStatusBar
8
- } from "./chunk-UWQYRSYQ.js";
8
+ } from "./chunk-YJMMG7C6.js";
9
+ import {
10
+ authenticate,
11
+ getAuthForUrl,
12
+ removeAuth,
13
+ supportsOAuth
14
+ } from "./chunk-4TLO4PO2.js";
9
15
  import {
10
16
  ensureCompatibilityImports,
11
17
  getMcpDiscoverySummary,
@@ -19,17 +25,11 @@ import {
19
25
  writeSharedServerEntry,
20
26
  writeStarterProjectConfig
21
27
  } from "./chunk-VSELYKWU.js";
22
- import {
23
- authenticate,
24
- getAuthForUrl,
25
- removeAuth,
26
- supportsOAuth
27
- } from "./chunk-4TLO4PO2.js";
28
28
  import {
29
29
  getAgentPath
30
30
  } from "./chunk-4HXHDDCF.js";
31
- import "./chunk-BI3DHYCN.js";
32
31
  import "./chunk-ARC4KOTI.js";
32
+ import "./chunk-BI3DHYCN.js";
33
33
  import "./chunk-Q4Q6D4IY.js";
34
34
  import "./chunk-BRJX2PRC.js";
35
35
 
@@ -255,7 +255,7 @@ function buildMcpPanelCallbacks(state, config, ctx) {
255
255
  async function openMcpPanel(state, pi, ctx, configOverridePath) {
256
256
  if (Object.keys(state.config.mcpServers).length === 0)
257
257
  return openMcpSetup(state, pi, ctx, configOverridePath, "empty");
258
- let config = state.config, cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), { lines: noticeLines, fingerprint } = buildSharedConfigNoticeLines(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-IIGMXQGP.js"), configChanged = !1;
258
+ let config = state.config, cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), { lines: noticeLines, fingerprint } = buildSharedConfigNoticeLines(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-KTTFXJZ4.js"), configChanged = !1;
259
259
  return await new Promise((resolve) => {
260
260
  ctx.ui.custom((tui, _theme, keybindings, done) => createMcpPanel(config, cache, provenanceMap, callbacks, tui, (result) => {
261
261
  !result.cancelled && result.changes.size > 0 && (writeDirectToolsConfig(result.changes, provenanceMap, config), configChanged = !0, ctx.ui.notify("Direct tools updated. Pi will reload after this panel closes.", "info")), done(void 0), resolve();
@@ -268,7 +268,7 @@ async function openMcpAuthPanel(state, pi, ctx, configOverridePath) {
268
268
  let config = state.config;
269
269
  if (Object.entries(config.mcpServers).filter(([, definition]) => supportsOAuth(definition)).length === 0)
270
270
  return ctx.ui.notify("No OAuth-capable MCP servers are configured.", "warning"), { configChanged: !1 };
271
- let cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-IIGMXQGP.js");
271
+ let cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-KTTFXJZ4.js");
272
272
  return await new Promise((resolve) => {
273
273
  ctx.ui.custom((tui, _theme, keybindings, done) => createMcpPanel(config, cache, provenanceMap, callbacks, tui, () => {
274
274
  done(void 0), resolve();
@@ -0,0 +1,20 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ defaultGatewayConfig,
4
+ gatewayConfigPath,
5
+ loadGatewayConfig,
6
+ platformConfigFor,
7
+ resolvePlatformToken,
8
+ saveGatewayConfig
9
+ } from "./chunk-R3K2F5GI.js";
10
+ import "./chunk-FQMM2EZ2.js";
11
+ import "./chunk-Q4Q6D4IY.js";
12
+ import "./chunk-BRJX2PRC.js";
13
+ export {
14
+ defaultGatewayConfig,
15
+ gatewayConfigPath,
16
+ loadGatewayConfig,
17
+ platformConfigFor,
18
+ resolvePlatformToken,
19
+ saveGatewayConfig
20
+ };
@@ -3,7 +3,8 @@ import {
3
3
  CUSTOMIZE_BRIDGE_SYMBOL,
4
4
  getCustomizeBridge,
5
5
  registerCustomizeBridge
6
- } from "./chunk-VGYZ3APQ.js";
6
+ } from "./chunk-4EULYYR4.js";
7
+ import "./chunk-IMLCWLPI.js";
7
8
  import "./chunk-BRJX2PRC.js";
8
9
  export {
9
10
  CUSTOMIZE_BRIDGE_SYMBOL,
@@ -6,25 +6,25 @@ import {
6
6
  resolveMcpOutputGuardOptions,
7
7
  resolveMcpResultContent,
8
8
  transformMcpContent
9
- } from "./chunk-IRPJXI6U.js";
9
+ } from "./chunk-BX2RB477.js";
10
10
  import {
11
11
  formatSchema,
12
12
  getFailureAgeSeconds,
13
13
  lazyConnect
14
- } from "./chunk-UWQYRSYQ.js";
15
- import {
16
- abortable,
17
- formatAuthRequiredMessage,
18
- throwIfAborted
19
- } from "./chunk-VSELYKWU.js";
14
+ } from "./chunk-YJMMG7C6.js";
20
15
  import {
21
16
  UrlElicitationRequiredError,
22
17
  authenticate,
23
18
  supportsOAuth
24
19
  } from "./chunk-4TLO4PO2.js";
20
+ import {
21
+ abortable,
22
+ formatAuthRequiredMessage,
23
+ throwIfAborted
24
+ } from "./chunk-VSELYKWU.js";
25
25
  import "./chunk-4HXHDDCF.js";
26
- import "./chunk-BI3DHYCN.js";
27
26
  import "./chunk-ARC4KOTI.js";
27
+ import "./chunk-BI3DHYCN.js";
28
28
  import "./chunk-Q4Q6D4IY.js";
29
29
  import "./chunk-BRJX2PRC.js";
30
30
 
@@ -1,12 +1,13 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  SessionManager
4
- } from "./chunk-GKLEQ3I4.js";
4
+ } from "./chunk-XLTL257W.js";
5
5
  import "./chunk-FVDOXRUD.js";
6
+ import "./chunk-UAEOTO52.js";
6
7
  import {
7
8
  getResolvedThemeColors,
8
9
  getThemeExportColors
9
- } from "./chunk-RNBHABBA.js";
10
+ } from "./chunk-7QWNYZDI.js";
10
11
  import {
11
12
  APP_NAME,
12
13
  getExportTemplateDir,
@@ -131,7 +132,7 @@ async function exportFromFile(inputPath, options) {
131
132
  let opts = typeof options == "string" ? { outputPath: options } : options || {}, resolvedInputPath = resolvePath(inputPath);
132
133
  if (!existsSync(resolvedInputPath))
133
134
  throw new Error(`File not found: ${resolvedInputPath}`);
134
- let sm = SessionManager.open(resolvedInputPath), sessionData = {
135
+ let sm = SessionManager.openReadOnly(resolvedInputPath), sessionData = {
135
136
  header: sm.getHeader(),
136
137
  entries: sm.getEntries(),
137
138
  leafId: sm.getLeafId(),
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  ExtensionInputComponent
4
- } from "./chunk-2SJB2AWP.js";
4
+ } from "./chunk-PC2Z5TKZ.js";
5
5
  import "./chunk-I6R76AG7.js";
6
- import "./chunk-BOHIDQT4.js";
7
- import "./chunk-DDWHZ633.js";
8
- import "./chunk-RNBHABBA.js";
6
+ import "./chunk-6B2POMK7.js";
7
+ import "./chunk-GNN7H3B7.js";
8
+ import "./chunk-7QWNYZDI.js";
9
9
  import "./chunk-FQMM2EZ2.js";
10
10
  import "./chunk-Q4Q6D4IY.js";
11
11
  import "./chunk-BRJX2PRC.js";
@@ -1,11 +1,11 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
2
  import {
3
3
  ExtensionSelectorComponent
4
- } from "./chunk-6KDIOJL3.js";
4
+ } from "./chunk-6427XAWG.js";
5
5
  import "./chunk-I6R76AG7.js";
6
- import "./chunk-BOHIDQT4.js";
7
- import "./chunk-DDWHZ633.js";
8
- import "./chunk-RNBHABBA.js";
6
+ import "./chunk-6B2POMK7.js";
7
+ import "./chunk-GNN7H3B7.js";
8
+ import "./chunk-7QWNYZDI.js";
9
9
  import "./chunk-FQMM2EZ2.js";
10
10
  import "./chunk-Q4Q6D4IY.js";
11
11
  import "./chunk-BRJX2PRC.js";
@@ -4,8 +4,8 @@ import {
4
4
  extractHeadingTitle,
5
5
  fetchAllContent,
6
6
  loadSsrfAllowRanges
7
- } from "./chunk-WJVFOIB5.js";
8
- import "./chunk-7NBZ5P7I.js";
7
+ } from "./chunk-UQUCFAJ3.js";
8
+ import "./chunk-NAY6UUQZ.js";
9
9
  import "./chunk-DAPBPCBP.js";
10
10
  import "./chunk-VRB2IYGG.js";
11
11
  import "./chunk-BRJX2PRC.js";