@cortex-agent/server 2026.10.25 → 2026.10.28
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 +23 -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-BPXakv_3.js +2 -0
- package/web/dist/assets/index-BHZpFXhc.js +525 -0
- package/web/dist/assets/index-DqWMdMkh.css +1 -0
- package/web/dist/assets/index-WCm6wwmM.js +1 -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{b as _}from"./chunk-WEZWKMYU.js";import{a as p}from"./chunk-XBJOYU5Y.js";import{a as w}from"./chunk-XAXWLYH5.js";import"./chunk-IRWZ7UPF.js";import{a as f}from"./chunk-ILEML5IP.js";import"./chunk-WHC7AYZD.js";var v="127.0.0.1",m=1456,E="/oauth/callback",d=`http://${v}:${m}${E}`,A=6e4,g="browser",y="device-code",a="pi-gateway",O="gateway offline_access",S="urn:ietf:params:oauth:grant-type:device_code";async function L(o,r){let e=await fetch(new URL("/v1/oauth",o),{headers:{accept:"application/json"},signal:r});if(!e.ok)throw new Error(`Could not load Radius OAuth config from ${o}: ${e.status} ${await e.text()}`);let t=await e.json();if(typeof t.authorizationEndpoint!="string")throw new Error(`Invalid Radius OAuth config from ${o}`);return{authorizationEndpoint:t.authorizationEndpoint}}var c=class extends Error{status;oauthError;constructor(r,e,t,n){let i=e?t?`${e}: ${t}`:e:t||String(r);super(`${n}: ${i}`),this.status=r,this.oauthError=e}};async function R(o,r){let e=await o.text().catch(()=>""),t,n;if(e)try{let i=JSON.parse(e);t=typeof i.error=="string"?i.error:void 0,n=typeof i.error_description=="string"?i.error_description:void 0}catch{n=e}return new c(o.status,t,n,r)}async function u(o,r,e){let t;try{t=await fetch(new URL("/v1/oauth/token",o),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:r,signal:e})}catch(i){throw e.aborted?new Error("Login cancelled"):i}if(!t.ok)throw await R(t,"Radius OAuth token request failed");let n=await t.json();return{type:"oauth",access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1e3-A,scope:n.scope}}async function C(o,r,e){let{verifier:t,challenge:n}=await w(),i=crypto.randomUUID(),l=new URL(r);l.search=new URLSearchParams({response_type:"code",client_id:a,redirect_uri:d,scope:O,code_challenge:n,code_challenge_method:"S256",handoff:"url",state:i}).toString();let h=await p({providerName:"Radius",host:v,port:m,path:E,state:i,complete:s=>u(o,new URLSearchParams({grant_type:"authorization_code",client_id:a,redirect_uri:d,code:s,code_verifier:t}),e.signal),signal:e.signal});e.notify({type:"progress",message:`Listening for OAuth callback on ${d}`}),e.notify({type:"auth_url",url:l.toString(),instructions:"Continue in your browser."});try{let s=await h.wait();if(!s)throw new Error("OAuth callback did not complete.");return s}finally{h.close()}}async function U(o,r){let e;try{e=await fetch(new URL("/v1/oauth/device",o),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:a,scope:O}),signal:r})}catch(n){throw r.aborted?new Error("Login cancelled"):n}if(!e.ok)throw await R(e,"Radius OAuth device authorization failed");let t=await e.json();if(!t.device_code||!t.user_code||!t.verification_uri||!t.expires_in)throw new Error("Radius OAuth device authorization response is missing required fields");return{device_code:t.device_code,user_code:t.user_code,verification_uri:t.verification_uri,expires_in:t.expires_in,interval:t.interval}}async function x(o,r){let e=await U(o,r.signal);return r.notify({type:"device_code",userCode:e.user_code,verificationUri:e.verification_uri,intervalSeconds:e.interval,expiresInSeconds:e.expires_in}),f({intervalSeconds:e.interval,expiresInSeconds:e.expires_in,signal:r.signal,poll:async()=>{try{return{status:"complete",value:await u(o,new URLSearchParams({grant_type:S,client_id:a,device_code:e.device_code}),r.signal)}}catch(t){if(!(t instanceof c))throw t;switch(t.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw t}}}})}function b(o){let r=_(o.gateway);return{name:o.name,async login(e){let t=await e.prompt({type:"select",message:`Sign in to ${o.name}:`,options:[{id:g,label:"Sign in with browser (recommended)"},{id:y,label:"Sign in with device code (when signing in from another device)"}]});if(t===y)return x(r,e);if(t===g){let n=await L(r,e.signal);return C(r,n.authorizationEndpoint,e)}throw new Error(`Unknown ${o.name} sign-in method: ${t}`)},async refresh(e,t){return await u(r,new URLSearchParams({grant_type:"refresh_token",client_id:a,refresh_token:e.refresh}),t)},async toAuth(e){return{apiKey:e.access}}}}export{b as createRadiusOAuth};
|
|
@@ -0,0 +1,14 @@
|
|
|
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 E}from"./chunk-XNSSUVT6.js";import{a as R,b as L,c as N,d as P,e as K,f as G}from"./chunk-TJ4GQRT6.js";import{a as j,d as F}from"./chunk-TAWLERZA.js";import"./chunk-CQLH4UVX.js";import"./chunk-OKRK6JPY.js";import"./chunk-OE4KH3NJ.js";import"./chunk-KRXTI4JO.js";import{J as r}from"./chunk-DPQPXBTP.js";import{f as A,l as I,u as O}from"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";import*as B from"fs";import*as v from"path";import*as Z from"crypto";import{pathToFileURL as ee}from"url";var k=class{memoryCache=new Map;cacheDir;sessionId;constructor(e={}){this.cacheDir=e.cacheDir??R(A),this.sessionId=e.sessionId??process.env.CORTEX_SESSION_ID,N(this.cacheDir)}buildBlocks(e,l,f){if(!l||l.length===0)return[];let h=c=>L(c.deviceId?.trim()||e,c.path);return P(this.cacheDir,this.sessionId,c=>{let n=!1,o=[];for(let t of l)c.get(h(t))!==t.mtimeMs&&(f?.has(t.path)?(c.set(h(t),t.mtimeMs),n=!0):o.push(t));let{included:u,blocks:m,truncated:a}=K(o,t=>this.formatBlock(e,t));for(let t of u)c.set(h(t),t.mtimeMs),n=!0;return{value:(a.length>0?[...m,G(a.map(t=>`${e}:${t.path}`))]:m).map(t=>({type:"text",text:t})),changed:n}},this.memoryCache)}formatBlock(e,l){return`<system-reminder>
|
|
5
|
+
Auto-loaded AGENTS.md from ${e}:${l.path} (ancestor of accessed path on remote device). These instructions apply to files under this directory on that device.
|
|
6
|
+
|
|
7
|
+
`+l.content+`
|
|
8
|
+
</system-reminder>`}},T=null;function q(){return T||(T=new k),T}function S(s,e,l){if(!e||e.length===0)return[];let f;if(l){let h=e.filter(c=>Q(c.path,l));h.length>0&&(f=new Set(h.map(c=>c.path)))}return q().buildBlocks(s,e,f)}function Q(s,e){return s===e?!0:s.replace(/\\/g,"/")===e.replace(/\\/g,"/")}import{readFileSync as V}from"fs";import*as z from"path";var Y=z.join(I,"machines.json");function H(s=Y){try{let e=JSON.parse(V(s,"utf-8"));return Object.entries(e).map(([l,f])=>({name:l,windows:f?.win===!0}))}catch{return[]}}function W(s){return s.length===0?"":` Known devices: ${s.map(l=>l.windows?`${l.name} (Windows)`:l.name).join(", ")}. May be offline; failed calls list currently online devices.`}function U(s,e){return Array.isArray(e)?`${s}. Online devices: ${e.length>0?e.join(", "):"none"}`:s}async function $(s,e,l,f,h){let{body:c}=await j("POST",`${s.webhookBaseUrl}/webhook/remote-command`,{device:e,action:l,params:f,timeout:h},F(s));if(!c.success)throw new Error(U(c.error||"Command failed",c.onlineDevices));return c.data}var J=v.join(O,"tool-results"),te={remote_bash:3e4,remote_grep:2e4,remote_glob:1e5};function C(s,e){let l=te[s];if(e.length<=l)return e;B.mkdirSync(J,{recursive:!0});let f=`${s}-${Date.now()}-${Z.randomBytes(4).toString("hex")}`,h=v.join(J,`${f}.txt`);B.writeFileSync(h,e,"utf8");let c=(e.length/1024).toFixed(2),n=e.slice(0,2e3);return["<persisted-output>",`Output too large (${c} KB). Full output saved to local file:`,` ${h}`,"","Preview (first 2 KB):",n,"...","</persisted-output>"].join(`
|
|
9
|
+
`)}var w=null;try{w=(await import("sharp")).default}catch{}var M=25e3,X=1568;function D(s){return Math.ceil(s*.125)}async function re(s,e,l,f){if(!w)return{data:s,mimeType:e,width:l||0,height:f||0};let h=Buffer.from(s,"base64"),c=await w(h).metadata(),n=c.width||l||0,o=c.height||f||0,u=e,m=Math.max(n,o),a=h;if(m>X){let g=X/m;n=Math.round(n*g),o=Math.round(o*g),a=await w(h).resize(n,o,{fit:"inside",withoutEnlargement:!0}).toBuffer()}let i;u==="image/png"?i=await w(a).png({compressionLevel:6}).toBuffer():u==="image/webp"?i=await w(a).webp({quality:85}).toBuffer():(i=await w(a).jpeg({quality:85}).toBuffer(),u="image/jpeg");let t=i.toString("base64"),d=D(t.length);if(d>M){(u==="image/png"||u==="image/webp")&&(i=await w(i).jpeg({quality:80}).toBuffer(),u="image/jpeg",t=i.toString("base64"),d=D(t.length));let g=[70,55,40,30];for(let p of g){if(d<=M)break;i=await w(a).resize(n,o,{fit:"inside",withoutEnlargement:!0}).jpeg({quality:p}).toBuffer(),u="image/jpeg",t=i.toString("base64"),d=D(t.length)}let b=[.75,.5,.35];for(let p of b){if(d<=M)break;let x=Math.round(n*p),_=Math.round(o*p);i=await w(h).resize(x,_,{fit:"inside",withoutEnlargement:!0}).jpeg({quality:30}).toBuffer(),t=i.toString("base64"),d=D(t.length)}}let y=await w(i).metadata();return{data:t,mimeType:u,width:y.width||n,height:y.height||o}}function we(s,e){let f=["remote_bash","remote_read","remote_write","remote_edit","remote_glob","remote_grep"].find(n=>!e.toolAllowlist||e.toolAllowlist.has(n)),h=W(H()),c=(n,o)=>o+(n===f?h:"");s.tool("remote_bash",c("remote_bash","Run a remote shell command via cortex-client; Windows uses git-bash."),{device:r.string().describe("Target device name."),command:r.string().describe("Shell command to execute"),timeout:r.number().int().min(1).max(600).optional().describe("Timeout in seconds (default: 120, max: 600)"),description:r.string().optional().describe("Command summary for logging"),run_in_background:r.boolean().optional().describe("Run command in background, return PID immediately; timeout is ignored")},async({device:n,command:o,timeout:u,description:m,run_in_background:a})=>{try{let i=(u??120)*1e3,t=await $(e,n,"bash",{command:o,timeout:i,run_in_background:a||!1},i+5e3),d=[];t.stdout&&d.push(t.stdout),t.stderr&&d.push(`[stderr]
|
|
10
|
+
${t.stderr}`),t.exitCode!==0&&d.push(`[exit code: ${t.exitCode}]`);let y=d.join(`
|
|
11
|
+
`)||"(no output)",g=C("remote_bash",y),b=t.exitCode!==void 0&&t.exitCode!==0;return{content:[{type:"text",text:g}],...b?{isError:!0}:{}}}catch(i){return{content:[{type:"text",text:`remote_bash error: ${i.message}`}],isError:!0}}}),s.tool("remote_read",c("remote_read","Read a remote absolute path: numbered text, inline images (PNG/JPEG/GIF/WebP/BMP), or PDF documents."),{device:r.string().describe("Target device name."),file_path:r.string().describe("Absolute path to the file to read"),offset:r.number().optional().describe("Line number to start reading from (0-based)"),limit:r.number().optional().describe("Number of lines to read")},{readOnlyHint:!0},async({device:n,file_path:o,offset:u,limit:m})=>{try{if(!E(o))return{content:[{type:"text",text:"file_path must be absolute"}],isError:!0};let a=await $(e,n,"read",{file_path:o,offset:u,limit:m}),i=S(n,a.cortexMDs,o);if(a.image){let{data:t,mimeType:d,width:y,height:g,originalSize:b}=a.image;try{let p=await re(t,d,y,g),x=D(p.data.length),_=[`Image: ${o}`,`Original: ${y||"?"}x${g||"?"} ${d} (${(b/1024).toFixed(1)} KB)`];return p.width!==y||p.height!==g||p.mimeType!==d?_.push(`Processed: ${p.width}x${p.height} ${p.mimeType} (~${x} tokens)`):_.push(`~${x} tokens`),{content:[{type:"text",text:_.join(`
|
|
12
|
+
`)},{type:"image",data:p.data,mimeType:p.mimeType},...i]}}catch(p){return{content:[{type:"text",text:`Image detected (${d}, ${y||"?"}x${g||"?"}, ${(b/1024).toFixed(1)} KB) but processing failed: ${p.message}`},...i]}}}if(a.pdf){let{data:t,originalSize:d}=a.pdf;return{content:[{type:"text",text:`PDF: ${o} (${(d/1024).toFixed(1)} KB)`},{type:"resource",resource:{uri:ee(o).href,mimeType:"application/pdf",blob:t}},...i]}}return{content:[{type:"text",text:a.content||"(empty file)"},...i]}}catch(a){return{content:[{type:"text",text:`remote_read error: ${a.message}`}],isError:!0}}}),s.tool("remote_write",c("remote_write","Write/overwrite a remote file at an absolute path; creates parent directories."),{device:r.string().describe("Target device name."),file_path:r.string().describe("Absolute path to the file to write"),content:r.string().describe("Content to write to the file")},async({device:n,file_path:o,content:u})=>{try{if(!E(o))return{content:[{type:"text",text:"file_path must be absolute"}],isError:!0};let m=await $(e,n,"write",{file_path:o,content:u}),a=S(n,m?.cortexMDs,o);return{content:[{type:"text",text:`File written: ${o}`},...a]}}catch(m){return{content:[{type:"text",text:`remote_write error: ${m.message}`}],isError:!0}}}),s.tool("remote_edit",c("remote_edit","Replace text in a remote file at an absolute path. old_string must be unique unless replace_all=true."),{device:r.string().describe("Target device name."),file_path:r.string().describe("Absolute path to the file to edit"),old_string:r.string().describe("The text to replace"),new_string:r.string().describe("The replacement text"),replace_all:r.boolean().optional().describe("Replace all occurrences (default: false)")},async({device:n,file_path:o,old_string:u,new_string:m,replace_all:a})=>{try{if(!E(o))return{content:[{type:"text",text:"file_path must be absolute"}],isError:!0};let i=await $(e,n,"edit",{file_path:o,old_string:u,new_string:m,replace_all:a||!1}),t=S(n,i?.cortexMDs,o);return{content:[{type:"text",text:`File edited: ${o}`},...t]}}catch(i){return{content:[{type:"text",text:`remote_edit error: ${i.message}`}],isError:!0}}}),s.tool("remote_glob",c("remote_glob","List remote file paths matching a glob."),{device:r.string().describe("Target device name."),pattern:r.string().describe("Glob pattern to match files against"),path:r.string().optional().describe("Directory to search in (absolute path)")},{readOnlyHint:!0},async({device:n,pattern:o,path:u})=>{try{let m=await $(e,n,"glob",{pattern:o,path:u}),a=m.files||[];if(a.length===0)return{content:[{type:"text",text:"No files matched the pattern."}]};let i=a.join(`
|
|
13
|
+
`);return m.truncated&&(i+=`
|
|
14
|
+
[... truncated at ${a.length} results]`),{content:[{type:"text",text:C("remote_glob",i)}]}}catch(m){return{content:[{type:"text",text:`remote_glob error: ${m.message}`}],isError:!0}}}),s.tool("remote_grep",c("remote_grep","Search remote file contents with ripgrep; return matching lines, paths, or counts."),{device:r.string().describe("Target device name."),pattern:r.string().describe("Regex pattern to search for"),path:r.string().optional().describe("File or directory to search in"),glob:r.string().optional().describe('Glob pattern to filter files (e.g. "*.ts", "*.{ts,tsx}")'),type:r.string().optional().describe('File type to search (e.g. "js", "py", "rust")'),output_mode:r.enum(["content","files_with_matches","count"]).optional().describe("Output mode (default: files_with_matches)"),"-A":r.number().optional().describe("Lines to show after each match"),"-B":r.number().optional().describe("Lines to show before each match"),"-C":r.number().optional().describe("Context lines before and after each match"),context:r.number().optional().describe("Alias for -C"),"-i":r.boolean().optional().describe("Case insensitive search"),"-n":r.boolean().optional().describe("Show line numbers (default: true for content mode)"),head_limit:r.number().optional().describe("Limit output entries (default: 250, 0 for unlimited)"),offset:r.number().optional().describe("Skip first N entries before applying head_limit"),multiline:r.boolean().optional().describe("Enable multiline matching (pattern can span lines)")},{readOnlyHint:!0},async({device:n,pattern:o,path:u,glob:m,type:a,output_mode:i,context:t,head_limit:d,offset:y,multiline:g,...b})=>{try{let x=(await $(e,n,"grep",{pattern:o,path:u,glob:m,type:a,output_mode:i,"-A":b["-A"],"-B":b["-B"],"-C":b["-C"],context:t,"-i":b["-i"],"-n":b["-n"],head_limit:d,offset:y,multiline:g})).output||"(no matches)";return{content:[{type:"text",text:C("remote_grep",x)}]}}catch(p){return{content:[{type:"text",text:`remote_grep error: ${p.message}`}],isError:!0}}})}export{we as registerRemoteOpsTools};
|
|
@@ -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{ia as a,ja as b,ka as c}from"./chunk-BKHDWCRT.js";import"./chunk-TJ4GQRT6.js";import"./chunk-DHSA5ACV.js";import"./chunk-KIU5FAPY.js";import"./chunk-B3XBQEFM.js";import"./chunk-4U7XXM4W.js";import"./chunk-LMDWRRX4.js";import"./chunk-Y6ZEVVL5.js";import"./chunk-NVX5IPRN.js";import"./chunk-TAWLERZA.js";import"./chunk-CQLH4UVX.js";import"./chunk-3F6WW7HR.js";import"./chunk-Z4H3VDHI.js";import"./chunk-FOQ7VLIL.js";import"./chunk-EQITBTJC.js";import"./chunk-UD3NMUHR.js";import"./chunk-LEUENXI2.js";import"./chunk-HALUQ7ZF.js";import"./chunk-3THJYAEF.js";import"./chunk-D3NXKK2L.js";import"./chunk-NKXV32S6.js";import"./chunk-O3JW2F7D.js";import"./chunk-TZFLHVOQ.js";import"./chunk-YG7OEPR2.js";import"./chunk-7MU2AKNM.js";import"./chunk-LMSQZ6TQ.js";import"./chunk-JERCOLY3.js";import"./chunk-DGMNI4AO.js";import"./chunk-5T7IX5KN.js";import"./chunk-OKRK6JPY.js";import"./chunk-BGVHA2D4.js";import"./chunk-OE4KH3NJ.js";import"./chunk-LCKVYFMD.js";import"./chunk-5M4PFLRW.js";import"./chunk-3YHOCPQU.js";import"./chunk-MEPASGPP.js";import"./chunk-STUHNKQS.js";import"./chunk-PFMEUFJ7.js";import"./chunk-KRXTI4JO.js";import"./chunk-DPQPXBTP.js";import"./chunk-Q4UGYGU5.js";import"./chunk-W5LGYSPZ.js";import"./chunk-E7ZMYIY6.js";import"./chunk-NAA7GF6Q.js";import"./chunk-QWAQHHRS.js";import"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";export{c as _test,b as runSubagent,a as supportsSubagents};
|
|
@@ -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,b,c,d,e,f}from"./chunk-L6VCIGWS.js";import"./chunk-Y3GFB5XM.js";import"./chunk-EQIMHXC4.js";import"./chunk-IRWZ7UPF.js";import"./chunk-RA6HKFBV.js";import"./chunk-FX6MOGLR.js";import"./chunk-QUUEQRIT.js";import"./chunk-AWFUHWQK.js";import"./chunk-B3XBQEFM.js";import"./chunk-WHC7AYZD.js";export{a as McpOAuthCredentialStore,f as McpServerConnection,d as McpServerLog,b as McpSignInCancelledError,e as createDefaultTransport,c as signInMcpServer};
|
|
@@ -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 k,d as S,e as l,f as w,h as v,k as p,o as g,q as A,r as j,s as C,t as D}from"./chunk-W25TB3PU.js";import"./chunk-HALUQ7ZF.js";import{h as x}from"./chunk-PZMXHA6X.js";import"./chunk-TZFLHVOQ.js";import"./chunk-JERCOLY3.js";import"./chunk-OKRK6JPY.js";import"./chunk-BGVHA2D4.js";import"./chunk-LCKVYFMD.js";import{b as E,c as M}from"./chunk-PMG4YGDU.js";import"./chunk-STUHNKQS.js";import"./chunk-Q4UGYGU5.js";import"./chunk-W5LGYSPZ.js";import"./chunk-E7ZMYIY6.js";import"./chunk-NAA7GF6Q.js";import"./chunk-QWAQHHRS.js";import"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";var f=["list","get","add","edit","pause","resume","remove"],L={"--type":"type","--interval":"interval","--time":"time","--day":"day","--delay":"delay","--message":"message","--project":"project","--model":"model","--thinking":"thinking","--pre-check":"preCheck","--idempotency-key":"idempotencyKey"},O=["interval","time","day","delay","message","project","model","thinking","preCheck"],I={list:["project"],get:[],add:["type",...O,"idempotencyKey"],edit:O,pause:[],resume:[],remove:[]},F={interval:["interval"],daily:["time"],weekly:["day","time"],once:["delay"]},T=new Set(["get","edit","pause","resume","remove"]),c=class extends Error{validValues;hint;constructor(t,n,r="cortex schedule --help"){super(t),this.validValues=n,this.hint=r}};function h(e){return Object.entries(L).filter(([,t])=>e.includes(t)).map(([t])=>t)}function N(e,t,n,r){let i=L[t[n]];if(!i||!I[e].includes(i)){let s=[...h(I[e]),...e==="remove"?["--dry-run"]:[]];throw new c(`Unknown option for '${e}': '${t[n]}'.`,s.length?s:["(none)"])}if(t[n+1]===void 0||t[n+1].startsWith("--"))throw new c(`Missing value for ${t[n]}.`);r[i]=t[n+1]}function R(e,t,n){let r={id:"",flags:{},dryRun:!1},i=[];for(let o=0;o<t.length;o+=1)e==="remove"&&t[o]==="--dry-run"?r.dryRun=!0:t[o].startsWith("-")?N(e,t,o++,r.flags):i.push(t[o]);let s=T.has(e)?1:0;if(i.length!==s)throw new c(s?`'${e}' takes one schedule id.`:`Unexpected argument: '${i[0]}'.`,void 0,s?`cortex schedule ${e} <id>`:void 0);return r.id=i[0]??"",r.flags.message==="-"&&(r.flags.message=n()),r}var b=["createdAt","nextRun","lastRun","runAt","pausedAt","lastSkipped"];function m(e){let t={...e};for(let n of b)typeof e[n]=="number"&&(t[n]=new Date(e[n]).toISOString());return t}function d(e,t){if(!e)throw new c(`Schedule not found: '${t}'.`,void 0,"cortex schedule list");return m(e)}async function G({flags:e},t){if(!e.type)throw new c("Missing --type.",[...k]);let n=v({type:e.type,message:e.message,projectId:e.project,selection:p(e.model,e.thinking),preCheck:e.preCheck,interval:e.interval,time:e.time,dayOfWeek:e.day,delay:e.delay}),r=F[n.type],i=["interval","time","day","delay"].filter(u=>e[u]!==void 0&&!r.includes(u));if(i.length)throw new c(`${h(i).join(", ")} does not apply to --type ${n.type}.`,h(r));let{task:s,created:o}=await A(t,n,{idempotencyKey:e.idempotencyKey});return{ok:!0,created:o,schedule:m(s)}}var W={message:e=>({message:e}),project:e=>({projectId:e}),preCheck:e=>({preCheck:e}),interval:e=>({intervalMs:l(e,"interval")}),time:e=>({time:e}),day:e=>({dayOfWeek:w(e)}),delay:e=>({runAt:Date.now()+l(e,"delay")})};async function K({id:e,flags:t},n){let r=await n.findTask(e);d(r,e);let{model:i,thinking:s,...o}=t,u=Object.assign({},...Object.entries(o).map(([_,$])=>W[_]($))),y=p(i,s,r?.selection);return y&&(u.selection=y),{ok:!0,schedule:d(await j(n,e,u),e)}}async function U({id:e,dryRun:t},n){return t?{ok:!0,dry_run:!0,would_remove:d(await n.findTask(e),e)}:{ok:!0,id:e,removed:await n.removeTask(e)}}async function V({flags:e},t){let n=(await t.read()).tasks.filter(r=>!e.project||r.projectId===e.project);return{ok:!0,count:n.length,schedules:n.map(m)}}var H={list:V,get:async({id:e},t)=>({ok:!0,schedule:d(await t.findTask(e),e)}),add:G,edit:K,pause:async({id:e},t)=>({ok:!0,schedule:d(await C(t,e),e)}),resume:async({id:e},t)=>({ok:!0,schedule:d(await D(t,e),e)}),remove:U};function a(e,t,n){return{exitCode:1,stdout:"",stderr:E(e,{validValues:t,hint:n})}}function P(e){return e instanceof c?a(e.message,e.validValues,e.hint):e instanceof S?a(e.message,void 0,"cortex schedule --help"):a(e.message)}async function X(e,t={}){if(e.includes("--help")||e.includes("-h"))return{exitCode:0,stdout:x(),stderr:""};let[n,...r]=e;if(!n)return a("Missing subcommand for 'schedule'.",[...f]);if(!f.includes(n))return a(`Unknown subcommand: '${n}'.`,[...f]);try{let i=R(n,r,t.readStdin??M),s=await H[n](i,t.repo??g);return{exitCode:0,stdout:JSON.stringify(s,null,2),stderr:""}}catch(i){return P(i)}}export{X as runScheduleCli};
|
|
@@ -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 w,c as E}from"./chunk-XNSSUVT6.js";import{e as x,f as C}from"./chunk-XAJLZR7C.js";import{a as L}from"./chunk-NT32UURL.js";import"./chunk-KIGMAATV.js";import"./chunk-I6OPDRVF.js";import"./chunk-N6BTQN7R.js";import"./chunk-TAWLERZA.js";import"./chunk-CQLH4UVX.js";import"./chunk-OKRK6JPY.js";import"./chunk-OE4KH3NJ.js";import"./chunk-KRXTI4JO.js";import{J as r}from"./chunk-DPQPXBTP.js";import"./chunk-NAA7GF6Q.js";import"./chunk-J5DVLUKY.js";import{e as T}from"./chunk-WHC7AYZD.js";var k=T(x(),1);import*as S from"fs";import*as b from"path";function v(e){return{slack:e.slackBotToken?new k.WebClient(e.slackBotToken):null,fallbackChannel:e.channel??void 0,ctx:e}}function y(){return new C({globalCapacity:m("CORTEX_SLACK_RL_GLOBAL_CAPACITY",20),globalRefillPerSec:m("CORTEX_SLACK_RL_GLOBAL_REFILL_PER_SEC",1),perChannelCapacity:m("CORTEX_SLACK_RL_CHANNEL_CAPACITY",1),perChannelRefillPerSec:m("CORTEX_SLACK_RL_CHANNEL_REFILL_PER_SEC",1)})}function m(e,t){let l=process.env[e];return l?Number(l):t}var R=null;async function A(e,{channel:t,filePath:l,fileName:s,title:h,initialComment:p}){let a=R??(R=y()),{resolved:o,size:c}=L(l),f=S.readFileSync(o),i=s||b.basename(o),n=w(t,"slack:");p&&(await a.acquire("chat.postMessage",n),await e.chat.postMessage({channel:n,text:p})),await a.acquire("files.getUploadURLExternal",n);let d=await e.files.getUploadURLExternal({filename:i,length:c});if(!d?.upload_url||!d?.file_id)throw new Error("Slack upload initialization failed: missing upload_url or file_id");let u=await fetch(d.upload_url,{method:"POST",headers:{"Content-Type":"application/octet-stream"},body:f});if(!u.ok){let _=await u.text().catch(()=>""),g=_?`: ${_.slice(0,300)}`:"";throw new Error(`Slack file upload failed (${u.status} ${u.statusText})${g}`)}return await a.acquire("files.completeUploadExternal",n),await e.files.completeUploadExternal({files:[{id:d.file_id,title:h||i}],channel_id:n}),{path:o,fileName:i,size:c}}function $(e,t){e.tool("slack_send_file","Share a local or remote-device file in the Slack chat.",{file_path:r.string().describe("File path to upload. Local path, or an absolute path on `device`."),file_name:r.string().optional().describe("Optional filename override shown in Slack"),title:r.string().optional().describe("Optional file title shown in Slack"),comment:r.string().optional().describe("Optional comment to accompany the file"),device:r.string().optional().describe("Connected device to read from; omit for this server.")},async({file_path:l,file_name:s,title:h,comment:p,device:a})=>{try{let o=t.fallbackChannel;if(!o)throw new Error("No routing channel available");if(!t.slack)throw new Error("Missing SLACK_BOT_TOKEN");let c=(i,n)=>A(t.slack,{channel:o,filePath:i,fileName:n,title:h,initialComment:p||void 0}),f=a?await E(t.ctx,a,l,i=>c(i.localPath,s||i.name)):await c(l,s);return{content:[{type:"text",text:`File uploaded${a?` from ${a}`:""}: ${f.fileName} (${f.size} bytes)`}]}}catch(o){return{content:[{type:"text",text:`Failed to upload file: ${o.message}`}],isError:!0}}})}export{$ as registerSlackTools,v as slackDepsFor,A as uploadFileToSlack};
|
|
@@ -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{a as j,b as Ie,c as ze,d as I,e as ae,f as fe,g as Ne,h as De,i as Me,j as We,k as Ve}from"./chunk-Z2Q2NR46.js";import{b as y}from"./chunk-WHC7AYZD.js";function Ge(r){if(!/^data:/i.test(r))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');r=r.replace(/\r?\n/g,"");let e=r.indexOf(",");if(e===-1||e<=4)throw new TypeError("malformed data: URI");let t=r.substring(5,e).split(";"),n="",o=!1,s=t[0]||"text/plain",i=s;for(let R=1;R<t.length;R++)t[R]==="base64"?o=!0:t[R]&&(i+=`;${t[R]}`,t[R].indexOf("charset=")===0&&(n=t[R].substring(8)));!t[0]&&!n.length&&(i+=";charset=US-ASCII",n="US-ASCII");let c=o?"base64":"ascii",l=unescape(r.substring(e+1)),a=Buffer.from(l,c);return a.type=s,a.typeFull=i,a.charset=n,a}var ce,le=y(()=>{ce=Ge});var U,M=y(()=>{U=class extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var p,q=y(()=>{M();p=class extends U{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}}});var W,ee,z,ue,he,de,V=y(()=>{W=Symbol.toStringTag,ee=r=>typeof r=="object"&&typeof r.append=="function"&&typeof r.delete=="function"&&typeof r.get=="function"&&typeof r.getAll=="function"&&typeof r.has=="function"&&typeof r.set=="function"&&typeof r.sort=="function"&&r[W]==="URLSearchParams",z=r=>r&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.constructor=="function"&&/^(Blob|File)$/.test(r[W]),ue=r=>typeof r=="object"&&(r[W]==="AbortSignal"||r[W]==="EventTarget"),he=(r,e)=>{let t=new URL(e).hostname,n=new URL(r).hostname;return t===n||t.endsWith(`.${n}`)},de=(r,e)=>{let t=new URL(e).protocol,n=new URL(r).protocol;return t===n}});import v,{PassThrough as pe}from"node:stream";import{types as me,deprecate as te,promisify as Ke}from"node:util";import{Buffer as b}from"node:buffer";async function re(r){if(r[m].disturbed)throw new TypeError(`body used already for: ${r.url}`);if(r[m].disturbed=!0,r[m].error)throw r[m].error;let{body:e}=r;if(e===null)return b.alloc(0);if(!(e instanceof v))return b.alloc(0);let t=[],n=0;try{for await(let o of e){if(r.size>0&&n+o.length>r.size){let s=new p(`content size at ${r.url} over limit: ${r.size}`,"max-size");throw e.destroy(s),s}n+=o.length,t.push(o)}}catch(o){throw o instanceof U?o:new p(`Invalid response body while trying to fetch ${r.url}: ${o.message}`,"system",o)}if(e.readableEnded===!0||e._readableState.ended===!0)try{return t.every(o=>typeof o=="string")?b.from(t.join("")):b.concat(t,n)}catch(o){throw new p(`Could not create Buffer from response body for ${r.url}: ${o.message}`,"system",o)}else throw new p(`Premature close of server response while trying to fetch ${r.url}`)}var Ye,m,E,F,Je,G,ye,ge,K=y(()=>{Ie();fe();q();M();V();Ye=Ke(v.pipeline),m=Symbol("Body internals"),E=class{constructor(e,{size:t=0}={}){let n=null;e===null?e=null:ee(e)?e=b.from(e.toString()):z(e)||b.isBuffer(e)||(me.isAnyArrayBuffer(e)?e=b.from(e):ArrayBuffer.isView(e)?e=b.from(e.buffer,e.byteOffset,e.byteLength):e instanceof v||(e instanceof I?(e=ae(e),n=e.type.split("=")[1]):e=b.from(String(e))));let o=e;b.isBuffer(e)?o=v.Readable.from(e):z(e)&&(o=v.Readable.from(e.stream())),this[m]={body:e,stream:o,boundary:n,disturbed:!1,error:null},this.size=t,e instanceof v&&e.on("error",s=>{let i=s instanceof U?s:new p(`Invalid response body while trying to fetch ${this.url}: ${s.message}`,"system",s);this[m].error=i})}get body(){return this[m].stream}get bodyUsed(){return this[m].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await re(this);return e.slice(t,t+n)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let n=new I,o=new URLSearchParams(await this.text());for(let[s,i]of o)n.append(s,i);return n}let{toFormData:t}=await import("./multipart-parser-GEHG6YAR.js");return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[m].body&&this[m].body.type||"",t=await this.arrayBuffer();return new j([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await re(this);return new TextDecoder().decode(e)}buffer(){return re(this)}};E.prototype.buffer=te(E.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(E.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:te(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});F=(r,e)=>{let t,n,{body:o}=r[m];if(r.bodyUsed)throw new Error("cannot clone body after it is used");return o instanceof v&&typeof o.getBoundary!="function"&&(t=new pe({highWaterMark:e}),n=new pe({highWaterMark:e}),o.pipe(t),o.pipe(n),r[m].stream=t,o=n),o},Je=te(r=>r.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),G=(r,e)=>r===null?null:typeof r=="string"?"text/plain;charset=UTF-8":ee(r)?"application/x-www-form-urlencoded;charset=UTF-8":z(r)?r.type||null:b.isBuffer(r)||me.isAnyArrayBuffer(r)||ArrayBuffer.isView(r)?null:r instanceof I?`multipart/form-data; boundary=${e[m].boundary}`:r&&typeof r.getBoundary=="function"?`multipart/form-data;boundary=${Je(r)}`:r instanceof v?null:"text/plain;charset=UTF-8",ye=r=>{let{body:e}=r[m];return e===null?0:z(e)?e.size:b.isBuffer(e)?e.length:e&&typeof e.getLengthSync=="function"&&e.hasKnownLength&&e.hasKnownLength()?e.getLengthSync():null},ge=async(r,{body:e})=>{e===null?r.end():await Ye(e,r)}});import{types as we}from"node:util";import J from"node:http";function be(r=[]){return new g(r.reduce((e,t,n,o)=>(n%2===0&&e.push(o.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return Y(e),oe(e,String(t)),!0}catch{return!1}}))}var Y,oe,g,_=y(()=>{Y=typeof J.validateHeaderName=="function"?J.validateHeaderName:r=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(r)){let e=new TypeError(`Header name must be a valid HTTP token [${r}]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),e}},oe=typeof J.validateHeaderValue=="function"?J.validateHeaderValue:(r,e)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(e)){let t=new TypeError(`Invalid character in header content ["${r}"]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_CHAR"}),t}},g=class r extends URLSearchParams{constructor(e){let t=[];if(e instanceof r){let n=e.raw();for(let[o,s]of Object.entries(n))t.push(...s.map(i=>[o,i]))}else if(e!=null)if(typeof e=="object"&&!we.isBoxedPrimitive(e)){let n=e[Symbol.iterator];if(n==null)t.push(...Object.entries(e));else{if(typeof n!="function")throw new TypeError("Header pairs must be iterable");t=[...e].map(o=>{if(typeof o!="object"||we.isBoxedPrimitive(o))throw new TypeError("Each header pair must be an iterable object");return[...o]}).map(o=>{if(o.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return t=t.length>0?t.map(([n,o])=>(Y(n),oe(n,String(o)),[String(n).toLowerCase(),String(o)])):void 0,super(t),new Proxy(this,{get(n,o,s){switch(o){case"append":case"set":return(i,c)=>(Y(i),oe(i,String(c)),URLSearchParams.prototype[o].call(n,String(i).toLowerCase(),String(c)));case"delete":case"has":case"getAll":return i=>(Y(i),URLSearchParams.prototype[o].call(n,String(i).toLowerCase()));case"keys":return()=>(n.sort(),new Set(URLSearchParams.prototype.keys.call(n)).keys());default:return Reflect.get(n,o,s)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(", ");return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,t)=>{let n=this.getAll(t);return t==="host"?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}};Object.defineProperties(g.prototype,["get","entries","forEach","values"].reduce((r,e)=>(r[e]={enumerable:!0},r),{}))});var _e,Z,ne=y(()=>{_e=new Set([301,302,303,307,308]),Z=r=>_e.has(r)});var T,S,Se=y(()=>{_();K();ne();T=Symbol("Response internals"),S=class r extends E{constructor(e=null,t={}){super(e,t);let n=t.status!=null?t.status:200,o=new g(t.headers);if(e!==null&&!o.has("Content-Type")){let s=G(e,this);s&&o.append("Content-Type",s)}this[T]={type:"default",url:t.url,status:n,statusText:t.statusText||"",headers:o,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[T].type}get url(){return this[T].url||""}get status(){return this[T].status}get ok(){return this[T].status>=200&&this[T].status<300}get redirected(){return this[T].counter>0}get statusText(){return this[T].statusText}get headers(){return this[T].headers}get highWaterMark(){return this[T].highWaterMark}clone(){return new r(F(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,t=302){if(!Z(t))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new r(null,{headers:{location:new URL(e).toString()},status:t})}static error(){let e=new r(null,{status:0,statusText:""});return e[T].type="error",e}static json(e=void 0,t={}){let n=JSON.stringify(e);if(n===void 0)throw new TypeError("data is not JSON serializable");let o=new g(t&&t.headers);return o.has("content-type")||o.set("content-type","application/json"),new r(n,{...t,headers:o})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(S.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var Te,Re=y(()=>{Te=r=>{if(r.search)return r.search;let e=r.href.length-1,t=r.hash||(r.href[e]==="#"?"#":"");return r.href[e-t.length]==="?"?"?":""}});import{isIP as Ze}from"node:net";function xe(r,e=!1){return r==null||(r=new URL(r),/^(about|blob|data):$/.test(r.protocol))?"no-referrer":(r.username="",r.password="",r.hash="",e&&(r.pathname="",r.search=""),r)}function Le(r){if(!Ee.has(r))throw new TypeError(`Invalid referrerPolicy: ${r}`);return r}function Qe(r){if(/^(http|ws)s:$/.test(r.protocol))return!0;let e=r.host.replace(/(^\[)|(]$)/g,""),t=Ze(e);return t===4&&/^127\./.test(e)||t===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(e)?!0:r.host==="localhost"||r.host.endsWith(".localhost")?!1:r.protocol==="file:"}function k(r){return/^about:(blank|srcdoc)$/.test(r)||r.protocol==="data:"||/^(blob|filesystem):$/.test(r.protocol)?!0:Qe(r)}function Ue(r,{referrerURLCallback:e,referrerOriginCallback:t}={}){if(r.referrer==="no-referrer"||r.referrerPolicy==="")return null;let n=r.referrerPolicy;if(r.referrer==="about:client")return"no-referrer";let o=r.referrer,s=xe(o),i=xe(o,!0);s.toString().length>4096&&(s=i),e&&(s=e(s)),t&&(i=t(i));let c=new URL(r.url);switch(n){case"no-referrer":return"no-referrer";case"origin":return i;case"unsafe-url":return s;case"strict-origin":return k(s)&&!k(c)?"no-referrer":i.toString();case"strict-origin-when-cross-origin":return s.origin===c.origin?s:k(s)&&!k(c)?"no-referrer":i;case"same-origin":return s.origin===c.origin?s:"no-referrer";case"origin-when-cross-origin":return s.origin===c.origin?s:i;case"no-referrer-when-downgrade":return k(s)&&!k(c)?"no-referrer":s;default:throw new TypeError(`Invalid referrerPolicy: ${n}`)}}function ve(r){let e=(r.get("referrer-policy")||"").split(/[,\s]+/),t="";for(let n of e)n&&Ee.has(n)&&(t=n);return t}var Ee,Pe,se=y(()=>{Ee=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),Pe="strict-origin-when-cross-origin"});import{format as Xe}from"node:url";import{deprecate as je}from"node:util";var u,N,qe,C,Be,Ae=y(()=>{_();K();V();Re();se();u=Symbol("Request internals"),N=r=>typeof r=="object"&&typeof r[u]=="object",qe=je(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)"),C=class r extends E{constructor(e,t={}){let n;if(N(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==""||n.password!=="")throw new TypeError(`${n} is an url with embedded credentials.`);let o=t.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o)&&(o=o.toUpperCase()),!N(t)&&"data"in t&&qe(),(t.body!=null||N(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let s=t.body?t.body:N(e)&&e.body!==null?F(e):null;super(s,{size:t.size||e.size||0});let i=new g(t.headers||e.headers||{});if(s!==null&&!i.has("Content-Type")){let a=G(s,this);a&&i.set("Content-Type",a)}let c=N(e)?e.signal:null;if("signal"in t&&(c=t.signal),c!=null&&!ue(c))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let l=t.referrer==null?e.referrer:t.referrer;if(l==="")l="no-referrer";else if(l){let a=new URL(l);l=/^about:(\/\/)?client$/.test(a)?"client":a}else l=void 0;this[u]={method:o,redirect:t.redirect||e.redirect||"follow",headers:i,parsedURL:n,signal:c,referrer:l},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||""}get method(){return this[u].method}get url(){return Xe(this[u].parsedURL)}get headers(){return this[u].headers}get redirect(){return this[u].redirect}get signal(){return this[u].signal}get referrer(){if(this[u].referrer==="no-referrer")return"";if(this[u].referrer==="client")return"about:client";if(this[u].referrer)return this[u].referrer.toString()}get referrerPolicy(){return this[u].referrerPolicy}set referrerPolicy(e){this[u].referrerPolicy=Le(e)}clone(){return new r(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(C.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});Be=r=>{let{parsedURL:e}=r[u],t=new g(r[u].headers);t.has("Accept")||t.set("Accept","*/*");let n=null;if(r.body===null&&/^(post|put)$/i.test(r.method)&&(n="0"),r.body!==null){let c=ye(r);typeof c=="number"&&!Number.isNaN(c)&&(n=String(c))}n&&t.set("Content-Length",n),r.referrerPolicy===""&&(r.referrerPolicy=Pe),r.referrer&&r.referrer!=="no-referrer"?r[u].referrer=Ue(r):r[u].referrer="no-referrer",r[u].referrer instanceof URL&&t.set("Referer",r.referrer),t.has("User-Agent")||t.set("User-Agent","node-fetch"),r.compress&&!t.has("Accept-Encoding")&&t.set("Accept-Encoding","gzip, deflate, br");let{agent:o}=r;typeof o=="function"&&(o=o(e));let s=Te(e),i={path:e.pathname+s,method:r.method,headers:t[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:r.insecureHTTPParser,agent:o};return{parsedURL:e,options:i}}});var Q,Ce=y(()=>{M();Q=class extends U{constructor(e,t="aborted"){super(e,t)}}});import er from"node:http";import rr from"node:https";import O from"node:zlib";import $e,{PassThrough as Fe,pipeline as H}from"node:stream";import{Buffer as X}from"node:buffer";async function ke(r,e){return new Promise((t,n)=>{let o=new C(r,e),{parsedURL:s,options:i}=Be(o);if(!tr.has(s.protocol))throw new TypeError(`node-fetch cannot load ${r}. URL scheme "${s.protocol.replace(/:$/,"")}" is not supported.`);if(s.protocol==="data:"){let f=ce(o.url),P=new S(f,{headers:{"Content-Type":f.typeFull}});t(P);return}let c=(s.protocol==="https:"?rr:er).request,{signal:l}=o,a=null,R=()=>{let f=new Q("The operation was aborted.");n(f),o.body&&o.body instanceof $e.Readable&&o.body.destroy(f),!(!a||!a.body)&&a.body.emit("error",f)};if(l&&l.aborted){R();return}let D=()=>{R(),A()},B=c(s.toString(),i);l&&l.addEventListener("abort",D);let A=()=>{B.abort(),l&&l.removeEventListener("abort",D)};B.on("error",f=>{n(new p(`request to ${o.url} failed, reason: ${f.message}`,"system",f)),A()}),or(B,f=>{a&&a.body&&a.body.destroy(f)}),process.version<"v14"&&B.on("socket",f=>{let P;f.prependListener("end",()=>{P=f._eventsCount}),f.prependListener("close",h=>{if(a&&P<f._eventsCount&&!h){let L=new Error("Premature close");L.code="ERR_STREAM_PREMATURE_CLOSE",a.body.emit("error",L)}})}),B.on("response",f=>{B.setTimeout(0);let P=be(f.rawHeaders);if(Z(f.statusCode)){let d=P.get("Location"),x=null;try{x=d===null?null:new URL(d,o.url)}catch{if(o.redirect!=="manual"){n(new p(`uri requested responds with an invalid redirect URL: ${d}`,"invalid-redirect")),A();return}}switch(o.redirect){case"error":n(new p(`uri requested responds with a redirect, redirect mode is set to error: ${o.url}`,"no-redirect")),A();return;case"manual":break;case"follow":{if(x===null)break;if(o.counter>=o.follow){n(new p(`maximum redirect reached at: ${o.url}`,"max-redirect")),A();return}let w={headers:new g(o.headers),follow:o.follow,counter:o.counter+1,agent:o.agent,compress:o.compress,method:o.method,body:F(o),signal:o.signal,size:o.size,referrer:o.referrer,referrerPolicy:o.referrerPolicy};if(!he(o.url,x)||!de(o.url,x))for(let He of["authorization","www-authenticate","cookie","cookie2"])w.headers.delete(He);if(f.statusCode!==303&&o.body&&e.body instanceof $e.Readable){n(new p("Cannot follow redirect with body being a readable stream","unsupported-redirect")),A();return}(f.statusCode===303||(f.statusCode===301||f.statusCode===302)&&o.method==="POST")&&(w.method="GET",w.body=void 0,w.headers.delete("content-length"));let ie=ve(P);ie&&(w.referrerPolicy=ie),t(ke(new C(x,w))),A();return}default:return n(new TypeError(`Redirect option '${o.redirect}' is not a valid value of RequestRedirect`))}}l&&f.once("end",()=>{l.removeEventListener("abort",D)});let h=H(f,new Fe,d=>{d&&n(d)});process.version<"v12.10"&&f.on("aborted",D);let L={url:o.url,status:f.statusCode,statusText:f.statusMessage,headers:P,size:o.size,counter:o.counter,highWaterMark:o.highWaterMark},$=P.get("Content-Encoding");if(!o.compress||o.method==="HEAD"||$===null||f.statusCode===204||f.statusCode===304){a=new S(h,L),t(a);return}let Oe={flush:O.Z_SYNC_FLUSH,finishFlush:O.Z_SYNC_FLUSH};if($==="gzip"||$==="x-gzip"){h=H(h,O.createGunzip(Oe),d=>{d&&n(d)}),a=new S(h,L),t(a);return}if($==="deflate"||$==="x-deflate"){let d=H(f,new Fe,x=>{x&&n(x)});d.once("data",x=>{(x[0]&15)===8?h=H(h,O.createInflate(),w=>{w&&n(w)}):h=H(h,O.createInflateRaw(),w=>{w&&n(w)}),a=new S(h,L),t(a)}),d.once("end",()=>{a||(a=new S(h,L),t(a))});return}if($==="br"){h=H(h,O.createBrotliDecompress(),d=>{d&&n(d)}),a=new S(h,L),t(a);return}a=new S(h,L),t(a)}),ge(B,o).catch(n)})}function or(r,e){let t=X.from(`0\r
|
|
5
|
+
\r
|
|
6
|
+
`),n=!1,o=!1,s;r.on("response",i=>{let{headers:c}=i;n=c["transfer-encoding"]==="chunked"&&!c["content-length"]}),r.on("socket",i=>{let c=()=>{if(n&&!o){let a=new Error("Premature close");a.code="ERR_STREAM_PREMATURE_CLOSE",e(a)}},l=a=>{o=X.compare(a.slice(-5),t)===0,!o&&s&&(o=X.compare(s.slice(-3),t.slice(0,3))===0&&X.compare(a.slice(-2),t.slice(3))===0),s=a};i.prependListener("close",c),i.on("data",l),r.on("close",()=>{i.removeListener("close",c),i.removeListener("data",l)})})}var tr,nr=y(()=>{le();K();Se();_();Ae();q();Ce();ne();fe();V();se();Ve();tr=new Set(["data:","http:","https:"])});nr();export{Q as AbortError,j as Blob,p as FetchError,ze as File,I as FormData,g as Headers,C as Request,S as Response,De as blobFrom,Ne as blobFromSync,ke as default,Me as fileFrom,We as fileFromSync,Z as isRedirect};
|
|
@@ -0,0 +1,43 @@
|
|
|
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 Ln,$a as No,A as un,Aa as ao,B as ln,Ba as co,Bb as Zo,C as dn,Ca as uo,D as fn,Da as lo,E as pn,Ea as fo,F as mn,Fa as po,G as hn,H as yn,Ha as xt,I as Sn,Ia as mo,J as wn,Ja as ho,K as En,Ka as yo,L as gn,La as So,M as vn,Ma as wo,N as bn,Na as Eo,O as _n,Oa as go,P as Tn,Pa as vo,Q as Rn,Qa as bo,R as An,Ra as _o,S as Pn,Sa as To,T as On,Ta as Ro,U as xn,Ua as Ao,V as In,Va as Po,W as Cn,Wa as Oo,X as Dn,Xa as xo,Y as Nn,Ya as Io,Z as Un,Za as Co,_ as Mn,_a as Do,aa as kn,ab as It,ba as Kn,bb as Uo,bc as ns,ca as Hn,cb as Mo,d as jr,da as Wn,db as Lo,ea as jn,eb as ko,fa as Bn,fb as Ko,fc as os,g as Br,ga as Fn,gb as Ho,gc as ss,h as Fr,ha as Jn,hb as Wo,hc as is,i as Jr,ia as $n,ib as jo,ic as as,j as $r,ja as Gn,jb as Bo,k as Gr,kb as Fo,l as zr,la as zn,lb as Jo,m as Vr,ma as Vn,mb as $o,n as Yr,na as Yn,nb as Go,nc as cs,o as Xr,oa as Xn,ob as zo,oc as us,p as qr,pa as qn,pc as ls,q as Qr,qa as Qn,qc as ds,r as Zr,ra as Zn,rc as fs,s as en,sa as eo,t as tn,ta as to,u as rn,ua as ro,v as nn,va as ut,vc as ps,w as on,wa as no,x as sn,xa as oo,xc as ms,y as an,ya as so,z as cn,za as io}from"./chunk-NKDMKRSB.js";import"./chunk-4U7XXM4W.js";import{a as Ct}from"./chunk-TCAEECDI.js";import{e as it,f as at}from"./chunk-LMDWRRX4.js";import{a as es,b as ts,c as rs}from"./chunk-Y6ZEVVL5.js";import{a as ie,b as ct}from"./chunk-OZGBWAT2.js";import"./chunk-4LLH5OWM.js";import"./chunk-ZFPMIQA3.js";import"./chunk-YAEVYJAR.js";import"./chunk-D3NXKK2L.js";import{a as Yo,c as Xo,d as qo}from"./chunk-REBNWCKI.js";import"./chunk-YHIWOGVL.js";import{b as hs}from"./chunk-QEOFEETJ.js";import"./chunk-DGMNI4AO.js";import{a as Fe,d as ne,e as Vo}from"./chunk-SUFW24P4.js";import"./chunk-LCKVYFMD.js";import"./chunk-5M4PFLRW.js";import"./chunk-52T37Y47.js";import{f as Hr,k as Wr}from"./chunk-3YHOCPQU.js";import{d as kr}from"./chunk-MEPASGPP.js";import"./chunk-STUHNKQS.js";import{a as Qo}from"./chunk-PFMEUFJ7.js";import"./chunk-KRXTI4JO.js";import{J as Ae}from"./chunk-DPQPXBTP.js";import"./chunk-Q4UGYGU5.js";import"./chunk-W5LGYSPZ.js";import{e as Kr}from"./chunk-E7ZMYIY6.js";import{e as D}from"./chunk-NAA7GF6Q.js";import"./chunk-QWAQHHRS.js";import{m as st,u as Mr,w as Lr}from"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";import*as oe from"node:path";import*as Ma from"node:fs";import{fileURLToPath as Df}from"node:url";function ys(e){let r=(Array.isArray(e)?e[0]:e)?.trim().toLowerCase();return Hr.includes(r??"")?r:null}function lt(e,...t){let r=Object.assign(Q(),e);for(let n of t)for(let o in n){if(o in r&&r[o]!==n[o])throw new Error(`Duplicate key ${o}`);r[o]=n[o]}return r}function F(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function dt(e){return typeof e=="function"}function Q(){return Object.create(null)}var La=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Je(e){return La&&F(e)&&Symbol.asyncIterator in e}var ae=e=>e();function Ss(e){return e}function ws(e){if(typeof AbortSignal.any=="function")return AbortSignal.any(e);let t=new AbortController;for(let n of e){if(n.aborted){r();break}n.addEventListener("abort",r,{once:!0})}return t.signal;function r(){t.abort();for(let n of e)n.removeEventListener("abort",r)}}var Pe={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,PAYMENT_REQUIRED:-32002,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,PRECONDITION_REQUIRED:-32028,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099},Es={[-32700]:"PARSE_ERROR",[-32600]:"BAD_REQUEST",[-32603]:"INTERNAL_SERVER_ERROR",[-32001]:"UNAUTHORIZED",[-32002]:"PAYMENT_REQUIRED",[-32003]:"FORBIDDEN",[-32004]:"NOT_FOUND",[-32005]:"METHOD_NOT_SUPPORTED",[-32008]:"TIMEOUT",[-32009]:"CONFLICT",[-32012]:"PRECONDITION_FAILED",[-32013]:"PAYLOAD_TOO_LARGE",[-32015]:"UNSUPPORTED_MEDIA_TYPE",[-32022]:"UNPROCESSABLE_CONTENT",[-32028]:"PRECONDITION_REQUIRED",[-32029]:"TOO_MANY_REQUESTS",[-32099]:"CLIENT_CLOSED_REQUEST"},Ff=[Pe.BAD_GATEWAY,Pe.SERVICE_UNAVAILABLE,Pe.GATEWAY_TIMEOUT,Pe.INTERNAL_SERVER_ERROR];var ka=Object.create,bs=Object.defineProperty,Ka=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyNames,Ha=Object.getPrototypeOf,Wa=Object.prototype.hasOwnProperty,Y=(e,t)=>function(){return t||(0,e[_s(e)[0]])((t={exports:{}}).exports,t),t.exports},ja=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=_s(t),s=0,i=o.length,a;s<i;s++)a=o[s],!Wa.call(e,a)&&a!==r&&bs(e,a,{get:(c=>t[c]).bind(null,a),enumerable:!(n=Ka(t,a))||n.enumerable});return e},A=(e,t,r)=>(r=e!=null?ka(Ha(e)):{},ja(t||!e||!e.__esModule?bs(r,"default",{value:e,enumerable:!0}):r,e)),Ba=()=>{},gs=e=>{Object.freeze&&Object.freeze(e)};function Ts(e,t,r){var n;let o=t.join(".");return(n=r[o])!==null&&n!==void 0||(r[o]=new Proxy(Ba,{get(s,i){if(!(typeof i!="string"||i==="then"))return Ts(e,[...t,i],r)},apply(s,i,a){let c=t[t.length-1];if(c==="valueOf"||c==="toString"||c==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:a,path:t};return c==="call"?u={args:a.length>=2?[a[1]]:[],path:t.slice(0,-1)}:c==="apply"&&(u={args:a.length>=2?a[1]:[],path:t.slice(0,-1)}),gs(u.args),gs(u.path),e(u)}})),r[o]}var Rs=e=>Ts(e,[],Q());var Fa={PARSE_ERROR:400,BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_SUPPORTED:405,TIMEOUT:408,CONFLICT:409,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNSUPPORTED_MEDIA_TYPE:415,UNPROCESSABLE_CONTENT:422,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504};function As(e){var t;return(t=Fa[e])!==null&&t!==void 0?t:500}function Ps(e){let t=Array.isArray(e)?e:[e],r=new Set(t.map(o=>{if("error"in o&&F(o.error.data)){var s;if(typeof((s=o.error.data)===null||s===void 0?void 0:s.httpStatus)=="number")return o.error.data.httpStatus;let i=Es[o.error.code];return As(i)}return 200}));return r.size!==1?207:r.values().next().value}function Ja(e){return As(e.code)}var Os=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(e,t){function r(n){"@babel/helpers - typeof";return t.exports=r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t.exports.__esModule=!0,t.exports.default=t.exports,r(n)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),$a=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(e,t){var r=Os().default;function n(o,s){if(r(o)!="object"||!o)return o;var i=o[Symbol.toPrimitive];if(i!==void 0){var a=i.call(o,s||"default");if(r(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(o)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ga=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(e,t){var r=Os().default,n=$a();function o(s){var i=n(s,"string");return r(i)=="symbol"?i:i+""}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),we=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(e,t){var r=Ga();function n(o,s,i){return(s=r(s))in o?Object.defineProperty(o,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):o[s]=i,o}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),X=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(e,t){var r=we();function n(s,i){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(s);i&&(c=c.filter(function(u){return Object.getOwnPropertyDescriptor(s,u).enumerable})),a.push.apply(a,c)}return a}function o(s){for(var i=1;i<arguments.length;i++){var a=arguments[i]!=null?arguments[i]:{};i%2?n(Object(a),!0).forEach(function(c){r(s,c,a[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach(function(c){Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c))})}return s}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports}}),vs=A(X(),1);function ce(e){let{path:t,error:r,config:n}=e,{code:o}=e.error,s={message:r.message,code:Pe[o],data:{code:o,httpStatus:Ja(r)}};return n.isDev&&typeof e.error.stack=="string"&&(s.data.stack=e.error.stack),typeof t=="string"&&(s.data.path=t),n.errorFormatter((0,vs.default)((0,vs.default)({},e),{},{shape:s}))}var xe=({shape:e})=>e,xs=A(we(),1),za=class extends Error{constructor(e){super(Va(e)),Object.assign(this,e)}};function Va(e){if("message"in e)return String(e.message)}function Ya(e){if(e instanceof Error)return e;let t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if(F(e))return new za(e)}}function $(e){if(e instanceof P||e instanceof Error&&e.name==="TRPCError")return e;let t=new P({code:"INTERNAL_SERVER_ERROR",cause:e});return e instanceof Error&&e.stack&&(t.stack=e.stack),t}var P=class extends Error{constructor(e){var t,r,n;let o=Ya(e.cause),s=(t=(r=e.message)!==null&&r!==void 0?r:o?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:o}),(0,xs.default)(this,"cause",void 0),(0,xs.default)(this,"code",void 0),this.code=e.code,this.name="TRPCError",(n=this.cause)!==null&&n!==void 0||(this.cause=o)}},Oe=A(X(),1);function Cs(e){return"input"in e?e:{input:e,output:e}}var Ie={input:{serialize:e=>e,deserialize:e=>e},output:{serialize:e=>e,deserialize:e=>e}};function Is(e,t){return"error"in t?(0,Oe.default)((0,Oe.default)({},t),{},{error:e.transformer.output.serialize(t.error)}):"data"in t.result?(0,Oe.default)((0,Oe.default)({},t),{},{result:(0,Oe.default)((0,Oe.default)({},t.result),{},{data:e.transformer.output.serialize(t.result.data)})}):t}function Ee(e,t){return Array.isArray(t)?t.map(r=>Is(e,r)):Is(e,t)}var ft=A(X(),1),Xa="lazyMarker";function qa(e){let t=Symbol(),r=t;return()=>(r===t&&(r=e()),r)}function Qa(e){return typeof e=="function"&&Xa in e}function Za(e){return F(e)&&F(e._def)&&"router"in e._def}var ec={_ctx:null,_errorShape:null,_meta:null,queries:{},mutations:{},subscriptions:{},errorFormatter:xe,transformer:Ie},tc=["then","call","apply"];function Dt(e){function t(r){let n=new Set(Object.keys(r).filter(p=>tc.includes(p)));if(n.size>0)throw new Error("Reserved words used in `router({})` call: "+Array.from(n).join(", "));let o=Q(),s=Q();function i(p){return{ref:p.ref,load:qa(async()=>{let h=await p.ref(),m=[...p.path,p.key],f=m.join(".");p.aggregate[p.key]=a(h._def.record,m),delete s[f];for(let[l,y]of Object.entries(h._def.lazy)){let _=[...m,l].join(".");s[_]=i({ref:y.ref,path:m,key:l,aggregate:p.aggregate[p.key]})}})}}function a(p,h=[]){let m=Q();for(let[f,l]of Object.entries(p??{})){if(Qa(l)){s[[...h,f].join(".")]=i({path:h,ref:l,key:f,aggregate:m});continue}if(Za(l)){m[f]=a(l._def.record,[...h,f]);continue}if(!rc(l)){m[f]=a(l,[...h,f]);continue}let y=[...h,f].join(".");if(o[y])throw new Error(`Duplicate key: ${y}`);o[y]=l,m[f]=l}return m}let c=a(r),u=(0,ft.default)((0,ft.default)({_config:e,router:!0,procedures:o,lazy:s},ec),{},{record:c});return(0,ft.default)((0,ft.default)({},c),{},{_def:u,createCaller:Nt()({_def:u})})}return t}function rc(e){return typeof e=="function"}async function $e(e,t){let{_def:r}=e,n=r.procedures[t];for(;!n;){let o=Object.keys(r.lazy).find(i=>t.startsWith(i));if(!o)return null;await r.lazy[o].load(),n=r.procedures[t]}return n}function Nt(){return function(t){let{_def:r}=t;return function(o,s){return Rs(async i=>{let{path:a,args:c}=i,u=a.join(".");if(a.length===1&&a[0]==="_def")return r;let d=await $e(t,u),p;try{if(!d)throw new P({code:"NOT_FOUND",message:`No procedure found on path "${a}"`});return p=dt(o)?await Promise.resolve(o()):o,await d({path:u,getRawInput:async()=>c[0],ctx:p,type:d._def.type,signal:s?.signal,batchIndex:0})}catch(f){var h,m;throw s==null||(h=s.onError)===null||h===void 0||h.call(s,{ctx:p,error:$(f),input:c[0],path:u,type:(m=d?._def.type)!==null&&m!==void 0?m:"unknown"}),f}})}}}function Ds(...e){var t,r;let n=lt({},...e.map(a=>a._def.record)),o=e.reduce((a,c)=>{if(c._def._config.errorFormatter&&c._def._config.errorFormatter!==xe){if(a!==xe&&a!==c._def._config.errorFormatter)throw new Error("You seem to have several error formatters");return c._def._config.errorFormatter}return a},xe),s=e.reduce((a,c)=>{if(c._def._config.transformer&&c._def._config.transformer!==Ie){if(a!==Ie&&a!==c._def._config.transformer)throw new Error("You seem to have several transformers");return c._def._config.transformer}return a},Ie);return Dt({errorFormatter:o,transformer:s,isDev:e.every(a=>a._def._config.isDev),allowOutsideOfServer:e.every(a=>a._def._config.allowOutsideOfServer),isServer:e.every(a=>a._def._config.isServer),$types:(t=e[0])===null||t===void 0?void 0:t._def._config.$types,sse:(r=e[0])===null||r===void 0?void 0:r._def._config.sse})(n)}var nc=Symbol();function Ut(e){return Array.isArray(e)&&e[2]===nc}var pt=A(X(),1),Ls="middlewareMarker";function oc(){function e(r){return{_middlewares:r,unstable_pipe(n){let o="_middlewares"in n?n._middlewares:[n];return e([...r,...o])}}}function t(r){return e([r])}return t}function sc(e){let t=async function(n){let o,s=await n.getRawInput();try{o=await e(s)}catch(a){throw new P({code:"BAD_REQUEST",cause:a})}let i=F(n.input)&&F(o)?(0,pt.default)((0,pt.default)({},n.input),o):o;return n.next({input:i})};return t._type="input",t}function ic(e){let t=async function({next:n}){let o=await n();if(!o.ok)return o;try{let s=await e(o.data);return(0,pt.default)((0,pt.default)({},o),{},{data:s})}catch(s){throw new P({message:"Output validation failed",code:"INTERNAL_SERVER_ERROR",cause:s})}};return t._type="output",t}var ac=A(we(),1),ks=class extends Error{constructor(e){var t;super((t=e[0])===null||t===void 0?void 0:t.message),(0,ac.default)(this,"issues",void 0),this.name="SchemaError",this.issues=e}};function Ns(e){let t=e,r="~standard"in t;if(typeof t=="function"&&typeof t.assert=="function")return t.assert.bind(t);if(typeof t=="function"&&!r)return t;if(typeof t.parseAsync=="function")return t.parseAsync.bind(t);if(typeof t.parse=="function")return t.parse.bind(t);if(typeof t.validateSync=="function")return t.validateSync.bind(t);if(typeof t.create=="function")return t.create.bind(t);if(typeof t.assert=="function")return n=>(t.assert(n),n);if(r)return async n=>{let o=await t["~standard"].validate(n);if(o.issues)throw new ks(o.issues);return o.value};throw new Error("Could not find a validator fn")}var cc=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(e,t){function r(n,o){if(n==null)return{};var s={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(o.includes(i))continue;s[i]=n[i]}return s}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),uc=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(e,t){var r=cc();function n(o,s){if(o==null)return{};var i,a,c=r(o,s);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(o);for(a=0;a<u.length;a++)i=u[a],s.includes(i)||{}.propertyIsEnumerable.call(o,i)&&(c[i]=o[i])}return c}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),lc=A(uc(),1),W=A(X(),1),dc=["middlewares","inputs","meta"];function pe(e,t){let{middlewares:r=[],inputs:n,meta:o}=t,s=(0,lc.default)(t,dc);return Ks((0,W.default)((0,W.default)({},lt(e,s)),{},{inputs:[...e.inputs,...n??[]],middlewares:[...e.middlewares,...r],meta:e.meta&&o?(0,W.default)((0,W.default)({},e.meta),o):o??e.meta}))}function Ks(e={}){let t=(0,W.default)({procedure:!0,inputs:[],middlewares:[]},e);return{_def:t,input(n){let o=Ns(n);return pe(t,{inputs:[n],middlewares:[sc(o)]})},output(n){let o=Ns(n);return pe(t,{output:n,middlewares:[ic(o)]})},meta(n){return pe(t,{meta:n})},use(n){let o="_middlewares"in n?n._middlewares:[n];return pe(t,{middlewares:o})},unstable_concat(n){return pe(t,n._def)},concat(n){return pe(t,n._def)},query(n){return Mt((0,W.default)((0,W.default)({},t),{},{type:"query"}),n)},mutation(n){return Mt((0,W.default)((0,W.default)({},t),{},{type:"mutation"}),n)},subscription(n){return Mt((0,W.default)((0,W.default)({},t),{},{type:"subscription"}),n)},experimental_caller(n){return pe(t,{caller:n})}}}function Mt(e,t){let r=pe(e,{resolver:t,middlewares:[async function(c){let u=await t(c);return{marker:Ls,ok:!0,data:u,ctx:c.ctx}}]}),n=(0,W.default)((0,W.default)({},r._def),{},{type:e.type,experimental_caller:!!r._def.caller,meta:r._def.meta,$types:null}),o=pc(r._def),s=r._def.caller;if(!s)return o;let i=async(...a)=>await s({args:a,invoke:o,_def:n});return i._def=n,i}var fc=`
|
|
5
|
+
This is a client-only function.
|
|
6
|
+
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
7
|
+
`.trim();async function Hs(e,t,r){try{let n=t.middlewares[e];return await n((0,W.default)((0,W.default)({},r),{},{meta:t.meta,input:r.input,next(s){var i;let a=s;return Hs(e+1,t,(0,W.default)((0,W.default)({},r),{},{ctx:a?.ctx?(0,W.default)((0,W.default)({},r.ctx),a.ctx):r.ctx,input:a&&"input"in a?a.input:r.input,getRawInput:(i=a?.getRawInput)!==null&&i!==void 0?i:r.getRawInput}))}}))}catch(n){return{ok:!1,error:$(n),marker:Ls}}}function pc(e){async function t(r){if(!r||!("getRawInput"in r))throw new Error(fc);let n=await Hs(0,e,r);if(!n)throw new P({code:"INTERNAL_SERVER_ERROR",message:"No result from middlewares - did you forget to `return next()`?"});if(!n.ok)throw n.error;return n.data}return t._def=e,t.procedure=!0,t.meta=e.meta,t}var Ce,De,Ne,Us=typeof window>"u"||"Deno"in window||((Ce=globalThis.process)===null||Ce===void 0||(Ce=Ce.env)===null||Ce===void 0?void 0:Ce.NODE_ENV)==="test"||!!(!((De=globalThis.process)===null||De===void 0||(De=De.env)===null||De===void 0)&&De.JEST_WORKER_ID)||!!(!((Ne=globalThis.process)===null||Ne===void 0||(Ne=Ne.env)===null||Ne===void 0)&&Ne.VITEST_WORKER_ID),Ms=A(X(),1),mc=class Lt{context(){return new Lt}meta(){return new Lt}create(t){var r,n,o,s,i,a;let c=(0,Ms.default)((0,Ms.default)({},t),{},{transformer:Cs((r=t?.transformer)!==null&&r!==void 0?r:Ie),isDev:(n=t?.isDev)!==null&&n!==void 0?n:((o=globalThis.process)===null||o===void 0?void 0:o.env.NODE_ENV)!=="production",allowOutsideOfServer:(s=t?.allowOutsideOfServer)!==null&&s!==void 0?s:!1,errorFormatter:(i=t?.errorFormatter)!==null&&i!==void 0?i:xe,isServer:(a=t?.isServer)!==null&&a!==void 0?a:Us,$types:null});{var u;if(!((u=t?.isServer)!==null&&u!==void 0?u:Us)&&t?.allowOutsideOfServer!==!0)throw new Error("You're trying to use @trpc/server in a non-server environment. This is not supported by default.")}return{_config:c,procedure:Ks({meta:t?.defaultMeta}),middleware:oc(),router:Dt(c),mergeRouters:Ds,createCallerFactory:Nt()}}},kt=new mc;var hc={ping:{enabled:!0,intervalMs:15e3},client:{reconnectAfterInactivityMs:45e3}},Kt=kt.context().create({sse:hc,errorFormatter({shape:e,path:t}){return t!=="config.setPlatform"?e:{...e,message:Kr("ui.platform.requestFailed"),data:{...e.data,stack:void 0}}}}),C=Kt.router,mt=Kt.procedure,pp=Kt.createCallerFactory;var yc=Ae.object({events:Ae.array(Ae.string()),projectId:Ae.string().nullish(),sessionId:Ae.string().nullish()}),Sc={"not-found":"NOT_FOUND","invalid-args":"BAD_REQUEST","invalid-name":"BAD_REQUEST","invalid-notes-file":"BAD_REQUEST","already-terminal":"CONFLICT","already-exists":"CONFLICT",conflict:"CONFLICT","backend-locked":"CONFLICT","session-running":"CONFLICT","not-available":"BAD_REQUEST",not_manageable:"BAD_REQUEST",runtime_unavailable:"BAD_REQUEST",logout_failed:"INTERNAL_SERVER_ERROR",internal:"INTERNAL_SERVER_ERROR"};function wc(e){return new P({code:Sc[e.code]??"INTERNAL_SERVER_ERROR",message:e.message,cause:e})}function Ws(e){if(e.ok)return e.data;throw wc(e)}function b(e,t,r){return mt.input(r).query(async({input:n})=>Ws(await e.query(t,n)))}function S(e,t,r){return mt.input(r).mutation(async({input:n,ctx:o})=>Ws(await e.mutate(t,n,{client:o.client??null})))}function Ec(e){return C({list:b(e,"projects.list",un),create:S(e,"projects.create",Hn)})}function gc(e){return C({list:b(e,"sessions.list",Jr),transcript:b(e,"sessions.transcript",$r),subagentTranscript:b(e,"sessions.subagentTranscript",Gr),debugDetails:b(e,"sessions.debugDetails",zr),pendingInteraction:b(e,"sessions.pendingInteraction",Vr),create:S(e,"sessions.create",Wn),send:S(e,"sessions.send",jn),cancel:S(e,"sessions.cancel",Bn),compact:S(e,"sessions.compact",Fn),setAgent:S(e,"sessions.setAgent",Gn),setSelection:S(e,"sessions.setSelection",zn),createAndSend:S(e,"sessions.createAndSend",eo),setStarred:S(e,"sessions.setStarred",Br),rename:S(e,"sessions.rename",Fr),markRead:S(e,"sessions.markRead",Jn),markManyRead:S(e,"sessions.markManyRead",$n),answerQuestion:S(e,"sessions.answerQuestion",Vn),respondPlan:S(e,"sessions.respondPlan",Yn),respondDecision:S(e,"sessions.respondDecision",Xn),cancelResume:S(e,"sessions.cancelResume",Qn),rewind:S(e,"sessions.rewind",Zn),resolveMedia:S(e,"sessions.resolveMedia",qn)})}function vc(e){return C({list:b(e,"schedules.list",Yr),pause:S(e,"schedules.pause",ut),resume:S(e,"schedules.resume",ut),remove:S(e,"schedules.remove",ut),add:S(e,"schedules.add",no),update:S(e,"schedules.update",oo)})}function bc(e){return C({list:b(e,"boards.list",Xr),get:b(e,"boards.get",qr),decisions:b(e,"boards.decisions",Qr),style:b(e,"boards.style",Zr)})}function _c(e){return C({list:b(e,"waitpoints.list",en),cancel:S(e,"waitpoints.cancel",to)})}function Tc(e){return C({list:b(e,"executions.list",tn),get:b(e,"executions.get",rn),cancel:S(e,"executions.cancel",ro)})}function Rc(e){return C({tree:b(e,"memory.tree",nn),file:b(e,"memory.file",on)})}function Ac(e){return C({list:b(e,"approvals.list",sn),approve:S(e,"approvals.approve",No),reject:S(e,"approvals.reject",Ho),request:S(e,"approvals.request",zo)})}function Pc(e){return C({list:b(e,"issues.list",an),handle:S(e,"issues.handle",It),delete:S(e,"issues.delete",It)})}function Oc(e){return C({list:b(e,"notes.list",cn),add:S(e,"notes.add",Uo),update:S(e,"notes.update",Mo),setCompleted:S(e,"notes.setCompleted",Lo),delete:S(e,"notes.delete",ko),clearCompleted:S(e,"notes.clearCompleted",Ko)})}function xc(e){return C({list:b(e,"hooks.list",ao),create:S(e,"hooks.create",co),update:S(e,"hooks.update",uo),setEnabled:S(e,"hooks.setEnabled",lo),remove:S(e,"hooks.remove",fo),test:S(e,"hooks.test",po)})}function Ic(e){return C({catalog:b(e,"models.catalog",En),favorites:C({add:S(e,"models.favorites.add",xt),remove:S(e,"models.favorites.remove",xt)}),setDefault:S(e,"models.setDefault",ho),setThinking:S(e,"models.setThinking",mo)})}function Cc(e){return C({status:b(e,"auth.status",fn),flowState:b(e,"auth.flowState",pn),startLogin:S(e,"auth.startLogin",Dn),respondPrompt:S(e,"auth.respondPrompt",Nn),cancelFlow:S(e,"auth.cancelFlow",Un),logout:S(e,"auth.logout",Ln),syncGateway:S(e,"auth.syncGateway",Mn),customProviders:b(e,"auth.customProviders",mn),upsertCustomProvider:S(e,"auth.upsertCustomProvider",kn),removeCustomProvider:S(e,"auth.removeCustomProvider",Kn)})}function Dc(e){return C({get:b(e,"usageSharing.get",hn),set:S(e,"usageSharing.set",yn)})}function Nc(e){return C({info:b(e,"telemetry.info",Sn),report:S(e,"telemetry.report",wn)})}function Uc(e){return C({daemonStatus:b(e,"system.daemonStatus",An),rateLimitStatus:b(e,"system.rateLimitStatus",Pn),usageStatus:b(e,"system.usageStatus",On),notices:b(e,"system.notices",xn),restart:S(e,"system.restart",Wo),clearRateLimit:S(e,"system.clearRateLimit",jo),refreshUsage:S(e,"system.refreshUsage",Bo),redeemUsageReset:S(e,"system.redeemUsageReset",Fo),updateStatus:b(e,"system.updateStatus",In),checkUpdate:S(e,"system.checkUpdate",Jo),applyUpdate:S(e,"system.applyUpdate",$o),skipUpdate:S(e,"system.skipUpdate",Go),version:b(e,"system.version",Cn)})}function Mc(e){return C({summary:b(e,"cost.summary",ln)})}function Lc(e){return C({get:b(e,"config.get",dn),set:S(e,"config.set",so),setPlatform:S(e,"config.setPlatform",jr),setProviderRateLimitPolicy:S(e,"config.setProviderRateLimitPolicy",io)})}function kc(e){return C({list:b(e,"machines.list",gn),detail:b(e,"machines.detail",vn)})}function Kc(e){return C({list:b(e,"skills.list",bn),session:b(e,"skills.session",_n)})}function Hc(e){return C({list:b(e,"plugins.list",Tn),assign:S(e,"plugins.assign",yo),skillFile:b(e,"plugins.skillFile",So),skillWrite:S(e,"plugins.skillWrite",wo),skillCreate:S(e,"plugins.skillCreate",Eo),skillMove:S(e,"plugins.skillMove",go),skillRemove:S(e,"plugins.skillRemove",vo),skillRevert:S(e,"plugins.skillRevert",bo),create:S(e,"plugins.create",_o),remove:S(e,"plugins.remove",To),convertToPortable:S(e,"plugins.convertToPortable",Ro),mcpRead:b(e,"plugins.mcpRead",Ao),mcpWrite:S(e,"plugins.mcpWrite",Po)})}function Wc(e){return C({list:b(e,"environments.list",Rn),get:b(e,"environments.get",Oo),validate:S(e,"environments.validate",xo),save:S(e,"environments.save",Io),delete:S(e,"environments.delete",Co),savePrompt:S(e,"environments.savePrompt",Do)})}function jc(e){return mt.input(yc).subscription(async function*({input:t,signal:r}){let n=e.subscribe(t);r?.addEventListener("abort",()=>n.close());try{for await(let o of n)yield o}finally{n.close()}})}function js(e){return C({projects:Ec(e),sessions:gc(e),schedules:vc(e),boards:bc(e),executions:Tc(e),waitpoints:_c(e),memory:Rc(e),approvals:Ac(e),issues:Pc(e),notes:Oc(e),cost:Mc(e),config:Lc(e),models:Ic(e),auth:Cc(e),usageSharing:Dc(e),telemetry:Nc(e),hooks:xc(e),machines:kc(e),skills:Kc(e),plugins:Hc(e),environments:Wc(e),system:Uc(e),subscribe:jc(e)})}import*as me from"fs";import*as _e from"path";function ht(e){return typeof e=="object"&&e!==null&&"subscribe"in e}function Bc(e,t){let r=null,n=()=>{r?.unsubscribe(),r=null,t.removeEventListener("abort",n)};return new ReadableStream({start(o){r=e.subscribe({next(s){o.enqueue({ok:!0,value:s})},error(s){o.enqueue({ok:!1,error:s}),o.close()},complete(){o.close()}}),t.aborted?n():t.addEventListener("abort",n,{once:!0})},cancel(){n()}})}function Ht(e,t){let n=Bc(e,t).getReader(),o={async next(){let s=await n.read();if(s.done)return{value:void 0,done:!0};let{value:i}=s;if(!i.ok)throw i.error;return{value:i.value,done:!1}},async return(){return await n.cancel(),{value:void 0,done:!0}}};return{[Symbol.asyncIterator](){return o}}}function Fc(e){try{if(e===null)return null;if(!F(e))throw new Error("Expected object");let t=Object.entries(e).filter(([r,n])=>typeof n!="string");if(t.length>0)throw new Error(`Expected connectionParams to be string values. Got ${t.map(([r,n])=>`${r}: ${typeof n}`).join(", ")}`);return e}catch(t){throw new P({code:"PARSE_ERROR",message:"Invalid connection params shape",cause:t})}}function Jc(e){let t;try{t=JSON.parse(e)}catch(r){throw new P({code:"PARSE_ERROR",message:"Not JSON-parsable query params",cause:r})}return Fc(t)}var Bs=A(X(),1);function ni(e){var t,r;return(t=e.get("trpc-accept"))!==null&&t!==void 0?t:!((r=e.get("accept"))===null||r===void 0)&&r.split(",").some(n=>n.trim()==="application/jsonl")?"application/jsonl":null}function Gt(e){let t=null,r=Symbol.for("@trpc/server/http/memo"),n=r;return{read:async()=>{var o;return n!==r||((o=t)!==null&&o!==void 0||(t=e().catch(s=>{throw s instanceof P?s:new P({code:"BAD_REQUEST",message:s instanceof Error?s.message:"Invalid input",cause:s})})),n=await t,t=null),n},result:()=>n!==r?n:void 0}}var oi={isMatch(e){var t;return!!(!((t=e.headers.get("content-type"))===null||t===void 0)&&t.startsWith("application/json"))},async parse(e){var t;let{req:r}=e,n=e.searchParams.get("batch")==="1",o=e.maxBatchSize,s=n?e.path.split(","):[e.path];if(n&&typeof o=="number"&&s.length>o)throw new P({code:"BAD_REQUEST",message:"Batch call exceeds maximum size"});let i=Gt(async()=>{let h;if(r.method==="GET"){let f=e.searchParams.get("input");f&&(h=JSON.parse(f))}else h=await r.json();if(h===void 0)return Q();if(!n){let f=Q();return f[0]=e.router._def._config.transformer.input.deserialize(h),f}if(!F(h))throw new P({code:"BAD_REQUEST",message:'"input" needs to be an object when doing a batch call'});let m=Q();for(let f of s.keys()){let l=h[f];l!==void 0&&(m[f]=e.router._def._config.transformer.input.deserialize(l))}return m}),a=await Promise.all(s.map(async(h,m)=>{let f=await $e(e.router,h);return{batchIndex:m,path:h,procedure:f,getRawInput:async()=>{let y=(await i.read())[m];if(f?._def.type==="subscription"){var _,w;let v=(_=(w=e.headers.get("last-event-id"))!==null&&w!==void 0?w:e.searchParams.get("lastEventId"))!==null&&_!==void 0?_:e.searchParams.get("Last-Event-Id");if(v)if(F(y))y=(0,Bs.default)((0,Bs.default)({},y),{},{lastEventId:v});else{var g;(g=y)!==null&&g!==void 0||(y={lastEventId:v})}}return y},result:()=>{var l;return(l=i.result())===null||l===void 0?void 0:l[m]}}})),c=new Set(a.map(h=>{var m;return(m=h.procedure)===null||m===void 0?void 0:m._def.type}).filter(Boolean));if(c.size>1)throw new P({code:"BAD_REQUEST",message:`Cannot mix procedure types in call: ${Array.from(c).join(", ")}`});let u=(t=c.values().next().value)!==null&&t!==void 0?t:"unknown",d=e.searchParams.get("connectionParams");return{isBatchCall:n,accept:ni(r.headers),calls:a,type:u,connectionParams:d===null?null:Jc(d),signal:r.signal,url:e.url}}},$c={isMatch(e){var t;return!!(!((t=e.headers.get("content-type"))===null||t===void 0)&&t.startsWith("multipart/form-data"))},async parse(e){let{req:t}=e;if(t.method!=="POST")throw new P({code:"METHOD_NOT_SUPPORTED",message:"Only POST requests are supported for multipart/form-data requests"});let r=Gt(async()=>await t.formData()),n=await $e(e.router,e.path);return{accept:null,calls:[{batchIndex:0,path:e.path,getRawInput:r.read,result:r.result,procedure:n}],isBatchCall:!1,type:"mutation",connectionParams:null,signal:t.signal,url:e.url}}},Gc={isMatch(e){var t;return!!(!((t=e.headers.get("content-type"))===null||t===void 0)&&t.startsWith("application/octet-stream"))},async parse(e){let{req:t}=e;if(t.method!=="POST")throw new P({code:"METHOD_NOT_SUPPORTED",message:"Only POST requests are supported for application/octet-stream requests"});let r=Gt(async()=>t.body);return{calls:[{batchIndex:0,path:e.path,getRawInput:r.read,result:r.result,procedure:await $e(e.router,e.path)}],isBatchCall:!1,accept:null,type:"mutation",connectionParams:null,signal:t.signal,url:e.url}}},zc=[oi,$c,Gc];function Vc(e){let t=zc.find(r=>r.isMatch(e));if(t)return t;if(!t&&e.method==="GET")return oi;throw new P({code:"UNSUPPORTED_MEDIA_TYPE",message:e.headers.has("content-type")?`Unsupported content-type "${e.headers.get("content-type")}`:"Missing content-type header"})}async function Yc(e){return await Vc(e.req).parse(e)}function zt(e){return F(e)&&e.name==="AbortError"}function Xc(e="AbortError"){throw new DOMException(e,"AbortError")}function Fs(e){return Object.prototype.toString.call(e)==="[object Object]"}function qc(e){var t,r;return Fs(e)===!1?!1:(t=e.constructor,t===void 0?!0:(r=t.prototype,!(Fs(r)===!1||r.hasOwnProperty("isPrototypeOf")===!1)))}var yt=A(we(),1),si,Wt=new WeakMap,Qc=()=>{};si=Symbol.toStringTag;var Vt=class ge{constructor(t){(0,yt.default)(this,"promise",void 0),(0,yt.default)(this,"subscribers",[]),(0,yt.default)(this,"settlement",null),(0,yt.default)(this,si,"Unpromise"),typeof t=="function"?this.promise=new Promise(t):this.promise=t;let r=this.promise.then(n=>{let{subscribers:o}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:n},o?.forEach(({resolve:s})=>{s(n)})});"catch"in r&&r.catch(n=>{let{subscribers:o}=this;this.subscribers=null,this.settlement={status:"rejected",reason:n},o?.forEach(({reject:s})=>{s(n)})})}subscribe(){let t,r,{settlement:n}=this;if(n===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");let o=eu();this.subscribers=tu(this.subscribers,o),t=o.promise,r=()=>{this.subscribers!==null&&(this.subscribers=nu(this.subscribers,o))}}else{let{status:o}=n;o==="fulfilled"?t=Promise.resolve(n.value):t=Promise.reject(n.reason),r=Qc}return Object.assign(t,{unsubscribe:r})}then(t,r){let n=this.subscribe(),{unsubscribe:o}=n;return Object.assign(n.then(t,r),{unsubscribe:o})}catch(t){let r=this.subscribe(),{unsubscribe:n}=r;return Object.assign(r.catch(t),{unsubscribe:n})}finally(t){let r=this.subscribe(),{unsubscribe:n}=r;return Object.assign(r.finally(t),{unsubscribe:n})}static proxy(t){let r=ge.getSubscribablePromise(t);return typeof r<"u"?r:ge.createSubscribablePromise(t)}static createSubscribablePromise(t){let r=new ge(t);return Wt.set(t,r),Wt.set(r,r),r}static getSubscribablePromise(t){return Wt.get(t)}static resolve(t){let r=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return ge.proxy(r).subscribe()}static async any(t){let n=(Array.isArray(t)?t:[...t]).map(ge.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:o})=>{o()})}}static async race(t){let n=(Array.isArray(t)?t:[...t]).map(ge.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:o})=>{o()})}}static async raceReferences(t){let r=t.map(Zc);try{return await Promise.race(r)}finally{for(let n of r)n.unsubscribe()}}};function Zc(e){return Vt.proxy(e).then(()=>[e])}function eu(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}function tu(e,t){return[...e,t]}function ru(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function nu(e,t){let r=e.indexOf(t);return r!==-1?ru(e,r):e}var Js,$s,Gs,zs;($s=(Js=Symbol).dispose)!==null&&$s!==void 0||(Js.dispose=Symbol());(zs=(Gs=Symbol).asyncDispose)!==null&&zs!==void 0||(Gs.asyncDispose=Symbol());function ou(e,t){let r=e,n=r[Symbol.dispose];return r[Symbol.dispose]=()=>{t(),n?.()},r}function ii(e,t){let r=e,n=r[Symbol.asyncDispose];return r[Symbol.asyncDispose]=async()=>{await t(),await n?.()},r}var Yt=Symbol();function ai(e){let t=null;return ou({start(){if(t)throw new Error("Timer already started");return new Promise(n=>{t=setTimeout(()=>n(Yt),e)})}},()=>{t&&clearTimeout(t)})}var Ye=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function r(){var n=typeof SuppressedError=="function"?SuppressedError:function(a,c){var u=Error();return u.name="SuppressedError",u.error=a,u.suppressed=c,u},o={},s=[];function i(a,c){if(c!=null){if(Object(c)!==c)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(a)var u=c[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(u===void 0&&(u=c[Symbol.dispose||Symbol.for("Symbol.dispose")],a))var d=u;if(typeof u!="function")throw new TypeError("Object is not disposable.");d&&(u=function(){try{d.call(c)}catch(h){return Promise.reject(h)}}),s.push({v:c,d:u,a})}else a&&s.push({d:c,a});return c}return{e:o,u:i.bind(null,!1),a:i.bind(null,!0),d:function(){var c,u=this.e,d=0;function p(){for(;c=s.pop();)try{if(!c.a&&d===1)return d=0,s.push(c),Promise.resolve().then(p);if(c.d){var m=c.d.call(c.v);if(c.a)return d|=2,Promise.resolve(m).then(p,h)}else d|=1}catch(f){return h(f)}if(d===1)return u!==o?Promise.reject(u):Promise.resolve();if(u!==o)throw u}function h(m){return u=u!==o?new n(m,u):m,p()}return p()}}}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Xt=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(e,t){function r(n,o){this.v=n,this.k=o}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Xe=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(e,t){var r=Xt();function n(o){return new r(o,0)}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ue=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(e,t){var r=Xt();function n(s){return function(){return new o(s.apply(this,arguments))}}function o(s){var i,a;function c(d,p){try{var h=s[d](p),m=h.value,f=m instanceof r;Promise.resolve(f?m.v:m).then(function(l){if(f){var y=d==="return"?"return":"next";if(!m.k||l.done)return c(y,l);l=s[y](l).value}u(h.done?"return":"normal",l)},function(l){c("throw",l)})}catch(l){u("throw",l)}}function u(d,p){switch(d){case"return":i.resolve({value:p,done:!0});break;case"throw":i.reject(p);break;default:i.resolve({value:p,done:!1})}(i=i.next)?c(i.key,i.arg):a=null}this._invoke=function(d,p){return new Promise(function(h,m){var f={key:d,arg:p,resolve:h,reject:m,next:null};a?a=a.next=f:(i=a=f,c(d,p))})},typeof s.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(s){return this._invoke("next",s)},o.prototype.throw=function(s){return this._invoke("throw",s)},o.prototype.return=function(s){return this._invoke("return",s)},t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),su=A(Ye(),1),Vs=A(Xe(),1),iu=A(Ue(),1);function qt(e){let t=e[Symbol.asyncIterator]();return t[Symbol.asyncDispose]?t:ii(t,async()=>{var r;await((r=t.return)===null||r===void 0?void 0:r.call(t))})}function au(e,t){return Ft.apply(this,arguments)}function Ft(){return Ft=(0,iu.default)(function*(e,t){try{var r=(0,su.default)();let n=r.a(qt(e)),o,s=r.u(ai(t.gracePeriodMs)),i=t.count,a=new Promise(()=>{});for(;;){if(o=yield(0,Vs.default)(Vt.race([n.next(),a])),o===Yt&&Xc(),o.done)return o.value;yield o.value,--i===0&&(a=s.start()),o=null}}catch(n){r.e=n}finally{yield(0,Vs.default)(r.d())}}),Ft.apply(this,arguments)}function Ys(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}var cu=A(Ye(),1),Xs=A(Xe(),1),uu=A(Ue(),1);function lu(e,t){let r=e[Symbol.asyncIterator](),n="idle";function o(){n="done",t=()=>{}}function s(){if(n!=="idle")return;n="pending",r.next().then(a=>{if(a.done){n="done",t({status:"return",value:a.value}),o();return}n="idle",t({status:"yield",value:a.value})}).catch(a=>{t({status:"error",error:a}),o()})}return{pull:s,destroy:async()=>{var i;o(),await((i=r.return)===null||i===void 0?void 0:i.call(r))}}}function du(){let e="idle",t=Ys(),r=[],n=new Set,o=[];function s(i){if(e!=="pending")return;let a=lu(i,c=>{if(e==="pending"){switch(c.status){case"yield":o.push([a,c]);break;case"return":n.delete(a);break;case"error":o.push([a,c]),n.delete(a);break}t.resolve()}});n.add(a),a.pull()}return{add(i){switch(e){case"idle":r.push(i);break;case"pending":s(i);break;case"done":break}},[Symbol.asyncIterator](){return(0,uu.default)(function*(){try{var i=(0,cu.default)();if(e!=="idle")throw new Error("Cannot iterate twice");e="pending";let a=i.a(ii({},async()=>{e="done";let c=[];if(await Promise.all(Array.from(n.values()).map(async u=>{try{await u.destroy()}catch(d){c.push(d)}})),o.length=0,n.clear(),t.resolve(),c.length>0)throw new AggregateError(c)}));for(;r.length>0;)s(r.shift());for(;n.size>0;){for(yield(0,Xs.default)(t.promise);o.length>0;){let[c,u]=o.shift();switch(u.status){case"yield":yield u.value,c.pull();break;case"error":throw u.error}}t=Ys()}}catch(a){i.e=a}finally{yield(0,Xs.default)(i.d())}})()}}}function ci(e){let t=e[Symbol.asyncIterator]();return new ReadableStream({async cancel(){var r;await((r=t.return)===null||r===void 0?void 0:r.call(t))},async pull(r){let n=await t.next();if(n.done){r.close();return}r.enqueue(n.value)}})}var qs=A(Ye(),1),Qs=A(Xe(),1),fu=A(Ue(),1),Ve=Symbol("ping");function ui(e,t){return Jt.apply(this,arguments)}function Jt(){return Jt=(0,fu.default)(function*(e,t){try{var r=(0,qs.default)();let o=r.a(qt(e)),s,i=o.next();for(;;)try{var n=(0,qs.default)();let a=n.u(ai(t));if(s=yield(0,Qs.default)(Vt.race([i,a.start()])),s===Yt){yield Ve;continue}if(s.done)return s.value;i=o.next(),yield s.value,s=null}catch(a){n.e=a}finally{n.d()}}catch(o){r.e=o}finally{yield(0,Qs.default)(r.d())}}),Jt.apply(this,arguments)}var li=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(e,t){function r(o){var s,i,a,c=2;for(typeof Symbol<"u"&&(i=Symbol.asyncIterator,a=Symbol.iterator);c--;){if(i&&(s=o[i])!=null)return s.call(o);if(a&&(s=o[a])!=null)return new n(s.call(o));i="@@asyncIterator",a="@@iterator"}throw new TypeError("Object is not async iterable")}function n(o){function s(i){if(Object(i)!==i)return Promise.reject(new TypeError(i+" is not an object."));var a=i.done;return Promise.resolve(i.value).then(function(c){return{value:c,done:a}})}return n=function(a){this.s=a,this.n=a.next},n.prototype={s:null,n:null,next:function(){return s(this.n.apply(this.s,arguments))},return:function(a){var c=this.s.return;return c===void 0?Promise.resolve({value:a,done:!0}):s(c.apply(this.s,arguments))},throw:function(a){var c=this.s.return;return c===void 0?Promise.reject(a):s(c.apply(this.s,arguments))}},new n(o)}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}}),Ge=A(Xe(),1),jt=A(Ue(),1),pu=A(Ye(),1),mu=A(li(),1),hu=0,yu=1,Su=0,wu=1,Eu=0,gu=1,vu=2;function di(e){return(F(e)||dt(e))&&typeof e?.then=="function"&&typeof e?.catch=="function"}var bu=class extends Error{constructor(e){super("Max depth reached at path: "+e.join(".")),this.path=e}};function _u(e){return $t.apply(this,arguments)}function $t(){return $t=(0,jt.default)(function*(e){let{data:t}=e,r=0,n=0,o=du();function s(w){let g=r++,v=w(g);return o.add(v),g}function i(w,g){return s((function(){var v=(0,jt.default)(function*(E){let O=c(g);O&&(w.catch(j=>{var se;(se=e.onError)===null||se===void 0||se.call(e,{error:j,path:g})}),w=Promise.reject(O));try{let j=yield(0,Ge.default)(w);yield[E,Su,d(j,g)]}catch(j){var k,z;(k=e.onError)===null||k===void 0||k.call(e,{error:j,path:g}),yield[E,wu,(z=e.formatError)===null||z===void 0?void 0:z.call(e,{error:j,path:g})]}});return function(E){return v.apply(this,arguments)}})())}function a(w,g){return s((function(){var v=(0,jt.default)(function*(E){try{var O=(0,pu.default)();let j=c(g);if(j)throw j;let se=O.a(qt(w));try{for(;;){let T=yield(0,Ge.default)(se.next());if(T.done){yield[E,Eu,d(T.value,g)];break}yield[E,gu,d(T.value,g)]}}catch(T){var k,z;(k=e.onError)===null||k===void 0||k.call(e,{error:T,path:g}),yield[E,vu,(z=e.formatError)===null||z===void 0?void 0:z.call(e,{error:T,path:g})]}}catch(j){O.e=j}finally{yield(0,Ge.default)(O.d())}});return function(E){return v.apply(this,arguments)}})())}function c(w){return e.maxDepth&&w.length>e.maxDepth?new bu(w):null}function u(w,g){if(di(w))return[hu,i(w,g)];if(Je(w)){if(e.maxDepth&&g.length>=e.maxDepth)throw new Error("Max depth reached");return[yu,a(w,g)]}return null}function d(w,g){if(w===void 0)return[[]];let v=u(w,g);if(v)return[[n],[null,...v]];if(!qc(w))return[[w]];let E=Q(),O=[];for(let[k,z]of Object.entries(w)){let j=u(z,[...g,k]);if(!j){E[k]=z;continue}E[k]=n,O.push([k,...j])}return[[E],...O]}let p=Q();for(let[w,g]of Object.entries(t))p[w]=d(g,[w]);yield p;let h=o;e.pingMs&&(h=ui(o,e.pingMs));var m=!1,f=!1,l;try{for(var y=(0,mu.default)(h),_;m=!(_=yield(0,Ge.default)(y.next())).done;m=!1)yield _.value}catch(w){f=!0,l=w}finally{try{m&&y.return!=null&&(yield(0,Ge.default)(y.return()))}finally{if(f)throw l}}}),$t.apply(this,arguments)}function Tu(e){let t=ci(_u(e)),{serialize:r}=e;return r&&(t=t.pipeThrough(new TransformStream({transform(n,o){n===Ve?o.enqueue(Ve):o.enqueue(r(n))}}))),t.pipeThrough(new TransformStream({transform(n,o){n===Ve?o.enqueue(" "):o.enqueue(JSON.stringify(n)+`
|
|
8
|
+
`)}})).pipeThrough(new TextEncoderStream)}var Ru=Y({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js"(e,t){var r=Xt();function n(o){var s={},i=!1;function a(c,u){return i=!0,u=new Promise(function(d){d(o[c](u))}),{done:!1,value:new r(u,1)}}return s[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},s.next=function(c){return i?(i=!1,c):a("next",c)},typeof o.throw=="function"&&(s.throw=function(c){if(i)throw i=!1,c;return a("throw",c)}),typeof o.return=="function"&&(s.return=function(c){return i?(i=!1,c):a("return",c)}),s}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}}),Zs=A(li(),1),ei=A(Xe(),1),ti=A(Ue(),1),Au=A(Ru(),1),Ap=A(Ye(),1),Pu="ping",Ou="serialized-error",xu="connected",Iu="return";function Cu(e){var t,r,n,o,s;let{serialize:i=Ss}=e,a={enabled:(t=(r=e.ping)===null||r===void 0?void 0:r.enabled)!==null&&t!==void 0?t:!1,intervalMs:(n=(o=e.ping)===null||o===void 0?void 0:o.intervalMs)!==null&&n!==void 0?n:1e3},c=(s=e.client)!==null&&s!==void 0?s:{};if(a.enabled&&c.reconnectAfterInactivityMs&&a.intervalMs>c.reconnectAfterInactivityMs)throw new Error(`Ping interval must be less than client reconnect interval to prevent unnecessary reconnection - ping.intervalMs: ${a.intervalMs} client.reconnectAfterInactivityMs: ${c.reconnectAfterInactivityMs}`);function u(){return d.apply(this,arguments)}function d(){return d=(0,ti.default)(function*(){yield{event:xu,data:JSON.stringify(c)};let f=e.data;e.emitAndEndImmediately&&(f=au(f,{count:1,gracePeriodMs:1})),a.enabled&&a.intervalMs!==1/0&&a.intervalMs>0&&(f=ui(f,a.intervalMs));let l,y;var _=!1,w=!1,g;try{for(var v=(0,Zs.default)(f),E;_=!(E=yield(0,ei.default)(v.next())).done;_=!1){l=E.value;{if(l===Ve){yield{event:Pu,data:""};continue}y=Ut(l)?{id:l[0],data:l[1]}:{data:l},y.data=JSON.stringify(i(y.data)),yield y,l=null,y=null}}}catch(O){w=!0,g=O}finally{try{_&&v.return!=null&&(yield(0,ei.default)(v.return()))}finally{if(w)throw g}}}),d.apply(this,arguments)}function p(){return h.apply(this,arguments)}function h(){return h=(0,ti.default)(function*(){try{yield*(0,Au.default)((0,Zs.default)(u())),yield{event:Iu,data:""}}catch(y){var f,l;if(zt(y))return;let _=$(y),w=(f=(l=e.formatError)===null||l===void 0?void 0:l.call(e,{error:_}))!==null&&f!==void 0?f:null;yield{event:Ou,data:JSON.stringify(i(w))}}}),h.apply(this,arguments)}return ci(p()).pipeThrough(new TransformStream({transform(f,l){"event"in f&&l.enqueue(`event: ${f.event}
|
|
9
|
+
`),"data"in f&&l.enqueue(`data: ${f.data}
|
|
10
|
+
`),"id"in f&&l.enqueue(`id: ${f.id}
|
|
11
|
+
`),"comment"in f&&l.enqueue(`: ${f.comment}
|
|
12
|
+
`),l.enqueue(`
|
|
13
|
+
|
|
14
|
+
`)}})).pipeThrough(new TextEncoderStream)}var Du={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform","X-Accel-Buffering":"no",Connection:"keep-alive"},Nu=A(Ue(),1),St=A(X(),1);function Bt(e){return ae((0,Nu.default)(function*(){throw e}))}function Uu(e){let t=new AbortController;return{signal:ws([e,t.signal]),controller:t}}var Mu={mutation:["POST"],query:["GET"],subscription:["GET"]},Lu={mutation:["POST"],query:["GET","POST"],subscription:["GET","POST"]};function ze(e){var t,r,n;let{ctx:o,info:s,responseMeta:i,untransformedJSON:a,errors:c=[],headers:u}=e,d=a?Ps(a):200,p=!a,h=p?[]:Array.isArray(a)?a:[a],m=(t=i?.({ctx:o,info:s,paths:s?.calls.map(f=>f.path),data:h,errors:c,eagerGeneration:p,type:(r=s==null||(n=s.calls.find(f=>{var l;return(l=f.procedure)===null||l===void 0?void 0:l._def.type}))===null||n===void 0||(n=n.procedure)===null||n===void 0?void 0:n._def.type)!==null&&r!==void 0?r:"unknown"}))!==null&&t!==void 0?t:{};if(m.headers)if(m.headers instanceof Headers)for(let[f,l]of m.headers.entries())u.append(f,l);else for(let[f,l]of Object.entries(m.headers))if(Array.isArray(l))for(let y of l)u.append(f,y);else typeof l=="string"&&u.set(f,l);return m.status&&(d=m.status),{status:d}}function ku(e,t){let{router:r,req:n,onError:o}=t.opts,s=$(e);o?.({error:s,path:t.path,input:t.input,ctx:t.ctx,type:t.type,req:n});let i={error:ce({config:r._def._config,error:s,type:t.type,path:t.path,input:t.input,ctx:t.ctx})},a=Ee(r._def._config,i),c=JSON.stringify(a);return{error:s,untransformedJSON:i,body:c}}function ri(e){return F(e)?Je(e)?!0:Object.values(e).some(di)||Object.values(e).some(Je):!1}async function fi(e){var t,r,n,o,s,i;let{router:a,req:c}=e,u=new Headers([["vary","trpc-accept, accept"]]),d=a._def._config,p=new URL(c.url);if(c.method==="HEAD")return new Response(null,{status:204});let h=(t=(r=e.allowBatching)!==null&&r!==void 0?r:(n=e.batching)===null||n===void 0?void 0:n.enabled)!==null&&t!==void 0?t:!0,m=((o=e.allowMethodOverride)!==null&&o!==void 0?o:!1)&&c.method==="POST",f=await ae(async()=>{try{return[void 0,await Yc({req:c,path:decodeURIComponent(e.path),router:a,searchParams:p.searchParams,headers:e.req.headers,url:p,maxBatchSize:e.maxBatchSize})]}catch(v){return[$(v),void 0]}}),l=ae(()=>{let v;return{valueOrUndefined:()=>{if(v)return v[1]},value:()=>{let[E,O]=v;if(E)throw E;return O},create:async E=>{if(v)throw new Error("This should only be called once - report a bug in tRPC");try{v=[void 0,await e.createContext({info:E})]}catch(O){v=[$(O),void 0]}}}}),y=m?Lu:Mu,_=ni(c.headers)==="application/jsonl",w=(s=(i=d.sse)===null||i===void 0?void 0:i.enabled)!==null&&s!==void 0?s:!0;try{let[v,E]=f;if(v)throw v;if(E.isBatchCall&&!h)throw new P({code:"BAD_REQUEST",message:"Batching is not enabled on the server"});if(_&&!E.isBatchCall)throw new P({message:"Streaming requests must be batched (you can do a batch of 1)",code:"BAD_REQUEST"});await l.create(E);let O=E.calls.map(async T=>{let H=T.procedure,x=Uu(e.req.signal);try{if(e.error)throw e.error;if(!H)throw new P({code:"NOT_FOUND",message:`No procedure found on path "${T.path}"`});if(!y[H._def.type].includes(c.method))throw new P({code:"METHOD_NOT_SUPPORTED",message:`Unsupported ${c.method}-request to ${H._def.type} procedure at path "${T.path}"`});if(H._def.type==="subscription"){var L;if(E.isBatchCall)throw new P({code:"BAD_REQUEST",message:"Cannot batch subscription calls"});if(!((L=d.sse)===null||L===void 0)&&L.maxDurationMs){let M=function(){clearTimeout(B),x.signal.removeEventListener("abort",M),x.controller.abort()},B=setTimeout(M,d.sse.maxDurationMs);x.signal.addEventListener("abort",M)}}return[void 0,{data:await H({path:T.path,getRawInput:T.getRawInput,ctx:l.value(),type:H._def.type,signal:x.signal,batchIndex:T.batchIndex}),signal:H._def.type==="subscription"?x.signal:void 0}]}catch(te){var N,U,V;let M=$(te),B=T.result();return(N=e.onError)===null||N===void 0||N.call(e,{error:M,path:T.path,input:B,ctx:l.valueOrUndefined(),type:(U=(V=T.procedure)===null||V===void 0?void 0:V._def.type)!==null&&U!==void 0?U:"unknown",req:e.req}),[M,void 0]}});if(!E.isBatchCall){let[T]=E.calls,[H,x]=await O[0];switch(E.type){case"unknown":case"mutation":case"query":{if(u.set("content-type","application/json"),ri(x?.data))throw new P({code:"UNSUPPORTED_MEDIA_TYPE",message:"Cannot use stream-like response in non-streaming request - use httpBatchStreamLink"});let L=H?{error:ce({config:d,ctx:l.valueOrUndefined(),error:H,input:T.result(),path:T.path,type:E.type})}:{result:{data:x.data}},N=ze({ctx:l.valueOrUndefined(),info:E,responseMeta:e.responseMeta,errors:H?[H]:[],headers:u,untransformedJSON:[L]});return new Response(JSON.stringify(Ee(d,L)),{status:N.status,headers:u})}case"subscription":{let L=ae(()=>H?Bt(H):w?!ht(x.data)&&!Je(x.data)?Bt(new P({message:`Subscription ${T.path} did not return an observable or a AsyncGenerator`,code:"INTERNAL_SERVER_ERROR"})):ht(x.data)?Ht(x.data,e.req.signal):x.data:Bt(new P({code:"METHOD_NOT_SUPPORTED",message:'Missing experimental flag "sseSubscriptions"'}))),N=Cu((0,St.default)((0,St.default)({},d.sse),{},{data:L,serialize:M=>d.transformer.output.serialize(M),formatError(M){var B,Se,Re;let Cr=$(M.error),Dr=T?.result(),Nr=T?.path,Ur=(B=T==null||(Se=T.procedure)===null||Se===void 0?void 0:Se._def.type)!==null&&B!==void 0?B:"unknown";return(Re=e.onError)===null||Re===void 0||Re.call(e,{error:Cr,path:Nr,input:Dr,ctx:l.valueOrUndefined(),req:e.req,type:Ur}),ce({config:d,ctx:l.valueOrUndefined(),error:Cr,input:Dr,path:Nr,type:Ur})}}));for(let[M,B]of Object.entries(Du))u.set(M,B);let U=ze({ctx:l.valueOrUndefined(),info:E,responseMeta:e.responseMeta,errors:[],headers:u,untransformedJSON:null}),V=x?.signal,te=N;if(V){let M=N.getReader(),B=()=>{M.cancel()};V.aborted?B():V.addEventListener("abort",B,{once:!0}),te=new ReadableStream({async pull(Se){let Re=await M.read();Re.done?(V.removeEventListener("abort",B),Se.close()):Se.enqueue(Re.value)},cancel(){return V.removeEventListener("abort",B),M.cancel()}})}return new Response(te,{headers:u,status:U.status})}}}if(E.accept==="application/jsonl"){u.set("content-type","application/json"),u.set("transfer-encoding","chunked");let T=ze({ctx:l.valueOrUndefined(),info:E,responseMeta:e.responseMeta,errors:[],headers:u,untransformedJSON:null}),H=Tu((0,St.default)((0,St.default)({},d.jsonl),{},{maxDepth:1/0,data:O.map(async(x,L)=>{let[N,U]=await x,V=E.calls[L];if(N){var te,M;return{error:ce({config:d,ctx:l.valueOrUndefined(),error:N,input:V.result(),path:V.path,type:(te=(M=V.procedure)===null||M===void 0?void 0:M._def.type)!==null&&te!==void 0?te:"unknown"})}}let B=ht(U.data)?Ht(U.data,e.req.signal):Promise.resolve(U.data);return{result:Promise.resolve({data:B})}}),serialize:x=>d.transformer.output.serialize(x),onError:x=>{var L,N;(L=e.onError)===null||L===void 0||L.call(e,{error:$(x.error),path:void 0,input:void 0,ctx:l.valueOrUndefined(),req:e.req,type:(N=E?.type)!==null&&N!==void 0?N:"unknown"})},formatError(x){var L,N;let U=E?.calls[x.path[0]],V=$(x.error),te=U?.result(),M=U?.path,B=(L=U==null||(N=U.procedure)===null||N===void 0?void 0:N._def.type)!==null&&L!==void 0?L:"unknown";return ce({config:d,ctx:l.valueOrUndefined(),error:V,input:te,path:M,type:B})}}));return new Response(H,{headers:u,status:T.status})}u.set("content-type","application/json");let k=(await Promise.all(O)).map(T=>{let[H,x]=T;return H?T:ri(x.data)?[new P({code:"UNSUPPORTED_MEDIA_TYPE",message:"Cannot use stream-like response in non-streaming request - use httpBatchStreamLink"}),void 0]:T}),z=k.map(([T,H],x)=>{let L=E.calls[x];if(T){var N,U;return{error:ce({config:d,ctx:l.valueOrUndefined(),error:T,input:L.result(),path:L.path,type:(N=(U=L.procedure)===null||U===void 0?void 0:U._def.type)!==null&&N!==void 0?N:"unknown"})}}return{result:{data:H.data}}}),j=k.map(([T])=>T).filter(Boolean),se=ze({ctx:l.valueOrUndefined(),info:E,responseMeta:e.responseMeta,untransformedJSON:z,errors:j,headers:u});return new Response(JSON.stringify(Ee(d,z)),{status:se.status,headers:u})}catch(v){var g;let[E,O]=f,k=l.valueOrUndefined(),{error:z,untransformedJSON:j,body:se}=ku(v,{opts:e,ctx:l.valueOrUndefined(),type:(g=O?.type)!==null&&g!==void 0?g:"unknown"}),T=ze({ctx:k,info:O,responseMeta:e.responseMeta,untransformedJSON:j,errors:[z],headers:u});return new Response(se,{status:T.status,headers:u})}}import{IncomingMessage as Ku}from"node:http";function Hu(e,t){if("body"in e)return e.body===void 0?void 0:typeof e.body=="string"||e.body instanceof Ku?e.body:JSON.stringify(e.body);let r=0,n=!1;return new ReadableStream({start(o){let s=a=>{if(r+=a.length,!t.maxBodySize||r<=t.maxBodySize){o.enqueue(new Uint8Array(a.buffer,a.byteOffset,a.byteLength));return}o.error(new P({code:"PAYLOAD_TOO_LARGE"})),n=!0,e.off("data",s),e.off("end",i)},i=()=>{n||(n=!0,e.off("data",s),e.off("end",i),o.close())};e.on("data",s),e.on("end",i)},cancel(){e.destroy()}})}function Qt(e){try{var t,r;let n=e.headers[":scheme"]&&e.headers[":scheme"]==="https"||e.socket&&"encrypted"in e.socket&&e.socket.encrypted?"https:":"http:",o=(t=(r=e.headers.host)!==null&&r!==void 0?r:e.headers[":authority"])!==null&&t!==void 0?t:"localhost";return new URL(e.url,`${n}//${o}`)}catch(n){throw new P({code:"BAD_REQUEST",message:"Invalid URL",cause:n})}}function Wu(e){let t=new Headers;for(let r in e){let n=e[r];if(!(typeof r=="string"&&r.startsWith(":")))if(Array.isArray(n))for(let o of n)t.append(r,o);else n!=null&&t.append(r,n)}return t}function ju(e,t,r){let n=new AbortController,o=()=>{t.off("close",o),e.off("aborted",o),n.abort()};t.once("close",o),e.once("aborted",o);let s=Qt(e),i={headers:Wu(e.headers),method:e.method,signal:n.signal};return e.method!=="GET"&&e.method!=="HEAD"&&(i.body=Hu(e,r),i.duplex="half"),new Request(s,i)}async function Bu(e,t){e.write(t)===!1&&await new Promise((r,n)=>{let o=a=>{n(a),i()},s=()=>{r(),i()},i=()=>{e.off("error",o),e.off("drain",s)};e.once("error",o),e.once("drain",s)})}async function Fu(e){let{res:t}=e;try{let r=new WritableStream({async write(n){var o;await Bu(t,n),(o=t.flush)===null||o===void 0||o.call(t)}});await e.body.pipeTo(r,{signal:e.signal})}catch(r){if(zt(r))return;throw r}}async function Ju(e){let{response:t,rawResponse:r}=e;r.statusCode===200&&(r.statusCode=t.status);for(let[o,s]of t.headers)o.toLowerCase()!=="set-cookie"&&r.setHeader(o,s);let n=t.headers.getSetCookie();n.length>0&&r.setHeader("set-cookie",n);try{t.body&&await Fu({res:r,signal:e.request.signal,body:t.body})}catch(o){throw r.headersSent||(r.statusCode=500),o}finally{r.end()}}var Me=A(X(),1);function Zt(e){return t=>{var r;let{res:n,req:o}=e,s=$(t),i=ce({config:e.router._def._config,error:s,type:"unknown",path:void 0,input:void 0,ctx:void 0});(r=e.onError)===null||r===void 0||r.call(e,{req:o,error:s,type:"unknown",path:void 0,input:void 0,ctx:void 0});let a=Ee(e.router._def._config,{error:i});n.statusCode=i.data.httpStatus,n.end(JSON.stringify(a))}}async function pi(e){return new Promise(t=>{var r;let n=(r=e.middleware)!==null&&r!==void 0?r:(o,s,i)=>i();return e.res.once("finish",()=>{t()}),n(e.req,e.res,o=>{ae(async()=>{var s;let i=ju(e.req,e.res,{maxBodySize:(s=e.maxBodySize)!==null&&s!==void 0?s:null}),a=async u=>{var d;return await((d=e.createContext)===null||d===void 0?void 0:d.call(e,(0,Me.default)((0,Me.default)({},e),u)))},c=await fi((0,Me.default)((0,Me.default)({},e),{},{req:i,error:o?$(o):null,createContext:a,onError(u){var d;e==null||(d=e.onError)===null||d===void 0||d.call(e,(0,Me.default)((0,Me.default)({},u),{},{req:e.req}))}}));await Ju({request:i,response:c,rawResponse:e.res})}).catch(Zt(e))})})}import $u from"http";var er=A(X(),1);function Gu(e){var t;let n=((t=e.basePath)!==null&&t!==void 0?t:"/").length;return(o,s)=>{let i="";ae(async()=>{i=Qt(o).pathname.slice(n),await pi((0,er.default)((0,er.default)({},e),{},{req:o,res:s,path:i}))}).catch(Zt((0,er.default)({req:o,res:s,path:i},e)))}}function zu(e){return Gu(e)}function mi(e){return $u.createServer(zu(e))}function I(e,t,r,n={}){if(e.headersSent)return;let o=Buffer.from(JSON.stringify(r),"utf8");e.writeHead(t,{"Content-Type":"application/json; charset=utf-8","Content-Length":String(o.length),...n}),e.end(o)}function R(e,t,r,n,o={}){I(e,t,{ok:!1,code:r,message:n},o)}function ve(e,t,r){I(e,t,r,{"Cache-Control":"no-store"})}function q(e,t){R(e,405,"method-not-allowed",`Use ${t}`,{Allow:t})}function tr(e){let t=e.headers["content-length"];if(t===void 0)return null;let r=Number(t);return Number.isFinite(r)&&r>=0?r:null}function rr(e,t,r,n,o,s){let i=0;e.on("data",a=>{i+=a.length,i>s&&e.socket.destroy()}),e.on("error",()=>{}),e.resume(),R(t,r,n,o)}async function ue(e,t){let r=()=>(rr(e,t,413,"too-large","Body exceeds 8192 bytes",8192),null);if((tr(e)??0)>8192)return r();let n=await new Promise((s,i)=>{let a=[],c=0,u=m=>{if(c+=m.length,c<=8192){a.push(m);return}h(),s(null)},d=()=>{h(),s(Buffer.concat(a))},p=m=>{h(),i(m)},h=()=>{e.off("data",u),e.off("end",d),e.off("error",p)};e.on("data",u),e.on("end",d),e.on("error",p)});if(n===null)return r();if(n.length===0)return{};let o;try{o=JSON.parse(n.toString("utf8"))}catch{return R(t,400,"bad-json","Body is not valid JSON"),null}return o===null||typeof o!="object"||Array.isArray(o)?(R(t,400,"bad-json","Body must be a JSON object"),null):o}import*as Si from"net";import{execFile as sl}from"child_process";import{promisify as il}from"util";var yi="#--tasklist--#",Vu=`netstat -ano; echo '${yi}'; MSYS_NO_PATHCONV=1 tasklist /FO CSV /NH`,Yu=new Set(["0.0.0.0:0","[::]:0","*:*"]),nr=new Set(["0.0.0.0","127.0.0.1","[::]","[::1]","*"]);function Xu(e){let t=new Map;for(let r of e.split(`
|
|
15
|
+
`)){let n=/^"([^"]*)","(\d+)"/.exec(r.trim());n&&t.set(Number(n[2]),n[1].replace(/\.exe$/i,""))}return t}function qu(e){let[t,r]=e.split(yi),n=r?Xu(r):new Map,o=new Map;for(let s of t.split(`
|
|
16
|
+
`)){let i=s.trim().split(/\s+/);if(i.length<4||i[0]!=="TCP"||!Yu.has(i[2]))continue;let a=i[1],c=a.lastIndexOf(":");if(c<0)continue;let u=Number(a.slice(c+1));if(!Number.isInteger(u)||u<1024)continue;let d=a.slice(0,c);if(!nr.has(d))continue;let p=Number(i[i.length-1]),h=n.get(p)??null,m=o.get(u);(!m||!m.process&&h)&&o.set(u,{port:u,address:d,process:h})}return[...o.values()].sort((s,i)=>s.port-i.port)}function hi(e){let t=new Map;for(let r of e.split(`
|
|
17
|
+
`)){let n=r.trim().split(/\s+/);if(n.length<4)continue;let o=n[3],s=o.lastIndexOf(":");if(s<0)continue;let i=Number(o.slice(s+1));if(!Number.isInteger(i)||i<1024)continue;let a=o.slice(0,s);if(!nr.has(a))continue;let c=/users:\(\("([^"]+)"/.exec(r),u=t.get(i);(!u||!u.process&&c)&&t.set(i,{port:i,address:a,process:c?c[1]:null})}return[...t.values()].sort((r,n)=>r.port-n.port)}var Qu="lsof -nP -iTCP -sTCP:LISTEN -F cn";function Zu(e){let t=new Map,r=null;for(let n of e.split(`
|
|
18
|
+
`)){let o=n.trim(),s=o[0],i=o.slice(1);if(s==="p")r=null;else if(s==="c")r=i||null;else if(s==="n"){let a=i.lastIndexOf(":");if(a<0)continue;let c=Number(i.slice(a+1));if(!Number.isInteger(c)||c<1024)continue;let u=i.slice(0,a);if(!nr.has(u))continue;let d=t.get(c);(!d||!d.process&&r)&&t.set(c,{port:c,address:u,process:r})}}return[...t.values()].sort((n,o)=>n.port-o.port)}var el="0A",tl=new Map([["00000000","0.0.0.0"],["0100007F","127.0.0.1"],["00000000000000000000000000000000","[::]"],["00000000000000000000000001000000","[::1]"]]);function rl(e){let t=new Map;for(let r of e.split(`
|
|
19
|
+
`)){let n=r.trim().split(/\s+/);if(n.length<4||n[3]!==el)continue;let[o,s]=n[1].split(":"),i=tl.get(o?.toUpperCase()??"");if(!i)continue;let a=parseInt(s,16);!Number.isInteger(a)||a<1024||t.has(a)||t.set(a,{port:a,address:i,process:null})}return[...t.values()].sort((r,n)=>r.port-n.port)}var nl="cat /proc/net/tcp /proc/net/tcp6 2>/dev/null";function ol(e){return e==="win32"?[{command:Vu,parse:qu}]:e==="darwin"?[{command:Qu,parse:Zu}]:[{command:"ss -ltnpH",parse:hi},{command:"ss -ltnH",parse:hi},{command:nl,parse:rl}]}async function wt(e,t){let r="no probe produced output";for(let n of ol(e))try{let o=await t(n.command);if(o.trim()!=="")return{ports:n.parse(o)}}catch(o){r=o.message}return{ports:[],error:r}}var Et=D("port-forward"),al=il(sl),wi="/forward",cl="/api/forward/ports",ul=64,ll=4004;function dl(e){let t;try{t=new URL(e,"http://localhost")}catch{return null}let r=Number(t.searchParams.get("port"));if(!Number.isInteger(r)||r<1024||r>65535)return null;let n=t.searchParams.get("host")??"127.0.0.1";return n!=="127.0.0.1"&&n!=="localhost"&&n!=="::1"?null:{host:n,port:r}}async function fl(){if(process.platform==="win32")return Et.warn("port discovery is not implemented for a Windows-hosted daemon"),[];let{ports:e,error:t}=await wt(process.platform,async r=>(await al("sh",["-c",r],{timeout:3e3})).stdout);return t&&Et.warn(`port discovery unavailable: ${t}`),e}function Ei(){return{[cl]:async(e,t)=>{I(t,200,{ok:!0,data:{ports:await fl()}})}}}function gi(){let e=new ct.default({noServer:!0}),t=0;return{handleUpgrade:(n,o,s)=>{let i=dl(n.url??"");if(!i){o.destroy();return}if(t>=ul){Et.warn(`forward refused (${t} already open): ${i.host}:${i.port}`),o.destroy();return}e.handleUpgrade(n,o,s,a=>{t+=1,pl(a,i,()=>{t-=1})})},close:()=>e.close()}}function pl(e,t,r){let n=Si.connect({host:t.host,port:t.port});n.setNoDelay(!0);let o=!1,s=(i,a)=>{if(!o){o=!0,n.destroy();try{e.close(i,a)}catch{}r()}};n.on("connect",()=>{Et.info(`forward open \u2192 ${t.host}:${t.port}`)}),n.on("error",i=>s(ll,i.code??"error")),n.on("close",()=>s(1e3,"target closed")),n.on("data",i=>{n.pause(),e.send(i,{binary:!0},()=>n.resume())}),e.on("message",i=>{let a=Array.isArray(i)?Buffer.concat(i):Buffer.from(i);n.write(a)}),e.on("close",()=>s(1e3,"client closed")),e.on("error",()=>s(1011,"socket error"))}import*as vi from"crypto";import{readFileSync as ml,writeFileSync as hl,mkdirSync as yl,renameSync as Sl}from"fs";import*as bi from"path";var wl=D("ui-http"),sr=720*60*60*1e3;function _i(e,t){let r=Array.isArray(e)?e[0]:e;if(r)for(let n of r.split(";")){let o=n.indexOf("=");if(o<0||n.slice(0,o).trim()!==t)continue;let s=n.slice(o+1).trim();try{return decodeURIComponent(s)}catch{return s}}}function Ti(e={}){let t=e.ttlMs&&e.ttlMs>0?e.ttlMs:sr,r=e.now??(()=>Date.now()),n=e.file,o=new Map,s=()=>{if(!n)return;let c;try{c=JSON.parse(ml(n,"utf8"))}catch{return}if(!c||typeof c!="object")return;let u=r();for(let[d,p]of Object.entries(c))typeof p=="number"&&p>u&&o.set(d,p)},i=()=>{if(n)try{yl(bi.dirname(n),{recursive:!0});let c=`${n}.tmp`;hl(c,JSON.stringify(Object.fromEntries(o)),{mode:384}),Sl(c,n)}catch(c){wl.warn(`could not persist UI sessions: ${c.message}`)}},a=()=>{let c=r(),u=!1;for(let[d,p]of o)p<=c&&(o.delete(d),u=!0);return u};return s(),{create(){a();let c=vi.randomBytes(32).toString("hex");return o.set(c,r()+t),i(),c},verify(c){if(!c)return!1;let u=r(),d=!1;for(let[p,h]of o)ne(p,c)&&h>u&&(d=!0);return d},revoke(c){if(!c)return;let u=o.delete(c),d=a();(u||d)&&i()},size(){return a(),o.size}}}var ir=D("ui-http"),Oi="cortex_ui",ar="/api/ui/login",El="/api/ui/logout",qe="/api/ui/session",cr=250;function Ri(e){return Array.isArray(e)?e[0]:e}function Ai(e){if(Ri(e.headers["x-forwarded-proto"])?.split(",")[0].trim()==="https"||e.socket.encrypted)return!0;let t=(Ri(e.headers.host)??"").replace(/:\d+$/,"").toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"}function Pi(e,t,r){let n=[`${Oi}=${e}`,"Path=/","HttpOnly","SameSite=Strict",`Max-Age=${t}`];return r&&n.push("Secure"),n.join("; ")}function ur(e){return _i(e.headers.cookie,Oi)}function gl(e,t){return e.redeemCode&&Xo(t)?e.redeemCode(t):ne(e.getToken(),t)}function xi(e){let t=Math.floor(e.ttlMs/1e3);return{[ar]:async(r,n)=>{if(r.method!=="POST")return q(n,"POST");let o=await ue(r,n);if(!o)return;let s=typeof o.token=="string"?o.token.trim():"";if(!gl(e,s))return await new Promise(c=>setTimeout(c,cr)),ir.warn("ui login rejected: wrong token or pairing code"),R(n,401,"invalid-token","Invalid token");let i=e.store.create(),a=Ai(r);a||ir.warn("ui login over plain HTTP to a non-loopback host \u2014 the session cookie is issued without Secure, so anyone on this network path can read it. Use HTTPS (a tunnel) for real use."),ir.info("ui login accepted \u2014 session issued"),I(n,200,{ok:!0},{"Set-Cookie":Pi(i,t,a)})},[El]:async(r,n)=>{if(r.method!=="POST")return q(n,"POST");e.store.revoke(ur(r)),I(n,200,{ok:!0},{"Set-Cookie":Pi("",0,Ai(r))})},[qe]:async(r,n)=>{I(n,200,{ok:!0,data:{authenticated:await e.authorize(r),tokenLogin:!0}})}}}function Ii(e){return{[qe]:async(t,r)=>{I(r,200,{ok:!0,data:{authenticated:await e(t),tokenLogin:!1}})}}}var be=D("ui-http"),vl="cf-access-jwt-assertion",Qe="/trpc/",bl="GET, POST, OPTIONS",_l=`${Fe}, content-type, x-session-id, x-file-name, x-cortex-client`,Tl="86400",Rl=16*1024*1024,Al=new Set(["GET","HEAD","OPTIONS"]);function Di(e,t,r){let n=e.headers[Fe],o=Array.isArray(n)?n[0]:n;return ne(t(),o)||r?.(o)===!0}async function Pl(e,t){if(!t)return!1;let r=e.headers[vl],n=Array.isArray(r)?r[0]:r;return n?t(n):!1}function Ni(e){return async t=>Di(t,e.getToken,e.matchDeviceToken)||e.verifySession?.(ur(t))?!0:Pl(t,e.verifyAccessJwt)}function Ze(e){return Array.isArray(e)?e[0]:e}function Ci(e,t){let r=Ze(e.headers.origin);if(r===void 0||t?.includes(r))return!0;try{return new URL(r).host===Ze(e.headers.host)}catch{return!1}}function Ol(e,t,r){if(!r||r.length===0)return;let n=Ze(e.headers.origin);if(!(!n||!r.includes(n)))return t.setHeader("Access-Control-Allow-Origin",n),t.setHeader("Vary","Origin"),t.setHeader("Access-Control-Allow-Methods",bl),t.setHeader("Access-Control-Allow-Headers",_l),t.setHeader("Access-Control-Max-Age",Tl),n}function xl(e,t,r){if(!r||!me.existsSync(r)){t.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),t.end("Cortex UI not built");return}let n;try{n=decodeURIComponent((e.url??"/").split("?")[0])}catch{t.writeHead(400,{"Content-Type":"text/plain; charset=utf-8"}),t.end("Bad request");return}let o=_e.resolve(r),s=_e.resolve(o,"."+(n==="/"?"/index.html":n));if(s!==o&&!s.startsWith(o+_e.sep)){t.writeHead(403,{"Content-Type":"text/plain; charset=utf-8"}),t.end("Forbidden");return}let i=_e.join(o,"index.html"),a=me.existsSync(s)&&me.statSync(s).isFile()?s:i;if(!me.existsSync(a)){t.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),t.end("Not found");return}let c=me.createReadStream(a);c.on("error",()=>{t.headersSent||t.writeHead(500,{"Content-Type":"text/plain; charset=utf-8"}),t.end()}),t.writeHead(200,{"Content-Type":at(it(a))}),c.pipe(t)}function Ui(e){let t=e.host??"127.0.0.1",r=e.authorize,n=new Set(e.publicRoutes??[]),o=mi({router:e.router,basePath:Qe,createContext:({req:c})=>e.createContext?.(c)??{},maxBodySize:Rl,middleware:async(c,u,d)=>{let p=c.url??"/",h=typeof e.corsOrigins=="function"?e.corsOrigins():e.corsOrigins;Ol(c,u,h);let m=p.split("?")[0],f=!!(e.customRoutes&&m in e.customRoutes);if(c.method==="OPTIONS"&&(p.startsWith(Qe)||f)){u.writeHead(204),u.end();return}if((f||p.startsWith(Qe))&&!Al.has(c.method??"GET")&&!Ci(c,h)){be.warn(`ui-http cross-origin request refused: ${c.method} ${m} from ${Ze(c.headers.origin)}`),R(u,403,"cross-origin","Cross-origin request refused");return}if(f){if(!(n.has(m)||await r(c))){be.warn(`ui-http auth rejected (custom route): ${c.method} ${p}`),u.writeHead(401,{"Content-Type":"text/plain; charset=utf-8"}),u.end("Unauthorized");return}try{await e.customRoutes[m](c,u)}catch(_){be.error(`Custom route ${p} error:`,_.message),R(u,500,"internal","Internal server error")}return}if(p.startsWith(Qe)){if(!await r(c)){be.warn(`ui-http auth rejected: ${c.method} ${p}`),u.writeHead(401,{"Content-Type":"text/plain; charset=utf-8"}),u.end("Unauthorized");return}d();return}xl(c,u,e.spaDir)}}),s=e.portForward===!1?null:gi(),i=e.upgradeRoutes??{};return(s||Object.keys(i).length>0)&&o.on("upgrade",(c,u,d)=>{let p=(c.url??"").split("?")[0];if(s&&p===wi){if(!Di(c,e.getToken,e.matchDeviceToken)){be.warn(`forward auth rejected: ${c.url}`),u.write(`HTTP/1.1 401 Unauthorized\r
|
|
20
|
+
\r
|
|
21
|
+
`),u.destroy();return}s.handleUpgrade(c,u,d);return}let h=Object.hasOwn(i,p)?i[p]:void 0;if(!h){u.destroy();return}let m=typeof e.corsOrigins=="function"?e.corsOrigins():e.corsOrigins;if(!Ci(c,m)){be.warn(`ui-http cross-origin upgrade refused: ${p} from ${Ze(c.headers.origin)}`),u.write(`HTTP/1.1 403 Forbidden\r
|
|
22
|
+
\r
|
|
23
|
+
`),u.destroy();return}h.handleUpgrade(c,u,d)}),o.listen(e.port,t,()=>{let c=o.address(),u=c&&typeof c!="string"?c.port:e.port;be.info(`Listening on ${t}:${u}${Qe}`)}),{server:o,close:()=>new Promise(c=>{s?.close();for(let u of Object.values(i))u.close();o.closeAllConnections?.(),o.close(()=>c())})}}var lr=D("ui-http"),dr="/api/ui/pair",Il="/api/ui/pairing-code",Cl="/api/ui/devices",Dl="/api/ui/devices/revoke";function Nl(e){let t=e.headers[Fe];return Array.isArray(t)?t[0]:t}function Ul(e,t){return async(r,n)=>{if(r.method!=="POST")return q(n,"POST");let o=await ue(r,n);if(!o)return;let s=typeof o.code=="string"?o.code:"";if(!t.redeem(s))return await new Promise(c=>setTimeout(c,cr)),lr.warn("app pairing rejected: wrong or expired code"),R(n,401,"invalid-code","Invalid or expired pairing code");let{device:i,token:a}=e.issue(typeof o.name=="string"?o.name:"");lr.info(`app paired: ${i.name} (${i.id})`),I(n,200,{ok:!0,data:{token:a,device:i}})}}function Ml(e){return async(t,r)=>{if(t.method!=="POST")return q(r,"POST");I(r,200,{ok:!0,data:e.create()},{"Cache-Control":"no-store"})}}function Ll(e){return async(t,r)=>{if(t.method!=="GET")return q(r,"GET");let n=e.devices.match(Nl(t))?.id,o=e.devices.list().map(s=>({...s,current:s.id===n}));I(r,200,{ok:!0,data:{devices:o,pairing:!!e.pairing}},{"Cache-Control":"no-store"})}}function kl(e){return async(t,r)=>{if(t.method!=="POST")return q(r,"POST");let n=await ue(t,r);if(!n)return;let o=typeof n.id=="string"?n.id:"";if(!e.revoke(o))return R(r,404,"not-found","No such device");lr.info(`paired app revoked: ${o}`),I(r,200,{ok:!0})}}function Mi(e){return{...e.pairing?{[dr]:Ul(e.devices,e.pairing),[Il]:Ml(e.pairing)}:{},[Cl]:Ll(e),[Dl]:kl(e.devices)}}import*as et from"crypto";import{mkdirSync as Kl,readFileSync as Hl,renameSync as Wl,writeFileSync as jl}from"fs";import*as ki from"path";var Bl=D("ui-http"),Fl=600*1e3,Jl=60,$l="App";function Li(e){return et.createHash("sha256").update(e).digest("hex")}function Gl(e){return e.trim().slice(0,Jl)||$l}function zl(e){let t=e;return typeof t?.id=="string"&&typeof t.name=="string"&&typeof t.tokenHash=="string"&&typeof t.createdAt=="number"&&typeof t.lastSeenAt=="number"}function Vl(e){if(!e)return[];try{let t=JSON.parse(Hl(e,"utf8"));return Array.isArray(t?.devices)?t.devices.filter(zl):[]}catch{return[]}}function fr(e){return{id:e.id,name:e.name,createdAt:e.createdAt,lastSeenAt:e.lastSeenAt}}function Ki(e={}){let t=e.now??(()=>Date.now()),r=Vl(e.file),n=new Map(r.map(i=>[i.id,i.lastSeenAt])),o=()=>{if(e.file)try{Kl(ki.dirname(e.file),{recursive:!0});let i=`${e.file}.tmp`;jl(i,JSON.stringify({devices:r}),{mode:384}),Wl(i,e.file);for(let a of r)n.set(a.id,a.lastSeenAt)}catch(i){Bl.warn(`could not persist paired devices: ${i.message}`)}},s=i=>{let a=Li(i),c;for(let u of r)ne(u.tokenHash,a)&&(c=u);return c};return{issue(i){let a=t(),c=et.randomBytes(32).toString("hex"),u={id:et.randomBytes(6).toString("hex"),name:Gl(i),createdAt:a,lastSeenAt:a,tokenHash:Li(c)};return r.push(u),o(),{device:fr(u),token:c}},match(i){if(!i)return;let a=s(i);if(a)return a.lastSeenAt=t(),a.lastSeenAt-(n.get(a.id)??0)>=Fl&&o(),fr(a)},list(){return r.map(fr)},revoke(i){let a=r.findIndex(c=>c.id===i);return a<0?!1:(r.splice(a,1),n.delete(i),o(),!0)}}}import*as re from"node:fs";import*as gt from"node:path";import*as vt from"node:crypto";import*as Bi from"node:zlib";var Yl=67324752,Xl=33639248,ql=101010256,Hi=8,pr=20,Wi=33,ji=0,Ql=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r>>>0}return e})();function Zl(e){let t=4294967295;for(let r=0;r<e.length;r++)t=Ql[(t^e[r])&255]^t>>>8;return(t^4294967295)>>>0}function Fi(e){let t=[...e].sort((c,u)=>c.name<u.name?-1:c.name>u.name?1:0),r=[],n=[],o=0;for(let c of t){let u=Buffer.from(c.name,"utf8"),d=Zl(c.data),p=Bi.deflateRawSync(c.data),h=c.data.length,m=p.length,f=Buffer.alloc(30);f.writeUInt32LE(Yl,0),f.writeUInt16LE(pr,4),f.writeUInt16LE(0,6),f.writeUInt16LE(Hi,8),f.writeUInt16LE(ji,10),f.writeUInt16LE(Wi,12),f.writeUInt32LE(d,14),f.writeUInt32LE(m,18),f.writeUInt32LE(h,22),f.writeUInt16LE(u.length,26),f.writeUInt16LE(0,28),r.push(f,u,p);let l=Buffer.alloc(46);l.writeUInt32LE(Xl,0),l.writeUInt16LE(pr,4),l.writeUInt16LE(pr,6),l.writeUInt16LE(0,8),l.writeUInt16LE(Hi,10),l.writeUInt16LE(ji,12),l.writeUInt16LE(Wi,14),l.writeUInt32LE(d,16),l.writeUInt32LE(m,20),l.writeUInt32LE(h,24),l.writeUInt16LE(u.length,28),l.writeUInt16LE(0,30),l.writeUInt16LE(0,32),l.writeUInt16LE(0,34),l.writeUInt16LE(0,36),l.writeUInt32LE(0,38),l.writeUInt32LE(o,42),n.push(l,u),o+=f.length+u.length+p.length}let s=Buffer.concat(r),i=Buffer.concat(n),a=Buffer.alloc(22);return a.writeUInt32LE(ql,0),a.writeUInt16LE(0,4),a.writeUInt16LE(0,6),a.writeUInt16LE(t.length,8),a.writeUInt16LE(t.length,10),a.writeUInt32LE(i.length,12),a.writeUInt32LE(s.length,16),a.writeUInt16LE(0,20),Buffer.concat([s,i,a])}var Ji=D("ui-ota"),ed="/api/ui-ota/manifest.json",Gi="/api/ui-ota/bundle.zip";function td(e){let t=[],r=(n,o)=>{for(let s of re.readdirSync(n,{withFileTypes:!0})){let i=gt.join(n,s.name),a=o?`${o}/${s.name}`:s.name;s.isDirectory()?r(i,a):s.isFile()&&t.push({name:a,data:re.readFileSync(i)})}};return r(e,""),t.sort((n,o)=>n.name<o.name?-1:n.name>o.name?1:0),t}function rd(e){let t=vt.createHash("sha256");for(let r of e)t.update(r.name),t.update("\0"),t.update(vt.createHash("sha256").update(r.data).digest("hex")),t.update("\0");return t.digest("hex")}function nd(e){let t=td(e),r=Fi(t),n=vt.createHash("sha256").update(r).digest("hex"),o=rd(t);return{zip:r,manifest:{version:o,sha256:n,size:r.length,url:`${Gi}?v=${o}`}}}var od=2e3;function $i(e){let t=0,r=0,n=0,o=s=>{n=Math.max(n,re.statSync(s).mtimeMs);for(let i of re.readdirSync(s,{withFileTypes:!0})){let a=gt.join(s,i.name);if(i.isDirectory())o(a);else if(i.isFile()){let c=re.statSync(a);t+=1,r+=c.size,n=Math.max(n,c.mtimeMs)}}};try{o(e)}catch{n=Date.now()}return{key:`${t}:${r}:${n}`,newestMs:n,hasIndex:re.existsSync(gt.join(e,"index.html"))}}function zi(e){if(!e||!re.existsSync(e))return{};let t,r=()=>{let s=$i(e);if(t&&(t.key===s.key||!s.hasIndex||Date.now()-s.newestMs<od))return t.bundle;let i=nd(e);return t={key:$i(e).key===s.key?s.key:null,bundle:i},i},n=async(s,i)=>{if(s.method!=="GET"&&s.method!=="HEAD"){ve(i,405,{ok:!1,code:"method-not-allowed",message:"Use GET"});return}let a=r().manifest;Ji.info(`manifest served: version=${a.version.slice(0,12)} size=${a.size} method=${s.method}`),ve(i,200,a)},o=async(s,i)=>{if(s.method!=="GET"&&s.method!=="HEAD"){ve(i,405,{ok:!1,code:"method-not-allowed",message:"Use GET"});return}let{zip:a}=r();Ji.info(`bundle served: size=${a.length} method=${s.method}`),i.writeHead(200,{"Content-Type":"application/zip","Content-Length":String(a.length),"Cache-Control":"no-store"}),i.end(s.method==="HEAD"?void 0:a)};return{[ed]:n,[Gi]:o}}var Vi=D("app-update"),sd="/api/app-update/manifest.json",id="fangxm233",ad="cortex-agent",cd=`https://api.github.com/repos/${id}/${ad}/releases?per_page=100`,ud=360*60*1e3,ld=8e3,dd=/^Cortex-(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)-(Linux|Windows|macOS|Android)-([A-Za-z0-9_]+?)(?:-setup)?\.(AppImage|deb|rpm|exe|dmg|apk)$/,fd={AppImage:"appimage",deb:"deb",rpm:"rpm",exe:"nsis",dmg:"dmg",apk:"apk"},pd={amd64:"x86_64",arm64:"aarch64"};function md(e){let t=dd.exec(e);if(!t)return null;let[,r,n,o,s]=t;return{version:r,os:n.toLowerCase(),arch:pd[o]??o,kind:fd[s]}}function hd(e){if(!e)return null;let t=/^sha256:([0-9a-fA-F]{64})$/.exec(e);return t?t[1].toLowerCase():null}function yd(e){let t=/^server-v(\d{4}\.\d{1,2}\.\d{1,2}(?:-\d+)?)$/.exec(e);return t?t[1]:null}function Sd(e){let t=[];for(let r of e.assets){let n=md(r.name),o=hd(r.digest);!n||!o||t.push({name:r.name,os:n.os,arch:n.arch,kind:n.kind,url:r.browser_download_url,size:r.size,sha256:o})}return t}function wd(e,t){let r=null;for(let n of e){let o=yd(n.tag_name);if(!o||Ct(o,t)>0)continue;let s=Sd(n);s.length!==0&&(!r||Ct(o,r.version)>0)&&(r={version:o,release:n,assets:s})}return r?{version:r.version,releaseUrl:r.release.html_url,publishedAt:r.release.published_at,notes:(r.release.body??"").slice(0,ld),assets:r.assets}:null}async function Ed(){let e=await fetch(cd,{headers:{Accept:"application/vnd.github+json","User-Agent":"cortex-agent"}});if(!e.ok)throw new Error(`GitHub releases API ${e.status}`);return await e.json()}function Yi(e={}){let t=e.serverVersion??Qo,r=e.devMode??!1,n=e.fetchReleases??Ed,o=e.ttlMs??ud,s=e.now??Date.now,i=null,a=null,c=async()=>{if(r)return null;if(a!==null&&s()-a<o)return i;a=s();try{i=wd(await n(),t)}catch(d){Vi.warn(`release fetch failed: ${d.message}`)}return i},u=async(d,p)=>{if(d.method!=="GET"&&d.method!=="HEAD"){ve(p,405,{ok:!1,code:"method-not-allowed",message:"Use GET"});return}let h=await c();h&&Vi.info(`manifest served: version=${h.version} assets=${h.assets.length}`),ve(p,200,h??{})};return{[sd]:u}}var gd=D("device-ports"),vd="/api/forward/devices",bd="/api/forward/device-ports",_d="/api/forward/device-port",Td="/api/forward/device-port/close";async function Rd(e,t){let r=e.listDevices().find(s=>s.device===t)?.platform??"",{ports:n,error:o}=await wt(r,s=>e.runOnDevice(t,s));return o&&gd.warn(`port discovery on ${t} unavailable: ${o}`),n}async function Xi(e,t){if(e.method!=="POST")return q(t,"POST"),null;let r=await ue(e,t);if(!r)return null;let n=typeof r.device=="string"?r.device:"",o=Number(r.port);return n?!Number.isInteger(o)||o<1024||o>65535?(R(t,400,"bad-port","port must be an integer in 1024..65535"),null):{device:n,port:o}:(R(t,400,"missing-device","device is required"),null)}function qi(e){let t=new Map,r=(n,o)=>`${n}\0${o}`;return{[vd]:async(n,o)=>{let s=e.listDevices().map(i=>({device:i.device,platform:i.platform}));I(o,200,{ok:!0,data:{devices:s}})},[bd]:async(n,o)=>{let s=new URL(n.url??"","http://localhost").searchParams.get("device");if(!s)return R(o,400,"missing-device","device is required");I(o,200,{ok:!0,data:{ports:await Rd(e,s)}})},[_d]:async(n,o)=>{let s=await Xi(n,o);if(!s)return;let i=r(s.device,s.port),a=e.listDevicePorts().some(u=>u.device===s.device&&u.remotePort===s.port),c;try{c=await e.openDevicePort(s.device,s.port)}catch(u){return R(o,500,"open-failed",u.message)}t.has(i)?t.set(i,t.get(i)+1):a||t.set(i,1),I(o,200,{ok:!0,data:c})},[Td]:async(n,o)=>{let s=await Xi(n,o);if(!s)return;let i=r(s.device,s.port),a=t.get(i)??0;a>1?t.set(i,a-1):t.delete(i);let c=a===1&&e.closeDevicePort(s.device,s.port);I(o,200,{ok:!0,data:{closed:c}})}}}import*as le from"node:path";import*as de from"node:fs";var Ad="/api/attachments/upload",Pd="/api/files/download",Od="/api/boards/asset",xd=100*1024*1024,Id=/^[A-Za-z0-9_-]{1,128}$/,Cd=new Set(["text/html","application/xhtml+xml","image/svg+xml","application/xml"]),Dd="sandbox allow-scripts";function mr(e,t){let r=e.headers[t];return(Array.isArray(r)?r[0]:r)?.trim()||void 0}function Nd(e){try{return decodeURIComponent(e)}catch{return e}}function Ud(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":"file"}async function Md(e,t,r){let n;try{n=await de.promises.open(t,"wx")}catch(s){return e.resume(),{kind:"failed",error:s}}let o=n.createWriteStream();return new Promise(s=>{let i=0,a=!1,c=p=>{if(!a){if(a=!0,e.off("data",u),e.off("end",d),p.kind==="stored")return s(p);o.destroy(),e.resume(),de.promises.unlink(t).catch(()=>{}).then(()=>s(p))}},u=p=>{if(i+=p.length,i>r)return c({kind:"too-large"});o.write(p)||(e.pause(),o.once("drain",()=>{a||e.resume()}))},d=()=>{o.end()};e.on("data",u),e.on("end",d),e.on("error",p=>c({kind:"failed",error:p})),e.on("close",()=>{e.complete||c({kind:"failed",error:new Error("upload aborted")})}),o.on("error",p=>c({kind:"failed",error:p})),o.on("finish",()=>c({kind:"stored",size:i}))})}async function Qi(e,t,r){let n;try{let a=await de.promises.stat(t);if(!a.isFile())throw new Error("not a file");n=a.size}catch{R(e,404,"not-found","File not found");return}let o=it(t),s=le.basename(t);e.writeHead(200,{"Content-Type":at(o),"Content-Length":String(n),"Content-Disposition":`${r}; filename="${s.replace(/"/g,"")}"`,"Cache-Control":"private, max-age=3600","X-Content-Type-Options":"nosniff",...Cd.has(o)?{"Content-Security-Policy":Dd}:{}});let i=de.createReadStream(t);i.on("error",()=>{e.headersSent||e.writeHead(500),e.end()}),i.pipe(e)}function Zi(e,t){try{return new URL(e.url??"","http://localhost").searchParams}catch{return R(t,400,"bad-request","Malformed URL"),null}}function ea(e){let t=e.maxUploadBytes??xd,r=(i,a)=>rr(i,a,413,"too-large",`File exceeds ${t/1024/1024}MB limit`,t),n=async(i,a)=>{if(i.method!=="POST")return q(a,"POST");let c=mr(i,"x-session-id"),u=mr(i,"x-file-name"),d=(mr(i,"content-type")??"application/octet-stream").split(";")[0].trim();if(!c)return R(a,400,"missing-session","X-Session-Id header required");if(!u)return R(a,400,"missing-name","X-File-Name header required");let p=le.resolve(e.attachmentsDir),h=le.resolve(p,c);if(!Id.test(c)||le.dirname(h)!==p)return R(a,400,"bad-session","X-Session-Id is not a session id");if((tr(i)??0)>t)return r(i,a);let m=es(Nd(u));await de.promises.mkdir(h,{recursive:!0});let{destPath:f,finalName:l}=await rs(h,ts(m)),y=await Md(i,f,t);if(y.kind==="too-large")return r(i,a);if(y.kind==="failed")return R(a,500,"upload-failed",y.error.message);I(a,200,{ok:!0,data:{name:m,path:`workspace/attachments/${c}/${l}`,size:y.size,mimeType:d,type:Ud(d)}})},o=async(i,a)=>{let c=Zi(i,a);if(!c)return;let u=(c.get("path")??"").trim(),d=c.get("disposition")==="inline"?"inline":"attachment";if(!u)return R(a,400,"missing-path","path query param required");let p=e.resolveWorkspaceRelPath(u);if(!p)return R(a,403,"forbidden","Path escapes the workspace root");await Qi(a,p,d)},s=async(i,a)=>{let c=Zi(i,a);if(!c)return;let u=(c.get("projectId")??"").trim(),d=(c.get("path")??"").trim(),p=c.get("disposition")==="attachment"?"attachment":"inline";if(!u||!d)return R(a,400,"missing-params","projectId and path query params required");if(!d.startsWith("boards/"))return R(a,403,"forbidden","path must be under boards/");let h=e.projectContextDir(u),m;try{if(!h)throw new Error("unknown project");let f=de.realpathSync(le.join(h,"boards"));m=e.resolveMemoryFilePath(f,d.slice(7))}catch{return R(a,404,"not-found","File not found")}await Qi(a,m,p)};return{[Ad]:n,[Pd]:o,[Od]:s}}import*as sa from"crypto";var Te=D("browser-stream"),Ld="/api/browser/sessions",kd="/api/browser/stream-ticket",ia="/api/browser/stream",Kd="/api/browser/takeover",Hd="/api/browser/insert-text",hr=4004,ta=4010,Wd=3e4,jd=256,Bd=32,Fd=10,Jd=15,$d=16*1024,ra=4e3,Gd=4*1024*1024,zd=5e3,Vd=3e4,Yd=10*6e4,na="cortex_takeover",Xd=/^[A-Za-z0-9_-]{1,64}$/,qd=new Set(["input_mouse","input_keyboard","input_touch"]);function Qd(e,t){let r;try{r=JSON.parse(e)}catch{return null}if(!r||typeof r!="object")return null;let n=r.type;if(n==="ack"){let o=r.seq;return typeof o=="number"&&Number.isFinite(o)?{message:JSON.stringify({type:"ack",seq:o}),input:!1}:null}return typeof n=="string"&&qd.has(n)&&t?{message:e,input:!0}:null}function oa(e){return e==null||e===""?"":typeof e=="string"&&Xd.test(e)?e:null}function Zd(e){let t=Number(e);return!e||!Number.isFinite(t)||t<=0?Fd:Math.min(Jd,Math.max(1,Math.round(t)))}function ef(e){let t;try{t=new URL(e,"http://localhost")}catch{return null}let r=t.searchParams.get("session")??"",n=t.searchParams.get("ticket")??"";return!r||!n?null:{sessionId:r,ticket:n,fps:Zd(t.searchParams.get("maxFps"))}}function tf(e=Date.now){let t=new Map,r=()=>{let n=e();for(let[o,s]of t)s.expiresAt<=n&&t.delete(o)};return{mint(n,o=""){for(r();t.size>=jd;)t.delete(t.keys().next().value);let s=sa.randomBytes(32).toString("hex");return t.set(s,{sessionId:n,client:o,expiresAt:e()+Wd}),s},redeem(n,o){r();let s=null;for(let a of t.keys())ne(a,n)&&(s=a);if(s===null)return null;let i=t.get(s);return t.delete(s),i.sessionId===o?{client:i.client}:null},size:()=>(r(),t.size)}}function rf(e){let t=new Map,r=i=>{i.grace&&clearTimeout(i.grace),i.idle&&clearTimeout(i.idle),i.grace=null,i.idle=null},n=(i,a,c)=>{t.get(i)===a&&(r(a),t.delete(i),e.isTakenOver(i)&&e.release(i,c))},o=(i,a)=>{let c=Math.max(0,a.lastInputAt+e.idleMs-e.now());a.idle=setTimeout(()=>{a.idle=null,e.now()-a.lastInputAt>=e.idleMs?n(i,a,"idle"):o(i,a)},c),a.idle.unref?.()},s=(i,a)=>{a.grace||(a.grace=setTimeout(()=>{a.grace=null,n(i,a,"disconnected")},e.graceMs),a.grace.unref?.())};return{begin(i,a){let c=t.get(i);c&&r(c);let u={client:a,lastInputAt:e.now(),grace:null,idle:null};t.set(i,u),o(i,u),e.hasClient(i,a)||s(i,u)},end(i){let a=t.get(i);a&&(r(a),t.delete(i))},holder:i=>t.get(i)?.client??null,connected(i,a){let c=t.get(i);c?.client===a&&c.grace&&(clearTimeout(c.grace),c.grace=null)},disconnected(i,a){let c=t.get(i);c?.client===a&&!e.hasClient(i,a)&&s(i,c)},input(i){let a=t.get(i);a&&(a.lastInputAt=e.now())},close(){for(let i of t.values())r(i);t.clear()}}}function nf(e){return{sessionId:e.sessionId,device:e.device,state:e.state,...e.error?{error:e.error}:{},...e.url?{url:e.url}:{},...e.title?{title:e.title}:{},takenOver:e.takenOver,lastUsedAt:e.lastUsedAt}}async function yr(e,t,r){if(e.method!=="POST")return q(t,"POST"),null;let n=await ue(e,t);if(!n)return null;let o=typeof n.session=="string"?n.session:"";return o?r.listSessions().some(s=>s.sessionId===o)?{sessionId:o,body:n}:(R(t,404,"no-browser","This session has no browser"),null):(R(t,400,"missing-session","session is required"),null)}function aa(e,t={}){let r=e.now??Date.now,n=tf(r),o=new ct.default({noServer:!0,maxPayload:$d}),s=new Set,i=f=>[...s].filter(l=>l.sessionId===f),a=f=>f.client!==""&&e.isTakenOver(f.sessionId)&&u.holder(f.sessionId)===f.client,c=f=>{for(let l of i(f))l.ws.readyState===ie.default.OPEN&&l.ws.send(JSON.stringify({type:na,takenOver:e.isTakenOver(f),mine:a(l)}))},u=rf({isTakenOver:e.isTakenOver,hasClient:(f,l)=>l!==""&&i(f).some(y=>y.client===l),now:r,graceMs:t.graceMs??Vd,idleMs:t.idleMs??Yd,release:(f,l)=>{(async()=>{try{await e.setTakeover(f,!1)}catch(y){Te.warn(`could not hand ${f} back: ${y.message}`);return}Te.info(`browser handed back automatically (${l==="idle"?"no input":"window gone"}): ${f}`),c(f)})()}}),d={[Ld]:async(f,l)=>{if(f.method!=="GET")return q(l,"GET");I(l,200,{ok:!0,data:{sessions:e.listSessions().map(nf)}},{"Cache-Control":"no-store"})},[kd]:async(f,l)=>{let y=await yr(f,l,e);if(!y)return;let _=oa(y.body.client);if(_===null)return R(l,400,"bad-client","client must be 1-64 letters, digits, _ or -");I(l,200,{ok:!0,data:{ticket:n.mint(y.sessionId,_)}},{"Cache-Control":"no-store"})},[Kd]:async(f,l)=>{let y=await yr(f,l,e);if(!y)return;let _=y.body.on;if(typeof _!="boolean")return R(l,400,"bad-on","on must be a boolean");let w=oa(y.body.client);if(w===null||_&&w==="")return R(l,400,"bad-client","client must be 1-64 letters, digits, _ or -");await e.setTakeover(y.sessionId,_),_?u.begin(y.sessionId,w):u.end(y.sessionId),Te.info(`browser ${_?"taken over":"handed back"}: ${y.sessionId}`),c(y.sessionId),I(l,200,{ok:!0,data:{takenOver:e.isTakenOver(y.sessionId)}})},[Hd]:async(f,l)=>{let y=await yr(f,l,e);if(!y)return;let _=typeof y.body.text=="string"?y.body.text:"";if(!_)return R(l,400,"missing-text","text is required");if(_.length>ra)return R(l,400,"text-too-long",`text exceeds ${ra} characters`);if(!e.isTakenOver(y.sessionId))return R(l,409,"not-taken-over","Take over the browser first");u.input(y.sessionId);try{await e.insertText(y.sessionId,_)}catch(w){return R(l,502,"insert-failed",w.message)}I(l,200,{ok:!0,data:{}})}},p=async(f,l)=>{let{ws:y}=f,_=null;try{_=await e.streamPort(l.sessionId)}catch(E){Te.warn(`stream port lookup failed for ${l.sessionId}: ${E.message}`)}if(y.readyState!==ie.default.OPEN)return;if(_===null){y.close(hr,"no stream");return}let w=new ie.default(`ws://127.0.0.1:${_}/?maxFps=${l.fps}&pacing=ack`,{handshakeTimeout:zd}),g=!1,v=(E,O)=>{(w.readyState===ie.default.OPEN||w.readyState===ie.default.CONNECTING)&&w.terminate(),y.readyState===ie.default.OPEN&&y.close(E,O)};w.on("open",()=>{g=!0}),w.on("message",(E,O)=>{y.readyState===ie.default.OPEN&&(y.bufferedAmount>Gd||y.send(E,{binary:O}))}),w.on("close",()=>v(g?ta:hr,g?"stream ended":"no stream")),w.on("error",E=>{Te.warn(`upstream stream error for ${l.sessionId}: ${E.message}`),v(g?ta:hr,g?"stream ended":"no stream")}),y.on("message",(E,O)=>{if(O||w.readyState!==ie.default.OPEN)return;let k=Qd(E.toString(),a(f));k&&(k.input&&u.input(l.sessionId),w.send(k.message))}),y.on("close",()=>v(1e3,"viewer closed"))};return{routes:d,handleUpgrade:(f,l,y)=>{let _=ef(f.url??""),w=_?n.redeem(_.ticket,_.sessionId):null;if(!_||!w){Te.warn("browser stream refused: missing or invalid ticket"),l.write(`HTTP/1.1 401 Unauthorized\r
|
|
24
|
+
Connection: close\r
|
|
25
|
+
\r
|
|
26
|
+
`),l.destroy();return}if(s.size>=Bd){Te.warn(`browser stream refused (${s.size} already open)`),l.write(`HTTP/1.1 503 Service Unavailable\r
|
|
27
|
+
Connection: close\r
|
|
28
|
+
\r
|
|
29
|
+
`),l.destroy();return}o.handleUpgrade(f,l,y,g=>{let v={ws:g,sessionId:_.sessionId,client:w.client};s.add(v),u.connected(v.sessionId,v.client),g.on("close",()=>{s.delete(v),u.disconnected(v.sessionId,v.client)}),g.on("error",()=>g.terminate()),g.send(JSON.stringify({type:na,takenOver:e.isTakenOver(v.sessionId),mine:a(v)})),p(v,_)})},close:()=>{u.close();for(let f of s)f.ws.terminate();s.clear(),o.close()}}}var tt=new TextEncoder,fe=new TextDecoder,$m=2**32;function ca(...e){let t=e.reduce((o,{length:s})=>o+s,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function bt(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>127)throw new TypeError("non-ASCII string encountered in encode()");t[r]=n}return t}function ua(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function he(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:fe.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=fe.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return ua(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var ye=(e,t="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`),Le=(e,t)=>e.name===t;function of(e){return parseInt(e.name.slice(4),10)}function Sr(e,t){if(of(e.hash)!==t)throw ye(`SHA-${t}`,"algorithm.hash")}function sf(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function af(e,t){if(t&&!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function la(e,t,r){switch(t){case"HS256":case"HS384":case"HS512":{if(!Le(e.algorithm,"HMAC"))throw ye("HMAC");Sr(e.algorithm,parseInt(t.slice(2),10));break}case"RS256":case"RS384":case"RS512":{if(!Le(e.algorithm,"RSASSA-PKCS1-v1_5"))throw ye("RSASSA-PKCS1-v1_5");Sr(e.algorithm,parseInt(t.slice(2),10));break}case"PS256":case"PS384":case"PS512":{if(!Le(e.algorithm,"RSA-PSS"))throw ye("RSA-PSS");Sr(e.algorithm,parseInt(t.slice(2),10));break}case"Ed25519":case"EdDSA":{if(!Le(e.algorithm,"Ed25519"))throw ye("Ed25519");break}case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":{if(!Le(e.algorithm,t))throw ye(t);break}case"ES256":case"ES384":case"ES512":{if(!Le(e.algorithm,"ECDSA"))throw ye("ECDSA");let n=sf(t);if(e.algorithm.namedCurve!==n)throw ye(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}af(e,r)}function da(e,t,...r){if(r=r.filter(Boolean),r.length>2){let n=r.pop();e+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?e+=`one of type ${r[0]} or ${r[1]}.`:e+=`of type ${r[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}var fa=(e,...t)=>da("Key must be ",e,...t),wr=(e,t,...r)=>da(`Key for the ${e} algorithm must be `,t,...r);var G=class extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(t,r){super(t,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},Z=class extends G{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(t,r,n="unspecified",o="unspecified"){super(t,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},rt=class extends G{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(t,r,n="unspecified",o="unspecified"){super(t,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}},_t=class extends G{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"},J=class extends G{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"};var K=class extends G{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"},ke=class extends G{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"};var nt=class extends G{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"},Ke=class extends G{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(t="no applicable key found in the JSON Web Key Set",r){super(t,r)}},Tt=class extends G{[Symbol.asyncIterator];static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(t="multiple matching keys found in the JSON Web Key Set",r){super(t,r)}},Rt=class extends G{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(t="request timed out",r){super(t,r)}},At=class extends G{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(t="signature verification failed",r){super(t,r)}};var Er=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},gr=e=>e?.[Symbol.toStringTag]==="KeyObject",vr=e=>Er(e)||gr(e);function br(e,t,r){try{return he(e)}catch{throw new r(`Failed to base64url decode the ${t}`)}}var cf=e=>typeof e=="object"&&e!==null;function ee(e){if(!cf(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function pa(...e){let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let r;for(let n of t){let o=Object.keys(n);if(!r||r.size===0){r=new Set(o);continue}for(let s of o){if(r.has(s))return!1;r.add(s)}}return!0}var ot=e=>ee(e)&&typeof e.kty=="string",ma=e=>e.kty!=="oct"&&(e.kty==="AKP"&&typeof e.priv=="string"||typeof e.d=="string"),ha=e=>e.kty!=="oct"&&e.d===void 0&&e.priv===void 0,ya=e=>e.kty==="oct"&&typeof e.k=="string";function lf(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:r}=t.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}function df(e,t){let r=`SHA-${e.slice(-3)}`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new J(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}async function ff(e,t,r){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(fa(t,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",t,{hash:`SHA-${e.slice(-3)}`,name:"HMAC"},!1,[r])}return la(t,e,r),t}async function Sa(e,t,r,n){let o=await ff(e,t,"verify");lf(e,o);let s=df(e,o.algorithm);try{return await crypto.subtle.verify(s,o,r,n)}catch{return!1}}var Pt='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';function pf(e){let t,r;switch(e.kty){case"AKP":{switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},r=e.priv?["sign"]:["verify"];break;default:throw new J(Pt)}break}case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},r=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},r=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new J(Pt)}break}case"EC":{switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[e.alg]},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new J(Pt)}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},r=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},r=e.d?["deriveBits"]:[];break;default:throw new J(Pt)}break}default:throw new J('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:r}}async function He(e){if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:r}=pf(e),n={...e};return n.kty!=="AKP"&&delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,t,e.ext??!(e.d||e.priv),e.key_ops??r)}var We="given KeyObject instance cannot be used for this algorithm",je,wa=async(e,t,r,n=!1)=>{je||=new WeakMap;let o=je.get(e);if(o?.[r])return o[r];let s=await He({...t,alg:r});return n&&Object.freeze(e),o?o[r]=s:je.set(e,{[r]:s}),s},mf=(e,t)=>{je||=new WeakMap;let r=je.get(e);if(r?.[t])return r[t];let n=e.type==="public",o=!!n,s;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(We)}s=e.toCryptoKey(e.asymmetricKeyType,o,n?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError(We);s=e.toCryptoKey(e.asymmetricKeyType,o,[n?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":{if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(We);s=e.toCryptoKey(e.asymmetricKeyType,o,[n?"verify":"sign"])}}if(e.asymmetricKeyType==="rsa"){let i;switch(t){case"RSA-OAEP":i="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":i="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":i="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":i="SHA-512";break;default:throw new TypeError(We)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:i},o,n?["encrypt"]:["decrypt"]);s=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:i},o,[n?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){let a=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!a)throw new TypeError(We);let c={ES256:"P-256",ES384:"P-384",ES512:"P-521"};c[t]&&a===c[t]&&(s=e.toCryptoKey({name:"ECDSA",namedCurve:a},o,[n?"verify":"sign"])),t.startsWith("ECDH-ES")&&(s=e.toCryptoKey({name:"ECDH",namedCurve:a},o,n?[]:["deriveBits"]))}if(!s)throw new TypeError(We);return r?r[t]=s:je.set(e,{[t]:s}),s};async function Ea(e,t){if(e instanceof Uint8Array||Er(e))return e;if(gr(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return mf(e,t)}catch(n){if(n instanceof TypeError)throw n}let r=e.export({format:"jwk"});return wa(e,r,t)}if(ot(e))return e.k?he(e.k):wa(e,e,t,!0);throw new Error("unreachable")}async function ga(e,t,r){if(!ee(e))throw new TypeError("JWK must be an object");let n;switch(t??=e.alg,n??=r?.extractable??e.ext,e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return he(e.k);case"RSA":if("oth"in e&&e.oth!==void 0)throw new J('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return He({...e,alg:t,ext:n});case"AKP":{if(typeof e.alg!="string"||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(t!==void 0&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return He({...e,ext:n})}case"EC":case"OKP":return He({...e,alg:t,ext:n});default:throw new J('Unsupported "kty" (Key Type) Parameter value')}}function va(e,t,r,n,o){if(o.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(i=>typeof i!="string"||i.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;r!==void 0?s=new Map([...Object.entries(r),...t.entries()]):s=t;for(let i of n.crit){if(!s.has(i))throw new J(`Extension Header Parameter "${i}" is not recognized`);if(o[i]===void 0)throw new e(`Extension Header Parameter "${i}" is missing`);if(s.get(i)&&n[i]===void 0)throw new e(`Extension Header Parameter "${i}" MUST be integrity protected`)}return new Set(n.crit)}function ba(e,t){if(t!==void 0&&(!Array.isArray(t)||t.some(r=>typeof r!="string")))throw new TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}var Be=e=>e?.[Symbol.toStringTag],_r=(e,t,r)=>{if(t.use!==void 0){let n;switch(r){case"sign":case"verify":n="sig";break;case"encrypt":case"decrypt":n="enc";break}if(t.use!==n)throw new TypeError(`Invalid key for this operation, its "use" must be "${n}" when present`)}if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let n;switch(!0){case(r==="sign"||r==="verify"):case e==="dir":case e.includes("CBC-HS"):n=r;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?n=r==="encrypt"?"wrapKey":"unwrapKey":n=r;break;case(r==="encrypt"&&e.startsWith("RSA")):n="wrapKey";break;case r==="decrypt":n=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(n&&t.key_ops?.includes?.(n)===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${n}" when present`)}return!0},hf=(e,t,r)=>{if(!(t instanceof Uint8Array)){if(ot(t)){if(ya(t)&&_r(e,t,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!vr(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${Be(t)} instances for symmetric algorithms must be of type "secret"`)}},yf=(e,t,r)=>{if(ot(t))switch(r){case"decrypt":case"sign":if(ma(t)&&_r(e,t,r))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if(ha(t)&&_r(e,t,r))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!vr(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${Be(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(r){case"sign":throw new TypeError(`${Be(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${Be(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(r){case"verify":throw new TypeError(`${Be(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${Be(t)} instances for asymmetric algorithm encryption must be of type "public"`)}};function _a(e,t,r){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":hf(e,t,r);break;default:yf(e,t,r)}}async function Ta(e,t,r){if(!ee(e))throw new K("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new K('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new K("JWS Protected Header incorrect type");if(e.payload===void 0)throw new K("JWS Payload missing");if(typeof e.signature!="string")throw new K("JWS Signature missing or incorrect type");if(e.header!==void 0&&!ee(e.header))throw new K("JWS Unprotected Header incorrect type");let n={};if(e.protected)try{let y=he(e.protected);n=JSON.parse(fe.decode(y))}catch{throw new K("JWS Protected Header is invalid")}if(!pa(n,e.header))throw new K("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...n,...e.header},s=va(K,new Map([["b64",!0]]),r?.crit,n,o),i=!0;if(s.has("b64")&&(i=n.b64,typeof i!="boolean"))throw new K('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:a}=o;if(typeof a!="string"||!a)throw new K('JWS "alg" (Algorithm) Header Parameter missing or invalid');let c=r&&ba("algorithms",r.algorithms);if(c&&!c.has(a))throw new _t('"alg" (Algorithm) Header Parameter value not allowed');if(i){if(typeof e.payload!="string")throw new K("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new K("JWS Payload must be a string or an Uint8Array instance");let u=!1;typeof t=="function"&&(t=await t(n,e),u=!0),_a(a,t,"verify");let d=ca(e.protected!==void 0?bt(e.protected):new Uint8Array,bt("."),typeof e.payload=="string"?i?bt(e.payload):tt.encode(e.payload):e.payload),p=br(e.signature,"signature",K),h=await Ea(t,a);if(!await Sa(a,h,p,d))throw new At;let f;i?f=br(e.payload,"payload",K):typeof e.payload=="string"?f=tt.encode(e.payload):f=e.payload;let l={payload:f};return e.protected!==void 0&&(l.protectedHeader=n),e.header!==void 0&&(l.unprotectedHeader=e.header),u?{...l,key:h}:l}async function Ra(e,t,r){if(e instanceof Uint8Array&&(e=fe.decode(e)),typeof e!="string")throw new K("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:s,length:i}=e.split(".");if(i!==3)throw new K("Invalid Compact JWS");let a=await Ta({payload:o,protected:n,signature:s},t,r),c={payload:a.payload,protectedHeader:a.protectedHeader};return typeof t=="function"?{...c,key:a.key}:c}var Sf=e=>Math.floor(e.getTime()/1e3),Oa=60,xa=Oa*60,Tr=xa*24,wf=Tr*7,Ef=Tr*365.25,gf=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Aa(e){let t=gf.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");let r=parseFloat(t[2]),n=t[3].toLowerCase(),o;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(r*Oa);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(r*xa);break;case"day":case"days":case"d":o=Math.round(r*Tr);break;case"week":case"weeks":case"w":o=Math.round(r*wf);break;default:o=Math.round(r*Ef);break}return t[1]==="-"||t[4]==="ago"?-o:o}var Pa=e=>e.includes("/")?e.toLowerCase():`application/${e.toLowerCase()}`,vf=(e,t)=>typeof e=="string"?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;function Ia(e,t,r={}){let n;try{n=JSON.parse(fe.decode(t))}catch{}if(!ee(n))throw new ke("JWT Claims Set must be a top-level JSON object");let{typ:o}=r;if(o&&(typeof e.typ!="string"||Pa(e.typ)!==Pa(o)))throw new Z('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:s=[],issuer:i,subject:a,audience:c,maxTokenAge:u}=r,d=[...s];u!==void 0&&d.push("iat"),c!==void 0&&d.push("aud"),a!==void 0&&d.push("sub"),i!==void 0&&d.push("iss");for(let f of new Set(d.reverse()))if(!(f in n))throw new Z(`missing required "${f}" claim`,n,f,"missing");if(i&&!(Array.isArray(i)?i:[i]).includes(n.iss))throw new Z('unexpected "iss" claim value',n,"iss","check_failed");if(a&&n.sub!==a)throw new Z('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!vf(n.aud,typeof c=="string"?[c]:c))throw new Z('unexpected "aud" claim value',n,"aud","check_failed");let p;switch(typeof r.clockTolerance){case"string":p=Aa(r.clockTolerance);break;case"number":p=r.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:h}=r,m=Sf(h||new Date);if((n.iat!==void 0||u)&&typeof n.iat!="number")throw new Z('"iat" claim must be a number',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new Z('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new Z('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new Z('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new rt('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){let f=m-n.iat,l=typeof u=="number"?u:Aa(u);if(f-p>l)throw new rt('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(f<0-p)throw new Z('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}async function Rr(e,t,r){let n=await Ra(e,t,r);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new ke("JWTs MUST NOT use unencoded payload");let s={payload:Ia(n.protectedHeader,n.payload,r),protectedHeader:n.protectedHeader};return typeof t=="function"?{...s,key:n.key}:s}function bf(e){switch(typeof e=="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new J('Unsupported "alg" value for a JSON Web Key Set')}}function _f(e){return e&&typeof e=="object"&&Array.isArray(e.keys)&&e.keys.every(Tf)}function Tf(e){return ee(e)}var Ar=class{#r;#i=new WeakMap;constructor(t){if(!_f(t))throw new nt("JSON Web Key Set malformed");this.#r=structuredClone(t)}jwks(){return this.#r}async getKey(t,r){let{alg:n,kid:o}={...t,...r?.header},s=bf(n),i=this.#r.keys.filter(u=>{let d=s===u.kty;if(d&&typeof o=="string"&&(d=o===u.kid),d&&(typeof u.alg=="string"||s==="AKP")&&(d=n===u.alg),d&&typeof u.use=="string"&&(d=u.use==="sig"),d&&Array.isArray(u.key_ops)&&(d=u.key_ops.includes("verify")),d)switch(n){case"ES256":d=u.crv==="P-256";break;case"ES384":d=u.crv==="P-384";break;case"ES512":d=u.crv==="P-521";break;case"Ed25519":case"EdDSA":d=u.crv==="Ed25519";break}return d}),{0:a,length:c}=i;if(c===0)throw new Ke;if(c!==1){let u=new Tt,d=this.#i;throw u[Symbol.asyncIterator]=async function*(){for(let p of i)try{yield await Ca(d,p,n)}catch{}},u}return Ca(this.#i,a,n)}};async function Ca(e,t,r){let n=e.get(t)||e.set(t,{}).get(t);if(n[r]===void 0){let o=await ga({...t,ext:!0},r);if(o instanceof Uint8Array||o.type!=="public")throw new nt("JSON Web Key Set members must be public keys");n[r]=o}return n[r]}function Pr(e){let t=new Ar(e),r=async(n,o)=>t.getKey(n,o);return Object.defineProperties(r,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),r}function Rf(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var Or;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(Or="jose/v6.2.3");var Da=Symbol();async function Af(e,t,r,n=fetch){let o=await n(e,{method:"GET",signal:r,redirect:"manual",headers:t}).catch(s=>{throw s.name==="TimeoutError"?new Rt:s});if(o.status!==200)throw new G("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new G("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var Ot=Symbol();function Pf(e,t){return!(typeof e!="object"||e===null||!("uat"in e)||typeof e.uat!="number"||Date.now()-e.uat>=t||!("jwks"in e)||!ee(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,ee))}var xr=class{#r;#i;#c;#a;#n;#e;#t;#u;#o;#s;constructor(t,r){if(!(t instanceof URL))throw new TypeError("url must be an instance of URL");this.#r=new URL(t.href),this.#i=typeof r?.timeoutDuration=="number"?r?.timeoutDuration:5e3,this.#c=typeof r?.cooldownDuration=="number"?r?.cooldownDuration:3e4,this.#a=typeof r?.cacheMaxAge=="number"?r?.cacheMaxAge:6e5,this.#t=new Headers(r?.headers),Or&&!this.#t.has("User-Agent")&&this.#t.set("User-Agent",Or),this.#t.has("accept")||(this.#t.set("accept","application/json"),this.#t.append("accept","application/jwk-set+json")),this.#u=r?.[Da],r?.[Ot]!==void 0&&(this.#s=r?.[Ot],Pf(r?.[Ot],this.#a)&&(this.#n=this.#s.uat,this.#o=Pr(this.#s.jwks)))}pendingFetch(){return!!this.#e}coolingDown(){return typeof this.#n=="number"?Date.now()<this.#n+this.#c:!1}fresh(){return typeof this.#n=="number"?Date.now()<this.#n+this.#a:!1}jwks(){return this.#o?.jwks()}async getKey(t,r){(!this.#o||!this.fresh())&&await this.reload();try{return await this.#o(t,r)}catch(n){if(n instanceof Ke&&this.coolingDown()===!1)return await this.reload(),this.#o(t,r);throw n}}async reload(){this.#e&&Rf()&&(this.#e=void 0),this.#e||=Af(this.#r.href,this.#t,AbortSignal.timeout(this.#i),this.#u).then(t=>{this.#o=Pr(t),this.#s&&(this.#s.uat=Date.now(),this.#s.jwks=t),this.#n=Date.now(),this.#e=void 0}).catch(t=>{throw this.#e=void 0,t}),await this.#e}};function Ir(e,t){let r=new xr(e,t),n=async(o,s)=>r.getKey(o,s);return Object.defineProperties(n,{coolingDown:{get:()=>r.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>r.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>r.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>r.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>r.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}var Of=D("ui-http"),xf=["RS256","ES256"];function If(e){let t=Ir(new URL(e.jwksUrl));return async r=>{try{return await Rr(r,t,{audience:e.audience,issuer:e.issuer,algorithms:xf}),!0}catch{return!1}}}function Cf(e){let t=e.trim().replace(/^https?:\/\//,"").replace(/\/+$/,"");return t.includes(".")?t:`${t}.cloudflareaccess.com`}function Na(e){let t=(e.CORTEX_ACCESS_TEAM_DOMAIN||"").trim(),r=(e.CORTEX_ACCESS_AUD||"").trim();if(!t||!r)return;let o=`https://${Cf(t)}`,s=(e.CORTEX_ACCESS_CERTS_URL||"").trim()||`${o}/cdn-cgi/access/certs`;return Of.info(`Cloudflare Access JWT verification enabled (iss: ${o})`),If({jwksUrl:s,audience:r,issuer:o})}var Nf=D("ui-http"),Uf=3004,Mf=oe.join(st,"ui-sessions.json"),Lf=oe.join(st,"ui-devices.json");function kf(e){let t=(e.CORTEX_UI_TOKEN_LOGIN??"").trim().toLowerCase();return!(t==="0"||t==="false"||t==="off"||t==="no")}function Ua(e){let t=Number((e.CORTEX_UI_SESSION_TTL_DAYS??"").trim());return Number.isFinite(t)&&t>0?t*24*60*60*1e3:sr}function Kf(){try{let e=oe.dirname(Df(new URL("dist/entry/start-ui-http.js",__cortexPackageRoot).href));return[oe.resolve(e,"../../web/dist"),oe.resolve(e,"../../../web/dist")].find(r=>Ma.existsSync(r))}catch{return}}function Hf(e,t,r){let n=kf(e),o=Ki({file:Lf}),s=p=>o.match(p)!==void 0,i=n?Ti({file:Mf,ttlMs:Ua(e)}):void 0,a=n?qo({file:oe.join(st,Yo)}):void 0,u=Ni({getToken:t,matchDeviceToken:s,verifySession:i?p=>i.verify(p):void 0,verifyAccessJwt:r}),d=i&&a?xi({store:i,getToken:t,authorize:u,ttlMs:Ua(e),redeemCode:p=>a.redeem(p)}):Ii(u);return{authorize:u,matchDeviceToken:s,tokenLogin:n,publicRoutes:n?[ar,qe,dr]:[qe],routes:{...d,...Mi({devices:o,pairing:a})}}}function Wy(e){let t=e.env??process.env;if(!hs(t))return null;let r=parseInt(t.CORTEX_UI_PORT??"",10),n=Number.isNaN(r)?Uf:r,o=js(e.uiService),s=e.corsOrigins??(()=>kr().uiCorsOrigins),i=typeof s=="function"?s():s,a=e.spaDir??t.CORTEX_UI_SPA_DIR??Kf(),c=Na(t),u=e.getToken??Vo,d=Hf(t,u,c),{authorize:p,tokenLogin:h}=d,m=aa({listSessions:cs,streamPort:us,setTakeover:ls,isTakenOver:ds,insertText:fs});return Nf.info(`Web UI enabled \u2014 starting tRPC HTTP+SSE on 127.0.0.1:${n}`+(a?` (SPA: ${a})`:" (SPA: not built \u2014 non-tRPC paths 404)")+(i.length>0?` (CORS allow-list: ${i.join(", ")})`:"")+(c?" (Cloudflare Access JWT path enabled)":"")+(h?" (browser token login enabled)":" (browser token login disabled)")),Ui({router:o,getToken:u,matchDeviceToken:d.matchDeviceToken,port:n,host:"127.0.0.1",spaDir:a,corsOrigins:s,authorize:p,createContext:f=>({client:ys(f.headers[Wr])}),publicRoutes:d.publicRoutes,customRoutes:{...d.routes,...ea({attachmentsDir:oe.join(Mr,"attachments"),resolveWorkspaceRelPath:Lr,projectContextDir:f=>ps.get(f)?.contextDir,resolveMemoryFilePath:ms}),...zi(a),...Yi({devMode:Zo()}),...Ei(),...qi({listDevices:ns,runOnDevice:async(f,l)=>{let y=await os(f,{action:"bash",params:{command:l},timeout:1e4});return typeof y?.stdout=="string"?y.stdout:""},openDevicePort:ss,closeDevicePort:is,listDevicePorts:as}),...m.routes},upgradeRoutes:{[ia]:m},portForward:t.CORTEX_PORT_FORWARD!=="0"})}export{Wy as startUiHttpServer};
|
|
30
|
+
/*! Bundled license information:
|
|
31
|
+
|
|
32
|
+
@trpc/server/dist/resolveResponse-CdASWfAV.mjs:
|
|
33
|
+
(* istanbul ignore if -- @preserve *)
|
|
34
|
+
(*!
|
|
35
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
38
|
+
* Released under the MIT License.
|
|
39
|
+
*)
|
|
40
|
+
|
|
41
|
+
@trpc/server/dist/resolveResponse-CdASWfAV.mjs:
|
|
42
|
+
(* istanbul ignore if -- @preserve *)
|
|
43
|
+
*/
|
|
@@ -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 _,d as y}from"./chunk-TAWLERZA.js";import{a as g,b as m,c as b,e as f,f as l,g as h}from"./chunk-CQLH4UVX.js";import{c as w}from"./chunk-LMSQZ6TQ.js";import"./chunk-JERCOLY3.js";import"./chunk-OKRK6JPY.js";import"./chunk-OE4KH3NJ.js";import"./chunk-5M4PFLRW.js";import"./chunk-KRXTI4JO.js";import{J as r}from"./chunk-DPQPXBTP.js";import"./chunk-NAA7GF6Q.js";import"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";var $=40*1e3,F=1800*1e3,E=1500*1e3;function k(t){return{model:r.string().optional().describe(t.model),backend:r.enum(["claude","pi"]).optional().describe(t.backend),clean:r.boolean().optional().describe(m),files:r.array(r.string()).optional().describe(b)}}function I(t){let e=r.object({description:r.string().describe("Short description of the delegated task."),prompt:r.string().describe("Complete task prompt for the subagent."),subagent_type:r.string().describe(t.subagentType),...k(t)});return{description:r.string().optional().describe("Short description for single mode."),prompt:r.string().optional().describe("Complete prompt for single mode."),subagent_type:r.string().optional().describe(t.subagentTypeSingle),...k(t),parallel:r.array(e).min(1).max(8).optional().describe("Tasks to execute concurrently."),chain:r.array(e).min(1).max(8).optional().describe("Tasks to execute sequentially; {previous} inserts the prior output."),run_in_background:r.boolean().optional().describe("Return agent_id immediately; results arrive later. Default: wait for completion.")}}function R(t){let e=f(t);try{return l({roles:h(w()),models:e})}catch{return l({models:e})}}async function d(t,e,n,i){let{body:o}=await _("POST",`${t.webhookBaseUrl}/webhook/subagent`,{action:e,sessionId:t.sessionId,...n},y(t),i);if(!o?.success)throw new Error(o?.error||`subagent ${e} failed`);return o.data}async function N(t,e){try{await d(t,"detach",{runId:e})}catch{}}function u(t,e=!1){return{content:[{type:"text",text:t}],...e?{isError:!0}:{}}}function D(t,e){let n=t?._meta?.progressToken,i=t?.sendNotification;return n===void 0||!i?()=>{}:o=>{try{Promise.resolve(i({method:"notifications/progress",params:{progressToken:n,progress:o,message:`agent ${e} still running`}})).catch(()=>{})}catch{}}}async function C(t,e,n=()=>{}){let i=Date.now()+E;for(let o=1;;o++){let s=await d(t,"wait",{runId:e},$);if(s.status!=="running")return s;if(Date.now()>=i)return{...s,timedOut:!0};n(o)}}function U(t,e){if(t.timedOut){let n=Math.round(E/6e4);return{text:`Agent ${e} passed the ${n}-minute foreground limit and now runs in the background: it keeps going, and its result will be delivered to you when it lands. Stop it with agent_stop("${e}") if it is no longer useful.`,isError:!1}}return t.status==="completed"?{text:t.text??"(no output)",isError:!1}:t.status==="stopped"?{text:`Agent ${e} was stopped.`,isError:!0}:{text:`Agent ${e} failed: ${t.error??"unknown error"}`,isError:!0}}function G(t,e){let n=R(e),i=I(n);t.tool("agent",g+n.catalog,i,async(o,s)=>{try{let{run_in_background:c,...T}=o,a=await d(e,"start",{params:T,background:!!c,cwd:process.cwd(),selection:e.selection,project:e.project,channel:e.channel,backend:e.backend});if(c)return u(`Agent ${a.id} started in the background. Its result will be delivered to you when it is ready. Stop it early with agent_stop("${a.id}").`);let p=await C(e,a.id,D(s,a.id));p.timedOut&&await N(e,a.id);let{text:A,isError:O}=U(p,a.id);return u(A,O)}catch(c){return u(`agent error: ${c.message}`,!0)}}),t.tool("agent_stop","Stop a subagent and discard its output; not for collecting results.",{agent_id:r.string().describe("The agent_id returned when the subagent was started.")},async({agent_id:o})=>{try{let s=await d(e,"stop",{runId:o});return u(`Agent ${s.id} is now ${s.status}.`)}catch(s){return u(`agent_stop error: ${s.message}`,!0)}})}export{F as CLIENT_IDLE_FLOOR_MS,E as FOREGROUND_DEADLINE_MS,$ as WAIT_REQUEST_TIMEOUT_MS,G as registerSubagentTools};
|
|
@@ -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"./chunk-KRXTI4JO.js";import{J as a}from"./chunk-DPQPXBTP.js";import"./chunk-WHC7AYZD.js";function d(i,n){let o=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short",timeZoneName:"shortOffset"}).formatToParts(i),e=c=>o.find(l=>l.type===c)?.value??"",t=`${e("year")}-${e("month")}-${e("day")}`,s=`${e("hour")==="24"?"00":e("hour")}:${e("minute")}:${e("second")}`,m=e("timeZoneName").replace(/^GMT/,"UTC");return{timezone:n,local:`${t} ${s}`,offset:m,weekday:e("weekday")}}function f(i){i.tool("current_time","Get current Unix milliseconds, UTC ISO date, and local date/time with UTC offset.",{timezone:a.string().optional().describe("IANA timezone, e.g. America/Denver or UTC. Default: server local timezone.")},{readOnlyHint:!0},async({timezone:n})=>{let o=new Date,e=n||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";try{let t=d(o,e),r={timezone:t.timezone,local:t.local,weekday:t.weekday,offset:t.offset,iso_utc:o.toISOString(),unix_ms:o.getTime()};return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(t){return{content:[{type:"text",text:`Invalid timezone "${e}": ${t.message}. Use an IANA name like "Asia/Shanghai" or "UTC".`}],isError:!0}}})}export{f as registerTimeTools};
|
|
@@ -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{s as a,t as b}from"./chunk-DHSA5ACV.js";import"./chunk-KIU5FAPY.js";import"./chunk-B3XBQEFM.js";import"./chunk-Y6ZEVVL5.js";import"./chunk-CQLH4UVX.js";import"./chunk-3F6WW7HR.js";import"./chunk-FOQ7VLIL.js";import"./chunk-YG7OEPR2.js";import"./chunk-7MU2AKNM.js";import"./chunk-LMSQZ6TQ.js";import"./chunk-JERCOLY3.js";import"./chunk-OKRK6JPY.js";import"./chunk-BGVHA2D4.js";import"./chunk-OE4KH3NJ.js";import"./chunk-5M4PFLRW.js";import"./chunk-MEPASGPP.js";import"./chunk-STUHNKQS.js";import"./chunk-DPQPXBTP.js";import"./chunk-Q4UGYGU5.js";import"./chunk-W5LGYSPZ.js";import"./chunk-NAA7GF6Q.js";import"./chunk-J5DVLUKY.js";import"./chunk-WHC7AYZD.js";export{a as childExtensions,b as installToolShims};
|
|
@@ -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 s}from"./chunk-E6BYRULL.js";import{a as r}from"./chunk-KGJZAYQD.js";import"./chunk-23PRJECN.js";import"./chunk-FF7UELTU.js";import"./chunk-PZMGBKUR.js";import"./chunk-D6VMBA4C.js";import"./chunk-K4NTZEDJ.js";import"./chunk-6AKUD3CF.js";import"./chunk-OSEIQ7SS.js";import"./chunk-CXT5IR5T.js";import"./chunk-WHC7AYZD.js";var n={api:"typesafe-system-one",label:"System One API",detectCompat:e=>e.provider==="openrouter"||e.baseUrl.includes("openrouter.ai")?{imageInput:"state-image-urls",sendImageOptInHeader:!1}:{imageInput:"assets",sendImageOptInHeader:!0},url:e=>new URL("systemone",`${e.baseUrl.replace(/\/+$/u,"")}/`),payload:(e,t)=>({model:e.id,...t}),output:e=>{if(!r(e))throw new Error("System One API returned an unexpected response");return e}},m=(e,t,a)=>s(n,e,t,a);export{m as classify};
|
|
@@ -0,0 +1,5 @@
|
|
|
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 c}from"./chunk-TURBFBYN.js";import{a as i,d as a,e as d}from"./chunk-TAWLERZA.js";import"./chunk-CQLH4UVX.js";import"./chunk-OKRK6JPY.js";import"./chunk-OE4KH3NJ.js";import"./chunk-KRXTI4JO.js";import{J as s}from"./chunk-DPQPXBTP.js";import"./chunk-WHC7AYZD.js";var b="Open a board: a live HTML status page shown in the Web UI, worth it when you dispatch several workers or the task spans many turns or hours. Give `title` to create one, or `board` (id or slug) to attach to an existing one. Binds this session, and your active workers that have no board yet if you lead a team. Returns the board directory.";async function l(o,e){let r=d(o);if(!r)throw new Error("No web session in context \u2014 boards are only available in Web UI sessions");let{body:t}=await i("POST",`${o.webhookBaseUrl}/webhook/board`,{sessionId:r,...e},a(o));if(!t?.success)throw new Error(t?.error||`board ${String(e.action)} failed`);return t.data}function h(o,e=!1){return{content:[{type:"text",text:o}],...e?{isError:!0}:{}}}function u(o){let e=o.bound.length-1;return[c(o),`Board directory: ${o.dir}`,`Edit ${o.dir}/board.html (body content only); put images in ${o.dir}/assets/.`,e>0?`Bound this session and ${e} worker(s).`:"Bound this session.","Write with the preset classes from the board skill; the scaffold has an example of every component."].join(`
|
|
5
|
+
`)}function y(o,e){o.tool("board_open",b,{title:s.string().optional().describe("Title of a new board."),board:s.string().optional().describe("Id or slug of an existing board.")},async({title:r,board:t})=>{try{if(!!r?.trim()==!!t?.trim())throw new Error("give exactly one of title or board");let n=await l(e,{action:"open",...r?.trim()?{title:r}:{board:t}});return h(u(n))}catch(n){return h(`board_open failed: ${n.message}`,!0)}})}export{u as openedText,y as registerUiBoardTools};
|