visual-living-plan 0.1.0 → 2.32.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/DESIGN.md +213 -0
- package/README.md +155 -28
- package/dist/AuthScreen.d.ts +9 -0
- package/dist/AuthScreen.js +7 -0
- package/dist/DesktopModeSwitch.d.ts +13 -0
- package/dist/DesktopModeSwitch.js +14 -0
- package/dist/OAuthMark.d.ts +6 -0
- package/dist/OAuthMark.js +8 -0
- package/dist/accountInitials.d.ts +5 -0
- package/dist/accountInitials.js +20 -0
- package/dist/accountLinking.d.ts +26 -0
- package/dist/accountLinking.js +46 -0
- package/dist/agentEvents.d.ts +31 -0
- package/dist/agentEvents.js +260 -0
- package/dist/agentPresence.d.ts +42 -0
- package/dist/agentPresence.js +69 -0
- package/dist/agentSkills.d.ts +35 -0
- package/dist/agentSkills.js +89 -0
- package/dist/agentStream.d.ts +35 -0
- package/dist/agentStream.js +133 -0
- package/dist/appearanceDom.d.ts +13 -0
- package/dist/appearanceDom.js +24 -0
- package/dist/appearanceSettings.d.ts +29 -0
- package/dist/appearanceSettings.js +293 -0
- package/dist/assets.d.ts +14 -0
- package/dist/assets.js +72 -0
- package/dist/authSearch.d.ts +11 -0
- package/dist/authSearch.js +30 -0
- package/dist/changelog.d.ts +11 -0
- package/dist/changelog.js +63 -0
- package/dist/changelogParse.d.ts +53 -0
- package/dist/changelogParse.js +226 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1684 -0
- package/dist/cliLauncher.d.ts +40 -0
- package/dist/cliLauncher.js +170 -0
- package/dist/cliToken.d.ts +11 -0
- package/dist/cliToken.js +15 -0
- package/dist/client/.vite/manifest.json +1780 -0
- package/dist/client/assets/BarChart-DtV3dIq4.js +1 -0
- package/dist/client/assets/BlockEditor-BklSUBjk.js +168 -0
- package/dist/client/assets/BlockEditor-K5h6xc4_.css +1 -0
- package/dist/client/assets/CodeBlock-BbI08MlQ.js +1 -0
- package/dist/client/assets/CodeBlock-BxRMnldw.js +175 -0
- package/dist/client/assets/LineChart-CQYMEbD6.js +1 -0
- package/dist/client/assets/Mermaid-Ciu9eIoG.js +1 -0
- package/dist/client/assets/Mermaid-jPWLXX7e.js +1 -0
- package/dist/client/assets/Popover-DbE4vUPG.js +1 -0
- package/dist/client/assets/ReactFlowExecutionCanvas-BhVs-adc.js +7 -0
- package/dist/client/assets/ReactFlowExecutionCanvas-DLioOiRN.css +1 -0
- package/dist/client/assets/StatusIcon-C_-Lm9b4.js +1 -0
- package/dist/client/assets/Workflow-C92OpLyf.js +1 -0
- package/dist/client/assets/agentPresence-D8asHrTp.js +1 -0
- package/dist/client/assets/andromeeda-DW8vo71h.js +1 -0
- package/dist/client/assets/andromeeda-vGVdxbeo.js +1 -0
- package/dist/client/assets/arrow-up-CEVVOXD5.js +1 -0
- package/dist/client/assets/arrow-up-down-BSjnQK2I.js +1 -0
- package/dist/client/assets/aurora-x-CDeNXAV0.js +1 -0
- package/dist/client/assets/aurora-x-rMvKqtYI.js +1 -0
- package/dist/client/assets/ayu-dark-CwczpL8O.js +1 -0
- package/dist/client/assets/ayu-dark-DluEY0Gj.js +1 -0
- package/dist/client/assets/ayu-light-C3h-C4tm.js +1 -0
- package/dist/client/assets/ayu-light-DSh22xiD.js +1 -0
- package/dist/client/assets/ayu-mirage-Bqwy1Gya.js +1 -0
- package/dist/client/assets/ayu-mirage-JE6hAyHG.js +1 -0
- package/dist/client/assets/browserStore-BDGKYoJj.js +435 -0
- package/dist/client/assets/button-BI07wqbi.css +1 -0
- package/dist/client/assets/button-DJWAGApe.js +1 -0
- package/dist/client/assets/catppuccin-frappe-C9Q5zVZY.js +1 -0
- package/dist/client/assets/catppuccin-frappe-pyXErRRU.js +1 -0
- package/dist/client/assets/catppuccin-latte-BILSUICr.js +1 -0
- package/dist/client/assets/catppuccin-latte-CtsyrtPq.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-Ck60ZZQE.js +1 -0
- package/dist/client/assets/catppuccin-macchiato-R8nAf1vR.js +1 -0
- package/dist/client/assets/catppuccin-mocha-C_2G67cS.js +1 -0
- package/dist/client/assets/catppuccin-mocha-DjuaAJKi.js +1 -0
- package/dist/client/assets/ccount-nzzEXTrh.js +1 -0
- package/dist/client/assets/chartRows-CNjjLsAH.js +2 -0
- package/dist/client/assets/circle-x-BLGxA3gi.js +1 -0
- package/dist/client/assets/client-BsE_buVT.js +9 -0
- package/dist/client/assets/constants-CmGPilXJ.js +1 -0
- package/dist/client/assets/dark-plus-CHgc6GYj.js +1 -0
- package/dist/client/assets/dark-plus-Cs2F2srj.js +1 -0
- package/dist/client/assets/default-5FplaXL4.js +7 -0
- package/dist/client/assets/diffsTheme-PJJTu2Rq.js +1 -0
- package/dist/client/assets/dracula-BHWKrbxM.js +1 -0
- package/dist/client/assets/dracula-Cf1PG3MT.js +1 -0
- package/dist/client/assets/dracula-soft-5eyTD99u.js +1 -0
- package/dist/client/assets/dracula-soft-DXuNm1Kq.js +1 -0
- package/dist/client/assets/editSource-DQfw4nRm.js +1 -0
- package/dist/client/assets/editSource-U5AoD-Wo.js +14 -0
- package/dist/client/assets/engine-CLTPZlti.js +1 -0
- package/dist/client/assets/engine-DUyaiAMV.js +2 -0
- package/dist/client/assets/everforest-dark-CjdfwUBe.js +1 -0
- package/dist/client/assets/everforest-dark-sB-x3p7T.js +1 -0
- package/dist/client/assets/everforest-light-CfVwwCBP.js +1 -0
- package/dist/client/assets/everforest-light-Df2xbC6M.js +1 -0
- package/dist/client/assets/forgetDocuments-CIUBitCs.js +1 -0
- package/dist/client/assets/formatCSSVariablePrefix-KRh9vnZf.js +1 -0
- package/dist/client/assets/github-dark-BL6HSl_n.js +1 -0
- package/dist/client/assets/github-dark-C-LZuMrd.js +1 -0
- package/dist/client/assets/github-dark-default-DXG-b-1a.js +1 -0
- package/dist/client/assets/github-dark-default-zacuWV-M.js +1 -0
- package/dist/client/assets/github-dark-dimmed-Bx1FflLF.js +1 -0
- package/dist/client/assets/github-dark-dimmed-Mc0P9idi.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-B_tTalzw.js +1 -0
- package/dist/client/assets/github-dark-high-contrast-IMKX2AVF.js +1 -0
- package/dist/client/assets/github-light-EUqPIrTm.js +1 -0
- package/dist/client/assets/github-light-default-BXViO-2h.js +1 -0
- package/dist/client/assets/github-light-default-DVlCqP3X.js +1 -0
- package/dist/client/assets/github-light-high-contrast-B68TUdTA.js +1 -0
- package/dist/client/assets/github-light-high-contrast-Dj6zTyWR.js +1 -0
- package/dist/client/assets/github-light-mYhEBkPo.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-C820rvS2.js +1 -0
- package/dist/client/assets/gruvbox-dark-hard-QTgQQZn-.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-9d5YdCTx.js +1 -0
- package/dist/client/assets/gruvbox-dark-medium-BPjhmG05.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-MrdJrrXF.js +1 -0
- package/dist/client/assets/gruvbox-dark-soft-XCkqeBhR.js +1 -0
- package/dist/client/assets/gruvbox-light-hard--5-nXqNp.js +1 -0
- package/dist/client/assets/gruvbox-light-hard-BC_s9l72.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-BAWPOn9u.js +1 -0
- package/dist/client/assets/gruvbox-light-medium-COA1PZW2.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-BSMLrYjP.js +1 -0
- package/dist/client/assets/gruvbox-light-soft-CIJpzjAO.js +1 -0
- package/dist/client/assets/hastToHtml-Dj8rXue9.js +11 -0
- package/dist/client/assets/highlight-cB-PkhyE.js +1 -0
- package/dist/client/assets/highlights-LLBF1DTm.js +1 -0
- package/dist/client/assets/horizon-Ba2cwkSy.js +1 -0
- package/dist/client/assets/horizon-CE9ld1lL.js +1 -0
- package/dist/client/assets/horizon-bright-DSNQnXHK.js +1 -0
- package/dist/client/assets/horizon-bright-DaEDgBmR.js +1 -0
- package/dist/client/assets/houston-B6x0XVpU.js +1 -0
- package/dist/client/assets/houston-CsvMBhTu.js +1 -0
- package/dist/client/assets/jsx-runtime-DKj5X9O4.js +1 -0
- package/dist/client/assets/kanagawa-dragon-Bozd7klA.js +1 -0
- package/dist/client/assets/kanagawa-dragon-DhTFvBMT.js +1 -0
- package/dist/client/assets/kanagawa-lotus--m8sdOxn.js +1 -0
- package/dist/client/assets/kanagawa-lotus-BmuOG9ZW.js +1 -0
- package/dist/client/assets/kanagawa-wave-BML5mF2J.js +1 -0
- package/dist/client/assets/kanagawa-wave-D-tTv4k2.js +1 -0
- package/dist/client/assets/laserwave-C_8bwKvT.js +1 -0
- package/dist/client/assets/laserwave-HSLx0L75.js +1 -0
- package/dist/client/assets/lib-COgu-QLX.js +33 -0
- package/dist/client/assets/lib-CdRiGVUZ.js +1 -0
- package/dist/client/assets/light-plus-CUjWrTSi.js +1 -0
- package/dist/client/assets/light-plus-DVQuIRkW.js +1 -0
- package/dist/client/assets/loader-CjL04K29.js +1 -0
- package/dist/client/assets/main-BGMX_GnZ.js +2 -0
- package/dist/client/assets/main-BTko4EvJ.css +1 -0
- package/dist/client/assets/material-theme-Bm3Qr25_.js +1 -0
- package/dist/client/assets/material-theme-CnthUGfg.js +1 -0
- package/dist/client/assets/material-theme-darker-2IIEA8gg.js +1 -0
- package/dist/client/assets/material-theme-darker-DUi03Qre.js +1 -0
- package/dist/client/assets/material-theme-lighter-D2-qr5Vw.js +1 -0
- package/dist/client/assets/material-theme-lighter-uhdI0v04.js +1 -0
- package/dist/client/assets/material-theme-ocean-CHQ94UKr.js +1 -0
- package/dist/client/assets/material-theme-ocean-CWR-LogA.js +1 -0
- package/dist/client/assets/material-theme-palenight-B5W6OYN7.js +1 -0
- package/dist/client/assets/material-theme-palenight-Cnv8m1ra.js +1 -0
- package/dist/client/assets/mdxEntries-BNTMP8ct.css +1 -0
- package/dist/client/assets/mdxEntries-L-V7bB6i.js +1 -0
- package/dist/client/assets/mermaid-Bjhs-krb.js +1 -0
- package/dist/client/assets/mermaid-Di4j-zgD.js +146 -0
- package/dist/client/assets/min-dark-BSWPekZh.js +1 -0
- package/dist/client/assets/min-dark-EXoM-6Xo.js +1 -0
- package/dist/client/assets/min-light-DDpmG2fV.js +1 -0
- package/dist/client/assets/min-light-DVOTDhnA.js +1 -0
- package/dist/client/assets/monokai-BscAjiQZ.js +1 -0
- package/dist/client/assets/monokai-DkggTbGy.js +1 -0
- package/dist/client/assets/mountChrome-BVWpsDCy.js +122 -0
- package/dist/client/assets/mountChrome-DhTDH3YM.css +1 -0
- package/dist/client/assets/night-owl-Bdcs0PMi.js +1 -0
- package/dist/client/assets/night-owl-DhmEMT88.js +1 -0
- package/dist/client/assets/night-owl-light-RoU30LE0.js +1 -0
- package/dist/client/assets/night-owl-light-eJ-hLW7d.js +1 -0
- package/dist/client/assets/noShiki-DB8hQ_W3.js +1 -0
- package/dist/client/assets/noShiki-GTG3tT8x.js +1 -0
- package/dist/client/assets/nord-Cb4Vim4T.js +1 -0
- package/dist/client/assets/nord-u7hMircQ.js +1 -0
- package/dist/client/assets/offlineSync-Cv3FVIlJ.js +1 -0
- package/dist/client/assets/one-dark-pro-08PdtLzi.js +1 -0
- package/dist/client/assets/one-dark-pro-C6YyR8OD.js +1 -0
- package/dist/client/assets/one-light-D7Lr4KcI.js +1 -0
- package/dist/client/assets/one-light-DgvUEtgI.js +1 -0
- package/dist/client/assets/opfs-worker-DuTOCgWR.js +5919 -0
- package/dist/client/assets/pierre-dark-B2jZWvHG.js +1 -0
- package/dist/client/assets/pierre-dark-CpLgRqie.js +1 -0
- package/dist/client/assets/pierre-dark-protanopia-deuteranopia-B35FxJx-.js +1 -0
- package/dist/client/assets/pierre-dark-protanopia-deuteranopia-CebgQdRf.js +1 -0
- package/dist/client/assets/pierre-dark-soft-DdE7dyP3.js +1 -0
- package/dist/client/assets/pierre-dark-soft-kZQmAZld.js +1 -0
- package/dist/client/assets/pierre-dark-tritanopia-CXimiT7X.js +1 -0
- package/dist/client/assets/pierre-dark-tritanopia-CpjhbsIL.js +1 -0
- package/dist/client/assets/pierre-dark-vibrant-CpQYzh95.js +1 -0
- package/dist/client/assets/pierre-dark-vibrant-DzBsxHvQ.js +1 -0
- package/dist/client/assets/pierre-light-CoaEpmwp.js +1 -0
- package/dist/client/assets/pierre-light-Vf__O3ev.js +1 -0
- package/dist/client/assets/pierre-light-protanopia-deuteranopia-0fSaH845.js +1 -0
- package/dist/client/assets/pierre-light-protanopia-deuteranopia-BUtWcCQC.js +1 -0
- package/dist/client/assets/pierre-light-soft-C3QCXKvN.js +1 -0
- package/dist/client/assets/pierre-light-soft-lWLdNTOI.js +1 -0
- package/dist/client/assets/pierre-light-tritanopia-CEbqgOJL.js +1 -0
- package/dist/client/assets/pierre-light-tritanopia-CKLy6XvA.js +1 -0
- package/dist/client/assets/pierre-light-vibrant-D80Fkn33.js +1 -0
- package/dist/client/assets/pierre-light-vibrant-DDuTEIhH.js +1 -0
- package/dist/client/assets/planEditButton-CbWGczbi.js +45 -0
- package/dist/client/assets/planEvents-cuzv9ELr.js +1 -0
- package/dist/client/assets/planMdx-Db1ze_nN.js +110 -0
- package/dist/client/assets/plastic-B8mE6BxX.js +1 -0
- package/dist/client/assets/plastic-DQwYfKfQ.js +1 -0
- package/dist/client/assets/poimandres-DRFjx7u4.js +1 -0
- package/dist/client/assets/poimandres-DUFjrgxT.js +1 -0
- package/dist/client/assets/preload-helper-Dx0-lKy1.js +1 -0
- package/dist/client/assets/queryClient-Bs5tSUJh.js +1 -0
- package/dist/client/assets/react-dom-DpzJPrWF.js +1 -0
- package/dist/client/assets/rebaseDraft-B2--cj1c.js +19 -0
- package/dist/client/assets/red-BJvdDEUx.js +1 -0
- package/dist/client/assets/red-CYlAq2b0.js +1 -0
- package/dist/client/assets/register-hZEIk3A9.css +1 -0
- package/dist/client/assets/register-htm5s8o9.js +1 -0
- package/dist/client/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/dist/client/assets/rose-pine-BSqRqUae.js +1 -0
- package/dist/client/assets/rose-pine-aMsaMD1D.js +1 -0
- package/dist/client/assets/rose-pine-dawn-8PwUyIlP.js +1 -0
- package/dist/client/assets/rose-pine-dawn-U6TBE82u.js +1 -0
- package/dist/client/assets/rose-pine-moon-CAU7u1h4.js +1 -0
- package/dist/client/assets/rose-pine-moon-DO-qXg-I.js +1 -0
- package/dist/client/assets/routeEdges-B2z8v0di.js +24 -0
- package/dist/client/assets/selector-CDsXW7SO.css +1 -0
- package/dist/client/assets/selector-tlBGWtQl.js +1 -0
- package/dist/client/assets/settingsChrome-NGUDtEIp.js +1 -0
- package/dist/client/assets/shiki-BOXJeUHI.js +2 -0
- package/dist/client/assets/slack-dark-CMu0smFa.js +1 -0
- package/dist/client/assets/slack-dark-DnToyrRv.js +1 -0
- package/dist/client/assets/slack-ochin-B2OO5cIa.js +1 -0
- package/dist/client/assets/slack-ochin-BBne7cjw.js +1 -0
- package/dist/client/assets/snazzy-light-4G7pJPwS.js +1 -0
- package/dist/client/assets/snazzy-light-CV8HUEmk.js +1 -0
- package/dist/client/assets/solarized-dark-CmYmhSgI.js +1 -0
- package/dist/client/assets/solarized-dark-b97czJOk.js +1 -0
- package/dist/client/assets/solarized-light-CjLLwxRp.js +1 -0
- package/dist/client/assets/solarized-light-DFPxpIYQ.js +1 -0
- package/dist/client/assets/stampPlanParts-DVXYCykw.js +15 -0
- package/dist/client/assets/stampPlanParts-ctZzxWdw.css +1 -0
- package/dist/client/assets/stream-tokenizer-C3n8hi1h.js +4 -0
- package/dist/client/assets/synthwave-84-nFMaYfgc.js +1 -0
- package/dist/client/assets/synthwave-84-wQeDKbzQ.js +1 -0
- package/dist/client/assets/textChildren-ZDSs1dod.js +1 -0
- package/dist/client/assets/themes-CdTJhjZf.js +2 -0
- package/dist/client/assets/tokyo-night-D4ZgDiA7.js +1 -0
- package/dist/client/assets/tokyo-night-oM2G3aXe.js +1 -0
- package/dist/client/assets/triangle-alert-C9Sgr3jF.js +1 -0
- package/dist/client/assets/unwrapDefault-ByDmBtHB.js +1 -0
- package/dist/client/assets/utils-C9Glzetk.js +2 -0
- package/dist/client/assets/versionView-zkSROPw7.js +1 -0
- package/dist/client/assets/vesper-DdrHHSXu.js +1 -0
- package/dist/client/assets/vesper-sUHevyKv.js +1 -0
- package/dist/client/assets/vitesse-black-CfklMpOb.js +1 -0
- package/dist/client/assets/vitesse-black-fwtXNY1n.js +1 -0
- package/dist/client/assets/vitesse-dark-BZCL-v6S.js +1 -0
- package/dist/client/assets/vitesse-dark-CJkzwmKT.js +1 -0
- package/dist/client/assets/vitesse-light-BxMp8E1Y.js +1 -0
- package/dist/client/assets/vitesse-light-VbXTXTou.js +1 -0
- package/dist/client/assets/wa-sqlite-Ba70bhIr.wasm +0 -0
- package/dist/client/assets/warmPlans-CYFrLwcX.js +1 -0
- package/dist/client/assets/with-selector-HIcjK0_d.js +1 -0
- package/dist/client/assets/workflowSource-LMsRuqF_.js +3 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/icons/apple-touch-icon-180x180.png +0 -0
- package/dist/client/icons/favicon.ico +0 -0
- package/dist/client/icons/maskable-icon-192x192.png +0 -0
- package/dist/client/icons/maskable-icon-512x512.png +0 -0
- package/dist/client/icons/pwa-16x16.png +0 -0
- package/dist/client/icons/pwa-192x192.png +0 -0
- package/dist/client/icons/pwa-32x32.png +0 -0
- package/dist/client/icons/pwa-512x512.png +0 -0
- package/dist/client/icons/pwa-64x64.png +0 -0
- package/dist/clientLog.d.ts +5 -0
- package/dist/clientLog.js +64 -0
- package/dist/cloudClient.d.ts +38 -0
- package/dist/cloudClient.js +185 -0
- package/dist/cloudCommand.d.ts +23 -0
- package/dist/cloudCommand.js +159 -0
- package/dist/cloudFrontmatter.d.ts +4 -0
- package/dist/cloudFrontmatter.js +30 -0
- package/dist/cloudStore.d.ts +28 -0
- package/dist/cloudStore.js +70 -0
- package/dist/cloudWatch.d.ts +12 -0
- package/dist/cloudWatch.js +103 -0
- package/dist/commentReply.d.ts +25 -0
- package/dist/commentReply.js +17 -0
- package/dist/configHome.d.ts +34 -0
- package/dist/configHome.js +136 -0
- package/dist/dashboard.d.ts +67 -0
- package/dist/dashboard.js +86 -0
- package/dist/dashboardClientScript.d.ts +2 -0
- package/dist/dashboardClientScript.js +1006 -0
- package/dist/dashboardDocument.d.ts +13 -0
- package/dist/dashboardDocument.js +40 -0
- package/dist/dashboardFormat.d.ts +98 -0
- package/dist/dashboardFormat.js +199 -0
- package/dist/dashboardLoading.d.ts +19 -0
- package/dist/dashboardLoading.js +94 -0
- package/dist/dashboardOverview.d.ts +28 -0
- package/dist/dashboardOverview.js +333 -0
- package/dist/dashboardPage.d.ts +2 -0
- package/dist/dashboardPage.js +11 -0
- package/dist/dashboardParts.d.ts +4 -0
- package/dist/dashboardParts.js +367 -0
- package/dist/dashboardSearchView.d.ts +38 -0
- package/dist/dashboardSearchView.js +255 -0
- package/dist/desktopApp.d.ts +23 -0
- package/dist/desktopApp.js +110 -0
- package/dist/desktopBridge.d.ts +21 -0
- package/dist/desktopBridge.js +78 -0
- package/dist/desktopCommand.d.ts +61 -0
- package/dist/desktopCommand.js +172 -0
- package/dist/desktopConfig.d.ts +54 -0
- package/dist/desktopConfig.js +164 -0
- package/dist/desktopNotices.d.ts +105 -0
- package/dist/desktopNotices.js +427 -0
- package/dist/diff.d.ts +2 -0
- package/dist/diff.js +46 -0
- package/dist/diffsTheme.d.ts +51 -0
- package/dist/diffsTheme.js +86 -0
- package/dist/diffsThemeCatalog.d.ts +3 -0
- package/dist/diffsThemeCatalog.js +78 -0
- package/dist/elkRuntime.node.d.ts +7 -0
- package/dist/elkRuntime.node.js +63 -0
- package/dist/execution.d.ts +78 -0
- package/dist/execution.js +139 -0
- package/dist/expectedWorkflow.d.ts +11 -0
- package/dist/expectedWorkflow.js +99 -0
- package/dist/favicon.d.ts +4 -0
- package/dist/favicon.js +40 -0
- package/dist/favicon.png +0 -0
- package/dist/faviconBase64.d.ts +1 -0
- package/dist/faviconBase64.js +1 -0
- package/dist/fileVersion.d.ts +8 -0
- package/dist/fileVersion.js +20 -0
- package/dist/formatBytes.d.ts +2 -0
- package/dist/formatBytes.js +13 -0
- package/dist/gitStatus.d.ts +12 -0
- package/dist/gitStatus.js +88 -0
- package/dist/hostToolbar.d.ts +38 -0
- package/dist/hostToolbar.js +249 -0
- package/dist/http.d.ts +8 -0
- package/dist/http.js +38 -0
- package/dist/httpServer.d.ts +13 -0
- package/dist/httpServer.js +40 -0
- package/dist/icons/apple-touch-icon-180x180.png +0 -0
- package/dist/icons/favicon.ico +0 -0
- package/dist/icons/maskable-icon-192x192.png +0 -0
- package/dist/icons/maskable-icon-512x512.png +0 -0
- package/dist/icons/pwa-16x16.png +0 -0
- package/dist/icons/pwa-192x192.png +0 -0
- package/dist/icons/pwa-32x32.png +0 -0
- package/dist/icons/pwa-512x512.png +0 -0
- package/dist/icons/pwa-64x64.png +0 -0
- package/dist/lanAccess.d.ts +31 -0
- package/dist/lanAccess.js +110 -0
- package/dist/lanAddress.d.ts +24 -0
- package/dist/lanAddress.js +174 -0
- package/dist/lanCommand.d.ts +25 -0
- package/dist/lanCommand.js +159 -0
- package/dist/lanConfig.d.ts +40 -0
- package/dist/lanConfig.js +130 -0
- package/dist/lanFirewall.d.ts +17 -0
- package/dist/lanFirewall.js +221 -0
- package/dist/layoutGraph.d.ts +13 -0
- package/dist/layoutGraph.js +55 -0
- package/dist/localName.d.ts +9 -0
- package/dist/localName.js +28 -0
- package/dist/lockBanner.d.ts +2 -0
- package/dist/lockBanner.js +2 -0
- package/dist/mdnsPacket.d.ts +44 -0
- package/dist/mdnsPacket.js +384 -0
- package/dist/mdnsPublish.d.ts +12 -0
- package/dist/mdnsPublish.js +290 -0
- package/dist/offlineSync.d.ts +249 -0
- package/dist/offlineSync.js +477 -0
- package/dist/openUrl.d.ts +40 -0
- package/dist/openUrl.js +147 -0
- package/dist/openedPages.d.ts +14 -0
- package/dist/openedPages.js +48 -0
- package/dist/pageEditPull.d.ts +9 -0
- package/dist/pageEditPull.js +29 -0
- package/dist/pageRoutes.d.ts +3 -0
- package/dist/pageRoutes.js +34 -0
- package/dist/parse.d.ts +7 -0
- package/dist/parse.js +100 -0
- package/dist/pid.d.ts +2 -0
- package/dist/pid.js +13 -0
- package/dist/planArchive.d.ts +4 -0
- package/dist/planArchive.js +28 -0
- package/dist/planEntries.d.ts +12 -0
- package/dist/planEntries.js +117 -0
- package/dist/planHost.d.ts +31 -0
- package/dist/planHost.js +286 -0
- package/dist/planId.d.ts +2 -0
- package/dist/planId.js +6 -0
- package/dist/planMdx/blockEdit.d.ts +41 -0
- package/dist/planMdx/blockEdit.js +60 -0
- package/dist/planMdx/cellPart.d.ts +14 -0
- package/dist/planMdx/cellPart.js +26 -0
- package/dist/planMdx/compilePlanMdx.d.ts +3 -0
- package/dist/planMdx/compilePlanMdx.js +22 -0
- package/dist/planMdx/editSource.d.ts +39 -0
- package/dist/planMdx/editSource.js +327 -0
- package/dist/planMdx/frontmatter.d.ts +5 -0
- package/dist/planMdx/frontmatter.js +15 -0
- package/dist/planMdx/markdown.d.ts +6 -0
- package/dist/planMdx/markdown.js +470 -0
- package/dist/planMdx/outline.d.ts +8 -0
- package/dist/planMdx/outline.js +548 -0
- package/dist/planMdx/payload.d.ts +4 -0
- package/dist/planMdx/payload.js +18 -0
- package/dist/planMdx/rebaseDraft.d.ts +54 -0
- package/dist/planMdx/rebaseDraft.js +675 -0
- package/dist/planMdx/recmaPlanComponents.d.ts +18 -0
- package/dist/planMdx/recmaPlanComponents.js +52 -0
- package/dist/planMdx/remarkBlockRanges.d.ts +104 -0
- package/dist/planMdx/remarkBlockRanges.js +275 -0
- package/dist/planMdx/remarkCodeMeta.d.ts +16 -0
- package/dist/planMdx/remarkCodeMeta.js +25 -0
- package/dist/planMdx/remarkGfmTable.d.ts +5 -0
- package/dist/planMdx/remarkGfmTable.js +15 -0
- package/dist/planMdx/remarkGfmTaskList.d.ts +5 -0
- package/dist/planMdx/remarkGfmTaskList.js +15 -0
- package/dist/planMdx/remarkMermaid.d.ts +16 -0
- package/dist/planMdx/remarkMermaid.js +56 -0
- package/dist/planMdx/source.d.ts +11 -0
- package/dist/planMdx/source.js +131 -0
- package/dist/planMdx/titleEdit.d.ts +35 -0
- package/dist/planMdx/titleEdit.js +112 -0
- package/dist/planPage.css +2125 -0
- package/dist/planProgress.d.ts +17 -0
- package/dist/planProgress.js +78 -0
- package/dist/planReady.d.ts +8 -0
- package/dist/planReady.js +20 -0
- package/dist/planRefNavigation.d.ts +4 -0
- package/dist/planRefNavigation.js +8 -0
- package/dist/planRoutes.d.ts +12 -0
- package/dist/planRoutes.js +141 -0
- package/dist/planSearch.d.ts +166 -0
- package/dist/planSearch.js +462 -0
- package/dist/planSession.d.ts +130 -0
- package/dist/planSession.js +1182 -0
- package/dist/planSnapshots.d.ts +34 -0
- package/dist/planSnapshots.js +113 -0
- package/dist/planStatus.d.ts +26 -0
- package/dist/planStatus.js +46 -0
- package/dist/planStepHeading.d.ts +16 -0
- package/dist/planStepHeading.js +34 -0
- package/dist/planTarget.d.ts +16 -0
- package/dist/planTarget.js +92 -0
- package/dist/planToc.d.ts +24 -0
- package/dist/planToc.js +258 -0
- package/dist/planVersionMenu.d.ts +12 -0
- package/dist/planVersionMenu.js +23 -0
- package/dist/processRecord.d.ts +108 -0
- package/dist/processRecord.js +68 -0
- package/dist/processesPanel.d.ts +7 -0
- package/dist/processesPanel.js +636 -0
- package/dist/pwaIconFile.d.ts +2 -0
- package/dist/pwaIconFile.js +42 -0
- package/dist/pwaIcons.d.ts +28 -0
- package/dist/pwaIcons.js +46 -0
- package/dist/registerServiceWorker.d.ts +25 -0
- package/dist/registerServiceWorker.js +26 -0
- package/dist/registryClient.d.ts +94 -0
- package/dist/registryClient.js +490 -0
- package/dist/registryConstants.d.ts +9 -0
- package/dist/registryConstants.js +9 -0
- package/dist/registryLock.d.ts +19 -0
- package/dist/registryLock.js +48 -0
- package/dist/registryPage.d.ts +2 -0
- package/dist/registryPage.js +284 -0
- package/dist/registryService.d.ts +21 -0
- package/dist/registryService.js +562 -0
- package/dist/registryStore.d.ts +63 -0
- package/dist/registryStore.js +398 -0
- package/dist/releaseNotes.d.ts +35 -0
- package/dist/releaseNotes.js +62 -0
- package/dist/render.d.ts +50 -0
- package/dist/render.js +1506 -0
- package/dist/requestGuard.d.ts +21 -0
- package/dist/requestGuard.js +42 -0
- package/dist/reviewRound.d.ts +12 -0
- package/dist/reviewRound.js +19 -0
- package/dist/runFollow.d.ts +28 -0
- package/dist/runFollow.js +33 -0
- package/dist/searchMatch.d.ts +35 -0
- package/dist/searchMatch.js +270 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.js +114 -0
- package/dist/serviceLog.d.ts +56 -0
- package/dist/serviceLog.js +481 -0
- package/dist/shellCache.d.ts +69 -0
- package/dist/shellCache.js +289 -0
- package/dist/shellWorker.js +322 -0
- package/dist/shellWorkerResponse.d.ts +4 -0
- package/dist/shellWorkerResponse.js +15 -0
- package/dist/startServer.d.ts +2 -0
- package/dist/startServer.js +2 -0
- package/dist/store/meta.d.ts +53 -0
- package/dist/store/meta.js +140 -0
- package/dist/store/migrate.d.ts +3 -0
- package/dist/store/migrate.js +408 -0
- package/dist/store/rows.d.ts +4 -0
- package/dist/store/rows.js +100 -0
- package/dist/store/schema.d.ts +5 -0
- package/dist/store/schema.js +5 -0
- package/dist/store/sqlite.d.ts +19 -0
- package/dist/store/sqlite.js +57 -0
- package/dist/store/tables.d.ts +1892 -0
- package/dist/store/tables.js +136 -0
- package/dist/theme.d.ts +174 -0
- package/dist/theme.js +444 -0
- package/dist/themeBootstrap.d.ts +2 -0
- package/dist/themeBootstrap.js +11 -0
- package/dist/tui/DashboardApp.d.ts +19 -0
- package/dist/tui/DashboardApp.js +237 -0
- package/dist/tui/PaletteProvider.d.ts +12 -0
- package/dist/tui/PaletteProvider.js +36 -0
- package/dist/tui/PlanActions.d.ts +7 -0
- package/dist/tui/PlanActions.js +9 -0
- package/dist/tui/PlanCard.d.ts +13 -0
- package/dist/tui/PlanCard.js +31 -0
- package/dist/tui/PlanRow.d.ts +13 -0
- package/dist/tui/PlanRow.js +31 -0
- package/dist/tui/PlanTable.d.ts +13 -0
- package/dist/tui/PlanTable.js +24 -0
- package/dist/tui/ProcessCard.d.ts +9 -0
- package/dist/tui/ProcessCard.js +24 -0
- package/dist/tui/ProcessList.d.ts +9 -0
- package/dist/tui/ProcessList.js +12 -0
- package/dist/tui/SegmentButton.d.ts +7 -0
- package/dist/tui/SegmentButton.js +18 -0
- package/dist/tui/StatCard.d.ts +6 -0
- package/dist/tui/StatCard.js +17 -0
- package/dist/tui/dashboardView.d.ts +45 -0
- package/dist/tui/dashboardView.js +192 -0
- package/dist/tui/openExternal.d.ts +2 -0
- package/dist/tui/openExternal.js +5 -0
- package/dist/tui/palette.d.ts +27 -0
- package/dist/tui/palette.js +66 -0
- package/dist/tui/planColumns.d.ts +38 -0
- package/dist/tui/planColumns.js +14 -0
- package/dist/tui/readDashboard.d.ts +3 -0
- package/dist/tui/readDashboard.js +15 -0
- package/dist/tui/readProcesses.d.ts +3 -0
- package/dist/tui/readProcesses.js +23 -0
- package/dist/tui/registryView.d.ts +11 -0
- package/dist/tui/registryView.js +56 -0
- package/dist/tui/runTui.d.ts +21 -0
- package/dist/tui/runTui.js +86 -0
- package/dist/tui/systemTheme.d.ts +28 -0
- package/dist/tui/systemTheme.js +141 -0
- package/dist/types.d.ts +191 -0
- package/dist/types.js +0 -0
- package/dist/webManifest.d.ts +39 -0
- package/dist/webManifest.js +48 -0
- package/dist/workflow.d.ts +8 -0
- package/dist/workflow.js +42 -0
- package/dist/workflowLayoutShared.d.ts +25 -0
- package/dist/workflowLayoutShared.js +33 -0
- package/dist/workflowSource.d.ts +31 -0
- package/dist/workflowSource.js +90 -0
- package/docs/changelogs/changelog-2026-10-27.md +203 -0
- package/docs/changelogs/changelog-2026-10-28.md +181 -0
- package/docs/changelogs/changelog-2026-10-29.md +349 -0
- package/docs/changelogs/changelog-2026-10-30.md +303 -0
- package/docs/changelogs/changelog-2026-10-31.md +129 -0
- package/docs/changelogs/changelog-2026-11-01.md +155 -0
- package/docs/changelogs/changelog-2026-11-02.md +195 -0
- package/docs/changelogs/changelog-2026-11-03.md +209 -0
- package/docs/changelogs/changelog-2026-11-04.md +243 -0
- package/docs/changelogs/changelog-2026-11-05.md +172 -0
- package/docs/changelogs/changelog-2026-11-06.md +123 -0
- package/docs/changelogs/changelog-2026-11-07.md +138 -0
- package/docs/changelogs/changelog-2026-11-08.md +47 -0
- package/docs/changelogs/changelog-2026-11-10.md +219 -0
- package/docs/changelogs/changelog-2026-11-11.md +205 -0
- package/docs/changelogs/changelog-2026-11-12.md +44 -0
- package/docs/changelogs/changelog-2026-11-13.md +48 -0
- package/docs/changelogs/changelog-2026-11-14.md +116 -0
- package/docs/changelogs/changelog-2026-11-15.md +31 -0
- package/docs/changelogs/changelog-2026-11-16.md +41 -0
- package/docs/changelogs/changelog-2026-11-17.md +25 -0
- package/docs/changelogs/changelog-2026-11-18.md +71 -0
- package/docs/changelogs/changelog-2026-11-19.md +19 -0
- package/examples/cloud-showcase.plan.md +181 -0
- package/examples/component-showcase.plan.md +378 -0
- package/examples/component-tour.plan.md +168 -0
- package/examples/data-table.plan.md +917 -0
- package/examples/execution-graph.json +15 -5
- package/examples/form-controls.plan.md +51 -0
- package/examples/live-plan.config.json +5 -0
- package/examples/rate-limit.plan.md +110 -78
- package/examples/submission-delivery-runbook.md +122 -0
- package/examples/submission-delivery.plan.md +107 -0
- package/examples/tables.plan.md +61 -0
- package/package.json +86 -15
- package/skills/live-plan/SKILL.md +381 -0
- package/skills/live-plan/primitives.md +738 -0
- package/skills/living-plan/SKILL.md +0 -71
package/dist/render.js
ADDED
|
@@ -0,0 +1,1506 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { planSourceFlags, renderPlanStaticHtml } from './planMdx/source';
|
|
3
|
+
import { fileVersionName, fileVersionSeq, fileVersionText } from './fileVersion';
|
|
4
|
+
import { clientLogScript } from './clientLog';
|
|
5
|
+
import { faviconLink } from './favicon';
|
|
6
|
+
import { webManifestHead } from './webManifest';
|
|
7
|
+
import { PLAN_STATUS_LABEL, planStatus, workState } from './planStatus';
|
|
8
|
+
import { LOCK_BANNER_TEXT } from './lockBanner';
|
|
9
|
+
import { AGENT_ICONS_SVG, agentPresenceText } from './agentPresence';
|
|
10
|
+
import { PROCESSES_PANEL_STYLES, processesPanelMarkup, processesPanelScript } from './processesPanel';
|
|
11
|
+
import { accentCssCustomProperties, PAGE_WIDTH_OPTIONS } from './theme';
|
|
12
|
+
import { DEFAULT_DIFFS_THEME, normalizeDiffsTheme, } from './diffsTheme';
|
|
13
|
+
import { buildPlanToc, renderPlanTocHtml } from './planToc';
|
|
14
|
+
import { planToExpectedGraph } from './workflow';
|
|
15
|
+
import { versionSectionHtml } from './changelog';
|
|
16
|
+
import { appearanceSettingsHtml } from './appearanceSettings';
|
|
17
|
+
import { desktopModeSwitchHtml } from './hostToolbar';
|
|
18
|
+
const planPageStyles = readFileSync(new URL('./planPage.css', import.meta.url), 'utf8');
|
|
19
|
+
function escapeHtml(value) {
|
|
20
|
+
return value
|
|
21
|
+
.replaceAll('&', '&')
|
|
22
|
+
.replaceAll('<', '<')
|
|
23
|
+
.replaceAll('>', '>')
|
|
24
|
+
.replaceAll('"', '"');
|
|
25
|
+
}
|
|
26
|
+
const THEME_BOOTSTRAP = `
|
|
27
|
+
(() => {
|
|
28
|
+
const apply = () => {
|
|
29
|
+
document.documentElement.dataset.theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
30
|
+
};
|
|
31
|
+
apply();
|
|
32
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', apply);
|
|
33
|
+
})();
|
|
34
|
+
`;
|
|
35
|
+
function accentStyleTag(accent) {
|
|
36
|
+
return `<style id="living-plan-accent-vars">${accentCssCustomProperties(accent)}</style>`;
|
|
37
|
+
}
|
|
38
|
+
function clientScript(mode, executionActive, theme, basePath) {
|
|
39
|
+
return `
|
|
40
|
+
(() => {
|
|
41
|
+
document.documentElement.classList.add('js');
|
|
42
|
+
let mode = ${JSON.stringify(mode)};
|
|
43
|
+
const apiBase = ${JSON.stringify(basePath)};
|
|
44
|
+
let interactionsLocked = ${JSON.stringify(executionActive)};
|
|
45
|
+
let currentAccent = ${JSON.stringify(theme.accent)};
|
|
46
|
+
const toast = document.getElementById('toast');
|
|
47
|
+
// type is a Ding toast kind: success (default), error, info, or warning. The fallback toast ignores it.
|
|
48
|
+
function showToast(message, type) {
|
|
49
|
+
if (typeof window.showPlanToast === 'function') {
|
|
50
|
+
window.showPlanToast(message, type);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (!toast) return;
|
|
54
|
+
toast.textContent = message;
|
|
55
|
+
toast.classList.add('show');
|
|
56
|
+
setTimeout(() => toast.classList.remove('show'), 1600);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setTimeout(() => {
|
|
60
|
+
if (document.documentElement.dataset.planChrome === 'react') return;
|
|
61
|
+
const planDetails = document.querySelector('[data-plan-details]');
|
|
62
|
+
const planDetailsBtn = document.querySelector('[data-plan-details-toggle]');
|
|
63
|
+
const planCard = document.querySelector('[data-plan-card]');
|
|
64
|
+
let planDetailsOpen = false;
|
|
65
|
+
let planDetailsCloseTimer = 0;
|
|
66
|
+
let planDetailsCloseListener = null;
|
|
67
|
+
function cancelPlanDetailsClose() {
|
|
68
|
+
window.clearTimeout(planDetailsCloseTimer);
|
|
69
|
+
planDetailsCloseTimer = 0;
|
|
70
|
+
if (planDetailsCloseListener && planCard) {
|
|
71
|
+
planCard.removeEventListener('transitionend', planDetailsCloseListener);
|
|
72
|
+
planDetailsCloseListener = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function finishPlanDetailsClose() {
|
|
76
|
+
cancelPlanDetailsClose();
|
|
77
|
+
if (planDetailsOpen || !planCard) return;
|
|
78
|
+
planCard.hidden = true;
|
|
79
|
+
}
|
|
80
|
+
function setPlanDetails(open) {
|
|
81
|
+
if (!planDetailsBtn || !planCard || open === planDetailsOpen) return;
|
|
82
|
+
planDetailsOpen = open;
|
|
83
|
+
planDetailsBtn.setAttribute('aria-expanded', open ? 'true' : 'false');
|
|
84
|
+
cancelPlanDetailsClose();
|
|
85
|
+
if (open) {
|
|
86
|
+
planCard.hidden = false;
|
|
87
|
+
planCard.setAttribute('data-closed', '');
|
|
88
|
+
planCard.removeAttribute('data-open');
|
|
89
|
+
void planCard.getBoundingClientRect();
|
|
90
|
+
planCard.removeAttribute('data-closed');
|
|
91
|
+
planCard.setAttribute('data-open', '');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
planCard.removeAttribute('data-open');
|
|
95
|
+
planCard.setAttribute('data-closed', '');
|
|
96
|
+
planDetailsCloseListener = (event) => {
|
|
97
|
+
if (event.target !== planCard || event.propertyName !== 'opacity') return;
|
|
98
|
+
finishPlanDetailsClose();
|
|
99
|
+
};
|
|
100
|
+
planCard.addEventListener('transitionend', planDetailsCloseListener);
|
|
101
|
+
planDetailsCloseTimer = window.setTimeout(finishPlanDetailsClose, 280);
|
|
102
|
+
}
|
|
103
|
+
let planDetailsPinned = false;
|
|
104
|
+
let planDetailsHoverTimer = 0;
|
|
105
|
+
function closePlanDetailsSoon() {
|
|
106
|
+
window.clearTimeout(planDetailsHoverTimer);
|
|
107
|
+
planDetailsHoverTimer = window.setTimeout(() => {
|
|
108
|
+
if (!planDetailsPinned) setPlanDetails(false);
|
|
109
|
+
}, 160);
|
|
110
|
+
}
|
|
111
|
+
if (planDetails && planDetailsBtn && planCard) {
|
|
112
|
+
planDetailsBtn.addEventListener('mouseenter', () => {
|
|
113
|
+
window.clearTimeout(planDetailsHoverTimer);
|
|
114
|
+
setPlanDetails(true);
|
|
115
|
+
});
|
|
116
|
+
planDetailsBtn.addEventListener('mouseleave', closePlanDetailsSoon);
|
|
117
|
+
planCard.addEventListener('mouseenter', () => {
|
|
118
|
+
window.clearTimeout(planDetailsHoverTimer);
|
|
119
|
+
});
|
|
120
|
+
planCard.addEventListener('mouseleave', closePlanDetailsSoon);
|
|
121
|
+
planDetailsBtn.addEventListener('click', () => {
|
|
122
|
+
if (planDetailsPinned) {
|
|
123
|
+
planDetailsPinned = false;
|
|
124
|
+
setPlanDetails(false);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
planDetailsPinned = true;
|
|
128
|
+
setPlanDetails(true);
|
|
129
|
+
});
|
|
130
|
+
document.addEventListener('keydown', (event) => {
|
|
131
|
+
if (event.key !== 'Escape') return;
|
|
132
|
+
planDetailsPinned = false;
|
|
133
|
+
setPlanDetails(false);
|
|
134
|
+
});
|
|
135
|
+
document.addEventListener('click', (event) => {
|
|
136
|
+
if (!planDetailsOpen) return;
|
|
137
|
+
if (event.target instanceof Node && planDetails.contains(event.target)) return;
|
|
138
|
+
planDetailsPinned = false;
|
|
139
|
+
setPlanDetails(false);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}, 0);
|
|
143
|
+
|
|
144
|
+
function syncPending(text) {
|
|
145
|
+
const count = Math.max(0, Number(text) || 0);
|
|
146
|
+
const label = 'Pending · ' + count;
|
|
147
|
+
document.querySelectorAll('[data-pending-count]').forEach((node) => {
|
|
148
|
+
node.textContent = String(count);
|
|
149
|
+
});
|
|
150
|
+
const fact = document.querySelector('[data-pending-fact]');
|
|
151
|
+
if (fact) {
|
|
152
|
+
fact.hidden = count <= 0;
|
|
153
|
+
fact.setAttribute('aria-label', label);
|
|
154
|
+
fact.setAttribute('title', label);
|
|
155
|
+
}
|
|
156
|
+
const badge = document.querySelector('[data-pending-badge]');
|
|
157
|
+
if (badge) {
|
|
158
|
+
badge.hidden = count <= 0;
|
|
159
|
+
badge.textContent = String(count);
|
|
160
|
+
}
|
|
161
|
+
const detailsBtn = document.querySelector('[data-plan-details-toggle]');
|
|
162
|
+
if (detailsBtn) {
|
|
163
|
+
detailsBtn.setAttribute('aria-label', count > 0 ? 'Plan details, ' + count + ' pending' : 'Plan details');
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function setModeChip(next) {
|
|
168
|
+
const chip = document.querySelector('[data-plan-mode-chip]');
|
|
169
|
+
if (!chip) return;
|
|
170
|
+
const label = 'Mode · ' + next;
|
|
171
|
+
chip.setAttribute('data-mode', next);
|
|
172
|
+
chip.setAttribute('aria-label', label);
|
|
173
|
+
chip.setAttribute('title', label);
|
|
174
|
+
const value = chip.querySelector('[data-plan-mode-value]');
|
|
175
|
+
if (value) value.textContent = next;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function setReview(decision) {
|
|
179
|
+
const reviewChip = document.querySelector('[data-review-chip]');
|
|
180
|
+
const reviewValue = document.querySelector('[data-review-value]');
|
|
181
|
+
if (!reviewChip) return;
|
|
182
|
+
reviewChip.hidden = !decision;
|
|
183
|
+
if (!decision) return;
|
|
184
|
+
const label = 'Review · ' + decision;
|
|
185
|
+
reviewChip.setAttribute('data-decision', decision);
|
|
186
|
+
reviewChip.setAttribute('aria-label', label);
|
|
187
|
+
reviewChip.setAttribute('title', label);
|
|
188
|
+
if (reviewValue) reviewValue.textContent = decision;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function ensureAccentStyle() {
|
|
192
|
+
let style = document.getElementById('living-plan-accent-vars');
|
|
193
|
+
if (!style) {
|
|
194
|
+
style = document.createElement('style');
|
|
195
|
+
style.id = 'living-plan-accent-vars';
|
|
196
|
+
document.head.appendChild(style);
|
|
197
|
+
}
|
|
198
|
+
return style;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const pageWidths = ${JSON.stringify(PAGE_WIDTH_OPTIONS.map((option) => option.id))};
|
|
202
|
+
const pageWidthLabels = ${JSON.stringify(Object.fromEntries(PAGE_WIDTH_OPTIONS.map((option) => [option.id, option.label])))};
|
|
203
|
+
let currentPageWidth = ${JSON.stringify(theme.pageWidth || 'default')};
|
|
204
|
+
let currentDiffsTheme = ${JSON.stringify(theme.diffsTheme || DEFAULT_DIFFS_THEME)};
|
|
205
|
+
|
|
206
|
+
function applyLayout(pageWidth) {
|
|
207
|
+
currentPageWidth = pageWidths.indexOf(pageWidth) >= 0 ? pageWidth : 'default';
|
|
208
|
+
document.documentElement.dataset.layout = currentPageWidth;
|
|
209
|
+
document.body.classList.remove('layout-narrow', 'layout-default', 'layout-wide', 'layout-full');
|
|
210
|
+
document.body.classList.add('layout-' + currentPageWidth);
|
|
211
|
+
document.querySelectorAll('[data-page-width]').forEach((node) => {
|
|
212
|
+
const id = node.getAttribute('data-page-width');
|
|
213
|
+
node.setAttribute('aria-checked', id === currentPageWidth ? 'true' : 'false');
|
|
214
|
+
});
|
|
215
|
+
syncTocDock();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function applyWrapCode(wrapCode) {
|
|
219
|
+
const on = wrapCode === true || wrapCode === 'true';
|
|
220
|
+
document.documentElement.dataset.wrapCode = on ? 'true' : 'false';
|
|
221
|
+
if (document.documentElement.dataset.codeWrapControl === 'react') return;
|
|
222
|
+
const control = document.querySelector('[data-code-wrap]');
|
|
223
|
+
if (!control) return;
|
|
224
|
+
control.setAttribute('aria-checked', on ? 'true' : 'false');
|
|
225
|
+
const thumb = control.querySelector('.plan-switch-thumb');
|
|
226
|
+
if (!thumb) return;
|
|
227
|
+
if (on) thumb.setAttribute('data-checked', '');
|
|
228
|
+
else thumb.removeAttribute('data-checked');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function applyDiffsTheme(diffsTheme, label) {
|
|
232
|
+
currentDiffsTheme = diffsTheme || ${JSON.stringify(DEFAULT_DIFFS_THEME)};
|
|
233
|
+
document.documentElement.dataset.diffsTheme = currentDiffsTheme;
|
|
234
|
+
document.querySelectorAll('[data-diffs-theme]').forEach((node) => {
|
|
235
|
+
const id = node.getAttribute('data-diffs-theme');
|
|
236
|
+
node.setAttribute('aria-checked', id === currentDiffsTheme ? 'true' : 'false');
|
|
237
|
+
});
|
|
238
|
+
const currentLabel = document.getElementById('diffs-theme-current');
|
|
239
|
+
if (currentLabel) {
|
|
240
|
+
currentLabel.textContent = label || currentLabel.textContent || currentDiffsTheme;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function applyTheme(payload) {
|
|
245
|
+
if (!payload) return;
|
|
246
|
+
if (payload.accent) {
|
|
247
|
+
currentAccent = payload.accent;
|
|
248
|
+
document.documentElement.dataset.accent = payload.accent;
|
|
249
|
+
if (payload.css) ensureAccentStyle().textContent = payload.css;
|
|
250
|
+
document.querySelectorAll('[data-accent-swatch]').forEach((node) => {
|
|
251
|
+
const swatch = node.getAttribute('data-accent-swatch');
|
|
252
|
+
node.setAttribute('aria-checked', swatch === payload.accent ? 'true' : 'false');
|
|
253
|
+
});
|
|
254
|
+
const colorInput = document.getElementById('theme-accent-picker');
|
|
255
|
+
if (colorInput && 'value' in colorInput) colorInput.value = payload.accent;
|
|
256
|
+
const hex = document.getElementById('theme-accent-hex');
|
|
257
|
+
if (hex) hex.textContent = payload.accent;
|
|
258
|
+
const customHex = document.getElementById('theme-accent-custom-hex');
|
|
259
|
+
if (customHex) customHex.textContent = payload.accent;
|
|
260
|
+
}
|
|
261
|
+
if (payload.pageWidth !== undefined) applyLayout(payload.pageWidth);
|
|
262
|
+
if (payload.diffsTheme !== undefined) {
|
|
263
|
+
const selected = document.querySelector('[data-diffs-theme="' + payload.diffsTheme + '"]');
|
|
264
|
+
const label = selected ? selected.getAttribute('data-diffs-theme-label') : payload.diffsTheme;
|
|
265
|
+
applyDiffsTheme(payload.diffsTheme, label);
|
|
266
|
+
}
|
|
267
|
+
if (payload.wrapCode !== undefined) applyWrapCode(payload.wrapCode);
|
|
268
|
+
window.dispatchEvent(new CustomEvent('living-plan-theme', { detail: payload }));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function putTheme(partial) {
|
|
272
|
+
const response = await fetch(apiBase + '/api/theme', {
|
|
273
|
+
method: 'PUT',
|
|
274
|
+
headers: { 'content-type': 'application/json' },
|
|
275
|
+
body: JSON.stringify(partial),
|
|
276
|
+
});
|
|
277
|
+
if (!response.ok) {
|
|
278
|
+
const text = await response.text();
|
|
279
|
+
throw new Error(text || 'Failed to save settings');
|
|
280
|
+
}
|
|
281
|
+
const payload = await response.json();
|
|
282
|
+
applyTheme(payload.theme || partial);
|
|
283
|
+
return payload;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async function putAccent(accent) {
|
|
287
|
+
await putTheme({ accent });
|
|
288
|
+
showToast('Accent saved');
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
applyTheme(${JSON.stringify({
|
|
292
|
+
accent: theme.accent,
|
|
293
|
+
pageWidth: theme.pageWidth || 'default',
|
|
294
|
+
diffsTheme: theme.diffsTheme || DEFAULT_DIFFS_THEME,
|
|
295
|
+
wrapCode: theme.wrapCode === true,
|
|
296
|
+
css: accentCssCustomProperties(theme.accent),
|
|
297
|
+
})});
|
|
298
|
+
|
|
299
|
+
document.querySelectorAll('[data-accent-swatch]').forEach((button) => {
|
|
300
|
+
button.addEventListener('click', async () => {
|
|
301
|
+
const accent = button.getAttribute('data-accent-swatch');
|
|
302
|
+
if (!accent || accent === currentAccent) return;
|
|
303
|
+
try {
|
|
304
|
+
await putAccent(accent);
|
|
305
|
+
} catch (error) {
|
|
306
|
+
showToast(error instanceof Error ? error.message : 'Accent update failed', 'error');
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
const picker = document.getElementById('theme-accent-picker');
|
|
312
|
+
if (picker) {
|
|
313
|
+
picker.addEventListener('input', () => {
|
|
314
|
+
if (!('value' in picker)) return;
|
|
315
|
+
const hex = document.getElementById('theme-accent-hex');
|
|
316
|
+
if (hex) hex.textContent = picker.value;
|
|
317
|
+
const customHex = document.getElementById('theme-accent-custom-hex');
|
|
318
|
+
if (customHex) customHex.textContent = picker.value;
|
|
319
|
+
});
|
|
320
|
+
picker.addEventListener('change', async () => {
|
|
321
|
+
if (!('value' in picker)) return;
|
|
322
|
+
try {
|
|
323
|
+
await putAccent(picker.value);
|
|
324
|
+
} catch (error) {
|
|
325
|
+
showToast(error instanceof Error ? error.message : 'Accent update failed', 'error');
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
document.addEventListener('click', async (event) => {
|
|
331
|
+
const target = event.target;
|
|
332
|
+
const button = target instanceof Element ? target.closest('[data-code-wrap]') : null;
|
|
333
|
+
if (!(button instanceof HTMLElement)) return;
|
|
334
|
+
if (document.documentElement.dataset.codeWrapControl === 'react') return;
|
|
335
|
+
const next = document.documentElement.dataset.wrapCode !== 'true';
|
|
336
|
+
const previous = !next;
|
|
337
|
+
applyWrapCode(next);
|
|
338
|
+
try {
|
|
339
|
+
await putTheme({ wrapCode: next });
|
|
340
|
+
showToast(next ? 'Code wraps' : 'Code scrolls');
|
|
341
|
+
} catch (error) {
|
|
342
|
+
applyWrapCode(previous);
|
|
343
|
+
showToast(error instanceof Error ? error.message : 'Could not save code wrap', 'error');
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
document.querySelectorAll('[data-page-width]').forEach((button) => {
|
|
348
|
+
button.addEventListener('click', async () => {
|
|
349
|
+
const next = button.getAttribute('data-page-width');
|
|
350
|
+
if (!next || next === currentPageWidth) return;
|
|
351
|
+
const previous = currentPageWidth;
|
|
352
|
+
applyLayout(next);
|
|
353
|
+
try {
|
|
354
|
+
await putTheme({ pageWidth: next });
|
|
355
|
+
showToast((pageWidthLabels[next] || 'Page') + ' width');
|
|
356
|
+
} catch (error) {
|
|
357
|
+
applyLayout(previous);
|
|
358
|
+
showToast(error instanceof Error ? error.message : 'Layout update failed', 'error');
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
setTimeout(() => {
|
|
364
|
+
if (document.documentElement.dataset.planChrome === 'react') return;
|
|
365
|
+
document.querySelectorAll('[data-accordion]').forEach((accordion) => {
|
|
366
|
+
const trigger = accordion.querySelector('[data-accordion-trigger]');
|
|
367
|
+
const panel = accordion.querySelector('[data-accordion-panel]');
|
|
368
|
+
if (!trigger) return;
|
|
369
|
+
const setOpen = (next) => {
|
|
370
|
+
accordion.setAttribute('data-open', next ? 'true' : 'false');
|
|
371
|
+
trigger.setAttribute('aria-expanded', next ? 'true' : 'false');
|
|
372
|
+
if (panel) {
|
|
373
|
+
if (next) panel.removeAttribute('inert');
|
|
374
|
+
else panel.setAttribute('inert', '');
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
setOpen(accordion.getAttribute('data-open') === 'true');
|
|
378
|
+
trigger.addEventListener('click', () => {
|
|
379
|
+
setOpen(accordion.getAttribute('data-open') !== 'true');
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
}, 0);
|
|
383
|
+
|
|
384
|
+
document.addEventListener('click', async (event) => {
|
|
385
|
+
const target = event.target;
|
|
386
|
+
const button = target instanceof Element ? target.closest('[data-diffs-theme]') : null;
|
|
387
|
+
if (!(button instanceof HTMLElement)) return;
|
|
388
|
+
const next = button.getAttribute('data-diffs-theme');
|
|
389
|
+
const label = button.getAttribute('data-diffs-theme-label') || next;
|
|
390
|
+
if (!next || next === currentDiffsTheme) return;
|
|
391
|
+
const previous = currentDiffsTheme;
|
|
392
|
+
const previousLabel = document.getElementById('diffs-theme-current')?.textContent || previous;
|
|
393
|
+
applyDiffsTheme(next, label);
|
|
394
|
+
window.dispatchEvent(new CustomEvent('living-plan-theme', { detail: { diffsTheme: next } }));
|
|
395
|
+
try {
|
|
396
|
+
await putTheme({ diffsTheme: next });
|
|
397
|
+
showToast('Diff theme saved');
|
|
398
|
+
} catch (error) {
|
|
399
|
+
applyDiffsTheme(previous, previousLabel);
|
|
400
|
+
window.dispatchEvent(new CustomEvent('living-plan-theme', { detail: { diffsTheme: previous } }));
|
|
401
|
+
showToast(error instanceof Error ? error.message : 'Diff theme update failed', 'error');
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
function activateTab(target) {
|
|
406
|
+
document.querySelectorAll('[data-tab-target]').forEach((node) => {
|
|
407
|
+
node.setAttribute('aria-selected', node.getAttribute('data-tab-target') === target ? 'true' : 'false');
|
|
408
|
+
});
|
|
409
|
+
document.querySelectorAll('[data-tab-panel]').forEach((panel) => {
|
|
410
|
+
panel.hidden = panel.getAttribute('data-tab-panel') !== target;
|
|
411
|
+
});
|
|
412
|
+
try { localStorage.setItem('living-plan-tab', target || 'plan'); } catch {}
|
|
413
|
+
if (target !== 'workflow') window.livingPlanPendingWorkflowFocus = null;
|
|
414
|
+
if (target === 'workflow') {
|
|
415
|
+
requestAnimationFrame(() => window.dispatchEvent(new Event('resize')));
|
|
416
|
+
}
|
|
417
|
+
updateTocCurrent();
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
document.querySelectorAll('[data-tab-target]').forEach((button) => {
|
|
421
|
+
button.addEventListener('click', () => {
|
|
422
|
+
const tab = button.getAttribute('data-tab-target');
|
|
423
|
+
if (tab === 'plan' || tab === 'workflow' || tab === 'settings') focusPageTab(tab);
|
|
424
|
+
else activateTab(tab);
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
document.addEventListener('click', (event) => {
|
|
429
|
+
const target = event.target;
|
|
430
|
+
if (!(target instanceof Element)) return;
|
|
431
|
+
const tabJump = target.closest('[data-tab-jump]');
|
|
432
|
+
if (!tabJump) return;
|
|
433
|
+
const tab = tabJump.getAttribute('data-tab-jump') || 'workflow';
|
|
434
|
+
if (tab === 'plan' || tab === 'workflow' || tab === 'settings') focusPageTab(tab);
|
|
435
|
+
else activateTab(tab);
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
try { history.scrollRestoration = 'manual'; } catch {}
|
|
439
|
+
|
|
440
|
+
let scrollGeneration = 0;
|
|
441
|
+
let jumpDepth = 0;
|
|
442
|
+
|
|
443
|
+
function decodeToken(value) {
|
|
444
|
+
const raw = String(value || '').replace(/^#/, '');
|
|
445
|
+
if (!raw) return '';
|
|
446
|
+
try { return decodeURIComponent(raw); } catch { return raw; }
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function findPlanTarget(token) {
|
|
450
|
+
const decoded = decodeToken(token);
|
|
451
|
+
if (!decoded) return null;
|
|
452
|
+
const ids = [decoded];
|
|
453
|
+
if (decoded.startsWith('plan-')) ids.push(decoded.slice(5));
|
|
454
|
+
else ids.push('plan-' + decoded);
|
|
455
|
+
for (const id of ids) {
|
|
456
|
+
const byId = document.getElementById(id);
|
|
457
|
+
if (byId) return byId;
|
|
458
|
+
}
|
|
459
|
+
for (const ref of ids) {
|
|
460
|
+
const byRef = document.querySelector('[data-plan-ref="' + CSS.escape(ref) + '"]');
|
|
461
|
+
if (byRef) return byRef;
|
|
462
|
+
}
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function canonicalRef(section, fallback) {
|
|
467
|
+
return section.getAttribute('data-plan-ref') || section.id || fallback || '';
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function workflowRefFromHash(hash) {
|
|
471
|
+
const decoded = decodeToken(hash);
|
|
472
|
+
if (!decoded.startsWith('workflow/')) return '';
|
|
473
|
+
return decoded.slice('workflow/'.length);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function highlightPlanTarget(section) {
|
|
477
|
+
document.querySelectorAll('.plan-ref-focus').forEach((node) => node.classList.remove('plan-ref-focus'));
|
|
478
|
+
if (section) section.classList.add('plan-ref-focus');
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function currentView() {
|
|
482
|
+
const selected = document.querySelector('[data-tab-target][aria-selected="true"]');
|
|
483
|
+
return {
|
|
484
|
+
tab: selected ? (selected.getAttribute('data-tab-target') || 'plan') : 'plan',
|
|
485
|
+
x: window.scrollX,
|
|
486
|
+
y: window.scrollY,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function snapshotView() {
|
|
491
|
+
const here = history.state && typeof history.state === 'object' ? history.state : {};
|
|
492
|
+
const view = currentView();
|
|
493
|
+
history.replaceState({ ...here, livingPlanView: { tab: view.tab, x: view.x, y: view.y, captured: true } }, '');
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function scrollToPlanTarget(section, instant) {
|
|
497
|
+
const generation = ++scrollGeneration;
|
|
498
|
+
const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
499
|
+
const run = () => {
|
|
500
|
+
if (generation !== scrollGeneration) return;
|
|
501
|
+
section.scrollIntoView({ behavior: instant || reduce ? 'auto' : 'smooth', block: 'center' });
|
|
502
|
+
};
|
|
503
|
+
if (instant || reduce) {
|
|
504
|
+
run();
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
requestAnimationFrame(() => requestAnimationFrame(run));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function focusPlanRef(ref, options) {
|
|
511
|
+
const recordHistory = !options || options.recordHistory !== false;
|
|
512
|
+
const instant = Boolean(options && options.instant);
|
|
513
|
+
const section = findPlanTarget(ref);
|
|
514
|
+
if (!section) {
|
|
515
|
+
if (recordHistory) showToast('No plan section for this step', 'info');
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
const canonical = canonicalRef(section, decodeToken(ref));
|
|
519
|
+
if (recordHistory) {
|
|
520
|
+
const hash = section.id ? '#' + encodeURIComponent(section.id) : (canonical ? '#' + encodeURIComponent('plan-' + canonical) : '');
|
|
521
|
+
const next = new URL(window.location.href);
|
|
522
|
+
if (hash) next.hash = hash;
|
|
523
|
+
const sameEntry = Boolean(hash) && history.state && history.state.livingPlanJump === canonical && location.hash === next.hash;
|
|
524
|
+
if (sameEntry || jumpDepth > 0) return;
|
|
525
|
+
jumpDepth += 1;
|
|
526
|
+
snapshotView();
|
|
527
|
+
if (hash) history.pushState({ livingPlanJump: canonical }, '', next);
|
|
528
|
+
jumpDepth -= 1;
|
|
529
|
+
}
|
|
530
|
+
activateTab('plan');
|
|
531
|
+
highlightPlanTarget(section);
|
|
532
|
+
scrollToPlanTarget(section, instant);
|
|
533
|
+
updateTocCurrent();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
function pinScroll(x, y) {
|
|
537
|
+
// A later jump (a quick Forward after Back) starts a new generation. Its scroll must not be undone here.
|
|
538
|
+
const generation = scrollGeneration;
|
|
539
|
+
const apply = () => {
|
|
540
|
+
if (generation !== scrollGeneration) return;
|
|
541
|
+
window.scrollTo({ left: x, top: y, behavior: 'instant' });
|
|
542
|
+
};
|
|
543
|
+
apply();
|
|
544
|
+
requestAnimationFrame(() => {
|
|
545
|
+
apply();
|
|
546
|
+
requestAnimationFrame(apply);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function restoreView(view) {
|
|
551
|
+
scrollGeneration += 1;
|
|
552
|
+
highlightPlanTarget(null);
|
|
553
|
+
window.livingPlanPendingWorkflowFocus = null;
|
|
554
|
+
if (view && view.tab) activateTab(view.tab);
|
|
555
|
+
if (view && typeof view.y === 'number') pinScroll(view.x || 0, view.y);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function focusWorkflowStep(ref, options) {
|
|
559
|
+
const recordHistory = !options || options.recordHistory !== false;
|
|
560
|
+
const canonical = decodeToken(ref);
|
|
561
|
+
if (!canonical) return;
|
|
562
|
+
if (recordHistory) {
|
|
563
|
+
const hash = '#workflow/' + encodeURIComponent(canonical);
|
|
564
|
+
const next = new URL(window.location.href);
|
|
565
|
+
next.hash = hash;
|
|
566
|
+
const sameEntry = history.state && history.state.livingPlanWorkflow === canonical && location.hash === next.hash;
|
|
567
|
+
if (sameEntry || jumpDepth > 0) return;
|
|
568
|
+
jumpDepth += 1;
|
|
569
|
+
snapshotView();
|
|
570
|
+
history.pushState({ livingPlanWorkflow: canonical }, '', next);
|
|
571
|
+
jumpDepth -= 1;
|
|
572
|
+
}
|
|
573
|
+
highlightPlanTarget(null);
|
|
574
|
+
activateTab('workflow');
|
|
575
|
+
window.livingPlanPendingWorkflowFocus = canonical;
|
|
576
|
+
window.dispatchEvent(new CustomEvent('living-plan-focus-workflow', { detail: { ref: canonical } }));
|
|
577
|
+
updateTocCurrent();
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function focusPageTab(tab, options) {
|
|
581
|
+
const page = tab === 'plan' || tab === 'workflow' || tab === 'settings' ? tab : '';
|
|
582
|
+
if (!page) return;
|
|
583
|
+
const recordHistory = !options || options.recordHistory !== false;
|
|
584
|
+
if (recordHistory) {
|
|
585
|
+
const next = new URL(window.location.href);
|
|
586
|
+
next.hash = '#' + page;
|
|
587
|
+
const sameEntry = history.state && history.state.livingPlanPage === page && location.hash === next.hash;
|
|
588
|
+
if (jumpDepth > 0) return;
|
|
589
|
+
// The URL can already name this tab while another one shows, for example after a run opened
|
|
590
|
+
// the Workflow tab. The tab still opens. Only the history entry is skipped.
|
|
591
|
+
if (!sameEntry) {
|
|
592
|
+
jumpDepth += 1;
|
|
593
|
+
snapshotView();
|
|
594
|
+
history.pushState({ livingPlanPage: page }, '', next);
|
|
595
|
+
jumpDepth -= 1;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
highlightPlanTarget(null);
|
|
599
|
+
window.livingPlanPendingWorkflowFocus = null;
|
|
600
|
+
activateTab(page);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
function focusWorkflowPage(options) {
|
|
604
|
+
focusPageTab('workflow', options);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function tocIsDocked() {
|
|
608
|
+
const nav = document.getElementById('plan-toc');
|
|
609
|
+
if (!nav) return false;
|
|
610
|
+
return getComputedStyle(nav).getPropertyValue('--toc-dock').trim() === '1';
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function setTocOpen(open) {
|
|
614
|
+
const nav = document.getElementById('plan-toc');
|
|
615
|
+
const toggle = document.querySelector('[data-toc-toggle]');
|
|
616
|
+
const backdrop = document.getElementById('plan-toc-backdrop');
|
|
617
|
+
if (!nav) return;
|
|
618
|
+
const docked = tocIsDocked();
|
|
619
|
+
const shown = docked || open;
|
|
620
|
+
nav.dataset.open = open && !docked ? 'true' : 'false';
|
|
621
|
+
if (shown) {
|
|
622
|
+
nav.removeAttribute('inert');
|
|
623
|
+
nav.removeAttribute('aria-hidden');
|
|
624
|
+
} else {
|
|
625
|
+
nav.setAttribute('inert', '');
|
|
626
|
+
nav.setAttribute('aria-hidden', 'true');
|
|
627
|
+
}
|
|
628
|
+
if (toggle) toggle.setAttribute('aria-expanded', open && !docked ? 'true' : 'false');
|
|
629
|
+
if (backdrop) backdrop.hidden = docked || !open;
|
|
630
|
+
if (open && !docked) nav.focus();
|
|
631
|
+
else if (!open && !docked && toggle instanceof HTMLElement && nav.contains(document.activeElement)) toggle.focus();
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
function syncTocDock() {
|
|
635
|
+
const nav = document.getElementById('plan-toc');
|
|
636
|
+
if (!nav) return;
|
|
637
|
+
if (tocIsDocked()) nav.dataset.open = 'false';
|
|
638
|
+
setTocOpen(nav.dataset.open === 'true');
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function updateTocCurrent() {
|
|
642
|
+
const links = [...document.querySelectorAll('#plan-toc a[data-toc]')];
|
|
643
|
+
if (links.length === 0) return;
|
|
644
|
+
const tab = currentView().tab;
|
|
645
|
+
let current = null;
|
|
646
|
+
if (tab === 'workflow') {
|
|
647
|
+
const ref = window.livingPlanPendingWorkflowFocus || '';
|
|
648
|
+
current = links.find((link) => link.getAttribute('data-toc') === 'workflow-step' && link.getAttribute('data-toc-target') === ref)
|
|
649
|
+
|| links.find((link) => link.getAttribute('data-toc') === 'workflow')
|
|
650
|
+
|| null;
|
|
651
|
+
} else if (tab === 'plan') {
|
|
652
|
+
const line = window.scrollY + 96;
|
|
653
|
+
for (const link of links) {
|
|
654
|
+
if (link.getAttribute('data-toc') !== 'section') continue;
|
|
655
|
+
const section = findPlanTarget(link.getAttribute('data-toc-target') || '');
|
|
656
|
+
if (!section) continue;
|
|
657
|
+
const top = section.getBoundingClientRect().top + window.scrollY;
|
|
658
|
+
if (top <= line) current = link;
|
|
659
|
+
}
|
|
660
|
+
if (!current) current = links.find((link) => link.getAttribute('data-toc') === 'section') || null;
|
|
661
|
+
}
|
|
662
|
+
links.forEach((link) => {
|
|
663
|
+
if (link === current) link.setAttribute('aria-current', 'true');
|
|
664
|
+
else link.removeAttribute('aria-current');
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function tokenFromAnchor(link) {
|
|
669
|
+
const hrefAttr = link.getAttribute('href') || '';
|
|
670
|
+
if (!hrefAttr || hrefAttr.slice(0, 11).toLowerCase() === 'javascript:') return '';
|
|
671
|
+
let url;
|
|
672
|
+
try { url = new URL(link.href, window.location.href); } catch { return ''; }
|
|
673
|
+
const sameDocument = url.origin === location.origin && url.pathname === location.pathname && url.search === location.search;
|
|
674
|
+
if (sameDocument && url.hash && findPlanTarget(url.hash)) return decodeToken(url.hash);
|
|
675
|
+
if (!/[/?#:]/.test(hrefAttr) && findPlanTarget(hrefAttr)) return decodeToken(hrefAttr);
|
|
676
|
+
return '';
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
function followTocLink(tocLink) {
|
|
680
|
+
const kind = tocLink.getAttribute('data-toc');
|
|
681
|
+
const ref = tocLink.getAttribute('data-toc-target') || '';
|
|
682
|
+
setTocOpen(false);
|
|
683
|
+
if (kind === 'workflow') focusWorkflowPage();
|
|
684
|
+
else if (kind === 'workflow-step' && ref) focusWorkflowStep(ref);
|
|
685
|
+
else if (ref) focusPlanRef(ref);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// iPad taps the label or icon. WebKit treats :hover as the gesture and skips click.
|
|
689
|
+
let tocPress = null;
|
|
690
|
+
let tocPointerLink = null;
|
|
691
|
+
let tocPointerAt = 0;
|
|
692
|
+
function tocLinkFrom(event) {
|
|
693
|
+
const target = event.target;
|
|
694
|
+
if (!(target instanceof Element)) return null;
|
|
695
|
+
return target.closest('#plan-toc a[data-toc]');
|
|
696
|
+
}
|
|
697
|
+
document.addEventListener('pointerdown', (event) => {
|
|
698
|
+
if (event.pointerType === 'mouse' || !event.isPrimary || event.button !== 0) {
|
|
699
|
+
tocPress = null;
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
const link = tocLinkFrom(event);
|
|
703
|
+
tocPress = link ? { id: event.pointerId, x: event.clientX, y: event.clientY, link: link } : null;
|
|
704
|
+
}, true);
|
|
705
|
+
document.addEventListener('pointerup', (event) => {
|
|
706
|
+
const press = tocPress;
|
|
707
|
+
tocPress = null;
|
|
708
|
+
if (!press || event.pointerId !== press.id) return;
|
|
709
|
+
const dx = event.clientX - press.x;
|
|
710
|
+
const dy = event.clientY - press.y;
|
|
711
|
+
if (dx * dx + dy * dy > 100) return;
|
|
712
|
+
const link = tocLinkFrom(event);
|
|
713
|
+
if (!link || link !== press.link) return;
|
|
714
|
+
event.preventDefault();
|
|
715
|
+
tocPointerLink = link;
|
|
716
|
+
tocPointerAt = Date.now();
|
|
717
|
+
followTocLink(link);
|
|
718
|
+
}, true);
|
|
719
|
+
document.addEventListener('pointercancel', (event) => {
|
|
720
|
+
if (tocPress && event.pointerId === tocPress.id) tocPress = null;
|
|
721
|
+
}, true);
|
|
722
|
+
|
|
723
|
+
document.addEventListener('click', (event) => {
|
|
724
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
725
|
+
const target = event.target;
|
|
726
|
+
if (!(target instanceof Element)) return;
|
|
727
|
+
const tocLink = target.closest('#plan-toc a[data-toc]');
|
|
728
|
+
if (tocLink) {
|
|
729
|
+
event.preventDefault();
|
|
730
|
+
if (event.button !== 0) return;
|
|
731
|
+
if (tocPointerLink === tocLink && Date.now() - tocPointerAt < 700) {
|
|
732
|
+
tocPointerLink = null;
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
followTocLink(tocLink);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
if (event.defaultPrevented || event.button !== 0) return;
|
|
739
|
+
const workflowJump = target.closest('[data-workflow-jump]');
|
|
740
|
+
if (workflowJump) {
|
|
741
|
+
if (document.documentElement.dataset.comments === 'on') return;
|
|
742
|
+
const ref = workflowJump.getAttribute('data-workflow-jump');
|
|
743
|
+
if (!ref) return;
|
|
744
|
+
event.preventDefault();
|
|
745
|
+
focusWorkflowStep(ref);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const planJump = target.closest('[data-plan-jump]');
|
|
749
|
+
if (planJump) {
|
|
750
|
+
const ref = planJump.getAttribute('data-plan-jump');
|
|
751
|
+
if (!ref || !findPlanTarget(ref)) return;
|
|
752
|
+
event.preventDefault();
|
|
753
|
+
focusPlanRef(ref);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const link = target.closest('a[href]');
|
|
757
|
+
if (!(link instanceof HTMLAnchorElement)) return;
|
|
758
|
+
const token = tokenFromAnchor(link);
|
|
759
|
+
if (!token) return;
|
|
760
|
+
event.preventDefault();
|
|
761
|
+
focusPlanRef(token);
|
|
762
|
+
}, true);
|
|
763
|
+
|
|
764
|
+
window.addEventListener('popstate', () => {
|
|
765
|
+
const state = history.state && typeof history.state === 'object' ? history.state : {};
|
|
766
|
+
if (state.livingPlanJump && state.livingPlanView && state.livingPlanView.captured) {
|
|
767
|
+
scrollGeneration += 1;
|
|
768
|
+
const section = findPlanTarget(state.livingPlanJump);
|
|
769
|
+
if (state.livingPlanView.tab) activateTab(state.livingPlanView.tab);
|
|
770
|
+
highlightPlanTarget(section);
|
|
771
|
+
pinScroll(state.livingPlanView.x || 0, state.livingPlanView.y || 0);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (state.livingPlanJump) {
|
|
775
|
+
focusPlanRef(state.livingPlanJump, { recordHistory: false, instant: true });
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if ((state.livingPlanPage === 'plan' || state.livingPlanPage === 'workflow' || state.livingPlanPage === 'settings') && !(state.livingPlanView && state.livingPlanView.captured)) {
|
|
779
|
+
focusPageTab(state.livingPlanPage, { recordHistory: false });
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (state.livingPlanView && state.livingPlanView.captured) {
|
|
783
|
+
restoreView(state.livingPlanView);
|
|
784
|
+
if (state.livingPlanView.tab === 'workflow' && state.livingPlanWorkflow) {
|
|
785
|
+
window.livingPlanPendingWorkflowFocus = state.livingPlanWorkflow;
|
|
786
|
+
window.dispatchEvent(new CustomEvent('living-plan-focus-workflow', { detail: { ref: state.livingPlanWorkflow } }));
|
|
787
|
+
}
|
|
788
|
+
updateTocCurrent();
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
if (state.livingPlanWorkflow) {
|
|
792
|
+
focusWorkflowStep(state.livingPlanWorkflow, { recordHistory: false });
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
const workflowRef = workflowRefFromHash(location.hash);
|
|
796
|
+
if (workflowRef) {
|
|
797
|
+
focusWorkflowStep(workflowRef, { recordHistory: false });
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
if (location.hash === '#workflow' || location.hash === '#plan' || location.hash === '#settings') {
|
|
801
|
+
focusPageTab(location.hash.slice(1), { recordHistory: false });
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
if (location.hash && findPlanTarget(location.hash)) {
|
|
805
|
+
focusPlanRef(location.hash, { recordHistory: false, instant: true });
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
highlightPlanTarget(null);
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
window.livingPlanFocusPlanRef = focusPlanRef;
|
|
812
|
+
window.livingPlanWorkflowFocusMissed = function () {
|
|
813
|
+
showToast('No workflow step for this section', 'info');
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
try {
|
|
817
|
+
let saved = localStorage.getItem('living-plan-tab');
|
|
818
|
+
if (saved === 'execution') saved = 'workflow';
|
|
819
|
+
const preferred = ${JSON.stringify(executionActive)} ? 'workflow' : (saved || 'plan');
|
|
820
|
+
if (preferred) activateTab(preferred);
|
|
821
|
+
} catch {}
|
|
822
|
+
|
|
823
|
+
const openingWorkflowRef = workflowRefFromHash(location.hash);
|
|
824
|
+
if (openingWorkflowRef) {
|
|
825
|
+
focusWorkflowStep(openingWorkflowRef, { recordHistory: false });
|
|
826
|
+
} else if (location.hash === '#workflow' || location.hash === '#plan' || location.hash === '#settings') {
|
|
827
|
+
focusPageTab(location.hash.slice(1), { recordHistory: false });
|
|
828
|
+
} else if (!interactionsLocked && location.hash && findPlanTarget(location.hash)) {
|
|
829
|
+
focusPlanRef(location.hash, { recordHistory: false, instant: true });
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
document.querySelector('[data-toc-toggle]')?.addEventListener('click', () => {
|
|
833
|
+
const nav = document.getElementById('plan-toc');
|
|
834
|
+
setTocOpen(nav?.dataset.open !== 'true');
|
|
835
|
+
});
|
|
836
|
+
document.getElementById('plan-toc-backdrop')?.addEventListener('click', () => setTocOpen(false));
|
|
837
|
+
document.addEventListener('keydown', (event) => {
|
|
838
|
+
if (event.key !== 'Escape') return;
|
|
839
|
+
const nav = document.getElementById('plan-toc');
|
|
840
|
+
if (!nav || nav.dataset.open !== 'true' || tocIsDocked()) return;
|
|
841
|
+
setTocOpen(false);
|
|
842
|
+
});
|
|
843
|
+
const tocStepStatuses = { pending: true, active: true, done: true, blocked: true, failed: true };
|
|
844
|
+
let tocExecution = null;
|
|
845
|
+
function readTocExecution() {
|
|
846
|
+
const node = document.getElementById('living-plan-bootstrap');
|
|
847
|
+
if (!node || !node.textContent) return null;
|
|
848
|
+
try { return JSON.parse(node.textContent); } catch { return null; }
|
|
849
|
+
}
|
|
850
|
+
function tocProgressNodes(state) {
|
|
851
|
+
const planned = state && state.planned && Array.isArray(state.planned.nodes) ? state.planned.nodes : [];
|
|
852
|
+
const live = state && state.graph && Array.isArray(state.graph.nodes) ? state.graph.nodes : [];
|
|
853
|
+
const liveById = new Map(live.map((node) => [node.id, node]));
|
|
854
|
+
const seen = new Set();
|
|
855
|
+
const nodes = [];
|
|
856
|
+
for (const node of planned) {
|
|
857
|
+
seen.add(node.id);
|
|
858
|
+
const overlay = liveById.get(node.id);
|
|
859
|
+
if (!overlay) {
|
|
860
|
+
nodes.push(node);
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
863
|
+
nodes.push({
|
|
864
|
+
id: node.id,
|
|
865
|
+
status: overlay.status || node.status,
|
|
866
|
+
planRef: overlay.planRef || node.planRef,
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
for (const node of live) {
|
|
870
|
+
if (!seen.has(node.id)) nodes.push(node);
|
|
871
|
+
}
|
|
872
|
+
return nodes;
|
|
873
|
+
}
|
|
874
|
+
function applyTocStepProgress(state) {
|
|
875
|
+
if (!state) return;
|
|
876
|
+
const links = document.querySelectorAll('#plan-toc a[data-toc-step]');
|
|
877
|
+
if (!links.length) return;
|
|
878
|
+
const byTarget = new Map();
|
|
879
|
+
for (const node of tocProgressNodes(state)) {
|
|
880
|
+
const status = node && node.status;
|
|
881
|
+
if (!status || !tocStepStatuses[status]) continue;
|
|
882
|
+
if (node.id) byTarget.set(node.id, status);
|
|
883
|
+
if (node.planRef) byTarget.set(node.planRef, status);
|
|
884
|
+
}
|
|
885
|
+
links.forEach((link) => {
|
|
886
|
+
const status = byTarget.get(link.getAttribute('data-toc-target') || '');
|
|
887
|
+
if (!status) return;
|
|
888
|
+
const icon = 'phase-' + status;
|
|
889
|
+
if (link.getAttribute('data-toc-icon') !== icon) link.setAttribute('data-toc-icon', icon);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
tocExecution = readTocExecution();
|
|
893
|
+
applyTocStepProgress(tocExecution);
|
|
894
|
+
window.addEventListener('living-plan-toc', () => {
|
|
895
|
+
updateTocCurrent();
|
|
896
|
+
applyTocStepProgress(tocExecution);
|
|
897
|
+
});
|
|
898
|
+
let tocScrollTick = 0;
|
|
899
|
+
window.addEventListener('scroll', () => {
|
|
900
|
+
if (tocScrollTick) return;
|
|
901
|
+
tocScrollTick = requestAnimationFrame(() => {
|
|
902
|
+
tocScrollTick = 0;
|
|
903
|
+
updateTocCurrent();
|
|
904
|
+
});
|
|
905
|
+
}, { passive: true });
|
|
906
|
+
window.addEventListener('resize', () => syncTocDock());
|
|
907
|
+
syncTocDock();
|
|
908
|
+
updateTocCurrent();
|
|
909
|
+
|
|
910
|
+
async function postJson(url, body) {
|
|
911
|
+
const response = await fetch(url, {
|
|
912
|
+
method: 'POST',
|
|
913
|
+
headers: { 'content-type': 'application/json' },
|
|
914
|
+
body: JSON.stringify(body),
|
|
915
|
+
});
|
|
916
|
+
if (!response.ok) {
|
|
917
|
+
const text = await response.text();
|
|
918
|
+
throw new Error(text || 'Request failed');
|
|
919
|
+
}
|
|
920
|
+
return response.json();
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
function markState(id, text) {
|
|
924
|
+
const el = document.querySelector('[data-state-for="' + id + '"]');
|
|
925
|
+
if (el) el.innerHTML = text;
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
document.addEventListener('click', async (event) => {
|
|
929
|
+
const target = event.target;
|
|
930
|
+
if (!(target instanceof Element) || interactionsLocked) return;
|
|
931
|
+
const choice = target.closest('[data-choice-id]');
|
|
932
|
+
if (choice instanceof HTMLButtonElement) {
|
|
933
|
+
const id = choice.getAttribute('data-choice-id');
|
|
934
|
+
const optionId = choice.getAttribute('data-option-id');
|
|
935
|
+
const label = choice.getAttribute('data-option-label');
|
|
936
|
+
if (!id || !optionId || !label) return;
|
|
937
|
+
await postJson(apiBase + '/api/interactions/' + encodeURIComponent(id), {
|
|
938
|
+
kind: 'choice',
|
|
939
|
+
id,
|
|
940
|
+
optionId,
|
|
941
|
+
label,
|
|
942
|
+
});
|
|
943
|
+
document.querySelectorAll('[data-choice-id="' + id + '"]').forEach((node) => {
|
|
944
|
+
node.disabled = true;
|
|
945
|
+
node.classList.toggle('selected', node.getAttribute('data-option-id') === optionId);
|
|
946
|
+
});
|
|
947
|
+
markState(id, 'Selected: <strong>' + label + '</strong>');
|
|
948
|
+
showToast('Choice sent to agent');
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
const approve = target.closest('[data-approve-id]');
|
|
952
|
+
if (!(approve instanceof HTMLButtonElement)) return;
|
|
953
|
+
const id = approve.getAttribute('data-approve-id');
|
|
954
|
+
const approved = approve.getAttribute('data-approved') === 'true';
|
|
955
|
+
if (!id) return;
|
|
956
|
+
const note = document.querySelector('[data-approve-note="' + id + '"]');
|
|
957
|
+
await postJson(apiBase + '/api/interactions/' + encodeURIComponent(id), {
|
|
958
|
+
kind: 'approve',
|
|
959
|
+
id,
|
|
960
|
+
approved,
|
|
961
|
+
note: note && 'value' in note ? note.value : undefined,
|
|
962
|
+
});
|
|
963
|
+
document.querySelectorAll('[data-approve-id="' + id + '"]').forEach((node) => {
|
|
964
|
+
node.disabled = true;
|
|
965
|
+
});
|
|
966
|
+
if (note) note.disabled = true;
|
|
967
|
+
markState(id, approved ? 'Approved' : 'Denied');
|
|
968
|
+
showToast(approved ? 'Approved' : 'Denied');
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
document.addEventListener('submit', async (event) => {
|
|
972
|
+
if (event.defaultPrevented) return;
|
|
973
|
+
const form = event.target;
|
|
974
|
+
if (!(form instanceof HTMLFormElement) || interactionsLocked) return;
|
|
975
|
+
const formId = form.getAttribute('data-form-id');
|
|
976
|
+
const questionsId = form.getAttribute('data-questions-id');
|
|
977
|
+
if (!formId && !questionsId) return;
|
|
978
|
+
event.preventDefault();
|
|
979
|
+
if (formId) {
|
|
980
|
+
const values = {};
|
|
981
|
+
const checkboxNames = new Set();
|
|
982
|
+
for (const element of form.elements) {
|
|
983
|
+
if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLTextAreaElement) && !(element instanceof HTMLSelectElement)) continue;
|
|
984
|
+
const isButton = element instanceof HTMLInputElement && (element.type === 'submit' || element.type === 'button');
|
|
985
|
+
if (!element.name || isButton) continue;
|
|
986
|
+
if (element instanceof HTMLInputElement && element.type === 'checkbox') {
|
|
987
|
+
checkboxNames.add(element.name);
|
|
988
|
+
continue;
|
|
989
|
+
}
|
|
990
|
+
if (element instanceof HTMLInputElement && element.type === 'number') {
|
|
991
|
+
if (element.value === '') continue;
|
|
992
|
+
values[element.name] = Number(element.value);
|
|
993
|
+
continue;
|
|
994
|
+
}
|
|
995
|
+
values[element.name] = element.value;
|
|
996
|
+
}
|
|
997
|
+
checkboxNames.forEach((name) => {
|
|
998
|
+
const boxes = [];
|
|
999
|
+
for (const element of form.elements) {
|
|
1000
|
+
if (element instanceof HTMLInputElement && element.type === 'checkbox' && element.name === name) boxes.push(element);
|
|
1001
|
+
}
|
|
1002
|
+
const checked = boxes.filter((box) => box.checked).map((box) => box.value);
|
|
1003
|
+
const single = boxes.length === 1 && boxes[0].value === 'true';
|
|
1004
|
+
values[name] = single ? (checked.length ? 'true' : 'false') : checked;
|
|
1005
|
+
});
|
|
1006
|
+
await postJson(apiBase + '/api/interactions/' + encodeURIComponent(formId), {
|
|
1007
|
+
kind: 'form',
|
|
1008
|
+
id: formId,
|
|
1009
|
+
values,
|
|
1010
|
+
});
|
|
1011
|
+
form.querySelectorAll('input, textarea, select, button').forEach((node) => {
|
|
1012
|
+
node.disabled = true;
|
|
1013
|
+
});
|
|
1014
|
+
markState(formId, 'Submitted');
|
|
1015
|
+
showToast('Form submitted');
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
const data = new FormData(form);
|
|
1019
|
+
const answers = {};
|
|
1020
|
+
data.forEach((value, key) => {
|
|
1021
|
+
answers[key] = String(value);
|
|
1022
|
+
});
|
|
1023
|
+
await postJson(apiBase + '/api/interactions/' + encodeURIComponent(questionsId), {
|
|
1024
|
+
kind: 'questions',
|
|
1025
|
+
id: questionsId,
|
|
1026
|
+
answers,
|
|
1027
|
+
});
|
|
1028
|
+
form.querySelectorAll('textarea, button').forEach((node) => {
|
|
1029
|
+
node.disabled = true;
|
|
1030
|
+
});
|
|
1031
|
+
markState(questionsId, 'Answers sent');
|
|
1032
|
+
showToast('Answers sent');
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
// A run that starts or stops changes the page in place. The banner and the locked panel are
|
|
1036
|
+
// client/planStatusMark.ts. This keeps the page's own guards and the review bar in step.
|
|
1037
|
+
let reviewDecision = null;
|
|
1038
|
+
function currentDecision() {
|
|
1039
|
+
if (reviewDecision !== null) return reviewDecision;
|
|
1040
|
+
try {
|
|
1041
|
+
const review = JSON.parse(document.getElementById('living-plan-review')?.textContent || 'null');
|
|
1042
|
+
return (review && review.decision) || '';
|
|
1043
|
+
} catch {
|
|
1044
|
+
return '';
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function setInteractionsLocked(locked) {
|
|
1048
|
+
if (locked === interactionsLocked) return;
|
|
1049
|
+
interactionsLocked = locked;
|
|
1050
|
+
const decision = currentDecision();
|
|
1051
|
+
const showBar = mode === 'review' && !decision && !interactionsLocked;
|
|
1052
|
+
document.body.classList.toggle('has-review-bar', showBar);
|
|
1053
|
+
const dock = document.getElementById('review-dock');
|
|
1054
|
+
if (dock) dock.hidden = !showBar;
|
|
1055
|
+
if (locked) activateTab('workflow');
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
function applyMode(payload) {
|
|
1059
|
+
if (!payload || (payload.mode !== 'watch' && payload.mode !== 'comment' && payload.mode !== 'review')) return;
|
|
1060
|
+
mode = payload.mode;
|
|
1061
|
+
setModeChip(mode);
|
|
1062
|
+
document.body.dataset.planMode = mode;
|
|
1063
|
+
const decision = payload.review && payload.review.decision;
|
|
1064
|
+
reviewDecision = decision || '';
|
|
1065
|
+
setReview(decision || '');
|
|
1066
|
+
const showBar = mode === 'review' && !decision && !interactionsLocked;
|
|
1067
|
+
document.body.classList.toggle('has-review-bar', showBar);
|
|
1068
|
+
const dock = document.getElementById('review-dock');
|
|
1069
|
+
if (dock) dock.hidden = !showBar;
|
|
1070
|
+
window.dispatchEvent(new CustomEvent('living-plan-mode', { detail: { mode: mode } }));
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const reviewNote = document.getElementById('review-note');
|
|
1074
|
+
if (reviewNote instanceof HTMLTextAreaElement) {
|
|
1075
|
+
const fitReviewNote = () => {
|
|
1076
|
+
reviewNote.style.height = 'auto';
|
|
1077
|
+
const next = Math.min(reviewNote.scrollHeight, 144);
|
|
1078
|
+
reviewNote.style.height = next + 'px';
|
|
1079
|
+
};
|
|
1080
|
+
reviewNote.addEventListener('input', fitReviewNote);
|
|
1081
|
+
fitReviewNote();
|
|
1082
|
+
}
|
|
1083
|
+
document.querySelectorAll('[data-review-decision]').forEach((button) => {
|
|
1084
|
+
button.addEventListener('click', async () => {
|
|
1085
|
+
const decision = button.getAttribute('data-review-decision');
|
|
1086
|
+
const note = document.getElementById('review-note');
|
|
1087
|
+
await postJson(apiBase + '/api/review', {
|
|
1088
|
+
decision,
|
|
1089
|
+
note: note && 'value' in note ? note.value : undefined,
|
|
1090
|
+
comments: [],
|
|
1091
|
+
});
|
|
1092
|
+
showToast('Review ' + decision);
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
function blockKey(node) {
|
|
1097
|
+
return node.getAttribute('data-plan-part') || node.id || '';
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
function animateBlockHeight(node, from, to, done) {
|
|
1101
|
+
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches || Math.abs(from - to) < 1) {
|
|
1102
|
+
if (done) done();
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
node.style.overflow = 'hidden';
|
|
1106
|
+
node.style.height = from + 'px';
|
|
1107
|
+
requestAnimationFrame(() => {
|
|
1108
|
+
requestAnimationFrame(() => {
|
|
1109
|
+
node.style.transition = 'height 200ms var(--ease-out)';
|
|
1110
|
+
node.style.height = to + 'px';
|
|
1111
|
+
});
|
|
1112
|
+
});
|
|
1113
|
+
node.addEventListener('transitionend', function onEnd(event) {
|
|
1114
|
+
if (event.propertyName !== 'height') return;
|
|
1115
|
+
node.removeEventListener('transitionend', onEnd);
|
|
1116
|
+
node.style.height = '';
|
|
1117
|
+
node.style.overflow = '';
|
|
1118
|
+
node.style.transition = '';
|
|
1119
|
+
if (done) done();
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
function syncDiffClass(previous, next) {
|
|
1124
|
+
['diff-added', 'diff-edited', 'diff-unchanged', 'diff-removed'].forEach((name) => {
|
|
1125
|
+
previous.classList.toggle(name, next.classList.contains(name));
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
function patchStack(stack, nextStack) {
|
|
1130
|
+
const incoming = [...nextStack.querySelectorAll(':scope > .block')];
|
|
1131
|
+
const live = new Map();
|
|
1132
|
+
stack.querySelectorAll(':scope > .block').forEach((node) => {
|
|
1133
|
+
const key = blockKey(node);
|
|
1134
|
+
if (key && !live.has(key)) live.set(key, node);
|
|
1135
|
+
});
|
|
1136
|
+
let applied = 0;
|
|
1137
|
+
let anchor = null;
|
|
1138
|
+
incoming.forEach((next) => {
|
|
1139
|
+
const key = blockKey(next);
|
|
1140
|
+
const previous = key ? live.get(key) : undefined;
|
|
1141
|
+
if (previous) live.delete(key);
|
|
1142
|
+
const same = previous
|
|
1143
|
+
&& previous.getAttribute('data-plan-stamp')
|
|
1144
|
+
&& previous.getAttribute('data-plan-stamp') === next.getAttribute('data-plan-stamp');
|
|
1145
|
+
if (previous && same) {
|
|
1146
|
+
syncDiffClass(previous, next);
|
|
1147
|
+
const expected = anchor ? anchor.nextElementSibling : stack.querySelector(':scope > .block');
|
|
1148
|
+
if (previous !== expected) stack.insertBefore(previous, anchor ? anchor.nextSibling : stack.firstChild);
|
|
1149
|
+
anchor = previous;
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
next.classList.add('change-applied');
|
|
1153
|
+
if (next instanceof HTMLElement) next.style.animationDelay = (applied * 70) + 'ms';
|
|
1154
|
+
applied += 1;
|
|
1155
|
+
const from = previous instanceof HTMLElement ? previous.getBoundingClientRect().height : 0;
|
|
1156
|
+
if (previous) previous.replaceWith(next);
|
|
1157
|
+
else stack.insertBefore(next, anchor ? anchor.nextSibling : stack.firstChild);
|
|
1158
|
+
if (next instanceof HTMLElement && !next.querySelector('.mermaid-diagram, pre.code-block')) {
|
|
1159
|
+
animateBlockHeight(next, from, next.getBoundingClientRect().height);
|
|
1160
|
+
}
|
|
1161
|
+
window.dispatchEvent(new CustomEvent('living-plan-document', { detail: { root: next } }));
|
|
1162
|
+
anchor = next;
|
|
1163
|
+
});
|
|
1164
|
+
live.forEach((node) => {
|
|
1165
|
+
if (!(node instanceof HTMLElement)) {
|
|
1166
|
+
node.remove();
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
const from = node.getBoundingClientRect().height;
|
|
1170
|
+
animateBlockHeight(node, from, 0, () => node.remove());
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
let refreshing = false;
|
|
1175
|
+
async function refreshPlan() {
|
|
1176
|
+
if (refreshing) return;
|
|
1177
|
+
refreshing = true;
|
|
1178
|
+
try {
|
|
1179
|
+
const response = await fetch(window.location.href, { headers: { accept: 'text/html' } });
|
|
1180
|
+
if (!response.ok) throw new Error('refresh failed');
|
|
1181
|
+
const parsed = new DOMParser().parseFromString(await response.text(), 'text/html');
|
|
1182
|
+
const nextStack = parsed.querySelector('main.stack');
|
|
1183
|
+
const stack = document.querySelector('main.stack');
|
|
1184
|
+
document.body.classList.add('plan-live');
|
|
1185
|
+
if (nextStack && stack) patchStack(stack, nextStack);
|
|
1186
|
+
const nextBoot = parsed.querySelector('#living-plan-bootstrap');
|
|
1187
|
+
if (nextBoot && nextBoot.textContent) {
|
|
1188
|
+
try { tocExecution = JSON.parse(nextBoot.textContent); } catch {}
|
|
1189
|
+
}
|
|
1190
|
+
const nextToc = parsed.querySelector('#plan-toc-list');
|
|
1191
|
+
const tocList = document.querySelector('#plan-toc-list');
|
|
1192
|
+
if (nextToc && tocList) {
|
|
1193
|
+
tocList.innerHTML = nextToc.innerHTML;
|
|
1194
|
+
window.dispatchEvent(new Event('living-plan-toc'));
|
|
1195
|
+
}
|
|
1196
|
+
const nextTitle = parsed.querySelector('h1.brand');
|
|
1197
|
+
const title = document.querySelector('h1.brand');
|
|
1198
|
+
if (nextTitle && title) title.textContent = nextTitle.textContent || '';
|
|
1199
|
+
const nextLede = parsed.querySelector('p.lede');
|
|
1200
|
+
const lede = document.querySelector('p.lede');
|
|
1201
|
+
if (nextLede && lede) lede.textContent = nextLede.textContent || '';
|
|
1202
|
+
const nextPending = parsed.querySelector('[data-pending-count]');
|
|
1203
|
+
if (nextPending) syncPending(nextPending.textContent || '0');
|
|
1204
|
+
if (parsed.title) document.title = parsed.title;
|
|
1205
|
+
} catch {
|
|
1206
|
+
showToast('Could not update the plan', 'error');
|
|
1207
|
+
} finally {
|
|
1208
|
+
refreshing = false;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// Listeners go on the page's one event hub. client/planEvents.ts owns the connection under it,
|
|
1213
|
+
// reconnects it, and sends hello each time it opens, so these listeners outlive a dropped stream.
|
|
1214
|
+
const source = window.__livingPlanHub || (window.__livingPlanHub = new EventTarget());
|
|
1215
|
+
function applyExecutionState(payload) {
|
|
1216
|
+
if (!payload || typeof payload !== 'object') return;
|
|
1217
|
+
tocExecution = payload;
|
|
1218
|
+
applyTocStepProgress(payload);
|
|
1219
|
+
setInteractionsLocked(Boolean(payload.active));
|
|
1220
|
+
}
|
|
1221
|
+
source.addEventListener('hello', (event) => {
|
|
1222
|
+
try {
|
|
1223
|
+
const payload = JSON.parse(event.data);
|
|
1224
|
+
if (!payload) return;
|
|
1225
|
+
applyExecutionState(payload.execution);
|
|
1226
|
+
if (payload.mode) applyMode({ mode: payload.mode, review: payload.review });
|
|
1227
|
+
} catch {}
|
|
1228
|
+
});
|
|
1229
|
+
source.addEventListener('reload', () => {
|
|
1230
|
+
void refreshPlan();
|
|
1231
|
+
});
|
|
1232
|
+
source.addEventListener('theme', (event) => {
|
|
1233
|
+
try {
|
|
1234
|
+
applyTheme(JSON.parse(event.data));
|
|
1235
|
+
} catch {}
|
|
1236
|
+
});
|
|
1237
|
+
source.addEventListener('execution', (event) => {
|
|
1238
|
+
try {
|
|
1239
|
+
applyExecutionState(JSON.parse(event.data));
|
|
1240
|
+
} catch {}
|
|
1241
|
+
});
|
|
1242
|
+
source.addEventListener('interaction', (event) => {
|
|
1243
|
+
try {
|
|
1244
|
+
const payload = JSON.parse(event.data);
|
|
1245
|
+
if (!payload || typeof payload.id !== 'string') return;
|
|
1246
|
+
if (payload.kind === 'choice' && typeof payload.label === 'string') {
|
|
1247
|
+
markState(payload.id, 'Selected: <strong>' + payload.label + '</strong>');
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
if (payload.kind === 'form') {
|
|
1251
|
+
markState(payload.id, 'Submitted');
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
if (payload.kind === 'questions') {
|
|
1255
|
+
markState(payload.id, 'Answers sent');
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1258
|
+
if (payload.kind === 'approve') {
|
|
1259
|
+
markState(payload.id, payload.approved ? 'Approved' : 'Denied');
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
markState(payload.id, 'Updated');
|
|
1263
|
+
} catch {}
|
|
1264
|
+
});
|
|
1265
|
+
source.addEventListener('review', (event) => {
|
|
1266
|
+
showToast('Review submitted');
|
|
1267
|
+
try {
|
|
1268
|
+
const payload = JSON.parse(event.data);
|
|
1269
|
+
if (payload && typeof payload.decision === 'string') reviewDecision = payload.decision;
|
|
1270
|
+
if (!payload || payload.decision !== 'iterate') return;
|
|
1271
|
+
document.body.classList.remove('has-review-bar');
|
|
1272
|
+
const dock = document.getElementById('review-dock');
|
|
1273
|
+
if (dock) dock.hidden = true;
|
|
1274
|
+
setReview('iterate');
|
|
1275
|
+
window.dispatchEvent(new CustomEvent('living-plan-review', { detail: payload }));
|
|
1276
|
+
} catch {}
|
|
1277
|
+
});
|
|
1278
|
+
source.addEventListener('mode', (event) => {
|
|
1279
|
+
try {
|
|
1280
|
+
applyMode(JSON.parse(event.data));
|
|
1281
|
+
} catch {}
|
|
1282
|
+
});
|
|
1283
|
+
})();
|
|
1284
|
+
`;
|
|
1285
|
+
}
|
|
1286
|
+
function statusIcon(paths, attrs = '') {
|
|
1287
|
+
return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"${attrs}>${paths}</svg>`;
|
|
1288
|
+
}
|
|
1289
|
+
const MODE_ICON = {
|
|
1290
|
+
watch: statusIcon('<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>', ' data-mode-icon="watch"'),
|
|
1291
|
+
review: statusIcon('<rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><path d="m9 14 2 2 4-4"/>', ' data-mode-icon="review"'),
|
|
1292
|
+
comment: statusIcon('<path d="M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"/>', ' data-mode-icon="comment"'),
|
|
1293
|
+
};
|
|
1294
|
+
const AGENT_ICON = statusIcon('<path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/>');
|
|
1295
|
+
const FILE_VERSION_ICON = statusIcon('<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"/><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"/>');
|
|
1296
|
+
const PENDING_ICON = statusIcon('<polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>');
|
|
1297
|
+
const CHANGED_ICON = statusIcon('<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M9 10h6"/><path d="M12 13V7"/><path d="M9 17h6"/>');
|
|
1298
|
+
const REVIEW_ICON = {
|
|
1299
|
+
approve: statusIcon('<path d="M20 6 9 17l-5-5"/>', ' data-review-icon="approve"'),
|
|
1300
|
+
deny: statusIcon('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>', ' data-review-icon="deny"'),
|
|
1301
|
+
iterate: statusIcon('<path d="m17 2 4 4-4 4"/><path d="M3 11v-1a4 4 0 0 1 4-4h14"/><path d="m7 22-4-4 4-4"/><path d="M21 13v1a4 4 0 0 1-4 4H3"/>', ' data-review-icon="iterate"'),
|
|
1302
|
+
};
|
|
1303
|
+
const TAB_ICONS = {
|
|
1304
|
+
plan: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>',
|
|
1305
|
+
workflow: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="8" height="8" x="3" y="3" rx="2"/><path d="M7 11v4a2 2 0 0 0 2 2h4"/><rect width="8" height="8" x="13" y="13" rx="2"/></svg>',
|
|
1306
|
+
settings: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/></svg>',
|
|
1307
|
+
};
|
|
1308
|
+
function tabButton(target, label, selected) {
|
|
1309
|
+
return `<button type="button" class="tab-btn" role="tab" data-tab-target="${target}" aria-selected="${selected ? 'true' : 'false'}" aria-label="${label}">${TAB_ICONS[target]}</button>`;
|
|
1310
|
+
}
|
|
1311
|
+
export function renderPlanPage(options) {
|
|
1312
|
+
const { plan, mode, responses, diffs, iteration, pendingInteractionIds, reviewDecision, execution, clientAssets, theme, } = options;
|
|
1313
|
+
const basePath = options.basePath ?? '';
|
|
1314
|
+
const dashboardHref = options.dashboardHref === undefined ? (basePath ? '/dashboard' : null) : options.dashboardHref;
|
|
1315
|
+
const selfId = options.selfId;
|
|
1316
|
+
const commentsJson = JSON.stringify(options.comments ?? []).replaceAll('<', '\\u003c');
|
|
1317
|
+
const reviewJson = JSON.stringify(options.review ?? null).replaceAll('<', '\\u003c');
|
|
1318
|
+
const mdxBoot = JSON.stringify({
|
|
1319
|
+
source: plan.source,
|
|
1320
|
+
title: plan.title,
|
|
1321
|
+
responses,
|
|
1322
|
+
locked: Boolean(execution.active),
|
|
1323
|
+
snapshots: options.mdxSnapshots ?? [],
|
|
1324
|
+
headSnapshotId: options.mdxHeadSnapshotId ?? null,
|
|
1325
|
+
}).replaceAll('<', '\\u003c');
|
|
1326
|
+
const locked = Boolean(execution.active);
|
|
1327
|
+
const pendingCount = pendingInteractionIds.length;
|
|
1328
|
+
const showReviewBar = mode === 'review' && !reviewDecision && !locked;
|
|
1329
|
+
const planned = planToExpectedGraph(plan, Object.keys(responses));
|
|
1330
|
+
const workflowState = locked ? 'live' : planned ? 'planned' : 'idle';
|
|
1331
|
+
const executionView = { ...execution, planned };
|
|
1332
|
+
const status = planStatus({ mode, decision: reviewDecision, active: locked, work: workState(executionView) });
|
|
1333
|
+
const agentConnected = Boolean(options.agent?.connected);
|
|
1334
|
+
const agentText = agentPresenceText(options.agent);
|
|
1335
|
+
const flags = planSourceFlags(plan.source);
|
|
1336
|
+
const hasMermaid = flags.mermaid;
|
|
1337
|
+
const hasCode = flags.code;
|
|
1338
|
+
const planMdxHref = clientAssets?.planMdxHref;
|
|
1339
|
+
const planMdxCss = (clientAssets?.planMdxCssHrefs ?? [])
|
|
1340
|
+
.map((href) => `<link rel="stylesheet" href="${escapeHtml(href)}" />`)
|
|
1341
|
+
.join('\n');
|
|
1342
|
+
const staticPlan = renderPlanStaticHtml(plan.source);
|
|
1343
|
+
const tocHtml = renderPlanTocHtml(buildPlanToc(plan.source));
|
|
1344
|
+
const body = `<div id="plan-mdx-root" data-plan-mdx class="${planMdxHref ? 'plan-mdx-pending' : ''}">${staticPlan}</div>`;
|
|
1345
|
+
const changed = diffs.filter((diff) => diff.status !== 'unchanged').length;
|
|
1346
|
+
const versionSeq = fileVersionSeq(options.mdxSnapshots ?? [], options.mdxHeadSnapshotId ?? null);
|
|
1347
|
+
const versionName = fileVersionName(versionSeq);
|
|
1348
|
+
const versionText = fileVersionText(versionSeq);
|
|
1349
|
+
const assetCss = [
|
|
1350
|
+
...(clientAssets?.cssHrefs ?? []),
|
|
1351
|
+
...(clientAssets?.selectorCssHrefs ?? []),
|
|
1352
|
+
...(hasMermaid ? (clientAssets?.mermaidCssHrefs ?? []) : []),
|
|
1353
|
+
...(hasCode ? (clientAssets?.highlightCssHrefs ?? []) : []),
|
|
1354
|
+
]
|
|
1355
|
+
.map((href) => `<link rel="stylesheet" href="${escapeHtml(href)}" />`)
|
|
1356
|
+
.join('\n');
|
|
1357
|
+
const assetJs = clientAssets
|
|
1358
|
+
? `<script type="module" src="${escapeHtml(clientAssets.jsHref)}"></script>`
|
|
1359
|
+
: '';
|
|
1360
|
+
const mermaidJs = hasMermaid && clientAssets?.mermaidHref
|
|
1361
|
+
? `<script type="module" src="${escapeHtml(clientAssets.mermaidHref)}"></script>`
|
|
1362
|
+
: '';
|
|
1363
|
+
const highlightJs = hasCode && clientAssets?.highlightHref
|
|
1364
|
+
? `<script type="module" src="${escapeHtml(clientAssets.highlightHref)}"></script>`
|
|
1365
|
+
: '';
|
|
1366
|
+
const selectorJs = clientAssets?.selectorHref
|
|
1367
|
+
? `<script type="module" src="${escapeHtml(clientAssets.selectorHref)}"></script>`
|
|
1368
|
+
: '';
|
|
1369
|
+
const planMdxJs = planMdxHref
|
|
1370
|
+
? `<script type="module" src="${escapeHtml(planMdxHref)}"></script>`
|
|
1371
|
+
: '';
|
|
1372
|
+
const executionFallback = clientAssets
|
|
1373
|
+
? ''
|
|
1374
|
+
: `<div class="execution-empty">Build the client with <code>npm run build:client</code> to enable the workflow canvas.</div>`;
|
|
1375
|
+
const bootstrap = JSON.stringify(executionView).replaceAll('<', '\\u003c');
|
|
1376
|
+
const configName = theme.configPath.split(/[\\/]/).pop() || 'live-plan.config.json';
|
|
1377
|
+
const layoutMode = theme.pageWidth || 'default';
|
|
1378
|
+
const diffsThemeId = normalizeDiffsTheme(theme.diffsTheme || DEFAULT_DIFFS_THEME);
|
|
1379
|
+
const wrapCode = theme.wrapCode === true;
|
|
1380
|
+
const savedTo = escapeHtml(configName);
|
|
1381
|
+
return `<!doctype html>
|
|
1382
|
+
<html lang="en" data-plan-host="local" data-accent="${escapeHtml(theme.accent)}" data-layout="${layoutMode}" data-diffs-theme="${escapeHtml(diffsThemeId)}" data-wrap-code="${wrapCode ? 'true' : 'false'}">
|
|
1383
|
+
<head>
|
|
1384
|
+
<meta charset="utf-8" />
|
|
1385
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1386
|
+
${faviconLink}
|
|
1387
|
+
${webManifestHead}
|
|
1388
|
+
<script>${THEME_BOOTSTRAP}</script>
|
|
1389
|
+
<title>${escapeHtml(plan.title)} · Living Plan</title>
|
|
1390
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
1391
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
1392
|
+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
|
1393
|
+
<style>${planPageStyles}${PROCESSES_PANEL_STYLES}</style>
|
|
1394
|
+
${assetCss}
|
|
1395
|
+
${planMdxCss}
|
|
1396
|
+
${accentStyleTag(theme.accent)}
|
|
1397
|
+
${planMdxHref ? '<style>.plan-mdx-pending{display:none}</style><noscript><style>.plan-mdx-pending{display:block}</style></noscript>' : ''}
|
|
1398
|
+
</head>
|
|
1399
|
+
<body class="${showReviewBar ? 'has-review-bar ' : ''}layout-${layoutMode}" data-plan-mode="${escapeHtml(mode)}" data-plan-status="${status}" data-agent="${agentConnected ? 'connected' : 'disconnected'}">
|
|
1400
|
+
<header class="titlebar">
|
|
1401
|
+
${dashboardHref
|
|
1402
|
+
? `<a class="logo-btn" href="${escapeHtml(dashboardHref)}" aria-label="Dashboard" title="Dashboard"><img class="titlebar-logo" src="/favicon.png" alt="" width="29" height="29" /></a>`
|
|
1403
|
+
: `<span class="logo-btn"><img class="titlebar-logo" src="/favicon.png" alt="" width="29" height="29" /></span>`}
|
|
1404
|
+
<h1 class="brand" id="plan-title">${escapeHtml(plan.title)}</h1>
|
|
1405
|
+
<div class="plan-details" data-plan-details>
|
|
1406
|
+
<button type="button" class="plan-status-chip" data-plan-details-toggle aria-expanded="false" aria-controls="plan-card" aria-label="${pendingCount > 0 ? `Plan details, ${pendingCount} pending` : 'Plan details'}">
|
|
1407
|
+
<span class="chip-status" aria-hidden="true"></span>
|
|
1408
|
+
<span class="plan-status-chip-label" data-plan-status-label>${PLAN_STATUS_LABEL[status]}</span>
|
|
1409
|
+
<span class="chip-agent" data-agent-presence-icon title="${escapeHtml(agentText)}">${AGENT_ICONS_SVG}</span>
|
|
1410
|
+
<span class="chip-badge" data-pending-badge${pendingCount > 0 ? '' : ' hidden'}>${pendingCount}</span>
|
|
1411
|
+
</button>
|
|
1412
|
+
<div class="plan-card" id="plan-card" data-plan-card role="dialog" aria-labelledby="plan-title" hidden>
|
|
1413
|
+
${plan.summary ? `<p class="lede">${escapeHtml(plan.summary)}</p>` : ''}
|
|
1414
|
+
<div class="facts">
|
|
1415
|
+
<span class="fact" data-plan-status-fact title="Status"><span class="status-dot" aria-hidden="true"></span><span class="val" data-plan-status-label>${PLAN_STATUS_LABEL[status]}</span></span>
|
|
1416
|
+
<span class="sr" data-agent-presence-label>${escapeHtml(agentText)}</span>
|
|
1417
|
+
<span class="fact solo" data-plan-mode-chip data-mode="${escapeHtml(mode)}" title="Mode · ${escapeHtml(mode)}" aria-label="Mode · ${escapeHtml(mode)}">${MODE_ICON.watch}${MODE_ICON.review}${MODE_ICON.comment}<span class="sr" data-plan-mode-value>${escapeHtml(mode)}</span></span>
|
|
1418
|
+
${plan.agent ? `<span class="fact" title="Agent · ${escapeHtml(plan.agent)}" aria-label="Agent · ${escapeHtml(plan.agent)}">${AGENT_ICON}<span class="val">${escapeHtml(plan.agent)}</span></span>` : ''}
|
|
1419
|
+
<span class="fact" data-file-version title="${escapeHtml(versionName)}" aria-label="${escapeHtml(versionName)}">${FILE_VERSION_ICON}<span class="val" data-file-version-value>${escapeHtml(versionText)}</span></span>
|
|
1420
|
+
<span class="fact" data-pending-fact title="Pending · ${pendingCount}" aria-label="Pending · ${pendingCount}"${pendingCount > 0 ? '' : ' hidden'}>${PENDING_ICON}<span class="val" data-pending-count>${pendingCount}</span></span>
|
|
1421
|
+
<span class="fact solo" data-workflow="${workflowState}" title="Workflow · ${escapeHtml(workflowState)}" aria-label="Workflow · ${escapeHtml(workflowState)}">${TAB_ICONS.workflow}</span>
|
|
1422
|
+
${changed ? `<span class="fact" title="Changed · ${changed}" aria-label="Changed · ${changed}">${CHANGED_ICON}<span class="val">${changed}</span></span>` : ''}
|
|
1423
|
+
<span class="fact solo" data-review-chip data-decision="${escapeHtml(reviewDecision ?? '')}" title="${reviewDecision ? `Review · ${escapeHtml(reviewDecision)}` : 'Review'}" aria-label="${reviewDecision ? `Review · ${escapeHtml(reviewDecision)}` : 'Review'}"${reviewDecision ? '' : ' hidden'}>${REVIEW_ICON.approve}${REVIEW_ICON.deny}${REVIEW_ICON.iterate}<span class="sr" data-review-value>${escapeHtml(reviewDecision ?? '')}</span></span>
|
|
1424
|
+
</div>
|
|
1425
|
+
</div>
|
|
1426
|
+
</div>
|
|
1427
|
+
<div class="chrome-tools">
|
|
1428
|
+
<p class="offline-state" data-offline-state hidden></p>
|
|
1429
|
+
${desktopModeSwitchHtml('local')}
|
|
1430
|
+
<div class="tabs" role="tablist" aria-label="Living Plan views">
|
|
1431
|
+
${tabButton('plan', 'Plan', true)}
|
|
1432
|
+
${tabButton('workflow', 'Workflow', false)}
|
|
1433
|
+
${tabButton('settings', 'Settings', false)}
|
|
1434
|
+
</div>
|
|
1435
|
+
${processesPanelMarkup(selfId)}
|
|
1436
|
+
</div>
|
|
1437
|
+
</header>
|
|
1438
|
+
${tocHtml}
|
|
1439
|
+
<div class="shell">
|
|
1440
|
+
<section class="tab-panel${locked ? ' plan-locked' : ''}" data-tab-panel="plan" role="tabpanel">
|
|
1441
|
+
<div class="lock-banner" data-lock-banner role="status"${locked ? '' : ' hidden'}>${LOCK_BANNER_TEXT}</div>
|
|
1442
|
+
<main class="stack">
|
|
1443
|
+
${body}
|
|
1444
|
+
</main>
|
|
1445
|
+
</section>
|
|
1446
|
+
<section class="tab-panel" data-tab-panel="workflow" role="tabpanel" hidden>
|
|
1447
|
+
<script id="living-plan-bootstrap" type="application/json">${bootstrap}</script>
|
|
1448
|
+
<script>window.__LIVE_PLAN_BASE__ = ${JSON.stringify(basePath)}; window.__LIVE_PLAN_HOST__ = "local";</script>
|
|
1449
|
+
<div id="execution-root">${executionFallback}</div>
|
|
1450
|
+
${assetJs}
|
|
1451
|
+
</section>
|
|
1452
|
+
<section class="tab-panel" data-tab-panel="settings" role="tabpanel" hidden>
|
|
1453
|
+
<main class="settings-stack">
|
|
1454
|
+
<section class="block settings-section" data-host-panel="local" data-plan-host="local">
|
|
1455
|
+
<h3>Local plan</h3>
|
|
1456
|
+
<p class="settings-copy">This plan is on loopback. Appearance stays in the theme file on this machine. An account is not required.</p>
|
|
1457
|
+
</section>
|
|
1458
|
+
${appearanceSettingsHtml({
|
|
1459
|
+
accent: theme.accent,
|
|
1460
|
+
pageWidth: layoutMode,
|
|
1461
|
+
diffsTheme: diffsThemeId,
|
|
1462
|
+
wrapCode,
|
|
1463
|
+
presets: theme.presets,
|
|
1464
|
+
widths: PAGE_WIDTH_OPTIONS.map((option) => ({ id: option.id, label: option.label })),
|
|
1465
|
+
accentNote: `Saved to <code>${savedTo}</code>. Agents can also run <code>live-plan theme set --accent #hex</code>.`,
|
|
1466
|
+
widthNote: `Saved to <code>${savedTo}</code> with the accent settings.`,
|
|
1467
|
+
wrapNote: `Saved to <code>${savedTo}</code> as <code>theme.wrapCode</code>.`,
|
|
1468
|
+
diffsNote: `Saved to <code>${savedTo}</code> as <code>theme.diffsTheme</code>.`,
|
|
1469
|
+
})}
|
|
1470
|
+
<section class="block settings-section" data-section>
|
|
1471
|
+
<h3>Agent skills</h3>
|
|
1472
|
+
<p class="settings-copy">The live-plan skill teaches an agent to write and serve plans. <code>live-plan skills install</code> copies it into Claude Code, Codex, Cursor, Gemini CLI, and OpenCode.</p>
|
|
1473
|
+
<p class="settings-actions desktop-only"><a class="plan-btn" href="living-plan://setup/skills">Install skills</a></p>
|
|
1474
|
+
</section>
|
|
1475
|
+
<section class="block settings-section desktop-only" data-section>
|
|
1476
|
+
<h3>Desktop app</h3>
|
|
1477
|
+
<p class="settings-copy">Setup holds the choices from the first launch: local or cloud, the color mode, the accent and syntax theme, and the command line tool.</p>
|
|
1478
|
+
<p class="settings-actions"><a class="plan-btn" href="living-plan://setup">Open setup</a> <a class="plan-btn" href="living-plan://setup/cli">Install the command line tool</a></p>
|
|
1479
|
+
<p class="settings-copy">The app installs new versions by itself and shows the download in the window. Check now to see if one is out.</p>
|
|
1480
|
+
<p class="settings-actions"><a class="plan-btn" href="living-plan://update/check" data-check-updates>Check for updates</a></p>
|
|
1481
|
+
</section>
|
|
1482
|
+
${versionSectionHtml(options.appVersion, options.changelog)}
|
|
1483
|
+
</main>
|
|
1484
|
+
</section>
|
|
1485
|
+
</div>
|
|
1486
|
+
<div id="review-dock" class="review-dock"${showReviewBar ? '' : ' hidden'}>
|
|
1487
|
+
<div class="review-bar" role="region" aria-label="Review this plan">
|
|
1488
|
+
<div class="actions">
|
|
1489
|
+
<button class="plan-btn plan-btn-danger" data-review-decision="deny">Deny</button>
|
|
1490
|
+
</div>
|
|
1491
|
+
</div>
|
|
1492
|
+
</div>
|
|
1493
|
+
<div id="toast" class="toast" role="status"></div>
|
|
1494
|
+
<script type="application/json" id="living-plan-comments">${commentsJson}</script>
|
|
1495
|
+
<script type="application/json" id="living-plan-review">${reviewJson}</script>
|
|
1496
|
+
<script type="application/json" id="living-plan-mdx">${mdxBoot}</script>
|
|
1497
|
+
<script>${clientLogScript(`${basePath}/api/logs`)}</script>
|
|
1498
|
+
<script>${clientScript(mode, locked, theme, basePath)}
|
|
1499
|
+
${processesPanelScript()}</script>
|
|
1500
|
+
${mermaidJs}
|
|
1501
|
+
${highlightJs}
|
|
1502
|
+
${selectorJs}
|
|
1503
|
+
${planMdxJs}
|
|
1504
|
+
</body>
|
|
1505
|
+
</html>`;
|
|
1506
|
+
}
|