@ashx-j/lunr-dev 0.2.13-dev.7.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.
- package/CHANGELOG.md +29 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +14 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +37 -3
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts +1 -15
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +7 -21
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.d.ts.map +1 -1
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js +6 -2
- package/dist/builtin-extensions/narumiruna-pi-goal/src/goal.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts +4 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +163 -169
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +46 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +109 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts +7 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js +211 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tool-executor.js.map +1 -0
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts +0 -5
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +0 -202
- package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +251 -94
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts +4 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/init.js +10 -3
- package/dist/builtin-extensions/pi-mcp-adapter/init.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/metadata-cache.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js +2 -1
- package/dist/builtin-extensions/pi-prompt-template-model/prompt-loader.js.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js +1 -1
- package/dist/builtin-extensions/pi-prompt-template-model/tool-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +38 -14
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/fork-context.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/watchdog/review.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/extract.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/extract.js +105 -54
- package/dist/builtin-extensions/pi-web-access/extract.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/gemini-search.js +82 -65
- package/dist/builtin-extensions/pi-web-access/gemini-search.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/github-extract.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/github-extract.js +2 -0
- package/dist/builtin-extensions/pi-web-access/github-extract.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +167 -77
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/lazy.d.ts +18 -0
- package/dist/builtin-extensions/pi-web-access/lazy.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/lazy.js +19 -0
- package/dist/builtin-extensions/pi-web-access/lazy.js.map +1 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts +6 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js +17 -0
- package/dist/builtin-extensions/pi-web-access/session-cleanup.js.map +1 -0
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/amazon-bedrock.json +1 -1
- package/dist/catalog/providers/azure-openai-responses.json +1 -1
- package/dist/catalog/providers/fireworks.json +1 -1
- package/dist/catalog/providers/github-copilot.json +1 -1
- package/dist/catalog/providers/openai-codex.json +1 -1
- package/dist/catalog/providers/openai.json +1 -1
- package/dist/catalog/providers/opencode.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/publication.json +131 -3
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +1 -0
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli-runtime.d.ts +3 -0
- package/dist/cli-runtime.d.ts.map +1 -0
- package/dist/cli-runtime.js +73 -0
- package/dist/cli-runtime.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -53
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -12
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/catalog-cache-scope.d.ts +3 -0
- package/dist/core/catalog-cache-scope.d.ts.map +1 -0
- package/dist/core/catalog-cache-scope.js +12 -0
- package/dist/core/catalog-cache-scope.js.map +1 -0
- package/dist/core/catalog-merge.d.ts +2 -0
- package/dist/core/catalog-merge.d.ts.map +1 -1
- package/dist/core/catalog-merge.js +29 -2
- package/dist/core/catalog-merge.js.map +1 -1
- package/dist/core/catalog-refresh-polling.d.ts +8 -0
- package/dist/core/catalog-refresh-polling.d.ts.map +1 -0
- package/dist/core/catalog-refresh-polling.js +30 -0
- package/dist/core/catalog-refresh-polling.js.map +1 -0
- package/dist/core/codex-catalog.d.ts +3 -0
- package/dist/core/codex-catalog.d.ts.map +1 -0
- package/dist/core/codex-catalog.js +15 -0
- package/dist/core/codex-catalog.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +10 -5
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/host-static.d.ts.map +1 -1
- package/dist/core/extensions/host-static.js +34 -12
- package/dist/core/extensions/host-static.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -2
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +10 -64
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +2 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/live-catalog.d.ts +5 -2
- package/dist/core/live-catalog.d.ts.map +1 -1
- package/dist/core/live-catalog.js +108 -27
- package/dist/core/live-catalog.js.map +1 -1
- package/dist/core/model-runtime.d.ts +8 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +64 -12
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/official-catalog.d.ts +4 -0
- package/dist/core/official-catalog.d.ts.map +1 -1
- package/dist/core/official-catalog.js +86 -21
- package/dist/core/official-catalog.js.map +1 -1
- package/dist/core/permissions.d.ts +0 -2
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +10 -18
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/timings.d.ts +2 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +17 -2
- package/dist/core/timings.js.map +1 -1
- package/dist/gateway/commands.d.ts +1 -1
- package/dist/gateway/commands.d.ts.map +1 -1
- package/dist/gateway/commands.js +1 -18
- package/dist/gateway/commands.js.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +66 -48
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +4 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -22
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +141 -207
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +95 -84
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/node-runtime/agent-session-services-IFJMSX7Z.js +36 -0
- package/dist/node-runtime/benchmark-request-UC7PD3V3.js +57 -0
- package/dist/node-runtime/brave-UWDA3I22.js +143 -0
- package/dist/node-runtime/builtin-extensions-LYZ3BFWQ.js +28 -0
- package/dist/node-runtime/chunk-2QKLKMKC.js +173 -0
- package/dist/node-runtime/chunk-3GHXVUAK.js +21 -0
- package/dist/node-runtime/chunk-3RCWXWAY.js +466 -0
- package/dist/node-runtime/chunk-3WFAEVKS.js +115 -0
- package/dist/node-runtime/chunk-3X3KZKMI.js +49 -0
- package/dist/node-runtime/chunk-4HXHDDCF.js +16 -0
- package/dist/node-runtime/chunk-4TLO4PO2.js +3427 -0
- package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
- package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
- package/dist/node-runtime/chunk-5P7PZMRU.js +610 -0
- package/dist/node-runtime/chunk-7N3YHTYF.js +26 -0
- package/dist/node-runtime/chunk-7NBZ5P7I.js +24 -0
- package/dist/node-runtime/chunk-A2KQXUJD.js +105 -0
- package/dist/node-runtime/chunk-AD6VXAO7.js +342 -0
- package/dist/node-runtime/chunk-AHSTJBIB.js +64 -0
- package/dist/node-runtime/chunk-AJX357CL.js +20211 -0
- package/dist/node-runtime/chunk-ARC4KOTI.js +11178 -0
- package/dist/node-runtime/chunk-AUXVGBO4.js +19 -0
- package/dist/node-runtime/chunk-AY6CAJSL.js +30 -0
- package/dist/node-runtime/chunk-BHO7O6E5.js +296 -0
- package/dist/node-runtime/chunk-BI3DHYCN.js +8845 -0
- package/dist/node-runtime/chunk-BR7YDUKA.js +109 -0
- package/dist/node-runtime/chunk-BRJX2PRC.js +53 -0
- package/dist/node-runtime/chunk-C4O2RSQQ.js +37 -0
- package/dist/node-runtime/chunk-CCZJ3PYY.js +17 -0
- package/dist/node-runtime/chunk-CDFZEWPU.js +8388 -0
- package/dist/node-runtime/chunk-CGBXPL3E.js +1171 -0
- package/dist/node-runtime/chunk-CJECDQKP.js +19 -0
- package/dist/node-runtime/chunk-DAPBPCBP.js +53 -0
- package/dist/node-runtime/chunk-DDGMHUOW.js +305 -0
- package/dist/node-runtime/chunk-DMMTJQMQ.js +43 -0
- package/dist/node-runtime/chunk-DVGWF6A2.js +1180 -0
- package/dist/node-runtime/chunk-ECD5L7YI.js +1369 -0
- package/dist/node-runtime/chunk-EDBJNRSM.js +46 -0
- package/dist/node-runtime/chunk-F4VQFJI2.js +1269 -0
- package/dist/node-runtime/chunk-FVDOXRUD.js +96 -0
- package/dist/node-runtime/chunk-GZQHMEWL.js +126 -0
- package/dist/node-runtime/chunk-H2EOZYMP.js +57 -0
- package/dist/node-runtime/chunk-HQCKFM2O.js +56 -0
- package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
- package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
- package/dist/node-runtime/chunk-IPA627GP.js +296 -0
- package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
- package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
- package/dist/node-runtime/chunk-LZAW4ZX3.js +633 -0
- package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
- package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
- package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
- package/dist/node-runtime/chunk-MKKH27PH.js +8956 -0
- package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -0
- package/dist/node-runtime/chunk-N77MY65L.js +966 -0
- package/dist/node-runtime/chunk-NUIFPZWX.js +209 -0
- package/dist/node-runtime/chunk-OBMWP3I5.js +68 -0
- package/dist/node-runtime/chunk-OR4L3IB2.js +42 -0
- package/dist/node-runtime/chunk-PBC2Y6GS.js +903 -0
- package/dist/node-runtime/chunk-PCGNAY2O.js +1324 -0
- package/dist/node-runtime/chunk-PCIGF2XK.js +250 -0
- package/dist/node-runtime/chunk-PGAJ5MO5.js +7558 -0
- package/dist/node-runtime/chunk-PL6JKXWI.js +3622 -0
- package/dist/node-runtime/chunk-PVCDKGR6.js +55 -0
- package/dist/node-runtime/chunk-Q4Q6D4IY.js +364 -0
- package/dist/node-runtime/chunk-Q5ZU2VRT.js +83 -0
- package/dist/node-runtime/chunk-QFWG2RVL.js +5477 -0
- package/dist/node-runtime/chunk-QH42CDX3.js +9451 -0
- package/dist/node-runtime/chunk-RQ2Q5IYR.js +72 -0
- package/dist/node-runtime/chunk-RQ5DNUNG.js +429 -0
- package/dist/node-runtime/chunk-RRIZE6QQ.js +17 -0
- package/dist/node-runtime/chunk-SN6G4OU6.js +4753 -0
- package/dist/node-runtime/chunk-SWSN6HAB.js +53 -0
- package/dist/node-runtime/chunk-TQNSPERU.js +949 -0
- package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
- package/dist/node-runtime/chunk-VSELYKWU.js +772 -0
- package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
- package/dist/node-runtime/chunk-WJVFOIB5.js +24921 -0
- package/dist/node-runtime/chunk-WOVTOV5P.js +5653 -0
- package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
- package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
- package/dist/node-runtime/chunk-YF63P5ZT.js +864 -0
- package/dist/node-runtime/chunk-YSKSB3BJ.js +295 -0
- package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
- package/dist/node-runtime/chunk-ZKMFUD3Q.js +2834 -0
- package/dist/node-runtime/cli-runtime.js +81 -0
- package/dist/node-runtime/clipboard-OZ63BBC6.js +12 -0
- package/dist/node-runtime/clipboard-image-7QR6GXVA.js +13 -0
- package/dist/node-runtime/command-L3LAHDIH.js +13 -0
- package/dist/node-runtime/commands-RL5YBW5I.js +291 -0
- package/dist/node-runtime/config-FMEOZSWE.js +77 -0
- package/dist/node-runtime/curator-server-XCM43VEF.js +3816 -0
- package/dist/node-runtime/customize-XEXL2DGQ.js +12 -0
- package/dist/node-runtime/direct-tool-executor-JVDXTO7A.js +188 -0
- package/dist/node-runtime/exa-LL64QZR2.js +329 -0
- package/dist/node-runtime/export-html-KR26FOUZ.js +150 -0
- package/dist/node-runtime/extension-input-RV5N6APL.js +14 -0
- package/dist/node-runtime/extension-selector-CPD5LWDD.js +14 -0
- package/dist/node-runtime/extract-XLQSJN4V.js +17 -0
- package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
- package/dist/node-runtime/gateway-X2TI5X7F.js +2484 -0
- package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
- package/dist/node-runtime/gemini-search-U7SUMPQA.js +330 -0
- package/dist/node-runtime/gemini-url-context-PXWCBQHK.js +103 -0
- package/dist/node-runtime/gemini-web-MM446SEH.js +14 -0
- package/dist/node-runtime/github-extract-F64RZOEA.js +619 -0
- package/dist/node-runtime/goal-CZQ7FFQJ.js +1831 -0
- package/dist/node-runtime/index.js +859 -0
- package/dist/node-runtime/init-NJV2T55N.js +28 -0
- package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
- package/dist/node-runtime/interactive-mode-KOM35YF2.js +56 -0
- package/dist/node-runtime/interactive-view-U6OILKF3.js +249 -0
- package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
- package/dist/node-runtime/lunr-cron-YJ5UHYRD.js +268 -0
- package/dist/node-runtime/main.js +54 -0
- package/dist/node-runtime/mcp-auth-flow-QIXHW6QN.js +32 -0
- package/dist/node-runtime/mcp-panel-IIGMXQGP.js +501 -0
- package/dist/node-runtime/mcp-setup-panel-FEK7663I.js +355 -0
- package/dist/node-runtime/memory-cap-3S4XRLNP.js +20 -0
- package/dist/node-runtime/model-tiers-NJLHUEGK.js +20 -0
- package/dist/node-runtime/openai-search-B3MSNCQA.js +288 -0
- package/dist/node-runtime/package-manager-cli-TZZHJCVI.js +749 -0
- package/dist/node-runtime/parallel-AI2MNSCU.js +265 -0
- package/dist/node-runtime/parser-manager-TQHWYDH7.js +152 -0
- package/dist/node-runtime/pdf-extract-IPE6H4HP.js +57 -0
- package/dist/node-runtime/perplexity-QVJW3I35.js +12 -0
- package/dist/node-runtime/pi-intercom-EEMBGQID.js +2215 -0
- package/dist/node-runtime/pi-mcp-adapter-QFB37AVN.js +422 -0
- package/dist/node-runtime/pi-ollama-cloud-4VZRMULP.js +1440 -0
- package/dist/node-runtime/pi-prompt-template-model-4QT4LLXF.js +3946 -0
- package/dist/node-runtime/pi-subagents-7XJ4H53P.js +6023 -0
- package/dist/node-runtime/pi-web-access-DPGAVKOA.js +1864 -0
- package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
- package/dist/node-runtime/proxy-modes-HEEFK4KC.js +685 -0
- package/dist/node-runtime/rpc-entry.js +62 -0
- package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
- package/dist/node-runtime/runtime-bridges-PPHNBFWL.js +14 -0
- package/dist/node-runtime/session-manager-MQNBYACL.js +35 -0
- package/dist/node-runtime/session-selector-5AZLJS6U.js +14 -0
- package/dist/node-runtime/settings-manager-5LF2VQWC.js +21 -0
- package/dist/node-runtime/src-Y7JSCK64.js +2407 -0
- package/dist/node-runtime/subagent-executor-5RNDEPIJ.js +8483 -0
- package/dist/node-runtime/summary-review-YSMXKITO.js +228 -0
- package/dist/node-runtime/tavily-WEZFVFP7.js +154 -0
- package/dist/node-runtime/timings-UAD5BEAS.js +16 -0
- package/dist/node-runtime/tool-renderer-MV5O452K.js +204 -0
- package/dist/node-runtime/update-cli-A253SZ7P.js +73 -0
- package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
- package/dist/node-runtime/video-extract-OYT5WKS5.js +304 -0
- package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
- package/dist/node-runtime/youtube-extract-TQYKGFGS.js +264 -0
- package/dist/startup/benchmark-request.d.ts +3 -0
- package/dist/startup/benchmark-request.d.ts.map +1 -0
- package/dist/startup/benchmark-request.js +65 -0
- package/dist/startup/benchmark-request.js.map +1 -0
- package/dist/startup/interactive-view.d.ts +55 -0
- package/dist/startup/interactive-view.d.ts.map +1 -0
- package/dist/startup/interactive-view.js +332 -0
- package/dist/startup/interactive-view.js.map +1 -0
- package/dist/startup/launch-routing.d.ts.map +1 -1
- package/dist/startup/launch-routing.js +9 -10
- package/dist/startup/launch-routing.js.map +1 -1
- package/dist/startup/startup-milestones.d.ts +1 -1
- package/dist/startup/startup-milestones.d.ts.map +1 -1
- package/dist/startup/startup-milestones.js +3 -2
- package/dist/startup/startup-milestones.js.map +1 -1
- package/dist/utils/await-with-abort.d.ts +2 -0
- package/dist/utils/await-with-abort.d.ts.map +1 -0
- package/dist/utils/await-with-abort.js +19 -0
- package/dist/utils/await-with-abort.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +10 -4
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/compaction.md +5 -3
- package/docs/development.md +5 -1
- package/docs/features.md +0 -1
- package/docs/interactive-startup.md +98 -0
- package/docs/model-catalog.md +29 -0
- package/docs/usage.md +0 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +20 -20
- package/dist/core/swarm.d.ts +0 -23
- package/dist/core/swarm.d.ts.map +0 -1
- package/dist/core/swarm.js +0 -45
- package/dist/core/swarm.js.map +0 -1
|
@@ -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-PCIGF2XK.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-dev: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
|
+
};
|