@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,1324 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
isPlanModeActive,
|
|
4
|
+
requestPlanApproval
|
|
5
|
+
} from "./chunk-LZAW4ZX3.js";
|
|
6
|
+
import {
|
|
7
|
+
typebox_exports
|
|
8
|
+
} from "./chunk-PL6JKXWI.js";
|
|
9
|
+
import {
|
|
10
|
+
ashxj_tui_default
|
|
11
|
+
} from "./chunk-JHYKXIMM.js";
|
|
12
|
+
import {
|
|
13
|
+
measureStartup
|
|
14
|
+
} from "./chunk-PVCDKGR6.js";
|
|
15
|
+
import {
|
|
16
|
+
keyText
|
|
17
|
+
} from "./chunk-C4O2RSQQ.js";
|
|
18
|
+
import {
|
|
19
|
+
getAgentDir
|
|
20
|
+
} from "./chunk-PCIGF2XK.js";
|
|
21
|
+
|
|
22
|
+
// packages/coding-agent/dist/builtin-extensions/simple-pi-memory.js
|
|
23
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
24
|
+
import { dirname, join } from "node:path";
|
|
25
|
+
function baseDir() {
|
|
26
|
+
return join(dirname(getAgentDir()), "simple-memory");
|
|
27
|
+
}
|
|
28
|
+
function memoryFile() {
|
|
29
|
+
return join(baseDir(), "memory.md");
|
|
30
|
+
}
|
|
31
|
+
function configFile() {
|
|
32
|
+
return join(baseDir(), "config.json");
|
|
33
|
+
}
|
|
34
|
+
var DEFAULT_CHAR_CAP = 5e3, MIN_CHAR_CAP = 1, MAX_CHAR_CAP = 3e4;
|
|
35
|
+
function getCapBridge() {
|
|
36
|
+
return globalThis[/* @__PURE__ */ Symbol.for("@lunr/memory-cap")];
|
|
37
|
+
}
|
|
38
|
+
function isMemoryEnabled() {
|
|
39
|
+
return getCapBridge()?.isEnabled() ?? !0;
|
|
40
|
+
}
|
|
41
|
+
function disabledResult() {
|
|
42
|
+
return { content: [{ type: "text", text: "Agent memory is disabled in /settings." }] };
|
|
43
|
+
}
|
|
44
|
+
function ensureDir() {
|
|
45
|
+
let dir = baseDir();
|
|
46
|
+
existsSync(dir) || mkdirSync(dir, { recursive: !0 });
|
|
47
|
+
}
|
|
48
|
+
function readMemory() {
|
|
49
|
+
let file = memoryFile();
|
|
50
|
+
return existsSync(file) ? readFileSync(file, "utf-8") : "";
|
|
51
|
+
}
|
|
52
|
+
function writeMemoryRaw(text2) {
|
|
53
|
+
ensureDir(), writeFileSync(memoryFile(), text2, "utf-8");
|
|
54
|
+
}
|
|
55
|
+
function memoryLines() {
|
|
56
|
+
let text2 = readMemory();
|
|
57
|
+
return text2.trim() ? text2.split(`
|
|
58
|
+
`).filter((l) => l.trim().length > 0) : [];
|
|
59
|
+
}
|
|
60
|
+
function clampCap(n) {
|
|
61
|
+
return Number.isFinite(n) ? (n = Math.trunc(n), n < MIN_CHAR_CAP ? MIN_CHAR_CAP : n > MAX_CHAR_CAP ? MAX_CHAR_CAP : n) : DEFAULT_CHAR_CAP;
|
|
62
|
+
}
|
|
63
|
+
function readCap() {
|
|
64
|
+
let bridge = getCapBridge();
|
|
65
|
+
if (bridge)
|
|
66
|
+
return clampCap(bridge.getCharCap());
|
|
67
|
+
let file = configFile();
|
|
68
|
+
if (!existsSync(file))
|
|
69
|
+
return DEFAULT_CHAR_CAP;
|
|
70
|
+
try {
|
|
71
|
+
let cfg = JSON.parse(readFileSync(file, "utf-8"));
|
|
72
|
+
if (typeof cfg.charCap == "number" && Number.isFinite(cfg.charCap))
|
|
73
|
+
return clampCap(cfg.charCap);
|
|
74
|
+
} catch {
|
|
75
|
+
}
|
|
76
|
+
return DEFAULT_CHAR_CAP;
|
|
77
|
+
}
|
|
78
|
+
function writeCap(cap) {
|
|
79
|
+
let bridge = getCapBridge();
|
|
80
|
+
if (bridge) {
|
|
81
|
+
bridge.setCharCap(clampCap(cap));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
ensureDir(), writeFileSync(configFile(), JSON.stringify({ charCap: cap }, null, 2), "utf-8");
|
|
85
|
+
}
|
|
86
|
+
function todayStamp() {
|
|
87
|
+
let d = /* @__PURE__ */ new Date(), p = (x) => String(x).padStart(2, "0");
|
|
88
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
|
|
89
|
+
}
|
|
90
|
+
function stripDate(line) {
|
|
91
|
+
return line.replace(/^\[\d{4}-\d{2}-\d{2}\]\s*/, "");
|
|
92
|
+
}
|
|
93
|
+
function simple_pi_memory_default(pi) {
|
|
94
|
+
pi.on("before_agent_start", async (event) => {
|
|
95
|
+
if (!isMemoryEnabled())
|
|
96
|
+
return;
|
|
97
|
+
let mem = readMemory();
|
|
98
|
+
if (!mem.trim())
|
|
99
|
+
return;
|
|
100
|
+
let block = `
|
|
101
|
+
|
|
102
|
+
## Memory (durable facts; apply these; change them only with the memory tools)
|
|
103
|
+
` + mem.trimEnd();
|
|
104
|
+
return { systemPrompt: event.systemPrompt + block };
|
|
105
|
+
}), pi.registerTool({
|
|
106
|
+
name: "memory_add",
|
|
107
|
+
label: "Memory Add",
|
|
108
|
+
description: [
|
|
109
|
+
"Add one durable fact about the user or their environment.",
|
|
110
|
+
"Store only established facts and stable preferences, never behavior instructions, task state, transcripts, guesses, or secrets.",
|
|
111
|
+
"Each memory is a single line; a [YYYY-MM-DD] date prefix is added automatically.",
|
|
112
|
+
"An optional #tag improves readability (e.g. #preference).",
|
|
113
|
+
"Refuses if the content already exists (exact match) or if the file is at the character cap."
|
|
114
|
+
].join(`
|
|
115
|
+
`),
|
|
116
|
+
parameters: typebox_exports.Object({
|
|
117
|
+
content: typebox_exports.String({
|
|
118
|
+
description: "The memory text (one line). You may include a #tag."
|
|
119
|
+
})
|
|
120
|
+
}),
|
|
121
|
+
async execute(_id, params) {
|
|
122
|
+
if (!isMemoryEnabled())
|
|
123
|
+
return disabledResult();
|
|
124
|
+
let content = String(params.content ?? "").replace(/[\r\n]+/g, " ").trim();
|
|
125
|
+
if (!content)
|
|
126
|
+
return { content: [{ type: "text", text: "memory_add: content is empty." }] };
|
|
127
|
+
let lines = memoryLines();
|
|
128
|
+
if (lines.some((l) => stripDate(l) === content))
|
|
129
|
+
return { content: [{ type: "text", text: "Already in memory (not added)." }] };
|
|
130
|
+
let cap = readCap(), newLine = `[${todayStamp()}] ${content}`, sep = lines.length > 0 ? `
|
|
131
|
+
` : "", prospective = lines.join(`
|
|
132
|
+
`) + sep + newLine + `
|
|
133
|
+
`;
|
|
134
|
+
return prospective.length > cap ? {
|
|
135
|
+
content: [
|
|
136
|
+
{
|
|
137
|
+
type: "text",
|
|
138
|
+
text: `Memory full: ${readMemory().length}/${cap} chars. Remove a memory first (memory_remove).`
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
} : (writeMemoryRaw(prospective), {
|
|
142
|
+
content: [
|
|
143
|
+
{ type: "text", text: `Added memory (${prospective.length}/${cap} chars): ${newLine}` }
|
|
144
|
+
]
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}), pi.registerTool({
|
|
148
|
+
name: "memory_remove",
|
|
149
|
+
label: "Memory Remove",
|
|
150
|
+
description: [
|
|
151
|
+
"Remove one memory by its exact line text, as shown by memory_load.",
|
|
152
|
+
"Deletes only an exact, full-line match (including the date prefix).",
|
|
153
|
+
"Returns 'not found' if no line matches exactly."
|
|
154
|
+
].join(`
|
|
155
|
+
`),
|
|
156
|
+
parameters: typebox_exports.Object({
|
|
157
|
+
line: typebox_exports.String({
|
|
158
|
+
description: "The exact memory line to remove (verbatim, including the date prefix)."
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
async execute(_id, params) {
|
|
162
|
+
if (!isMemoryEnabled())
|
|
163
|
+
return disabledResult();
|
|
164
|
+
let target = String(params.line ?? "").trim();
|
|
165
|
+
if (!target)
|
|
166
|
+
return { content: [{ type: "text", text: "memory_remove: line is empty." }] };
|
|
167
|
+
let lines = memoryLines(), remaining = lines.filter((l) => l !== target);
|
|
168
|
+
return remaining.length === lines.length ? { content: [{ type: "text", text: `Not found (no exact match): ${target}` }] } : (writeMemoryRaw(remaining.length > 0 ? remaining.join(`
|
|
169
|
+
`) + `
|
|
170
|
+
` : ""), { content: [{ type: "text", text: `Removed memory: ${target}` }] });
|
|
171
|
+
}
|
|
172
|
+
}), pi.registerTool({
|
|
173
|
+
name: "memory_load",
|
|
174
|
+
label: "Memory Load",
|
|
175
|
+
description: [
|
|
176
|
+
"Read the current memory file and show all memories with the size/cap.",
|
|
177
|
+
"Use this to inspect durable facts before adding, correcting, or removing one."
|
|
178
|
+
].join(`
|
|
179
|
+
`),
|
|
180
|
+
parameters: typebox_exports.Object({}),
|
|
181
|
+
async execute() {
|
|
182
|
+
if (!isMemoryEnabled())
|
|
183
|
+
return disabledResult();
|
|
184
|
+
let raw = readMemory(), cap = readCap();
|
|
185
|
+
return raw.trim() ? {
|
|
186
|
+
content: [
|
|
187
|
+
{ type: "text", text: `Memory (${raw.length}/${cap} chars):
|
|
188
|
+
${raw.trimEnd()}` }
|
|
189
|
+
]
|
|
190
|
+
} : { content: [{ type: "text", text: `Memory is empty (0/${cap} chars).` }] };
|
|
191
|
+
}
|
|
192
|
+
}), pi.registerCommand("memory-char-cap", {
|
|
193
|
+
description: "View or set the memory character cap (1..30000). Default 5000.",
|
|
194
|
+
handler(args, ctx) {
|
|
195
|
+
let trimmed = args.trim();
|
|
196
|
+
if (!trimmed) {
|
|
197
|
+
ctx.ui.notify(`Memory character cap: ${readCap()}`, "info");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
let n = Number(trimmed);
|
|
201
|
+
if (!Number.isFinite(n) || !Number.isInteger(n) || n < MIN_CHAR_CAP || n > MAX_CHAR_CAP) {
|
|
202
|
+
ctx.ui.notify(`Invalid cap. Must be an integer between ${MIN_CHAR_CAP} and ${MAX_CHAR_CAP}.`, "error");
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (n < readMemory().length) {
|
|
206
|
+
ctx.ui.notify(`Your memory file already exceeds this character cap: ${memoryFile()}`, "warning");
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
writeCap(n), ctx.ui.notify(`Memory character cap set to ${n}.`, "info");
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// packages/coding-agent/dist/builtin-extensions/pi-tps.js
|
|
215
|
+
var spinner = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"], spinnerIdx = 0, spinnerInterval = null, GREEN = "\x1B[32m", YELLOW = "\x1B[33m", RED = "\x1B[31m", RESET = "\x1B[0m";
|
|
216
|
+
function colorForTps(tps) {
|
|
217
|
+
return tps >= 100 ? GREEN : tps >= 30 ? YELLOW : RED;
|
|
218
|
+
}
|
|
219
|
+
function formatTokens(n) {
|
|
220
|
+
return n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : String(n);
|
|
221
|
+
}
|
|
222
|
+
function pi_tps_default(pi) {
|
|
223
|
+
let messageStartTime = 0, lastAvgTps = 0, lastOutputTokens = 0, isStreaming = !1;
|
|
224
|
+
pi.on("agent_start", async (_event, ctx) => {
|
|
225
|
+
lastAvgTps = 0, lastOutputTokens = 0, ctx.hasUI && ctx.ui.setStatus("tps", "");
|
|
226
|
+
}), pi.on("message_start", (event) => {
|
|
227
|
+
event.message.role === "assistant" && (messageStartTime = Date.now(), isStreaming = !0, spinnerIdx = 0, spinnerInterval && clearInterval(spinnerInterval), spinnerInterval = setInterval(() => {
|
|
228
|
+
spinnerIdx = (spinnerIdx + 1) % spinner.length;
|
|
229
|
+
}, 80));
|
|
230
|
+
}), pi.on("message_update", (event, ctx) => {
|
|
231
|
+
if (event.message.role !== "assistant" || !ctx.hasUI)
|
|
232
|
+
return;
|
|
233
|
+
let usage = event.message.usage;
|
|
234
|
+
if (!usage)
|
|
235
|
+
return;
|
|
236
|
+
let outputTokens = usage.output;
|
|
237
|
+
if (outputTokens === 0)
|
|
238
|
+
return;
|
|
239
|
+
let elapsed = (Date.now() - messageStartTime) / 1e3, tps = outputTokens / elapsed, color = colorForTps(tps), frame = spinner[spinnerIdx % spinner.length];
|
|
240
|
+
ctx.ui.setStatus("tps", `${color}${frame} ${tps.toFixed(1)} t/s${RESET} \u2193 ${formatTokens(outputTokens)} tokens`);
|
|
241
|
+
}), pi.on("message_end", (event, ctx) => {
|
|
242
|
+
if (event.message.role !== "assistant" || !ctx.hasUI)
|
|
243
|
+
return;
|
|
244
|
+
let elapsed = (Date.now() - messageStartTime) / 1e3, outputTokens = event.message.usage?.output ?? 0;
|
|
245
|
+
elapsed > 0 && outputTokens > 0 && (lastAvgTps = outputTokens / elapsed, lastOutputTokens = outputTokens), isStreaming = !1, spinnerInterval && (clearInterval(spinnerInterval), spinnerInterval = null), setImmediate(() => {
|
|
246
|
+
let color = colorForTps(lastAvgTps);
|
|
247
|
+
ctx.ui.setStatus("tps", `${color}\u2713 ${lastAvgTps.toFixed(1)} t/s \xB7 ${formatTokens(lastOutputTokens)} tokens in ${elapsed.toFixed(1)}s${RESET}`);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// node_modules/unicode-animations/dist/chunk-F2BWZODB.js
|
|
253
|
+
var BRAILLE_DOT_MAP = [
|
|
254
|
+
[1, 8],
|
|
255
|
+
// row 0
|
|
256
|
+
[2, 16],
|
|
257
|
+
// row 1
|
|
258
|
+
[4, 32],
|
|
259
|
+
// row 2
|
|
260
|
+
[64, 128]
|
|
261
|
+
// row 3
|
|
262
|
+
];
|
|
263
|
+
function gridToBraille(grid) {
|
|
264
|
+
let rows = grid.length, cols = grid[0] ? grid[0].length : 0, charCount = Math.ceil(cols / 2), result = "";
|
|
265
|
+
for (let c = 0; c < charCount; c++) {
|
|
266
|
+
let code = 10240;
|
|
267
|
+
for (let r = 0; r < 4 && r < rows; r++)
|
|
268
|
+
for (let d = 0; d < 2; d++) {
|
|
269
|
+
let col = c * 2 + d;
|
|
270
|
+
col < cols && grid[r] && grid[r][col] && (code |= BRAILLE_DOT_MAP[r][d]);
|
|
271
|
+
}
|
|
272
|
+
result += String.fromCodePoint(code);
|
|
273
|
+
}
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
function makeGrid(rows, cols) {
|
|
277
|
+
return rows <= 0 || cols <= 0 ? [] : Array.from({ length: rows }, () => Array(cols).fill(!1));
|
|
278
|
+
}
|
|
279
|
+
function genScan() {
|
|
280
|
+
let frames = [];
|
|
281
|
+
for (let pos = -1; pos < 9; pos++) {
|
|
282
|
+
let g = makeGrid(4, 8);
|
|
283
|
+
for (let r = 0; r < 4; r++)
|
|
284
|
+
for (let c = 0; c < 8; c++)
|
|
285
|
+
(c === pos || c === pos - 1) && (g[r][c] = !0);
|
|
286
|
+
frames.push(gridToBraille(g));
|
|
287
|
+
}
|
|
288
|
+
return frames;
|
|
289
|
+
}
|
|
290
|
+
function genRain() {
|
|
291
|
+
let frames = [], offsets = [0, 3, 1, 5, 2, 7, 4, 6];
|
|
292
|
+
for (let f = 0; f < 12; f++) {
|
|
293
|
+
let g = makeGrid(4, 8);
|
|
294
|
+
for (let c = 0; c < 8; c++) {
|
|
295
|
+
let row = (f + offsets[c]) % 6;
|
|
296
|
+
row < 4 && (g[row][c] = !0);
|
|
297
|
+
}
|
|
298
|
+
frames.push(gridToBraille(g));
|
|
299
|
+
}
|
|
300
|
+
return frames;
|
|
301
|
+
}
|
|
302
|
+
function genScanLine() {
|
|
303
|
+
let frames = [], positions = [0, 1, 2, 3, 2, 1];
|
|
304
|
+
for (let row of positions) {
|
|
305
|
+
let g = makeGrid(4, 6);
|
|
306
|
+
for (let c = 0; c < 6; c++)
|
|
307
|
+
g[row][c] = !0, row > 0 && (g[row - 1][c] = c % 2 === 0);
|
|
308
|
+
frames.push(gridToBraille(g));
|
|
309
|
+
}
|
|
310
|
+
return frames;
|
|
311
|
+
}
|
|
312
|
+
function genPulse() {
|
|
313
|
+
let frames = [], radii = [0.5, 1.2, 2, 3, 3.5];
|
|
314
|
+
for (let r of radii) {
|
|
315
|
+
let g = makeGrid(4, 6);
|
|
316
|
+
for (let row = 0; row < 4; row++)
|
|
317
|
+
for (let col = 0; col < 6; col++) {
|
|
318
|
+
let dist = Math.sqrt((col - 2.5) ** 2 + (row - 1.5) ** 2);
|
|
319
|
+
Math.abs(dist - r) < 0.9 && (g[row][col] = !0);
|
|
320
|
+
}
|
|
321
|
+
frames.push(gridToBraille(g));
|
|
322
|
+
}
|
|
323
|
+
return frames;
|
|
324
|
+
}
|
|
325
|
+
function genSnake() {
|
|
326
|
+
let path = [];
|
|
327
|
+
for (let r = 0; r < 4; r++)
|
|
328
|
+
if (r % 2 === 0)
|
|
329
|
+
for (let c = 0; c < 4; c++) path.push([r, c]);
|
|
330
|
+
else
|
|
331
|
+
for (let c = 3; c >= 0; c--) path.push([r, c]);
|
|
332
|
+
let frames = [];
|
|
333
|
+
for (let i = 0; i < path.length; i++) {
|
|
334
|
+
let g = makeGrid(4, 4);
|
|
335
|
+
for (let t = 0; t < 4; t++) {
|
|
336
|
+
let idx = (i - t + path.length) % path.length;
|
|
337
|
+
g[path[idx][0]][path[idx][1]] = !0;
|
|
338
|
+
}
|
|
339
|
+
frames.push(gridToBraille(g));
|
|
340
|
+
}
|
|
341
|
+
return frames;
|
|
342
|
+
}
|
|
343
|
+
function genSparkle() {
|
|
344
|
+
let patterns = [
|
|
345
|
+
[1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0],
|
|
346
|
+
[0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0],
|
|
347
|
+
[0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1],
|
|
348
|
+
[1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0],
|
|
349
|
+
[0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1],
|
|
350
|
+
[0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0]
|
|
351
|
+
], W = 8, H = 4, frames = [];
|
|
352
|
+
for (let pat of patterns) {
|
|
353
|
+
let g = makeGrid(H, W);
|
|
354
|
+
for (let r = 0; r < H; r++)
|
|
355
|
+
for (let c = 0; c < W; c++)
|
|
356
|
+
g[r][c] = !!pat[r * W + c];
|
|
357
|
+
frames.push(gridToBraille(g));
|
|
358
|
+
}
|
|
359
|
+
return frames;
|
|
360
|
+
}
|
|
361
|
+
function genCascade() {
|
|
362
|
+
let frames = [];
|
|
363
|
+
for (let offset = -2; offset < 12; offset++) {
|
|
364
|
+
let g = makeGrid(4, 8);
|
|
365
|
+
for (let r = 0; r < 4; r++)
|
|
366
|
+
for (let c = 0; c < 8; c++) {
|
|
367
|
+
let diag = c + r;
|
|
368
|
+
(diag === offset || diag === offset - 1) && (g[r][c] = !0);
|
|
369
|
+
}
|
|
370
|
+
frames.push(gridToBraille(g));
|
|
371
|
+
}
|
|
372
|
+
return frames;
|
|
373
|
+
}
|
|
374
|
+
function genColumns() {
|
|
375
|
+
let frames = [];
|
|
376
|
+
for (let col = 0; col < 6; col++)
|
|
377
|
+
for (let fillTo = 3; fillTo >= 0; fillTo--) {
|
|
378
|
+
let g = makeGrid(4, 6);
|
|
379
|
+
for (let pc = 0; pc < col; pc++)
|
|
380
|
+
for (let r = 0; r < 4; r++) g[r][pc] = !0;
|
|
381
|
+
for (let r = fillTo; r < 4; r++) g[r][col] = !0;
|
|
382
|
+
frames.push(gridToBraille(g));
|
|
383
|
+
}
|
|
384
|
+
let full = makeGrid(4, 6);
|
|
385
|
+
for (let r = 0; r < 4; r++) for (let c = 0; c < 6; c++) full[r][c] = !0;
|
|
386
|
+
return frames.push(gridToBraille(full)), frames.push(gridToBraille(makeGrid(4, 6))), frames;
|
|
387
|
+
}
|
|
388
|
+
function genOrbit() {
|
|
389
|
+
let path = [
|
|
390
|
+
[0, 0],
|
|
391
|
+
[0, 1],
|
|
392
|
+
[1, 1],
|
|
393
|
+
[2, 1],
|
|
394
|
+
[3, 1],
|
|
395
|
+
[3, 0],
|
|
396
|
+
[2, 0],
|
|
397
|
+
[1, 0]
|
|
398
|
+
], frames = [];
|
|
399
|
+
for (let i = 0; i < path.length; i++) {
|
|
400
|
+
let g = makeGrid(4, 2);
|
|
401
|
+
g[path[i][0]][path[i][1]] = !0;
|
|
402
|
+
let t1 = (i - 1 + path.length) % path.length;
|
|
403
|
+
g[path[t1][0]][path[t1][1]] = !0, frames.push(gridToBraille(g));
|
|
404
|
+
}
|
|
405
|
+
return frames;
|
|
406
|
+
}
|
|
407
|
+
function genBreathe() {
|
|
408
|
+
let stages = [
|
|
409
|
+
[],
|
|
410
|
+
[[1, 0]],
|
|
411
|
+
[[0, 1], [2, 0]],
|
|
412
|
+
[[0, 0], [1, 1], [3, 0]],
|
|
413
|
+
[[0, 0], [1, 1], [2, 0], [3, 1]],
|
|
414
|
+
[[0, 0], [0, 1], [1, 1], [2, 0], [3, 1]],
|
|
415
|
+
[[0, 0], [0, 1], [1, 0], [2, 1], [3, 0], [3, 1]],
|
|
416
|
+
[[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [3, 0], [3, 1]],
|
|
417
|
+
[[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1], [3, 0], [3, 1]]
|
|
418
|
+
], frames = [], sequence = [...stages, ...stages.slice().reverse().slice(1)];
|
|
419
|
+
for (let dots of sequence) {
|
|
420
|
+
let g = makeGrid(4, 2);
|
|
421
|
+
for (let [r, c] of dots) g[r][c] = !0;
|
|
422
|
+
frames.push(gridToBraille(g));
|
|
423
|
+
}
|
|
424
|
+
return frames;
|
|
425
|
+
}
|
|
426
|
+
function genWaveRows() {
|
|
427
|
+
let frames = [];
|
|
428
|
+
for (let f = 0; f < 16; f++) {
|
|
429
|
+
let g = makeGrid(4, 8);
|
|
430
|
+
for (let c = 0; c < 8; c++) {
|
|
431
|
+
let phase = f - c * 0.5, row = Math.round((Math.sin(phase * 0.8) + 1) / 2 * 3);
|
|
432
|
+
g[row][c] = !0, row > 0 && (g[row - 1][c] = (f + c) % 3 === 0);
|
|
433
|
+
}
|
|
434
|
+
frames.push(gridToBraille(g));
|
|
435
|
+
}
|
|
436
|
+
return frames;
|
|
437
|
+
}
|
|
438
|
+
function genCheckerboard() {
|
|
439
|
+
let frames = [];
|
|
440
|
+
for (let phase = 0; phase < 4; phase++) {
|
|
441
|
+
let g = makeGrid(4, 6);
|
|
442
|
+
for (let r = 0; r < 4; r++)
|
|
443
|
+
for (let c = 0; c < 6; c++)
|
|
444
|
+
phase < 2 ? g[r][c] = (r + c + phase) % 2 === 0 : g[r][c] = (r + c + phase) % 3 === 0;
|
|
445
|
+
frames.push(gridToBraille(g));
|
|
446
|
+
}
|
|
447
|
+
return frames;
|
|
448
|
+
}
|
|
449
|
+
function genHelix() {
|
|
450
|
+
let frames = [];
|
|
451
|
+
for (let f = 0; f < 16; f++) {
|
|
452
|
+
let g = makeGrid(4, 8);
|
|
453
|
+
for (let c = 0; c < 8; c++) {
|
|
454
|
+
let phase = (f + c) * (Math.PI / 4), y1 = Math.round((Math.sin(phase) + 1) / 2 * 3), y2 = Math.round((Math.sin(phase + Math.PI) + 1) / 2 * 3);
|
|
455
|
+
g[y1][c] = !0, g[y2][c] = !0;
|
|
456
|
+
}
|
|
457
|
+
frames.push(gridToBraille(g));
|
|
458
|
+
}
|
|
459
|
+
return frames;
|
|
460
|
+
}
|
|
461
|
+
function genFillSweep() {
|
|
462
|
+
let frames = [];
|
|
463
|
+
for (let row = 3; row >= 0; row--) {
|
|
464
|
+
let g = makeGrid(4, 4);
|
|
465
|
+
for (let r = row; r < 4; r++)
|
|
466
|
+
for (let c = 0; c < 4; c++) g[r][c] = !0;
|
|
467
|
+
frames.push(gridToBraille(g));
|
|
468
|
+
}
|
|
469
|
+
let full = makeGrid(4, 4);
|
|
470
|
+
for (let r = 0; r < 4; r++) for (let c = 0; c < 4; c++) full[r][c] = !0;
|
|
471
|
+
frames.push(gridToBraille(full)), frames.push(gridToBraille(full));
|
|
472
|
+
for (let row = 0; row < 4; row++) {
|
|
473
|
+
let g = makeGrid(4, 4);
|
|
474
|
+
for (let r = row + 1; r < 4; r++)
|
|
475
|
+
for (let c = 0; c < 4; c++) g[r][c] = !0;
|
|
476
|
+
frames.push(gridToBraille(g));
|
|
477
|
+
}
|
|
478
|
+
return frames.push(gridToBraille(makeGrid(4, 4))), frames;
|
|
479
|
+
}
|
|
480
|
+
function genDiagonalSwipe() {
|
|
481
|
+
let frames = [];
|
|
482
|
+
for (let d = 0; d <= 6; d++) {
|
|
483
|
+
let g = makeGrid(4, 4);
|
|
484
|
+
for (let r = 0; r < 4; r++)
|
|
485
|
+
for (let c = 0; c < 4; c++)
|
|
486
|
+
r + c <= d && (g[r][c] = !0);
|
|
487
|
+
frames.push(gridToBraille(g));
|
|
488
|
+
}
|
|
489
|
+
let full = makeGrid(4, 4);
|
|
490
|
+
for (let r = 0; r < 4; r++) for (let c = 0; c < 4; c++) full[r][c] = !0;
|
|
491
|
+
frames.push(gridToBraille(full));
|
|
492
|
+
for (let d = 0; d <= 6; d++) {
|
|
493
|
+
let g = makeGrid(4, 4);
|
|
494
|
+
for (let r = 0; r < 4; r++)
|
|
495
|
+
for (let c = 0; c < 4; c++)
|
|
496
|
+
r + c > d && (g[r][c] = !0);
|
|
497
|
+
frames.push(gridToBraille(g));
|
|
498
|
+
}
|
|
499
|
+
return frames.push(gridToBraille(makeGrid(4, 4))), frames;
|
|
500
|
+
}
|
|
501
|
+
var spinners = {
|
|
502
|
+
// === Classic braille single-char ===
|
|
503
|
+
braille: {
|
|
504
|
+
frames: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"],
|
|
505
|
+
interval: 80
|
|
506
|
+
},
|
|
507
|
+
braillewave: {
|
|
508
|
+
frames: [
|
|
509
|
+
"\u2801\u2802\u2804\u2840",
|
|
510
|
+
"\u2802\u2804\u2840\u2880",
|
|
511
|
+
"\u2804\u2840\u2880\u2820",
|
|
512
|
+
"\u2840\u2880\u2820\u2810",
|
|
513
|
+
"\u2880\u2820\u2810\u2808",
|
|
514
|
+
"\u2820\u2810\u2808\u2801",
|
|
515
|
+
"\u2810\u2808\u2801\u2802",
|
|
516
|
+
"\u2808\u2801\u2802\u2804"
|
|
517
|
+
],
|
|
518
|
+
interval: 100
|
|
519
|
+
},
|
|
520
|
+
dna: {
|
|
521
|
+
frames: [
|
|
522
|
+
"\u280B\u2809\u2819\u281A",
|
|
523
|
+
"\u2809\u2819\u281A\u2812",
|
|
524
|
+
"\u2819\u281A\u2812\u2802",
|
|
525
|
+
"\u281A\u2812\u2802\u2802",
|
|
526
|
+
"\u2812\u2802\u2802\u2812",
|
|
527
|
+
"\u2802\u2802\u2812\u2832",
|
|
528
|
+
"\u2802\u2812\u2832\u2834",
|
|
529
|
+
"\u2812\u2832\u2834\u2824",
|
|
530
|
+
"\u2832\u2834\u2824\u2804",
|
|
531
|
+
"\u2834\u2824\u2804\u280B",
|
|
532
|
+
"\u2824\u2804\u280B\u2809",
|
|
533
|
+
"\u2804\u280B\u2809\u2819"
|
|
534
|
+
],
|
|
535
|
+
interval: 80
|
|
536
|
+
},
|
|
537
|
+
// === Generated braille grid animations ===
|
|
538
|
+
scan: { frames: genScan(), interval: 70 },
|
|
539
|
+
rain: { frames: genRain(), interval: 100 },
|
|
540
|
+
scanline: { frames: genScanLine(), interval: 120 },
|
|
541
|
+
pulse: { frames: genPulse(), interval: 180 },
|
|
542
|
+
snake: { frames: genSnake(), interval: 80 },
|
|
543
|
+
sparkle: { frames: genSparkle(), interval: 150 },
|
|
544
|
+
cascade: { frames: genCascade(), interval: 60 },
|
|
545
|
+
columns: { frames: genColumns(), interval: 60 },
|
|
546
|
+
orbit: { frames: genOrbit(), interval: 100 },
|
|
547
|
+
breathe: { frames: genBreathe(), interval: 100 },
|
|
548
|
+
waverows: { frames: genWaveRows(), interval: 90 },
|
|
549
|
+
checkerboard: { frames: genCheckerboard(), interval: 250 },
|
|
550
|
+
helix: { frames: genHelix(), interval: 80 },
|
|
551
|
+
fillsweep: { frames: genFillSweep(), interval: 100 },
|
|
552
|
+
diagswipe: { frames: genDiagonalSwipe(), interval: 60 }
|
|
553
|
+
};
|
|
554
|
+
|
|
555
|
+
// packages/coding-agent/dist/builtin-extensions/ashxj-spinners.js
|
|
556
|
+
var THINKING_TOOL_SPINNER_POOL = [
|
|
557
|
+
"rain",
|
|
558
|
+
"breathe",
|
|
559
|
+
"checkerboard",
|
|
560
|
+
"sparkle",
|
|
561
|
+
"braille",
|
|
562
|
+
"snake"
|
|
563
|
+
], THINKING_TOOL_KAOMOJI_POOL = [
|
|
564
|
+
// formerly `thinking`
|
|
565
|
+
"(\u1D55\u2014\u1D17\u2014)",
|
|
566
|
+
// determined
|
|
567
|
+
"(\u02F5 \xAC\u1D17\xAC\u02F5)",
|
|
568
|
+
// clever
|
|
569
|
+
"(\u2E1D\u2E1D\u1D55\u1D17\u1D55\u2E1D\u2E1D)",
|
|
570
|
+
// admiring gaze
|
|
571
|
+
"\u2E1C(\uFF61\u02C3 \u1D55 \u02C2 )\u2E1D\u2661",
|
|
572
|
+
// blushing happy
|
|
573
|
+
"(\u02F6>\u2A4A<\u02F6)",
|
|
574
|
+
// cheerful
|
|
575
|
+
"\u0AEE\u2E1D\u2E1D> \u032B <\u2E1D\u2E1D \u10D0",
|
|
576
|
+
// pleading with worry
|
|
577
|
+
"(\u02F6 > \u2083 < \u02F6)",
|
|
578
|
+
// licking lips
|
|
579
|
+
// formerly `toolRunning`
|
|
580
|
+
"(\u0E51\xB4>\u1391<)~*",
|
|
581
|
+
// reaching for hug, eager
|
|
582
|
+
// new
|
|
583
|
+
"\u208D^. .^\u208E\u27C6",
|
|
584
|
+
"(\u3145\xB4 \u02D8 `)",
|
|
585
|
+
"(\u201E\u2022 \u058A \u2022\u201E)",
|
|
586
|
+
"(\u02F6\u02C3 \u1D55 \u02C2\u02F6)",
|
|
587
|
+
"\u285E\u2833\u28C4\u28C0\u28E0\u281E\u28B7 \u05B9\u06EA",
|
|
588
|
+
"\uFF08\u02F6\u2022\u0300 \u1391-\u02F6\uFF09"
|
|
589
|
+
], SPINNER_POOL_FOR_STATE = {
|
|
590
|
+
idle: [],
|
|
591
|
+
startup: [],
|
|
592
|
+
thinking: THINKING_TOOL_SPINNER_POOL,
|
|
593
|
+
searching: ["diagswipe", "scan", "cascade"],
|
|
594
|
+
editing: ["columns", "fillsweep"],
|
|
595
|
+
toolRunning: THINKING_TOOL_SPINNER_POOL,
|
|
596
|
+
complete: [],
|
|
597
|
+
error: ["pulse"]
|
|
598
|
+
}, KAOMOJI_FOR_STATE = {
|
|
599
|
+
// idle, startup, complete are silent: no kaomoji.
|
|
600
|
+
idle: [],
|
|
601
|
+
startup: [],
|
|
602
|
+
thinking: THINKING_TOOL_KAOMOJI_POOL,
|
|
603
|
+
searching: [
|
|
604
|
+
"(\u2E1D\u2E1D\u2A4C \u2919 \u2A4C\u2E1D\u2E1D)",
|
|
605
|
+
// confused
|
|
606
|
+
"(\u2579 -\u2579)?"
|
|
607
|
+
// questioning
|
|
608
|
+
],
|
|
609
|
+
editing: [
|
|
610
|
+
"(\u1D55 \u2022 \u1D17 \u2022)",
|
|
611
|
+
// content
|
|
612
|
+
"(\u02F6\u1D54 \u1D55 \u1D54\u02F6) \u2039\u{1D7F9}",
|
|
613
|
+
// warm with small heart
|
|
614
|
+
"(\u0E51\u1D54\u2919\u1D54\u0E51)"
|
|
615
|
+
// gleeful
|
|
616
|
+
],
|
|
617
|
+
toolRunning: THINKING_TOOL_KAOMOJI_POOL,
|
|
618
|
+
complete: [],
|
|
619
|
+
error: [
|
|
620
|
+
"(,,>\uFE4F<,,)",
|
|
621
|
+
// crying
|
|
622
|
+
"(\u2E1D\u2E1D \u2661\uFE4F\u2661\u2E1D\u2E1D)",
|
|
623
|
+
// apologetic crying
|
|
624
|
+
'"\u0AEE\u208D \u02F6\u2022\u2919\u2022\u02F6 \u208E\u10D0',
|
|
625
|
+
// pleading paws
|
|
626
|
+
"(\u2565\uFE4F\u2565)",
|
|
627
|
+
// heavy crying
|
|
628
|
+
"(\u02F6\xB0\u3141\xB0)!!",
|
|
629
|
+
// shocked
|
|
630
|
+
"(,,\u2022\u1DC4\uFE4F\u200E\u2022\u1DC5,,)"
|
|
631
|
+
// distressed
|
|
632
|
+
]
|
|
633
|
+
}, SEARCH_RE = /(search|find|grep|list|ls|fuzzy|query)/i, EDIT_RE = /(^|[_\-\s])(write|edit|patch|create|delete|remove|replace|insert|update|apply_?patch|apply_?edit|str_?replace|str_?replace_?editor|create_?file|delete_?file|write_?file|edit_?file|insert_?content|append_?file|modify_?file)([_\-\s]|$)/i, TRANSIENT_MS = 3e3, STATE_TTL_MS = 3e3, STATES_WITH_TTL = /* @__PURE__ */ new Set([
|
|
634
|
+
"thinking",
|
|
635
|
+
"searching",
|
|
636
|
+
"editing",
|
|
637
|
+
"toolRunning",
|
|
638
|
+
"error"
|
|
639
|
+
]), SILENT_STATES = /* @__PURE__ */ new Set([
|
|
640
|
+
"idle",
|
|
641
|
+
"startup",
|
|
642
|
+
"complete"
|
|
643
|
+
]), KAOMOJI_REROLL_MS = 3e4;
|
|
644
|
+
function pick(arr) {
|
|
645
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
646
|
+
}
|
|
647
|
+
function pickOther(arr, current) {
|
|
648
|
+
if (arr.length <= 1)
|
|
649
|
+
return arr[0];
|
|
650
|
+
let v;
|
|
651
|
+
do
|
|
652
|
+
v = pick(arr);
|
|
653
|
+
while (v === current);
|
|
654
|
+
return v;
|
|
655
|
+
}
|
|
656
|
+
function ashxj_spinners_default(pi) {
|
|
657
|
+
let state = "idle", stateEnteredAt = 0, currentKaomoji = "", transientTimer, rerollTimer;
|
|
658
|
+
function publishWorkingMessage(ctx) {
|
|
659
|
+
ctx.ui.setWorkingMessage(currentKaomoji);
|
|
660
|
+
}
|
|
661
|
+
function clearTransient() {
|
|
662
|
+
transientTimer !== void 0 && (clearTimeout(transientTimer), transientTimer = void 0);
|
|
663
|
+
}
|
|
664
|
+
function clearReroll() {
|
|
665
|
+
rerollTimer !== void 0 && (clearInterval(rerollTimer), rerollTimer = void 0);
|
|
666
|
+
}
|
|
667
|
+
function doApplyState(next, ctx) {
|
|
668
|
+
state = next, stateEnteredAt = Date.now();
|
|
669
|
+
let spinnerPool = SPINNER_POOL_FOR_STATE[next];
|
|
670
|
+
if (spinnerPool.length > 0) {
|
|
671
|
+
let spinnerName = pick(spinnerPool), def = spinners[spinnerName], frames = def.frames.map((f) => ctx.ui.theme.fg("accent", f));
|
|
672
|
+
ctx.ui.setWorkingIndicator({ frames, intervalMs: def.interval });
|
|
673
|
+
} else
|
|
674
|
+
ctx.ui.setWorkingIndicator({ frames: [] });
|
|
675
|
+
let kaomojiPool = KAOMOJI_FOR_STATE[next];
|
|
676
|
+
currentKaomoji = kaomojiPool.length > 0 ? pick(kaomojiPool) : "", publishWorkingMessage(ctx), clearReroll(), clearTransient(), kaomojiPool.length > 1 && (rerollTimer = setInterval(() => rerollKaomoji(ctx), KAOMOJI_REROLL_MS)), (next === "complete" || next === "startup") && (transientTimer = setTimeout(() => doApplyState("idle", ctx), TRANSIENT_MS));
|
|
677
|
+
}
|
|
678
|
+
function rerollKaomoji(ctx) {
|
|
679
|
+
let pool = KAOMOJI_FOR_STATE[state];
|
|
680
|
+
pool.length <= 1 || (currentKaomoji = pickOther(pool, currentKaomoji), publishWorkingMessage(ctx));
|
|
681
|
+
}
|
|
682
|
+
function applyState(next, ctx, options = {}) {
|
|
683
|
+
ctx.mode === "tui" && (!options.force && !SILENT_STATES.has(next) && next !== "error" && STATES_WITH_TTL.has(state) && Date.now() - stateEnteredAt < STATE_TTL_MS || doApplyState(next, ctx));
|
|
684
|
+
}
|
|
685
|
+
pi.on("session_start", (event, ctx) => {
|
|
686
|
+
ctx.mode === "tui" && doApplyState(event.reason === "startup" ? "startup" : "idle", ctx);
|
|
687
|
+
}), pi.on("turn_start", (_event, ctx) => {
|
|
688
|
+
applyState("thinking", ctx);
|
|
689
|
+
}), pi.on("tool_execution_start", (event, ctx) => {
|
|
690
|
+
if (state === "error")
|
|
691
|
+
return;
|
|
692
|
+
let name = event.toolName, force = !0;
|
|
693
|
+
SEARCH_RE.test(name) ? applyState("searching", ctx, { force }) : EDIT_RE.test(name) ? applyState("editing", ctx, { force }) : applyState("toolRunning", ctx, { force });
|
|
694
|
+
}), pi.on("tool_execution_end", (event, ctx) => {
|
|
695
|
+
event.isError && applyState("error", ctx);
|
|
696
|
+
}), pi.on("turn_end", (_event, ctx) => {
|
|
697
|
+
(state === "searching" || state === "editing" || state === "toolRunning") && applyState("thinking", ctx, { force: !0 });
|
|
698
|
+
}), pi.on("agent_end", (event, ctx) => {
|
|
699
|
+
let last = event.messages.at(-1);
|
|
700
|
+
if (!last || last.role !== "assistant") {
|
|
701
|
+
applyState("idle", ctx);
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
let stopReason = last.stopReason;
|
|
705
|
+
stopReason === "stop" || stopReason === "length" ? applyState("complete", ctx) : stopReason === "error" || stopReason === "aborted" ? applyState("error", ctx) : stopReason === "toolUse" || applyState("idle", ctx);
|
|
706
|
+
}), pi.on("session_shutdown", (_event, ctx) => {
|
|
707
|
+
clearTransient(), clearReroll(), ctx.mode === "tui" && (ctx.ui.setWorkingIndicator({ frames: [] }), ctx.ui.setWorkingMessage("")), state = "idle", stateEnteredAt = 0, currentKaomoji = "";
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// packages/coding-agent/dist/builtin-extensions/ashxj-thinking.js
|
|
712
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, renameSync } from "node:fs";
|
|
713
|
+
import { join as join2 } from "node:path";
|
|
714
|
+
import { homedir } from "node:os";
|
|
715
|
+
var ALL_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"], ALL_LEVELS_5 = ["off", "minimal", "low", "medium", "high"], THINKING_DESCRIPTIONS = {
|
|
716
|
+
off: "No reasoning",
|
|
717
|
+
minimal: "Very brief reasoning",
|
|
718
|
+
low: "Light reasoning",
|
|
719
|
+
medium: "Moderate reasoning",
|
|
720
|
+
high: "Deep reasoning",
|
|
721
|
+
xhigh: "Extra-high reasoning",
|
|
722
|
+
// lunr: added — mirrors settings-selector.ts.
|
|
723
|
+
max: "Maximum reasoning"
|
|
724
|
+
};
|
|
725
|
+
function availableLevelsFor(model) {
|
|
726
|
+
return model ? model.reasoning === !1 ? ["off"] : ALL_LEVELS.filter((level) => {
|
|
727
|
+
let mapped = model.thinkingLevelMap?.[level];
|
|
728
|
+
return mapped === null ? !1 : level === "xhigh" || level === "max" ? mapped !== void 0 : !0;
|
|
729
|
+
}) : ALL_LEVELS_5;
|
|
730
|
+
}
|
|
731
|
+
function formatLevelLabel(level) {
|
|
732
|
+
return `${level.padEnd(8)} \u2014 ${THINKING_DESCRIPTIONS[level]}`;
|
|
733
|
+
}
|
|
734
|
+
function agentSettingsPath() {
|
|
735
|
+
let envDir = process.env.PI_CODING_AGENT_DIR;
|
|
736
|
+
if (envDir) {
|
|
737
|
+
let home = homedir(), expanded = envDir === "~" ? home : envDir.startsWith("~/") || process.platform === "win32" && envDir.startsWith("~\\") ? join2(home, envDir.slice(2)) : envDir;
|
|
738
|
+
return join2(expanded, "settings.json");
|
|
739
|
+
}
|
|
740
|
+
return join2(homedir(), ".lunr", "agent", "settings.json");
|
|
741
|
+
}
|
|
742
|
+
function getCustomizeBridge() {
|
|
743
|
+
return globalThis[/* @__PURE__ */ Symbol.for("@lunr/customize")];
|
|
744
|
+
}
|
|
745
|
+
function readHideThinkingBlock() {
|
|
746
|
+
let bridge = getCustomizeBridge();
|
|
747
|
+
if (bridge)
|
|
748
|
+
return bridge.getHideThinkingBlock();
|
|
749
|
+
try {
|
|
750
|
+
let p = agentSettingsPath();
|
|
751
|
+
return existsSync2(p) ? JSON.parse(readFileSync2(p, "utf8")).hideThinkingBlock === !0 : !1;
|
|
752
|
+
} catch {
|
|
753
|
+
return !1;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function writeHideThinkingBlock(hide) {
|
|
757
|
+
let bridge = getCustomizeBridge();
|
|
758
|
+
if (bridge)
|
|
759
|
+
try {
|
|
760
|
+
return bridge.setHideThinkingBlock(hide), { ok: !0, createdFresh: !1 };
|
|
761
|
+
} catch {
|
|
762
|
+
return { ok: !1, createdFresh: !1 };
|
|
763
|
+
}
|
|
764
|
+
try {
|
|
765
|
+
let p = agentSettingsPath(), cfg = {}, createdFresh = !1;
|
|
766
|
+
if (existsSync2(p))
|
|
767
|
+
try {
|
|
768
|
+
cfg = JSON.parse(readFileSync2(p, "utf8"));
|
|
769
|
+
} catch {
|
|
770
|
+
try {
|
|
771
|
+
renameSync(p, `${p}.bak`);
|
|
772
|
+
} catch {
|
|
773
|
+
}
|
|
774
|
+
cfg = {}, createdFresh = !0;
|
|
775
|
+
}
|
|
776
|
+
else
|
|
777
|
+
createdFresh = !0;
|
|
778
|
+
return cfg.hideThinkingBlock = hide, writeFileSync2(p, JSON.stringify(cfg, null, 2) + `
|
|
779
|
+
`, "utf8"), { ok: !0, createdFresh };
|
|
780
|
+
} catch {
|
|
781
|
+
return { ok: !1, createdFresh: !1 };
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
var THINKING_COMMAND_DESCRIPTION = "View or set the reasoning level for the current model, or toggle thinking-block visibility with show/hide/toggle";
|
|
785
|
+
function ashxj_thinking_default(pi) {
|
|
786
|
+
let thinkingSpec = {
|
|
787
|
+
description: THINKING_COMMAND_DESCRIPTION,
|
|
788
|
+
getArgumentCompletions(prefix) {
|
|
789
|
+
let lower = prefix.toLowerCase(), visibility = [
|
|
790
|
+
{ value: "show", label: "show", description: "Show thinking blocks (persisted to settings.json)" },
|
|
791
|
+
{ value: "hide", label: "hide", description: "Hide thinking blocks (persisted to settings.json)" },
|
|
792
|
+
{ value: "toggle", label: "toggle", description: "Toggle thinking blocks (persisted to settings.json)" }
|
|
793
|
+
], levelItems = availableLevelsFor(currentModel(pi)).filter((lvl) => lvl.startsWith(lower)).map((lvl) => ({ value: lvl, label: lvl, description: THINKING_DESCRIPTIONS[lvl] }));
|
|
794
|
+
return [
|
|
795
|
+
...visibility.filter((v) => v.value.startsWith(lower)),
|
|
796
|
+
...levelItems
|
|
797
|
+
];
|
|
798
|
+
},
|
|
799
|
+
handler: async (args, ctx) => {
|
|
800
|
+
let trimmed = args.trim(), lower = trimmed.toLowerCase();
|
|
801
|
+
if (lower === "show" || lower === "hide" || lower === "toggle") {
|
|
802
|
+
let current = readHideThinkingBlock(), next = lower === "toggle" ? !current : lower === "hide";
|
|
803
|
+
if (next === current) {
|
|
804
|
+
ctx.ui.notify(`Thinking blocks already ${current ? "hidden" : "shown"}.`, "info");
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let result = writeHideThinkingBlock(next);
|
|
808
|
+
if (!result.ok) {
|
|
809
|
+
ctx.ui.notify(`Failed to update ${agentSettingsPath()}`, "error");
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
let verb = next ? "hidden" : "shown", note = result.createdFresh ? `Thinking blocks ${verb}. (Created ${agentSettingsPath()} with this setting.)` : `Thinking blocks ${verb}.`;
|
|
813
|
+
ctx.ui.notify(note, "info"), await ctx.reload();
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
let levels = availableLevelsFor(ctx.model), currentLevel = pi.getThinkingLevel(), validSet = new Set(levels);
|
|
817
|
+
if (trimmed === "") {
|
|
818
|
+
if (ctx.mode !== "tui") {
|
|
819
|
+
ctx.ui.notify(`Thinking level: ${currentLevel}`, "info");
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (levels.length === 0) {
|
|
823
|
+
ctx.ui.notify("No thinking levels available for this model.", "warning");
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
let options = levels.map((lvl) => (lvl === currentLevel ? "\u25CF " : " ") + formatLevelLabel(lvl)), chosen = await ctx.ui.select(`Thinking level (current: ${currentLevel})`, options);
|
|
827
|
+
if (chosen === void 0)
|
|
828
|
+
return;
|
|
829
|
+
let level = chosen.replace(/^[\u25CF ]\s?/, "").trimStart().split(/\s+/)[0];
|
|
830
|
+
if (!validSet.has(level)) {
|
|
831
|
+
ctx.ui.notify(`Unsupported thinking level: ${level}`, "error");
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
if (level === currentLevel)
|
|
835
|
+
return;
|
|
836
|
+
pi.setThinkingLevel(level), ctx.ui.notify(`Thinking level: ${pi.getThinkingLevel()}`, "info");
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
let requested = trimmed.toLowerCase();
|
|
840
|
+
if (!validSet.has(requested)) {
|
|
841
|
+
ctx.ui.notify(`Invalid thinking level: "${trimmed}". Valid: ${levels.join(", ")}`, "error");
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
if (requested === currentLevel) {
|
|
845
|
+
ctx.ui.notify(`Thinking level: ${requested} (unchanged)`, "info");
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
pi.setThinkingLevel(requested), ctx.ui.notify(`Thinking level: ${pi.getThinkingLevel()}`, "info");
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
pi.registerCommand("thinking", thinkingSpec), pi.registerCommand("effort", {
|
|
852
|
+
...thinkingSpec,
|
|
853
|
+
description: `${THINKING_COMMAND_DESCRIPTION} (alias of /thinking)`
|
|
854
|
+
}), pi.registerCommand("reasoning", {
|
|
855
|
+
...thinkingSpec,
|
|
856
|
+
description: `${THINKING_COMMAND_DESCRIPTION} (alias of /thinking)`
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
function currentModel(pi) {
|
|
860
|
+
let fn = pi.getModel;
|
|
861
|
+
if (typeof fn == "function")
|
|
862
|
+
return fn.call(pi);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-local-providers/local-servers.js
|
|
866
|
+
var OLLAMA_ORIGIN = "http://127.0.0.1:11434", LM_STUDIO_ORIGIN = "http://127.0.0.1:1234", OLLAMA_LOCAL = {
|
|
867
|
+
providerId: "ollama-local",
|
|
868
|
+
displayName: "Ollama (local)",
|
|
869
|
+
productName: "Ollama",
|
|
870
|
+
port: 11434,
|
|
871
|
+
baseUrl: `${OLLAMA_ORIGIN}/v1`,
|
|
872
|
+
modelsUrl: `${OLLAMA_ORIGIN}/v1/models`,
|
|
873
|
+
tagsUrl: `${OLLAMA_ORIGIN}/api/tags`,
|
|
874
|
+
dummyKey: "ollama"
|
|
875
|
+
}, LM_STUDIO = {
|
|
876
|
+
providerId: "lm-studio",
|
|
877
|
+
displayName: "LM Studio (local)",
|
|
878
|
+
productName: "LM Studio",
|
|
879
|
+
port: 1234,
|
|
880
|
+
baseUrl: `${LM_STUDIO_ORIGIN}/v1`,
|
|
881
|
+
modelsUrl: `${LM_STUDIO_ORIGIN}/v1/models`,
|
|
882
|
+
dummyKey: "local"
|
|
883
|
+
}, LOCAL_SERVERS = [OLLAMA_LOCAL, LM_STUDIO];
|
|
884
|
+
function extractModelIds(payload) {
|
|
885
|
+
let ids = [], push = (value) => {
|
|
886
|
+
typeof value == "string" && value.length > 0 && !ids.includes(value) && ids.push(value);
|
|
887
|
+
}, fromEntry = (entry) => {
|
|
888
|
+
if (typeof entry == "string") {
|
|
889
|
+
push(entry);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (entry !== null && typeof entry == "object") {
|
|
893
|
+
let record = entry;
|
|
894
|
+
push(record.id ?? record.name ?? record.model);
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
if (Array.isArray(payload)) {
|
|
898
|
+
for (let entry of payload)
|
|
899
|
+
fromEntry(entry);
|
|
900
|
+
return ids;
|
|
901
|
+
}
|
|
902
|
+
if (payload !== null && typeof payload == "object") {
|
|
903
|
+
let record = payload;
|
|
904
|
+
if (Array.isArray(record.data))
|
|
905
|
+
for (let entry of record.data)
|
|
906
|
+
fromEntry(entry);
|
|
907
|
+
if (Array.isArray(record.models))
|
|
908
|
+
for (let entry of record.models)
|
|
909
|
+
fromEntry(entry);
|
|
910
|
+
}
|
|
911
|
+
return ids;
|
|
912
|
+
}
|
|
913
|
+
async function fetchJson(url, timeoutMs, signal) {
|
|
914
|
+
let controller = new AbortController(), timer = setTimeout(() => controller.abort(), timeoutMs), onAbort = () => controller.abort();
|
|
915
|
+
signal?.addEventListener("abort", onAbort, { once: !0 });
|
|
916
|
+
try {
|
|
917
|
+
let response = await fetch(url, {
|
|
918
|
+
headers: { accept: "application/json" },
|
|
919
|
+
signal: controller.signal
|
|
920
|
+
});
|
|
921
|
+
return response.ok ? await response.json() : null;
|
|
922
|
+
} catch {
|
|
923
|
+
return null;
|
|
924
|
+
} finally {
|
|
925
|
+
clearTimeout(timer), signal?.removeEventListener("abort", onAbort);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
async function fetchLocalModelIds(spec, timeoutMs, signal) {
|
|
929
|
+
let payload = await fetchJson(spec.modelsUrl, timeoutMs, signal);
|
|
930
|
+
if (payload !== null)
|
|
931
|
+
return extractModelIds(payload);
|
|
932
|
+
if (spec.tagsUrl) {
|
|
933
|
+
let fallback = await fetchJson(spec.tagsUrl, timeoutMs, signal);
|
|
934
|
+
if (fallback !== null)
|
|
935
|
+
return extractModelIds(fallback);
|
|
936
|
+
}
|
|
937
|
+
return null;
|
|
938
|
+
}
|
|
939
|
+
function toModelConfig(id) {
|
|
940
|
+
return {
|
|
941
|
+
id,
|
|
942
|
+
name: id,
|
|
943
|
+
reasoning: !1,
|
|
944
|
+
input: ["text"],
|
|
945
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
946
|
+
contextWindow: 32768,
|
|
947
|
+
maxTokens: 8192
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-local-providers/index.js
|
|
952
|
+
var LOGIN_PROBE_TIMEOUT_MS = 3e3, REFRESH_TIMEOUT_MS = 3e3, AUTO_SELECT_POLL_MS = 100, AUTO_SELECT_MAX_WAIT_MS = 5e3, NEVER_EXPIRES = 41024448e5;
|
|
953
|
+
function isUnknownModel(model) {
|
|
954
|
+
return !!model && model.provider === "unknown" && model.id === "unknown" && model.api === "unknown";
|
|
955
|
+
}
|
|
956
|
+
function lunrLocalProviders(pi) {
|
|
957
|
+
let lastCtx;
|
|
958
|
+
pi.on("session_start", (_event, ctx) => {
|
|
959
|
+
lastCtx = ctx;
|
|
960
|
+
}), pi.on("model_select", (_event, ctx) => {
|
|
961
|
+
lastCtx = ctx;
|
|
962
|
+
});
|
|
963
|
+
for (let spec of LOCAL_SERVERS) {
|
|
964
|
+
let state = { spec, models: [], justLoggedIn: !1 }, scheduleAutoSelect = () => {
|
|
965
|
+
let started = Date.now(), timer = setInterval(() => {
|
|
966
|
+
let ctx = lastCtx;
|
|
967
|
+
if (!ctx) {
|
|
968
|
+
clearInterval(timer);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
971
|
+
let first = ctx.modelRegistry.getAvailable().find((model) => model.provider === spec.providerId);
|
|
972
|
+
if (!first) {
|
|
973
|
+
Date.now() - started > AUTO_SELECT_MAX_WAIT_MS && clearInterval(timer);
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
clearInterval(timer);
|
|
977
|
+
let current = ctx.model;
|
|
978
|
+
current && !isUnknownModel(current) || pi.setModel(first);
|
|
979
|
+
}, AUTO_SELECT_POLL_MS);
|
|
980
|
+
timer.unref();
|
|
981
|
+
};
|
|
982
|
+
pi.registerProvider(spec.providerId, {
|
|
983
|
+
name: spec.displayName,
|
|
984
|
+
baseUrl: spec.baseUrl,
|
|
985
|
+
api: "openai-completions",
|
|
986
|
+
models: state.models,
|
|
987
|
+
refreshModels: async (context) => {
|
|
988
|
+
if (!context.allowNetwork) {
|
|
989
|
+
let stored = await context.store.read();
|
|
990
|
+
return stored?.models?.length && (state.models = stored.models.map((model) => toModelConfig(model.id))), state.models;
|
|
991
|
+
}
|
|
992
|
+
let ids = await fetchLocalModelIds(spec, REFRESH_TIMEOUT_MS, context.signal);
|
|
993
|
+
if (state.models = (ids ?? []).map(toModelConfig), state.models.length > 0)
|
|
994
|
+
try {
|
|
995
|
+
await context.store.write({
|
|
996
|
+
models: state.models.map((model) => ({
|
|
997
|
+
...model,
|
|
998
|
+
api: "openai-completions",
|
|
999
|
+
provider: spec.providerId,
|
|
1000
|
+
baseUrl: spec.baseUrl
|
|
1001
|
+
})),
|
|
1002
|
+
checkedAt: Date.now()
|
|
1003
|
+
});
|
|
1004
|
+
} catch {
|
|
1005
|
+
}
|
|
1006
|
+
return state.justLoggedIn && state.models.length > 0 && (state.justLoggedIn = !1, scheduleAutoSelect()), state.models;
|
|
1007
|
+
},
|
|
1008
|
+
oauth: {
|
|
1009
|
+
name: spec.displayName,
|
|
1010
|
+
login: async (callbacks) => {
|
|
1011
|
+
callbacks.onProgress?.(`Looking for ${spec.productName} on localhost:${spec.port}...`);
|
|
1012
|
+
let ids = await fetchLocalModelIds(spec, LOGIN_PROBE_TIMEOUT_MS, callbacks.signal);
|
|
1013
|
+
if (ids === null)
|
|
1014
|
+
throw new Error(`${spec.productName} not detected on localhost:${spec.port} \u2014 start it and retry.`);
|
|
1015
|
+
if (ids.length === 0)
|
|
1016
|
+
throw new Error(`${spec.productName} is running on localhost:${spec.port} but has no models. Load a model and retry.`);
|
|
1017
|
+
return state.models = ids.map(toModelConfig), state.justLoggedIn = !0, { refresh: spec.dummyKey, access: spec.dummyKey, expires: NEVER_EXPIRES };
|
|
1018
|
+
},
|
|
1019
|
+
refreshToken: async (credentials) => credentials,
|
|
1020
|
+
getApiKey: () => spec.dummyKey
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-todos.js
|
|
1027
|
+
import { Text } from "@ashx-j/lunr-tui";
|
|
1028
|
+
var TODO_WIDGET_COLLAPSED_ROWS = 3, STATUS_GLYPHS = {
|
|
1029
|
+
in_progress: "\u25CF",
|
|
1030
|
+
pending: "\u25CB",
|
|
1031
|
+
completed: "\u2713"
|
|
1032
|
+
};
|
|
1033
|
+
function summarizeTodos(todos) {
|
|
1034
|
+
if (todos.length === 0)
|
|
1035
|
+
return "No todos.";
|
|
1036
|
+
let count = (s) => todos.filter((t) => t.status === s).length, parts = [], inProgress = count("in_progress"), pending = count("pending"), completed = count("completed");
|
|
1037
|
+
return inProgress > 0 && parts.push(`${inProgress} in progress`), pending > 0 && parts.push(`${pending} pending`), completed > 0 && parts.push(`${completed} completed`), `${todos.length} todo${todos.length === 1 ? "" : "s"}: ${parts.join(", ")}`;
|
|
1038
|
+
}
|
|
1039
|
+
function buildTodoWidgetLines(todos, expanded, expandKey = "click") {
|
|
1040
|
+
if (todos.length === 0)
|
|
1041
|
+
return [];
|
|
1042
|
+
let row = (t) => ({
|
|
1043
|
+
kind: "todo",
|
|
1044
|
+
status: t.status,
|
|
1045
|
+
text: `${STATUS_GLYPHS[t.status]} ${t.content}`
|
|
1046
|
+
}), active = [
|
|
1047
|
+
...todos.filter((t) => t.status === "in_progress"),
|
|
1048
|
+
...todos.filter((t) => t.status === "pending")
|
|
1049
|
+
], done = todos.filter((t) => t.status === "completed");
|
|
1050
|
+
if (expanded)
|
|
1051
|
+
return [...active.map(row), ...done.map(row)];
|
|
1052
|
+
let lines = active.slice(0, TODO_WIDGET_COLLAPSED_ROWS).map(row), hidden = active.length - TODO_WIDGET_COLLAPSED_ROWS;
|
|
1053
|
+
return hidden > 0 && lines.push({ kind: "hint", text: `+${hidden} more` }), lines;
|
|
1054
|
+
}
|
|
1055
|
+
var WIDGET_KEY = "todos", EXPANDED_BRIDGE_SYMBOL = /* @__PURE__ */ Symbol.for("@lunr/tools-expanded-changed");
|
|
1056
|
+
function lunr_todos_default(pi) {
|
|
1057
|
+
let todos = [], expanded = !1, lastCtx = null;
|
|
1058
|
+
function colorize(line, theme) {
|
|
1059
|
+
return line.kind === "summary" || line.kind === "hint" ? theme.fg("muted", line.text) : line.status === "in_progress" ? theme.fg("accent", line.text) : line.status === "completed" ? theme.fg("dim", line.text) : line.text;
|
|
1060
|
+
}
|
|
1061
|
+
function refreshWidget() {
|
|
1062
|
+
let ctx = lastCtx;
|
|
1063
|
+
if (!ctx?.hasUI)
|
|
1064
|
+
return;
|
|
1065
|
+
let lines = buildTodoWidgetLines(todos, expanded, keyText("app.tools.expand"));
|
|
1066
|
+
if (todos.length === 0 || lines.length === 0) {
|
|
1067
|
+
ctx.ui.setWidget(WIDGET_KEY, void 0);
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
ctx.ui.setWidget(WIDGET_KEY, (_tui, theme) => {
|
|
1071
|
+
let text2 = new Text(lines.map((l) => colorize(l, theme)).join(`
|
|
1072
|
+
`), 1, 0);
|
|
1073
|
+
return {
|
|
1074
|
+
render: (width) => text2.render(width),
|
|
1075
|
+
invalidate: () => text2.invalidate?.(),
|
|
1076
|
+
handleClick: () => (expanded = !expanded, refreshWidget(), !0)
|
|
1077
|
+
};
|
|
1078
|
+
}, { placement: "aboveEditor" });
|
|
1079
|
+
}
|
|
1080
|
+
function pruneCompleted() {
|
|
1081
|
+
let next = todos.filter((t) => t.status !== "completed");
|
|
1082
|
+
next.length !== todos.length && (todos = next, refreshWidget());
|
|
1083
|
+
}
|
|
1084
|
+
function registerExpandedBridge() {
|
|
1085
|
+
globalThis[EXPANDED_BRIDGE_SYMBOL] = (value) => {
|
|
1086
|
+
expanded = !!value, refreshWidget();
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1089
|
+
registerExpandedBridge(), pi.on("session_start", (_event, ctx) => {
|
|
1090
|
+
lastCtx = ctx, todos = [], expanded = ctx.hasUI ? ctx.ui.getToolsExpanded?.() ?? !1 : !1, registerExpandedBridge(), ctx.hasUI && ctx.ui.setWidget(WIDGET_KEY, void 0);
|
|
1091
|
+
}), pi.on("message_start", (event, ctx) => {
|
|
1092
|
+
event.message?.role === "user" && (lastCtx = ctx, pruneCompleted());
|
|
1093
|
+
}), pi.on("session_shutdown", () => {
|
|
1094
|
+
lastCtx?.hasUI && lastCtx.ui.setWidget(WIDGET_KEY, void 0), lastCtx = null, delete globalThis[EXPANDED_BRIDGE_SYMBOL];
|
|
1095
|
+
}), pi.registerTool({
|
|
1096
|
+
name: "todo",
|
|
1097
|
+
label: "Todo",
|
|
1098
|
+
description: [
|
|
1099
|
+
"Manage the session todo list shown above the user's editor. Full-replace semantics:",
|
|
1100
|
+
"every call must send the ENTIRE list; send an empty array to clear it.",
|
|
1101
|
+
"Each item: { id, content, status: 'pending' | 'in_progress' | 'completed' }.",
|
|
1102
|
+
"Use it to track multi-step work; keep exactly one item in_progress at a time."
|
|
1103
|
+
].join(`
|
|
1104
|
+
`),
|
|
1105
|
+
parameters: typebox_exports.Object({
|
|
1106
|
+
todos: typebox_exports.Array(typebox_exports.Object({
|
|
1107
|
+
id: typebox_exports.String({ description: "Stable id for the item." }),
|
|
1108
|
+
content: typebox_exports.String({ description: "Short description of the task." }),
|
|
1109
|
+
status: typebox_exports.Union([
|
|
1110
|
+
typebox_exports.Literal("pending"),
|
|
1111
|
+
typebox_exports.Literal("in_progress"),
|
|
1112
|
+
typebox_exports.Literal("completed")
|
|
1113
|
+
])
|
|
1114
|
+
}))
|
|
1115
|
+
}),
|
|
1116
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
1117
|
+
let text2 = (t) => ({ content: [{ type: "text", text: t }] });
|
|
1118
|
+
return todos = (Array.isArray(params?.todos) ? params.todos : []).filter((t) => t && typeof t.content == "string" && t.content.trim().length > 0).map((t, i) => ({
|
|
1119
|
+
id: typeof t.id == "string" && t.id ? t.id : String(i + 1),
|
|
1120
|
+
content: t.content.trim(),
|
|
1121
|
+
status: t.status === "in_progress" || t.status === "completed" ? t.status : "pending"
|
|
1122
|
+
})), lastCtx = ctx, refreshWidget(), text2(summarizeTodos(todos));
|
|
1123
|
+
},
|
|
1124
|
+
renderCall(args, theme) {
|
|
1125
|
+
let n = Array.isArray(args?.todos) ? args.todos.length : 0, detail = n === 0 ? "clear" : `${n} item${n === 1 ? "" : "s"}`;
|
|
1126
|
+
return new Text(theme.fg("toolTitle", theme.bold("todo ")) + theme.fg("dim", detail), 0, 0);
|
|
1127
|
+
},
|
|
1128
|
+
renderResult(result, { isPartial }, theme) {
|
|
1129
|
+
if (isPartial)
|
|
1130
|
+
return new Text(theme.fg("warning", "Updating todos..."), 0, 0);
|
|
1131
|
+
let first = result?.content?.[0], summary = first?.type === "text" ? first.text : "";
|
|
1132
|
+
return new Text(theme.fg("dim", summary), 0, 0);
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-plan-tools.js
|
|
1138
|
+
import { Text as Text2 } from "@ashx-j/lunr-tui";
|
|
1139
|
+
var PRESENT_PLAN_WRONG_MODE_TEXT = "present_plan is only available in plan mode.";
|
|
1140
|
+
async function runPresentPlan(summary) {
|
|
1141
|
+
return isPlanModeActive() ? requestPlanApproval(summary) : PRESENT_PLAN_WRONG_MODE_TEXT;
|
|
1142
|
+
}
|
|
1143
|
+
function lunr_plan_tools_default(pi) {
|
|
1144
|
+
pi.registerTool({
|
|
1145
|
+
name: "present_plan",
|
|
1146
|
+
label: "Plan",
|
|
1147
|
+
description: [
|
|
1148
|
+
"Present the finished plan for user approval. Only available in plan mode.",
|
|
1149
|
+
"Call once with a concise, concrete summary of the plan; the user approves",
|
|
1150
|
+
"or declines it in a dialog. The result text says whether to implement or revise."
|
|
1151
|
+
].join(`
|
|
1152
|
+
`),
|
|
1153
|
+
parameters: typebox_exports.Object({
|
|
1154
|
+
summary: typebox_exports.String({ description: "Concise summary of the plan to approve." })
|
|
1155
|
+
}),
|
|
1156
|
+
async execute(_toolCallId, params) {
|
|
1157
|
+
let summary = typeof params?.summary == "string" ? params.summary.trim() : "";
|
|
1158
|
+
return { content: [{ type: "text", text: await runPresentPlan(summary) }] };
|
|
1159
|
+
},
|
|
1160
|
+
renderCall(_args, theme) {
|
|
1161
|
+
return new Text2(theme.fg("toolTitle", theme.bold("present_plan")), 0, 0);
|
|
1162
|
+
},
|
|
1163
|
+
renderResult(result, { isPartial }, theme) {
|
|
1164
|
+
if (isPartial)
|
|
1165
|
+
return new Text2(theme.fg("warning", "Presenting plan..."), 0, 0);
|
|
1166
|
+
let first = result?.content?.[0], text2 = first?.type === "text" ? first.text : "";
|
|
1167
|
+
return new Text2(theme.fg("dim", text2), 0, 0);
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-skill-creator/index.js
|
|
1173
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
1174
|
+
import { fileURLToPath } from "node:url";
|
|
1175
|
+
var SKILLS_DIR = join3(dirname2(fileURLToPath(new URL("../builtin-extensions/lunr-skill-creator/index.js", import.meta.url).href)), "skills");
|
|
1176
|
+
function lunr_skill_creator_default(pi) {
|
|
1177
|
+
pi.on("resources_discover", async () => ({ skillPaths: [SKILLS_DIR] }));
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
// packages/coding-agent/dist/builtin-extensions/lunr-settings-tools.js
|
|
1181
|
+
var SETTINGS_BRIDGE = /* @__PURE__ */ Symbol.for("@lunr/settings-tools"), MODEL_TIERS_BRIDGE = /* @__PURE__ */ Symbol.for("@lunr/model-tiers"), DETAILED_SETTINGS_TOOL_NAMES = [
|
|
1182
|
+
"settings_model_tiers",
|
|
1183
|
+
"settings_subscriptions",
|
|
1184
|
+
"settings_rollback",
|
|
1185
|
+
"settings_session_retention"
|
|
1186
|
+
];
|
|
1187
|
+
function settingsBridge() {
|
|
1188
|
+
let bridge = globalThis[SETTINGS_BRIDGE];
|
|
1189
|
+
if (!bridge)
|
|
1190
|
+
throw new Error("Settings are unavailable in this runtime. Reload lunR and try again.");
|
|
1191
|
+
return bridge;
|
|
1192
|
+
}
|
|
1193
|
+
function text(value, guidance) {
|
|
1194
|
+
return {
|
|
1195
|
+
content: [{ type: "text", text: `${JSON.stringify(value, null, 2)}
|
|
1196
|
+
|
|
1197
|
+
${guidance}` }],
|
|
1198
|
+
details: value
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
var thinking = typebox_exports.Union([
|
|
1202
|
+
typebox_exports.Literal("off"),
|
|
1203
|
+
typebox_exports.Literal("minimal"),
|
|
1204
|
+
typebox_exports.Literal("low"),
|
|
1205
|
+
typebox_exports.Literal("medium"),
|
|
1206
|
+
typebox_exports.Literal("high"),
|
|
1207
|
+
typebox_exports.Literal("xhigh"),
|
|
1208
|
+
typebox_exports.Literal("max"),
|
|
1209
|
+
typebox_exports.Null()
|
|
1210
|
+
], { description: "Per-tier thinking level. null inherits the parent session thinking level." });
|
|
1211
|
+
function lunrSettingsTools(pi) {
|
|
1212
|
+
let loaded = !1, registerDetailedTools = () => {
|
|
1213
|
+
loaded || (loaded = !0, pi.registerTool({
|
|
1214
|
+
name: "settings_model_tiers",
|
|
1215
|
+
label: "Model tiers",
|
|
1216
|
+
description: "Read or partially update light, standard, and heavy subagent model routes and their thinking levels. Models use provider/model ids. Omitted fields are unchanged.",
|
|
1217
|
+
parameters: typebox_exports.Object({
|
|
1218
|
+
enabled: typebox_exports.Optional(typebox_exports.Boolean({ description: "Enable or disable tier-based child routing." })),
|
|
1219
|
+
light: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Model route for light work." })),
|
|
1220
|
+
standard: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Model route for standard work." })),
|
|
1221
|
+
heavy: typebox_exports.Optional(typebox_exports.String({ minLength: 1, description: "Model route for heavy work." })),
|
|
1222
|
+
lightThinking: typebox_exports.Optional(thinking),
|
|
1223
|
+
standardThinking: typebox_exports.Optional(thinking),
|
|
1224
|
+
heavyThinking: typebox_exports.Optional(thinking)
|
|
1225
|
+
}, { additionalProperties: !1 }),
|
|
1226
|
+
async execute(_id, params) {
|
|
1227
|
+
let bridge = settingsBridge();
|
|
1228
|
+
return Object.keys(params).length > 0 && (bridge.setModelTiers(params), globalThis[MODEL_TIERS_BRIDGE]?.refreshToolDescription?.()), text(bridge.getModelTiers(), Object.keys(params).length > 0 ? "Tier routes are saved and apply to the next child launch; the subagent schema guidance is refreshed now." : "Pass only the fields you want to change. Child launches still validate model availability and authentication.");
|
|
1229
|
+
}
|
|
1230
|
+
}), pi.registerTool({
|
|
1231
|
+
name: "settings_subscriptions",
|
|
1232
|
+
label: "Subscription management",
|
|
1233
|
+
description: "Read or update automatic management of multiple stored provider subscriptions. Omit enabled to read without changing it.",
|
|
1234
|
+
parameters: typebox_exports.Object({ enabled: typebox_exports.Optional(typebox_exports.Boolean()) }, { additionalProperties: !1 }),
|
|
1235
|
+
async execute(_id, params) {
|
|
1236
|
+
let bridge = settingsBridge();
|
|
1237
|
+
return params.enabled !== void 0 && bridge.setAutoManageSubscriptions(params.enabled), text({ enabled: bridge.getAutoManageSubscriptions() }, params.enabled === void 0 ? "Set enabled to change automatic subscription selection." : "The setting is saved and applies to subsequent provider requests.");
|
|
1238
|
+
}
|
|
1239
|
+
}), pi.registerTool({
|
|
1240
|
+
name: "settings_rollback",
|
|
1241
|
+
label: "Rollback",
|
|
1242
|
+
description: "Read or partially update rollback behavior: enabled, retained turns, capture strategy, and scope. Omitted fields are unchanged. Auto permission mode force-enables rollback for its current session.",
|
|
1243
|
+
parameters: typebox_exports.Object({
|
|
1244
|
+
enabled: typebox_exports.Optional(typebox_exports.Boolean()),
|
|
1245
|
+
turns: typebox_exports.Optional(typebox_exports.Integer({ minimum: 1, maximum: 20 })),
|
|
1246
|
+
capture: typebox_exports.Optional(typebox_exports.Union([typebox_exports.Literal("copies"), typebox_exports.Literal("shadow-git"), typebox_exports.Literal("hybrid")])),
|
|
1247
|
+
scope: typebox_exports.Optional(typebox_exports.Union([typebox_exports.Literal("tools"), typebox_exports.Literal("tree")]))
|
|
1248
|
+
}, { additionalProperties: !1 }),
|
|
1249
|
+
async execute(_id, params) {
|
|
1250
|
+
let bridge = settingsBridge();
|
|
1251
|
+
Object.keys(params).length > 0 && bridge.setRollback(params);
|
|
1252
|
+
let current = bridge.getRollback();
|
|
1253
|
+
return text(current, current.forcedByAuto ? "Saved settings apply normally, but rollback remains force-enabled for this Auto-mode session." : Object.keys(params).length > 0 ? "Rollback settings are saved and live for subsequent tool calls." : "Pass only the fields you want to change.");
|
|
1254
|
+
}
|
|
1255
|
+
}), pi.registerTool({
|
|
1256
|
+
name: "settings_session_retention",
|
|
1257
|
+
label: "Session retention",
|
|
1258
|
+
description: "Read or update how many days saved sessions are retained. Set days to 0 to keep sessions forever. Cleanup applies on a later launch, not retroactively in this turn.",
|
|
1259
|
+
parameters: typebox_exports.Object({ days: typebox_exports.Optional(typebox_exports.Integer({ minimum: 0, maximum: 36500 })) }, { additionalProperties: !1 }),
|
|
1260
|
+
async execute(_id, params) {
|
|
1261
|
+
let bridge = settingsBridge();
|
|
1262
|
+
return params.days !== void 0 && bridge.setSessionRetentionDays(params.days), text({ days: bridge.getSessionRetentionDays() }, params.days === void 0 ? "Set days to change retention; 0 keeps sessions forever." : "The setting is saved. Session cleanup uses it on a later launch.");
|
|
1263
|
+
}
|
|
1264
|
+
}));
|
|
1265
|
+
};
|
|
1266
|
+
pi.registerTool({
|
|
1267
|
+
name: "settings_load",
|
|
1268
|
+
label: "Settings",
|
|
1269
|
+
description: "Load four narrow agent-managed settings tools for model tiers, subscription management, rollback, and session retention. Call only when the task requires inspecting or changing those settings.",
|
|
1270
|
+
promptSnippet: "Load narrow settings controls on demand",
|
|
1271
|
+
promptGuidelines: ["Call settings_load only when the user asks to inspect or change model tiers, subscription management, rollback, or session retention."],
|
|
1272
|
+
parameters: typebox_exports.Object({}, { additionalProperties: !1 }),
|
|
1273
|
+
async execute() {
|
|
1274
|
+
let alreadyLoaded = loaded;
|
|
1275
|
+
return registerDetailedTools(), pi.setActiveTools([.../* @__PURE__ */ new Set([...pi.getActiveTools(), ...DETAILED_SETTINGS_TOOL_NAMES])]), text({ activated: [...DETAILED_SETTINGS_TOOL_NAMES], alreadyLoaded }, "The four tools are active for the next model step and remain active in this runtime. A new runtime starts with only settings_load visible.");
|
|
1276
|
+
}
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// packages/coding-agent/dist/builtin-extensions/index.js
|
|
1281
|
+
function ext(name, factory) {
|
|
1282
|
+
return { name, factory };
|
|
1283
|
+
}
|
|
1284
|
+
var lightBuiltinExtensions = [
|
|
1285
|
+
ext("simple-pi-memory", simple_pi_memory_default),
|
|
1286
|
+
ext("pi-tps", pi_tps_default),
|
|
1287
|
+
ext("ashxj-tui", ashxj_tui_default),
|
|
1288
|
+
ext("ashxj-spinners", ashxj_spinners_default),
|
|
1289
|
+
ext("ashxj-thinking", ashxj_thinking_default),
|
|
1290
|
+
ext("lunr-local-providers", lunrLocalProviders),
|
|
1291
|
+
ext("lunr-todos", lunr_todos_default),
|
|
1292
|
+
ext("lunr-plan-tools", lunr_plan_tools_default),
|
|
1293
|
+
ext("lunr-skill-creator", lunr_skill_creator_default),
|
|
1294
|
+
ext("lunr-settings-tools", lunrSettingsTools)
|
|
1295
|
+
], DEFERRED_BUILTIN_LOADERS = [
|
|
1296
|
+
{ name: "pi-ollama-cloud", load: () => import("./pi-ollama-cloud-4VZRMULP.js") },
|
|
1297
|
+
{ name: "narumiruna-pi-goal", load: () => import("./goal-CZQ7FFQJ.js") },
|
|
1298
|
+
{ name: "lunr-cron", load: () => import("./lunr-cron-YJ5UHYRD.js") },
|
|
1299
|
+
{ name: "pi-intercom", load: () => import("./pi-intercom-EEMBGQID.js") },
|
|
1300
|
+
{ name: "pi-prompt-template-model", load: () => import("./pi-prompt-template-model-4QT4LLXF.js") },
|
|
1301
|
+
{ name: "pi-subagents", load: () => import("./pi-subagents-7XJ4H53P.js") },
|
|
1302
|
+
{ name: "pi-web-access", load: () => import("./pi-web-access-DPGAVKOA.js") },
|
|
1303
|
+
{ name: "pi-lsp-extension", load: () => import("./src-Y7JSCK64.js") },
|
|
1304
|
+
{ name: "pi-mcp-adapter", load: () => import("./pi-mcp-adapter-QFB37AVN.js") }
|
|
1305
|
+
], DEFERRED_BUILTIN_EXTENSION_NAMES = DEFERRED_BUILTIN_LOADERS.map((entry) => entry.name), DEFERRED_BUILTIN_FLAGS = ["mcp-config"];
|
|
1306
|
+
async function loadDeferredBuiltinExtensions() {
|
|
1307
|
+
return await Promise.all(DEFERRED_BUILTIN_LOADERS.map(async ({ name, load }) => {
|
|
1308
|
+
let module = await measureStartup(name, load, "imports");
|
|
1309
|
+
return ext(name, module.default);
|
|
1310
|
+
}));
|
|
1311
|
+
}
|
|
1312
|
+
async function loadAllBuiltinExtensions() {
|
|
1313
|
+
return [...lightBuiltinExtensions, ...await loadDeferredBuiltinExtensions()];
|
|
1314
|
+
}
|
|
1315
|
+
var builtinExtensions = lightBuiltinExtensions;
|
|
1316
|
+
|
|
1317
|
+
export {
|
|
1318
|
+
lightBuiltinExtensions,
|
|
1319
|
+
DEFERRED_BUILTIN_EXTENSION_NAMES,
|
|
1320
|
+
DEFERRED_BUILTIN_FLAGS,
|
|
1321
|
+
loadDeferredBuiltinExtensions,
|
|
1322
|
+
loadAllBuiltinExtensions,
|
|
1323
|
+
builtinExtensions
|
|
1324
|
+
};
|