@ashx-j/lunr 0.2.17 → 0.2.19

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 (330) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +2 -1
  3. package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
  4. package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
  5. package/dist/builtin-extensions/ashxj-thinking.js +44 -19
  6. package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +2 -1
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
  11. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  12. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +172 -171
  13. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  14. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +50 -0
  15. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
  16. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +131 -0
  17. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
  18. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
  19. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
  20. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
  21. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
  22. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
  23. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  24. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
  25. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  26. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  27. package/dist/builtin-extensions/pi-mcp-adapter/index.js +276 -109
  28. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  29. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
  30. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
  31. package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
  32. package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
  33. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
  35. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
  36. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
  37. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
  38. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
  39. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
  40. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
  41. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
  42. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
  43. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
  44. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
  45. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
  46. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  49. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +68 -15
  50. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
  54. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
  63. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +72 -31
  65. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
  69. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
  70. package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
  71. package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
  72. package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
  73. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
  74. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
  75. package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
  76. package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
  77. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
  78. package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
  79. package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
  80. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  81. package/dist/builtin-extensions/pi-web-access/index.js +259 -168
  82. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  83. package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
  84. package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
  85. package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
  86. package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
  87. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
  88. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
  89. package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
  90. package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
  91. package/dist/cli-runtime.d.ts +3 -0
  92. package/dist/cli-runtime.d.ts.map +1 -0
  93. package/dist/cli-runtime.js +72 -0
  94. package/dist/cli-runtime.js.map +1 -0
  95. package/dist/cli.d.ts.map +1 -1
  96. package/dist/cli.js +11 -60
  97. package/dist/cli.js.map +1 -1
  98. package/dist/config.d.ts +1 -0
  99. package/dist/config.d.ts.map +1 -1
  100. package/dist/config.js +1 -0
  101. package/dist/config.js.map +1 -1
  102. package/dist/core/agent-session.d.ts.map +1 -1
  103. package/dist/core/agent-session.js +6 -3
  104. package/dist/core/agent-session.js.map +1 -1
  105. package/dist/core/extensions/host-static.d.ts.map +1 -1
  106. package/dist/core/extensions/host-static.js +34 -12
  107. package/dist/core/extensions/host-static.js.map +1 -1
  108. package/dist/core/extensions/loader.d.ts +1 -2
  109. package/dist/core/extensions/loader.d.ts.map +1 -1
  110. package/dist/core/extensions/loader.js +10 -64
  111. package/dist/core/extensions/loader.js.map +1 -1
  112. package/dist/core/keybindings.d.ts +2 -2
  113. package/dist/core/keybindings.d.ts.map +1 -1
  114. package/dist/core/keybindings.js +2 -2
  115. package/dist/core/keybindings.js.map +1 -1
  116. package/dist/core/package-manager.d.ts.map +1 -1
  117. package/dist/core/package-manager.js +1 -1
  118. package/dist/core/package-manager.js.map +1 -1
  119. package/dist/core/sdk.d.ts +1 -1
  120. package/dist/core/sdk.d.ts.map +1 -1
  121. package/dist/core/sdk.js +1 -1
  122. package/dist/core/sdk.js.map +1 -1
  123. package/dist/core/timings.d.ts +2 -1
  124. package/dist/core/timings.d.ts.map +1 -1
  125. package/dist/core/timings.js +17 -2
  126. package/dist/core/timings.js.map +1 -1
  127. package/dist/gateway/agent-bridge.d.ts +6 -1
  128. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  129. package/dist/gateway/agent-bridge.js +23 -6
  130. package/dist/gateway/agent-bridge.js.map +1 -1
  131. package/dist/gateway/cron.d.ts +1 -1
  132. package/dist/gateway/cron.d.ts.map +1 -1
  133. package/dist/gateway/cron.js +3 -1
  134. package/dist/gateway/cron.js.map +1 -1
  135. package/dist/main.d.ts.map +1 -1
  136. package/dist/main.js +20 -14
  137. package/dist/main.js.map +1 -1
  138. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  139. package/dist/modes/interactive/interactive-mode.js +10 -8
  140. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  141. package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
  142. package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
  143. package/dist/modes/interactive/thinking-level-slash.js +23 -0
  144. package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
  145. package/dist/node-runtime/agent-session-services-35WNVGMR.js +36 -0
  146. package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
  147. package/dist/node-runtime/brave-UWDA3I22.js +143 -0
  148. package/dist/node-runtime/builtin-extensions-322XDDEM.js +28 -0
  149. package/dist/node-runtime/chunk-2SJB2AWP.js +47 -0
  150. package/dist/node-runtime/chunk-3NMWLTPV.js +64 -0
  151. package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
  152. package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
  153. package/dist/node-runtime/chunk-4CSFRBCN.js +7558 -0
  154. package/dist/node-runtime/chunk-4DJ6HEGH.js +296 -0
  155. package/dist/node-runtime/chunk-4FX25LWP.js +1345 -0
  156. package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
  157. package/dist/node-runtime/chunk-4I23VTC4.js +429 -0
  158. package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
  159. package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
  160. package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
  161. package/dist/node-runtime/chunk-5EFIU3OM.js +295 -0
  162. package/dist/node-runtime/chunk-6BEIBLQ3.js +53 -0
  163. package/dist/node-runtime/chunk-6KDIOJL3.js +72 -0
  164. package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
  165. package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
  166. package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
  167. package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
  168. package/dist/node-runtime/chunk-AROOY4BB.js +173 -0
  169. package/dist/node-runtime/chunk-ATGA2WLC.js +5646 -0
  170. package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
  171. package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
  172. package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
  173. package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
  174. package/dist/node-runtime/chunk-BOHIDQT4.js +21 -0
  175. package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
  176. package/dist/node-runtime/chunk-CBGB57XT.js +20211 -0
  177. package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
  178. package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
  179. package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
  180. package/dist/node-runtime/chunk-CSFI6YXL.js +130 -0
  181. package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
  182. package/dist/node-runtime/chunk-DDWHZ633.js +37 -0
  183. package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
  184. package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
  185. package/dist/node-runtime/chunk-FQMM2EZ2.js +248 -0
  186. package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
  187. package/dist/node-runtime/chunk-G6LRAP36.js +105 -0
  188. package/dist/node-runtime/chunk-GKLEQ3I4.js +860 -0
  189. package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
  190. package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
  191. package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
  192. package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
  193. package/dist/node-runtime/chunk-IRPJXI6U.js +1269 -0
  194. package/dist/node-runtime/chunk-J26TSGDL.js +633 -0
  195. package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
  196. package/dist/node-runtime/chunk-JZQ7F36T.js +610 -0
  197. package/dist/node-runtime/chunk-KBKMCJDU.js +126 -0
  198. package/dist/node-runtime/chunk-KWA4OC2J.js +100 -0
  199. package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
  200. package/dist/node-runtime/chunk-MCUNIRD5.js +8388 -0
  201. package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
  202. package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
  203. package/dist/node-runtime/chunk-OCVIXVTZ.js +88 -0
  204. package/dist/node-runtime/chunk-OPEK5RRY.js +466 -0
  205. package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
  206. package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
  207. package/dist/node-runtime/chunk-PNJSG3IZ.js +807 -0
  208. package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
  209. package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
  210. package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
  211. package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
  212. package/dist/node-runtime/chunk-QZMODZQ2.js +305 -0
  213. package/dist/node-runtime/chunk-RNBHABBA.js +986 -0
  214. package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
  215. package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
  216. package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
  217. package/dist/node-runtime/chunk-STERBGUB.js +949 -0
  218. package/dist/node-runtime/chunk-TFBIJTM3.js +966 -0
  219. package/dist/node-runtime/chunk-TXHKBRHZ.js +9450 -0
  220. package/dist/node-runtime/chunk-UWQYRSYQ.js +8973 -0
  221. package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
  222. package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
  223. package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
  224. package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
  225. package/dist/node-runtime/chunk-WKDK4C5P.js +2834 -0
  226. package/dist/node-runtime/chunk-XATUM2HK.js +46 -0
  227. package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
  228. package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
  229. package/dist/node-runtime/chunk-ZRCBN365.js +1734 -0
  230. package/dist/node-runtime/cli-runtime.js +80 -0
  231. package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
  232. package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
  233. package/dist/node-runtime/command-DWUM5X3U.js +13 -0
  234. package/dist/node-runtime/commands-MV5KOZ64.js +291 -0
  235. package/dist/node-runtime/config-QDD5PUE2.js +73 -0
  236. package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
  237. package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
  238. package/dist/node-runtime/direct-tool-executor-BK7CLEBX.js +188 -0
  239. package/dist/node-runtime/exa-LL64QZR2.js +329 -0
  240. package/dist/node-runtime/export-html-TEXVV5RP.js +150 -0
  241. package/dist/node-runtime/extension-input-O4HSAEM4.js +14 -0
  242. package/dist/node-runtime/extension-selector-X5FCX43D.js +14 -0
  243. package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
  244. package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
  245. package/dist/node-runtime/gateway-UZXMFGWY.js +2137 -0
  246. package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
  247. package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
  248. package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
  249. package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
  250. package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
  251. package/dist/node-runtime/goal-NJEE5CTU.js +1831 -0
  252. package/dist/node-runtime/index.js +859 -0
  253. package/dist/node-runtime/init-3C7Z24OI.js +28 -0
  254. package/dist/node-runtime/install-cli-EXMJQESX.js +308 -0
  255. package/dist/node-runtime/interactive-mode-QT5IKGQ5.js +56 -0
  256. package/dist/node-runtime/interactive-view-ILS6TAN5.js +247 -0
  257. package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
  258. package/dist/node-runtime/lunr-cron-QPBTKBGI.js +272 -0
  259. package/dist/node-runtime/main.js +54 -0
  260. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
  261. package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
  262. package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
  263. package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
  264. package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
  265. package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
  266. package/dist/node-runtime/package-manager-cli-7RKSZGEN.js +749 -0
  267. package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
  268. package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
  269. package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
  270. package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
  271. package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
  272. package/dist/node-runtime/pi-mcp-adapter-GUFZWW54.js +428 -0
  273. package/dist/node-runtime/pi-ollama-cloud-2F3Y2QNM.js +1440 -0
  274. package/dist/node-runtime/pi-prompt-template-model-QWTCGLJU.js +3946 -0
  275. package/dist/node-runtime/pi-subagents-7YJ3I4VE.js +6048 -0
  276. package/dist/node-runtime/pi-web-access-2CQGFLT2.js +1867 -0
  277. package/dist/node-runtime/print-mode-XSFM26EL.js +12 -0
  278. package/dist/node-runtime/proxy-modes-V6YVFH3C.js +685 -0
  279. package/dist/node-runtime/rpc-entry.js +62 -0
  280. package/dist/node-runtime/rpc-mode-W5ZTLTMZ.js +13 -0
  281. package/dist/node-runtime/runtime-bridges-3RKBDLNA.js +14 -0
  282. package/dist/node-runtime/session-manager-E7AREDTV.js +33 -0
  283. package/dist/node-runtime/session-selector-FJ7M2AIX.js +14 -0
  284. package/dist/node-runtime/settings-manager-GHPTUN7R.js +21 -0
  285. package/dist/node-runtime/src-BPQFJR76.js +2427 -0
  286. package/dist/node-runtime/subagent-executor-5Q5A4HJ2.js +8499 -0
  287. package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
  288. package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
  289. package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
  290. package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
  291. package/dist/node-runtime/update-cli-L3JIBH2U.js +70 -0
  292. package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
  293. package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
  294. package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
  295. package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
  296. package/dist/rpc.d.ts +3 -0
  297. package/dist/rpc.d.ts.map +1 -0
  298. package/dist/rpc.js +18 -0
  299. package/dist/rpc.js.map +1 -0
  300. package/dist/startup/benchmark-request.d.ts +3 -0
  301. package/dist/startup/benchmark-request.d.ts.map +1 -0
  302. package/dist/startup/benchmark-request.js +65 -0
  303. package/dist/startup/benchmark-request.js.map +1 -0
  304. package/dist/startup/interactive-view.d.ts.map +1 -1
  305. package/dist/startup/interactive-view.js +1 -2
  306. package/dist/startup/interactive-view.js.map +1 -1
  307. package/dist/startup/startup-milestones.d.ts +1 -1
  308. package/dist/startup/startup-milestones.d.ts.map +1 -1
  309. package/dist/startup/startup-milestones.js.map +1 -1
  310. package/dist/utils/await-with-abort.d.ts +2 -0
  311. package/dist/utils/await-with-abort.d.ts.map +1 -0
  312. package/dist/utils/await-with-abort.js +19 -0
  313. package/dist/utils/await-with-abort.js.map +1 -0
  314. package/docs/development.md +5 -1
  315. package/docs/features.md +2 -2
  316. package/docs/interactive-startup.md +95 -48
  317. package/docs/keybindings.md +2 -2
  318. package/docs/terminal-setup.md +1 -1
  319. package/docs/usage.md +1 -1
  320. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  321. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  322. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  323. package/examples/extensions/gondolin/package-lock.json +2 -2
  324. package/examples/extensions/gondolin/package.json +1 -1
  325. package/examples/extensions/hidden-thinking-label.ts +1 -1
  326. package/examples/extensions/sandbox/package-lock.json +2 -2
  327. package/examples/extensions/sandbox/package.json +1 -1
  328. package/examples/extensions/with-deps/package-lock.json +2 -2
  329. package/examples/extensions/with-deps/package.json +1 -1
  330. package/package.json +8 -8
