@cortex-agent/server 2026.10.25 → 2026.10.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -5
- package/THIRD_PARTY_NOTICES.txt +16546 -0
- package/defaults/prompts/clean-workspace.md +21 -0
- package/dist/agent-adapter/claude/remote-mcp-proxy.js +4 -66
- package/dist/chunks/anthropic-SUZWKBRW.js +4 -0
- package/dist/chunks/anthropic-messages-M3SMXACA.js +8 -0
- package/dist/chunks/api-GM53PHIL-GFHEXXE6.js +4 -0
- package/dist/chunks/azure-openai-responses-76YWXHSB.js +4 -0
- package/dist/chunks/bedrock-converse-stream-5UPX4NTQ.js +58 -0
- package/dist/chunks/child-runner-3GHOWGZP.js +4 -0
- package/dist/chunks/chunk-23PRJECN.js +4 -0
- package/dist/chunks/chunk-2ZNLUY2U.js +128 -0
- package/dist/chunks/chunk-3F6WW7HR.js +13 -0
- package/dist/chunks/chunk-3OKHUVEM.js +7 -0
- package/dist/chunks/chunk-3TGQSGG4.js +8 -0
- package/dist/chunks/chunk-3THJYAEF.js +4 -0
- package/dist/chunks/chunk-3YHOCPQU.js +10 -0
- package/dist/chunks/chunk-4EX2JJWB.js +4 -0
- package/dist/chunks/chunk-4LLH5OWM.js +10 -0
- package/dist/chunks/chunk-4U7XXM4W.js +4 -0
- package/dist/chunks/chunk-52T37Y47.js +8 -0
- package/dist/chunks/chunk-5M4PFLRW.js +4 -0
- package/dist/chunks/chunk-5NRGVROY.js +4 -0
- package/dist/chunks/chunk-5T7IX5KN.js +4 -0
- package/dist/chunks/chunk-6AKUD3CF.js +4 -0
- package/dist/chunks/chunk-6LZK4DDH.js +4 -0
- package/dist/chunks/chunk-6R73ICDB.js +4 -0
- package/dist/chunks/chunk-7MU2AKNM.js +4 -0
- package/dist/chunks/chunk-A34TDMIC.js +7 -0
- package/dist/chunks/chunk-AAA3UBIS.js +4 -0
- package/dist/chunks/chunk-ASYQHJVQ.js +9 -0
- package/dist/chunks/chunk-AWFUHWQK.js +4 -0
- package/dist/chunks/chunk-B3XBQEFM.js +4 -0
- package/dist/chunks/chunk-BGVHA2D4.js +4 -0
- package/dist/chunks/chunk-BGYR4ID3.js +4 -0
- package/dist/chunks/chunk-BKHDWCRT.js +79 -0
- package/dist/chunks/chunk-BR7A5SWM.js +23 -0
- package/dist/chunks/chunk-CQLH4UVX.js +4 -0
- package/dist/chunks/chunk-CVC66CFV.js +33 -0
- package/dist/chunks/chunk-CXT5IR5T.js +4 -0
- package/dist/chunks/chunk-D3NXKK2L.js +4 -0
- package/dist/chunks/chunk-D6UA4BZC.js +19 -0
- package/dist/chunks/chunk-D6VMBA4C.js +4 -0
- package/dist/chunks/chunk-DGMNI4AO.js +4 -0
- package/dist/chunks/chunk-DHSA5ACV.js +125 -0
- package/dist/chunks/chunk-DPQPXBTP.js +68 -0
- package/dist/chunks/chunk-DQJ6LLAS.js +4 -0
- package/dist/chunks/chunk-DXBSQXJL.js +18 -0
- package/dist/chunks/chunk-E6BYRULL.js +4 -0
- package/dist/chunks/chunk-E7ZMYIY6.js +30 -0
- package/dist/chunks/chunk-EQIMHXC4.js +5 -0
- package/dist/chunks/chunk-EQITBTJC.js +10 -0
- package/dist/chunks/chunk-EXJA5RIX.js +357 -0
- package/dist/chunks/chunk-FF7UELTU.js +4 -0
- package/dist/chunks/chunk-FH74NME3.js +115 -0
- package/dist/chunks/chunk-FOJQXLL2.js +6 -0
- package/dist/chunks/chunk-FOQ7VLIL.js +17 -0
- package/dist/chunks/chunk-FX6MOGLR.js +11 -0
- package/dist/chunks/chunk-FXDIR3SQ.js +4 -0
- package/dist/chunks/chunk-G2V65UBA.js +4 -0
- package/dist/chunks/chunk-H2FP6DG4.js +5 -0
- package/dist/chunks/chunk-HALUQ7ZF.js +4 -0
- package/dist/chunks/chunk-HGPBHTVD.js +6 -0
- package/dist/chunks/chunk-HU6UIDEJ.js +6 -0
- package/dist/chunks/chunk-I6OPDRVF.js +4 -0
- package/dist/chunks/chunk-ILEML5IP.js +4 -0
- package/dist/chunks/chunk-IRWZ7UPF.js +77 -0
- package/dist/chunks/chunk-J5DVLUKY.js +6 -0
- package/dist/chunks/chunk-JERCOLY3.js +142 -0
- package/dist/chunks/chunk-JW2HFMTF.js +4 -0
- package/dist/chunks/chunk-JXFG66UN.js +4 -0
- package/dist/chunks/chunk-K4NTZEDJ.js +4 -0
- package/dist/chunks/chunk-KDYEGGMW.js +4 -0
- package/dist/chunks/chunk-KENCMLRE.js +4 -0
- package/dist/chunks/chunk-KGJZAYQD.js +4 -0
- package/dist/chunks/chunk-KIGMAATV.js +23 -0
- package/dist/chunks/chunk-KIU5FAPY.js +5 -0
- package/dist/chunks/chunk-KIWMQPH7.js +739 -0
- package/dist/chunks/chunk-KRXTI4JO.js +3 -0
- package/dist/chunks/chunk-L6VCIGWS.js +11 -0
- package/dist/chunks/chunk-LACGULCN.js +10 -0
- package/dist/chunks/chunk-LCKVYFMD.js +4 -0
- package/dist/chunks/chunk-LEUENXI2.js +6 -0
- package/dist/chunks/chunk-LMDWRRX4.js +4 -0
- package/dist/chunks/chunk-LMSQZ6TQ.js +4 -0
- package/dist/chunks/chunk-MEPASGPP.js +6 -0
- package/dist/chunks/chunk-MFAEUHMV.js +28 -0
- package/dist/chunks/chunk-N6BTQN7R.js +8 -0
- package/dist/chunks/chunk-NAA7GF6Q.js +5 -0
- package/dist/chunks/chunk-NHD2ESHA.js +4 -0
- package/dist/chunks/chunk-NKDMKRSB.js +68 -0
- package/dist/chunks/chunk-NKXV32S6.js +4 -0
- package/dist/chunks/chunk-NR6U3WIZ.js +4 -0
- package/dist/chunks/chunk-NT32UURL.js +4 -0
- package/dist/chunks/chunk-NVX5IPRN.js +4 -0
- package/dist/chunks/chunk-O3JW2F7D.js +8 -0
- package/dist/chunks/chunk-OE4KH3NJ.js +4 -0
- package/dist/chunks/chunk-OISO5JXB.js +4 -0
- package/dist/chunks/chunk-OKRK6JPY.js +4 -0
- package/dist/chunks/chunk-OPYXNSMY.js +4 -0
- package/dist/chunks/chunk-OSEIQ7SS.js +4 -0
- package/dist/chunks/chunk-OZGBWAT2.js +4 -0
- package/dist/chunks/chunk-P52RMIYX.js +6 -0
- package/dist/chunks/chunk-PBJ5MPPX.js +60 -0
- package/dist/chunks/chunk-PFMEUFJ7.js +4 -0
- package/dist/chunks/chunk-PMG4YGDU.js +7 -0
- package/dist/chunks/chunk-PXS5SHOV.js +4 -0
- package/dist/chunks/chunk-PZMGBKUR.js +13 -0
- package/dist/chunks/chunk-PZMXHA6X.js +9 -0
- package/dist/chunks/chunk-Q4UGYGU5.js +4 -0
- package/dist/chunks/chunk-Q7CE3UIE.js +133 -0
- package/dist/chunks/chunk-QBKCAIJG.js +4 -0
- package/dist/chunks/chunk-QEOFEETJ.js +4 -0
- package/dist/chunks/chunk-QN44UXQR.js +11 -0
- package/dist/chunks/chunk-QUUEQRIT.js +4 -0
- package/dist/chunks/chunk-QWAQHHRS.js +4 -0
- package/dist/chunks/chunk-RA6HKFBV.js +4 -0
- package/dist/chunks/chunk-REBNWCKI.js +4 -0
- package/dist/chunks/chunk-REPYBMQS.js +4 -0
- package/dist/chunks/chunk-RO4C2MJP.js +4 -0
- package/dist/chunks/chunk-SKHLZ6XY.js +9 -0
- package/dist/chunks/chunk-STUHNKQS.js +4 -0
- package/dist/chunks/chunk-SUFW24P4.js +7 -0
- package/dist/chunks/chunk-TAWLERZA.js +4 -0
- package/dist/chunks/chunk-TCAEECDI.js +4 -0
- package/dist/chunks/chunk-TJ4GQRT6.js +8 -0
- package/dist/chunks/chunk-TURBFBYN.js +4 -0
- package/dist/chunks/chunk-TWAEABGG.js +52 -0
- package/dist/chunks/chunk-TZFLHVOQ.js +7 -0
- package/dist/chunks/chunk-TZGNSHOL.js +4 -0
- package/dist/chunks/chunk-UD3NMUHR.js +12 -0
- package/dist/chunks/chunk-UNVEZI57.js +4 -0
- package/dist/chunks/chunk-USBJFDJ6.js +4 -0
- package/dist/chunks/chunk-V3AQJSWR.js +4 -0
- package/dist/chunks/chunk-VQUPKMDR.js +4 -0
- package/dist/chunks/chunk-W25TB3PU.js +4 -0
- package/dist/chunks/chunk-W5LGYSPZ.js +4 -0
- package/dist/chunks/chunk-WEZWKMYU.js +4 -0
- package/dist/chunks/chunk-WHC7AYZD.js +4 -0
- package/dist/chunks/chunk-X2GYYRVM.js +22 -0
- package/dist/chunks/chunk-XAJLZR7C.js +28 -0
- package/dist/chunks/chunk-XAXWLYH5.js +4 -0
- package/dist/chunks/chunk-XBJOYU5Y.js +4 -0
- package/dist/chunks/chunk-XH6FMP3N.js +71 -0
- package/dist/chunks/chunk-XIECJESP.js +4 -0
- package/dist/chunks/chunk-XNSSUVT6.js +4 -0
- package/dist/chunks/chunk-XSRZHN63.js +4 -0
- package/dist/chunks/chunk-Y3GFB5XM.js +8 -0
- package/dist/chunks/chunk-Y6ZEVVL5.js +4 -0
- package/dist/chunks/chunk-YAEVYJAR.js +4 -0
- package/dist/chunks/chunk-YG7OEPR2.js +6 -0
- package/dist/chunks/chunk-YHIWOGVL.js +4 -0
- package/dist/chunks/chunk-YKKEI5GI.js +4 -0
- package/dist/chunks/chunk-YPK2CAIZ.js +8 -0
- package/dist/chunks/chunk-YZSHTWNM.js +92 -0
- package/dist/chunks/chunk-Z2Q2NR46.js +34 -0
- package/dist/chunks/chunk-Z4H3VDHI.js +4 -0
- package/dist/chunks/chunk-ZFPMIQA3.js +6 -0
- package/dist/chunks/chunk-ZNZFWSPH.js +4 -0
- package/dist/chunks/chunk-ZQ7LGTSN.js +8 -0
- package/dist/chunks/chunk-ZSV6TO7Q.js +4 -0
- package/dist/chunks/cli-5DBTRMHU.js +53 -0
- package/dist/chunks/client-XOGYH5UR.js +4 -0
- package/dist/chunks/cloudflare-workers-ai-system-one-32JCFHI3.js +4 -0
- package/dist/chunks/config-DJSQI77S-335IXHSM.js +4 -0
- package/dist/chunks/context-VCQH5OB6.js +4 -0
- package/dist/chunks/cost-PGGFI7QJ.js +5 -0
- package/dist/chunks/dist-7RWW7YH4.js +11 -0
- package/dist/chunks/dist-PUKMZ7GW.js +4 -0
- package/dist/chunks/easter-egg-3d-MO4MOEVF.js +4 -0
- package/dist/chunks/es5-VNTQPCKX.js +4 -0
- package/dist/chunks/event-streams-3JSFPOTZ.js +4 -0
- package/dist/chunks/execution-repo-ZLJTBWFC.js +4 -0
- package/dist/chunks/executions-6ARGR3IO.js +9 -0
- package/dist/chunks/file-7BN7RCAY.js +4 -0
- package/dist/chunks/gateway-UCRPMR75.js +36 -0
- package/dist/chunks/github-copilot-HAI2DA62.js +4 -0
- package/dist/chunks/google-generative-ai-2VXWLHWI.js +4 -0
- package/dist/chunks/google-vertex-UA36QP2U.js +4 -0
- package/dist/chunks/init-HA7FAQ73.js +4 -0
- package/dist/chunks/install-cli-4IZCSDFZ.js +16 -0
- package/dist/chunks/interaction-ask-G5T3H3CG.js +9 -0
- package/dist/chunks/interaction-plan-E5V42MUP.js +11 -0
- package/dist/chunks/jiti-loader-WANUXUDO.js +4 -0
- package/dist/chunks/jiti-static-loader-W3QZ4GDS.js +476 -0
- package/dist/chunks/kimi-coding-HMJRKCPA.js +4 -0
- package/dist/chunks/lib-RSOU34HQ.js +11 -0
- package/dist/chunks/llama-cpp-classify-OTXZWCMW.js +24 -0
- package/dist/chunks/local-client-stop-SQRU7ZZM.js +4 -0
- package/dist/chunks/memory-cli-PYOILNN5.js +11 -0
- package/dist/chunks/meta-KY3LNFV2.js +4 -0
- package/dist/chunks/mistral-conversations-34F66L3O.js +7 -0
- package/dist/chunks/model-resolver-N3DTAQ2S.js +4 -0
- package/dist/chunks/models-L5VF4I5O-XXNJYQMQ.js +4 -0
- package/dist/chunks/multipart-parser-GEHG6YAR.js +5 -0
- package/dist/chunks/node-PTK2HCDV.js +18 -0
- package/dist/chunks/node-VLVSZ76W.js +4 -0
- package/dist/chunks/openai-chatgpt-PETGIJOZ.js +4 -0
- package/dist/chunks/openai-codex-2REL6UQU.js +4 -0
- package/dist/chunks/openai-codex-responses-ZBVHREB3.js +12 -0
- package/dist/chunks/openai-completions-VVIB26SH.js +9 -0
- package/dist/chunks/openai-decisions-2N6ZRPZC.js +7 -0
- package/dist/chunks/openai-responses-735XA2ZX.js +6 -0
- package/dist/chunks/openrouter-GDY3BLT2.js +4 -0
- package/dist/chunks/openrouter-images-3IKETHAC.js +4 -0
- package/dist/chunks/pi-messages-I3E4ZFHA.js +10 -0
- package/dist/chunks/radius-HXRZVBDB.js +4 -0
- package/dist/chunks/remote-ops-BALZYKH6.js +14 -0
- package/dist/chunks/runner-PLVZDGHB.js +4 -0
- package/dist/chunks/runtime-6YLTA2ZD.js +4 -0
- package/dist/chunks/schedule-cli-OLASBBYJ.js +4 -0
- package/dist/chunks/slack-WAGSPZUX.js +4 -0
- package/dist/chunks/src-CCI7P7AI.js +6 -0
- package/dist/chunks/start-ui-http-QALT7C3P.js +43 -0
- package/dist/chunks/subagent-E3UC7ZHC.js +4 -0
- package/dist/chunks/time-KEHDQT6K.js +4 -0
- package/dist/chunks/tool-shims-Q6P6UXVC.js +4 -0
- package/dist/chunks/typesafe-system-one-6ULACYD4.js +4 -0
- package/dist/chunks/ui-board-4GYW6KKW.js +5 -0
- package/dist/chunks/ui-decision-U2FXSEC2.js +4 -0
- package/dist/chunks/ui-file-GVH53O3X.js +5 -0
- package/dist/chunks/ui-view-O7PLANT7.js +4 -0
- package/dist/chunks/virtual-modules-IDC5YKZJ.js +4 -0
- package/dist/chunks/waitpoint-2FGQBIAC.js +5 -0
- package/dist/chunks/workers-XN4PSTH6.js +4 -0
- package/dist/chunks/xai-KEVUJTFV.js +4 -0
- package/dist/client-bundle/manifest.json +1 -1
- package/dist/core/pi-sdk.js +4 -73
- package/dist/domain/auth/cc-auth-cli.js +4 -248
- package/dist/domain/mcp/bundled-server.js +4 -146
- package/dist/entry/app.js +601 -611
- package/dist/entry/browser-cli.js +14 -316
- package/dist/entry/cli.js +4 -587
- package/dist/entry/cortex-cli.js +4 -2
- package/dist/entry/daemon.js +7 -909
- package/dist/entry/hook-cli.js +6 -401
- package/dist/entry/production-app-bootstrap.js +5 -42
- package/dist/entry/production-evidence-export-cli.js +12 -99
- package/dist/entry/signal-cli.js +6 -198
- package/dist/tui/index.js +114 -306
- package/package.json +11 -50
- package/scripts/bundle-prune-browser.mjs +52 -0
- package/scripts/postinstall-restart-trigger.mjs +8 -0
- package/vendor/aistatus/gateway-cli.js +21 -0
- package/vendor/pi/CHANGELOG.md +6365 -0
- package/vendor/pi/README.md +95 -0
- package/vendor/pi/dist/codemode-worker.js +478 -0
- package/vendor/pi/dist/core/export-html/ansi-to-html.js +249 -0
- package/vendor/pi/dist/core/export-html/index.js +228 -0
- package/vendor/pi/dist/core/export-html/template.css +1076 -0
- package/vendor/pi/dist/core/export-html/template.html +56 -0
- package/vendor/pi/dist/core/export-html/template.js +1924 -0
- package/vendor/pi/dist/core/export-html/tool-renderer.js +110 -0
- package/vendor/pi/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/vendor/pi/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/vendor/pi/dist/core/export-html/vendor/marked.min.js +79 -0
- package/vendor/pi/dist/core/extensions/loader.js +4 -0
- package/vendor/pi/dist/extensions/codemode/execute.js +507 -0
- package/vendor/pi/dist/modes/interactive/assets/clankolas.png +0 -0
- package/vendor/pi/dist/modes/interactive/theme/dark.json +78 -0
- package/vendor/pi/dist/modes/interactive/theme/light.json +78 -0
- package/vendor/pi/dist/modes/interactive/theme/system-theme.js +546 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-controller.js +210 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-schema.js +105 -0
- package/vendor/pi/dist/modes/interactive/theme/theme-tokens.js +94 -0
- package/vendor/pi/dist/modes/interactive/theme/theme.js +905 -0
- package/vendor/pi/dist/utils/image-resize-worker.js +4 -0
- package/vendor/pi/dist/utils/image-resize.js +4 -0
- package/vendor/pi/docs/cli-integration.md +106 -0
- package/vendor/pi/docs/cli.md +333 -0
- package/vendor/pi/docs/codemode.md +230 -0
- package/vendor/pi/docs/compaction.md +463 -0
- package/vendor/pi/docs/configuration.md +47 -0
- package/vendor/pi/docs/containerization.md +183 -0
- package/vendor/pi/docs/custom-provider.md +225 -0
- package/vendor/pi/docs/docs.json +220 -0
- package/vendor/pi/docs/environment-variables.md +101 -0
- package/vendor/pi/docs/extensions.md +400 -0
- package/vendor/pi/docs/how-pi-works.md +49 -0
- package/vendor/pi/docs/images/doom-extension.png +0 -0
- package/vendor/pi/docs/images/exy.png +0 -0
- package/vendor/pi/docs/images/interactive-mode.png +0 -0
- package/vendor/pi/docs/images/tree-view.png +0 -0
- package/vendor/pi/docs/index.md +39 -0
- package/vendor/pi/docs/json.md +226 -0
- package/vendor/pi/docs/keybindings.md +195 -0
- package/vendor/pi/docs/llama-cpp.md +121 -0
- package/vendor/pi/docs/mcp.md +272 -0
- package/vendor/pi/docs/message-types.md +279 -0
- package/vendor/pi/docs/models-configuration.md +196 -0
- package/vendor/pi/docs/models.md +225 -0
- package/vendor/pi/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/vendor/pi/docs/packages.md +129 -0
- package/vendor/pi/docs/prompt-templates.md +59 -0
- package/vendor/pi/docs/providers.md +247 -0
- package/vendor/pi/docs/quickstart.md +136 -0
- package/vendor/pi/docs/rpc-commands.md +860 -0
- package/vendor/pi/docs/rpc-extension-ui.md +200 -0
- package/vendor/pi/docs/rpc.md +193 -0
- package/vendor/pi/docs/sdk.md +147 -0
- package/vendor/pi/docs/security.md +99 -0
- package/vendor/pi/docs/session-format.md +293 -0
- package/vendor/pi/docs/sessions.md +66 -0
- package/vendor/pi/docs/settings.md +172 -0
- package/vendor/pi/docs/shell-aliases.md +93 -0
- package/vendor/pi/docs/skills.md +93 -0
- package/vendor/pi/docs/slash-commands.md +60 -0
- package/vendor/pi/docs/terminal-setup.md +233 -0
- package/vendor/pi/docs/termux.md +117 -0
- package/vendor/pi/docs/themes.md +138 -0
- package/vendor/pi/docs/tmux.md +55 -0
- package/vendor/pi/docs/tui.md +195 -0
- package/vendor/pi/docs/usage.md +94 -0
- package/vendor/pi/docs/virtual-models.md +114 -0
- package/vendor/pi/docs/windows.md +81 -0
- package/vendor/pi/examples/README.md +36 -0
- package/vendor/pi/examples/extensions/README.md +214 -0
- package/vendor/pi/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/vendor/pi/examples/extensions/bash-spawn-hook.ts +30 -0
- package/vendor/pi/examples/extensions/bookmark.ts +50 -0
- package/vendor/pi/examples/extensions/border-status-editor.ts +150 -0
- package/vendor/pi/examples/extensions/built-in-tool-renderer.ts +225 -0
- package/vendor/pi/examples/extensions/claude-rules.ts +86 -0
- package/vendor/pi/examples/extensions/commands.ts +72 -0
- package/vendor/pi/examples/extensions/confirm-destructive.ts +59 -0
- package/vendor/pi/examples/extensions/custom-compaction.ts +117 -0
- package/vendor/pi/examples/extensions/custom-footer.ts +64 -0
- package/vendor/pi/examples/extensions/custom-header.ts +73 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/index.ts +617 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/vendor/pi/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/vendor/pi/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/vendor/pi/examples/extensions/debug-provider.ts +90 -0
- package/vendor/pi/examples/extensions/dirty-repo-guard.ts +56 -0
- package/vendor/pi/examples/extensions/doom-overlay/README.md +46 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/vendor/pi/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/vendor/pi/examples/extensions/doom-overlay/index.ts +74 -0
- package/vendor/pi/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/vendor/pi/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/vendor/pi/examples/extensions/dynamic-resources/dynamic.json +81 -0
- package/vendor/pi/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/vendor/pi/examples/extensions/dynamic-resources/index.ts +15 -0
- package/vendor/pi/examples/extensions/dynamic-tools.ts +74 -0
- package/vendor/pi/examples/extensions/entry-renderer.ts +41 -0
- package/vendor/pi/examples/extensions/event-bus.ts +43 -0
- package/vendor/pi/examples/extensions/file-trigger.ts +41 -0
- package/vendor/pi/examples/extensions/git-checkpoint.ts +53 -0
- package/vendor/pi/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/vendor/pi/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/vendor/pi/examples/extensions/gondolin/index.ts +531 -0
- package/vendor/pi/examples/extensions/gondolin/package-lock.json +185 -0
- package/vendor/pi/examples/extensions/gondolin/package.json +19 -0
- package/vendor/pi/examples/extensions/handoff.ts +190 -0
- package/vendor/pi/examples/extensions/hello.ts +26 -0
- package/vendor/pi/examples/extensions/hidden-thinking-label.ts +53 -0
- package/vendor/pi/examples/extensions/inline-bash.ts +94 -0
- package/vendor/pi/examples/extensions/input-transform-streaming.ts +39 -0
- package/vendor/pi/examples/extensions/input-transform.ts +43 -0
- package/vendor/pi/examples/extensions/interactive-shell.ts +196 -0
- package/vendor/pi/examples/extensions/jev-router.ts +113 -0
- package/vendor/pi/examples/extensions/mac-system-theme.ts +47 -0
- package/vendor/pi/examples/extensions/message-renderer.ts +59 -0
- package/vendor/pi/examples/extensions/minimal-mode.ts +353 -0
- package/vendor/pi/examples/extensions/modal-editor.ts +85 -0
- package/vendor/pi/examples/extensions/model-status.ts +31 -0
- package/vendor/pi/examples/extensions/notify.ts +57 -0
- package/vendor/pi/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/vendor/pi/examples/extensions/overlay-test.ts +153 -0
- package/vendor/pi/examples/extensions/permission-gate.ts +34 -0
- package/vendor/pi/examples/extensions/pirate.ts +47 -0
- package/vendor/pi/examples/extensions/plan-mode/README.md +66 -0
- package/vendor/pi/examples/extensions/plan-mode/index.ts +394 -0
- package/vendor/pi/examples/extensions/plan-mode/utils.ts +168 -0
- package/vendor/pi/examples/extensions/preset.ts +436 -0
- package/vendor/pi/examples/extensions/project-trust.ts +64 -0
- package/vendor/pi/examples/extensions/prompt-customizer.ts +49 -0
- package/vendor/pi/examples/extensions/protected-paths.ts +30 -0
- package/vendor/pi/examples/extensions/provider-payload.ts +18 -0
- package/vendor/pi/examples/extensions/qna.ts +118 -0
- package/vendor/pi/examples/extensions/question.ts +286 -0
- package/vendor/pi/examples/extensions/questionnaire.ts +448 -0
- package/vendor/pi/examples/extensions/rainbow-editor.ts +88 -0
- package/vendor/pi/examples/extensions/reload-runtime.ts +37 -0
- package/vendor/pi/examples/extensions/rpc-demo.ts +118 -0
- package/vendor/pi/examples/extensions/sandbox/index.ts +321 -0
- package/vendor/pi/examples/extensions/sandbox/package-lock.json +92 -0
- package/vendor/pi/examples/extensions/sandbox/package.json +19 -0
- package/vendor/pi/examples/extensions/send-user-message.ts +97 -0
- package/vendor/pi/examples/extensions/session-name.ts +27 -0
- package/vendor/pi/examples/extensions/shutdown-command.ts +63 -0
- package/vendor/pi/examples/extensions/snake.ts +343 -0
- package/vendor/pi/examples/extensions/space-invaders.ts +560 -0
- package/vendor/pi/examples/extensions/ssh.ts +220 -0
- package/vendor/pi/examples/extensions/status-line.ts +32 -0
- package/vendor/pi/examples/extensions/structured-output.ts +65 -0
- package/vendor/pi/examples/extensions/subagent/README.md +177 -0
- package/vendor/pi/examples/extensions/subagent/agents/planner.md +37 -0
- package/vendor/pi/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/vendor/pi/examples/extensions/subagent/agents/scout.md +50 -0
- package/vendor/pi/examples/extensions/subagent/agents/worker.md +24 -0
- package/vendor/pi/examples/extensions/subagent/agents.ts +157 -0
- package/vendor/pi/examples/extensions/subagent/index.ts +1036 -0
- package/vendor/pi/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/vendor/pi/examples/extensions/subagent/prompts/implement.md +10 -0
- package/vendor/pi/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/vendor/pi/examples/extensions/summarize.ts +199 -0
- package/vendor/pi/examples/extensions/system-prompt-header.ts +17 -0
- package/vendor/pi/examples/extensions/tic-tac-toe.ts +1008 -0
- package/vendor/pi/examples/extensions/timed-confirm.ts +70 -0
- package/vendor/pi/examples/extensions/titlebar-spinner.ts +58 -0
- package/vendor/pi/examples/extensions/todo.ts +297 -0
- package/vendor/pi/examples/extensions/tool-override.ts +144 -0
- package/vendor/pi/examples/extensions/tools.ts +146 -0
- package/vendor/pi/examples/extensions/trigger-compact.ts +50 -0
- package/vendor/pi/examples/extensions/truncated-tool.ts +195 -0
- package/vendor/pi/examples/extensions/widget-placement.ts +9 -0
- package/vendor/pi/examples/extensions/with-deps/index.ts +32 -0
- package/vendor/pi/examples/extensions/with-deps/package-lock.json +31 -0
- package/vendor/pi/examples/extensions/with-deps/package.json +22 -0
- package/vendor/pi/examples/extensions/working-indicator.ts +123 -0
- package/vendor/pi/examples/extensions/working-message-test.ts +25 -0
- package/vendor/pi/examples/rpc-client.ts +35 -0
- package/vendor/pi/examples/rpc-extension-ui.ts +661 -0
- package/vendor/pi/examples/sdk/01-minimal.ts +26 -0
- package/vendor/pi/examples/sdk/02-custom-model.ts +49 -0
- package/vendor/pi/examples/sdk/03-custom-prompt.ts +75 -0
- package/vendor/pi/examples/sdk/04-skills.ts +55 -0
- package/vendor/pi/examples/sdk/05-tools.ts +48 -0
- package/vendor/pi/examples/sdk/06-extensions.ts +99 -0
- package/vendor/pi/examples/sdk/07-context-files.ts +47 -0
- package/vendor/pi/examples/sdk/08-prompt-templates.ts +51 -0
- package/vendor/pi/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/vendor/pi/examples/sdk/10-settings.ts +53 -0
- package/vendor/pi/examples/sdk/11-sessions.ts +52 -0
- package/vendor/pi/examples/sdk/12-full-control.ts +74 -0
- package/vendor/pi/examples/sdk/13-session-runtime.ts +67 -0
- package/vendor/pi/examples/sdk/14-codemode-mcp.ts +61 -0
- package/vendor/pi/examples/sdk/README.md +141 -0
- package/vendor/pi/package.json +98 -0
- package/vendor/pi/schemas/keybindings.schema.json +393 -0
- package/vendor/pi/schemas/models.schema.json +1211 -0
- package/vendor/pi/schemas/settings.schema.json +783 -0
- package/vendor/pi/schemas/theme.schema.json +365 -0
- package/vendor/pi-ai/bedrock.js +4 -0
- package/vendor/pi-ai/oauth-load.js +4 -0
- package/vendor/quickjs.wasm +0 -0
- package/web/dist/assets/board-math-css-BmiXB1z5.js +2 -0
- package/web/dist/assets/index-DqWMdMkh.css +1 -0
- package/web/dist/assets/index-XBRXpnC5.js +1 -0
- package/web/dist/assets/index-btKNdkvc.js +525 -0
- package/web/dist/index.html +2 -2
- package/dist/agent-adapter/bg-wait.d.ts +0 -11
- package/dist/agent-adapter/bg-wait.js +0 -32
- package/dist/agent-adapter/capabilities.d.ts +0 -18
- package/dist/agent-adapter/capabilities.js +0 -39
- package/dist/agent-adapter/claude/active-capture-registry.d.ts +0 -7
- package/dist/agent-adapter/claude/active-capture-registry.js +0 -42
- package/dist/agent-adapter/claude/adapter.d.ts +0 -170
- package/dist/agent-adapter/claude/adapter.js +0 -459
- package/dist/agent-adapter/claude/assistant-blocks.d.ts +0 -5
- package/dist/agent-adapter/claude/assistant-blocks.js +0 -61
- package/dist/agent-adapter/claude/bg-task-tracker.d.ts +0 -105
- package/dist/agent-adapter/claude/bg-task-tracker.js +0 -168
- package/dist/agent-adapter/claude/cache-refresh.d.ts +0 -58
- package/dist/agent-adapter/claude/cache-refresh.js +0 -145
- package/dist/agent-adapter/claude/cache-touch.d.ts +0 -12
- package/dist/agent-adapter/claude/cache-touch.js +0 -75
- package/dist/agent-adapter/claude/compact-window.d.ts +0 -18
- package/dist/agent-adapter/claude/compact-window.js +0 -49
- package/dist/agent-adapter/claude/context-usage.d.ts +0 -28
- package/dist/agent-adapter/claude/context-usage.js +0 -173
- package/dist/agent-adapter/claude/defaults.d.ts +0 -42
- package/dist/agent-adapter/claude/defaults.js +0 -59
- package/dist/agent-adapter/claude/engine.d.ts +0 -75
- package/dist/agent-adapter/claude/engine.js +0 -139
- package/dist/agent-adapter/claude/event-parser.d.ts +0 -60
- package/dist/agent-adapter/claude/event-parser.js +0 -259
- package/dist/agent-adapter/claude/event-translator.d.ts +0 -45
- package/dist/agent-adapter/claude/event-translator.js +0 -98
- package/dist/agent-adapter/claude/hooks-builder.d.ts +0 -19
- package/dist/agent-adapter/claude/hooks-builder.js +0 -57
- package/dist/agent-adapter/claude/mcp-config.d.ts +0 -11
- package/dist/agent-adapter/claude/mcp-config.js +0 -142
- package/dist/agent-adapter/claude/remote-mcp-proxy.d.ts +0 -1
- package/dist/agent-adapter/claude/session-options.d.ts +0 -70
- package/dist/agent-adapter/claude/session-options.js +0 -148
- package/dist/agent-adapter/claude/spawn-args.d.ts +0 -70
- package/dist/agent-adapter/claude/spawn-args.js +0 -367
- package/dist/agent-adapter/claude/tool-summarizers.d.ts +0 -2
- package/dist/agent-adapter/claude/tool-summarizers.js +0 -20
- package/dist/agent-adapter/claude/transcript-clear.d.ts +0 -42
- package/dist/agent-adapter/claude/transcript-clear.js +0 -217
- package/dist/agent-adapter/claude/transcript-path.d.ts +0 -39
- package/dist/agent-adapter/claude/transcript-path.js +0 -114
- package/dist/agent-adapter/claude/turn-machine.d.ts +0 -220
- package/dist/agent-adapter/claude/turn-machine.js +0 -731
- package/dist/agent-adapter/claude/window-warmup.d.ts +0 -13
- package/dist/agent-adapter/claude/window-warmup.js +0 -38
- package/dist/agent-adapter/continuation-phase.d.ts +0 -131
- package/dist/agent-adapter/continuation-phase.js +0 -345
- package/dist/agent-adapter/engine-injections.d.ts +0 -47
- package/dist/agent-adapter/engine-injections.js +0 -80
- package/dist/agent-adapter/mcp-remote-fetch.d.ts +0 -1
- package/dist/agent-adapter/mcp-remote-fetch.js +0 -32
- package/dist/agent-adapter/normalize/event-types.d.ts +0 -125
- package/dist/agent-adapter/normalize/event-types.js +0 -1
- package/dist/agent-adapter/normalize/prompt-builder.d.ts +0 -22
- package/dist/agent-adapter/normalize/prompt-builder.js +0 -41
- package/dist/agent-adapter/normalize/tool-result-images.d.ts +0 -11
- package/dist/agent-adapter/normalize/tool-result-images.js +0 -32
- package/dist/agent-adapter/pi/adapter.d.ts +0 -125
- package/dist/agent-adapter/pi/adapter.js +0 -275
- package/dist/agent-adapter/pi/agent-dir.d.ts +0 -57
- package/dist/agent-adapter/pi/agent-dir.js +0 -154
- package/dist/agent-adapter/pi/background-subagent.d.ts +0 -26
- package/dist/agent-adapter/pi/background-subagent.js +0 -1
- package/dist/agent-adapter/pi/child-events.d.ts +0 -13
- package/dist/agent-adapter/pi/child-events.js +0 -96
- package/dist/agent-adapter/pi/child-runner.d.ts +0 -31
- package/dist/agent-adapter/pi/child-runner.js +0 -133
- package/dist/agent-adapter/pi/child-session.d.ts +0 -28
- package/dist/agent-adapter/pi/child-session.js +0 -70
- package/dist/agent-adapter/pi/custom-catalog.d.ts +0 -10
- package/dist/agent-adapter/pi/custom-catalog.js +0 -38
- package/dist/agent-adapter/pi/defaults.d.ts +0 -7
- package/dist/agent-adapter/pi/defaults.js +0 -11
- package/dist/agent-adapter/pi/discovery.d.ts +0 -37
- package/dist/agent-adapter/pi/discovery.js +0 -33
- package/dist/agent-adapter/pi/engine.d.ts +0 -66
- package/dist/agent-adapter/pi/engine.js +0 -180
- package/dist/agent-adapter/pi/event-parser.d.ts +0 -43
- package/dist/agent-adapter/pi/event-parser.js +0 -446
- package/dist/agent-adapter/pi/extensions.d.ts +0 -33
- package/dist/agent-adapter/pi/extensions.js +0 -58
- package/dist/agent-adapter/pi/hook-bridge.d.ts +0 -54
- package/dist/agent-adapter/pi/hook-bridge.js +0 -394
- package/dist/agent-adapter/pi/image-first.d.ts +0 -3
- package/dist/agent-adapter/pi/image-first.js +0 -31
- package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +0 -32
- package/dist/agent-adapter/pi/mcp-bridge-logic.js +0 -63
- package/dist/agent-adapter/pi/mcp-bridge.d.ts +0 -65
- package/dist/agent-adapter/pi/mcp-bridge.js +0 -389
- package/dist/agent-adapter/pi/native-tool-policy.d.ts +0 -3
- package/dist/agent-adapter/pi/native-tool-policy.js +0 -11
- package/dist/agent-adapter/pi/pi-session.d.ts +0 -185
- package/dist/agent-adapter/pi/pi-session.js +0 -656
- package/dist/agent-adapter/pi/providers-config.d.ts +0 -60
- package/dist/agent-adapter/pi/providers-config.js +0 -96
- package/dist/agent-adapter/pi/quota-probe.d.ts +0 -12
- package/dist/agent-adapter/pi/quota-probe.js +0 -33
- package/dist/agent-adapter/pi/quota-sink.d.ts +0 -33
- package/dist/agent-adapter/pi/quota-sink.js +0 -57
- package/dist/agent-adapter/pi/runtime-settings.d.ts +0 -9
- package/dist/agent-adapter/pi/runtime-settings.js +0 -53
- package/dist/agent-adapter/pi/runtime.d.ts +0 -48
- package/dist/agent-adapter/pi/runtime.js +0 -163
- package/dist/agent-adapter/pi/session-files.d.ts +0 -2
- package/dist/agent-adapter/pi/session-files.js +0 -15
- package/dist/agent-adapter/pi/session-options.d.ts +0 -86
- package/dist/agent-adapter/pi/session-options.js +0 -162
- package/dist/agent-adapter/pi/session-support.d.ts +0 -54
- package/dist/agent-adapter/pi/session-support.js +0 -101
- package/dist/agent-adapter/pi/subagent-bridge.d.ts +0 -17
- package/dist/agent-adapter/pi/subagent-bridge.js +0 -1
- package/dist/agent-adapter/pi/subagent.d.ts +0 -100
- package/dist/agent-adapter/pi/subagent.js +0 -199
- package/dist/agent-adapter/pi/tool-shims.d.ts +0 -32
- package/dist/agent-adapter/pi/tool-shims.js +0 -148
- package/dist/agent-adapter/pi/ui-context.d.ts +0 -20
- package/dist/agent-adapter/pi/ui-context.js +0 -92
- package/dist/agent-adapter/pi/web-fetch.d.ts +0 -13
- package/dist/agent-adapter/pi/web-fetch.js +0 -196
- package/dist/agent-adapter/pi/web-search.d.ts +0 -9
- package/dist/agent-adapter/pi/web-search.js +0 -517
- package/dist/agent-adapter/run-events.d.ts +0 -169
- package/dist/agent-adapter/run-events.js +0 -119
- package/dist/agent-adapter/types.d.ts +0 -330
- package/dist/agent-adapter/types.js +0 -3
- package/dist/core/agents/roles.d.ts +0 -50
- package/dist/core/agents/roles.js +0 -176
- package/dist/core/agents/subagent/attribution.d.ts +0 -15
- package/dist/core/agents/subagent/attribution.js +0 -60
- package/dist/core/agents/subagent/catalog.d.ts +0 -65
- package/dist/core/agents/subagent/catalog.js +0 -200
- package/dist/core/agents/subagent/model-spec.d.ts +0 -28
- package/dist/core/agents/subagent/model-spec.js +0 -39
- package/dist/core/agents/subagent/orchestrate.d.ts +0 -25
- package/dist/core/agents/subagent/orchestrate.js +0 -92
- package/dist/core/agents/subagent/schema.d.ts +0 -12
- package/dist/core/agents/subagent/schema.js +0 -51
- package/dist/core/agents/subagent/types.d.ts +0 -84
- package/dist/core/agents/subagent/types.js +0 -1
- package/dist/core/agents/subagent/usage.d.ts +0 -8
- package/dist/core/agents/subagent/usage.js +0 -32
- package/dist/core/anthropic-model-discovery.d.ts +0 -54
- package/dist/core/anthropic-model-discovery.js +0 -156
- package/dist/core/anthropic-models.d.ts +0 -1
- package/dist/core/anthropic-models.js +0 -13
- package/dist/core/async-mutex.d.ts +0 -6
- package/dist/core/async-mutex.js +0 -32
- package/dist/core/atomic-write.d.ts +0 -9
- package/dist/core/atomic-write.js +0 -104
- package/dist/core/auth.d.ts +0 -40
- package/dist/core/auth.js +0 -94
- package/dist/core/board-action.d.ts +0 -19
- package/dist/core/board-action.js +0 -24
- package/dist/core/builtin-layer.d.ts +0 -22
- package/dist/core/builtin-layer.js +0 -45
- package/dist/core/cached-scan.d.ts +0 -42
- package/dist/core/cached-scan.js +0 -95
- package/dist/core/calver.d.ts +0 -1
- package/dist/core/calver.js +0 -25
- package/dist/core/claude-credentials.d.ts +0 -91
- package/dist/core/claude-credentials.js +0 -242
- package/dist/core/cli-utils.d.ts +0 -56
- package/dist/core/cli-utils.js +0 -70
- package/dist/core/codex-quota.d.ts +0 -27
- package/dist/core/codex-quota.js +0 -55
- package/dist/core/codex-token.d.ts +0 -4
- package/dist/core/codex-token.js +0 -26
- package/dist/core/config-generator.d.ts +0 -17
- package/dist/core/config-generator.js +0 -181
- package/dist/core/debug-mode.d.ts +0 -15
- package/dist/core/debug-mode.js +0 -22
- package/dist/core/exec-async.d.ts +0 -28
- package/dist/core/exec-async.js +0 -48
- package/dist/core/file-lock.d.ts +0 -15
- package/dist/core/file-lock.js +0 -164
- package/dist/core/format-duration.d.ts +0 -7
- package/dist/core/format-duration.js +0 -23
- package/dist/core/gateway-generator.d.ts +0 -152
- package/dist/core/gateway-generator.js +0 -559
- package/dist/core/git-availability.d.ts +0 -2
- package/dist/core/git-availability.js +0 -43
- package/dist/core/hook-bus.d.ts +0 -25
- package/dist/core/hook-bus.js +0 -99
- package/dist/core/hook-exec.d.ts +0 -15
- package/dist/core/hook-exec.js +0 -86
- package/dist/core/hook-scripts.d.ts +0 -19
- package/dist/core/hook-scripts.js +0 -30
- package/dist/core/i18n.d.ts +0 -19
- package/dist/core/i18n.js +0 -42
- package/dist/core/icons.d.ts +0 -72
- package/dist/core/icons.js +0 -71
- package/dist/core/json-repository.d.ts +0 -78
- package/dist/core/json-repository.js +0 -154
- package/dist/core/locales/en.d.ts +0 -911
- package/dist/core/locales/en.js +0 -32
- package/dist/core/locales/slices/commands.d.ts +0 -301
- package/dist/core/locales/slices/commands.js +0 -634
- package/dist/core/locales/slices/init.d.ts +0 -153
- package/dist/core/locales/slices/init.js +0 -431
- package/dist/core/locales/slices/interactions.d.ts +0 -47
- package/dist/core/locales/slices/interactions.js +0 -99
- package/dist/core/locales/slices/lang.d.ts +0 -8
- package/dist/core/locales/slices/lang.js +0 -15
- package/dist/core/locales/slices/notices.d.ts +0 -78
- package/dist/core/locales/slices/notices.js +0 -156
- package/dist/core/locales/slices/providers.d.ts +0 -43
- package/dist/core/locales/slices/providers.js +0 -87
- package/dist/core/locales/slices/scheduling.d.ts +0 -33
- package/dist/core/locales/slices/scheduling.js +0 -65
- package/dist/core/locales/slices/startup.d.ts +0 -10
- package/dist/core/locales/slices/startup.js +0 -19
- package/dist/core/locales/slices/status.d.ts +0 -48
- package/dist/core/locales/slices/status.js +0 -109
- package/dist/core/locales/slices/tui.d.ts +0 -93
- package/dist/core/locales/slices/tui.js +0 -192
- package/dist/core/locales/slices/uiextra.d.ts +0 -49
- package/dist/core/locales/slices/uiextra.js +0 -102
- package/dist/core/locales/slices/uimsg.d.ts +0 -74
- package/dist/core/locales/slices/uimsg.js +0 -158
- package/dist/core/locales/zh.d.ts +0 -5
- package/dist/core/locales/zh.js +0 -30
- package/dist/core/log.d.ts +0 -16
- package/dist/core/log.js +0 -174
- package/dist/core/loopback-http.d.ts +0 -6
- package/dist/core/loopback-http.js +0 -43
- package/dist/core/mcp-bundles.d.ts +0 -8
- package/dist/core/mcp-bundles.js +0 -47
- package/dist/core/mcp-timeout.d.ts +0 -1
- package/dist/core/mcp-timeout.js +0 -1
- package/dist/core/mcp-tool-gate.d.ts +0 -25
- package/dist/core/mcp-tool-gate.js +0 -97
- package/dist/core/media-types.d.ts +0 -20
- package/dist/core/media-types.js +0 -63
- package/dist/core/models-generator.d.ts +0 -29
- package/dist/core/models-generator.js +0 -82
- package/dist/core/native-name.d.ts +0 -4
- package/dist/core/native-name.js +0 -57
- package/dist/core/paths.d.ts +0 -63
- package/dist/core/paths.js +0 -105
- package/dist/core/pi-sdk.d.ts +0 -38
- package/dist/core/pi-session-filename.d.ts +0 -10
- package/dist/core/pi-session-filename.js +0 -49
- package/dist/core/platform-settings-spec.d.ts +0 -47
- package/dist/core/platform-settings-spec.js +0 -28
- package/dist/core/private-dir.d.ts +0 -13
- package/dist/core/private-dir.js +0 -48
- package/dist/core/process-command-line.d.ts +0 -6
- package/dist/core/process-command-line.js +0 -39
- package/dist/core/prompt-template.d.ts +0 -14
- package/dist/core/prompt-template.js +0 -29
- package/dist/core/rebuild-progress.d.ts +0 -59
- package/dist/core/rebuild-progress.js +0 -106
- package/dist/core/resilient-watch.d.ts +0 -28
- package/dist/core/resilient-watch.js +0 -108
- package/dist/core/resume-reminder.d.ts +0 -5
- package/dist/core/resume-reminder.js +0 -12
- package/dist/core/run-registry.d.ts +0 -134
- package/dist/core/run-registry.js +0 -256
- package/dist/core/runtime-env.d.ts +0 -1
- package/dist/core/runtime-env.js +0 -11
- package/dist/core/session-holds.d.ts +0 -88
- package/dist/core/session-holds.js +0 -168
- package/dist/core/session-state.d.ts +0 -32
- package/dist/core/session-state.js +0 -39
- package/dist/core/session-todos.d.ts +0 -12
- package/dist/core/session-todos.js +0 -44
- package/dist/core/settings-migration.d.ts +0 -5
- package/dist/core/settings-migration.js +0 -128
- package/dist/core/settings-spec.d.ts +0 -301
- package/dist/core/settings-spec.js +0 -309
- package/dist/core/settings.d.ts +0 -19
- package/dist/core/settings.js +0 -492
- package/dist/core/short-session-id.d.ts +0 -2
- package/dist/core/short-session-id.js +0 -4
- package/dist/core/singleton-lock.d.ts +0 -39
- package/dist/core/singleton-lock.js +0 -127
- package/dist/core/status-format.d.ts +0 -70
- package/dist/core/status-format.js +0 -59
- package/dist/core/subagent-spawn.d.ts +0 -40
- package/dist/core/subagent-spawn.js +0 -47
- package/dist/core/team-action.d.ts +0 -28
- package/dist/core/team-action.js +0 -65
- package/dist/core/todo.d.ts +0 -18
- package/dist/core/todo.js +0 -79
- package/dist/core/tool-names.d.ts +0 -12
- package/dist/core/tool-names.js +0 -65
- package/dist/core/types/agent-types.d.ts +0 -173
- package/dist/core/types/agent-types.js +0 -1
- package/dist/core/types/environment-types.d.ts +0 -45
- package/dist/core/types/environment-types.js +0 -1
- package/dist/core/utils.d.ts +0 -72
- package/dist/core/utils.js +0 -176
- package/dist/core/version.d.ts +0 -6
- package/dist/core/version.js +0 -11
- package/dist/core/workspace-filenames.d.ts +0 -9
- package/dist/core/workspace-filenames.js +0 -61
- package/dist/domain/agents/agent-state.d.ts +0 -19
- package/dist/domain/agents/agent-state.js +0 -73
- package/dist/domain/agents/agent-switch.d.ts +0 -16
- package/dist/domain/agents/agent-switch.js +0 -30
- package/dist/domain/agents/config.d.ts +0 -20
- package/dist/domain/agents/config.js +0 -89
- package/dist/domain/agents/engine-selection.d.ts +0 -21
- package/dist/domain/agents/engine-selection.js +0 -37
- package/dist/domain/agents/environments/entities.d.ts +0 -50
- package/dist/domain/agents/environments/entities.js +0 -94
- package/dist/domain/agents/environments/file-refs.d.ts +0 -20
- package/dist/domain/agents/environments/file-refs.js +0 -51
- package/dist/domain/agents/environments/index.d.ts +0 -7
- package/dist/domain/agents/environments/index.js +0 -9
- package/dist/domain/agents/environments/paths.d.ts +0 -7
- package/dist/domain/agents/environments/paths.js +0 -9
- package/dist/domain/agents/environments/prompt-includes.d.ts +0 -1
- package/dist/domain/agents/environments/prompt-includes.js +0 -91
- package/dist/domain/agents/environments/registry.d.ts +0 -17
- package/dist/domain/agents/environments/registry.js +0 -163
- package/dist/domain/agents/environments/resolve.d.ts +0 -11
- package/dist/domain/agents/environments/resolve.js +0 -36
- package/dist/domain/agents/environments/schema.d.ts +0 -69
- package/dist/domain/agents/environments/schema.js +0 -115
- package/dist/domain/agents/environments/schema.parity.d.ts +0 -1
- package/dist/domain/agents/environments/schema.parity.js +0 -7
- package/dist/domain/agents/environments/system-prompt.d.ts +0 -37
- package/dist/domain/agents/environments/system-prompt.js +0 -110
- package/dist/domain/agents/index.d.ts +0 -6
- package/dist/domain/agents/index.js +0 -7
- package/dist/domain/agents/model-selection.d.ts +0 -30
- package/dist/domain/agents/model-selection.js +0 -111
- package/dist/domain/agents/models.d.ts +0 -12
- package/dist/domain/agents/models.js +0 -94
- package/dist/domain/agents/provider-run-lifecycle.d.ts +0 -11
- package/dist/domain/agents/provider-run-lifecycle.js +0 -17
- package/dist/domain/agents/subagent/background-spend.d.ts +0 -17
- package/dist/domain/agents/subagent/background-spend.js +0 -42
- package/dist/domain/agents/subagent/foreign.d.ts +0 -13
- package/dist/domain/agents/subagent/foreign.js +0 -30
- package/dist/domain/agents/subagent/registry.d.ts +0 -106
- package/dist/domain/agents/subagent/registry.js +0 -272
- package/dist/domain/agents/subagent/runner.d.ts +0 -61
- package/dist/domain/agents/subagent/runner.js +0 -301
- package/dist/domain/agents/subagent/service.d.ts +0 -26
- package/dist/domain/agents/subagent/service.js +0 -68
- package/dist/domain/auth/anthropic-env.d.ts +0 -20
- package/dist/domain/auth/anthropic-env.js +0 -132
- package/dist/domain/auth/auth-events.d.ts +0 -18
- package/dist/domain/auth/auth-events.js +0 -34
- package/dist/domain/auth/auth-format.d.ts +0 -2
- package/dist/domain/auth/auth-format.js +0 -53
- package/dist/domain/auth/auth-status.d.ts +0 -63
- package/dist/domain/auth/auth-status.js +0 -286
- package/dist/domain/auth/auth-watch.d.ts +0 -16
- package/dist/domain/auth/auth-watch.js +0 -166
- package/dist/domain/auth/cc-auth-cli.d.ts +0 -30
- package/dist/domain/auth/cc-login.d.ts +0 -7
- package/dist/domain/auth/cc-login.js +0 -20
- package/dist/domain/auth/cc-subscription.d.ts +0 -18
- package/dist/domain/auth/cc-subscription.js +0 -54
- package/dist/domain/auth/claude-account-credentials.d.ts +0 -13
- package/dist/domain/auth/claude-account-credentials.js +0 -22
- package/dist/domain/auth/claude-user-settings.d.ts +0 -22
- package/dist/domain/auth/claude-user-settings.js +0 -104
- package/dist/domain/auth/codex-credentials.d.ts +0 -13
- package/dist/domain/auth/codex-credentials.js +0 -25
- package/dist/domain/auth/gateway-sync.d.ts +0 -19
- package/dist/domain/auth/gateway-sync.js +0 -46
- package/dist/domain/auth/index.d.ts +0 -14
- package/dist/domain/auth/index.js +0 -14
- package/dist/domain/auth/login-flow.d.ts +0 -141
- package/dist/domain/auth/login-flow.js +0 -339
- package/dist/domain/auth/login-service.d.ts +0 -33
- package/dist/domain/auth/login-service.js +0 -65
- package/dist/domain/auth/logout.d.ts +0 -32
- package/dist/domain/auth/logout.js +0 -156
- package/dist/domain/auth/pi-login.d.ts +0 -26
- package/dist/domain/auth/pi-login.js +0 -70
- package/dist/domain/auth/pi-oauth.d.ts +0 -26
- package/dist/domain/auth/pi-oauth.js +0 -85
- package/dist/domain/auth/pi-runtime.d.ts +0 -82
- package/dist/domain/auth/pi-runtime.js +0 -40
- package/dist/domain/benchmark/accounting-reconciliation.d.ts +0 -117
- package/dist/domain/benchmark/accounting-reconciliation.js +0 -174
- package/dist/domain/benchmark/atif.d.ts +0 -42
- package/dist/domain/benchmark/atif.js +0 -263
- package/dist/domain/benchmark/attempt-record.d.ts +0 -167
- package/dist/domain/benchmark/attempt-record.js +0 -113
- package/dist/domain/benchmark/benchmark-types.d.ts +0 -17
- package/dist/domain/benchmark/benchmark-types.js +0 -1
- package/dist/domain/benchmark/composite-manifest.d.ts +0 -117
- package/dist/domain/benchmark/composite-manifest.js +0 -477
- package/dist/domain/benchmark/decimal-text.d.ts +0 -22
- package/dist/domain/benchmark/decimal-text.js +0 -42
- package/dist/domain/benchmark/identity.d.ts +0 -39
- package/dist/domain/benchmark/identity.js +0 -70
- package/dist/domain/benchmark/journal.d.ts +0 -47
- package/dist/domain/benchmark/journal.js +0 -254
- package/dist/domain/benchmark/manifest-contract.d.ts +0 -30
- package/dist/domain/benchmark/manifest-contract.js +0 -118
- package/dist/domain/benchmark/production-attempt-identity.d.ts +0 -73
- package/dist/domain/benchmark/production-attempt-identity.js +0 -372
- package/dist/domain/benchmark/production-attempt-journal.d.ts +0 -38
- package/dist/domain/benchmark/production-attempt-journal.js +0 -267
- package/dist/domain/benchmark/production-benchmark-evidence.d.ts +0 -2
- package/dist/domain/benchmark/production-benchmark-evidence.js +0 -67
- package/dist/domain/benchmark/production-evidence-export.d.ts +0 -14
- package/dist/domain/benchmark/production-evidence-export.js +0 -134
- package/dist/domain/benchmark/production-evidence-journal.d.ts +0 -11
- package/dist/domain/benchmark/production-evidence-journal.js +0 -81
- package/dist/domain/benchmark/production-evidence-projection.d.ts +0 -39
- package/dist/domain/benchmark/production-evidence-projection.js +0 -392
- package/dist/domain/benchmark/role-surface.d.ts +0 -4
- package/dist/domain/benchmark/role-surface.js +0 -117
- package/dist/domain/benchmark/session-evidence.d.ts +0 -7
- package/dist/domain/benchmark/session-evidence.js +0 -34
- package/dist/domain/boards/board-context.d.ts +0 -17
- package/dist/domain/boards/board-context.js +0 -11
- package/dist/domain/boards/board-paths.d.ts +0 -18
- package/dist/domain/boards/board-paths.js +0 -32
- package/dist/domain/boards/board-service.d.ts +0 -50
- package/dist/domain/boards/board-service.js +0 -146
- package/dist/domain/boards/board-watcher.d.ts +0 -36
- package/dist/domain/boards/board-watcher.js +0 -284
- package/dist/domain/boards/decision-projection.d.ts +0 -46
- package/dist/domain/boards/decision-projection.js +0 -44
- package/dist/domain/browser/broker.d.ts +0 -99
- package/dist/domain/browser/broker.js +0 -487
- package/dist/domain/costs/account-reset.d.ts +0 -30
- package/dist/domain/costs/account-reset.js +0 -98
- package/dist/domain/costs/aistatus-config.d.ts +0 -27
- package/dist/domain/costs/aistatus-config.js +0 -56
- package/dist/domain/costs/claude-account.d.ts +0 -34
- package/dist/domain/costs/claude-account.js +0 -170
- package/dist/domain/costs/codex-account.d.ts +0 -55
- package/dist/domain/costs/codex-account.js +0 -155
- package/dist/domain/costs/cost-tracker.d.ts +0 -181
- package/dist/domain/costs/cost-tracker.js +0 -350
- package/dist/domain/costs/gateway-manager.d.ts +0 -6
- package/dist/domain/costs/gateway-manager.js +0 -225
- package/dist/domain/costs/rate-limit-throttle.d.ts +0 -78
- package/dist/domain/costs/rate-limit-throttle.js +0 -502
- package/dist/domain/costs/reset-account.d.ts +0 -36
- package/dist/domain/costs/reset-account.js +0 -5
- package/dist/domain/costs/resume-registry.d.ts +0 -30
- package/dist/domain/costs/resume-registry.js +0 -108
- package/dist/domain/costs/usage-service.d.ts +0 -80
- package/dist/domain/costs/usage-service.js +0 -618
- package/dist/domain/costs/usage-store.d.ts +0 -83
- package/dist/domain/costs/usage-store.js +0 -104
- package/dist/domain/executions/registry.d.ts +0 -47
- package/dist/domain/executions/registry.js +0 -100
- package/dist/domain/hooks/hook-view.d.ts +0 -22
- package/dist/domain/hooks/hook-view.js +0 -34
- package/dist/domain/mcp/bundled-server.d.ts +0 -19
- package/dist/domain/mcp/feishu/client.d.ts +0 -46
- package/dist/domain/mcp/feishu/client.js +0 -91
- package/dist/domain/mcp/feishu/file.d.ts +0 -14
- package/dist/domain/mcp/feishu/file.js +0 -88
- package/dist/domain/mcp/feishu/types.d.ts +0 -31
- package/dist/domain/mcp/feishu/types.js +0 -34
- package/dist/domain/mcp/feishu/user-auth.d.ts +0 -140
- package/dist/domain/mcp/feishu/user-auth.js +0 -278
- package/dist/domain/mcp/tools/agents-md.d.ts +0 -16
- package/dist/domain/mcp/tools/agents-md.js +0 -34
- package/dist/domain/mcp/tools/catalog-owner.d.ts +0 -3
- package/dist/domain/mcp/tools/catalog-owner.js +0 -23
- package/dist/domain/mcp/tools/context.d.ts +0 -69
- package/dist/domain/mcp/tools/context.js +0 -106
- package/dist/domain/mcp/tools/cost.d.ts +0 -2
- package/dist/domain/mcp/tools/cost.js +0 -56
- package/dist/domain/mcp/tools/executions.d.ts +0 -2
- package/dist/domain/mcp/tools/executions.js +0 -71
- package/dist/domain/mcp/tools/interaction-ask.d.ts +0 -37
- package/dist/domain/mcp/tools/interaction-ask.js +0 -131
- package/dist/domain/mcp/tools/interaction-plan.d.ts +0 -34
- package/dist/domain/mcp/tools/interaction-plan.js +0 -116
- package/dist/domain/mcp/tools/remote-devices.d.ts +0 -9
- package/dist/domain/mcp/tools/remote-devices.js +0 -28
- package/dist/domain/mcp/tools/remote-file.d.ts +0 -24
- package/dist/domain/mcp/tools/remote-file.js +0 -52
- package/dist/domain/mcp/tools/remote-ops.d.ts +0 -3
- package/dist/domain/mcp/tools/remote-ops.js +0 -359
- package/dist/domain/mcp/tools/slack.d.ts +0 -23
- package/dist/domain/mcp/tools/slack.js +0 -106
- package/dist/domain/mcp/tools/subagent.d.ts +0 -23
- package/dist/domain/mcp/tools/subagent.js +0 -179
- package/dist/domain/mcp/tools/time.d.ts +0 -2
- package/dist/domain/mcp/tools/time.js +0 -62
- package/dist/domain/mcp/tools/ui-board.d.ts +0 -12
- package/dist/domain/mcp/tools/ui-board.js +0 -48
- package/dist/domain/mcp/tools/ui-decision.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-decision.js +0 -37
- package/dist/domain/mcp/tools/ui-file.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-file.js +0 -70
- package/dist/domain/mcp/tools/ui-view.d.ts +0 -3
- package/dist/domain/mcp/tools/ui-view.js +0 -44
- package/dist/domain/mcp/tools/waitpoint.d.ts +0 -28
- package/dist/domain/mcp/tools/waitpoint.js +0 -109
- package/dist/domain/mcp/tools/workers.d.ts +0 -5
- package/dist/domain/mcp/tools/workers.js +0 -77
- package/dist/domain/memory/agents-md-injector.d.ts +0 -25
- package/dist/domain/memory/agents-md-injector.js +0 -58
- package/dist/domain/memory/consolidate.d.ts +0 -56
- package/dist/domain/memory/consolidate.js +0 -419
- package/dist/domain/memory/index-regen.d.ts +0 -30
- package/dist/domain/memory/index-regen.js +0 -334
- package/dist/domain/memory/rules-loader.d.ts +0 -6
- package/dist/domain/memory/rules-loader.js +0 -13
- package/dist/domain/memory/user-context.d.ts +0 -5
- package/dist/domain/memory/user-context.js +0 -32
- package/dist/domain/memory/watcher.d.ts +0 -8
- package/dist/domain/memory/watcher.js +0 -135
- package/dist/domain/monitor/disk-monitor.d.ts +0 -17
- package/dist/domain/monitor/disk-monitor.js +0 -117
- package/dist/domain/monitor/event-loop-monitor.d.ts +0 -35
- package/dist/domain/monitor/event-loop-monitor.js +0 -64
- package/dist/domain/monitor/gpu-monitor.d.ts +0 -26
- package/dist/domain/monitor/gpu-monitor.js +0 -132
- package/dist/domain/pi-providers/custom-provider-model.d.ts +0 -49
- package/dist/domain/pi-providers/custom-provider-model.js +0 -116
- package/dist/domain/pi-providers/custom-provider-service.d.ts +0 -57
- package/dist/domain/pi-providers/custom-provider-service.js +0 -153
- package/dist/domain/pi-providers/gateway-route-store.d.ts +0 -23
- package/dist/domain/pi-providers/gateway-route-store.js +0 -74
- package/dist/domain/pi-providers/index.d.ts +0 -3
- package/dist/domain/pi-providers/index.js +0 -3
- package/dist/domain/pi-providers/models-json-store.d.ts +0 -6
- package/dist/domain/pi-providers/models-json-store.js +0 -73
- package/dist/domain/plugins/agent-plugins-v1.d.ts +0 -58
- package/dist/domain/plugins/agent-plugins-v1.js +0 -84
- package/dist/domain/plugins/authoring.d.ts +0 -46
- package/dist/domain/plugins/authoring.js +0 -335
- package/dist/domain/plugins/builtin.d.ts +0 -25
- package/dist/domain/plugins/builtin.js +0 -44
- package/dist/domain/plugins/catalog-types.d.ts +0 -89
- package/dist/domain/plugins/catalog-types.js +0 -39
- package/dist/domain/plugins/catalog.d.ts +0 -39
- package/dist/domain/plugins/catalog.js +0 -482
- package/dist/domain/plugins/conversation-skills.d.ts +0 -10
- package/dist/domain/plugins/conversation-skills.js +0 -22
- package/dist/domain/plugins/fs-helpers.d.ts +0 -9
- package/dist/domain/plugins/fs-helpers.js +0 -107
- package/dist/domain/plugins/mcp.d.ts +0 -6
- package/dist/domain/plugins/mcp.js +0 -223
- package/dist/domain/plugins/runtime-gc.d.ts +0 -17
- package/dist/domain/plugins/runtime-gc.js +0 -101
- package/dist/domain/plugins/runtime.d.ts +0 -21
- package/dist/domain/plugins/runtime.js +0 -555
- package/dist/domain/plugins/skill-projection.d.ts +0 -19
- package/dist/domain/plugins/skill-projection.js +0 -193
- package/dist/domain/plugins/skill.d.ts +0 -14
- package/dist/domain/plugins/skill.js +0 -145
- package/dist/domain/projects/index.d.ts +0 -3
- package/dist/domain/projects/index.js +0 -3
- package/dist/domain/projects/project-store.d.ts +0 -72
- package/dist/domain/projects/project-store.js +0 -240
- package/dist/domain/projects/project-types.d.ts +0 -11
- package/dist/domain/projects/project-types.js +0 -1
- package/dist/domain/remote/client-bootstrap.d.ts +0 -1
- package/dist/domain/remote/client-bootstrap.js +0 -126
- package/dist/domain/remote/client-hot-reload.d.ts +0 -40
- package/dist/domain/remote/client-hot-reload.js +0 -269
- package/dist/domain/remote/client-lifecycle.d.ts +0 -32
- package/dist/domain/remote/client-lifecycle.js +0 -382
- package/dist/domain/remote/client-manager.d.ts +0 -54
- package/dist/domain/remote/client-manager.js +0 -325
- package/dist/domain/remote/client-pids.d.ts +0 -13
- package/dist/domain/remote/client-pids.js +0 -43
- package/dist/domain/remote/client-protocol.d.ts +0 -1
- package/dist/domain/remote/client-protocol.js +0 -1
- package/dist/domain/remote/client-remove.d.ts +0 -61
- package/dist/domain/remote/client-remove.js +0 -129
- package/dist/domain/remote/client-ssh-tunnel.d.ts +0 -79
- package/dist/domain/remote/client-ssh-tunnel.js +0 -352
- package/dist/domain/remote/device-browser.d.ts +0 -38
- package/dist/domain/remote/device-browser.js +0 -158
- package/dist/domain/remote/device-chrome-commands.d.ts +0 -18
- package/dist/domain/remote/device-chrome-commands.js +0 -125
- package/dist/domain/remote/device-file.d.ts +0 -51
- package/dist/domain/remote/device-file.js +0 -193
- package/dist/domain/remote/device-port.d.ts +0 -23
- package/dist/domain/remote/device-port.js +0 -192
- package/dist/domain/remote/local-client-install.d.ts +0 -32
- package/dist/domain/remote/local-client-install.js +0 -168
- package/dist/domain/remote/local-client-stop.d.ts +0 -37
- package/dist/domain/remote/local-client-stop.js +0 -101
- package/dist/domain/remote/machine-registry.d.ts +0 -54
- package/dist/domain/remote/machine-registry.js +0 -184
- package/dist/domain/remote/owned-local-launch.d.ts +0 -22
- package/dist/domain/remote/owned-local-launch.js +0 -75
- package/dist/domain/remote/package-client-bundle.d.ts +0 -14
- package/dist/domain/remote/package-client-bundle.js +0 -37
- package/dist/domain/remote/reverse-stream.d.ts +0 -42
- package/dist/domain/remote/reverse-stream.js +0 -95
- package/dist/domain/remote/ssh-exec.d.ts +0 -10
- package/dist/domain/remote/ssh-exec.js +0 -25
- package/dist/domain/runs/adapters.d.ts +0 -15
- package/dist/domain/runs/adapters.js +0 -59
- package/dist/domain/runs/attempt.d.ts +0 -37
- package/dist/domain/runs/attempt.js +0 -232
- package/dist/domain/runs/builders.d.ts +0 -27
- package/dist/domain/runs/builders.js +0 -47
- package/dist/domain/runs/compact.d.ts +0 -30
- package/dist/domain/runs/compact.js +0 -43
- package/dist/domain/runs/config-resolver.d.ts +0 -26
- package/dist/domain/runs/config-resolver.js +0 -38
- package/dist/domain/runs/engine-spec.d.ts +0 -40
- package/dist/domain/runs/engine-spec.js +0 -215
- package/dist/domain/runs/engines.d.ts +0 -71
- package/dist/domain/runs/engines.js +0 -181
- package/dist/domain/runs/events.d.ts +0 -2
- package/dist/domain/runs/events.js +0 -1
- package/dist/domain/runs/fallback.d.ts +0 -11
- package/dist/domain/runs/fallback.js +0 -18
- package/dist/domain/runs/mode-env.d.ts +0 -16
- package/dist/domain/runs/mode-env.js +0 -48
- package/dist/domain/runs/notices.d.ts +0 -44
- package/dist/domain/runs/notices.js +0 -109
- package/dist/domain/runs/observers/resume-recorder.d.ts +0 -26
- package/dist/domain/runs/observers/resume-recorder.js +0 -27
- package/dist/domain/runs/prompt.d.ts +0 -78
- package/dist/domain/runs/prompt.js +0 -98
- package/dist/domain/runs/request.d.ts +0 -99
- package/dist/domain/runs/request.js +0 -1
- package/dist/domain/runs/retryable-errors.d.ts +0 -5
- package/dist/domain/runs/retryable-errors.js +0 -24
- package/dist/domain/runs/run.d.ts +0 -238
- package/dist/domain/runs/run.js +0 -574
- package/dist/domain/runs/service.d.ts +0 -3
- package/dist/domain/runs/service.js +0 -63
- package/dist/domain/runs/spec-loader.d.ts +0 -75
- package/dist/domain/runs/spec-loader.js +0 -58
- package/dist/domain/runs/spend.d.ts +0 -16
- package/dist/domain/runs/spend.js +0 -31
- package/dist/domain/scheduling/builtin-job-controller.d.ts +0 -21
- package/dist/domain/scheduling/builtin-job-controller.js +0 -106
- package/dist/domain/scheduling/builtin-job-migration.d.ts +0 -23
- package/dist/domain/scheduling/builtin-job-migration.js +0 -64
- package/dist/domain/scheduling/builtin-jobs.d.ts +0 -2
- package/dist/domain/scheduling/builtin-jobs.js +0 -44
- package/dist/domain/scheduling/job-registry.d.ts +0 -22
- package/dist/domain/scheduling/job-registry.js +0 -16
- package/dist/domain/scheduling/jobs/auth-expiry-scan.d.ts +0 -15
- package/dist/domain/scheduling/jobs/auth-expiry-scan.js +0 -75
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +0 -24
- package/dist/domain/scheduling/jobs/scheduled-task.js +0 -112
- package/dist/domain/scheduling/jobs/sync-public.d.ts +0 -4
- package/dist/domain/scheduling/jobs/sync-public.js +0 -40
- package/dist/domain/scheduling/run-guards.d.ts +0 -6
- package/dist/domain/scheduling/run-guards.js +0 -18
- package/dist/domain/scheduling/runner.d.ts +0 -17
- package/dist/domain/scheduling/runner.js +0 -22
- package/dist/domain/scheduling/schedule-ops.d.ts +0 -15
- package/dist/domain/scheduling/schedule-ops.js +0 -43
- package/dist/domain/scheduling/schedule-selection.d.ts +0 -3
- package/dist/domain/scheduling/schedule-selection.js +0 -16
- package/dist/domain/scheduling/schedule-spec.d.ts +0 -79
- package/dist/domain/scheduling/schedule-spec.js +0 -169
- package/dist/domain/scheduling/scheduler.d.ts +0 -75
- package/dist/domain/scheduling/scheduler.js +0 -312
- package/dist/domain/sessions/session-backup.d.ts +0 -44
- package/dist/domain/sessions/session-backup.js +0 -138
- package/dist/domain/sessions/session-hooks.d.ts +0 -130
- package/dist/domain/sessions/session-hooks.js +0 -347
- package/dist/domain/sessions/session-lifecycle.d.ts +0 -91
- package/dist/domain/sessions/session-lifecycle.js +0 -82
- package/dist/domain/sessions/session-retention.d.ts +0 -50
- package/dist/domain/sessions/session-retention.js +0 -466
- package/dist/domain/sessions/session-use.d.ts +0 -28
- package/dist/domain/sessions/session-use.js +0 -45
- package/dist/domain/sessions/session.d.ts +0 -3
- package/dist/domain/sessions/session.js +0 -13
- package/dist/domain/sessions/team.d.ts +0 -26
- package/dist/domain/sessions/team.js +0 -30
- package/dist/domain/system/doctor.d.ts +0 -82
- package/dist/domain/system/doctor.js +0 -484
- package/dist/domain/system/github-release.d.ts +0 -16
- package/dist/domain/system/github-release.js +0 -101
- package/dist/domain/system/install-cli.d.ts +0 -7
- package/dist/domain/system/install-cli.js +0 -107
- package/dist/domain/system/notice-history.d.ts +0 -18
- package/dist/domain/system/notice-history.js +0 -23
- package/dist/domain/system/own-bin-path.d.ts +0 -13
- package/dist/domain/system/own-bin-path.js +0 -36
- package/dist/domain/system/preferences.d.ts +0 -30
- package/dist/domain/system/preferences.js +0 -59
- package/dist/domain/system/rebuild-hold.d.ts +0 -36
- package/dist/domain/system/rebuild-hold.js +0 -83
- package/dist/domain/system/server-update-check.d.ts +0 -24
- package/dist/domain/system/server-update-check.js +0 -89
- package/dist/domain/system/server-update-coordinator.d.ts +0 -46
- package/dist/domain/system/server-update-coordinator.js +0 -155
- package/dist/domain/system/server-update-install.d.ts +0 -16
- package/dist/domain/system/server-update-install.js +0 -65
- package/dist/domain/system/system-notice.d.ts +0 -24
- package/dist/domain/system/system-notice.js +0 -31
- package/dist/domain/system/terminal-cli/index.d.ts +0 -58
- package/dist/domain/system/terminal-cli/index.js +0 -100
- package/dist/domain/system/terminal-cli/posix-profiles.d.ts +0 -23
- package/dist/domain/system/terminal-cli/posix-profiles.js +0 -74
- package/dist/domain/system/terminal-cli/registrar.d.ts +0 -12
- package/dist/domain/system/terminal-cli/registrar.js +0 -1
- package/dist/domain/system/terminal-cli/shims.d.ts +0 -27
- package/dist/domain/system/terminal-cli/shims.js +0 -108
- package/dist/domain/system/terminal-cli/state.d.ts +0 -7
- package/dist/domain/system/terminal-cli/state.js +0 -36
- package/dist/domain/system/terminal-cli/windows-user-path.d.ts +0 -13
- package/dist/domain/system/terminal-cli/windows-user-path.js +0 -67
- package/dist/domain/system/update-prompt.d.ts +0 -8
- package/dist/domain/system/update-prompt.js +0 -1
- package/dist/domain/system/update-state.d.ts +0 -9
- package/dist/domain/system/update-state.js +0 -22
- package/dist/domain/system/update-ui-state.d.ts +0 -39
- package/dist/domain/system/update-ui-state.js +0 -70
- package/dist/domain/telemetry/bus-collector.d.ts +0 -3
- package/dist/domain/telemetry/bus-collector.js +0 -22
- package/dist/domain/telemetry/child-exit.d.ts +0 -11
- package/dist/domain/telemetry/child-exit.js +0 -36
- package/dist/domain/telemetry/client-kind.d.ts +0 -4
- package/dist/domain/telemetry/client-kind.js +0 -7
- package/dist/domain/telemetry/crash-limits.d.ts +0 -15
- package/dist/domain/telemetry/crash-limits.js +0 -50
- package/dist/domain/telemetry/crash.d.ts +0 -25
- package/dist/domain/telemetry/crash.js +0 -70
- package/dist/domain/telemetry/daily-upload.d.ts +0 -5
- package/dist/domain/telemetry/daily-upload.js +0 -20
- package/dist/domain/telemetry/daily.d.ts +0 -5
- package/dist/domain/telemetry/daily.js +0 -104
- package/dist/domain/telemetry/endpoint.d.ts +0 -7
- package/dist/domain/telemetry/endpoint.js +0 -40
- package/dist/domain/telemetry/envelope.d.ts +0 -6
- package/dist/domain/telemetry/envelope.js +0 -35
- package/dist/domain/telemetry/error-digest.d.ts +0 -7
- package/dist/domain/telemetry/error-digest.js +0 -43
- package/dist/domain/telemetry/funnel.d.ts +0 -6
- package/dist/domain/telemetry/funnel.js +0 -22
- package/dist/domain/telemetry/gate.d.ts +0 -19
- package/dist/domain/telemetry/gate.js +0 -67
- package/dist/domain/telemetry/heartbeat.d.ts +0 -17
- package/dist/domain/telemetry/heartbeat.js +0 -49
- package/dist/domain/telemetry/info.d.ts +0 -9
- package/dist/domain/telemetry/info.js +0 -12
- package/dist/domain/telemetry/init-answer.d.ts +0 -12
- package/dist/domain/telemetry/init-answer.js +0 -42
- package/dist/domain/telemetry/install-id.d.ts +0 -5
- package/dist/domain/telemetry/install-id.js +0 -42
- package/dist/domain/telemetry/normalize.d.ts +0 -33
- package/dist/domain/telemetry/normalize.js +0 -88
- package/dist/domain/telemetry/outbox.d.ts +0 -18
- package/dist/domain/telemetry/outbox.js +0 -93
- package/dist/domain/telemetry/panic-group.d.ts +0 -4
- package/dist/domain/telemetry/panic-group.js +0 -51
- package/dist/domain/telemetry/paths.d.ts +0 -7
- package/dist/domain/telemetry/paths.js +0 -11
- package/dist/domain/telemetry/redact.d.ts +0 -18
- package/dist/domain/telemetry/redact.js +0 -109
- package/dist/domain/telemetry/rollup-types.d.ts +0 -81
- package/dist/domain/telemetry/rollup-types.js +0 -31
- package/dist/domain/telemetry/rollup.d.ts +0 -16
- package/dist/domain/telemetry/rollup.js +0 -102
- package/dist/domain/telemetry/schema.d.ts +0 -931
- package/dist/domain/telemetry/schema.js +0 -275
- package/dist/domain/telemetry/service.d.ts +0 -34
- package/dist/domain/telemetry/service.js +0 -146
- package/dist/domain/telemetry/state.d.ts +0 -17
- package/dist/domain/telemetry/state.js +0 -29
- package/dist/domain/telemetry/turns.d.ts +0 -17
- package/dist/domain/telemetry/turns.js +0 -176
- package/dist/domain/telemetry/upgrade.d.ts +0 -14
- package/dist/domain/telemetry/upgrade.js +0 -87
- package/dist/domain/telemetry/uploader.d.ts +0 -21
- package/dist/domain/telemetry/uploader.js +0 -82
- package/dist/domain/telemetry/usage.d.ts +0 -25
- package/dist/domain/telemetry/usage.js +0 -153
- package/dist/domain/telemetry/web-report.d.ts +0 -8
- package/dist/domain/telemetry/web-report.js +0 -15
- package/dist/domain/tui-session/index.d.ts +0 -2
- package/dist/domain/tui-session/index.js +0 -1
- package/dist/domain/tui-session/tui-session-service.d.ts +0 -2
- package/dist/domain/tui-session/tui-session-service.js +0 -85
- package/dist/domain/tui-session/types.d.ts +0 -40
- package/dist/domain/tui-session/types.js +0 -1
- package/dist/domain/ui-service/app-router.d.ts +0 -1180
- package/dist/domain/ui-service/app-router.js +0 -312
- package/dist/domain/ui-service/assistant-snapshots.d.ts +0 -10
- package/dist/domain/ui-service/assistant-snapshots.js +0 -45
- package/dist/domain/ui-service/contract.parity.d.ts +0 -19
- package/dist/domain/ui-service/contract.parity.js +0 -1
- package/dist/domain/ui-service/index.d.ts +0 -4
- package/dist/domain/ui-service/index.js +0 -1
- package/dist/domain/ui-service/inline-media-types.d.ts +0 -18
- package/dist/domain/ui-service/inline-media-types.js +0 -1
- package/dist/domain/ui-service/input-schemas.d.ts +0 -1132
- package/dist/domain/ui-service/input-schemas.js +0 -710
- package/dist/domain/ui-service/mutate/approvals.d.ts +0 -33
- package/dist/domain/ui-service/mutate/approvals.js +0 -134
- package/dist/domain/ui-service/mutate/auth.d.ts +0 -15
- package/dist/domain/ui-service/mutate/auth.js +0 -103
- package/dist/domain/ui-service/mutate/config.d.ts +0 -18
- package/dist/domain/ui-service/mutate/config.js +0 -108
- package/dist/domain/ui-service/mutate/custom-providers.d.ts +0 -8
- package/dist/domain/ui-service/mutate/custom-providers.js +0 -33
- package/dist/domain/ui-service/mutate/environments.d.ts +0 -27
- package/dist/domain/ui-service/mutate/environments.js +0 -66
- package/dist/domain/ui-service/mutate/errors.d.ts +0 -7
- package/dist/domain/ui-service/mutate/errors.js +0 -14
- package/dist/domain/ui-service/mutate/executions.d.ts +0 -4
- package/dist/domain/ui-service/mutate/executions.js +0 -15
- package/dist/domain/ui-service/mutate/hooks.d.ts +0 -12
- package/dist/domain/ui-service/mutate/hooks.js +0 -110
- package/dist/domain/ui-service/mutate/issues.d.ts +0 -18
- package/dist/domain/ui-service/mutate/issues.js +0 -100
- package/dist/domain/ui-service/mutate/models.d.ts +0 -13
- package/dist/domain/ui-service/mutate/models.js +0 -137
- package/dist/domain/ui-service/mutate/notes.d.ts +0 -6
- package/dist/domain/ui-service/mutate/notes.js +0 -32
- package/dist/domain/ui-service/mutate/platform-settings.d.ts +0 -6
- package/dist/domain/ui-service/mutate/platform-settings.js +0 -17
- package/dist/domain/ui-service/mutate/plugin-packages.d.ts +0 -10
- package/dist/domain/ui-service/mutate/plugin-packages.js +0 -152
- package/dist/domain/ui-service/mutate/plugins.d.ts +0 -2
- package/dist/domain/ui-service/mutate/plugins.js +0 -38
- package/dist/domain/ui-service/mutate/projects.d.ts +0 -4
- package/dist/domain/ui-service/mutate/projects.js +0 -7
- package/dist/domain/ui-service/mutate/resolve-media.d.ts +0 -4
- package/dist/domain/ui-service/mutate/resolve-media.js +0 -17
- package/dist/domain/ui-service/mutate/schedules.d.ts +0 -12
- package/dist/domain/ui-service/mutate/schedules.js +0 -75
- package/dist/domain/ui-service/mutate/session-metadata.d.ts +0 -3
- package/dist/domain/ui-service/mutate/session-metadata.js +0 -22
- package/dist/domain/ui-service/mutate/sessions.d.ts +0 -19
- package/dist/domain/ui-service/mutate/sessions.js +0 -307
- package/dist/domain/ui-service/mutate/system.d.ts +0 -10
- package/dist/domain/ui-service/mutate/system.js +0 -120
- package/dist/domain/ui-service/mutate/telemetry.d.ts +0 -5
- package/dist/domain/ui-service/mutate/telemetry.js +0 -6
- package/dist/domain/ui-service/mutate/usage-sharing.d.ts +0 -8
- package/dist/domain/ui-service/mutate/usage-sharing.js +0 -16
- package/dist/domain/ui-service/mutate/waitpoints.d.ts +0 -2
- package/dist/domain/ui-service/mutate/waitpoints.js +0 -13
- package/dist/domain/ui-service/platform-settings.d.ts +0 -5
- package/dist/domain/ui-service/platform-settings.js +0 -72
- package/dist/domain/ui-service/plugins-shared.d.ts +0 -29
- package/dist/domain/ui-service/plugins-shared.js +0 -176
- package/dist/domain/ui-service/query/approvals.d.ts +0 -10
- package/dist/domain/ui-service/query/approvals.js +0 -119
- package/dist/domain/ui-service/query/auth.d.ts +0 -6
- package/dist/domain/ui-service/query/auth.js +0 -8
- package/dist/domain/ui-service/query/boards.d.ts +0 -14
- package/dist/domain/ui-service/query/boards.js +0 -111
- package/dist/domain/ui-service/query/config.d.ts +0 -9
- package/dist/domain/ui-service/query/config.js +0 -167
- package/dist/domain/ui-service/query/cost.d.ts +0 -3
- package/dist/domain/ui-service/query/cost.js +0 -3
- package/dist/domain/ui-service/query/custom-providers.d.ts +0 -8
- package/dist/domain/ui-service/query/custom-providers.js +0 -9
- package/dist/domain/ui-service/query/environments.d.ts +0 -12
- package/dist/domain/ui-service/query/environments.js +0 -73
- package/dist/domain/ui-service/query/executions.d.ts +0 -3
- package/dist/domain/ui-service/query/executions.js +0 -61
- package/dist/domain/ui-service/query/hooks.d.ts +0 -9
- package/dist/domain/ui-service/query/hooks.js +0 -92
- package/dist/domain/ui-service/query/issues.d.ts +0 -14
- package/dist/domain/ui-service/query/issues.js +0 -78
- package/dist/domain/ui-service/query/machine-detail.d.ts +0 -2
- package/dist/domain/ui-service/query/machine-detail.js +0 -30
- package/dist/domain/ui-service/query/machine-probe.d.ts +0 -18
- package/dist/domain/ui-service/query/machine-probe.js +0 -133
- package/dist/domain/ui-service/query/machines.d.ts +0 -2
- package/dist/domain/ui-service/query/machines.js +0 -21
- package/dist/domain/ui-service/query/memory.d.ts +0 -7
- package/dist/domain/ui-service/query/memory.js +0 -191
- package/dist/domain/ui-service/query/models.d.ts +0 -27
- package/dist/domain/ui-service/query/models.js +0 -125
- package/dist/domain/ui-service/query/notes.d.ts +0 -3
- package/dist/domain/ui-service/query/notes.js +0 -15
- package/dist/domain/ui-service/query/plugin-source.d.ts +0 -4
- package/dist/domain/ui-service/query/plugin-source.js +0 -58
- package/dist/domain/ui-service/query/plugins.d.ts +0 -2
- package/dist/domain/ui-service/query/plugins.js +0 -28
- package/dist/domain/ui-service/query/projects.d.ts +0 -2
- package/dist/domain/ui-service/query/projects.js +0 -27
- package/dist/domain/ui-service/query/schedules.d.ts +0 -5
- package/dist/domain/ui-service/query/schedules.js +0 -28
- package/dist/domain/ui-service/query/sessions.d.ts +0 -6
- package/dist/domain/ui-service/query/sessions.js +0 -430
- package/dist/domain/ui-service/query/skills.d.ts +0 -5
- package/dist/domain/ui-service/query/skills.js +0 -16
- package/dist/domain/ui-service/query/system.d.ts +0 -6
- package/dist/domain/ui-service/query/system.js +0 -120
- package/dist/domain/ui-service/query/telemetry.d.ts +0 -3
- package/dist/domain/ui-service/query/telemetry.js +0 -4
- package/dist/domain/ui-service/query/usage-sharing.d.ts +0 -4
- package/dist/domain/ui-service/query/usage-sharing.js +0 -5
- package/dist/domain/ui-service/query/waitpoints.d.ts +0 -10
- package/dist/domain/ui-service/query/waitpoints.js +0 -37
- package/dist/domain/ui-service/query-input-schemas.d.ts +0 -73
- package/dist/domain/ui-service/query-input-schemas.js +0 -70
- package/dist/domain/ui-service/session-metadata-schemas.d.ts +0 -13
- package/dist/domain/ui-service/session-metadata-schemas.js +0 -9
- package/dist/domain/ui-service/subscribe.d.ts +0 -6
- package/dist/domain/ui-service/subscribe.js +0 -125
- package/dist/domain/ui-service/trpc.d.ts +0 -52
- package/dist/domain/ui-service/trpc.js +0 -43
- package/dist/domain/ui-service/types.d.ts +0 -1808
- package/dist/domain/ui-service/types.js +0 -1
- package/dist/domain/ui-service/ui-service.d.ts +0 -541
- package/dist/domain/ui-service/ui-service.js +0 -235
- package/dist/domain/waitpoints/notices.d.ts +0 -25
- package/dist/domain/waitpoints/notices.js +0 -125
- package/dist/domain/waitpoints/service.d.ts +0 -107
- package/dist/domain/waitpoints/service.js +0 -276
- package/dist/domain/waitpoints/view.d.ts +0 -29
- package/dist/domain/waitpoints/view.js +0 -97
- package/dist/entry/admin-channel-hot-reload.d.ts +0 -4
- package/dist/entry/admin-channel-hot-reload.js +0 -17
- package/dist/entry/app.d.ts +0 -1
- package/dist/entry/auth-cli.d.ts +0 -9
- package/dist/entry/auth-cli.js +0 -55
- package/dist/entry/auth-login-cli.d.ts +0 -20
- package/dist/entry/auth-login-cli.js +0 -153
- package/dist/entry/auth-login-terminal.d.ts +0 -16
- package/dist/entry/auth-login-terminal.js +0 -59
- package/dist/entry/boot-jobs.d.ts +0 -7
- package/dist/entry/boot-jobs.js +0 -16
- package/dist/entry/browser-cli.d.ts +0 -39
- package/dist/entry/cli-help.d.ts +0 -10
- package/dist/entry/cli-help.js +0 -290
- package/dist/entry/cli.d.ts +0 -19
- package/dist/entry/client-cli.d.ts +0 -4
- package/dist/entry/client-cli.js +0 -62
- package/dist/entry/cortex-cli.d.ts +0 -1
- package/dist/entry/daemon-notice.d.ts +0 -26
- package/dist/entry/daemon-notice.js +0 -38
- package/dist/entry/daemon.d.ts +0 -120
- package/dist/entry/doctor-cli.d.ts +0 -8
- package/dist/entry/doctor-cli.js +0 -70
- package/dist/entry/draft-attachments.d.ts +0 -8
- package/dist/entry/draft-attachments.js +0 -79
- package/dist/entry/fast-install.d.ts +0 -49
- package/dist/entry/fast-install.js +0 -192
- package/dist/entry/feishu-login.d.ts +0 -21
- package/dist/entry/feishu-login.js +0 -209
- package/dist/entry/hook-cli.d.ts +0 -14
- package/dist/entry/init-auth.d.ts +0 -4
- package/dist/entry/init-auth.js +0 -42
- package/dist/entry/init-git.d.ts +0 -6
- package/dist/entry/init-git.js +0 -36
- package/dist/entry/init-local-client.d.ts +0 -11
- package/dist/entry/init-local-client.js +0 -34
- package/dist/entry/init.d.ts +0 -151
- package/dist/entry/init.js +0 -1292
- package/dist/entry/local-ui.d.ts +0 -38
- package/dist/entry/local-ui.js +0 -107
- package/dist/entry/memory-cli.d.ts +0 -3
- package/dist/entry/memory-cli.js +0 -79
- package/dist/entry/path-cli.d.ts +0 -4
- package/dist/entry/path-cli.js +0 -65
- package/dist/entry/platform-connect.d.ts +0 -23
- package/dist/entry/platform-connect.js +0 -94
- package/dist/entry/production-app-bootstrap.d.ts +0 -1
- package/dist/entry/production-evidence-export-cli.d.ts +0 -13
- package/dist/entry/provider-cli.d.ts +0 -12
- package/dist/entry/provider-cli.js +0 -199
- package/dist/entry/schedule-cli.d.ts +0 -10
- package/dist/entry/schedule-cli.js +0 -166
- package/dist/entry/shutdown.d.ts +0 -32
- package/dist/entry/shutdown.js +0 -84
- package/dist/entry/signal-cli.d.ts +0 -25
- package/dist/entry/start-ui-http.d.ts +0 -24
- package/dist/entry/start-ui-http.js +0 -188
- package/dist/entry/startup-helpers.d.ts +0 -2
- package/dist/entry/startup-helpers.js +0 -15
- package/dist/entry/startup-notify.d.ts +0 -6
- package/dist/entry/startup-notify.js +0 -18
- package/dist/entry/telemetry-wiring.d.ts +0 -12
- package/dist/entry/telemetry-wiring.js +0 -56
- package/dist/entry/ui-cli.d.ts +0 -2
- package/dist/entry/ui-cli.js +0 -87
- package/dist/entry/ui-http-gate.d.ts +0 -17
- package/dist/entry/ui-http-gate.js +0 -17
- package/dist/entry/ui-service-wiring.d.ts +0 -12
- package/dist/entry/ui-service-wiring.js +0 -144
- package/dist/events/event-bus.d.ts +0 -47
- package/dist/events/event-bus.js +0 -83
- package/dist/events/event-logger.d.ts +0 -12
- package/dist/events/event-logger.js +0 -144
- package/dist/events/event-types.d.ts +0 -259
- package/dist/events/event-types.js +0 -1
- package/dist/events/index.d.ts +0 -5
- package/dist/events/index.js +0 -2
- package/dist/orchestration/agent-decision-send.d.ts +0 -42
- package/dist/orchestration/agent-decision-send.js +0 -62
- package/dist/orchestration/agent-file-send.d.ts +0 -58
- package/dist/orchestration/agent-file-send.js +0 -69
- package/dist/orchestration/agent-runner.d.ts +0 -52
- package/dist/orchestration/agent-runner.js +0 -230
- package/dist/orchestration/agent-view-send.d.ts +0 -66
- package/dist/orchestration/agent-view-send.js +0 -103
- package/dist/orchestration/attachments-store.d.ts +0 -31
- package/dist/orchestration/attachments-store.js +0 -156
- package/dist/orchestration/benchmark-session-webhook.d.ts +0 -19
- package/dist/orchestration/benchmark-session-webhook.js +0 -142
- package/dist/orchestration/board-webhook.d.ts +0 -7
- package/dist/orchestration/board-webhook.js +0 -38
- package/dist/orchestration/browser-webhook.d.ts +0 -11
- package/dist/orchestration/browser-webhook.js +0 -28
- package/dist/orchestration/busy-tracker.d.ts +0 -15
- package/dist/orchestration/busy-tracker.js +0 -38
- package/dist/orchestration/cache-keep-warm.d.ts +0 -77
- package/dist/orchestration/cache-keep-warm.js +0 -213
- package/dist/orchestration/claude-window-warmup.d.ts +0 -40
- package/dist/orchestration/claude-window-warmup.js +0 -126
- package/dist/orchestration/conduit-queue.d.ts +0 -14
- package/dist/orchestration/conduit-queue.js +0 -53
- package/dist/orchestration/conversation-request.d.ts +0 -163
- package/dist/orchestration/conversation-request.js +0 -276
- package/dist/orchestration/delta-coalescer.d.ts +0 -69
- package/dist/orchestration/delta-coalescer.js +0 -120
- package/dist/orchestration/durable-helpers.d.ts +0 -3
- package/dist/orchestration/durable-helpers.js +0 -38
- package/dist/orchestration/edit-retry.d.ts +0 -35
- package/dist/orchestration/edit-retry.js +0 -127
- package/dist/orchestration/injection-ledger.d.ts +0 -56
- package/dist/orchestration/injection-ledger.js +0 -270
- package/dist/orchestration/inline-media-eager.d.ts +0 -13
- package/dist/orchestration/inline-media-eager.js +0 -58
- package/dist/orchestration/inline-media.d.ts +0 -22
- package/dist/orchestration/inline-media.js +0 -151
- package/dist/orchestration/interactions/answer-question.d.ts +0 -16
- package/dist/orchestration/interactions/answer-question.js +0 -38
- package/dist/orchestration/interactions/ask-user-question.d.ts +0 -34
- package/dist/orchestration/interactions/ask-user-question.js +0 -179
- package/dist/orchestration/interactions/ask-user-resume.d.ts +0 -11
- package/dist/orchestration/interactions/ask-user-resume.js +0 -57
- package/dist/orchestration/interactions/command-action-router.d.ts +0 -31
- package/dist/orchestration/interactions/command-action-router.js +0 -48
- package/dist/orchestration/interactions/interaction-handlers.d.ts +0 -5
- package/dist/orchestration/interactions/interaction-handlers.js +0 -288
- package/dist/orchestration/interactions/interaction-records.d.ts +0 -57
- package/dist/orchestration/interactions/interaction-records.js +0 -142
- package/dist/orchestration/interactions/plan-approvals.d.ts +0 -38
- package/dist/orchestration/interactions/plan-approvals.js +0 -73
- package/dist/orchestration/interactions/plan-handler.d.ts +0 -3
- package/dist/orchestration/interactions/plan-handler.js +0 -13
- package/dist/orchestration/interactions/plan-response.d.ts +0 -9
- package/dist/orchestration/interactions/plan-response.js +0 -23
- package/dist/orchestration/interactions/ui-update-prompt.d.ts +0 -8
- package/dist/orchestration/interactions/ui-update-prompt.js +0 -39
- package/dist/orchestration/interactions/update-prompt.d.ts +0 -6
- package/dist/orchestration/interactions/update-prompt.js +0 -150
- package/dist/orchestration/mid-turn-inject.d.ts +0 -64
- package/dist/orchestration/mid-turn-inject.js +0 -103
- package/dist/orchestration/orchestrator.d.ts +0 -23
- package/dist/orchestration/orchestrator.js +0 -12
- package/dist/orchestration/outputs-store.d.ts +0 -40
- package/dist/orchestration/outputs-store.js +0 -83
- package/dist/orchestration/pending-injection-recovery.d.ts +0 -36
- package/dist/orchestration/pending-injection-recovery.js +0 -88
- package/dist/orchestration/pi-background-subagent.d.ts +0 -15
- package/dist/orchestration/pi-background-subagent.js +0 -34
- package/dist/orchestration/resume-dispatcher.d.ts +0 -20
- package/dist/orchestration/resume-dispatcher.js +0 -97
- package/dist/orchestration/resume-target-sink.d.ts +0 -37
- package/dist/orchestration/resume-target-sink.js +0 -68
- package/dist/orchestration/routing/commands/cancel.d.ts +0 -58
- package/dist/orchestration/routing/commands/cancel.js +0 -212
- package/dist/orchestration/routing/commands/channel.d.ts +0 -7
- package/dist/orchestration/routing/commands/channel.js +0 -229
- package/dist/orchestration/routing/commands/command-context.d.ts +0 -14
- package/dist/orchestration/routing/commands/command-context.js +0 -1
- package/dist/orchestration/routing/commands/compact.d.ts +0 -6
- package/dist/orchestration/routing/commands/compact.js +0 -22
- package/dist/orchestration/routing/commands/cost.d.ts +0 -11
- package/dist/orchestration/routing/commands/cost.js +0 -101
- package/dist/orchestration/routing/commands/device.d.ts +0 -4
- package/dist/orchestration/routing/commands/device.js +0 -70
- package/dist/orchestration/routing/commands/index.d.ts +0 -22
- package/dist/orchestration/routing/commands/index.js +0 -160
- package/dist/orchestration/routing/commands/lang.d.ts +0 -9
- package/dist/orchestration/routing/commands/lang.js +0 -34
- package/dist/orchestration/routing/commands/login-custom.d.ts +0 -26
- package/dist/orchestration/routing/commands/login-custom.js +0 -85
- package/dist/orchestration/routing/commands/login-notice.d.ts +0 -23
- package/dist/orchestration/routing/commands/login-notice.js +0 -84
- package/dist/orchestration/routing/commands/login.d.ts +0 -12
- package/dist/orchestration/routing/commands/login.js +0 -560
- package/dist/orchestration/routing/commands/mode.d.ts +0 -10
- package/dist/orchestration/routing/commands/mode.js +0 -302
- package/dist/orchestration/routing/commands/nvtop.d.ts +0 -3
- package/dist/orchestration/routing/commands/nvtop.js +0 -107
- package/dist/orchestration/routing/commands/orient.d.ts +0 -2
- package/dist/orchestration/routing/commands/orient.js +0 -5
- package/dist/orchestration/routing/commands/restart.d.ts +0 -18
- package/dist/orchestration/routing/commands/restart.js +0 -31
- package/dist/orchestration/routing/commands/schedule.d.ts +0 -6
- package/dist/orchestration/routing/commands/schedule.js +0 -206
- package/dist/orchestration/routing/commands/sendfile.d.ts +0 -2
- package/dist/orchestration/routing/commands/sendfile.js +0 -97
- package/dist/orchestration/routing/commands/session.d.ts +0 -18
- package/dist/orchestration/routing/commands/session.js +0 -131
- package/dist/orchestration/routing/commands/status.d.ts +0 -5
- package/dist/orchestration/routing/commands/status.js +0 -165
- package/dist/orchestration/routing/commands/tail.d.ts +0 -2
- package/dist/orchestration/routing/commands/tail.js +0 -79
- package/dist/orchestration/routing/commands/time-ago.d.ts +0 -2
- package/dist/orchestration/routing/commands/time-ago.js +0 -14
- package/dist/orchestration/routing/commands/usage-format.d.ts +0 -5
- package/dist/orchestration/routing/commands/usage-format.js +0 -107
- package/dist/orchestration/routing/commands/usage-reset.d.ts +0 -20
- package/dist/orchestration/routing/commands/usage-reset.js +0 -123
- package/dist/orchestration/routing/commands/usage.d.ts +0 -10
- package/dist/orchestration/routing/commands/usage.js +0 -54
- package/dist/orchestration/routing/edit-handler.d.ts +0 -27
- package/dist/orchestration/routing/edit-handler.js +0 -205
- package/dist/orchestration/routing/file-handler.d.ts +0 -15
- package/dist/orchestration/routing/file-handler.js +0 -39
- package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +0 -14
- package/dist/orchestration/routing/hook-bridge-subscribers.js +0 -174
- package/dist/orchestration/routing/hook-bridge.d.ts +0 -28
- package/dist/orchestration/routing/hook-bridge.js +0 -104
- package/dist/orchestration/routing/message-router.d.ts +0 -6
- package/dist/orchestration/routing/message-router.js +0 -62
- package/dist/orchestration/routing/webhook.d.ts +0 -10
- package/dist/orchestration/routing/webhook.js +0 -434
- package/dist/orchestration/runtime.d.ts +0 -30
- package/dist/orchestration/runtime.js +0 -37
- package/dist/orchestration/session-compact.d.ts +0 -50
- package/dist/orchestration/session-compact.js +0 -84
- package/dist/orchestration/session-events.d.ts +0 -173
- package/dist/orchestration/session-events.js +0 -140
- package/dist/orchestration/session-gateway.d.ts +0 -52
- package/dist/orchestration/session-gateway.js +0 -87
- package/dist/orchestration/session-retention-controller.d.ts +0 -14
- package/dist/orchestration/session-retention-controller.js +0 -88
- package/dist/orchestration/session-retention-liveness.d.ts +0 -13
- package/dist/orchestration/session-retention-liveness.js +0 -31
- package/dist/orchestration/session-rewind.d.ts +0 -79
- package/dist/orchestration/session-rewind.js +0 -147
- package/dist/orchestration/status-helpers.d.ts +0 -40
- package/dist/orchestration/status-helpers.js +0 -177
- package/dist/orchestration/subagent-adopt.d.ts +0 -20
- package/dist/orchestration/subagent-adopt.js +0 -43
- package/dist/orchestration/subagent-attribution.d.ts +0 -42
- package/dist/orchestration/subagent-attribution.js +0 -130
- package/dist/orchestration/subagent-delivery.d.ts +0 -43
- package/dist/orchestration/subagent-delivery.js +0 -112
- package/dist/orchestration/subagent-rows.d.ts +0 -11
- package/dist/orchestration/subagent-rows.js +0 -16
- package/dist/orchestration/subagent-webhook.d.ts +0 -6
- package/dist/orchestration/subagent-webhook.js +0 -89
- package/dist/orchestration/team-delivery.d.ts +0 -81
- package/dist/orchestration/team-delivery.js +0 -284
- package/dist/orchestration/team-inbox.d.ts +0 -18
- package/dist/orchestration/team-inbox.js +0 -49
- package/dist/orchestration/team-state.d.ts +0 -74
- package/dist/orchestration/team-state.js +0 -219
- package/dist/orchestration/team-webhook.d.ts +0 -57
- package/dist/orchestration/team-webhook.js +0 -293
- package/dist/orchestration/transcript-sink.d.ts +0 -83
- package/dist/orchestration/transcript-sink.js +0 -267
- package/dist/orchestration/turn/active-turns.d.ts +0 -49
- package/dist/orchestration/turn/active-turns.js +0 -76
- package/dist/orchestration/turn/background-hold.d.ts +0 -158
- package/dist/orchestration/turn/background-hold.js +0 -240
- package/dist/orchestration/turn/hold-render-platform.d.ts +0 -35
- package/dist/orchestration/turn/hold-render-platform.js +0 -105
- package/dist/orchestration/turn/hold-render-web.d.ts +0 -17
- package/dist/orchestration/turn/hold-render-web.js +0 -51
- package/dist/orchestration/turn/terminal.d.ts +0 -105
- package/dist/orchestration/turn/terminal.js +0 -194
- package/dist/orchestration/turn/turn-prep.d.ts +0 -33
- package/dist/orchestration/turn/turn-prep.js +0 -44
- package/dist/orchestration/turn/turn-tracking.d.ts +0 -22
- package/dist/orchestration/turn/turn-tracking.js +0 -89
- package/dist/orchestration/turn/turn.d.ts +0 -199
- package/dist/orchestration/turn/turn.js +0 -586
- package/dist/orchestration/turn-mutation-lock.d.ts +0 -3
- package/dist/orchestration/turn-mutation-lock.js +0 -32
- package/dist/orchestration/turn-notify.d.ts +0 -22
- package/dist/orchestration/turn-notify.js +0 -50
- package/dist/orchestration/waitpoint-ingress.d.ts +0 -36
- package/dist/orchestration/waitpoint-ingress.js +0 -183
- package/dist/orchestration/waitpoint-notifier.d.ts +0 -32
- package/dist/orchestration/waitpoint-notifier.js +0 -140
- package/dist/orchestration/waitpoint-remote-drain.d.ts +0 -22
- package/dist/orchestration/waitpoint-remote-drain.js +0 -134
- package/dist/orchestration/waitpoint-sweep.d.ts +0 -43
- package/dist/orchestration/waitpoint-sweep.js +0 -84
- package/dist/platform/adapter.d.ts +0 -48
- package/dist/platform/adapter.js +0 -1
- package/dist/platform/adapters/chunked-output-stream.d.ts +0 -71
- package/dist/platform/adapters/chunked-output-stream.js +0 -382
- package/dist/platform/adapters/composite-adapter.d.ts +0 -99
- package/dist/platform/adapters/composite-adapter.js +0 -369
- package/dist/platform/adapters/feishu-http.d.ts +0 -46
- package/dist/platform/adapters/feishu-http.js +0 -108
- package/dist/platform/adapters/feishu-image.d.ts +0 -19
- package/dist/platform/adapters/feishu-image.js +0 -64
- package/dist/platform/adapters/feishu-output-stream.d.ts +0 -11
- package/dist/platform/adapters/feishu-output-stream.js +0 -29
- package/dist/platform/adapters/feishu.d.ts +0 -167
- package/dist/platform/adapters/feishu.js +0 -1059
- package/dist/platform/adapters/index.d.ts +0 -19
- package/dist/platform/adapters/index.js +0 -108
- package/dist/platform/adapters/project-conduits.d.ts +0 -9
- package/dist/platform/adapters/project-conduits.js +0 -36
- package/dist/platform/adapters/slack-output-stream.d.ts +0 -15
- package/dist/platform/adapters/slack-output-stream.js +0 -33
- package/dist/platform/adapters/slack.d.ts +0 -106
- package/dist/platform/adapters/slack.js +0 -733
- package/dist/platform/adapters/tui/index.d.ts +0 -2
- package/dist/platform/adapters/tui/index.js +0 -2
- package/dist/platform/adapters/tui/ports.d.ts +0 -46
- package/dist/platform/adapters/tui/ports.js +0 -1
- package/dist/platform/adapters/tui/tui-connection.d.ts +0 -20
- package/dist/platform/adapters/tui/tui-connection.js +0 -44
- package/dist/platform/adapters/tui/tui-gateway.d.ts +0 -90
- package/dist/platform/adapters/tui/tui-gateway.js +0 -884
- package/dist/platform/adapters/tui/tui-output-stream.d.ts +0 -35
- package/dist/platform/adapters/tui/tui-output-stream.js +0 -94
- package/dist/platform/adapters/tui/tui-transcript.d.ts +0 -8
- package/dist/platform/adapters/tui/tui-transcript.js +0 -42
- package/dist/platform/browser/agent-browser.d.ts +0 -50
- package/dist/platform/browser/agent-browser.js +0 -165
- package/dist/platform/browser/display.d.ts +0 -48
- package/dist/platform/browser/display.js +0 -188
- package/dist/platform/browser/managed-browser.d.ts +0 -23
- package/dist/platform/browser/managed-browser.js +0 -357
- package/dist/platform/index.d.ts +0 -10
- package/dist/platform/index.js +0 -6
- package/dist/platform/interactive-builder.d.ts +0 -34
- package/dist/platform/interactive-builder.js +0 -138
- package/dist/platform/output-stream-chunk.d.ts +0 -6
- package/dist/platform/output-stream-chunk.js +0 -42
- package/dist/platform/output-stream-helpers.d.ts +0 -8
- package/dist/platform/output-stream-helpers.js +0 -19
- package/dist/platform/output-stream.d.ts +0 -35
- package/dist/platform/output-stream.js +0 -1
- package/dist/platform/testing.d.ts +0 -136
- package/dist/platform/testing.js +0 -286
- package/dist/platform/tool-trace.d.ts +0 -35
- package/dist/platform/tool-trace.js +0 -287
- package/dist/platform/tui/protocol.d.ts +0 -352
- package/dist/platform/tui/protocol.js +0 -146
- package/dist/platform/types.d.ts +0 -223
- package/dist/platform/types.js +0 -22
- package/dist/platform/ui-http/access-jwt.d.ts +0 -28
- package/dist/platform/ui-http/access-jwt.js +0 -53
- package/dist/platform/ui-http/app-update.d.ts +0 -69
- package/dist/platform/ui-http/app-update.js +0 -143
- package/dist/platform/ui-http/browser-stream.d.ts +0 -110
- package/dist/platform/ui-http/browser-stream.js +0 -447
- package/dist/platform/ui-http/device-ports.d.ts +0 -34
- package/dist/platform/ui-http/device-ports.js +0 -102
- package/dist/platform/ui-http/file-routes.d.ts +0 -23
- package/dist/platform/ui-http/file-routes.js +0 -224
- package/dist/platform/ui-http/http-json.d.ts +0 -24
- package/dist/platform/ui-http/http-json.js +0 -109
- package/dist/platform/ui-http/listening-ports.d.ts +0 -98
- package/dist/platform/ui-http/listening-ports.js +0 -239
- package/dist/platform/ui-http/port-forward.d.ts +0 -40
- package/dist/platform/ui-http/port-forward.js +0 -130
- package/dist/platform/ui-http/ui-auth-routes.d.ts +0 -51
- package/dist/platform/ui-http/ui-auth-routes.js +0 -120
- package/dist/platform/ui-http/ui-device-routes.d.ts +0 -13
- package/dist/platform/ui-http/ui-device-routes.js +0 -81
- package/dist/platform/ui-http/ui-devices.d.ts +0 -24
- package/dist/platform/ui-http/ui-devices.js +0 -107
- package/dist/platform/ui-http/ui-http-server.d.ts +0 -100
- package/dist/platform/ui-http/ui-http-server.js +0 -310
- package/dist/platform/ui-http/ui-ota.d.ts +0 -22
- package/dist/platform/ui-http/ui-ota.js +0 -151
- package/dist/platform/ui-http/ui-pairing.d.ts +0 -25
- package/dist/platform/ui-http/ui-pairing.js +0 -98
- package/dist/platform/ui-http/ui-session.d.ts +0 -33
- package/dist/platform/ui-http/ui-session.js +0 -124
- package/dist/platform/ui-http/zip-writer.d.ts +0 -13
- package/dist/platform/ui-http/zip-writer.js +0 -93
- package/dist/platform/utils/rate-limiter.d.ts +0 -90
- package/dist/platform/utils/rate-limiter.js +0 -203
- package/dist/platform/utils/reaction-diagnostics.d.ts +0 -9
- package/dist/platform/utils/reaction-diagnostics.js +0 -19
- package/dist/platform/utils/readable-file.d.ts +0 -9
- package/dist/platform/utils/readable-file.js +0 -18
- package/dist/store/board-migration.d.ts +0 -21
- package/dist/store/board-migration.js +0 -217
- package/dist/store/board-repo.d.ts +0 -35
- package/dist/store/board-repo.js +0 -62
- package/dist/store/builtin-overlay-migration.d.ts +0 -11
- package/dist/store/builtin-overlay-migration.js +0 -308
- package/dist/store/claude-transcript-migration.d.ts +0 -32
- package/dist/store/claude-transcript-migration.js +0 -119
- package/dist/store/conversation-display-projection.d.ts +0 -36
- package/dist/store/conversation-display-projection.js +0 -180
- package/dist/store/conversation-history-reader.d.ts +0 -30
- package/dist/store/conversation-history-reader.js +0 -440
- package/dist/store/conversation-history-repo.d.ts +0 -449
- package/dist/store/conversation-history-repo.js +0 -632
- package/dist/store/conversation-ledger-repo.d.ts +0 -76
- package/dist/store/conversation-ledger-repo.js +0 -219
- package/dist/store/cost-repo.d.ts +0 -88
- package/dist/store/cost-repo.js +0 -233
- package/dist/store/execution-repo.d.ts +0 -169
- package/dist/store/execution-repo.js +0 -329
- package/dist/store/gitignore-migration.d.ts +0 -2
- package/dist/store/gitignore-migration.js +0 -16
- package/dist/store/hook-registry.d.ts +0 -101
- package/dist/store/hook-registry.js +0 -319
- package/dist/store/hook-writer.d.ts +0 -43
- package/dist/store/hook-writer.js +0 -133
- package/dist/store/models-repo.d.ts +0 -18
- package/dist/store/models-repo.js +0 -74
- package/dist/store/outbound-queue.d.ts +0 -67
- package/dist/store/outbound-queue.js +0 -284
- package/dist/store/pending-injection-repo.d.ts +0 -29
- package/dist/store/pending-injection-repo.js +0 -52
- package/dist/store/project-dir-repo.d.ts +0 -17
- package/dist/store/project-dir-repo.js +0 -44
- package/dist/store/project-notes-repo.d.ts +0 -27
- package/dist/store/project-notes-repo.js +0 -219
- package/dist/store/prompt-migration-replacements.d.ts +0 -3
- package/dist/store/prompt-migration-replacements.js +0 -96
- package/dist/store/provider-state-repo.d.ts +0 -22
- package/dist/store/provider-state-repo.js +0 -115
- package/dist/store/retention-candidate-repo.d.ts +0 -12
- package/dist/store/retention-candidate-repo.js +0 -47
- package/dist/store/retire-profiles-migration.d.ts +0 -28
- package/dist/store/retire-profiles-migration.js +0 -335
- package/dist/store/schedule-repo.d.ts +0 -53
- package/dist/store/schedule-repo.js +0 -121
- package/dist/store/session-registry-import.d.ts +0 -34
- package/dist/store/session-registry-import.js +0 -173
- package/dist/store/session-registry-journal.d.ts +0 -195
- package/dist/store/session-registry-journal.js +0 -871
- package/dist/store/session-registry-repo.d.ts +0 -169
- package/dist/store/session-registry-repo.js +0 -530
- package/dist/store/session-totals-repo.d.ts +0 -45
- package/dist/store/session-totals-repo.js +0 -104
- package/dist/store/session-totals.d.ts +0 -69
- package/dist/store/session-totals.js +0 -93
- package/dist/store/team-inbox-repo.d.ts +0 -34
- package/dist/store/team-inbox-repo.js +0 -72
- package/dist/store/team-outbox-repo.d.ts +0 -20
- package/dist/store/team-outbox-repo.js +0 -39
- package/dist/store/tool-image-files.d.ts +0 -12
- package/dist/store/tool-image-files.js +0 -40
- package/dist/store/version-migrations.d.ts +0 -120
- package/dist/store/version-migrations.js +0 -1408
- package/dist/store/waitpoint-repo.d.ts +0 -111
- package/dist/store/waitpoint-repo.js +0 -83
- package/dist/tui/App.d.ts +0 -27
- package/dist/tui/App.js +0 -406
- package/dist/tui/components/AskUserModal.d.ts +0 -10
- package/dist/tui/components/AskUserModal.js +0 -362
- package/dist/tui/components/ConfirmModal.d.ts +0 -12
- package/dist/tui/components/ConfirmModal.js +0 -29
- package/dist/tui/components/Dashboard.d.ts +0 -24
- package/dist/tui/components/Dashboard.js +0 -89
- package/dist/tui/components/DashboardCostTab.d.ts +0 -7
- package/dist/tui/components/DashboardCostTab.js +0 -32
- package/dist/tui/components/DashboardExecutionsTab.d.ts +0 -11
- package/dist/tui/components/DashboardExecutionsTab.js +0 -112
- package/dist/tui/components/DashboardSchedulesTab.d.ts +0 -11
- package/dist/tui/components/DashboardSchedulesTab.js +0 -132
- package/dist/tui/components/InputBox.d.ts +0 -26
- package/dist/tui/components/InputBox.js +0 -266
- package/dist/tui/components/Notifications.d.ts +0 -12
- package/dist/tui/components/Notifications.js +0 -59
- package/dist/tui/components/ProjectSwitcher.d.ts +0 -17
- package/dist/tui/components/ProjectSwitcher.js +0 -40
- package/dist/tui/components/SessionPicker.d.ts +0 -13
- package/dist/tui/components/SessionPicker.js +0 -42
- package/dist/tui/components/SidePanel.d.ts +0 -19
- package/dist/tui/components/SidePanel.js +0 -8
- package/dist/tui/components/SlashMenu.d.ts +0 -8
- package/dist/tui/components/SlashMenu.js +0 -15
- package/dist/tui/components/StatusLine.d.ts +0 -19
- package/dist/tui/components/StatusLine.js +0 -39
- package/dist/tui/components/Transcript.d.ts +0 -21
- package/dist/tui/components/Transcript.js +0 -150
- package/dist/tui/components/dashboard-constants.d.ts +0 -1
- package/dist/tui/components/dashboard-constants.js +0 -1
- package/dist/tui/hooks/useDashboardData.d.ts +0 -24
- package/dist/tui/hooks/useDashboardData.js +0 -75
- package/dist/tui/hooks/useKeybindings.d.ts +0 -19
- package/dist/tui/hooks/useKeybindings.js +0 -75
- package/dist/tui/hooks/useMouseHandler.d.ts +0 -15
- package/dist/tui/hooks/useMouseHandler.js +0 -90
- package/dist/tui/hooks/useMutate.d.ts +0 -22
- package/dist/tui/hooks/useMutate.js +0 -54
- package/dist/tui/hooks/useNotifications.d.ts +0 -26
- package/dist/tui/hooks/useNotifications.js +0 -60
- package/dist/tui/hooks/useTranscript.d.ts +0 -42
- package/dist/tui/hooks/useTranscript.js +0 -277
- package/dist/tui/index.d.ts +0 -2
- package/dist/tui/logic.d.ts +0 -144
- package/dist/tui/logic.js +0 -388
- package/dist/tui/raf-batch.d.ts +0 -31
- package/dist/tui/raf-batch.js +0 -89
- package/dist/tui/render/inline-markdown.d.ts +0 -22
- package/dist/tui/render/inline-markdown.js +0 -99
- package/dist/tui/render/markdown.d.ts +0 -10
- package/dist/tui/render/markdown.js +0 -35
- package/dist/tui/render-output.d.ts +0 -42
- package/dist/tui/render-output.js +0 -81
- package/dist/tui/slash-commands.d.ts +0 -21
- package/dist/tui/slash-commands.js +0 -71
- package/dist/tui/turn-status.d.ts +0 -10
- package/dist/tui/turn-status.js +0 -48
- package/dist/tui/ws-client.d.ts +0 -39
- package/dist/tui/ws-client.js +0 -139
- package/scripts/install-bundled-dependencies.mjs +0 -54
- package/web/dist/assets/board-math-css-spk7yR6n.js +0 -2
- package/web/dist/assets/index-BQ69u-92.css +0 -1
- package/web/dist/assets/index-CKNLatCd.js +0 -1
- package/web/dist/assets/index-CkzWfC98.js +0 -525
package/dist/entry/daemon.js
CHANGED
|
@@ -1,909 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* IPC protocol (app.ts → daemon):
|
|
5
|
-
* { type: 'busy' } — a request is being processed, defer restart
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* IPC protocol (daemon → app.ts, see entry/daemon-notice.ts):
|
|
9
|
-
* { type: 'rebuild-aborted', text } — pipeline stopped early; app.ts broadcasts it as an
|
|
10
|
-
* error-level system notice. The daemon has no platform adapter, so this is its only
|
|
11
|
-
* way to reach the operator.
|
|
12
|
-
* { type: 'rebuild-hold', hold, phase, reason } — admission control for the last seconds before
|
|
13
|
-
* this process is replaced: while `hold` is true the app refuses to START new turns, because a
|
|
14
|
-
* turn spawned now is orphaned by the SIGTERM. Scope is deliberately narrow — the install and
|
|
15
|
-
* restart steps and a queued restart, never the build (see `rebuildHoldsTurns`). Re-sent on every
|
|
16
|
-
* phase change: the app's hold expires on its own, so a daemon that dies mid-pipeline fails open
|
|
17
|
-
* instead of muting the app forever.
|
|
18
|
-
*
|
|
19
|
-
* Rebuild progress:
|
|
20
|
-
* The pipeline publishes its plan and each step transition to STORE_DIR/daemon-rebuild.json
|
|
21
|
-
* (core/rebuild-progress.ts), which `system.daemonStatus` reads for the daemon page. It is a file
|
|
22
|
-
* and not in-app state on purpose: the pipeline's last act replaces the process that would have
|
|
23
|
-
* held it, so only a file can tell the new app what the rebuild it was born from did.
|
|
24
|
-
*
|
|
25
|
-
* Restart serialization:
|
|
26
|
-
* Only ONE restart cycle (stop → start) runs at a time. Concurrent requests
|
|
27
|
-
* are absorbed into `pendingRestart` and consumed after the cycle completes.
|
|
28
|
-
* The crash-recovery timer is tracked and cancelled on intentional restarts.
|
|
29
|
-
*
|
|
30
|
-
* Source-watch rebuild loop:
|
|
31
|
-
* When CORTEX_REPO is set and ${CORTEX_REPO}/src exists, daemon watches
|
|
32
|
-
* src/**\/*.ts and on change runs: build the workspace packages (see `planRebuildLanes`) → install
|
|
33
|
-
* into the install root → restart() the app.js child from the freshly installed dist. The daemon
|
|
34
|
-
* process itself does NOT reload — if you edit daemon.ts you must manually
|
|
35
|
-
* `cortex daemon` restart to pick up the new daemon code.
|
|
36
|
-
*
|
|
37
|
-
* The install step has two paths (see entry/fast-install.ts). While the manifest's dependency
|
|
38
|
-
* sets are unchanged — every rebuild that only touched source — the build outputs are copied
|
|
39
|
-
* straight into the install root through staged renames, which takes seconds. When dependencies
|
|
40
|
-
* change, it falls back to npm pack → install -g so the vendored closure is rebuilt.
|
|
41
|
-
*
|
|
42
|
-
* The build runs as concurrent lanes. One lane is an ordered chain, and its order is
|
|
43
|
-
* load-bearing: ui-contract re-exports the server's dist types and web typechecks against
|
|
44
|
-
* ui-contract's built dist, so skipping the middle package makes web fail on every newly added
|
|
45
|
-
* server DTO. Web's bundle and its dependency check read only web sources, so they start at t=0
|
|
46
|
-
* beside that chain instead of waiting behind it.
|
|
47
|
-
*
|
|
48
|
-
* Every step is paid on every rebuild, including web work that a server-only edit almost never
|
|
49
|
-
* changes, so the cost of each is kept down at the package level rather than by skipping steps
|
|
50
|
-
* here: the server's tsconfig carries an incremental cache. That cache lives inside dist/ on
|
|
51
|
-
* purpose — tsc trusts its buildinfo over the filesystem, so a cache that outlived its output
|
|
52
|
-
* would let a deleted dist file stay deleted.
|
|
53
|
-
*
|
|
54
|
-
* Any step failing → log + notify the operator + skip (no restart), so an abort never looks
|
|
55
|
-
* like a no-op restart. Lanes are not cancelled when a sibling fails: each runs to its end, so
|
|
56
|
-
* the notice names every step that failed rather than whichever finished first.
|
|
57
|
-
*
|
|
58
|
-
* busy/idle gating is checked twice, because only the tail of the pipeline is dangerous to a live
|
|
59
|
-
* turn. Once before the build, and again after it: the build takes minutes, so a turn can have
|
|
60
|
-
* started meanwhile, and everything past that point replaces the files app.js is running from and
|
|
61
|
-
* then kills it. A busy child there parks the reason in `pendingRebuild` and the whole pipeline
|
|
62
|
-
* runs again on the idle transition — waiting for real work to finish, rather than refusing it.
|
|
63
|
-
*
|
|
64
|
-
* Manual upgrade workflow (still supported):
|
|
65
|
-
* npm run build && npm pack && npm install -g ./cortex-agent-server-X.Y.Z.tgz (package: @cortex-agent/server)
|
|
66
|
-
* The postinstall-restart-trigger.mjs touches .restart, which the .restart
|
|
67
|
-
* watcher below picks up. In dev mode (CORTEX_REPO set) this triggers the full
|
|
68
|
-
* rebuild pipeline; in production mode it just respawns app.js.
|
|
69
|
-
*/
|
|
70
|
-
import { fork, spawn } from 'child_process';
|
|
71
|
-
import { watch, existsSync, unlinkSync, statSync, writeFileSync, readdirSync, } from 'fs';
|
|
72
|
-
import * as path from 'path';
|
|
73
|
-
import { createLogger } from '../core/log.js';
|
|
74
|
-
import { t, setLocale, normalizeLocale } from '../core/i18n.js';
|
|
75
|
-
import { loadLang } from '../domain/system/preferences.js';
|
|
76
|
-
import { loadRuntimeDotenv } from '../core/runtime-env.js';
|
|
77
|
-
import { createResilientWatchMonitor } from '../core/resilient-watch.js';
|
|
78
|
-
import { isMainModule, moduleDir, withServerNpmPrefix } from '../core/utils.js';
|
|
79
|
-
import { DATA_DIR, CONFIG_DIR, INSTALL_ROOT, DAEMON_PID_FILE, DAEMON_CHILD_PID_FILE, RESTART_TRIGGER_FILE, } from '../core/paths.js';
|
|
80
|
-
import { planFastInstall, applyFastInstall } from './fast-install.js';
|
|
81
|
-
import { tryAcquireSingletonLock, releaseSingletonLock as releaseLock } from '../core/singleton-lock.js';
|
|
82
|
-
import { ensureOwnBinsOnPath } from '../domain/system/own-bin-path.js';
|
|
83
|
-
import { captureProcessCrash } from '../domain/telemetry/crash.js';
|
|
84
|
-
import { CHILD_EXIT_ENV, encodeChildExit } from '../domain/telemetry/child-exit.js';
|
|
85
|
-
import { finishRebuildStep, planRebuildProgress, settleRebuildProgress, startRebuildStep, writeRebuildProgress, } from '../core/rebuild-progress.js';
|
|
86
|
-
// Load .env BEFORE reading any CORTEX_* env vars below. Mirrors app.ts §61 — the
|
|
87
|
-
// daemon needs CORTEX_REPO (and potentially other vars) from .env, not just from
|
|
88
|
-
// the OS shell env. Must be sync and before the `CORTEX_REPO` constant below.
|
|
89
|
-
loadRuntimeDotenv(path.join(CONFIG_DIR, '.env'));
|
|
90
|
-
// --- Logger ---
|
|
91
|
-
const log = createLogger('daemon');
|
|
92
|
-
// --- Paths ---
|
|
93
|
-
const MODULE_DIR = moduleDir(import.meta.url);
|
|
94
|
-
// --- Config ---
|
|
95
|
-
const APP_ENTRY = path.join(MODULE_DIR, 'app.js');
|
|
96
|
-
const ENV_FILE = path.join(CONFIG_DIR, '.env');
|
|
97
|
-
const CORTEX_REPO = process.env.CORTEX_REPO ?? '';
|
|
98
|
-
const SRC_WATCH_PATH = CORTEX_REPO ? path.join(CORTEX_REPO, 'src') : '';
|
|
99
|
-
// Monorepo root is the parent of the agent-server repo (e.g. /srv/cortex).
|
|
100
|
-
// Web SPA lives under MONOREPO_ROOT/web/ and must be built before packing.
|
|
101
|
-
const MONOREPO_ROOT = CORTEX_REPO ? path.dirname(CORTEX_REPO) : '';
|
|
102
|
-
const WEB_DIR = MONOREPO_ROOT ? path.join(MONOREPO_ROOT, 'web') : '';
|
|
103
|
-
// ui-contract re-exports the server's ui-service DTO types and the web SPA resolves them through
|
|
104
|
-
// this package's BUILT dist — so it must be rebuilt between the two, or web's typecheck fails on
|
|
105
|
-
// every newly added server DTO. Only these three workspace packages are in the hot path: a blanket
|
|
106
|
-
// `pnpm -r run build` would also drag in desktop's `tauri build` and the worker's `wrangler deploy`.
|
|
107
|
-
const UI_CONTRACT_DIR = MONOREPO_ROOT ? path.join(MONOREPO_ROOT, 'packages', 'ui-contract') : '';
|
|
108
|
-
const DEBOUNCE_MS = 800; // .restart / .env — fast
|
|
109
|
-
const BUILD_DEBOUNCE_MS = 2500; // src/*.ts — slower, build takes seconds anyway
|
|
110
|
-
const BACKOFF_INITIAL = 1000;
|
|
111
|
-
const BACKOFF_MAX = 30_000;
|
|
112
|
-
const HEALTHY_THRESHOLD = 10_000; // if alive > 10s, reset backoff
|
|
113
|
-
// Src-watch filter: paths under SRC_WATCH_PATH that should NOT trigger a rebuild.
|
|
114
|
-
const SRC_IGNORE_PREFIXES = ['tests/', 'tmp/', 'node_modules/', 'dist/', 'vendor/'];
|
|
115
|
-
const SRC_IGNORE_SUFFIXES = ['.d.ts', '.test.ts', '.spec.ts'];
|
|
116
|
-
// --- State ---
|
|
117
|
-
let child = null;
|
|
118
|
-
let childStartedAt = 0;
|
|
119
|
-
let backoff = BACKOFF_INITIAL;
|
|
120
|
-
let restartTimer = null; // debounce timer for .restart / .env
|
|
121
|
-
let rebuildTimer = null; // debounce timer for src/*.ts
|
|
122
|
-
let crashRecoveryTimer = null; // timer from crash handler's auto-restart
|
|
123
|
-
let shuttingDown = false;
|
|
124
|
-
let childBusy = false; // true when app.ts is processing a request
|
|
125
|
-
let pendingRestart = null; // reason string if restart is deferred
|
|
126
|
-
let pendingRebuild = null; // reason string if rebuild is deferred (busy or in-flight)
|
|
127
|
-
let restarting = false; // true while restart() stop→start cycle is in progress
|
|
128
|
-
let rebuilding = false; // true while runRebuildPipeline() is running
|
|
129
|
-
let nextRestartReason = null; // forwarded to next child via CORTEX_RESTART_REASON
|
|
130
|
-
let nextChildExit = null; // forwarded via CORTEX_CHILD_EXIT (telemetry crash report)
|
|
131
|
-
let watchMonitors = [];
|
|
132
|
-
let rebuildProgress = null; // published pipeline state (file + child IPC)
|
|
133
|
-
// Daemon logs are written by the centralized logger (src/core/log.ts)
|
|
134
|
-
// — console + daily-rotating file output in DATA_DIR/logs/.
|
|
135
|
-
// --- Cancel all pending restart timers ---
|
|
136
|
-
function cancelPendingTimers() {
|
|
137
|
-
if (crashRecoveryTimer) {
|
|
138
|
-
clearTimeout(crashRecoveryTimer);
|
|
139
|
-
crashRecoveryTimer = null;
|
|
140
|
-
}
|
|
141
|
-
if (restartTimer) {
|
|
142
|
-
clearTimeout(restartTimer);
|
|
143
|
-
restartTimer = null;
|
|
144
|
-
}
|
|
145
|
-
if (rebuildTimer) {
|
|
146
|
-
clearTimeout(rebuildTimer);
|
|
147
|
-
rebuildTimer = null;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
export function buildChildProcessConfig(restartReason = null, childExit = null) {
|
|
151
|
-
const stdio = ['pipe', 'ignore', 'ignore', 'ipc'];
|
|
152
|
-
const env = { ...process.env };
|
|
153
|
-
delete env.CORTEX_RESTART_REASON;
|
|
154
|
-
delete env[CHILD_EXIT_ENV];
|
|
155
|
-
if (restartReason)
|
|
156
|
-
env.CORTEX_RESTART_REASON = restartReason;
|
|
157
|
-
if (childExit)
|
|
158
|
-
env[CHILD_EXIT_ENV] = childExit;
|
|
159
|
-
return {
|
|
160
|
-
cwd: DATA_DIR,
|
|
161
|
-
windowsHide: true,
|
|
162
|
-
stdio,
|
|
163
|
-
execArgv: [],
|
|
164
|
-
env,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
// --- Child Process Management ---
|
|
168
|
-
function startChild() {
|
|
169
|
-
if (shuttingDown)
|
|
170
|
-
return;
|
|
171
|
-
if (child) {
|
|
172
|
-
log.info('startChild called but child already running — skipping.');
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
const reasonForChild = nextRestartReason;
|
|
176
|
-
const childExit = nextChildExit;
|
|
177
|
-
nextRestartReason = null;
|
|
178
|
-
nextChildExit = null;
|
|
179
|
-
log.info(reasonForChild ? `Starting app.ts (reason: ${reasonForChild})...` : 'Starting app.ts...');
|
|
180
|
-
childStartedAt = Date.now();
|
|
181
|
-
childBusy = false;
|
|
182
|
-
pendingRestart = null;
|
|
183
|
-
child = fork(APP_ENTRY, [], buildChildProcessConfig(reasonForChild, childExit));
|
|
184
|
-
// Daemon only logs its own messages; app.ts handles its own output independently.
|
|
185
|
-
log.info(`app.ts started — PID ${child.pid}`);
|
|
186
|
-
// Persist child PID so CLI (daemon status / daemon restart --hard) can find it
|
|
187
|
-
try {
|
|
188
|
-
writeFileSync(DAEMON_CHILD_PID_FILE, String(child.pid), 'utf8');
|
|
189
|
-
}
|
|
190
|
-
catch { }
|
|
191
|
-
// IPC: app.ts tells us when it's busy/idle
|
|
192
|
-
child.on('message', onChildMessage);
|
|
193
|
-
child.on('exit', onChildExit);
|
|
194
|
-
}
|
|
195
|
-
function onChildIdle() {
|
|
196
|
-
childBusy = false;
|
|
197
|
-
const note = pendingRestart
|
|
198
|
-
? ` (pending restart: ${pendingRestart})`
|
|
199
|
-
: pendingRebuild
|
|
200
|
-
? ` (pending rebuild: ${pendingRebuild})`
|
|
201
|
-
: '';
|
|
202
|
-
log.info(`IPC ← app.ts: idle${note}`);
|
|
203
|
-
if (pendingRestart) {
|
|
204
|
-
const reason = pendingRestart;
|
|
205
|
-
pendingRestart = null;
|
|
206
|
-
restart(reason);
|
|
207
|
-
}
|
|
208
|
-
else if (pendingRebuild) {
|
|
209
|
-
const reason = pendingRebuild;
|
|
210
|
-
pendingRebuild = null;
|
|
211
|
-
runRebuildPipeline(reason);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function onChildMessage(msg) {
|
|
215
|
-
if (msg?.type === 'busy') {
|
|
216
|
-
log.info(`IPC ← app.ts: busy`);
|
|
217
|
-
childBusy = true;
|
|
218
|
-
}
|
|
219
|
-
else if (msg?.type === 'idle') {
|
|
220
|
-
onChildIdle();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function onChildExit(code, signal) {
|
|
224
|
-
child = null;
|
|
225
|
-
childBusy = false;
|
|
226
|
-
// Clean up child PID file
|
|
227
|
-
try {
|
|
228
|
-
if (existsSync(DAEMON_CHILD_PID_FILE))
|
|
229
|
-
unlinkSync(DAEMON_CHILD_PID_FILE);
|
|
230
|
-
}
|
|
231
|
-
catch { }
|
|
232
|
-
if (shuttingDown) {
|
|
233
|
-
log.info('app.ts exited (shutdown).');
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
// If restart() is driving the stop→start cycle, let it handle startChild()
|
|
237
|
-
if (restarting) {
|
|
238
|
-
if (signal)
|
|
239
|
-
log.info(`app.ts stopped (signal ${signal}).`);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
scheduleCrashRecovery(code, signal);
|
|
243
|
-
}
|
|
244
|
-
/** Unexpected crash — schedule recovery with backoff. */
|
|
245
|
-
function scheduleCrashRecovery(code, signal) {
|
|
246
|
-
const alive = Date.now() - childStartedAt;
|
|
247
|
-
if (alive > HEALTHY_THRESHOLD)
|
|
248
|
-
backoff = BACKOFF_INITIAL;
|
|
249
|
-
const crashReason = signal ? `crash (signal ${signal})` : `crash (exit code ${code})`;
|
|
250
|
-
const crashFacts = encodeChildExit({ code, signal, uptimeMs: alive, backoffMs: backoff });
|
|
251
|
-
log.info(signal ? `app.ts killed by signal ${signal}.` : `app.ts exited with code ${code}.`);
|
|
252
|
-
log.info(`Restarting in ${backoff}ms...`);
|
|
253
|
-
cancelPendingTimers();
|
|
254
|
-
crashRecoveryTimer = setTimeout(() => {
|
|
255
|
-
crashRecoveryTimer = null;
|
|
256
|
-
nextRestartReason = crashReason;
|
|
257
|
-
nextChildExit = crashFacts;
|
|
258
|
-
startChild();
|
|
259
|
-
}, backoff);
|
|
260
|
-
backoff = Math.min(backoff * 2, BACKOFF_MAX);
|
|
261
|
-
}
|
|
262
|
-
function stopChild() {
|
|
263
|
-
return new Promise((resolve) => {
|
|
264
|
-
if (!child)
|
|
265
|
-
return resolve();
|
|
266
|
-
const c = child; // capture local ref — exit handler sets global child=null
|
|
267
|
-
log.info(`Stopping app.ts (PID ${c.pid})...`);
|
|
268
|
-
const forceKillTimer = setTimeout(() => {
|
|
269
|
-
log.info('Force killing app.ts...');
|
|
270
|
-
try {
|
|
271
|
-
c.kill('SIGKILL');
|
|
272
|
-
}
|
|
273
|
-
catch { }
|
|
274
|
-
}, 5000);
|
|
275
|
-
c.once('exit', () => {
|
|
276
|
-
clearTimeout(forceKillTimer);
|
|
277
|
-
resolve();
|
|
278
|
-
});
|
|
279
|
-
c.kill('SIGTERM');
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Stop the child and start a fresh one. Resolves once the replacement has been forked.
|
|
284
|
-
*
|
|
285
|
-
* Returns 'deferred' when the cycle did not run: the child was mid-request, or another cycle owns
|
|
286
|
-
* the stop→start, and `pendingRestart` now carries the reason to the next idle transition. Callers
|
|
287
|
-
* that report progress need that distinction — a deferred restart leaves the OLD process serving.
|
|
288
|
-
*
|
|
289
|
-
* The child is told to hold new turns before anything else happens, including on the deferred
|
|
290
|
-
* paths: a restart that is waiting for idle wants the child to drain, not to take more work.
|
|
291
|
-
*/
|
|
292
|
-
async function restart(reason) {
|
|
293
|
-
// Defer if child is busy processing a request
|
|
294
|
-
if (childBusy) {
|
|
295
|
-
log.info(`Restart deferred (app.ts is busy): ${reason}`);
|
|
296
|
-
pendingRestart = reason;
|
|
297
|
-
holdChildTurns(true, 'restart', reason);
|
|
298
|
-
return 'deferred';
|
|
299
|
-
}
|
|
300
|
-
// Serialize: only one stop→start cycle at a time
|
|
301
|
-
if (restarting) {
|
|
302
|
-
log.info(`Restart deferred (already restarting): ${reason}`);
|
|
303
|
-
pendingRestart = reason;
|
|
304
|
-
holdChildTurns(true, 'restart', reason);
|
|
305
|
-
return 'deferred';
|
|
306
|
-
}
|
|
307
|
-
cancelPendingTimers();
|
|
308
|
-
log.info(`Restarting: ${reason}`);
|
|
309
|
-
backoff = BACKOFF_INITIAL;
|
|
310
|
-
restarting = true;
|
|
311
|
-
// The window this closes is the one that orphaned a turn on 2026-09-21: app.ts reported idle, the
|
|
312
|
-
// daemon began the stop, and a message landing in the same tick spawned a CLI whose stdout owner
|
|
313
|
-
// died a moment later. Between this line and SIGTERM the child admits nothing new.
|
|
314
|
-
holdChildTurns(true, 'restart', reason);
|
|
315
|
-
await stopChild();
|
|
316
|
-
restarting = false;
|
|
317
|
-
// Absorb any restarts requested during the stop phase —
|
|
318
|
-
// the new child loads the latest code from disk regardless
|
|
319
|
-
if (pendingRestart) {
|
|
320
|
-
log.info(`Absorbed deferred restart: ${pendingRestart}`);
|
|
321
|
-
pendingRestart = null;
|
|
322
|
-
}
|
|
323
|
-
nextRestartReason = reason;
|
|
324
|
-
startChild();
|
|
325
|
-
return 'restarted';
|
|
326
|
-
}
|
|
327
|
-
// --- File Watching ---
|
|
328
|
-
function closeWatchers(watchers) {
|
|
329
|
-
for (const watcher of watchers.splice(0)) {
|
|
330
|
-
try {
|
|
331
|
-
watcher.close();
|
|
332
|
-
}
|
|
333
|
-
catch { }
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
/** Recursively watch each directory on Windows, closing partial setup on failure. */
|
|
337
|
-
function watchTree(root, callback) {
|
|
338
|
-
const watchers = [];
|
|
339
|
-
const walk = (dir) => {
|
|
340
|
-
watchers.push(watch(dir, (eventType, filename) => callback(eventType, filename)));
|
|
341
|
-
let entries;
|
|
342
|
-
try {
|
|
343
|
-
entries = readdirSync(dir, { withFileTypes: true });
|
|
344
|
-
}
|
|
345
|
-
catch {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
for (const entry of entries) {
|
|
349
|
-
if (!entry.isDirectory())
|
|
350
|
-
continue;
|
|
351
|
-
if (entry.name.startsWith('.') || entry.name === 'node_modules')
|
|
352
|
-
continue;
|
|
353
|
-
walk(path.join(dir, entry.name));
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
try {
|
|
357
|
-
walk(root);
|
|
358
|
-
}
|
|
359
|
-
catch (error) {
|
|
360
|
-
closeWatchers(watchers);
|
|
361
|
-
throw error;
|
|
362
|
-
}
|
|
363
|
-
return watchers;
|
|
364
|
-
}
|
|
365
|
-
function isDirectory(dir) {
|
|
366
|
-
try {
|
|
367
|
-
return existsSync(dir) && statSync(dir).isDirectory();
|
|
368
|
-
}
|
|
369
|
-
catch {
|
|
370
|
-
return false;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function handleSourceChange(filename) {
|
|
374
|
-
if (!filename)
|
|
375
|
-
return;
|
|
376
|
-
const changedName = String(filename).replace(/\\/g, '/');
|
|
377
|
-
if (!changedName.endsWith('.ts'))
|
|
378
|
-
return;
|
|
379
|
-
if (SRC_IGNORE_SUFFIXES.some(suffix => changedName.endsWith(suffix)))
|
|
380
|
-
return;
|
|
381
|
-
if (SRC_IGNORE_PREFIXES.some(prefix => changedName.startsWith(prefix) || changedName.includes(`/${prefix}`)))
|
|
382
|
-
return;
|
|
383
|
-
debouncedRebuild(`src change: ${changedName}`);
|
|
384
|
-
}
|
|
385
|
-
function setupSourceMonitor() {
|
|
386
|
-
if (!SRC_WATCH_PATH || !isDirectory(SRC_WATCH_PATH)) {
|
|
387
|
-
const detail = CORTEX_REPO
|
|
388
|
-
? `CORTEX_REPO=${CORTEX_REPO} set but ${SRC_WATCH_PATH} not a directory`
|
|
389
|
-
: 'CORTEX_REPO unset';
|
|
390
|
-
log.warn(`${detail} — src watcher disabled, only .restart trigger available`);
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
return createResilientWatchMonitor({
|
|
394
|
-
label: `Source ${SRC_WATCH_PATH}`,
|
|
395
|
-
warn: (message) => log.warn(message),
|
|
396
|
-
startWatching: () => {
|
|
397
|
-
if (process.platform === 'win32') {
|
|
398
|
-
const watchers = watchTree(SRC_WATCH_PATH, (_event, filename) => handleSourceChange(filename));
|
|
399
|
-
log.info(`Watching src: ${SRC_WATCH_PATH} (per-directory, *.ts, ${watchers.length} dirs)`);
|
|
400
|
-
return watchers;
|
|
401
|
-
}
|
|
402
|
-
const watcher = watch(SRC_WATCH_PATH, { recursive: true }, (_event, filename) => handleSourceChange(filename));
|
|
403
|
-
log.info(`Watching src: ${SRC_WATCH_PATH} (recursive, *.ts)`);
|
|
404
|
-
return [watcher];
|
|
405
|
-
},
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
function consumeRestartTrigger() {
|
|
409
|
-
if (!existsSync(RESTART_TRIGGER_FILE))
|
|
410
|
-
return;
|
|
411
|
-
try {
|
|
412
|
-
unlinkSync(RESTART_TRIGGER_FILE);
|
|
413
|
-
}
|
|
414
|
-
catch { }
|
|
415
|
-
if (CORTEX_REPO) {
|
|
416
|
-
debouncedRebuild('manual trigger (.restart file)');
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
debouncedRestart('manual trigger (.restart file)');
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
function setupRestartTriggerMonitor() {
|
|
423
|
-
const triggerDir = path.dirname(RESTART_TRIGGER_FILE);
|
|
424
|
-
const triggerName = path.basename(RESTART_TRIGGER_FILE);
|
|
425
|
-
return createResilientWatchMonitor({
|
|
426
|
-
label: `Restart trigger ${RESTART_TRIGGER_FILE}`,
|
|
427
|
-
warn: (message) => log.warn(message),
|
|
428
|
-
startWatching: () => {
|
|
429
|
-
const watcher = watch(triggerDir, (_event, filename) => {
|
|
430
|
-
if (filename && String(filename) === triggerName)
|
|
431
|
-
consumeRestartTrigger();
|
|
432
|
-
});
|
|
433
|
-
log.info(`Watching for restart trigger: ${RESTART_TRIGGER_FILE}`);
|
|
434
|
-
return [watcher];
|
|
435
|
-
},
|
|
436
|
-
poll: consumeRestartTrigger,
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
function fileStamp(filePath) {
|
|
440
|
-
try {
|
|
441
|
-
const stat = statSync(filePath);
|
|
442
|
-
return `${stat.mtimeMs}:${stat.size}`;
|
|
443
|
-
}
|
|
444
|
-
catch {
|
|
445
|
-
return null;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
function startEnvWatcher(envDir, envName, onChange) {
|
|
449
|
-
const watcher = watch(envDir, (_event, filename) => {
|
|
450
|
-
if (filename && String(filename) === envName)
|
|
451
|
-
onChange();
|
|
452
|
-
});
|
|
453
|
-
log.info(`Watching env file: ${ENV_FILE}`);
|
|
454
|
-
return [watcher];
|
|
455
|
-
}
|
|
456
|
-
function setupEnvMonitor() {
|
|
457
|
-
const envDir = path.dirname(ENV_FILE);
|
|
458
|
-
if (!existsSync(envDir))
|
|
459
|
-
return null;
|
|
460
|
-
const envName = path.basename(ENV_FILE);
|
|
461
|
-
let observedStamp = fileStamp(ENV_FILE);
|
|
462
|
-
const handleChange = () => {
|
|
463
|
-
observedStamp = fileStamp(ENV_FILE);
|
|
464
|
-
debouncedRestart('env change (.env)');
|
|
465
|
-
};
|
|
466
|
-
const poll = () => {
|
|
467
|
-
const nextStamp = fileStamp(ENV_FILE);
|
|
468
|
-
if (nextStamp === observedStamp)
|
|
469
|
-
return;
|
|
470
|
-
observedStamp = nextStamp;
|
|
471
|
-
debouncedRestart('env change (.env)');
|
|
472
|
-
};
|
|
473
|
-
return createResilientWatchMonitor({
|
|
474
|
-
label: `Environment file ${ENV_FILE}`,
|
|
475
|
-
startWatching: () => startEnvWatcher(envDir, envName, handleChange),
|
|
476
|
-
poll,
|
|
477
|
-
warn: (message) => log.warn(message),
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
function setupWatchers() {
|
|
481
|
-
const monitors = [setupRestartTriggerMonitor(), setupEnvMonitor()];
|
|
482
|
-
const sourceMonitor = setupSourceMonitor();
|
|
483
|
-
if (sourceMonitor)
|
|
484
|
-
monitors.push(sourceMonitor);
|
|
485
|
-
return monitors.filter((monitor) => monitor !== null);
|
|
486
|
-
}
|
|
487
|
-
function debouncedRestart(reason) {
|
|
488
|
-
if (restartTimer)
|
|
489
|
-
clearTimeout(restartTimer);
|
|
490
|
-
restartTimer = setTimeout(() => {
|
|
491
|
-
restartTimer = null;
|
|
492
|
-
restart(reason);
|
|
493
|
-
}, DEBOUNCE_MS);
|
|
494
|
-
}
|
|
495
|
-
function debouncedRebuild(reason) {
|
|
496
|
-
if (rebuildTimer)
|
|
497
|
-
clearTimeout(rebuildTimer);
|
|
498
|
-
rebuildTimer = setTimeout(() => {
|
|
499
|
-
rebuildTimer = null;
|
|
500
|
-
runRebuildPipeline(reason);
|
|
501
|
-
}, BUILD_DEBOUNCE_MS);
|
|
502
|
-
}
|
|
503
|
-
// --- Rebuild Pipeline ---
|
|
504
|
-
// spawn helper: stream stdout/stderr through daemon logger, resolve with exit code
|
|
505
|
-
function spawnAsync(cmd, args, opts) {
|
|
506
|
-
return new Promise((resolve) => {
|
|
507
|
-
const tag = `[${cmd} ${args.join(' ')}]`;
|
|
508
|
-
log.info(`${tag} cwd=${opts.cwd}`);
|
|
509
|
-
const proc = spawn(cmd, args, { cwd: opts.cwd, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
510
|
-
const onLine = (label) => (chunk) => {
|
|
511
|
-
for (const line of chunk.toString('utf8').split('\n')) {
|
|
512
|
-
if (line.trim())
|
|
513
|
-
log.info(`${tag} ${label}: ${line}`);
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
proc.stdout?.on('data', onLine('out'));
|
|
517
|
-
proc.stderr?.on('data', onLine('err'));
|
|
518
|
-
proc.on('exit', (code) => {
|
|
519
|
-
log.info(`${tag} exit=${code}`);
|
|
520
|
-
resolve(code ?? 1);
|
|
521
|
-
});
|
|
522
|
-
proc.on('error', (err) => {
|
|
523
|
-
log.error(`${tag} spawn error: ${err.message}`);
|
|
524
|
-
resolve(1);
|
|
525
|
-
});
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
/** The hot-reload build as lanes that run concurrently, each an ordered list of `npm run` steps,
|
|
529
|
-
* skipping packages that are absent. The first lane's order is load-bearing: agent-server emits the
|
|
530
|
-
* dist types, ui-contract re-exports them, web typechecks against ui-contract's dist. Web's bundle
|
|
531
|
-
* and dependency check read only web sources, so each gets a lane of its own. Together the web
|
|
532
|
-
* steps are web's `build` script. */
|
|
533
|
-
export function planRebuildLanes(dirs) {
|
|
534
|
-
const run = (label, cwd, script) => ({ label, cmd: 'npm', args: ['run', script], cwd });
|
|
535
|
-
const types = [run('server', dirs.repoDir, 'build')];
|
|
536
|
-
if (dirs.uiContractDir)
|
|
537
|
-
types.push(run('ui-contract', dirs.uiContractDir, 'build'));
|
|
538
|
-
if (!dirs.webDir)
|
|
539
|
-
return [types];
|
|
540
|
-
types.push(run('web-typecheck', dirs.webDir, 'typecheck'));
|
|
541
|
-
return [types, [run('web-bundle', dirs.webDir, 'bundle')], [run('web-depcruise', dirs.webDir, 'depcruise')]];
|
|
542
|
-
}
|
|
543
|
-
/** The text shown to the operator when the pipeline stops early. Spells out the consequence
|
|
544
|
-
* explicitly: an aborted rebuild leaves the *previous* build running, so a silent abort looks
|
|
545
|
-
* exactly like "my restart did nothing". */
|
|
546
|
-
export function buildRebuildAbortNotice(p) {
|
|
547
|
-
return t('notice.rebuild.aborted', { step: p.step, detail: p.detail, reason: p.reason });
|
|
548
|
-
}
|
|
549
|
-
/** Push a message down the fork IPC channel. Best-effort: the child may be mid-exit. */
|
|
550
|
-
function notifyChild(msg) {
|
|
551
|
-
if (!child || !child.connected)
|
|
552
|
-
return;
|
|
553
|
-
try {
|
|
554
|
-
child.send(msg);
|
|
555
|
-
}
|
|
556
|
-
catch { /* child went away — the log line still records it */ }
|
|
557
|
-
}
|
|
558
|
-
/** Tell the child to stop admitting new turns (or to resume). Sent on every phase change so the
|
|
559
|
-
* child's hold, which expires on its own, keeps being renewed for as long as the pipeline runs.
|
|
560
|
-
* A turn admitted after this point would be spawned into a process that is about to be SIGTERMed:
|
|
561
|
-
* its CLI child outlives the app that owns its stdout, so the answer is written to a pipe nobody
|
|
562
|
-
* is reading and the turn never completes. */
|
|
563
|
-
function holdChildTurns(hold, phase, reason) {
|
|
564
|
-
notifyChild({ type: 'rebuild-hold', hold, phase, reason });
|
|
565
|
-
}
|
|
566
|
-
/** Which published states close the child's turn gate.
|
|
567
|
-
*
|
|
568
|
-
* Only the two steps that touch the running process: `install` overwrites the files app.js loaded,
|
|
569
|
-
* `restart` kills it. The build steps before them read the repo and write `dist/` — a turn running
|
|
570
|
-
* during those is in no danger, and refusing it would be worse than useless: a refused waitpoint
|
|
571
|
-
* wake or background-agent result is dropped work, not delayed work (2026-09-21). Those two steps
|
|
572
|
-
* are only entered when app.ts is idle anyway, so the gate exists for the tick-level race — a
|
|
573
|
-
* message landing between the idle check and the SIGTERM.
|
|
574
|
-
*
|
|
575
|
-
* A queued restart (`pendingRestart`) holds regardless of the record: the build is over, but the
|
|
576
|
-
* process a turn would run in is still going to be replaced. */
|
|
577
|
-
export function rebuildHoldsTurns(progress, queuedRestart) {
|
|
578
|
-
if (queuedRestart)
|
|
579
|
-
return true;
|
|
580
|
-
if (!progress || progress.status !== 'running')
|
|
581
|
-
return false;
|
|
582
|
-
return progress.current === 'install' || progress.current === 'restart';
|
|
583
|
-
}
|
|
584
|
-
/** Publish pipeline state: keep it in memory, on disk for `system.daemonStatus`, and in the child's
|
|
585
|
-
* turn gate. One function so a phase can never reach one reader and not the others. */
|
|
586
|
-
function setRebuildProgress(next) {
|
|
587
|
-
rebuildProgress = next;
|
|
588
|
-
writeRebuildProgress(next);
|
|
589
|
-
const queuedRestart = pendingRestart !== null;
|
|
590
|
-
holdChildTurns(rebuildHoldsTurns(next, queuedRestart), next.current ?? (queuedRestart ? 'restart' : null), next.reason);
|
|
591
|
-
}
|
|
592
|
-
/** The steps a checkout will actually run, lane by lane. Derived from `planRebuildLanes` so the
|
|
593
|
-
* build half cannot drift — a package that is absent is never published as pending — plus the two
|
|
594
|
-
* phases the build planner does not own. */
|
|
595
|
-
export function planRebuildStepNames(dirs) {
|
|
596
|
-
const names = planRebuildLanes(dirs).flat().map((step) => step.label);
|
|
597
|
-
return [...names, 'install', 'restart'];
|
|
598
|
-
}
|
|
599
|
-
/** `planRebuildStepNames` for this process's checkout. */
|
|
600
|
-
function plannedProgressSteps() {
|
|
601
|
-
return planRebuildStepNames({
|
|
602
|
-
repoDir: CORTEX_REPO,
|
|
603
|
-
uiContractDir: UI_CONTRACT_DIR && existsSync(UI_CONTRACT_DIR) ? UI_CONTRACT_DIR : null,
|
|
604
|
-
webDir: WEB_DIR && existsSync(WEB_DIR) ? WEB_DIR : null,
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
/** The pipeline's last step, with the progress record closed out according to what restart() did. */
|
|
608
|
-
async function restartForRebuild(reason) {
|
|
609
|
-
updateRebuildProgress((progress) => startRebuildStep(progress, 'restart'));
|
|
610
|
-
const outcome = await restart(`src rebuild: ${reason}`);
|
|
611
|
-
updateRebuildProgress((progress) => (outcome === 'restarted'
|
|
612
|
-
? settleRebuildProgress(finishRebuildStep(progress, 'restart', 'done'), 'succeeded')
|
|
613
|
-
: settleRebuildProgress(finishRebuildStep(progress, 'restart', 'skipped', 'app.ts busy'), 'deferred', 'Build and install succeeded; the restart is queued until app.ts goes idle.')));
|
|
614
|
-
}
|
|
615
|
-
/** Advance the published progress, if a pipeline is being tracked at all. */
|
|
616
|
-
function updateRebuildProgress(patch) {
|
|
617
|
-
if (!rebuildProgress)
|
|
618
|
-
return;
|
|
619
|
-
setRebuildProgress(patch(rebuildProgress));
|
|
620
|
-
}
|
|
621
|
-
/** Map an abort's step label onto the published step vocabulary. `tgz cleanup` and `pack` are
|
|
622
|
-
* phases of the same install step from the reader's point of view. Build steps are already
|
|
623
|
-
* marked by the lane that ran them. */
|
|
624
|
-
function progressStepFor(label) {
|
|
625
|
-
if (label === 'install' || label === 'pack' || label === 'tgz cleanup')
|
|
626
|
-
return 'install';
|
|
627
|
-
return null;
|
|
628
|
-
}
|
|
629
|
-
/** Single exit point for every pipeline abort: log it, mark the step failed, tell the operator. */
|
|
630
|
-
function abortRebuild(step, detail, reason) {
|
|
631
|
-
// The daemon never runs the preferences wiring app.ts does, so pick up the operator's current
|
|
632
|
-
// language here (same precedence as app.ts: CORTEX_LANG, then the persisted preference).
|
|
633
|
-
setLocale(process.env.CORTEX_LANG ? normalizeLocale(process.env.CORTEX_LANG) : loadLang());
|
|
634
|
-
const text = buildRebuildAbortNotice({ step, detail, reason });
|
|
635
|
-
log.error(text);
|
|
636
|
-
const failed = progressStepFor(step);
|
|
637
|
-
updateRebuildProgress((progress) => settleRebuildProgress(failed ? finishRebuildStep(progress, failed, 'failed', detail) : progress, 'aborted', text));
|
|
638
|
-
notifyChild({ type: 'rebuild-aborted', text });
|
|
639
|
-
}
|
|
640
|
-
/** Run one lane's steps in order, stopping at the first failure. Returns that failure, or null. */
|
|
641
|
-
async function runBuildLane(lane) {
|
|
642
|
-
for (const step of lane) {
|
|
643
|
-
updateRebuildProgress((progress) => startRebuildStep(progress, step.label));
|
|
644
|
-
const code = await spawnAsync(step.cmd, step.args, { cwd: step.cwd });
|
|
645
|
-
if (code !== 0) {
|
|
646
|
-
const detail = `exit ${code}`;
|
|
647
|
-
updateRebuildProgress((progress) => finishRebuildStep(progress, step.label, 'failed', detail));
|
|
648
|
-
return { label: step.label, detail };
|
|
649
|
-
}
|
|
650
|
-
updateRebuildProgress((progress) => finishRebuildStep(progress, step.label, 'done'));
|
|
651
|
-
}
|
|
652
|
-
return null;
|
|
653
|
-
}
|
|
654
|
-
/** Run the build lanes concurrently and wait for all of them. Returns false when any step failed
|
|
655
|
-
* (already reported, naming every failed step). */
|
|
656
|
-
async function runBuildSteps(reason) {
|
|
657
|
-
const lanes = planRebuildLanes({
|
|
658
|
-
repoDir: CORTEX_REPO,
|
|
659
|
-
uiContractDir: UI_CONTRACT_DIR && existsSync(UI_CONTRACT_DIR) ? UI_CONTRACT_DIR : null,
|
|
660
|
-
webDir: WEB_DIR && existsSync(WEB_DIR) ? WEB_DIR : null,
|
|
661
|
-
});
|
|
662
|
-
if (!lanes.flat().some((step) => step.label === 'web-bundle')) {
|
|
663
|
-
log.warn('WEB_DIR not found — skipping web build, pack will use stale web/dist if present');
|
|
664
|
-
}
|
|
665
|
-
const failures = (await Promise.all(lanes.map(runBuildLane))).filter((failure) => failure !== null);
|
|
666
|
-
if (failures.length === 0)
|
|
667
|
-
return true;
|
|
668
|
-
abortRebuild(failures.map((failure) => failure.label).join(', '), failures.map((failure) => failure.detail).join(', '), reason);
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
/** Newest packed tarball in CORTEX_REPO, or an abort detail explaining why there is none. */
|
|
672
|
-
function findNewestTarball() {
|
|
673
|
-
let candidates;
|
|
674
|
-
try {
|
|
675
|
-
candidates = readdirSync(CORTEX_REPO)
|
|
676
|
-
.filter(f => f.startsWith('cortex-agent-server-') && f.endsWith('.tgz'))
|
|
677
|
-
.map(f => ({ f, mtime: statSync(path.join(CORTEX_REPO, f)).mtimeMs }))
|
|
678
|
-
.sort((a, b) => b.mtime - a.mtime);
|
|
679
|
-
}
|
|
680
|
-
catch (err) {
|
|
681
|
-
return { detail: `failed to enumerate tgz in ${CORTEX_REPO}: ${err?.message ?? err}` };
|
|
682
|
-
}
|
|
683
|
-
if (candidates.length === 0)
|
|
684
|
-
return { detail: 'npm pack succeeded but no cortex-agent-server-*.tgz found' };
|
|
685
|
-
return { path: path.join(CORTEX_REPO, candidates[0].f) };
|
|
686
|
-
}
|
|
687
|
-
/** Clean stale tarballs, pack, and return the freshly packed tgz path (or '' after an abort). */
|
|
688
|
-
async function packTarball(reason) {
|
|
689
|
-
const cleanCode = await spawnAsync('bash', ['-c', 'rm -f cortex-agent-server-*.tgz'], { cwd: CORTEX_REPO });
|
|
690
|
-
if (cleanCode !== 0) {
|
|
691
|
-
abortRebuild('tgz cleanup', `exit ${cleanCode}`, reason);
|
|
692
|
-
return '';
|
|
693
|
-
}
|
|
694
|
-
const packCode = await spawnAsync('npm', ['pack'], { cwd: CORTEX_REPO });
|
|
695
|
-
if (packCode !== 0) {
|
|
696
|
-
abortRebuild('pack', `exit ${packCode}`, reason);
|
|
697
|
-
return '';
|
|
698
|
-
}
|
|
699
|
-
const found = findNewestTarball();
|
|
700
|
-
if ('detail' in found) {
|
|
701
|
-
abortRebuild('pack', found.detail, reason);
|
|
702
|
-
return '';
|
|
703
|
-
}
|
|
704
|
-
return found.path;
|
|
705
|
-
}
|
|
706
|
-
/**
|
|
707
|
-
* Refresh the install root by copying the build outputs in, skipping pack + `npm install -g`.
|
|
708
|
-
* Only valid while the dependency closure is unchanged, which is every rebuild that did not touch
|
|
709
|
-
* the manifest. Returns the synced entries, or null when the full install path must run.
|
|
710
|
-
*/
|
|
711
|
-
function tryFastInstall() {
|
|
712
|
-
const plan = planFastInstall({
|
|
713
|
-
repoDir: CORTEX_REPO,
|
|
714
|
-
monorepoRoot: MONOREPO_ROOT,
|
|
715
|
-
installRoot: INSTALL_ROOT,
|
|
716
|
-
});
|
|
717
|
-
if (plan.blocked) {
|
|
718
|
-
log.info(`Fast install unavailable (${plan.blocked}) — falling back to pack + install -g`);
|
|
719
|
-
return null;
|
|
720
|
-
}
|
|
721
|
-
try {
|
|
722
|
-
return applyFastInstall(plan);
|
|
723
|
-
}
|
|
724
|
-
catch (err) {
|
|
725
|
-
// A failed sync leaves the previous tree in place (staged rename), so the full path can
|
|
726
|
-
// still recover the install root.
|
|
727
|
-
log.warn(`Fast install failed (${err?.message ?? err}) — falling back to pack + install -g`);
|
|
728
|
-
return null;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
async function runRebuildPipeline(reason) {
|
|
732
|
-
// Defer if app.ts is mid-request: install -g + restart() would interrupt it.
|
|
733
|
-
// The build/pack/install commands themselves don't touch the running child, but the
|
|
734
|
-
// final restart() does — to keep the gate simple we defer the whole pipeline.
|
|
735
|
-
if (childBusy) {
|
|
736
|
-
log.info(`Rebuild deferred (app.ts busy): ${reason}`);
|
|
737
|
-
pendingRebuild = reason;
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
// Serialize: only one rebuild pipeline at a time. Overlapping triggers collapse into pendingRebuild.
|
|
741
|
-
if (rebuilding) {
|
|
742
|
-
log.info(`Rebuild deferred (already rebuilding): ${reason}`);
|
|
743
|
-
pendingRebuild = reason;
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
if (!CORTEX_REPO) {
|
|
747
|
-
log.error(`Rebuild requested but CORTEX_REPO unset — ignoring: ${reason}`);
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
rebuilding = true;
|
|
751
|
-
let awaitingIdle = false;
|
|
752
|
-
try {
|
|
753
|
-
log.info(`Rebuild pipeline starting: ${reason}`);
|
|
754
|
-
// Publishing the plan before the first step is what makes the progress honest: the reader gets
|
|
755
|
-
// the total up front, including the steps that have not started.
|
|
756
|
-
setRebuildProgress(planRebuildProgress({
|
|
757
|
-
reason,
|
|
758
|
-
names: plannedProgressSteps(),
|
|
759
|
-
daemonPid: process.pid,
|
|
760
|
-
}));
|
|
761
|
-
// Step 1: build the workspace packages (server → ui-contract → web typecheck, beside web's
|
|
762
|
-
// bundle and dependency check).
|
|
763
|
-
if (!await runBuildSteps(reason))
|
|
764
|
-
return;
|
|
765
|
-
// Second busy gate. The build above is minutes long and touches nothing the running child
|
|
766
|
-
// reads, so a turn can legitimately have started during it — and everything below does touch
|
|
767
|
-
// it: the install overwrites the files app.js loaded, the restart kills it. Rather than refuse
|
|
768
|
-
// that turn (a refused waitpoint wake or background-agent result is dropped work, not delayed
|
|
769
|
-
// work), abandon the install and let the idle transition run the whole pipeline again. The
|
|
770
|
-
// build outputs stay on disk, so the retry is the incremental cost of a second `npm run build`.
|
|
771
|
-
if (childBusy) {
|
|
772
|
-
log.info(`Rebuild install deferred (app.ts busy): ${reason} — retrying when app.ts goes idle`);
|
|
773
|
-
pendingRebuild = reason;
|
|
774
|
-
awaitingIdle = true;
|
|
775
|
-
updateRebuildProgress((progress) => settleRebuildProgress(progress, 'deferred', 'Build finished; install and restart wait for app.ts to go idle.'));
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
// Step 2: fast install. A src edit changes only the compiled output, so copying it into the
|
|
779
|
-
// install root is equivalent to reinstalling — and skips rewriting the ~40k-file vendored
|
|
780
|
-
// closure that `npm install -g` rm -rf's and re-extracts on every rebuild.
|
|
781
|
-
const started = Date.now();
|
|
782
|
-
updateRebuildProgress((progress) => startRebuildStep(progress, 'install'));
|
|
783
|
-
const synced = tryFastInstall();
|
|
784
|
-
if (synced) {
|
|
785
|
-
log.info(`Fast install: ${synced.join(', ')} in ${Date.now() - started}ms — restarting app.ts`);
|
|
786
|
-
updateRebuildProgress((progress) => finishRebuildStep(progress, 'install', 'done', 'fast'));
|
|
787
|
-
await restartForRebuild(reason);
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
// Step 3: pack (clean old tgz first, otherwise readdir picks up a stale one)
|
|
791
|
-
const tgzPath = await packTarball(reason);
|
|
792
|
-
if (!tgzPath)
|
|
793
|
-
return;
|
|
794
|
-
log.info(`Packed tarball: ${tgzPath}`);
|
|
795
|
-
// Step 4: install -g. Run from /tmp so npm doesn't choke if its CWD lives inside the package
|
|
796
|
-
// currently being unlinked.
|
|
797
|
-
const installCode = await spawnAsync('npm', withServerNpmPrefix(['install', '-g', tgzPath]), { cwd: '/tmp' });
|
|
798
|
-
if (installCode !== 0) {
|
|
799
|
-
abortRebuild('install', `exit ${installCode}`, reason);
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
updateRebuildProgress((progress) => finishRebuildStep(progress, 'install', 'done', 'pack + install -g'));
|
|
803
|
-
// Step 5: restart app.ts. This reuses the busy/idle gate inside restart() —
|
|
804
|
-
// if a request snuck in between the busy-check above and now, restart() will
|
|
805
|
-
// re-defer to pendingRestart. Either way, the new app.js boots from the freshly
|
|
806
|
-
// installed dist/.
|
|
807
|
-
log.info(`Rebuild succeeded — restarting app.ts`);
|
|
808
|
-
await restartForRebuild(reason);
|
|
809
|
-
}
|
|
810
|
-
finally {
|
|
811
|
-
// An aborted pipeline already settled its own record; a run that reached here still `running`
|
|
812
|
-
// never restarted the child either, so releasing the hold is the honest close.
|
|
813
|
-
if (rebuildProgress?.status === 'running') {
|
|
814
|
-
setRebuildProgress(settleRebuildProgress(rebuildProgress, 'aborted', 'pipeline ended without restarting app.ts'));
|
|
815
|
-
}
|
|
816
|
-
rebuildProgress = null;
|
|
817
|
-
rebuilding = false;
|
|
818
|
-
// If src changed again while we were rebuilding, pick that up now. A pipeline that deferred its
|
|
819
|
-
// own install is the one exception: its reason stays queued for the idle transition, because
|
|
820
|
-
// re-triggering here would rebuild every couple of seconds for as long as the turn lasts.
|
|
821
|
-
if (pendingRebuild && !awaitingIdle) {
|
|
822
|
-
const next = pendingRebuild;
|
|
823
|
-
pendingRebuild = null;
|
|
824
|
-
log.info(`Consuming queued rebuild: ${next}`);
|
|
825
|
-
// Schedule via debounce so further rapid edits still coalesce.
|
|
826
|
-
debouncedRebuild(next);
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
// --- Graceful Shutdown ---
|
|
831
|
-
function closeWatchMonitors() {
|
|
832
|
-
for (const monitor of watchMonitors.splice(0))
|
|
833
|
-
monitor.close();
|
|
834
|
-
}
|
|
835
|
-
function setupShutdown() {
|
|
836
|
-
const shutdown = async (signal) => {
|
|
837
|
-
if (shuttingDown)
|
|
838
|
-
return;
|
|
839
|
-
shuttingDown = true;
|
|
840
|
-
log.info(`Received ${signal}, shutting down...`);
|
|
841
|
-
cancelPendingTimers();
|
|
842
|
-
closeWatchMonitors();
|
|
843
|
-
await stopChild();
|
|
844
|
-
log.info('Daemon stopped.');
|
|
845
|
-
process.exit(0);
|
|
846
|
-
};
|
|
847
|
-
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
848
|
-
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
849
|
-
}
|
|
850
|
-
function acquireSingletonLock() {
|
|
851
|
-
const result = tryAcquireSingletonLock(DAEMON_PID_FILE);
|
|
852
|
-
if (result.acquired) {
|
|
853
|
-
// Stale lock — previous daemon died without cleanup
|
|
854
|
-
if (result.stale)
|
|
855
|
-
log.info(`Removed stale PID file and reclaimed lock for PID ${process.pid}`);
|
|
856
|
-
return;
|
|
857
|
-
}
|
|
858
|
-
log.error(`Another Cortex daemon is already running (PID ${result.holderPid}, lockfile ${DAEMON_PID_FILE}).\n` +
|
|
859
|
-
` Refusing to start a second instance — its app.ts already holds ports 3001/3002 and your child would crash-loop on EADDRINUSE.\n` +
|
|
860
|
-
` To restart the running daemon: \`touch agent-server/.restart\` (hot reload), or send SIGTERM to PID ${result.holderPid} and rerun.`);
|
|
861
|
-
process.exit(1);
|
|
862
|
-
}
|
|
863
|
-
function releaseSingletonLock() {
|
|
864
|
-
releaseLock(DAEMON_PID_FILE);
|
|
865
|
-
try {
|
|
866
|
-
if (existsSync(DAEMON_CHILD_PID_FILE))
|
|
867
|
-
unlinkSync(DAEMON_CHILD_PID_FILE);
|
|
868
|
-
}
|
|
869
|
-
catch { }
|
|
870
|
-
}
|
|
871
|
-
function setupProcessErrorHandlers() {
|
|
872
|
-
// Prevent log failures from recursively re-entering the process error handlers.
|
|
873
|
-
let handlingError = false;
|
|
874
|
-
const report = (kind, detail) => {
|
|
875
|
-
if (handlingError)
|
|
876
|
-
return;
|
|
877
|
-
handlingError = true;
|
|
878
|
-
try {
|
|
879
|
-
log.error(`${kind}: ${String(detail)}`);
|
|
880
|
-
}
|
|
881
|
-
catch {
|
|
882
|
-
// The logger may itself fail on a broken stderr; avoid recursive handling.
|
|
883
|
-
}
|
|
884
|
-
finally {
|
|
885
|
-
handlingError = false;
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
process.on('uncaughtException', error => {
|
|
889
|
-
report('uncaughtException', error?.stack ?? error);
|
|
890
|
-
captureProcessCrash('daemon', 'uncaughtException', error);
|
|
891
|
-
});
|
|
892
|
-
process.on('unhandledRejection', reason => {
|
|
893
|
-
report('unhandledRejection', reason instanceof Error ? reason.stack : reason);
|
|
894
|
-
captureProcessCrash('daemon', 'unhandledRejection', reason);
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
function main() {
|
|
898
|
-
setupProcessErrorHandlers();
|
|
899
|
-
acquireSingletonLock();
|
|
900
|
-
process.on('exit', releaseSingletonLock);
|
|
901
|
-
log.info('Cortex Daemon starting...');
|
|
902
|
-
ensureOwnBinsOnPath();
|
|
903
|
-
setupShutdown();
|
|
904
|
-
startChild();
|
|
905
|
-
watchMonitors = setupWatchers();
|
|
906
|
-
}
|
|
907
|
-
if (isMainModule(import.meta.url)) {
|
|
908
|
-
main();
|
|
909
|
-
}
|
|
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 Ie,b as V,c as Ce,e as Oe,f as S,g as b,h as C,j as Pe}from"../chunks/chunk-REPYBMQS.js";import{e as Q}from"../chunks/chunk-52T37Y47.js";import{a as _e}from"../chunks/chunk-H2FP6DG4.js";import{b as Ne}from"../chunks/chunk-AAA3UBIS.js";import{f as xe,g as Te}from"../chunks/chunk-KENCMLRE.js";import"../chunks/chunk-3YHOCPQU.js";import"../chunks/chunk-MEPASGPP.js";import{a as F}from"../chunks/chunk-STUHNKQS.js";import"../chunks/chunk-PFMEUFJ7.js";import"../chunks/chunk-KRXTI4JO.js";import"../chunks/chunk-DPQPXBTP.js";import"../chunks/chunk-Q4UGYGU5.js";import"../chunks/chunk-W5LGYSPZ.js";import{a as Se,c as ve,e as ke}from"../chunks/chunk-E7ZMYIY6.js";import{e as Ee}from"../chunks/chunk-NAA7GF6Q.js";import{a as je,b as De,f as $e}from"../chunks/chunk-QWAQHHRS.js";import{c as we,f as Re,l as K,p as L,q as _,r as E}from"../chunks/chunk-J5DVLUKY.js";import"../chunks/chunk-WHC7AYZD.js";import{fork as Vt}from"child_process";import{watch as Y,existsSync as T,unlinkSync as de,statSync as tt,writeFileSync as Zt,readdirSync as en}from"fs";import*as p from"path";import{mkdtempSync as Mt,readdirSync as Wt,rmSync as Gt,statSync as Ut}from"node:fs";import{tmpdir as Ye}from"node:os";import*as k from"node:path";import*as d from"fs";import*as l from"path";var lt=["dist/","defaults/","web/dist/","bundled-dependencies/","scripts/install-bundled-dependencies.mjs","scripts/postinstall-restart-trigger.mjs","README.md"],ut=["dependencies","optionalDependencies","peerDependencies","bundleDependencies"];function v(e){return{blocked:e,targets:[],manifestSource:"",manifestDestination:""}}function Ae(e){try{return JSON.parse(d.readFileSync(e,"utf8"))}catch{return null}}var dt=/[*?[\]{}]/;function ft(e){let t=Array.isArray(e)?e.filter(i=>typeof i=="string"):[],n=t.filter(i=>!i.startsWith("!"));if(JSON.stringify([...n].sort())!==JSON.stringify([...lt].sort()))return{blocked:"package.json `files` changed \u2014 update EXPECTED_FILES in fast-install.ts",excluded:[]};let r=[];for(let i of t.filter(o=>o.startsWith("!"))){if(dt.test(i))return{blocked:`unsupported \`files\` negation: ${i}`,excluded:[]};r.push(l.posix.normalize(i.slice(1)).replace(/^\.\/|\/$/g,""))}return{blocked:null,excluded:r}}function pt(e,t){return t.filter(n=>n.startsWith(`${e.name}/`)).map(n=>l.join(e.source,n.slice(e.name.length+1)))}function Le(e){return JSON.stringify(ut.map(t=>{let n=e[t];return Array.isArray(n)?[t,[...n].sort()]:n&&typeof n=="object"?[t,Object.entries(n).sort(([r],[i])=>r.localeCompare(i))]:[t,null]}))}function mt(e,t){let n=e;for(;;){if(d.existsSync(l.join(n,"node_modules",t,"package.json")))return!0;let r=l.dirname(n);if(r===n)return!1;n=r}}function Fe(e){let t=ht(e);if(t)return v(t);let n=l.join(e.repoDir,"package.json"),r=Ae(n);if(!r)return v(`unreadable manifest: ${n}`);let i=Ae(l.join(e.installRoot,"package.json"));return i?bt(e,r,i):v("no installed manifest \u2014 package was never installed")}function ht({repoDir:e,installRoot:t}){return!e||!t?"repo or install root unset":l.resolve(e)===l.resolve(t)?"install root is the source checkout":null}function bt(e,t,n){if(n.cortexBundle===!0)return v("installed package is bundled \u2014 full install required");let r=ft(t.files);if(r.blocked)return v(r.blocked);let i=gt(e.installRoot,t,n);return i?v(i):yt(e,r.excluded)}function gt(e,t,n){if(Le(t)!==Le(n))return"dependency closure changed";let i=Object.keys(n.dependencies??{}).find(o=>!mt(e,o));return i?`installed dependency missing: ${i}`:null}function yt(e,t){let{repoDir:n,monorepoRoot:r,installRoot:i}=e,c=[{name:"dist",source:l.join(n,"dist"),destination:l.join(i,"dist")},{name:"defaults",source:l.join(n,"defaults"),destination:l.join(i,"defaults")},{name:"web/dist",source:l.join(r,"web","dist"),destination:l.join(i,"web","dist")}].filter(f=>d.existsSync(f.source)).map(f=>({...f,exclude:pt(f,t)}));return c.some(f=>f.name==="dist")?{blocked:null,targets:c,manifestSource:l.join(n,"package.json"),manifestDestination:l.join(i,"package.json")}:v(`no build output at ${l.join(n,"dist")}`)}function wt(e,t,n=[]){let r=`.cortex-fast-${process.pid}-${Date.now()}`,i=`${t}${r}.new`,o=`${t}${r}.old`,c=d.existsSync(t);try{d.mkdirSync(l.dirname(t),{recursive:!0}),d.cpSync(e,i,{recursive:!0,filter:f=>!n.some(ye=>f===ye||f.startsWith(`${ye}${l.sep}`))}),c&&d.renameSync(t,o),d.renameSync(i,t),c&&d.rmSync(o,{recursive:!0,force:!0})}catch(f){throw d.rmSync(i,{recursive:!0,force:!0}),c&&!d.existsSync(t)&&d.existsSync(o)&&d.renameSync(o,t),f}}function Be(e){if(e.blocked)throw new Error(`fast install blocked: ${e.blocked}`);for(let t of e.targets)wt(t.source,t.destination,t.exclude);return d.copyFileSync(e.manifestSource,e.manifestDestination),e.targets.map(t=>t.name)}import u from"node:fs";import a from"node:path";var Rt=["dist/","defaults/","web/dist/","vendor/","README.md","LICENSE","THIRD_PARTY_NOTICES.txt","scripts/bundle-prune-browser.mjs","scripts/postinstall-restart-trigger.mjs","!**/*.map"],P=["dist","defaults","web","vendor","scripts"],Z=["README.md","LICENSE","THIRD_PARTY_NOTICES.txt","package.json"],Et=["dist/entry/cli.js","dist/entry/daemon.js","dist/entry/production-app-bootstrap.js","dist/tui/index.js","dist/domain/mcp/bundled-server.js","dist/agent-adapter/claude/remote-mcp-proxy.js","dist/core/pi-sdk.js","dist/domain/auth/cc-auth-cli.js","web/dist/index.html","vendor/aistatus/gateway-cli.js","vendor/pi/dist/utils/image-resize-worker.js","vendor/pi/dist/utils/image-resize.js","vendor/pi/dist/core/extensions/loader.js","vendor/pi-ai/oauth-load.js","vendor/pi-ai/bedrock.js","vendor/pi/dist/extensions/codemode/execute.js","vendor/pi/dist/codemode-worker.js","vendor/quickjs.wasm","vendor/pi/package.json","vendor/pi/README.md","vendor/pi/CHANGELOG.md","scripts/bundle-prune-browser.mjs","scripts/postinstall-restart-trigger.mjs",...Z],St=[...P,"web/dist","dist/client-bundle","vendor/pi/docs","vendor/pi/examples","vendor/pi/schemas","vendor/pi/dist/modes/interactive/theme","vendor/pi/dist/modes/interactive/assets","vendor/pi/dist/core/export-html"],vt=["dependencies","optionalDependencies","peerDependencies","peerDependenciesMeta","bundleDependencies","bundledDependencies"];function ee(e){let t=JSON.parse(u.readFileSync(e,"utf8"));if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid manifest: ${e}`);return t}function kt(e,t){return Array.isArray(e)&&JSON.stringify([...e].sort())===JSON.stringify([...t].sort())}function jt(e){if(e.name!=="@cortex-agent/server"||e.cortexBundle!==!0)throw new Error("Invalid bundle stage: expected @cortex-agent/server with cortexBundle:true");if(!kt(e.files,Rt))throw new Error("Invalid bundle stage: package.json `files` changed")}function Dt(e){let t=e.bin;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid bundle stage: missing bin entries");let n=[e.main,...Object.values(t)];for(let r of n)$t(r);return n}function $t(e){if(typeof e!="string")throw new Error("Invalid bundle stage: missing runtime entry");if(!e.startsWith("dist/")||!e.endsWith(".js")||e.includes("\\"))throw new Error(`Invalid bundle stage entry: ${e}`);if(e.split("/").some(t=>t===".."||t==="."))throw new Error(`Unsafe stage entry: ${e}`)}function B(e,t,n){let r=a.join(e,t),i=u.lstatSync(r);if(!(n?i.isDirectory():i.isFile()))throw new Error(`Invalid bundle stage entry (wrong type or symlink): ${r}`)}function te(e){return u.readdirSync(e,{withFileTypes:!0}).flatMap(t=>{let n=a.join(e,t.name);if(t.isDirectory())return te(n);if(t.isFile())return[n];throw new Error(`Invalid bundle stage: symlink or special entry: ${n}`)})}function W(e){if(!e)throw new Error("Bundle stage directory unset");let t=ee(a.join(e,"package.json"));jt(t);for(let n of St)B(e,n,!0);for(let n of[...Et,...Dt(t)])B(e,n,!1);for(let n of P)te(a.join(e,n))}function M(e){let t=a.resolve(e);try{return u.realpathSync(t)}catch(n){if(n.code!=="ENOENT")throw n;return It(t)}}function It(e){return u.lstatSync(e,{throwIfNoEntry:!1})?.isSymbolicLink()?M(a.resolve(a.dirname(e),u.readlinkSync(e))):a.join(M(a.dirname(e)),a.basename(e))}function Me(e,t){let n=a.relative(e,t);return n===""||!n.startsWith(`..${a.sep}`)&&n!==".."&&!a.isAbsolute(n)}function Ge(e){if(!e.stageDir||!e.installRoot)throw new Error("Bundle stage and install roots must be separate and set");let t=M(e.stageDir),n=M(e.installRoot);if(Me(t,n)||Me(n,t))throw new Error("Bundle stage and install roots overlap; separate roots are required");return{stageDir:t,installRoot:n}}function We(e){return JSON.stringify(vt.map(t=>{let n=e[t];return Array.isArray(n)?[t,[...n].sort()]:n&&typeof n=="object"?[t,Object.entries(n).sort(([r],[i])=>r.localeCompare(i))]:[t,n??null]}))}function xt(e,t){let n=e;for(;;){if(u.existsSync(a.join(n,"node_modules",t,"package.json")))return!0;let r=a.dirname(n);if(r===n)return!1;n=r}}function Tt(e,t,n){if(We(t)!==We(n))return"dependency closure changed";let i=Object.keys(t.dependencies??{}).find(o=>!xt(e,o));return i?`installed dependency missing: ${i}`:null}function _t(e){try{for(let t of P)B(e,t,!0);for(let t of Z)B(e,t,!1);return null}catch{return"installed bundle layout is incomplete or incompatible"}}function Ct(e,t){let n;try{n=ee(a.join(e,"package.json"))}catch{return"no readable installed manifest \u2014 full install required"}return n.cortexBundle!==!0||n.name!=="@cortex-agent/server"?"installed package is not a Cortex bundle \u2014 full install required":Tt(e,t,n)??_t(e)}function Ue(e,t){return{name:t,source:a.join(e.stageDir,t),destination:a.join(e.installRoot,t),exclude:[]}}function ne(e){W(e.stageDir);let t=Ge(e),n=Ct(t.installRoot,ee(a.join(t.stageDir,"package.json"))),r=[...P,...Z.filter(i=>i!=="package.json")];return{...t,blocked:n,targets:n?[]:r.map(i=>Ue(t,i)),manifestSource:a.join(t.stageDir,"package.json"),manifestDestination:a.join(t.installRoot,"package.json")}}function Ot(e,t){return u.mkdirSync(a.join(t,"new")),u.mkdirSync(a.join(t,"old")),[...e.targets,Ue(e,"package.json")].map(n=>{let r=a.join(t,"new",n.name);return u.cpSync(n.source,r,{recursive:!0,dereference:!1,errorOnExist:!0,force:!1}),{destination:n.destination,staged:r,previous:a.join(t,"old",n.name),movedPrevious:!1,installedNew:!1}})}function Pt(e){u.renameSync(e.destination,e.previous),e.movedPrevious=!0,u.renameSync(e.staged,e.destination),e.installedNew=!0}function Nt(e){let t=[];for(let n of[...e].reverse())try{n.installedNew&&u.rmSync(n.destination,{recursive:!0,force:!0}),n.movedPrevious&&u.renameSync(n.previous,n.destination)}catch(r){t.push(r)}return t}function At(e,t,n){try{for(let r of e)Pt(r)}catch(r){let i=Nt(e);throw i.length?new AggregateError([r,...i],`Bundle rollback incomplete; backups retained at ${t}`):(u.rmSync(t,{recursive:!0,force:!0}),r)}try{u.rmSync(t,{recursive:!0,force:!0})}catch(r){n(`Bundle installed; backup cleanup failed at ${t}: ${r}`)}}function Xe(e,t=console.warn){if(e.blocked)throw new Error(`bundle install blocked: ${e.blocked}`);let n=ne(e);if(n.blocked)throw new Error(`bundle install blocked: ${n.blocked}`);let r=u.mkdtempSync(a.join(a.dirname(n.installRoot),".cortex-bundle-")),i;try{i=Ot(n,r)}catch(o){throw u.rmSync(r,{recursive:!0,force:!0}),o}return At(i,r,t),n.targets.map(o=>o.name)}function Lt(e,t){let n=t;for(;n!==e;){let r=u.lstatSync(n,{throwIfNoEntry:!1});if(r?.isSymbolicLink())throw new Error(`Source map destination is a symlink: ${n}`);if(r&&(n===t?!r.isFile():!r.isDirectory()))throw new Error(`Source map destination has incompatible type: ${n}`);n=a.dirname(n)}}function He(e,t){W(e);let n=Ge({stageDir:e,installRoot:t}),i=P.flatMap(o=>te(a.join(n.stageDir,o))).filter(o=>o.endsWith(".map")).map(o=>{let c=a.join(n.installRoot,a.relative(n.stageDir,o));return Lt(n.installRoot,c),{destination:c,content:u.readFileSync(o)}});for(let{destination:o,content:c}of i)u.mkdirSync(a.dirname(o),{recursive:!0}),u.writeFileSync(o,c)}import{spawn as Ft}from"node:child_process";function ze(e,t,n,r){return new Promise(i=>{let o=`[${e} ${t.join(" ")}]`;r.info(`${o} cwd=${n.cwd}`);let c=Ft(e,t,{...n,stdio:["ignore","pipe","pipe"]});c.stdout?.on("data",qe(r,o,"out")),c.stderr?.on("data",qe(r,o,"err")),c.on("exit",f=>{r.info(`${o} exit=${f}`),i(f??1)}),c.on("error",f=>{r.error(`${o} spawn error: ${f.message}`),i(1)})})}function qe(e,t,n){return r=>{for(let i of r.toString("utf8").split(`
|
|
5
|
+
`))i.trim()&&e.info(`${t} ${n}: ${i}`)}}function re(e){let t=(r,i,o)=>({label:r,cmd:"npm",args:["run",o],cwd:i}),n=[t("server",e.repoDir,"build")];return e.uiContractDir&&n.push(t("ui-contract",e.uiContractDir,"build")),e.webDir?(n.push(t("web-typecheck",e.webDir,"typecheck")),[n,[t("web-bundle",e.webDir,"bundle")],[t("web-depcruise",e.webDir,"depcruise")]]):[n]}function ie(e,t=!0){let n=re(e).flat().map(r=>r.label);return t&&n.push("bundle"),[...n,"install","restart"]}async function Bt(e,t){for(let n of e){t.update(i=>S(i,n.label));let r=await t.run(n.cmd,n.args,{cwd:n.cwd});if(r!==0){let i=`exit ${r}`;return t.update(o=>b(o,n.label,"failed",i)),{label:n.label,detail:i}}t.update(i=>b(i,n.label,"done"))}return null}async function Je(e){let t=re(e.dirs);t.flat().some(r=>r.label==="web-bundle")||e.log.warn("WEB_DIR not found \u2014 skipping web build, pack will use stale web/dist if present");let n=(await Promise.all(t.map(r=>Bt(r,e)))).filter(r=>r!==null);return n.length===0?!0:(e.abort(n.map(r=>r.label).join(", "),n.map(r=>r.detail).join(", ")),!1)}function Xt(e){return e.bundle?e.bundleBlocked===null?"bundle-fast":"bundle-full":"source"}var j=class extends Error{step;constructor(t,n){super(n),this.step=t}};function U(e){return e instanceof Error?e.message:String(e)}async function Ke(e){try{return await Je(e)?await Ht(e):"finished"}catch(t){let n=t instanceof j?t.step:"install";return e.abort(n,U(t)),"finished"}}async function Ht(e){let t=e.bundle?Mt(k.join(Ye(),"cortex-rebuild-")):null;try{return await qt(e,t?k.join(t,"stage"):null)}finally{t&&Gt(t,{recursive:!0,force:!0})}}async function qt(e,t){if(t&&await zt(e,t),e.deferInstall())return"deferred";e.update(r=>S(r,"install"));let n=await Jt(e,t);return e.update(r=>b(r,"install","done",n)),e.log.info("Rebuild succeeded \u2014 restarting app.ts"),await e.restart(),"finished"}async function zt(e,t){e.update(n=>S(n,"bundle"));try{await G(e,"bundle",process.execPath,["scripts/bundle.mjs",t,"--sourcemap"],e.dirs.repoDir),W(t),e.update(n=>b(n,"bundle","done"))}catch(n){throw new j("bundle",U(n))}}async function Jt(e,t){if(!t)return Kt(e);let n=ne({stageDir:t,installRoot:e.installRoot}),r=Xt({bundle:e.bundle,bundleBlocked:n.blocked});if(r==="bundle-fast"){let o=Xe(n,c=>e.log.warn(c));return e.log.info(`Bundle fast install: ${o.join(", ")}`),r}e.log.info(`Bundle fast install unavailable (${n.blocked}) \u2014 packing staged bundle`);let i=await Qt(e,t);await Ve(e,i);try{He(t,e.installRoot)}catch(o){e.log.warn(`Bundle installed without complete local source maps: ${U(o)} \u2014 restarting app.ts`)}return"bundle-full"}function Yt(e){let t=Fe({repoDir:e.dirs.repoDir,monorepoRoot:k.dirname(e.dirs.repoDir),installRoot:e.installRoot});if(t.blocked)return e.log.info(`Fast install unavailable (${t.blocked}) \u2014 falling back to pack + install -g`),null;try{return Be(t)}catch(n){return e.log.warn(`Fast install failed (${U(n)}) \u2014 falling back to pack + install -g`),null}}async function Kt(e){let t=Yt(e);return t?(e.log.info(`Fast install: ${t.join(", ")}`),"fast"):(await G(e,"tgz cleanup","bash",["-c","rm -f cortex-agent-server-*.tgz"],e.dirs.repoDir),await G(e,"pack","npm",["pack"],e.dirs.repoDir),await Ve(e,Qe(e.dirs.repoDir)),"pack + install -g")}async function Qt(e,t){return await G(e,"pack","npm",["pack","--ignore-scripts"],t),Qe(t)}function Qe(e){let t=Wt(e).filter(n=>n.startsWith("cortex-agent-server-")&&n.endsWith(".tgz")).map(n=>({file:n,mtime:Ut(k.join(e,n)).mtimeMs})).sort((n,r)=>r.mtime-n.mtime);if(!t.length)throw new j("pack","npm pack succeeded but no cortex-agent-server-*.tgz found");return k.join(e,t[0].file)}async function Ve(e,t){e.log.info(`Packed tarball: ${t}`);let n=$e(["install","-g",t],e.installRoot),r={...process.env,CORTEX_SKIP_POSTINSTALL_RESTART:"1"},i=await e.run("npm",n,{cwd:Ye(),env:r});if(i!==0)throw new j("install",`exit ${i}`)}async function G(e,t,n,r,i){let o=await e.run(n,r,{cwd:i});if(o!==0)throw new j(t,`exit ${o}`)}Ie(p.join(K,".env"));var s=Ee("daemon"),tn=je(new URL("dist/entry/daemon.js",__cortexPackageRoot).href),nn=p.join(tn,"app.js"),D=p.join(K,".env"),y=process.env.CORTEX_REPO??"",nt=process.env.CORTEX_REBUILD_BUNDLE!=="0",w=y?p.join(y,"src"):"",q=y?p.dirname(y):"",oe=q?p.join(q,"web"):"",se=q?p.join(q,"packages","ui-contract"):"",rn=800,on=2500,fe=1e3,sn=3e4,an=1e4,cn=["tests/","tmp/","node_modules/","dist/","vendor/"],ln=[".d.ts",".test.ts",".spec.ts"],m=null,rt=0,$=fe,I=null,x=null,N=null,z=!1,R=!1,h=null,g=null,X=!1,ce=!1,J=null,le=null,it=[],O=null;function pe(){N&&(clearTimeout(N),N=null),I&&(clearTimeout(I),I=null),x&&(clearTimeout(x),x=null)}function un(e=null,t=null){let n=["pipe","ignore","ignore","ipc"],r={...process.env};return delete r.CORTEX_RESTART_REASON,delete r[V],e&&(r.CORTEX_RESTART_REASON=e),t&&(r[V]=t),{cwd:Re,windowsHide:!0,stdio:n,execArgv:[],env:r}}function me(){if(z)return;if(m){s.info("startChild called but child already running \u2014 skipping.");return}let e=J,t=le;J=null,le=null,s.info(e?`Starting app.ts (reason: ${e})...`:"Starting app.ts..."),rt=Date.now(),R=!1,h=null,m=Vt(nn,[],un(e,t)),s.info(`app.ts started \u2014 PID ${m.pid}`);try{Zt(_,String(m.pid),"utf8")}catch{}m.on("message",fn),m.on("exit",pn)}function dn(){R=!1;let e=h?` (pending restart: ${h})`:g?` (pending rebuild: ${g})`:"";if(s.info(`IPC \u2190 app.ts: idle${e}`),h){let t=h;h=null,he(t)}else if(g){let t=g;g=null,ct(t)}}function fn(e){e?.type==="busy"?(s.info("IPC \u2190 app.ts: busy"),R=!0):e?.type==="idle"&&dn()}function pn(e,t){m=null,R=!1;try{T(_)&&de(_)}catch{}if(z){s.info("app.ts exited (shutdown).");return}if(X){t&&s.info(`app.ts stopped (signal ${t}).`);return}mn(e,t)}function mn(e,t){let n=Date.now()-rt;n>an&&($=fe);let r=t?`crash (signal ${t})`:`crash (exit code ${e})`,i=Ce({code:e,signal:t,uptimeMs:n,backoffMs:$});s.info(t?`app.ts killed by signal ${t}.`:`app.ts exited with code ${e}.`),s.info(`Restarting in ${$}ms...`),pe(),N=setTimeout(()=>{N=null,J=r,le=i,me()},$),$=Math.min($*2,sn)}function ot(){return new Promise(e=>{if(!m)return e();let t=m;s.info(`Stopping app.ts (PID ${t.pid})...`);let n=setTimeout(()=>{s.info("Force killing app.ts...");try{t.kill("SIGKILL")}catch{}},5e3);t.once("exit",()=>{clearTimeout(n),e()}),t.kill("SIGTERM")})}async function he(e){return R?(s.info(`Restart deferred (app.ts is busy): ${e}`),h=e,H(!0,"restart",e),"deferred"):X?(s.info(`Restart deferred (already restarting): ${e}`),h=e,H(!0,"restart",e),"deferred"):(pe(),s.info(`Restarting: ${e}`),$=fe,X=!0,H(!0,"restart",e),await ot(),X=!1,h&&(s.info(`Absorbed deferred restart: ${h}`),h=null),J=e,me(),"restarted")}function hn(e){for(let t of e.splice(0))try{t.close()}catch{}}function bn(e,t){let n=[],r=i=>{n.push(Y(i,(c,f)=>t(c,f)));let o;try{o=en(i,{withFileTypes:!0})}catch{return}for(let c of o)c.isDirectory()&&(c.name.startsWith(".")||c.name==="node_modules"||r(p.join(i,c.name)))};try{r(e)}catch(i){throw hn(n),i}return n}function gn(e){try{return T(e)&&tt(e).isDirectory()}catch{return!1}}function Ze(e){if(!e)return;let t=String(e).replace(/\\/g,"/");t.endsWith(".ts")&&(ln.some(n=>t.endsWith(n))||cn.some(n=>t.startsWith(n)||t.includes(`/${n}`))||be(`src change: ${t}`))}function yn(){if(!w||!gn(w)){let e=y?`CORTEX_REPO=${y} set but ${w} not a directory`:"CORTEX_REPO unset";return s.warn(`${e} \u2014 src watcher disabled, only .restart trigger available`),null}return F({label:`Source ${w}`,warn:e=>s.warn(e),startWatching:()=>{if(process.platform==="win32"){let t=bn(w,(n,r)=>Ze(r));return s.info(`Watching src: ${w} (per-directory, *.ts, ${t.length} dirs)`),t}let e=Y(w,{recursive:!0},(t,n)=>Ze(n));return s.info(`Watching src: ${w} (recursive, *.ts)`),[e]}})}function et(){if(T(E)){try{de(E)}catch{}y?be("manual trigger (.restart file)"):ue("manual trigger (.restart file)")}}function wn(){let e=p.dirname(E),t=p.basename(E);return F({label:`Restart trigger ${E}`,warn:n=>s.warn(n),startWatching:()=>{let n=Y(e,(r,i)=>{i&&String(i)===t&&et()});return s.info(`Watching for restart trigger: ${E}`),[n]},poll:et})}function ae(e){try{let t=tt(e);return`${t.mtimeMs}:${t.size}`}catch{return null}}function Rn(e,t,n){let r=Y(e,(i,o)=>{o&&String(o)===t&&n()});return s.info(`Watching env file: ${D}`),[r]}function En(){let e=p.dirname(D);if(!T(e))return null;let t=p.basename(D),n=ae(D),r=()=>{n=ae(D),ue("env change (.env)")},i=()=>{let o=ae(D);o!==n&&(n=o,ue("env change (.env)"))};return F({label:`Environment file ${D}`,startWatching:()=>Rn(e,t,r),poll:i,warn:o=>s.warn(o)})}function Sn(){let e=[wn(),En()],t=yn();return t&&e.push(t),e.filter(n=>n!==null)}function ue(e){I&&clearTimeout(I),I=setTimeout(()=>{I=null,he(e)},rn)}function be(e){x&&clearTimeout(x),x=setTimeout(()=>{x=null,ct(e)},on)}function vn(e){return ke("notice.rebuild.aborted",{step:e.step,detail:e.detail,reason:e.reason})}function st(e){if(!(!m||!m.connected))try{m.send(e)}catch{}}function H(e,t,n){st({type:"rebuild-hold",hold:e,phase:t,reason:n})}function kn(e,t){return t?!0:!e||e.status!=="running"?!1:e.current==="install"||e.current==="restart"}function ge(e){O=e,Pe(e);let t=h!==null;H(kn(e,t),e.current??(t?"restart":null),e.reason)}function at(){return{repoDir:y,uiContractDir:se&&T(se)?se:null,webDir:oe&&T(oe)?oe:null}}async function jn(e){A(n=>S(n,"restart"));let t=await he(`src rebuild: ${e}`);A(n=>t==="restarted"?C(b(n,"restart","done"),"succeeded"):C(b(n,"restart","skipped","app.ts busy"),"deferred","Build and install succeeded; the restart is queued until app.ts goes idle."))}function A(e){O&&ge(e(O))}function Dn(e){return e==="bundle"?"bundle":e==="install"||e==="pack"||e==="tgz cleanup"?"install":null}function $n(e,t,n){ve(process.env.CORTEX_LANG?Se(process.env.CORTEX_LANG):_e());let r=vn({step:e,detail:t,reason:n});s.error(r);let i=Dn(e);A(o=>C(i?b(o,i,"failed",t):o,"aborted",r)),st({type:"rebuild-aborted",text:r})}function In(e){return R||ce?(s.info(`Rebuild deferred (${R?"app.ts busy":"already rebuilding"}): ${e}`),g=e,!1):y?(ce=!0,!0):(s.error(`Rebuild requested but CORTEX_REPO unset \u2014 ignoring: ${e}`),!1)}function xn(e){return R?(s.info(`Rebuild install deferred (app.ts busy): ${e} \u2014 retrying when app.ts goes idle`),g=e,A(t=>C(t,"deferred","Build finished; install and restart wait for app.ts to go idle.")),!0):!1}function Tn(e){return{dirs:at(),installRoot:we,bundle:nt,log:s,run:(t,n,r)=>ze(t,n,r,s),update:A,abort:(t,n)=>$n(t,n,e),deferInstall:()=>xn(e),restart:()=>jn(e)}}async function ct(e){if(!In(e))return;let t=!1;try{s.info(`Rebuild pipeline starting: ${e}`),ge(Oe({reason:e,names:ie(at(),nt),daemonPid:process.pid})),t=await Ke(Tn(e))==="deferred"}finally{_n(t)}}function _n(e){if(O?.status==="running"&&ge(C(O,"aborted","pipeline ended without restarting app.ts")),O=null,ce=!1,g&&!e){let t=g;g=null,s.info(`Consuming queued rebuild: ${t}`),be(t)}}function Cn(){for(let e of it.splice(0))e.close()}function On(){let e=async t=>{z||(z=!0,s.info(`Received ${t}, shutting down...`),pe(),Cn(),await ot(),s.info("Daemon stopped."),process.exit(0))};process.on("SIGINT",()=>e("SIGINT")),process.on("SIGTERM",()=>e("SIGTERM"))}function Pn(){let e=xe(L);if(e.acquired){e.stale&&s.info(`Removed stale PID file and reclaimed lock for PID ${process.pid}`);return}s.error(`Another Cortex daemon is already running (PID ${e.holderPid}, lockfile ${L}).
|
|
6
|
+
Refusing to start a second instance \u2014 its app.ts already holds ports 3001/3002 and your child would crash-loop on EADDRINUSE.
|
|
7
|
+
To restart the running daemon: \`touch agent-server/.restart\` (hot reload), or send SIGTERM to PID ${e.holderPid} and rerun.`),process.exit(1)}function Nn(){Te(L);try{T(_)&&de(_)}catch{}}function An(){let e=!1,t=(n,r)=>{if(!e){e=!0;try{s.error(`${n}: ${String(r)}`)}catch{}finally{e=!1}}};process.on("uncaughtException",n=>{t("uncaughtException",n?.stack??n),Q("daemon","uncaughtException",n)}),process.on("unhandledRejection",n=>{t("unhandledRejection",n instanceof Error?n.stack:n),Q("daemon","unhandledRejection",n)})}function Ln(){An(),Pn(),process.on("exit",Nn),s.info("Cortex Daemon starting..."),Ne(),On(),me(),it=Sn()}De(new URL("dist/entry/daemon.js",__cortexPackageRoot).href)&&Ln();export{un as buildChildProcessConfig,vn as buildRebuildAbortNotice,re as planRebuildLanes,ie as planRebuildStepNames,kn as rebuildHoldsTurns};
|