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
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a page in the Living Plan desktop app when it is installed ([ADR 0037], [ADR 0038]).
|
|
3
|
+
*
|
|
4
|
+
* The app (`src-tauri/`) registers the `living-plan` URL scheme:
|
|
5
|
+
*
|
|
6
|
+
* living-plan://plans/<id> that plan, on this machine's plan service
|
|
7
|
+
* living-plan://dashboard the dashboard
|
|
8
|
+
* living-plan://cloud/plans/<id> that plan, on the hosted app the desktop app is set up with
|
|
9
|
+
* living-plan://cloud/dashboard the hosted dashboard
|
|
10
|
+
*
|
|
11
|
+
* A link names a page by id, never by URL. A hosted page has a link only when its origin is the
|
|
12
|
+
* one the app knows: the host chosen in setup, or the one `account login` signed in to. A private
|
|
13
|
+
* `--no-registry` server and a LAN or `--host` address go to the web app or the browser. The app
|
|
14
|
+
* ships for macOS only for now, so other platforms skip it.
|
|
15
|
+
*
|
|
16
|
+
* [ADR 0037]: ../docs/architecture/decisions/0037-plans-open-in-the-desktop-app.md
|
|
17
|
+
* [ADR 0038]: ../docs/architecture/decisions/0038-desktop-setup-and-cloud.md
|
|
18
|
+
*/
|
|
19
|
+
import { spawn } from 'node:child_process';
|
|
20
|
+
import { readCloudFile } from './cloudStore';
|
|
21
|
+
import { readDesktopConfig } from './desktopConfig';
|
|
22
|
+
import { isLoopbackHost } from './localName';
|
|
23
|
+
export const DESKTOP_SCHEME = 'living-plan';
|
|
24
|
+
/** Plan ids are a hash of the plan path. The app accepts the same characters. */
|
|
25
|
+
const PLAN_ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
26
|
+
function pageLink(url, prefix) {
|
|
27
|
+
if (url.pathname === '/dashboard' || url.pathname === '/dashboard/')
|
|
28
|
+
return `${prefix}dashboard`;
|
|
29
|
+
const id = url.pathname.match(/^\/plans\/([^/]+)\/?$/)?.[1];
|
|
30
|
+
if (!id || !PLAN_ID.test(id))
|
|
31
|
+
return null;
|
|
32
|
+
return `${prefix}plans/${id}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The `living-plan://` link for a page on the local service, or on `cloudUrl`, the hosted app the
|
|
36
|
+
* desktop app is set up with. Null when the app cannot show the page.
|
|
37
|
+
*/
|
|
38
|
+
export function desktopLinkFor(pageUrl, cloudUrl) {
|
|
39
|
+
let url;
|
|
40
|
+
try {
|
|
41
|
+
url = new URL(pageUrl);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (cloudUrl) {
|
|
47
|
+
try {
|
|
48
|
+
if (new URL(cloudUrl).origin === url.origin)
|
|
49
|
+
return pageLink(url, `${DESKTOP_SCHEME}://cloud/`);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// An unreadable host matches nothing.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (url.protocol !== 'http:' || !isLoopbackHost(url.hostname))
|
|
56
|
+
return null;
|
|
57
|
+
return pageLink(url, `${DESKTOP_SCHEME}://`);
|
|
58
|
+
}
|
|
59
|
+
/** The hosted app the desktop app opens: the host chosen in setup, else the one the CLI is signed in to. */
|
|
60
|
+
export async function desktopCloudUrl() {
|
|
61
|
+
try {
|
|
62
|
+
return (await readDesktopConfig()).cloudUrl ?? (await readCloudFile()).account?.baseUrl ?? null;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** `LIVE_PLAN_DESKTOP=0` (or `off`, `false`, `no`) keeps every page in the browser. */
|
|
69
|
+
export function desktopAppDisabled(env) {
|
|
70
|
+
const value = env.LIVE_PLAN_DESKTOP?.trim().toLowerCase();
|
|
71
|
+
return value === '0' || value === 'off' || value === 'false' || value === 'no';
|
|
72
|
+
}
|
|
73
|
+
function runQuietly(command, args, timeoutMs = 10_000) {
|
|
74
|
+
return new Promise((resolveExit) => {
|
|
75
|
+
let child;
|
|
76
|
+
try {
|
|
77
|
+
child = spawn(command, args, { stdio: 'ignore' });
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
resolveExit(null);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const timer = setTimeout(() => {
|
|
84
|
+
child.kill();
|
|
85
|
+
resolveExit(null);
|
|
86
|
+
}, timeoutMs);
|
|
87
|
+
child.on('error', () => {
|
|
88
|
+
clearTimeout(timer);
|
|
89
|
+
resolveExit(null);
|
|
90
|
+
});
|
|
91
|
+
child.on('exit', (code) => {
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
resolveExit(code);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const defaultDeps = { platform: process.platform, env: process.env, run: runQuietly };
|
|
98
|
+
/**
|
|
99
|
+
* Open the page in the desktop app. Resolves false when the page has no app link, the app is
|
|
100
|
+
* turned off, or it is not installed, so `openUrl` tries the web app and then a browser tab.
|
|
101
|
+
*/
|
|
102
|
+
export async function openInDesktopApp(pageUrl, deps = defaultDeps) {
|
|
103
|
+
if (deps.platform !== 'darwin' || desktopAppDisabled(deps.env))
|
|
104
|
+
return false;
|
|
105
|
+
const link = desktopLinkFor(pageUrl) ?? desktopLinkFor(pageUrl, await (deps.cloudUrl ?? desktopCloudUrl)());
|
|
106
|
+
if (!link)
|
|
107
|
+
return false;
|
|
108
|
+
// `open` exits non-zero, without a dialog, when no installed app claims the scheme.
|
|
109
|
+
return (await (deps.run ?? runQuietly)('open', [link])) === 0;
|
|
110
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type DesktopAppearance = {
|
|
2
|
+
accent: string;
|
|
3
|
+
diffsTheme: string;
|
|
4
|
+
savedAt: number;
|
|
5
|
+
};
|
|
6
|
+
export type DesktopInfo = {
|
|
7
|
+
platform: string;
|
|
8
|
+
/** `overlay` when the page's toolbar is the window's title bar. */
|
|
9
|
+
chrome: string;
|
|
10
|
+
appearance?: DesktopAppearance;
|
|
11
|
+
};
|
|
12
|
+
export declare const DESKTOP_APPEARANCE_EVENT = "living-plan-desktop-appearance";
|
|
13
|
+
export declare function desktopInfo(): DesktopInfo | null;
|
|
14
|
+
/** The setup look this origin has not saved yet, or null. */
|
|
15
|
+
export declare function pendingDesktopAppearance(info: DesktopInfo | null, appliedAt: number): DesktopAppearance | null;
|
|
16
|
+
/**
|
|
17
|
+
* Save the look chosen in the app's setup to the signed-in account, once per choice. The save
|
|
18
|
+
* carries the time of the choice, so the host keeps an account look that was changed after it.
|
|
19
|
+
* A signed-out page saves nothing and tries again on the next page.
|
|
20
|
+
*/
|
|
21
|
+
export declare function saveDesktopAppearance(settingsUrl: string, followsAccount: () => boolean): Promise<void>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a page knows when it runs inside the desktop app ([ADR 0038]).
|
|
3
|
+
*
|
|
4
|
+
* The app sets `window.__LIVING_PLAN_DESKTOP__` and `data-desktop` on the root before the page's
|
|
5
|
+
* scripts run (`desktop/bridge.js`). The page gets no Tauri API. It reaches the app by following
|
|
6
|
+
* `living-plan://` links, and the app hands it one thing: the look chosen in setup, which a hosted
|
|
7
|
+
* page saves to the signed-in account once.
|
|
8
|
+
*
|
|
9
|
+
* [ADR 0038]: ../docs/architecture/decisions/0038-desktop-setup-and-cloud.md
|
|
10
|
+
*/
|
|
11
|
+
import { applyAppearance } from './appearanceDom';
|
|
12
|
+
export const DESKTOP_APPEARANCE_EVENT = 'living-plan-desktop-appearance';
|
|
13
|
+
/** Where this origin keeps the `savedAt` of the setup look it last saved to the account. */
|
|
14
|
+
const APPLIED_KEY = 'living-plan-desktop-appearance';
|
|
15
|
+
export function desktopInfo() {
|
|
16
|
+
if (typeof window === 'undefined')
|
|
17
|
+
return null;
|
|
18
|
+
const info = window.__LIVING_PLAN_DESKTOP__;
|
|
19
|
+
return info && typeof info === 'object' ? info : null;
|
|
20
|
+
}
|
|
21
|
+
function readAppearance(value) {
|
|
22
|
+
if (!value || typeof value !== 'object')
|
|
23
|
+
return null;
|
|
24
|
+
const record = value;
|
|
25
|
+
if (typeof record.accent !== 'string' || typeof record.diffsTheme !== 'string')
|
|
26
|
+
return null;
|
|
27
|
+
const savedAt = typeof record.savedAt === 'number' && Number.isFinite(record.savedAt) ? record.savedAt : 0;
|
|
28
|
+
return savedAt > 0 ? { accent: record.accent, diffsTheme: record.diffsTheme, savedAt } : null;
|
|
29
|
+
}
|
|
30
|
+
/** The setup look this origin has not saved yet, or null. */
|
|
31
|
+
export function pendingDesktopAppearance(info, appliedAt) {
|
|
32
|
+
const appearance = readAppearance(info?.appearance);
|
|
33
|
+
return appearance && appearance.savedAt > appliedAt ? appearance : null;
|
|
34
|
+
}
|
|
35
|
+
function appliedAt() {
|
|
36
|
+
try {
|
|
37
|
+
return Number(localStorage.getItem(APPLIED_KEY)) || 0;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Save the look chosen in the app's setup to the signed-in account, once per choice. The save
|
|
45
|
+
* carries the time of the choice, so the host keeps an account look that was changed after it.
|
|
46
|
+
* A signed-out page saves nothing and tries again on the next page.
|
|
47
|
+
*/
|
|
48
|
+
export async function saveDesktopAppearance(settingsUrl, followsAccount) {
|
|
49
|
+
const appearance = pendingDesktopAppearance(desktopInfo(), appliedAt());
|
|
50
|
+
if (!appearance)
|
|
51
|
+
return;
|
|
52
|
+
const response = await fetch(settingsUrl, {
|
|
53
|
+
method: 'PUT',
|
|
54
|
+
credentials: 'include',
|
|
55
|
+
headers: { 'content-type': 'application/json' },
|
|
56
|
+
body: JSON.stringify({ accent: appearance.accent, diffsTheme: appearance.diffsTheme, updatedAt: appearance.savedAt }),
|
|
57
|
+
}).catch(() => null);
|
|
58
|
+
if (!response?.ok)
|
|
59
|
+
return;
|
|
60
|
+
try {
|
|
61
|
+
localStorage.setItem(APPLIED_KEY, String(appearance.savedAt));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Without storage the same look is saved again on the next page, which changes nothing.
|
|
65
|
+
}
|
|
66
|
+
const saved = (await response.json().catch(() => null));
|
|
67
|
+
const settings = (saved && typeof saved === 'object' && 'settings' in saved ? saved.settings : saved);
|
|
68
|
+
// The host answers with the look it kept. Show it when this page follows the account.
|
|
69
|
+
if (!settings || typeof settings.accent !== 'string' || typeof settings.diffsTheme !== 'string' || !followsAccount())
|
|
70
|
+
return;
|
|
71
|
+
const root = document.documentElement;
|
|
72
|
+
applyAppearance({
|
|
73
|
+
accent: settings.accent,
|
|
74
|
+
diffsTheme: settings.diffsTheme,
|
|
75
|
+
pageWidth: typeof settings.pageWidth === 'string' ? settings.pageWidth : (root.dataset.layout ?? 'default'),
|
|
76
|
+
wrapCode: typeof settings.wrapCode === 'boolean' ? settings.wrapCode : root.dataset.wrapCode === 'true',
|
|
77
|
+
}, { notify: true });
|
|
78
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `live-plan desktop` and `live-plan skills`: what the desktop app's setup screen runs ([ADR 0038]).
|
|
3
|
+
*
|
|
4
|
+
* desktop state one JSON line: the app's config, what setup can offer, and the
|
|
5
|
+
* release notes to show when this is a newer minor ([ADR 0042])
|
|
6
|
+
* desktop configure --json {} change the config, then print the same line
|
|
7
|
+
* desktop install-cli put `live-plan` on the PATH, running this install
|
|
8
|
+
* skills list where the live-plan skill is and is not installed
|
|
9
|
+
* skills install copy the skill into agent harnesses
|
|
10
|
+
*
|
|
11
|
+
* The app keeps no logic of its own for these. It runs the CLI it ships and shows the answer.
|
|
12
|
+
*
|
|
13
|
+
* [ADR 0038]: ../docs/architecture/decisions/0038-desktop-setup-and-cloud.md
|
|
14
|
+
* [ADR 0042]: ../docs/architecture/decisions/0042-update-notices-and-whats-new.md
|
|
15
|
+
*/
|
|
16
|
+
import { type HarnessStatus } from './agentSkills';
|
|
17
|
+
import { type LauncherStatus, type LauncherTarget } from './cliLauncher';
|
|
18
|
+
import { type DesktopConfig, type DesktopConfigPatch } from './desktopConfig';
|
|
19
|
+
import { type DiffsThemeSample } from './diffsTheme';
|
|
20
|
+
import { type WhatsNew } from './releaseNotes';
|
|
21
|
+
export type DesktopState = {
|
|
22
|
+
version: string;
|
|
23
|
+
config: DesktopConfig;
|
|
24
|
+
/** The hosted app the window opens in cloud mode: the configured host, else the one the CLI is signed in to. */
|
|
25
|
+
cloudUrl: string | null;
|
|
26
|
+
/** The look plans on this machine start with. */
|
|
27
|
+
theme: {
|
|
28
|
+
accent: string;
|
|
29
|
+
diffsTheme: string;
|
|
30
|
+
};
|
|
31
|
+
cli: LauncherStatus;
|
|
32
|
+
harnesses: HarnessStatus[];
|
|
33
|
+
accents: Array<{
|
|
34
|
+
label: string;
|
|
35
|
+
accent: string;
|
|
36
|
+
}>;
|
|
37
|
+
syntaxThemes: Array<{
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
description: string;
|
|
41
|
+
light: DiffsThemeSample;
|
|
42
|
+
dark: DiffsThemeSample;
|
|
43
|
+
}>;
|
|
44
|
+
/** Release notes the app shows once, when this version is a newer minor than the last notes seen. */
|
|
45
|
+
whatsNew: WhatsNew | null;
|
|
46
|
+
};
|
|
47
|
+
export type DesktopCommandContext = {
|
|
48
|
+
version: string;
|
|
49
|
+
target: LauncherTarget;
|
|
50
|
+
/** The `docs/changelogs` directory beside this install. What's new reads it. */
|
|
51
|
+
changelogs?: string;
|
|
52
|
+
};
|
|
53
|
+
/** The notes due at this version. Only after setup, and only past the minor whose notes were seen. */
|
|
54
|
+
export declare function dueWhatsNew(config: DesktopConfig, context: Pick<DesktopCommandContext, 'version' | 'changelogs'>): WhatsNew | null;
|
|
55
|
+
export declare function desktopState(context: DesktopCommandContext): Promise<DesktopState>;
|
|
56
|
+
/** Save a change from setup. A new accent or syntax theme also becomes the machine-wide theme file. */
|
|
57
|
+
export declare function configureDesktop(patch: DesktopConfigPatch, options?: {
|
|
58
|
+
version?: string;
|
|
59
|
+
}): Promise<DesktopConfig>;
|
|
60
|
+
export declare function cmdDesktop(args: string[], context: DesktopCommandContext): Promise<number>;
|
|
61
|
+
export declare function cmdSkills(args: string[]): Promise<number>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `live-plan desktop` and `live-plan skills`: what the desktop app's setup screen runs ([ADR 0038]).
|
|
3
|
+
*
|
|
4
|
+
* desktop state one JSON line: the app's config, what setup can offer, and the
|
|
5
|
+
* release notes to show when this is a newer minor ([ADR 0042])
|
|
6
|
+
* desktop configure --json {} change the config, then print the same line
|
|
7
|
+
* desktop install-cli put `live-plan` on the PATH, running this install
|
|
8
|
+
* skills list where the live-plan skill is and is not installed
|
|
9
|
+
* skills install copy the skill into agent harnesses
|
|
10
|
+
*
|
|
11
|
+
* The app keeps no logic of its own for these. It runs the CLI it ships and shows the answer.
|
|
12
|
+
*
|
|
13
|
+
* [ADR 0038]: ../docs/architecture/decisions/0038-desktop-setup-and-cloud.md
|
|
14
|
+
* [ADR 0042]: ../docs/architecture/decisions/0042-update-notices-and-whats-new.md
|
|
15
|
+
*/
|
|
16
|
+
import { AGENT_HARNESSES, harnessStatuses, installSkill } from './agentSkills';
|
|
17
|
+
import { currentLauncherEnv, installLauncher, launcherStatus } from './cliLauncher';
|
|
18
|
+
import { loadVersionNotes } from './changelog';
|
|
19
|
+
import { readCloudFile } from './cloudStore';
|
|
20
|
+
import { globalThemeConfigPath } from './configHome';
|
|
21
|
+
import { mergeDesktopConfig, readDesktopConfig, writeDesktopConfig, } from './desktopConfig';
|
|
22
|
+
import { DIFFS_THEME_PRESETS } from './diffsTheme';
|
|
23
|
+
import { notesDue, whatsNew } from './releaseNotes';
|
|
24
|
+
import { ACCENT_PRESETS, loadThemeConfig, saveThemeConfig } from './theme';
|
|
25
|
+
/** The notes due at this version. Only after setup, and only past the minor whose notes were seen. */
|
|
26
|
+
export function dueWhatsNew(config, context) {
|
|
27
|
+
// Only a newer minor reads the changelog files.
|
|
28
|
+
if (!config.setupDone || !context.changelogs || !notesDue(context.version, config.notesSeen))
|
|
29
|
+
return null;
|
|
30
|
+
return whatsNew(context.version, config.notesSeen, loadVersionNotes(context.changelogs));
|
|
31
|
+
}
|
|
32
|
+
async function signedInCloudUrl() {
|
|
33
|
+
return (await readCloudFile()).account?.baseUrl ?? null;
|
|
34
|
+
}
|
|
35
|
+
export async function desktopState(context) {
|
|
36
|
+
const [config, signedIn, theme, env, harnesses] = await Promise.all([
|
|
37
|
+
readDesktopConfig(),
|
|
38
|
+
signedInCloudUrl(),
|
|
39
|
+
loadThemeConfig(globalThemeConfigPath()),
|
|
40
|
+
currentLauncherEnv(),
|
|
41
|
+
harnessStatuses(),
|
|
42
|
+
]);
|
|
43
|
+
return {
|
|
44
|
+
version: context.version,
|
|
45
|
+
config,
|
|
46
|
+
cloudUrl: config.cloudUrl ?? signedIn,
|
|
47
|
+
theme: { accent: theme.accent, diffsTheme: theme.diffsTheme },
|
|
48
|
+
cli: launcherStatus(context.target, env),
|
|
49
|
+
harnesses,
|
|
50
|
+
accents: ACCENT_PRESETS.map((preset) => ({ label: preset.label, accent: preset.accent })),
|
|
51
|
+
syntaxThemes: DIFFS_THEME_PRESETS.map((preset) => ({
|
|
52
|
+
id: preset.id,
|
|
53
|
+
label: preset.label,
|
|
54
|
+
description: preset.description,
|
|
55
|
+
light: preset.lightSample,
|
|
56
|
+
dark: preset.darkSample,
|
|
57
|
+
})),
|
|
58
|
+
whatsNew: dueWhatsNew(config, context),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Save a change from setup. A new accent or syntax theme also becomes the machine-wide theme file. */
|
|
62
|
+
export async function configureDesktop(patch, options = {}) {
|
|
63
|
+
const current = await readDesktopConfig();
|
|
64
|
+
const next = mergeDesktopConfig(current, patch, { fallbackCloudUrl: await signedInCloudUrl(), version: options.version });
|
|
65
|
+
await writeDesktopConfig(next);
|
|
66
|
+
if (next.appearance && next.appearance.savedAt !== current.appearance?.savedAt) {
|
|
67
|
+
const path = globalThemeConfigPath();
|
|
68
|
+
const theme = await loadThemeConfig(path);
|
|
69
|
+
await saveThemeConfig(path, { ...theme, accent: next.appearance.accent, diffsTheme: next.appearance.diffsTheme });
|
|
70
|
+
}
|
|
71
|
+
return next;
|
|
72
|
+
}
|
|
73
|
+
function flagValues(args, name) {
|
|
74
|
+
const values = [];
|
|
75
|
+
for (let index = 0; index < args.length - 1; index += 1) {
|
|
76
|
+
if (args[index] === name)
|
|
77
|
+
values.push(args[index + 1] ?? '');
|
|
78
|
+
}
|
|
79
|
+
return values;
|
|
80
|
+
}
|
|
81
|
+
function fail(error) {
|
|
82
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
83
|
+
return 1;
|
|
84
|
+
}
|
|
85
|
+
const DESKTOP_USAGE = `Usage: live-plan desktop <state | configure --json '{"mode":"cloud"}' | install-cli>`;
|
|
86
|
+
export async function cmdDesktop(args, context) {
|
|
87
|
+
const action = args[0];
|
|
88
|
+
try {
|
|
89
|
+
if (action === 'state') {
|
|
90
|
+
console.log(JSON.stringify(await desktopState(context)));
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
if (action === 'configure') {
|
|
94
|
+
const raw = flagValues(args, '--json')[0];
|
|
95
|
+
if (!raw) {
|
|
96
|
+
console.error(DESKTOP_USAGE);
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
let patch;
|
|
100
|
+
try {
|
|
101
|
+
patch = JSON.parse(raw);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
console.error('--json is not JSON.');
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
if (!patch || typeof patch !== 'object' || Array.isArray(patch)) {
|
|
108
|
+
console.error('--json must be an object.');
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
await configureDesktop(patch, { version: context.version });
|
|
112
|
+
console.log(JSON.stringify(await desktopState(context)));
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
if (action === 'install-cli') {
|
|
116
|
+
const status = await installLauncher(context.target, await currentLauncherEnv());
|
|
117
|
+
if (args.includes('--json'))
|
|
118
|
+
console.log(JSON.stringify(status));
|
|
119
|
+
else {
|
|
120
|
+
console.log(`Installed live-plan to ${status.path}`);
|
|
121
|
+
if (status.hint)
|
|
122
|
+
console.log(`That folder is not on your PATH. Add this line to your shell profile:\n ${status.hint}`);
|
|
123
|
+
}
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
return fail(error);
|
|
129
|
+
}
|
|
130
|
+
console.error(DESKTOP_USAGE);
|
|
131
|
+
return 1;
|
|
132
|
+
}
|
|
133
|
+
const SKILLS_USAGE = `Usage: live-plan skills <list | install [--harness <id>]... [--all]> [--json]
|
|
134
|
+
Harnesses: ${AGENT_HARNESSES.map((harness) => harness.id).join(', ')}
|
|
135
|
+
install with no --harness copies the skill into every harness found on this machine.`;
|
|
136
|
+
function describe(status) {
|
|
137
|
+
const state = status.current ? 'installed' : status.installed ? 'installed, older copy' : status.detected ? 'not installed' : 'not found on this machine';
|
|
138
|
+
return `${status.id.padEnd(12)} ${state.padEnd(26)} ${status.path}`;
|
|
139
|
+
}
|
|
140
|
+
export async function cmdSkills(args) {
|
|
141
|
+
const action = args[0];
|
|
142
|
+
const json = args.includes('--json');
|
|
143
|
+
try {
|
|
144
|
+
if (action === 'list') {
|
|
145
|
+
const statuses = await harnessStatuses();
|
|
146
|
+
if (json)
|
|
147
|
+
console.log(JSON.stringify(statuses));
|
|
148
|
+
else
|
|
149
|
+
for (const status of statuses)
|
|
150
|
+
console.log(describe(status));
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
if (action === 'install') {
|
|
154
|
+
const ids = args.includes('--all') ? AGENT_HARNESSES.map((harness) => harness.id) : flagValues(args, '--harness');
|
|
155
|
+
const installed = await installSkill(ids);
|
|
156
|
+
if (json)
|
|
157
|
+
console.log(JSON.stringify(installed));
|
|
158
|
+
else if (installed.length === 0) {
|
|
159
|
+
console.log('No agent harness was found on this machine. Name one with --harness, or pass --all.');
|
|
160
|
+
}
|
|
161
|
+
else
|
|
162
|
+
for (const status of installed)
|
|
163
|
+
console.log(`Installed the live-plan skill to ${status.path}`);
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
return fail(error);
|
|
169
|
+
}
|
|
170
|
+
console.error(SKILLS_USAGE);
|
|
171
|
+
return 1;
|
|
172
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const DESKTOP_MODES: readonly ["local", "cloud"];
|
|
2
|
+
export type DesktopMode = (typeof DESKTOP_MODES)[number];
|
|
3
|
+
export declare const COLOR_MODES: readonly ["system", "light", "dark"];
|
|
4
|
+
export type ColorMode = (typeof COLOR_MODES)[number];
|
|
5
|
+
/** The accent and syntax theme chosen in setup. A hosted page saves a newer one to the account once. */
|
|
6
|
+
export type DesktopAppearance = {
|
|
7
|
+
accent: string;
|
|
8
|
+
diffsTheme: string;
|
|
9
|
+
savedAt: number;
|
|
10
|
+
};
|
|
11
|
+
export type DesktopConfig = {
|
|
12
|
+
/** False until the person finishes the setup screen once. */
|
|
13
|
+
setupDone: boolean;
|
|
14
|
+
mode: DesktopMode;
|
|
15
|
+
/** Origin of the hosted app, such as `https://plans.example.com`. */
|
|
16
|
+
cloudUrl: string | null;
|
|
17
|
+
colorMode: ColorMode;
|
|
18
|
+
appearance: DesktopAppearance | null;
|
|
19
|
+
/**
|
|
20
|
+
* The app version whose What's new was last closed (`src/releaseNotes.ts`). Null until then.
|
|
21
|
+
* Finishing setup the first time sets it, so a new install does not open the notes.
|
|
22
|
+
*/
|
|
23
|
+
notesSeen: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type DesktopConfigPatch = {
|
|
26
|
+
setupDone?: unknown;
|
|
27
|
+
mode?: unknown;
|
|
28
|
+
cloudUrl?: unknown;
|
|
29
|
+
colorMode?: unknown;
|
|
30
|
+
accent?: unknown;
|
|
31
|
+
diffsTheme?: unknown;
|
|
32
|
+
notesSeen?: unknown;
|
|
33
|
+
};
|
|
34
|
+
export declare function defaultDesktopConfig(): DesktopConfig;
|
|
35
|
+
export declare function desktopConfigPath(home?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* The origin of a hosted app. It must be `https`, or `http` on loopback for a development host.
|
|
38
|
+
* A bare host name gets `https://`. Throws with a sentence a person can act on.
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeCloudUrl(raw: string): string;
|
|
41
|
+
/** Read a stored config. Anything unreadable falls back to the default for that field. */
|
|
42
|
+
export declare function parseDesktopConfig(raw: unknown): DesktopConfig;
|
|
43
|
+
export declare function readDesktopConfig(home?: string): Promise<DesktopConfig>;
|
|
44
|
+
export declare function writeDesktopConfig(config: DesktopConfig, home?: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Apply a change from the setup screen. `fallbackCloudUrl` is the host the CLI is signed in to, used
|
|
47
|
+
* when cloud is chosen and the config names no host. `version` is the running app's, recorded as
|
|
48
|
+
* `notesSeen` when setup finishes the first time. Throws when a value is not one the app accepts.
|
|
49
|
+
*/
|
|
50
|
+
export declare function mergeDesktopConfig(current: DesktopConfig, patch: DesktopConfigPatch, options?: {
|
|
51
|
+
now?: number;
|
|
52
|
+
fallbackCloudUrl?: string | null;
|
|
53
|
+
version?: string;
|
|
54
|
+
}): DesktopConfig;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the desktop app remembers between launches ([ADR 0038]): whether it opens the plans on this
|
|
3
|
+
* machine or the hosted ones, which host that is, the color mode, the look chosen in setup, and the
|
|
4
|
+
* version whose release notes were last seen ([ADR 0042]).
|
|
5
|
+
*
|
|
6
|
+
* The file is `desktop.json` in the config home, beside `cloud.json`. The app reads and writes it
|
|
7
|
+
* through `live-plan desktop state` and `live-plan desktop configure`. The CLI reads it to know
|
|
8
|
+
* which hosted pages the app can show (`src/desktopApp.ts`).
|
|
9
|
+
*
|
|
10
|
+
* [ADR 0038]: ../docs/architecture/decisions/0038-desktop-setup-and-cloud.md
|
|
11
|
+
* [ADR 0042]: ../docs/architecture/decisions/0042-update-notices-and-whats-new.md
|
|
12
|
+
*/
|
|
13
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
14
|
+
import { dirname, join } from 'node:path';
|
|
15
|
+
import { normalizeBase } from './cloudStore';
|
|
16
|
+
import { defaultRegistryHome } from './configHome';
|
|
17
|
+
import { isKnownDiffsTheme, normalizeDiffsTheme } from './diffsTheme';
|
|
18
|
+
import { isLoopbackHost } from './localName';
|
|
19
|
+
import { normalizeAccent } from './theme';
|
|
20
|
+
export const DESKTOP_MODES = ['local', 'cloud'];
|
|
21
|
+
export const COLOR_MODES = ['system', 'light', 'dark'];
|
|
22
|
+
export function defaultDesktopConfig() {
|
|
23
|
+
return { setupDone: false, mode: 'local', cloudUrl: null, colorMode: 'system', appearance: null, notesSeen: null };
|
|
24
|
+
}
|
|
25
|
+
/** An `x.y.z` version, or null. */
|
|
26
|
+
function version(value) {
|
|
27
|
+
return typeof value === 'string' && /^\d+\.\d+\.\d+$/.test(value) ? value : null;
|
|
28
|
+
}
|
|
29
|
+
export function desktopConfigPath(home = defaultRegistryHome()) {
|
|
30
|
+
return join(home, 'desktop.json');
|
|
31
|
+
}
|
|
32
|
+
function oneOf(values, value) {
|
|
33
|
+
return typeof value === 'string' && values.includes(value) ? value : null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The origin of a hosted app. It must be `https`, or `http` on loopback for a development host.
|
|
37
|
+
* A bare host name gets `https://`. Throws with a sentence a person can act on.
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeCloudUrl(raw) {
|
|
40
|
+
const text = raw.trim();
|
|
41
|
+
if (!text)
|
|
42
|
+
throw new Error('Enter the address of the cloud host.');
|
|
43
|
+
let url;
|
|
44
|
+
try {
|
|
45
|
+
url = new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(text) ? text : `https://${text}`);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
throw new Error(`${text} is not an address. Use one like https://plans.example.com.`);
|
|
49
|
+
}
|
|
50
|
+
if (url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopbackHost(url.hostname))) {
|
|
51
|
+
throw new Error('The cloud host must use https.');
|
|
52
|
+
}
|
|
53
|
+
if (url.username || url.password)
|
|
54
|
+
throw new Error('Leave the user name and password out of the address.');
|
|
55
|
+
return normalizeBase(url.href);
|
|
56
|
+
}
|
|
57
|
+
function parseAppearance(raw) {
|
|
58
|
+
if (!raw || typeof raw !== 'object')
|
|
59
|
+
return null;
|
|
60
|
+
const record = raw;
|
|
61
|
+
const accent = normalizeAccent(typeof record.accent === 'string' ? record.accent : undefined);
|
|
62
|
+
const diffsTheme = typeof record.diffsTheme === 'string' && isKnownDiffsTheme(record.diffsTheme) ? normalizeDiffsTheme(record.diffsTheme) : null;
|
|
63
|
+
const savedAt = typeof record.savedAt === 'number' && Number.isFinite(record.savedAt) ? record.savedAt : 0;
|
|
64
|
+
return accent && diffsTheme ? { accent, diffsTheme, savedAt } : null;
|
|
65
|
+
}
|
|
66
|
+
/** Read a stored config. Anything unreadable falls back to the default for that field. */
|
|
67
|
+
export function parseDesktopConfig(raw) {
|
|
68
|
+
const config = defaultDesktopConfig();
|
|
69
|
+
if (!raw || typeof raw !== 'object')
|
|
70
|
+
return config;
|
|
71
|
+
const record = raw;
|
|
72
|
+
if (typeof record.cloudUrl === 'string') {
|
|
73
|
+
try {
|
|
74
|
+
config.cloudUrl = normalizeCloudUrl(record.cloudUrl);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
config.cloudUrl = null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
config.setupDone = record.setupDone === true;
|
|
81
|
+
config.colorMode = oneOf(COLOR_MODES, record.colorMode) ?? 'system';
|
|
82
|
+
config.appearance = parseAppearance(record.appearance);
|
|
83
|
+
config.notesSeen = version(record.notesSeen);
|
|
84
|
+
const mode = oneOf(DESKTOP_MODES, record.mode) ?? 'local';
|
|
85
|
+
// Cloud without a host cannot open anything.
|
|
86
|
+
config.mode = mode === 'cloud' && !config.cloudUrl ? 'local' : mode;
|
|
87
|
+
return config;
|
|
88
|
+
}
|
|
89
|
+
export async function readDesktopConfig(home = defaultRegistryHome()) {
|
|
90
|
+
try {
|
|
91
|
+
return parseDesktopConfig(JSON.parse(await readFile(desktopConfigPath(home), 'utf8')));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return defaultDesktopConfig();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export async function writeDesktopConfig(config, home = defaultRegistryHome()) {
|
|
98
|
+
const path = desktopConfigPath(home);
|
|
99
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
100
|
+
await writeFile(path, `${JSON.stringify(config, null, 2)}\n`);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Apply a change from the setup screen. `fallbackCloudUrl` is the host the CLI is signed in to, used
|
|
104
|
+
* when cloud is chosen and the config names no host. `version` is the running app's, recorded as
|
|
105
|
+
* `notesSeen` when setup finishes the first time. Throws when a value is not one the app accepts.
|
|
106
|
+
*/
|
|
107
|
+
export function mergeDesktopConfig(current, patch, options = {}) {
|
|
108
|
+
const next = { ...current };
|
|
109
|
+
if (patch.cloudUrl !== undefined) {
|
|
110
|
+
if (patch.cloudUrl === null || patch.cloudUrl === '')
|
|
111
|
+
next.cloudUrl = null;
|
|
112
|
+
else if (typeof patch.cloudUrl === 'string')
|
|
113
|
+
next.cloudUrl = normalizeCloudUrl(patch.cloudUrl);
|
|
114
|
+
else
|
|
115
|
+
throw new Error('cloudUrl must be an address.');
|
|
116
|
+
}
|
|
117
|
+
if (patch.mode !== undefined) {
|
|
118
|
+
const mode = oneOf(DESKTOP_MODES, patch.mode);
|
|
119
|
+
if (!mode)
|
|
120
|
+
throw new Error('mode must be local or cloud.');
|
|
121
|
+
next.mode = mode;
|
|
122
|
+
}
|
|
123
|
+
if (next.mode === 'cloud' && !next.cloudUrl) {
|
|
124
|
+
if (patch.mode === undefined)
|
|
125
|
+
next.mode = 'local';
|
|
126
|
+
else if (options.fallbackCloudUrl)
|
|
127
|
+
next.cloudUrl = normalizeCloudUrl(options.fallbackCloudUrl);
|
|
128
|
+
else
|
|
129
|
+
throw new Error('Enter the address of the cloud host first.');
|
|
130
|
+
}
|
|
131
|
+
if (patch.colorMode !== undefined) {
|
|
132
|
+
const colorMode = oneOf(COLOR_MODES, patch.colorMode);
|
|
133
|
+
if (!colorMode)
|
|
134
|
+
throw new Error('colorMode must be system, light, or dark.');
|
|
135
|
+
next.colorMode = colorMode;
|
|
136
|
+
}
|
|
137
|
+
if (patch.accent !== undefined || patch.diffsTheme !== undefined) {
|
|
138
|
+
const accent = patch.accent === undefined ? current.appearance?.accent : normalizeAccent(typeof patch.accent === 'string' ? patch.accent : undefined);
|
|
139
|
+
if (patch.accent !== undefined && !accent)
|
|
140
|
+
throw new Error('accent must be a hex color such as #0f766e.');
|
|
141
|
+
if (patch.diffsTheme !== undefined && !(typeof patch.diffsTheme === 'string' && isKnownDiffsTheme(patch.diffsTheme))) {
|
|
142
|
+
throw new Error('diffsTheme is not a known syntax theme.');
|
|
143
|
+
}
|
|
144
|
+
const diffsTheme = patch.diffsTheme === undefined ? current.appearance?.diffsTheme : normalizeDiffsTheme(patch.diffsTheme);
|
|
145
|
+
if (accent && diffsTheme)
|
|
146
|
+
next.appearance = { accent, diffsTheme, savedAt: options.now ?? Date.now() };
|
|
147
|
+
}
|
|
148
|
+
if (patch.setupDone !== undefined)
|
|
149
|
+
next.setupDone = patch.setupDone === true;
|
|
150
|
+
if (patch.notesSeen !== undefined) {
|
|
151
|
+
if (patch.notesSeen === null)
|
|
152
|
+
next.notesSeen = null;
|
|
153
|
+
else {
|
|
154
|
+
const seen = version(patch.notesSeen);
|
|
155
|
+
if (!seen)
|
|
156
|
+
throw new Error('notesSeen must be a version such as 2.32.0.');
|
|
157
|
+
next.notesSeen = seen;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// A new install has nothing to catch up on: its notes start with the next minor release.
|
|
161
|
+
if (!current.setupDone && next.setupDone && !next.notesSeen)
|
|
162
|
+
next.notesSeen = version(options.version);
|
|
163
|
+
return next;
|
|
164
|
+
}
|