@cortex-agent/server 2026.10.25 → 2026.10.27
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/LICENSE +21 -0
- package/README.md +5 -5
- package/THIRD_PARTY_NOTICES.txt +16546 -0
- package/defaults/prompts/clean-workspace.md +21 -0
- package/dist/agent-adapter/claude/remote-mcp-proxy.js +4 -66
- package/dist/chunks/anthropic-SUZWKBRW.js +4 -0
- package/dist/chunks/anthropic-messages-M3SMXACA.js +8 -0
- package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +4 -0
- package/dist/chunks/azure-openai-responses-76YWXHSB.js +4 -0
- package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +58 -0
- package/dist/chunks/child-runner-3GHOWGZP.js +4 -0
- package/dist/chunks/chunk-23PRJECN.js +4 -0
- package/dist/chunks/chunk-2ZNLUY2U.js +128 -0
- package/dist/chunks/chunk-3F6WW7HR.js +13 -0
- package/dist/chunks/chunk-3OKHUVEM.js +7 -0
- package/dist/chunks/chunk-3TGQSGG4.js +8 -0
- package/dist/chunks/chunk-3THJYAEF.js +4 -0
- package/dist/chunks/chunk-3YHOCPQU.js +10 -0
- package/dist/chunks/chunk-4EX2JJWB.js +4 -0
- package/dist/chunks/chunk-4LLH5OWM.js +10 -0
- package/dist/chunks/chunk-4U7XXM4W.js +4 -0
- package/dist/chunks/chunk-52T37Y47.js +8 -0
- package/dist/chunks/chunk-5M4PFLRW.js +4 -0
- package/dist/chunks/chunk-5NRGVROY.js +4 -0
- package/dist/chunks/chunk-5T7IX5KN.js +4 -0
- package/dist/chunks/chunk-6AKUD3CF.js +4 -0
- package/dist/chunks/chunk-6LZK4DDH.js +4 -0
- package/dist/chunks/chunk-6R73ICDB.js +4 -0
- package/dist/chunks/chunk-7MU2AKNM.js +4 -0
- package/dist/chunks/chunk-A34TDMIC.js +7 -0
- package/dist/chunks/chunk-AAA3UBIS.js +4 -0
- package/dist/chunks/chunk-ASYQHJVQ.js +9 -0
- package/dist/chunks/chunk-AWFUHWQK.js +4 -0
- package/dist/chunks/chunk-B3XBQEFM.js +4 -0
- package/dist/chunks/chunk-BGVHA2D4.js +4 -0
- package/dist/chunks/chunk-BGYR4ID3.js +4 -0
- package/dist/chunks/chunk-BKHDWCRT.js +79 -0
- package/dist/chunks/chunk-BR7A5SWM.js +23 -0
- package/dist/chunks/chunk-CQLH4UVX.js +4 -0
- package/dist/chunks/chunk-CVC66CFV.js +33 -0
- package/dist/chunks/chunk-CXT5IR5T.js +4 -0
- package/dist/chunks/chunk-D3NXKK2L.js +4 -0
- package/dist/chunks/chunk-D6UA4BZC.js +19 -0
- package/dist/chunks/chunk-D6VMBA4C.js +4 -0
- package/dist/chunks/chunk-DGMNI4AO.js +4 -0
- package/dist/chunks/chunk-DHSA5ACV.js +125 -0
- package/dist/chunks/chunk-DPQPXBTP.js +68 -0
- package/dist/chunks/chunk-DQJ6LLAS.js +4 -0
- package/dist/chunks/chunk-DXBSQXJL.js +18 -0
- package/dist/chunks/chunk-E6BYRULL.js +4 -0
- package/dist/chunks/chunk-E7ZMYIY6.js +30 -0
- package/dist/chunks/chunk-EQIMHXC4.js +5 -0
- package/dist/chunks/chunk-EQITBTJC.js +10 -0
- package/dist/chunks/chunk-EXJA5RIX.js +357 -0
- package/dist/chunks/chunk-FF7UELTU.js +4 -0
- package/dist/chunks/chunk-FH74NME3.js +115 -0
- package/dist/chunks/chunk-FOJQXLL2.js +6 -0
- package/dist/chunks/chunk-FOQ7VLIL.js +17 -0
- package/dist/chunks/chunk-FX6MOGLR.js +11 -0
- package/dist/chunks/chunk-FXDIR3SQ.js +4 -0
- package/dist/chunks/chunk-G2V65UBA.js +4 -0
- package/dist/chunks/chunk-H2FP6DG4.js +5 -0
- package/dist/chunks/chunk-HALUQ7ZF.js +4 -0
- package/dist/chunks/chunk-HGPBHTVD.js +6 -0
- package/dist/chunks/chunk-HU6UIDEJ.js +6 -0
- package/dist/chunks/chunk-I6OPDRVF.js +4 -0
- package/dist/chunks/chunk-ILEML5IP.js +4 -0
- package/dist/chunks/chunk-IRWZ7UPF.js +77 -0
- package/dist/chunks/chunk-J5DVLUKY.js +6 -0
- package/dist/chunks/chunk-JERCOLY3.js +142 -0
- package/dist/chunks/chunk-JW2HFMTF.js +4 -0
- package/dist/chunks/chunk-JXFG66UN.js +4 -0
- package/dist/chunks/chunk-K4NTZEDJ.js +4 -0
- package/dist/chunks/chunk-KDYEGGMW.js +4 -0
- package/dist/chunks/chunk-KENCMLRE.js +4 -0
- package/dist/chunks/chunk-KGJZAYQD.js +4 -0
- package/dist/chunks/chunk-KIGMAATV.js +23 -0
- package/dist/chunks/chunk-KIU5FAPY.js +5 -0
- package/dist/chunks/chunk-KIWMQPH7.js +739 -0
- package/dist/chunks/chunk-KRXTI4JO.js +3 -0
- package/dist/chunks/chunk-L6VCIGWS.js +11 -0
- package/dist/chunks/chunk-LACGULCN.js +10 -0
- package/dist/chunks/chunk-LCKVYFMD.js +4 -0
- package/dist/chunks/chunk-LEUENXI2.js +6 -0
- package/dist/chunks/chunk-LMDWRRX4.js +4 -0
- package/dist/chunks/chunk-LMSQZ6TQ.js +4 -0
- package/dist/chunks/chunk-MEPASGPP.js +6 -0
- package/dist/chunks/chunk-MFAEUHMV.js +28 -0
- package/dist/chunks/chunk-N6BTQN7R.js +8 -0
- package/dist/chunks/chunk-NAA7GF6Q.js +5 -0
- package/dist/chunks/chunk-NHD2ESHA.js +4 -0
- package/dist/chunks/chunk-NKDMKRSB.js +68 -0
- package/dist/chunks/chunk-NKXV32S6.js +4 -0
- package/dist/chunks/chunk-NR6U3WIZ.js +4 -0
- package/dist/chunks/chunk-NT32UURL.js +4 -0
- package/dist/chunks/chunk-NVX5IPRN.js +4 -0
- package/dist/chunks/chunk-O3JW2F7D.js +8 -0
- package/dist/chunks/chunk-OE4KH3NJ.js +4 -0
- package/dist/chunks/chunk-OISO5JXB.js +4 -0
- package/dist/chunks/chunk-OKRK6JPY.js +4 -0
- package/dist/chunks/chunk-OPYXNSMY.js +4 -0
- package/dist/chunks/chunk-OSEIQ7SS.js +4 -0
- package/dist/chunks/chunk-OZGBWAT2.js +4 -0
- package/dist/chunks/chunk-P52RMIYX.js +6 -0
- package/dist/chunks/chunk-PBJ5MPPX.js +60 -0
- package/dist/chunks/chunk-PFMEUFJ7.js +4 -0
- package/dist/chunks/chunk-PMG4YGDU.js +7 -0
- package/dist/chunks/chunk-PXS5SHOV.js +4 -0
- package/dist/chunks/chunk-PZMGBKUR.js +13 -0
- package/dist/chunks/chunk-PZMXHA6X.js +9 -0
- package/dist/chunks/chunk-Q4UGYGU5.js +4 -0
- package/dist/chunks/chunk-Q7CE3UIE.js +133 -0
- package/dist/chunks/chunk-QBKCAIJG.js +4 -0
- package/dist/chunks/chunk-QEOFEETJ.js +4 -0
- package/dist/chunks/chunk-QN44UXQR.js +11 -0
- package/dist/chunks/chunk-QUUEQRIT.js +4 -0
- package/dist/chunks/chunk-QWAQHHRS.js +4 -0
- package/dist/chunks/chunk-RA6HKFBV.js +4 -0
- package/dist/chunks/chunk-REBNWCKI.js +4 -0
- package/dist/chunks/chunk-REPYBMQS.js +4 -0
- package/dist/chunks/chunk-RO4C2MJP.js +4 -0
- package/dist/chunks/chunk-SKHLZ6XY.js +9 -0
- package/dist/chunks/chunk-STUHNKQS.js +4 -0
- package/dist/chunks/chunk-SUFW24P4.js +7 -0
- package/dist/chunks/chunk-TAWLERZA.js +4 -0
- package/dist/chunks/chunk-TCAEECDI.js +4 -0
- package/dist/chunks/chunk-TJ4GQRT6.js +8 -0
- package/dist/chunks/chunk-TURBFBYN.js +4 -0
- package/dist/chunks/chunk-TWAEABGG.js +52 -0
- package/dist/chunks/chunk-TZFLHVOQ.js +7 -0
- package/dist/chunks/chunk-TZGNSHOL.js +4 -0
- package/dist/chunks/chunk-UD3NMUHR.js +12 -0
- package/dist/chunks/chunk-UNVEZI57.js +4 -0
- package/dist/chunks/chunk-USBJFDJ6.js +4 -0
- package/dist/chunks/chunk-V3AQJSWR.js +4 -0
- package/dist/chunks/chunk-VQUPKMDR.js +4 -0
- package/dist/chunks/chunk-W25TB3PU.js +4 -0
- package/dist/chunks/chunk-W5LGYSPZ.js +4 -0
- package/dist/chunks/chunk-WEZWKMYU.js +4 -0
- package/dist/chunks/chunk-WHC7AYZD.js +4 -0
- package/dist/chunks/chunk-X2GYYRVM.js +22 -0
- package/dist/chunks/chunk-XAJLZR7C.js +28 -0
- package/dist/chunks/chunk-XAXWLYH5.js +4 -0
- package/dist/chunks/chunk-XBJOYU5Y.js +4 -0
- package/dist/chunks/chunk-XH6FMP3N.js +71 -0
- package/dist/chunks/chunk-XIECJESP.js +4 -0
- package/dist/chunks/chunk-XNSSUVT6.js +4 -0
- package/dist/chunks/chunk-XSRZHN63.js +4 -0
- package/dist/chunks/chunk-Y3GFB5XM.js +8 -0
- package/dist/chunks/chunk-Y6ZEVVL5.js +4 -0
- package/dist/chunks/chunk-YAEVYJAR.js +4 -0
- package/dist/chunks/chunk-YG7OEPR2.js +6 -0
- package/dist/chunks/chunk-YHIWOGVL.js +4 -0
- package/dist/chunks/chunk-YKKEI5GI.js +4 -0
- package/dist/chunks/chunk-YPK2CAIZ.js +8 -0
- package/dist/chunks/chunk-YZSHTWNM.js +92 -0
- package/dist/chunks/chunk-Z2Q2NR46.js +34 -0
- package/dist/chunks/chunk-Z4H3VDHI.js +4 -0
- package/dist/chunks/chunk-ZFPMIQA3.js +6 -0
- package/dist/chunks/chunk-ZNZFWSPH.js +4 -0
- package/dist/chunks/chunk-ZQ7LGTSN.js +8 -0
- package/dist/chunks/chunk-ZSV6TO7Q.js +4 -0
- package/dist/chunks/cli-5DBTRMHU.js +53 -0
- package/dist/chunks/client-XOGYH5UR.js +4 -0
- package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +4 -0
- package/dist/chunks/config-DJSQI77S-335IXHSM.js +4 -0
- package/dist/chunks/context-VCQH5OB6.js +4 -0
- package/dist/chunks/cost-PGGFI7QJ.js +5 -0
- package/dist/chunks/dist-7RWW7YH4.js +11 -0
- package/dist/chunks/dist-PUKMZ7GW.js +4 -0
- package/dist/chunks/easter-egg-3d-MO4MOEVF.js +4 -0
- package/dist/chunks/es5-VNTQPCKX.js +4 -0
- package/dist/chunks/event-streams-3JSFPOTZ.js +4 -0
- package/dist/chunks/execution-repo-ZLJTBWFC.js +4 -0
- package/dist/chunks/executions-6ARGR3IO.js +9 -0
- package/dist/chunks/file-7BN7RCAY.js +4 -0
- package/dist/chunks/gateway-UCRPMR75.js +36 -0
- package/dist/chunks/github-copilot-HAI2DA62.js +4 -0
- package/dist/chunks/google-generative-ai-2VXWLHWI.js +4 -0
- package/dist/chunks/google-vertex-UA36QP2U.js +4 -0
- package/dist/chunks/init-HA7FAQ73.js +4 -0
- package/dist/chunks/install-cli-4IZCSDFZ.js +16 -0
- package/dist/chunks/interaction-ask-G5T3H3CG.js +9 -0
- package/dist/chunks/interaction-plan-E5V42MUP.js +11 -0
- package/dist/chunks/jiti-loader-WANUXUDO.js +4 -0
- package/dist/chunks/jiti-static-loader-W3QZ4GDS.js +476 -0
- package/dist/chunks/kimi-coding-HMJRKCPA.js +4 -0
- package/dist/chunks/lib-RSOU34HQ.js +11 -0
- package/dist/chunks/llama-cpp-classify-OTXZWCMW.js +24 -0
- package/dist/chunks/local-client-stop-SQRU7ZZM.js +4 -0
- package/dist/chunks/memory-cli-PYOILNN5.js +11 -0
- package/dist/chunks/meta-KY3LNFV2.js +4 -0
- package/dist/chunks/mistral-conversations-34F66L3O.js +7 -0
- package/dist/chunks/model-resolver-N3DTAQ2S.js +4 -0
- package/dist/chunks/models-L5VF4I5O-XXNJYQMQ.js +4 -0
- package/dist/chunks/multipart-parser-GEHG6YAR.js +5 -0
- package/dist/chunks/node-PTK2HCDV.js +18 -0
- package/dist/chunks/node-VLVSZ76W.js +4 -0
- package/dist/chunks/openai-chatgpt-PETGIJOZ.js +4 -0
- package/dist/chunks/openai-codex-2REL6UQU.js +4 -0
- package/dist/chunks/openai-codex-responses-ZBVHREB3.js +12 -0
- package/dist/chunks/openai-completions-VVIB26SH.js +9 -0
- package/dist/chunks/openai-decisions-2N6ZRPZC.js +7 -0
- package/dist/chunks/openai-responses-735XA2ZX.js +6 -0
- package/dist/chunks/openrouter-GDY3BLT2.js +4 -0
- package/dist/chunks/openrouter-images-3IKETHAC.js +4 -0
- package/dist/chunks/pi-messages-I3E4ZFHA.js +10 -0
- package/dist/chunks/radius-HXRZVBDB.js +4 -0
- package/dist/chunks/remote-ops-BALZYKH6.js +14 -0
- package/dist/chunks/runner-PLVZDGHB.js +4 -0
- package/dist/chunks/runtime-6YLTA2ZD.js +4 -0
- package/dist/chunks/schedule-cli-OLASBBYJ.js +4 -0
- package/dist/chunks/slack-WAGSPZUX.js +4 -0
- package/dist/chunks/src-CCI7P7AI.js +6 -0
- package/dist/chunks/start-ui-http-QALT7C3P.js +43 -0
- package/dist/chunks/subagent-E3UC7ZHC.js +4 -0
- package/dist/chunks/time-KEHDQT6K.js +4 -0
- package/dist/chunks/tool-shims-Q6P6UXVC.js +4 -0
- package/dist/chunks/typesafe-system-one-6ULACYD4.js +4 -0
- package/dist/chunks/ui-board-4GYW6KKW.js +5 -0
- package/dist/chunks/ui-decision-U2FXSEC2.js +4 -0
- package/dist/chunks/ui-file-GVH53O3X.js +5 -0
- package/dist/chunks/ui-view-O7PLANT7.js +4 -0
- package/dist/chunks/virtual-modules-IDC5YKZJ.js +4 -0
- package/dist/chunks/waitpoint-2FGQBIAC.js +5 -0
- package/dist/chunks/workers-XN4PSTH6.js +4 -0
- package/dist/chunks/xai-KEVUJTFV.js +4 -0
- package/dist/client-bundle/manifest.json +1 -1
- package/dist/core/pi-sdk.js +4 -73
- package/dist/domain/auth/cc-auth-cli.js +4 -248
- package/dist/domain/mcp/bundled-server.js +4 -146
- package/dist/entry/app.js +601 -611
- package/dist/entry/browser-cli.js +14 -316
- package/dist/entry/cli.js +4 -587
- package/dist/entry/cortex-cli.js +4 -2
- package/dist/entry/daemon.js +7 -909
- package/dist/entry/hook-cli.js +6 -401
- package/dist/entry/production-app-bootstrap.js +5 -42
- package/dist/entry/production-evidence-export-cli.js +12 -99
- package/dist/entry/signal-cli.js +6 -198
- package/dist/tui/index.js +114 -306
- package/package.json +11 -50
- package/scripts/bundle-prune-browser.mjs +52 -0
- package/scripts/postinstall-restart-trigger.mjs +8 -0
- package/vendor/aistatus/gateway-cli.js +21 -0
- package/vendor/pi/CHANGELOG.md +6365 -0
- package/vendor/pi/README.md +95 -0
- package/vendor/pi/dist/codemode-worker.js +478 -0
- package/vendor/pi/dist/core/export-html/ansi-to-html.js +249 -0
- package/vendor/pi/dist/core/export-html/index.js +228 -0
- package/vendor/pi/dist/core/export-html/template.css +1076 -0
- package/vendor/pi/dist/core/export-html/template.html +56 -0
- package/vendor/pi/dist/core/export-html/template.js +1924 -0
- package/vendor/pi/dist/core/export-html/tool-renderer.js +110 -0
- package/vendor/pi/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/vendor/pi/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/vendor/pi/dist/core/export-html/vendor/marked.min.js +79 -0
- package/vendor/pi/dist/core/extensions/loader.js +4 -0
- package/vendor/pi/dist/extensions/codemode/execute.js +507 -0
- package/vendor/pi/dist/modes/interactive/assets/clankolas.png +0 -0
- package/vendor/pi/dist/modes/interactive/theme/dark.json +78 -0
- package/vendor/pi/dist/modes/interactive/theme/light.json +78 -0
- package/vendor/pi/dist/modes/interactive/theme/system-theme.js +546 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/vendor/pi/dist/modes/interactive/theme/theme.js +905 -0
- package/vendor/pi/dist/utils/image-resize-worker.js +4 -0
- package/vendor/pi/dist/utils/image-resize.js +4 -0
- package/vendor/pi/docs/cli-integration.md +106 -0
- package/vendor/pi/docs/cli.md +333 -0
- package/vendor/pi/docs/codemode.md +230 -0
- package/vendor/pi/docs/compaction.md +463 -0
- package/vendor/pi/docs/configuration.md +47 -0
- package/vendor/pi/docs/containerization.md +183 -0
- package/vendor/pi/docs/custom-provider.md +225 -0
- package/vendor/pi/docs/docs.json +220 -0
- package/vendor/pi/docs/environment-variables.md +101 -0
- package/vendor/pi/docs/extensions.md +400 -0
- package/vendor/pi/docs/how-pi-works.md +49 -0
- package/vendor/pi/docs/images/doom-extension.png +0 -0
- package/vendor/pi/docs/images/exy.png +0 -0
- package/vendor/pi/docs/images/interactive-mode.png +0 -0
- package/vendor/pi/docs/images/tree-view.png +0 -0
- package/vendor/pi/docs/index.md +39 -0
- package/vendor/pi/docs/json.md +226 -0
- package/vendor/pi/docs/keybindings.md +195 -0
- package/vendor/pi/docs/llama-cpp.md +121 -0
- package/vendor/pi/docs/mcp.md +272 -0
- package/vendor/pi/docs/message-types.md +279 -0
- package/vendor/pi/docs/models-configuration.md +196 -0
- package/vendor/pi/docs/models.md +225 -0
- package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/vendor/pi/docs/packages.md +129 -0
- package/vendor/pi/docs/prompt-templates.md +59 -0
- package/vendor/pi/docs/providers.md +247 -0
- package/vendor/pi/docs/quickstart.md +136 -0
- package/vendor/pi/docs/rpc-commands.md +860 -0
- package/vendor/pi/docs/rpc-extension-ui.md +200 -0
- package/vendor/pi/docs/rpc.md +193 -0
- package/vendor/pi/docs/sdk.md +147 -0
- package/vendor/pi/docs/security.md +99 -0
- package/vendor/pi/docs/session-format.md +293 -0
- package/vendor/pi/docs/sessions.md +66 -0
- package/vendor/pi/docs/settings.md +172 -0
- package/vendor/pi/docs/shell-aliases.md +93 -0
- package/vendor/pi/docs/skills.md +93 -0
- package/vendor/pi/docs/slash-commands.md +60 -0
- package/vendor/pi/docs/terminal-setup.md +233 -0
- package/vendor/pi/docs/termux.md +117 -0
- package/vendor/pi/docs/themes.md +138 -0
- package/vendor/pi/docs/tmux.md +55 -0
- package/vendor/pi/docs/tui.md +195 -0
- package/vendor/pi/docs/usage.md +94 -0
- package/vendor/pi/docs/virtual-models.md +114 -0
- package/vendor/pi/docs/windows.md +81 -0
- package/vendor/pi/examples/README.md +36 -0
- package/vendor/pi/examples/extensions/README.md +214 -0
- package/vendor/pi/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/vendor/pi/examples/extensions/bash-spawn-hook.ts +30 -0
- package/vendor/pi/examples/extensions/bookmark.ts +50 -0
- package/vendor/pi/examples/extensions/border-status-editor.ts +150 -0
- package/vendor/pi/examples/extensions/built-in-tool-renderer.ts +225 -0
- package/vendor/pi/examples/extensions/claude-rules.ts +86 -0
- package/vendor/pi/examples/extensions/commands.ts +72 -0
- package/vendor/pi/examples/extensions/confirm-destructive.ts +59 -0
- package/vendor/pi/examples/extensions/custom-compaction.ts +117 -0
- package/vendor/pi/examples/extensions/custom-footer.ts +64 -0
- package/vendor/pi/examples/extensions/custom-header.ts +73 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +617 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/vendor/pi/examples/extensions/debug-provider.ts +90 -0
- package/vendor/pi/examples/extensions/dirty-repo-guard.ts +56 -0
- package/vendor/pi/examples/extensions/doom-overlay/README.md +46 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/vendor/pi/examples/extensions/doom-overlay/index.ts +74 -0
- package/vendor/pi/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/vendor/pi/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/vendor/pi/examples/extensions/dynamic-resources/dynamic.json +81 -0
- package/vendor/pi/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/vendor/pi/examples/extensions/dynamic-resources/index.ts +15 -0
- package/vendor/pi/examples/extensions/dynamic-tools.ts +74 -0
- package/vendor/pi/examples/extensions/entry-renderer.ts +41 -0
- package/vendor/pi/examples/extensions/event-bus.ts +43 -0
- package/vendor/pi/examples/extensions/file-trigger.ts +41 -0
- package/vendor/pi/examples/extensions/git-checkpoint.ts +53 -0
- package/vendor/pi/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/vendor/pi/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/vendor/pi/examples/extensions/gondolin/index.ts +531 -0
- package/vendor/pi/examples/extensions/gondolin/package-lock.json +185 -0
- package/vendor/pi/examples/extensions/gondolin/package.json +19 -0
- package/vendor/pi/examples/extensions/handoff.ts +190 -0
- package/vendor/pi/examples/extensions/hello.ts +26 -0
- package/vendor/pi/examples/extensions/hidden-thinking-label.ts +53 -0
- package/vendor/pi/examples/extensions/inline-bash.ts +94 -0
- package/vendor/pi/examples/extensions/input-transform-streaming.ts +39 -0
- package/vendor/pi/examples/extensions/input-transform.ts +43 -0
- package/vendor/pi/examples/extensions/interactive-shell.ts +196 -0
- package/vendor/pi/examples/extensions/jev-router.ts +113 -0
- package/vendor/pi/examples/extensions/mac-system-theme.ts +47 -0
- package/vendor/pi/examples/extensions/message-renderer.ts +59 -0
- package/vendor/pi/examples/extensions/minimal-mode.ts +353 -0
- package/vendor/pi/examples/extensions/modal-editor.ts +85 -0
- package/vendor/pi/examples/extensions/model-status.ts +31 -0
- package/vendor/pi/examples/extensions/notify.ts +57 -0
- package/vendor/pi/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/vendor/pi/examples/extensions/overlay-test.ts +153 -0
- package/vendor/pi/examples/extensions/permission-gate.ts +34 -0
- package/vendor/pi/examples/extensions/pirate.ts +47 -0
- package/vendor/pi/examples/extensions/plan-mode/README.md +66 -0
- package/vendor/pi/examples/extensions/plan-mode/index.ts +394 -0
- package/vendor/pi/examples/extensions/plan-mode/utils.ts +168 -0
- package/vendor/pi/examples/extensions/preset.ts +436 -0
- package/vendor/pi/examples/extensions/project-trust.ts +64 -0
- package/vendor/pi/examples/extensions/prompt-customizer.ts +49 -0
- package/vendor/pi/examples/extensions/protected-paths.ts +30 -0
- package/vendor/pi/examples/extensions/provider-payload.ts +18 -0
- package/vendor/pi/examples/extensions/qna.ts +118 -0
- package/vendor/pi/examples/extensions/question.ts +286 -0
- package/vendor/pi/examples/extensions/questionnaire.ts +448 -0
- package/vendor/pi/examples/extensions/rainbow-editor.ts +88 -0
- package/vendor/pi/examples/extensions/reload-runtime.ts +37 -0
- package/vendor/pi/examples/extensions/rpc-demo.ts +118 -0
- package/vendor/pi/examples/extensions/sandbox/index.ts +321 -0
- package/vendor/pi/examples/extensions/sandbox/package-lock.json +92 -0
- package/vendor/pi/examples/extensions/sandbox/package.json +19 -0
- package/vendor/pi/examples/extensions/send-user-message.ts +97 -0
- package/vendor/pi/examples/extensions/session-name.ts +27 -0
- package/vendor/pi/examples/extensions/shutdown-command.ts +63 -0
- package/vendor/pi/examples/extensions/snake.ts +343 -0
- package/vendor/pi/examples/extensions/space-invaders.ts +560 -0
- package/vendor/pi/examples/extensions/ssh.ts +220 -0
- package/vendor/pi/examples/extensions/status-line.ts +32 -0
- package/vendor/pi/examples/extensions/structured-output.ts +65 -0
- package/vendor/pi/examples/extensions/subagent/README.md +177 -0
- package/vendor/pi/examples/extensions/subagent/agents/planner.md +37 -0
- package/vendor/pi/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/vendor/pi/examples/extensions/subagent/agents/scout.md +50 -0
- package/vendor/pi/examples/extensions/subagent/agents/worker.md +24 -0
- package/vendor/pi/examples/extensions/subagent/agents.ts +157 -0
- package/vendor/pi/examples/extensions/subagent/index.ts +1036 -0
- package/vendor/pi/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/vendor/pi/examples/extensions/subagent/prompts/implement.md +10 -0
- package/vendor/pi/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/vendor/pi/examples/extensions/summarize.ts +199 -0
- package/vendor/pi/examples/extensions/system-prompt-header.ts +17 -0
- package/vendor/pi/examples/extensions/tic-tac-toe.ts +1008 -0
- package/vendor/pi/examples/extensions/timed-confirm.ts +70 -0
- package/vendor/pi/examples/extensions/titlebar-spinner.ts +58 -0
- package/vendor/pi/examples/extensions/todo.ts +297 -0
- package/vendor/pi/examples/extensions/tool-override.ts +144 -0
- package/vendor/pi/examples/extensions/tools.ts +146 -0
- package/vendor/pi/examples/extensions/trigger-compact.ts +50 -0
- package/vendor/pi/examples/extensions/truncated-tool.ts +195 -0
- package/vendor/pi/examples/extensions/widget-placement.ts +9 -0
- package/vendor/pi/examples/extensions/with-deps/index.ts +32 -0
- package/vendor/pi/examples/extensions/with-deps/package-lock.json +31 -0
- package/vendor/pi/examples/extensions/with-deps/package.json +22 -0
- package/vendor/pi/examples/extensions/working-indicator.ts +123 -0
- package/vendor/pi/examples/extensions/working-message-test.ts +25 -0
- package/vendor/pi/examples/rpc-client.ts +35 -0
- package/vendor/pi/examples/rpc-extension-ui.ts +661 -0
- package/vendor/pi/examples/sdk/01-minimal.ts +26 -0
- package/vendor/pi/examples/sdk/02-custom-model.ts +49 -0
- package/vendor/pi/examples/sdk/03-custom-prompt.ts +75 -0
- package/vendor/pi/examples/sdk/04-skills.ts +55 -0
- package/vendor/pi/examples/sdk/05-tools.ts +48 -0
- package/vendor/pi/examples/sdk/06-extensions.ts +99 -0
- package/vendor/pi/examples/sdk/07-context-files.ts +47 -0
- package/vendor/pi/examples/sdk/08-prompt-templates.ts +51 -0
- package/vendor/pi/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/vendor/pi/examples/sdk/10-settings.ts +53 -0
- package/vendor/pi/examples/sdk/11-sessions.ts +52 -0
- package/vendor/pi/examples/sdk/12-full-control.ts +74 -0
- package/vendor/pi/examples/sdk/13-session-runtime.ts +67 -0
- package/vendor/pi/examples/sdk/14-codemode-mcp.ts +61 -0
- package/vendor/pi/examples/sdk/README.md +141 -0
- package/vendor/pi/package.json +98 -0
- package/vendor/pi/schemas/keybindings.schema.json +393 -0
- package/vendor/pi/schemas/models.schema.json +1211 -0
- package/vendor/pi/schemas/settings.schema.json +783 -0
- package/vendor/pi/schemas/theme.schema.json +365 -0
- package/vendor/pi-ai/bedrock.js +4 -0
- package/vendor/pi-ai/oauth-load.js +4 -0
- package/vendor/quickjs.wasm +0 -0
- package/web/dist/assets/board-math-css-BmiXB1z5.js +2 -0
- package/web/dist/assets/index-DqWMdMkh.css +1 -0
- package/web/dist/assets/index-XBRXpnC5.js +1 -0
- package/web/dist/assets/index-btKNdkvc.js +525 -0
- package/web/dist/index.html +2 -2
- package/dist/agent-adapter/bg-wait.d.ts +0 -11
- package/dist/agent-adapter/bg-wait.js +0 -32
- package/dist/agent-adapter/capabilities.d.ts +0 -18
- package/dist/agent-adapter/capabilities.js +0 -39
- package/dist/agent-adapter/claude/active-capture-registry.d.ts +0 -7
- package/dist/agent-adapter/claude/active-capture-registry.js +0 -42
- package/dist/agent-adapter/claude/adapter.d.ts +0 -170
- package/dist/agent-adapter/claude/adapter.js +0 -459
- package/dist/agent-adapter/claude/assistant-blocks.d.ts +0 -5
- package/dist/agent-adapter/claude/assistant-blocks.js +0 -61
- package/dist/agent-adapter/claude/bg-task-tracker.d.ts +0 -105
- package/dist/agent-adapter/claude/bg-task-tracker.js +0 -168
- package/dist/agent-adapter/claude/cache-refresh.d.ts +0 -58
- package/dist/agent-adapter/claude/cache-refresh.js +0 -145
- package/dist/agent-adapter/claude/cache-touch.d.ts +0 -12
- package/dist/agent-adapter/claude/cache-touch.js +0 -75
- package/dist/agent-adapter/claude/compact-window.d.ts +0 -18
- package/dist/agent-adapter/claude/compact-window.js +0 -49
- package/dist/agent-adapter/claude/context-usage.d.ts +0 -28
- package/dist/agent-adapter/claude/context-usage.js +0 -173
- package/dist/agent-adapter/claude/defaults.d.ts +0 -42
- package/dist/agent-adapter/claude/defaults.js +0 -59
- package/dist/agent-adapter/claude/engine.d.ts +0 -75
- package/dist/agent-adapter/claude/engine.js +0 -139
- package/dist/agent-adapter/claude/event-parser.d.ts +0 -60
- package/dist/agent-adapter/claude/event-parser.js +0 -259
- package/dist/agent-adapter/claude/event-translator.d.ts +0 -45
- package/dist/agent-adapter/claude/event-translator.js +0 -98
- package/dist/agent-adapter/claude/hooks-builder.d.ts +0 -19
- package/dist/agent-adapter/claude/hooks-builder.js +0 -57
- package/dist/agent-adapter/claude/mcp-config.d.ts +0 -11
- package/dist/agent-adapter/claude/mcp-config.js +0 -142
- package/dist/agent-adapter/claude/remote-mcp-proxy.d.ts +0 -1
- package/dist/agent-adapter/claude/session-options.d.ts +0 -70
- package/dist/agent-adapter/claude/session-options.js +0 -148
- package/dist/agent-adapter/claude/spawn-args.d.ts +0 -70
- package/dist/agent-adapter/claude/spawn-args.js +0 -367
- package/dist/agent-adapter/claude/tool-summarizers.d.ts +0 -2
- package/dist/agent-adapter/claude/tool-summarizers.js +0 -20
- package/dist/agent-adapter/claude/transcript-clear.d.ts +0 -42
- package/dist/agent-adapter/claude/transcript-clear.js +0 -217
- package/dist/agent-adapter/claude/transcript-path.d.ts +0 -39
- package/dist/agent-adapter/claude/transcript-path.js +0 -114
- package/dist/agent-adapter/claude/turn-machine.d.ts +0 -220
- package/dist/agent-adapter/claude/turn-machine.js +0 -731
- package/dist/agent-adapter/claude/window-warmup.d.ts +0 -13
- package/dist/agent-adapter/claude/window-warmup.js +0 -38
- package/dist/agent-adapter/continuation-phase.d.ts +0 -131
- package/dist/agent-adapter/continuation-phase.js +0 -345
- package/dist/agent-adapter/engine-injections.d.ts +0 -47
- package/dist/agent-adapter/engine-injections.js +0 -80
- package/dist/agent-adapter/mcp-remote-fetch.d.ts +0 -1
- package/dist/agent-adapter/mcp-remote-fetch.js +0 -32
- package/dist/agent-adapter/normalize/event-types.d.ts +0 -125
- package/dist/agent-adapter/normalize/event-types.js +0 -1
- package/dist/agent-adapter/normalize/prompt-builder.d.ts +0 -22
- package/dist/agent-adapter/normalize/prompt-builder.js +0 -41
- package/dist/agent-adapter/normalize/tool-result-images.d.ts +0 -11
- package/dist/agent-adapter/normalize/tool-result-images.js +0 -32
- package/dist/agent-adapter/pi/adapter.d.ts +0 -125
- package/dist/agent-adapter/pi/adapter.js +0 -275
- package/dist/agent-adapter/pi/agent-dir.d.ts +0 -57
- package/dist/agent-adapter/pi/agent-dir.js +0 -154
- package/dist/agent-adapter/pi/background-subagent.d.ts +0 -26
- package/dist/agent-adapter/pi/background-subagent.js +0 -1
- package/dist/agent-adapter/pi/child-events.d.ts +0 -13
- package/dist/agent-adapter/pi/child-events.js +0 -96
- package/dist/agent-adapter/pi/child-runner.d.ts +0 -31
- package/dist/agent-adapter/pi/child-runner.js +0 -133
- package/dist/agent-adapter/pi/child-session.d.ts +0 -28
- package/dist/agent-adapter/pi/child-session.js +0 -70
- package/dist/agent-adapter/pi/custom-catalog.d.ts +0 -10
- package/dist/agent-adapter/pi/custom-catalog.js +0 -38
- package/dist/agent-adapter/pi/defaults.d.ts +0 -7
- package/dist/agent-adapter/pi/defaults.js +0 -11
- package/dist/agent-adapter/pi/discovery.d.ts +0 -37
- package/dist/agent-adapter/pi/discovery.js +0 -33
- package/dist/agent-adapter/pi/engine.d.ts +0 -66
- package/dist/agent-adapter/pi/engine.js +0 -180
- package/dist/agent-adapter/pi/event-parser.d.ts +0 -43
- package/dist/agent-adapter/pi/event-parser.js +0 -446
- package/dist/agent-adapter/pi/extensions.d.ts +0 -33
- package/dist/agent-adapter/pi/extensions.js +0 -58
- package/dist/agent-adapter/pi/hook-bridge.d.ts +0 -54
- package/dist/agent-adapter/pi/hook-bridge.js +0 -394
- package/dist/agent-adapter/pi/image-first.d.ts +0 -3
- package/dist/agent-adapter/pi/image-first.js +0 -31
- package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +0 -32
- package/dist/agent-adapter/pi/mcp-bridge-logic.js +0 -63
- package/dist/agent-adapter/pi/mcp-bridge.d.ts +0 -65
- package/dist/agent-adapter/pi/mcp-bridge.js +0 -389
- package/dist/agent-adapter/pi/native-tool-policy.d.ts +0 -3
- package/dist/agent-adapter/pi/native-tool-policy.js +0 -11
- package/dist/agent-adapter/pi/pi-session.d.ts +0 -185
- package/dist/agent-adapter/pi/pi-session.js +0 -656
- package/dist/agent-adapter/pi/providers-config.d.ts +0 -60
- package/dist/agent-adapter/pi/providers-config.js +0 -96
- package/dist/agent-adapter/pi/quota-probe.d.ts +0 -12
- package/dist/agent-adapter/pi/quota-probe.js +0 -33
- package/dist/agent-adapter/pi/quota-sink.d.ts +0 -33
- package/dist/agent-adapter/pi/quota-sink.js +0 -57
- package/dist/agent-adapter/pi/runtime-settings.d.ts +0 -9
- package/dist/agent-adapter/pi/runtime-settings.js +0 -53
- package/dist/agent-adapter/pi/runtime.d.ts +0 -48
- package/dist/agent-adapter/pi/runtime.js +0 -163
- package/dist/agent-adapter/pi/session-files.d.ts +0 -2
- package/dist/agent-adapter/pi/session-files.js +0 -15
- package/dist/agent-adapter/pi/session-options.d.ts +0 -86
- package/dist/agent-adapter/pi/session-options.js +0 -162
- package/dist/agent-adapter/pi/session-support.d.ts +0 -54
- package/dist/agent-adapter/pi/session-support.js +0 -101
- package/dist/agent-adapter/pi/subagent-bridge.d.ts +0 -17
- package/dist/agent-adapter/pi/subagent-bridge.js +0 -1
- package/dist/agent-adapter/pi/subagent.d.ts +0 -100
- package/dist/agent-adapter/pi/subagent.js +0 -199
- package/dist/agent-adapter/pi/tool-shims.d.ts +0 -32
- package/dist/agent-adapter/pi/tool-shims.js +0 -148
- package/dist/agent-adapter/pi/ui-context.d.ts +0 -20
- package/dist/agent-adapter/pi/ui-context.js +0 -92
- package/dist/agent-adapter/pi/web-fetch.d.ts +0 -13
- package/dist/agent-adapter/pi/web-fetch.js +0 -196
- package/dist/agent-adapter/pi/web-search.d.ts +0 -9
- package/dist/agent-adapter/pi/web-search.js +0 -517
- package/dist/agent-adapter/run-events.d.ts +0 -169
- package/dist/agent-adapter/run-events.js +0 -119
- package/dist/agent-adapter/types.d.ts +0 -330
- package/dist/agent-adapter/types.js +0 -3
- package/dist/core/agents/roles.d.ts +0 -50
- package/dist/core/agents/roles.js +0 -176
- package/dist/core/agents/subagent/attribution.d.ts +0 -15
- package/dist/core/agents/subagent/attribution.js +0 -60
- package/dist/core/agents/subagent/catalog.d.ts +0 -65
- package/dist/core/agents/subagent/catalog.js +0 -200
- package/dist/core/agents/subagent/model-spec.d.ts +0 -28
- package/dist/core/agents/subagent/model-spec.js +0 -39
- package/dist/core/agents/subagent/orchestrate.d.ts +0 -25
- package/dist/core/agents/subagent/orchestrate.js +0 -92
- package/dist/core/agents/subagent/schema.d.ts +0 -12
- package/dist/core/agents/subagent/schema.js +0 -51
- package/dist/core/agents/subagent/types.d.ts +0 -84
- package/dist/core/agents/subagent/types.js +0 -1
- package/dist/core/agents/subagent/usage.d.ts +0 -8
- package/dist/core/agents/subagent/usage.js +0 -32
- package/dist/core/anthropic-model-discovery.d.ts +0 -54
- package/dist/core/anthropic-model-discovery.js +0 -156
- package/dist/core/anthropic-models.d.ts +0 -1
- package/dist/core/anthropic-models.js +0 -13
- package/dist/core/async-mutex.d.ts +0 -6
- package/dist/core/async-mutex.js +0 -32
- package/dist/core/atomic-write.d.ts +0 -9
- package/dist/core/atomic-write.js +0 -104
- package/dist/core/auth.d.ts +0 -40
- package/dist/core/auth.js +0 -94
- package/dist/core/board-action.d.ts +0 -19
- package/dist/core/board-action.js +0 -24
- package/dist/core/builtin-layer.d.ts +0 -22
- package/dist/core/builtin-layer.js +0 -45
- package/dist/core/cached-scan.d.ts +0 -42
- package/dist/core/cached-scan.js +0 -95
- package/dist/core/calver.d.ts +0 -1
- package/dist/core/calver.js +0 -25
- package/dist/core/claude-credentials.d.ts +0 -91
- package/dist/core/claude-credentials.js +0 -242
- package/dist/core/cli-utils.d.ts +0 -56
- package/dist/core/cli-utils.js +0 -70
- package/dist/core/codex-quota.d.ts +0 -27
- package/dist/core/codex-quota.js +0 -55
- package/dist/core/codex-token.d.ts +0 -4
- package/dist/core/codex-token.js +0 -26
- package/dist/core/config-generator.d.ts +0 -17
- package/dist/core/config-generator.js +0 -181
- package/dist/core/debug-mode.d.ts +0 -15
- package/dist/core/debug-mode.js +0 -22
- package/dist/core/exec-async.d.ts +0 -28
- package/dist/core/exec-async.js +0 -48
- package/dist/core/file-lock.d.ts +0 -15
- package/dist/core/file-lock.js +0 -164
- package/dist/core/format-duration.d.ts +0 -7
- package/dist/core/format-duration.js +0 -23
- package/dist/core/gateway-generator.d.ts +0 -152
- package/dist/core/gateway-generator.js +0 -559
- package/dist/core/git-availability.d.ts +0 -2
- package/dist/core/git-availability.js +0 -43
- package/dist/core/hook-bus.d.ts +0 -25
- package/dist/core/hook-bus.js +0 -99
- package/dist/core/hook-exec.d.ts +0 -15
- package/dist/core/hook-exec.js +0 -86
- package/dist/core/hook-scripts.d.ts +0 -19
- package/dist/core/hook-scripts.js +0 -30
- package/dist/core/i18n.d.ts +0 -19
- package/dist/core/i18n.js +0 -42
- package/dist/core/icons.d.ts +0 -72
- package/dist/core/icons.js +0 -71
- package/dist/core/json-repository.d.ts +0 -78
- package/dist/core/json-repository.js +0 -154
- package/dist/core/locales/en.d.ts +0 -911
- package/dist/core/locales/en.js +0 -32
- package/dist/core/locales/slices/commands.d.ts +0 -301
- package/dist/core/locales/slices/commands.js +0 -634
- package/dist/core/locales/slices/init.d.ts +0 -153
- package/dist/core/locales/slices/init.js +0 -431
- package/dist/core/locales/slices/interactions.d.ts +0 -47
- package/dist/core/locales/slices/interactions.js +0 -99
- package/dist/core/locales/slices/lang.d.ts +0 -8
- package/dist/core/locales/slices/lang.js +0 -15
- package/dist/core/locales/slices/notices.d.ts +0 -78
- package/dist/core/locales/slices/notices.js +0 -156
- package/dist/core/locales/slices/providers.d.ts +0 -43
- package/dist/core/locales/slices/providers.js +0 -87
- package/dist/core/locales/slices/scheduling.d.ts +0 -33
- package/dist/core/locales/slices/scheduling.js +0 -65
- package/dist/core/locales/slices/startup.d.ts +0 -10
- package/dist/core/locales/slices/startup.js +0 -19
- package/dist/core/locales/slices/status.d.ts +0 -48
- package/dist/core/locales/slices/status.js +0 -109
- package/dist/core/locales/slices/tui.d.ts +0 -93
- package/dist/core/locales/slices/tui.js +0 -192
- package/dist/core/locales/slices/uiextra.d.ts +0 -49
- package/dist/core/locales/slices/uiextra.js +0 -102
- package/dist/core/locales/slices/uimsg.d.ts +0 -74
- package/dist/core/locales/slices/uimsg.js +0 -158
- package/dist/core/locales/zh.d.ts +0 -5
- package/dist/core/locales/zh.js +0 -30
- package/dist/core/log.d.ts +0 -16
- package/dist/core/log.js +0 -174
- package/dist/core/loopback-http.d.ts +0 -6
- package/dist/core/loopback-http.js +0 -43
- package/dist/core/mcp-bundles.d.ts +0 -8
- package/dist/core/mcp-bundles.js +0 -47
- package/dist/core/mcp-timeout.d.ts +0 -1
- package/dist/core/mcp-timeout.js +0 -1
- package/dist/core/mcp-tool-gate.d.ts +0 -25
- package/dist/core/mcp-tool-gate.js +0 -97
- package/dist/core/media-types.d.ts +0 -20
- package/dist/core/media-types.js +0 -63
- package/dist/core/models-generator.d.ts +0 -29
- package/dist/core/models-generator.js +0 -82
- package/dist/core/native-name.d.ts +0 -4
- package/dist/core/native-name.js +0 -57
- package/dist/core/paths.d.ts +0 -63
- package/dist/core/paths.js +0 -105
- package/dist/core/pi-sdk.d.ts +0 -38
- package/dist/core/pi-session-filename.d.ts +0 -10
- package/dist/core/pi-session-filename.js +0 -49
- package/dist/core/platform-settings-spec.d.ts +0 -47
- package/dist/core/platform-settings-spec.js +0 -28
- package/dist/core/private-dir.d.ts +0 -13
- package/dist/core/private-dir.js +0 -48
- package/dist/core/process-command-line.d.ts +0 -6
- package/dist/core/process-command-line.js +0 -39
- package/dist/core/prompt-template.d.ts +0 -14
- package/dist/core/prompt-template.js +0 -29
- package/dist/core/rebuild-progress.d.ts +0 -59
- package/dist/core/rebuild-progress.js +0 -106
- package/dist/core/resilient-watch.d.ts +0 -28
- package/dist/core/resilient-watch.js +0 -108
- package/dist/core/resume-reminder.d.ts +0 -5
- package/dist/core/resume-reminder.js +0 -12
- package/dist/core/run-registry.d.ts +0 -134
- package/dist/core/run-registry.js +0 -256
- package/dist/core/runtime-env.d.ts +0 -1
- package/dist/core/runtime-env.js +0 -11
- package/dist/core/session-holds.d.ts +0 -88
- package/dist/core/session-holds.js +0 -168
- package/dist/core/session-state.d.ts +0 -32
- package/dist/core/session-state.js +0 -39
- package/dist/core/session-todos.d.ts +0 -12
- package/dist/core/session-todos.js +0 -44
- package/dist/core/settings-migration.d.ts +0 -5
- package/dist/core/settings-migration.js +0 -128
- package/dist/core/settings-spec.d.ts +0 -301
- package/dist/core/settings-spec.js +0 -309
- package/dist/core/settings.d.ts +0 -19
- package/dist/core/settings.js +0 -492
- package/dist/core/short-session-id.d.ts +0 -2
- package/dist/core/short-session-id.js +0 -4
- package/dist/core/singleton-lock.d.ts +0 -39
- package/dist/core/singleton-lock.js +0 -127
- package/dist/core/status-format.d.ts +0 -70
- package/dist/core/status-format.js +0 -59
- package/dist/core/subagent-spawn.d.ts +0 -40
- package/dist/core/subagent-spawn.js +0 -47
- package/dist/core/team-action.d.ts +0 -28
- package/dist/core/team-action.js +0 -65
- package/dist/core/todo.d.ts +0 -18
- package/dist/core/todo.js +0 -79
- package/dist/core/tool-names.d.ts +0 -12
- package/dist/core/tool-names.js +0 -65
- package/dist/core/types/agent-types.d.ts +0 -173
- package/dist/core/types/agent-types.js +0 -1
- package/dist/core/types/environment-types.d.ts +0 -45
- package/dist/core/types/environment-types.js +0 -1
- package/dist/core/utils.d.ts +0 -72
- package/dist/core/utils.js +0 -176
- package/dist/core/version.d.ts +0 -6
- package/dist/core/version.js +0 -11
- package/dist/core/workspace-filenames.d.ts +0 -9
- package/dist/core/workspace-filenames.js +0 -61
- package/dist/domain/agents/agent-state.d.ts +0 -19
- package/dist/domain/agents/agent-state.js +0 -73
- package/dist/domain/agents/agent-switch.d.ts +0 -16
- package/dist/domain/agents/agent-switch.js +0 -30
- package/dist/domain/agents/config.d.ts +0 -20
- package/dist/domain/agents/config.js +0 -89
- package/dist/domain/agents/engine-selection.d.ts +0 -21
- package/dist/domain/agents/engine-selection.js +0 -37
- package/dist/domain/agents/environments/entities.d.ts +0 -50
- package/dist/domain/agents/environments/entities.js +0 -94
- package/dist/domain/agents/environments/file-refs.d.ts +0 -20
- package/dist/domain/agents/environments/file-refs.js +0 -51
- package/dist/domain/agents/environments/index.d.ts +0 -7
- package/dist/domain/agents/environments/index.js +0 -9
- package/dist/domain/agents/environments/paths.d.ts +0 -7
- package/dist/domain/agents/environments/paths.js +0 -9
- package/dist/domain/agents/environments/prompt-includes.d.ts +0 -1
- package/dist/domain/agents/environments/prompt-includes.js +0 -91
- package/dist/domain/agents/environments/registry.d.ts +0 -17
- package/dist/domain/agents/environments/registry.js +0 -163
- package/dist/domain/agents/environments/resolve.d.ts +0 -11
- package/dist/domain/agents/environments/resolve.js +0 -36
- package/dist/domain/agents/environments/schema.d.ts +0 -69
- package/dist/domain/agents/environments/schema.js +0 -115
- package/dist/domain/agents/environments/schema.parity.d.ts +0 -1
- package/dist/domain/agents/environments/schema.parity.js +0 -7
- package/dist/domain/agents/environments/system-prompt.d.ts +0 -37
- package/dist/domain/agents/environments/system-prompt.js +0 -110
- package/dist/domain/agents/index.d.ts +0 -6
- package/dist/domain/agents/index.js +0 -7
- package/dist/domain/agents/model-selection.d.ts +0 -30
- package/dist/domain/agents/model-selection.js +0 -111
- package/dist/domain/agents/models.d.ts +0 -12
- package/dist/domain/agents/models.js +0 -94
- package/dist/domain/agents/provider-run-lifecycle.d.ts +0 -11
- package/dist/domain/agents/provider-run-lifecycle.js +0 -17
- package/dist/domain/agents/subagent/background-spend.d.ts +0 -17
- package/dist/domain/agents/subagent/background-spend.js +0 -42
- package/dist/domain/agents/subagent/foreign.d.ts +0 -13
- package/dist/domain/agents/subagent/foreign.js +0 -30
- package/dist/domain/agents/subagent/registry.d.ts +0 -106
- package/dist/domain/agents/subagent/registry.js +0 -272
- package/dist/domain/agents/subagent/runner.d.ts +0 -61
- package/dist/domain/agents/subagent/runner.js +0 -301
- package/dist/domain/agents/subagent/service.d.ts +0 -26
- package/dist/domain/agents/subagent/service.js +0 -68
- package/dist/domain/auth/anthropic-env.d.ts +0 -20
- package/dist/domain/auth/anthropic-env.js +0 -132
- package/dist/domain/auth/auth-events.d.ts +0 -18
- package/dist/domain/auth/auth-events.js +0 -34
- package/dist/domain/auth/auth-format.d.ts +0 -2
- package/dist/domain/auth/auth-format.js +0 -53
- package/dist/domain/auth/auth-status.d.ts +0 -63
- package/dist/domain/auth/auth-status.js +0 -286
- package/dist/domain/auth/auth-watch.d.ts +0 -16
- package/dist/domain/auth/auth-watch.js +0 -166
- package/dist/domain/auth/cc-auth-cli.d.ts +0 -30
- package/dist/domain/auth/cc-login.d.ts +0 -7
- package/dist/domain/auth/cc-login.js +0 -20
- package/dist/domain/auth/cc-subscription.d.ts +0 -18
- package/dist/domain/auth/cc-subscription.js +0 -54
- package/dist/domain/auth/claude-account-credentials.d.ts +0 -13
- package/dist/domain/auth/claude-account-credentials.js +0 -22
- package/dist/domain/auth/claude-user-settings.d.ts +0 -22
- package/dist/domain/auth/claude-user-settings.js +0 -104
- package/dist/domain/auth/codex-credentials.d.ts +0 -13
- package/dist/domain/auth/codex-credentials.js +0 -25
- package/dist/domain/auth/gateway-sync.d.ts +0 -19
- package/dist/domain/auth/gateway-sync.js +0 -46
- package/dist/domain/auth/index.d.ts +0 -14
- package/dist/domain/auth/index.js +0 -14
- package/dist/domain/auth/login-flow.d.ts +0 -141
- package/dist/domain/auth/login-flow.js +0 -339
- package/dist/domain/auth/login-service.d.ts +0 -33
- package/dist/domain/auth/login-service.js +0 -65
- package/dist/domain/auth/logout.d.ts +0 -32
- package/dist/domain/auth/logout.js +0 -156
- package/dist/domain/auth/pi-login.d.ts +0 -26
- package/dist/domain/auth/pi-login.js +0 -70
- package/dist/domain/auth/pi-oauth.d.ts +0 -26
- package/dist/domain/auth/pi-oauth.js +0 -85
- package/dist/domain/auth/pi-runtime.d.ts +0 -82
- package/dist/domain/auth/pi-runtime.js +0 -40
- package/dist/domain/benchmark/accounting-reconciliation.d.ts +0 -117
- package/dist/domain/benchmark/accounting-reconciliation.js +0 -174
- package/dist/domain/benchmark/atif.d.ts +0 -42
- package/dist/domain/benchmark/atif.js +0 -263
- package/dist/domain/benchmark/attempt-record.d.ts +0 -167
- package/dist/domain/benchmark/attempt-record.js +0 -113
- package/dist/domain/benchmark/benchmark-types.d.ts +0 -17
- package/dist/domain/benchmark/benchmark-types.js +0 -1
- package/dist/domain/benchmark/composite-manifest.d.ts +0 -117
- package/dist/domain/benchmark/composite-manifest.js +0 -477
- package/dist/domain/benchmark/decimal-text.d.ts +0 -22
- package/dist/domain/benchmark/decimal-text.js +0 -42
- package/dist/domain/benchmark/identity.d.ts +0 -39
- package/dist/domain/benchmark/identity.js +0 -70
- package/dist/domain/benchmark/journal.d.ts +0 -47
- package/dist/domain/benchmark/journal.js +0 -254
- package/dist/domain/benchmark/manifest-contract.d.ts +0 -30
- package/dist/domain/benchmark/manifest-contract.js +0 -118
- package/dist/domain/benchmark/production-attempt-identity.d.ts +0 -73
- package/dist/domain/benchmark/production-attempt-identity.js +0 -372
- package/dist/domain/benchmark/production-attempt-journal.d.ts +0 -38
- package/dist/domain/benchmark/production-attempt-journal.js +0 -267
- package/dist/domain/benchmark/production-benchmark-evidence.d.ts +0 -2
- package/dist/domain/benchmark/production-benchmark-evidence.js +0 -67
- package/dist/domain/benchmark/production-evidence-export.d.ts +0 -14
- package/dist/domain/benchmark/production-evidence-export.js +0 -134
- package/dist/domain/benchmark/production-evidence-journal.d.ts +0 -11
- package/dist/domain/benchmark/production-evidence-journal.js +0 -81
- package/dist/domain/benchmark/production-evidence-projection.d.ts +0 -39
- package/dist/domain/benchmark/production-evidence-projection.js +0 -392
- package/dist/domain/benchmark/role-surface.d.ts +0 -4
- package/dist/domain/benchmark/role-surface.js +0 -117
- package/dist/domain/benchmark/session-evidence.d.ts +0 -7
- package/dist/domain/benchmark/session-evidence.js +0 -34
- package/dist/domain/boards/board-context.d.ts +0 -17
- package/dist/domain/boards/board-context.js +0 -11
- package/dist/domain/boards/board-paths.d.ts +0 -18
- package/dist/domain/boards/board-paths.js +0 -32
- package/dist/domain/boards/board-service.d.ts +0 -50
- package/dist/domain/boards/board-service.js +0 -146
- package/dist/domain/boards/board-watcher.d.ts +0 -36
- package/dist/domain/boards/board-watcher.js +0 -284
- package/dist/domain/boards/decision-projection.d.ts +0 -46
- package/dist/domain/boards/decision-projection.js +0 -44
- package/dist/domain/browser/broker.d.ts +0 -99
- package/dist/domain/browser/broker.js +0 -487
- package/dist/domain/costs/account-reset.d.ts +0 -30
- package/dist/domain/costs/account-reset.js +0 -98
- package/dist/domain/costs/aistatus-config.d.ts +0 -27
- package/dist/domain/costs/aistatus-config.js +0 -56
- package/dist/domain/costs/claude-account.d.ts +0 -34
- package/dist/domain/costs/claude-account.js +0 -170
- package/dist/domain/costs/codex-account.d.ts +0 -55
- package/dist/domain/costs/codex-account.js +0 -155
- package/dist/domain/costs/cost-tracker.d.ts +0 -181
- package/dist/domain/costs/cost-tracker.js +0 -350
- package/dist/domain/costs/gateway-manager.d.ts +0 -6
- package/dist/domain/costs/gateway-manager.js +0 -225
- package/dist/domain/costs/rate-limit-throttle.d.ts +0 -78
- package/dist/domain/costs/rate-limit-throttle.js +0 -502
- package/dist/domain/costs/reset-account.d.ts +0 -36
- package/dist/domain/costs/reset-account.js +0 -5
- package/dist/domain/costs/resume-registry.d.ts +0 -30
- package/dist/domain/costs/resume-registry.js +0 -108
- package/dist/domain/costs/usage-service.d.ts +0 -80
- package/dist/domain/costs/usage-service.js +0 -618
- package/dist/domain/costs/usage-store.d.ts +0 -83
- package/dist/domain/costs/usage-store.js +0 -104
- package/dist/domain/executions/registry.d.ts +0 -47
- package/dist/domain/executions/registry.js +0 -100
- package/dist/domain/hooks/hook-view.d.ts +0 -22
- package/dist/domain/hooks/hook-view.js +0 -34
- package/dist/domain/mcp/bundled-server.d.ts +0 -19
- package/dist/domain/mcp/feishu/client.d.ts +0 -46
- package/dist/domain/mcp/feishu/client.js +0 -91
- package/dist/domain/mcp/feishu/file.d.ts +0 -14
- package/dist/domain/mcp/feishu/file.js +0 -88
- package/dist/domain/mcp/feishu/types.d.ts +0 -31
- package/dist/domain/mcp/feishu/types.js +0 -34
- package/dist/domain/mcp/feishu/user-auth.d.ts +0 -140
- package/dist/domain/mcp/feishu/user-auth.js +0 -278
- package/dist/domain/mcp/tools/agents-md.d.ts +0 -16
- package/dist/domain/mcp/tools/agents-md.js +0 -34
- package/dist/domain/mcp/tools/catalog-owner.d.ts +0 -3
- package/dist/domain/mcp/tools/catalog-owner.js +0 -23
- package/dist/domain/mcp/tools/context.d.ts +0 -69
- package/dist/domain/mcp/tools/context.js +0 -106
- package/dist/domain/mcp/tools/cost.d.ts +0 -2
- package/dist/domain/mcp/tools/cost.js +0 -56
- package/dist/domain/mcp/tools/executions.d.ts +0 -2
- package/dist/domain/mcp/tools/executions.js +0 -71
- package/dist/domain/mcp/tools/interaction-ask.d.ts +0 -37
- package/dist/domain/mcp/tools/interaction-ask.js +0 -131
- package/dist/domain/mcp/tools/interaction-plan.d.ts +0 -34
- package/dist/domain/mcp/tools/interaction-plan.js +0 -116
- package/dist/domain/mcp/tools/remote-devices.d.ts +0 -9
- package/dist/domain/mcp/tools/remote-devices.js +0 -28
- package/dist/domain/mcp/tools/remote-file.d.ts +0 -24
- package/dist/domain/mcp/tools/remote-file.js +0 -52
- package/dist/domain/mcp/tools/remote-ops.d.ts +0 -3
- package/dist/domain/mcp/tools/remote-ops.js +0 -359
- package/dist/domain/mcp/tools/slack.d.ts +0 -23
- package/dist/domain/mcp/tools/slack.js +0 -106
- package/dist/domain/mcp/tools/subagent.d.ts +0 -23
- package/dist/domain/mcp/tools/subagent.js +0 -179
- package/dist/domain/mcp/tools/time.d.ts +0 -2
- package/dist/domain/mcp/tools/time.js +0 -62
- package/dist/domain/mcp/tools/ui-board.d.ts +0 -12
- package/dist/domain/mcp/tools/ui-board.js +0 -48
- package/dist/domain/mcp/tools/ui-decision.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-decision.js +0 -37
- package/dist/domain/mcp/tools/ui-file.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-file.js +0 -70
- package/dist/domain/mcp/tools/ui-view.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-view.js +0 -44
- package/dist/domain/mcp/tools/waitpoint.d.ts +0 -28
- package/dist/domain/mcp/tools/waitpoint.js +0 -109
- package/dist/domain/mcp/tools/workers.d.ts +0 -5
- package/dist/domain/mcp/tools/workers.js +0 -77
- package/dist/domain/memory/agents-md-injector.d.ts +0 -25
- package/dist/domain/memory/agents-md-injector.js +0 -58
- package/dist/domain/memory/consolidate.d.ts +0 -56
- package/dist/domain/memory/consolidate.js +0 -419
- package/dist/domain/memory/index-regen.d.ts +0 -30
- package/dist/domain/memory/index-regen.js +0 -334
- package/dist/domain/memory/rules-loader.d.ts +0 -6
- package/dist/domain/memory/rules-loader.js +0 -13
- package/dist/domain/memory/user-context.d.ts +0 -5
- package/dist/domain/memory/user-context.js +0 -32
- package/dist/domain/memory/watcher.d.ts +0 -8
- package/dist/domain/memory/watcher.js +0 -135
- package/dist/domain/monitor/disk-monitor.d.ts +0 -17
- package/dist/domain/monitor/disk-monitor.js +0 -117
- package/dist/domain/monitor/event-loop-monitor.d.ts +0 -35
- package/dist/domain/monitor/event-loop-monitor.js +0 -64
- package/dist/domain/monitor/gpu-monitor.d.ts +0 -26
- package/dist/domain/monitor/gpu-monitor.js +0 -132
- package/dist/domain/pi-providers/custom-provider-model.d.ts +0 -49
- package/dist/domain/pi-providers/custom-provider-model.js +0 -116
- package/dist/domain/pi-providers/custom-provider-service.d.ts +0 -57
- package/dist/domain/pi-providers/custom-provider-service.js +0 -153
- package/dist/domain/pi-providers/gateway-route-store.d.ts +0 -23
- package/dist/domain/pi-providers/gateway-route-store.js +0 -74
- package/dist/domain/pi-providers/index.d.ts +0 -3
- package/dist/domain/pi-providers/index.js +0 -3
- package/dist/domain/pi-providers/models-json-store.d.ts +0 -6
- package/dist/domain/pi-providers/models-json-store.js +0 -73
- package/dist/domain/plugins/agent-plugins-v1.d.ts +0 -58
- package/dist/domain/plugins/agent-plugins-v1.js +0 -84
- package/dist/domain/plugins/authoring.d.ts +0 -46
- package/dist/domain/plugins/authoring.js +0 -335
- package/dist/domain/plugins/builtin.d.ts +0 -25
- package/dist/domain/plugins/builtin.js +0 -44
- package/dist/domain/plugins/catalog-types.d.ts +0 -89
- package/dist/domain/plugins/catalog-types.js +0 -39
- package/dist/domain/plugins/catalog.d.ts +0 -39
- package/dist/domain/plugins/catalog.js +0 -482
- package/dist/domain/plugins/conversation-skills.d.ts +0 -10
- package/dist/domain/plugins/conversation-skills.js +0 -22
- package/dist/domain/plugins/fs-helpers.d.ts +0 -9
- package/dist/domain/plugins/fs-helpers.js +0 -107
- package/dist/domain/plugins/mcp.d.ts +0 -6
- package/dist/domain/plugins/mcp.js +0 -223
- package/dist/domain/plugins/runtime-gc.d.ts +0 -17
- package/dist/domain/plugins/runtime-gc.js +0 -101
- package/dist/domain/plugins/runtime.d.ts +0 -21
- package/dist/domain/plugins/runtime.js +0 -555
- package/dist/domain/plugins/skill-projection.d.ts +0 -19
- package/dist/domain/plugins/skill-projection.js +0 -193
- package/dist/domain/plugins/skill.d.ts +0 -14
- package/dist/domain/plugins/skill.js +0 -145
- package/dist/domain/projects/index.d.ts +0 -3
- package/dist/domain/projects/index.js +0 -3
- package/dist/domain/projects/project-store.d.ts +0 -72
- package/dist/domain/projects/project-store.js +0 -240
- package/dist/domain/projects/project-types.d.ts +0 -11
- package/dist/domain/projects/project-types.js +0 -1
- package/dist/domain/remote/client-bootstrap.d.ts +0 -1
- package/dist/domain/remote/client-bootstrap.js +0 -126
- package/dist/domain/remote/client-hot-reload.d.ts +0 -40
- package/dist/domain/remote/client-hot-reload.js +0 -269
- package/dist/domain/remote/client-lifecycle.d.ts +0 -32
- package/dist/domain/remote/client-lifecycle.js +0 -382
- package/dist/domain/remote/client-manager.d.ts +0 -54
- package/dist/domain/remote/client-manager.js +0 -325
- package/dist/domain/remote/client-pids.d.ts +0 -13
- package/dist/domain/remote/client-pids.js +0 -43
- package/dist/domain/remote/client-protocol.d.ts +0 -1
- package/dist/domain/remote/client-protocol.js +0 -1
- package/dist/domain/remote/client-remove.d.ts +0 -61
- package/dist/domain/remote/client-remove.js +0 -129
- package/dist/domain/remote/client-ssh-tunnel.d.ts +0 -79
- package/dist/domain/remote/client-ssh-tunnel.js +0 -352
- package/dist/domain/remote/device-browser.d.ts +0 -38
- package/dist/domain/remote/device-browser.js +0 -158
- package/dist/domain/remote/device-chrome-commands.d.ts +0 -18
- package/dist/domain/remote/device-chrome-commands.js +0 -125
- package/dist/domain/remote/device-file.d.ts +0 -51
- package/dist/domain/remote/device-file.js +0 -193
- package/dist/domain/remote/device-port.d.ts +0 -23
- package/dist/domain/remote/device-port.js +0 -192
- package/dist/domain/remote/local-client-install.d.ts +0 -32
- package/dist/domain/remote/local-client-install.js +0 -168
- package/dist/domain/remote/local-client-stop.d.ts +0 -37
- package/dist/domain/remote/local-client-stop.js +0 -101
- package/dist/domain/remote/machine-registry.d.ts +0 -54
- package/dist/domain/remote/machine-registry.js +0 -184
- package/dist/domain/remote/owned-local-launch.d.ts +0 -22
- package/dist/domain/remote/owned-local-launch.js +0 -75
- package/dist/domain/remote/package-client-bundle.d.ts +0 -14
- package/dist/domain/remote/package-client-bundle.js +0 -37
- package/dist/domain/remote/reverse-stream.d.ts +0 -42
- package/dist/domain/remote/reverse-stream.js +0 -95
- package/dist/domain/remote/ssh-exec.d.ts +0 -10
- package/dist/domain/remote/ssh-exec.js +0 -25
- package/dist/domain/runs/adapters.d.ts +0 -15
- package/dist/domain/runs/adapters.js +0 -59
- package/dist/domain/runs/attempt.d.ts +0 -37
- package/dist/domain/runs/attempt.js +0 -232
- package/dist/domain/runs/builders.d.ts +0 -27
- package/dist/domain/runs/builders.js +0 -47
- package/dist/domain/runs/compact.d.ts +0 -30
- package/dist/domain/runs/compact.js +0 -43
- package/dist/domain/runs/config-resolver.d.ts +0 -26
- package/dist/domain/runs/config-resolver.js +0 -38
- package/dist/domain/runs/engine-spec.d.ts +0 -40
- package/dist/domain/runs/engine-spec.js +0 -215
- package/dist/domain/runs/engines.d.ts +0 -71
- package/dist/domain/runs/engines.js +0 -181
- package/dist/domain/runs/events.d.ts +0 -2
- package/dist/domain/runs/events.js +0 -1
- package/dist/domain/runs/fallback.d.ts +0 -11
- package/dist/domain/runs/fallback.js +0 -18
- package/dist/domain/runs/mode-env.d.ts +0 -16
- package/dist/domain/runs/mode-env.js +0 -48
- package/dist/domain/runs/notices.d.ts +0 -44
- package/dist/domain/runs/notices.js +0 -109
- package/dist/domain/runs/observers/resume-recorder.d.ts +0 -26
- package/dist/domain/runs/observers/resume-recorder.js +0 -27
- package/dist/domain/runs/prompt.d.ts +0 -78
- package/dist/domain/runs/prompt.js +0 -98
- package/dist/domain/runs/request.d.ts +0 -99
- package/dist/domain/runs/request.js +0 -1
- package/dist/domain/runs/retryable-errors.d.ts +0 -5
- package/dist/domain/runs/retryable-errors.js +0 -24
- package/dist/domain/runs/run.d.ts +0 -238
- package/dist/domain/runs/run.js +0 -574
- package/dist/domain/runs/service.d.ts +0 -3
- package/dist/domain/runs/service.js +0 -63
- package/dist/domain/runs/spec-loader.d.ts +0 -75
- package/dist/domain/runs/spec-loader.js +0 -58
- package/dist/domain/runs/spend.d.ts +0 -16
- package/dist/domain/runs/spend.js +0 -31
- package/dist/domain/scheduling/builtin-job-controller.d.ts +0 -21
- package/dist/domain/scheduling/builtin-job-controller.js +0 -106
- package/dist/domain/scheduling/builtin-job-migration.d.ts +0 -23
- package/dist/domain/scheduling/builtin-job-migration.js +0 -64
- package/dist/domain/scheduling/builtin-jobs.d.ts +0 -2
- package/dist/domain/scheduling/builtin-jobs.js +0 -44
- package/dist/domain/scheduling/job-registry.d.ts +0 -22
- package/dist/domain/scheduling/job-registry.js +0 -16
- package/dist/domain/scheduling/jobs/auth-expiry-scan.d.ts +0 -15
- package/dist/domain/scheduling/jobs/auth-expiry-scan.js +0 -75
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +0 -24
- package/dist/domain/scheduling/jobs/scheduled-task.js +0 -112
- package/dist/domain/scheduling/jobs/sync-public.d.ts +0 -4
- package/dist/domain/scheduling/jobs/sync-public.js +0 -40
- package/dist/domain/scheduling/run-guards.d.ts +0 -6
- package/dist/domain/scheduling/run-guards.js +0 -18
- package/dist/domain/scheduling/runner.d.ts +0 -17
- package/dist/domain/scheduling/runner.js +0 -22
- package/dist/domain/scheduling/schedule-ops.d.ts +0 -15
- package/dist/domain/scheduling/schedule-ops.js +0 -43
- package/dist/domain/scheduling/schedule-selection.d.ts +0 -3
- package/dist/domain/scheduling/schedule-selection.js +0 -16
- package/dist/domain/scheduling/schedule-spec.d.ts +0 -79
- package/dist/domain/scheduling/schedule-spec.js +0 -169
- package/dist/domain/scheduling/scheduler.d.ts +0 -75
- package/dist/domain/scheduling/scheduler.js +0 -312
- package/dist/domain/sessions/session-backup.d.ts +0 -44
- package/dist/domain/sessions/session-backup.js +0 -138
- package/dist/domain/sessions/session-hooks.d.ts +0 -130
- package/dist/domain/sessions/session-hooks.js +0 -347
- package/dist/domain/sessions/session-lifecycle.d.ts +0 -91
- package/dist/domain/sessions/session-lifecycle.js +0 -82
- package/dist/domain/sessions/session-retention.d.ts +0 -50
- package/dist/domain/sessions/session-retention.js +0 -466
- package/dist/domain/sessions/session-use.d.ts +0 -28
- package/dist/domain/sessions/session-use.js +0 -45
- package/dist/domain/sessions/session.d.ts +0 -3
- package/dist/domain/sessions/session.js +0 -13
- package/dist/domain/sessions/team.d.ts +0 -26
- package/dist/domain/sessions/team.js +0 -30
- package/dist/domain/system/doctor.d.ts +0 -82
- package/dist/domain/system/doctor.js +0 -484
- package/dist/domain/system/github-release.d.ts +0 -16
- package/dist/domain/system/github-release.js +0 -101
- package/dist/domain/system/install-cli.d.ts +0 -7
- package/dist/domain/system/install-cli.js +0 -107
- package/dist/domain/system/notice-history.d.ts +0 -18
- package/dist/domain/system/notice-history.js +0 -23
- package/dist/domain/system/own-bin-path.d.ts +0 -13
- package/dist/domain/system/own-bin-path.js +0 -36
- package/dist/domain/system/preferences.d.ts +0 -30
- package/dist/domain/system/preferences.js +0 -59
- package/dist/domain/system/rebuild-hold.d.ts +0 -36
- package/dist/domain/system/rebuild-hold.js +0 -83
- package/dist/domain/system/server-update-check.d.ts +0 -24
- package/dist/domain/system/server-update-check.js +0 -89
- package/dist/domain/system/server-update-coordinator.d.ts +0 -46
- package/dist/domain/system/server-update-coordinator.js +0 -155
- package/dist/domain/system/server-update-install.d.ts +0 -16
- package/dist/domain/system/server-update-install.js +0 -65
- package/dist/domain/system/system-notice.d.ts +0 -24
- package/dist/domain/system/system-notice.js +0 -31
- package/dist/domain/system/terminal-cli/index.d.ts +0 -58
- package/dist/domain/system/terminal-cli/index.js +0 -100
- package/dist/domain/system/terminal-cli/posix-profiles.d.ts +0 -23
- package/dist/domain/system/terminal-cli/posix-profiles.js +0 -74
- package/dist/domain/system/terminal-cli/registrar.d.ts +0 -12
- package/dist/domain/system/terminal-cli/registrar.js +0 -1
- package/dist/domain/system/terminal-cli/shims.d.ts +0 -27
- package/dist/domain/system/terminal-cli/shims.js +0 -108
- package/dist/domain/system/terminal-cli/state.d.ts +0 -7
- package/dist/domain/system/terminal-cli/state.js +0 -36
- package/dist/domain/system/terminal-cli/windows-user-path.d.ts +0 -13
- package/dist/domain/system/terminal-cli/windows-user-path.js +0 -67
- package/dist/domain/system/update-prompt.d.ts +0 -8
- package/dist/domain/system/update-prompt.js +0 -1
- package/dist/domain/system/update-state.d.ts +0 -9
- package/dist/domain/system/update-state.js +0 -22
- package/dist/domain/system/update-ui-state.d.ts +0 -39
- package/dist/domain/system/update-ui-state.js +0 -70
- package/dist/domain/telemetry/bus-collector.d.ts +0 -3
- package/dist/domain/telemetry/bus-collector.js +0 -22
- package/dist/domain/telemetry/child-exit.d.ts +0 -11
- package/dist/domain/telemetry/child-exit.js +0 -36
- package/dist/domain/telemetry/client-kind.d.ts +0 -4
- package/dist/domain/telemetry/client-kind.js +0 -7
- package/dist/domain/telemetry/crash-limits.d.ts +0 -15
- package/dist/domain/telemetry/crash-limits.js +0 -50
- package/dist/domain/telemetry/crash.d.ts +0 -25
- package/dist/domain/telemetry/crash.js +0 -70
- package/dist/domain/telemetry/daily-upload.d.ts +0 -5
- package/dist/domain/telemetry/daily-upload.js +0 -20
- package/dist/domain/telemetry/daily.d.ts +0 -5
- package/dist/domain/telemetry/daily.js +0 -104
- package/dist/domain/telemetry/endpoint.d.ts +0 -7
- package/dist/domain/telemetry/endpoint.js +0 -40
- package/dist/domain/telemetry/envelope.d.ts +0 -6
- package/dist/domain/telemetry/envelope.js +0 -35
- package/dist/domain/telemetry/error-digest.d.ts +0 -7
- package/dist/domain/telemetry/error-digest.js +0 -43
- package/dist/domain/telemetry/funnel.d.ts +0 -6
- package/dist/domain/telemetry/funnel.js +0 -22
- package/dist/domain/telemetry/gate.d.ts +0 -19
- package/dist/domain/telemetry/gate.js +0 -67
- package/dist/domain/telemetry/heartbeat.d.ts +0 -17
- package/dist/domain/telemetry/heartbeat.js +0 -49
- package/dist/domain/telemetry/info.d.ts +0 -9
- package/dist/domain/telemetry/info.js +0 -12
- package/dist/domain/telemetry/init-answer.d.ts +0 -12
- package/dist/domain/telemetry/init-answer.js +0 -42
- package/dist/domain/telemetry/install-id.d.ts +0 -5
- package/dist/domain/telemetry/install-id.js +0 -42
- package/dist/domain/telemetry/normalize.d.ts +0 -33
- package/dist/domain/telemetry/normalize.js +0 -88
- package/dist/domain/telemetry/outbox.d.ts +0 -18
- package/dist/domain/telemetry/outbox.js +0 -93
- package/dist/domain/telemetry/panic-group.d.ts +0 -4
- package/dist/domain/telemetry/panic-group.js +0 -51
- package/dist/domain/telemetry/paths.d.ts +0 -7
- package/dist/domain/telemetry/paths.js +0 -11
- package/dist/domain/telemetry/redact.d.ts +0 -18
- package/dist/domain/telemetry/redact.js +0 -109
- package/dist/domain/telemetry/rollup-types.d.ts +0 -81
- package/dist/domain/telemetry/rollup-types.js +0 -31
- package/dist/domain/telemetry/rollup.d.ts +0 -16
- package/dist/domain/telemetry/rollup.js +0 -102
- package/dist/domain/telemetry/schema.d.ts +0 -931
- package/dist/domain/telemetry/schema.js +0 -275
- package/dist/domain/telemetry/service.d.ts +0 -34
- package/dist/domain/telemetry/service.js +0 -146
- package/dist/domain/telemetry/state.d.ts +0 -17
- package/dist/domain/telemetry/state.js +0 -29
- package/dist/domain/telemetry/turns.d.ts +0 -17
- package/dist/domain/telemetry/turns.js +0 -176
- package/dist/domain/telemetry/upgrade.d.ts +0 -14
- package/dist/domain/telemetry/upgrade.js +0 -87
- package/dist/domain/telemetry/uploader.d.ts +0 -21
- package/dist/domain/telemetry/uploader.js +0 -82
- package/dist/domain/telemetry/usage.d.ts +0 -25
- package/dist/domain/telemetry/usage.js +0 -153
- package/dist/domain/telemetry/web-report.d.ts +0 -8
- package/dist/domain/telemetry/web-report.js +0 -15
- package/dist/domain/tui-session/index.d.ts +0 -2
- package/dist/domain/tui-session/index.js +0 -1
- package/dist/domain/tui-session/tui-session-service.d.ts +0 -2
- package/dist/domain/tui-session/tui-session-service.js +0 -85
- package/dist/domain/tui-session/types.d.ts +0 -40
- package/dist/domain/tui-session/types.js +0 -1
- package/dist/domain/ui-service/app-router.d.ts +0 -1180
- package/dist/domain/ui-service/app-router.js +0 -312
- package/dist/domain/ui-service/assistant-snapshots.d.ts +0 -10
- package/dist/domain/ui-service/assistant-snapshots.js +0 -45
- package/dist/domain/ui-service/contract.parity.d.ts +0 -19
- package/dist/domain/ui-service/contract.parity.js +0 -1
- package/dist/domain/ui-service/index.d.ts +0 -4
- package/dist/domain/ui-service/index.js +0 -1
- package/dist/domain/ui-service/inline-media-types.d.ts +0 -18
- package/dist/domain/ui-service/inline-media-types.js +0 -1
- package/dist/domain/ui-service/input-schemas.d.ts +0 -1132
- package/dist/domain/ui-service/input-schemas.js +0 -710
- package/dist/domain/ui-service/mutate/approvals.d.ts +0 -33
- package/dist/domain/ui-service/mutate/approvals.js +0 -134
- package/dist/domain/ui-service/mutate/auth.d.ts +0 -15
- package/dist/domain/ui-service/mutate/auth.js +0 -103
- package/dist/domain/ui-service/mutate/config.d.ts +0 -18
- package/dist/domain/ui-service/mutate/config.js +0 -108
- package/dist/domain/ui-service/mutate/custom-providers.d.ts +0 -8
- package/dist/domain/ui-service/mutate/custom-providers.js +0 -33
- package/dist/domain/ui-service/mutate/environments.d.ts +0 -27
- package/dist/domain/ui-service/mutate/environments.js +0 -66
- package/dist/domain/ui-service/mutate/errors.d.ts +0 -7
- package/dist/domain/ui-service/mutate/errors.js +0 -14
- package/dist/domain/ui-service/mutate/executions.d.ts +0 -4
- package/dist/domain/ui-service/mutate/executions.js +0 -15
- package/dist/domain/ui-service/mutate/hooks.d.ts +0 -12
- package/dist/domain/ui-service/mutate/hooks.js +0 -110
- package/dist/domain/ui-service/mutate/issues.d.ts +0 -18
- package/dist/domain/ui-service/mutate/issues.js +0 -100
- package/dist/domain/ui-service/mutate/models.d.ts +0 -13
- package/dist/domain/ui-service/mutate/models.js +0 -137
- package/dist/domain/ui-service/mutate/notes.d.ts +0 -6
- package/dist/domain/ui-service/mutate/notes.js +0 -32
- package/dist/domain/ui-service/mutate/platform-settings.d.ts +0 -6
- package/dist/domain/ui-service/mutate/platform-settings.js +0 -17
- package/dist/domain/ui-service/mutate/plugin-packages.d.ts +0 -10
- package/dist/domain/ui-service/mutate/plugin-packages.js +0 -152
- package/dist/domain/ui-service/mutate/plugins.d.ts +0 -2
- package/dist/domain/ui-service/mutate/plugins.js +0 -38
- package/dist/domain/ui-service/mutate/projects.d.ts +0 -4
- package/dist/domain/ui-service/mutate/projects.js +0 -7
- package/dist/domain/ui-service/mutate/resolve-media.d.ts +0 -4
- package/dist/domain/ui-service/mutate/resolve-media.js +0 -17
- package/dist/domain/ui-service/mutate/schedules.d.ts +0 -12
- package/dist/domain/ui-service/mutate/schedules.js +0 -75
- package/dist/domain/ui-service/mutate/session-metadata.d.ts +0 -3
- package/dist/domain/ui-service/mutate/session-metadata.js +0 -22
- package/dist/domain/ui-service/mutate/sessions.d.ts +0 -19
- package/dist/domain/ui-service/mutate/sessions.js +0 -307
- package/dist/domain/ui-service/mutate/system.d.ts +0 -10
- package/dist/domain/ui-service/mutate/system.js +0 -120
- package/dist/domain/ui-service/mutate/telemetry.d.ts +0 -5
- package/dist/domain/ui-service/mutate/telemetry.js +0 -6
- package/dist/domain/ui-service/mutate/usage-sharing.d.ts +0 -8
- package/dist/domain/ui-service/mutate/usage-sharing.js +0 -16
- package/dist/domain/ui-service/mutate/waitpoints.d.ts +0 -2
- package/dist/domain/ui-service/mutate/waitpoints.js +0 -13
- package/dist/domain/ui-service/platform-settings.d.ts +0 -5
- package/dist/domain/ui-service/platform-settings.js +0 -72
- package/dist/domain/ui-service/plugins-shared.d.ts +0 -29
- package/dist/domain/ui-service/plugins-shared.js +0 -176
- package/dist/domain/ui-service/query/approvals.d.ts +0 -10
- package/dist/domain/ui-service/query/approvals.js +0 -119
- package/dist/domain/ui-service/query/auth.d.ts +0 -6
- package/dist/domain/ui-service/query/auth.js +0 -8
- package/dist/domain/ui-service/query/boards.d.ts +0 -14
- package/dist/domain/ui-service/query/boards.js +0 -111
- package/dist/domain/ui-service/query/config.d.ts +0 -9
- package/dist/domain/ui-service/query/config.js +0 -167
- package/dist/domain/ui-service/query/cost.d.ts +0 -3
- package/dist/domain/ui-service/query/cost.js +0 -3
- package/dist/domain/ui-service/query/custom-providers.d.ts +0 -8
- package/dist/domain/ui-service/query/custom-providers.js +0 -9
- package/dist/domain/ui-service/query/environments.d.ts +0 -12
- package/dist/domain/ui-service/query/environments.js +0 -73
- package/dist/domain/ui-service/query/executions.d.ts +0 -3
- package/dist/domain/ui-service/query/executions.js +0 -61
- package/dist/domain/ui-service/query/hooks.d.ts +0 -9
- package/dist/domain/ui-service/query/hooks.js +0 -92
- package/dist/domain/ui-service/query/issues.d.ts +0 -14
- package/dist/domain/ui-service/query/issues.js +0 -78
- package/dist/domain/ui-service/query/machine-detail.d.ts +0 -2
- package/dist/domain/ui-service/query/machine-detail.js +0 -30
- package/dist/domain/ui-service/query/machine-probe.d.ts +0 -18
- package/dist/domain/ui-service/query/machine-probe.js +0 -133
- package/dist/domain/ui-service/query/machines.d.ts +0 -2
- package/dist/domain/ui-service/query/machines.js +0 -21
- package/dist/domain/ui-service/query/memory.d.ts +0 -7
- package/dist/domain/ui-service/query/memory.js +0 -191
- package/dist/domain/ui-service/query/models.d.ts +0 -27
- package/dist/domain/ui-service/query/models.js +0 -125
- package/dist/domain/ui-service/query/notes.d.ts +0 -3
- package/dist/domain/ui-service/query/notes.js +0 -15
- package/dist/domain/ui-service/query/plugin-source.d.ts +0 -4
- package/dist/domain/ui-service/query/plugin-source.js +0 -58
- package/dist/domain/ui-service/query/plugins.d.ts +0 -2
- package/dist/domain/ui-service/query/plugins.js +0 -28
- package/dist/domain/ui-service/query/projects.d.ts +0 -2
- package/dist/domain/ui-service/query/projects.js +0 -27
- package/dist/domain/ui-service/query/schedules.d.ts +0 -5
- package/dist/domain/ui-service/query/schedules.js +0 -28
- package/dist/domain/ui-service/query/sessions.d.ts +0 -6
- package/dist/domain/ui-service/query/sessions.js +0 -430
- package/dist/domain/ui-service/query/skills.d.ts +0 -5
- package/dist/domain/ui-service/query/skills.js +0 -16
- package/dist/domain/ui-service/query/system.d.ts +0 -6
- package/dist/domain/ui-service/query/system.js +0 -120
- package/dist/domain/ui-service/query/telemetry.d.ts +0 -3
- package/dist/domain/ui-service/query/telemetry.js +0 -4
- package/dist/domain/ui-service/query/usage-sharing.d.ts +0 -4
- package/dist/domain/ui-service/query/usage-sharing.js +0 -5
- package/dist/domain/ui-service/query/waitpoints.d.ts +0 -10
- package/dist/domain/ui-service/query/waitpoints.js +0 -37
- package/dist/domain/ui-service/query-input-schemas.d.ts +0 -73
- package/dist/domain/ui-service/query-input-schemas.js +0 -70
- package/dist/domain/ui-service/session-metadata-schemas.d.ts +0 -13
- package/dist/domain/ui-service/session-metadata-schemas.js +0 -9
- package/dist/domain/ui-service/subscribe.d.ts +0 -6
- package/dist/domain/ui-service/subscribe.js +0 -125
- package/dist/domain/ui-service/trpc.d.ts +0 -52
- package/dist/domain/ui-service/trpc.js +0 -43
- package/dist/domain/ui-service/types.d.ts +0 -1808
- package/dist/domain/ui-service/types.js +0 -1
- package/dist/domain/ui-service/ui-service.d.ts +0 -541
- package/dist/domain/ui-service/ui-service.js +0 -235
- package/dist/domain/waitpoints/notices.d.ts +0 -25
- package/dist/domain/waitpoints/notices.js +0 -125
- package/dist/domain/waitpoints/service.d.ts +0 -107
- package/dist/domain/waitpoints/service.js +0 -276
- package/dist/domain/waitpoints/view.d.ts +0 -29
- package/dist/domain/waitpoints/view.js +0 -97
- package/dist/entry/admin-channel-hot-reload.d.ts +0 -4
- package/dist/entry/admin-channel-hot-reload.js +0 -17
- package/dist/entry/app.d.ts +0 -1
- package/dist/entry/auth-cli.d.ts +0 -9
- package/dist/entry/auth-cli.js +0 -55
- package/dist/entry/auth-login-cli.d.ts +0 -20
- package/dist/entry/auth-login-cli.js +0 -153
- package/dist/entry/auth-login-terminal.d.ts +0 -16
- package/dist/entry/auth-login-terminal.js +0 -59
- package/dist/entry/boot-jobs.d.ts +0 -7
- package/dist/entry/boot-jobs.js +0 -16
- package/dist/entry/browser-cli.d.ts +0 -39
- package/dist/entry/cli-help.d.ts +0 -10
- package/dist/entry/cli-help.js +0 -290
- package/dist/entry/cli.d.ts +0 -19
- package/dist/entry/client-cli.d.ts +0 -4
- package/dist/entry/client-cli.js +0 -62
- package/dist/entry/cortex-cli.d.ts +0 -1
- package/dist/entry/daemon-notice.d.ts +0 -26
- package/dist/entry/daemon-notice.js +0 -38
- package/dist/entry/daemon.d.ts +0 -120
- package/dist/entry/doctor-cli.d.ts +0 -8
- package/dist/entry/doctor-cli.js +0 -70
- package/dist/entry/draft-attachments.d.ts +0 -8
- package/dist/entry/draft-attachments.js +0 -79
- package/dist/entry/fast-install.d.ts +0 -49
- package/dist/entry/fast-install.js +0 -192
- package/dist/entry/feishu-login.d.ts +0 -21
- package/dist/entry/feishu-login.js +0 -209
- package/dist/entry/hook-cli.d.ts +0 -14
- package/dist/entry/init-auth.d.ts +0 -4
- package/dist/entry/init-auth.js +0 -42
- package/dist/entry/init-git.d.ts +0 -6
- package/dist/entry/init-git.js +0 -36
- package/dist/entry/init-local-client.d.ts +0 -11
- package/dist/entry/init-local-client.js +0 -34
- package/dist/entry/init.d.ts +0 -151
- package/dist/entry/init.js +0 -1292
- package/dist/entry/local-ui.d.ts +0 -38
- package/dist/entry/local-ui.js +0 -107
- package/dist/entry/memory-cli.d.ts +0 -3
- package/dist/entry/memory-cli.js +0 -79
- package/dist/entry/path-cli.d.ts +0 -4
- package/dist/entry/path-cli.js +0 -65
- package/dist/entry/platform-connect.d.ts +0 -23
- package/dist/entry/platform-connect.js +0 -94
- package/dist/entry/production-app-bootstrap.d.ts +0 -1
- package/dist/entry/production-evidence-export-cli.d.ts +0 -13
- package/dist/entry/provider-cli.d.ts +0 -12
- package/dist/entry/provider-cli.js +0 -199
- package/dist/entry/schedule-cli.d.ts +0 -10
- package/dist/entry/schedule-cli.js +0 -166
- package/dist/entry/shutdown.d.ts +0 -32
- package/dist/entry/shutdown.js +0 -84
- package/dist/entry/signal-cli.d.ts +0 -25
- package/dist/entry/start-ui-http.d.ts +0 -24
- package/dist/entry/start-ui-http.js +0 -188
- package/dist/entry/startup-helpers.d.ts +0 -2
- package/dist/entry/startup-helpers.js +0 -15
- package/dist/entry/startup-notify.d.ts +0 -6
- package/dist/entry/startup-notify.js +0 -18
- package/dist/entry/telemetry-wiring.d.ts +0 -12
- package/dist/entry/telemetry-wiring.js +0 -56
- package/dist/entry/ui-cli.d.ts +0 -2
- package/dist/entry/ui-cli.js +0 -87
- package/dist/entry/ui-http-gate.d.ts +0 -17
- package/dist/entry/ui-http-gate.js +0 -17
- package/dist/entry/ui-service-wiring.d.ts +0 -12
- package/dist/entry/ui-service-wiring.js +0 -144
- package/dist/events/event-bus.d.ts +0 -47
- package/dist/events/event-bus.js +0 -83
- package/dist/events/event-logger.d.ts +0 -12
- package/dist/events/event-logger.js +0 -144
- package/dist/events/event-types.d.ts +0 -259
- package/dist/events/event-types.js +0 -1
- package/dist/events/index.d.ts +0 -5
- package/dist/events/index.js +0 -2
- package/dist/orchestration/agent-decision-send.d.ts +0 -42
- package/dist/orchestration/agent-decision-send.js +0 -62
- package/dist/orchestration/agent-file-send.d.ts +0 -58
- package/dist/orchestration/agent-file-send.js +0 -69
- package/dist/orchestration/agent-runner.d.ts +0 -52
- package/dist/orchestration/agent-runner.js +0 -230
- package/dist/orchestration/agent-view-send.d.ts +0 -66
- package/dist/orchestration/agent-view-send.js +0 -103
- package/dist/orchestration/attachments-store.d.ts +0 -31
- package/dist/orchestration/attachments-store.js +0 -156
- package/dist/orchestration/benchmark-session-webhook.d.ts +0 -19
- package/dist/orchestration/benchmark-session-webhook.js +0 -142
- package/dist/orchestration/board-webhook.d.ts +0 -7
- package/dist/orchestration/board-webhook.js +0 -38
- package/dist/orchestration/browser-webhook.d.ts +0 -11
- package/dist/orchestration/browser-webhook.js +0 -28
- package/dist/orchestration/busy-tracker.d.ts +0 -15
- package/dist/orchestration/busy-tracker.js +0 -38
- package/dist/orchestration/cache-keep-warm.d.ts +0 -77
- package/dist/orchestration/cache-keep-warm.js +0 -213
- package/dist/orchestration/claude-window-warmup.d.ts +0 -40
- package/dist/orchestration/claude-window-warmup.js +0 -126
- package/dist/orchestration/conduit-queue.d.ts +0 -14
- package/dist/orchestration/conduit-queue.js +0 -53
- package/dist/orchestration/conversation-request.d.ts +0 -163
- package/dist/orchestration/conversation-request.js +0 -276
- package/dist/orchestration/delta-coalescer.d.ts +0 -69
- package/dist/orchestration/delta-coalescer.js +0 -120
- package/dist/orchestration/durable-helpers.d.ts +0 -3
- package/dist/orchestration/durable-helpers.js +0 -38
- package/dist/orchestration/edit-retry.d.ts +0 -35
- package/dist/orchestration/edit-retry.js +0 -127
- package/dist/orchestration/injection-ledger.d.ts +0 -56
- package/dist/orchestration/injection-ledger.js +0 -270
- package/dist/orchestration/inline-media-eager.d.ts +0 -13
- package/dist/orchestration/inline-media-eager.js +0 -58
- package/dist/orchestration/inline-media.d.ts +0 -22
- package/dist/orchestration/inline-media.js +0 -151
- package/dist/orchestration/interactions/answer-question.d.ts +0 -16
- package/dist/orchestration/interactions/answer-question.js +0 -38
- package/dist/orchestration/interactions/ask-user-question.d.ts +0 -34
- package/dist/orchestration/interactions/ask-user-question.js +0 -179
- package/dist/orchestration/interactions/ask-user-resume.d.ts +0 -11
- package/dist/orchestration/interactions/ask-user-resume.js +0 -57
- package/dist/orchestration/interactions/command-action-router.d.ts +0 -31
- package/dist/orchestration/interactions/command-action-router.js +0 -48
- package/dist/orchestration/interactions/interaction-handlers.d.ts +0 -5
- package/dist/orchestration/interactions/interaction-handlers.js +0 -288
- package/dist/orchestration/interactions/interaction-records.d.ts +0 -57
- package/dist/orchestration/interactions/interaction-records.js +0 -142
- package/dist/orchestration/interactions/plan-approvals.d.ts +0 -38
- package/dist/orchestration/interactions/plan-approvals.js +0 -73
- package/dist/orchestration/interactions/plan-handler.d.ts +0 -3
- package/dist/orchestration/interactions/plan-handler.js +0 -13
- package/dist/orchestration/interactions/plan-response.d.ts +0 -9
- package/dist/orchestration/interactions/plan-response.js +0 -23
- package/dist/orchestration/interactions/ui-update-prompt.d.ts +0 -8
- package/dist/orchestration/interactions/ui-update-prompt.js +0 -39
- package/dist/orchestration/interactions/update-prompt.d.ts +0 -6
- package/dist/orchestration/interactions/update-prompt.js +0 -150
- package/dist/orchestration/mid-turn-inject.d.ts +0 -64
- package/dist/orchestration/mid-turn-inject.js +0 -103
- package/dist/orchestration/orchestrator.d.ts +0 -23
- package/dist/orchestration/orchestrator.js +0 -12
- package/dist/orchestration/outputs-store.d.ts +0 -40
- package/dist/orchestration/outputs-store.js +0 -83
- package/dist/orchestration/pending-injection-recovery.d.ts +0 -36
- package/dist/orchestration/pending-injection-recovery.js +0 -88
- package/dist/orchestration/pi-background-subagent.d.ts +0 -15
- package/dist/orchestration/pi-background-subagent.js +0 -34
- package/dist/orchestration/resume-dispatcher.d.ts +0 -20
- package/dist/orchestration/resume-dispatcher.js +0 -97
- package/dist/orchestration/resume-target-sink.d.ts +0 -37
- package/dist/orchestration/resume-target-sink.js +0 -68
- package/dist/orchestration/routing/commands/cancel.d.ts +0 -58
- package/dist/orchestration/routing/commands/cancel.js +0 -212
- package/dist/orchestration/routing/commands/channel.d.ts +0 -7
- package/dist/orchestration/routing/commands/channel.js +0 -229
- package/dist/orchestration/routing/commands/command-context.d.ts +0 -14
- package/dist/orchestration/routing/commands/command-context.js +0 -1
- package/dist/orchestration/routing/commands/compact.d.ts +0 -6
- package/dist/orchestration/routing/commands/compact.js +0 -22
- package/dist/orchestration/routing/commands/cost.d.ts +0 -11
- package/dist/orchestration/routing/commands/cost.js +0 -101
- package/dist/orchestration/routing/commands/device.d.ts +0 -4
- package/dist/orchestration/routing/commands/device.js +0 -70
- package/dist/orchestration/routing/commands/index.d.ts +0 -22
- package/dist/orchestration/routing/commands/index.js +0 -160
- package/dist/orchestration/routing/commands/lang.d.ts +0 -9
- package/dist/orchestration/routing/commands/lang.js +0 -34
- package/dist/orchestration/routing/commands/login-custom.d.ts +0 -26
- package/dist/orchestration/routing/commands/login-custom.js +0 -85
- package/dist/orchestration/routing/commands/login-notice.d.ts +0 -23
- package/dist/orchestration/routing/commands/login-notice.js +0 -84
- package/dist/orchestration/routing/commands/login.d.ts +0 -12
- package/dist/orchestration/routing/commands/login.js +0 -560
- package/dist/orchestration/routing/commands/mode.d.ts +0 -10
- package/dist/orchestration/routing/commands/mode.js +0 -302
- package/dist/orchestration/routing/commands/nvtop.d.ts +0 -3
- package/dist/orchestration/routing/commands/nvtop.js +0 -107
- package/dist/orchestration/routing/commands/orient.d.ts +0 -2
- package/dist/orchestration/routing/commands/orient.js +0 -5
- package/dist/orchestration/routing/commands/restart.d.ts +0 -18
- package/dist/orchestration/routing/commands/restart.js +0 -31
- package/dist/orchestration/routing/commands/schedule.d.ts +0 -6
- package/dist/orchestration/routing/commands/schedule.js +0 -206
- package/dist/orchestration/routing/commands/sendfile.d.ts +0 -2
- package/dist/orchestration/routing/commands/sendfile.js +0 -97
- package/dist/orchestration/routing/commands/session.d.ts +0 -18
- package/dist/orchestration/routing/commands/session.js +0 -131
- package/dist/orchestration/routing/commands/status.d.ts +0 -5
- package/dist/orchestration/routing/commands/status.js +0 -165
- package/dist/orchestration/routing/commands/tail.d.ts +0 -2
- package/dist/orchestration/routing/commands/tail.js +0 -79
- package/dist/orchestration/routing/commands/time-ago.d.ts +0 -2
- package/dist/orchestration/routing/commands/time-ago.js +0 -14
- package/dist/orchestration/routing/commands/usage-format.d.ts +0 -5
- package/dist/orchestration/routing/commands/usage-format.js +0 -107
- package/dist/orchestration/routing/commands/usage-reset.d.ts +0 -20
- package/dist/orchestration/routing/commands/usage-reset.js +0 -123
- package/dist/orchestration/routing/commands/usage.d.ts +0 -10
- package/dist/orchestration/routing/commands/usage.js +0 -54
- package/dist/orchestration/routing/edit-handler.d.ts +0 -27
- package/dist/orchestration/routing/edit-handler.js +0 -205
- package/dist/orchestration/routing/file-handler.d.ts +0 -15
- package/dist/orchestration/routing/file-handler.js +0 -39
- package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +0 -14
- package/dist/orchestration/routing/hook-bridge-subscribers.js +0 -174
- package/dist/orchestration/routing/hook-bridge.d.ts +0 -28
- package/dist/orchestration/routing/hook-bridge.js +0 -104
- package/dist/orchestration/routing/message-router.d.ts +0 -6
- package/dist/orchestration/routing/message-router.js +0 -62
- package/dist/orchestration/routing/webhook.d.ts +0 -10
- package/dist/orchestration/routing/webhook.js +0 -434
- package/dist/orchestration/runtime.d.ts +0 -30
- package/dist/orchestration/runtime.js +0 -37
- package/dist/orchestration/session-compact.d.ts +0 -50
- package/dist/orchestration/session-compact.js +0 -84
- package/dist/orchestration/session-events.d.ts +0 -173
- package/dist/orchestration/session-events.js +0 -140
- package/dist/orchestration/session-gateway.d.ts +0 -52
- package/dist/orchestration/session-gateway.js +0 -87
- package/dist/orchestration/session-retention-controller.d.ts +0 -14
- package/dist/orchestration/session-retention-controller.js +0 -88
- package/dist/orchestration/session-retention-liveness.d.ts +0 -13
- package/dist/orchestration/session-retention-liveness.js +0 -31
- package/dist/orchestration/session-rewind.d.ts +0 -79
- package/dist/orchestration/session-rewind.js +0 -147
- package/dist/orchestration/status-helpers.d.ts +0 -40
- package/dist/orchestration/status-helpers.js +0 -177
- package/dist/orchestration/subagent-adopt.d.ts +0 -20
- package/dist/orchestration/subagent-adopt.js +0 -43
- package/dist/orchestration/subagent-attribution.d.ts +0 -42
- package/dist/orchestration/subagent-attribution.js +0 -130
- package/dist/orchestration/subagent-delivery.d.ts +0 -43
- package/dist/orchestration/subagent-delivery.js +0 -112
- package/dist/orchestration/subagent-rows.d.ts +0 -11
- package/dist/orchestration/subagent-rows.js +0 -16
- package/dist/orchestration/subagent-webhook.d.ts +0 -6
- package/dist/orchestration/subagent-webhook.js +0 -89
- package/dist/orchestration/team-delivery.d.ts +0 -81
- package/dist/orchestration/team-delivery.js +0 -284
- package/dist/orchestration/team-inbox.d.ts +0 -18
- package/dist/orchestration/team-inbox.js +0 -49
- package/dist/orchestration/team-state.d.ts +0 -74
- package/dist/orchestration/team-state.js +0 -219
- package/dist/orchestration/team-webhook.d.ts +0 -57
- package/dist/orchestration/team-webhook.js +0 -293
- package/dist/orchestration/transcript-sink.d.ts +0 -83
- package/dist/orchestration/transcript-sink.js +0 -267
- package/dist/orchestration/turn/active-turns.d.ts +0 -49
- package/dist/orchestration/turn/active-turns.js +0 -76
- package/dist/orchestration/turn/background-hold.d.ts +0 -158
- package/dist/orchestration/turn/background-hold.js +0 -240
- package/dist/orchestration/turn/hold-render-platform.d.ts +0 -35
- package/dist/orchestration/turn/hold-render-platform.js +0 -105
- package/dist/orchestration/turn/hold-render-web.d.ts +0 -17
- package/dist/orchestration/turn/hold-render-web.js +0 -51
- package/dist/orchestration/turn/terminal.d.ts +0 -105
- package/dist/orchestration/turn/terminal.js +0 -194
- package/dist/orchestration/turn/turn-prep.d.ts +0 -33
- package/dist/orchestration/turn/turn-prep.js +0 -44
- package/dist/orchestration/turn/turn-tracking.d.ts +0 -22
- package/dist/orchestration/turn/turn-tracking.js +0 -89
- package/dist/orchestration/turn/turn.d.ts +0 -199
- package/dist/orchestration/turn/turn.js +0 -586
- package/dist/orchestration/turn-mutation-lock.d.ts +0 -3
- package/dist/orchestration/turn-mutation-lock.js +0 -32
- package/dist/orchestration/turn-notify.d.ts +0 -22
- package/dist/orchestration/turn-notify.js +0 -50
- package/dist/orchestration/waitpoint-ingress.d.ts +0 -36
- package/dist/orchestration/waitpoint-ingress.js +0 -183
- package/dist/orchestration/waitpoint-notifier.d.ts +0 -32
- package/dist/orchestration/waitpoint-notifier.js +0 -140
- package/dist/orchestration/waitpoint-remote-drain.d.ts +0 -22
- package/dist/orchestration/waitpoint-remote-drain.js +0 -134
- package/dist/orchestration/waitpoint-sweep.d.ts +0 -43
- package/dist/orchestration/waitpoint-sweep.js +0 -84
- package/dist/platform/adapter.d.ts +0 -48
- package/dist/platform/adapter.js +0 -1
- package/dist/platform/adapters/chunked-output-stream.d.ts +0 -71
- package/dist/platform/adapters/chunked-output-stream.js +0 -382
- package/dist/platform/adapters/composite-adapter.d.ts +0 -99
- package/dist/platform/adapters/composite-adapter.js +0 -369
- package/dist/platform/adapters/feishu-http.d.ts +0 -46
- package/dist/platform/adapters/feishu-http.js +0 -108
- package/dist/platform/adapters/feishu-image.d.ts +0 -19
- package/dist/platform/adapters/feishu-image.js +0 -64
- package/dist/platform/adapters/feishu-output-stream.d.ts +0 -11
- package/dist/platform/adapters/feishu-output-stream.js +0 -29
- package/dist/platform/adapters/feishu.d.ts +0 -167
- package/dist/platform/adapters/feishu.js +0 -1059
- package/dist/platform/adapters/index.d.ts +0 -19
- package/dist/platform/adapters/index.js +0 -108
- package/dist/platform/adapters/project-conduits.d.ts +0 -9
- package/dist/platform/adapters/project-conduits.js +0 -36
- package/dist/platform/adapters/slack-output-stream.d.ts +0 -15
- package/dist/platform/adapters/slack-output-stream.js +0 -33
- package/dist/platform/adapters/slack.d.ts +0 -106
- package/dist/platform/adapters/slack.js +0 -733
- package/dist/platform/adapters/tui/index.d.ts +0 -2
- package/dist/platform/adapters/tui/index.js +0 -2
- package/dist/platform/adapters/tui/ports.d.ts +0 -46
- package/dist/platform/adapters/tui/ports.js +0 -1
- package/dist/platform/adapters/tui/tui-connection.d.ts +0 -20
- package/dist/platform/adapters/tui/tui-connection.js +0 -44
- package/dist/platform/adapters/tui/tui-gateway.d.ts +0 -90
- package/dist/platform/adapters/tui/tui-gateway.js +0 -884
- package/dist/platform/adapters/tui/tui-output-stream.d.ts +0 -35
- package/dist/platform/adapters/tui/tui-output-stream.js +0 -94
- package/dist/platform/adapters/tui/tui-transcript.d.ts +0 -8
- package/dist/platform/adapters/tui/tui-transcript.js +0 -42
- package/dist/platform/browser/agent-browser.d.ts +0 -50
- package/dist/platform/browser/agent-browser.js +0 -165
- package/dist/platform/browser/display.d.ts +0 -48
- package/dist/platform/browser/display.js +0 -188
- package/dist/platform/browser/managed-browser.d.ts +0 -23
- package/dist/platform/browser/managed-browser.js +0 -357
- package/dist/platform/index.d.ts +0 -10
- package/dist/platform/index.js +0 -6
- package/dist/platform/interactive-builder.d.ts +0 -34
- package/dist/platform/interactive-builder.js +0 -138
- package/dist/platform/output-stream-chunk.d.ts +0 -6
- package/dist/platform/output-stream-chunk.js +0 -42
- package/dist/platform/output-stream-helpers.d.ts +0 -8
- package/dist/platform/output-stream-helpers.js +0 -19
- package/dist/platform/output-stream.d.ts +0 -35
- package/dist/platform/output-stream.js +0 -1
- package/dist/platform/testing.d.ts +0 -136
- package/dist/platform/testing.js +0 -286
- package/dist/platform/tool-trace.d.ts +0 -35
- package/dist/platform/tool-trace.js +0 -287
- package/dist/platform/tui/protocol.d.ts +0 -352
- package/dist/platform/tui/protocol.js +0 -146
- package/dist/platform/types.d.ts +0 -223
- package/dist/platform/types.js +0 -22
- package/dist/platform/ui-http/access-jwt.d.ts +0 -28
- package/dist/platform/ui-http/access-jwt.js +0 -53
- package/dist/platform/ui-http/app-update.d.ts +0 -69
- package/dist/platform/ui-http/app-update.js +0 -143
- package/dist/platform/ui-http/browser-stream.d.ts +0 -110
- package/dist/platform/ui-http/browser-stream.js +0 -447
- package/dist/platform/ui-http/device-ports.d.ts +0 -34
- package/dist/platform/ui-http/device-ports.js +0 -102
- package/dist/platform/ui-http/file-routes.d.ts +0 -23
- package/dist/platform/ui-http/file-routes.js +0 -224
- package/dist/platform/ui-http/http-json.d.ts +0 -24
- package/dist/platform/ui-http/http-json.js +0 -109
- package/dist/platform/ui-http/listening-ports.d.ts +0 -98
- package/dist/platform/ui-http/listening-ports.js +0 -239
- package/dist/platform/ui-http/port-forward.d.ts +0 -40
- package/dist/platform/ui-http/port-forward.js +0 -130
- package/dist/platform/ui-http/ui-auth-routes.d.ts +0 -51
- package/dist/platform/ui-http/ui-auth-routes.js +0 -120
- package/dist/platform/ui-http/ui-device-routes.d.ts +0 -13
- package/dist/platform/ui-http/ui-device-routes.js +0 -81
- package/dist/platform/ui-http/ui-devices.d.ts +0 -24
- package/dist/platform/ui-http/ui-devices.js +0 -107
- package/dist/platform/ui-http/ui-http-server.d.ts +0 -100
- package/dist/platform/ui-http/ui-http-server.js +0 -310
- package/dist/platform/ui-http/ui-ota.d.ts +0 -22
- package/dist/platform/ui-http/ui-ota.js +0 -151
- package/dist/platform/ui-http/ui-pairing.d.ts +0 -25
- package/dist/platform/ui-http/ui-pairing.js +0 -98
- package/dist/platform/ui-http/ui-session.d.ts +0 -33
- package/dist/platform/ui-http/ui-session.js +0 -124
- package/dist/platform/ui-http/zip-writer.d.ts +0 -13
- package/dist/platform/ui-http/zip-writer.js +0 -93
- package/dist/platform/utils/rate-limiter.d.ts +0 -90
- package/dist/platform/utils/rate-limiter.js +0 -203
- package/dist/platform/utils/reaction-diagnostics.d.ts +0 -9
- package/dist/platform/utils/reaction-diagnostics.js +0 -19
- package/dist/platform/utils/readable-file.d.ts +0 -9
- package/dist/platform/utils/readable-file.js +0 -18
- package/dist/store/board-migration.d.ts +0 -21
- package/dist/store/board-migration.js +0 -217
- package/dist/store/board-repo.d.ts +0 -35
- package/dist/store/board-repo.js +0 -62
- package/dist/store/builtin-overlay-migration.d.ts +0 -11
- package/dist/store/builtin-overlay-migration.js +0 -308
- package/dist/store/claude-transcript-migration.d.ts +0 -32
- package/dist/store/claude-transcript-migration.js +0 -119
- package/dist/store/conversation-display-projection.d.ts +0 -36
- package/dist/store/conversation-display-projection.js +0 -180
- package/dist/store/conversation-history-reader.d.ts +0 -30
- package/dist/store/conversation-history-reader.js +0 -440
- package/dist/store/conversation-history-repo.d.ts +0 -449
- package/dist/store/conversation-history-repo.js +0 -632
- package/dist/store/conversation-ledger-repo.d.ts +0 -76
- package/dist/store/conversation-ledger-repo.js +0 -219
- package/dist/store/cost-repo.d.ts +0 -88
- package/dist/store/cost-repo.js +0 -233
- package/dist/store/execution-repo.d.ts +0 -169
- package/dist/store/execution-repo.js +0 -329
- package/dist/store/gitignore-migration.d.ts +0 -2
- package/dist/store/gitignore-migration.js +0 -16
- package/dist/store/hook-registry.d.ts +0 -101
- package/dist/store/hook-registry.js +0 -319
- package/dist/store/hook-writer.d.ts +0 -43
- package/dist/store/hook-writer.js +0 -133
- package/dist/store/models-repo.d.ts +0 -18
- package/dist/store/models-repo.js +0 -74
- package/dist/store/outbound-queue.d.ts +0 -67
- package/dist/store/outbound-queue.js +0 -284
- package/dist/store/pending-injection-repo.d.ts +0 -29
- package/dist/store/pending-injection-repo.js +0 -52
- package/dist/store/project-dir-repo.d.ts +0 -17
- package/dist/store/project-dir-repo.js +0 -44
- package/dist/store/project-notes-repo.d.ts +0 -27
- package/dist/store/project-notes-repo.js +0 -219
- package/dist/store/prompt-migration-replacements.d.ts +0 -3
- package/dist/store/prompt-migration-replacements.js +0 -96
- package/dist/store/provider-state-repo.d.ts +0 -22
- package/dist/store/provider-state-repo.js +0 -115
- package/dist/store/retention-candidate-repo.d.ts +0 -12
- package/dist/store/retention-candidate-repo.js +0 -47
- package/dist/store/retire-profiles-migration.d.ts +0 -28
- package/dist/store/retire-profiles-migration.js +0 -335
- package/dist/store/schedule-repo.d.ts +0 -53
- package/dist/store/schedule-repo.js +0 -121
- package/dist/store/session-registry-import.d.ts +0 -34
- package/dist/store/session-registry-import.js +0 -173
- package/dist/store/session-registry-journal.d.ts +0 -195
- package/dist/store/session-registry-journal.js +0 -871
- package/dist/store/session-registry-repo.d.ts +0 -169
- package/dist/store/session-registry-repo.js +0 -530
- package/dist/store/session-totals-repo.d.ts +0 -45
- package/dist/store/session-totals-repo.js +0 -104
- package/dist/store/session-totals.d.ts +0 -69
- package/dist/store/session-totals.js +0 -93
- package/dist/store/team-inbox-repo.d.ts +0 -34
- package/dist/store/team-inbox-repo.js +0 -72
- package/dist/store/team-outbox-repo.d.ts +0 -20
- package/dist/store/team-outbox-repo.js +0 -39
- package/dist/store/tool-image-files.d.ts +0 -12
- package/dist/store/tool-image-files.js +0 -40
- package/dist/store/version-migrations.d.ts +0 -120
- package/dist/store/version-migrations.js +0 -1408
- package/dist/store/waitpoint-repo.d.ts +0 -111
- package/dist/store/waitpoint-repo.js +0 -83
- package/dist/tui/App.d.ts +0 -27
- package/dist/tui/App.js +0 -406
- package/dist/tui/components/AskUserModal.d.ts +0 -10
- package/dist/tui/components/AskUserModal.js +0 -362
- package/dist/tui/components/ConfirmModal.d.ts +0 -12
- package/dist/tui/components/ConfirmModal.js +0 -29
- package/dist/tui/components/Dashboard.d.ts +0 -24
- package/dist/tui/components/Dashboard.js +0 -89
- package/dist/tui/components/DashboardCostTab.d.ts +0 -7
- package/dist/tui/components/DashboardCostTab.js +0 -32
- package/dist/tui/components/DashboardExecutionsTab.d.ts +0 -11
- package/dist/tui/components/DashboardExecutionsTab.js +0 -112
- package/dist/tui/components/DashboardSchedulesTab.d.ts +0 -11
- package/dist/tui/components/DashboardSchedulesTab.js +0 -132
- package/dist/tui/components/InputBox.d.ts +0 -26
- package/dist/tui/components/InputBox.js +0 -266
- package/dist/tui/components/Notifications.d.ts +0 -12
- package/dist/tui/components/Notifications.js +0 -59
- package/dist/tui/components/ProjectSwitcher.d.ts +0 -17
- package/dist/tui/components/ProjectSwitcher.js +0 -40
- package/dist/tui/components/SessionPicker.d.ts +0 -13
- package/dist/tui/components/SessionPicker.js +0 -42
- package/dist/tui/components/SidePanel.d.ts +0 -19
- package/dist/tui/components/SidePanel.js +0 -8
- package/dist/tui/components/SlashMenu.d.ts +0 -8
- package/dist/tui/components/SlashMenu.js +0 -15
- package/dist/tui/components/StatusLine.d.ts +0 -19
- package/dist/tui/components/StatusLine.js +0 -39
- package/dist/tui/components/Transcript.d.ts +0 -21
- package/dist/tui/components/Transcript.js +0 -150
- package/dist/tui/components/dashboard-constants.d.ts +0 -1
- package/dist/tui/components/dashboard-constants.js +0 -1
- package/dist/tui/hooks/useDashboardData.d.ts +0 -24
- package/dist/tui/hooks/useDashboardData.js +0 -75
- package/dist/tui/hooks/useKeybindings.d.ts +0 -19
- package/dist/tui/hooks/useKeybindings.js +0 -75
- package/dist/tui/hooks/useMouseHandler.d.ts +0 -15
- package/dist/tui/hooks/useMouseHandler.js +0 -90
- package/dist/tui/hooks/useMutate.d.ts +0 -22
- package/dist/tui/hooks/useMutate.js +0 -54
- package/dist/tui/hooks/useNotifications.d.ts +0 -26
- package/dist/tui/hooks/useNotifications.js +0 -60
- package/dist/tui/hooks/useTranscript.d.ts +0 -42
- package/dist/tui/hooks/useTranscript.js +0 -277
- package/dist/tui/index.d.ts +0 -2
- package/dist/tui/logic.d.ts +0 -144
- package/dist/tui/logic.js +0 -388
- package/dist/tui/raf-batch.d.ts +0 -31
- package/dist/tui/raf-batch.js +0 -89
- package/dist/tui/render/inline-markdown.d.ts +0 -22
- package/dist/tui/render/inline-markdown.js +0 -99
- package/dist/tui/render/markdown.d.ts +0 -10
- package/dist/tui/render/markdown.js +0 -35
- package/dist/tui/render-output.d.ts +0 -42
- package/dist/tui/render-output.js +0 -81
- package/dist/tui/slash-commands.d.ts +0 -21
- package/dist/tui/slash-commands.js +0 -71
- package/dist/tui/turn-status.d.ts +0 -10
- package/dist/tui/turn-status.js +0 -48
- package/dist/tui/ws-client.d.ts +0 -39
- package/dist/tui/ws-client.js +0 -139
- package/scripts/install-bundled-dependencies.mjs +0 -54
- package/web/dist/assets/board-math-css-spk7yR6n.js +0 -2
- package/web/dist/assets/index-BQ69u-92.css +0 -1
- package/web/dist/assets/index-CKNLatCd.js +0 -1
- package/web/dist/assets/index-CkzWfC98.js +0 -525
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{c as p}from"./chunk-WHC7AYZD.js";var w=p((Ei,Ee)=>{"use strict";var st="2.0.0",nt=Number.MAX_SAFE_INTEGER||9007199254740991,it=16,ot=250,ct=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Ee.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:it,MAX_SAFE_BUILD_LENGTH:ot,MAX_SAFE_INTEGER:nt,RELEASE_TYPES:ct,SEMVER_SPEC_VERSION:st,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var P=p((hi,he)=>{"use strict";var lt=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};he.exports=lt});var g=p((A,pe)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:Y,MAX_SAFE_BUILD_LENGTH:at,MAX_LENGTH:ut}=w(),ft=P();A=pe.exports={};var Et=A.re=[],ht=A.safeRe=[],c=A.src=[],pt=A.safeSrc=[],l=A.t={},Rt=0,M="[a-zA-Z0-9-]",$t=[["\\s",1],["\\d",ut],[M,at]],mt=t=>{for(let[e,r]of $t)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},R=(t,e,r)=>{let s=mt(e),n=Rt++;ft(t,n,e),l[t]=n,c[n]=e,pt[n]=s,Et[n]=new RegExp(e,r?"g":void 0),ht[n]=new RegExp(s,r?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*");R("NUMERICIDENTIFIERLOOSE","\\d+");R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${M}*`);R("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`);R("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASEIDENTIFIER",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIER]})`);R("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NONNUMERICIDENTIFIER]}|${c[l.NUMERICIDENTIFIERLOOSE]})`);R("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`);R("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`);R("BUILDIDENTIFIER",`${M}+`);R("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`);R("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`);R("FULL",`^${c[l.FULLPLAIN]}$`);R("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`);R("LOOSE",`^${c[l.LOOSEPLAIN]}$`);R("GTLT","((?:<|>)?=?)");R("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);R("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`);R("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`);R("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`);R("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`);R("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`);R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Y}})(?:\\.(\\d{1,${Y}}))?(?:\\.(\\d{1,${Y}}))?`);R("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`);R("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`);R("COERCERTL",c[l.COERCE],!0);R("COERCERTLFULL",c[l.COERCEFULL],!0);R("LONETILDE","(?:~>?)");R("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0);A.tildeTrimReplace="$1~";R("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`);R("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`);R("LONECARET","(?:\\^)");R("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0);A.caretTrimReplace="$1^";R("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`);R("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`);R("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`);R("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`);R("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0);A.comparatorTrimReplace="$1$2$3";R("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`);R("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`);R("STAR","(<|>)?=?\\s*\\*");R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var G=p((pi,Re)=>{"use strict";var It=Object.freeze({loose:!0}),Lt=Object.freeze({}),Nt=t=>t?typeof t!="object"?It:t:Lt;Re.exports=Nt});var W=p((Ri,Ie)=>{"use strict";var $e=/^[0-9]+$/,me=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=$e.test(t),s=$e.test(e);return r&&s&&(t=+t,e=+e),t===e?0:r&&!s?-1:s&&!r?1:t<e?-1:1},Ot=(t,e)=>me(e,t);Ie.exports={compareIdentifiers:me,rcompareIdentifiers:Ot}});var N=p(($i,Ne)=>{"use strict";var y=P(),{MAX_LENGTH:Le,MAX_SAFE_INTEGER:F}=w(),{safeRe:j,t:U}=g(),dt=G(),{compareIdentifiers:z}=W(),St=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let s=0;s<r.length;s++)if(z(t[s],r[s])!==0)return!1;return!0},K=class t{constructor(e,r){if(r=dt(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Le)throw new TypeError(`version is longer than ${Le} characters`);y("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let s=e.trim().match(r.loose?j[U.LOOSE]:j[U.FULL]);if(!s)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+s[1],this.minor=+s[2],this.patch=+s[3],this.major>F||this.major<0)throw new TypeError("Invalid major version");if(this.minor>F||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>F||this.patch<0)throw new TypeError("Invalid patch version");s[4]?this.prerelease=s[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let i=+n;if(i>=0&&i<F)return i}return n}):this.prerelease=[],this.build=s[5]?s[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(y("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let s=this.prerelease[r],n=e.prerelease[r];if(y("prerelease compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return z(s,n)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let s=this.build[r],n=e.build[r];if(y("build compare",r,s,n),s===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(s===void 0)return-1;if(s===n)continue;return z(s,n)}while(++r)}inc(e,r,s){if(e.startsWith("pre")){if(!r&&s===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let n=`-${r}`.match(this.options.loose?j[U.PRERELEASELOOSE]:j[U.PRERELEASE]);if(!n||n[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,s);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,s);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,s),this.inc("pre",r,s);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,s),this.inc("pre",r,s);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let n=Number(s)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let i=this.prerelease.length;for(;--i>=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&s===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(r){let i=[r,n];if(s===!1&&(i=[r]),St(this.prerelease,r)){let o=this.prerelease[r.split(".").length];isNaN(o)&&(this.prerelease=i)}else this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ne.exports=K});var q=p((mi,de)=>{"use strict";var Oe=N(),Tt=(t,e,r=!1)=>{if(t instanceof Oe)return t;try{return new Oe(t,e)}catch(s){if(!r)return null;throw s}};de.exports=Tt});var Te=p((Ii,Se)=>{"use strict";var At=q(),qt=(t,e)=>{let r=At(t,e);return r?r.version:null};Se.exports=qt});var qe=p((Li,Ae)=>{"use strict";var wt=q(),gt=(t,e)=>{let r=wt(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Ae.exports=gt});var Pe=p((Ni,ge)=>{"use strict";var we=N(),Pt=(t,e,r,s,n)=>{typeof r=="string"&&(n=s,s=r,r=void 0);try{return new we(t instanceof we?t.version:t,r).inc(e,s,n).version}catch{return null}};ge.exports=Pt});var Ce=p((Oi,xe)=>{"use strict";var ve=q(),vt=(t,e)=>{let r=ve(t,null,!0),s=ve(e,null,!0),n=r.compare(s);if(n===0)return null;let i=n>0,o=i?r:s,a=i?s:r,u=!!o.prerelease.length;if(!!a.prerelease.length&&!u){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0)return a.minor&&!a.patch?"minor":"patch"}let $=u?"pre":"";return r.major!==s.major?$+"major":r.minor!==s.minor?$+"minor":r.patch!==s.patch?$+"patch":"prerelease"};xe.exports=vt});var Ge=p((di,De)=>{"use strict";var xt=N(),Ct=(t,e)=>new xt(t,e).major;De.exports=Ct});var Fe=p((Si,ye)=>{"use strict";var Dt=N(),Gt=(t,e)=>new Dt(t,e).minor;ye.exports=Gt});var Ue=p((Ti,je)=>{"use strict";var yt=N(),Ft=(t,e)=>new yt(t,e).patch;je.exports=Ft});var Ve=p((Ai,Xe)=>{"use strict";var jt=q(),Ut=(t,e)=>{let r=jt(t,e);return r&&r.prerelease.length?r.prerelease:null};Xe.exports=Ut});var S=p((qi,be)=>{"use strict";var _e=N(),Xt=(t,e,r)=>new _e(t,r).compare(new _e(e,r));be.exports=Xt});var ke=p((wi,He)=>{"use strict";var Vt=S(),_t=(t,e,r)=>Vt(e,t,r);He.exports=_t});var Ye=p((gi,Be)=>{"use strict";var bt=S(),Ht=(t,e)=>bt(t,e,!0);Be.exports=Ht});var X=p((Pi,We)=>{"use strict";var Me=N(),kt=(t,e,r)=>{let s=new Me(t,r),n=new Me(e,r);return s.compare(n)||s.compareBuild(n)};We.exports=kt});var Ke=p((vi,ze)=>{"use strict";var Bt=X(),Yt=(t,e)=>t.sort((r,s)=>Bt(r,s,e));ze.exports=Yt});var Je=p((xi,Ze)=>{"use strict";var Mt=X(),Wt=(t,e)=>t.sort((r,s)=>Mt(s,r,e));Ze.exports=Wt});var v=p((Ci,Qe)=>{"use strict";var zt=S(),Kt=(t,e,r)=>zt(t,e,r)>0;Qe.exports=Kt});var V=p((Di,er)=>{"use strict";var Zt=S(),Jt=(t,e,r)=>Zt(t,e,r)<0;er.exports=Jt});var Z=p((Gi,rr)=>{"use strict";var Qt=S(),es=(t,e,r)=>Qt(t,e,r)===0;rr.exports=es});var J=p((yi,tr)=>{"use strict";var rs=S(),ts=(t,e,r)=>rs(t,e,r)!==0;tr.exports=ts});var _=p((Fi,sr)=>{"use strict";var ss=S(),ns=(t,e,r)=>ss(t,e,r)>=0;sr.exports=ns});var b=p((ji,nr)=>{"use strict";var is=S(),os=(t,e,r)=>is(t,e,r)<=0;nr.exports=os});var Q=p((Ui,ir)=>{"use strict";var cs=Z(),ls=J(),as=v(),us=_(),fs=V(),Es=b(),hs=(t,e,r,s)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return cs(t,r,s);case"!=":return ls(t,r,s);case">":return as(t,r,s);case">=":return us(t,r,s);case"<":return fs(t,r,s);case"<=":return Es(t,r,s);default:throw new TypeError(`Invalid operator: ${e}`)}};ir.exports=hs});var cr=p((Xi,or)=>{"use strict";var ps=N(),Rs=q(),{safeRe:H,t:k}=g(),$s=(t,e)=>{if(t instanceof ps)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?H[k.COERCEFULL]:H[k.COERCE]);else{let u=e.includePrerelease?H[k.COERCERTLFULL]:H[k.COERCERTL],f;for(;(f=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||f.index+f[0].length!==r.index+r[0].length)&&(r=f),u.lastIndex=f.index+f[1].length+f[2].length;u.lastIndex=-1}if(r===null)return null;let s=r[2],n=r[3]||"0",i=r[4]||"0",o=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Rs(`${s}.${n}.${i}${o}${a}`,e)};or.exports=$s});var ar=p((Vi,lr)=>{"use strict";var ms=q(),Is=w(),Ls=N(),Ns=(t,e,r)=>{if(!Is.RELEASE_TYPES.includes(e))return null;let s=Os(t,r);return s&&ds(s,e)},Os=(t,e)=>{let r=t instanceof Ls?t.version:t;return ms(r,e)},ds=(t,e)=>{if(Ss(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Ss=t=>t.startsWith("pre");lr.exports=Ns});var fr=p((_i,ur)=>{"use strict";var ee=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,r)}return this}};ur.exports=ee});var T=p((bi,Rr)=>{"use strict";var Ts=/\s+/g,re=class t{constructor(e,r){if(r=qs(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof te)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Ts," "),this.set=this.raw.split("||").map(s=>this.parseRange(s.trim())).filter(s=>s.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let s=this.set[0];if(this.set=this.set.filter(n=>!hr(n[0])),this.set.length===0)this.set=[s];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&ys(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let s=0;s<r.length;s++)s>0&&(this.formatted+=" "),this.formatted+=r[s].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Gs,"");let s=((this.options.includePrerelease&&Cs)|(this.options.loose&&Ds))+":"+e,n=Er.get(s);if(n)return n;let i=this.options.loose,o=i?d[O.HYPHENRANGELOOSE]:d[O.HYPHENRANGE];e=e.replace(o,Ys(this.options.includePrerelease)),m("hyphen replace",e),e=e.replace(d[O.COMPARATORTRIM],Ps),m("comparator trim",e),e=e.replace(d[O.TILDETRIM],vs),m("tilde trim",e),e=e.replace(d[O.CARETTRIM],xs),m("caret trim",e);let a=e.split(" ").map(E=>Fs(E,this.options)).join(" ").split(/\s+/).map(E=>Bs(E,this.options));i&&(a=a.filter(E=>(m("loose invalid filter",E,this.options),!!E.match(d[O.COMPARATORLOOSE])))),m("range list",a);let u=new Map,f=a.map(E=>new te(E,this.options));for(let E of f){if(hr(E))return[E];u.set(E.value,E)}u.size>1&&u.has("")&&u.delete("");let $=[...u.values()];return Er.set(s,$),$}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(s=>pr(s,r)&&e.set.some(n=>pr(n,r)&&s.every(i=>n.every(o=>i.intersects(o,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new ws(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Ms(this.set[r],e,this.options))return!0;return!1}};Rr.exports=re;var As=fr(),Er=new As,qs=G(),te=x(),m=P(),ws=N(),{safeRe:d,src:gs,t:O,comparatorTrimReplace:Ps,tildeTrimReplace:vs,caretTrimReplace:xs}=g(),{FLAG_INCLUDE_PRERELEASE:Cs,FLAG_LOOSE:Ds}=w(),Gs=new RegExp(gs[O.BUILD],"g"),hr=t=>t.value==="<0.0.0-0",ys=t=>t.value==="",pr=(t,e)=>{let r=!0,s=t.slice(),n=s.pop();for(;r&&s.length;)r=s.every(i=>n.intersects(i,e)),n=s.pop();return r},Fs=(t,e)=>(t=t.replace(d[O.BUILD],""),m("comp",t,e),t=Vs(t,e),m("caret",t),t=Us(t,e),m("tildes",t),t=bs(t,e),m("xrange",t),t=ks(t,e),m("stars",t),t),L=t=>!t||t.toLowerCase()==="x"||t==="*",js=(t,e,r)=>L(t)&&!L(e)||L(e)&&r&&!L(r),Us=(t,e)=>t.trim().split(/\s+/).map(r=>Xs(r,e)).join(" "),Xs=(t,e)=>{let r=e.loose?d[O.TILDELOOSE]:d[O.TILDE],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,u)=>{m("tilde",t,n,i,o,a,u);let f;return L(i)?f="":L(o)?f=`>=${i}.0.0${s} <${+i+1}.0.0-0`:L(a)?f=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:u?(m("replaceTilde pr",u),f=`>=${i}.${o}.${a}-${u} <${i}.${+o+1}.0-0`):f=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`,m("tilde return",f),f})},Vs=(t,e)=>t.trim().split(/\s+/).map(r=>_s(r,e)).join(" "),_s=(t,e)=>{m("caret",t,e);let r=e.loose?d[O.CARETLOOSE]:d[O.CARET],s=e.includePrerelease?"-0":"";return t.replace(r,(n,i,o,a,u)=>{m("caret",t,n,i,o,a,u);let f;return L(i)?f="":L(o)?f=`>=${i}.0.0${s} <${+i+1}.0.0-0`:L(a)?i==="0"?f=`>=${i}.${o}.0${s} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.0${s} <${+i+1}.0.0-0`:u?(m("replaceCaret pr",u),i==="0"?o==="0"?f=`>=${i}.${o}.${a}-${u} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a}-${u} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a}-${u} <${+i+1}.0.0-0`):(m("no pr"),i==="0"?o==="0"?f=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`:f=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`:f=`>=${i}.${o}.${a} <${+i+1}.0.0-0`),m("caret return",f),f})},bs=(t,e)=>(m("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hs(r,e)).join(" ")),Hs=(t,e)=>{t=t.trim();let r=e.loose?d[O.XRANGELOOSE]:d[O.XRANGE];return t.replace(r,(s,n,i,o,a,u)=>{if(m("xRange",t,s,n,i,o,a,u),js(i,o,a))return t;let f=L(i),$=f||L(o),E=$||L(a),I=E;return n==="="&&I&&(n=""),u=e.includePrerelease?"-0":"",f?n===">"||n==="<"?s="<0.0.0-0":s="*":n&&I?($&&(o=0),a=0,n===">"?(n=">=",$?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",$?i=+i+1:o=+o+1),n==="<"&&(u="-0"),s=`${n+i}.${o}.${a}${u}`):$?s=`>=${i}.0.0${u} <${+i+1}.0.0-0`:E&&(s=`>=${i}.${o}.0${u} <${i}.${+o+1}.0-0`),m("xRange return",s),s})},ks=(t,e)=>(m("replaceStars",t,e),t.trim().replace(d[O.STAR],"")),Bs=(t,e)=>(m("replaceGTE0",t,e),t.trim().replace(d[e.includePrerelease?O.GTE0PRE:O.GTE0],"")),Ys=t=>(e,r,s,n,i,o,a,u,f,$,E,I)=>(L(s)?r="":L(n)?r=`>=${s}.0.0${t?"-0":""}`:L(i)?r=`>=${s}.${n}.0${t?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,L(f)?u="":L($)?u=`<${+f+1}.0.0-0`:L(E)?u=`<${f}.${+$+1}.0-0`:I?u=`<=${f}.${$}.${E}-${I}`:t?u=`<${f}.${$}.${+E+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Ms=(t,e,r)=>{for(let s=0;s<t.length;s++)if(!t[s].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let s=0;s<t.length;s++)if(m(t[s].semver),t[s].semver!==te.ANY&&t[s].semver.prerelease.length>0){let n=t[s].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var x=p((Hi,Or)=>{"use strict";var C=Symbol("SemVer ANY"),ie=class t{static get ANY(){return C}constructor(e,r){if(r=$r(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),ne("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===C?this.value="":this.value=this.operator+this.semver.version,ne("comp",this)}parse(e){let r=this.options.loose?mr[Ir.COMPARATORLOOSE]:mr[Ir.COMPARATOR],s=e.match(r);if(!s)throw new TypeError(`Invalid comparator: ${e}`);this.operator=s[1]!==void 0?s[1]:"",this.operator==="="&&(this.operator=""),s[2]?this.semver=new Lr(s[2],this.options.loose):this.semver=C}toString(){return this.value}test(e){if(ne("Comparator.test",e,this.options.loose),this.semver===C||e===C)return!0;if(typeof e=="string")try{e=new Lr(e,this.options)}catch{return!1}return se(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Nr(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Nr(this.value,r).test(e.semver):(r=$r(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||se(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||se(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};Or.exports=ie;var $r=G(),{safeRe:mr,t:Ir}=g(),se=Q(),ne=P(),Lr=N(),Nr=T()});var D=p((ki,dr)=>{"use strict";var Ws=T(),zs=(t,e,r)=>{try{e=new Ws(e,r)}catch{return!1}return e.test(t)};dr.exports=zs});var Tr=p((Bi,Sr)=>{"use strict";var Ks=T(),Zs=(t,e)=>new Ks(t,e).set.map(r=>r.map(s=>s.value).join(" ").trim().split(" "));Sr.exports=Zs});var qr=p((Yi,Ar)=>{"use strict";var Js=N(),Qs=T(),en=(t,e,r)=>{let s=null,n=null,i=null;try{i=new Qs(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===-1)&&(s=o,n=new Js(s,r))}),s};Ar.exports=en});var gr=p((Mi,wr)=>{"use strict";var rn=N(),tn=T(),sn=(t,e,r)=>{let s=null,n=null,i=null;try{i=new tn(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!s||n.compare(o)===1)&&(s=o,n=new rn(s,r))}),s};wr.exports=sn});var xr=p((Wi,vr)=>{"use strict";var oe=N(),nn=T(),Pr=v(),on=(t,e)=>{t=new nn(t,e);let r=new oe("0.0.0");if(t.test(r)||(r=new oe("0.0.0-0"),t.test(r)))return r;r=null;for(let s=0;s<t.set.length;++s){let n=t.set[s],i=null;n.forEach(o=>{let a=new oe(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Pr(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Pr(r,i))&&(r=i)}return r&&t.test(r)?r:null};vr.exports=on});var Dr=p((zi,Cr)=>{"use strict";var cn=T(),ln=(t,e)=>{try{return new cn(t,e).range||"*"}catch{return null}};Cr.exports=ln});var B=p((Ki,jr)=>{"use strict";var an=N(),Fr=x(),{ANY:un}=Fr,fn=T(),En=D(),Gr=v(),yr=V(),hn=b(),pn=_(),Rn=(t,e,r,s)=>{t=new an(t,s),e=new fn(e,s);let n,i,o,a,u;switch(r){case">":n=Gr,i=hn,o=yr,a=">",u=">=";break;case"<":n=yr,i=pn,o=Gr,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(En(t,e,s))return!1;for(let f=0;f<e.set.length;++f){let $=e.set[f],E=null,I=null;if($.forEach(h=>{h.semver===un&&(h=new Fr(">=0.0.0")),E=E||h,I=I||h,n(h.semver,E.semver,s)?E=h:o(h.semver,I.semver,s)&&(I=h)}),E.operator===a||E.operator===u||(!I.operator||I.operator===a)&&i(t,I.semver))return!1;if(I.operator===u&&o(t,I.semver))return!1}return!0};jr.exports=Rn});var Xr=p((Zi,Ur)=>{"use strict";var $n=B(),mn=(t,e,r)=>$n(t,e,">",r);Ur.exports=mn});var _r=p((Ji,Vr)=>{"use strict";var In=B(),Ln=(t,e,r)=>In(t,e,"<",r);Vr.exports=Ln});var kr=p((Qi,Hr)=>{"use strict";var br=T(),Nn=(t,e,r)=>(t=new br(t,r),e=new br(e,r),t.intersects(e,r));Hr.exports=Nn});var Yr=p((eo,Br)=>{"use strict";var On=D(),dn=S();Br.exports=(t,e,r)=>{let s=[],n=null,i=null,o=t.sort(($,E)=>dn($,E,r));for(let $ of o)On($,e,r)?(i=$,n||(n=$)):(i&&s.push([n,i]),i=null,n=null);n&&s.push([n,null]);let a=[];for(let[$,E]of s)$===E?a.push($):!E&&$===o[0]?a.push("*"):E?$===o[0]?a.push(`<=${E}`):a.push(`${$} - ${E}`):a.push(`>=${$}`);let u=a.join(" || "),f=typeof e.raw=="string"?e.raw:String(e);return u.length<f.length?u:e}});var Jr=p((ro,Zr)=>{"use strict";var Mr=T(),ae=x(),{ANY:ce}=ae,le=D(),ue=S(),Sn=(t,e,r={})=>{if(t===e)return!0;t=new Mr(t,r),e=new Mr(e,r);let s=!1;e:for(let n of t.set){for(let i of e.set){let o=An(n,i,r);if(s=s||o!==null,o)continue e}if(s)return!1}return!0},Tn=[new ae(">=0.0.0-0")],Wr=[new ae(">=0.0.0")],An=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===ce){if(e.length===1&&e[0].semver===ce)return!0;r.includePrerelease?t=Tn:t=Wr}if(e.length===1&&e[0].semver===ce){if(r.includePrerelease)return!0;e=Wr}let s=new Set,n,i;for(let h of t)h.operator===">"||h.operator===">="?n=zr(n,h,r):h.operator==="<"||h.operator==="<="?i=Kr(i,h,r):s.add(h.semver);if(s.size>1)return null;let o;if(n&&i){if(o=ue(n.semver,i.semver,r),o>0)return null;if(o===0&&(n.operator!==">="||i.operator!=="<="))return null}for(let h of s){if(n&&!le(h,String(n),r)||i&&!le(h,String(i),r))return null;for(let tt of e)if(!le(h,String(tt),r))return!1;return!0}let a,u,f,$,E=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,I=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1;E&&E.prerelease.length===1&&i.operator==="<"&&E.prerelease[0]===0&&(E=!1);for(let h of e){if($=$||h.operator===">"||h.operator===">=",f=f||h.operator==="<"||h.operator==="<=",n){if(I&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===I.major&&h.semver.minor===I.minor&&h.semver.patch===I.patch&&(I=!1),h.operator===">"||h.operator===">="){if(a=zr(n,h,r),a===h&&a!==n)return!1}else if(n.operator===">="&&!h.test(n.semver))return!1}if(i){if(E&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===E.major&&h.semver.minor===E.minor&&h.semver.patch===E.patch&&(E=!1),h.operator==="<"||h.operator==="<="){if(u=Kr(i,h,r),u===h&&u!==i)return!1}else if(i.operator==="<="&&!h.test(i.semver))return!1}if(!h.operator&&(i||n)&&o!==0)return!1}return!(n&&f&&!i&&o!==0||i&&$&&!n&&o!==0||I||E)},zr=(t,e,r)=>{if(!t)return e;let s=ue(t.semver,e.semver,r);return s>0?t:s<0||e.operator===">"&&t.operator===">="?e:t},Kr=(t,e,r)=>{if(!t)return e;let s=ue(t.semver,e.semver,r);return s<0?t:s>0||e.operator==="<"&&t.operator==="<="?e:t};Zr.exports=Sn});var fi=p((to,rt)=>{"use strict";var fe=g(),Qr=w(),qn=N(),et=W(),wn=q(),gn=Te(),Pn=qe(),vn=Pe(),xn=Ce(),Cn=Ge(),Dn=Fe(),Gn=Ue(),yn=Ve(),Fn=S(),jn=ke(),Un=Ye(),Xn=X(),Vn=Ke(),_n=Je(),bn=v(),Hn=V(),kn=Z(),Bn=J(),Yn=_(),Mn=b(),Wn=Q(),zn=cr(),Kn=ar(),Zn=x(),Jn=T(),Qn=D(),ei=Tr(),ri=qr(),ti=gr(),si=xr(),ni=Dr(),ii=B(),oi=Xr(),ci=_r(),li=kr(),ai=Yr(),ui=Jr();rt.exports={parse:wn,valid:gn,clean:Pn,inc:vn,diff:xn,major:Cn,minor:Dn,patch:Gn,prerelease:yn,compare:Fn,rcompare:jn,compareLoose:Un,compareBuild:Xn,sort:Vn,rsort:_n,gt:bn,lt:Hn,eq:kn,neq:Bn,gte:Yn,lte:Mn,cmp:Wn,coerce:zn,truncate:Kn,Comparator:Zn,Range:Jn,satisfies:Qn,toComparators:ei,maxSatisfying:ri,minSatisfying:ti,minVersion:si,validRange:ni,outside:ii,gtr:oi,ltr:ci,intersects:li,simplifyRange:ai,subset:ui,SemVer:qn,re:fe.re,src:fe.src,tokens:fe.t,SEMVER_SPEC_VERSION:Qr.SEMVER_SPEC_VERSION,RELEASE_TYPES:Qr.RELEASE_TYPES,compareIdentifiers:et.compareIdentifiers,rcompareIdentifiers:et.rcompareIdentifiers}});export{fi as a};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{e as Nt,g as Jt,h as P,i as Qt}from"./chunk-4U7XXM4W.js";import{a as Lt}from"./chunk-TCAEECDI.js";import{a as Rt,b as jt}from"./chunk-OZGBWAT2.js";import{a as Ht,b as Wt,c as Gt,d as K,e as Vt,f as qt,g as zt,i as Xt}from"./chunk-ZFPMIQA3.js";import{a as Yt}from"./chunk-YAEVYJAR.js";import{a as Zt,c as Kt}from"./chunk-D3NXKK2L.js";import{a as Pt,b as At}from"./chunk-YHIWOGVL.js";import{a as en}from"./chunk-QEOFEETJ.js";import{a as de}from"./chunk-DGMNI4AO.js";import{a as Dt,d as Ot,e as Mt}from"./chunk-SUFW24P4.js";import{a as X}from"./chunk-LCKVYFMD.js";import{a as He,d as Ge}from"./chunk-52T37Y47.js";import{d as $e,j as _t,t as Ut,u as Bt,v as We,x as ue}from"./chunk-3YHOCPQU.js";import{a as Tt,d as le}from"./chunk-MEPASGPP.js";import{c as Ct}from"./chunk-STUHNKQS.js";import{a as F}from"./chunk-PFMEUFJ7.js";import{J as n}from"./chunk-DPQPXBTP.js";import{d as xt}from"./chunk-W5LGYSPZ.js";import{e as I}from"./chunk-E7ZMYIY6.js";import{e as h}from"./chunk-NAA7GF6Q.js";import{f as Ft,g as Be}from"./chunk-QWAQHHRS.js";import{f as vt,l as Et,m as $t,t as kt}from"./chunk-J5DVLUKY.js";var _o=[["permission",/\b(EACCES|EPERM)\b|permission denied/i],["disk",/\bENOSPC\b|no space left/i],["timeout",/\bETIMEDOUT\b|timed? ?out|killed by SIG/i],["network",/\b(ENOTFOUND|ECONNRESET|ECONNREFUSED|EAI_AGAIN|ENETUNREACH)\b|network|fetch failed/i],["npm",/npm (ERR|error)|exited with code|could not start/i]];function Po(e){return _o.find(([,t])=>t.test(e))?.[0]??"other"}function tn(e,t){return Math.max(0,Math.round((t-e)/1e3))}function ke(e,t=new Date){return{type:"upgrade",at:t.toISOString(),...e}}function Ao(e,t){let o=tn(Date.parse(e.startedAt),Date.now()),{from:r,to:i,method:a}=e;if(t===null){We(l=>({...l,pendingUpgrade:e})),ue(ke({from:r,to:i,method:a,stage:"installed",durationS:o,failure:null}));return}let c={class:Po(t),message:He(t)};ue(ke({from:r,to:i,method:a,stage:"failed",durationS:o,failure:c}),{urgent:!0})}function nn(e){return(t,o)=>{let r={from:F,to:t,startedAt:new Date().toISOString(),method:le().serverAutoUpdate?"auto":"prompt"};e(t,i=>{try{Ao(r,i)}catch{}o(i)})}}function Do(e,t,o){if(e){let r=e.to===F?"confirmed":"unconfirmed",i=tn(Date.parse(e.startedAt),o);return ke({...e,stage:r,durationS:i,failure:null},new Date(o))}return!t||t===F?null:ke({from:t,to:F,method:"manual",stage:"version-changed",durationS:null,failure:null},new Date(o))}function Pi(e=Date.now()){let t=Bt(),o=Do(t.pendingUpgrade,t.lastVersion,e);We(r=>({...r,pendingUpgrade:null,lastVersion:F})),o&&ue(o)}function Oo(e){let t=e?.code;return t==="EACCES"||t==="EPERM"?"permission":e instanceof SyntaxError?"parse":typeof t=="string"&&t.startsWith("E")?"io":"other"}function Ai(e){let t=e.error instanceof Error?e.error.message:String(e.error);ue({type:"migration_failure",at:new Date().toISOString(),migration:e.migration.replace(/[^A-Za-z0-9._:/@[\]-]/g,"_").slice(0,80),errorClass:Oo(e.error),message:He(t)})}import*as _e from"node:fs";import*as Xe from"node:os";import{spawn as Go}from"node:child_process";var on={available:null,state:"idle"},v=on,N=null;function rn(){return v}function Oi(e,t){let o=N;N=null,o?.(null),N=t,v={available:e,state:"prompting"}}function sn(e){let t=N;return t?(N=null,t(e),!0):!1}function Mi(e){N=null,v=e==="apply"?{available:v.available,state:"waiting"}:on}function an(e){let t=N;N=null,t?.(null),v={available:e,state:"waiting",auto:!0}}function cn(){return v.auto?{auto:!0}:{}}function ln(){v={available:v.available,state:"installing",...cn()}}function un(){v={available:v.available,state:"restarting",...cn()}}function pe(e){v={available:v.available,state:"failed",error:e}}var Ce={status:"error",reason:"check_failed"},Mo=15e3;function Ve(e){return{status:"available",update:{version:e}}}async function Lo(e){let t,o=new Promise(r=>{t=setTimeout(()=>r(null),Mo),t.unref?.()});try{return await Promise.race([Promise.resolve().then(e),o])}finally{clearTimeout(t)}}var Te=class{deps;inFlight=null;pending=null;latestVersion=null;promptFailed=!1;decision=Promise.resolve(null);constructor(t){this.deps=t}check(){return this.inFlight?this.inFlight:(this.inFlight=this.discover().catch(()=>Ce).finally(()=>{this.inFlight=null}),this.inFlight)}async checkAndWait(){return await this.check(),{action:await this.decision,latestVersion:this.latestVersion}}skipReason(){if(le().serverUpdateDisable)return"disabled";if(this.deps.isDevMode())return"dev_mode";let{state:t}=rn();return t==="waiting"||t==="installing"||t==="restarting"?"update_in_progress":null}async discover(){let t=this.skipReason();return t?{status:"skipped",reason:t}:this.lookup()}async lookup(){let t=await Lo(this.deps.getLatest);if(!t||!/^\d+\.\d+\.\d+(?:-\d+)?$/.test(t))return Ce;let o=this.skipReason();return o?{status:"skipped",reason:o}:(this.latestVersion=t,this.resolveVersion(t))}resolveVersion(t){if(Lt(t,F)<=0)return this.current();let o=this.deps.loadState()??{};return o.skippedVersion===t?{status:"skipped",reason:"version_skipped"}:le().serverAutoUpdate?this.autoInstall(t,o):this.pending?.version===t?Ve(t):this.openPrompt(t,o)}autoInstall(t,o){this.deps.saveState({...o,lastCheckedAt:this.deps.now()}),this.pending=null,an(t);try{this.deps.installWhenIdle(t)}catch(r){return pe(r instanceof Error?r.message:String(r)),this.decision=Promise.resolve(null),Ce}return this.decision=Promise.resolve("apply"),{...Ve(t),reason:"auto_install"}}current(){return this.pending&&(this.pending=null,sn("cancel"),this.decision=Promise.resolve(null)),{status:"current"}}async openPrompt(t,o){let r={...o,lastCheckedAt:this.deps.now(),lastPromptedVersion:t};this.deps.saveState(r);let i=this.deps.prompt.ask({latestVersion:t});return this.pending={version:t,answer:i},this.promptFailed=!1,this.decision=this.handleDecision(this.pending,r),await Promise.resolve(),this.promptFailed?Ce:Ve(t)}async handleDecision(t,o){try{let r=await t.answer;return this.pending!==t?null:this.acceptChoice(r,t.version,o)}catch(r){return this.failDecision(t,r)}finally{this.pending===t&&(this.pending=null)}}failDecision(t,o){return this.pending!==t||(this.promptFailed=!0,pe(o instanceof Error?o.message:String(o))),null}acceptChoice(t,o,r){return t==="apply"&&(this.deps.saveState({...r,skippedVersion:void 0}),this.deps.installWhenIdle(o)),t==="skip"&&this.deps.saveState({...r,skippedVersion:o}),t}};import{execFile as Fo}from"node:child_process";var No=1024*1024;function Uo(e,t,o,r,i){let a=t&&typeof t.code=="number"?t.code:t?null:0,c=t?.signal??null,l=!!t&&(t?.killed===!0||c==="SIGTERM")&&i!==void 0;e({ok:a===0,code:a,signal:c,timedOut:l,stdout:o,stderr:r,...t&&typeof t.code=="string"?{error:t.message}:{}})}function J(e,t=[],o={}){return new Promise(r=>{let i=Fo(e,[...t],{cwd:o.cwd,shell:o.shell,env:o.env??process.env,timeout:o.timeoutMs,killSignal:"SIGTERM",maxBuffer:o.maxBuffer??No,encoding:"utf8",windowsHide:!0},(a,c,l)=>Uo(r,a,c,l,o.timeoutMs));o.stdin!==void 0?i.stdin?.end(o.stdin):i.stdin?.end()})}function Gi(e,t={}){let o=process.platform==="win32"?process.env.ComSpec??"cmd.exe":"/bin/sh",r=process.platform==="win32"?"/c":"-c";return J(o,[r,e],t)}import*as Q from"fs";import*as Re from"path";var qe=Re.join($t,"update-state.json");function dn(){try{return JSON.parse(Q.readFileSync(qe,"utf8"))}catch{return null}}function pn(e){let t=Re.dirname(qe);Q.mkdirSync(t,{recursive:!0}),Q.writeFileSync(qe,JSON.stringify(e,null,2))}var me="server-update",Bo=5*6e4,ee=null;function je(e){let t=e.now??Date.now();ee={phase:e.phase??null,expiresAt:t+Bo}}function ze(){ee=null}function fn(e=Date.now()){return ee?e>=ee.expiresAt?(ee=null,null):{phase:ee.phase}:null}function Ki(e=Date.now()){return fn(e)!==null}var mn=160;function Ho(e){let t=e.replace(/\s+/g," ").trim();return t?t.length>mn?`${t.slice(0,mn)}\u2026`:t:"(no text)"}async function Ji(e){let t=fn()?.phase??"restart",o=t===me;if(e.interactive){let i={type:"interactive-reply",conduit:e.channel,sessionId:""},a=o?I("startup.updateHold"):I("startup.rebuildHold",{phase:t});await e.adapter.postMessage(i,{text:`${X.warning} ${a}`}).catch(()=>{});return}let r={channel:e.channel,preview:Ho(e.text)};await Nt(e.adapter,{level:"warning",title:o?I("notice.serverUpdate.title"):I("notice.rebuild.title"),text:o?I("startup.updateHoldDropped",r):I("startup.rebuildHoldDropped",{phase:t,...r})}).catch(()=>{})}var Wo=6e4,hn={isIdle:()=>!0,onIdle:()=>()=>{}};function gn(e,t,o={}){let r=o.supervised??(()=>!!process.send),i=o.renewMs??Wo,a=null,c=!1,l=null,f=(w,g)=>{if(clearInterval(w),c=!1,g!==null){ze(),pe(g);return}un(),r()?je({phase:me}):ze()},m=()=>{if(c||a===null||!e.isIdle())return;let w=a;a=null,l?.(),l=null,c=!0,je({phase:me});let g=setInterval(()=>je({phase:me}),i);g.unref?.(),ln();let z=!1,ce=L=>{z||(z=!0,f(g,L))};try{t(w,ce)}catch(L){ce(L instanceof Error?L.message:String(L))}};return w=>{if(a=w,e.isIdle()){m();return}l??=e.onIdle(m)}}function Vo(){let e=process.env.CORTEX_REPO;if(!e)return!1;try{return _e.existsSync(e)&&_e.statSync(e).isDirectory()}catch{return!1}}async function qo(){let e=Be(["view","@cortex-agent/server","version"]),t=await J(e.command,e.args,{shell:e.shell,timeoutMs:15e3,cwd:Xe.tmpdir()});return t.ok&&t.stdout.trim()||null}var zo=2e3;function Xo(e,t,o){let r=t!==null?`killed by ${t}`:`exited with code ${e}`,i=o.trim().split(`
|
|
5
|
+
`).slice(-6).join(`
|
|
6
|
+
`).trim();return i?`npm install -g ${r}
|
|
7
|
+
${i}`:`npm install -g ${r}`}function Yo(e,t){let o=Be(Ft(["install","-g",`@cortex-agent/server@${e}`])),r=Go(o.command,o.args,{shell:o.shell,detached:!0,stdio:["ignore","ignore","pipe"],cwd:Xe.tmpdir()}),i="";r.stderr?.on("data",a=>{i.length<zo&&(i+=String(a))}),r.stderr?.unref?.(),r.on("error",a=>t(`npm install -g could not start: ${a.message}`)),r.on("exit",(a,c)=>t(a===0?null:Xo(a,c,i))),r.unref()}function Zo(){return new Date().toISOString()}function ua(e){return new Te({prompt:e.prompt,getLatest:e.getLatest??qo,installWhenIdle:e.installWhenIdle??gn(e.idle??hn,nn(Yo)),loadState:e.loadState??dn,saveState:e.saveState??pn,now:e.now??Zo,isDevMode:Vo})}import{readFileSync as wn,existsSync as Ko}from"fs";import*as Sn from"path";var U=h("machine-registry"),te=Sn.join(Et,"machines.json"),fe={},bn=!1,Pe=null,Y=null;function Jo(e,t){if(typeof t.cortexPath!="string"||typeof t.gpuCount!="number")throw new Error(`Invalid machine entry "${e}": requires cortexPath (string) and gpuCount (number)`);let o=t.clientConnection??"direct";if(o!=="direct"&&o!=="ssh-reverse")throw new Error(`Invalid machine entry "${e}": clientConnection must be direct or ssh-reverse`);if(o==="ssh-reverse"&&!t.ssh?.trim())throw new Error(`Invalid machine entry "${e}": ssh-reverse requires ssh`);if(t.clientReversePort!==void 0){if(o!=="ssh-reverse")throw new Error(`Invalid machine entry "${e}": clientReversePort requires ssh-reverse`);if(!Number.isInteger(t.clientReversePort)||t.clientReversePort<1024||t.clientReversePort>65535)throw new Error(`Invalid machine entry "${e}": clientReversePort must be an integer in 1024..65535`)}}var he=null;function wa(e){he=e}var In=null;function Sa(e){In=e}function Qo(e,t,o){e!==t?(U.info(`Hot-reload: machines changed [${e}] \u2192 [${t}]`),he?.(`${X.refresh} \`machines.json\` hot-reloaded: [${e}] \u2192 [${t}]`)):(U.info(`Hot-reload: ${o} machines reloaded`),he?.(`${X.refresh} \`machines.json\` hot-reloaded (${o} machines)`)),In?.()}function yn(e=!0){try{let t=wn(te,"utf-8"),o=JSON.parse(t);for(let[c,l]of Object.entries(o))Jo(c,l);let r=Object.keys(fe).sort().join(","),i=Object.keys(o).sort().join(","),a=bn;fe=o,bn=!0,a?Qo(r,i,Object.keys(o).length):U.info(`Loaded ${Object.keys(o).length} machines: ${Object.keys(o).join(", ")}`)}catch(t){let o=`[machine-registry] Failed to load ${te}: ${t.message}`;if(e)throw new Error(o);U.error(o+" \u2014 keeping previous config"),he?.(`${X.warning} \`machines.json\` hot-reload FAILED \u2014 keeping previous config`)}}function Ae(){return fe}var er=64;function tr(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=er}function nr(e,t){try{let o=JSON.parse(wn(te,"utf-8"));return o[e]?(o[e].gpuCount=t,xt(te,`${JSON.stringify(o,null,2)}
|
|
8
|
+
`),!0):!1}catch(o){return U.error(`Failed to persist gpuCount for ${e}: ${o.message}`),!1}}function xn(e,t){let o=fe[e];if(!o||!tr(t))return"skipped";if(o.gpuCount===t)return"unchanged";if(!nr(e,t))return"skipped";let r=o.gpuCount;return o.gpuCount=t,U.info(`${e}: gpuCount ${r} \u2192 ${t} (client-reported)`),he?.(`${X.refresh} \`${e}\` gpuCount ${r} \u2192 ${t} (reported by its client)`),"updated"}function Ia(){return Object.keys(fe)[0]||"local"}function or(){Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,yn(!1)},300)}function ya(){Pe?.close(),Pe=Ct({label:"machines.json",filePath:te,onChange:or,warn:e=>U.error(e)})}function xa(){Pe?.close(),Pe=null,Y&&clearTimeout(Y),Y=null}if(Ko(te))try{yn()}catch(e){U.error(`Auto-load failed: ${e.message}`)}var rr=3e4,sr=h("hook-bus"),vn=[],En=null;function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ar(e,t){return e===void 0?!0:ir(e)?Object.entries(e).every(([o,r])=>Object.hasOwn(t,o)&&t[o]===r):!1}function cr(e,t){let o=e.run.script===void 0?void 0:Kt(e.run.script,En??Zt());return{id:e.id,command:o===void 0?e.run.command:"node",args:o,timeoutMs:e.run.timeout===void 0?t:e.run.timeout*1e3,result:e.result}}function lr(e,t,o){return vn.filter(r=>r.enabled!==!1).filter(r=>r.event===e).filter(r=>ar(r.matcher,t)).map(r=>cr(r,o))}function Ye(e,t){let o=t instanceof Error?t.message:String(t);return sr.error(`Hook ${e} failed: ${o}`),{id:e,error:o}}function ur(e,t){return e.result==="stdout-as-prompt"?{id:e.id,result:t.trim()}:{id:e.id}}function dr(e,t,o){let r=ur(e,t);return o?{...r,stderr:o}:r}async function pr(e,t,o){try{let r=await Yt({command:e.command,args:e.args,timeoutMs:e.timeoutMs,stdinPayload:t,env:o,label:e.id});return r.error?Ye(e.id,r.error):dr(e,r.stdout,r.stderr)}catch(r){return Ye(e.id,r)}}function Ca(e){vn=[...e.entries],En=e.scriptDirs??null}function mr(e){let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Hook payload is not JSON-serializable");return t}async function Ze(e,t,o){let r=[...lr(e,t,o?.defaultTimeoutMs??rr),...o?.scopedHooks??[]];if(r.length===0)return[];let i;try{i=mr(t)}catch(c){return r.map(l=>Ye(l.id,c))}let a=[];for(let c of r)a.push(await pr(c,i,o?.env));return a}var Ke=null;function $n(e){Ke=e}function ja(e,t){if(!(!Ke||!Ut()))try{Ke(e,t)}catch{}}function ge(e,t=1){t<=0||P(o=>{o.features[e]=(o.features[e]??0)+t})}function fr(e){P(t=>{t.messagesByChannel[e]=(t.messagesByChannel[e]??0)+1})}function La(e){return e.startsWith("slack")?"slack":e.startsWith("feishu")?"feishu":e.startsWith("tui")?"tui":"other"}function hr(e){P(t=>{t.uiOps[e]=(t.uiOps[e]??0)+1})}var gr=new Set(["sessions.send","sessions.createAndSend"]),br=new Set(["sessions.create","sessions.createAndSend"]);function Fa(e,t,o){hr(e),t&&(gr.has(e)&&fr(o??"other"),br.has(e)&&(ge("session_created"),de("first_session")))}var wr={"/webhook/subagent":{start:"subagent_run"},"/webhook/team":{spawn:"worker_spawned"},"/webhook/board":{open:"board_opened"},"/webhook/waitpoint":{create:"waitpoint_created"}},De={day:"",ids:new Set};function Sr(e){let t=Jt(Date.now());De.day!==t&&Object.assign(De,{day:t,ids:new Set});let o=typeof e=="string"?e:"";De.ids.has(o)||(De.ids.add(o),ge("browser_session"))}function Na(e,t){let o=t??{};if(e==="/webhook/browser"&&o.action==="lease")return Sr(o.sessionId);let r=wr[e??""]?.[String(o.action)];r&&(ge(r),r==="worker_spawned"&&de("first_worker"))}function Ua(e=1){e<=0||(ge("schedule_created",e),de("first_schedule"))}function kn(){ge("remote_client_connected"),de("first_remote_client")}function Cn(){P(e=>{e.perf.remoteClientDisconnects+=1})}function Ba(e){P(t=>Qt(t,e))}var Tn=[];function Ha(e,t=performance.now()){Tn.push([e,t])}function Wa(e,t=performance.now()){let o={imports:Math.round(e)},r=e;for(let[i,a]of Tn)o[i]=Math.max(0,Math.round(a-r)),r=a;o.total=Math.round(t),P(i=>{i.perf.startups.push(o),i.perf.startups.length>10&&i.perf.startups.shift()})}var Ir=/^(?::[A-Za-z][A-Za-z0-9_]{0,30}|\*|[a-z][a-z-]{0,23})$/;function yr(e){return!e||e.length>80||!e.startsWith("/")?null:e.split("/").filter(o=>o!=="").every(o=>Ir.test(o))?e:null}function xr(e){P(({perf:{web:t}})=>{t.loads+=1,e.ttfbMs!==null&&(t.ttfbMs[$e("webLoadMs",e.ttfbMs)]+=1),e.firstRenderMs!==null&&(t.firstRenderMs[$e("webLoadMs",e.firstRenderMs)]+=1),e.interactiveMs!==null&&(t.interactiveMs[$e("webLoadMs",e.interactiveMs)]+=1)})}function vr(e,t){if(e.kind==="crash"){let{crashKind:r,errorName:i,message:a,stack:c,buildStamp:l,uptimeS:f}=e;return Ge({component:"web",kind:r,errorName:i,message:a,stack:c,buildStamp:l,uptimeS:f,client:t,route:yr(e.route)})}if(e.kind!=="native_crash")return;let o=new Date(e.at);Ge({component:e.component,kind:"panic",errorName:"panic",message:e.message,stack:e.stack,buildStamp:e.appVersion,client:t,at:Number.isNaN(o.getTime())?new Date:o})}function Er(e,t){if(e.kind==="load")return xr(e);if(e.kind==="sse_reconnect")return P(o=>{o.perf.sseReconnects+=e.count});vr(e,t)}function Ga(){$n(Er)}import*as Mn from"crypto";import*as jn from"crypto";var $r=h("reverse-stream"),kr="/reverse",Rn=1e4,Cr=64,B=new Map;function _n(e){if(!e)return null;let t=new URL(e,"http://placeholder");if(t.pathname!==kr)return null;let o=t.searchParams.get("stream");return o&&/^[0-9a-f]{32}$/.test(o)?o:null}function Pn(e,t){if(B.size>=Cr)throw new Error(`too many pending reverse streams (${B.size})`);let o=jn.randomBytes(16).toString("hex"),r,i,a=new Promise((l,f)=>{r=l,i=f}),c=setTimeout(()=>{B.delete(o),i(new Error(`device ${e} did not open a stream to ${t} within ${Rn}ms`))},Rn);return c.unref?.(),B.set(o,{device:e,target:t,resolve:r,reject:i,timer:c}),{id:o,socket:a}}function An(e,t,o){let{id:r,socket:i}=Pn(e,`${t}:${o}`);return{id:r,message:{type:"open-stream",streamId:r,host:t,port:o},socket:i}}function za(e,t){let{id:o,socket:r}=Pn(e,t);return{id:o,message:{type:"open-file-stream",streamId:o,path:t},socket:r}}function Dn(e,t){let o=B.get(e);return o?(clearTimeout(o.timer),B.delete(e),$r.info(`stream ${e.slice(0,8)} claimed by ${o.device} \u2192 ${o.target}`),o.resolve(t),!0):!1}function On(e){let t=0;for(let[o,r]of B)r.device===e&&(clearTimeout(r.timer),B.delete(o),r.reject(new Error(`device ${e} disconnected before opening the stream`)),t++);return t}var y=h("client-manager"),Je=null;function nc(e){Je=e}var be=null;function oc(e){be=e}var E=new Map,A=new Map,ne=null,Oe=null,Qe=null,Ln="Server shutting down",Tr=15e3,Rr=12e4,jr=3e4;function Fn(e,t){t!==Ln&&Cn(),Ze("cortex:client.disconnected",t?{device:e,reason:t}:{device:e}).catch(()=>{})}function _r(e,t){for(let[o,r]of A)r.device===e&&(clearTimeout(r.timer),r.reject(t),A.delete(o))}function et(e,t){E.delete(e),y.info(`Device disconnected: ${e}${t?` (${t})`:""}`),Fn(e,t);let o=On(e);o>0&&y.info(`cancelled ${o} pending reverse stream(s) for ${e}`),_r(e,new Error(`Device "${e}" disconnected${t?` (${t})`:""}`)),be?.onDeviceGone(e)}function Nn(e){let t=E.get(e);if(!t)throw new Error(`Device "${e}" is not online`);if(t.ws.readyState!==Rt.default.OPEN)throw et(e,"WebSocket is not open"),new Error(`Device "${e}" WebSocket is not open`);return t.ws}function Pr(e){return!!e&&(e==="::1"||/^(::ffff:)?127\./.test(e))}function Ar(e,t){if(!t)return e.close(4001,"Missing device name"),!1;if(!Object.hasOwn(Ae(),t))return e.close(4005,"Unknown device"),!1;let o=E.get(t);return o&&o.ws!==e?(y.info(`Device ${t} already connected, rejecting new connection`),e.close(4002,"Device already connected"),!1):!0}function Dr(e,t,o){let r=t.device;if(!Ar(e,r))return null;let i=typeof t.bundleHash=="string"&&t.bundleHash?t.bundleHash:null,a=t.platform||"unknown";E.set(r,{device:r,platform:a,capabilities:t.capabilities||[],connectedAt:new Date,lastHeartbeat:new Date,bundleHash:i,ws:e}),y.info(`Device connected: ${r} (${a})`),kn(),Ze("cortex:client.connected",{device:r}).catch(()=>{}),xn(r,typeof t.gpuCount=="number"?t.gpuCount:null);try{Je?.onHello(r,i)}catch(l){y.warn(`onHello hook failed for ${r}: ${l.message}`)}let c=typeof t.pid=="number"&&Number.isInteger(t.pid)&&t.pid>0?t.pid:null;try{be?.onHello?.(r,{pid:c,loopback:Pr(o)})}catch(l){y.warn(`lifecycle hello hook failed for ${r}: ${l.message}`)}return r}function Or(e){try{let t=JSON.parse(e);return t&&typeof t.type=="string"?t:null}catch{return null}}function Mr(e){let t=e.commandId?A.get(e.commandId):void 0;t&&(A.delete(e.commandId),clearTimeout(t.timer),e.success?t.resolve(e.data):t.reject(new Error(e.error||"Command failed")))}function Lr(e,t){try{Je?.onUpdateResult(e,{ok:!!t.ok,hash:typeof t.hash=="string"?t.hash:void 0,error:typeof t.error=="string"?t.error:void 0})}catch(o){y.warn(`onUpdateResult hook failed for ${e}: ${o.message}`)}}function Fr(e,t){if(e.type==="result")return Mr(e);if(t)if(e.type==="heartbeat"){let o=E.get(t);o&&(o.lastHeartbeat=new Date)}else e.type==="update-result"&&Lr(t,e)}function Nr(e,t){let o=e.req.headers[Dt],r=Array.isArray(o)?o[0]:o;if(Ot(Mt(),r))return t(!0);let i=e.req.socket?.remoteAddress||"unknown";y.warn(`WS auth rejected from ${i}: ${r?"invalid token":"missing token"}`),t(!1,401,"Unauthorized")}function Ur(e,t){let o=null;e.on("message",r=>{let i=Or(r.toString());i?.type==="hello"?o=Dr(e,i,t):i&&Fr(i,o)}),e.on("close",(r,i)=>{o&&E.get(o)?.ws===e&&et(o,i.toString().trim()||void 0)}),e.on("error",r=>{y.error(`WebSocket error for ${o||"unknown"}: ${r.message}`)})}function Br(e,t){let o=_n(t.url);if(!o)return Ur(e,t.socket?.remoteAddress);Dn(o,e)||(y.warn("reverse callback with an unknown stream id \u2014 closing"),e.close(4004,"Unknown stream"))}function Hr(){let e=Date.now(),t=[...E.values()].filter(o=>e-o.lastHeartbeat.getTime()>Tr);for(let o of t)if(E.get(o.device)===o){try{o.ws.close(4003,"Heartbeat timeout")}catch{}et(o.device,"Heartbeat timeout")}}function rc(e,t){if(ne){y.warn("Already running");return}Qe=e,be?.onStart(),ne=new jt.default({port:e,host:t,verifyClient:Nr}),y.info(`WebSocket server started on port ${e}`),ne.on("connection",Br),ne.on("error",o=>{y.error(`Server error: ${o.message}`)}),Oe=setInterval(Hr,5e3)}async function sc(){Oe&&clearInterval(Oe),Oe=null;for(let[t,o]of A)clearTimeout(o.timer),o.reject(new Error("Client manager shutting down")),A.delete(t);for(let[,t]of E){try{t.ws.close(1001,"Server shutting down")}catch{}Fn(t.device,Ln)}E.clear();let e=ne;ne=null,e&&e.close(),await be?.onStop(),Qe=null,e&&y.info("WebSocket server stopped")}function Me(){let e=[];for(let[,t]of E)e.push({device:t.device,platform:t.platform,connectedAt:t.connectedAt,lastHeartbeat:t.lastHeartbeat,capabilities:t.capabilities,bundleHash:t.bundleHash});return e}function Un(e){return E.has(e)}function ic(){return Qe}function Bn(e,t){Nn(e).send(JSON.stringify(t))}function Hn(e,t){let o;try{o=Nn(e)}catch(a){return Promise.reject(a)}let r=Mn.randomBytes(8).toString("hex"),i=t.timeout||(t.action==="bash"?Rr:jr);return new Promise((a,c)=>{let l=setTimeout(()=>{A.delete(r),c(new Error(`Command to "${e}" timed out after ${i/1e3}s`))},i);A.set(r,{resolve:a,reject:c,timer:l,device:e});try{let f={type:"command",commandId:r,action:t.action,params:t.params};o.send(JSON.stringify(f))}catch(f){A.delete(r),clearTimeout(l),c(new Error(`Failed to send command to "${e}": ${f.message}`))}})}import*as Gn from"net";var H=h("device-port"),Wn="127.0.0.1",Vn="127.0.0.1",Wr=32,Gr=64,W=new Map;function qn(e,t,o){return`${e}|${t}|${o}`}function Vr(e,t,o){let r=!1,i=a=>{if(!r){r=!0,H.debug(`${o} closed: ${a}`);try{t.close()}catch{}try{e.destroy()}catch{}}};t.on("message",a=>{let c=Array.isArray(a)?Buffer.concat(a):Buffer.from(a);e.write(c)||(t.pause?.(),e.once("drain",()=>t.resume?.()))}),t.on("error",a=>i(`ws error: ${a.message}`)),t.on("close",()=>i("ws closed")),e.on("data",a=>{e.pause(),t.send(a,c=>{c?i(`send failed: ${c.message}`):e.resume()})}),e.on("error",a=>i(`tcp error: ${a.message}`)),e.on("close",()=>i("tcp closed")),e.resume()}var qr=Bn;async function zr(e,t){let{device:o,remoteHost:r,remotePort:i}=e.info;if(t.pause(),t.setNoDelay(!0),e.connections.add(t),t.once("close",()=>e.connections.delete(t)),e.connections.size>Gr){H.warn(`${o}:${i} \u2014 connection cap reached, refusing`),t.destroy();return}let a;try{a=An(o,r,i)}catch(l){H.warn(`${o}:${i} \u2014 ${l.message}`),t.destroy();return}a.socket.catch(()=>{});try{qr(o,a.message)}catch(l){H.warn(`${o}:${i} \u2014 cannot ask device to open a stream: ${l.message}`),t.destroy();return}let c;try{c=await a.socket}catch(l){H.warn(`${o}:${i} \u2014 ${l.message}`),t.destroy();return}if(t.destroyed){try{c.close()}catch{}return}Vr(t,c,`${o}:${i} stream ${a.id.slice(0,8)}`)}async function zn(e,t){let o=Vn,r=qn(e,o,t),i=W.get(r);if(i)return i.info;if(W.size>=Wr)throw new Error(`too many device ports open (${W.size})`);let a=Gn.createServer(),c={info:{device:e,remoteHost:o,remotePort:t,localPort:0,openedAt:new Date},server:a,connections:new Set};await new Promise((f,m)=>{a.once("error",m),a.listen(0,Wn,()=>{a.removeListener("error",m),f()})});let l=a.address();if(!l||typeof l=="string")throw a.close(),new Error("failed to bind a local port");return c.info.localPort=l.port,a.on("connection",f=>{zr(c,f)}),a.on("error",f=>H.warn(`listener for ${e}:${t} failed: ${f.message}`)),W.set(r,c),H.info(`device port ${Wn}:${l.port} \u2192 ${e} ${o}:${t}`),c.info}function oe(e,t){let o=Vn,r=qn(e,o,t),i=W.get(r);if(!i)return!1;W.delete(r);for(let a of i.connections)a.destroy();return i.connections.clear(),i.server.close(),H.info(`closed device port ${i.info.localPort} \u2192 ${e} ${o}:${t}`),!0}function dc(){return[...W.values()].map(e=>({...e.info}))}function pc(){for(let e of[...W.values()])oe(e.info.device,e.info.remotePort)}import*as Ie from"fs";import*as no from"net";import*as oo from"path";import{spawn as ro}from"child_process";import*as re from"fs";import*as tt from"path";import{execFile as Xr,spawn as Yr}from"child_process";import{promisify as Zr}from"util";var Kr=Zr(Xr),Xn=h("browser-display");function Jr(e){if(e.override)return{mode:"attached",display:e.override,takeover:"remote-desktop",reason:`display pinned by configuration (${e.override})`};if(e.platform==="linux"){if(e.envDisplay&&e.usableDisplays.includes(e.envDisplay))return{mode:"attached",display:e.envDisplay,takeover:"remote-desktop",reason:`$DISPLAY ${e.envDisplay} is reachable`};if(e.usableDisplays.length>0){let t=e.usableDisplays[0];return{mode:"attached",display:t,takeover:"remote-desktop",reason:`graphical session ${t} belongs to this user and is reachable`}}return e.hasXvfb?{mode:"virtual",display:null,takeover:"vnc-required",reason:"no reachable session; a virtual display will be created (a VNC bridge is needed to watch it)"}:{mode:"headless",display:null,takeover:"none",reason:"no graphical session and no Xvfb \u2014 the agent can browse, but nobody can take over"}}return e.platform==="darwin"||e.platform==="win32"?e.interactiveSession?{mode:"attached",display:null,takeover:"remote-desktop",reason:"running inside an interactive desktop session"}:{mode:"headless",display:null,takeover:"none",reason:e.platform==="win32"?"service session (Session 0) cannot show a window \u2014 CDP still works, takeover cannot":"no Aqua session (daemon context) \u2014 CDP still works, takeover cannot"}:{mode:"headless",display:null,takeover:"none",reason:`unsupported platform ${e.platform}`}}async function Qr(){let e;try{e=await re.promises.readdir("/tmp/.X11-unix")}catch{return[]}let t=typeof process.getuid=="function"?process.getuid():-1;return(await Promise.all(e.filter(r=>/^X\d+$/.test(r)).map(async r=>{try{let a=await re.promises.stat(`/tmp/.X11-unix/${r}`);if(t>=0&&a.uid!==t)return null}catch{return null}let i=`:${r.slice(1)}`;return await es(i)?i:null}))).filter(r=>r!==null).sort((r,i)=>Number(r.slice(1))-Number(i.slice(1)))}async function es(e){let t=[["xdpyinfo",["-display",e]],["xset",["-display",e,"q"]]];for(let[o,r]of t){let i=await Yn(o,r,3e3);if(i!=="missing")return i===0}return Xn.warn("neither xdpyinfo nor xset is installed \u2014 trusting X socket ownership"),!0}function Yn(e,t,o){return new Promise(r=>{let i=Yr(e,t,{stdio:"ignore",timeout:o});i.once("error",a=>r(a.code==="ENOENT"?"missing":-1)),i.once("exit",a=>r(a??-1))})}async function nt(e){return await Yn("which",[e],2e3)===0}async function ts(e,t=process.env){if(e==="darwin")try{let{stdout:o}=await Kr("launchctl",["managername"],{encoding:"utf8",timeout:2e3});return o.trim()==="Aqua"}catch{return!1}if(e==="win32"){let o=t.SESSIONNAME;return!!o&&o.toLowerCase()!=="services"}return!1}function Zn(e,t="/tmp"){for(let o=e;o<e+100;o++)if(!(re.existsSync(tt.join(t,`.X${o}-lock`))||re.existsSync(tt.join(t,".X11-unix",`X${o}`))))return o;return null}async function Kn(e=process.env){let t=process.platform,o=e.CORTEX_BROWSER_DISPLAY,r=t==="linux"&&!o,[i,a,c]=await Promise.all([r?Qr():[],r?nt("Xvfb"):!1,o?!1:ts(t,e)]),l=Jr({platform:t,override:o,envDisplay:e.DISPLAY,usableDisplays:i,hasXvfb:a,interactiveSession:c});return Xn.info(`display \u2192 ${l.mode}${l.display?` (${l.display})`:""}: ${l.reason}`),l}var D=h("managed-browser"),Jn=oo.join(vt,"browser","profile"),ns=9222,os=600*1e3,Qn=3e4,eo=1e4,rs=99,ss=3,ot="browser stopped while starting",is=6e4,as=3,b=null,we=null,se=null,R=0,T=null,Se=[],j="server";async function rt(){R++,T&&(clearTimeout(T),T=null);try{return await ao()}catch(e){throw R>0&&R--,e}}function st(){R!==0&&(R--,R===0&&cs())}function so(){return{running:!!b,refs:R,browser:b?{cdpEndpoint:b.cdpEndpoint,port:b.port,display:b.display,pid:b.pid}:null}}function xc(){T&&(clearTimeout(T),T=null),R=0,se&&(se.cancelled=!0,Le(se.procs,"SIGTERM")),io()}function cs(){T&&clearTimeout(T),T=setTimeout(()=>{T=null,R===0&&(D.info("no browser sessions left \u2014 reclaiming Chrome"),io())},os),T.unref?.()}function io(){let e=b;b=null,e&&Le([e.proc,...e.xvfb?[e.xvfb]:[]],"SIGTERM")}function Le(e,t){for(let o of e)try{o.kill(t)}catch{}}async function ao(){return b||we||(we=ls().finally(()=>{we=null}),we)}async function ls(){let e={cancelled:!1,procs:[]};se=e;try{return await us(e)}catch(t){throw Le(e.procs,"SIGKILL"),t}finally{se===e&&(se=null)}}async function us(e){let t=()=>{if(e.cancelled)throw new Error(ot)},o=await fs();if(!o)throw new Error("no Chrome/Chromium found \u2014 install Google Chrome, or set CORTEX_BROWSER_BINARY to its path");let r=await Kn();t(),Ie.mkdirSync(Jn,{recursive:!0});let i=await hs(ns);t();let a,c=r.display;if(r.mode==="virtual"){let g=await ps(e);a=g.proc,c=g.display}let l=[`--remote-debugging-port=${i}`,`--user-data-dir=${Jn}`,"--no-first-run","--no-default-browser-check","--disable-features=Translate","--remote-debugging-address=127.0.0.1"];r.mode==="headless"&&l.push("--headless=new"),process.platform==="linux"&&l.push("--password-store=basic");let f={...process.env};c?f.DISPLAY=c:delete f.DISPLAY,D.info(`launching ${o} on port ${i} (${r.mode}${c?` ${c}`:""})`);let m=ro(o,l,{env:f,stdio:"ignore",detached:!1});e.procs.push(m);let w=null;return m.on("exit",(g,z)=>ds(m,g,z)),m.on("error",g=>{w=g.message,D.error(`Chrome failed to spawn: ${g.message}`)}),await gs(i,()=>e.cancelled?ot:w?`Chrome failed to spawn: ${w}`:m.exitCode!==null||m.signalCode!==null?`Chrome exited during startup (code=${m.exitCode} signal=${m.signalCode})`:null),t(),b={cdpEndpoint:`http://127.0.0.1:${i}`,port:i,display:{...r,display:c},pid:m.pid??-1,proc:m,xvfb:a},D.info(`Chrome ready at ${b.cdpEndpoint} (pid ${b.pid})`),b}function ds(e,t,o){if(!b||b.proc!==e||(D.warn(`Chrome exited (code=${t} signal=${o})`),b.xvfb?.kill("SIGTERM"),b=null,R===0))return;let r=Date.now();if(Se=Se.filter(i=>r-i<is),Se.length>=as){D.error("Chrome crashed repeatedly \u2014 giving up until the next acquire"),Se=[];return}Se.push(r),D.info(`${R} session(s) still need a browser \u2014 restarting`),ao().catch(i=>D.error(`restart failed: ${String(i)}`))}async function ps(e){let t=rs,o="no free display number";for(let r=0;r<ss;r++){let i=Zn(t);if(i===null)break;let a=`:${i}`,c=ro("Xvfb",[a,"-screen","0","1920x1080x24","-nolisten","tcp","-displayfd","3"],{stdio:["ignore","ignore","ignore","pipe"]});e.procs.push(c);let l=await ms(c);if(e.cancelled)throw new Error(ot);if(!l)return{proc:c,display:a};o=`${a}: ${l}`,D.warn(`Xvfb ${o}`),Le([c],"SIGKILL"),t=i+1}throw new Error(`Xvfb could not start a virtual display (${o})`)}function ms(e){return new Promise(t=>{let o=!1,r="",i=l=>{o||(o=!0,clearTimeout(a),t(l))},a=setTimeout(()=>i(`not ready within ${eo}ms`),eo),c=e.stdio[3];c?.on("data",l=>{r+=String(l),r.includes(`
|
|
9
|
+
`)&&i(null)}),c?.on("error",()=>{}),e.once("exit",(l,f)=>i(`exited (code=${l} signal=${f})`)),e.once("error",l=>i(l.message))})}async function fs(e=process.env){if(e.CORTEX_BROWSER_BINARY)return Ie.existsSync(e.CORTEX_BROWSER_BINARY)?e.CORTEX_BROWSER_BINARY:null;let t=process.platform==="darwin"?["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium"]:process.platform==="win32"?[`${e.ProgramFiles??"C:\\Program Files"}\\Google\\Chrome\\Application\\chrome.exe`,`${e["ProgramFiles(x86)"]??"C:\\Program Files (x86)"}\\Google\\Chrome\\Application\\chrome.exe`,`${e.LOCALAPPDATA??""}\\Google\\Chrome\\Application\\chrome.exe`]:[];for(let o of t)try{if(Ie.existsSync(o))return o}catch{}for(let o of["google-chrome","google-chrome-stable","chromium","chromium-browser","chrome"])if(await nt(o))return o;return null}async function hs(e){if(await to(e))return e;for(let t=e+1;t<e+20;t++)if(await to(t))return t;throw new Error(`no free CDP port near ${e}`)}function to(e){return new Promise(t=>{let o=no.createServer();o.once("error",()=>t(!1)),o.once("listening",()=>o.close(()=>t(!0))),o.listen(e,"127.0.0.1")})}async function gs(e,t){let o=Date.now()+Qn,r="";for(;Date.now()<o;){let i=t();if(i)throw new Error(i);try{let a=await fetch(`http://127.0.0.1:${e}/json/version`,{signal:AbortSignal.timeout(2e3)});if(a.ok)return;r=`HTTP ${a.status}`}catch(a){r=a instanceof Error?a.message:String(a)}await new Promise(a=>setTimeout(a,250))}throw new Error(`Chrome did not expose CDP on ${e} within ${Qn}ms (${r})`)}var co=".cortex/browser/profile",Fe="DevToolsActivePort";function bs(e){return e==="darwin"?["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome","/Applications/Chromium.app/Contents/MacOS/Chromium"]:[]}var ws=["google-chrome","google-chrome-stable","chromium","chromium-browser","chrome"],it="Cortex Managed Browser",Ss=`
|
|
10
|
+
$ErrorActionPreference = "Stop"
|
|
11
|
+
$profile = Join-Path $env:USERPROFILE ".cortex\\browser\\profile"
|
|
12
|
+
$portFile = Join-Path $profile "${Fe}"
|
|
13
|
+
New-Item -ItemType Directory -Force -Path $profile | Out-Null
|
|
14
|
+
if ((Test-Path -LiteralPath $portFile) -and (Get-Item -LiteralPath $portFile).Length -gt 0) {
|
|
15
|
+
Get-Content -LiteralPath $portFile -TotalCount 1
|
|
16
|
+
exit 0
|
|
17
|
+
}
|
|
18
|
+
$candidates = @(
|
|
19
|
+
(Join-Path $env:ProgramFiles "Google\\Chrome\\Application\\chrome.exe"),
|
|
20
|
+
(Join-Path ([Environment]::GetEnvironmentVariable("ProgramFiles(x86)")) "Google\\Chrome\\Application\\chrome.exe"),
|
|
21
|
+
(Join-Path $env:LOCALAPPDATA "Google\\Chrome\\Application\\chrome.exe")
|
|
22
|
+
)
|
|
23
|
+
$chrome = $candidates | Where-Object { $_ -and (Test-Path -LiteralPath $_) } | Select-Object -First 1
|
|
24
|
+
if (-not $chrome) {
|
|
25
|
+
foreach ($name in @("google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "chrome")) {
|
|
26
|
+
$found = Get-Command $name -ErrorAction SilentlyContinue
|
|
27
|
+
if ($found) { $chrome = $found.Source; break }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (-not $chrome) { [Console]::Error.WriteLine("chrome-not-found"); exit 3 }
|
|
31
|
+
$user = (Get-CimInstance Win32_ComputerSystem).UserName
|
|
32
|
+
if (-not $user) { [Console]::Error.WriteLine("no-interactive-user"); exit 5 }
|
|
33
|
+
$current = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
|
34
|
+
if ($user -ine $current) { [Console]::Error.WriteLine("interactive-user-mismatch"); exit 6 }
|
|
35
|
+
$quote = [char]34
|
|
36
|
+
$arguments = "--remote-debugging-port=0 --remote-debugging-address=127.0.0.1 --user-data-dir=$quote$profile$quote --no-first-run --no-default-browser-check about:blank"
|
|
37
|
+
$action = New-ScheduledTaskAction -Execute $chrome -Argument $arguments
|
|
38
|
+
$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited
|
|
39
|
+
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit ([TimeSpan]::Zero) -MultipleInstances IgnoreNew
|
|
40
|
+
Register-ScheduledTask -TaskName "${it}" -Action $action -Principal $principal -Settings $settings -Force | Out-Null
|
|
41
|
+
Start-ScheduledTask -TaskName "${it}"
|
|
42
|
+
for ($i = 0; $i -lt 60; $i++) {
|
|
43
|
+
if ((Test-Path -LiteralPath $portFile) -and (Get-Item -LiteralPath $portFile).Length -gt 0) { break }
|
|
44
|
+
Start-Sleep -Milliseconds 500
|
|
45
|
+
}
|
|
46
|
+
if (-not ((Test-Path -LiteralPath $portFile) -and (Get-Item -LiteralPath $portFile).Length -gt 0)) {
|
|
47
|
+
[Console]::Error.WriteLine("chrome-did-not-listen")
|
|
48
|
+
exit 4
|
|
49
|
+
}
|
|
50
|
+
Get-Content -LiteralPath $portFile -TotalCount 1
|
|
51
|
+
`.trim();function Is(e){let t=bs(e).map(o=>` [ -f "${o}" ] && { CHROME="${o}"; }`).join(`
|
|
52
|
+
`);return[`PROFILE="$HOME/${co}"`,`PORTFILE="$PROFILE/${Fe}"`,'mkdir -p "$PROFILE"','if [ -s "$PORTFILE" ]; then head -1 "$PORTFILE"; exit 0; fi','CHROME=""',...t?[`if [ -z "$CHROME" ]; then :
|
|
53
|
+
${t}
|
|
54
|
+
fi`]:[],`for b in ${ws.join(" ")}; do`,' [ -n "$CHROME" ] && break',' p=$(command -v "$b" 2>/dev/null) && CHROME="$p"',"done",'[ -n "$CHROME" ] || { echo "chrome-not-found" >&2; exit 3; }','nohup "$CHROME" --remote-debugging-port=0 --remote-debugging-address=127.0.0.1 --user-data-dir="$PROFILE" --no-first-run --no-default-browser-check --password-store=basic about:blank >/dev/null 2>&1 &','for _ in $(seq 1 60); do [ -s "$PORTFILE" ] && break; sleep 0.5; done','[ -s "$PORTFILE" ] || { echo "chrome-did-not-listen" >&2; exit 4; }','head -1 "$PORTFILE"'].join(`
|
|
55
|
+
`)}function lo(e){return e==="win32"?`powershell.exe -NoProfile -Command '${Ss}' </dev/null`:Is(e)}function at(e){let t=`"$HOME/${co}"`;return e==="win32"?[`powershell.exe -NoProfile -Command '${['$ErrorActionPreference = "SilentlyContinue"',`Stop-ScheduledTask -TaskName "${it}" -ErrorAction SilentlyContinue`,"Get-CimInstance Win32_Process | Where-Object {",' $_.Name -eq "chrome.exe" -and $_.CommandLine -like "*.cortex*browser*profile*"',"} | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"].join(`
|
|
56
|
+
`)}' </dev/null >/dev/null 2>&1 || true`,`rm -f ${t}/${Fe}`].join(`
|
|
57
|
+
`):[`pkill -f -- ${t} >/dev/null 2>&1 || true`,`rm -f ${t}/${Fe}`].join(`
|
|
58
|
+
`)}var ye=h("device-browser"),ys=9e4,xs=5e3,vs=10*6e4,G=new Map;async function lt(e,t,o){let r=await Hn(e,{action:"bash",params:{command:t},timeout:o});if(r?.exitCode!==void 0&&r.exitCode!==0){let i=String(r.stderr??"").trim()||`exit ${r.exitCode}`;throw new Error(i)}return typeof r?.stdout=="string"?r.stdout:""}function Es(e){let t=e.split(`
|
|
59
|
+
`).map(r=>r.trim()).filter(r=>/^\d+$/.test(r));if(t.length===0)return null;let o=Number(t[t.length-1]);return o>0&&o<=65535?o:null}function po(e){return Me().find(t=>t.device===e)?.platform??""}async function ct(e){try{return(await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(xs)})).ok}catch{return!1}}async function uo(e,t){let o=await lt(e,lo(t),ys),r=Es(o);if(r===null)throw new Error(`device ${e} reported no debugging port`);let i=await zn(e,r);return{device:e,remotePort:r,cdpEndpoint:`http://127.0.0.1:${i.localPort}`,refs:0,idleTimer:null}}async function ut(e){let t=po(e),o=G.get(e);if(o){if(o.idleTimer&&(clearTimeout(o.idleTimer),o.idleTimer=null),await ct(o.cdpEndpoint))return o.refs++,{device:e,remotePort:o.remotePort,cdpEndpoint:o.cdpEndpoint};ye.info(`${e}: mapped browser no longer answers \u2014 relaunching`),oe(e,o.remotePort),G.delete(e)}let r=await uo(e,t);if(!await ct(r.cdpEndpoint)&&(ye.info(`${e}: adopted debugging port ${r.remotePort} is dead \u2014 stopping and relaunching`),oe(e,r.remotePort),await lt(e,at(t),3e4),r=await uo(e,t),!await ct(r.cdpEndpoint)))throw oe(e,r.remotePort),new Error(`device ${e} launched Chrome but its debugging port is unreachable`);return r.refs=1,G.set(e,r),ye.info(`${e}: browser on device port ${r.remotePort} \u2192 ${r.cdpEndpoint}`),{device:e,remotePort:r.remotePort,cdpEndpoint:r.cdpEndpoint}}function $s(e){e.idleTimer=setTimeout(()=>{e.refs>0||(ye.info(`${e.device}: no browser sessions left \u2014 reclaiming Chrome`),ks(e.device).catch(t=>ye.warn(`${e.device}: could not stop Chrome: ${t.message}`)))},vs),e.idleTimer.unref?.()}function mo(e){let t=G.get(e);t&&(t.refs=Math.max(0,t.refs-1),t.refs===0&&!t.idleTimer&&$s(t))}async function ks(e){let t=G.get(e);t?.idleTimer&&clearTimeout(t.idleTimer),G.delete(e),t&&oe(e,t.remotePort),await lt(e,at(po(e)),3e4)}function Rc(){for(let e of G.values())e.idleTimer&&clearTimeout(e.idleTimer);G.clear()}var V=h("browser-broker"),Cs=10*6e4,Ts=15e3,Rs=5e3,$=class extends Error{code;hint;constructor(t,o,r){super(o),this.name="BrowserLeaseError",this.code=t,this.hint=r}};function Ne(e){return typeof e=="string"?e.trim():""}function js(e,t){let o=t.trim(),r="or run without --device to use the server's browser";return o.includes("chrome-not-found")?{message:`Chrome is not installed on ${e}`,hint:`install Google Chrome on ${e}, ${r}`}:o.includes("no-interactive-user")?{message:`nobody is logged in to the desktop on ${e}`,hint:`log in on ${e}, ${r}`}:o.includes("interactive-user-mismatch")?{message:`the Cortex client on ${e} runs as a different user than the desktop session`,hint:`run the Cortex client as the logged-in user on ${e}`}:o.includes("chrome-did-not-listen")?{message:`Chrome on ${e} did not open its debugging port in time`,hint:`close any Chrome window still using the Cortex profile on ${e} and retry`}:/timed out/i.test(o)?{message:`${e} did not answer while starting Chrome (${o})`,hint:`check that ${e} is awake and its Cortex client is connected`}:{message:`could not start Chrome on ${e}: ${o||"unknown error"}`}}function _s(e){let t=new Map,o=new Map,r=new Map,i=new Map,a=new Set,c=null;function l(){for(let s of a)try{s()}catch(u){V.warn(`listener failed: ${u.message}`)}}function f(s,u,d){let S=(s.get(u)??Promise.resolve()).catch(()=>{}).then(d),x=S.catch(()=>{});return s.set(u,x),x.then(()=>{s.get(u)===x&&s.delete(u)}),S}function m(){if(c)return c;try{c={bin:e.resolveBin(),env:e.baseEnv()}}catch(s){throw s instanceof Ht?new $("engine-missing",s.message,s.hint):s}return c}function w(s){s.idleTimer&&clearTimeout(s.idleTimer),s.idleTimer=setTimeout(()=>{if(s.idleTimer=null,s.takenOver){w(s);return}t.get(s.sessionId)===s&&(V.info(`${s.sessionId}: browser idle for ${Math.round(e.idleMs/6e4)} min \u2014 releasing`),f(o,s.sessionId,async()=>{t.get(s.sessionId)===s&&!s.takenOver&&await z(s)}))},e.idleMs),s.idleTimer.unref?.()}function g(s){s.lastUsedAt=e.now(),w(s)}async function z(s){if(s.idleTimer&&clearTimeout(s.idleTimer),s.idleTimer=null,t.get(s.sessionId)===s&&t.delete(s.sessionId),i.delete(s),s.holdsRef&&(s.holdsRef=!1,e.release(s.device)),l(),!(!s.cdpEndpoint||!c))for(let u of[["tab","close"],["close"]])await e.run(c.bin,K(s.cdpEndpoint,s.abSession,u),c.env).catch(()=>{})}function ce(s,u){return s.holdsRef&&(s.holdsRef=!1,e.release(s.device)),i.delete(s),s.state="error",s.error=u.hint?`${u.message} \u2014 ${u.hint}`:u.message,s.cdpEndpoint=null,l(),u}function L(s){if(s===j)return;let{state:u,online:d}=e.availability(s);if(u==="online")return;let p=d.length?`online devices: ${["server",...d].join(", ")}`:"no devices are online";throw u==="offline"?new $("device-offline",`device "${s}" is offline`,`start its Cortex client, or pick another device (${p})`):new $("unknown-device",`unknown device "${s}"`,`use one of: server${d.length?`, ${d.join(", ")}`:""}`)}function gt(s,u){if(u instanceof $)return u;let d=u?.message??String(u);if(s===j)return new $("chrome-failed",`could not start Chrome on the server: ${d}`);let{message:p,hint:S}=js(s,d);return new $("chrome-failed",p,S)}function ko(s){return s===j?e.acquire(s):f(r,s,()=>e.acquire(s))}async function Co(s){try{L(s.device),m(),s.cdpEndpoint=await ko(s.device),s.holdsRef=!0,await St(s),s.state="ready",s.error=void 0,i.set(s,e.now()),V.info(`${s.sessionId}: browser ready on ${s.device} (${s.abSession})`)}catch(u){throw ce(s,gt(s.device,u))}l()}async function To(s){if(!(!(s.device===j||e.now()-(i.get(s)??0)>=Ts)||!s.cdpEndpoint))try{L(s.device);let d=await(s.device===j?e.refresh(s.device,s.cdpEndpoint):f(r,s.device,()=>e.refresh(s.device,s.cdpEndpoint)));i.set(s,e.now()),d!==s.cdpEndpoint&&(V.info(`${s.sessionId}: ${s.device} browser moved to ${d}`),s.cdpEndpoint=d,l())}catch(d){throw ce(s,gt(s.device,d))}}function bt(s,u,d){return f(o,s,async()=>{let p=t.get(s);if(d&&p?.takenOver)throw new $("taken-over","the user is controlling this browser right now","wait for them to hand it back, or ask them; do not retry in a loop");let S=u||p?.device||j;if(p&&(p.device!==S||p.state==="error")){let jo=p.takenOver;await z(p),p=void 0,jo&&V.info(`${s}: switching device ends the takeover`)}if(p?.state==="ready")return await To(p),g(p),p;let x={sessionId:s,device:S,abSession:Gt(s,S),state:"starting",cdpEndpoint:null,holdsRef:!1,takenOver:!1,lastUsedAt:e.now(),idleTimer:null,refreshing:!1,refreshAgain:!1};return t.set(s,x),g(x),l(),await Co(x),x})}function wt(s){let u=t.get(s);if(!u)throw new $("no-lease",`session ${s} has no browser`);return u}function Ro(s){let u=wt(s);if(u.state!=="ready"||!u.cdpEndpoint)throw new $("no-lease",`the browser for session ${s} is ${u.state}`);return u}async function Ee(s,u){let d=m(),p=()=>e.run(d.bin,K(s.cdpEndpoint,s.abSession,u),d.env),S=await p();return S.code===0||!qt(S.stderr)||(V.info(`${s.sessionId}: bound tab is gone \u2014 opening a new one`),(await e.run(d.bin,K(s.cdpEndpoint,s.abSession,["tab","new"]),d.env)).code!==0)?S:(await St(s),p())}async function St(s){let u=m(),d=await e.run(u.bin,K(s.cdpEndpoint,s.abSession,Vt),u.env).catch(p=>({code:-1,stdout:"",stderr:String(p)}));d.code!==0&&V.warn(`${s.sessionId}: could not set the viewport: ${d.stderr.trim().slice(0,200)}`)}async function It(s){if(s.refreshing){s.refreshAgain=!0;return}s.refreshing=!0;try{do{if(s.refreshAgain=!1,t.get(s.sessionId)!==s||s.state!=="ready"||!c)return;let u=async S=>{let x=await e.run(c.bin,K(s.cdpEndpoint,s.abSession,["--json","get",S]),c.env);if(x.code===0)try{return Ne(JSON.parse(x.stdout)?.data?.[S])||void 0}catch{return}},[d,p]=[await u("url"),await u("title")];(d!==s.url||p!==s.title)&&(s.url=d,s.title=p,l())}while(s.refreshAgain)}finally{s.refreshing=!1}}function yt(s){try{return JSON.parse(s)}catch{return null}}return{async leaseBrowser({sessionId:s,device:u}){let d=Ne(s);if(!d)throw new $("bad-request","no session id","cortex-browser must run inside a Cortex session (CORTEX_SESSION_ID is unset)");let p=await bt(d,Ne(u)||null,!0);return{device:p.device,cdpEndpoint:p.cdpEndpoint,abSession:p.abSession}},listBrowserSessions(){return[...t.values()].sort((s,u)=>u.lastUsedAt-s.lastUsedAt).map(s=>({sessionId:s.sessionId,device:s.device,abSession:s.abSession,state:s.state,...s.error?{error:s.error}:{},...s.url?{url:s.url}:{},...s.title?{title:s.title}:{},takenOver:s.takenOver,lastUsedAt:s.lastUsedAt}))},async runAgentBrowser(s,u){let d=await bt(s,null,!1),p=await Ee(d,u);return It(d),p},async streamPort(s){let u=t.get(s);if(!u||u.state!=="ready")return null;let d=yt((await Ee(u,["--json","stream","status"])).stdout);if(d?.data?.enabled&&typeof d.data.port=="number")return d.data.port;let p=yt((await Ee(u,["--json","stream","enable"])).stdout);return typeof p?.data?.port=="number"?p.data.port:null},setTakeover(s,u){let d=wt(s);d.takenOver!==u&&(d.takenOver=u,g(d),V.info(`${s}: browser ${u?"taken over by the user":"handed back to the agent"}`),l())},isTakenOver(s){return t.get(s)?.takenOver??!1},async insertText(s,u){let d=Ro(s),p=await Ee(d,["keyboard","inserttext",u]);if(p.code!==0)throw new Error(p.stderr.trim()||`agent-browser exited ${p.code}`)},noteBrowserCommand(s){let u=t.get(Ne(s));u&&(g(u),It(u))},agentBrowserRuntime(){return m()},onBrowserSessionsChanged(s){return a.add(s),()=>{a.delete(s)}},shutdown(){for(let s of t.values())s.idleTimer&&clearTimeout(s.idleTimer);t.clear(),a.clear()}}}async function Ps(e){try{return(await fetch(`${e}/json/version`,{signal:AbortSignal.timeout(Rs)})).ok}catch{return!1}}function As(){return{async acquire(e){return e===j?(await rt()).cdpEndpoint:(await ut(e)).cdpEndpoint},release(e){e===j?st():mo(e)},async refresh(e,t){if(e===j){let o=so().browser?.cdpEndpoint;if(o)return o;let r=(await rt()).cdpEndpoint;return st(),r}return await Ps(t)?t:(await ut(e)).cdpEndpoint},availability(e){let t=Me().map(o=>o.device).sort();return Un(e)?{state:"online",online:t}:{state:Object.hasOwn(Ae(),e)?"offline":"unknown",online:t}},resolveBin:()=>Wt(),baseEnv:()=>zt(),run:(e,t,o)=>Xt(e,t,{env:o}),now:()=>Date.now(),idleMs:Cs}}var dt=null;function q(){return dt??=_s(As()),dt}var Lc=e=>q().leaseBrowser(e),Fc=()=>q().listBrowserSessions();var Nc=e=>q().streamPort(e),Uc=(e,t)=>q().setTakeover(e,t),Bc=e=>q().isTakenOver(e),Hc=(e,t)=>q().insertText(e,t),Wc=e=>q().noteBrowserCommand(e),Gc=()=>q().agentBrowserRuntime();function Vc(){dt?.shutdown()}import*as k from"node:fs";import*as O from"node:path";var ie=h("project-store"),Ds=1e3;function fo(e,t,o){return[`# ${e} Status`,"","Updated: \u2014","","## Current Situation",t,"","## In Flight & New Variables","none","","## Blockers & Pending Decisions","none","","## Next Step",o,""].join(`
|
|
60
|
+
`)}var Os=fo("general","Synthetic umbrella project \u2014 collects work not scoped to a specific project.","none"),Ms=`# general
|
|
61
|
+
|
|
62
|
+
Synthetic umbrella project \u2014 always present. Created automatically by the system.
|
|
63
|
+
`,Ls=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,pt=class{projectsDir;watchEnabled;projects=[];initialized=!1;watcher=null;debounceTimer=null;constructor(t={}){this.projectsDir=t.projectsDir??kt,this.watchEnabled=t.watchEnabled??!0}async initialize(){this.initialized||(this.scaffoldGeneral(),this.scan(),this.initialized=!0,this.watchEnabled&&this.startWatcher(),ie.info(`ProjectStore initialized: ${this.projects.length} projects (${this.projectsDir})`))}list(){return[...this.projects]}get(t){return this.projects.find(o=>o.id===t)}exists(t){return this.projects.some(o=>o.id===t)}getDefault(){return this.projects.find(t=>t.kind==="general")}resolveFromMessage(t){if(!t)return this.getDefault();let o=t.match(/\[project:([^\]]+)\]/);if(o)return this.get(o[1])??this.getDefault();let r=t.toLowerCase(),i=null,a=0;for(let c of this.projects){if(c.kind==="general")continue;let l=c.id.toLowerCase();r.includes(l)&&c.id.length>a&&(i=c,a=c.id.length)}return i??this.getDefault()}refresh(){this.scan()}createProject(t){let o=typeof t=="string"?t.trim():"";if(!o||o==="general"||!Ls.test(o)||O.basename(o)!==o)return{ok:!1,code:"invalid-name",message:`Invalid project name: ${JSON.stringify(t)}`};let r=O.join(this.projectsDir,o);if(this.exists(o)||k.existsSync(r))return{ok:!1,code:"already-exists",message:`Project already exists: ${o}`};this.scaffoldProject(r,fo(o,"New project \u2014 not yet oriented.","Define mission.md and roadmap.md."),`# ${o}
|
|
64
|
+
|
|
65
|
+
${o} project.
|
|
66
|
+
`),ie.info(`Created project at ${r}`),this.scan();let i=this.get(o);return i?{ok:!0,project:i}:{ok:!1,code:"invalid-name",message:`Project not registered after creation: ${o}`}}destroy(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),this.watcher&&(this.watcher.close(),this.watcher=null),this.initialized=!1}scaffoldGeneral(){let t=O.join(this.projectsDir,"general");k.existsSync(t)||(this.scaffoldProject(t,Os,Ms),ie.info(`Scaffolded general project at ${t}`))}scaffoldProject(t,o,r){k.mkdirSync(t,{recursive:!0}),k.writeFileSync(O.join(t,"STATUS.md"),o,"utf8"),k.writeFileSync(O.join(t,"AGENTS.md"),r,"utf8")}scan(){let t=[];t.push(this.makeGeneralProject());try{let o=k.readdirSync(this.projectsDir,{withFileTypes:!0});for(let r of o)r.isDirectory()&&(r.name.startsWith(".")||r.name!=="general"&&t.push({id:r.name,name:r.name,kind:"user",contextDir:O.join(this.projectsDir,r.name)}))}catch{}this.projects=t}makeGeneralProject(){return{id:"general",name:"general",kind:"general",contextDir:O.join(this.projectsDir,"general")}}startWatcher(){try{this.watcher=k.watch(this.projectsDir,(t,o)=>{o&&(o.startsWith(".")||this.debouncedRescan())}),this.watcher.on("error",t=>{ie.error(`Watcher error for ${this.projectsDir}:`,t.message)})}catch(t){ie.error(`Failed to start watcher for ${this.projectsDir}:`,t)}}debouncedRescan(){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.scan(),ie.debug("Rescanned projects after directory change")},Ds)}},Yc=new pt;import*as C from"node:fs";import*as _ from"node:path";var Fs=["mission.md","roadmap.md","STATUS.md"],Ns=["experiments","knowledge","patterns","decisions"];function mt(e){return Object.assign(new Error(e),{code:"not-found"})}function Ue(e){return Object.assign(new Error(e),{code:"invalid-args"})}function go(e,t){let o=e.projectStore.get(t);if(!o)throw mt(`project not found: ${t}`);try{return C.realpathSync(o.contextDir)}catch{throw mt(`project directory not found: ${t}`)}}function ho(e,t){return t===e||t.startsWith(e+_.sep)}function Us(e,t){if(_.isAbsolute(t))throw Ue(`absolute path not allowed: ${t}`);let o=_.resolve(e,t);if(!ho(e,o))throw Ue(`path escapes project root: ${t}`);let r;try{r=C.realpathSync(o)}catch{throw mt(`file not found: ${t}`)}if(!ho(e,r))throw Ue(`path escapes project root: ${t}`);if(!C.statSync(r).isFile())throw Ue(`not a file: ${t}`);return r}async function Qc(e,t){let o=go(e,t.projectId),r=Fs.flatMap(a=>{let c=_.join(o,a),l;try{l=C.statSync(c)}catch{return[]}return l.isFile()?[{name:a,sizeBytes:l.size,modifiedAt:l.mtime.toISOString()}]:[]}),i=Ns.flatMap(a=>{let c=_.join(o,a),l;try{l=C.readdirSync(c,{withFileTypes:!0})}catch{return[]}let f=l.filter(m=>m.isFile()&&m.name.endsWith(".md")&&m.name!=="index.md"&&m.name!=="AGENTS.md").map(m=>{let w=C.statSync(_.join(c,m.name));return{name:m.name,sizeBytes:w.size,modifiedAt:w.mtime.toISOString()}}).sort((m,w)=>m.name.localeCompare(w.name));return[{name:a,entryCount:f.length,entries:f}]});return{projectId:t.projectId,files:r,dirs:i}}async function Bs(e,t){let o=await J("git",["diff","--numstat","HEAD","--",t],{cwd:e,timeoutMs:5e3,maxBuffer:1048576,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});if(!o.ok)return null;let i=o.stdout.split(`
|
|
67
|
+
`).find(m=>m.trim().length>0);if(!i)return{added:0,removed:0};let[a,c]=i.split(" "),l=Number(a),f=Number(c);return!Number.isFinite(l)||!Number.isFinite(f)?null:{added:l,removed:f}}var Hs=/\b(?:task|manager|gate)\s+([0-9a-f]{4})\b/i;function Ws(e){let t=Hs.exec(e);return t?t[1].toLowerCase():null}function Gs(e){let t=[],o=new Map,r=null,i=0;for(let a of e.split(`
|
|
68
|
+
`)){if(a.startsWith(" ")){r&&t.push({line:i,commit:r.slice(0,8),taskRef:o.get(r)??null}),r=null;continue}let c=/^([0-9a-f]{40}) \d+ (\d+)(?: \d+)?$/.exec(a);if(c){r=c[1],i=Number(c[2]);continue}r&&a.startsWith("summary ")&&o.set(r,Ws(a.slice(8)))}return t}async function Vs(e,t){let o=await J("git",["blame","--line-porcelain","HEAD","--",t],{cwd:e,timeoutMs:5e3,maxBuffer:8388608,env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});return o.ok?Gs(o.stdout):null}async function el(e,t){let o=go(e,t.projectId),r=Us(o,t.path),i=C.statSync(r),a=C.readFileSync(r,"utf8"),[c,l]=en()?await Promise.all([Bs(o,t.path),Vs(o,t.path)]):[null,null];return{projectId:t.projectId,path:t.path,content:a,sizeBytes:i.size,modifiedAt:i.mtime.toISOString(),lineDiff:c,blame:l}}var bo={feishu:["FEISHU_APP_ID","FEISHU_APP_SECRET","FEISHU_DOMAIN","FEISHU_ENCRYPT_KEY","FEISHU_VERIFICATION_TOKEN"],slack:["SLACK_BOT_TOKEN","SLACK_SIGNING_SECRET","SLACK_APP_TOKEN"]},ol={feishu:["FEISHU_APP_ID","FEISHU_APP_SECRET"],slack:bo.slack},rl=["FEISHU_APP_ID","FEISHU_DOMAIN"],Z=n.string().min(1).max(4096).regex(/^[^\s'\\\u0000-\u001f\u007f]+$/,"Invalid credential characters"),qs=n.object({FEISHU_APP_ID:Z.nullable().optional(),FEISHU_APP_SECRET:Z.nullable().optional(),FEISHU_DOMAIN:n.enum(["feishu","lark"]).nullable().optional(),FEISHU_ENCRYPT_KEY:Z.nullable().optional(),FEISHU_VERIFICATION_TOKEN:Z.nullable().optional(),SLACK_BOT_TOKEN:Z.nullable().optional(),SLACK_SIGNING_SECRET:Z.nullable().optional(),SLACK_APP_TOKEN:Z.nullable().optional()}).strict(),wo=n.object({platform:n.enum(["feishu","slack"]),enabled:n.boolean().optional(),fields:qs}).strict().refine(e=>Object.keys(e.fields).every(t=>bo[e.platform].includes(t)),"Fields must belong to the selected platform");var ft=["openai-codex","anthropic"];function il(e){return ft.includes(e)}var So=n.object({sessionId:n.string().min(1),starred:n.boolean()}),Io=n.object({sessionId:n.string().min(1),label:n.string().trim().min(1).max(60)});var zs=n.object({projectId:n.string().optional(),resumable:n.boolean().optional(),origin:n.enum(["direct","thread","scheduled"]).optional()}),Xs=n.object({sessionId:n.string(),compactSubagents:n.boolean().optional(),since:n.string().max(64).optional()}),Ys=n.object({sessionId:n.string(),subagentId:n.string().min(1).max(512)}),Zs=n.object({sessionId:n.string(),ref:n.string().min(1).max(512)}),Ks=n.object({sessionId:n.string().min(1)}),Js=n.object({projectId:n.string().optional(),paused:n.boolean().optional()}),Qs=n.object({projectId:n.string().optional()}),ei=n.object({boardId:n.string()}),ti=n.object({boardId:n.string()}),ni=n.object({}),oi=n.object({sessionId:n.string().min(1)}),ri=n.object({status:n.array(n.string()).optional(),limit:n.number().optional()}),si=n.object({executionId:n.string()}),ii=n.object({projectId:n.string()}),ai=n.object({projectId:n.string(),path:n.string()}),ci=n.object({status:n.enum(["pending","approved","rejected","failed"]).optional()}),li=n.object({projectId:n.string()}),ui=n.object({projectId:n.string()});var yl=n.object({}),xl=n.object({projectId:n.string().nullish()}),vl=n.object({}),El=n.object({}),$l=n.object({flowId:n.string().min(1)}),kl=n.object({}),Cl=n.object({}),Tl=n.object({enabled:n.boolean(),name:n.string().trim().optional(),org:n.string().trim().optional(),email:n.string().trim().optional()}),Rl=n.object({}),jl=_t,_l=n.object({}),Pl=n.object({}),Al=n.object({machine:n.string().min(1)}),Dl=n.object({}),Ol=n.object({sessionId:n.string().min(1).optional(),agentName:n.string().min(1).nullable().optional()}),Ml=n.object({}),Ll=n.object({}),Fl=n.object({}),Nl=n.object({}),Ul=n.object({}),Bl=n.object({limit:n.number().int().positive().max(50).optional()}),Hl=n.object({}),Wl=n.object({}),Gl=n.object({backend:n.enum(["claude","pi"]),provider:n.string().min(1),authType:n.enum(["api_key","oauth"]),noticeId:n.string().min(1).optional()}),Vl=n.object({flowId:n.string().min(1),value:n.string(),promptId:n.number().int().nonnegative().optional()}),ql=n.object({flowId:n.string().min(1)}),zl=n.object({backend:n.enum(["claude","pi"]).optional()}),Xl=n.object({backend:n.enum(["claude","pi"]),provider:n.string().min(1),authType:n.enum(["api_key","oauth"])}),xo=n.string().min(1).regex(At),Yl=n.object({name:xo,api:n.enum(Pt),upstreamUrl:n.string().min(1),apiKey:n.string().optional(),models:n.array(n.object({id:n.string().min(1),contextWindow:n.number().int().positive().optional(),maxTokens:n.number().int().positive().optional(),reasoning:n.boolean().optional()})).min(1),headers:n.record(n.string(),n.string()).optional(),compat:n.record(n.string(),n.unknown()).optional()}),Zl=n.object({name:xo}),Kl=n.object({name:n.string()}),Jl=n.object({projectId:n.string().optional()}),Ql=n.object({sessionId:n.string(),text:n.string(),attachments:n.array(n.object({name:n.string(),path:n.string(),size:n.number(),mimeType:n.string(),type:n.enum(["image","video","file","view"])})).optional()}),eu=n.object({sessionId:n.string()}),tu=n.object({sessionId:n.string()}),nu=n.object({sessionId:n.string()}),ou=n.object({sessionIds:n.array(n.string()).min(1).max(500)}),ru=n.object({sessionId:n.string(),agentName:n.string().min(1).nullable().optional()}),vo=n.object({backend:n.enum(["claude","pi"]),provider:n.string().min(1).nullable(),model:n.string().min(1),thinking:n.string().min(1).nullable(),mode:n.string().min(1)}).strict(),xe=vo,su=n.object({sessionId:n.string(),selection:xe}).strict(),iu=n.object({requestId:n.string().min(1),answers:n.record(n.string(),n.string())}),au=n.object({requestId:n.string().min(1),approved:n.boolean(),feedback:n.string().optional()}),cu=n.object({sessionId:n.string().min(1),decisionId:n.string().min(1),action:n.enum(["approve","explain","revise"]),message:n.string().optional()}),lu=n.object({sessionId:n.string().regex(/^[\w-]+$/),ts:n.string().min(1),src:n.string().min(1)}),uu=n.object({sessionId:n.string()}),du=n.object({sessionId:n.string(),turnIndex:n.number().int().min(0),text:n.string().min(1)}),pu=n.object({projectId:n.string(),agentName:n.string().min(1).optional(),selection:xe.optional(),clean:n.boolean().optional(),text:n.string(),draftUploadId:n.string().uuid().optional(),attachments:n.array(n.object({name:n.string(),path:n.string(),size:n.number(),mimeType:n.string(),type:n.enum(["image","video","file"])})).optional()}),mu=n.object({waitpointId:n.string().min(1)}),fu=n.object({executionId:n.string()}),hu=n.object({scheduleId:n.string()}),gu=n.object({type:n.enum(["interval","daily","weekly","once"]),message:n.string().min(1),projectId:n.string().optional(),selection:xe.optional(),intervalMs:n.number().int().positive().optional(),time:n.string().regex(/^\d{2}:\d{2}$/).optional(),dayOfWeek:n.number().int().min(0).max(6).optional(),delay:n.number().int().positive().optional()}).superRefine((e,t)=>{e.type==="interval"&&e.intervalMs===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:["intervalMs"],message:I("ui.schedule.intervalRequired")}),(e.type==="daily"||e.type==="weekly")&&e.time===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:["time"],message:I("ui.schedule.timeRequired",{type:e.type})}),e.type==="weekly"&&e.dayOfWeek===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:["dayOfWeek"],message:I("ui.schedule.dayOfWeekRequired")}),e.type==="once"&&e.delay===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:["delay"],message:I("ui.schedule.delayRequired")})}),bu=n.object({scheduleId:n.string(),message:n.string().min(1).optional(),projectId:n.string().optional(),selection:xe.optional(),intervalMs:n.number().int().positive().optional(),time:n.string().regex(/^\d{2}:\d{2}$/).optional(),dayOfWeek:n.number().int().min(0).max(6).optional()}),di=new Set(["__proto__","prototype","constructor"]),pi=120,mi={boolean:n.boolean(),number:n.number().finite(),"number|null":n.number().finite().nullable(),"string[]":n.array(n.string()),"string|null":n.string().nullable()};function fi(e){let t=mi[e.type];return!("validate"in e)||typeof e.validate!="function"?t:t.superRefine((o,r)=>{let i=e.validate(o);i&&r.addIssue({code:n.ZodIssueCode.custom,message:i})})}var hi=Object.fromEntries(Object.entries(Tt).filter(([e])=>e!=="providerRateLimits").map(([e,t])=>[e,fi(t)]));function gi(e,t){for(let[o,r]of Object.entries(e))r===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:[o],message:"setting must not be undefined"})}var bi=n.object(hi).partial().strict().superRefine(gi),wu=n.discriminatedUnion("section",[n.object({section:n.literal("budget"),project:n.string().min(1).nullish(),value:n.object({daily_usd:n.number().finite().positive(),monthly_usd:n.number().finite().positive()}).nullish()}).superRefine((e,t)=>{e.value==null&&!e.project&&t.addIssue({code:n.ZodIssueCode.custom,path:["value"],message:"a budget write without a value clears a per-project override and requires `project`"})}),n.object({section:n.literal("settings"),value:bi}),n.object({section:n.literal("preferences"),value:n.object({lang:n.enum(["en","zh"])})})]),Su=n.object({provider:n.string().trim().min(1).max(pi).refine(e=>!di.has(e),"provider key is reserved"),windowType:n.string().trim().min(1).nullish(),windowLabel:n.string().trim().min(1).nullish(),enabled:n.boolean(),threshold:n.union([n.number().finite().gt(0).lte(1),n.null()]).optional()}).superRefine((e,t)=>{e.windowLabel&&!e.windowType&&t.addIssue({code:n.ZodIssueCode.custom,path:["windowType"],message:"windowType is required when windowLabel is set"})}),Iu=n.object({}),wi=n.union([n.string(),n.number(),n.boolean(),n.null()]),Eo={event:n.string().min(1),matcher:n.string().optional(),matcherFilters:n.record(n.string(),wi).optional(),script:n.string().min(1).optional(),command:n.string().min(1).optional(),timeoutSec:n.number().finite().positive().optional(),backends:n.array(n.enum(["claude","pi"])).optional(),requiresTool:n.string().min(1).optional(),result:n.enum(["stdout-as-prompt","none"]).optional(),enabled:n.boolean().optional()};function $o(e,t){let o=e.script!==void 0,r=e.command!==void 0;o===r&&t.addIssue({code:n.ZodIssueCode.custom,path:["script"],message:I("ui.hook.exactlyOneRun")})}var yu=n.object({id:n.string().min(1),...Eo}).superRefine($o),xu=n.object({id:n.string().min(1),...Eo}).superRefine($o),vu=n.object({id:n.string().min(1),enabled:n.boolean()}),Eu=n.object({id:n.string().min(1)}),$u=n.object({id:n.string().min(1),payload:n.string()}),Si=vo.pick({backend:!0,provider:!0,model:!0}),ku=n.object({backend:n.enum(["claude","pi"]),provider:n.string().min(1).nullable().optional(),model:n.string().min(1)}).strict(),Cu=n.object({ref:Si,thinking:n.string().nullable()}).strict(),Tu=n.object({selection:xe}).strict(),Ii=e=>new TextEncoder().encode(e).byteLength<=255,yi=e=>e!=="."&&e!==".."&&!e.includes("/")&&!e.includes("\\")&&!e.includes("\0"),xi=n.string().max(240).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/),vi=n.string().min(1).refine(Ii).refine(yi),ht=n.string().regex(/^[a-f0-9]{64}$/),Ei=n.object({kind:n.literal("agent"),name:xi,baseHash:ht}),Ru=n.object({target:Ei,pluginIds:n.array(vi),acknowledgeMcp:n.boolean().optional()}),M=n.string().min(1).max(64).regex(/^(?!.*--)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),ae={pluginId:M,skill:M},ju=n.object(ae),_u=n.object({...ae,content:n.string().max(512*1024),baseHash:ht}),Pu=n.object({...ae,description:n.string().min(1).max(1024)}),Au=n.object({...ae,toPluginId:M,toSkill:M}),Du=n.object(ae),Ou=n.object(ae),Mu=n.object({id:M,description:n.string().max(1024).optional()}),Lu=n.object({id:M}),Fu=n.object({id:M}),Nu=n.object({pluginId:M}),yo=n.record(n.string().min(1).max(200),n.string().max(4096).nullable()),Uu=n.object({pluginId:M,servers:n.array(n.object({name:n.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/),type:n.enum(["stdio","streamable-http","sse"]),command:n.string().max(1024).optional(),args:n.array(n.string().max(1024)).max(64).optional(),cwd:n.string().max(1024).optional(),url:n.string().max(2048).optional(),env:yo.optional(),headers:yo.optional()})).max(32),baseHash:ht}),ve=n.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]*$/),Bu=n.object({name:ve}),Hu=n.object({name:ve,body:n.record(n.string(),n.unknown())}),Wu=n.object({name:ve,body:n.record(n.string(),n.unknown()),baseHash:n.string().optional()}),Gu=n.object({name:ve}),Vu=n.object({name:ve,text:n.string().max(65536)}),qu=n.object({id:n.string()}),zu=n.object({projectId:n.string(),id:n.string()}),$i=n.string().trim().min(1).max(1e3).refine(e=>!/[\r\n]/.test(e),{error:()=>I("ui.note.oneLine")}),ki=n.object({projectId:n.string(),text:$i}),Xu=ki.extend({id:n.string()}),Yu=n.object({projectId:n.string(),id:n.string(),completed:n.boolean()}),Zu=n.object({projectId:n.string(),id:n.string()}),Ku=n.object({projectId:n.string()}),Ju=n.object({id:n.string(),feedback:n.string().optional()}),Qu=n.object({kind:n.enum(["soft","hard","force"])}),ed=n.object({provider:n.string().optional()}),td=n.object({}),nd=n.object({provider:n.enum(ft),creditId:n.string().min(1).optional()}),od=n.object({}),rd=n.object({}),sd=n.object({}),id=n.object({kind:n.enum(["reconnect-platform","add-machine"]),platform:n.enum(["slack","feishu"]).optional(),machineName:n.string().min(1).optional()}).superRefine((e,t)=>{e.kind==="reconnect-platform"&&e.platform===void 0&&t.addIssue({code:n.ZodIssueCode.custom,path:["platform"],message:"platform is required for kind=reconnect-platform"}),e.kind==="add-machine"&&(e.machineName===void 0||e.machineName.trim()==="")&&t.addIssue({code:n.ZodIssueCode.custom,path:["machineName"],message:I("ui.approval.machineNameRequired")})});export{bo as a,ol as b,rl as c,wo as d,ft as e,il as f,So as g,Io as h,zs as i,Xs as j,Ys as k,Zs as l,Ks as m,Js as n,Qs as o,ei as p,ti as q,ni as r,oi as s,ri as t,si as u,ii as v,ai as w,ci as x,li as y,ui as z,yl as A,xl as B,vl as C,El as D,$l as E,kl as F,Cl as G,Tl as H,Rl as I,jl as J,_l as K,Pl as L,Al as M,Dl as N,Ol as O,Ml as P,Ll as Q,Fl as R,Nl as S,Ul as T,Bl as U,Hl as V,Wl as W,Gl as X,Vl as Y,ql as Z,zl as _,Xl as $,Yl as aa,Zl as ba,Kl as ca,Jl as da,Ql as ea,eu as fa,tu as ga,nu as ha,ou as ia,ru as ja,xe as ka,su as la,iu as ma,au as na,cu as oa,lu as pa,uu as qa,du as ra,pu as sa,mu as ta,fu as ua,hu as va,gu as wa,bu as xa,wu as ya,Su as za,Iu as Aa,yu as Ba,xu as Ca,vu as Da,Eu as Ea,$u as Fa,Si as Ga,ku as Ha,Cu as Ia,Tu as Ja,Ru as Ka,ju as La,_u as Ma,Pu as Na,Au as Oa,Du as Pa,Ou as Qa,Mu as Ra,Lu as Sa,Fu as Ta,Nu as Ua,Uu as Va,Bu as Wa,Hu as Xa,Wu as Ya,Gu as Za,Vu as _a,qu as $a,zu as ab,ki as bb,Xu as cb,Yu as db,Zu as eb,Ku as fb,Ju as gb,Qu as hb,ed as ib,td as jb,nd as kb,od as lb,rd as mb,sd as nb,id as ob,rn as pb,Oi as qb,sn as rb,Mi as sb,J as tb,Gi as ub,je as vb,ze as wb,Ki as xb,Ji as yb,Pi as zb,Ai as Ab,Vo as Bb,ua as Cb,xc as Db,wa as Eb,Sa as Fb,yn as Gb,Ae as Hb,Ia as Ib,ya as Jb,xa as Kb,za as Lb,Ca as Mb,Ze as Nb,ja as Ob,ge as Pb,fr as Qb,La as Rb,Fa as Sb,Na as Tb,Ua as Ub,Ba as Vb,Ha as Wb,Wa as Xb,Ga as Yb,nc as Zb,oc as _b,rc as $b,sc as ac,Me as bc,Un as cc,ic as dc,Bn as ec,Hn as fc,zn as gc,oe as hc,dc as ic,pc as jc,Rc as kc,$ as lc,Lc as mc,Fc as nc,Nc as oc,Uc as pc,Bc as qc,Hc as rc,Wc as sc,Gc as tc,Vc as uc,Yc as vc,go as wc,Us as xc,Qc as yc,Ws as zc,el as Ac};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{existsSync as i,readFileSync as n}from"fs";function s(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=e;return typeof r.api=="string"&&Array.isArray(r.models)}function c(e){if(!i(e))return{};try{let r=JSON.parse(n(e,"utf8"));if(!r||typeof r!="object"||Array.isArray(r))return{};let t=r.providers;return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function a(e){let r={};for(let[t,o]of Object.entries(c(e)))s(o)&&(r[t]=o);return r}export{a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var t;function e(r){t=r}var o=async()=>t?t.anthropic():(await import("./anthropic-SUZWKBRW.js")).anthropicOAuth,i=async()=>t?t.openaiCodex():(await import("./openai-codex-2REL6UQU.js")).openaiCodexOAuth,n=async()=>t?t.openaiChatGPT():(await import("./openai-chatgpt-PETGIJOZ.js")).openaiChatGPTOAuth,a=async()=>t?t.githubCopilot():(await import("./github-copilot-HAI2DA62.js")).githubCopilotOAuth,u=async()=>t?t.openrouter():(await import("./openrouter-GDY3BLT2.js")).openRouterOAuth,s=async()=>t?t.kimiCoding():(await import("./kimi-coding-HMJRKCPA.js")).kimiCodingOAuth,p=async()=>t?t.meta():(await import("./meta-KY3LNFV2.js")).metaOAuth,c=async()=>t?t.xai():(await import("./xai-KEVUJTFV.js")).xaiOAuth,h=async r=>t?t.radius(r):(await import("./radius-HXRZVBDB.js")).createRadiusOAuth(r);export{e as a,o as b,i as c,n as d,a as e,u as f,s as g,p as h,c as i,h as j};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import*as o from"fs";import*as e from"path";function i(r){let s=e.isAbsolute(r)?r:e.resolve(process.cwd(),r);if(!o.existsSync(s))throw new Error(`File not found: ${s}`);let t=o.statSync(s);if(!t.isFile())throw new Error(`Not a file: ${s}`);return{resolved:s,size:t.size}}export{i as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{c as I}from"./chunk-TAWLERZA.js";import{m as B}from"./chunk-CQLH4UVX.js";import{a as J,b as Y}from"./chunk-Z4H3VDHI.js";import{$ as H,A as k,D as E,F as C,I as P,L,V as x,W as Z,X as D,_ as p,b as f,d as T,e as R,f as g,g as b,h as G,i as W,j as F,o as u,w as _,y as v}from"./chunk-FOQ7VLIL.js";import{a as U,b as z,d as X}from"./chunk-5T7IX5KN.js";import{i as V}from"./chunk-OE4KH3NJ.js";import{a as N}from"./chunk-PFMEUFJ7.js";import{D as j}from"./chunk-DPQPXBTP.js";import{e as O}from"./chunk-NAA7GF6Q.js";import{b as q}from"./chunk-QWAQHHRS.js";var Q=Symbol.for("mcp.completable");function A(o){return!!o&&typeof o=="object"&&Q in o}function ee(o){return o[Q]?.complete}var K;(function(o){o.Completable="McpCompletable"})(K||(K={}));var ce=/^[A-Za-z0-9._-]{1,128}$/;function de(o){let e=[];if(o.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(o.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${o.length})`]};if(o.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),o.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(o.startsWith("-")||o.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(o.startsWith(".")||o.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ce.test(o)){let t=o.split("").filter(r=>!/[A-Za-z0-9._-]/.test(r)).filter((r,n,a)=>a.indexOf(r)===n);return e.push(`Tool name contains invalid characters: ${t.map(r=>`"${r}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function ue(o,e){if(e.length>0){console.warn(`Tool name validation warning for "${o}":`);for(let t of e)console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function M(o){let e=de(o);return ue(o,e.warnings),e.isValid}var S=class{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let n={taskSupport:"required",...t.execution};if(n.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,n,t._meta,r)}};var y=class{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new J(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new S(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(h(P)),this.server.assertCanSetRequestHandler(h(L)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(P,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let n=g(t.inputSchema);return n?H(n,{strictUnions:!0,pipeStrategy:"input"}):pe})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let n=g(t.outputSchema);n&&(r.outputSchema=H(n,{strictUnions:!0,pipeStrategy:"output"}))}return r})})),this.server.setRequestHandler(L,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new p(u.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new p(u.InvalidParams,`Tool ${e.params.name} disabled`);let n=!!e.params.task,a=r.execution?.taskSupport,s="createTask"in r.handler;if((a==="required"||a==="optional")&&!s)throw new p(u.InternalError,`Tool ${e.params.name} has taskSupport '${a}' but was not registered with registerToolTask`);if(a==="required"&&!n)throw new p(u.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(a==="optional"&&!n&&s)return await this.handleAutomaticTaskPolling(r,e,t);let i=await this.validateToolInput(r,e.params.arguments,e.params.name),c=await this.executeToolHandler(r,i,t);return n||await this.validateToolOutput(r,c,e.params.name),c}catch(r){if(r instanceof p&&r.code===u.UrlElicitationRequired)throw r;return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=g(e.inputSchema)??e.inputSchema,s=await T(a,t);if(!s.success){let i="error"in s?s.error:"Unknown error",c=b(i);throw new p(u.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${c}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema||!("content"in t)||t.isError)return;if(!t.structuredContent)throw new p(u.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let n=g(e.outputSchema),a=await T(n,t.structuredContent);if(!a.success){let s="error"in a?a.error:"Unknown error",i=b(s);throw new p(u.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${i}`)}}async executeToolHandler(e,t,r){let n=e.handler;if("createTask"in n){if(!r.taskStore)throw new Error("No task store provided.");let s={...r,taskStore:r.taskStore};if(e.inputSchema){let i=n;return await Promise.resolve(i.createTask(t,s))}else{let i=n;return await Promise.resolve(i.createTask(s))}}if(e.inputSchema){let s=n;return await Promise.resolve(s(t,r))}else{let s=n;return await Promise.resolve(s(r))}}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw new Error("No task store provided for task-capable tool.");let n=await this.validateToolInput(e,t.params.arguments,t.params.name),a=e.handler,s={...r,taskStore:r.taskStore},i=n?await Promise.resolve(a.createTask(n,s)):await Promise.resolve(a.createTask(s)),c=i.task.taskId,l=i.task,m=l.pollInterval??5e3;for(;l.status!=="completed"&&l.status!=="failed"&&l.status!=="cancelled";){await new Promise(le=>setTimeout(le,m));let d=await r.taskStore.getTask(c);if(!d)throw new p(u.InternalError,`Task ${c} not found during polling`);l=d}return await r.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(h(x)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(x,async e=>{switch(e.params.ref.type){case"ref/prompt":return Z(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return D(e),this.handleResourceCompletion(e,e.params.ref);default:throw new p(u.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new p(u.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new p(u.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return w;let a=R(r.argsSchema)?.[e.params.argument.name];if(!A(a))return w;let s=ee(a);if(!s)return w;let i=await s(e.params.argument.value,e.params.context);return re(i)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return w;throw new p(u.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let n=r.resourceTemplate.completeCallback(e.params.argument.name);if(!n)return w;let a=await n(e.params.argument.value,e.params.context);return re(a)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(h(_)),this.server.assertCanSetRequestHandler(h(v)),this.server.assertCanSetRequestHandler(h(k)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(_,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([a,s])=>s.enabled).map(([a,s])=>({uri:a,name:s.name,...s.metadata})),n=[];for(let a of Object.values(this._registeredResourceTemplates)){if(!a.resourceTemplate.listCallback)continue;let s=await a.resourceTemplate.listCallback(t);for(let i of s.resources)n.push({...a.metadata,...i})}return{resources:[...r,...n]}}),this.server.setRequestHandler(v,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(k,async(e,t)=>{let r=new URL(e.params.uri),n=this._registeredResources[r.toString()];if(n){if(!n.enabled)throw new p(u.InvalidParams,`Resource ${r} disabled`);return n.readCallback(r,t)}for(let a of Object.values(this._registeredResourceTemplates)){let s=a.resourceTemplate.uriTemplate.match(r.toString());if(s)return a.readCallback(r,s,t)}throw new p(u.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(h(E)),this.server.assertCanSetRequestHandler(h(C)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(E,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?me(t.argsSchema):void 0}))})),this.server.setRequestHandler(C,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new p(u.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new p(u.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let n=g(r.argsSchema),a=await T(n,e.params.arguments);if(!a.success){let c="error"in a?a.error:"Unknown error",l=b(c);throw new p(u.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${l}`)}let s=a.data,i=r.callback;return await Promise.resolve(i(s,t))}else{let n=r.callback;return await Promise.resolve(n(t))}}),this._promptHandlersInitialized=!0)}resource(e,t,...r){let n;typeof r[0]=="object"&&(n=r.shift());let a=r[0];if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,void 0,t,n,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,void 0,t,n,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(e,t,r,n){if(typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,t,r,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,r,n,a){let s={name:e,title:t,metadata:n,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:i=>{typeof i.uri<"u"&&i.uri!==r&&(delete this._registeredResources[r],i.uri&&(this._registeredResources[i.uri]=s)),typeof i.name<"u"&&(s.name=i.name),typeof i.title<"u"&&(s.title=i.title),typeof i.metadata<"u"&&(s.metadata=i.metadata),typeof i.callback<"u"&&(s.readCallback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=s,s}_createRegisteredResourceTemplate(e,t,r,n,a){let s={resourceTemplate:r,title:t,metadata:n,readCallback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(delete this._registeredResourceTemplates[e],l.name&&(this._registeredResourceTemplates[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.template<"u"&&(s.resourceTemplate=l.template),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=s;let i=r.uriTemplate.variableNames;return Array.isArray(i)&&i.some(l=>!!r.completeCallback(l))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(e,t,r,n,a){let s={title:t,description:r,argsSchema:n===void 0?void 0:f(n),callback:a,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:i=>{typeof i.name<"u"&&i.name!==e&&(delete this._registeredPrompts[e],i.name&&(this._registeredPrompts[i.name]=s)),typeof i.title<"u"&&(s.title=i.title),typeof i.description<"u"&&(s.description=i.description),typeof i.argsSchema<"u"&&(s.argsSchema=f(i.argsSchema)),typeof i.callback<"u"&&(s.callback=i.callback),typeof i.enabled<"u"&&(s.enabled=i.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=s,n&&Object.values(n).some(c=>{let l=c instanceof j?c._def?.innerType:c;return A(l)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(e,t,r,n,a,s,i,c,l){M(e);let m={title:t,description:r,inputSchema:te(n),outputSchema:te(a),annotations:s,execution:i,_meta:c,handler:l,enabled:!0,disable:()=>m.update({enabled:!1}),enable:()=>m.update({enabled:!0}),remove:()=>m.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&M(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=m)),typeof d.title<"u"&&(m.title=d.title),typeof d.description<"u"&&(m.description=d.description),typeof d.paramsSchema<"u"&&(m.inputSchema=f(d.paramsSchema)),typeof d.outputSchema<"u"&&(m.outputSchema=f(d.outputSchema)),typeof d.callback<"u"&&(m.handler=d.callback),typeof d.annotations<"u"&&(m.annotations=d.annotations),typeof d._meta<"u"&&(m._meta=d._meta),typeof d.enabled<"u"&&(m.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=m,this.setToolRequestHandlers(),this.sendToolListChanged(),m}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let r,n,a,s;if(typeof t[0]=="string"&&(r=t.shift()),t.length>1){let c=t[0];if($(c))n=t.shift(),t.length>1&&typeof t[0]=="object"&&t[0]!==null&&!$(t[0])&&(s=t.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(l=>typeof l=="object"&&l!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=t.shift()}}let i=t[0];return this._createRegisteredTool(e,void 0,r,n,a,s,{taskSupport:"forbidden"},void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:n,description:a,inputSchema:s,outputSchema:i,annotations:c,_meta:l}=t;return this._createRegisteredTool(e,n,a,s,i,c,{taskSupport:"forbidden"},l,r)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let r;typeof t[0]=="string"&&(r=t.shift());let n;t.length>1&&(n=t.shift());let a=t[0],s=this._createRegisteredPrompt(e,void 0,r,n,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:n,description:a,argsSchema:s}=t,i=this._createRegisteredPrompt(e,n,a,s,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var pe={type:"object",properties:{}};function se(o){return o!==null&&typeof o=="object"&&"parse"in o&&typeof o.parse=="function"&&"safeParse"in o&&typeof o.safeParse=="function"}function oe(o){return"_def"in o||"_zod"in o||se(o)}function $(o){return typeof o!="object"||o===null||oe(o)?!1:Object.keys(o).length===0?!0:Object.values(o).some(se)}function te(o){if(o){if($(o))return f(o);if(!oe(o))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return o}}function me(o){let e=R(o);return e?Object.entries(e).map(([t,r])=>{let n=G(r),a=W(r);return{name:t,description:n,required:!a}}):[]}function h(o){let t=R(o)?.method;if(!t)throw new Error("Schema is missing a method literal");let r=F(t);if(typeof r=="string")return r;throw new Error("Schema method literal must be a string")}function re(o){return{completion:{values:o.slice(0,100),total:o.length,hasMore:o.length>100}}}var w={completion:{values:[],hasMore:!1}};function ne(o,e){let t=o.tool,r=new Map;o.tool=((...s)=>{let i=t.apply(o,s);return i&&(s[0]==="agent"||s[0]==="worker_spawn")&&r.set(s[0],i),i});try{e()}finally{o.tool=t}let n=r.get("worker_spawn");r.get("agent")&&n&&n.update({description:B(n.description??"")})}var ae=O("mcp-bundled"),he=async o=>{let[{registerRemoteOpsTools:e},{registerTimeTools:t},{registerSubagentTools:r}]=await Promise.all([import("./remote-ops-BALZYKH6.js"),import("./time-KEHDQT6K.js"),import("./subagent-E3UC7ZHC.js")]);return n=>{e(n,o),t(n),r(n,o)}},fe=async o=>{let[{registerCostTools:e},{registerExecutionTools:t},{registerContextTools:r},{registerWaitpointTools:n}]=await Promise.all([import("./cost-PGGFI7QJ.js"),import("./executions-6ARGR3IO.js"),import("./context-VCQH5OB6.js"),import("./waitpoint-2FGQBIAC.js")]);return a=>{e(a),t(a),r(a,o),n(a,o)}},ge=async o=>{let[{registerInteractionPlanTools:e,interactionDepsFor:t},{registerInteractionAskTools:r}]=await Promise.all([import("./interaction-plan-E5V42MUP.js"),import("./interaction-ask-G5T3H3CG.js")]),n=t(o);return a=>{e(a,n),r(a,n)}},we=async o=>{let{registerSlackTools:e,slackDepsFor:t}=await import("./slack-WAGSPZUX.js"),r=t(o);return n=>e(n,r)},Te=async o=>{let[{registerFileTools:e},{buildFeishuClientFromEnv:t}]=await Promise.all([import("./file-7BN7RCAY.js"),import("./client-XOGYH5UR.js")]),r=t();return n=>e(n,{client:r,fallbackChannel:o.channel,ctx:o})},Re=async o=>{let[{registerUiFileTools:e},{registerUiViewTools:t},{registerUiDecisionTools:r},{registerUiBoardTools:n}]=await Promise.all([import("./ui-file-GVH53O3X.js"),import("./ui-view-O7PLANT7.js"),import("./ui-decision-U2FXSEC2.js"),import("./ui-board-4GYW6KKW.js")]);return a=>{e(a,o),t(a,o),r(a,o),n(a,o)}},be=async o=>{let{registerWorkerTools:e}=await import("./workers-XN4PSTH6.js");return t=>e(t,o)},Se=async o=>{let{registerWorkerReportTools:e}=await import("./workers-XN4PSTH6.js");return t=>e(t,o)},ye={"cortex-core":he,"cortex-ext":fe,"cortex-interaction-bridge":ge,"cortex-slack":we,"cortex-feishu":Te,"cortex-web":Re,"cortex-workers":be,"cortex-worker-report":Se};function _e(o,e){let t=e instanceof Error?e.message:String(e);ae.error(`Skipping MCP bundle ${o}: ${t}`)}async function ve(o,e,t=(n,a)=>ye[n](a),r=_e){return(await Promise.all(o.map(async a=>{try{let s=await t(a,e);return i=>{try{s(i)}catch(c){r(a,c)}}}catch(s){return r(a,s),null}}))).filter(a=>a!==null)}async function ie(o,e){let t=await ve(o,e),r=new y({name:z,version:N});return V(r,n=>ne(n,()=>t.forEach(a=>a(n))),e.toolAllowlist),r}async function ke(){let o=process.env[U]??process.argv[2],e=X(o);if(e.includes("cortex-ext")){let{executionRepo:r}=await import("./execution-repo-ZLJTBWFC.js");r.follow()}await(await ie(e,I())).connect(new Y)}q(new URL("dist/domain/mcp/bundled-server.js",__cortexPackageRoot).href)&&ke().catch(o=>{ae.error(o),process.exit(1)});async function Ke(o,e){return ie(o,I(e))}export{ve as a,ie as b,ke as c,Ke as d};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{I as re,V as K,a as U,b as k,c as ee,g as te,v as ne}from"./chunk-TZFLHVOQ.js";import{a as Z,b as S,c as D,d as L}from"./chunk-5T7IX5KN.js";import{a as q,b as z,f as J,g as Q}from"./chunk-OE4KH3NJ.js";import{a as N}from"./chunk-5M4PFLRW.js";import{b as x}from"./chunk-W5LGYSPZ.js";import{e as E}from"./chunk-NAA7GF6Q.js";import{h as X}from"./chunk-QWAQHHRS.js";import{d as V,e as A,f as T,j as d,l}from"./chunk-J5DVLUKY.js";import{createHash as Re}from"node:crypto";import{chmodSync as oe,mkdirSync as we,readFileSync as He,writeFileSync as ie}from"fs";import*as s from"path";var be=E("config-generator"),xe=s.join(l,"mcp-config.json"),Ne=s.join(l,"mcp-config-core.json"),De=s.join(l,"mcp-config-empty.json"),Le=s.join(l,"mcp-config-interaction.json"),Ue=s.join(l,"mcp-config-slack.json"),ke=s.join(l,"mcp-config-feishu.json"),Ke=s.join(l,"mcp-config-web.json");function Ge(e,t,n){return{command:"node",args:[s.join(t,e)],cwd:t,...n?{env:n}:{}}}function m(e,t){let n=Ge("dist/domain/mcp/bundled-server.js",t);return{...n,args:[...n.args,D(e)]}}function Me(e){return JSON.parse(He(e,"utf8"))}function je(e){let t=e.env?.[Z];if(t!==void 0)return L(t);let n=Array.isArray(e.args)?e.args:[],r=typeof n[0]=="string"?n[0].replaceAll("\\","/"):"";return s.basename(r)==="bundled-server.js"&&typeof n[1]=="string"?L(n[1]):null}function $e(e){let t={external:{},template:null};for(let n of e)for(let[r,o]of Object.entries(n.mcpServers)){if(je(o)===null){t.external[r]=o;continue}t.template??=o}return t}function Fe(e,t,n){let{external:r,template:o}=$e(e);if(!o)return{mcpServers:r};if(r[S])throw new Error(`User MCP server name conflicts with reserved ${S}`);let c=Array.isArray(o.args)?[...o.args]:[];c[1]=D(n);let p={...o.env??{},...t?{[q]:t}:{}};return{mcpServers:{[S]:{...o,args:c,env:p},...r}}}function Ye(e,t,n,r,o){let c=Re("sha256").update(JSON.stringify({configPaths:t,documents:n,encodedAllowlist:r,selectedBundles:o})).digest("hex").slice(0,16);return s.join(e,`mcp-composition-${c}.json`)}function Be(e,t){return Q(e),e.filter(n=>t.has(n))}function Vt(e,t,n=s.join(l,"mcp-tool-gates"),r){if(t===void 0)return[...e];let o=e.map(Me),c=new Set(r.flatMap(Se=>z[Se]??[])),p=Be(J(t),c),W=JSON.stringify(p),ve=Fe(o,W,r);we(n,{recursive:!0,mode:448}),oe(n,448);let b=Ye(n,e,o,W,r);return ie(b,JSON.stringify(ve,null,2),{mode:384}),oe(b,384),[b]}function We(e){return{mcpServers:{"cortex-core":m(["cortex-core","cortex-ext"],e)}}}function Ve(e){return{mcpServers:{"cortex-core":m(["cortex-core"],e)}}}function Xe(){return{mcpServers:{}}}function qe(e){return{mcpServers:{"cortex-interaction-bridge":m(["cortex-interaction-bridge"],e)}}}function ze(e){return{mcpServers:{"cortex-slack":m(["cortex-slack"],e)}}}function Je(e){return{mcpServers:{"cortex-feishu":m(["cortex-feishu"],e)}}}function Qe(e){return{mcpServers:{"cortex-web":m(["cortex-web"],e)}}}function Xt(){let e=[["full",xe,We(A)],["core",Ne,Ve(A)],["empty",De,Xe()],["interaction",Le,qe(A)],["Slack",Ue,ze(A)],["Feishu",ke,Je(A)],["Web",Ke,Qe(A)]];for(let[t,n,r]of e)ie(n,JSON.stringify(r,null,2)),be.info(`Generated ${t} MCP config at ${n}`)}import{fileURLToPath as Ze}from"node:url";import{spawn as et}from"child_process";import{createWriteStream as tt,mkdirSync as ce,existsSync as nt}from"fs";import*as w from"path";import*as ue from"http";import{createRequire as rt}from"module";var ot=E("gateway-mgr"),O=d.url,nn=rt(new URL("dist/domain/costs/gateway-manager.js",__cortexPackageRoot).href),it=Ze(new URL("vendor/aistatus/",__cortexPackageRoot)),G=w.join(it,"gateway-cli.js"),le=w.join(T,"logs"),at=w.join(le,"gateway.log"),M=1e3,st=3e4,ct=1e4,ae=3e4,ut=5e3,u=null,fe=0,h=M,C=null,R=null,y=!1,f=!1,g=null;function i(e){ot.info(e);try{let t=new Date().toLocaleTimeString("en-GB",{hour12:!1});pe().write(`[gateway-mgr ${t}] ${e}
|
|
5
|
+
`)}catch{}}function pe(){return g||(ce(le,{recursive:!0}),g=tt(at,{flags:"a"})),g}var lt=globalThis.__mockHttpGet||ue.get,ft=globalThis.__mockChildProcessSpawn||et;function j(){return new Promise(e=>{let t=lt(`${O}/status`,{timeout:ut},n=>{let r="";n.on("data",o=>{r+=o}),n.on("end",()=>{e(n.statusCode===200)})});t.on("error",()=>e(!1)),t.on("timeout",()=>{t.destroy(),e(!1)})})}async function pt(){if(y||!u&&!f)return;let e=f;f=await j(),e&&!f?i("Health check failed \u2014 gateway may be unresponsive"):!e&&f&&i("Health check passed \u2014 gateway is responsive")}function _e(){return se!==null?se:f}async function _t(){return await j()?(f=!0,h=M,i(`Gateway already healthy on ${O} \u2014 reusing existing process`),!0):!1}async function de(){if(!y){if(u){i("spawnGateway called but child already running \u2014 skipping");return}if(!nt(G)){i(`Gateway CLI not found at ${G} \u2014 cannot start gateway`);return}await _t()||At()}}function dt(){return d.home?(ce(d.home,{recursive:!0}),{...process.env,HOME:d.home,USERPROFILE:d.home}):{...process.env}}function At(){i("Starting aistatus gateway (TS)..."),fe=Date.now(),f=!1;let e=pe();u=ft(process.execPath,[G,"start","-c",d.configPath,"-p",String(d.port)],{cwd:T,stdio:["ignore","pipe","pipe"],detached:!1,env:dt()}),u.stdout?.on("data",t=>{e.write(t)}),u.stderr?.on("data",t=>{e.write(t)}),i(`Gateway started \u2014 PID ${u.pid}`),u.on("exit",Et),setTimeout(mt,2e3)}function Et(e,t){let n=u?.pid;if(u=null,f=!1,y){i(`Gateway exited (shutdown) \u2014 PID ${n}`);return}Date.now()-fe>ct&&(h=M),i(t?`Gateway killed by signal ${t} \u2014 PID ${n}`:`Gateway exited with code ${e} \u2014 PID ${n}`),i(`Restarting gateway in ${h}ms...`),C=setTimeout(()=>{C=null,de()},h),h=Math.min(h*2,st)}async function mt(){u&&(f=await j(),i(f?"Gateway is healthy after startup":"Gateway not yet healthy after startup (will retry via periodic check)"))}function ht(){return new Promise(e=>{if(!u)return e();let t=u;i(`Stopping gateway (PID ${t.pid})...`);let n=setTimeout(()=>{i("Force killing gateway...");try{t.kill("SIGKILL")}catch{}},5e3);t.once("exit",()=>{clearTimeout(n),e()}),t.kill("SIGTERM")})}function rn(){y=!1,de(),R=setInterval(pt,ae),i(`Gateway manager started (health check interval: ${ae/1e3}s)`)}async function on(){y=!0,C&&(clearTimeout(C),C=null),R&&(clearInterval(R),R=null),await ht(),g&&(g.end(),g=null),i("Gateway manager stopped")}var se=null;var gt=[[/(?:\blogin_required\b|please\s+run\s+\/login\b)/i,"login_required"],[/(?:\boauth_expired\b|oauth\s+(?:token|session)\s+(?:has\s+)?expired\b)/i,"oauth_expired"],[/(?:\bauthentication_error\b|\bauthentication\b|\binvalid[_ -]api[_ -]key\b|\binvalid\s+x-api-key\b)/i,"invalid_api_key"],[/(?:\bunauthorized\b|\b401\b)/i,"unauthorized"],[/\binvalid_grant\b/i,"invalid_grant"]],I=null,$=new Set;function Ae(e,t){return`${e}:${t}`}function sn(e){for(let[t,n]of gt)if(t.test(e))return n;return null}function cn(e){I=e,$.clear()}function un(e){I&&($.add(Ae(e.backend,e.provider)),I.publish({type:"auth.required",...e}))}function ln(e){!I||!$.delete(Ae(e.backend,e.provider))||I.publish({type:"auth.recovered",...e})}import*as Ee from"node:path";var me=Ee.join(l,".env");function he(){let e=ee(),n=U(process.env.CLAUDE_CODE_OAUTH_TOKEN)||e.CLAUDE_CODE_OAUTH_TOKEN,r=n!==void 0&&n===e.CLAUDE_CODE_OAUTH_TOKEN;return{ANTHROPIC_API_KEY:k(process.env.ANTHROPIC_API_KEY)||e.ANTHROPIC_API_KEY,ANTHROPIC_BASE_URL:U(process.env.ANTHROPIC_BASE_URL)||e.ANTHROPIC_BASE_URL,CLAUDE_CODE_OAUTH_TOKEN:n,CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT:r?e.CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT:void 0}}var _=he();function H(){let e=he();return e.ANTHROPIC_API_KEY&&(_.ANTHROPIC_API_KEY=e.ANTHROPIC_API_KEY),e.ANTHROPIC_BASE_URL&&(_.ANTHROPIC_BASE_URL=e.ANTHROPIC_BASE_URL),_.CLAUDE_CODE_OAUTH_TOKEN=e.CLAUDE_CODE_OAUTH_TOKEN,_.CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT=e.CLAUDE_CODE_OAUTH_TOKEN?e.CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT:void 0,{..._}}function Tt(e){let t=k(e);if(!t||/[\s"\\]/.test(t))throw new Error("Enter a valid Anthropic API key.");return t}function Y(e,t){return new RegExp(`^[ \\t]*(?:export[ \\t]+)?${e}[ \\t]*=.*$`,t)}function Ct(e,t,n){let r=`${t}=${JSON.stringify(n)}`;if(Y(t,"m").test(e))return e.replace(Y(t,"gm"),r);let c=e.length===0||e.endsWith(`
|
|
6
|
+
`)?"":`
|
|
7
|
+
`;return`${e}${c}${r}
|
|
8
|
+
`}function Ot(e,t){let n=Y(t,"gm");return e.replace(new RegExp(`${n.source}(?:\\r?\\n|$)`,"gm"),"")}async function yt(e,t){await x(me,n=>Ct(n,e,t),{mode:384})}async function ge(e){await x(me,t=>e.reduce(Ot,t),{mode:384})}async function An(e){let t=Tt(e);await yt("ANTHROPIC_API_KEY",t),_.ANTHROPIC_API_KEY=t,process.env.ANTHROPIC_API_KEY=t}async function En(){await ge(["ANTHROPIC_API_KEY"]),_.ANTHROPIC_API_KEY=void 0,delete process.env.ANTHROPIC_API_KEY}async function mn(){await ge(["CLAUDE_CODE_OAUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT"]),_.CLAUDE_CODE_OAUTH_TOKEN=void 0,_.CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT=void 0,delete process.env.CLAUDE_CODE_OAUTH_TOKEN}function It(e){return te()?null:e.CLAUDE_CODE_OAUTH_TOKEN??null}function F(e,t){t!==void 0&&(t===null?delete process.env[e]:process.env[e]=t)}function hn(){let e=H(),t=It(e);F("ANTHROPIC_API_KEY",e.ANTHROPIC_API_KEY??null),F("CLAUDE_CODE_OAUTH_TOKEN",t),t===null&&F("CLAUDE_CODE_OAUTH_TOKEN_EXPIRES_AT",null)}var Pt=E("mode-env");function vt(e,t){if(t&&Object.keys(t).length>0){let n=Object.entries(t).map(([r,o])=>`${encodeURIComponent(r)}=${encodeURIComponent(o)}`).join(",");return`${O}/m/${e}/${n}/anthropic`}return`${O}/m/${e}/anthropic`}function St(e,t){let n=vt(e,t);if(e==="plan")return{ANTHROPIC_BASE_URL:n,ANTHROPIC_API_KEY:null};let r=H();return{ANTHROPIC_BASE_URL:n,ANTHROPIC_API_KEY:r.ANTHROPIC_API_KEY||X}}function Rt(e){if(e==="plan")return{ANTHROPIC_API_KEY:null};let t=H();return{ANTHROPIC_BASE_URL:t.ANTHROPIC_BASE_URL,ANTHROPIC_API_KEY:t.ANTHROPIC_API_KEY||null,CLAUDE_CODE_OAUTH_TOKEN:t.CLAUDE_CODE_OAUTH_TOKEN||null}}function Te(e,t){return _e()?St(e,t):(Pt.debug(`Gateway unhealthy \u2014 using direct Anthropic connection (mode=${e})`),Rt(e))}function wn(e={}){let t=e.selection??e.session?.selection??re(e.channel??void 0)??K(),n=e.session;if((n?.backendSessionId===void 0?n?.sessionId:n.backendSessionId)&&n?.backend&&t.backend!==n.backend)throw new Error(`Cannot resume ${n.backend} session on ${t.backend} backend`);return t}function Hn(){return ne.readIfPresent()?.default?K():null}function wt(e,t={}){let n={};return t.project&&(n.project=t.project),t.trigger&&(n.trigger=t.trigger),Te(e.mode||"api",Object.keys(n).length?n:void 0)}function bn(e,t){let{project:n,trigger:r,routeTrigger:o}=e.context;return wt(t,{project:n,trigger:o??r})}import v from"node:path";import P from"node:fs";import a from"node:path";function Ln(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ce(e,t){let n=a.resolve(e),r=a.resolve(t);return r===n||r.startsWith(n+a.sep)}function B(e){try{return P.lstatSync(e),!0}catch{return!1}}function Ht(e){let t=[],n=a.resolve(e);for(;!B(n);){let r=a.dirname(n);if(r===n)return null;t.unshift(a.basename(n)),n=r}return{base:n,tail:t}}function bt(e,t){return t.reduce((n,r)=>a.join(n,r),e)}function Oe(e){try{return P.realpathSync(e)}catch{return null}}function xt(e){let t=Ht(e),n=t?Oe(t.base):null;return n&&t?bt(n,t.tail):null}function Nt(e,t){let n=a.relative(a.resolve(e),a.resolve(t));return n===""?[]:n===".."||n.startsWith(`..${a.sep}`)||a.isAbsolute(n)?null:n.split(a.sep).filter(Boolean)}function Dt(e,t,n){let r=a.join(t,n);if(!B(r))return r;let o=Oe(r);return o&&Ce(e,o)?o:null}function Lt(e,t){return Ce(e,t)?t:null}function Ut(e,t){let n=xt(e),r=Nt(e,t);if(!n||!r)return null;let o=n;for(let c of r)if(o=Dt(n,o,c),!o)return null;return Lt(n,o)}function Un(e,t){return Ut(e,a.resolve(e,t))}function kn(e){try{return P.statSync(e).isFile()}catch{return!1}}function Kn(e){try{return P.statSync(e).isDirectory()}catch{return!1}}function ye(e){return B(e)?P.readdirSync(e,{withFileTypes:!0}).filter(n=>n.isDirectory()||n.isSymbolicLink()).map(n=>n.name).sort():[]}var Pe=v.join(V,"plugins");function kt(){return N()?Pe:null}function Kt(e=kt()){return e?ye(e):[]}function Gt(e){return v.posix.join("plugins",e)}function Mt(e){return e.skills!==!1&&N()}function Ie(e,t){return v.isAbsolute(e)?v.resolve(e):v.resolve(t,e)}function Yn(e,t={}){let n=t.dataDir??T,r=(e.pluginDirs??[]).map(p=>Ie(p,n));if(!Mt(e))return e.pluginDirs?r:void 0;let o=new Set(e.disabledPlugins??[]),c=(t.builtinIds??Kt(Pe)).filter(p=>!o.has(p)).map(p=>Ie(Gt(p),n));return[...new Set([...r,...c])]}export{Vt as a,We as b,Ve as c,Xe as d,qe as e,Xt as f,O as g,rn as h,on as i,Ln as j,Ce as k,B as l,Oe as m,Ut as n,Un as o,kn as p,Kn as q,ye as r,kt as s,Kt as t,Mt as u,Yn as v,sn as w,cn as x,un as y,ln as z,H as A,An as B,En as C,mn as D,hn as E,wn as F,Hn as G,wt as H,bn as I};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var s="CORTEX_MCP_TOOL_ALLOWLIST",i={"cortex-core":["remote_bash","remote_read","remote_write","remote_edit","remote_glob","remote_grep","current_time","agent","agent_stop"],"cortex-ext":["cost_query","query_executions","cortex_context","wait_create","wait_check","wait_cancel"],"cortex-interaction-bridge":["cortex_plan_enter","cortex_plan_exit","cortex_ask_user"],"cortex-slack":["slack_send_file"],"cortex-feishu":["feishu_send_file"],"cortex-web":["send_file","send_view","send_decision","board_open"],"cortex-workers":["worker_spawn","worker_send","worker_list","worker_stop","worker_answer"],"cortex-worker-report":["mark_routine"]},l=new Set(Object.values(i).flat()),u=new Set(["cortex_schedule_add","cortex_schedule_list","cortex_schedule_get","cortex_schedule_remove","cortex_schedule_pause","cortex_schedule_resume","task_status","task_result","task_list","answer_subtask","thread_abort","thread_split","thread_wait","ask_manager","thread_run","cortex_commission_start","cortex_commission_submit","board_close"]),d=["agent","agent_stop"];function w(e,t){let o=e??t.flatMap(n=>i[n]??[]),r=new Set(d);return _(o.filter(n=>!r.has(n)))}function _(e){return[...new Set(e)].filter(t=>!u.has(t)).sort()}function x(e,t=l){let o=_(e).filter(r=>!t.has(r));if(o.length>0)throw new Error(`Unknown MCP tool name(s): ${o.join(", ")}`)}function p(e=process.env[s]){if(e===void 0)return null;let t;try{t=JSON.parse(e)}catch{throw new Error(`${s} must be a JSON string array`)}if(!Array.isArray(t)||t.some(r=>typeof r!="string"))throw new Error(`${s} must be a JSON string array`);let o=_(t);return x(o),new Set(o)}function a(e,t){return(...o)=>t.has(o[0])?e(...o):void 0}function h(e,t,o=p()){if(o===null){t(e);return}let r=e,n=r.tool.bind(e),c=r.registerTool.bind(e);r.tool=a(n,o),r.registerTool=a(c,o);try{t(e)}finally{r.tool=n,r.registerTool=c}}export{s as a,i as b,u as c,d,w as e,_ as f,x as g,p as h,h as i};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var s=(e=>(e.OPERATIONAL="operational",e.DEGRADED="degraded",e.DOWN="down",e.UNKNOWN="unknown",e))(s||{}),t=class{provider;status;statusDetail;model;alternatives;constructor(e){this.provider=e.provider,this.status=e.status,this.statusDetail=e.statusDetail??null,this.model=e.model??null,this.alternatives=e.alternatives??[]}get isAvailable(){return this.status==="operational"}},a=class{content;modelUsed;providerUsed;wasFallback;fallbackReason;inputTokens;outputTokens;cacheCreationInputTokens;cacheReadInputTokens;costUsd;raw;constructor(e){this.content=e.content,this.modelUsed=e.modelUsed,this.providerUsed=e.providerUsed,this.wasFallback=e.wasFallback,this.fallbackReason=e.fallbackReason??null,this.inputTokens=e.inputTokens??0,this.outputTokens=e.outputTokens??0,this.cacheCreationInputTokens=e.cacheCreationInputTokens??0,this.cacheReadInputTokens=e.cacheReadInputTokens??0,this.costUsd=e.costUsd??0,this.raw=e.raw??null}toString(){return this.content}};export{s as a,t as b,a as c};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var u=["claude-fable-5-1","claude-fable-5-1[1m]","claude-fable-5","claude-fable-5[1m]","claude-opus-5-5","claude-opus-5-5[1m]","claude-opus-5","claude-opus-5[1m]","claude-opus-4-8","claude-opus-4-8[1m]","claude-opus-4-7","claude-opus-4-7[1m]","claude-opus-4-6","claude-opus-4-6[1m]","claude-sonnet-5-5","claude-sonnet-5-5[1m]","claude-sonnet-5","claude-sonnet-5[1m]","claude-sonnet-4-6","claude-sonnet-4-6[1m]","claude-haiku-5-5","claude-haiku-5-5[1m]","claude-haiku-4-5"];export{u as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
var f=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],m=12288,d=65510,h=[12288,12288,65281,65376,65504,65510];var x=4352,w=262141,s=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var a=(t,i)=>{let n=0,e=Math.floor(t.length/2)-1;for(;n<=e;){let r=Math.floor((n+e)/2),o=r*2;if(i<t[o])e=r-1;else if(i>t[o+1])n=r+1;else return!0}return!1};var p=19968,[c,R]=W(s);function W(t){let i=t[0],n=t[1];for(let e=0;e<t.length;e+=2){let r=t[e],o=t[e+1];if(p>=r&&p<=o)return[r,o];o-r>n-i&&(i=r,n=o)}return[i,n]}var g=t=>t<161||t>1114109?!1:a(f,t),u=t=>t<m||t>d?!1:a(h,t);var l=t=>t>=c&&t<=R?!0:t<x||t>w?!1:a(s,t);function b(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function H(t,{ambiguousAsWide:i=!1}={}){return b(t),u(t)||l(t)||i&&g(t)?2:1}export{u as a,l as b,H as c};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{b as p}from"./chunk-CXT5IR5T.js";function d(r,a,s){return{role:"assistant",content:[],api:r.api,provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"error",errorMessage:a instanceof Error?a.message:String(a),timestamp:s}}function l(r){return typeof r.result=="function"}async function h(r,a,s,n){let e;for await(let t of a)r.push(t),s?.onEvent?.(t),t.type==="done"?e=t.message:t.type==="error"&&(e=t.error);l(a)&&(e=await a.result()),r.end(e),n(e)}function f(r,a,s){let n=Date.now(),e=new p,t=!1,o=c=>{t||(t=!0,s?.onResult?.(c))};return a().then(c=>h(e,c,s,o)).catch(c=>{let i=d(r,c,n),u={type:"error",reason:"error",error:i};e.push(u),s?.onEvent?.(u),e.end(i),o(i)}),e}function w(r,a){let s={stream:(n,e,t)=>f(n,async()=>(await r()).stream(n,e,t)),streamSimple:(n,e,t)=>f(n,async()=>(await r()).streamSimple(n,e,t))};return a?.fetchDeferred&&(s.fetchDeferred=(n,e,t)=>f(n,async()=>{let o=await r();if(!o.fetchDeferred)throw new Error("API does not support deferred responses");return o.fetchDeferred(n,e,t)})),a?.cancelDeferred&&(s.cancelDeferred=async(n,e,t)=>{let o=await r();if(!o.cancelDeferred)throw new Error("API cannot cancel deferred responses");await o.cancelDeferred(n,e,t)}),s}export{f as a,w as b};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{a as o,b as t,c as m,d as p,e as f,f as i,g as c,h as S}from"./chunk-4LLH5OWM.js";import{e}from"./chunk-WHC7AYZD.js";var a=e(i(),1),b=e(p(),1),s=e(o(),1),k=e(t(),1),l=e(m(),1),n=e(c(),1),r=e(f(),1),x=e(S(),1);var W=r.default;export{r as a,x as b,W as c};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __cortexCreateRequire } from 'node:module';
|
|
2
|
+
const require = __cortexCreateRequire(import.meta.url);
|
|
3
|
+
const __cortexPackageRoot = new URL("../../", import.meta.url);
|
|
4
|
+
import{f as k,h as U,i as F}from"./chunk-RA6HKFBV.js";import{G as D,M as _,c as $,h as w,m as N,n as b,o as V}from"./chunk-QUUEQRIT.js";import*as v from"node:fs";import{createRequire as le}from"node:module";import*as p from"node:path";import{fileURLToPath as A}from"node:url";import{EventEmitter as ne}from"node:events";function z(){let e=new ne;return{emit:(r,l)=>{e.emit(r,l)},on:(r,l)=>{let n=async c=>{try{await l(c)}catch(a){console.error(`Event handler error (${r}):`,a)}};return e.on(r,n),()=>e.off(r,n)},clear:()=>{e.removeAllListeners()}}}import{spawn as se}from"node:child_process";async function B(e,r,l,n){return new Promise(c=>{let a=se(e,r,{cwd:l,shell:!1,stdio:["ignore","pipe","pipe"]}),i="",d="",o=!1,u,g=()=>{o||(o=!0,a.kill("SIGTERM"),setTimeout(()=>{a.killed||a.kill("SIGKILL")},5e3))};n?.signal&&(n.signal.aborted?g():n.signal.addEventListener("abort",g,{once:!0})),n?.timeout&&n.timeout>0&&(u=setTimeout(()=>{g()},n.timeout)),a.stdout?.on("data",h=>{i+=h.toString()}),a.stderr?.on("data",h=>{d+=h.toString()}),$(a).then(h=>{u&&clearTimeout(u),n?.signal&&n.signal.removeEventListener("abort",g),c({stdout:i,stderr:d,code:h??0,killed:o})}).catch(h=>{u&&clearTimeout(u),n?.signal&&n.signal.removeEventListener("abort",g),c({stdout:i,stderr:d,code:1,killed:o})})})}import{readFileSync as ie}from"node:fs";var oe=["extensions","skills","prompts","themes"];function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function W(e){try{let r=JSON.parse(N(ie(e,"utf-8")));if(!O(r)||!O(r.pi))return null;let l={};for(let n of oe){let c=r.pi[n];Array.isArray(c)&&c.every(a=>typeof a=="string")&&(l[n]=c)}return l}catch{return null}}var J="builtin:";function G(e){if(e.startsWith(J))return"builtin";if(e.startsWith("<")&&e.endsWith(">"))return e.slice(1,-1).split(":")[0]||"temporary"}function q(e){return e.startsWith(J)||e.startsWith("<")}function Ie(e,r){return{path:e,source:r.source,scope:r.scope,origin:r.origin,baseDir:r.baseDir}}function H(e,r){return{path:e,source:r.source,scope:r.scope??"temporary",origin:r.origin??"top-level",baseDir:r.baseDir}}var P=process.env.PI_TIMING==="1",S=new Map;function ae(e="main"){P&&S.set(e,{timings:[],lastTime:Date.now()})}function T(e,r="main"){if(!P)return;let l=Date.now();S.has(r)||ae(r);let n=S.get(r);n.timings.push({label:e,ms:l-n.lastTime}),n.lastTime=l}function ce(e,r){let l=r.filter(n=>n.ms>=0);if(l.length!==0){console.error(`
|
|
5
|
+
--- ${e} ---`);for(let n of l)console.error(` ${n.label}: ${n.ms}ms`);console.error(` TOTAL: ${l.reduce((n,c)=>n+c.ms,0)}ms`),console.error(`${"-".repeat(e.length+8)}
|
|
6
|
+
`)}}function je(){if(P)for(let[e,r]of S)ce(`Startup Timings: ${e}`,r.timings)}var R=le(new URL("vendor/pi/dist/core/extensions/loader.js",__cortexPackageRoot).href),de="sea"in process.features&&process.features.sea===!0||process.getBuiltinModule("node:sea")?.isSea()===!0,ue=!b&&p.extname(A(new URL("vendor/pi/dist/core/extensions/loader.js",__cortexPackageRoot).href))===".ts",Z=b||de||V,K;function fe(){return K??=(Z?import("./jiti-static-loader-W3QZ4GDS.js"):import("./jiti-loader-WANUXUDO.js")).then(e=>e.createJiti),K}var X;function Q(){return X??=import("./virtual-modules-IDC5YKZJ.js").then(e=>e.VIRTUAL_MODULES),X}var M=null;function pe(){if(M)return M;let e=p.dirname(A(new URL("vendor/pi/dist/core/extensions/loader.js",__cortexPackageRoot).href)),r=p.resolve(e,"../..","index.js"),l=R.resolve("typebox"),n=R.resolve("typebox/compile"),c=R.resolve("typebox/value"),a=p.resolve(e,"../../../../"),i=(f,y)=>{let m=p.join(a,f);return v.existsSync(m)?m:A(import.meta.resolve(y))},d=r,o=i("agent/dist/index.js","@earendil-works/pi-agent-core"),u=i("tui/dist/index.js","@earendil-works/pi-tui"),g=i("ai/dist/compat.js","@earendil-works/pi-ai/compat"),h=i("ai/dist/models.js","@earendil-works/pi-ai/models"),t=i("ai/dist/oauth.js","@earendil-works/pi-ai/oauth"),s=i("ai/dist/providers/all.js","@earendil-works/pi-ai/providers/all");return M={"@earendil-works/pi-coding-agent":d,"@earendil-works/pi-agent-core":o,"@earendil-works/pi-tui":u,"@earendil-works/pi-ai/providers/all":s,"@earendil-works/pi-ai/compat":g,"@earendil-works/pi-ai/models":h,"@earendil-works/pi-ai/oauth":t,"@earendil-works/pi-ai":g,"@mariozechner/pi-coding-agent":d,"@mariozechner/pi-agent-core":o,"@mariozechner/pi-tui":u,"@mariozechner/pi-ai/providers/all":s,"@mariozechner/pi-ai/compat":g,"@mariozechner/pi-ai/models":h,"@mariozechner/pi-ai/oauth":t,"@mariozechner/pi-ai":g,typebox:l,"typebox/compile":n,"typebox/value":c,"@sinclair/typebox":l,"@sinclair/typebox/compile":n,"@sinclair/typebox/value":c},M}var x,L=0,I=new Map;function ge(){I.clear(),x=void 0,L++}function he(e){let r=w(e);return x!==void 0&&x!==r&&ge(),x=r,{cwd:r,generation:L}}function me(){let e=()=>{throw new Error("Extension runtime not initialized. Action methods cannot be called during extension loading.")},r={},l=new Set,n=()=>{if(r.staleMessage)throw new Error(r.staleMessage)},c={sendMessage:e,sendUserMessage:e,appendEntry:e,setSessionName:e,getSessionName:e,setLabel:e,getActiveTools:e,getAllTools:e,getSettings:e,setActiveTools:e,refreshTools:()=>{},getCommands:e,setModel:()=>Promise.reject(new Error("Extension runtime not initialized")),getThinkingLevel:e,setThinkingLevel:e,flagValues:new Map,pendingProviderRegistrations:[],pendingNativeProviderRegistrations:[],mcpServers:new F,pendingVirtualModelRegistrations:[],createContext:e,assertActive:n,invalidate:a=>{if(!r.staleMessage){r.staleMessage=a??"This extension ctx is stale after session replacement or reload. Do not use a captured pi or command ctx after ctx.newSession(), ctx.fork(), ctx.switchSession(), or ctx.reload(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().";for(let i of l)i();l.clear()}},trackEventBusSubscription:a=>{let i=!0,d=()=>{i&&(i=!1,l.delete(d),a())};return l.add(d),d},registerProvider:(a,i,d="<unknown>")=>{c.pendingProviderRegistrations.push({name:a,config:i,extensionPath:d})},registerNativeProvider:(a,i="<unknown>")=>{c.pendingNativeProviderRegistrations.push({provider:a,extensionPath:i})},unregisterProvider:a=>{c.pendingProviderRegistrations=c.pendingProviderRegistrations.filter(i=>i.name!==a),c.pendingNativeProviderRegistrations=c.pendingNativeProviderRegistrations.filter(i=>i.provider.id!==a)},registerVirtualModel:(a,i="<unknown>")=>{c.pendingVirtualModelRegistrations.push({definition:a,extensionPath:i})},unregisterVirtualModel:(a,i)=>{c.pendingVirtualModelRegistrations=c.pendingVirtualModelRegistrations.filter(({definition:d})=>d.provider!==a||d.id!==i)}};return c}function ve(e,r,l,n){let c=new Map,a=[],i=[],d="loading",o=()=>{if(d==="failed")throw new Error(`Extension "${e.path}" failed to load and its API is no longer active.`);r.assertActive()},u=t=>{d==="loading"?a.push(t):t()},g=()=>{c.clear(),a.length=0,i.length=0};return{api:{on(t,s){o();let f=(...m)=>s(...m),y=e.handlers.get(t)??[];return y.push(f),e.handlers.set(t,y),()=>{let m=e.handlers.get(t);if(!m)return;let E=m.indexOf(f);E!==-1&&(m.splice(E,1),m.length===0&&e.handlers.delete(t))}},registerTool(t){if(o(),typeof t.parameters!="object"||t.parameters===null||Array.isArray(t.parameters))throw new Error(`Tool "${t.name}" registered by extension "${e.path}" must define an object parameter schema.`);e.tools.set(t.name,{definition:t,sourceInfo:e.sourceInfo}),r.refreshTools()},registerCommand(t,s){if(o(),typeof t!="string"||t.length===0)throw new Error(`Command registered by extension "${e.path}" must have a non-empty string name. Use pi.registerCommand("name", { description, handler }).`);if(typeof s?.handler!="function")throw new Error(`Command "/${t}" registered by extension "${e.path}" must define handler().`);e.commands.set(t,{name:t,sourceInfo:e.sourceInfo,...s})},registerShortcut(t,s){o(),e.shortcuts.set(t,{shortcut:t,extensionPath:e.path,...s})},registerFlag(t,s){if(o(),s.default!==void 0&&typeof s.default!==s.type)throw new Error(`Invalid default for flag "${t}": expected ${s.type}, got ${typeof s.default}`);e.flags.set(t,{name:t,extensionPath:e.path,...s}),s.default!==void 0&&!r.flagValues.has(t)&&(d==="loading"?c.has(t)||c.set(t,s.default):r.flagValues.set(t,s.default))},registerMessageRenderer(t,s){o(),e.messageRenderers.set(t,s)},registerMarkdownTransformer(t){o(),e.markdownTransformer=t},registerEntryRenderer(t,s){o(),e.entryRenderers??=new Map,e.entryRenderers.set(t,s)},registerToolRenderer(t){o(),e.toolRenderers??=[],e.toolRenderers.push(t)},getFlag(t){if(o(),!!e.flags.has(t))return r.flagValues.has(t)?r.flagValues.get(t):c.get(t)},sendMessage(t,s){o(),r.sendMessage(t,s)},sendUserMessage(t,s){o(),r.sendUserMessage(t,s)},appendEntry(t,s){o(),r.appendEntry(t,s)},setSessionName(t){o(),r.setSessionName(t)},getSessionName(){return o(),r.getSessionName()},setLabel(t,s){o(),r.setLabel(t,s)},exec(t,s,f){return o(),B(t,s,f?.cwd??l,f)},getActiveTools(){return o(),r.getActiveTools()},getAllTools(){return o(),r.getAllTools()},getSettings(){return o(),r.getSettings()},setActiveTools(t){o(),r.setActiveTools(t)},getCommands(){return o(),r.getCommands()},setModel(t){return o(),r.setModel(t)},getThinkingLevel(){return o(),r.getThinkingLevel()},setThinkingLevel(t){o(),r.setThinkingLevel(t)},registerProvider(t,s){if(o(),typeof t=="string"){if(!s)throw new Error("Provider config is required when registering by name");u(()=>r.registerProvider(t,s,e.path));return}u(()=>r.registerNativeProvider(t,e.path))},unregisterProvider(t){o(),u(()=>r.unregisterProvider(t,e.path))},registerMcpServer(t,s){o();let f=U(t,s);if(typeof f=="string")throw new Error(`Invalid MCP server registered by extension "${e.path}": ${f}`);let y=r.mcpServers.get(t)?.extensionPath;if(y!==void 0&&y!==e.path)throw new Error(`MCP server "${t}" is already registered by extension "${y}"`);let m=r.mcpServers.list().find(j=>j.name!==t&&k(j.name)===k(t));if(m)throw new Error(`MCP server "${t}" conflicts with registered server "${m.name}"`);let E={name:t,config:structuredClone(f),extensionPath:e.path};u(()=>r.mcpServers.register(E))},unregisterMcpServer(t){o(),u(()=>r.mcpServers.unregister(t,e.path))},getMcpServers(){return o(),r.mcpServers.list()},registerVirtualModel(t){o();let s={...t,route:f=>t.route(f,r.createContext())};u(()=>r.registerVirtualModel(s,e.path))},unregisterVirtualModel(t,s){o(),u(()=>r.unregisterVirtualModel(t,s))},events:{emit(t,s){o(),n.emit(t,s)},on(t,s){o();let f=r.trackEventBusSubscription(n.on(t,s));return d==="loading"&&i.push(f),f}}},commit:()=>{if(d==="loading"){r.assertActive();for(let[t,s]of c)r.flagValues.has(t)||r.flagValues.set(t,s);for(let t of a)t();d="active",g()}},discard:()=>{if(d==="loading"){d="failed";for(let t of i)t();g()}}}}function Y(e){return e!==void 0&&x===e.cwd&&L===e.generation}async function ye(e,r){if(Y(r)){let d=I.get(e);if(d)return d}let l=await fe(),n=Z?{virtualModules:await Q(),tryNative:!1}:ue?{virtualModules:await Q(),tsconfigPaths:!0}:{alias:pe()},i=await l(new URL("vendor/pi/dist/core/extensions/loader.js",__cortexPackageRoot).href,{moduleCache:!1,...n}).import(e,{default:!0});if(typeof i=="function")return Y(r)&&I.set(e,i),i}function we(e,r){let l=G(e)??"local",n=q(e)?void 0:p.dirname(r);return{path:e,resolvedPath:r,sourceInfo:H(e,{source:l,baseDir:n}),handlers:new Map,tools:new Map,messageRenderers:new Map,entryRenderers:new Map,commands:new Map,flags:new Map,shortcuts:new Map}}async function ee(e,r,l,n,c,a){let i=we(r,l),d=ve(i,a,n,c);try{await e(d.api),d.commit()}catch(o){throw d.discard(),o}return T(`${r} factory`,"extensions"),i}async function xe(e,r,l,n,c){let a=w(e,r,{normalizeUnicodeSpaces:!0});try{let i=await ye(a,c);return T(`${e} module import`,"extensions"),i?{extension:await ee(i,e,a,r,l,n),error:null}:{extension:null,error:`Extension does not export a valid factory function: ${e}`}}catch(i){return{extension:null,error:`Failed to load extension: ${i instanceof Error?i.message:String(i)}`}}}async function Je(e,r,l,n,c="<inline>"){let a=w(r);return ee(e,c,c,a,l,n)}async function te(e,r,l,n,c=!1){let a=[],i=[],d=[],o=c?he(r):void 0,u=o?.cwd??w(r),g=l??z(),h=n??me();for(let t of e){let{extension:s,error:f}=await xe(t,u,g,h,o);if(f){i.push({path:t,error:f});continue}s&&a.push(s)}return{extensions:a,errors:i,warnings:d,runtime:h}}async function Ee(e,r,l,n){return te(e,r,l,n)}async function Ge(e,r,l,n){return te(e,r,l,n,!0)}function Se(e){return e.endsWith(".ts")||e.endsWith(".js")}function re(e){let r=p.join(e,"package.json");if(v.existsSync(r)){let c=W(r);if(c?.extensions?.length){let a=[];for(let i of c.extensions){let d=p.resolve(e,i);v.existsSync(d)&&a.push(d)}if(a.length>0)return a}}let l=p.join(e,"index.ts"),n=p.join(e,"index.js");return v.existsSync(l)?[l]:v.existsSync(n)?[n]:null}function C(e){if(!v.existsSync(e))return[];let r=[];try{let l=v.readdirSync(e,{withFileTypes:!0});for(let n of l){let c=p.join(e,n.name);if((n.isFile()||n.isSymbolicLink())&&Se(n.name)){r.push(c);continue}if(n.isDirectory()||n.isSymbolicLink()){let a=re(c);a&&r.push(...a)}}}catch{return[]}return r}async function qe(e,r,l=_(),n){let c=w(r),a=w(l),i=[],d=new Set,o=h=>{for(let t of h){let s=p.resolve(t);d.has(s)||(d.add(s),i.push(t))}},u=p.join(c,D,"extensions");o(C(u));let g=p.join(a,"extensions");o(C(g));for(let h of e){let t=w(h,c,{normalizeUnicodeSpaces:!0});if(v.existsSync(t)&&v.statSync(t).isDirectory()){let s=re(t);if(s){o(s);continue}o(C(t));continue}o([t])}return Ee(i,c,n)}export{z as a,W as b,J as c,G as d,q as e,Ie as f,H as g,ae as h,T as i,je as j,ge as k,me as l,Je as m,Ee as n,Ge as o,qe as p};
|