@ashx-j/lunr-dev 0.2.13-dev.8.1 → 0.2.19-dev.10.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 +60 -1
- package/README.md +7 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -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 +8 -21
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +157 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- 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 +172 -171
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +50 -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 +131 -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 +276 -109
- 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-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.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 +68 -15
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.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 +2 -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 +72 -31
- 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 +259 -168
- 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/publication.json +12 -12
- 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-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.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/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/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +66 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +88 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +80 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +24 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +330 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- 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/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions.d.ts +1 -3
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +33 -25
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -0
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.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/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +19 -0
- package/dist/core/settings-manager.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/dev-cli.js +0 -0
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.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/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +23 -7
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +57 -48
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +12 -21
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +138 -152
- 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/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/agent-session-services-RSGP5GDN.js +39 -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-7STLFW3A.js +29 -0
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -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-4SJWFTUP.js +24 -0
- package/dist/node-runtime/chunk-4ZWGEEAS.js +69 -0
- package/dist/node-runtime/chunk-53YJI7JU.js +137 -0
- package/dist/node-runtime/chunk-5NWQCSKR.js +19218 -0
- package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
- package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
- package/dist/node-runtime/chunk-5SQDLSZJ.js +949 -0
- package/dist/node-runtime/chunk-6SPPH4FY.js +1269 -0
- package/dist/node-runtime/chunk-6UB6NKA3.js +860 -0
- package/dist/node-runtime/chunk-7AFOFSDY.js +105 -0
- package/dist/node-runtime/chunk-7N3YHTYF.js +26 -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-BKAZ6BKX.js +2185 -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-CGBXPL3E.js +1171 -0
- package/dist/node-runtime/chunk-CH6OL6P2.js +295 -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-EH2LJQPM.js +64 -0
- package/dist/node-runtime/chunk-EHMBW7FA.js +772 -0
- package/dist/node-runtime/chunk-FLYMHKCS.js +966 -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-HRS4HMDX.js +610 -0
- package/dist/node-runtime/chunk-HYHJIRDW.js +19 -0
- package/dist/node-runtime/chunk-I6R76AG7.js +22 -0
- package/dist/node-runtime/chunk-ISQDQIZN.js +296 -0
- package/dist/node-runtime/chunk-J7QGQD45.js +24921 -0
- package/dist/node-runtime/chunk-JHYKXIMM.js +378 -0
- package/dist/node-runtime/chunk-JT6YCS5B.js +5648 -0
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/chunk-K72NVGUB.js +2834 -0
- package/dist/node-runtime/chunk-KKSIVROT.js +88 -0
- package/dist/node-runtime/chunk-LCACDWHJ.js +1743 -0
- package/dist/node-runtime/chunk-LTXUQJI4.js +173 -0
- package/dist/node-runtime/chunk-LWJXTA6Z.js +6814 -0
- package/dist/node-runtime/chunk-M3LZLQW2.js +98 -0
- package/dist/node-runtime/chunk-MGSB2C3M.js +46 -0
- package/dist/node-runtime/chunk-MGWCVY6Y.js +47 -0
- package/dist/node-runtime/chunk-MJQDX3BA.js +72 -0
- package/dist/node-runtime/chunk-MUMMMTW4.js +8392 -0
- package/dist/node-runtime/chunk-MX3GJNXJ.js +986 -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-OTT6JMPU.js +807 -0
- package/dist/node-runtime/chunk-PCIGF2XK.js +250 -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-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-T5GM5BFH.js +7558 -0
- package/dist/node-runtime/chunk-TAP7QTUT.js +1346 -0
- package/dist/node-runtime/chunk-U6C7VTR5.js +2033 -0
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/chunk-VRB2IYGG.js +53 -0
- package/dist/node-runtime/chunk-W3CVH5RX.js +62 -0
- package/dist/node-runtime/chunk-W7S2REEG.js +9478 -0
- package/dist/node-runtime/chunk-XBWPBZBN.js +125 -0
- package/dist/node-runtime/chunk-XTHQ7XR7.js +509 -0
- package/dist/node-runtime/chunk-ZCHMJ34K.js +130 -0
- package/dist/node-runtime/chunk-ZRDIMBEQ.js +651 -0
- package/dist/node-runtime/chunk-ZSEZY3II.js +247 -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-6UXQ6XZN.js +13 -0
- package/dist/node-runtime/commands-LGR5VT5X.js +293 -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-TDJS7TBD.js +191 -0
- package/dist/node-runtime/exa-LL64QZR2.js +329 -0
- package/dist/node-runtime/export-html-E4DT6ZJQ.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-IUCVZCWC.js +17 -0
- package/dist/node-runtime/file-sync-HCOP2QVF.js +117 -0
- package/dist/node-runtime/gateway-3OLC4GQN.js +2139 -0
- package/dist/node-runtime/gemini-api-QE7ANVDZ.js +29 -0
- package/dist/node-runtime/gemini-search-NCIDF7NE.js +330 -0
- package/dist/node-runtime/gemini-url-context-OKIN7AIP.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/image-resize-6ZPBFMWW.js +11 -0
- package/dist/node-runtime/index.js +863 -0
- package/dist/node-runtime/init-EKE277AG.js +30 -0
- package/dist/node-runtime/install-cli-TH7IJJQQ.js +308 -0
- package/dist/node-runtime/interactive-mode-S5M26CQ7.js +59 -0
- package/dist/node-runtime/interactive-view-N6F4KUIT.js +247 -0
- package/dist/node-runtime/lsp-manager-3ASUSO4T.js +1104 -0
- package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
- package/dist/node-runtime/lunr-cron-KKBOGAEF.js +274 -0
- package/dist/node-runtime/main.js +57 -0
- package/dist/node-runtime/mcp-auth-flow-YL6RWPYG.js +33 -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-C4EJOO5Q.js +751 -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-DPTJGAAL.js +428 -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-VKCLYIBY.js +6050 -0
- package/dist/node-runtime/pi-web-access-BV6DSZOP.js +1867 -0
- package/dist/node-runtime/print-mode-VWIRFDAC.js +12 -0
- package/dist/node-runtime/proxy-modes-R64LU6WZ.js +688 -0
- package/dist/node-runtime/rpc-entry.js +65 -0
- package/dist/node-runtime/rpc-mode-SJNSOA4G.js +13 -0
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/runtime-bridges-UJ5WJJLN.js +14 -0
- package/dist/node-runtime/session-manager-QEMZBMTM.js +33 -0
- package/dist/node-runtime/session-selector-URVJLOTK.js +14 -0
- package/dist/node-runtime/settings-manager-K6IPIQTI.js +23 -0
- package/dist/node-runtime/src-GPFAU3N6.js +2427 -0
- package/dist/node-runtime/subagent-executor-EFLTO32A.js +8501 -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-I6OVDRPL.js +75 -0
- package/dist/node-runtime/v4-5MNC3H7G.js +424 -0
- package/dist/node-runtime/video-extract-ETA5RA7U.js +304 -0
- package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
- package/dist/node-runtime/workspace-index-6DBXSTJ6.js +163 -0
- package/dist/node-runtime/youtube-extract-SRVGNN26.js +264 -0
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -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-shell.d.ts → interactive-view.d.ts} +18 -18
- package/dist/startup/interactive-view.d.ts.map +1 -0
- package/dist/startup/{interactive-shell.js → interactive-view.js} +119 -52
- 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/computer-use.md +277 -0
- package/docs/development.md +5 -33
- package/docs/features.md +2 -3
- package/docs/interactive-startup.md +105 -0
- package/docs/keybindings.md +2 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -2
- 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/hidden-thinking-label.ts +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/install-lock/package-lock.json +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +30 -24
- 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
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js.map +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
loadPhoton
|
|
4
|
+
} from "./chunk-RQ2Q5IYR.js";
|
|
5
|
+
|
|
6
|
+
// packages/coding-agent/dist/utils/image-resize.js
|
|
7
|
+
import { Worker } from "node:worker_threads";
|
|
8
|
+
|
|
9
|
+
// packages/coding-agent/dist/utils/exif-orientation.js
|
|
10
|
+
function readOrientationFromTiff(bytes, tiffStart) {
|
|
11
|
+
if (tiffStart + 8 > bytes.length)
|
|
12
|
+
return 1;
|
|
13
|
+
let le = (bytes[tiffStart] << 8 | bytes[tiffStart + 1]) === 18761, read16 = (pos) => le ? bytes[pos] | bytes[pos + 1] << 8 : bytes[pos] << 8 | bytes[pos + 1], ifdOffset = ((pos) => le ? bytes[pos] | bytes[pos + 1] << 8 | bytes[pos + 2] << 16 | bytes[pos + 3] << 24 : (bytes[pos] << 24 | bytes[pos + 1] << 16 | bytes[pos + 2] << 8 | bytes[pos + 3]) >>> 0)(tiffStart + 4), ifdStart = tiffStart + ifdOffset;
|
|
14
|
+
if (ifdStart + 2 > bytes.length)
|
|
15
|
+
return 1;
|
|
16
|
+
let entryCount = read16(ifdStart);
|
|
17
|
+
for (let i = 0; i < entryCount; i++) {
|
|
18
|
+
let entryPos = ifdStart + 2 + i * 12;
|
|
19
|
+
if (entryPos + 12 > bytes.length)
|
|
20
|
+
return 1;
|
|
21
|
+
if (read16(entryPos) === 274) {
|
|
22
|
+
let value = read16(entryPos + 8);
|
|
23
|
+
return value >= 1 && value <= 8 ? value : 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
function findJpegTiffOffset(bytes) {
|
|
29
|
+
let offset = 2;
|
|
30
|
+
for (; offset < bytes.length - 1; ) {
|
|
31
|
+
if (bytes[offset] !== 255)
|
|
32
|
+
return -1;
|
|
33
|
+
let marker = bytes[offset + 1];
|
|
34
|
+
if (marker === 255) {
|
|
35
|
+
offset++;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (marker === 225) {
|
|
39
|
+
if (offset + 4 >= bytes.length)
|
|
40
|
+
return -1;
|
|
41
|
+
let segmentStart = offset + 4;
|
|
42
|
+
return segmentStart + 6 > bytes.length || !hasExifHeader(bytes, segmentStart) ? -1 : segmentStart + 6;
|
|
43
|
+
}
|
|
44
|
+
if (offset + 4 > bytes.length)
|
|
45
|
+
return -1;
|
|
46
|
+
let length = bytes[offset + 2] << 8 | bytes[offset + 3];
|
|
47
|
+
offset += 2 + length;
|
|
48
|
+
}
|
|
49
|
+
return -1;
|
|
50
|
+
}
|
|
51
|
+
function findWebpTiffOffset(bytes) {
|
|
52
|
+
let offset = 12;
|
|
53
|
+
for (; offset + 8 <= bytes.length; ) {
|
|
54
|
+
let chunkId = String.fromCharCode(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3]), chunkSize = bytes[offset + 4] | bytes[offset + 5] << 8 | bytes[offset + 6] << 16 | bytes[offset + 7] << 24, dataStart = offset + 8;
|
|
55
|
+
if (chunkId === "EXIF")
|
|
56
|
+
return dataStart + chunkSize > bytes.length ? -1 : chunkSize >= 6 && hasExifHeader(bytes, dataStart) ? dataStart + 6 : dataStart;
|
|
57
|
+
offset = dataStart + chunkSize + chunkSize % 2;
|
|
58
|
+
}
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
function hasExifHeader(bytes, offset) {
|
|
62
|
+
return bytes[offset] === 69 && bytes[offset + 1] === 120 && bytes[offset + 2] === 105 && bytes[offset + 3] === 102 && bytes[offset + 4] === 0 && bytes[offset + 5] === 0;
|
|
63
|
+
}
|
|
64
|
+
function getExifOrientation(bytes) {
|
|
65
|
+
let tiffOffset = -1;
|
|
66
|
+
return bytes.length >= 2 && bytes[0] === 255 && bytes[1] === 216 ? tiffOffset = findJpegTiffOffset(bytes) : bytes.length >= 12 && bytes[0] === 82 && bytes[1] === 73 && bytes[2] === 70 && bytes[3] === 70 && bytes[8] === 87 && bytes[9] === 69 && bytes[10] === 66 && bytes[11] === 80 && (tiffOffset = findWebpTiffOffset(bytes)), tiffOffset === -1 ? 1 : readOrientationFromTiff(bytes, tiffOffset);
|
|
67
|
+
}
|
|
68
|
+
function rotate90(photon, image, dstIndex) {
|
|
69
|
+
let w = image.get_width(), h = image.get_height(), src = image.get_raw_pixels(), dst = new Uint8Array(src.length);
|
|
70
|
+
for (let y = 0; y < h; y++)
|
|
71
|
+
for (let x = 0; x < w; x++) {
|
|
72
|
+
let srcIdx = (y * w + x) * 4, dstIdx = dstIndex(x, y, w, h) * 4;
|
|
73
|
+
dst[dstIdx] = src[srcIdx], dst[dstIdx + 1] = src[srcIdx + 1], dst[dstIdx + 2] = src[srcIdx + 2], dst[dstIdx + 3] = src[srcIdx + 3];
|
|
74
|
+
}
|
|
75
|
+
return new photon.PhotonImage(dst, h, w);
|
|
76
|
+
}
|
|
77
|
+
function applyExifOrientation(photon, image, originalBytes) {
|
|
78
|
+
let orientation = getExifOrientation(originalBytes);
|
|
79
|
+
if (orientation === 1)
|
|
80
|
+
return image;
|
|
81
|
+
switch (orientation) {
|
|
82
|
+
case 2:
|
|
83
|
+
return photon.fliph(image), image;
|
|
84
|
+
case 3:
|
|
85
|
+
return photon.fliph(image), photon.flipv(image), image;
|
|
86
|
+
case 4:
|
|
87
|
+
return photon.flipv(image), image;
|
|
88
|
+
case 5: {
|
|
89
|
+
let rotated = rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
90
|
+
return photon.fliph(rotated), rotated;
|
|
91
|
+
}
|
|
92
|
+
case 6:
|
|
93
|
+
return rotate90(photon, image, (x, y, _w, h) => x * h + (h - 1 - y));
|
|
94
|
+
case 7: {
|
|
95
|
+
let rotated = rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
96
|
+
return photon.fliph(rotated), rotated;
|
|
97
|
+
}
|
|
98
|
+
case 8:
|
|
99
|
+
return rotate90(photon, image, (x, y, w, h) => (w - 1 - x) * h + y);
|
|
100
|
+
default:
|
|
101
|
+
return image;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// packages/coding-agent/dist/utils/image-resize-core.js
|
|
106
|
+
var DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024, DEFAULT_OPTIONS = {
|
|
107
|
+
maxWidth: 2e3,
|
|
108
|
+
maxHeight: 2e3,
|
|
109
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
110
|
+
jpegQuality: 80
|
|
111
|
+
};
|
|
112
|
+
function encodeCandidate(buffer, mimeType) {
|
|
113
|
+
let data = Buffer.from(buffer).toString("base64");
|
|
114
|
+
return {
|
|
115
|
+
data,
|
|
116
|
+
encodedSize: Buffer.byteLength(data, "utf-8"),
|
|
117
|
+
mimeType
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
121
|
+
let opts = { ...DEFAULT_OPTIONS, ...options }, inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4, photon = await loadPhoton();
|
|
122
|
+
if (!photon)
|
|
123
|
+
return null;
|
|
124
|
+
let image;
|
|
125
|
+
try {
|
|
126
|
+
let tryEncodings = function(width, height, jpegQualities) {
|
|
127
|
+
let resized = photon.resize(image, width, height, photon.SamplingFilter.Lanczos3);
|
|
128
|
+
try {
|
|
129
|
+
let candidates = [encodeCandidate(resized.get_bytes(), "image/png")];
|
|
130
|
+
for (let quality of jpegQualities)
|
|
131
|
+
candidates.push(encodeCandidate(resized.get_bytes_jpeg(quality), "image/jpeg"));
|
|
132
|
+
return candidates;
|
|
133
|
+
} finally {
|
|
134
|
+
resized.free();
|
|
135
|
+
}
|
|
136
|
+
}, rawImage = photon.PhotonImage.new_from_byteslice(inputBytes);
|
|
137
|
+
image = applyExifOrientation(photon, rawImage, inputBytes), image !== rawImage && rawImage.free();
|
|
138
|
+
let originalWidth = image.get_width(), originalHeight = image.get_height(), format = mimeType.split("/")[1] ?? "png";
|
|
139
|
+
if (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes)
|
|
140
|
+
return {
|
|
141
|
+
data: Buffer.from(inputBytes).toString("base64"),
|
|
142
|
+
mimeType: mimeType || `image/${format}`,
|
|
143
|
+
originalWidth,
|
|
144
|
+
originalHeight,
|
|
145
|
+
width: originalWidth,
|
|
146
|
+
height: originalHeight,
|
|
147
|
+
wasResized: !1
|
|
148
|
+
};
|
|
149
|
+
let targetWidth = originalWidth, targetHeight = originalHeight;
|
|
150
|
+
targetWidth > opts.maxWidth && (targetHeight = Math.round(targetHeight * opts.maxWidth / targetWidth), targetWidth = opts.maxWidth), targetHeight > opts.maxHeight && (targetWidth = Math.round(targetWidth * opts.maxHeight / targetHeight), targetHeight = opts.maxHeight);
|
|
151
|
+
let qualitySteps = Array.from(/* @__PURE__ */ new Set([opts.jpegQuality, 85, 70, 55, 40])), currentWidth = targetWidth, currentHeight = targetHeight;
|
|
152
|
+
for (; ; ) {
|
|
153
|
+
let candidates = tryEncodings(currentWidth, currentHeight, qualitySteps);
|
|
154
|
+
for (let candidate of candidates)
|
|
155
|
+
if (candidate.encodedSize < opts.maxBytes)
|
|
156
|
+
return {
|
|
157
|
+
data: candidate.data,
|
|
158
|
+
mimeType: candidate.mimeType,
|
|
159
|
+
originalWidth,
|
|
160
|
+
originalHeight,
|
|
161
|
+
width: currentWidth,
|
|
162
|
+
height: currentHeight,
|
|
163
|
+
wasResized: !0
|
|
164
|
+
};
|
|
165
|
+
if (currentWidth === 1 && currentHeight === 1)
|
|
166
|
+
break;
|
|
167
|
+
let nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75)), nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));
|
|
168
|
+
if (nextWidth === currentWidth && nextHeight === currentHeight)
|
|
169
|
+
break;
|
|
170
|
+
currentWidth = nextWidth, currentHeight = nextHeight;
|
|
171
|
+
}
|
|
172
|
+
return null;
|
|
173
|
+
} catch {
|
|
174
|
+
return null;
|
|
175
|
+
} finally {
|
|
176
|
+
image && image.free();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// packages/coding-agent/dist/utils/image-resize.js
|
|
181
|
+
function toTransferableBytes(input) {
|
|
182
|
+
return new Uint8Array(input);
|
|
183
|
+
}
|
|
184
|
+
function isResizeImageWorkerResponse(value) {
|
|
185
|
+
return value !== null && typeof value == "object";
|
|
186
|
+
}
|
|
187
|
+
function createResizeWorker(workerSpecifier) {
|
|
188
|
+
return new Worker(workerSpecifier);
|
|
189
|
+
}
|
|
190
|
+
async function resizeImageInWorker(workerSpecifier, inputBytes, mimeType, options) {
|
|
191
|
+
let worker = createResizeWorker(workerSpecifier);
|
|
192
|
+
try {
|
|
193
|
+
let inputBytesForWorker = toTransferableBytes(inputBytes);
|
|
194
|
+
return await new Promise((resolve, reject) => {
|
|
195
|
+
let settled = !1, settle = (result) => {
|
|
196
|
+
settled || (settled = !0, resolve(result));
|
|
197
|
+
}, fail = (error) => {
|
|
198
|
+
settled || (settled = !0, reject(error));
|
|
199
|
+
};
|
|
200
|
+
worker.once("message", (message) => {
|
|
201
|
+
if (!isResizeImageWorkerResponse(message)) {
|
|
202
|
+
fail(new Error("Invalid image resize worker response"));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (message.error) {
|
|
206
|
+
fail(new Error(message.error));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
settle(message.result ?? null);
|
|
210
|
+
}), worker.once("error", fail), worker.once("exit", (code) => {
|
|
211
|
+
settled || fail(new Error(`Image resize worker exited with code ${code}`));
|
|
212
|
+
}), worker.postMessage({
|
|
213
|
+
inputBytes: inputBytesForWorker,
|
|
214
|
+
mimeType,
|
|
215
|
+
options
|
|
216
|
+
}, [inputBytesForWorker.buffer]);
|
|
217
|
+
});
|
|
218
|
+
} finally {
|
|
219
|
+
worker.terminate().catch(() => {
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async function resizeImage(inputBytes, mimeType, options) {
|
|
224
|
+
let isTypeScriptRuntime = new URL("../utils/image-resize.js", import.meta.url).href.endsWith(".ts"), workerUrl = new URL(isTypeScriptRuntime ? "./image-resize-worker.ts" : "./image-resize-worker.js", new URL("../utils/image-resize.js", import.meta.url).href);
|
|
225
|
+
if (typeof process.versions.bun == "string")
|
|
226
|
+
try {
|
|
227
|
+
return await resizeImageInWorker("./src/utils/image-resize-worker.ts", inputBytes, mimeType, options);
|
|
228
|
+
} catch {
|
|
229
|
+
}
|
|
230
|
+
try {
|
|
231
|
+
return await resizeImageInWorker(workerUrl, inputBytes, mimeType, options);
|
|
232
|
+
} catch {
|
|
233
|
+
return resizeImageInProcess(inputBytes, mimeType, options);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function formatDimensionNote(result) {
|
|
237
|
+
if (!result.wasResized)
|
|
238
|
+
return;
|
|
239
|
+
let scale = result.originalWidth / result.width;
|
|
240
|
+
return `[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export {
|
|
244
|
+
applyExifOrientation,
|
|
245
|
+
resizeImage,
|
|
246
|
+
formatDimensionNote
|
|
247
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
parseArgs
|
|
5
|
+
} from "./chunk-DDGMHUOW.js";
|
|
6
|
+
import {
|
|
7
|
+
markStartupMilestone
|
|
8
|
+
} from "./chunk-CCZJ3PYY.js";
|
|
9
|
+
import {
|
|
10
|
+
isNodeBundle
|
|
11
|
+
} from "./chunk-PCIGF2XK.js";
|
|
12
|
+
import "./chunk-Q4Q6D4IY.js";
|
|
13
|
+
import "./chunk-BRJX2PRC.js";
|
|
14
|
+
|
|
15
|
+
// packages/coding-agent/dist/cli-runtime.js
|
|
16
|
+
import { enableCompileCache } from "node:module";
|
|
17
|
+
import { homedir } from "node:os";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
|
|
20
|
+
// packages/coding-agent/dist/startup/launch-routing.js
|
|
21
|
+
var DEFERRED_COMMANDS = /* @__PURE__ */ new Set([
|
|
22
|
+
"config",
|
|
23
|
+
"features",
|
|
24
|
+
"gateway",
|
|
25
|
+
"install",
|
|
26
|
+
"list",
|
|
27
|
+
"remove",
|
|
28
|
+
"setup",
|
|
29
|
+
"uninstall",
|
|
30
|
+
"update"
|
|
31
|
+
]);
|
|
32
|
+
function resolvePreloadLaunchMode(args2, environment) {
|
|
33
|
+
if (DEFERRED_COMMANDS.has(args2[0] ?? ""))
|
|
34
|
+
return "deferred";
|
|
35
|
+
let parsed = parseArgs([...args2]);
|
|
36
|
+
return parsed.help || parsed.version || parsed.print || parsed.export || parsed.listModels !== void 0 || parsed.mode === "rpc" || parsed.mode === "json" ? "deferred" : environment.startupBenchmark || environment.stdinIsTTY && environment.stdoutIsTTY ? "interactive" : "deferred";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// packages/coding-agent/dist/cli-runtime.js
|
|
40
|
+
markStartupMilestone("process_entry");
|
|
41
|
+
var startupAppName = process.env.PI_CODING_AGENT_DEV === "1" ? "lunr-dev" : "lunr";
|
|
42
|
+
process.title = startupAppName;
|
|
43
|
+
process.stdout.isTTY && process.stdout.write(`\x1B]0;${startupAppName}\x07`);
|
|
44
|
+
if (!isNodeBundle)
|
|
45
|
+
try {
|
|
46
|
+
let agentDir = process.env.PI_CODING_AGENT_DIR?.trim() || join(homedir(), ".lunr", "agent");
|
|
47
|
+
enableCompileCache(join(agentDir, "compile-cache"));
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
process.env.PI_CODING_AGENT = "true";
|
|
51
|
+
process.emitWarning = (() => {
|
|
52
|
+
});
|
|
53
|
+
var args = process.argv.slice(2), startupBenchmark = process.env.PI_STARTUP_BENCHMARK === "1", preloadMode = resolvePreloadLaunchMode(args, {
|
|
54
|
+
stdinIsTTY: process.stdin.isTTY === !0,
|
|
55
|
+
stdoutIsTTY: process.stdout.isTTY === !0,
|
|
56
|
+
startupBenchmark
|
|
57
|
+
});
|
|
58
|
+
markStartupMilestone("mode_routed");
|
|
59
|
+
var startupView;
|
|
60
|
+
if (preloadMode === "interactive") {
|
|
61
|
+
let { InteractiveView } = await import("./interactive-view-N6F4KUIT.js");
|
|
62
|
+
startupView = new InteractiveView(), startupView.start(), await startupView.waitForFirstFrame(), startupView.isExitRequested && process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
var startRuntime = async () => {
|
|
65
|
+
let importStarted = performance.now();
|
|
66
|
+
try {
|
|
67
|
+
let [{ APP_NAME }, { main }, { noteImportMain }] = await Promise.all([
|
|
68
|
+
import("./config-FMEOZSWE.js"),
|
|
69
|
+
import("./main.js"),
|
|
70
|
+
import("./timings-UAD5BEAS.js")
|
|
71
|
+
]);
|
|
72
|
+
noteImportMain(performance.now() - importStarted), process.title = APP_NAME, await main(args, { startupView });
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (startupBenchmark && console.error(error), startupView && !startupView.isExitRequested)
|
|
75
|
+
process.exitCode = 1, await startupView.fail(error);
|
|
76
|
+
else
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
process.once("exit", () => startupView?.stop());
|
|
81
|
+
startupView ? (await Promise.race([startRuntime(), startupView.waitForExit()]), startupView.isExitRequested && process.exit(process.exitCode ?? 0)) : await startRuntime();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
copyToClipboard,
|
|
4
|
+
readClipboardText
|
|
5
|
+
} from "./chunk-Q5ZU2VRT.js";
|
|
6
|
+
import "./chunk-NUIFPZWX.js";
|
|
7
|
+
import "./chunk-RQ2Q5IYR.js";
|
|
8
|
+
import "./chunk-BRJX2PRC.js";
|
|
9
|
+
export {
|
|
10
|
+
copyToClipboard,
|
|
11
|
+
readClipboardText
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
extensionForImageMimeType,
|
|
4
|
+
isWaylandSession,
|
|
5
|
+
readClipboardImage
|
|
6
|
+
} from "./chunk-NUIFPZWX.js";
|
|
7
|
+
import "./chunk-RQ2Q5IYR.js";
|
|
8
|
+
import "./chunk-BRJX2PRC.js";
|
|
9
|
+
export {
|
|
10
|
+
extensionForImageMimeType,
|
|
11
|
+
isWaylandSession,
|
|
12
|
+
readClipboardImage
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import "./chunk-BRJX2PRC.js";
|
|
3
|
+
|
|
4
|
+
// packages/coding-agent/dist/gateway/command.js
|
|
5
|
+
async function handleGatewayCommand(args) {
|
|
6
|
+
if (args[0] !== "gateway")
|
|
7
|
+
return !1;
|
|
8
|
+
let { runGateway } = await import("./gateway-3OLC4GQN.js"), code = await runGateway(args.slice(1));
|
|
9
|
+
return process.exitCode = code, !0;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
handleGatewayCommand
|
|
13
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
buildToolMetadata,
|
|
4
|
+
getFailureAgeSeconds,
|
|
5
|
+
lazyConnect,
|
|
6
|
+
updateMetadataCache,
|
|
7
|
+
updateStatusBar
|
|
8
|
+
} from "./chunk-BKAZ6BKX.js";
|
|
9
|
+
import {
|
|
10
|
+
ensureCompatibilityImports,
|
|
11
|
+
getMcpDiscoverySummary,
|
|
12
|
+
getServerProvenance,
|
|
13
|
+
loadMetadataCache,
|
|
14
|
+
openPath,
|
|
15
|
+
previewCompatibilityImports,
|
|
16
|
+
previewSharedServerEntry,
|
|
17
|
+
previewStarterProjectConfig,
|
|
18
|
+
writeDirectToolsConfig,
|
|
19
|
+
writeSharedServerEntry,
|
|
20
|
+
writeStarterProjectConfig
|
|
21
|
+
} from "./chunk-EHMBW7FA.js";
|
|
22
|
+
import "./chunk-ARC4KOTI.js";
|
|
23
|
+
import "./chunk-LWJXTA6Z.js";
|
|
24
|
+
import {
|
|
25
|
+
authenticate,
|
|
26
|
+
getAuthForUrl,
|
|
27
|
+
removeAuth,
|
|
28
|
+
supportsOAuth
|
|
29
|
+
} from "./chunk-U6C7VTR5.js";
|
|
30
|
+
import {
|
|
31
|
+
getAgentPath
|
|
32
|
+
} from "./chunk-4HXHDDCF.js";
|
|
33
|
+
import "./chunk-2IDTZAG5.js";
|
|
34
|
+
import "./chunk-BI3DHYCN.js";
|
|
35
|
+
import "./chunk-Q4Q6D4IY.js";
|
|
36
|
+
import "./chunk-BRJX2PRC.js";
|
|
37
|
+
|
|
38
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/onboarding-state.js
|
|
39
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync } from "node:fs";
|
|
40
|
+
import { dirname } from "node:path";
|
|
41
|
+
var DEFAULT_STATE = {
|
|
42
|
+
version: 1,
|
|
43
|
+
sharedConfigHintShown: !1,
|
|
44
|
+
setupCompleted: !1
|
|
45
|
+
};
|
|
46
|
+
function getOnboardingStatePath() {
|
|
47
|
+
return getAgentPath("mcp-onboarding.json");
|
|
48
|
+
}
|
|
49
|
+
function loadOnboardingState() {
|
|
50
|
+
let path = getOnboardingStatePath();
|
|
51
|
+
if (!existsSync(path))
|
|
52
|
+
return { ...DEFAULT_STATE };
|
|
53
|
+
try {
|
|
54
|
+
let raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
55
|
+
return !raw || typeof raw != "object" ? { ...DEFAULT_STATE } : {
|
|
56
|
+
version: 1,
|
|
57
|
+
sharedConfigHintShown: raw.sharedConfigHintShown === !0,
|
|
58
|
+
setupCompleted: raw.setupCompleted === !0,
|
|
59
|
+
lastDiscoveryFingerprint: typeof raw.lastDiscoveryFingerprint == "string" ? raw.lastDiscoveryFingerprint : void 0
|
|
60
|
+
};
|
|
61
|
+
} catch {
|
|
62
|
+
return { ...DEFAULT_STATE };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function saveOnboardingState(state) {
|
|
66
|
+
let path = getOnboardingStatePath();
|
|
67
|
+
mkdirSync(dirname(path), { recursive: !0 });
|
|
68
|
+
let tmpPath = `${path}.${process.pid}.tmp`;
|
|
69
|
+
writeFileSync(tmpPath, `${JSON.stringify(state, null, 2)}
|
|
70
|
+
`, "utf-8"), renameSync(tmpPath, path);
|
|
71
|
+
}
|
|
72
|
+
function updateOnboardingState(updater) {
|
|
73
|
+
let next = updater(loadOnboardingState());
|
|
74
|
+
return saveOnboardingState(next), next;
|
|
75
|
+
}
|
|
76
|
+
function markSharedConfigHintShown(fingerprint) {
|
|
77
|
+
return updateOnboardingState((state) => ({
|
|
78
|
+
...state,
|
|
79
|
+
sharedConfigHintShown: !0,
|
|
80
|
+
lastDiscoveryFingerprint: fingerprint ?? state.lastDiscoveryFingerprint
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
function markSetupCompleted(fingerprint) {
|
|
84
|
+
return updateOnboardingState((state) => ({
|
|
85
|
+
...state,
|
|
86
|
+
setupCompleted: !0,
|
|
87
|
+
lastDiscoveryFingerprint: fingerprint ?? state.lastDiscoveryFingerprint
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// packages/coding-agent/dist/builtin-extensions/pi-mcp-adapter/commands.js
|
|
92
|
+
async function showStatus(state, ctx) {
|
|
93
|
+
if (!ctx.hasUI)
|
|
94
|
+
return;
|
|
95
|
+
let lines = ["MCP Server Status:", ""];
|
|
96
|
+
for (let name of Object.keys(state.config.mcpServers)) {
|
|
97
|
+
let connection = state.manager.getConnection(name), metadata = state.toolMetadata.get(name), toolCount = metadata?.length ?? 0, failedAgo = getFailureAgeSeconds(state, name), status = "not connected", statusIcon = "\u25CB", failed = !1;
|
|
98
|
+
connection?.status === "connected" ? (status = "connected", statusIcon = "\u2713") : connection?.status === "needs-auth" ? (status = "needs auth", statusIcon = "\u26A0") : failedAgo !== null ? (status = `failed ${failedAgo}s ago`, statusIcon = "\u2717", failed = !0) : metadata !== void 0 && (status = "cached");
|
|
99
|
+
let toolSuffix = failed ? "" : ` (${toolCount} tools${status === "cached" ? ", cached" : ""})`;
|
|
100
|
+
lines.push(`${statusIcon} ${name}: ${status}${toolSuffix}`);
|
|
101
|
+
}
|
|
102
|
+
Object.keys(state.config.mcpServers).length === 0 && (lines.push("No MCP servers configured"), lines.push("Run /mcp setup to adopt imports or scaffold a starter .mcp.json")), ctx.ui.notify(lines.join(`
|
|
103
|
+
`), "info");
|
|
104
|
+
}
|
|
105
|
+
async function showTools(state, ctx) {
|
|
106
|
+
if (!ctx.hasUI)
|
|
107
|
+
return;
|
|
108
|
+
let allTools = [...state.toolMetadata.values()].flat().map((m) => m.name);
|
|
109
|
+
if (allTools.length === 0) {
|
|
110
|
+
ctx.ui.notify("No MCP tools available", "info");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let lines = [
|
|
114
|
+
"MCP Tools:",
|
|
115
|
+
"",
|
|
116
|
+
...allTools.map((t) => ` ${t}`),
|
|
117
|
+
"",
|
|
118
|
+
`Total: ${allTools.length} tools`
|
|
119
|
+
];
|
|
120
|
+
ctx.ui.notify(lines.join(`
|
|
121
|
+
`), "info");
|
|
122
|
+
}
|
|
123
|
+
async function reconnectServers(state, ctx, targetServer) {
|
|
124
|
+
if (targetServer && !state.config.mcpServers[targetServer]) {
|
|
125
|
+
ctx.hasUI && ctx.ui.notify(`Server "${targetServer}" not found in config`, "error");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let entries = targetServer ? [[targetServer, state.config.mcpServers[targetServer]]] : Object.entries(state.config.mcpServers);
|
|
129
|
+
for (let [name, definition] of entries)
|
|
130
|
+
try {
|
|
131
|
+
await state.manager.close(name);
|
|
132
|
+
let connection = await state.manager.connect(name, definition);
|
|
133
|
+
if (connection.status === "needs-auth") {
|
|
134
|
+
ctx.hasUI && ctx.ui.notify(`MCP: ${name} requires OAuth. Run /mcp-auth ${name} first.`, "warning");
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
let prefix = state.config.settings?.toolPrefix ?? "server", { metadata, failedTools } = buildToolMetadata(connection.tools, connection.resources, definition, name, prefix);
|
|
138
|
+
state.toolMetadata.set(name, metadata), updateMetadataCache(state, name), state.failureTracker.delete(name), ctx.hasUI && (ctx.ui.notify(`MCP: Reconnected to ${name} (${connection.tools.length} tools, ${connection.resources.length} resources)`, "info"), failedTools.length > 0 && ctx.ui.notify(`MCP: ${name} - ${failedTools.length} tools skipped`, "warning"));
|
|
139
|
+
} catch (error) {
|
|
140
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
141
|
+
state.failureTracker.set(name, Date.now()), ctx.hasUI && ctx.ui.notify(`MCP: Failed to reconnect to ${name}: ${message}`, "error");
|
|
142
|
+
}
|
|
143
|
+
updateStatusBar(state);
|
|
144
|
+
}
|
|
145
|
+
async function authenticateServer(serverName, config, ctx) {
|
|
146
|
+
if (!ctx.hasUI)
|
|
147
|
+
return { ok: !1, message: "OAuth authentication requires an interactive session." };
|
|
148
|
+
let definition = config.mcpServers[serverName];
|
|
149
|
+
if (!definition) {
|
|
150
|
+
let message = `Server "${serverName}" not found in config`;
|
|
151
|
+
return ctx.ui.notify(message, "error"), { ok: !1, message };
|
|
152
|
+
}
|
|
153
|
+
if (!supportsOAuth(definition)) {
|
|
154
|
+
let message = `Server "${serverName}" does not use OAuth authentication. Set "auth": "oauth" or omit auth for auto-detection.`;
|
|
155
|
+
return ctx.ui.notify(`Server "${serverName}" does not use OAuth authentication.
|
|
156
|
+
Set "auth": "oauth" or omit auth for auto-detection.`, "error"), { ok: !1, message };
|
|
157
|
+
}
|
|
158
|
+
if (!definition.url) {
|
|
159
|
+
let message = `Server "${serverName}" has no URL configured (OAuth requires HTTP transport)`;
|
|
160
|
+
return ctx.ui.notify(message, "error"), { ok: !1, message };
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
if (ctx.ui.setStatus("mcp-auth", `Authenticating ${serverName}...`), await authenticate(serverName, definition.url, definition, {
|
|
164
|
+
onAuthorizationUrl: (authorizationUrl) => {
|
|
165
|
+
ctx.ui.notify(`Open this URL to authenticate ${serverName}:
|
|
166
|
+
|
|
167
|
+
${authorizationUrl}
|
|
168
|
+
|
|
169
|
+
After approving, return to Pi; the local callback will complete automatically.`, "info");
|
|
170
|
+
}
|
|
171
|
+
}) === "authenticated") {
|
|
172
|
+
let message2 = `OAuth authentication successful for "${serverName}"! Run /mcp reconnect ${serverName} to connect with the new token.`;
|
|
173
|
+
return ctx.ui.notify(`OAuth authentication successful for "${serverName}"!
|
|
174
|
+
Run /mcp reconnect ${serverName} to connect with the new token.`, "info"), { ok: !0, message: message2 };
|
|
175
|
+
}
|
|
176
|
+
let message = `OAuth authentication failed for "${serverName}".`;
|
|
177
|
+
return ctx.ui.notify(message, "error"), { ok: !1, message };
|
|
178
|
+
} catch (error) {
|
|
179
|
+
let message = error instanceof Error ? error.message : String(error);
|
|
180
|
+
return ctx.ui.notify(`Failed to authenticate "${serverName}": ${message}`, "error"), { ok: !1, message };
|
|
181
|
+
} finally {
|
|
182
|
+
ctx.ui.setStatus("mcp-auth", void 0);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
async function logoutServer(serverName, state, ctx) {
|
|
186
|
+
if (!state.config.mcpServers[serverName]) {
|
|
187
|
+
let message2 = `Server "${serverName}" not found in config`;
|
|
188
|
+
return ctx.hasUI && ctx.ui.notify(message2, "error"), { ok: !1, message: message2 };
|
|
189
|
+
}
|
|
190
|
+
await removeAuth(serverName), await state.manager.close(serverName), updateStatusBar(state);
|
|
191
|
+
let message = `OAuth credentials cleared for "${serverName}". Run /mcp-auth ${serverName} to authenticate again.`;
|
|
192
|
+
return ctx.hasUI && ctx.ui.notify(message, "info"), { ok: !0, message };
|
|
193
|
+
}
|
|
194
|
+
function buildSharedConfigNoticeLines(configOverridePath, cwd) {
|
|
195
|
+
let discovery = getMcpDiscoverySummary(configOverridePath, cwd), onboardingState = loadOnboardingState();
|
|
196
|
+
return !discovery.hasSharedServers || onboardingState.sharedConfigHintShown ? { lines: [], fingerprint: null } : {
|
|
197
|
+
lines: [
|
|
198
|
+
`Using standard MCP config from ${discovery.sources.filter((source) => source.kind === "shared" && source.serverCount > 0).map((source) => source.path).join(", ")}.`,
|
|
199
|
+
"Pi only writes compatibility imports and adapter-specific overrides into Pi-owned files when needed."
|
|
200
|
+
],
|
|
201
|
+
fingerprint: discovery.fingerprint
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
async function openMcpSetup(_state, pi, ctx, configOverridePath, mode = "setup") {
|
|
205
|
+
if (!ctx.hasUI)
|
|
206
|
+
return { configChanged: !1 };
|
|
207
|
+
let discovery = getMcpDiscoverySummary(configOverridePath, ctx.cwd), onboardingState = loadOnboardingState(), { createMcpSetupPanel } = await import("./mcp-setup-panel-FEK7663I.js"), configChanged = !1, callbacks = {
|
|
208
|
+
previewImports: (imports) => previewCompatibilityImports(imports, configOverridePath),
|
|
209
|
+
previewStarterProject: () => previewStarterProjectConfig(ctx.cwd),
|
|
210
|
+
previewRepoPrompt: () => {
|
|
211
|
+
let repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd).repoPrompt;
|
|
212
|
+
return !repoPrompt.entry || !repoPrompt.targetPath || !repoPrompt.serverName ? null : previewSharedServerEntry(repoPrompt.targetPath, repoPrompt.serverName, repoPrompt.entry);
|
|
213
|
+
},
|
|
214
|
+
adoptImports: async (imports) => {
|
|
215
|
+
let result = ensureCompatibilityImports(imports, configOverridePath);
|
|
216
|
+
return result.added.length > 0 && (configChanged = !0), result;
|
|
217
|
+
},
|
|
218
|
+
scaffoldProjectConfig: async () => {
|
|
219
|
+
let path = writeStarterProjectConfig(ctx.cwd);
|
|
220
|
+
return configChanged = !0, { path };
|
|
221
|
+
},
|
|
222
|
+
addRepoPrompt: async () => {
|
|
223
|
+
let repoPrompt = getMcpDiscoverySummary(configOverridePath, ctx.cwd).repoPrompt;
|
|
224
|
+
if (!repoPrompt.entry || !repoPrompt.targetPath || !repoPrompt.serverName)
|
|
225
|
+
throw new Error("RepoPrompt is not available to add from this setup screen.");
|
|
226
|
+
let path = writeSharedServerEntry(repoPrompt.targetPath, repoPrompt.serverName, repoPrompt.entry);
|
|
227
|
+
return configChanged = !0, { path, serverName: repoPrompt.serverName };
|
|
228
|
+
},
|
|
229
|
+
openPath: async (targetPath) => {
|
|
230
|
+
await openPath(pi, targetPath);
|
|
231
|
+
},
|
|
232
|
+
markSetupCompleted: () => {
|
|
233
|
+
markSetupCompleted(discovery.fingerprint);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
return new Promise((resolve) => {
|
|
237
|
+
ctx.ui.custom((tui, _theme, keybindings, done) => createMcpSetupPanel(discovery, callbacks, { mode, onboardingState, keybindings }, tui, () => {
|
|
238
|
+
done(void 0), resolve({ configChanged });
|
|
239
|
+
}), { overlay: !0, overlayOptions: { anchor: "center", width: 92 } });
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
function buildMcpPanelCallbacks(state, config, ctx) {
|
|
243
|
+
return {
|
|
244
|
+
reconnect: (serverName) => lazyConnect(state, serverName),
|
|
245
|
+
canAuthenticate: (serverName) => {
|
|
246
|
+
let definition = config.mcpServers[serverName];
|
|
247
|
+
return definition ? supportsOAuth(definition) : !1;
|
|
248
|
+
},
|
|
249
|
+
authenticate: (serverName) => authenticateServer(serverName, config, ctx),
|
|
250
|
+
getConnectionStatus: (serverName) => {
|
|
251
|
+
let definition = config.mcpServers[serverName], connection = state.manager.getConnection(serverName);
|
|
252
|
+
return connection?.status === "needs-auth" || definition?.auth === "oauth" && definition.url && definition.oauth !== !1 && definition.oauth?.grantType !== "client_credentials" && !getAuthForUrl(serverName, definition.url)?.tokens ? "needs-auth" : connection?.status === "connected" ? "connected" : getFailureAgeSeconds(state, serverName) !== null ? "failed" : "idle";
|
|
253
|
+
},
|
|
254
|
+
refreshCacheAfterReconnect: (serverName) => loadMetadataCache()?.servers?.[serverName] ?? null
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
async function openMcpPanel(state, pi, ctx, configOverridePath) {
|
|
258
|
+
if (Object.keys(state.config.mcpServers).length === 0)
|
|
259
|
+
return openMcpSetup(state, pi, ctx, configOverridePath, "empty");
|
|
260
|
+
let config = state.config, cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), { lines: noticeLines, fingerprint } = buildSharedConfigNoticeLines(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-IIGMXQGP.js"), configChanged = !1;
|
|
261
|
+
return await new Promise((resolve) => {
|
|
262
|
+
ctx.ui.custom((tui, _theme, keybindings, done) => createMcpPanel(config, cache, provenanceMap, callbacks, tui, (result) => {
|
|
263
|
+
!result.cancelled && result.changes.size > 0 && (writeDirectToolsConfig(result.changes, provenanceMap, config), configChanged = !0, ctx.ui.notify("Direct tools updated. Pi will reload after this panel closes.", "info")), done(void 0), resolve();
|
|
264
|
+
}, { noticeLines, keybindings }), { overlay: !0, overlayOptions: { anchor: "center", width: 82 } });
|
|
265
|
+
}), noticeLines.length > 0 && fingerprint && markSharedConfigHintShown(fingerprint), { configChanged };
|
|
266
|
+
}
|
|
267
|
+
async function openMcpAuthPanel(state, pi, ctx, configOverridePath) {
|
|
268
|
+
if (!ctx.hasUI)
|
|
269
|
+
return { configChanged: !1 };
|
|
270
|
+
let config = state.config;
|
|
271
|
+
if (Object.entries(config.mcpServers).filter(([, definition]) => supportsOAuth(definition)).length === 0)
|
|
272
|
+
return ctx.ui.notify("No OAuth-capable MCP servers are configured.", "warning"), { configChanged: !1 };
|
|
273
|
+
let cache = loadMetadataCache(), configPath = pi.getFlag("mcp-config") ?? configOverridePath, provenanceMap = getServerProvenance(configPath, ctx.cwd), callbacks = buildMcpPanelCallbacks(state, config, ctx), { createMcpPanel } = await import("./mcp-panel-IIGMXQGP.js");
|
|
274
|
+
return await new Promise((resolve) => {
|
|
275
|
+
ctx.ui.custom((tui, _theme, keybindings, done) => createMcpPanel(config, cache, provenanceMap, callbacks, tui, () => {
|
|
276
|
+
done(void 0), resolve();
|
|
277
|
+
}, {
|
|
278
|
+
authOnly: !0,
|
|
279
|
+
keybindings,
|
|
280
|
+
noticeLines: ["Select an OAuth MCP server and press Enter or ctrl+a to authenticate."]
|
|
281
|
+
}), { overlay: !0, overlayOptions: { anchor: "center", width: 82 } });
|
|
282
|
+
}), { configChanged: !1 };
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
authenticateServer,
|
|
286
|
+
logoutServer,
|
|
287
|
+
openMcpAuthPanel,
|
|
288
|
+
openMcpPanel,
|
|
289
|
+
openMcpSetup,
|
|
290
|
+
reconnectServers,
|
|
291
|
+
showStatus,
|
|
292
|
+
showTools
|
|
293
|
+
};
|