@ashx-j/lunr 0.2.17 → 0.2.18

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 (339) hide show
  1. package/CHANGELOG.md +19 -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/ashxj-tui.d.ts +2 -2
  8. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  9. package/dist/builtin-extensions/ashxj-tui.js +8 -11
  10. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  11. package/dist/builtin-extensions/index.d.ts.map +1 -1
  12. package/dist/builtin-extensions/index.js +2 -1
  13. package/dist/builtin-extensions/index.js.map +1 -1
  14. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
  15. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  16. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +172 -171
  17. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  18. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +50 -0
  19. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
  20. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +131 -0
  21. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
  22. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
  23. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
  24. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
  25. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
  26. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
  27. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  28. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
  29. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  30. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  31. package/dist/builtin-extensions/pi-mcp-adapter/index.js +276 -109
  32. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  33. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
  36. package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
  37. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
  38. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
  39. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
  40. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
  41. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
  43. package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
  44. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
  45. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
  46. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
  47. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
  48. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
  49. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
  50. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +68 -15
  54. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
  58. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
  65. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +2 -1
  67. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +72 -31
  69. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
  71. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
  73. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
  74. package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
  75. package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
  76. package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
  77. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
  78. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
  79. package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
  80. package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
  81. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
  82. package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
  83. package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
  84. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  85. package/dist/builtin-extensions/pi-web-access/index.js +259 -168
  86. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  87. package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
  88. package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
  89. package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
  90. package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
  91. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
  92. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
  93. package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
  94. package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
  95. package/dist/cli-runtime.d.ts +3 -0
  96. package/dist/cli-runtime.d.ts.map +1 -0
  97. package/dist/cli-runtime.js +72 -0
  98. package/dist/cli-runtime.js.map +1 -0
  99. package/dist/cli.d.ts.map +1 -1
  100. package/dist/cli.js +11 -60
  101. package/dist/cli.js.map +1 -1
  102. package/dist/config.d.ts +1 -0
  103. package/dist/config.d.ts.map +1 -1
  104. package/dist/config.js +1 -0
  105. package/dist/config.js.map +1 -1
  106. package/dist/core/agent-session.d.ts.map +1 -1
  107. package/dist/core/agent-session.js +6 -3
  108. package/dist/core/agent-session.js.map +1 -1
  109. package/dist/core/extensions/host-static.d.ts.map +1 -1
  110. package/dist/core/extensions/host-static.js +34 -12
  111. package/dist/core/extensions/host-static.js.map +1 -1
  112. package/dist/core/extensions/loader.d.ts +1 -2
  113. package/dist/core/extensions/loader.d.ts.map +1 -1
  114. package/dist/core/extensions/loader.js +10 -64
  115. package/dist/core/extensions/loader.js.map +1 -1
  116. package/dist/core/keybindings.d.ts +2 -2
  117. package/dist/core/keybindings.d.ts.map +1 -1
  118. package/dist/core/keybindings.js +2 -2
  119. package/dist/core/keybindings.js.map +1 -1
  120. package/dist/core/package-manager.d.ts.map +1 -1
  121. package/dist/core/package-manager.js +1 -1
  122. package/dist/core/package-manager.js.map +1 -1
  123. package/dist/core/sdk.d.ts +1 -1
  124. package/dist/core/sdk.d.ts.map +1 -1
  125. package/dist/core/sdk.js +1 -1
  126. package/dist/core/sdk.js.map +1 -1
  127. package/dist/core/timings.d.ts +2 -1
  128. package/dist/core/timings.d.ts.map +1 -1
  129. package/dist/core/timings.js +17 -2
  130. package/dist/core/timings.js.map +1 -1
  131. package/dist/gateway/agent-bridge.d.ts +6 -1
  132. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  133. package/dist/gateway/agent-bridge.js +23 -6
  134. package/dist/gateway/agent-bridge.js.map +1 -1
  135. package/dist/gateway/cron.d.ts +1 -1
  136. package/dist/gateway/cron.d.ts.map +1 -1
  137. package/dist/gateway/cron.js +3 -1
  138. package/dist/gateway/cron.js.map +1 -1
  139. package/dist/main.d.ts.map +1 -1
  140. package/dist/main.js +20 -14
  141. package/dist/main.js.map +1 -1
  142. package/dist/modes/interactive/injected-context.d.ts +2 -0
  143. package/dist/modes/interactive/injected-context.d.ts.map +1 -0
  144. package/dist/modes/interactive/injected-context.js +7 -0
  145. package/dist/modes/interactive/injected-context.js.map +1 -0
  146. package/dist/modes/interactive/interactive-mode.d.ts +2 -0
  147. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  148. package/dist/modes/interactive/interactive-mode.js +32 -8
  149. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  150. package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
  151. package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
  152. package/dist/modes/interactive/thinking-level-slash.js +23 -0
  153. package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
  154. package/dist/node-runtime/agent-session-services-35WNVGMR.js +36 -0
  155. package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
  156. package/dist/node-runtime/brave-UWDA3I22.js +143 -0
  157. package/dist/node-runtime/builtin-extensions-QATGXENO.js +28 -0
  158. package/dist/node-runtime/chunk-2SJB2AWP.js +47 -0
  159. package/dist/node-runtime/chunk-3NMWLTPV.js +64 -0
  160. package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
  161. package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
  162. package/dist/node-runtime/chunk-4CSFRBCN.js +7558 -0
  163. package/dist/node-runtime/chunk-4DJ6HEGH.js +296 -0
  164. package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
  165. package/dist/node-runtime/chunk-4I23VTC4.js +429 -0
  166. package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
  167. package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
  168. package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
  169. package/dist/node-runtime/chunk-5EFIU3OM.js +295 -0
  170. package/dist/node-runtime/chunk-6BEIBLQ3.js +53 -0
  171. package/dist/node-runtime/chunk-6KDIOJL3.js +72 -0
  172. package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
  173. package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
  174. package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
  175. package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
  176. package/dist/node-runtime/chunk-AROOY4BB.js +173 -0
  177. package/dist/node-runtime/chunk-ATGA2WLC.js +5646 -0
  178. package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
  179. package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
  180. package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
  181. package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
  182. package/dist/node-runtime/chunk-BOHIDQT4.js +21 -0
  183. package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
  184. package/dist/node-runtime/chunk-CBGB57XT.js +20211 -0
  185. package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
  186. package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
  187. package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
  188. package/dist/node-runtime/chunk-CSFI6YXL.js +130 -0
  189. package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
  190. package/dist/node-runtime/chunk-DDWHZ633.js +37 -0
  191. package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
  192. package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
  193. package/dist/node-runtime/chunk-EBF6COVM.js +1734 -0
  194. package/dist/node-runtime/chunk-FQMM2EZ2.js +248 -0
  195. package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
  196. package/dist/node-runtime/chunk-G4P75AIS.js +9471 -0
  197. package/dist/node-runtime/chunk-G6LRAP36.js +105 -0
  198. package/dist/node-runtime/chunk-GKLEQ3I4.js +860 -0
  199. package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
  200. package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
  201. package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
  202. package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
  203. package/dist/node-runtime/chunk-IRPJXI6U.js +1269 -0
  204. package/dist/node-runtime/chunk-J26TSGDL.js +633 -0
  205. package/dist/node-runtime/chunk-JZQ7F36T.js +610 -0
  206. package/dist/node-runtime/chunk-KBKMCJDU.js +126 -0
  207. package/dist/node-runtime/chunk-KWA4OC2J.js +100 -0
  208. package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
  209. package/dist/node-runtime/chunk-MCUNIRD5.js +8388 -0
  210. package/dist/node-runtime/chunk-NI6OTSBH.js +966 -0
  211. package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
  212. package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
  213. package/dist/node-runtime/chunk-OCVIXVTZ.js +88 -0
  214. package/dist/node-runtime/chunk-OPEK5RRY.js +466 -0
  215. package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
  216. package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
  217. package/dist/node-runtime/chunk-PNJSG3IZ.js +807 -0
  218. package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
  219. package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
  220. package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
  221. package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
  222. package/dist/node-runtime/chunk-QZMODZQ2.js +305 -0
  223. package/dist/node-runtime/chunk-R5EDISSV.js +375 -0
  224. package/dist/node-runtime/chunk-RNBHABBA.js +986 -0
  225. package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
  226. package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
  227. package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
  228. package/dist/node-runtime/chunk-STERBGUB.js +949 -0
  229. package/dist/node-runtime/chunk-UWQYRSYQ.js +8973 -0
  230. package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
  231. package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
  232. package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
  233. package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
  234. package/dist/node-runtime/chunk-WKDK4C5P.js +2834 -0
  235. package/dist/node-runtime/chunk-XATUM2HK.js +46 -0
  236. package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
  237. package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
  238. package/dist/node-runtime/chunk-ZBV7FAHG.js +1345 -0
  239. package/dist/node-runtime/cli-runtime.js +80 -0
  240. package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
  241. package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
  242. package/dist/node-runtime/command-AAV3YRR5.js +13 -0
  243. package/dist/node-runtime/commands-MV5KOZ64.js +291 -0
  244. package/dist/node-runtime/config-QDD5PUE2.js +73 -0
  245. package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
  246. package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
  247. package/dist/node-runtime/direct-tool-executor-BK7CLEBX.js +188 -0
  248. package/dist/node-runtime/exa-LL64QZR2.js +329 -0
  249. package/dist/node-runtime/export-html-TEXVV5RP.js +150 -0
  250. package/dist/node-runtime/extension-input-O4HSAEM4.js +14 -0
  251. package/dist/node-runtime/extension-selector-X5FCX43D.js +14 -0
  252. package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
  253. package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
  254. package/dist/node-runtime/gateway-OAC4OBBL.js +2137 -0
  255. package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
  256. package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
  257. package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
  258. package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
  259. package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
  260. package/dist/node-runtime/goal-NJEE5CTU.js +1831 -0
  261. package/dist/node-runtime/index.js +859 -0
  262. package/dist/node-runtime/init-3C7Z24OI.js +28 -0
  263. package/dist/node-runtime/install-cli-EXMJQESX.js +308 -0
  264. package/dist/node-runtime/interactive-mode-2SZUO53H.js +56 -0
  265. package/dist/node-runtime/interactive-view-S6J3QHEF.js +247 -0
  266. package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
  267. package/dist/node-runtime/lunr-cron-AUUYP4N4.js +272 -0
  268. package/dist/node-runtime/main.js +54 -0
  269. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
  270. package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
  271. package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
  272. package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
  273. package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
  274. package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
  275. package/dist/node-runtime/package-manager-cli-7RKSZGEN.js +749 -0
  276. package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
  277. package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
  278. package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
  279. package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
  280. package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
  281. package/dist/node-runtime/pi-mcp-adapter-GUFZWW54.js +428 -0
  282. package/dist/node-runtime/pi-ollama-cloud-2F3Y2QNM.js +1440 -0
  283. package/dist/node-runtime/pi-prompt-template-model-QWTCGLJU.js +3946 -0
  284. package/dist/node-runtime/pi-subagents-7YJ3I4VE.js +6048 -0
  285. package/dist/node-runtime/pi-web-access-2CQGFLT2.js +1867 -0
  286. package/dist/node-runtime/print-mode-XSFM26EL.js +12 -0
  287. package/dist/node-runtime/proxy-modes-V6YVFH3C.js +685 -0
  288. package/dist/node-runtime/rpc-entry.js +62 -0
  289. package/dist/node-runtime/rpc-mode-W5ZTLTMZ.js +13 -0
  290. package/dist/node-runtime/runtime-bridges-3RKBDLNA.js +14 -0
  291. package/dist/node-runtime/session-manager-E7AREDTV.js +33 -0
  292. package/dist/node-runtime/session-selector-FJ7M2AIX.js +14 -0
  293. package/dist/node-runtime/settings-manager-GHPTUN7R.js +21 -0
  294. package/dist/node-runtime/src-BPQFJR76.js +2427 -0
  295. package/dist/node-runtime/subagent-executor-5Q5A4HJ2.js +8499 -0
  296. package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
  297. package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
  298. package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
  299. package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
  300. package/dist/node-runtime/update-cli-L3JIBH2U.js +70 -0
  301. package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
  302. package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
  303. package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
  304. package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
  305. package/dist/rpc.d.ts +3 -0
  306. package/dist/rpc.d.ts.map +1 -0
  307. package/dist/rpc.js +18 -0
  308. package/dist/rpc.js.map +1 -0
  309. package/dist/startup/benchmark-request.d.ts +3 -0
  310. package/dist/startup/benchmark-request.d.ts.map +1 -0
  311. package/dist/startup/benchmark-request.js +65 -0
  312. package/dist/startup/benchmark-request.js.map +1 -0
  313. package/dist/startup/interactive-view.d.ts.map +1 -1
  314. package/dist/startup/interactive-view.js +1 -2
  315. package/dist/startup/interactive-view.js.map +1 -1
  316. package/dist/startup/startup-milestones.d.ts +1 -1
  317. package/dist/startup/startup-milestones.d.ts.map +1 -1
  318. package/dist/startup/startup-milestones.js.map +1 -1
  319. package/dist/utils/await-with-abort.d.ts +2 -0
  320. package/dist/utils/await-with-abort.d.ts.map +1 -0
  321. package/dist/utils/await-with-abort.js +19 -0
  322. package/dist/utils/await-with-abort.js.map +1 -0
  323. package/docs/development.md +5 -1
  324. package/docs/features.md +2 -2
  325. package/docs/interactive-startup.md +95 -48
  326. package/docs/keybindings.md +2 -2
  327. package/docs/terminal-setup.md +1 -1
  328. package/docs/usage.md +1 -1
  329. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  330. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  331. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  332. package/examples/extensions/gondolin/package-lock.json +2 -2
  333. package/examples/extensions/gondolin/package.json +1 -1
  334. package/examples/extensions/hidden-thinking-label.ts +1 -1
  335. package/examples/extensions/sandbox/package-lock.json +2 -2
  336. package/examples/extensions/sandbox/package.json +1 -1
  337. package/examples/extensions/with-deps/package-lock.json +2 -2
  338. package/examples/extensions/with-deps/package.json +1 -1
  339. package/package.json +8 -8