@@ -0,0 +1,18 @@
1
+ export declare const loadExtract: () => Promise<typeof import("./extract.ts")>;
2
+ export declare const loadGeminiSearch: () => Promise<typeof import("./gemini-search.ts")>;
3
+ export declare const loadCuratorServer: () => Promise<typeof import("./curator-server.ts")>;
4
+ export declare const loadSummaryReview: () => Promise<typeof import("./summary-review.ts")>;
5
+ export declare const loadGeminiWeb: () => Promise<typeof import("./gemini-web.ts")>;
6
+ export declare const loadGeminiApi: () => Promise<typeof import("./gemini-api.ts")>;
7
+ export declare const loadOpenAISearch: () => Promise<typeof import("./openai-search.ts")>;
8
+ export declare const loadBrave: () => Promise<typeof import("./brave.ts")>;
9
+ export declare const loadParallel: () => Promise<typeof import("./parallel.ts")>;
10
+ export declare const loadTavily: () => Promise<typeof import("./tavily.ts")>;
11
+ export declare const loadPerplexity: () => Promise<typeof import("./perplexity.ts")>;
12
+ export declare const loadExa: () => Promise<typeof import("./exa.ts")>;
13
+ export declare const loadGithubExtract: () => Promise<typeof import("./github-extract.ts")>;
14
+ export declare const loadPdfExtract: () => Promise<typeof import("./pdf-extract.ts")>;
15
+ export declare const loadYoutubeExtract: () => Promise<typeof import("./youtube-extract.ts")>;
16
+ export declare const loadVideoExtract: () => Promise<typeof import("./video-extract.ts")>;
17
+ export declare const loadGeminiUrlContext: () => Promise<typeof import("./gemini-url-context.ts")>;
18
+ //# sourceMappingURL=lazy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../../src/builtin-extensions/pi-web-access/lazy.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,8CAA+B,CAAC;AACxD,eAAO,MAAM,gBAAgB,oDAAqC,CAAC;AACnE,eAAO,MAAM,iBAAiB,qDAAsC,CAAC;AACrE,eAAO,MAAM,iBAAiB,qDAAsC,CAAC;AACrE,eAAO,MAAM,aAAa,iDAAkC,CAAC;AAC7D,eAAO,MAAM,aAAa,iDAAkC,CAAC;AAC7D,eAAO,MAAM,gBAAgB,oDAAqC,CAAC;AACnE,eAAO,MAAM,SAAS,4CAA6B,CAAC;AACpD,eAAO,MAAM,YAAY,+CAAgC,CAAC;AAC1D,eAAO,MAAM,UAAU,6CAA8B,CAAC;AACtD,eAAO,MAAM,cAAc,iDAAkC,CAAC;AAC9D,eAAO,MAAM,OAAO,0CAA2B,CAAC;AAChD,eAAO,MAAM,iBAAiB,qDAAsC,CAAC;AACrE,eAAO,MAAM,cAAc,kDAAmC,CAAC;AAC/D,eAAO,MAAM,kBAAkB,sDAAuC,CAAC;AACvE,eAAO,MAAM,gBAAgB,oDAAqC,CAAC;AACnE,eAAO,MAAM,oBAAoB,yDAA0C,CAAC","sourcesContent":["// Node caches loaded modules; retaining rejected promises here would prevent resolution retries.\nexport const loadExtract = () => import(\"./extract.ts\");\nexport const loadGeminiSearch = () => import(\"./gemini-search.ts\");\nexport const loadCuratorServer = () => import(\"./curator-server.ts\");\nexport const loadSummaryReview = () => import(\"./summary-review.ts\");\nexport const loadGeminiWeb = () => import(\"./gemini-web.ts\");\nexport const loadGeminiApi = () => import(\"./gemini-api.ts\");\nexport const loadOpenAISearch = () => import(\"./openai-search.ts\");\nexport const loadBrave = () => import(\"./brave.ts\");\nexport const loadParallel = () => import(\"./parallel.ts\");\nexport const loadTavily = () => import(\"./tavily.ts\");\nexport const loadPerplexity = () => import(\"./perplexity.ts\");\nexport const loadExa = () => import(\"./exa.ts\");\nexport const loadGithubExtract = () => import(\"./github-extract.ts\");\nexport const loadPdfExtract = () => import(\"./pdf-extract.ts\");\nexport const loadYoutubeExtract = () => import(\"./youtube-extract.ts\");\nexport const loadVideoExtract = () => import(\"./video-extract.ts\");\nexport const loadGeminiUrlContext = () => import(\"./gemini-url-context.ts\");\n"]}
@@ -0,0 +1,19 @@
1
+ // Node caches loaded modules; retaining rejected promises here would prevent resolution retries.
2
+ export const loadExtract = () => import("./extract.js");
3
+ export const loadGeminiSearch = () => import("./gemini-search.js");
4
+ export const loadCuratorServer = () => import("./curator-server.js");
5
+ export const loadSummaryReview = () => import("./summary-review.js");
6
+ export const loadGeminiWeb = () => import("./gemini-web.js");
7
+ export const loadGeminiApi = () => import("./gemini-api.js");
8
+ export const loadOpenAISearch = () => import("./openai-search.js");
9
+ export const loadBrave = () => import("./brave.js");
10
+ export const loadParallel = () => import("./parallel.js");
11
+ export const loadTavily = () => import("./tavily.js");
12
+ export const loadPerplexity = () => import("./perplexity.js");
13
+ export const loadExa = () => import("./exa.js");
14
+ export const loadGithubExtract = () => import("./github-extract.js");
15
+ export const loadPdfExtract = () => import("./pdf-extract.js");
16
+ export const loadYoutubeExtract = () => import("./youtube-extract.js");
17
+ export const loadVideoExtract = () => import("./video-extract.js");
18
+ export const loadGeminiUrlContext = () => import("./gemini-url-context.js");
19
+ //# sourceMappingURL=lazy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../../src/builtin-extensions/pi-web-access/lazy.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;AACxD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC","sourcesContent":["// Node caches loaded modules; retaining rejected promises here would prevent resolution retries.\nexport const loadExtract = () => import(\"./extract.ts\");\nexport const loadGeminiSearch = () => import(\"./gemini-search.ts\");\nexport const loadCuratorServer = () => import(\"./curator-server.ts\");\nexport const loadSummaryReview = () => import(\"./summary-review.ts\");\nexport const loadGeminiWeb = () => import(\"./gemini-web.ts\");\nexport const loadGeminiApi = () => import(\"./gemini-api.ts\");\nexport const loadOpenAISearch = () => import(\"./openai-search.ts\");\nexport const loadBrave = () => import(\"./brave.ts\");\nexport const loadParallel = () => import(\"./parallel.ts\");\nexport const loadTavily = () => import(\"./tavily.ts\");\nexport const loadPerplexity = () => import(\"./perplexity.ts\");\nexport const loadExa = () => import(\"./exa.ts\");\nexport const loadGithubExtract = () => import(\"./github-extract.ts\");\nexport const loadPdfExtract = () => import(\"./pdf-extract.ts\");\nexport const loadYoutubeExtract = () => import(\"./youtube-extract.ts\");\nexport const loadVideoExtract = () => import(\"./video-extract.ts\");\nexport const loadGeminiUrlContext = () => import(\"./gemini-url-context.ts\");\n"]}
@@ -0,0 +1,6 @@
1
+ /** Lightweight session teardown hooks. Heavy modules register on first load. */
2
+ type Cleanup = () => void;
3
+ export declare function registerSessionCleanup(fn: Cleanup): void;
4
+ export declare function runSessionCleanups(): void;
5
+ export {};
6
+ //# sourceMappingURL=session-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-cleanup.d.ts","sourceRoot":"","sources":["../../../src/builtin-extensions/pi-web-access/session-cleanup.ts"],"names":[],"mappings":"AACA,gFAAgF;AAEhF,KAAK,OAAO,GAAG,MAAM,IAAI,CAAC;AAI1B,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAExD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAOzC","sourcesContent":["// @ts-nocheck\n/** Lightweight session teardown hooks. Heavy modules register on first load. */\n\ntype Cleanup = () => void;\n\nconst cleanups: Cleanup[] = [];\n\nexport function registerSessionCleanup(fn: Cleanup): void {\n\tif (!cleanups.includes(fn)) cleanups.push(fn);\n}\n\nexport function runSessionCleanups(): void {\n\tfor (const fn of cleanups) {\n\t\ttry {\n\t\t\tfn();\n\t\t} catch {\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,17 @@
1
+ // @ts-nocheck
2
+ /** Lightweight session teardown hooks. Heavy modules register on first load. */
3
+ const cleanups = [];
4
+ export function registerSessionCleanup(fn) {
5
+ if (!cleanups.includes(fn))
6
+ cleanups.push(fn);
7
+ }
8
+ export function runSessionCleanups() {
9
+ for (const fn of cleanups) {
10
+ try {
11
+ fn();
12
+ }
13
+ catch {
14
+ }
15
+ }
16
+ }
17
+ //# sourceMappingURL=session-cleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-cleanup.js","sourceRoot":"","sources":["../../../src/builtin-extensions/pi-web-access/session-cleanup.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,gFAAgF;AAIhF,MAAM,QAAQ,GAAc,EAAE,CAAC;AAE/B,MAAM,UAAU,sBAAsB,CAAC,EAAW,EAAQ;IACzD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAAA,CAC9C;AAED,MAAM,UAAU,kBAAkB,GAAS;IAC1C,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,CAAC;YACJ,EAAE,EAAE,CAAC;QACN,CAAC;QAAC,MAAM,CAAC;QACT,CAAC;IACF,CAAC;AAAA,CACD","sourcesContent":["// @ts-nocheck\n/** Lightweight session teardown hooks. Heavy modules register on first load. */\n\ntype Cleanup = () => void;\n\nconst cleanups: Cleanup[] = [];\n\nexport function registerSessionCleanup(fn: Cleanup): void {\n\tif (!cleanups.includes(fn)) cleanups.push(fn);\n}\n\nexport function runSessionCleanups(): void {\n\tfor (const fn of cleanups) {\n\t\ttry {\n\t\t\tfn();\n\t\t} catch {\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-runtime.d.ts","sourceRoot":"","sources":["../src/cli-runtime.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { isNodeBundle } from \"./config.ts\";\nimport type { InteractiveView } from \"./startup/interactive-view.ts\";\nimport { resolvePreloadLaunchMode } from \"./startup/launch-routing.ts\";\nimport { markStartupMilestone } from \"./startup/startup-milestones.ts\";\n\nmarkStartupMilestone(\"process_entry\");\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\nif (!isNodeBundle) {\n\ttry {\n\t\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\t\tenableCompileCache(join(agentDir, \"compile-cache\"));\n\t} catch {}\n}\n\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst startupBenchmark = process.env.PI_STARTUP_BENCHMARK === \"1\";\nconst preloadMode = resolvePreloadLaunchMode(args, {\n\tstdinIsTTY: process.stdin.isTTY === true,\n\tstdoutIsTTY: process.stdout.isTTY === true,\n\tstartupBenchmark,\n});\nmarkStartupMilestone(\"mode_routed\");\n\nlet startupView: InteractiveView | undefined;\nif (preloadMode === \"interactive\") {\n\tconst { InteractiveView } = await import(\"./startup/interactive-view.ts\");\n\tstartupView = new InteractiveView();\n\tstartupView.start();\n\tawait startupView.waitForFirstFrame();\n\tif (startupView.isExitRequested) process.exit(0);\n}\n\nconst startRuntime = async () => {\n\tconst importStarted = performance.now();\n\ttry {\n\t\tconst [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([\n\t\t\timport(\"./config.ts\"),\n\t\t\timport(\"./main.ts\"),\n\t\t\timport(\"./core/timings.ts\"),\n\t\t]);\n\t\tnoteImportMain(performance.now() - importStarted);\n\t\tprocess.title = APP_NAME;\n\t\tawait main(args, { startupView });\n\t} catch (error) {\n\t\tif (startupBenchmark) console.error(error);\n\t\tif (startupView && !startupView.isExitRequested) {\n\t\t\tprocess.exitCode = 1;\n\t\t\tawait startupView.fail(error);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n};\nprocess.once(\"exit\", () => startupView?.stop());\nif (startupView) {\n\tawait Promise.race([startRuntime(), startupView.waitForExit()]);\n\tif (startupView.isExitRequested) process.exit(process.exitCode ?? 0);\n} else {\n\tawait startRuntime();\n}\n"]}
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+ import { enableCompileCache } from "node:module";
3
+ import { homedir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { isNodeBundle } from "./config.js";
6
+ import { resolvePreloadLaunchMode } from "./startup/launch-routing.js";
7
+ import { markStartupMilestone } from "./startup/startup-milestones.js";
8
+ markStartupMilestone("process_entry");
9
+ process.title = "lunr";
10
+ if (process.stdout.isTTY) {
11
+ process.stdout.write("\x1b]0;lunr\x07");
12
+ }
13
+ if (!isNodeBundle) {
14
+ try {
15
+ const agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), ".lunr", "agent");
16
+ enableCompileCache(join(agentDir, "compile-cache"));
17
+ }
18
+ catch { }
19
+ }
20
+ process.env.PI_CODING_AGENT = "true";
21
+ process.emitWarning = (() => { });
22
+ const args = process.argv.slice(2);
23
+ const startupBenchmark = process.env.PI_STARTUP_BENCHMARK === "1";
24
+ const preloadMode = resolvePreloadLaunchMode(args, {
25
+ stdinIsTTY: process.stdin.isTTY === true,
26
+ stdoutIsTTY: process.stdout.isTTY === true,
27
+ startupBenchmark,
28
+ });
29
+ markStartupMilestone("mode_routed");
30
+ let startupView;
31
+ if (preloadMode === "interactive") {
32
+ const { InteractiveView } = await import("./startup/interactive-view.js");
33
+ startupView = new InteractiveView();
34
+ startupView.start();
35
+ await startupView.waitForFirstFrame();
36
+ if (startupView.isExitRequested)
37
+ process.exit(0);
38
+ }
39
+ const startRuntime = async () => {
40
+ const importStarted = performance.now();
41
+ try {
42
+ const [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([
43
+ import("./config.js"),
44
+ import("./main.js"),
45
+ import("./core/timings.js"),
46
+ ]);
47
+ noteImportMain(performance.now() - importStarted);
48
+ process.title = APP_NAME;
49
+ await main(args, { startupView });
50
+ }
51
+ catch (error) {
52
+ if (startupBenchmark)
53
+ console.error(error);
54
+ if (startupView && !startupView.isExitRequested) {
55
+ process.exitCode = 1;
56
+ await startupView.fail(error);
57
+ }
58
+ else {
59
+ throw error;
60
+ }
61
+ }
62
+ };
63
+ process.once("exit", () => startupView?.stop());
64
+ if (startupView) {
65
+ await Promise.race([startRuntime(), startupView.waitForExit()]);
66
+ if (startupView.isExitRequested)
67
+ process.exit(process.exitCode ?? 0);
68
+ }
69
+ else {
70
+ await startRuntime();
71
+ }
72
+ //# sourceMappingURL=cli-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-runtime.js","sourceRoot":"","sources":["../src/cli-runtime.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,oBAAoB,CAAC,eAAe,CAAC,CAAC;AACtC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC;AACvB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACzC,CAAC;AAED,IAAI,CAAC,YAAY,EAAE,CAAC;IACnB,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9F,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACX,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;AACrC,OAAO,CAAC,WAAW,GAAG,CAAC,GAAG,EAAE,CA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,GAAG,QAAQ,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,gBAAgB;YAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;YACjD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,MAAM,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACP,MAAM,KAAK,CAAC;QACb,CAAC;IACF,CAAC;AAAA,CACD,CAAC;AACF,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,IAAI,WAAW,EAAE,CAAC;IACjB,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAChE,IAAI,WAAW,CAAC,eAAe;QAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC;KAAM,CAAC;IACP,MAAM,YAAY,EAAE,CAAC;AACtB,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { isNodeBundle } from \"./config.ts\";\nimport type { InteractiveView } from \"./startup/interactive-view.ts\";\nimport { resolvePreloadLaunchMode } from \"./startup/launch-routing.ts\";\nimport { markStartupMilestone } from \"./startup/startup-milestones.ts\";\n\nmarkStartupMilestone(\"process_entry\");\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\nif (!isNodeBundle) {\n\ttry {\n\t\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\t\tenableCompileCache(join(agentDir, \"compile-cache\"));\n\t} catch {}\n}\n\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst startupBenchmark = process.env.PI_STARTUP_BENCHMARK === \"1\";\nconst preloadMode = resolvePreloadLaunchMode(args, {\n\tstdinIsTTY: process.stdin.isTTY === true,\n\tstdoutIsTTY: process.stdout.isTTY === true,\n\tstartupBenchmark,\n});\nmarkStartupMilestone(\"mode_routed\");\n\nlet startupView: InteractiveView | undefined;\nif (preloadMode === \"interactive\") {\n\tconst { InteractiveView } = await import(\"./startup/interactive-view.ts\");\n\tstartupView = new InteractiveView();\n\tstartupView.start();\n\tawait startupView.waitForFirstFrame();\n\tif (startupView.isExitRequested) process.exit(0);\n}\n\nconst startRuntime = async () => {\n\tconst importStarted = performance.now();\n\ttry {\n\t\tconst [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([\n\t\t\timport(\"./config.ts\"),\n\t\t\timport(\"./main.ts\"),\n\t\t\timport(\"./core/timings.ts\"),\n\t\t]);\n\t\tnoteImportMain(performance.now() - importStarted);\n\t\tprocess.title = APP_NAME;\n\t\tawait main(args, { startupView });\n\t} catch (error) {\n\t\tif (startupBenchmark) console.error(error);\n\t\tif (startupView && !startupView.isExitRequested) {\n\t\t\tprocess.exitCode = 1;\n\t\t\tawait startupView.fail(error);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n};\nprocess.once(\"exit\", () => startupView?.stop());\nif (startupView) {\n\tawait Promise.race([startRuntime(), startupView.waitForExit()]);\n\tif (startupView.isExitRequested) process.exit(process.exitCode ?? 0);\n} else {\n\tawait startRuntime();\n}\n"]}
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { InteractiveView } from \"./startup/interactive-view.ts\";\nimport { resolvePreloadLaunchMode } from \"./startup/launch-routing.ts\";\nimport { markStartupMilestone } from \"./startup/startup-milestones.ts\";\n\nmarkStartupMilestone(\"process_entry\");\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {}\n\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst startupBenchmark = process.env.PI_STARTUP_BENCHMARK === \"1\";\nconst preloadMode = resolvePreloadLaunchMode(args, {\n\tstdinIsTTY: process.stdin.isTTY === true,\n\tstdoutIsTTY: process.stdout.isTTY === true,\n\tstartupBenchmark,\n});\nmarkStartupMilestone(\"mode_routed\");\n\nlet startupView: InteractiveView | undefined;\nif (preloadMode === \"interactive\") {\n\tconst { InteractiveView } = await import(\"./startup/interactive-view.ts\");\n\tstartupView = new InteractiveView();\n\tstartupView.start();\n\tawait startupView.waitForFirstFrame();\n\tif (startupView.isExitRequested) process.exit(0);\n}\n\nconst startRuntime = async () => {\n\tconst importStarted = performance.now();\n\ttry {\n\t\tconst [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([\n\t\t\timport(\"./config.ts\"),\n\t\t\timport(\"./main.ts\"),\n\t\t\timport(\"./core/timings.ts\"),\n\t\t]);\n\t\tnoteImportMain(performance.now() - importStarted);\n\t\tprocess.title = APP_NAME;\n\t\tawait main(args, { startupView });\n\t} catch (error) {\n\t\tif (startupView && !startupView.isExitRequested) {\n\t\t\tprocess.exitCode = 1;\n\t\t\tawait startupView.fail(error);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n};\nprocess.once(\"exit\", () => startupView?.stop());\nif (startupView) {\n\tawait Promise.race([startRuntime(), startupView.waitForExit()]);\n\tif (startupView.isExitRequested) process.exit(process.exitCode ?? 0);\n} else {\n\tawait startRuntime();\n}\n"]}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\nimport { existsSync } from \"node:fs\";\n\nconst bundled = new URL(\"./node-runtime/cli-runtime.js\", import.meta.url);\nif (existsSync(bundled)) {\n\tawait import(bundled.href);\n} else {\n\tawait import(\"./cli-runtime.ts\");\n}\n"]}
package/dist/cli.js CHANGED
@@ -1,67 +1,18 @@
1
1
  #!/usr/bin/env node
