@pi-chamber/web 1.0.5 → 1.0.6-rc.1
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/assets/{DiagramView-CrKjR8CR.js → DiagramView-DUxXEKjQ.js} +1 -1
- package/dist/assets/DiffView-DEd3rdnu.js +18 -0
- package/dist/assets/FileSaveConflictDialog-C6o4fYIn.js +3 -0
- package/dist/assets/{FilesView-BRR3N7UA.js → FilesView-Ccl4CxjR.js} +3 -3
- package/dist/assets/{GitHubDetailScaffold-C1UHuETI.js → GitHubDetailScaffold-DlgVm5uD.js} +3 -3
- package/dist/assets/{GitHubLinkPicker-B0O3Vapu.js → GitHubLinkPicker-BgDZR-3K.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-DvQDU--z.js → GitHubListPrimitives-BTeI3B3C.js} +1 -1
- package/dist/assets/{GitView-wAscrRhO.js → GitView-BkrH0HFQ.js} +4 -4
- package/dist/assets/{IssuesSurface-mh50UUQ8.js → IssuesSurface-CD1m8BHP.js} +3 -3
- package/dist/assets/{JsonTreeView-BfErTllU.js → JsonTreeView-RLgBKik9.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-SXAK4uOu.js → MarkdownRendererImpl-BkfhE9NN.js} +2 -2
- package/dist/assets/{PatchDiff-CHr79sJ6.js → PatchDiff-BLNLrGYa.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CGpKcLro.js → PierreDiffViewer-iLnLAFeL.js} +3 -3
- package/dist/assets/PullRequestsSurface-_kgJMFTh.js +2 -0
- package/dist/assets/{SessionSwitcherContent-DEAw6v12.js → SessionSwitcherContent-BCOUKRch.js} +1 -1
- package/dist/assets/SessionSwitcherDropdown-CA64t2xd.js +2 -0
- package/dist/assets/SessionUnreadDot-BZy2DM6H.js +1 -0
- package/dist/assets/SettingsView-TwUy1kXV.js +6 -0
- package/dist/assets/{SettingsWindow-BiY5FmhZ.js → SettingsWindow-BXE4JP-T.js} +1 -1
- package/dist/assets/{StickyHorizontalScrollbar-BMITjK4e.js → StickyHorizontalScrollbar-p7EbL2-E.js} +2 -2
- package/dist/assets/{ToolOutputDialog-B3RRLhR3.js → ToolOutputDialog-tiXT-Xts.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-D9m_vrht.js → ToolPartDiffPreview-CylbiIKd.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-B8lhZGLu.js → VirtualizedFileDiff-Cccy1L8L.js} +4 -4
- package/dist/assets/{Virtualizer-DP6HbEeC.js → Virtualizer-DNJrJKVb.js} +1 -1
- package/dist/assets/{appThemeRegistry-gegrE2dq.js → appThemeRegistry-Ca8eGRB9.js} +1 -1
- package/dist/assets/{collapsible-9MJx4VhA.js → collapsible-0yfy07W2.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-Bjhk2CQS.js → computeVirtualFileMetrics-ydVGT2RY.js} +2 -2
- package/dist/assets/{contextFileOpenGuard-CsF5Boky.js → contextFileOpenGuard--7BLkncT.js} +1 -1
- package/dist/assets/{document-attachments-BslE4Ns7.js → document-attachments-CZl9rK1z.js} +5 -5
- package/dist/assets/{gitStatusPredicates-B3Zxud6E.js → gitStatusPredicates-BzR54iPh.js} +1 -1
- package/dist/assets/{githubLink-CbGYxsIq.js → githubLink-WO5BkC0U.js} +5 -5
- package/dist/assets/{index-D4n3TVp2.js → index-C2ISrmRR.js} +10 -10
- package/dist/assets/index-DgwThEwf.css +1 -0
- package/dist/assets/index-nOAE6UDy.js +1 -0
- package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
- package/dist/assets/main-B4UP1bOp.js +2 -0
- package/dist/assets/main-DxYfmK5D.js +137 -0
- package/dist/assets/{markdown-shiki.worker-DnvH1S1x.js → markdown-shiki.worker-BVA5NZBT.js} +5 -5
- package/dist/assets/markdownCore-DIn2dwA6.js +2 -0
- package/dist/assets/miniChat-CMGH4R_p.js +2 -0
- package/dist/assets/mobile-BJz0lBjK.js +2 -0
- package/dist/assets/{nativeFileSave-BJsGPh58.js → nativeFileSave-Bhafll_7.js} +1 -1
- package/dist/assets/nsis-LY0VT_u5.js +1 -0
- package/dist/assets/permissionStore-zIpxq9Pq.js +1 -0
- package/dist/assets/pi-session-focus-preference-D6vrJGbH.js +9 -0
- package/dist/assets/{registerCustomTheme-DmolaWWZ.js → registerCustomTheme-C-h6lsYW.js} +1 -1
- package/dist/assets/{renderDiffWithHighlighter-BhMEWmHn.js → renderDiffWithHighlighter-JwKOWdBN.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-DYdkuv5N.js +2 -0
- package/dist/assets/{renderFileWithHighlighter-DUGluXlw.js → renderFileWithHighlighter-RJTrDxFH.js} +1 -1
- package/dist/assets/renderMobileApp-x1P9U65-.js +11 -0
- package/dist/assets/ruby-BK5aLJev.js +1 -0
- package/dist/assets/runtimeEndpointReset-OqTh3bbO.js +62 -0
- package/dist/assets/runtimeSurface-CJN1oo_1.js +1 -0
- package/dist/assets/themeResolver-DrfmQi8i.js +1 -0
- package/dist/assets/useAppFontEffects-CHnpTOtc.js +215 -0
- package/dist/assets/useFilesViewSearch-DeVixiGZ.js +7 -0
- package/dist/assets/{useGitHubRemoteSearch-DYoLQ4ro.js → useGitHubRemoteSearch-GjQca1iD.js} +1 -1
- package/dist/assets/{useSwitcherItems-BS6E199F.js → useSwitcherItems-DYtnl0T2.js} +1 -1
- package/dist/assets/vendor-aparajita-capacitor-secure-storage-BLsm9T1Y.js +1 -0
- package/dist/assets/vendor-base-ui-C7vVMZTg.js +1 -0
- package/dist/assets/{vendor-beautiful-mermaid-DApbjBp2.js → vendor-beautiful-mermaid-b48gT2g0.js} +1 -1
- package/dist/assets/vendor-boot-CoTxysn6.js +65 -0
- package/dist/assets/{vendor-capacitor-app-BaupizkW.js → vendor-capacitor-app-NX6DULfp.js} +1 -1
- package/dist/assets/{vendor-capacitor-keyboard-9BVxykO7.js → vendor-capacitor-keyboard-DJD81I9f.js} +1 -1
- package/dist/assets/{vendor-capacitor-status-bar-BsrUwiaA.js → vendor-capacitor-status-bar-DV24OoQV.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-qsuH4Dh-.js +1 -0
- package/dist/assets/vendor-codemirror-lang-angular-ZHWyBf7j.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-pCTOmv-k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-2bFuyM70.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-go-Crwca_X7.js → vendor-codemirror-lang-go-DrG_c7D7.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-html-BV8lrR8v.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-DrsvH6T2.js +1 -0
- package/dist/assets/vendor-codemirror-lang-javascript-Dkzl3s07.js +13 -0
- package/dist/assets/vendor-codemirror-lang-jinja-8Nn3bnoP.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-CsdmtHhi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-DJuZ4cZe.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-D2RO-Pzr.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-C0Zu3b3n.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-CuDtt2Zj.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-Cv2exx_M.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-C4TxJ6Rg.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-BmtPz8kf.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-B0f-qCZo.js → vendor-codemirror-lang-sql-BF1ZaXqJ.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-DZgXrP2k.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-DsnaGtL_.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-D8DzzFat.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-D5hBv7m6.js +1 -0
- package/dist/assets/{vendor-codemirror-language-data-CqU7kHmg.js → vendor-codemirror-language-data-vn2RyN9T.js} +2 -2
- package/dist/assets/vendor-codemirror-search-BVCYIV0D.js +2 -0
- package/dist/assets/vendor-dompurify-BGCr_sdL.js +3 -0
- package/dist/assets/vendor-elkjs-D1S1RCAO.js +24 -0
- package/dist/assets/vendor-fuse.js-t_7AcMTv.js +1 -0
- package/dist/assets/{vendor-hast-util-to-html-BKBhbTDb.js → vendor-hast-util-to-html-O3stl53j.js} +1 -1
- package/dist/assets/{vendor-heic2any-pq-UTQQR.js → vendor-heic2any-sztndhZI.js} +1 -1
- package/dist/assets/vendor-lezer-cpp-vqXSn3lv.js +1 -0
- package/dist/assets/vendor-lezer-css-JnEzSyZR.js +1 -0
- package/dist/assets/{vendor-lezer-go-CHIhCNY6.js → vendor-lezer-go-dD2gQMIL.js} +1 -1
- package/dist/assets/{vendor-lezer-html-B3h0MOrG.js → vendor-lezer-html-Cr3U-1pu.js} +1 -1
- package/dist/assets/vendor-lezer-java-CRM0IMCo.js +1 -0
- package/dist/assets/vendor-lezer-javascript-B3s21DIS.js +1 -0
- package/dist/assets/{vendor-lezer-json-BP_UAzLL.js → vendor-lezer-json-DPFM6EBV.js} +1 -1
- package/dist/assets/vendor-lezer-lr-Bllrq8hY.js +1 -0
- package/dist/assets/vendor-lezer-markdown-6-3PLvXG.js +6 -0
- package/dist/assets/vendor-lezer-php-DOyzfHRl.js +1 -0
- package/dist/assets/{vendor-lezer-python-EJ4Im4y2.js → vendor-lezer-python-CdHdN5qt.js} +1 -1
- package/dist/assets/vendor-lezer-rust-CqnW8EMH.js +1 -0
- package/dist/assets/{vendor-lezer-sass-CMi6zfXI.js → vendor-lezer-sass-BbcF4y6A.js} +1 -1
- package/dist/assets/{vendor-lezer-xml-0MHMeZDp.js → vendor-lezer-xml-C31AyWoo.js} +1 -1
- package/dist/assets/{vendor-lezer-yaml-BE2EFjpA.js → vendor-lezer-yaml-Cv908yC2.js} +1 -1
- package/dist/assets/{vendor-lru_map-DOPmc7GU.js → vendor-lru_map-BbiDqlyL.js} +1 -1
- package/dist/assets/vendor-marked-Be78pDn1.js +59 -0
- package/dist/assets/{vendor-oniguruma-parser-C0D4_9rT.js → vendor-oniguruma-parser-BrbMHgHx.js} +1 -1
- package/dist/assets/vendor-oniguruma-to-es-DgwFOwdE.js +94 -0
- package/dist/assets/{vendor-pierre-theming-Dgp7B_O4.js → vendor-pierre-theming-BO6EPniU.js} +1 -1
- package/dist/assets/vendor-property-information-C40bX6nM.js +1 -0
- package/dist/assets/{vendor-qrcode-Dv4uniC1.js → vendor-qrcode-gzL9QFkg.js} +5 -5
- package/dist/assets/vendor-react-Bz1tRBxM.js +1 -0
- package/dist/assets/{vendor-react-drawio-Duu5LgQA.js → vendor-react-drawio-IYnLUY5N.js} +1 -1
- package/dist/assets/vendor-remend-DcBOpbSu.js +24 -0
- package/dist/assets/vendor-replit-codemirror-vim-Cwhyn_5f.js +6 -0
- package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
- package/dist/assets/vendor-shiki-BEwTOAFg.js +1 -0
- package/dist/assets/{vendor-shikijs-core-CGM_jqPK.js → vendor-shikijs-core-Ck_OPM_T.js} +1 -1
- package/dist/assets/{vendor-shikijs-engine-javascript-Cme4830A.js → vendor-shikijs-engine-javascript-DL394yyj.js} +1 -1
- package/dist/assets/vendor-shikijs-vscode-textmate-DPFxvYtK.js +3 -0
- package/dist/assets/vendor-tailwind-merge-BKkUfl9q.js +1 -0
- package/dist/assets/vendor-workbox-window-BBnX5xw4.js +2 -0
- package/dist/assets/vendor-zumer-snapdom-SJzqoCHV.js +8 -0
- package/dist/assets/vendor-zustand-CXhN0IMY.js +6 -0
- package/dist/assets/{web-components-DzQ9ybbb.js → web-components-CIPJC1JE.js} +1 -1
- package/dist/assets/worker-CKCfxIfO.js +153 -0
- package/dist/assets/workerFactory-DlGfNFqf.js +1 -0
- package/dist/assets/zig-BB16gwVL.js +1 -0
- package/dist/index.html +8 -8
- package/dist/mini-chat.html +7 -7
- package/dist/mobile.html +7 -7
- package/package.json +54 -53
- package/server/index.js +18 -1
- package/server/lib/client-auth/live-revocation.test.js +4 -0
- package/server/lib/fs/DOCUMENTATION.md +10 -0
- package/server/lib/fs/project-icon.js +243 -0
- package/server/lib/fs/project-icon.test.js +114 -0
- package/server/lib/fs/routes.js +35 -0
- package/server/lib/fs/routes.test.js +74 -0
- package/server/lib/git/DOCUMENTATION.md +2 -1
- package/server/lib/git/routes.js +11 -3
- package/server/lib/git/routes.test.js +80 -0
- package/server/lib/git/service.js +38 -3
- package/server/lib/git/service.test.js +93 -0
- package/server/lib/open-url/DOCUMENTATION.md +35 -0
- package/server/lib/open-url/browser-env.js +199 -0
- package/server/lib/open-url/browser-env.test.js +147 -0
- package/server/lib/open-url/browser-handler.mjs +154 -0
- package/server/lib/open-url/browser-handler.test.js +69 -0
- package/server/lib/open-url/intake.js +187 -0
- package/server/lib/open-url/intake.test.js +75 -0
- package/server/lib/pi/extension-protocol.js +149 -0
- package/server/lib/pi/extension-protocol.test.js +20 -1
- package/server/lib/pi/routes.js +195 -1
- package/server/lib/pi/routes.test.js +129 -0
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +38 -10
- package/server/lib/pi/session-daemon/builtin-extensions.js +14 -4
- package/server/lib/pi/session-daemon/daemon-process.js +13 -0
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +6 -1
- package/server/lib/pi/session-daemon/extension-bridge.js +40 -6
- package/server/lib/pi/session-daemon/extension-custom-host.js +1259 -0
- package/server/lib/pi/session-daemon/extension-custom-host.test.js +759 -0
- package/server/lib/pi/session-daemon/extension-keybindings.js +21 -0
- package/server/lib/pi/session-daemon/extension-keybindings.test.js +37 -0
- package/server/lib/pi/session-daemon/extension-message-render.js +7 -4
- package/server/lib/pi/session-daemon/extension-message-render.test.js +14 -2
- package/server/lib/pi/session-daemon/extension-tool-render.js +7 -0
- package/server/lib/pi/session-daemon/extension-tool-render.test.js +26 -0
- package/server/lib/pi/session-daemon/open-request.js +60 -0
- package/server/lib/pi/session-daemon/open-request.test.js +54 -0
- package/server/lib/pi/session-daemon/prompt-preflight.test.js +134 -0
- package/server/lib/pi/session-daemon/sdk-upgrade.test.js +21 -4
- package/server/lib/pi/session-daemon/session-daemon-bash.e2e.test.js +225 -0
- package/server/lib/pi/session-daemon/session-daemon-directory-catalog.e2e.test.js +156 -0
- package/server/lib/pi/session-daemon/session-daemon-directory-catalog.test.js +381 -0
- package/server/lib/pi/session-daemon/session-daemon-engines.test.js +11 -2
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +30 -4
- package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +20 -0
- package/server/lib/pi/session-daemon/session-daemon-mcp.e2e.test.js +16 -4
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +7 -2
- package/server/lib/pi/session-daemon/session-daemon.js +448 -49
- package/server/lib/pi/session-daemon/session-daemon.test.js +91 -4
- package/server/lib/pi/session-daemon/session-engine-router.js +9 -3
- package/server/lib/pi/session-daemon/session-engine-router.test.js +12 -2
- package/server/lib/pi/session-daemon/session-engines.js +7 -2
- package/server/lib/pi/session-daemon/session-jsonl.js +170 -75
- package/server/lib/pi/session-daemon/session-jsonl.test.js +106 -2
- package/server/lib/pi/session-daemon/supervisor.js +4 -0
- package/server/lib/pi/session-daemon/user-bash.js +326 -0
- package/server/lib/pi/session-daemon/user-bash.test.js +371 -0
- package/server/lib/preview/proxy-runtime.js +140 -45
- package/server/lib/preview/proxy-runtime.test.js +174 -3
- package/server/lib/preview/proxy-runtime.websocket.test.js +89 -0
- package/server/lib/relay/tunnel-host.js +1 -0
- package/server/lib/security/request-security.js +37 -0
- package/server/lib/security/request-security.test.js +54 -0
- package/server/lib/security/server-network-host.js +107 -0
- package/server/lib/security/server-network-host.test.js +70 -0
- package/server/lib/server-browser/DOCUMENTATION.md +243 -0
- package/server/lib/server-browser/browser-tab.js +524 -0
- package/server/lib/server-browser/chrome-executable.js +138 -0
- package/server/lib/server-browser/chrome-launch.js +138 -0
- package/server/lib/server-browser/dev-servers.js +288 -0
- package/server/lib/server-browser/dev-servers.test.js +152 -0
- package/server/lib/server-browser/downloads.js +75 -0
- package/server/lib/server-browser/frame-policy.js +183 -0
- package/server/lib/server-browser/frame-policy.test.js +98 -0
- package/server/lib/server-browser/network-guard.js +235 -0
- package/server/lib/server-browser/page-scripts.js +209 -0
- package/server/lib/server-browser/runtime.integration.test.js +474 -0
- package/server/lib/server-browser/runtime.js +300 -0
- package/server/lib/server-browser/runtime.test.js +50 -0
- package/server/lib/server-browser/server-browser.js +431 -0
- package/server/lib/server-browser/server-browser.test.js +975 -0
- package/server/lib/server-browser/tab-input.js +241 -0
- package/server/lib/server-browser/tab-prompts.js +125 -0
- package/server/lib/server-browser/tab-stream.js +252 -0
- package/server/lib/server-browser/uploads.js +98 -0
- package/server/lib/stt/runtime.js +4 -1
- package/server/lib/stt/runtime.test.js +43 -0
- package/server/lib/terminal/runtime.js +4 -1
- package/server/lib/terminal/runtime.test.js +41 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +29 -1
- package/server/lib/ui-auth/ui-auth.js +1 -0
- package/server/lib/ui-auth/ui-auth.test.js +9 -1
- package/server/lib/workspace/host.js +20 -3
- package/dist/assets/DiffView-CSonR3pr.js +0 -18
- package/dist/assets/FileSaveConflictDialog-Cun0LIbj.js +0 -3
- package/dist/assets/PullRequestsSurface-CfaOpeZn.js +0 -2
- package/dist/assets/SessionSwitcherDropdown-BSutduo7.js +0 -2
- package/dist/assets/SessionUnreadDot-Dav_rix1.js +0 -1
- package/dist/assets/SettingsView-CQJkOPJh.js +0 -6
- package/dist/assets/abap-BdImnpbu.js +0 -1
- package/dist/assets/actionscript-3-CoDkCxhg.js +0 -1
- package/dist/assets/ada-bCR0ucgS.js +0 -1
- package/dist/assets/angular-html-CU67Zn6k.js +0 -1
- package/dist/assets/angular-ts-BwZT4LLn.js +0 -1
- package/dist/assets/apache-Pmp26Uib.js +0 -1
- package/dist/assets/apex-D8_7TLub.js +0 -1
- package/dist/assets/apl-dKokRX4l.js +0 -1
- package/dist/assets/applescript-Co6uUVPk.js +0 -1
- package/dist/assets/ara-BRHolxvo.js +0 -1
- package/dist/assets/asciidoc-Ve4PFQV2.js +0 -1
- package/dist/assets/asm-D_Q5rh1f.js +0 -1
- package/dist/assets/astro-CbQHKStN.js +0 -1
- package/dist/assets/awk-DMzUqQB5.js +0 -1
- package/dist/assets/ballerina-BFfxhgS-.js +0 -1
- package/dist/assets/bat-BkioyH1T.js +0 -1
- package/dist/assets/beancount-k_qm7-4y.js +0 -1
- package/dist/assets/berry-uYugtg8r.js +0 -1
- package/dist/assets/bibtex-CHM0blh-.js +0 -1
- package/dist/assets/bicep-Bmn6On1c.js +0 -1
- package/dist/assets/bird2-DPOp833l.js +0 -1
- package/dist/assets/blade-D4QpJJKB.js +0 -1
- package/dist/assets/bsl-BO_Y6i37.js +0 -1
- package/dist/assets/c-BIGW1oBm.js +0 -1
- package/dist/assets/c3-eo99z4R2.js +0 -1
- package/dist/assets/cadence-Bv_4Rxtq.js +0 -1
- package/dist/assets/cairo-KRGpt6FW.js +0 -1
- package/dist/assets/clarity-D53aC0YG.js +0 -1
- package/dist/assets/clojure-P80f7IUj.js +0 -1
- package/dist/assets/cmake-D1j8_8rp.js +0 -1
- package/dist/assets/cobol-nwyudZeR.js +0 -1
- package/dist/assets/codeowners-Bp6g37R7.js +0 -1
- package/dist/assets/codeql-DsOJ9woJ.js +0 -1
- package/dist/assets/coffee-Ch7k5sss.js +0 -1
- package/dist/assets/common-lisp-Cg-RD9OK.js +0 -1
- package/dist/assets/coq-DkFqJrB1.js +0 -1
- package/dist/assets/cpp-CofmeUqb.js +0 -1
- package/dist/assets/crystal-tKQVLTB8.js +0 -1
- package/dist/assets/csharp-COcwbKMJ.js +0 -1
- package/dist/assets/css-DPfMkruS.js +0 -1
- package/dist/assets/csv-fuZLfV_i.js +0 -1
- package/dist/assets/cue-D82EKSYY.js +0 -1
- package/dist/assets/cypher-COkxafJQ.js +0 -1
- package/dist/assets/d-85-TOEBH.js +0 -1
- package/dist/assets/dart-CF10PKvl.js +0 -1
- package/dist/assets/dax-CEL-wOlO.js +0 -1
- package/dist/assets/desktop-BmXAJ9_W.js +0 -1
- package/dist/assets/diff-D97Zzqfu.js +0 -1
- package/dist/assets/docker-BcOcwvcX.js +0 -1
- package/dist/assets/dotenv-Da5cRb03.js +0 -1
- package/dist/assets/dream-maker-BtqSS_iP.js +0 -1
- package/dist/assets/edge-BkV0erSs.js +0 -1
- package/dist/assets/elixir-CDX3lj18.js +0 -1
- package/dist/assets/elm-DbKCFpqz.js +0 -1
- package/dist/assets/emacs-lisp-C9XAeP06.js +0 -1
- package/dist/assets/erb-B12qg9BL.js +0 -1
- package/dist/assets/erlang-DsQrWhSR.js +0 -1
- package/dist/assets/fennel-BYunw83y.js +0 -1
- package/dist/assets/fish-BvzEVeQv.js +0 -1
- package/dist/assets/fluent-C4IJs8-o.js +0 -1
- package/dist/assets/fortran-fixed-form-CkoXwp7k.js +0 -1
- package/dist/assets/fortran-free-form-BxgE0vQu.js +0 -1
- package/dist/assets/fsharp-CXgrBDvD.js +0 -1
- package/dist/assets/gdresource-BOOCDP_w.js +0 -1
- package/dist/assets/gdscript-C5YyOfLZ.js +0 -1
- package/dist/assets/gdshader-DkwncUOv.js +0 -1
- package/dist/assets/genie-D0YGMca9.js +0 -1
- package/dist/assets/gherkin-DyxjwDmM.js +0 -1
- package/dist/assets/git-commit-F4YmCXRG.js +0 -1
- package/dist/assets/git-rebase-r7XF79zn.js +0 -1
- package/dist/assets/gleam-BspZqrRM.js +0 -1
- package/dist/assets/glimmer-js-Rg0-pVw9.js +0 -1
- package/dist/assets/glimmer-ts-U6CK756n.js +0 -1
- package/dist/assets/glsl-DplSGwfg.js +0 -1
- package/dist/assets/gn-n2N0HUVH.js +0 -1
- package/dist/assets/gnuplot-DdkO51Og.js +0 -1
- package/dist/assets/go-CxLEBnE3.js +0 -1
- package/dist/assets/graphql-ChdNCCLP.js +0 -1
- package/dist/assets/groovy-gcz8RCvz.js +0 -1
- package/dist/assets/hack-CaT9iCJl.js +0 -1
- package/dist/assets/haml-B8DHNrY2.js +0 -1
- package/dist/assets/handlebars-BL8al0AC.js +0 -1
- package/dist/assets/haskell-Df6bDoY_.js +0 -1
- package/dist/assets/haxe-CzTSHFRz.js +0 -1
- package/dist/assets/hcl-BWvSN4gD.js +0 -1
- package/dist/assets/hjson-D5-asLiD.js +0 -1
- package/dist/assets/hlsl-D3lLCCz7.js +0 -1
- package/dist/assets/html-GMplVEZG.js +0 -1
- package/dist/assets/html-derivative-BFtXZ54Q.js +0 -1
- package/dist/assets/http-jrhK8wxY.js +0 -1
- package/dist/assets/hurl-irOxFIW8.js +0 -1
- package/dist/assets/hxml-Bvhsp5Yf.js +0 -1
- package/dist/assets/hy-DFXneXwc.js +0 -1
- package/dist/assets/imba-DGztddWO.js +0 -1
- package/dist/assets/index-B0h6_x5N.js +0 -1
- package/dist/assets/index-BwoW_-vk.css +0 -1
- package/dist/assets/ini-BEwlwnbL.js +0 -1
- package/dist/assets/java-CylS5w8V.js +0 -1
- package/dist/assets/javascript-wDzz0qaB.js +0 -1
- package/dist/assets/jinja-4LBKfQ-Z.js +0 -1
- package/dist/assets/jison-wvAkD_A8.js +0 -1
- package/dist/assets/json-Cp-IABpG.js +0 -1
- package/dist/assets/json5-C9tS-k6U.js +0 -1
- package/dist/assets/jsonc-Des-eS-w.js +0 -1
- package/dist/assets/jsonl-DcaNXYhu.js +0 -1
- package/dist/assets/jsonnet-DFQXde-d.js +0 -1
- package/dist/assets/jssm-C2t-YnRu.js +0 -1
- package/dist/assets/jsx-g9-lgVsj.js +0 -1
- package/dist/assets/julia-CxzCAyBv.js +0 -1
- package/dist/assets/just-Cw27pwNe.js +0 -1
- package/dist/assets/kdl-DV7GczEv.js +0 -1
- package/dist/assets/kotlin-BdnUsdx6.js +0 -1
- package/dist/assets/kusto-DZf3V79B.js +0 -1
- package/dist/assets/latex-CWtU0Tv5.js +0 -1
- package/dist/assets/lean-BZvkOJ9d.js +0 -1
- package/dist/assets/less-B1dDrJ26.js +0 -1
- package/dist/assets/liquid-DYVedYrR.js +0 -1
- package/dist/assets/llvm-DjAJT7YJ.js +0 -1
- package/dist/assets/log-2UxHyX5q.js +0 -1
- package/dist/assets/logo-BtOb2qkB.js +0 -1
- package/dist/assets/lua-BaeVxFsk.js +0 -1
- package/dist/assets/luau-C-HG3fhB.js +0 -1
- package/dist/assets/main-C6i4ph9N.js +0 -2
- package/dist/assets/main-r5elIPBi.js +0 -136
- package/dist/assets/make-CHLpvVh8.js +0 -1
- package/dist/assets/markdown-Cvjx9yec.js +0 -1
- package/dist/assets/markdownCore-C2YQ3Z0q.js +0 -2
- package/dist/assets/marko-CnJfTvn9.js +0 -1
- package/dist/assets/matlab-D7o27uSR.js +0 -1
- package/dist/assets/mdc-BMNejdWA.js +0 -1
- package/dist/assets/mdx-Cmh6b_Ma.js +0 -1
- package/dist/assets/mermaid-mWjccvbQ.js +0 -1
- package/dist/assets/miniChat-d_GCHoIf.js +0 -2
- package/dist/assets/mipsasm-CKIfxQSi.js +0 -1
- package/dist/assets/mobile-BJ3tgyKd.js +0 -2
- package/dist/assets/mojo-rZm6bMo-.js +0 -1
- package/dist/assets/moonbit-_H4v1dQx.js +0 -1
- package/dist/assets/move-IF9eRakj.js +0 -1
- package/dist/assets/narrat-DRg8JJMk.js +0 -1
- package/dist/assets/nextflow-Zz6hmt5N.js +0 -1
- package/dist/assets/nextflow-groovy-BeH2EWoN.js +0 -1
- package/dist/assets/nginx-BpAMiNFr.js +0 -1
- package/dist/assets/nim-CVrawwO9.js +0 -1
- package/dist/assets/nix-CwoSXNpI.js +0 -1
- package/dist/assets/nsis-LdVXkNf5.js +0 -1
- package/dist/assets/nushell-Cz2AlsmD.js +0 -1
- package/dist/assets/objective-c-DXmwc3jG.js +0 -1
- package/dist/assets/objective-cpp-CLxacb5B.js +0 -1
- package/dist/assets/ocaml-C0hk2d4L.js +0 -1
- package/dist/assets/odin-BBf5iR-q.js +0 -1
- package/dist/assets/openscad-C4EeE6gA.js +0 -1
- package/dist/assets/pascal-D93ZcfNL.js +0 -1
- package/dist/assets/perl-C0TMdlhV.js +0 -1
- package/dist/assets/permissionStore-B9Hkrqny.js +0 -1
- package/dist/assets/php-Dhbhpdrm.js +0 -1
- package/dist/assets/pi-session-focus-preference-BFnGFuvP.js +0 -9
- package/dist/assets/pkl-u5AG7uiY.js +0 -1
- package/dist/assets/plsql-ChMvpjG-.js +0 -1
- package/dist/assets/po-BTJTHyun.js +0 -1
- package/dist/assets/polar-C0HS_06l.js +0 -1
- package/dist/assets/postcss-CXtECtnM.js +0 -1
- package/dist/assets/powerquery-CEu0bR-o.js +0 -1
- package/dist/assets/powershell-Dpen1YoG.js +0 -1
- package/dist/assets/prisma-Dd19v3D-.js +0 -1
- package/dist/assets/prolog-CbFg5uaA.js +0 -1
- package/dist/assets/proto-C7zT0LnQ.js +0 -1
- package/dist/assets/pug-CGlum2m_.js +0 -1
- package/dist/assets/puppet-BMWR74SV.js +0 -1
- package/dist/assets/purescript-CklMAg4u.js +0 -1
- package/dist/assets/python-B6aJPvgy.js +0 -1
- package/dist/assets/qml-3beO22l8.js +0 -1
- package/dist/assets/qmldir-C8lEn-DE.js +0 -1
- package/dist/assets/qss-IeuSbFQv.js +0 -1
- package/dist/assets/r-Dspwwk_N.js +0 -1
- package/dist/assets/racket-BqYA7rlc.js +0 -1
- package/dist/assets/raku-DXvB9xmW.js +0 -1
- package/dist/assets/razor-Uh8Bk_45.js +0 -1
- package/dist/assets/reg-C-SQnVFl.js +0 -1
- package/dist/assets/regexp-CDVJQ6XC.js +0 -1
- package/dist/assets/rel-C3B-1QV4.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-Bap5OwgB.js +0 -2
- package/dist/assets/renderMobileApp-DJbslvby.js +0 -11
- package/dist/assets/riscv-BM1_JUlF.js +0 -1
- package/dist/assets/ron-D8l8udqQ.js +0 -1
- package/dist/assets/rosmsg-BJDFO7_C.js +0 -1
- package/dist/assets/rst-BrH8l1NY.js +0 -1
- package/dist/assets/ruby-B2Rjki9n.js +0 -1
- package/dist/assets/ruby-Dw2BHqvy.js +0 -1
- package/dist/assets/runtimeEndpointReset-D22U_Vjs.js +0 -62
- package/dist/assets/runtimeSurface-k1Eit61v.js +0 -1
- package/dist/assets/rust-B1yitclQ.js +0 -1
- package/dist/assets/sas-cz2c8ADy.js +0 -1
- package/dist/assets/sass-Cj5Yp3dK.js +0 -1
- package/dist/assets/scala-C151Ov-r.js +0 -1
- package/dist/assets/scheme-C98Dy4si.js +0 -1
- package/dist/assets/scss-OYdSNvt2.js +0 -1
- package/dist/assets/sdbl-DVxCFoDh.js +0 -1
- package/dist/assets/shaderlab-Dg9Lc6iA.js +0 -1
- package/dist/assets/shellscript-Yzrsuije.js +0 -1
- package/dist/assets/shellsession-BADoaaVG.js +0 -1
- package/dist/assets/smalltalk-BERRCDM3.js +0 -1
- package/dist/assets/solidity-rGO070M0.js +0 -1
- package/dist/assets/soy-Brmx7dQM.js +0 -1
- package/dist/assets/sparql-rVzFXLq3.js +0 -1
- package/dist/assets/splunk-BtCnVYZw.js +0 -1
- package/dist/assets/sql-BLtJtn59.js +0 -1
- package/dist/assets/ssh-config-_ykCGR6B.js +0 -1
- package/dist/assets/stata-BH5u7GGu.js +0 -1
- package/dist/assets/stylus-BEDo0Tqx.js +0 -1
- package/dist/assets/surrealql-Bq5Q-fJD.js +0 -1
- package/dist/assets/svelte-C_ipcX3V.js +0 -1
- package/dist/assets/swift-D82vCrfD.js +0 -1
- package/dist/assets/system-verilog-CnnmHF94.js +0 -1
- package/dist/assets/systemd-4A_iFExJ.js +0 -1
- package/dist/assets/talonscript-CkByrt1z.js +0 -1
- package/dist/assets/tasl-QIJgUcNo.js +0 -1
- package/dist/assets/tcl-dwOrl1Do.js +0 -1
- package/dist/assets/templ-P3uqSqPl.js +0 -1
- package/dist/assets/terraform-BETggiCN.js +0 -1
- package/dist/assets/tex-idrVyKtj.js +0 -1
- package/dist/assets/themeResolver-yJ9XpNMI.js +0 -1
- package/dist/assets/toml-vGWfd6FD.js +0 -1
- package/dist/assets/ts-tags-zn1MmPIZ.js +0 -1
- package/dist/assets/tsv-B_m7g4N7.js +0 -1
- package/dist/assets/tsx-COt5Ahok.js +0 -1
- package/dist/assets/turtle-BsS91CYL.js +0 -1
- package/dist/assets/twig-DNn4PbVi.js +0 -1
- package/dist/assets/typescript-BPQ3VLAy.js +0 -1
- package/dist/assets/typespec-BGHnOYBU.js +0 -1
- package/dist/assets/typst-DHCkPAjA.js +0 -1
- package/dist/assets/useAppFontEffects-CqHhRKmN.js +0 -212
- package/dist/assets/useFilesViewSearch-CqoYEK0U.js +0 -7
- package/dist/assets/v-BcVCzyr7.js +0 -1
- package/dist/assets/vala-CsfeWuGM.js +0 -1
- package/dist/assets/vb-D17OF-Vu.js +0 -1
- package/dist/assets/vendor-aparajita-capacitor-secure-storage-BDrMx_CE.js +0 -1
- package/dist/assets/vendor-base-ui-CKRUCG-f.js +0 -1
- package/dist/assets/vendor-boot-EC6IyLt1.js +0 -69
- package/dist/assets/vendor-codemirror-autocomplete-CGpAsPWp.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-CDJoHJSY.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-BmHofQls.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-RM2HqXZ0.js +0 -1
- package/dist/assets/vendor-codemirror-lang-html-CHSHUpwq.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-lhQXgWu0.js +0 -1
- package/dist/assets/vendor-codemirror-lang-javascript-Dw4kFO4e.js +0 -13
- package/dist/assets/vendor-codemirror-lang-jinja-_pAC3UTN.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-B-b1vAv-.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-xIgOi1ze.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-CP49m5dB.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-BTht2ATe.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-BguZDhaO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-CH6_em9L.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-EG_DtGyi.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-BknY5Qpo.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-CyGn9snv.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-CsFfSyyB.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-Cdan_Jp1.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-COI5hck8.js +0 -1
- package/dist/assets/vendor-codemirror-search-DUfSCF9S.js +0 -2
- package/dist/assets/vendor-dompurify-r8glNMJW.js +0 -2
- package/dist/assets/vendor-elkjs-D27273Ms.js +0 -24
- package/dist/assets/vendor-fuse.js-Dw8P0qyA.js +0 -1
- package/dist/assets/vendor-lezer-cpp-DMZOJzBa.js +0 -1
- package/dist/assets/vendor-lezer-css-DUkkbMp7.js +0 -1
- package/dist/assets/vendor-lezer-java-tMazV_6X.js +0 -1
- package/dist/assets/vendor-lezer-javascript-ctwLWf4v.js +0 -1
- package/dist/assets/vendor-lezer-lr-B8TQctNw.js +0 -1
- package/dist/assets/vendor-lezer-markdown-aGLZf_3h.js +0 -6
- package/dist/assets/vendor-lezer-php-D5zCNzlt.js +0 -1
- package/dist/assets/vendor-lezer-rust-DO5c7OtA.js +0 -1
- package/dist/assets/vendor-marked-CX41MkDF.js +0 -59
- package/dist/assets/vendor-oniguruma-to-es-DLBnFDCE.js +0 -94
- package/dist/assets/vendor-property-information-rJCbAzvX.js +0 -1
- package/dist/assets/vendor-react-DASdDPIk.js +0 -1
- package/dist/assets/vendor-remend-BWYYytN3.js +0 -22
- package/dist/assets/vendor-replit-codemirror-vim-AnOuN8yJ.js +0 -39
- package/dist/assets/vendor-shiki-Bbf2GEcE.js +0 -2
- package/dist/assets/vendor-shikijs-vscode-textmate-BgLrS_2D.js +0 -3
- package/dist/assets/vendor-tailwind-merge-CPcsbTWB.js +0 -1
- package/dist/assets/vendor-workbox-window-BIl4cyR9.js +0 -2
- package/dist/assets/vendor-zumer-snapdom-Btyu_Xi2.js +0 -8
- package/dist/assets/vendor-zustand-CUi8eEds.js +0 -6
- package/dist/assets/verilog-BQ8w6xss.js +0 -1
- package/dist/assets/vhdl-CeAyd5Ju.js +0 -1
- package/dist/assets/viml-CJc9bBzg.js +0 -1
- package/dist/assets/vue-DN_0RTcg.js +0 -1
- package/dist/assets/vue-html-AaS7Mt5G.js +0 -1
- package/dist/assets/vue-vine-CQOfvN7w.js +0 -1
- package/dist/assets/vyper-CDx5xZoG.js +0 -1
- package/dist/assets/wasm-MzD3tlZU.js +0 -1
- package/dist/assets/wenyan-BV7otONQ.js +0 -1
- package/dist/assets/wgsl-Dx-B1_4e.js +0 -1
- package/dist/assets/wikitext-BhOHFoWU.js +0 -1
- package/dist/assets/wit-5i3qLPDT.js +0 -1
- package/dist/assets/wolfram-lXgVvXCa.js +0 -1
- package/dist/assets/worker-BBk7yuNN.js +0 -153
- package/dist/assets/workerFactory-tw7cIdmV.js +0 -1
- package/dist/assets/xml-sdJ4AIDG.js +0 -1
- package/dist/assets/xsl-CtQFsRM5.js +0 -1
- package/dist/assets/yaml-Buea-lGh.js +0 -1
- package/dist/assets/zenscript-DVFEvuxE.js +0 -1
- package/dist/assets/zig-VOosw3JB.js +0 -1
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
22
|
MAX_EXTENSION_APP_HTML_CHARS,
|
|
23
|
+
isValidCustomInputItems,
|
|
23
24
|
sanitizeExtensionFormFields,
|
|
24
25
|
validateExtensionFormValues,
|
|
25
26
|
} from '../extension-protocol.js';
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
installExtensionGlobalTheme,
|
|
39
40
|
} from './extension-tool-render.js';
|
|
40
41
|
import { createExtensionMessageRenderer } from './extension-message-render.js';
|
|
42
|
+
import { normalizeOpenRequestUrl, resolveOpenRequestSession } from './open-request.js';
|
|
41
43
|
import { getBuiltinExtensionFactories } from './builtin-extensions.js';
|
|
42
44
|
import {
|
|
43
45
|
SESSION_DAEMON_DEFAULT_MESSAGE_PAGE_LIMIT,
|
|
@@ -47,6 +49,7 @@ import {
|
|
|
47
49
|
SESSION_DAEMON_PROTOCOL_VERSION as PROTOCOL_VERSION,
|
|
48
50
|
} from './ipc-protocol.js';
|
|
49
51
|
import { createMessageEntryAliases } from './message-entry-aliases.js';
|
|
52
|
+
import { createUserBash, projectBashExecutionEntry, UserBashError, validateUserBashRequest } from './user-bash.js';
|
|
50
53
|
import { createSessionReplayLog } from './session-replay.js';
|
|
51
54
|
import {
|
|
52
55
|
createSendOperationRegistry,
|
|
@@ -62,6 +65,7 @@ import { withCrossProcessLock } from '../../server/cross-process-lock.js';
|
|
|
62
65
|
import {
|
|
63
66
|
findPiSessionJsonlById,
|
|
64
67
|
getPiSessionDirectory,
|
|
68
|
+
createPiSessionJsonlListCache,
|
|
65
69
|
listPiSessionJsonlDirectory,
|
|
66
70
|
validatePiSessionJsonlDirectory,
|
|
67
71
|
validatePiSessionJsonlFile,
|
|
@@ -73,6 +77,7 @@ import {
|
|
|
73
77
|
} from './session-engines.js';
|
|
74
78
|
import { createSessionEngineRouter } from './session-engine-router.js';
|
|
75
79
|
import { createPendingInputIndex } from './pending-input.js';
|
|
80
|
+
import { createExtensionCustomHost } from './extension-custom-host.js';
|
|
76
81
|
|
|
77
82
|
const textFromContent = (content) => (
|
|
78
83
|
Array.isArray(content)
|
|
@@ -89,7 +94,8 @@ if (!globalThis.__PICHAMBER__) {
|
|
|
89
94
|
globalThis.__PICHAMBER__ = Object.freeze({
|
|
90
95
|
version: 1,
|
|
91
96
|
protocol: 'pichamber-extension-ui',
|
|
92
|
-
mode
|
|
97
|
+
// Matches `ctx.mode` (extension-bridge.js).
|
|
98
|
+
mode: 'tui',
|
|
93
99
|
});
|
|
94
100
|
} catch {}
|
|
95
101
|
}
|
|
@@ -192,9 +198,11 @@ export function createSessionDaemon({
|
|
|
192
198
|
onShutdown,
|
|
193
199
|
idleTimeoutMs = 5 * 60 * 1_000,
|
|
194
200
|
sendOperationTtlMs = 10 * 60 * 1_000,
|
|
201
|
+
sessionListCache = createPiSessionJsonlListCache(),
|
|
195
202
|
listSessions = ({ cwd: sessionCwd, agentDir: sessionAgentDir = agentDir }) => listPiSessionJsonlDirectory({
|
|
196
203
|
cwd: sessionCwd,
|
|
197
204
|
agentDir: sessionAgentDir,
|
|
205
|
+
cache: sessionListCache,
|
|
198
206
|
}),
|
|
199
207
|
createSettingsManager = ({ cwd: settingsCwd, agentDir: settingsAgentDir = agentDir, projectTrusted }) => SettingsManager.create(
|
|
200
208
|
settingsCwd,
|
|
@@ -291,7 +299,7 @@ export function createSessionDaemon({
|
|
|
291
299
|
// are registered); every routing branch guards on `size > 0` so the
|
|
292
300
|
// zero-engine path runs exactly the Pi-only code.
|
|
293
301
|
let engineRegistry;
|
|
294
|
-
|
|
302
|
+
const runtimeStartPromises = new Map();
|
|
295
303
|
let idleDisposeTimer;
|
|
296
304
|
let dormantSession;
|
|
297
305
|
let sequence = 0;
|
|
@@ -569,6 +577,9 @@ export function createSessionDaemon({
|
|
|
569
577
|
},
|
|
570
578
|
});
|
|
571
579
|
|
|
580
|
+
// The session that most recently produced an event: the carrier for an
|
|
581
|
+
// Open request nobody can attribute (see open-request.js).
|
|
582
|
+
let lastPublishedSession = null;
|
|
572
583
|
const publish = (event, payload, sessionId = runtime?.session?.sessionId, directory) => {
|
|
573
584
|
if (typeof sessionId !== 'string' || sessionId.length === 0) return;
|
|
574
585
|
const targetDirectory = directory || activeDirectory || cwd;
|
|
@@ -585,12 +596,32 @@ export function createSessionDaemon({
|
|
|
585
596
|
},
|
|
586
597
|
};
|
|
587
598
|
const line = `${JSON.stringify(message)}\n`;
|
|
599
|
+
lastPublishedSession = { sessionId, directory: targetDirectory };
|
|
588
600
|
// Live delivery stays full-fidelity even when the event is too large to
|
|
589
601
|
// retain: retention evicts whole oldest events and never truncates content.
|
|
590
602
|
replayLog.append(message.sequence, sessionId, line);
|
|
591
603
|
for (const client of clients) writeLine(client, line);
|
|
592
604
|
};
|
|
593
605
|
|
|
606
|
+
// Live-only events (`custom()` frames) skip the replay log: a 30 fps
|
|
607
|
+
// component would otherwise evict every useful event from it within
|
|
608
|
+
// seconds. Their sequence gaps are harmless, like snapshots'. A client
|
|
609
|
+
// that attaches by replay gets the current full frames instead
|
|
610
|
+
// (`writeCustomKeyframes`).
|
|
611
|
+
const publishTransient = (event, payload, sessionId, directory) => {
|
|
612
|
+
if (typeof sessionId !== 'string' || sessionId.length === 0) return;
|
|
613
|
+
const message = {
|
|
614
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
615
|
+
kind: 'event',
|
|
616
|
+
event,
|
|
617
|
+
streamEpoch,
|
|
618
|
+
sequence: ++sequence,
|
|
619
|
+
payload: { sessionId, directory: directory || activeDirectory || cwd, ...payload },
|
|
620
|
+
};
|
|
621
|
+
const line = `${JSON.stringify(message)}\n`;
|
|
622
|
+
for (const client of clients) writeLine(client, line);
|
|
623
|
+
};
|
|
624
|
+
|
|
594
625
|
// Daemon-level pending-input state: whether a session is blocked waiting
|
|
595
626
|
// for the user. Daemon-hosted blocking requests (extension dialogs) and
|
|
596
627
|
// engine-reported summaries both feed it; every device learns it without
|
|
@@ -599,6 +630,61 @@ export function createSessionDaemon({
|
|
|
599
630
|
publish,
|
|
600
631
|
onHostedSessionSettled: (sessionId) => safeTouchIdleDisposal(sessionId),
|
|
601
632
|
});
|
|
633
|
+
// User shell commands (`!cmd` / `!!cmd`). A settled command re-arms the
|
|
634
|
+
// idle timer only when nothing else keeps the runtime busy.
|
|
635
|
+
const userBash = createUserBash({
|
|
636
|
+
publish,
|
|
637
|
+
redact: (value) => redactAttachmentPaths(value),
|
|
638
|
+
onSettled: (sessionId) => safeTouchIdleDisposal(sessionId),
|
|
639
|
+
});
|
|
640
|
+
// What opened a `custom()` surface, for its header: the running top-level
|
|
641
|
+
// tool, else the extension command being run. Pi's ctx.ui is shared per
|
|
642
|
+
// session and does not say which extension called it.
|
|
643
|
+
const runningToolsBySession = new Map();
|
|
644
|
+
const runningCommandBySession = new Map();
|
|
645
|
+
// The browser tab that sent each session's latest input (`clientId`, the
|
|
646
|
+
// same id it uses for custom() surfaces): surfaces that input opens are
|
|
647
|
+
// drawn at that tab's size.
|
|
648
|
+
const promptClientBySession = new Map();
|
|
649
|
+
/**
|
|
650
|
+
* The running extension command while it is the only thing running (no
|
|
651
|
+
* agent turn): the session is busy, as in Pi's interactive mode, which
|
|
652
|
+
* holds new input until the command returns. Steering applies only while
|
|
653
|
+
* the agent streams, so clients queue instead of steering then.
|
|
654
|
+
*/
|
|
655
|
+
const commandOnlyRun = (sessionId, session) => {
|
|
656
|
+
if (session?.isStreaming === true) return undefined;
|
|
657
|
+
const name = runningCommandBySession.get(sessionId)?.name;
|
|
658
|
+
return name ? `/${name}` : undefined;
|
|
659
|
+
};
|
|
660
|
+
const describeCustomOrigin = (sessionId) => {
|
|
661
|
+
const tools = runningToolsBySession.get(sessionId);
|
|
662
|
+
const tool = tools ? [...tools.values()].at(-1) : undefined;
|
|
663
|
+
if (tool) return tool;
|
|
664
|
+
const command = runningCommandBySession.get(sessionId)?.name;
|
|
665
|
+
return command ? `/${command}` : undefined;
|
|
666
|
+
};
|
|
667
|
+
const findRuntimeForSession = (sessionId) => runtimeRegistry?.findBySessionId(sessionId)
|
|
668
|
+
|| (runtime?.session?.sessionId === sessionId ? runtime : undefined);
|
|
669
|
+
const customHost = createExtensionCustomHost({
|
|
670
|
+
publish,
|
|
671
|
+
publishTransient,
|
|
672
|
+
pendingInput,
|
|
673
|
+
agentDir,
|
|
674
|
+
theme: extensionTheme,
|
|
675
|
+
directoryForSession: (sessionId) => findRuntimeForSession(sessionId)?.cwd || activeDirectory || cwd,
|
|
676
|
+
redactLine: (line) => redactAttachmentPaths(line),
|
|
677
|
+
describeOrigin: describeCustomOrigin,
|
|
678
|
+
openerClientFor: (sessionId) => promptClientBySession.get(sessionId),
|
|
679
|
+
onSettled: (sessionId) => safeTouchIdleDisposal(sessionId),
|
|
680
|
+
onError: (sessionId, stage, error) => {
|
|
681
|
+
publish('extension.error', {
|
|
682
|
+
source: 'extension.custom',
|
|
683
|
+
event: stage,
|
|
684
|
+
message: String(error?.message ?? error ?? 'Extension component error.'),
|
|
685
|
+
}, sessionId, findRuntimeForSession(sessionId)?.cwd);
|
|
686
|
+
},
|
|
687
|
+
});
|
|
602
688
|
const extensionBridge = createExtensionBridge({
|
|
603
689
|
publish,
|
|
604
690
|
resolveDirectory,
|
|
@@ -612,7 +698,58 @@ export function createSessionDaemon({
|
|
|
612
698
|
renderExtensionMessage: (session, message) => extensionMessageRenderer.renderMessage(session, message),
|
|
613
699
|
requestSessionShutdown: (sessionId) => shutdownRequestedBySession.add(sessionId),
|
|
614
700
|
pendingInput,
|
|
701
|
+
customHost,
|
|
615
702
|
});
|
|
703
|
+
// `custom()` commands from browsers. Unknown or closed surfaces answer
|
|
704
|
+
// `accepted: false` instead of throwing, like stale dialog responses, so a
|
|
705
|
+
// late key from another device never tears down the daemon socket.
|
|
706
|
+
const handleCustomCommand = (command, payload) => {
|
|
707
|
+
const sessionId = payload?.sessionId;
|
|
708
|
+
if (typeof sessionId !== 'string' || sessionId.length === 0) {
|
|
709
|
+
throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'The extension surface request is invalid.');
|
|
710
|
+
}
|
|
711
|
+
const surfaceId = typeof payload.surfaceId === 'string' && payload.surfaceId.length > 0 && payload.surfaceId.length <= 128
|
|
712
|
+
? payload.surfaceId
|
|
713
|
+
: undefined;
|
|
714
|
+
const clientId = typeof payload.clientId === 'string' && payload.clientId.length > 0 && payload.clientId.length <= 128
|
|
715
|
+
? payload.clientId
|
|
716
|
+
: undefined;
|
|
717
|
+
const viewport = payload.viewport && typeof payload.viewport === 'object' ? payload.viewport : undefined;
|
|
718
|
+
switch (command) {
|
|
719
|
+
case 'extensions.custom.input':
|
|
720
|
+
if (!surfaceId || !isValidCustomInputItems(payload.items)) {
|
|
721
|
+
throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'The extension surface input is invalid.');
|
|
722
|
+
}
|
|
723
|
+
return customHost.input({ sessionId, surfaceId, clientId, viewport, items: payload.items });
|
|
724
|
+
case 'extensions.custom.viewport':
|
|
725
|
+
return customHost.reportViewport({ sessionId, clientId, viewport, claim: payload.claim === true });
|
|
726
|
+
case 'extensions.custom.close':
|
|
727
|
+
if (!surfaceId) throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'The extension surface is invalid.');
|
|
728
|
+
return customHost.close({ sessionId, surfaceId, clientId, viewport });
|
|
729
|
+
case 'extensions.custom.focus':
|
|
730
|
+
if (!surfaceId) throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'The extension surface is invalid.');
|
|
731
|
+
return customHost.focus({ sessionId, surfaceId, clientId, viewport });
|
|
732
|
+
default:
|
|
733
|
+
return customHost.refresh({ sessionId, surfaceId });
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// Frames are live-only (`publishTransient`), so a client that attached by
|
|
738
|
+
// replay gets each open surface's current full frame. The sequence numbers
|
|
739
|
+
// are this client's alone; other clients see a gap, as with snapshots.
|
|
740
|
+
const writeCustomKeyframes = (socket, requestedSessionId) => {
|
|
741
|
+
for (const { sessionId, payload } of customHost.keyframes(requestedSessionId)) {
|
|
742
|
+
writeFrame(socket, {
|
|
743
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
744
|
+
kind: 'event',
|
|
745
|
+
event: 'extension.custom.frame',
|
|
746
|
+
streamEpoch,
|
|
747
|
+
sequence: ++sequence,
|
|
748
|
+
payload: { sessionId, directory: findRuntimeForSession(sessionId)?.cwd || activeDirectory || cwd, ...payload },
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
|
|
616
753
|
const {
|
|
617
754
|
buildExtensionBindings,
|
|
618
755
|
clearExtensionState,
|
|
@@ -723,7 +860,8 @@ export function createSessionDaemon({
|
|
|
723
860
|
// this snapshot is a recovery baseline rather than a routine attach.
|
|
724
861
|
...(resync ? { resync: true } : {}),
|
|
725
862
|
isStreaming: session.isStreaming ?? false,
|
|
726
|
-
lifecycle: retry ? 'retry' : session.isStreaming ? 'busy' : 'idle',
|
|
863
|
+
lifecycle: retry ? 'retry' : session.isStreaming || commandOnlyRun(session.sessionId, session) ? 'busy' : 'idle',
|
|
864
|
+
...(!retry && commandOnlyRun(session.sessionId, session) ? { command: commandOnlyRun(session.sessionId, session) } : {}),
|
|
727
865
|
...(retry ? { retry } : {}),
|
|
728
866
|
...(compaction ? { compaction } : {}),
|
|
729
867
|
queue: activeSession ? {
|
|
@@ -745,9 +883,11 @@ export function createSessionDaemon({
|
|
|
745
883
|
...(extensionSnapshot.title ? { extensionTitle: extensionSnapshot.title } : {}),
|
|
746
884
|
...(extensionSnapshot.working ? { extensionWorking: extensionSnapshot.working } : {}),
|
|
747
885
|
...(extensionSnapshot.draftTracked ? { extensionDraftTracked: true } : {}),
|
|
886
|
+
...(extensionSnapshot.surfaces ? { extensionSurfaces: extensionSnapshot.surfaces } : {}),
|
|
748
887
|
...(session.sessionId
|
|
749
888
|
? {
|
|
750
889
|
inputState: { pending: pendingInput.summaryFor(session.sessionId) },
|
|
890
|
+
bashExecutions: userBash.snapshot(session.sessionId) ?? [],
|
|
751
891
|
}
|
|
752
892
|
: {}),
|
|
753
893
|
},
|
|
@@ -837,7 +977,7 @@ export function createSessionDaemon({
|
|
|
837
977
|
}
|
|
838
978
|
};
|
|
839
979
|
|
|
840
|
-
const startRuntime = async ({ cwd: runtimeCwd = activeDirectory || cwd, sessionFile } = {}) => {
|
|
980
|
+
const startRuntime = async ({ cwd: runtimeCwd = activeDirectory || cwd, sessionFile, activate = true } = {}) => {
|
|
841
981
|
if (sessionFile) await validatePiSessionJsonlFile(sessionFile);
|
|
842
982
|
const canonicalRuntimeCwd = sessionFile && dormantSession?.cwd
|
|
843
983
|
? dormantSession.cwd
|
|
@@ -863,21 +1003,57 @@ export function createSessionDaemon({
|
|
|
863
1003
|
});
|
|
864
1004
|
}
|
|
865
1005
|
runtimeRegistry.register(newRuntime, { cwd: canonicalRuntimeCwd });
|
|
866
|
-
runtime = newRuntime;
|
|
867
|
-
activeDirectory = canonicalRuntimeCwd;
|
|
868
1006
|
rebuildSessionExtensionState(newRuntime);
|
|
869
|
-
|
|
1007
|
+
if (activate) {
|
|
1008
|
+
runtime = newRuntime;
|
|
1009
|
+
activeDirectory = canonicalRuntimeCwd;
|
|
1010
|
+
rememberRuntimeSession();
|
|
1011
|
+
return newRuntime;
|
|
1012
|
+
}
|
|
1013
|
+
// A runtime started to answer for another directory stays non-active: it
|
|
1014
|
+
// must not take over the daemon's active runtime or active directory, and
|
|
1015
|
+
// it must not replace the dormant session belonging to the active project.
|
|
1016
|
+
// It is view-only state, so it gets the same idle lifetime as any other
|
|
1017
|
+
// browse-only session; reading many projects cannot accumulate runtimes.
|
|
1018
|
+
touchIdleDisposal(newRuntime.session?.sessionId);
|
|
870
1019
|
return newRuntime;
|
|
871
1020
|
};
|
|
872
1021
|
|
|
873
1022
|
const ensureRuntime = (targetCwd = activeDirectory || cwd) => {
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1023
|
+
const requestedCwd = resolve(targetCwd);
|
|
1024
|
+
// Runtime state is owned per working directory. A request that names a
|
|
1025
|
+
// directory is answered by a runtime resident in that directory, never by
|
|
1026
|
+
// the active runtime of a different project, whose loaded extensions,
|
|
1027
|
+
// skills, prompts, and models would then be reported for the wrong project.
|
|
1028
|
+
const resident = runtimeRegistry?.listByDirectory?.(requestedCwd) ?? [];
|
|
1029
|
+
const candidate = resident.includes(runtime) ? runtime : resident[0];
|
|
1030
|
+
if (candidate) return Promise.resolve(candidate);
|
|
1031
|
+
|
|
1032
|
+
// Concurrent starts are shared per directory, never across directories.
|
|
1033
|
+
let pendingStart = runtimeStartPromises.get(requestedCwd);
|
|
1034
|
+
if (!pendingStart) {
|
|
1035
|
+
// The last opened JSONL is reopened for the directory that owns it, and
|
|
1036
|
+
// only there; a different directory starts its own Pi session.
|
|
1037
|
+
const sessionFile = dormantSession?.sessionFile
|
|
1038
|
+
&& resolve(dormantSession.cwd || cwd) === requestedCwd
|
|
1039
|
+
? dormantSession.sessionFile
|
|
1040
|
+
: undefined;
|
|
1041
|
+
pendingStart = startRuntime({
|
|
1042
|
+
cwd: requestedCwd,
|
|
1043
|
+
sessionFile,
|
|
1044
|
+
// Only a start for the active directory, on a daemon without an active
|
|
1045
|
+
// runtime, adopts what it starts. After idle disposal clears `runtime`,
|
|
1046
|
+
// `activeDirectory` still names the user's project, so reading another
|
|
1047
|
+
// project's catalog leaves that project and its dormant session intact.
|
|
1048
|
+
activate: !runtime && requestedCwd === resolve(activeDirectory || cwd),
|
|
1049
|
+
}).finally(() => {
|
|
1050
|
+
if (runtimeStartPromises.get(requestedCwd) === pendingStart) {
|
|
1051
|
+
runtimeStartPromises.delete(requestedCwd);
|
|
1052
|
+
}
|
|
878
1053
|
});
|
|
1054
|
+
runtimeStartPromises.set(requestedCwd, pendingStart);
|
|
879
1055
|
}
|
|
880
|
-
return
|
|
1056
|
+
return pendingStart;
|
|
881
1057
|
};
|
|
882
1058
|
|
|
883
1059
|
const beginSessionInput = (targetRuntime) => {
|
|
@@ -1023,8 +1199,13 @@ export function createSessionDaemon({
|
|
|
1023
1199
|
// away finds it still pending later. Deletion and daemon stop still
|
|
1024
1200
|
// cancel dialogs as before.
|
|
1025
1201
|
if (isValidIdleSessionId(sessionId) && pendingInput.hasHostedRequests(sessionId)) return false;
|
|
1202
|
+
// An open custom() component is live, capturing or not.
|
|
1203
|
+
if (isValidIdleSessionId(sessionId) && customHost.hasOpenSurfaces(sessionId)) return false;
|
|
1026
1204
|
if (isValidIdleSessionId(sessionId) && (activeSessionRequests.get(sessionId) ?? 0) > 0) return false;
|
|
1027
1205
|
if (targetRuntime.session?.isStreaming || targetRuntime.session?.isCompacting) return false;
|
|
1206
|
+
// A user shell command (`!cmd`) is live work from acceptance (before Pi
|
|
1207
|
+
// reports `isBashRunning`) until it settles.
|
|
1208
|
+
if (targetRuntime.session?.isBashRunning || userBash.isActive(sessionId)) return false;
|
|
1028
1209
|
if (activeSessionInputs.has(targetRuntime)) return false;
|
|
1029
1210
|
if (pendingResourceReloads.has(targetRuntime) || resourceReloadsByRuntime.has(targetRuntime)) return false;
|
|
1030
1211
|
// A scheduled provider retry is still live work: agent_settled remains
|
|
@@ -1073,6 +1254,7 @@ export function createSessionDaemon({
|
|
|
1073
1254
|
// thread blocks forever on a disposed runtime.
|
|
1074
1255
|
clearExtensionState(sessionId);
|
|
1075
1256
|
extensionToolRenderer.clearSession(sessionId);
|
|
1257
|
+
runningToolsBySession.delete(sessionId);
|
|
1076
1258
|
await runtimeRegistry.dispose(targetRuntime);
|
|
1077
1259
|
// Positively determine ephemerality while the resident lease is
|
|
1078
1260
|
// still held, before any release. A stat success means persisted;
|
|
@@ -1094,6 +1276,7 @@ export function createSessionDaemon({
|
|
|
1094
1276
|
const released = releaseResult?.released === true;
|
|
1095
1277
|
shutdownRequestedBySession.delete(sessionId);
|
|
1096
1278
|
compactionStateBySession.delete(sessionId);
|
|
1279
|
+
userBash.clearSession(sessionId);
|
|
1097
1280
|
if (targetRuntime === runtime) runtime = undefined;
|
|
1098
1281
|
// Publish only after a successful lease release so a
|
|
1099
1282
|
// cross-daemon recreate cannot slip between release and event.
|
|
@@ -1203,6 +1386,8 @@ export function createSessionDaemon({
|
|
|
1203
1386
|
case 'sessions.setModel':
|
|
1204
1387
|
case 'sessions.setThinking':
|
|
1205
1388
|
case 'sessions.compact':
|
|
1389
|
+
case 'sessions.bash':
|
|
1390
|
+
case 'sessions.abortBash':
|
|
1206
1391
|
case 'sessions.delete':
|
|
1207
1392
|
case 'sessions.rename': {
|
|
1208
1393
|
const candidate = message?.payload?.sessionId;
|
|
@@ -1243,16 +1428,28 @@ export function createSessionDaemon({
|
|
|
1243
1428
|
const sessionId = entry?.session?.sessionId;
|
|
1244
1429
|
if (typeof sessionId !== 'string' || sessionId.length === 0) continue;
|
|
1245
1430
|
const retry = retryStateBySession.get(sessionId);
|
|
1246
|
-
const
|
|
1431
|
+
const command = retry ? undefined : commandOnlyRun(sessionId, entry.session);
|
|
1432
|
+
const lifecycle = retry ? 'retry' : entry.session.isStreaming === true || command ? 'busy' : 'idle';
|
|
1247
1433
|
const runStartedAt = lifecycle !== 'idle' ? activeRunStartedAt.get(sessionId) : undefined;
|
|
1248
1434
|
liveById.set(sessionId, {
|
|
1249
1435
|
lifecycle,
|
|
1250
1436
|
sequence: observedSequence,
|
|
1251
1437
|
...(retry ? { retry } : {}),
|
|
1438
|
+
...(command ? { command } : {}),
|
|
1252
1439
|
...(Number.isFinite(runStartedAt) ? { runStartedAt } : {}),
|
|
1253
1440
|
serverNow,
|
|
1254
1441
|
});
|
|
1255
1442
|
}
|
|
1443
|
+
// A resident runtime's SessionManager is authoritative for the name,
|
|
1444
|
+
// including renames not yet flushed to disk and explicit clears.
|
|
1445
|
+
const liveNameById = new Map();
|
|
1446
|
+
for (const entry of activeEntries) {
|
|
1447
|
+
const sessionId = entry?.session?.sessionId;
|
|
1448
|
+
const getSessionName = entry?.session?.sessionManager?.getSessionName;
|
|
1449
|
+
if (typeof sessionId !== 'string' || typeof getSessionName !== 'function') continue;
|
|
1450
|
+
const liveName = getSessionName.call(entry.session.sessionManager);
|
|
1451
|
+
liveNameById.set(sessionId, typeof liveName === 'string' ? liveName : undefined);
|
|
1452
|
+
}
|
|
1256
1453
|
const extra = [];
|
|
1257
1454
|
for (const entry of activeEntries) {
|
|
1258
1455
|
if (entry?.session?.sessionId && !knownIds.has(entry.session.sessionId)) {
|
|
@@ -1275,8 +1472,9 @@ export function createSessionDaemon({
|
|
|
1275
1472
|
throw new SessionDaemonProtocolError('INVALID_SESSION', 'Pi returned an invalid session record.');
|
|
1276
1473
|
}
|
|
1277
1474
|
const safeFirstMessage = redactAttachmentPaths(session.firstMessage);
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1475
|
+
const name = liveNameById.has(session.id) ? liveNameById.get(session.id) : session.name;
|
|
1476
|
+
const title = typeof name === 'string' && name.trim().length > 0
|
|
1477
|
+
? redactAttachmentPaths(name.trim())
|
|
1280
1478
|
: deriveSessionTitle(safeFirstMessage);
|
|
1281
1479
|
return {
|
|
1282
1480
|
session: {
|
|
@@ -1323,12 +1521,12 @@ export function createSessionDaemon({
|
|
|
1323
1521
|
|| runtimeRegistry?.findBySessionId(sessionId)
|
|
1324
1522
|
|| (runtime?.session?.sessionId === sessionId ? runtime : undefined);
|
|
1325
1523
|
if (activeRuntime?.session) {
|
|
1326
|
-
|
|
1327
|
-
if (typeof manager?.appendSessionInfo !== 'function') {
|
|
1524
|
+
if (typeof activeRuntime.session.setSessionName !== 'function') {
|
|
1328
1525
|
throw new SessionDaemonProtocolError('INVALID_SESSION', 'Pi returned an invalid active session.');
|
|
1329
1526
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1527
|
+
// Pi appends `session_info` and emits `session_info_changed` to
|
|
1528
|
+
// listeners and extensions; the subscriber publishes `session.updated`.
|
|
1529
|
+
activeRuntime.session.setSessionName(title);
|
|
1332
1530
|
return;
|
|
1333
1531
|
}
|
|
1334
1532
|
|
|
@@ -1650,6 +1848,14 @@ export function createSessionDaemon({
|
|
|
1650
1848
|
return [projected];
|
|
1651
1849
|
}
|
|
1652
1850
|
if (entry?.type !== 'message' || !entry.message || typeof entry.id !== 'string') return [];
|
|
1851
|
+
// User shell commands (`!cmd`) recorded by Pi, including ones run from
|
|
1852
|
+
// the Pi CLI, render as reserved `pichamber.bash` extension items.
|
|
1853
|
+
const bashItem = projectBashExecutionEntry(entry, {
|
|
1854
|
+
sessionId: session.sessionId,
|
|
1855
|
+
directory: targetDir,
|
|
1856
|
+
redact: redactAttachmentPaths,
|
|
1857
|
+
});
|
|
1858
|
+
if (bashItem) return [bashItem];
|
|
1653
1859
|
const timestamp = Date.parse(entry.timestamp);
|
|
1654
1860
|
const createdAt = Number.isFinite(timestamp) ? timestamp : 0;
|
|
1655
1861
|
if (entry.message.role === 'user') {
|
|
@@ -1907,7 +2113,8 @@ export function createSessionDaemon({
|
|
|
1907
2113
|
...(page.hasMoreBefore ? { hasMoreBefore: true, beforeCursor: page.beforeCursor } : {}),
|
|
1908
2114
|
lastSequence: sequence,
|
|
1909
2115
|
isStreaming,
|
|
1910
|
-
lifecycle: retry ? 'retry' : isStreaming ? 'busy' : 'idle',
|
|
2116
|
+
lifecycle: retry ? 'retry' : isStreaming || commandOnlyRun(session.sessionId, session) ? 'busy' : 'idle',
|
|
2117
|
+
...(!retry && commandOnlyRun(session.sessionId, session) ? { command: commandOnlyRun(session.sessionId, session) } : {}),
|
|
1911
2118
|
...(retry ? { retry } : {}),
|
|
1912
2119
|
...(compaction ? { compaction } : {}),
|
|
1913
2120
|
...(activeRunStartedAt.has(session.sessionId) ? { runStartedAt: activeRunStartedAt.get(session.sessionId) } : {}),
|
|
@@ -1920,7 +2127,9 @@ export function createSessionDaemon({
|
|
|
1920
2127
|
...(extensionSnapshot.title ? { extensionTitle: extensionSnapshot.title } : {}),
|
|
1921
2128
|
...(extensionSnapshot.working ? { extensionWorking: extensionSnapshot.working } : {}),
|
|
1922
2129
|
...(extensionSnapshot.draftTracked ? { extensionDraftTracked: true } : {}),
|
|
2130
|
+
...(extensionSnapshot.surfaces ? { extensionSurfaces: extensionSnapshot.surfaces } : {}),
|
|
1923
2131
|
inputState: { pending: pendingInput.summaryFor(session.sessionId) },
|
|
2132
|
+
bashExecutions: userBash.snapshot(session.sessionId) ?? [],
|
|
1924
2133
|
};
|
|
1925
2134
|
};
|
|
1926
2135
|
|
|
@@ -2078,20 +2287,32 @@ export function createSessionDaemon({
|
|
|
2078
2287
|
return { providers: [...providers.values()] };
|
|
2079
2288
|
};
|
|
2080
2289
|
|
|
2081
|
-
|
|
2290
|
+
// In-flight refreshes are shared per resolved directory, never across
|
|
2291
|
+
// directories, so a concurrent refresh for another project cannot return
|
|
2292
|
+
// this project's catalog. Refreshes for different directories still run one
|
|
2293
|
+
// after another: each touches every resident ModelRuntime and installs
|
|
2294
|
+
// temporary catalog keys, which must not interleave.
|
|
2295
|
+
const refreshProvidersInflight = new Map();
|
|
2296
|
+
let refreshProvidersQueue = Promise.resolve();
|
|
2082
2297
|
const refreshProviders = async (requestedDirectory) => {
|
|
2083
2298
|
try {
|
|
2084
2299
|
await flushPendingRuntimeRecreation();
|
|
2085
2300
|
} catch {
|
|
2086
2301
|
// A failed rebuild stays queued for a later edge; the catalog refresh below retries startup.
|
|
2087
2302
|
}
|
|
2088
|
-
|
|
2089
|
-
const
|
|
2303
|
+
const targetDir = resolve(await resolveDirectory(requestedDirectory));
|
|
2304
|
+
const existing = refreshProvidersInflight.get(targetDir);
|
|
2305
|
+
if (existing) return existing;
|
|
2306
|
+
const task = refreshProvidersQueue.then(async () => {
|
|
2090
2307
|
const signal = typeof AbortSignal.timeout === 'function' ? AbortSignal.timeout(15_000) : undefined;
|
|
2091
2308
|
// Refresh only live runtimes. Transient prompt-mutation services are never
|
|
2092
|
-
// retained, so there are no orphan ModelRuntimes to refresh here
|
|
2093
|
-
//
|
|
2309
|
+
// retained, so there are no orphan ModelRuntimes to refresh here. The
|
|
2310
|
+
// requested directory's runtime is always included (started if it is not
|
|
2311
|
+
// resident) because the returned catalog comes from it via listProviders.
|
|
2094
2312
|
const runtimes = new Set();
|
|
2313
|
+
const target = await ensureRuntime(targetDir);
|
|
2314
|
+
if (target?.session?.modelRuntime) runtimes.add(target.session.modelRuntime);
|
|
2315
|
+
if (target?.services?.modelRuntime) runtimes.add(target.services.modelRuntime);
|
|
2095
2316
|
if (runtime?.session?.modelRuntime) runtimes.add(runtime.session.modelRuntime);
|
|
2096
2317
|
if (runtime?.services?.modelRuntime) runtimes.add(runtime.services.modelRuntime);
|
|
2097
2318
|
if (runtimeRegistry?.listAll) {
|
|
@@ -2102,11 +2323,6 @@ export function createSessionDaemon({
|
|
|
2102
2323
|
}
|
|
2103
2324
|
} catch {}
|
|
2104
2325
|
}
|
|
2105
|
-
if (runtimes.size === 0) {
|
|
2106
|
-
const active = await ensureRuntime(requestedDirectory ? await resolveDirectory(requestedDirectory) : undefined);
|
|
2107
|
-
const mr = active?.session?.modelRuntime ?? active?.services?.modelRuntime;
|
|
2108
|
-
if (mr) runtimes.add(mr);
|
|
2109
|
-
}
|
|
2110
2326
|
const dummyMap = new Map();
|
|
2111
2327
|
for (const mr of runtimes) {
|
|
2112
2328
|
try {
|
|
@@ -2151,12 +2367,13 @@ export function createSessionDaemon({
|
|
|
2151
2367
|
throw new SessionDaemonProtocolError('PI_MODEL_CONFIG_INVALID', 'Pi models configuration is invalid.');
|
|
2152
2368
|
}
|
|
2153
2369
|
}
|
|
2154
|
-
const catalog = await listProviders(
|
|
2370
|
+
const catalog = await listProviders(targetDir);
|
|
2155
2371
|
return catalog;
|
|
2156
|
-
})
|
|
2157
|
-
refreshProvidersInflight
|
|
2372
|
+
}).finally(() => {
|
|
2373
|
+
if (refreshProvidersInflight.get(targetDir) === task) refreshProvidersInflight.delete(targetDir);
|
|
2158
2374
|
});
|
|
2159
|
-
refreshProvidersInflight
|
|
2375
|
+
refreshProvidersInflight.set(targetDir, task);
|
|
2376
|
+
refreshProvidersQueue = task.catch(() => {});
|
|
2160
2377
|
return task;
|
|
2161
2378
|
};
|
|
2162
2379
|
|
|
@@ -3286,6 +3503,12 @@ export function createSessionDaemon({
|
|
|
3286
3503
|
if (!requestedDelivery && activeRuntime.session.isStreaming) {
|
|
3287
3504
|
throw new SessionDaemonProtocolError('SESSION_BUSY', 'The Pi session already has an active run.');
|
|
3288
3505
|
}
|
|
3506
|
+
// Pi holds input while an extension command runs without an agent turn;
|
|
3507
|
+
// steer and follow-up only queue behind a streaming turn, so they would
|
|
3508
|
+
// start a second run here. Clients queue the message until idle.
|
|
3509
|
+
if (commandOnlyRun(payload.sessionId, activeRuntime.session)) {
|
|
3510
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'An extension command is still running.');
|
|
3511
|
+
}
|
|
3289
3512
|
beginSessionInput(activeRuntime);
|
|
3290
3513
|
try {
|
|
3291
3514
|
if (payload.model !== undefined) {
|
|
@@ -3301,8 +3524,15 @@ export function createSessionDaemon({
|
|
|
3301
3524
|
// input that actually enters the transcript. Resolve this from Pi's live
|
|
3302
3525
|
// registered-command catalog rather than trusting a browser hint.
|
|
3303
3526
|
const manager = activeRuntime.session?.sessionManager;
|
|
3304
|
-
|
|
3305
|
-
|
|
3527
|
+
// Parsed exactly as Pi's `_tryExecuteExtensionCommand` does on the text
|
|
3528
|
+
// it receives (attachments are appended below, so they are prepared
|
|
3529
|
+
// first): case-sensitive, starting at the first character, name ending
|
|
3530
|
+
// at the first space.
|
|
3531
|
+
const attachments = await prepareAttachmentContent(payload.attachments);
|
|
3532
|
+
const text = [payload.text, attachments.text].filter(Boolean).join('\n\n');
|
|
3533
|
+
const isSlashPrompt = typeof text === 'string' && text.startsWith('/');
|
|
3534
|
+
const slashInvocation = isSlashPrompt
|
|
3535
|
+
? (text.indexOf(' ') === -1 ? text.slice(1) : text.slice(1, text.indexOf(' ')))
|
|
3306
3536
|
: undefined;
|
|
3307
3537
|
const registeredExtensionCommands = typeof activeRuntime.session?.extensionRunner?.getRegisteredCommands === 'function'
|
|
3308
3538
|
? activeRuntime.session.extensionRunner.getRegisteredCommands()
|
|
@@ -3310,23 +3540,25 @@ export function createSessionDaemon({
|
|
|
3310
3540
|
const isExtensionCommand = Boolean(
|
|
3311
3541
|
slashInvocation
|
|
3312
3542
|
&& Array.isArray(registeredExtensionCommands)
|
|
3313
|
-
&& registeredExtensionCommands.some((command) =>
|
|
3314
|
-
&& command.invocationName.toLowerCase() === slashInvocation.toLowerCase()),
|
|
3543
|
+
&& registeredExtensionCommands.some((command) => command?.invocationName === slashInvocation),
|
|
3315
3544
|
);
|
|
3316
|
-
//
|
|
3317
|
-
//
|
|
3545
|
+
// Like the Pi CLI, never persist an auto-title. Lists derive the display
|
|
3546
|
+
// title from the first user prompt; publish that derived title live (not
|
|
3547
|
+
// persisted) so connected surfaces converge without waiting for a list.
|
|
3318
3548
|
if (!isExtensionCommand && typeof payload.text === 'string' && payload.text.trim().length > 0 && !manager?.getSessionName?.()) {
|
|
3319
3549
|
const derived = deriveSessionTitle(payload.text);
|
|
3320
|
-
if (derived
|
|
3321
|
-
manager.appendSessionInfo(derived);
|
|
3550
|
+
if (derived) {
|
|
3322
3551
|
publish('session.updated', { title: redactAttachmentPaths(derived) }, payload.sessionId, activeRuntime.cwd);
|
|
3323
3552
|
}
|
|
3324
3553
|
}
|
|
3325
3554
|
|
|
3326
|
-
const attachments = await prepareAttachmentContent(payload.attachments);
|
|
3327
|
-
const text = [payload.text, attachments.text].filter(Boolean).join('\n\n');
|
|
3328
3555
|
const images = attachments.images.length > 0 ? attachments.images : undefined;
|
|
3329
|
-
|
|
3556
|
+
// Re-checked after the model and attachment awaits: a command another
|
|
3557
|
+
// client dispatched meanwhile holds this input too. Nothing below awaits
|
|
3558
|
+
// before the command marker is set.
|
|
3559
|
+
if (commandOnlyRun(payload.sessionId, activeRuntime.session)) {
|
|
3560
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'An extension command is still running.');
|
|
3561
|
+
}
|
|
3330
3562
|
const messageId = typeof payload.messageId === 'string' && payload.messageId.length > 0
|
|
3331
3563
|
? payload.messageId
|
|
3332
3564
|
: activeRuntime.session.sessionManager?.getLeafId?.() ?? `msg_${randomUUID()}`;
|
|
@@ -3351,6 +3583,15 @@ export function createSessionDaemon({
|
|
|
3351
3583
|
? { provider: activeRuntime.session.model.provider, id: activeRuntime.session.model.id }
|
|
3352
3584
|
: null;
|
|
3353
3585
|
let promptPromise;
|
|
3586
|
+
// A command's custom() surfaces are titled with its name (see
|
|
3587
|
+
// describeCustomOrigin). Cleared when the command settles.
|
|
3588
|
+
const commandMarker = isExtensionCommand ? { name: slashInvocation } : undefined;
|
|
3589
|
+
if (commandMarker) runningCommandBySession.set(payload.sessionId, commandMarker);
|
|
3590
|
+
if (typeof payload.clientId === 'string' && payload.clientId.length > 0 && payload.clientId.length <= 128) {
|
|
3591
|
+
promptClientBySession.set(payload.sessionId, payload.clientId);
|
|
3592
|
+
} else {
|
|
3593
|
+
promptClientBySession.delete(payload.sessionId);
|
|
3594
|
+
}
|
|
3354
3595
|
// True SDK acceptance: await the prompt preflight signal, not the full
|
|
3355
3596
|
// agent turn. In SDK 1.0.0, preflightResult is called on acceptance with
|
|
3356
3597
|
// a PromptDisposition ("started" | "queued" | "handled"). Rejections
|
|
@@ -3382,13 +3623,46 @@ export function createSessionDaemon({
|
|
|
3382
3623
|
...(requestedDelivery ? { streamingBehavior: requestedDelivery } : {}),
|
|
3383
3624
|
preflightResult: onPreflightResult,
|
|
3384
3625
|
});
|
|
3626
|
+
// Pi reports `handled` for a registered command only once its handler
|
|
3627
|
+
// returns. A command waiting on custom() or a dialog would hold the
|
|
3628
|
+
// browser's send (and the composer text) until it closes, so accept
|
|
3629
|
+
// it once dispatched; Pi always runs a registered command.
|
|
3630
|
+
if (isExtensionCommand) onPreflightResult('handled');
|
|
3631
|
+
if (commandMarker && commandOnlyRun(payload.sessionId, activeRuntime.session)) {
|
|
3632
|
+
if (!activeRunStartedAt.has(payload.sessionId)) activeRunStartedAt.set(payload.sessionId, Date.now());
|
|
3633
|
+
publish('session.lifecycle', {
|
|
3634
|
+
state: 'busy',
|
|
3635
|
+
command: `/${commandMarker.name}`,
|
|
3636
|
+
runStartedAt: activeRunStartedAt.get(payload.sessionId),
|
|
3637
|
+
serverNow: Date.now(),
|
|
3638
|
+
}, payload.sessionId, activeRuntime.cwd);
|
|
3639
|
+
}
|
|
3385
3640
|
} catch (error) {
|
|
3386
3641
|
removeUserStart(payload.sessionId, generation);
|
|
3642
|
+
if (commandMarker && runningCommandBySession.get(payload.sessionId) === commandMarker) runningCommandBySession.delete(payload.sessionId);
|
|
3387
3643
|
throw error;
|
|
3388
3644
|
}
|
|
3389
3645
|
// A settlement without a preflight signal resolves the gate so a missing
|
|
3390
3646
|
// callback cannot hang acceptance. Resolve implies acceptance; reject
|
|
3391
3647
|
// implies preflight failure whose real error is propagated below.
|
|
3648
|
+
if (commandMarker) {
|
|
3649
|
+
// The command returning (or throwing) ends its busy run. This is the
|
|
3650
|
+
// only edge that does: `agent_settled` for a turn the command started
|
|
3651
|
+
// reports busy while the command still runs, and later sends (a steer
|
|
3652
|
+
// into that turn) move the send generation on, so the generic
|
|
3653
|
+
// settlement below cannot be relied on to publish idle here.
|
|
3654
|
+
const settleCommand = () => {
|
|
3655
|
+
if (runningCommandBySession.get(payload.sessionId) !== commandMarker) return;
|
|
3656
|
+
runningCommandBySession.delete(payload.sessionId);
|
|
3657
|
+
// A turn still streaming ends with its own agent_settled.
|
|
3658
|
+
if (activeRuntime.session?.isStreaming) return;
|
|
3659
|
+
settledSendGenerationBySession.set(payload.sessionId, sendGenerationBySession.get(payload.sessionId) ?? generation);
|
|
3660
|
+
activeRunStartedAt.delete(payload.sessionId);
|
|
3661
|
+
publish('session.lifecycle', { state: 'idle', serverNow: Date.now() }, payload.sessionId, activeRuntime.cwd);
|
|
3662
|
+
completeRequestedShutdown(payload.sessionId);
|
|
3663
|
+
};
|
|
3664
|
+
Promise.resolve(promptPromise).then(settleCommand, settleCommand);
|
|
3665
|
+
}
|
|
3392
3666
|
Promise.resolve(promptPromise).then(
|
|
3393
3667
|
() => {
|
|
3394
3668
|
if (preflightOutcome === null) {
|
|
@@ -3431,7 +3705,6 @@ export function createSessionDaemon({
|
|
|
3431
3705
|
removeUserStart(payload.sessionId, generation);
|
|
3432
3706
|
}
|
|
3433
3707
|
if (sendGenerationBySession.get(payload.sessionId) !== generation) return;
|
|
3434
|
-
if (settledSendGenerationBySession.get(payload.sessionId) === generation) return;
|
|
3435
3708
|
const curModel = activeRuntime.session?.model;
|
|
3436
3709
|
if (
|
|
3437
3710
|
curModel?.provider && curModel?.id
|
|
@@ -3441,8 +3714,10 @@ export function createSessionDaemon({
|
|
|
3441
3714
|
model: { providerId: curModel.provider, modelId: curModel.id },
|
|
3442
3715
|
}, payload.sessionId, activeRuntime.cwd);
|
|
3443
3716
|
}
|
|
3717
|
+
if (settledSendGenerationBySession.get(payload.sessionId) === generation) return;
|
|
3444
3718
|
if (activeRuntime.session?.isStreaming) return;
|
|
3445
3719
|
settledSendGenerationBySession.set(payload.sessionId, generation);
|
|
3720
|
+
activeRunStartedAt.delete(payload.sessionId);
|
|
3446
3721
|
// Extension commands can complete without starting an agent turn, so Pi
|
|
3447
3722
|
// emits no agent_settled event. Close the optimistic browser lifecycle
|
|
3448
3723
|
// when the command promise itself is the authoritative completion edge.
|
|
@@ -3458,6 +3733,7 @@ export function createSessionDaemon({
|
|
|
3458
3733
|
: {}),
|
|
3459
3734
|
}, payload.sessionId, activeRuntime.cwd);
|
|
3460
3735
|
if (!activeRuntime.session?.isStreaming) {
|
|
3736
|
+
// A command that threw already ended its busy run in settleCommand.
|
|
3461
3737
|
completeRequestedShutdown(payload.sessionId);
|
|
3462
3738
|
return;
|
|
3463
3739
|
}
|
|
@@ -3542,6 +3818,10 @@ export function createSessionDaemon({
|
|
|
3542
3818
|
await releaseResidentLease({ cwd: active?.cwd || targetDir, sessionId });
|
|
3543
3819
|
retryStateBySession.delete(sessionId);
|
|
3544
3820
|
compactionStateBySession.delete(sessionId);
|
|
3821
|
+
runningToolsBySession.delete(sessionId);
|
|
3822
|
+
runningCommandBySession.delete(sessionId);
|
|
3823
|
+
promptClientBySession.delete(sessionId);
|
|
3824
|
+
userBash.clearSession(sessionId);
|
|
3545
3825
|
activeRunStartedAt.delete(sessionId);
|
|
3546
3826
|
shutdownRequestedBySession.delete(sessionId);
|
|
3547
3827
|
sendGenerationBySession.delete(sessionId);
|
|
@@ -3697,6 +3977,11 @@ export function createSessionDaemon({
|
|
|
3697
3977
|
if (typeof event.parentToolCallId === 'string' && event.parentToolCallId.length > 0) {
|
|
3698
3978
|
break;
|
|
3699
3979
|
}
|
|
3980
|
+
if (typeof event.toolCallId === 'string' && typeof event.toolName === 'string') {
|
|
3981
|
+
const tools = runningToolsBySession.get(sessionId) ?? new Map();
|
|
3982
|
+
tools.set(event.toolCallId, event.toolName);
|
|
3983
|
+
runningToolsBySession.set(sessionId, tools);
|
|
3984
|
+
}
|
|
3700
3985
|
const messageId = streamingMessageIds.get(sessionId) ?? latestAssistantMessageIds.get(sessionId) ?? `assistant-${sessionId}`;
|
|
3701
3986
|
const startedAt = Date.now();
|
|
3702
3987
|
const activeRuntime = runtimeRegistry?.get({ cwd: directory, sessionId }) || runtime;
|
|
@@ -3788,6 +4073,8 @@ export function createSessionDaemon({
|
|
|
3788
4073
|
if (typeof event.parentToolCallId === 'string' && event.parentToolCallId.length > 0) {
|
|
3789
4074
|
break;
|
|
3790
4075
|
}
|
|
4076
|
+
const runningTools = runningToolsBySession.get(sessionId);
|
|
4077
|
+
if (runningTools?.delete(event.toolCallId) && runningTools.size === 0) runningToolsBySession.delete(sessionId);
|
|
3791
4078
|
const messageId = streamingMessageIds.get(sessionId) ?? latestAssistantMessageIds.get(sessionId) ?? `assistant-${sessionId}`;
|
|
3792
4079
|
const timingKey = toolTimingKey(sessionId, event.toolCallId);
|
|
3793
4080
|
const startedAt = toolStartedAt.get(timingKey);
|
|
@@ -3886,7 +4173,22 @@ export function createSessionDaemon({
|
|
|
3886
4173
|
toolInputBySession.delete(sessionId);
|
|
3887
4174
|
clearToolTimingsForSession(sessionId, { keepCompleted: true });
|
|
3888
4175
|
extensionToolRenderer.clearSession(sessionId);
|
|
3889
|
-
|
|
4176
|
+
// A missed tool_execution_end must not title later surfaces.
|
|
4177
|
+
runningToolsBySession.delete(sessionId);
|
|
4178
|
+
{
|
|
4179
|
+
// A turn the command started (sendUserMessage) ended while the
|
|
4180
|
+
// command still runs: the session stays busy until it returns.
|
|
4181
|
+
const command = commandOnlyRun(sessionId, owningRuntime?.session);
|
|
4182
|
+
if (command) {
|
|
4183
|
+
activeRunStartedAt.set(sessionId, Date.now());
|
|
4184
|
+
publish('session.lifecycle', { state: 'busy', command, runStartedAt: activeRunStartedAt.get(sessionId), serverNow: Date.now() }, sessionId, directory);
|
|
4185
|
+
// The command's own settlement publishes idle, completes a
|
|
4186
|
+
// requested shutdown, and re-arms idle disposal and pending
|
|
4187
|
+
// reloads; doing any of that now would end it mid-run.
|
|
4188
|
+
break;
|
|
4189
|
+
}
|
|
4190
|
+
publish('session.lifecycle', { state: 'idle', serverNow: Date.now() }, sessionId, directory);
|
|
4191
|
+
}
|
|
3890
4192
|
if (!completeRequestedShutdown(sessionId)) {
|
|
3891
4193
|
void flushPendingResourceReload(owningRuntime).then(() => {
|
|
3892
4194
|
if (!shutdownRequestedBySession.has(sessionId)) scheduleIdleDisposal(sessionId);
|
|
@@ -3895,8 +4197,10 @@ export function createSessionDaemon({
|
|
|
3895
4197
|
void flushPendingRuntimeRecreation().catch(() => {});
|
|
3896
4198
|
break;
|
|
3897
4199
|
case 'session_info_changed': {
|
|
4200
|
+
// An empty title means Pi cleared the name; clients fall back to
|
|
4201
|
+
// the derived first-prompt title.
|
|
3898
4202
|
const title = typeof event.name === 'string' ? event.name.trim() : '';
|
|
3899
|
-
|
|
4203
|
+
publish('session.updated', { title: title ? redactAttachmentPaths(title).slice(0, 256) : '' }, sessionId, directory);
|
|
3900
4204
|
break;
|
|
3901
4205
|
}
|
|
3902
4206
|
case 'model_select':
|
|
@@ -4025,10 +4329,12 @@ export function createSessionDaemon({
|
|
|
4025
4329
|
'projects.list', 'projects.select', 'sessions.list', 'sessions.create', 'sessions.open', 'sessions.messages', 'sessions.rename', 'sessions.delete',
|
|
4026
4330
|
'sessions.tree', 'sessions.navigate', 'sessions.fork', 'sessions.clone', 'sessions.prompt',
|
|
4027
4331
|
'sessions.steer', 'sessions.followUp', 'sessions.sendReceipt', 'sessions.pendingInput', 'sessions.abort', 'sessions.setModel',
|
|
4028
|
-
'sessions.setThinking', 'sessions.compact', 'engines.list', 'providers.list', 'providers.refresh', 'providers.config.get', 'providers.models.set', 'providers.models.add', 'providers.status', 'providers.login',
|
|
4332
|
+
'sessions.setThinking', 'sessions.compact', 'sessions.bash', 'sessions.abortBash', 'engines.list', 'providers.list', 'providers.refresh', 'providers.config.get', 'providers.models.set', 'providers.models.add', 'providers.status', 'providers.login',
|
|
4029
4333
|
'providers.login.respond', 'providers.login.status', 'providers.logout', 'settings.get', 'settings.set',
|
|
4030
4334
|
'resources.list', 'resources.update', 'resources.prompts.create', 'resources.prompts.update', 'resources.prompts.delete',
|
|
4031
4335
|
'extensions.list', 'extensions.respond', 'extensions.draft',
|
|
4336
|
+
'openUrl.publish',
|
|
4337
|
+
'extensions.custom.input', 'extensions.custom.viewport', 'extensions.custom.close', 'extensions.custom.focus', 'extensions.custom.refresh',
|
|
4032
4338
|
],
|
|
4033
4339
|
...(Number.isInteger(healthMetadata.daemonPid) ? { daemonPid: healthMetadata.daemonPid } : {}),
|
|
4034
4340
|
...(typeof profileKey === 'string' && profileKey.length > 0 ? { profileKey } : {}),
|
|
@@ -4226,6 +4532,15 @@ export function createSessionDaemon({
|
|
|
4226
4532
|
writeFrame(socket, { protocolVersion: PROTOCOL_VERSION, kind: 'response', requestId: message.requestId, result: resolution });
|
|
4227
4533
|
return;
|
|
4228
4534
|
}
|
|
4535
|
+
case 'extensions.custom.input':
|
|
4536
|
+
case 'extensions.custom.viewport':
|
|
4537
|
+
case 'extensions.custom.close':
|
|
4538
|
+
case 'extensions.custom.focus':
|
|
4539
|
+
case 'extensions.custom.refresh': {
|
|
4540
|
+
const result = handleCustomCommand(message.command, message.payload);
|
|
4541
|
+
writeFrame(socket, { protocolVersion: PROTOCOL_VERSION, kind: 'response', requestId: message.requestId, result });
|
|
4542
|
+
return;
|
|
4543
|
+
}
|
|
4229
4544
|
case 'extensions.draft': {
|
|
4230
4545
|
const sessionId = message.payload?.sessionId;
|
|
4231
4546
|
const text = message.payload?.text;
|
|
@@ -4273,6 +4588,46 @@ export function createSessionDaemon({
|
|
|
4273
4588
|
});
|
|
4274
4589
|
return;
|
|
4275
4590
|
}
|
|
4591
|
+
case 'openUrl.publish': {
|
|
4592
|
+
// An Open request from the PiChamber server's intake. Not
|
|
4593
|
+
// session-scoped on input: the daemon attributes it and publishes a
|
|
4594
|
+
// `session.openUrl` event. It is never stored in a transcript; the
|
|
4595
|
+
// replay log may resend it, and devices ignore stale ones by age.
|
|
4596
|
+
const url = normalizeOpenRequestUrl(message.payload?.url);
|
|
4597
|
+
if (!url) throw new SessionDaemonProtocolError('INVALID_ARGUMENT', 'An http(s) URL is required.');
|
|
4598
|
+
const residentRuntimes = new Set();
|
|
4599
|
+
if (runtime?.session?.sessionId) residentRuntimes.add(runtime);
|
|
4600
|
+
for (const tracked of runtimeRegistry?.listAll?.() ?? []) residentRuntimes.add(tracked);
|
|
4601
|
+
const residents = [...residentRuntimes].map((tracked) => ({
|
|
4602
|
+
sessionId: tracked?.session?.sessionId,
|
|
4603
|
+
directory: typeof tracked?.cwd === 'string' && tracked.cwd.length > 0 ? tracked.cwd : (activeDirectory || cwd),
|
|
4604
|
+
busy: tracked?.session?.isStreaming === true
|
|
4605
|
+
|| tracked?.session?.isCompacting === true
|
|
4606
|
+
|| activeSessionInputs.has(tracked),
|
|
4607
|
+
}));
|
|
4608
|
+
const target = resolveOpenRequestSession({
|
|
4609
|
+
requestedSessionId: typeof message.payload?.sessionId === 'string' ? message.payload.sessionId : undefined,
|
|
4610
|
+
residents,
|
|
4611
|
+
recent: lastPublishedSession,
|
|
4612
|
+
});
|
|
4613
|
+
if (target) {
|
|
4614
|
+
publish('session.openUrl', {
|
|
4615
|
+
id: `open-${randomUUID()}`,
|
|
4616
|
+
url,
|
|
4617
|
+
attributed: target.attributed,
|
|
4618
|
+
createdAt: Date.now(),
|
|
4619
|
+
}, target.sessionId, target.directory);
|
|
4620
|
+
}
|
|
4621
|
+
writeFrame(socket, {
|
|
4622
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
4623
|
+
kind: 'response',
|
|
4624
|
+
requestId: message.requestId,
|
|
4625
|
+
result: target
|
|
4626
|
+
? { published: true, sessionId: target.sessionId, attributed: target.attributed }
|
|
4627
|
+
: { published: false },
|
|
4628
|
+
});
|
|
4629
|
+
return;
|
|
4630
|
+
}
|
|
4276
4631
|
case 'sessions.pendingInput': {
|
|
4277
4632
|
// Daemon-level pending-input state for every session with an open
|
|
4278
4633
|
// request. No arguments, not session-scoped, never routed to
|
|
@@ -4472,6 +4827,39 @@ export function createSessionDaemon({
|
|
|
4472
4827
|
writeFrame(socket, { protocolVersion: PROTOCOL_VERSION, kind: 'response', requestId: message.requestId, result: {} });
|
|
4473
4828
|
return;
|
|
4474
4829
|
}
|
|
4830
|
+
case 'sessions.bash': {
|
|
4831
|
+
let request;
|
|
4832
|
+
try {
|
|
4833
|
+
request = validateUserBashRequest(message.payload);
|
|
4834
|
+
} catch (error) {
|
|
4835
|
+
throw new SessionDaemonProtocolError(error.code ?? 'INVALID_ARGUMENT', error.message);
|
|
4836
|
+
}
|
|
4837
|
+
const activeRuntime = await activateSession(message.payload?.sessionId, message.payload?.directory || message.payload?.cwd);
|
|
4838
|
+
// Held like every other input while an extension command runs.
|
|
4839
|
+
if (commandOnlyRun(message.payload.sessionId, activeRuntime.session)) {
|
|
4840
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'An extension command is still running.');
|
|
4841
|
+
}
|
|
4842
|
+
let started;
|
|
4843
|
+
try {
|
|
4844
|
+
started = userBash.start({
|
|
4845
|
+
sessionId: message.payload.sessionId,
|
|
4846
|
+
directory: activeRuntime.cwd,
|
|
4847
|
+
session: activeRuntime.session,
|
|
4848
|
+
...request,
|
|
4849
|
+
});
|
|
4850
|
+
} catch (error) {
|
|
4851
|
+
if (error instanceof UserBashError) throw new SessionDaemonProtocolError(error.code, error.message);
|
|
4852
|
+
throw error;
|
|
4853
|
+
}
|
|
4854
|
+
writeFrame(socket, { protocolVersion: PROTOCOL_VERSION, kind: 'response', requestId: message.requestId, result: { accepted: true, id: started.id } });
|
|
4855
|
+
return;
|
|
4856
|
+
}
|
|
4857
|
+
case 'sessions.abortBash': {
|
|
4858
|
+
const activeRuntime = await activateSession(message.payload?.sessionId, message.payload?.directory || message.payload?.cwd);
|
|
4859
|
+
userBash.abort(activeRuntime.session);
|
|
4860
|
+
writeFrame(socket, { protocolVersion: PROTOCOL_VERSION, kind: 'response', requestId: message.requestId, result: {} });
|
|
4861
|
+
return;
|
|
4862
|
+
}
|
|
4475
4863
|
case 'sessions.compact': {
|
|
4476
4864
|
if (message.payload?.thinking !== undefined) validateThinking(message.payload.thinking);
|
|
4477
4865
|
if (message.payload?.customInstructions !== undefined
|
|
@@ -4483,6 +4871,9 @@ export function createSessionDaemon({
|
|
|
4483
4871
|
if (activeRuntime.session.isCompacting || currentCompaction?.phase === 'running' || currentCompaction?.phase === 'retrying') {
|
|
4484
4872
|
throw new SessionDaemonProtocolError('SESSION_BUSY', 'This session is already compacting.');
|
|
4485
4873
|
}
|
|
4874
|
+
if (commandOnlyRun(message.payload.sessionId, activeRuntime.session)) {
|
|
4875
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'An extension command is still running.');
|
|
4876
|
+
}
|
|
4486
4877
|
if (message.payload?.model !== undefined) {
|
|
4487
4878
|
await setSessionModel(activeRuntime, message.payload.model);
|
|
4488
4879
|
publishSessionModel(activeRuntime.session, message.payload.sessionId, activeRuntime.cwd);
|
|
@@ -4490,6 +4881,10 @@ export function createSessionDaemon({
|
|
|
4490
4881
|
if (message.payload?.thinking !== undefined) {
|
|
4491
4882
|
applyThinking(activeRuntime, message.payload.thinking, message.payload.sessionId, activeRuntime.cwd);
|
|
4492
4883
|
}
|
|
4884
|
+
// Again after the model await, which a command dispatch can overtake.
|
|
4885
|
+
if (commandOnlyRun(message.payload.sessionId, activeRuntime.session)) {
|
|
4886
|
+
throw new SessionDaemonProtocolError('SESSION_BUSY', 'An extension command is still running.');
|
|
4887
|
+
}
|
|
4493
4888
|
Promise.resolve(activeRuntime.session.compact(message.payload?.customInstructions)).catch((error) => {
|
|
4494
4889
|
const current = compactionStateBySession.get(message.payload.sessionId);
|
|
4495
4890
|
if (current?.phase === 'completed' || current?.phase === 'failed' || current?.phase === 'aborted') return;
|
|
@@ -4595,6 +4990,7 @@ export function createSessionDaemon({
|
|
|
4595
4990
|
// window, a daemon restart, or a cursor from a retired epoch.
|
|
4596
4991
|
publishSnapshot(socket, requestedSessionId, { resync: fromSequence !== undefined || epochMismatch === true });
|
|
4597
4992
|
}
|
|
4993
|
+
writeCustomKeyframes(socket, requestedSessionId);
|
|
4598
4994
|
continue;
|
|
4599
4995
|
}
|
|
4600
4996
|
requestChain = requestChain.then(() => handleRequest(socket, message)).catch((error) => reject(error));
|
|
@@ -4688,6 +5084,9 @@ export function createSessionDaemon({
|
|
|
4688
5084
|
shutdownRequestedBySession.clear();
|
|
4689
5085
|
sendGenerationBySession.clear();
|
|
4690
5086
|
settledSendGenerationBySession.clear();
|
|
5087
|
+
runningToolsBySession.clear();
|
|
5088
|
+
runningCommandBySession.clear();
|
|
5089
|
+
promptClientBySession.clear();
|
|
4691
5090
|
pendingUserStartsBySession.clear();
|
|
4692
5091
|
queueSizesBySession.clear();
|
|
4693
5092
|
queueShrinkBySession.clear();
|