@ashx-j/lunr-dev 0.2.13-dev.8.1 → 0.2.16-dev.9.1

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 +29 -1
  2. package/dist/builtin-extensions/ashxj-tui.d.ts +14 -0
  3. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  4. package/dist/builtin-extensions/ashxj-tui.js +37 -3
  5. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  6. package/dist/builtin-extensions/index.d.ts +1 -15
  7. package/dist/builtin-extensions/index.d.ts.map +1 -1
  8. package/dist/builtin-extensions/index.js +7 -21
  9. package/dist/builtin-extensions/index.js.map +1 -1
  10. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -1
  11. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +6 -2
  12. package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -1
  13. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
  14. package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
  15. package/dist/builtin-extensions/pi-lsp-extension/src/index.js +163 -169
  16. package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
  17. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +46 -0
  18. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
  19. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +109 -0
  20. package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
  21. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
  22. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
  23. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
  24. package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
  25. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
  26. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  27. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
  28. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  29. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  30. package/dist/builtin-extensions/pi-mcp-adapter/index.js +251 -94
  31. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  32. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
  33. package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
  35. package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
  36. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
  38. package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
  39. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
  40. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
  41. package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
  42. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
  43. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
  44. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
  45. package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
  47. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +38 -14
  49. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
  51. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
  53. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +2 -1
  60. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
  64. package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
  65. package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
  67. package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
  68. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
  69. package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
  71. package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
  72. package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
  73. package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
  74. package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
  75. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  76. package/dist/builtin-extensions/pi-web-access/index.js +167 -77
  77. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  78. package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
  79. package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
  80. package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
  81. package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
  82. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
  83. package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
  84. package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
  85. package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
  86. package/dist/catalog/publication.json +12 -12
  87. package/dist/cli-runtime.d.ts +3 -0
  88. package/dist/cli-runtime.d.ts.map +1 -0
  89. package/dist/cli-runtime.js +73 -0
  90. package/dist/cli-runtime.js.map +1 -0
  91. package/dist/cli.d.ts.map +1 -1
  92. package/dist/cli.js +14 -53
  93. package/dist/cli.js.map +1 -1
  94. package/dist/config.d.ts +1 -0
  95. package/dist/config.d.ts.map +1 -1
  96. package/dist/config.js +1 -0
  97. package/dist/config.js.map +1 -1
  98. package/dist/core/agent-session.d.ts +3 -0
  99. package/dist/core/agent-session.d.ts.map +1 -1
  100. package/dist/core/agent-session.js +56 -12
  101. package/dist/core/agent-session.js.map +1 -1
  102. package/dist/core/compaction/compaction.d.ts.map +1 -1
  103. package/dist/core/compaction/compaction.js +10 -5
  104. package/dist/core/compaction/compaction.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/extensions/types.d.ts +2 -2
  113. package/dist/core/extensions/types.d.ts.map +1 -1
  114. package/dist/core/extensions/types.js.map +1 -1
  115. package/dist/core/footer-data-provider.d.ts.map +1 -1
  116. package/dist/core/footer-data-provider.js +2 -0
  117. package/dist/core/footer-data-provider.js.map +1 -1
  118. package/dist/core/permissions.d.ts +0 -2
  119. package/dist/core/permissions.d.ts.map +1 -1
  120. package/dist/core/permissions.js +10 -18
  121. package/dist/core/permissions.js.map +1 -1
  122. package/dist/core/sdk.d.ts +1 -1
  123. package/dist/core/sdk.d.ts.map +1 -1
  124. package/dist/core/sdk.js +1 -1
  125. package/dist/core/sdk.js.map +1 -1
  126. package/dist/core/slash-commands.d.ts.map +1 -1
  127. package/dist/core/slash-commands.js +0 -1
  128. package/dist/core/slash-commands.js.map +1 -1
  129. package/dist/core/timings.d.ts +2 -1
  130. package/dist/core/timings.d.ts.map +1 -1
  131. package/dist/core/timings.js +17 -2
  132. package/dist/core/timings.js.map +1 -1
  133. package/dist/gateway/commands.d.ts +1 -1
  134. package/dist/gateway/commands.d.ts.map +1 -1
  135. package/dist/gateway/commands.js +1 -18
  136. package/dist/gateway/commands.js.map +1 -1
  137. package/dist/main.d.ts +2 -2
  138. package/dist/main.d.ts.map +1 -1
  139. package/dist/main.js +57 -48
  140. package/dist/main.js.map +1 -1
  141. package/dist/modes/interactive/interactive-mode.d.ts +12 -21
  142. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  143. package/dist/modes/interactive/interactive-mode.js +120 -144
  144. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  145. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  146. package/dist/modes/interactive/theme/theme.js +95 -84
  147. package/dist/modes/interactive/theme/theme.js.map +1 -1
  148. package/dist/node-runtime/agent-session-services-IFJMSX7Z.js +36 -0
  149. package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
  150. package/dist/node-runtime/brave-UWDA3I22.js +143 -0
  151. package/dist/node-runtime/builtin-extensions-LYZ3BFWQ.js +28 -0
  152. package/dist/node-runtime/chunk-2QKLKMKC.js +173 -0
  153. package/dist/node-runtime/chunk-3GHXVUAK.js +21 -0
  154. package/dist/node-runtime/chunk-3RCWXWAY.js +466 -0
  155. package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
  156. package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
  157. package/dist/node-runtime/chunk-4HXHDDCF.js +16 -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-5P7PZMRU.js +610 -0
  162. package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
  163. package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
  164. package/dist/node-runtime/chunk-A2KQXUJD.js +105 -0
  165. package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
  166. package/dist/node-runtime/chunk-AHSTJBIB.js +64 -0
  167. package/dist/node-runtime/chunk-AJX357CL.js +20211 -0
  168. package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
  169. package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
  170. package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
  171. package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
  172. package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
  173. package/dist/node-runtime/chunk-BR7YDUKA.js +109 -0
  174. package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
  175. package/dist/node-runtime/chunk-C4O2RSQQ.js +37 -0
  176. package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
  177. package/dist/node-runtime/chunk-CDFZEWPU.js +8388 -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-DAPBPCBP.js +53 -0
  181. package/dist/node-runtime/chunk-DDGMHUOW.js +305 -0
  182. package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
  183. package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
  184. package/dist/node-runtime/chunk-ECD5L7YI.js +1369 -0
  185. package/dist/node-runtime/chunk-EDBJNRSM.js +46 -0
  186. package/dist/node-runtime/chunk-F4VQFJI2.js +1269 -0
  187. package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
  188. package/dist/node-runtime/chunk-GZQHMEWL.js +126 -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-IPA627GP.js +296 -0
  194. package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
  195. package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
  196. package/dist/node-runtime/chunk-LZAW4ZX3.js +633 -0
  197. package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
  198. package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
  199. package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
  200. package/dist/node-runtime/chunk-MKKH27PH.js +8956 -0
  201. package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -0
  202. package/dist/node-runtime/chunk-N77MY65L.js +966 -0
  203. package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
  204. package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
  205. package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
  206. package/dist/node-runtime/chunk-PBC2Y6GS.js +903 -0
  207. package/dist/node-runtime/chunk-PCGNAY2O.js +1324 -0
  208. package/dist/node-runtime/chunk-PCIGF2XK.js +250 -0
  209. package/dist/node-runtime/chunk-PGAJ5MO5.js +7558 -0
  210. package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
  211. package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
  212. package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
  213. package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
  214. package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
  215. package/dist/node-runtime/chunk-QH42CDX3.js +9451 -0
  216. package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
  217. package/dist/node-runtime/chunk-RQ5DNUNG.js +429 -0
  218. package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
  219. package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
  220. package/dist/node-runtime/chunk-SWSN6HAB.js +53 -0
  221. package/dist/node-runtime/chunk-TQNSPERU.js +949 -0
  222. package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
  223. package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
  224. package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
  225. package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
  226. package/dist/node-runtime/chunk-WOVTOV5P.js +5653 -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-YF63P5ZT.js +864 -0
  230. package/dist/node-runtime/chunk-YSKSB3BJ.js +295 -0
  231. package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
  232. package/dist/node-runtime/chunk-ZKMFUD3Q.js +2834 -0
  233. package/dist/node-runtime/cli-runtime.js +81 -0
  234. package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
  235. package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
  236. package/dist/node-runtime/command-L3LAHDIH.js +13 -0
  237. package/dist/node-runtime/commands-RL5YBW5I.js +291 -0
  238. package/dist/node-runtime/config-FMEOZSWE.js +77 -0
  239. package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
  240. package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
  241. package/dist/node-runtime/direct-tool-executor-JVDXTO7A.js +188 -0
  242. package/dist/node-runtime/exa-LL64QZR2.js +329 -0
  243. package/dist/node-runtime/export-html-KR26FOUZ.js +150 -0
  244. package/dist/node-runtime/extension-input-RV5N6APL.js +14 -0
  245. package/dist/node-runtime/extension-selector-CPD5LWDD.js +14 -0
  246. package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
  247. package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
  248. package/dist/node-runtime/gateway-X2TI5X7F.js +2484 -0
  249. package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
  250. package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
  251. package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
  252. package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
  253. package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
  254. package/dist/node-runtime/goal-CZQ7FFQJ.js +1831 -0
  255. package/dist/node-runtime/index.js +859 -0
  256. package/dist/node-runtime/init-NJV2T55N.js +28 -0
  257. package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
  258. package/dist/node-runtime/interactive-mode-KOM35YF2.js +56 -0
  259. package/dist/node-runtime/interactive-view-U6OILKF3.js +249 -0
  260. package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
  261. package/dist/node-runtime/lunr-cron-YJ5UHYRD.js +268 -0
  262. package/dist/node-runtime/main.js +54 -0
  263. package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
  264. package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
  265. package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
  266. package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
  267. package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
  268. package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
  269. package/dist/node-runtime/package-manager-cli-TZZHJCVI.js +749 -0
  270. package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
  271. package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
  272. package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
  273. package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
  274. package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
  275. package/dist/node-runtime/pi-mcp-adapter-QFB37AVN.js +422 -0
  276. package/dist/node-runtime/pi-ollama-cloud-4VZRMULP.js +1440 -0
  277. package/dist/node-runtime/pi-prompt-template-model-4QT4LLXF.js +3946 -0
  278. package/dist/node-runtime/pi-subagents-7XJ4H53P.js +6023 -0
  279. package/dist/node-runtime/pi-web-access-DPGAVKOA.js +1864 -0
  280. package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
  281. package/dist/node-runtime/proxy-modes-HEEFK4KC.js +685 -0
  282. package/dist/node-runtime/rpc-entry.js +62 -0
  283. package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
  284. package/dist/node-runtime/runtime-bridges-PPHNBFWL.js +14 -0
  285. package/dist/node-runtime/session-manager-MQNBYACL.js +35 -0
  286. package/dist/node-runtime/session-selector-5AZLJS6U.js +14 -0
  287. package/dist/node-runtime/settings-manager-5LF2VQWC.js +21 -0
  288. package/dist/node-runtime/src-Y7JSCK64.js +2407 -0
  289. package/dist/node-runtime/subagent-executor-5RNDEPIJ.js +8483 -0
  290. package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
  291. package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
  292. package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
  293. package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
  294. package/dist/node-runtime/update-cli-A253SZ7P.js +73 -0
  295. package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
  296. package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
  297. package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
  298. package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
  299. package/dist/startup/benchmark-request.d.ts +3 -0
  300. package/dist/startup/benchmark-request.d.ts.map +1 -0
  301. package/dist/startup/benchmark-request.js +65 -0
  302. package/dist/startup/benchmark-request.js.map +1 -0
  303. package/dist/startup/interactive-view.d.ts +55 -0
  304. package/dist/startup/interactive-view.d.ts.map +1 -0
  305. package/dist/startup/interactive-view.js +332 -0
  306. package/dist/startup/interactive-view.js.map +1 -0
  307. package/dist/startup/launch-routing.d.ts.map +1 -1
  308. package/dist/startup/launch-routing.js +9 -10
  309. package/dist/startup/launch-routing.js.map +1 -1
  310. package/dist/startup/startup-milestones.d.ts +1 -1
  311. package/dist/startup/startup-milestones.d.ts.map +1 -1
  312. package/dist/startup/startup-milestones.js +3 -2
  313. package/dist/startup/startup-milestones.js.map +1 -1
  314. package/dist/utils/await-with-abort.d.ts +2 -0
  315. package/dist/utils/await-with-abort.d.ts.map +1 -0
  316. package/dist/utils/await-with-abort.js +19 -0
  317. package/dist/utils/await-with-abort.js.map +1 -0
  318. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  319. package/dist/utils/syntax-highlight.js +10 -4
  320. package/dist/utils/syntax-highlight.js.map +1 -1
  321. package/docs/compaction.md +5 -3
  322. package/docs/development.md +5 -1
  323. package/docs/features.md +0 -1
  324. package/docs/interactive-startup.md +98 -0
  325. package/docs/usage.md +0 -1
  326. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  327. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  328. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  329. package/examples/extensions/gondolin/package-lock.json +2 -2
  330. package/examples/extensions/gondolin/package.json +1 -1
  331. package/examples/extensions/sandbox/package-lock.json +2 -2
  332. package/examples/extensions/sandbox/package.json +1 -1
  333. package/examples/extensions/with-deps/package-lock.json +2 -2
  334. package/examples/extensions/with-deps/package.json +1 -1
  335. package/package.json +20 -20
  336. package/dist/core/swarm.d.ts +0 -23
  337. package/dist/core/swarm.d.ts.map +0 -1
  338. package/dist/core/swarm.js +0 -45
  339. package/dist/core/swarm.js.map +0 -1