2
- import { enableCompileCache } from "node:module";
3
- import { homedir } from "node:os";
4
- import { join } from "node:path";
5
- import { resolvePreloadLaunchMode } from "./startup/launch-routing.js";
6
- import { markStartupMilestone } from "./startup/startup-milestones.js";
7
- markStartupMilestone("process_entry");
8
- process.title = "lunr";
9
- if (process.stdout.isTTY) {
10
- process.stdout.write("\x1b]0;lunr\x07");
11
- }
12
- try {
13
- const agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), ".lunr", "agent");
14
- enableCompileCache(join(agentDir, "compile-cache"));
15
- }
16
- catch { }
17
- process.env.PI_CODING_AGENT = "true";
18
- process.emitWarning = (() => { });
19
- const args = process.argv.slice(2);
20
- const startupBenchmark = process.env.PI_STARTUP_BENCHMARK === "1";
21
- const preloadMode = resolvePreloadLaunchMode(args, {
22
- stdinIsTTY: process.stdin.isTTY === true,
23
- stdoutIsTTY: process.stdout.isTTY === true,
24
- startupBenchmark,
25
- });
26
- markStartupMilestone("mode_routed");
27
- let startupView;
28
- if (preloadMode === "interactive") {
29
- const { InteractiveView } = await import("./startup/interactive-view.js");
30
- startupView = new InteractiveView();
31
- startupView.start();
32
- await startupView.waitForFirstFrame();
33
- if (startupView.isExitRequested)
34
- process.exit(0);
35
- }
36
- const startRuntime = async () => {
37
- const importStarted = performance.now();
38
- try {
39
- const [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([
40
- import("./config.js"),
41
- import("./main.js"),
42
- import("./core/timings.js"),
43
- ]);
44
- noteImportMain(performance.now() - importStarted);
45
- process.title = APP_NAME;
46
- await main(args, { startupView });
47
- }
48
- catch (error) {
49
- if (startupView && !startupView.isExitRequested) {
50
- process.exitCode = 1;
51
- await startupView.fail(error);
52
- }
53
- else {
54
- throw error;
55
- }
2
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
3
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
4
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
5
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
6
+ });
56
7
  }
