@cortex-agent/server 2026.10.21 → 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 +10 -6
- package/THIRD_PARTY_NOTICES.txt +16546 -0
- package/defaults/context/projects/AGENTS.md +1 -1
- package/defaults/gitignore +3 -3
- package/defaults/hooks/new-session-hook.mjs +1 -1
- package/defaults/hooks/status-md-guard.mjs +6 -6
- package/defaults/plugins/cortex-system/plugin.json +1 -1
- package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +16 -9
- package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +2 -2
- package/defaults/prompts/clean-workspace.md +21 -0
- package/defaults/rules/agents-md.md +1 -1
- package/defaults/rules/issues-md.md +1 -1
- package/defaults/rules/meta-conventions.md +3 -3
- package/defaults/rules/mission-md.md +1 -1
- package/defaults/rules/status-md.md +1 -1
- package/dist/agent-adapter/claude/remote-mcp-proxy.js +4 -66
- package/dist/build-info.json +1 -0
- 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/client.mjs +10 -5
- package/dist/client-bundle/manifest.json +2 -2
- 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 -593
- 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 -895
- 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 -201
- 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 -103
- package/dist/agent-adapter/claude/bg-task-tracker.js +0 -164
- 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 -131
- 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 -219
- package/dist/agent-adapter/claude/turn-machine.js +0 -728
- 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 -128
- package/dist/agent-adapter/continuation-phase.js +0 -340
- 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 -165
- package/dist/agent-adapter/run-events.js +0 -119
- package/dist/agent-adapter/types.d.ts +0 -323
- 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 -85
- package/dist/core/claude-credentials.js +0 -231
- 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 -135
- package/dist/core/gateway-generator.js +0 -521
- 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 -106
- 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 -910
- 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 -152
- package/dist/core/locales/slices/init.js +0 -429
- 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 -13
- package/dist/core/log.js +0 -157
- 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 -296
- package/dist/core/settings-spec.js +0 -305
- 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 -171
- package/dist/core/types/agent-types.js +0 -1
- package/dist/core/types/environment-types.d.ts +0 -50
- 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 -162
- 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 -68
- package/dist/domain/agents/environments/schema.js +0 -114
- 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 -136
- 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 -70
- package/dist/domain/mcp/tools/context.js +0 -107
- 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 -33
- package/dist/domain/monitor/event-loop-monitor.js +0 -60
- 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 -39
- package/dist/domain/plugins/authoring.js +0 -320
- 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 -10
- package/dist/domain/plugins/runtime-gc.js +0 -68
- package/dist/domain/plugins/runtime.d.ts +0 -21
- package/dist/domain/plugins/runtime.js +0 -554
- 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 -320
- 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 -22
- 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 -12
- package/dist/domain/runs/service.js +0 -49
- 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 -19
- package/dist/domain/scheduling/builtin-job-controller.js +0 -103
- 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 -37
- 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 -303
- 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 -88
- 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/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 -1136
- package/dist/domain/ui-service/app-router.js +0 -305
- 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 -1068
- package/dist/domain/ui-service/input-schemas.js +0 -702
- package/dist/domain/ui-service/mutate/approvals.d.ts +0 -32
- package/dist/domain/ui-service/mutate/approvals.js +0 -133
- 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/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 -118
- 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 -132
- 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 -24
- package/dist/domain/ui-service/query/models.js +0 -108
- 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 -57
- 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 -429
- 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/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 -47
- package/dist/domain/ui-service/trpc.js +0 -43
- package/dist/domain/ui-service/types.d.ts +0 -1790
- package/dist/domain/ui-service/types.js +0 -1
- package/dist/domain/ui-service/ui-service.d.ts +0 -512
- package/dist/domain/ui-service/ui-service.js +0 -234
- 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 -277
- 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 -148
- package/dist/entry/init.js +0 -1270
- 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 -81
- 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 -166
- 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/ui-cli.d.ts +0 -13
- package/dist/entry/ui-cli.js +0 -78
- 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 -262
- 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 -60
- package/dist/orchestration/routing/webhook.d.ts +0 -10
- package/dist/orchestration/routing/webhook.js +0 -432
- 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 -77
- package/dist/orchestration/transcript-sink.js +0 -250
- 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 -180
- 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 -49
- package/dist/platform/ui-http/ui-auth-routes.js +0 -113
- package/dist/platform/ui-http/ui-http-server.d.ts +0 -93
- package/dist/platform/ui-http/ui-http-server.js +0 -306
- 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-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/hook-registry.d.ts +0 -101
- package/dist/store/hook-registry.js +0 -314
- 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 -868
- 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 -115
- package/dist/store/version-migrations.js +0 -1371
- 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 -88
- 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-CB4GJ6qO.js +0 -2
- package/web/dist/assets/index-CaSZPg_H.css +0 -1
- package/web/dist/assets/index-CzOR7Edh.js +0 -522
- package/web/dist/assets/index-cIGFv27z.js +0 -1
|
@@ -0,0 +1,1924 @@
|
|
|
1
|
+
(function() {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// ============================================================
|
|
5
|
+
// DATA LOADING
|
|
6
|
+
// ============================================================
|
|
7
|
+
|
|
8
|
+
const base64 = document.getElementById('session-data').textContent;
|
|
9
|
+
const binary = atob(base64);
|
|
10
|
+
const bytes = new Uint8Array(binary.length);
|
|
11
|
+
for (let i = 0; i < binary.length; i++) {
|
|
12
|
+
bytes[i] = binary.charCodeAt(i);
|
|
13
|
+
}
|
|
14
|
+
const data = JSON.parse(new TextDecoder('utf-8').decode(bytes));
|
|
15
|
+
const { header, entries, leafId: defaultLeafId, systemPrompt, tools, renderedTools } = data;
|
|
16
|
+
|
|
17
|
+
// ============================================================
|
|
18
|
+
// URL PARAMETER HANDLING
|
|
19
|
+
// ============================================================
|
|
20
|
+
|
|
21
|
+
// Parse URL parameters for deep linking: leafId and targetId
|
|
22
|
+
// Check for injected params (when loaded in iframe via srcdoc) or use window.location
|
|
23
|
+
const injectedParams = document.querySelector('meta[name="pi-url-params"]');
|
|
24
|
+
const searchString = injectedParams ? injectedParams.content : window.location.search.substring(1);
|
|
25
|
+
const urlParams = new URLSearchParams(searchString);
|
|
26
|
+
const urlLeafId = urlParams.get('leafId');
|
|
27
|
+
const urlTargetId = urlParams.get('targetId');
|
|
28
|
+
// Use URL leafId if provided, otherwise fall back to session default
|
|
29
|
+
const leafId = urlLeafId || defaultLeafId;
|
|
30
|
+
|
|
31
|
+
// ============================================================
|
|
32
|
+
// DATA STRUCTURES
|
|
33
|
+
// ============================================================
|
|
34
|
+
|
|
35
|
+
// Entry lookup by ID
|
|
36
|
+
const byId = new Map();
|
|
37
|
+
for (const entry of entries) {
|
|
38
|
+
byId.set(entry.id, entry);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Tool call lookup (toolCallId -> {name, arguments})
|
|
42
|
+
const toolCallMap = new Map();
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
if (entry.type === 'message' && entry.message.role === 'assistant') {
|
|
45
|
+
const content = entry.message.content;
|
|
46
|
+
if (Array.isArray(content)) {
|
|
47
|
+
for (const block of content) {
|
|
48
|
+
if (block.type === 'toolCall') {
|
|
49
|
+
toolCallMap.set(block.id, { name: block.name, arguments: block.arguments });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Label lookup (entryId -> label string)
|
|
57
|
+
// Labels are stored in 'label' entries that reference their target via targetId
|
|
58
|
+
const labelMap = new Map();
|
|
59
|
+
for (const entry of entries) {
|
|
60
|
+
if (entry.type === 'label' && entry.targetId && entry.label) {
|
|
61
|
+
labelMap.set(entry.targetId, entry.label);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ============================================================
|
|
66
|
+
// TREE DATA PREPARATION (no DOM, pure data)
|
|
67
|
+
// ============================================================
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Build tree structure from flat entries.
|
|
71
|
+
* Returns array of root nodes, each with { entry, children, label }.
|
|
72
|
+
*/
|
|
73
|
+
function buildTree() {
|
|
74
|
+
const nodeMap = new Map();
|
|
75
|
+
const roots = [];
|
|
76
|
+
|
|
77
|
+
// Create nodes
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
nodeMap.set(entry.id, {
|
|
80
|
+
entry,
|
|
81
|
+
children: [],
|
|
82
|
+
label: labelMap.get(entry.id)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Build parent-child relationships
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
const node = nodeMap.get(entry.id);
|
|
89
|
+
if (entry.parentId === null || entry.parentId === undefined || entry.parentId === entry.id) {
|
|
90
|
+
roots.push(node);
|
|
91
|
+
} else {
|
|
92
|
+
const parent = nodeMap.get(entry.parentId);
|
|
93
|
+
if (parent) {
|
|
94
|
+
parent.children.push(node);
|
|
95
|
+
} else {
|
|
96
|
+
roots.push(node);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Sort children by timestamp
|
|
102
|
+
function sortChildren(node) {
|
|
103
|
+
node.children.sort((a, b) =>
|
|
104
|
+
new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()
|
|
105
|
+
);
|
|
106
|
+
node.children.forEach(sortChildren);
|
|
107
|
+
}
|
|
108
|
+
roots.forEach(sortChildren);
|
|
109
|
+
|
|
110
|
+
return roots;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Build set of entry IDs on path from root to target.
|
|
115
|
+
*/
|
|
116
|
+
function buildActivePathIds(targetId) {
|
|
117
|
+
const ids = new Set();
|
|
118
|
+
let current = byId.get(targetId);
|
|
119
|
+
while (current) {
|
|
120
|
+
ids.add(current.id);
|
|
121
|
+
// Stop if no parent or self-referencing (root)
|
|
122
|
+
if (!current.parentId || current.parentId === current.id) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
current = byId.get(current.parentId);
|
|
126
|
+
}
|
|
127
|
+
return ids;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get array of entries from root to target (the conversation path).
|
|
132
|
+
*/
|
|
133
|
+
function getPath(targetId) {
|
|
134
|
+
const path = [];
|
|
135
|
+
let current = byId.get(targetId);
|
|
136
|
+
while (current) {
|
|
137
|
+
path.unshift(current);
|
|
138
|
+
// Stop if no parent or self-referencing (root)
|
|
139
|
+
if (!current.parentId || current.parentId === current.id) {
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
current = byId.get(current.parentId);
|
|
143
|
+
}
|
|
144
|
+
return path;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Tree node lookup for finding leaves
|
|
148
|
+
let treeNodeMap = null;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Find the newest leaf node reachable from a given node.
|
|
152
|
+
* This allows clicking any node in a branch to show the full branch.
|
|
153
|
+
* Children are sorted by timestamp, so the newest is always last.
|
|
154
|
+
*/
|
|
155
|
+
function findNewestLeaf(nodeId) {
|
|
156
|
+
// Build tree node map lazily
|
|
157
|
+
if (!treeNodeMap) {
|
|
158
|
+
treeNodeMap = new Map();
|
|
159
|
+
const tree = buildTree();
|
|
160
|
+
function mapNodes(node) {
|
|
161
|
+
treeNodeMap.set(node.entry.id, node);
|
|
162
|
+
node.children.forEach(mapNodes);
|
|
163
|
+
}
|
|
164
|
+
tree.forEach(mapNodes);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const node = treeNodeMap.get(nodeId);
|
|
168
|
+
if (!node) return nodeId;
|
|
169
|
+
|
|
170
|
+
// Follow the newest (last) child at each level
|
|
171
|
+
let current = node;
|
|
172
|
+
while (current.children.length > 0) {
|
|
173
|
+
current = current.children[current.children.length - 1];
|
|
174
|
+
}
|
|
175
|
+
return current.entry.id;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Flatten tree into list with indentation and connector info.
|
|
180
|
+
* Returns array of { node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots }.
|
|
181
|
+
* Matches tree-selector.ts logic exactly.
|
|
182
|
+
*/
|
|
183
|
+
function flattenTree(roots, activePathIds) {
|
|
184
|
+
const result = [];
|
|
185
|
+
const multipleRoots = roots.length > 1;
|
|
186
|
+
|
|
187
|
+
// Mark which subtrees contain the active leaf
|
|
188
|
+
const containsActive = new Map();
|
|
189
|
+
function markActive(node) {
|
|
190
|
+
let has = activePathIds.has(node.entry.id);
|
|
191
|
+
for (const child of node.children) {
|
|
192
|
+
if (markActive(child)) has = true;
|
|
193
|
+
}
|
|
194
|
+
containsActive.set(node, has);
|
|
195
|
+
return has;
|
|
196
|
+
}
|
|
197
|
+
roots.forEach(markActive);
|
|
198
|
+
|
|
199
|
+
// Stack: [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]
|
|
200
|
+
const stack = [];
|
|
201
|
+
|
|
202
|
+
// Add roots (prioritize branch containing active leaf)
|
|
203
|
+
const orderedRoots = [...roots].sort((a, b) =>
|
|
204
|
+
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
205
|
+
);
|
|
206
|
+
for (let i = orderedRoots.length - 1; i >= 0; i--) {
|
|
207
|
+
const isLast = i === orderedRoots.length - 1;
|
|
208
|
+
stack.push([orderedRoots[i], multipleRoots ? 1 : 0, multipleRoots, multipleRoots, isLast, [], multipleRoots]);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
while (stack.length > 0) {
|
|
212
|
+
const [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop();
|
|
213
|
+
|
|
214
|
+
result.push({ node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots });
|
|
215
|
+
|
|
216
|
+
const children = node.children;
|
|
217
|
+
const multipleChildren = children.length > 1;
|
|
218
|
+
|
|
219
|
+
// Order children (active branch first)
|
|
220
|
+
const orderedChildren = [...children].sort((a, b) =>
|
|
221
|
+
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
// Calculate child indent (matches tree-selector.ts)
|
|
225
|
+
let childIndent;
|
|
226
|
+
if (multipleChildren) {
|
|
227
|
+
// Parent branches: children get +1
|
|
228
|
+
childIndent = indent + 1;
|
|
229
|
+
} else if (justBranched && indent > 0) {
|
|
230
|
+
// First generation after a branch: +1 for visual grouping
|
|
231
|
+
childIndent = indent + 1;
|
|
232
|
+
} else {
|
|
233
|
+
// Single-child chain: stay flat
|
|
234
|
+
childIndent = indent;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Build gutters for children
|
|
238
|
+
const connectorDisplayed = showConnector && !isVirtualRootChild;
|
|
239
|
+
const currentDisplayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
240
|
+
const connectorPosition = Math.max(0, currentDisplayIndent - 1);
|
|
241
|
+
const childGutters = connectorDisplayed
|
|
242
|
+
? [...gutters, { position: connectorPosition, show: !isLast }]
|
|
243
|
+
: gutters;
|
|
244
|
+
|
|
245
|
+
// Add children in reverse order for stack
|
|
246
|
+
for (let i = orderedChildren.length - 1; i >= 0; i--) {
|
|
247
|
+
const childIsLast = i === orderedChildren.length - 1;
|
|
248
|
+
stack.push([orderedChildren[i], childIndent, multipleChildren, multipleChildren, childIsLast, childGutters, false]);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Build ASCII prefix string for tree node.
|
|
257
|
+
*/
|
|
258
|
+
function buildTreePrefix(flatNode) {
|
|
259
|
+
const { indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots } = flatNode;
|
|
260
|
+
const displayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
261
|
+
const connector = showConnector && !isVirtualRootChild ? (isLast ? '└─ ' : '├─ ') : '';
|
|
262
|
+
const connectorPosition = connector ? displayIndent - 1 : -1;
|
|
263
|
+
|
|
264
|
+
const totalChars = displayIndent * 3;
|
|
265
|
+
const prefixChars = [];
|
|
266
|
+
for (let i = 0; i < totalChars; i++) {
|
|
267
|
+
const level = Math.floor(i / 3);
|
|
268
|
+
const posInLevel = i % 3;
|
|
269
|
+
|
|
270
|
+
const gutter = gutters.find(g => g.position === level);
|
|
271
|
+
if (gutter) {
|
|
272
|
+
prefixChars.push(posInLevel === 0 ? (gutter.show ? '│' : ' ') : ' ');
|
|
273
|
+
} else if (connector && level === connectorPosition) {
|
|
274
|
+
if (posInLevel === 0) {
|
|
275
|
+
prefixChars.push(isLast ? '└' : '├');
|
|
276
|
+
} else if (posInLevel === 1) {
|
|
277
|
+
prefixChars.push('─');
|
|
278
|
+
} else {
|
|
279
|
+
prefixChars.push(' ');
|
|
280
|
+
}
|
|
281
|
+
} else {
|
|
282
|
+
prefixChars.push(' ');
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return prefixChars.join('');
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ============================================================
|
|
289
|
+
// FILTERING (pure data)
|
|
290
|
+
// ============================================================
|
|
291
|
+
|
|
292
|
+
let filterMode = 'default';
|
|
293
|
+
let searchQuery = '';
|
|
294
|
+
|
|
295
|
+
function hasTextContent(content) {
|
|
296
|
+
if (typeof content === 'string') return content.trim().length > 0;
|
|
297
|
+
if (Array.isArray(content)) {
|
|
298
|
+
for (const c of content) {
|
|
299
|
+
if (c.type === 'text' && c.text && c.text.trim().length > 0) return true;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function extractContent(content) {
|
|
306
|
+
if (typeof content === 'string') return content;
|
|
307
|
+
if (Array.isArray(content)) {
|
|
308
|
+
return content
|
|
309
|
+
.filter(c => c.type === 'text' && c.text)
|
|
310
|
+
.map(c => c.text)
|
|
311
|
+
.join('');
|
|
312
|
+
}
|
|
313
|
+
return '';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Parse a skill block from message text.
|
|
318
|
+
* Returns null if the text doesn't contain a skill block.
|
|
319
|
+
* Matches the format: <skill name="..." location="...">\n...\n</skill>\n\nuser message
|
|
320
|
+
*/
|
|
321
|
+
function parseSkillBlock(text) {
|
|
322
|
+
const match = text.match(/^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/);
|
|
323
|
+
if (!match) return null;
|
|
324
|
+
return {
|
|
325
|
+
name: match[1],
|
|
326
|
+
location: match[2],
|
|
327
|
+
content: match[3],
|
|
328
|
+
userMessage: match[4]?.trim() || undefined,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function getSearchableText(entry, label) {
|
|
333
|
+
const parts = [];
|
|
334
|
+
if (label) parts.push(label);
|
|
335
|
+
|
|
336
|
+
switch (entry.type) {
|
|
337
|
+
case 'message': {
|
|
338
|
+
const msg = entry.message;
|
|
339
|
+
parts.push(msg.role);
|
|
340
|
+
if (msg.content) parts.push(extractContent(msg.content));
|
|
341
|
+
if (msg.role === 'bashExecution' && msg.command) parts.push(msg.command);
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
case 'custom_message':
|
|
345
|
+
parts.push(entry.customType);
|
|
346
|
+
parts.push(typeof entry.content === 'string' ? entry.content : extractContent(entry.content));
|
|
347
|
+
break;
|
|
348
|
+
case 'compaction':
|
|
349
|
+
parts.push('compaction');
|
|
350
|
+
break;
|
|
351
|
+
case 'branch_summary':
|
|
352
|
+
parts.push('branch summary', entry.summary);
|
|
353
|
+
break;
|
|
354
|
+
case 'model_change':
|
|
355
|
+
parts.push('model', entry.modelId);
|
|
356
|
+
break;
|
|
357
|
+
case 'thinking_level_change':
|
|
358
|
+
parts.push('thinking', entry.thinkingLevel);
|
|
359
|
+
break;
|
|
360
|
+
case 'context_edit':
|
|
361
|
+
parts.push('context edit', entry.replacement === null ? 'omit' : 'replace', entry.targetId);
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return parts.join(' ').toLowerCase();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Filter flat nodes based on current filterMode and searchQuery.
|
|
370
|
+
*/
|
|
371
|
+
function filterNodes(flatNodes, currentLeafId) {
|
|
372
|
+
const searchTokens = searchQuery.toLowerCase().split(/\s+/).filter(Boolean);
|
|
373
|
+
|
|
374
|
+
const filtered = flatNodes.filter(flatNode => {
|
|
375
|
+
const entry = flatNode.node.entry;
|
|
376
|
+
const label = flatNode.node.label;
|
|
377
|
+
const isCurrentLeaf = entry.id === currentLeafId;
|
|
378
|
+
|
|
379
|
+
// Always show current leaf
|
|
380
|
+
if (isCurrentLeaf) return true;
|
|
381
|
+
|
|
382
|
+
// Hide assistant messages with only tool calls (no text) unless error/aborted
|
|
383
|
+
if (entry.type === 'message' && entry.message.role === 'assistant') {
|
|
384
|
+
const msg = entry.message;
|
|
385
|
+
const hasText = hasTextContent(msg.content);
|
|
386
|
+
const isErrorOrAborted = msg.stopReason && msg.stopReason !== 'stop' && msg.stopReason !== 'toolUse';
|
|
387
|
+
if (!hasText && !isErrorOrAborted) return false;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Apply filter mode
|
|
391
|
+
const isSettingsEntry = ['label', 'custom', 'context_edit', 'model_change', 'thinking_level_change'].includes(entry.type);
|
|
392
|
+
let passesFilter = true;
|
|
393
|
+
|
|
394
|
+
switch (filterMode) {
|
|
395
|
+
case 'user-only':
|
|
396
|
+
passesFilter = entry.type === 'message' && entry.message.role === 'user';
|
|
397
|
+
break;
|
|
398
|
+
case 'no-tools':
|
|
399
|
+
passesFilter = !isSettingsEntry && !(entry.type === 'message' && entry.message.role === 'toolResult');
|
|
400
|
+
break;
|
|
401
|
+
case 'labeled-only':
|
|
402
|
+
passesFilter = label !== undefined;
|
|
403
|
+
break;
|
|
404
|
+
case 'all':
|
|
405
|
+
passesFilter = true;
|
|
406
|
+
break;
|
|
407
|
+
default: // 'default'
|
|
408
|
+
passesFilter = !isSettingsEntry;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
if (!passesFilter) return false;
|
|
413
|
+
|
|
414
|
+
// Apply search filter
|
|
415
|
+
if (searchTokens.length > 0) {
|
|
416
|
+
const nodeText = getSearchableText(entry, label);
|
|
417
|
+
if (!searchTokens.every(t => nodeText.includes(t))) return false;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return true;
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// Recalculate visual structure based on visible tree
|
|
424
|
+
recalculateVisualStructure(filtered, flatNodes);
|
|
425
|
+
|
|
426
|
+
return filtered;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Recompute indentation/connectors for the filtered view
|
|
431
|
+
*
|
|
432
|
+
* Filtering can hide intermediate entries; descendants attach to the nearest visible ancestor.
|
|
433
|
+
* Keep indentation semantics aligned with flattenTree() so single-child chains don't drift right.
|
|
434
|
+
*/
|
|
435
|
+
function recalculateVisualStructure(filteredNodes, allFlatNodes) {
|
|
436
|
+
if (filteredNodes.length === 0) return;
|
|
437
|
+
|
|
438
|
+
const visibleIds = new Set(filteredNodes.map(n => n.node.entry.id));
|
|
439
|
+
|
|
440
|
+
// Build entry map for parent lookup (using full tree)
|
|
441
|
+
const entryMap = new Map();
|
|
442
|
+
for (const flatNode of allFlatNodes) {
|
|
443
|
+
entryMap.set(flatNode.node.entry.id, flatNode);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Find nearest visible ancestor for a node
|
|
447
|
+
function findVisibleAncestor(nodeId) {
|
|
448
|
+
let currentId = entryMap.get(nodeId)?.node.entry.parentId;
|
|
449
|
+
while (currentId != null) {
|
|
450
|
+
if (visibleIds.has(currentId)) {
|
|
451
|
+
return currentId;
|
|
452
|
+
}
|
|
453
|
+
currentId = entryMap.get(currentId)?.node.entry.parentId;
|
|
454
|
+
}
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Build visible tree structure
|
|
459
|
+
const visibleParent = new Map();
|
|
460
|
+
const visibleChildren = new Map();
|
|
461
|
+
visibleChildren.set(null, []); // root-level nodes
|
|
462
|
+
|
|
463
|
+
for (const flatNode of filteredNodes) {
|
|
464
|
+
const nodeId = flatNode.node.entry.id;
|
|
465
|
+
const ancestorId = findVisibleAncestor(nodeId);
|
|
466
|
+
visibleParent.set(nodeId, ancestorId);
|
|
467
|
+
|
|
468
|
+
if (!visibleChildren.has(ancestorId)) {
|
|
469
|
+
visibleChildren.set(ancestorId, []);
|
|
470
|
+
}
|
|
471
|
+
visibleChildren.get(ancestorId).push(nodeId);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Update multipleRoots based on visible roots
|
|
475
|
+
const visibleRootIds = visibleChildren.get(null);
|
|
476
|
+
const multipleRoots = visibleRootIds.length > 1;
|
|
477
|
+
|
|
478
|
+
// Build a map for quick lookup: nodeId → FlatNode
|
|
479
|
+
const filteredNodeMap = new Map();
|
|
480
|
+
for (const flatNode of filteredNodes) {
|
|
481
|
+
filteredNodeMap.set(flatNode.node.entry.id, flatNode);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// DFS traversal of visible tree, applying same indentation rules as flattenTree()
|
|
485
|
+
// Stack items: [nodeId, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]
|
|
486
|
+
const stack = [];
|
|
487
|
+
|
|
488
|
+
// Add visible roots in reverse order (to process in forward order via stack)
|
|
489
|
+
for (let i = visibleRootIds.length - 1; i >= 0; i--) {
|
|
490
|
+
const isLast = i === visibleRootIds.length - 1;
|
|
491
|
+
stack.push([
|
|
492
|
+
visibleRootIds[i],
|
|
493
|
+
multipleRoots ? 1 : 0,
|
|
494
|
+
multipleRoots,
|
|
495
|
+
multipleRoots,
|
|
496
|
+
isLast,
|
|
497
|
+
[],
|
|
498
|
+
multipleRoots
|
|
499
|
+
]);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
while (stack.length > 0) {
|
|
503
|
+
const [nodeId, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop();
|
|
504
|
+
|
|
505
|
+
const flatNode = filteredNodeMap.get(nodeId);
|
|
506
|
+
if (!flatNode) continue;
|
|
507
|
+
|
|
508
|
+
// Update this node's visual properties
|
|
509
|
+
flatNode.indent = indent;
|
|
510
|
+
flatNode.showConnector = showConnector;
|
|
511
|
+
flatNode.isLast = isLast;
|
|
512
|
+
flatNode.gutters = gutters;
|
|
513
|
+
flatNode.isVirtualRootChild = isVirtualRootChild;
|
|
514
|
+
flatNode.multipleRoots = multipleRoots;
|
|
515
|
+
|
|
516
|
+
// Get visible children of this node
|
|
517
|
+
const children = visibleChildren.get(nodeId) || [];
|
|
518
|
+
const multipleChildren = children.length > 1;
|
|
519
|
+
|
|
520
|
+
// Calculate child indent using same rules as flattenTree():
|
|
521
|
+
// - Parent branches (multiple children): children get +1
|
|
522
|
+
// - Just branched and indent > 0: children get +1 for visual grouping
|
|
523
|
+
// - Single-child chain: stay flat
|
|
524
|
+
let childIndent;
|
|
525
|
+
if (multipleChildren) {
|
|
526
|
+
childIndent = indent + 1;
|
|
527
|
+
} else if (justBranched && indent > 0) {
|
|
528
|
+
childIndent = indent + 1;
|
|
529
|
+
} else {
|
|
530
|
+
childIndent = indent;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Build gutters for children (same logic as flattenTree)
|
|
534
|
+
const connectorDisplayed = showConnector && !isVirtualRootChild;
|
|
535
|
+
const currentDisplayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
536
|
+
const connectorPosition = Math.max(0, currentDisplayIndent - 1);
|
|
537
|
+
const childGutters = connectorDisplayed
|
|
538
|
+
? [...gutters, { position: connectorPosition, show: !isLast }]
|
|
539
|
+
: gutters;
|
|
540
|
+
|
|
541
|
+
// Add children in reverse order (to process in forward order via stack)
|
|
542
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
543
|
+
const childIsLast = i === children.length - 1;
|
|
544
|
+
stack.push([
|
|
545
|
+
children[i],
|
|
546
|
+
childIndent,
|
|
547
|
+
multipleChildren,
|
|
548
|
+
multipleChildren,
|
|
549
|
+
childIsLast,
|
|
550
|
+
childGutters,
|
|
551
|
+
false
|
|
552
|
+
]);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// ============================================================
|
|
558
|
+
// TREE DISPLAY TEXT (pure data -> string)
|
|
559
|
+
// ============================================================
|
|
560
|
+
|
|
561
|
+
function shortenPath(p) {
|
|
562
|
+
if (typeof p !== 'string') return '';
|
|
563
|
+
if (p.startsWith('/Users/')) {
|
|
564
|
+
const parts = p.split('/');
|
|
565
|
+
if (parts.length > 2) return '~' + p.slice(('/Users/' + parts[2]).length);
|
|
566
|
+
}
|
|
567
|
+
if (p.startsWith('/home/')) {
|
|
568
|
+
const parts = p.split('/');
|
|
569
|
+
if (parts.length > 2) return '~' + p.slice(('/home/' + parts[2]).length);
|
|
570
|
+
}
|
|
571
|
+
return p;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function formatToolCall(name, args) {
|
|
575
|
+
switch (name) {
|
|
576
|
+
case 'read': {
|
|
577
|
+
const path = shortenPath(String(args.path || args.file_path || ''));
|
|
578
|
+
return `[read: ${path}${formatReadLineRange(args.offset, args.limit)}]`;
|
|
579
|
+
}
|
|
580
|
+
case 'write':
|
|
581
|
+
return `[write: ${shortenPath(String(args.path || args.file_path || ''))}]`;
|
|
582
|
+
case 'edit':
|
|
583
|
+
return `[edit: ${shortenPath(String(args.path || args.file_path || ''))}]`;
|
|
584
|
+
case 'bash': {
|
|
585
|
+
const rawCmd = String(args.command || '');
|
|
586
|
+
const cmd = rawCmd.replace(/[\n\t]/g, ' ').trim().slice(0, 50);
|
|
587
|
+
return `[bash: ${cmd}${rawCmd.length > 50 ? '...' : ''}]`;
|
|
588
|
+
}
|
|
589
|
+
case 'grep':
|
|
590
|
+
return `[grep: /${args.pattern || ''}/ in ${shortenPath(String(args.path || '.'))}]`;
|
|
591
|
+
case 'find':
|
|
592
|
+
return `[find: ${args.pattern || ''} in ${shortenPath(String(args.path || '.'))}]`;
|
|
593
|
+
case 'ls':
|
|
594
|
+
return `[ls: ${shortenPath(String(args.path || '.'))}]`;
|
|
595
|
+
default: {
|
|
596
|
+
const argsStr = JSON.stringify(args).slice(0, 40);
|
|
597
|
+
return `[${name}: ${argsStr}${JSON.stringify(args).length > 40 ? '...' : ''}]`;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function escapeHtml(text) {
|
|
603
|
+
return String(text)
|
|
604
|
+
.replace(/&/g, '&')
|
|
605
|
+
.replace(/</g, '<')
|
|
606
|
+
.replace(/>/g, '>')
|
|
607
|
+
.replace(/"/g, '"')
|
|
608
|
+
.replace(/'/g, ''');
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
function sanitizeMarkdownUrl(value) {
|
|
612
|
+
const href = String(value || '').trim().replace(/[\x00-\x1f\x7f]/g, '');
|
|
613
|
+
if (!href) return href;
|
|
614
|
+
|
|
615
|
+
const scheme = href.match(/^([A-Za-z][A-Za-z0-9+.-]*):/);
|
|
616
|
+
if (scheme && !/^(https?|mailto|tel|ftp)$/i.test(scheme[1])) {
|
|
617
|
+
return null;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
return href;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Truncate string to maxLen chars, append "..." if truncated.
|
|
625
|
+
*/
|
|
626
|
+
function truncate(s, maxLen = 100) {
|
|
627
|
+
if (s.length <= maxLen) return s;
|
|
628
|
+
return s.slice(0, maxLen) + '...';
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Get display text for tree node (returns HTML string).
|
|
633
|
+
*/
|
|
634
|
+
function getTreeNodeDisplayHtml(entry, label) {
|
|
635
|
+
const normalize = s => s.replace(/[\n\t]/g, ' ').trim();
|
|
636
|
+
const labelHtml = label ? `<span class="tree-label">[${escapeHtml(label)}]</span> ` : '';
|
|
637
|
+
|
|
638
|
+
switch (entry.type) {
|
|
639
|
+
case 'message': {
|
|
640
|
+
const msg = entry.message;
|
|
641
|
+
if (msg.role === 'user') {
|
|
642
|
+
const rawContent = extractContent(msg.content);
|
|
643
|
+
const skillBlock = parseSkillBlock(rawContent);
|
|
644
|
+
if (skillBlock) {
|
|
645
|
+
let treeHtml = labelHtml + `<span class="tree-role-skill">skill:</span> ${escapeHtml(skillBlock.name)}`;
|
|
646
|
+
if (skillBlock.userMessage) {
|
|
647
|
+
treeHtml += ` · <span class="tree-role-user">user:</span> ${escapeHtml(truncate(normalize(skillBlock.userMessage)))}`;
|
|
648
|
+
}
|
|
649
|
+
return treeHtml;
|
|
650
|
+
}
|
|
651
|
+
const content = truncate(normalize(rawContent));
|
|
652
|
+
return labelHtml + `<span class="tree-role-user">user:</span> ${escapeHtml(content)}`;
|
|
653
|
+
}
|
|
654
|
+
if (msg.role === 'assistant') {
|
|
655
|
+
const textContent = truncate(normalize(extractContent(msg.content)));
|
|
656
|
+
if (textContent) {
|
|
657
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> ${escapeHtml(textContent)}`;
|
|
658
|
+
}
|
|
659
|
+
if (msg.stopReason === 'aborted') {
|
|
660
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-muted">(aborted)</span>`;
|
|
661
|
+
}
|
|
662
|
+
if (msg.errorMessage) {
|
|
663
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-error">${escapeHtml(truncate(msg.errorMessage))}</span>`;
|
|
664
|
+
}
|
|
665
|
+
return labelHtml + `<span class="tree-role-assistant">assistant:</span> <span class="tree-muted">(no text)</span>`;
|
|
666
|
+
}
|
|
667
|
+
if (msg.role === 'toolResult') {
|
|
668
|
+
const toolCall = msg.toolCallId ? toolCallMap.get(msg.toolCallId) : null;
|
|
669
|
+
if (toolCall) {
|
|
670
|
+
return labelHtml + `<span class="tree-role-tool">${escapeHtml(formatToolCall(toolCall.name, toolCall.arguments))}</span>`;
|
|
671
|
+
}
|
|
672
|
+
return labelHtml + `<span class="tree-role-tool">[${escapeHtml(msg.toolName || 'tool')}]</span>`;
|
|
673
|
+
}
|
|
674
|
+
if (msg.role === 'bashExecution') {
|
|
675
|
+
const cmd = truncate(normalize(msg.command || ''));
|
|
676
|
+
return labelHtml + `<span class="tree-role-tool">[bash]:</span> ${escapeHtml(cmd)}`;
|
|
677
|
+
}
|
|
678
|
+
return labelHtml + `<span class="tree-muted">[${escapeHtml(msg.role)}]</span>`;
|
|
679
|
+
}
|
|
680
|
+
case 'compaction':
|
|
681
|
+
return labelHtml + `<span class="tree-compaction">[compaction: ${Math.round(entry.tokensBefore/1000)}k tokens]</span>`;
|
|
682
|
+
case 'branch_summary': {
|
|
683
|
+
const summary = truncate(normalize(entry.summary || ''));
|
|
684
|
+
return labelHtml + `<span class="tree-branch-summary">[branch summary]:</span> ${escapeHtml(summary)}`;
|
|
685
|
+
}
|
|
686
|
+
case 'custom_message': {
|
|
687
|
+
const content = typeof entry.content === 'string' ? entry.content : extractContent(entry.content);
|
|
688
|
+
return labelHtml + `<span class="tree-custom">[${escapeHtml(entry.customType)}]:</span> ${escapeHtml(truncate(normalize(content)))}`;
|
|
689
|
+
}
|
|
690
|
+
case 'model_change':
|
|
691
|
+
return labelHtml + `<span class="tree-muted">[model: ${escapeHtml(entry.modelId)}]</span>`;
|
|
692
|
+
case 'thinking_level_change':
|
|
693
|
+
return labelHtml + `<span class="tree-muted">[thinking: ${escapeHtml(entry.thinkingLevel)}]</span>`;
|
|
694
|
+
case 'context_edit':
|
|
695
|
+
return labelHtml + `<span class="tree-muted">[context ${entry.replacement === null ? 'omit' : 'replace'}: ${escapeHtml(entry.targetId)}]</span>`;
|
|
696
|
+
default:
|
|
697
|
+
return labelHtml + `<span class="tree-muted">[${escapeHtml(entry.type)}]</span>`;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// ============================================================
|
|
702
|
+
// TREE RENDERING (DOM manipulation)
|
|
703
|
+
// ============================================================
|
|
704
|
+
|
|
705
|
+
let currentLeafId = leafId;
|
|
706
|
+
let currentTargetId = urlTargetId || leafId;
|
|
707
|
+
let treeRendered = false;
|
|
708
|
+
|
|
709
|
+
function renderTree() {
|
|
710
|
+
const tree = buildTree();
|
|
711
|
+
const activePathIds = buildActivePathIds(currentLeafId);
|
|
712
|
+
const flatNodes = flattenTree(tree, activePathIds);
|
|
713
|
+
const filtered = filterNodes(flatNodes, currentLeafId);
|
|
714
|
+
const container = document.getElementById('tree-container');
|
|
715
|
+
|
|
716
|
+
// Full render only on first call or when filter/search changes
|
|
717
|
+
if (!treeRendered) {
|
|
718
|
+
container.innerHTML = '';
|
|
719
|
+
|
|
720
|
+
for (const flatNode of filtered) {
|
|
721
|
+
const entry = flatNode.node.entry;
|
|
722
|
+
const isOnPath = activePathIds.has(entry.id);
|
|
723
|
+
const isTarget = entry.id === currentTargetId;
|
|
724
|
+
|
|
725
|
+
const div = document.createElement('div');
|
|
726
|
+
div.className = 'tree-node';
|
|
727
|
+
if (isOnPath) div.classList.add('in-path');
|
|
728
|
+
if (isTarget) div.classList.add('active');
|
|
729
|
+
div.dataset.id = entry.id;
|
|
730
|
+
|
|
731
|
+
const prefix = buildTreePrefix(flatNode);
|
|
732
|
+
const prefixSpan = document.createElement('span');
|
|
733
|
+
prefixSpan.className = 'tree-prefix';
|
|
734
|
+
prefixSpan.textContent = prefix;
|
|
735
|
+
|
|
736
|
+
const marker = document.createElement('span');
|
|
737
|
+
marker.className = 'tree-marker';
|
|
738
|
+
marker.textContent = isOnPath ? '•' : ' ';
|
|
739
|
+
|
|
740
|
+
const content = document.createElement('span');
|
|
741
|
+
content.className = 'tree-content';
|
|
742
|
+
content.innerHTML = getTreeNodeDisplayHtml(entry, flatNode.node.label);
|
|
743
|
+
|
|
744
|
+
div.appendChild(prefixSpan);
|
|
745
|
+
div.appendChild(marker);
|
|
746
|
+
div.appendChild(content);
|
|
747
|
+
// Navigate to the newest leaf through this node, but scroll to the clicked node
|
|
748
|
+
div.addEventListener('click', () => {
|
|
749
|
+
if (window.getSelection().toString()) return;
|
|
750
|
+
const leafId = findNewestLeaf(entry.id);
|
|
751
|
+
navigateTo(leafId, 'target', entry.id);
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
container.appendChild(div);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
treeRendered = true;
|
|
758
|
+
} else {
|
|
759
|
+
// Just update markers and classes
|
|
760
|
+
const nodes = container.querySelectorAll('.tree-node');
|
|
761
|
+
for (const node of nodes) {
|
|
762
|
+
const id = node.dataset.id;
|
|
763
|
+
const isOnPath = activePathIds.has(id);
|
|
764
|
+
const isTarget = id === currentTargetId;
|
|
765
|
+
|
|
766
|
+
node.classList.toggle('in-path', isOnPath);
|
|
767
|
+
node.classList.toggle('active', isTarget);
|
|
768
|
+
|
|
769
|
+
const marker = node.querySelector('.tree-marker');
|
|
770
|
+
if (marker) {
|
|
771
|
+
marker.textContent = isOnPath ? '•' : ' ';
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
document.getElementById('tree-status').textContent = `${filtered.length} / ${flatNodes.length} entries`;
|
|
777
|
+
|
|
778
|
+
// Scroll active node into view after layout
|
|
779
|
+
setTimeout(() => {
|
|
780
|
+
const activeNode = container.querySelector('.tree-node.active');
|
|
781
|
+
if (activeNode) {
|
|
782
|
+
activeNode.scrollIntoView({ block: 'nearest' });
|
|
783
|
+
}
|
|
784
|
+
}, 0);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function forceTreeRerender() {
|
|
788
|
+
treeRendered = false;
|
|
789
|
+
renderTree();
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// ============================================================
|
|
793
|
+
// MESSAGE RENDERING
|
|
794
|
+
// ============================================================
|
|
795
|
+
|
|
796
|
+
function formatTokens(count) {
|
|
797
|
+
if (count < 1000) return count.toString();
|
|
798
|
+
if (count < 10000) return (count / 1000).toFixed(1) + 'k';
|
|
799
|
+
if (count < 1000000) return Math.round(count / 1000) + 'k';
|
|
800
|
+
return (count / 1000000).toFixed(1) + 'M';
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function formatTimestamp(ts) {
|
|
804
|
+
if (!ts) return '';
|
|
805
|
+
const date = new Date(ts);
|
|
806
|
+
return date.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
function replaceTabs(text) {
|
|
810
|
+
return text.replace(/\t/g, ' ');
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/** Safely coerce value to string for display. Returns null if invalid type. */
|
|
814
|
+
function str(value) {
|
|
815
|
+
if (typeof value === 'string') return value;
|
|
816
|
+
if (value == null) return '';
|
|
817
|
+
return null;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// Mirrors ../tools/render-utils.ts.
|
|
821
|
+
function parseLineNumber(value) {
|
|
822
|
+
if (typeof value === 'string' && value.trim() !== '') value = Number(value);
|
|
823
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function formatReadLineRange(offset, limit) {
|
|
827
|
+
if (offset == null && limit == null) return '';
|
|
828
|
+
const start = offset == null ? 1 : parseLineNumber(offset);
|
|
829
|
+
if (start === undefined) return '';
|
|
830
|
+
if (limit == null) return `:${start}`;
|
|
831
|
+
const count = parseLineNumber(limit);
|
|
832
|
+
if (count === undefined) return '';
|
|
833
|
+
const end = start + count - 1;
|
|
834
|
+
return `:${start}${end ? `-${end}` : ''}`;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
function getLanguageFromPath(filePath) {
|
|
838
|
+
const ext = filePath.split('.').pop()?.toLowerCase();
|
|
839
|
+
const extToLang = {
|
|
840
|
+
ts: 'typescript', tsx: 'typescript', js: 'javascript', jsx: 'javascript',
|
|
841
|
+
py: 'python', rb: 'ruby', rs: 'rust', go: 'go', java: 'java',
|
|
842
|
+
c: 'c', cpp: 'cpp', h: 'c', hpp: 'cpp', cs: 'csharp',
|
|
843
|
+
php: 'php', sh: 'bash', bash: 'bash', zsh: 'bash',
|
|
844
|
+
sql: 'sql', html: 'html', css: 'css', scss: 'scss',
|
|
845
|
+
json: 'json', yaml: 'yaml', yml: 'yaml', xml: 'xml',
|
|
846
|
+
md: 'markdown', dockerfile: 'dockerfile'
|
|
847
|
+
};
|
|
848
|
+
return extToLang[ext];
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function findToolResult(toolCallId) {
|
|
852
|
+
for (const entry of entries) {
|
|
853
|
+
if (entry.type === 'message' && entry.message.role === 'toolResult') {
|
|
854
|
+
if (entry.message.toolCallId === toolCallId) {
|
|
855
|
+
return entry.message;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
return null;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
function formatExpandableOutput(text, maxLines, lang) {
|
|
863
|
+
text = replaceTabs(text);
|
|
864
|
+
const lines = text.split('\n');
|
|
865
|
+
const displayLines = lines.slice(0, maxLines);
|
|
866
|
+
const remaining = lines.length - maxLines;
|
|
867
|
+
|
|
868
|
+
if (lang) {
|
|
869
|
+
let highlighted;
|
|
870
|
+
try {
|
|
871
|
+
highlighted = hljs.highlight(text, { language: lang }).value;
|
|
872
|
+
} catch {
|
|
873
|
+
highlighted = escapeHtml(text);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
if (remaining > 0) {
|
|
877
|
+
const previewCode = displayLines.join('\n');
|
|
878
|
+
let previewHighlighted;
|
|
879
|
+
try {
|
|
880
|
+
previewHighlighted = hljs.highlight(previewCode, { language: lang }).value;
|
|
881
|
+
} catch {
|
|
882
|
+
previewHighlighted = escapeHtml(previewCode);
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
return `<div class="tool-output expandable" onclick="if(window.getSelection().toString())return;this.classList.toggle('expanded')">
|
|
886
|
+
<div class="output-preview"><pre><code class="hljs">${previewHighlighted}</code></pre>
|
|
887
|
+
<div class="expand-hint">... (${remaining} more lines)</div></div>
|
|
888
|
+
<div class="output-full"><pre><code class="hljs">${highlighted}</code></pre></div></div>`;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
return `<div class="tool-output"><pre><code class="hljs">${highlighted}</code></pre></div>`;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
// Plain text output
|
|
895
|
+
if (remaining > 0) {
|
|
896
|
+
let out = '<div class="tool-output expandable" onclick="if(window.getSelection().toString())return;this.classList.toggle(\'expanded\')">';
|
|
897
|
+
out += '<div class="output-preview">';
|
|
898
|
+
for (const line of displayLines) {
|
|
899
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
900
|
+
}
|
|
901
|
+
out += `<div class="expand-hint">... (${remaining} more lines)</div></div>`;
|
|
902
|
+
out += '<div class="output-full">';
|
|
903
|
+
for (const line of lines) {
|
|
904
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
905
|
+
}
|
|
906
|
+
out += '</div></div>';
|
|
907
|
+
return out;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
let out = '<div class="tool-output">';
|
|
911
|
+
for (const line of displayLines) {
|
|
912
|
+
out += `<div>${escapeHtml(replaceTabs(line))}</div>`;
|
|
913
|
+
}
|
|
914
|
+
out += '</div>';
|
|
915
|
+
return out;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
function renderToolCall(call) {
|
|
919
|
+
const result = findToolResult(call.id);
|
|
920
|
+
const isError = result?.isError || false;
|
|
921
|
+
const statusClass = result ? (isError ? 'error' : 'success') : 'pending';
|
|
922
|
+
|
|
923
|
+
const getResultText = () => {
|
|
924
|
+
if (!result) return '';
|
|
925
|
+
const textBlocks = result.content.filter(c => c.type === 'text');
|
|
926
|
+
return textBlocks.map(c => c.text).join('\n');
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
const getResultImages = () => {
|
|
930
|
+
if (!result) return [];
|
|
931
|
+
return result.content.filter(c => c.type === 'image');
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
const renderResultImages = () => {
|
|
935
|
+
const images = getResultImages();
|
|
936
|
+
if (images.length === 0) return '';
|
|
937
|
+
return '<div class="tool-images">' +
|
|
938
|
+
images.map(img => `<img src="data:${escapeHtml(img.mimeType || 'image/png')};base64,${escapeHtml(img.data || '')}" class="tool-image" />`).join('') +
|
|
939
|
+
'</div>';
|
|
940
|
+
};
|
|
941
|
+
|
|
942
|
+
// Calls this tool made to other tools (for example from a codemode script), recorded without results.
|
|
943
|
+
const renderNestedCalls = () => {
|
|
944
|
+
const nested = result?.nestedCalls;
|
|
945
|
+
if (!nested || !Array.isArray(nested.calls) || nested.calls.length === 0) return '';
|
|
946
|
+
const icons = { ok: '✓', error: '✗', unfinished: '…' };
|
|
947
|
+
const lines = nested.calls.map(c => {
|
|
948
|
+
const args = c.arguments ? JSON.stringify(c.arguments) : `[arguments omitted, ${c.argumentsBytes} bytes]`;
|
|
949
|
+
const duration = c.durationMs !== undefined ? ` ${c.durationMs}ms` : '';
|
|
950
|
+
const error = c.error ? `\n ${c.error.split('\n').join('\n ')}` : '';
|
|
951
|
+
return `${icons[c.status] || '?'} ${c.name} ${args}${duration}${error}`;
|
|
952
|
+
});
|
|
953
|
+
const title = `Nested calls: ${nested.calls.length}${nested.complete ? '' : ' (incomplete record)'}`;
|
|
954
|
+
return formatExpandableOutput([title, ...lines].join('\n'), 1);
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
const toolDomId = `tool-call-${escapeHtml(call.id)}`;
|
|
958
|
+
let html = `<div class="tool-execution ${statusClass}" id="${toolDomId}">`;
|
|
959
|
+
const args = call.arguments || {};
|
|
960
|
+
const name = call.name;
|
|
961
|
+
|
|
962
|
+
const invalidArg = '<span class="tool-error">[invalid arg]</span>';
|
|
963
|
+
|
|
964
|
+
switch (name) {
|
|
965
|
+
case 'bash': {
|
|
966
|
+
const command = str(args.command);
|
|
967
|
+
const cmdDisplay = command === null ? invalidArg : escapeHtml(command || '...');
|
|
968
|
+
html += `<div class="tool-command">$ ${cmdDisplay}</div>`;
|
|
969
|
+
if (result) {
|
|
970
|
+
const output = getResultText().trim();
|
|
971
|
+
if (output) html += formatExpandableOutput(output, 5);
|
|
972
|
+
}
|
|
973
|
+
break;
|
|
974
|
+
}
|
|
975
|
+
case 'read': {
|
|
976
|
+
const filePath = str(args.file_path ?? args.path);
|
|
977
|
+
const readLineRange = formatReadLineRange(args.offset, args.limit);
|
|
978
|
+
let pathHtml = filePath === null ? invalidArg : escapeHtml(shortenPath(filePath || ''));
|
|
979
|
+
if (filePath !== null && readLineRange) {
|
|
980
|
+
pathHtml += `<span class="line-numbers">${escapeHtml(readLineRange)}</span>`;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
html += `<div class="tool-header"><span class="tool-name">read</span> <span class="tool-path">${pathHtml}</span></div>`;
|
|
984
|
+
if (result) {
|
|
985
|
+
html += renderResultImages();
|
|
986
|
+
const output = getResultText();
|
|
987
|
+
const lang = filePath ? getLanguageFromPath(filePath) : null;
|
|
988
|
+
if (output) html += formatExpandableOutput(output, 10, lang);
|
|
989
|
+
}
|
|
990
|
+
break;
|
|
991
|
+
}
|
|
992
|
+
case 'write': {
|
|
993
|
+
const filePath = str(args.file_path ?? args.path);
|
|
994
|
+
const content = str(args.content);
|
|
995
|
+
|
|
996
|
+
html += `<div class="tool-header"><span class="tool-name">write</span> <span class="tool-path">${filePath === null ? invalidArg : escapeHtml(shortenPath(filePath || ''))}</span>`;
|
|
997
|
+
if (content !== null && content) {
|
|
998
|
+
const lines = content.split('\n');
|
|
999
|
+
if (lines.length > 10) html += ` <span class="line-count">(${lines.length} lines)</span>`;
|
|
1000
|
+
}
|
|
1001
|
+
html += '</div>';
|
|
1002
|
+
|
|
1003
|
+
if (content === null) {
|
|
1004
|
+
html += `<div class="tool-error">[invalid content arg - expected string]</div>`;
|
|
1005
|
+
} else if (content) {
|
|
1006
|
+
const lang = filePath ? getLanguageFromPath(filePath) : null;
|
|
1007
|
+
html += formatExpandableOutput(content, 10, lang);
|
|
1008
|
+
}
|
|
1009
|
+
if (result) {
|
|
1010
|
+
const output = getResultText().trim();
|
|
1011
|
+
if (output) html += `<div class="tool-output"><div>${escapeHtml(output)}</div></div>`;
|
|
1012
|
+
}
|
|
1013
|
+
break;
|
|
1014
|
+
}
|
|
1015
|
+
case 'edit': {
|
|
1016
|
+
const filePath = str(args.file_path ?? args.path);
|
|
1017
|
+
html += `<div class="tool-header"><span class="tool-name">edit</span> <span class="tool-path">${filePath === null ? invalidArg : escapeHtml(shortenPath(filePath || ''))}</span></div>`;
|
|
1018
|
+
|
|
1019
|
+
if (result?.details?.diff) {
|
|
1020
|
+
const diffLines = result.details.diff.split('\n');
|
|
1021
|
+
html += '<div class="tool-diff">';
|
|
1022
|
+
for (const line of diffLines) {
|
|
1023
|
+
const cls = line.match(/^\+/) ? 'diff-added' : line.match(/^-/) ? 'diff-removed' : 'diff-context';
|
|
1024
|
+
html += `<div class="${cls}">${escapeHtml(replaceTabs(line))}</div>`;
|
|
1025
|
+
}
|
|
1026
|
+
html += '</div>';
|
|
1027
|
+
} else if (result) {
|
|
1028
|
+
const output = getResultText().trim();
|
|
1029
|
+
if (output) html += `<div class="tool-output"><pre>${escapeHtml(output)}</pre></div>`;
|
|
1030
|
+
}
|
|
1031
|
+
break;
|
|
1032
|
+
}
|
|
1033
|
+
case 'ls': {
|
|
1034
|
+
const dirPath = str(args.path);
|
|
1035
|
+
const limit = args.limit;
|
|
1036
|
+
|
|
1037
|
+
let pathHtml = dirPath === null ? invalidArg : escapeHtml(shortenPath(dirPath || '.'));
|
|
1038
|
+
if (limit !== undefined) {
|
|
1039
|
+
pathHtml += ` <span class="line-count">(limit ${escapeHtml(String(limit))})</span>`;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
html += `<div class="tool-header"><span class="tool-name">ls</span> <span class="tool-path">${pathHtml}</span></div>`;
|
|
1043
|
+
if (result) {
|
|
1044
|
+
const output = getResultText().trim();
|
|
1045
|
+
if (output) html += formatExpandableOutput(output, 20);
|
|
1046
|
+
}
|
|
1047
|
+
break;
|
|
1048
|
+
}
|
|
1049
|
+
default: {
|
|
1050
|
+
// Check for pre-rendered custom tool HTML
|
|
1051
|
+
const rendered = renderedTools?.[call.id];
|
|
1052
|
+
if (rendered?.callHtml || rendered?.resultHtmlCollapsed || rendered?.resultHtmlExpanded) {
|
|
1053
|
+
// Custom tool with pre-rendered HTML from TUI renderer
|
|
1054
|
+
if (rendered.callHtml) {
|
|
1055
|
+
html += `<div class="tool-header ansi-rendered">${rendered.callHtml}</div>`;
|
|
1056
|
+
} else {
|
|
1057
|
+
html += `<div class="tool-header"><span class="tool-name">${escapeHtml(name)}</span></div>`;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
if (rendered.resultHtmlCollapsed && rendered.resultHtmlExpanded && rendered.resultHtmlCollapsed !== rendered.resultHtmlExpanded) {
|
|
1061
|
+
// Both collapsed and expanded differ - render expandable section
|
|
1062
|
+
html += `<div class="tool-output expandable ansi-rendered" onclick="if(window.getSelection().toString())return;this.classList.toggle('expanded')">
|
|
1063
|
+
<div class="output-preview">${rendered.resultHtmlCollapsed}</div>
|
|
1064
|
+
<div class="output-full">${rendered.resultHtmlExpanded}</div>
|
|
1065
|
+
</div>`;
|
|
1066
|
+
} else if (rendered.resultHtmlExpanded) {
|
|
1067
|
+
// Only expanded exists (or collapsed is identical) - show directly
|
|
1068
|
+
html += `<div class="tool-output ansi-rendered">${rendered.resultHtmlExpanded}</div>`;
|
|
1069
|
+
} else if (result) {
|
|
1070
|
+
// No pre-rendered result HTML - fallback to JSON
|
|
1071
|
+
const output = getResultText();
|
|
1072
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1073
|
+
}
|
|
1074
|
+
} else {
|
|
1075
|
+
// Fallback to JSON display (existing behavior)
|
|
1076
|
+
html += `<div class="tool-header"><span class="tool-name">${escapeHtml(name)}</span></div>`;
|
|
1077
|
+
html += `<div class="tool-output"><pre>${escapeHtml(JSON.stringify(args, null, 2))}</pre></div>`;
|
|
1078
|
+
if (result) {
|
|
1079
|
+
const output = getResultText();
|
|
1080
|
+
if (output) html += formatExpandableOutput(output, 10);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
html += renderNestedCalls();
|
|
1087
|
+
html += '</div>';
|
|
1088
|
+
return html;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Download the session data as a JSONL file.
|
|
1093
|
+
* Reconstructs the original format: header line + entry lines.
|
|
1094
|
+
*/
|
|
1095
|
+
window.downloadSessionJson = function() {
|
|
1096
|
+
// Build JSONL content: header first, then all entries
|
|
1097
|
+
const lines = [];
|
|
1098
|
+
if (header) {
|
|
1099
|
+
lines.push(JSON.stringify({ type: 'header', ...header }));
|
|
1100
|
+
}
|
|
1101
|
+
for (const entry of entries) {
|
|
1102
|
+
lines.push(JSON.stringify(entry));
|
|
1103
|
+
}
|
|
1104
|
+
const jsonlContent = lines.join('\n');
|
|
1105
|
+
|
|
1106
|
+
// Create download
|
|
1107
|
+
const blob = new Blob([jsonlContent], { type: 'application/x-ndjson' });
|
|
1108
|
+
const url = URL.createObjectURL(blob);
|
|
1109
|
+
const a = document.createElement('a');
|
|
1110
|
+
a.href = url;
|
|
1111
|
+
a.download = `${header?.id || 'session'}.jsonl`;
|
|
1112
|
+
document.body.appendChild(a);
|
|
1113
|
+
a.click();
|
|
1114
|
+
document.body.removeChild(a);
|
|
1115
|
+
URL.revokeObjectURL(url);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Build a shareable URL for a specific message.
|
|
1120
|
+
* URL format: base?gistId&leafId=<leafId>&targetId=<entryId>
|
|
1121
|
+
*/
|
|
1122
|
+
function buildShareUrl(entryId) {
|
|
1123
|
+
// Check for injected base URL (used when loaded in iframe via srcdoc)
|
|
1124
|
+
const baseUrlMeta = document.querySelector('meta[name="pi-share-base-url"]');
|
|
1125
|
+
const baseUrl = baseUrlMeta ? baseUrlMeta.content : window.location.href.split('?')[0];
|
|
1126
|
+
|
|
1127
|
+
const url = new URL(window.location.href);
|
|
1128
|
+
// Find the gist ID (first query param without value, e.g., ?abc123)
|
|
1129
|
+
const gistId = Array.from(url.searchParams.keys()).find(k => !url.searchParams.get(k));
|
|
1130
|
+
|
|
1131
|
+
// Build the share URL
|
|
1132
|
+
const params = new URLSearchParams();
|
|
1133
|
+
params.set('leafId', currentLeafId);
|
|
1134
|
+
params.set('targetId', entryId);
|
|
1135
|
+
|
|
1136
|
+
// If we have an injected base URL (iframe context), use it directly
|
|
1137
|
+
if (baseUrlMeta) {
|
|
1138
|
+
return `${baseUrl}&${params.toString()}`;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// Otherwise build from current location (direct file access)
|
|
1142
|
+
url.search = gistId ? `?${gistId}&${params.toString()}` : `?${params.toString()}`;
|
|
1143
|
+
return url.toString();
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Copy text to clipboard with visual feedback.
|
|
1148
|
+
* Uses navigator.clipboard with fallback to execCommand for HTTP contexts.
|
|
1149
|
+
*/
|
|
1150
|
+
async function copyToClipboard(text, button) {
|
|
1151
|
+
let success = false;
|
|
1152
|
+
try {
|
|
1153
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
1154
|
+
await navigator.clipboard.writeText(text);
|
|
1155
|
+
success = true;
|
|
1156
|
+
}
|
|
1157
|
+
} catch (err) {
|
|
1158
|
+
// Clipboard API failed, try fallback
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// Fallback for HTTP or when Clipboard API is unavailable
|
|
1162
|
+
if (!success) {
|
|
1163
|
+
try {
|
|
1164
|
+
const textarea = document.createElement('textarea');
|
|
1165
|
+
textarea.value = text;
|
|
1166
|
+
textarea.style.position = 'fixed';
|
|
1167
|
+
textarea.style.opacity = '0';
|
|
1168
|
+
document.body.appendChild(textarea);
|
|
1169
|
+
textarea.select();
|
|
1170
|
+
success = document.execCommand('copy');
|
|
1171
|
+
document.body.removeChild(textarea);
|
|
1172
|
+
} catch (err) {
|
|
1173
|
+
console.error('Failed to copy:', err);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
if (success && button) {
|
|
1178
|
+
const originalHtml = button.innerHTML;
|
|
1179
|
+
button.innerHTML = '✓';
|
|
1180
|
+
button.classList.add('copied');
|
|
1181
|
+
setTimeout(() => {
|
|
1182
|
+
button.innerHTML = originalHtml;
|
|
1183
|
+
button.classList.remove('copied');
|
|
1184
|
+
}, 1500);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Render the copy-link button HTML for a message.
|
|
1190
|
+
*/
|
|
1191
|
+
function renderCopyLinkButton(entryId) {
|
|
1192
|
+
return `<button class="copy-link-btn" data-entry-id="${escapeHtml(entryId)}" title="Copy link to this message">
|
|
1193
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1194
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
|
|
1195
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
|
|
1196
|
+
</svg>
|
|
1197
|
+
</button>`;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
function renderEntry(entry) {
|
|
1201
|
+
const ts = formatTimestamp(entry.timestamp);
|
|
1202
|
+
const tsHtml = ts ? `<div class="message-timestamp">${ts}</div>` : '';
|
|
1203
|
+
const entryDomId = `entry-${escapeHtml(entry.id)}`;
|
|
1204
|
+
const copyBtnHtml = renderCopyLinkButton(entry.id);
|
|
1205
|
+
|
|
1206
|
+
if (entry.type === 'message') {
|
|
1207
|
+
const msg = entry.message;
|
|
1208
|
+
|
|
1209
|
+
if (msg.role === 'user') {
|
|
1210
|
+
const content = msg.content;
|
|
1211
|
+
const text = typeof content === 'string' ? content :
|
|
1212
|
+
content.filter(c => c.type === 'text').map(c => c.text).join('\n');
|
|
1213
|
+
const skillBlock = parseSkillBlock(text);
|
|
1214
|
+
|
|
1215
|
+
if (skillBlock) {
|
|
1216
|
+
// Collect images from content array
|
|
1217
|
+
const images = Array.isArray(content) ? content.filter(c => c.type === 'image') : [];
|
|
1218
|
+
const hasUserContent = skillBlock.userMessage || images.length > 0;
|
|
1219
|
+
let html = `<div class="skill-user-entry" id="${entryDomId}">${copyBtnHtml}${tsHtml}`;
|
|
1220
|
+
|
|
1221
|
+
// Skill invocation (collapsed by default, click to expand)
|
|
1222
|
+
html += `<div class="skill-invocation" onclick="if(window.getSelection().toString())return;this.classList.toggle('expanded')">
|
|
1223
|
+
<div class="skill-invocation-label">[skill] ${escapeHtml(skillBlock.name)}</div>
|
|
1224
|
+
<div class="skill-invocation-collapsed">${escapeHtml(skillBlock.name)} (click to expand)</div>
|
|
1225
|
+
<div class="skill-invocation-content markdown-content">${safeMarkedParse(skillBlock.content)}</div>
|
|
1226
|
+
</div>`;
|
|
1227
|
+
|
|
1228
|
+
// User message (separate block if present)
|
|
1229
|
+
if (hasUserContent) {
|
|
1230
|
+
html += '<div class="user-message">';
|
|
1231
|
+
if (images.length > 0) {
|
|
1232
|
+
html += '<div class="message-images">';
|
|
1233
|
+
for (const img of images) {
|
|
1234
|
+
html += `<img src="data:${escapeHtml(img.mimeType || 'image/png')};base64,${escapeHtml(img.data || '')}" class="message-image" />`;
|
|
1235
|
+
}
|
|
1236
|
+
html += '</div>';
|
|
1237
|
+
}
|
|
1238
|
+
if (skillBlock.userMessage) {
|
|
1239
|
+
html += `<div class="markdown-content">${safeMarkedParse(skillBlock.userMessage)}</div>`;
|
|
1240
|
+
}
|
|
1241
|
+
html += '</div>';
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
html += '</div>';
|
|
1245
|
+
return html;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
// No skill block - normal user message
|
|
1249
|
+
let html = `<div class="user-message" id="${entryDomId}">${copyBtnHtml}${tsHtml}`;
|
|
1250
|
+
|
|
1251
|
+
if (Array.isArray(content)) {
|
|
1252
|
+
const images = content.filter(c => c.type === 'image');
|
|
1253
|
+
if (images.length > 0) {
|
|
1254
|
+
html += '<div class="message-images">';
|
|
1255
|
+
for (const img of images) {
|
|
1256
|
+
html += `<img src="data:${escapeHtml(img.mimeType || 'image/png')};base64,${escapeHtml(img.data || '')}" class="message-image" />`;
|
|
1257
|
+
}
|
|
1258
|
+
html += '</div>';
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
if (text.trim()) {
|
|
1263
|
+
html += `<div class="markdown-content">${safeMarkedParse(text)}</div>`;
|
|
1264
|
+
}
|
|
1265
|
+
html += '</div>';
|
|
1266
|
+
return html;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
if (msg.role === 'assistant') {
|
|
1270
|
+
let html = `<div class="assistant-message" id="${entryDomId}">${copyBtnHtml}${tsHtml}`;
|
|
1271
|
+
|
|
1272
|
+
for (const block of msg.content) {
|
|
1273
|
+
if (block.type === 'text' && block.text.trim()) {
|
|
1274
|
+
html += `<div class="assistant-text markdown-content">${safeMarkedParse(block.text)}</div>`;
|
|
1275
|
+
} else if (block.type === 'thinking' && block.thinking.trim()) {
|
|
1276
|
+
html += `<div class="thinking-block">
|
|
1277
|
+
<div class="thinking-text">${escapeHtml(block.thinking)}</div>
|
|
1278
|
+
<div class="thinking-collapsed">Thinking ...</div>
|
|
1279
|
+
</div>`;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
for (const block of msg.content) {
|
|
1284
|
+
if (block.type === 'toolCall') {
|
|
1285
|
+
html += renderToolCall(block);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
if (msg.stopReason === 'aborted') {
|
|
1290
|
+
html += '<div class="error-text">Aborted</div>';
|
|
1291
|
+
} else if (msg.stopReason === 'error') {
|
|
1292
|
+
html += `<div class="error-text">Error: ${escapeHtml(msg.errorMessage || 'Unknown error')}</div>`;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
html += '</div>';
|
|
1296
|
+
return html;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
if (msg.role === 'bashExecution') {
|
|
1300
|
+
const isError = msg.cancelled || (msg.exitCode !== 0 && msg.exitCode !== null);
|
|
1301
|
+
let html = `<div class="tool-execution ${isError ? 'error' : 'success'}" id="${entryDomId}">${tsHtml}`;
|
|
1302
|
+
html += `<div class="tool-command">$ ${escapeHtml(msg.command)}</div>`;
|
|
1303
|
+
if (msg.output) html += formatExpandableOutput(msg.output, 10);
|
|
1304
|
+
if (msg.cancelled) {
|
|
1305
|
+
html += '<div style="color: var(--warning)">(cancelled)</div>';
|
|
1306
|
+
} else if (msg.exitCode !== 0 && msg.exitCode !== null) {
|
|
1307
|
+
html += `<div style="color: var(--error)">(exit ${msg.exitCode})</div>`;
|
|
1308
|
+
}
|
|
1309
|
+
html += '</div>';
|
|
1310
|
+
return html;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
if (msg.role === 'toolResult') return '';
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
if (entry.type === 'model_change') {
|
|
1317
|
+
return `<div class="model-change" id="${entryDomId}">${tsHtml}Switched to model: <span class="model-name">${escapeHtml(entry.provider)}/${escapeHtml(entry.modelId)}</span></div>`;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
if (entry.type === 'compaction') {
|
|
1321
|
+
return `<div class="compaction" id="${entryDomId}" onclick="if(window.getSelection().toString())return;this.classList.toggle('expanded')">
|
|
1322
|
+
<div class="compaction-label">[compaction]</div>
|
|
1323
|
+
<div class="compaction-collapsed">Compacted from ${entry.tokensBefore.toLocaleString()} tokens</div>
|
|
1324
|
+
<div class="compaction-content"><strong>Compacted from ${entry.tokensBefore.toLocaleString()} tokens</strong>\n\n${escapeHtml(entry.summary)}</div>
|
|
1325
|
+
</div>`;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
if (entry.type === 'branch_summary') {
|
|
1329
|
+
return `<div class="branch-summary" id="${entryDomId}">${tsHtml}
|
|
1330
|
+
<div class="branch-summary-header">Branch Summary</div>
|
|
1331
|
+
<div class="markdown-content">${safeMarkedParse(entry.summary)}</div>
|
|
1332
|
+
</div>`;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
if (entry.type === 'custom_message') {
|
|
1336
|
+
const hidden = entry.display === false;
|
|
1337
|
+
return `<div class="hook-message${hidden ? ' hook-message-hidden' : ''}" id="${entryDomId}">${tsHtml}
|
|
1338
|
+
<div class="hook-type">[${escapeHtml(entry.customType)}]${hidden ? ' · Hidden in terminal' : ''}</div>
|
|
1339
|
+
<div class="markdown-content">${safeMarkedParse(typeof entry.content === 'string' ? entry.content : JSON.stringify(entry.content))}</div>
|
|
1340
|
+
</div>`;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
return '';
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// ============================================================
|
|
1347
|
+
// HEADER / STATS
|
|
1348
|
+
// ============================================================
|
|
1349
|
+
|
|
1350
|
+
function computeStats(entryList) {
|
|
1351
|
+
let userMessages = 0, assistantMessages = 0, toolResults = 0;
|
|
1352
|
+
let customMessages = 0, compactions = 0, branchSummaries = 0, toolCalls = 0;
|
|
1353
|
+
const tokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
1354
|
+
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
|
1355
|
+
const models = new Set();
|
|
1356
|
+
|
|
1357
|
+
for (const entry of entryList) {
|
|
1358
|
+
if (entry.type === 'message') {
|
|
1359
|
+
const msg = entry.message;
|
|
1360
|
+
if (msg.role === 'user') userMessages++;
|
|
1361
|
+
if (msg.role === 'assistant') {
|
|
1362
|
+
assistantMessages++;
|
|
1363
|
+
if (msg.model) models.add(msg.provider ? `${msg.provider}/${msg.model}` : msg.model);
|
|
1364
|
+
if (msg.usage) {
|
|
1365
|
+
tokens.input += msg.usage.input || 0;
|
|
1366
|
+
tokens.output += msg.usage.output || 0;
|
|
1367
|
+
tokens.cacheRead += msg.usage.cacheRead || 0;
|
|
1368
|
+
tokens.cacheWrite += msg.usage.cacheWrite || 0;
|
|
1369
|
+
if (msg.usage.cost) {
|
|
1370
|
+
cost.input += msg.usage.cost.input || 0;
|
|
1371
|
+
cost.output += msg.usage.cost.output || 0;
|
|
1372
|
+
cost.cacheRead += msg.usage.cost.cacheRead || 0;
|
|
1373
|
+
cost.cacheWrite += msg.usage.cost.cacheWrite || 0;
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
toolCalls += msg.content.filter(c => c.type === 'toolCall').length;
|
|
1377
|
+
}
|
|
1378
|
+
if (msg.role === 'toolResult') toolResults++;
|
|
1379
|
+
} else if (entry.type === 'compaction') {
|
|
1380
|
+
compactions++;
|
|
1381
|
+
} else if (entry.type === 'branch_summary') {
|
|
1382
|
+
branchSummaries++;
|
|
1383
|
+
} else if (entry.type === 'custom_message') {
|
|
1384
|
+
customMessages++;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
return { userMessages, assistantMessages, toolResults, customMessages, compactions, branchSummaries, toolCalls, tokens, cost, models: Array.from(models) };
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
const globalStats = computeStats(entries);
|
|
1392
|
+
|
|
1393
|
+
function renderHeader() {
|
|
1394
|
+
const totalCost = globalStats.cost.input + globalStats.cost.output + globalStats.cost.cacheRead + globalStats.cost.cacheWrite;
|
|
1395
|
+
|
|
1396
|
+
const tokenParts = [];
|
|
1397
|
+
if (globalStats.tokens.input) tokenParts.push(`↑${formatTokens(globalStats.tokens.input)}`);
|
|
1398
|
+
if (globalStats.tokens.output) tokenParts.push(`↓${formatTokens(globalStats.tokens.output)}`);
|
|
1399
|
+
if (globalStats.tokens.cacheRead) tokenParts.push(`R${formatTokens(globalStats.tokens.cacheRead)}`);
|
|
1400
|
+
if (globalStats.tokens.cacheWrite) tokenParts.push(`W${formatTokens(globalStats.tokens.cacheWrite)}`);
|
|
1401
|
+
|
|
1402
|
+
const msgParts = [];
|
|
1403
|
+
if (globalStats.userMessages) msgParts.push(`${globalStats.userMessages} user`);
|
|
1404
|
+
if (globalStats.assistantMessages) msgParts.push(`${globalStats.assistantMessages} assistant`);
|
|
1405
|
+
if (globalStats.toolResults) msgParts.push(`${globalStats.toolResults} tool results`);
|
|
1406
|
+
if (globalStats.customMessages) msgParts.push(`${globalStats.customMessages} custom`);
|
|
1407
|
+
if (globalStats.compactions) msgParts.push(`${globalStats.compactions} compactions`);
|
|
1408
|
+
if (globalStats.branchSummaries) msgParts.push(`${globalStats.branchSummaries} branch summaries`);
|
|
1409
|
+
|
|
1410
|
+
let html = `
|
|
1411
|
+
<div class="header">
|
|
1412
|
+
<h1>Session: ${escapeHtml(header?.id || 'unknown')}</h1>
|
|
1413
|
+
<div class="help-bar">
|
|
1414
|
+
<span class="help-hint">T toggle thinking · O toggle tools · H toggle hidden messages</span>
|
|
1415
|
+
<div class="help-actions">
|
|
1416
|
+
<button type="button" class="header-toggle-btn" data-action="toggle-thinking" aria-pressed="${thinkingExpanded}" title="Toggle thinking (T)">Toggle thinking</button>
|
|
1417
|
+
<button type="button" class="header-toggle-btn" data-action="toggle-tools" aria-pressed="${toolOutputsExpanded}" title="Toggle tools (O)">Toggle tools</button>
|
|
1418
|
+
<button type="button" class="header-toggle-btn" data-action="toggle-hidden-messages" aria-pressed="${showHiddenMessages}" title="Show custom messages marked as hidden in the terminal (H).">${showHiddenMessages ? 'Hide hidden messages' : 'Show hidden messages'}</button>
|
|
1419
|
+
<button type="button" class="download-json-btn" onclick="downloadSessionJson()" title="Download session as JSONL">↓ JSONL</button>
|
|
1420
|
+
</div>
|
|
1421
|
+
</div>
|
|
1422
|
+
<div class="header-info">
|
|
1423
|
+
<div class="info-item"><span class="info-label">Date:</span><span class="info-value">${header?.timestamp ? new Date(header.timestamp).toLocaleString() : 'unknown'}</span></div>
|
|
1424
|
+
<div class="info-item"><span class="info-label">Models:</span><span class="info-value">${escapeHtml(globalStats.models.join(', ') || 'unknown')}</span></div>
|
|
1425
|
+
<div class="info-item"><span class="info-label">Messages:</span><span class="info-value">${msgParts.join(', ') || '0'}</span></div>
|
|
1426
|
+
<div class="info-item"><span class="info-label">Tool Calls:</span><span class="info-value">${globalStats.toolCalls}</span></div>
|
|
1427
|
+
<div class="info-item"><span class="info-label">Tokens:</span><span class="info-value">${tokenParts.join(' ') || '0'}</span></div>
|
|
1428
|
+
<div class="info-item"><span class="info-label">Cost:</span><span class="info-value">$${totalCost.toFixed(3)}</span></div>
|
|
1429
|
+
</div>
|
|
1430
|
+
</div>`;
|
|
1431
|
+
|
|
1432
|
+
// Render system prompt (user's base prompt, applies to all providers)
|
|
1433
|
+
if (systemPrompt) {
|
|
1434
|
+
const lines = systemPrompt.split('\n');
|
|
1435
|
+
const previewLines = 10;
|
|
1436
|
+
if (lines.length > previewLines) {
|
|
1437
|
+
const preview = lines.slice(0, previewLines).join('\n');
|
|
1438
|
+
const remaining = lines.length - previewLines;
|
|
1439
|
+
html += `<div class="system-prompt expandable" onclick="if(window.getSelection().toString())return;this.classList.toggle('expanded')">
|
|
1440
|
+
<div class="system-prompt-header">System Prompt</div>
|
|
1441
|
+
<div class="system-prompt-preview">${escapeHtml(preview)}</div>
|
|
1442
|
+
<div class="system-prompt-expand-hint">... (${remaining} more lines, click to expand)</div>
|
|
1443
|
+
<div class="system-prompt-full">${escapeHtml(systemPrompt)}</div>
|
|
1444
|
+
</div>`;
|
|
1445
|
+
} else {
|
|
1446
|
+
html += `<div class="system-prompt">
|
|
1447
|
+
<div class="system-prompt-header">System Prompt</div>
|
|
1448
|
+
<div class="system-prompt-full" style="display: block">${escapeHtml(systemPrompt)}</div>
|
|
1449
|
+
</div>`;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
if (tools && tools.length > 0) {
|
|
1454
|
+
html += `<div class="tools-list">
|
|
1455
|
+
<div class="tools-header">Available Tools</div>
|
|
1456
|
+
<div class="tools-content">
|
|
1457
|
+
${tools.map(t => {
|
|
1458
|
+
const hasParams = t.parameters && typeof t.parameters === 'object' && t.parameters.properties && Object.keys(t.parameters.properties).length > 0;
|
|
1459
|
+
if (!hasParams) {
|
|
1460
|
+
return `<div class="tool-item"><span class="tool-item-name">${escapeHtml(t.name)}</span> - <span class="tool-item-desc">${escapeHtml(t.description)}</span></div>`;
|
|
1461
|
+
}
|
|
1462
|
+
const params = t.parameters;
|
|
1463
|
+
const properties = params.properties;
|
|
1464
|
+
const required = params.required || [];
|
|
1465
|
+
let paramsHtml = '';
|
|
1466
|
+
for (const [name, prop] of Object.entries(properties)) {
|
|
1467
|
+
const isRequired = required.includes(name);
|
|
1468
|
+
const typeStr = prop.type || 'any';
|
|
1469
|
+
const reqLabel = isRequired ? '<span class="tool-param-required">required</span>' : '<span class="tool-param-optional">optional</span>';
|
|
1470
|
+
paramsHtml += `<div class="tool-param"><span class="tool-param-name">${escapeHtml(name)}</span> <span class="tool-param-type">${escapeHtml(typeStr)}</span> ${reqLabel}`;
|
|
1471
|
+
if (prop.description) {
|
|
1472
|
+
paramsHtml += `<div class="tool-param-desc">${escapeHtml(prop.description)}</div>`;
|
|
1473
|
+
}
|
|
1474
|
+
paramsHtml += `</div>`;
|
|
1475
|
+
}
|
|
1476
|
+
return `<div class="tool-item" onclick="if(window.getSelection().toString())return;this.classList.toggle('params-expanded')"><span class="tool-item-name">${escapeHtml(t.name)}</span> - <span class="tool-item-desc">${escapeHtml(t.description)}</span> <span class="tool-params-hint"></span><div class="tool-params-content">${paramsHtml}</div></div>`;
|
|
1477
|
+
}).join('')}
|
|
1478
|
+
</div>
|
|
1479
|
+
</div>`;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
return html;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
// ============================================================
|
|
1486
|
+
// NAVIGATION
|
|
1487
|
+
// ============================================================
|
|
1488
|
+
|
|
1489
|
+
// Cache for rendered entry DOM nodes
|
|
1490
|
+
const entryCache = new Map();
|
|
1491
|
+
|
|
1492
|
+
function getScrollTargetElementId(entryId) {
|
|
1493
|
+
const entry = byId.get(entryId);
|
|
1494
|
+
if (entry?.type === 'message' && entry.message.role === 'toolResult' && entry.message.toolCallId) {
|
|
1495
|
+
// getElementById() matches the parsed DOM id attribute, whose HTML entities
|
|
1496
|
+
// were already resolved from the escaped id rendered by renderToolCall().
|
|
1497
|
+
return `tool-call-${entry.message.toolCallId}`;
|
|
1498
|
+
}
|
|
1499
|
+
return `entry-${entryId}`;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
function renderEntryToNode(entry) {
|
|
1503
|
+
// Check cache first
|
|
1504
|
+
if (entryCache.has(entry.id)) {
|
|
1505
|
+
return entryCache.get(entry.id).cloneNode(true);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
// Render to HTML string, then parse to node
|
|
1509
|
+
const html = renderEntry(entry);
|
|
1510
|
+
if (!html) return null;
|
|
1511
|
+
|
|
1512
|
+
const template = document.createElement('template');
|
|
1513
|
+
template.innerHTML = html;
|
|
1514
|
+
const node = template.content.firstElementChild;
|
|
1515
|
+
|
|
1516
|
+
// Cache the node
|
|
1517
|
+
if (node) {
|
|
1518
|
+
entryCache.set(entry.id, node.cloneNode(true));
|
|
1519
|
+
}
|
|
1520
|
+
return node;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
function navigateTo(targetId, scrollMode = 'target', scrollToEntryId = null) {
|
|
1524
|
+
currentLeafId = targetId;
|
|
1525
|
+
currentTargetId = scrollToEntryId || targetId;
|
|
1526
|
+
const targetEntry = byId.get(currentTargetId);
|
|
1527
|
+
if (scrollMode === 'target' && targetEntry?.type === 'custom_message' && targetEntry.display === false) {
|
|
1528
|
+
setHiddenMessagesVisible(true);
|
|
1529
|
+
}
|
|
1530
|
+
const path = getPath(targetId);
|
|
1531
|
+
|
|
1532
|
+
renderTree();
|
|
1533
|
+
|
|
1534
|
+
document.getElementById('header-container').innerHTML = renderHeader();
|
|
1535
|
+
attachHeaderHandlers();
|
|
1536
|
+
|
|
1537
|
+
// Build messages using cached DOM nodes
|
|
1538
|
+
const messagesEl = document.getElementById('messages');
|
|
1539
|
+
const fragment = document.createDocumentFragment();
|
|
1540
|
+
|
|
1541
|
+
for (const entry of path) {
|
|
1542
|
+
const node = renderEntryToNode(entry);
|
|
1543
|
+
if (node) {
|
|
1544
|
+
fragment.appendChild(node);
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
messagesEl.innerHTML = '';
|
|
1549
|
+
messagesEl.appendChild(fragment);
|
|
1550
|
+
|
|
1551
|
+
// Cached nodes contain their initial presentation; reapply the viewer's toggle states.
|
|
1552
|
+
setThinkingExpanded(thinkingExpanded);
|
|
1553
|
+
setToolOutputsExpanded(toolOutputsExpanded);
|
|
1554
|
+
|
|
1555
|
+
// Attach click handlers for copy-link buttons
|
|
1556
|
+
messagesEl.querySelectorAll('.copy-link-btn').forEach(btn => {
|
|
1557
|
+
btn.addEventListener('click', (e) => {
|
|
1558
|
+
e.stopPropagation();
|
|
1559
|
+
const entryId = btn.dataset.entryId;
|
|
1560
|
+
const shareUrl = buildShareUrl(entryId);
|
|
1561
|
+
copyToClipboard(shareUrl, btn);
|
|
1562
|
+
});
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
// Use setTimeout(0) to ensure DOM is fully laid out before scrolling
|
|
1566
|
+
setTimeout(() => {
|
|
1567
|
+
const content = document.getElementById('content');
|
|
1568
|
+
if (scrollMode === 'bottom') {
|
|
1569
|
+
content.scrollTop = content.scrollHeight;
|
|
1570
|
+
} else if (scrollMode === 'target') {
|
|
1571
|
+
// If scrollToEntryId is provided, scroll to that specific entry.
|
|
1572
|
+
// Tool result entries are rendered inside their assistant tool-call block,
|
|
1573
|
+
// so route them to the visible tool-call element instead.
|
|
1574
|
+
const scrollTargetId = scrollToEntryId || targetId;
|
|
1575
|
+
const targetEl = document.getElementById(getScrollTargetElementId(scrollTargetId)) ||
|
|
1576
|
+
document.getElementById(`entry-${scrollTargetId}`);
|
|
1577
|
+
if (targetEl) {
|
|
1578
|
+
targetEl.scrollIntoView({ block: 'center' });
|
|
1579
|
+
// Briefly highlight the target message
|
|
1580
|
+
if (scrollToEntryId) {
|
|
1581
|
+
targetEl.classList.add('highlight');
|
|
1582
|
+
setTimeout(() => targetEl.classList.remove('highlight'), 2000);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
}, 0);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
// ============================================================
|
|
1590
|
+
// INITIALIZATION
|
|
1591
|
+
// ============================================================
|
|
1592
|
+
|
|
1593
|
+
// Configure marked with syntax highlighting and TUI-compatible HTML handling
|
|
1594
|
+
const strictStrikethroughRegex = /^(~~)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/;
|
|
1595
|
+
|
|
1596
|
+
marked.use({
|
|
1597
|
+
breaks: true,
|
|
1598
|
+
gfm: true,
|
|
1599
|
+
tokenizer: {
|
|
1600
|
+
// Treat HTML-like input as plain text so tags are shown verbatim,
|
|
1601
|
+
// matching the TUI markdown renderer.
|
|
1602
|
+
html() {
|
|
1603
|
+
return undefined;
|
|
1604
|
+
},
|
|
1605
|
+
tag() {
|
|
1606
|
+
return undefined;
|
|
1607
|
+
},
|
|
1608
|
+
del(src) {
|
|
1609
|
+
const match = strictStrikethroughRegex.exec(src);
|
|
1610
|
+
if (!match) return undefined;
|
|
1611
|
+
return {
|
|
1612
|
+
type: 'del',
|
|
1613
|
+
raw: match[0],
|
|
1614
|
+
text: match[2],
|
|
1615
|
+
tokens: this.lexer.inlineTokens(match[2])
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
emStrong: markedCjkFriendly().tokenizer.emStrong
|
|
1619
|
+
},
|
|
1620
|
+
renderer: {
|
|
1621
|
+
// Sanitize link URLs with a scheme allow-list. Browsers strip C0
|
|
1622
|
+
// controls from schemes, so strip them before checking and emitting.
|
|
1623
|
+
link(token) {
|
|
1624
|
+
const href = sanitizeMarkdownUrl(token.href);
|
|
1625
|
+
if (href === null) {
|
|
1626
|
+
return this.parser.parseInline(token.tokens);
|
|
1627
|
+
}
|
|
1628
|
+
let out = '<a href="' + escapeHtml(href) + '"';
|
|
1629
|
+
if (token.title) {
|
|
1630
|
+
out += ' title="' + escapeHtml(token.title) + '"';
|
|
1631
|
+
}
|
|
1632
|
+
out += '>' + this.parser.parseInline(token.tokens) + '</a>';
|
|
1633
|
+
return out;
|
|
1634
|
+
},
|
|
1635
|
+
// Sanitize image src URLs with the same scheme allow-list.
|
|
1636
|
+
image(token) {
|
|
1637
|
+
const href = sanitizeMarkdownUrl(token.href);
|
|
1638
|
+
if (href === null) {
|
|
1639
|
+
return escapeHtml(token.text || '');
|
|
1640
|
+
}
|
|
1641
|
+
let out = '<img src="' + escapeHtml(href) + '" alt="' + escapeHtml(token.text || '') + '"';
|
|
1642
|
+
if (token.title) {
|
|
1643
|
+
out += ' title="' + escapeHtml(token.title) + '"';
|
|
1644
|
+
}
|
|
1645
|
+
out += '>';
|
|
1646
|
+
return out;
|
|
1647
|
+
},
|
|
1648
|
+
// Code blocks: syntax highlight, no HTML escaping
|
|
1649
|
+
code(token) {
|
|
1650
|
+
const code = token.text;
|
|
1651
|
+
const lang = token.lang;
|
|
1652
|
+
let highlighted;
|
|
1653
|
+
if (lang && hljs.getLanguage(lang)) {
|
|
1654
|
+
try {
|
|
1655
|
+
highlighted = hljs.highlight(code, { language: lang }).value;
|
|
1656
|
+
} catch {
|
|
1657
|
+
highlighted = escapeHtml(code);
|
|
1658
|
+
}
|
|
1659
|
+
} else {
|
|
1660
|
+
// Auto-detect language if not specified
|
|
1661
|
+
try {
|
|
1662
|
+
highlighted = hljs.highlightAuto(code).value;
|
|
1663
|
+
} catch {
|
|
1664
|
+
highlighted = escapeHtml(code);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return `<pre><code class="hljs">${highlighted}</code></pre>`;
|
|
1668
|
+
},
|
|
1669
|
+
// Inline code: escape HTML
|
|
1670
|
+
codespan(token) {
|
|
1671
|
+
return `<code>${escapeHtml(token.text)}</code>`;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
});
|
|
1675
|
+
|
|
1676
|
+
// Simple marked parse (escaping handled in renderers)
|
|
1677
|
+
function safeMarkedParse(text) {
|
|
1678
|
+
return marked.parse(text);
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
// Search input
|
|
1682
|
+
const searchInput = document.getElementById('tree-search');
|
|
1683
|
+
searchInput.addEventListener('input', (e) => {
|
|
1684
|
+
searchQuery = e.target.value;
|
|
1685
|
+
forceTreeRerender();
|
|
1686
|
+
});
|
|
1687
|
+
|
|
1688
|
+
// Filter buttons
|
|
1689
|
+
document.querySelectorAll('.filter-btn').forEach(btn => {
|
|
1690
|
+
btn.addEventListener('click', () => {
|
|
1691
|
+
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
|
|
1692
|
+
btn.classList.add('active');
|
|
1693
|
+
filterMode = btn.dataset.filter;
|
|
1694
|
+
forceTreeRerender();
|
|
1695
|
+
});
|
|
1696
|
+
});
|
|
1697
|
+
|
|
1698
|
+
// Sidebar toggle
|
|
1699
|
+
const sidebar = document.getElementById('sidebar');
|
|
1700
|
+
const overlay = document.getElementById('sidebar-overlay');
|
|
1701
|
+
const hamburger = document.getElementById('hamburger');
|
|
1702
|
+
const sidebarResizer = document.getElementById('sidebar-resizer');
|
|
1703
|
+
const SIDEBAR_WIDTH_STORAGE_KEY = 'pi-share:v1:sidebar-width';
|
|
1704
|
+
const MIN_CONTENT_WIDTH = 320;
|
|
1705
|
+
|
|
1706
|
+
function isMobileLayout() {
|
|
1707
|
+
return window.matchMedia('(max-width: 900px)').matches;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
function getSidebarBounds() {
|
|
1711
|
+
const rootStyles = getComputedStyle(document.documentElement);
|
|
1712
|
+
const minWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-min-width')) || 240;
|
|
1713
|
+
const maxWidth = parseFloat(rootStyles.getPropertyValue('--sidebar-max-width')) || 720;
|
|
1714
|
+
const viewportMaxWidth = window.innerWidth - MIN_CONTENT_WIDTH;
|
|
1715
|
+
return {
|
|
1716
|
+
minWidth,
|
|
1717
|
+
maxWidth: Math.max(minWidth, Math.min(maxWidth, viewportMaxWidth))
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
function clampSidebarWidth(width) {
|
|
1722
|
+
const { minWidth, maxWidth } = getSidebarBounds();
|
|
1723
|
+
return Math.max(minWidth, Math.min(maxWidth, width));
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function applySidebarWidth(width) {
|
|
1727
|
+
document.documentElement.style.setProperty('--sidebar-width', `${Math.round(clampSidebarWidth(width))}px`);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
function loadSidebarWidth() {
|
|
1731
|
+
try {
|
|
1732
|
+
const raw = localStorage.getItem(SIDEBAR_WIDTH_STORAGE_KEY);
|
|
1733
|
+
if (raw === null) return null;
|
|
1734
|
+
const width = Number(raw);
|
|
1735
|
+
return Number.isFinite(width) ? width : null;
|
|
1736
|
+
} catch {
|
|
1737
|
+
return null;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
function saveSidebarWidth(width) {
|
|
1742
|
+
try {
|
|
1743
|
+
localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, String(Math.round(clampSidebarWidth(width))));
|
|
1744
|
+
} catch {
|
|
1745
|
+
// Ignore storage failures (e.g. private browsing restrictions)
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
function setupSidebarResize() {
|
|
1750
|
+
const savedWidth = loadSidebarWidth();
|
|
1751
|
+
if (savedWidth !== null) {
|
|
1752
|
+
applySidebarWidth(savedWidth);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
if (!sidebarResizer) return;
|
|
1756
|
+
|
|
1757
|
+
let cleanupDrag = null;
|
|
1758
|
+
|
|
1759
|
+
const stopDrag = (pointerId) => {
|
|
1760
|
+
if (cleanupDrag) {
|
|
1761
|
+
cleanupDrag(pointerId);
|
|
1762
|
+
cleanupDrag = null;
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
sidebarResizer.addEventListener('pointerdown', (e) => {
|
|
1767
|
+
if (isMobileLayout()) return;
|
|
1768
|
+
|
|
1769
|
+
e.preventDefault();
|
|
1770
|
+
const startX = e.clientX;
|
|
1771
|
+
const startWidth = sidebar.getBoundingClientRect().width;
|
|
1772
|
+
document.body.classList.add('sidebar-resizing');
|
|
1773
|
+
sidebarResizer.setPointerCapture?.(e.pointerId);
|
|
1774
|
+
|
|
1775
|
+
const onPointerMove = (event) => {
|
|
1776
|
+
applySidebarWidth(startWidth + (event.clientX - startX));
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1779
|
+
cleanupDrag = (pointerIdToRelease) => {
|
|
1780
|
+
document.body.classList.remove('sidebar-resizing');
|
|
1781
|
+
sidebarResizer.releasePointerCapture?.(pointerIdToRelease);
|
|
1782
|
+
window.removeEventListener('pointermove', onPointerMove);
|
|
1783
|
+
window.removeEventListener('pointerup', onPointerUp);
|
|
1784
|
+
window.removeEventListener('pointercancel', onPointerCancel);
|
|
1785
|
+
saveSidebarWidth(sidebar.getBoundingClientRect().width);
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
const onPointerUp = (event) => stopDrag(event.pointerId);
|
|
1789
|
+
const onPointerCancel = (event) => stopDrag(event.pointerId);
|
|
1790
|
+
|
|
1791
|
+
window.addEventListener('pointermove', onPointerMove);
|
|
1792
|
+
window.addEventListener('pointerup', onPointerUp);
|
|
1793
|
+
window.addEventListener('pointercancel', onPointerCancel);
|
|
1794
|
+
});
|
|
1795
|
+
|
|
1796
|
+
sidebarResizer.addEventListener('dblclick', () => {
|
|
1797
|
+
if (isMobileLayout()) return;
|
|
1798
|
+
applySidebarWidth(400);
|
|
1799
|
+
saveSidebarWidth(400);
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
window.addEventListener('resize', () => {
|
|
1803
|
+
if (isMobileLayout()) return;
|
|
1804
|
+
applySidebarWidth(sidebar.getBoundingClientRect().width);
|
|
1805
|
+
});
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
setupSidebarResize();
|
|
1809
|
+
|
|
1810
|
+
hamburger.addEventListener('click', () => {
|
|
1811
|
+
sidebar.classList.add('open');
|
|
1812
|
+
overlay.classList.add('open');
|
|
1813
|
+
hamburger.style.display = 'none';
|
|
1814
|
+
});
|
|
1815
|
+
|
|
1816
|
+
const closeSidebar = () => {
|
|
1817
|
+
sidebar.classList.remove('open');
|
|
1818
|
+
overlay.classList.remove('open');
|
|
1819
|
+
hamburger.style.display = '';
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
overlay.addEventListener('click', closeSidebar);
|
|
1823
|
+
document.getElementById('sidebar-close').addEventListener('click', closeSidebar);
|
|
1824
|
+
|
|
1825
|
+
// Toggle states
|
|
1826
|
+
let thinkingExpanded = true;
|
|
1827
|
+
let toolOutputsExpanded = false;
|
|
1828
|
+
let showHiddenMessages = false;
|
|
1829
|
+
|
|
1830
|
+
function setHiddenMessagesVisible(visible) {
|
|
1831
|
+
showHiddenMessages = visible;
|
|
1832
|
+
document.body.classList.toggle('show-hidden-messages', visible);
|
|
1833
|
+
const button = document.querySelector('[data-action="toggle-hidden-messages"]');
|
|
1834
|
+
if (button) {
|
|
1835
|
+
button.setAttribute('aria-pressed', String(visible));
|
|
1836
|
+
button.textContent = visible ? 'Hide hidden messages' : 'Show hidden messages';
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
function setThinkingExpanded(expanded) {
|
|
1841
|
+
thinkingExpanded = expanded;
|
|
1842
|
+
document.querySelector('[data-action="toggle-thinking"]')?.setAttribute('aria-pressed', String(expanded));
|
|
1843
|
+
document.querySelectorAll('.thinking-text').forEach(el => {
|
|
1844
|
+
el.style.display = thinkingExpanded ? '' : 'none';
|
|
1845
|
+
});
|
|
1846
|
+
document.querySelectorAll('.thinking-collapsed').forEach(el => {
|
|
1847
|
+
el.style.display = thinkingExpanded ? 'none' : 'block';
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
function setToolOutputsExpanded(expanded) {
|
|
1852
|
+
toolOutputsExpanded = expanded;
|
|
1853
|
+
document.querySelector('[data-action="toggle-tools"]')?.setAttribute('aria-pressed', String(expanded));
|
|
1854
|
+
document.querySelectorAll('.tool-output.expandable').forEach(el => {
|
|
1855
|
+
el.classList.toggle('expanded', toolOutputsExpanded);
|
|
1856
|
+
});
|
|
1857
|
+
document.querySelectorAll('.compaction').forEach(el => {
|
|
1858
|
+
el.classList.toggle('expanded', toolOutputsExpanded);
|
|
1859
|
+
});
|
|
1860
|
+
document.querySelectorAll('.skill-invocation').forEach(el => {
|
|
1861
|
+
el.classList.toggle('expanded', toolOutputsExpanded);
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
const attachHeaderHandlers = () => {
|
|
1866
|
+
document.querySelector('[data-action="toggle-thinking"]')?.addEventListener('click', () => {
|
|
1867
|
+
setThinkingExpanded(!thinkingExpanded);
|
|
1868
|
+
});
|
|
1869
|
+
document.querySelector('[data-action="toggle-tools"]')?.addEventListener('click', () => {
|
|
1870
|
+
setToolOutputsExpanded(!toolOutputsExpanded);
|
|
1871
|
+
});
|
|
1872
|
+
document.querySelector('[data-action="toggle-hidden-messages"]')?.addEventListener('click', () => {
|
|
1873
|
+
setHiddenMessagesVisible(!showHiddenMessages);
|
|
1874
|
+
});
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
const isEditableTarget = (element) => {
|
|
1878
|
+
if (!element) return false;
|
|
1879
|
+
const tagName = element.tagName;
|
|
1880
|
+
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT' || tagName === 'BUTTON') {
|
|
1881
|
+
return true;
|
|
1882
|
+
}
|
|
1883
|
+
return element.isContentEditable || Boolean(element.closest?.('[contenteditable="true"]'));
|
|
1884
|
+
};
|
|
1885
|
+
|
|
1886
|
+
// Keyboard shortcuts
|
|
1887
|
+
document.addEventListener('keydown', (e) => {
|
|
1888
|
+
if (e.key === 'Escape') {
|
|
1889
|
+
searchInput.value = '';
|
|
1890
|
+
searchQuery = '';
|
|
1891
|
+
navigateTo(leafId, 'bottom');
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
if (e.ctrlKey || e.metaKey || e.altKey || isEditableTarget(document.activeElement)) {
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
const key = e.key.toLowerCase();
|
|
1899
|
+
if (key === 't') {
|
|
1900
|
+
e.preventDefault();
|
|
1901
|
+
setThinkingExpanded(!thinkingExpanded);
|
|
1902
|
+
} else if (key === 'o') {
|
|
1903
|
+
e.preventDefault();
|
|
1904
|
+
setToolOutputsExpanded(!toolOutputsExpanded);
|
|
1905
|
+
} else if (key === 'h') {
|
|
1906
|
+
e.preventDefault();
|
|
1907
|
+
setHiddenMessagesVisible(!showHiddenMessages);
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
|
|
1911
|
+
// Initial render
|
|
1912
|
+
// If URL has targetId, scroll to that specific message; otherwise stay at top
|
|
1913
|
+
if (leafId) {
|
|
1914
|
+
if (urlTargetId && byId.has(urlTargetId)) {
|
|
1915
|
+
// Deep link: navigate to leaf and scroll to target message
|
|
1916
|
+
navigateTo(leafId, 'target', urlTargetId);
|
|
1917
|
+
} else {
|
|
1918
|
+
navigateTo(leafId, 'none');
|
|
1919
|
+
}
|
|
1920
|
+
} else if (entries.length > 0) {
|
|
1921
|
+
// Fallback: use last entry if no leafId
|
|
1922
|
+
navigateTo(entries[entries.length - 1].id, 'none');
|
|
1923
|
+
}
|
|
1924
|
+
})();
|