@@ -0,0 +1,986 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ getCustomThemesDir,
4
+ getThemesDir
5
+ } from "./chunk-FQMM2EZ2.js";
6
+
7
+ // packages/coding-agent/dist/modes/interactive/theme/theme.js
8
+ import * as fs from "node:fs";
9
+ import { createRequire as createRequire2 } from "node:module";
10
+ import * as path from "node:path";
11
+ import { getCapabilities } from "@ashx-j/lunr-tui";
12
+ import chalk from "chalk";
13
+
14
+ // packages/coding-agent/dist/utils/fs-watch.js
15
+ import { watch } from "node:fs";
16
+ var FS_WATCH_RETRY_DELAY_MS = 5e3;
17
+ function closeWatcher(watcher) {
18
+ if (watcher)
19
+ try {
20
+ watcher.close();
21
+ } catch {
22
+ }
23
+ }
24
+ function watchWithErrorHandler(path2, listener, onError) {
25
+ try {
26
+ let watcher = watch(path2, listener);
27
+ return watcher.on("error", onError), watcher;
28
+ } catch {
29
+ return onError(), null;
30
+ }
31
+ }
32
+
33
+ // packages/coding-agent/dist/utils/syntax-highlight.js
34
+ import { createRequire } from "node:module";
35
+
36
+ // packages/coding-agent/dist/utils/html.js
37
+ function decodeCodePoint(codePoint) {
38
+ if (!(!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 1114111))
39
+ return String.fromCodePoint(codePoint);
40
+ }
41
+ function decodeHtmlEntity(entity) {
42
+ switch (entity) {
43
+ case "amp":
44
+ return "&";
45
+ case "lt":
46
+ return "<";
47
+ case "gt":
48
+ return ">";
49
+ case "quot":
50
+ return '"';
51
+ case "apos":
52
+ return "'";
53
+ }
54
+ if (entity.startsWith("#x") || entity.startsWith("#X"))
55
+ return decodeCodePoint(Number.parseInt(entity.slice(2), 16));
56
+ if (entity.startsWith("#"))
57
+ return decodeCodePoint(Number.parseInt(entity.slice(1), 10));
58
+ }
59
+ function decodeHtmlEntityAt(html, index) {
60
+ let semicolonIndex = html.indexOf(";", index + 1);
61
+ if (semicolonIndex === -1 || semicolonIndex - index > 16)
62
+ return;
63
+ let entity = html.slice(index + 1, semicolonIndex), decoded = decodeHtmlEntity(entity);
64
+ if (decoded !== void 0)
65
+ return { text: decoded, length: semicolonIndex - index + 1 };
66
+ }
67
+
68
+ // packages/coding-agent/dist/utils/syntax-highlight.js
69
+ var require2 = createRequire(new URL("../utils/syntax-highlight.js", import.meta.url).href), highlighter;
70
+ function getHighlighter() {
71
+ return highlighter ??= require2("highlight.js/lib/index.js"), highlighter;
72
+ }
73
+ var SPAN_CLOSE = "</span>", HIGHLIGHT_CLASS_PREFIX = "hljs-";
74
+ function getScopeFromSpanTag(tag) {
75
+ let match = /\sclass\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(tag), classValue = match?.[1] ?? match?.[2];
76
+ if (classValue) {
77
+ for (let className of classValue.split(/\s+/))
78
+ if (className.startsWith(HIGHLIGHT_CLASS_PREFIX))
79
+ return className.slice(HIGHLIGHT_CLASS_PREFIX.length);
80
+ }
81
+ }
82
+ function getScopeFormatter(scope, theme2) {
83
+ let exact = theme2[scope];
84
+ if (exact)
85
+ return exact;
86
+ let dotIndex = scope.indexOf(".");
87
+ if (dotIndex !== -1) {
88
+ let prefixFormatter = theme2[scope.slice(0, dotIndex)];
89
+ if (prefixFormatter)
90
+ return prefixFormatter;
91
+ }
92
+ let dashIndex = scope.indexOf("-");
93
+ if (dashIndex !== -1) {
94
+ let prefixFormatter = theme2[scope.slice(0, dashIndex)];
95
+ if (prefixFormatter)
96
+ return prefixFormatter;
97
+ }
98
+ }
99
+ function getActiveFormatter(scopes, theme2) {
100
+ for (let i = scopes.length - 1; i >= 0; i--) {
101
+ let scope = scopes[i];
102
+ if (!scope)
103
+ continue;
104
+ let formatter = getScopeFormatter(scope, theme2);
105
+ if (formatter)
106
+ return formatter;
107
+ }
108
+ return theme2.default;
109
+ }
110
+ function isSpanOpenTagStart(html, index) {
111
+ if (!html.startsWith("<span", index))
112
+ return !1;
113
+ let nextChar = html[index + 5];
114
+ return nextChar === ">" || nextChar === " " || nextChar === " " || nextChar === `
115
+ ` || nextChar === "\r";
116
+ }
117
+ function renderHighlightedHtml(html, theme2 = {}) {
118
+ let output = "", textBuffer = "", scopes = [], flushText = () => {
119
+ if (!textBuffer)
120
+ return;
121
+ let formatter = getActiveFormatter(scopes, theme2);
122
+ output += formatter ? formatter(textBuffer) : textBuffer, textBuffer = "";
123
+ }, index = 0;
124
+ for (; index < html.length; ) {
125
+ if (isSpanOpenTagStart(html, index)) {
126
+ let tagEndIndex = html.indexOf(">", index + 5);
127
+ if (tagEndIndex !== -1) {
128
+ flushText();
129
+ let tag = html.slice(index, tagEndIndex + 1), scope = getScopeFromSpanTag(tag);
130
+ scopes.push(scope), index = tagEndIndex + 1;
131
+ continue;
132
+ }
133
+ }
134
+ if (html.startsWith(SPAN_CLOSE, index)) {
135
+ flushText(), scopes.length > 0 && scopes.pop(), index += SPAN_CLOSE.length;
136
+ continue;
137
+ }
138
+ if (html[index] === "&") {
139
+ let decoded = decodeHtmlEntityAt(html, index);
140
+ if (decoded) {
141
+ textBuffer += decoded.text, index += decoded.length;
142
+ continue;
143
+ }
144
+ }
145
+ textBuffer += html[index], index++;
146
+ }
147
+ return flushText(), output;
148
+ }
149
+ function highlight(code, options = {}) {
150
+ let html = options.language ? getHighlighter().highlight(code, {
151
+ language: options.language,
152
+ ignoreIllegals: options.ignoreIllegals
153
+ }).value : getHighlighter().highlightAuto(code, options.languageSubset).value;
154
+ return renderHighlightedHtml(html, options.theme);
155
+ }
156
+ function supportsLanguage(name) {
157
+ return getHighlighter().getLanguage(name) !== void 0;
158
+ }
159
+
160
+ // packages/coding-agent/dist/modes/interactive/theme/theme.js
161
+ var require3 = createRequire2(new URL("../modes/interactive/theme/theme.js", import.meta.url).href);
162
+ function createThemeSchema() {
163
+ let { Type } = require3("typebox"), ColorValueSchema = Type.Union([
164
+ Type.String(),
165
+ // hex "#ff0000", var ref "primary", or empty ""
166
+ Type.Integer({ minimum: 0, maximum: 255 })
167
+ // 256-color index
168
+ ]);
169
+ return Type.Object({
170
+ $schema: Type.Optional(Type.String()),
171
+ name: Type.String(),
172
+ vars: Type.Optional(Type.Record(Type.String(), ColorValueSchema)),
173
+ colors: Type.Object({
174
+ // Core UI (10 colors)
175
+ accent: ColorValueSchema,
176
+ accent2: Type.Optional(ColorValueSchema),
177
+ border: ColorValueSchema,
178
+ borderAccent: ColorValueSchema,
179
+ borderMuted: ColorValueSchema,
180
+ success: ColorValueSchema,
181
+ error: ColorValueSchema,
182
+ warning: ColorValueSchema,
183
+ muted: ColorValueSchema,
184
+ dim: ColorValueSchema,
185
+ text: ColorValueSchema,
186
+ white: Type.Optional(ColorValueSchema),
187
+ thinkingText: ColorValueSchema,
188
+ // Backgrounds & Content Text (11 colors)
189
+ selectedBg: ColorValueSchema,
190
+ userMessageBg: ColorValueSchema,
191
+ userMessageText: ColorValueSchema,
192
+ customMessageBg: ColorValueSchema,
193
+ customMessageText: ColorValueSchema,
194
+ customMessageLabel: ColorValueSchema,
195
+ toolPendingBg: ColorValueSchema,
196
+ toolSuccessBg: ColorValueSchema,
197
+ toolErrorBg: ColorValueSchema,
198
+ toolTitle: ColorValueSchema,
199
+ toolOutput: ColorValueSchema,
200
+ // Markdown (10 colors)
201
+ mdHeading: ColorValueSchema,
202
+ mdLink: ColorValueSchema,
203
+ mdLinkUrl: ColorValueSchema,
204
+ mdCode: ColorValueSchema,
205
+ mdCodeBlock: ColorValueSchema,
206
+ mdCodeBlockBorder: ColorValueSchema,
207
+ mdQuote: ColorValueSchema,
208
+ mdQuoteBorder: ColorValueSchema,
209
+ mdHr: ColorValueSchema,
210
+ mdListBullet: ColorValueSchema,
211
+ // Tool Diffs (3 colors)
212
+ toolDiffAdded: ColorValueSchema,
213
+ toolDiffRemoved: ColorValueSchema,
214
+ toolDiffContext: ColorValueSchema,
215
+ // Syntax Highlighting (9 colors)
216
+ syntaxComment: ColorValueSchema,
217
+ syntaxKeyword: ColorValueSchema,
218
+ syntaxFunction: ColorValueSchema,
219
+ syntaxVariable: ColorValueSchema,
220
+ syntaxString: ColorValueSchema,
221
+ syntaxNumber: ColorValueSchema,
222
+ syntaxType: ColorValueSchema,
223
+ syntaxOperator: ColorValueSchema,
224
+ syntaxPunctuation: ColorValueSchema,
225
+ // Thinking Level Borders (6 colors)
226
+ thinkingOff: ColorValueSchema,
227
+ thinkingMinimal: ColorValueSchema,
228
+ thinkingLow: ColorValueSchema,
229
+ thinkingMedium: ColorValueSchema,
230
+ thinkingHigh: ColorValueSchema,
231
+ thinkingXhigh: ColorValueSchema,
232
+ thinkingMax: Type.Optional(ColorValueSchema),
233
+ // Bash Mode (1 color)
234
+ bashMode: ColorValueSchema
235
+ }),
236
+ glyphs: Type.Optional(Type.Object({
237
+ promptMoon: Type.Optional(Type.String()),
238
+ promptArrow: Type.Optional(Type.String())
239
+ })),
240
+ export: Type.Optional(Type.Object({
241
+ pageBg: Type.Optional(ColorValueSchema),
242
+ cardBg: Type.Optional(ColorValueSchema),
243
+ infoBg: Type.Optional(ColorValueSchema)
244
+ }))
245
+ });
246
+ }
247
+ function createThemeValidator() {
248
+ let { Compile } = require3("typebox/compile");
249
+ return Compile(createThemeSchema());
250
+ }
251
+ var themeValidator;
252
+ function hexToRgb(hex) {
253
+ let cleaned = hex.replace("#", "");
254
+ if (cleaned.length !== 6)
255
+ throw new Error(`Invalid hex color: ${hex}`);
256
+ let r = parseInt(cleaned.substring(0, 2), 16), g = parseInt(cleaned.substring(2, 4), 16), b = parseInt(cleaned.substring(4, 6), 16);
257
+ if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b))
258
+ throw new Error(`Invalid hex color: ${hex}`);
259
+ return { r, g, b };
260
+ }
261
+ var CUBE_VALUES = [0, 95, 135, 175, 215, 255], GRAY_VALUES = Array.from({ length: 24 }, (_, i) => 8 + i * 10);
262
+ function findClosestCubeIndex(value) {
263
+ let minDist = 1 / 0, minIdx = 0;
264
+ for (let i = 0; i < CUBE_VALUES.length; i++) {
265
+ let dist = Math.abs(value - CUBE_VALUES[i]);
266
+ dist < minDist && (minDist = dist, minIdx = i);
267
+ }
268
+ return minIdx;
269
+ }
270
+ function findClosestGrayIndex(gray) {
271
+ let minDist = 1 / 0, minIdx = 0;
272
+ for (let i = 0; i < GRAY_VALUES.length; i++) {
273
+ let dist = Math.abs(gray - GRAY_VALUES[i]);
274
+ dist < minDist && (minDist = dist, minIdx = i);
275
+ }
276
+ return minIdx;
277
+ }
278
+ function colorDistance(r1, g1, b1, r2, g2, b2) {
279
+ let dr = r1 - r2, dg = g1 - g2, db = b1 - b2;
280
+ return dr * dr * 0.299 + dg * dg * 0.587 + db * db * 0.114;
281
+ }
282
+ function rgbTo256(r, g, b) {
283
+ let rIdx = findClosestCubeIndex(r), gIdx = findClosestCubeIndex(g), bIdx = findClosestCubeIndex(b), cubeR = CUBE_VALUES[rIdx], cubeG = CUBE_VALUES[gIdx], cubeB = CUBE_VALUES[bIdx], cubeIndex = 16 + 36 * rIdx + 6 * gIdx + bIdx, cubeDist = colorDistance(r, g, b, cubeR, cubeG, cubeB), gray = Math.round(0.299 * r + 0.587 * g + 0.114 * b), grayIdx = findClosestGrayIndex(gray), grayValue = GRAY_VALUES[grayIdx], grayIndex = 232 + grayIdx, grayDist = colorDistance(r, g, b, grayValue, grayValue, grayValue), maxC = Math.max(r, g, b), minC = Math.min(r, g, b);
284
+ return maxC - minC < 10 && grayDist < cubeDist ? grayIndex : cubeIndex;
285
+ }
286
+ function hexTo256(hex) {
287
+ let { r, g, b } = hexToRgb(hex);
288
+ return rgbTo256(r, g, b);
289
+ }
290
+ function fgAnsi(color, mode) {
291
+ if (color === "")
292
+ return "\x1B[39m";
293
+ if (typeof color == "number")
294
+ return `\x1B[38;5;${color}m`;
295
+ if (color.startsWith("#"))
296
+ if (mode === "truecolor") {
297
+ let { r, g, b } = hexToRgb(color);
298
+ return `\x1B[38;2;${r};${g};${b}m`;
299
+ } else
300
+ return `\x1B[38;5;${hexTo256(color)}m`;
301
+ throw new Error(`Invalid color value: ${color}`);
302
+ }
303
+ function bgAnsi(color, mode) {
304
+ if (color === "")
305
+ return "\x1B[49m";
306
+ if (typeof color == "number")
307
+ return `\x1B[48;5;${color}m`;
308
+ if (color.startsWith("#"))
309
+ if (mode === "truecolor") {
310
+ let { r, g, b } = hexToRgb(color);
311
+ return `\x1B[48;2;${r};${g};${b}m`;
312
+ } else
313
+ return `\x1B[48;5;${hexTo256(color)}m`;
314
+ throw new Error(`Invalid color value: ${color}`);
315
+ }
316
+ function resolveVarRefs(value, vars, visited = /* @__PURE__ */ new Set()) {
317
+ if (typeof value == "number" || value === "" || value.startsWith("#"))
318
+ return value;
319
+ if (visited.has(value))
320
+ throw new Error(`Circular variable reference detected: ${value}`);
321
+ if (!(value in vars))
322
+ throw new Error(`Variable reference not found: ${value}`);
323
+ return visited.add(value), resolveVarRefs(vars[value], vars, visited);
324
+ }
325
+ function resolveThemeColors(colors, vars = {}) {
326
+ let resolved = {};
327
+ for (let [key, value] of Object.entries(colors))
328
+ resolved[key] = resolveVarRefs(value, vars);
329
+ return resolved;
330
+ }
331
+ function withThemeColorFallbacks(colors) {
332
+ return {
333
+ ...colors,
334
+ thinkingMax: colors.thinkingMax ?? colors.thinkingXhigh,
335
+ accent2: colors.accent2 ?? colors.accent,
336
+ white: colors.white ?? colors.text
337
+ };
338
+ }
339
+ var DEFAULT_THEME_GLYPHS = {
340
+ promptArrow: ">"
341
+ }, Theme = class {
342
+ name;
343
+ sourcePath;
344
+ sourceInfo;
345
+ fgColors;
346
+ bgColors;
347
+ glyphs;
348
+ mode;
349
+ constructor(fgColors, bgColors, mode, options = {}) {
350
+ this.name = options.name, this.sourcePath = options.sourcePath, this.sourceInfo = options.sourceInfo, this.mode = mode, this.glyphs = { ...DEFAULT_THEME_GLYPHS, ...options.glyphs }, this.fgColors = /* @__PURE__ */ new Map();
351
+ let colors = { ...fgColors, thinkingMax: fgColors.thinkingMax ?? fgColors.thinkingXhigh };
352
+ for (let [key, value] of Object.entries(colors))
353
+ this.fgColors.set(key, fgAnsi(value, mode));
354
+ this.bgColors = /* @__PURE__ */ new Map();
355
+ for (let [key, value] of Object.entries(bgColors))
356
+ this.bgColors.set(key, bgAnsi(value, mode));
357
+ }
358
+ fg(color, text) {
359
+ let ansi = this.fgColors.get(color);
360
+ if (!ansi)
361
+ throw new Error(`Unknown theme color: ${color}`);
362
+ return `${ansi}${text}\x1B[39m`;
363
+ }
364
+ bg(color, text) {
365
+ let ansi = this.bgColors.get(color);
366
+ if (!ansi)
367
+ throw new Error(`Unknown theme background color: ${color}`);
368
+ return `${ansi}${text}\x1B[49m`;
369
+ }
370
+ bold(text) {
371
+ return chalk.bold(text);
372
+ }
373
+ italic(text) {
374
+ return chalk.italic(text);
375
+ }
376
+ underline(text) {
377
+ return chalk.underline(text);
378
+ }
379
+ inverse(text) {
380
+ return chalk.inverse(text);
381
+ }
382
+ strikethrough(text) {
383
+ return chalk.strikethrough(text);
384
+ }
385
+ getFgAnsi(color) {
386
+ let ansi = this.fgColors.get(color);
387
+ if (!ansi)
388
+ throw new Error(`Unknown theme color: ${color}`);
389
+ return ansi;
390
+ }
391
+ getBgAnsi(color) {
392
+ let ansi = this.bgColors.get(color);
393
+ if (!ansi)
394
+ throw new Error(`Unknown theme background color: ${color}`);
395
+ return ansi;
396
+ }
397
+ getColorMode() {
398
+ return this.mode;
399
+ }
400
+ /** lunr: prompt glyph tokens; empty string means that part is hidden. */
401
+ glyph(name) {
402
+ return this.glyphs[name];
403
+ }
404
+ getThinkingBorderColor(level) {
405
+ switch (level) {
406
+ case "off":
407
+ return (str) => this.fg("thinkingOff", str);
408
+ case "minimal":
409
+ return (str) => this.fg("thinkingMinimal", str);
410
+ case "low":
411
+ return (str) => this.fg("thinkingLow", str);
412
+ case "medium":
413
+ return (str) => this.fg("thinkingMedium", str);
414
+ case "high":
415
+ return (str) => this.fg("thinkingHigh", str);
416
+ case "xhigh":
417
+ return (str) => this.fg("thinkingXhigh", str);
418
+ case "max":
419
+ return (str) => this.fg("thinkingMax", str);
420
+ default:
421
+ return (str) => this.fg("thinkingOff", str);
422
+ }
423
+ }
424
+ getBashModeBorderColor() {
425
+ return (str) => this.fg("bashMode", str);
426
+ }
427
+ }, BUILTIN_THEMES;
428
+ function getBuiltinThemes() {
429
+ if (!BUILTIN_THEMES) {
430
+ let themesDir = getThemesDir(), moonPath = path.join(themesDir, "moon.json");
431
+ BUILTIN_THEMES = {
432
+ moon: JSON.parse(fs.readFileSync(moonPath, "utf-8"))
433
+ };
434
+ }
435
+ return BUILTIN_THEMES;
436
+ }
437
+ function getAvailableThemes() {
438
+ return getAvailableThemesWithPaths().map(({ name }) => name);
439
+ }
440
+ function getAvailableThemesWithPaths() {
441
+ let themesDir = getThemesDir(), result = [], seen = /* @__PURE__ */ new Set(), addTheme = (themeInfo) => {
442
+ seen.has(themeInfo.name) || (seen.add(themeInfo.name), result.push(themeInfo));
443
+ };
444
+ for (let name of Object.keys(getBuiltinThemes()))
445
+ addTheme({ name, path: path.join(themesDir, `${name}.json`) });
446
+ for (let themeInfo of getCustomThemeInfos())
447
+ addTheme(themeInfo);
448
+ for (let [name, theme2] of registeredThemes.entries())
449
+ addTheme({ name, path: theme2.sourcePath });
450
+ return result.sort((a, b) => a.name.localeCompare(b.name));
451
+ }
452
+ function getCustomThemeInfos() {
453
+ let customThemesDir = getCustomThemesDir(), result = [];
454
+ if (!fs.existsSync(customThemesDir))
455
+ return result;
456
+ for (let file of fs.readdirSync(customThemesDir)) {
457
+ if (!file.endsWith(".json"))
458
+ continue;
459
+ let themePath = path.join(customThemesDir, file);
460
+ try {
461
+ let customTheme = loadThemeFromPath(themePath);
462
+ customTheme.name && result.push({ name: customTheme.name, path: themePath });
463
+ } catch {
464
+ }
465
+ }
466
+ return result;
467
+ }
468
+ function assertThemeNameIsValid(name) {
469
+ if (name.includes("/"))
470
+ throw new Error(`Invalid theme name "${name}": theme names cannot contain "/" because it is reserved for automatic light/dark theme settings.`);
471
+ }
472
+ function parseThemeJson(label, json) {
473
+ themeValidator ??= createThemeValidator();
474
+ let validateThemeJson = themeValidator;
475
+ if (!validateThemeJson.Check(json)) {
476
+ let errors = Array.from(validateThemeJson.Errors(json)), missingColors = /* @__PURE__ */ new Set(), otherErrors = [];
477
+ for (let error of errors) {
478
+ if (error.keyword === "required" && error.instancePath === "/colors") {
479
+ let requiredProperties = error.params.requiredProperties;
480
+ for (let requiredProperty of requiredProperties ?? [])
481
+ missingColors.add(requiredProperty);
482
+ continue;
483
+ }
484
+ let path2 = error.instancePath || "/";
485
+ otherErrors.push(` - ${path2}: ${error.message}`);
486
+ }
487
+ let errorMessage = `Invalid theme "${label}":
488
+ `;
489
+ throw missingColors.size > 0 && (errorMessage += `
490
+ Missing required color tokens:
491
+ `, errorMessage += Array.from(missingColors).sort().map((color) => ` - ${color}`).join(`
492
+ `), errorMessage += `
493
+
494
+ Please add these colors to your theme's "colors" object.`, errorMessage += `
495
+ See the built-in theme (moon.json) for reference values.`), otherErrors.length > 0 && (errorMessage += `
496
+
497
+ Other errors:
498
+ ${otherErrors.join(`
499
+ `)}`), new Error(errorMessage);
500
+ }
501
+ let themeJson = json;
502
+ return assertThemeNameIsValid(themeJson.name), themeJson;
503
+ }
504
+ function parseThemeJsonContent(label, content) {
505
+ let json;
506
+ try {
507
+ json = JSON.parse(content);
508
+ } catch (error) {
509
+ throw new Error(`Failed to parse theme ${label}: ${error}`);
510
+ }
511
+ return parseThemeJson(label, json);
512
+ }
513
+ function loadThemeJson(name) {
514
+ let builtinThemes = getBuiltinThemes();
515
+ if (name in builtinThemes)
516
+ return builtinThemes[name];
517
+ let registeredTheme = registeredThemes.get(name);
518
+ if (registeredTheme?.sourcePath) {
519
+ let content2 = fs.readFileSync(registeredTheme.sourcePath, "utf-8");
520
+ return parseThemeJsonContent(registeredTheme.sourcePath, content2);
521
+ }
522
+ if (registeredTheme)
523
+ throw new Error(`Theme "${name}" does not have a source path for export`);
524
+ let customThemesDir = getCustomThemesDir(), themePath = path.join(customThemesDir, `${name}.json`);
525
+ if (!fs.existsSync(themePath))
526
+ throw new Error(`Theme not found: ${name}`);
527
+ let content = fs.readFileSync(themePath, "utf-8");
528
+ return parseThemeJsonContent(name, content);
529
+ }
530
+ function createTheme(themeJson, mode, sourcePath) {
531
+ let colorMode = mode ?? (getCapabilities().trueColor ? "truecolor" : "256color"), resolvedColors = resolveThemeColors(withThemeColorFallbacks(themeJson.colors), themeJson.vars), fgColors = {}, bgColors = {}, bgColorKeys = /* @__PURE__ */ new Set([
532
+ "selectedBg",
533
+ "userMessageBg",
534
+ "customMessageBg",
535
+ "toolPendingBg",
536
+ "toolSuccessBg",
537
+ "toolErrorBg"
538
+ ]);
539
+ for (let [key, value] of Object.entries(resolvedColors))
540
+ bgColorKeys.has(key) ? bgColors[key] = value : fgColors[key] = value;
541
+ return new Theme(fgColors, bgColors, colorMode, {
542
+ name: themeJson.name,
543
+ sourcePath,
544
+ glyphs: {
545
+ promptArrow: themeJson.glyphs?.promptArrow ?? DEFAULT_THEME_GLYPHS.promptArrow
546
+ }
547
+ });
548
+ }
549
+ function loadThemeFromPath(themePath, mode) {
550
+ let content = fs.readFileSync(themePath, "utf-8"), themeJson = parseThemeJsonContent(themePath, content);
551
+ return createTheme(themeJson, mode, themePath);
552
+ }
553
+ function loadTheme(name, mode) {
554
+ let registeredTheme = registeredThemes.get(name);
555
+ if (registeredTheme)
556
+ return registeredTheme;
557
+ let themeJson = loadThemeJson(name);
558
+ return createTheme(themeJson, mode);
559
+ }
560
+ function getThemeByName(name) {
561
+ try {
562
+ return loadTheme(name);
563
+ } catch {
564
+ return;
565
+ }
566
+ }
567
+ function parseAutoThemeSetting(themeSetting) {
568
+ if (!themeSetting)
569
+ return;
570
+ let slashIndex = themeSetting.indexOf("/");
571
+ if (slashIndex === -1 || themeSetting.indexOf("/", slashIndex + 1) !== -1)
572
+ return;
573
+ let lightTheme = themeSetting.slice(0, slashIndex).trim(), darkTheme = themeSetting.slice(slashIndex + 1).trim();
574
+ if (!(!lightTheme || !darkTheme))
575
+ return { lightTheme, darkTheme };
576
+ }
577
+ function resolveThemeSetting(themeSetting, terminalTheme) {
578
+ let autoTheme = parseAutoThemeSetting(themeSetting);
579
+ if (autoTheme)
580
+ return terminalTheme === "light" ? autoTheme.lightTheme : autoTheme.darkTheme;
581
+ if (!themeSetting?.includes("/") && typeof themeSetting == "string")
582
+ return themeSetting;
583
+ }
584
+ function getColorFgBgBackgroundIndex(colorfgbg) {
585
+ let parts = colorfgbg.split(";");
586
+ for (let i = parts.length - 1; i >= 0; i--) {
587
+ let bg = parseInt(parts[i].trim(), 10);
588
+ if (Number.isInteger(bg) && bg >= 0 && bg <= 255)
589
+ return bg;
590
+ }
591
+ }
592
+ function getRgbColorLuminance({ r, g, b }) {
593
+ let toLinear = (channel) => {
594
+ let value = channel / 255;
595
+ return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
596
+ };
597
+ return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
598
+ }
599
+ function getAnsiColorLuminance(index) {
600
+ return getRgbColorLuminance(hexToRgb(ansi256ToHex(index)));
601
+ }
602
+ function getThemeForRgbColor(rgb) {
603
+ return getRgbColorLuminance(rgb) >= 0.5 ? "light" : "dark";
604
+ }
605
+ function detectTerminalBackgroundFromEnv(options = {}) {
606
+ let colorfgbg = (options.env ?? process.env).COLORFGBG || "", bg = getColorFgBgBackgroundIndex(colorfgbg);
607
+ return bg !== void 0 ? {
608
+ theme: getAnsiColorLuminance(bg) >= 0.5 ? "light" : "dark",
609
+ source: "COLORFGBG",
610
+ detail: `background color index ${bg}`,
611
+ confidence: "high"
612
+ } : {
613
+ theme: "dark",
614
+ source: "fallback",
615
+ detail: "no terminal background hint found",
616
+ confidence: "low"
617
+ };
618
+ }
619
+ async function detectTerminalBackgroundTheme({ ui, timeoutMs, env }) {
620
+ try {
621
+ let rgb = await ui.queryTerminalBackgroundColor({ timeoutMs });
622
+ if (rgb)
623
+ return {
624
+ theme: getThemeForRgbColor(rgb),
625
+ source: "terminal background",
626
+ detail: `OSC 11 background rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`,
627
+ confidence: "high"
628
+ };
629
+ } catch {
630
+ }
631
+ return detectTerminalBackgroundFromEnv({ env });
632
+ }
633
+ async function detectTerminalThemeForAuto({ ui, timeoutMs, env }) {
634
+ try {
635
+ let colorScheme = await ui.queryTerminalColorScheme?.({ timeoutMs });
636
+ if (colorScheme)
637
+ return colorScheme;
638
+ } catch {
639
+ }
640
+ return (await detectTerminalBackgroundTheme({ ui, timeoutMs, env })).theme;
641
+ }
642
+ function getDefaultTheme() {
643
+ return "moon";
644
+ }
645
+ var THEME_KEY = /* @__PURE__ */ Symbol.for("@ashx-j/lunr:theme"), THEME_KEY_OLD = /* @__PURE__ */ Symbol.for("@mariozechner/pi-coding-agent:theme"), theme = new Proxy({}, {
646
+ get(_target, prop) {
647
+ let t = globalThis[THEME_KEY];
648
+ if (!t)
649
+ throw new Error("Theme not initialized. Call initTheme() first.");
650
+ return t[prop];
651
+ }
652
+ });
653
+ function setGlobalTheme(t) {
654
+ globalThis[THEME_KEY] = t, globalThis[THEME_KEY_OLD] = t;
655
+ }
656
+ var currentThemeName, themeWatcher, themeReloadTimer, onThemeChangeCallback, registeredThemes = /* @__PURE__ */ new Map();
657
+ function setRegisteredThemes(themes) {
658
+ registeredThemes.clear();
659
+ for (let theme2 of themes)
660
+ theme2.name && (assertThemeNameIsValid(theme2.name), registeredThemes.set(theme2.name, theme2));
661
+ }
662
+ function initTheme(themeName, enableWatcher = !1) {
663
+ let name = themeName ?? getDefaultTheme();
664
+ currentThemeName = name;
665
+ try {
666
+ setGlobalTheme(loadTheme(name)), enableWatcher && startThemeWatcher();
667
+ } catch {
668
+ currentThemeName = "moon", setGlobalTheme(loadTheme("moon"));
669
+ }
670
+ }
671
+ function setTheme(name, enableWatcher = !1) {
672
+ currentThemeName = name;
673
+ try {
674
+ return setGlobalTheme(loadTheme(name)), enableWatcher && startThemeWatcher(), onThemeChangeCallback && onThemeChangeCallback(), { success: !0 };
675
+ } catch (error) {
676
+ return currentThemeName = "moon", setGlobalTheme(loadTheme("moon")), {
677
+ success: !1,
678
+ error: error instanceof Error ? error.message : String(error)
679
+ };
680
+ }
681
+ }
682
+ function setThemeInstance(themeInstance) {
683
+ setGlobalTheme(themeInstance), currentThemeName = "<in-memory>", stopThemeWatcher(), onThemeChangeCallback && onThemeChangeCallback();
684
+ }
685
+ function onThemeChange(callback) {
686
+ onThemeChangeCallback = callback;
687
+ }
688
+ function getThemeName() {
689
+ return currentThemeName ?? getDefaultTheme();
690
+ }
691
+ function startThemeWatcher() {
692
+ if (stopThemeWatcher(), !currentThemeName || currentThemeName === "moon")
693
+ return;
694
+ let customThemesDir = getCustomThemesDir(), watchedThemeName = currentThemeName, watchedFileName = `${watchedThemeName}.json`, themeFile = path.join(customThemesDir, watchedFileName);
695
+ if (!fs.existsSync(themeFile))
696
+ return;
697
+ let scheduleReload = () => {
698
+ themeReloadTimer && clearTimeout(themeReloadTimer), themeReloadTimer = setTimeout(() => {
699
+ if (themeReloadTimer = void 0, currentThemeName === watchedThemeName && fs.existsSync(themeFile))
700
+ try {
701
+ let reloadedTheme = loadThemeFromPath(themeFile);
702
+ registeredThemes.set(watchedThemeName, reloadedTheme), setGlobalTheme(reloadedTheme), onThemeChangeCallback && onThemeChangeCallback();
703
+ } catch {
704
+ }
705
+ }, 100);
706
+ };
707
+ themeWatcher = watchWithErrorHandler(customThemesDir, (_eventType, filename) => {
708
+ if (currentThemeName === watchedThemeName) {
709
+ if (!filename) {
710
+ scheduleReload();
711
+ return;
712
+ }
713
+ filename === watchedFileName && scheduleReload();
714
+ }
715
+ }, () => {
716
+ closeWatcher(themeWatcher), themeWatcher = void 0;
717
+ }) ?? void 0;
718
+ }
719
+ function stopThemeWatcher() {
720
+ themeReloadTimer && (clearTimeout(themeReloadTimer), themeReloadTimer = void 0), closeWatcher(themeWatcher), themeWatcher = void 0;
721
+ }
722
+ function ansi256ToHex(index) {
723
+ let basicColors = [
724
+ "#000000",
725
+ "#800000",
726
+ "#008000",
727
+ "#808000",
728
+ "#000080",
729
+ "#800080",
730
+ "#008080",
731
+ "#c0c0c0",
732
+ "#808080",
733
+ "#ff0000",
734
+ "#00ff00",
735
+ "#ffff00",
736
+ "#0000ff",
737
+ "#ff00ff",
738
+ "#00ffff",
739
+ "#ffffff"
740
+ ];
741
+ if (index < 16)
742
+ return basicColors[index];
743
+ if (index < 232) {
744
+ let cubeIndex = index - 16, r = Math.floor(cubeIndex / 36), g = Math.floor(cubeIndex % 36 / 6), b = cubeIndex % 6, toHex = (n) => (n === 0 ? 0 : 55 + n * 40).toString(16).padStart(2, "0");
745
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
746
+ }
747
+ let grayHex = (8 + (index - 232) * 10).toString(16).padStart(2, "0");
748
+ return `#${grayHex}${grayHex}${grayHex}`;
749
+ }
750
+ function getResolvedThemeColors(themeName) {
751
+ let name = themeName ?? currentThemeName ?? getDefaultTheme(), isLight = name === "light", themeJson = loadThemeJson(name), resolved = resolveThemeColors(withThemeColorFallbacks(themeJson.colors), themeJson.vars), defaultText = isLight ? "#000000" : "#e5e5e7", cssColors = {};
752
+ for (let [key, value] of Object.entries(resolved))
753
+ typeof value == "number" ? cssColors[key] = ansi256ToHex(value) : value === "" ? cssColors[key] = defaultText : cssColors[key] = value;
754
+ return cssColors;
755
+ }
756
+ function getThemeExportColors(themeName) {
757
+ let name = themeName ?? currentThemeName ?? getDefaultTheme();
758
+ try {
759
+ let themeJson = loadThemeJson(name), exportSection = themeJson.export;
760
+ if (!exportSection)
761
+ return {};
762
+ let vars = themeJson.vars ?? {}, resolve = (value) => {
763
+ if (value === void 0)
764
+ return;
765
+ let resolved = resolveVarRefs(value, vars);
766
+ if (typeof resolved == "number")
767
+ return ansi256ToHex(resolved);
768
+ if (resolved !== "")
769
+ return resolved;
770
+ };
771
+ return {
772
+ pageBg: resolve(exportSection.pageBg),
773
+ cardBg: resolve(exportSection.cardBg),
774
+ infoBg: resolve(exportSection.infoBg)
775
+ };
776
+ } catch {
777
+ return {};
778
+ }
779
+ }
780
+ var cachedHighlightThemeFor, cachedCliHighlightTheme;
781
+ function buildCliHighlightTheme(t) {
782
+ return {
783
+ keyword: (s) => t.fg("syntaxKeyword", s),
784
+ built_in: (s) => t.fg("syntaxType", s),
785
+ literal: (s) => t.fg("syntaxNumber", s),
786
+ number: (s) => t.fg("syntaxNumber", s),
787
+ regexp: (s) => t.fg("syntaxString", s),
788
+ string: (s) => t.fg("syntaxString", s),
789
+ comment: (s) => t.fg("syntaxComment", s),
790
+ doctag: (s) => t.fg("syntaxComment", s),
791
+ meta: (s) => t.fg("muted", s),
792
+ function: (s) => t.fg("syntaxFunction", s),
793
+ title: (s) => t.fg("syntaxFunction", s),
794
+ class: (s) => t.fg("syntaxType", s),
795
+ type: (s) => t.fg("syntaxType", s),
796
+ tag: (s) => t.fg("syntaxPunctuation", s),
797
+ name: (s) => t.fg("syntaxKeyword", s),
798
+ attr: (s) => t.fg("syntaxVariable", s),
799
+ variable: (s) => t.fg("syntaxVariable", s),
800
+ params: (s) => t.fg("syntaxVariable", s),
801
+ operator: (s) => t.fg("syntaxOperator", s),
802
+ punctuation: (s) => t.fg("syntaxPunctuation", s),
803
+ emphasis: (s) => t.italic(s),
804
+ strong: (s) => t.bold(s),
805
+ link: (s) => t.underline(s),
806
+ addition: (s) => t.fg("toolDiffAdded", s),
807
+ deletion: (s) => t.fg("toolDiffRemoved", s)
808
+ };
809
+ }
810
+ function getCliHighlightTheme(t) {
811
+ return (cachedHighlightThemeFor !== t || !cachedCliHighlightTheme) && (cachedHighlightThemeFor = t, cachedCliHighlightTheme = buildCliHighlightTheme(t)), cachedCliHighlightTheme;
812
+ }
813
+ function highlightCode(code, lang) {
814
+ let validLang = lang && supportsLanguage(lang) ? lang : void 0;
815
+ if (!validLang)
816
+ return code.split(`
817
+ `).map((line) => theme.fg("mdCodeBlock", line));
818
+ let opts = {
819
+ language: validLang,
820
+ ignoreIllegals: !0,
821
+ theme: getCliHighlightTheme(theme)
822
+ };
823
+ try {
824
+ return highlight(code, opts).split(`
825
+ `);
826
+ } catch {
827
+ return code.split(`
828
+ `);
829
+ }
830
+ }
831
+ function getLanguageFromPath(filePath) {
832
+ let ext = filePath.split(".").pop()?.toLowerCase();
833
+ return ext ? {
834
+ ts: "typescript",
835
+ tsx: "typescript",
836
+ js: "javascript",
837
+ jsx: "javascript",
838
+ mjs: "javascript",
839
+ cjs: "javascript",
840
+ py: "python",
841
+ rb: "ruby",
842
+ rs: "rust",
843
+ go: "go",
844
+ java: "java",
845
+ kt: "kotlin",
846
+ swift: "swift",
847
+ c: "c",
848
+ h: "c",
849
+ cpp: "cpp",
850
+ cc: "cpp",
851
+ cxx: "cpp",
852
+ hpp: "cpp",
853
+ cs: "csharp",
854
+ php: "php",
855
+ sh: "bash",
856
+ bash: "bash",
857
+ zsh: "bash",
858
+ fish: "fish",
859
+ ps1: "powershell",
860
+ sql: "sql",
861
+ html: "html",
862
+ htm: "html",
863
+ css: "css",
864
+ scss: "scss",
865
+ sass: "sass",
866
+ less: "less",
867
+ json: "json",
868
+ yaml: "yaml",
869
+ yml: "yaml",
870
+ toml: "toml",
871
+ xml: "xml",
872
+ md: "markdown",
873
+ markdown: "markdown",
874
+ dockerfile: "dockerfile",
875
+ makefile: "makefile",
876
+ cmake: "cmake",
877
+ lua: "lua",
878
+ perl: "perl",
879
+ r: "r",
880
+ scala: "scala",
881
+ clj: "clojure",
882
+ ex: "elixir",
883
+ exs: "elixir",
884
+ erl: "erlang",
885
+ hs: "haskell",
886
+ ml: "ocaml",
887
+ vim: "vim",
888
+ graphql: "graphql",
889
+ proto: "protobuf",
890
+ tf: "hcl",
891
+ hcl: "hcl"
892
+ }[ext] : void 0;
893
+ }
894
+ function getMarkdownTheme() {
895
+ return {
896
+ heading: (text) => theme.fg("mdHeading", text),
897
+ link: (text) => theme.fg("mdLink", text),
898
+ linkUrl: (text) => theme.fg("mdLinkUrl", text),
899
+ code: (text) => theme.fg("mdCode", text),
900
+ codeBlock: (text) => theme.fg("mdCodeBlock", text),
901
+ codeBlockBorder: (text) => theme.fg("mdCodeBlockBorder", text),
902
+ quote: (text) => theme.fg("mdQuote", text),
903
+ quoteBorder: (text) => theme.fg("mdQuoteBorder", text),
904
+ hr: (text) => theme.fg("mdHr", text),
905
+ listBullet: (text) => theme.fg("mdListBullet", text),
906
+ bold: (text) => theme.bold(text),
907
+ italic: (text) => theme.italic(text),
908
+ underline: (text) => theme.underline(text),
909
+ strikethrough: (text) => chalk.strikethrough(text),
910
+ highlightCode: (code, lang) => {
911
+ let validLang = lang && supportsLanguage(lang) ? lang : void 0;
912
+ if (!validLang)
913
+ return code.split(`
914
+ `).map((line) => theme.fg("mdCodeBlock", line));
915
+ let opts = {
916
+ language: validLang,
917
+ ignoreIllegals: !0,
918
+ theme: getCliHighlightTheme(theme)
919
+ };
920
+ try {
921
+ return highlight(code, opts).split(`
922
+ `);
923
+ } catch {
924
+ return code.split(`
925
+ `).map((line) => theme.fg("mdCodeBlock", line));
926
+ }
927
+ }
928
+ };
929
+ }
930
+ function getSelectListTheme() {
931
+ return {
932
+ selectedPrefix: (text) => theme.fg("accent", text),
933
+ selectedText: (text) => theme.fg("accent", text),
934
+ description: (text) => theme.fg("muted", text),
935
+ scrollInfo: (text) => theme.fg("muted", text),
936
+ noMatch: (text) => theme.fg("muted", text)
937
+ };
938
+ }
939
+ function getEditorTheme() {
940
+ return {
941
+ borderColor: (text) => theme.fg("borderMuted", text),
942
+ selectList: getSelectListTheme()
943
+ };
944
+ }
945
+ function getSettingsListTheme() {
946
+ return {
947
+ label: (text, selected) => selected ? theme.fg("accent", text) : text,
948
+ value: (text, selected) => selected ? theme.fg("accent", text) : theme.fg("muted", text),
949
+ description: (text) => theme.fg("dim", text),
950
+ disabled: (text) => theme.fg("dim", text),
951
+ cursor: theme.fg("accent", "\u2192 "),
952
+ hint: (text) => theme.fg("dim", text)
953
+ };
954
+ }
955
+
956
+ export {
957
+ FS_WATCH_RETRY_DELAY_MS,
958
+ closeWatcher,
959
+ watchWithErrorHandler,
960
+ Theme,
961
+ getAvailableThemes,
962
+ getAvailableThemesWithPaths,
963
+ loadThemeFromPath,
964
+ getThemeByName,
965
+ parseAutoThemeSetting,
966
+ resolveThemeSetting,
967
+ detectTerminalBackgroundFromEnv,
968
+ detectTerminalThemeForAuto,
969
+ getDefaultTheme,
970
+ theme,
971
+ setRegisteredThemes,
972
+ initTheme,
973
+ setTheme,
974
+ setThemeInstance,
975
+ onThemeChange,
976
+ getThemeName,
977
+ stopThemeWatcher,
978
+ getResolvedThemeColors,
979
+ getThemeExportColors,
980
+ highlightCode,
981
+ getLanguageFromPath,
982
+ getMarkdownTheme,
983
+ getSelectListTheme,
984
+ getEditorTheme,
985
+ getSettingsListTheme
986
+ };