8
+ return path;
57
9
  };
58
- process.once("exit", () => startupView?.stop());
59
- if (startupView) {
60
- await Promise.race([startRuntime(), startupView.waitForExit()]);
61
- if (startupView.isExitRequested)
62
- process.exit(process.exitCode ?? 0);
10
+ import { existsSync } from "node:fs";
11
+ const bundled = new URL("./node-runtime/cli-runtime.js", import.meta.url);
12
+ if (existsSync(bundled)) {
13
+ await import(__rewriteRelativeImportExtension(bundled.href));
63
14
  }
64
15
  else {
65
- await startRuntime();
16
+ await import("./cli-runtime.js");
66
17
  }
67
18
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EA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EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAChE,IAAI,WAAW,CAAC,eAAe;QAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC;KAAM,CAAC;IACP,MAAM,YAAY,EAAE,CAAC;AACtB,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { enableCompileCache } from \"node:module\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { InteractiveView } from \"./startup/interactive-view.ts\";\nimport { resolvePreloadLaunchMode } from \"./startup/launch-routing.ts\";\nimport { markStartupMilestone } from \"./startup/startup-milestones.ts\";\n\nmarkStartupMilestone(\"process_entry\");\nprocess.title = \"lunr\";\nif (process.stdout.isTTY) {\n\tprocess.stdout.write(\"\\x1b]0;lunr\\x07\");\n}\n\ntry {\n\tconst agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), \".lunr\", \"agent\");\n\tenableCompileCache(join(agentDir, \"compile-cache\"));\n} catch {}\n\nprocess.env.PI_CODING_AGENT = \"true\";\nprocess.emitWarning = (() => {}) as typeof process.emitWarning;\n\nconst args = process.argv.slice(2);\nconst startupBenchmark = process.env.PI_STARTUP_BENCHMARK === \"1\";\nconst preloadMode = resolvePreloadLaunchMode(args, {\n\tstdinIsTTY: process.stdin.isTTY === true,\n\tstdoutIsTTY: process.stdout.isTTY === true,\n\tstartupBenchmark,\n});\nmarkStartupMilestone(\"mode_routed\");\n\nlet startupView: InteractiveView | undefined;\nif (preloadMode === \"interactive\") {\n\tconst { InteractiveView } = await import(\"./startup/interactive-view.ts\");\n\tstartupView = new InteractiveView();\n\tstartupView.start();\n\tawait startupView.waitForFirstFrame();\n\tif (startupView.isExitRequested) process.exit(0);\n}\n\nconst startRuntime = async () => {\n\tconst importStarted = performance.now();\n\ttry {\n\t\tconst [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([\n\t\t\timport(\"./config.ts\"),\n\t\t\timport(\"./main.ts\"),\n\t\t\timport(\"./core/timings.ts\"),\n\t\t]);\n\t\tnoteImportMain(performance.now() - importStarted);\n\t\tprocess.title = APP_NAME;\n\t\tawait main(args, { startupView });\n\t} catch (error) {\n\t\tif (startupView && !startupView.isExitRequested) {\n\t\t\tprocess.exitCode = 1;\n\t\t\tawait startupView.fail(error);\n\t\t} else {\n\t\t\tthrow error;\n\t\t}\n\t}\n};\nprocess.once(\"exit\", () => startupView?.stop());\nif (startupView) {\n\tawait Promise.race([startRuntime(), startupView.waitForExit()]);\n\tif (startupView.isExitRequested) process.exit(process.exitCode ?? 0);\n} else {\n\tawait startRuntime();\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,+BAA+B,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1E,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,MAAM,MAAM,kCAAC,OAAO,CAAC,IAAI,EAAC,CAAC;AAC5B,CAAC;KAAM,CAAC;IACP,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAClC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { existsSync } from \"node:fs\";\n\nconst bundled = new URL(\"./node-runtime/cli-runtime.js\", import.meta.url);\nif (existsSync(bundled)) {\n\tawait import(bundled.href);\n} else {\n\tawait import(\"./cli-runtime.ts\");\n}\n"]}
package/dist/config.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  export declare const isBunBinary: boolean;
6
6
  /** Detect if Bun is the runtime (compiled binary or bun run) */
