@markusylisiurunen/tau 0.3.100 → 0.3.102
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/dist/core/code_mode/agents.js +60 -14
- package/dist/core/code_mode/agents.js.map +1 -1
- package/dist/core/config/ownership.js +3 -1
- package/dist/core/config/ownership.js.map +1 -1
- package/dist/core/config/schema.js +3 -1
- package/dist/core/config/schema.js.map +1 -1
- package/dist/core/history/agent_history_recorder.js.map +1 -1
- package/dist/core/history/migrations.js +6 -1
- package/dist/core/history/migrations.js.map +1 -1
- package/dist/core/runtime/chat_runtime.js +5 -5
- package/dist/core/runtime/chat_runtime.js.map +1 -1
- package/dist/core/runtime/session_prompt_composer.js +2 -6
- package/dist/core/runtime/session_prompt_composer.js.map +1 -1
- package/dist/core/static/code_mode/history/documentation.md +1 -1
- package/dist/core/static/index.js +22 -11
- package/dist/core/static/index.js.map +1 -1
- package/dist/core/static/prompts/subagent-prefix.md +13 -5
- package/dist/core/static/tau_docs/code-mode.md +1 -1
- package/dist/core/static/tau_docs/config-reference.md +19 -7
- package/dist/core/static/tau_docs/credentials.md +4 -4
- package/dist/core/static/tau_docs/history.md +3 -3
- package/dist/core/static/tau_docs/image-generation.md +27 -20
- package/dist/core/static/tau_docs/index.md +2 -1
- package/dist/core/static/tau_docs/manifest.json +1 -0
- package/dist/core/static/tau_docs/node-sdk.md +6 -6
- package/dist/core/static/tau_docs/personas.md +1 -1
- package/dist/core/static/tau_docs/prompts-and-project-context.md +6 -6
- package/dist/core/static/tau_docs/remote-sessions.md +1 -1
- package/dist/core/static/tau_docs/session-protocol-methods.md +49 -1
- package/dist/core/static/tau_docs/session-protocol.md +22 -3
- package/dist/core/static/tau_docs/sessions.md +3 -1
- package/dist/core/static/tau_docs/subagents.md +65 -48
- package/dist/core/static/tau_docs/telegram-commands.md +55 -0
- package/dist/core/static/tau_docs/telegram.md +10 -38
- package/dist/core/static/tau_docs/tools.md +1 -1
- package/dist/core/static/tau_docs/troubleshooting.md +3 -3
- package/dist/core/static/tau_docs/tui.md +22 -18
- package/dist/core/subagents/agent_supervisor.js +192 -15
- package/dist/core/subagents/agent_supervisor.js.map +1 -1
- package/dist/core/subagents/claude_code_runner.mjs +61 -60
- package/dist/core/subagents/native_subagent_runtime.js +37 -13
- package/dist/core/subagents/native_subagent_runtime.js.map +1 -1
- package/dist/core/subagents/prompt.js.map +1 -1
- package/dist/core/subagents/registry.js +1 -0
- package/dist/core/subagents/registry.js.map +1 -1
- package/dist/core/subagents/runtime.js.map +1 -1
- package/dist/core/subagents/types.js +2 -1
- package/dist/core/subagents/types.js.map +1 -1
- package/dist/core/telegram/adapter.js +178 -61
- package/dist/core/telegram/adapter.js.map +1 -1
- package/dist/core/telegram/cli.js +1 -3
- package/dist/core/telegram/cli.js.map +1 -1
- package/dist/core/telegram/config.js +3 -1
- package/dist/core/telegram/config.js.map +1 -1
- package/dist/core/telegram/runtime.js +1 -1
- package/dist/core/telegram/runtime.js.map +1 -1
- package/dist/core/tool/cli.js +1 -1
- package/dist/core/tool/image_generate.js +6 -2
- package/dist/core/tool/image_generate.js.map +1 -1
- package/dist/core/tools/catalog.js +24 -14
- package/dist/core/tools/catalog.js.map +1 -1
- package/dist/core/tools/wait_for_agents.js.map +1 -1
- package/dist/core/utils/scribe_transcription.js +283 -0
- package/dist/core/utils/scribe_transcription.js.map +1 -0
- package/dist/core/utils/speech_cleanup.js +198 -0
- package/dist/core/utils/speech_cleanup.js.map +1 -0
- package/dist/core/utils/speech_to_text.js +3 -3
- package/dist/core/utils/speech_to_text_keywords.js +5 -4
- package/dist/core/utils/speech_to_text_keywords.js.map +1 -1
- package/dist/core/version.js +1 -1
- package/dist/diff_tool/app/dist/assets/andromeeda-DW8vo71h.js +1 -0
- package/dist/diff_tool/app/dist/assets/aurora-x-rMvKqtYI.js +1 -0
- package/dist/diff_tool/app/dist/assets/ayu-dark-CwczpL8O.js +1 -0
- package/dist/diff_tool/app/dist/assets/ayu-light-DSh22xiD.js +1 -0
- package/dist/diff_tool/app/dist/assets/ayu-mirage-JE6hAyHG.js +1 -0
- package/dist/diff_tool/app/dist/assets/catppuccin-frappe-pyXErRRU.js +1 -0
- package/dist/diff_tool/app/dist/assets/catppuccin-latte-BILSUICr.js +1 -0
- package/dist/diff_tool/app/dist/assets/catppuccin-macchiato-Ck60ZZQE.js +1 -0
- package/dist/diff_tool/app/dist/assets/catppuccin-mocha-C_2G67cS.js +1 -0
- package/dist/diff_tool/app/dist/assets/{core-3PFMkRLP.js → core-Cnp6wBC7.js} +1 -1
- package/dist/diff_tool/app/dist/assets/dark-plus-CHgc6GYj.js +1 -0
- package/dist/diff_tool/app/dist/assets/dracula-Cf1PG3MT.js +1 -0
- package/dist/diff_tool/app/dist/assets/dracula-soft-DXuNm1Kq.js +1 -0
- package/dist/diff_tool/app/dist/assets/engine-oniguruma-ConHyUk6.js +1 -0
- package/dist/diff_tool/app/dist/assets/everforest-dark-CjdfwUBe.js +1 -0
- package/dist/diff_tool/app/dist/assets/everforest-light-CfVwwCBP.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-dark-BL6HSl_n.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-dark-default-zacuWV-M.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-dark-dimmed-Mc0P9idi.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-dark-high-contrast-IMKX2AVF.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-light-default-DVlCqP3X.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-light-high-contrast-Dj6zTyWR.js +1 -0
- package/dist/diff_tool/app/dist/assets/github-light-mYhEBkPo.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-hard-QTgQQZn-.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-medium-9d5YdCTx.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-soft-XCkqeBhR.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-light-hard--5-nXqNp.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-light-medium-COA1PZW2.js +1 -0
- package/dist/diff_tool/app/dist/assets/gruvbox-light-soft-CIJpzjAO.js +1 -0
- package/dist/diff_tool/app/dist/assets/highlights-DeO0fGqQ.js +7 -0
- package/dist/diff_tool/app/dist/assets/horizon-Ba2cwkSy.js +1 -0
- package/dist/diff_tool/app/dist/assets/horizon-bright-DaEDgBmR.js +1 -0
- package/dist/diff_tool/app/dist/assets/houston-B6x0XVpU.js +1 -0
- package/dist/diff_tool/app/dist/assets/index-BDuQ2wXS.js +221 -0
- package/dist/diff_tool/app/dist/assets/kanagawa-dragon-DhTFvBMT.js +1 -0
- package/dist/diff_tool/app/dist/assets/kanagawa-lotus--m8sdOxn.js +1 -0
- package/dist/diff_tool/app/dist/assets/kanagawa-wave-D-tTv4k2.js +1 -0
- package/dist/diff_tool/app/dist/assets/langs-DDFHLNuJ.js +1 -0
- package/dist/diff_tool/app/dist/assets/laserwave-HSLx0L75.js +1 -0
- package/dist/diff_tool/app/dist/assets/light-plus-CUjWrTSi.js +1 -0
- package/dist/diff_tool/app/dist/assets/loader-DrwOwtvp.js +1 -0
- package/dist/diff_tool/app/dist/assets/material-theme-CnthUGfg.js +1 -0
- package/dist/diff_tool/app/dist/assets/material-theme-darker-DUi03Qre.js +1 -0
- package/dist/diff_tool/app/dist/assets/material-theme-lighter-D2-qr5Vw.js +1 -0
- package/dist/diff_tool/app/dist/assets/material-theme-ocean-CWR-LogA.js +1 -0
- package/dist/diff_tool/app/dist/assets/material-theme-palenight-Cnv8m1ra.js +1 -0
- package/dist/diff_tool/app/dist/assets/min-dark-EXoM-6Xo.js +1 -0
- package/dist/diff_tool/app/dist/assets/min-light-DVOTDhnA.js +1 -0
- package/dist/diff_tool/app/dist/assets/monokai-DkggTbGy.js +1 -0
- package/dist/diff_tool/app/dist/assets/night-owl-Bdcs0PMi.js +1 -0
- package/dist/diff_tool/app/dist/assets/night-owl-light-RoU30LE0.js +1 -0
- package/dist/diff_tool/app/dist/assets/nord-u7hMircQ.js +1 -0
- package/dist/diff_tool/app/dist/assets/one-dark-pro-08PdtLzi.js +1 -0
- package/dist/diff_tool/app/dist/assets/one-light-DgvUEtgI.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-dark-B2jZWvHG.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-dark-protanopia-deuteranopia-CebgQdRf.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-dark-soft-DdE7dyP3.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-dark-tritanopia-CXimiT7X.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-dark-vibrant-DzBsxHvQ.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-light-Vf__O3ev.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-light-protanopia-deuteranopia-BUtWcCQC.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-light-soft-C3QCXKvN.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-light-tritanopia-CKLy6XvA.js +1 -0
- package/dist/diff_tool/app/dist/assets/pierre-light-vibrant-DDuTEIhH.js +1 -0
- package/dist/diff_tool/app/dist/assets/plastic-B8mE6BxX.js +1 -0
- package/dist/diff_tool/app/dist/assets/poimandres-DUFjrgxT.js +1 -0
- package/dist/diff_tool/app/dist/assets/{preload-helper-CRzLMJPS.js → preload-helper-DclECHGd.js} +1 -1
- package/dist/diff_tool/app/dist/assets/red-BJvdDEUx.js +1 -0
- package/dist/diff_tool/app/dist/assets/rose-pine-BSqRqUae.js +1 -0
- package/dist/diff_tool/app/dist/assets/rose-pine-dawn-U6TBE82u.js +1 -0
- package/dist/diff_tool/app/dist/assets/rose-pine-moon-CAU7u1h4.js +1 -0
- package/dist/diff_tool/app/dist/assets/{shiki-BArE1NVK.js → shiki-CwKGJZFi.js} +2 -2
- package/dist/diff_tool/app/dist/assets/slack-dark-CMu0smFa.js +1 -0
- package/dist/diff_tool/app/dist/assets/slack-ochin-BBne7cjw.js +1 -0
- package/dist/diff_tool/app/dist/assets/snazzy-light-CV8HUEmk.js +1 -0
- package/dist/diff_tool/app/dist/assets/solarized-dark-CmYmhSgI.js +1 -0
- package/dist/diff_tool/app/dist/assets/solarized-light-CjLLwxRp.js +1 -0
- package/dist/diff_tool/app/dist/assets/{stream-tokenizer-DFTZfQ1S.js → stream-tokenizer-D4-m26wx.js} +1 -1
- package/dist/diff_tool/app/dist/assets/synthwave-84-wQeDKbzQ.js +1 -0
- package/dist/diff_tool/app/dist/assets/{themes-Dzo-2cM5.js → themes-Do3waJhf.js} +2 -2
- package/dist/diff_tool/app/dist/assets/tokyo-night-D4ZgDiA7.js +1 -0
- package/dist/diff_tool/app/dist/assets/vesper-sUHevyKv.js +1 -0
- package/dist/diff_tool/app/dist/assets/vitesse-black-CfklMpOb.js +1 -0
- package/dist/diff_tool/app/dist/assets/vitesse-dark-CJkzwmKT.js +1 -0
- package/dist/diff_tool/app/dist/assets/vitesse-light-BxMp8E1Y.js +1 -0
- package/dist/diff_tool/app/dist/index.html +2 -2
- package/dist/history/worker/index.js +77 -51
- package/dist/history/worker/index.js.map +1 -1
- package/dist/history/worker/migrations/0003_digest_schedule.sql +36 -0
- package/dist/history/worker/migrations/0004_recent_sessions.sql +1 -0
- package/dist/host/local_session_host.js +233 -125
- package/dist/host/local_session_host.js.map +1 -1
- package/dist/host/session_host.js +2 -0
- package/dist/host/session_host.js.map +1 -1
- package/dist/host/session_protocol_handler.js +11 -1
- package/dist/host/session_protocol_handler.js.map +1 -1
- package/dist/protocol/session_protocol.d.ts +18 -1
- package/dist/protocol/session_protocol.js +27 -0
- package/dist/protocol/session_protocol.js.map +1 -1
- package/dist/sdk/session.js +12 -0
- package/dist/sdk/session.js.map +1 -1
- package/dist/sdk/types.d.ts +6 -0
- package/dist/store/session_snapshot_migrations.js +35 -1
- package/dist/store/session_snapshot_migrations.js.map +1 -1
- package/dist/tui/chat_view.js +3 -1
- package/dist/tui/chat_view.js.map +1 -1
- package/dist/tui/listen_capture.js +7 -5
- package/dist/tui/listen_capture.js.map +1 -1
- package/dist/tui/session_chat_controller.js +93 -15
- package/dist/tui/session_chat_controller.js.map +1 -1
- package/dist/tui/ui/custom_editor.js +3 -0
- package/dist/tui/ui/custom_editor.js.map +1 -1
- package/dist/tui/ui/subagent_panel.js +45 -14
- package/dist/tui/ui/subagent_panel.js.map +1 -1
- package/package.json +8 -7
- package/dist/core/utils/gemini_transcription.js +0 -566
- package/dist/core/utils/gemini_transcription.js.map +0 -1
- package/dist/diff_tool/app/dist/assets/andromeeda-BJLMrMlp.js +0 -1
- package/dist/diff_tool/app/dist/assets/aurora-x-BCChoRpm.js +0 -1
- package/dist/diff_tool/app/dist/assets/ayu-dark-DzFZPuMV.js +0 -1
- package/dist/diff_tool/app/dist/assets/ayu-light-DSkcX_XD.js +0 -1
- package/dist/diff_tool/app/dist/assets/ayu-mirage-DSve0zuE.js +0 -1
- package/dist/diff_tool/app/dist/assets/catppuccin-frappe-DbLkF0J2.js +0 -1
- package/dist/diff_tool/app/dist/assets/catppuccin-latte-b6208YQK.js +0 -1
- package/dist/diff_tool/app/dist/assets/catppuccin-macchiato-CNNBbV1L.js +0 -1
- package/dist/diff_tool/app/dist/assets/catppuccin-mocha-DHkNF0Mp.js +0 -1
- package/dist/diff_tool/app/dist/assets/dark-plus-BVZ_4wTZ.js +0 -1
- package/dist/diff_tool/app/dist/assets/dracula-BoZgXveB.js +0 -1
- package/dist/diff_tool/app/dist/assets/dracula-soft-D-Kgh5gw.js +0 -1
- package/dist/diff_tool/app/dist/assets/engine-oniguruma-C5P09Ghe.js +0 -1
- package/dist/diff_tool/app/dist/assets/everforest-dark-Y6tr-2zD.js +0 -1
- package/dist/diff_tool/app/dist/assets/everforest-light-CA0Ol4Qu.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-dark-C895GGrm.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-dark-default-CM8LCIj6.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-dark-dimmed-jPx1V1fR.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-dark-high-contrast-UN5YjL_Z.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-light-B4HDwToD.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-light-default-CfC59JYV.js +0 -1
- package/dist/diff_tool/app/dist/assets/github-light-high-contrast-C3edEHcK.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-hard-BdGOuxq8.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-medium-CmygtSMi.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-dark-soft-BJH4XuY9.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-light-hard-BkSILF4E.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-light-medium-DiZUfgdz.js +0 -1
- package/dist/diff_tool/app/dist/assets/gruvbox-light-soft-CRCTnbIj.js +0 -1
- package/dist/diff_tool/app/dist/assets/highlights-Bi-VwGCO.js +0 -3
- package/dist/diff_tool/app/dist/assets/horizon-DUI96lQn.js +0 -1
- package/dist/diff_tool/app/dist/assets/horizon-bright-COxh1lHf.js +0 -1
- package/dist/diff_tool/app/dist/assets/houston-DduE73P7.js +0 -1
- package/dist/diff_tool/app/dist/assets/index-DhaXI7F3.js +0 -221
- package/dist/diff_tool/app/dist/assets/kanagawa-dragon-BHDhSKDf.js +0 -1
- package/dist/diff_tool/app/dist/assets/kanagawa-lotus-NJjGXXql.js +0 -1
- package/dist/diff_tool/app/dist/assets/kanagawa-wave-DsGe2Uqk.js +0 -1
- package/dist/diff_tool/app/dist/assets/langs-CDbZNx2R.js +0 -1
- package/dist/diff_tool/app/dist/assets/laserwave-DYV0fvJ_.js +0 -1
- package/dist/diff_tool/app/dist/assets/light-plus-FTnIShls.js +0 -1
- package/dist/diff_tool/app/dist/assets/loader-DYYMIDWx.js +0 -1
- package/dist/diff_tool/app/dist/assets/material-theme-IcIb8QNx.js +0 -1
- package/dist/diff_tool/app/dist/assets/material-theme-darker-B_f2vxdL.js +0 -1
- package/dist/diff_tool/app/dist/assets/material-theme-lighter-CR2Q-4Hp.js +0 -1
- package/dist/diff_tool/app/dist/assets/material-theme-ocean-BX6hAJ_y.js +0 -1
- package/dist/diff_tool/app/dist/assets/material-theme-palenight-B6DWAotd.js +0 -1
- package/dist/diff_tool/app/dist/assets/min-dark-DECtZcqS.js +0 -1
- package/dist/diff_tool/app/dist/assets/min-light-qRIVcaqf.js +0 -1
- package/dist/diff_tool/app/dist/assets/monokai-CLmrJ-8t.js +0 -1
- package/dist/diff_tool/app/dist/assets/night-owl-eR4AsyAP.js +0 -1
- package/dist/diff_tool/app/dist/assets/night-owl-light-C74n5ti-.js +0 -1
- package/dist/diff_tool/app/dist/assets/nord-D4wy7NEP.js +0 -1
- package/dist/diff_tool/app/dist/assets/one-dark-pro-28TLzoS8.js +0 -1
- package/dist/diff_tool/app/dist/assets/one-light-C0UY_Fh7.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-dark-fPlffE7i.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-dark-protanopia-deuteranopia-BmjibgrW.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-dark-soft-Cng2SYKc.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-dark-tritanopia-DneQ5i7L.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-dark-vibrant-BUK9Y-N_.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-light-BvcXQJIj.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-light-protanopia-deuteranopia-Cd5nk0bp.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-light-soft-BvU23vks.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-light-tritanopia-BSHccQzI.js +0 -1
- package/dist/diff_tool/app/dist/assets/pierre-light-vibrant-BgMZEwQI.js +0 -1
- package/dist/diff_tool/app/dist/assets/plastic-B2V_PDVk.js +0 -1
- package/dist/diff_tool/app/dist/assets/poimandres-DB9-pI6r.js +0 -1
- package/dist/diff_tool/app/dist/assets/red-CqYzoXtd.js +0 -1
- package/dist/diff_tool/app/dist/assets/rose-pine-C3zjVKxG.js +0 -1
- package/dist/diff_tool/app/dist/assets/rose-pine-dawn-C72QYfqa.js +0 -1
- package/dist/diff_tool/app/dist/assets/rose-pine-moon-CSM8ewhO.js +0 -1
- package/dist/diff_tool/app/dist/assets/slack-dark-Dtzi51su.js +0 -1
- package/dist/diff_tool/app/dist/assets/slack-ochin-Bb7oPExa.js +0 -1
- package/dist/diff_tool/app/dist/assets/snazzy-light-DXgiwzKu.js +0 -1
- package/dist/diff_tool/app/dist/assets/solarized-dark-BKOT3ICq.js +0 -1
- package/dist/diff_tool/app/dist/assets/solarized-light--Lk5pOfE.js +0 -1
- package/dist/diff_tool/app/dist/assets/synthwave-84-BJJFg-sc.js +0 -1
- package/dist/diff_tool/app/dist/assets/tokyo-night-DvpptEDd.js +0 -1
- package/dist/diff_tool/app/dist/assets/vesper-C1rBZbON.js +0 -1
- package/dist/diff_tool/app/dist/assets/vitesse-black-Sqvrs2Sw.js +0 -1
- package/dist/diff_tool/app/dist/assets/vitesse-dark-BWf_ZQtP.js +0 -1
- package/dist/diff_tool/app/dist/assets/vitesse-light-Cqenv4Qv.js +0 -1
|
@@ -10,19 +10,21 @@ import { getEffectiveAutoCompactThresholdTokens, } from "../core/session/auto_co
|
|
|
10
10
|
import { buildToolRunPresentation, TOOL_UI_FACET_VERSION } from "../core/tools/presentation.js";
|
|
11
11
|
import { appendUsageLogEntry, getUsageCostTotal, getUsageTotals, } from "../core/usage/logs.js";
|
|
12
12
|
import { filterProjectPathAutocompleteEntries, loadProjectPathAutocompleteEntriesWithBackend, } from "../core/utils/project_files.js";
|
|
13
|
-
import { applySessionProtocolDelta, createSessionProtocolDeltaMessage, createSessionProtocolEphemeralMessage, createSessionProtocolSubagentActivitiesMessage, parseAutoCompactThresholdTokens, parseSessionAttributes, projectSessionProtocolNoticePresentation, projectSessionProtocolSubagentActivity, SESSION_PROTOCOL_MAX_SUBAGENT_ACTIVITIES, } from "../protocol/session_protocol.js";
|
|
13
|
+
import { applySessionProtocolDelta, createSessionProtocolDeltaMessage, createSessionProtocolEphemeralMessage, createSessionProtocolSubagentActivitiesMessage, parseAutoCompactThresholdTokens, parseSessionAttributes, projectSessionProtocolNoticePresentation, projectSessionProtocolSubagentActivity, SESSION_PROTOCOL_MAX_RETENTION_MS, SESSION_PROTOCOL_MAX_SUBAGENT_ACTIVITIES, } from "../protocol/session_protocol.js";
|
|
14
14
|
import { isIntermediateSystemMessage, } from "../protocol/system_message.js";
|
|
15
15
|
import { LEGACY_SESSION_MODEL_CONTEXT_KEY } from "../store/session_snapshot_migrations.js";
|
|
16
16
|
import { ClientToolBroker } from "./client_tool_broker.js";
|
|
17
17
|
import { createExecutionEnvironmentSubagentPromptResolver } from "./execution_runtime.js";
|
|
18
18
|
import { HostedEphemeralAgentSession } from "./hosted_ephemeral_agent_session.js";
|
|
19
|
-
import { SessionExecBusyError, SessionRetryUnavailableError, } from "./session_host.js";
|
|
19
|
+
import { SessionExecBusyError, SessionRetryUnavailableError, SessionRuntimeNotLoadedError, } from "./session_host.js";
|
|
20
20
|
const PATH_AUTOCOMPLETE_CACHE_TTL_MS = 5_000;
|
|
21
21
|
const HISTORY_UNAVAILABLE_NOTICE_ID = "notice-history-unavailable";
|
|
22
22
|
export class LocalSessionHost {
|
|
23
23
|
sessions = new Set();
|
|
24
24
|
sessionReferences = new Map();
|
|
25
|
-
sessionEvictions = new
|
|
25
|
+
sessionEvictions = new Map();
|
|
26
|
+
disposalFailures = new Map();
|
|
27
|
+
retention = new Map();
|
|
26
28
|
sessionRecoveryPromises = new Map();
|
|
27
29
|
store;
|
|
28
30
|
history;
|
|
@@ -129,11 +131,20 @@ export class LocalSessionHost {
|
|
|
129
131
|
await hostedSession.dispose();
|
|
130
132
|
}
|
|
131
133
|
else {
|
|
132
|
-
await
|
|
134
|
+
await this.disposeRecoveredEnvironment(snapshot.sessionId, executionEnvironment);
|
|
133
135
|
}
|
|
134
136
|
throw error;
|
|
135
137
|
}
|
|
136
138
|
}
|
|
139
|
+
async disposeRecoveredEnvironment(sessionId, executionEnvironment) {
|
|
140
|
+
try {
|
|
141
|
+
await executionEnvironment.dispose();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
this.disposalFailures.set(sessionId, error);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
137
148
|
async createLocalSessionHandle(executionEnvironment, committedSnapshot, createParams, forceNextSnapshotRevision = false) {
|
|
138
149
|
const remoteCatalog = this.sessionOptions.getRemoteModelCatalog();
|
|
139
150
|
const bootstrap = await this.resolveSessionBootstrap(executionEnvironment, remoteCatalog, committedSnapshot !== undefined);
|
|
@@ -190,7 +201,7 @@ export class LocalSessionHost {
|
|
|
190
201
|
openSubagentHistory: (child) => {
|
|
191
202
|
const recorder = new AgentHistoryRecorder(this.history.openSession({
|
|
192
203
|
sessionId: child.sessionId,
|
|
193
|
-
parentSessionId:
|
|
204
|
+
parentSessionId: child.parentSessionId,
|
|
194
205
|
attributes: { ...attributes, cwd: child.workingDirectory },
|
|
195
206
|
createdAt: child.createdAt,
|
|
196
207
|
}, this.historyRemote));
|
|
@@ -214,7 +225,9 @@ export class LocalSessionHost {
|
|
|
214
225
|
? createParams.autoCompactThresholdTokens
|
|
215
226
|
: (bootstrap.initialAutoCompactThresholdTokens ?? null));
|
|
216
227
|
const historyWriter = this.history.openSession({ sessionId, attributes, createdAt }, this.historyRemote);
|
|
217
|
-
hostedSession = new LocalHostedSessionHandle(runtime, runtimeContext.promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, this.sessionOptions.getRemoteModelCatalog, this.sessionOptions.includeAgentContext, executionEnvironment, this.store, new AgentHistoryRecorder(historyWriter), attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, this.sessionOptions.recordUsage ?? appendUsageLogEntry, (session) => {
|
|
228
|
+
hostedSession = new LocalHostedSessionHandle(runtime, runtimeContext.promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, this.sessionOptions.getRemoteModelCatalog, this.sessionOptions.includeAgentContext, executionEnvironment, this.store, new AgentHistoryRecorder(historyWriter), attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, this.sessionOptions.recordUsage ?? appendUsageLogEntry, (session, error) => {
|
|
229
|
+
if (error)
|
|
230
|
+
this.disposalFailures.set(session.sessionId, error);
|
|
218
231
|
this.sessions.delete(session);
|
|
219
232
|
this.sessionReferences.delete(session);
|
|
220
233
|
});
|
|
@@ -268,11 +281,6 @@ export class LocalSessionHost {
|
|
|
268
281
|
if (liveSession) {
|
|
269
282
|
return this.retainSession(liveSession);
|
|
270
283
|
}
|
|
271
|
-
await this.refreshStore();
|
|
272
|
-
const refreshedLiveSession = this.findLiveSession(sessionId);
|
|
273
|
-
if (refreshedLiveSession) {
|
|
274
|
-
return this.retainSession(refreshedLiveSession);
|
|
275
|
-
}
|
|
276
284
|
const existingRecovery = this.sessionRecoveryPromises.get(sessionId);
|
|
277
285
|
if (existingRecovery) {
|
|
278
286
|
const recovered = await existingRecovery;
|
|
@@ -291,6 +299,7 @@ export class LocalSessionHost {
|
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
async recoverSession(sessionId) {
|
|
302
|
+
await this.refreshStore();
|
|
294
303
|
if (this.shuttingDown) {
|
|
295
304
|
return undefined;
|
|
296
305
|
}
|
|
@@ -304,12 +313,12 @@ export class LocalSessionHost {
|
|
|
304
313
|
}
|
|
305
314
|
const executionEnvironment = await this.sessionOptions.executionEnvironmentResolver.restore(snapshot.executionEnvironment);
|
|
306
315
|
if (this.shuttingDown) {
|
|
307
|
-
await
|
|
316
|
+
await this.disposeRecoveredEnvironment(sessionId, executionEnvironment);
|
|
308
317
|
return undefined;
|
|
309
318
|
}
|
|
310
319
|
const restoredLiveSession = this.findLiveSession(sessionId);
|
|
311
320
|
if (restoredLiveSession) {
|
|
312
|
-
await
|
|
321
|
+
await this.disposeRecoveredEnvironment(sessionId, executionEnvironment);
|
|
313
322
|
return restoredLiveSession;
|
|
314
323
|
}
|
|
315
324
|
return await this.createRecoveredSession(snapshot, executionEnvironment);
|
|
@@ -341,26 +350,99 @@ export class LocalSessionHost {
|
|
|
341
350
|
return;
|
|
342
351
|
}
|
|
343
352
|
this.sessionReferences.delete(hostedSession);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
353
|
+
this.scheduleEviction(hostedSession);
|
|
354
|
+
}
|
|
355
|
+
setRetention(sessionId, durationMs) {
|
|
356
|
+
this.assertHostActive();
|
|
357
|
+
if (durationMs !== null &&
|
|
358
|
+
(!Number.isInteger(durationMs) ||
|
|
359
|
+
durationMs < 1 ||
|
|
360
|
+
durationMs > SESSION_PROTOCOL_MAX_RETENTION_MS)) {
|
|
361
|
+
throw new Error("invalid retention duration");
|
|
362
|
+
}
|
|
363
|
+
const session = this.findLiveSession(sessionId);
|
|
364
|
+
if (!session) {
|
|
365
|
+
if (durationMs === null)
|
|
366
|
+
return { retainedUntil: null };
|
|
367
|
+
throw new SessionRuntimeNotLoadedError("session runtime is not loaded");
|
|
368
|
+
}
|
|
369
|
+
const previous = this.retention.get(session);
|
|
370
|
+
if (previous)
|
|
371
|
+
clearTimeout(previous.timer);
|
|
372
|
+
this.retention.delete(session);
|
|
373
|
+
if (durationMs === null) {
|
|
374
|
+
this.scheduleEviction(session);
|
|
375
|
+
return { retainedUntil: null };
|
|
376
|
+
}
|
|
377
|
+
const until = Date.now() + durationMs;
|
|
378
|
+
const timer = setTimeout(() => {
|
|
379
|
+
this.retention.delete(session);
|
|
380
|
+
this.scheduleEviction(session);
|
|
381
|
+
}, durationMs);
|
|
382
|
+
timer.unref();
|
|
383
|
+
this.retention.set(session, { until, timer });
|
|
384
|
+
return { retainedUntil: until };
|
|
385
|
+
}
|
|
386
|
+
async collectSession(sessionId) {
|
|
387
|
+
this.assertHostActive();
|
|
388
|
+
if (this.sessionRecoveryPromises.has(sessionId))
|
|
389
|
+
return { disposed: false };
|
|
390
|
+
const session = this.findLiveSession(sessionId);
|
|
391
|
+
if (session) {
|
|
392
|
+
if (this.isHeld(session) || session.hasActiveWork)
|
|
393
|
+
return { disposed: false };
|
|
394
|
+
this.scheduleEviction(session);
|
|
395
|
+
}
|
|
396
|
+
while (true) {
|
|
397
|
+
const evictions = [...this.sessionEvictions]
|
|
398
|
+
.filter(([candidate]) => candidate.sessionId === sessionId)
|
|
399
|
+
.map(([, promise]) => promise);
|
|
400
|
+
if (evictions.length === 0)
|
|
401
|
+
break;
|
|
402
|
+
await Promise.all(evictions);
|
|
403
|
+
}
|
|
404
|
+
if (this.disposalFailures.has(sessionId))
|
|
405
|
+
throw this.disposalFailures.get(sessionId);
|
|
406
|
+
return {
|
|
407
|
+
disposed: !this.findLiveSession(sessionId) && !this.sessionRecoveryPromises.has(sessionId),
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
isHeld(session) {
|
|
411
|
+
return ((this.sessionReferences.get(session) ?? 0) > 0 ||
|
|
412
|
+
(this.retention.get(session)?.until ?? 0) > Date.now());
|
|
413
|
+
}
|
|
414
|
+
scheduleEviction(session) {
|
|
415
|
+
if (this.sessionEvictions.has(session) || this.isHeld(session) || this.shuttingDown)
|
|
416
|
+
return;
|
|
417
|
+
const eviction = this.evictReleasedSession(session);
|
|
418
|
+
this.sessionEvictions.set(session, eviction);
|
|
419
|
+
void eviction.then(() => {
|
|
420
|
+
this.sessionEvictions.delete(session);
|
|
421
|
+
if (this.sessions.has(session) && !session.isDisposed)
|
|
422
|
+
this.scheduleEviction(session);
|
|
423
|
+
}, () => this.sessionEvictions.delete(session));
|
|
347
424
|
}
|
|
348
425
|
async evictReleasedSession(session) {
|
|
349
|
-
|
|
350
|
-
await session.waitForActiveWork().catch(() => undefined);
|
|
426
|
+
while (true) {
|
|
351
427
|
await session.runtime.jobs.waitForIdle();
|
|
428
|
+
await session.runtime.supervisor.waitForIdle();
|
|
352
429
|
await session.waitForActiveWork().catch(() => undefined);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
430
|
+
if (this.shuttingDown || session.isDisposed || this.isHeld(session))
|
|
431
|
+
return;
|
|
432
|
+
if (session.hasActiveWork)
|
|
433
|
+
continue;
|
|
434
|
+
await session.snapshot();
|
|
435
|
+
if (this.shuttingDown || session.isDisposed || this.isHeld(session))
|
|
436
|
+
return;
|
|
437
|
+
if (!session.hasActiveWork)
|
|
438
|
+
break;
|
|
356
439
|
}
|
|
357
|
-
await session.snapshot();
|
|
358
|
-
if (this.shuttingDown || (this.sessionReferences.get(session) ?? 0) > 0)
|
|
359
|
-
return;
|
|
360
|
-
if (session.runtime.jobs.hasRunning)
|
|
361
|
-
return await this.evictReleasedSession(session);
|
|
362
440
|
this.sessions.delete(session);
|
|
363
441
|
this.sessionReferences.delete(session);
|
|
442
|
+
const retention = this.retention.get(session);
|
|
443
|
+
if (retention)
|
|
444
|
+
clearTimeout(retention.timer);
|
|
445
|
+
this.retention.delete(session);
|
|
364
446
|
await session.dispose();
|
|
365
447
|
}
|
|
366
448
|
async listSessions() {
|
|
@@ -383,6 +465,9 @@ export class LocalSessionHost {
|
|
|
383
465
|
return await this.shutdownPromise;
|
|
384
466
|
}
|
|
385
467
|
async shutdownNow() {
|
|
468
|
+
for (const hold of this.retention.values())
|
|
469
|
+
clearTimeout(hold.timer);
|
|
470
|
+
this.retention.clear();
|
|
386
471
|
const errors = [];
|
|
387
472
|
const resourceShutdown = this.onShutdown
|
|
388
473
|
? Promise.resolve()
|
|
@@ -422,13 +507,14 @@ export class LocalSessionHost {
|
|
|
422
507
|
}
|
|
423
508
|
this.sessions.clear();
|
|
424
509
|
this.sessionReferences.clear();
|
|
425
|
-
const evictionResults = await Promise.allSettled(this.sessionEvictions);
|
|
510
|
+
const evictionResults = await Promise.allSettled(this.sessionEvictions.values());
|
|
426
511
|
for (const result of evictionResults) {
|
|
427
512
|
if (result.status === "rejected") {
|
|
428
513
|
errors.push(result.reason);
|
|
429
514
|
}
|
|
430
515
|
}
|
|
431
516
|
this.sessionEvictions.clear();
|
|
517
|
+
errors.push(...this.disposalFailures.values());
|
|
432
518
|
try {
|
|
433
519
|
await this.history.flush();
|
|
434
520
|
}
|
|
@@ -443,7 +529,7 @@ export class LocalSessionHost {
|
|
|
443
529
|
}
|
|
444
530
|
await resourceShutdown;
|
|
445
531
|
if (errors.length > 0) {
|
|
446
|
-
throw new AggregateError(errors, "failed to shut down local session host");
|
|
532
|
+
throw new AggregateError([...new Set(errors)], "failed to shut down local session host");
|
|
447
533
|
}
|
|
448
534
|
}
|
|
449
535
|
async refreshStore() {
|
|
@@ -518,7 +604,7 @@ class LocalHostedSessionHandle {
|
|
|
518
604
|
forceNextSnapshotRevision;
|
|
519
605
|
projectionFailure;
|
|
520
606
|
disposed = false;
|
|
521
|
-
constructor(runtime, promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, getLatestRemoteModelCatalog, includeAgentContext, executionEnvironment, store, historyRecorder, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, recordUsage, removeFromHost
|
|
607
|
+
constructor(runtime, promptBootstrap, catalog, mcp, bootstrap, remoteCatalog, getLatestRemoteModelCatalog, includeAgentContext, executionEnvironment, store, historyRecorder, attributes, createdAt, committedSnapshot, forceNextSnapshotRevision, recordUsage, removeFromHost) {
|
|
522
608
|
this.runtime = runtime;
|
|
523
609
|
this.promptBootstrap = promptBootstrap;
|
|
524
610
|
this.catalog = catalog;
|
|
@@ -545,6 +631,13 @@ class LocalHostedSessionHandle {
|
|
|
545
631
|
? cloneSessionProtocolSnapshot(committedSnapshot)
|
|
546
632
|
: { ...this.buildSnapshotDraft(), revision: 1 };
|
|
547
633
|
}
|
|
634
|
+
get hasActiveWork() {
|
|
635
|
+
return (Boolean(this.activeTurnPromise) ||
|
|
636
|
+
this.activeWorkPromises.size > 0 ||
|
|
637
|
+
this.runtime.isTurnRunning ||
|
|
638
|
+
this.runtime.jobs.hasRunning ||
|
|
639
|
+
this.runtime.supervisor.getActiveCount() > 0);
|
|
640
|
+
}
|
|
548
641
|
get isTurnRunning() {
|
|
549
642
|
return this.runtime.isTurnRunning;
|
|
550
643
|
}
|
|
@@ -862,106 +955,114 @@ class LocalHostedSessionHandle {
|
|
|
862
955
|
}
|
|
863
956
|
async setPersona(personaId, overrides) {
|
|
864
957
|
this.assertActive();
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
this.
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
958
|
+
return await this.trackActiveWork(async () => {
|
|
959
|
+
const runtimeConfig = await this.executionEnvironment.resolveRuntimeConfig(this.executionEnvironment.snapshot().cwd, { remoteCatalog: this.remoteCatalog });
|
|
960
|
+
const personas = runtimeConfig.personas.map(clonePersona);
|
|
961
|
+
const selectedPersona = resolvePersonaSelection(personas, runtimeConfig.config.defaultPersona, personaId, overrides);
|
|
962
|
+
const runtimeContext = await this.executionEnvironment.resolveRuntimeContext({
|
|
963
|
+
cwd: this.executionEnvironment.snapshot().cwd,
|
|
964
|
+
discoveredSkills: runtimeConfig.skills,
|
|
965
|
+
includeAgentContext: this.includeAgentContext,
|
|
966
|
+
});
|
|
967
|
+
return await this.enqueueConfigurationMutation(async () => {
|
|
968
|
+
this.runtime.setRuntimeConfig(runtimeConfig.config, runtimeConfig.bootstrap.modelResolver.resolveModel);
|
|
969
|
+
this.runtime.updatePromptContext(runtimeContext.promptBootstrap.promptContext);
|
|
970
|
+
this.runtime.setPersona(selectedPersona);
|
|
971
|
+
this.runtime.setAutoCompactThreshold(overrides?.autoCompactThresholdTokens ?? null);
|
|
972
|
+
this.bootstrap = {
|
|
973
|
+
persona: clonePersona(selectedPersona),
|
|
974
|
+
discoveredSkills: structuredClone(runtimeConfig.skills),
|
|
975
|
+
personas: personas.map(clonePersona),
|
|
976
|
+
prompts: structuredClone(runtimeConfig.prompts),
|
|
977
|
+
modelResolver: runtimeConfig.bootstrap.modelResolver.resolveModel,
|
|
978
|
+
config: runtimeConfig.config,
|
|
979
|
+
};
|
|
980
|
+
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.mcp);
|
|
981
|
+
const snapshot = await this.commitSnapshot();
|
|
982
|
+
this.emitSnapshotReset("configuration", snapshot);
|
|
983
|
+
return snapshot;
|
|
984
|
+
});
|
|
890
985
|
});
|
|
891
986
|
}
|
|
892
987
|
async reload() {
|
|
893
988
|
this.assertActive();
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
this.
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
989
|
+
return await this.trackActiveWork(async () => {
|
|
990
|
+
const remoteCatalog = this.getLatestRemoteModelCatalog();
|
|
991
|
+
const runtimeConfig = await this.executionEnvironment.resolveRuntimeConfig(this.executionEnvironment.snapshot().cwd, { remoteCatalog });
|
|
992
|
+
if (runtimeConfig.personas.length === 0) {
|
|
993
|
+
throw new Error("reload failed: no personas available");
|
|
994
|
+
}
|
|
995
|
+
const personas = runtimeConfig.personas.map(clonePersona);
|
|
996
|
+
const currentPersonaId = this.runtime.persona.id.toLowerCase();
|
|
997
|
+
const nextPersona = clonePersona(personas.find((persona) => persona.id.toLowerCase() === currentPersonaId) ?? personas[0]);
|
|
998
|
+
if (nextPersona.id.toLowerCase() === currentPersonaId) {
|
|
999
|
+
nextPersona.settings = structuredClone(this.runtime.persona.settings);
|
|
1000
|
+
}
|
|
1001
|
+
const runtimeContext = await this.executionEnvironment.resolveRuntimeContext({
|
|
1002
|
+
cwd: this.executionEnvironment.snapshot().cwd,
|
|
1003
|
+
discoveredSkills: runtimeConfig.skills,
|
|
1004
|
+
includeAgentContext: this.includeAgentContext,
|
|
1005
|
+
});
|
|
1006
|
+
return await this.enqueueConfigurationMutation(async () => {
|
|
1007
|
+
this.runtime.setRuntimeConfig(runtimeConfig.config, runtimeConfig.bootstrap.modelResolver.resolveModel);
|
|
1008
|
+
this.runtime.updatePromptContext(runtimeContext.promptBootstrap.promptContext);
|
|
1009
|
+
this.runtime.setPersona(nextPersona);
|
|
1010
|
+
this.remoteCatalog = remoteCatalog;
|
|
1011
|
+
this.bootstrap = {
|
|
1012
|
+
persona: clonePersona(nextPersona),
|
|
1013
|
+
discoveredSkills: structuredClone(runtimeConfig.skills),
|
|
1014
|
+
personas: personas.map(clonePersona),
|
|
1015
|
+
prompts: structuredClone(runtimeConfig.prompts),
|
|
1016
|
+
modelResolver: runtimeConfig.bootstrap.modelResolver.resolveModel,
|
|
1017
|
+
config: runtimeConfig.config,
|
|
1018
|
+
};
|
|
1019
|
+
this.catalog = createContentCatalogSnapshot(this.bootstrap, this.catalog.mcp);
|
|
1020
|
+
const snapshot = await this.commitSnapshot();
|
|
1021
|
+
this.emitSnapshotReset("configuration", snapshot);
|
|
1022
|
+
return {
|
|
1023
|
+
snapshot,
|
|
1024
|
+
warnings: [
|
|
1025
|
+
...runtimeConfig.warnings,
|
|
1026
|
+
...(this.catalog.mcp.status === "available" &&
|
|
1027
|
+
!isDeepStrictEqual(this.boundMcpServers, runtimeConfig.config.mcpServers)
|
|
1028
|
+
? [
|
|
1029
|
+
"MCP configuration changed; new definitions take effect after this session unloads and is opened again.",
|
|
1030
|
+
]
|
|
1031
|
+
: []),
|
|
1032
|
+
],
|
|
1033
|
+
counts: {
|
|
1034
|
+
personas: runtimeConfig.personas.length,
|
|
1035
|
+
prompts: runtimeConfig.prompts.length,
|
|
1036
|
+
skills: runtimeConfig.skills.length,
|
|
1037
|
+
},
|
|
1038
|
+
};
|
|
1039
|
+
});
|
|
943
1040
|
});
|
|
944
1041
|
}
|
|
945
1042
|
async resolvePrompt(promptId) {
|
|
946
1043
|
this.assertActive();
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1044
|
+
return await this.trackActiveWork(async () => {
|
|
1045
|
+
const executionSnapshot = this.executionEnvironment.snapshot();
|
|
1046
|
+
const prompt = await resolvePromptTemplateWithBackend({
|
|
1047
|
+
backend: this.executionEnvironment.getToolExecutionBackend(),
|
|
1048
|
+
cwd: executionSnapshot.cwd,
|
|
1049
|
+
home: executionSnapshot.home,
|
|
1050
|
+
promptId,
|
|
1051
|
+
});
|
|
1052
|
+
if (!prompt) {
|
|
1053
|
+
throw new Error(`unknown prompt '${promptId}'`);
|
|
1054
|
+
}
|
|
1055
|
+
return { promptId: prompt.id, text: prompt.template };
|
|
953
1056
|
});
|
|
954
|
-
if (!prompt) {
|
|
955
|
-
throw new Error(`unknown prompt '${promptId}'`);
|
|
956
|
-
}
|
|
957
|
-
return { promptId: prompt.id, text: prompt.template };
|
|
958
1057
|
}
|
|
959
1058
|
async autocompletePaths(options) {
|
|
960
1059
|
this.assertActive();
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1060
|
+
return await this.trackActiveWork(async () => {
|
|
1061
|
+
const entries = await this.getPathAutocompleteEntries();
|
|
1062
|
+
return {
|
|
1063
|
+
paths: filterProjectPathAutocompleteEntries(entries, options),
|
|
1064
|
+
};
|
|
1065
|
+
});
|
|
965
1066
|
}
|
|
966
1067
|
async getPathAutocompleteEntries() {
|
|
967
1068
|
const now = Date.now();
|
|
@@ -1025,13 +1126,20 @@ class LocalHostedSessionHandle {
|
|
|
1025
1126
|
? AbortSignal.any([externalSignal, abortController.signal])
|
|
1026
1127
|
: abortController.signal;
|
|
1027
1128
|
this.activeWorkAbortControllers.add(abortController);
|
|
1028
|
-
|
|
1129
|
+
try {
|
|
1130
|
+
return await this.trackActiveWork(() => operation(signal));
|
|
1131
|
+
}
|
|
1132
|
+
finally {
|
|
1133
|
+
this.activeWorkAbortControllers.delete(abortController);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
async trackActiveWork(operation) {
|
|
1137
|
+
const promise = operation();
|
|
1029
1138
|
this.activeWorkPromises.add(promise);
|
|
1030
1139
|
try {
|
|
1031
1140
|
return await promise;
|
|
1032
1141
|
}
|
|
1033
1142
|
finally {
|
|
1034
|
-
this.activeWorkAbortControllers.delete(abortController);
|
|
1035
1143
|
this.activeWorkPromises.delete(promise);
|
|
1036
1144
|
}
|
|
1037
1145
|
}
|
|
@@ -1194,12 +1302,12 @@ class LocalHostedSessionHandle {
|
|
|
1194
1302
|
catch (error) {
|
|
1195
1303
|
errors.push(error);
|
|
1196
1304
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1305
|
+
const error = errors.length > 0
|
|
1306
|
+
? new AggregateError(errors, "failed to dispose hosted session")
|
|
1307
|
+
: undefined;
|
|
1308
|
+
this.removeFromHost(this, error);
|
|
1309
|
+
if (error)
|
|
1310
|
+
throw error;
|
|
1203
1311
|
}
|
|
1204
1312
|
async commitSnapshot(options = {}) {
|
|
1205
1313
|
this.assertNotDisposed();
|