@@ -0,0 +1,619 @@
1
+ import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
+ import {
3
+ registerSessionCleanup
4
+ } from "./chunk-AUXVGBO4.js";
5
+ import {
6
+ activityMonitor
7
+ } from "./chunk-DAPBPCBP.js";
8
+ import {
9
+ getWebSearchConfigPath
10
+ } from "./chunk-VRB2IYGG.js";
11
+ import "./chunk-BRJX2PRC.js";
12
+
13
+ // packages/coding-agent/dist/builtin-extensions/pi-web-access/github-extract.js
14
+ import { existsSync, readFileSync, rmSync, statSync, readdirSync, openSync, readSync, closeSync, realpathSync } from "node:fs";
15
+ import { execFile as execFile2 } from "node:child_process";
16
+ import { extname, join, resolve as resolvePath, sep as pathSep } from "node:path";
17
+
18
+ // packages/coding-agent/dist/builtin-extensions/pi-web-access/github-api.js
19
+ import { execFile } from "node:child_process";
20
+ var MAX_TREE_ENTRIES = 200, MAX_INLINE_FILE_CHARS = 1e5, ghAvailable = null, ghHintShown = !1;
21
+ async function checkGhAvailable() {
22
+ return ghAvailable !== null ? ghAvailable : new Promise((resolve) => {
23
+ execFile("gh", ["--version"], { timeout: 5e3 }, (err) => {
24
+ ghAvailable = !err, resolve(ghAvailable);
25
+ });
26
+ });
27
+ }
28
+ function showGhHint() {
29
+ ghHintShown || (ghHintShown = !0, console.error("[pi-web-access] Install `gh` CLI for better GitHub repo access including private repos."));
30
+ }
31
+ async function checkRepoSize(owner, repo) {
32
+ return await checkGhAvailable() ? new Promise((resolve) => {
33
+ execFile("gh", ["api", `repos/${owner}/${repo}`, "--jq", ".size"], { timeout: 1e4 }, (err, stdout) => {
34
+ if (err) {
35
+ resolve(null);
36
+ return;
37
+ }
38
+ let kb = parseInt(stdout.trim(), 10);
39
+ resolve(Number.isNaN(kb) ? null : kb);
40
+ });
41
+ }) : null;
42
+ }
43
+ async function getDefaultBranch(owner, repo) {
44
+ return await checkGhAvailable() ? new Promise((resolve) => {
45
+ execFile("gh", ["api", `repos/${owner}/${repo}`, "--jq", ".default_branch"], { timeout: 1e4 }, (err, stdout) => {
46
+ if (err) {
47
+ resolve(null);
48
+ return;
49
+ }
50
+ let branch = stdout.trim();
51
+ resolve(branch || null);
52
+ });
53
+ }) : null;
54
+ }
55
+ async function fetchTreeViaApi(owner, repo, ref) {
56
+ return await checkGhAvailable() ? new Promise((resolve) => {
57
+ execFile("gh", ["api", `repos/${owner}/${repo}/git/trees/${ref}?recursive=1`, "--jq", ".tree[].path"], { timeout: 15e3, maxBuffer: 5 * 1024 * 1024 }, (err, stdout) => {
58
+ if (err) {
59
+ resolve(null);
60
+ return;
61
+ }
62
+ let paths = stdout.trim().split(`
63
+ `).filter(Boolean);
64
+ if (paths.length === 0) {
65
+ resolve(null);
66
+ return;
67
+ }
68
+ let truncated = paths.length > MAX_TREE_ENTRIES, display = paths.slice(0, MAX_TREE_ENTRIES).join(`
69
+ `);
70
+ resolve(truncated ? display + `
71
+ ... (${paths.length} total entries)` : display);
72
+ });
73
+ }) : null;
74
+ }
75
+ async function fetchReadmeViaApi(owner, repo, ref) {
76
+ return await checkGhAvailable() ? new Promise((resolve) => {
77
+ execFile("gh", ["api", `repos/${owner}/${repo}/readme?ref=${ref}`, "--jq", ".content"], { timeout: 1e4 }, (err, stdout) => {
78
+ if (err) {
79
+ resolve(null);
80
+ return;
81
+ }
82
+ try {
83
+ let decoded = Buffer.from(stdout.trim(), "base64").toString("utf-8");
84
+ resolve(decoded.length > 8192 ? decoded.slice(0, 8192) + `
85
+
86
+ [README truncated at 8K chars]` : decoded);
87
+ } catch {
88
+ resolve(null);
89
+ }
90
+ });
91
+ }) : null;
92
+ }
93
+ async function fetchFileViaApi(owner, repo, path, ref) {
94
+ return await checkGhAvailable() ? new Promise((resolve) => {
95
+ execFile("gh", ["api", `repos/${owner}/${repo}/contents/${path}?ref=${ref}`, "--jq", ".content"], { timeout: 1e4, maxBuffer: 2 * 1024 * 1024 }, (err, stdout) => {
96
+ if (err) {
97
+ resolve(null);
98
+ return;
99
+ }
100
+ try {
101
+ resolve(Buffer.from(stdout.trim(), "base64").toString("utf-8"));
102
+ } catch {
103
+ resolve(null);
104
+ }
105
+ });
106
+ }) : null;
107
+ }
108
+ async function fetchViaApi(url, owner, repo, info, sizeNote) {
109
+ let ref = info.ref || await getDefaultBranch(owner, repo);
110
+ if (!ref)
111
+ return null;
112
+ let lines = [];
113
+ if (sizeNote && (lines.push(sizeNote), lines.push("")), info.type === "blob" && info.path) {
114
+ let content = await fetchFileViaApi(owner, repo, info.path, ref);
115
+ return content ? (lines.push(`## ${info.path}`), content.length > MAX_INLINE_FILE_CHARS ? (lines.push(content.slice(0, MAX_INLINE_FILE_CHARS)), lines.push(`
116
+ [File truncated at 100K chars]`)) : lines.push(content), {
117
+ url,
118
+ title: `${owner}/${repo} - ${info.path}`,
119
+ content: lines.join(`
120
+ `),
121
+ error: null
122
+ }) : null;
123
+ }
124
+ let [tree, readme] = await Promise.all([
125
+ fetchTreeViaApi(owner, repo, ref),
126
+ fetchReadmeViaApi(owner, repo, ref)
127
+ ]);
128
+ if (!tree && !readme)
129
+ return null;
130
+ tree && (lines.push("## Structure"), lines.push(tree), lines.push("")), readme && (lines.push("## README.md"), lines.push(readme), lines.push("")), lines.push("This is an API-only view. Clone the repo or use `read`/`bash` for deeper exploration.");
131
+ let title = info.path ? `${owner}/${repo} - ${info.path}` : `${owner}/${repo}`;
132
+ return {
133
+ url,
134
+ title,
135
+ content: lines.join(`
136
+ `),
137
+ error: null
138
+ };
139
+ }
140
+
141
+ // packages/coding-agent/dist/builtin-extensions/pi-web-access/github-extract.js
142
+ var CONFIG_PATH = getWebSearchConfigPath(), BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
143
+ ".png",
144
+ ".jpg",
145
+ ".jpeg",
146
+ ".gif",
147
+ ".bmp",
148
+ ".ico",
149
+ ".webp",
150
+ ".svg",
151
+ ".tiff",
152
+ ".tif",
153
+ ".mp3",
154
+ ".mp4",
155
+ ".avi",
156
+ ".mov",
157
+ ".mkv",
158
+ ".flv",
159
+ ".wmv",
160
+ ".wav",
161
+ ".ogg",
162
+ ".webm",
163
+ ".flac",
164
+ ".aac",
165
+ ".zip",
166
+ ".tar",
167
+ ".gz",
168
+ ".bz2",
169
+ ".xz",
170
+ ".7z",
171
+ ".rar",
172
+ ".zst",
173
+ ".exe",
174
+ ".dll",
175
+ ".so",
176
+ ".dylib",
177
+ ".bin",
178
+ ".o",
179
+ ".a",
180
+ ".lib",
181
+ ".woff",
182
+ ".woff2",
183
+ ".ttf",
184
+ ".otf",
185
+ ".eot",
186
+ ".pdf",
187
+ ".doc",
188
+ ".docx",
189
+ ".xls",
190
+ ".xlsx",
191
+ ".ppt",
192
+ ".pptx",
193
+ ".sqlite",
194
+ ".db",
195
+ ".sqlite3",
196
+ ".pyc",
197
+ ".pyo",
198
+ ".class",
199
+ ".jar",
200
+ ".war",
201
+ ".iso",
202
+ ".img",
203
+ ".dmg"
204
+ ]), NOISE_DIRS = /* @__PURE__ */ new Set([
205
+ "node_modules",
206
+ "vendor",
207
+ ".next",
208
+ "dist",
209
+ "build",
210
+ "__pycache__",
211
+ ".venv",
212
+ "venv",
213
+ ".tox",
214
+ ".mypy_cache",
215
+ ".pytest_cache",
216
+ "target",
217
+ ".gradle",
218
+ ".idea",
219
+ ".vscode"
220
+ ]), MAX_INLINE_FILE_CHARS2 = 1e5, MAX_TREE_ENTRIES2 = 200, cloneCache = /* @__PURE__ */ new Map(), cachedConfig = null;
221
+ function normalizeEnabled(value, fallback) {
222
+ return typeof value == "boolean" ? value : fallback;
223
+ }
224
+ function normalizePositiveNumber(value, fallback) {
225
+ return typeof value != "number" || !Number.isFinite(value) ? fallback : value > 0 ? value : fallback;
226
+ }
227
+ function normalizeClonePath(value, fallback) {
228
+ if (typeof value != "string")
229
+ return fallback;
230
+ let normalized = value.trim();
231
+ return normalized.length > 0 ? normalized : fallback;
232
+ }
233
+ function loadGitHubConfig() {
234
+ if (cachedConfig)
235
+ return cachedConfig;
236
+ let defaults = {
237
+ enabled: !0,
238
+ maxRepoSizeMB: 350,
239
+ cloneTimeoutSeconds: 30,
240
+ clonePath: "/tmp/pi-github-repos"
241
+ };
242
+ if (!existsSync(CONFIG_PATH))
243
+ return cachedConfig = defaults, cachedConfig;
244
+ let rawText = readFileSync(CONFIG_PATH, "utf-8"), raw;
245
+ try {
246
+ raw = JSON.parse(rawText);
247
+ } catch (err) {
248
+ let message = err instanceof Error ? err.message : String(err);
249
+ throw new Error(`Failed to parse ${CONFIG_PATH}: ${message}`);
250
+ }
251
+ let gc = raw.githubClone ?? {};
252
+ return cachedConfig = {
253
+ enabled: normalizeEnabled(gc.enabled, defaults.enabled),
254
+ maxRepoSizeMB: normalizePositiveNumber(gc.maxRepoSizeMB, defaults.maxRepoSizeMB),
255
+ cloneTimeoutSeconds: normalizePositiveNumber(gc.cloneTimeoutSeconds, defaults.cloneTimeoutSeconds),
256
+ clonePath: normalizeClonePath(gc.clonePath, defaults.clonePath)
257
+ }, cachedConfig;
258
+ }
259
+ var NON_CODE_SEGMENTS = /* @__PURE__ */ new Set([
260
+ "issues",
261
+ "pull",
262
+ "pulls",
263
+ "discussions",
264
+ "releases",
265
+ "wiki",
266
+ "actions",
267
+ "settings",
268
+ "security",
269
+ "projects",
270
+ "graphs",
271
+ "compare",
272
+ "commits",
273
+ "tags",
274
+ "branches",
275
+ "stargazers",
276
+ "watchers",
277
+ "network",
278
+ "forks",
279
+ "milestone",
280
+ "labels",
281
+ "packages",
282
+ "codespaces",
283
+ "contribute",
284
+ "community",
285
+ "sponsors",
286
+ "invitations",
287
+ "notifications",
288
+ "insights"
289
+ ]);
290
+ function parseGitHubUrl(url) {
291
+ let parsed;
292
+ try {
293
+ parsed = new URL(url);
294
+ } catch {
295
+ return null;
296
+ }
297
+ let host = parsed.hostname.toLowerCase();
298
+ if (host !== "github.com" && host !== "www.github.com")
299
+ return null;
300
+ let segments = parsed.pathname.split("/").filter(Boolean).map((segment) => {
301
+ try {
302
+ return decodeURIComponent(segment);
303
+ } catch {
304
+ return segment;
305
+ }
306
+ });
307
+ if (segments.length < 2)
308
+ return null;
309
+ let owner = segments[0], repo = segments[1].replace(/\.git$/, "");
310
+ if (NON_CODE_SEGMENTS.has(segments[2]?.toLowerCase()))
311
+ return null;
312
+ if (segments.length === 2)
313
+ return { owner, repo, refIsFullSha: !1, type: "root" };
314
+ let action = segments[2];
315
+ if (action !== "blob" && action !== "tree" || segments.length < 4)
316
+ return null;
317
+ let ref = segments[3], refIsFullSha = /^[0-9a-f]{40}$/.test(ref), pathParts = segments.slice(4), path = pathParts.length > 0 ? pathParts.join("/") : "";
318
+ return {
319
+ owner,
320
+ repo,
321
+ ref,
322
+ refIsFullSha,
323
+ path,
324
+ type: action
325
+ };
326
+ }
327
+ function cacheKey(owner, repo, ref) {
328
+ return ref ? `${owner}/${repo}@${ref}` : `${owner}/${repo}`;
329
+ }
330
+ function cloneDir(config, owner, repo, ref) {
331
+ let dirName = ref ? `${repo}@${ref}` : repo;
332
+ return join(config.clonePath, owner, dirName);
333
+ }
334
+ function execClone(args, localPath, timeoutMs, signal) {
335
+ return new Promise((resolve) => {
336
+ let child = execFile2(args[0], args.slice(1), { timeout: timeoutMs }, (err) => {
337
+ if (err) {
338
+ try {
339
+ rmSync(localPath, { recursive: !0, force: !0 });
340
+ } catch {
341
+ }
342
+ resolve(null);
343
+ return;
344
+ }
345
+ resolve(localPath);
346
+ });
347
+ if (signal) {
348
+ let onAbort = () => child.kill();
349
+ signal.addEventListener("abort", onAbort, { once: !0 }), child.on("exit", () => signal.removeEventListener("abort", onAbort));
350
+ }
351
+ });
352
+ }
353
+ async function cloneRepo(owner, repo, ref, config, signal) {
354
+ let localPath = cloneDir(config, owner, repo, ref);
355
+ try {
356
+ rmSync(localPath, { recursive: !0, force: !0 });
357
+ } catch {
358
+ }
359
+ let timeoutMs = config.cloneTimeoutSeconds * 1e3;
360
+ if (await checkGhAvailable()) {
361
+ let args2 = ["gh", "repo", "clone", `${owner}/${repo}`, localPath, "--", "--depth", "1", "--single-branch"];
362
+ return ref && args2.push("--branch", ref), execClone(args2, localPath, timeoutMs, signal);
363
+ }
364
+ showGhHint();
365
+ let gitUrl = `https://github.com/${owner}/${repo}.git`, args = ["git", "clone", "--depth", "1", "--single-branch"];
366
+ return ref && args.push("--branch", ref), args.push(gitUrl, localPath), execClone(args, localPath, timeoutMs, signal);
367
+ }
368
+ function isBinaryFile(filePath) {
369
+ let ext = extname(filePath).toLowerCase();
370
+ if (BINARY_EXTENSIONS.has(ext))
371
+ return !0;
372
+ let fd;
373
+ try {
374
+ fd = openSync(filePath, "r");
375
+ } catch {
376
+ return !1;
377
+ }
378
+ try {
379
+ let buf = Buffer.alloc(512), bytesRead = readSync(fd, buf, 0, 512, 0);
380
+ for (let i = 0; i < bytesRead; i++)
381
+ if (buf[i] === 0)
382
+ return !0;
383
+ } catch {
384
+ return !1;
385
+ } finally {
386
+ closeSync(fd);
387
+ }
388
+ return !1;
389
+ }
390
+ function formatFileSize(bytes) {
391
+ return bytes < 1024 ? `${bytes} B` : bytes < 1024 * 1024 ? `${(bytes / 1024).toFixed(1)} KB` : `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
392
+ }
393
+ function resolveWithinRepo(rootPath, relativePath) {
394
+ let normalizedRoot = resolvePath(rootPath), candidate = resolvePath(normalizedRoot, relativePath);
395
+ if (candidate !== normalizedRoot) {
396
+ let rootPrefix = normalizedRoot.endsWith(pathSep) ? normalizedRoot : normalizedRoot + pathSep;
397
+ if (!candidate.startsWith(rootPrefix))
398
+ return null;
399
+ }
400
+ if (!existsSync(candidate))
401
+ return candidate;
402
+ try {
403
+ let realRoot = realpathSync(normalizedRoot), realCandidate = realpathSync(candidate);
404
+ if (realCandidate === realRoot)
405
+ return candidate;
406
+ let realRootPrefix = realRoot.endsWith(pathSep) ? realRoot : realRoot + pathSep;
407
+ return realCandidate.startsWith(realRootPrefix) ? candidate : null;
408
+ } catch {
409
+ return null;
410
+ }
411
+ }
412
+ function readTextFile(path) {
413
+ try {
414
+ return readFileSync(path, "utf-8");
415
+ } catch {
416
+ return null;
417
+ }
418
+ }
419
+ function buildTree(rootPath) {
420
+ let entries = [];
421
+ function walk(dir, relPath) {
422
+ if (entries.length >= MAX_TREE_ENTRIES2)
423
+ return;
424
+ let items;
425
+ try {
426
+ items = readdirSync(dir).sort();
427
+ } catch {
428
+ return;
429
+ }
430
+ for (let item of items) {
431
+ if (entries.length >= MAX_TREE_ENTRIES2)
432
+ return;
433
+ if (item === ".git")
434
+ continue;
435
+ let rel = relPath ? `${relPath}/${item}` : item, safePath = resolveWithinRepo(rootPath, rel);
436
+ if (!safePath) {
437
+ entries.push(`${rel} [outside repo skipped]`);
438
+ continue;
439
+ }
440
+ let stat;
441
+ try {
442
+ stat = statSync(safePath);
443
+ } catch {
444
+ continue;
445
+ }
446
+ if (stat.isDirectory()) {
447
+ if (NOISE_DIRS.has(item)) {
448
+ entries.push(`${rel}/ [skipped]`);
449
+ continue;
450
+ }
451
+ entries.push(`${rel}/`), walk(safePath, rel);
452
+ } else
453
+ entries.push(rel);
454
+ }
455
+ }
456
+ return walk(rootPath, ""), entries.length >= MAX_TREE_ENTRIES2 && entries.push(`... (truncated at ${MAX_TREE_ENTRIES2} entries)`), entries.join(`
457
+ `);
458
+ }
459
+ function buildDirListing(rootPath, subPath) {
460
+ let targetPath = resolveWithinRepo(rootPath, subPath);
461
+ if (!targetPath)
462
+ return "(path escapes repository root)";
463
+ let lines = [], items;
464
+ try {
465
+ items = readdirSync(targetPath).sort();
466
+ } catch {
467
+ return "(directory not readable)";
468
+ }
469
+ for (let item of items) {
470
+ if (item === ".git")
471
+ continue;
472
+ let rel = subPath ? `${subPath}/${item}` : item, safePath = resolveWithinRepo(rootPath, rel);
473
+ if (!safePath) {
474
+ lines.push(` ${item} (outside repo)`);
475
+ continue;
476
+ }
477
+ try {
478
+ let stat = statSync(safePath);
479
+ stat.isDirectory() ? lines.push(` ${item}/`) : lines.push(` ${item} (${formatFileSize(stat.size)})`);
480
+ } catch {
481
+ lines.push(` ${item} (unreadable)`);
482
+ }
483
+ }
484
+ return lines.join(`
485
+ `);
486
+ }
487
+ function readReadme(localPath) {
488
+ let candidates = ["README.md", "readme.md", "README", "README.txt", "README.rst"];
489
+ for (let name of candidates) {
490
+ let readmePath = join(localPath, name);
491
+ if (existsSync(readmePath))
492
+ try {
493
+ let content = readFileSync(readmePath, "utf-8");
494
+ return content.length > 8192 ? content.slice(0, 8192) + `
495
+
496
+ [README truncated at 8K chars]` : content;
497
+ } catch {
498
+ continue;
499
+ }
500
+ }
501
+ return null;
502
+ }
503
+ function generateContent(localPath, info) {
504
+ let lines = [];
505
+ if (lines.push(`Repository cloned to: ${localPath}`), lines.push(""), info.type === "root") {
506
+ lines.push("## Structure"), lines.push(buildTree(localPath)), lines.push("");
507
+ let readme = readReadme(localPath);
508
+ return readme && (lines.push("## README.md"), lines.push(readme), lines.push("")), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
509
+ `);
510
+ }
511
+ if (info.type === "tree") {
512
+ let dirPath = info.path || "", fullDirPath = resolveWithinRepo(localPath, dirPath);
513
+ return !fullDirPath || !existsSync(fullDirPath) ? (lines.push(`Path \`${dirPath}\` not found in clone. Showing repository root instead.`), lines.push(""), lines.push("## Structure"), lines.push(buildTree(localPath))) : (lines.push(`## ${dirPath || "/"}`), lines.push(buildDirListing(localPath, dirPath))), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
514
+ `);
515
+ }
516
+ if (info.type === "blob") {
517
+ let filePath = info.path || "", fullFilePath = resolveWithinRepo(localPath, filePath);
518
+ if (!fullFilePath || !existsSync(fullFilePath))
519
+ return lines.push(`Path \`${filePath}\` not found in clone. Showing repository root instead.`), lines.push(""), lines.push("## Structure"), lines.push(buildTree(localPath)), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
520
+ `);
521
+ let stat;
522
+ try {
523
+ stat = statSync(fullFilePath);
524
+ } catch (err) {
525
+ let message = err instanceof Error ? err.message : String(err);
526
+ return lines.push(`Could not inspect \`${filePath}\`: ${message}`), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
527
+ `);
528
+ }
529
+ if (stat.isDirectory())
530
+ return lines.push(`## ${filePath || "/"}`), lines.push(buildDirListing(localPath, filePath)), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
531
+ `);
532
+ if (isBinaryFile(fullFilePath)) {
533
+ let ext = extname(filePath).replace(".", "");
534
+ return lines.push(`## ${filePath}`), lines.push(`Binary file (${ext}, ${formatFileSize(stat.size)}). Use \`read\` or \`bash\` tools at the path above to inspect.`), lines.join(`
535
+ `);
536
+ }
537
+ let content = readTextFile(fullFilePath);
538
+ return content === null ? (lines.push(`Could not read \`${filePath}\` as UTF-8 text.`), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
539
+ `)) : (lines.push(`## ${filePath}`), content.length > MAX_INLINE_FILE_CHARS2 ? (lines.push(content.slice(0, MAX_INLINE_FILE_CHARS2)), lines.push(""), lines.push(`[File truncated at 100K chars. Full file: ${fullFilePath}]`)) : lines.push(content), lines.push(""), lines.push("Use `read` and `bash` tools at the path above to explore further."), lines.join(`
540
+ `));
541
+ }
542
+ return lines.join(`
543
+ `);
544
+ }
545
+ async function awaitCachedClone(cached, url, owner, repo, info, signal) {
546
+ if (signal?.aborted)
547
+ return null;
548
+ let result = await cached.clonePromise;
549
+ if (signal?.aborted)
550
+ return null;
551
+ if (result) {
552
+ let content = generateContent(result, info), title = info.path ? `${owner}/${repo} - ${info.path}` : `${owner}/${repo}`;
553
+ return { url, title, content, error: null };
554
+ }
555
+ return fetchViaApi(url, owner, repo, info);
556
+ }
557
+ async function extractGitHub(url, signal, forceClone) {
558
+ let info = parseGitHubUrl(url);
559
+ if (!info || signal?.aborted)
560
+ return null;
561
+ let config = loadGitHubConfig();
562
+ if (!config.enabled)
563
+ return null;
564
+ let { owner, repo } = info, key = cacheKey(owner, repo, info.ref), cached = cloneCache.get(key);
565
+ if (cached)
566
+ return awaitCachedClone(cached, url, owner, repo, info, signal);
567
+ if (info.refIsFullSha)
568
+ return signal?.aborted ? null : fetchViaApi(url, owner, repo, info, "Note: Commit SHA URLs use the GitHub API instead of cloning.");
569
+ let activityId = activityMonitor.logStart({ type: "fetch", url: `github.com/${owner}/${repo}` });
570
+ if (!forceClone) {
571
+ let sizeKB = await checkRepoSize(owner, repo);
572
+ if (signal?.aborted)
573
+ return activityMonitor.logComplete(activityId, 0), null;
574
+ if (sizeKB !== null) {
575
+ let sizeMB = sizeKB / 1024;
576
+ if (sizeMB > config.maxRepoSizeMB) {
577
+ if (signal?.aborted)
578
+ return activityMonitor.logComplete(activityId, 0), null;
579
+ let sizeNote = `Note: Repository is ${Math.round(sizeMB)}MB (threshold: ${config.maxRepoSizeMB}MB). Showing API-fetched content instead of full clone. Ask the user if they'd like to clone the full repo -- if yes, call fetch_content again with the same URL and add forceClone: true to the params.`, apiView = await fetchViaApi(url, owner, repo, info, sizeNote);
580
+ return apiView ? (activityMonitor.logComplete(activityId, 200), apiView) : (activityMonitor.logError(activityId, "api fallback unavailable for oversized repository"), null);
581
+ }
582
+ }
583
+ }
584
+ if (signal?.aborted)
585
+ return activityMonitor.logComplete(activityId, 0), null;
586
+ let cachedAfterSizeCheck = cloneCache.get(key);
587
+ if (cachedAfterSizeCheck) {
588
+ let cachedResult = await awaitCachedClone(cachedAfterSizeCheck, url, owner, repo, info, signal);
589
+ return signal?.aborted ? activityMonitor.logComplete(activityId, 0) : cachedResult ? activityMonitor.logComplete(activityId, 200) : activityMonitor.logError(activityId, "clone failed"), cachedResult;
590
+ }
591
+ let clonePromise = cloneRepo(owner, repo, info.ref, config, signal), localPath = cloneDir(config, owner, repo, info.ref);
592
+ cloneCache.set(key, { localPath, clonePromise });
593
+ let result = await clonePromise;
594
+ if (signal?.aborted)
595
+ return result || cloneCache.delete(key), activityMonitor.logComplete(activityId, 0), null;
596
+ if (!result) {
597
+ if (cloneCache.delete(key), signal?.aborted)
598
+ return activityMonitor.logComplete(activityId, 0), null;
599
+ let apiFallback = await fetchViaApi(url, owner, repo, info);
600
+ return apiFallback ? (activityMonitor.logComplete(activityId, 200), apiFallback) : (activityMonitor.logError(activityId, "clone and API fallback failed"), null);
601
+ }
602
+ activityMonitor.logComplete(activityId, 200);
603
+ let content = generateContent(result, info), title = info.path ? `${owner}/${repo} - ${info.path}` : `${owner}/${repo}`;
604
+ return { url, title, content, error: null };
605
+ }
606
+ function clearCloneCache() {
607
+ for (let entry of cloneCache.values())
608
+ try {
609
+ rmSync(entry.localPath, { recursive: !0, force: !0 });
610
+ } catch {
611
+ }
612
+ cloneCache.clear(), cachedConfig = null;
613
+ }
614
+ registerSessionCleanup(clearCloneCache);
615
+ export {
616
+ clearCloneCache,
617
+ extractGitHub,
618
+ parseGitHubUrl
619
+ };