7
7
  export declare const isBunRuntime: boolean;
8
+ export declare const isNodeBundle: boolean;
8
9
  /**
9
10
  * Get the base directory for resolving package assets (themes, package.json, README.md).
10
11
  * - For Bun binary: returns the directory containing the executable
@@ -1 +1 @@
1
-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AMpC;AAWD,iDAAiD;AACjD,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,8BAA8B;AAC9B,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,4BAA4B;AAC5B,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,gCAAgC;AAChC,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,kCAAkC;AAClC,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,sDAAsD;AACtD,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED,6CAA6C;AAC7C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,qCAAqC;AACrC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,iCAAiC;AACjC,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAMpD","sourcesContent":["import { appendFileSync, existsSync, readFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { dirname, join, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { normalizePath } from \"./utils/paths.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js (dist/): returns __dirname (the dist/ directory)\n * - For tsx (src/): returns parent directory (the package root)\n */\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.PI_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\t// Node.js: walk up from __dirname until we find package.json\n\tlet dir = __dirname;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\t// Fallback (shouldn't happen)\n\treturn __dirname;\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(readFileSync(getPackageJsonPath(), \"utf-8\")) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@ashx-j/lunr\";\n/** Public npm package users install. Workspace name stays PACKAGE_NAME. */\nexport const NPM_CLI_PACKAGE = \"@ashx-j/lunr\";\nexport const APP_NAME: string = piConfigName || \"pi\";\nexport const APP_TITLE: string = piConfigName ? APP_NAME : \"π\";\nexport const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || \".pi\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n// NOTE: pinned to PI_* on purpose. These env var names are an external contract;\n// deriving them from APP_NAME would silently rename them to LUNR_* now that\n// piConfig.name is \"lunr\". Renaming is deferred (see AGENTS.md deferred tasks).\nexport const ENV_AGENT_DIR = \"PI_CODING_AGENT_DIR\";\nexport const ENV_SESSION_DIR = \"PI_CODING_AGENT_SESSION_DIR\";\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.pi/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.pi/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n// lunr: default PI_CODING_AGENT_DIR to the resolved agent dir (~/.lunr/agent) so\n// vendored extensions carrying their own PI_CODING_AGENT_DIR-honoring resolvers\n// (pi-mcp-adapter agent-dir.ts, pi-intercom broker/paths.ts, pi-web-access utils.ts,\n// pi-goal persistence.ts) land in .lunr instead of leaking into a real pi install's\n// ~/.pi. Only set when unset/blank, so explicit user/test values still win.\nif (!process.env[ENV_AGENT_DIR]?.trim()) {\n\tprocess.env[ENV_AGENT_DIR] = getAgentDir();\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n\n/**\n * Append a line to the debug log file. Never throws — debug logging must not\n * break the calling code path. Used for background operations (session\n * retention pruning, auto-naming) that must not print to the interactive UI.\n */\nexport function appendDebugLog(message: string): void {\n\ttry {\n\t\tappendFileSync(getDebugLogPath(), `[${new Date().toISOString()}] ${message}\\n`);\n\t} catch {\n\t\t// Ignore: debug logging is best-effort only.\n\t}\n}\n"]}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,eAAO,MAAM,WAAW,SACqF,CAAC;AAE9G,gEAAgE;AAChE,eAAO,MAAM,YAAY,SAAyB,CAAC;AAGnD,eAAO,MAAM,YAAY,SAA8D,CAAC;AAMxF;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAqBtC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAQrC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAO7C;AAED,+BAA+B;AAC/B,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,4BAA4B;AAC5B,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,iCAAiC;AACjC,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,qCAAqC;AACrC,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,M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FileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { dirname, join, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { normalizePath } from \"./utils/paths.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\ndeclare const LUNR_NODE_BUNDLE: boolean;\nexport const isNodeBundle = typeof LUNR_NODE_BUNDLE !== \"undefined\" && LUNR_NODE_BUNDLE;\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js (dist/): returns __dirname (the dist/ directory)\n * - For tsx (src/): returns parent directory (the package root)\n */\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.PI_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\t// Node.js: walk up from __dirname until we find package.json\n\tlet dir = __dirname;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\t// Fallback (shouldn't happen)\n\treturn __dirname;\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(readFileSync(getPackageJsonPath(), \"utf-8\")) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@ashx-j/lunr\";\n/** Public npm package users install. Workspace name stays PACKAGE_NAME. */\nexport const NPM_CLI_PACKAGE = \"@ashx-j/lunr\";\nexport const APP_NAME: string = piConfigName || \"pi\";\nexport const APP_TITLE: string = piConfigName ? APP_NAME : \"π\";\nexport const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || \".pi\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n// NOTE: pinned to PI_* on purpose. These env var names are an external contract;\n// deriving them from APP_NAME would silently rename them to LUNR_* now that\n// piConfig.name is \"lunr\". Renaming is deferred (see AGENTS.md deferred tasks).\nexport const ENV_AGENT_DIR = \"PI_CODING_AGENT_DIR\";\nexport const ENV_SESSION_DIR = \"PI_CODING_AGENT_SESSION_DIR\";\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.pi/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.pi/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n// lunr: default PI_CODING_AGENT_DIR to the resolved agent dir (~/.lunr/agent) so\n// vendored extensions carrying their own PI_CODING_AGENT_DIR-honoring resolvers\n// (pi-mcp-adapter agent-dir.ts, pi-intercom broker/paths.ts, pi-web-access utils.ts,\n// pi-goal persistence.ts) land in .lunr instead of leaking into a real pi install's\n// ~/.pi. Only set when unset/blank, so explicit user/test values still win.\nif (!process.env[ENV_AGENT_DIR]?.trim()) {\n\tprocess.env[ENV_AGENT_DIR] = getAgentDir();\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n\n/**\n * Append a line to the debug log file. Never throws — debug logging must not\n * break the calling code path. Used for background operations (session\n * retention pruning, auto-naming) that must not print to the interactive UI.\n */\nexport function appendDebugLog(message: string): void {\n\ttry {\n\t\tappendFileSync(getDebugLogPath(), `[${new Date().toISOString()}] ${message}\\n`);\n\t} catch {\n\t\t// Ignore: debug logging is best-effort only.\n\t}\n}\n"]}
package/dist/config.js CHANGED
@@ -15,6 +15,7 @@ const __dirname = dirname(__filename);
15
15
  export const isBunBinary = import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN");
16
16
  /** Detect if Bun is the runtime (compiled binary or bun run) */
17
17
  export const isBunRuntime = !!process.versions.bun;
18
+ export const isNodeBundle = typeof LUNR_NODE_BUNDLE !== "undefined" && LUNR_NODE_BUNDLE;
18
19
  // =============================================================================
19
20
  // Package Asset Paths (shipped with executable)
20
21
  // =============================================================================
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GACvB,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAE9G,gEAAg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C,WAAW,EAAE,EAAE,WAAW,CAAC,CAAC;AAAA,CACxC;AAED,gCAAgC;AAChC,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,eAAe,CAAC,CAAC;AAAA,CAC5C;AAED,kCAAkC;AAClC,MAAM,UAAU,WAAW,GAAW;IACrC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;AAAA,CACpC;AAED,sDAAsD;AACtD,MAAM,UAAU,SAAS,GAAW;IACnC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;AAAA,CAClC;AAED,6CAA6C;AAC7C,MAAM,UAAU,aAAa,GAAW;IACvC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,CAAC;AAAA,CACtC;AAED,qCAAqC;AACrC,MAAM,UAAU,cAAc,GAAW;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AAAA,CACvC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AAAA,CACpD;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAQ;IACrD,IAAI,CAAC;QACJ,cAAc,CAAC,eAAe,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO,IAAI,CAAC,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACR,6CAA6C;IAC9C,CAAC;AAAA,CACD","sourcesContent":["import { appendFileSync, existsSync, readFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { dirname, join, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { normalizePath } from \"./utils/paths.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js (dist/): returns __dirname (the dist/ directory)\n * - For tsx (src/): returns parent directory (the package root)\n */\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.PI_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\t// Node.js: walk up from __dirname until we find package.json\n\tlet dir = __dirname;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\t// Fallback (shouldn't happen)\n\treturn __dirname;\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(readFileSync(getPackageJsonPath(), \"utf-8\")) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@ashx-j/lunr\";\n/** Public npm package users install. Workspace name stays PACKAGE_NAME. */\nexport const NPM_CLI_PACKAGE = \"@ashx-j/lunr\";\nexport const APP_NAME: string = piConfigName || \"pi\";\nexport const APP_TITLE: string = piConfigName ? APP_NAME : \"π\";\nexport const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || \".pi\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n// NOTE: pinned to PI_* on purpose. These env var names are an external contract;\n// deriving them from APP_NAME would silently rename them to LUNR_* now that\n// piConfig.name is \"lunr\". Renaming is deferred (see AGENTS.md deferred tasks).\nexport const ENV_AGENT_DIR = \"PI_CODING_AGENT_DIR\";\nexport const ENV_SESSION_DIR = \"PI_CODING_AGENT_SESSION_DIR\";\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.pi/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.pi/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n// lunr: default PI_CODING_AGENT_DIR to the resolved agent dir (~/.lunr/agent) so\n// vendored extensions carrying their own PI_CODING_AGENT_DIR-honoring resolvers\n// (pi-mcp-adapter agent-dir.ts, pi-intercom broker/paths.ts, pi-web-access utils.ts,\n// pi-goal persistence.ts) land in .lunr instead of leaking into a real pi install's\n// ~/.pi. Only set when unset/blank, so explicit user/test values still win.\nif (!process.env[ENV_AGENT_DIR]?.trim()) {\n\tprocess.env[ENV_AGENT_DIR] = getAgentDir();\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n\n/**\n * Append a line to the debug log file. Never throws — debug logging must not\n * break the calling code path. Used for background operations (session\n * retention pruning, auto-naming) that must not print to the interactive UI.\n */\nexport function appendDebugLog(message: string): void {\n\ttry {\n\t\tappendFileSync(getDebugLogPath(), `[${new Date().toISOString()}] ${message}\\n`);\n\t} catch {\n\t\t// Ignore: debug logging is best-effort only.\n\t}\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7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IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CAAC;AAAA,CACvC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe,GAAW;IACzC,OAAO,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,QAAQ,YAAY,CAAC,CAAC;AAAA,CACpD;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAQ;IACrD,IAAI,CAAC;QACJ,cAAc,CAAC,eAAe,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,OAAO,IAAI,CAAC,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACR,6CAA6C;IAC9C,CAAC;AAAA,CACD","sourcesContent":["import { appendFileSync, existsSync, readFileSync } from \"fs\";\nimport { homedir } from \"os\";\nimport { dirname, join, resolve } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { normalizePath } from \"./utils/paths.ts\";\n\n// =============================================================================\n// Package Detection\n// =============================================================================\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Detect if we're running as a Bun compiled binary.\n * Bun binaries have import.meta.url containing \"$bunfs\", \"~BUN\", or \"%7EBUN\" (Bun's virtual filesystem path)\n */\nexport const isBunBinary =\n\timport.meta.url.includes(\"$bunfs\") || import.meta.url.includes(\"~BUN\") || import.meta.url.includes(\"%7EBUN\");\n\n/** Detect if Bun is the runtime (compiled binary or bun run) */\nexport const isBunRuntime = !!process.versions.bun;\n\ndeclare const LUNR_NODE_BUNDLE: boolean;\nexport const isNodeBundle = typeof LUNR_NODE_BUNDLE !== \"undefined\" && LUNR_NODE_BUNDLE;\n\n// =============================================================================\n// Package Asset Paths (shipped with executable)\n// =============================================================================\n\n/**\n * Get the base directory for resolving package assets (themes, package.json, README.md).\n * - For Bun binary: returns the directory containing the executable\n * - For Node.js (dist/): returns __dirname (the dist/ directory)\n * - For tsx (src/): returns parent directory (the package root)\n */\nexport function getPackageDir(): string {\n\t// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)\n\tconst envDir = process.env.PI_PACKAGE_DIR;\n\tif (envDir) {\n\t\treturn normalizePath(envDir);\n\t}\n\n\tif (isBunBinary) {\n\t\t// Bun binary: process.execPath points to the compiled executable\n\t\treturn dirname(process.execPath);\n\t}\n\t// Node.js: walk up from __dirname until we find package.json\n\tlet dir = __dirname;\n\twhile (dir !== dirname(dir)) {\n\t\tif (existsSync(join(dir, \"package.json\"))) {\n\t\t\treturn dir;\n\t\t}\n\t\tdir = dirname(dir);\n\t}\n\t// Fallback (shouldn't happen)\n\treturn __dirname;\n}\n\n/**\n * Get path to built-in themes directory (shipped with package)\n * - For Bun binary: theme/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/theme/\n * - For tsx (src/): src/modes/interactive/theme/\n */\nexport function getThemesDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"theme\");\n\t}\n\t// Theme is in modes/interactive/theme/ relative to src/ or dist/\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"theme\");\n}\n\n/**\n * Get path to HTML export template directory (shipped with package)\n * - For Bun binary: export-html/ next to executable\n * - For Node.js (dist/): dist/core/export-html/\n * - For tsx (src/): src/core/export-html/\n */\nexport function getExportTemplateDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"export-html\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"core\", \"export-html\");\n}\n\n/** Get path to package.json */\nexport function getPackageJsonPath(): string {\n\treturn join(getPackageDir(), \"package.json\");\n}\n\n/** Get path to README.md */\nexport function getReadmePath(): string {\n\treturn resolve(join(getPackageDir(), \"README.md\"));\n}\n\n/** Get path to docs directory */\nexport function getDocsPath(): string {\n\treturn resolve(join(getPackageDir(), \"docs\"));\n}\n\n/** Get path to examples directory */\nexport function getExamplesPath(): string {\n\treturn resolve(join(getPackageDir(), \"examples\"));\n}\n\n/**\n * Get path to built-in interactive assets directory.\n * - For Bun binary: assets/ next to executable\n * - For Node.js (dist/): dist/modes/interactive/assets/\n * - For tsx (src/): src/modes/interactive/assets/\n */\nexport function getInteractiveAssetsDir(): string {\n\tif (isBunBinary) {\n\t\treturn join(getPackageDir(), \"assets\");\n\t}\n\tconst packageDir = getPackageDir();\n\tconst srcOrDist = existsSync(join(packageDir, \"src\")) ? \"src\" : \"dist\";\n\treturn join(packageDir, srcOrDist, \"modes\", \"interactive\", \"assets\");\n}\n\n/** Get path to a bundled interactive asset */\nexport function getBundledInteractiveAssetPath(name: string): string {\n\treturn join(getInteractiveAssetsDir(), name);\n}\n\n// =============================================================================\n// App Config (from package.json piConfig)\n// =============================================================================\n\ninterface PackageJson {\n\tname?: string;\n\tversion?: string;\n\tpiConfig?: {\n\t\tname?: string;\n\t\tconfigDir?: string;\n\t};\n}\n\nlet pkg: PackageJson = {};\ntry {\n\tpkg = JSON.parse(readFileSync(getPackageJsonPath(), \"utf-8\")) as PackageJson;\n} catch (e: unknown) {\n\tconst err = e as NodeJS.ErrnoException;\n\tif (err.code !== \"ENOENT\") throw e;\n}\n\nconst piConfigName: string | undefined = pkg.piConfig?.name;\nexport const PACKAGE_NAME: string = pkg.name || \"@ashx-j/lunr\";\n/** Public npm package users install. Workspace name stays PACKAGE_NAME. */\nexport const NPM_CLI_PACKAGE = \"@ashx-j/lunr\";\nexport const APP_NAME: string = piConfigName || \"pi\";\nexport const APP_TITLE: string = piConfigName ? APP_NAME : \"π\";\nexport const CONFIG_DIR_NAME: string = pkg.piConfig?.configDir || \".pi\";\nexport const VERSION: string = pkg.version || \"0.0.0\";\n\n// e.g., PI_CODING_AGENT_DIR or TAU_CODING_AGENT_DIR\n// NOTE: pinned to PI_* on purpose. These env var names are an external contract;\n// deriving them from APP_NAME would silently rename them to LUNR_* now that\n// piConfig.name is \"lunr\". Renaming is deferred (see AGENTS.md deferred tasks).\nexport const ENV_AGENT_DIR = \"PI_CODING_AGENT_DIR\";\nexport const ENV_SESSION_DIR = \"PI_CODING_AGENT_SESSION_DIR\";\n\nexport function expandTildePath(path: string): string {\n\treturn normalizePath(path);\n}\n\nconst DEFAULT_SHARE_VIEWER_URL = \"https://pi.dev/session/\";\n\n/** Get the share viewer URL for a gist ID */\nexport function getShareViewerUrl(gistId: string): string {\n\tconst baseUrl = process.env.PI_SHARE_VIEWER_URL || DEFAULT_SHARE_VIEWER_URL;\n\treturn `${baseUrl}#${gistId}`;\n}\n\n// =============================================================================\n// User Config Paths (~/.pi/agent/*)\n// =============================================================================\n\n/** Get the agent config directory (e.g., ~/.pi/agent/) */\nexport function getAgentDir(): string {\n\tconst envDir = process.env[ENV_AGENT_DIR];\n\tif (envDir) {\n\t\treturn expandTildePath(envDir);\n\t}\n\treturn join(homedir(), CONFIG_DIR_NAME, \"agent\");\n}\n\n// lunr: default PI_CODING_AGENT_DIR to the resolved agent dir (~/.lunr/agent) so\n// vendored extensions carrying their own PI_CODING_AGENT_DIR-honoring resolvers\n// (pi-mcp-adapter agent-dir.ts, pi-intercom broker/paths.ts, pi-web-access utils.ts,\n// pi-goal persistence.ts) land in .lunr instead of leaking into a real pi install's\n// ~/.pi. Only set when unset/blank, so explicit user/test values still win.\nif (!process.env[ENV_AGENT_DIR]?.trim()) {\n\tprocess.env[ENV_AGENT_DIR] = getAgentDir();\n}\n\n/** Get path to user's custom themes directory */\nexport function getCustomThemesDir(): string {\n\treturn join(getAgentDir(), \"themes\");\n}\n\n/** Get path to models.json */\nexport function getModelsPath(): string {\n\treturn join(getAgentDir(), \"models.json\");\n}\n\n/** Get path to auth.json */\nexport function getAuthPath(): string {\n\treturn join(getAgentDir(), \"auth.json\");\n}\n\n/** Get path to settings.json */\nexport function getSettingsPath(): string {\n\treturn join(getAgentDir(), \"settings.json\");\n}\n\n/** Get path to tools directory */\nexport function getToolsDir(): string {\n\treturn join(getAgentDir(), \"tools\");\n}\n\n/** Get path to managed binaries directory (fd, rg) */\nexport function getBinDir(): string {\n\treturn join(getAgentDir(), \"bin\");\n}\n\n/** Get path to prompt templates directory */\nexport function getPromptsDir(): string {\n\treturn join(getAgentDir(), \"prompts\");\n}\n\n/** Get path to sessions directory */\nexport function getSessionsDir(): string {\n\treturn join(getAgentDir(), \"sessions\");\n}\n\n/** Get path to debug log file */\nexport function getDebugLogPath(): string {\n\treturn join(getAgentDir(), `${APP_NAME}-debug.log`);\n}\n\n/**\n * Append a line to the debug log file. Never throws — debug logging must not\n * break the calling code path. Used for background operations (session\n * retention pruning, auto-naming) that must not print to the interactive UI.\n */\nexport function appendDebugLog(message: string): void {\n\ttry {\n\t\tappendFileSync(getDebugLogPath(), `[${new Date().toISOString()}] ${message}\\n`);\n\t} catch {\n\t\t// Ignore: debug logging is best-effort only.\n\t}\n}\n"]}