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,675 @@
|
|
|
1
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
|
+
import { mdxFromMarkdown } from 'mdast-util-mdx';
|
|
3
|
+
import { mdxjs } from 'micromark-extension-mdxjs';
|
|
4
|
+
import { workflowNodeCells } from '../workflowSource';
|
|
5
|
+
import { splitFrontmatter, topEntryIds, wireNewSteps } from './editSource';
|
|
6
|
+
/** Plan cards that keep their identity by `id` while their content changes. */
|
|
7
|
+
const CARD_TAGS = new Set(['phase', 'choice', 'form', 'questions', 'approve', 'checklist', 'callout', 'workflow']);
|
|
8
|
+
function parse(markdown) {
|
|
9
|
+
return fromMarkdown(markdown, { extensions: [mdxjs()], mdastExtensions: [mdxFromMarkdown()] });
|
|
10
|
+
}
|
|
11
|
+
/** The syntax tree with positions dropped, as src/planMdx/editSource.ts compares blocks. */
|
|
12
|
+
function canonical(value) {
|
|
13
|
+
if (Array.isArray(value))
|
|
14
|
+
return value.map(canonical);
|
|
15
|
+
if (!value || typeof value !== 'object')
|
|
16
|
+
return value;
|
|
17
|
+
const out = {};
|
|
18
|
+
for (const [key, inner] of Object.entries(value)) {
|
|
19
|
+
if (key === 'position' || key === 'data' || inner === null || inner === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
out[key] = canonical(inner);
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function keyOf(value) {
|
|
26
|
+
return JSON.stringify(canonical(value));
|
|
27
|
+
}
|
|
28
|
+
function isFlowJsx(node) {
|
|
29
|
+
return node.type === 'mdxJsxFlowElement';
|
|
30
|
+
}
|
|
31
|
+
function attr(node, name) {
|
|
32
|
+
for (const attribute of node.attributes) {
|
|
33
|
+
if (attribute.type === 'mdxJsxAttribute' && attribute.name === name && typeof attribute.value === 'string') {
|
|
34
|
+
return attribute.value;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
function shapeOf(node) {
|
|
40
|
+
if (node.type === 'heading')
|
|
41
|
+
return `heading${node.depth}`;
|
|
42
|
+
if (node.type === 'list')
|
|
43
|
+
return node.ordered ? 'list-ordered' : 'list';
|
|
44
|
+
if (isFlowJsx(node))
|
|
45
|
+
return `jsx:${node.name ?? ''}`;
|
|
46
|
+
return node.type;
|
|
47
|
+
}
|
|
48
|
+
function toBlocks(nodes) {
|
|
49
|
+
return nodes.flatMap((node) => {
|
|
50
|
+
const start = node.position?.start.offset;
|
|
51
|
+
const end = node.position?.end.offset;
|
|
52
|
+
if (start === undefined || end === undefined)
|
|
53
|
+
return [];
|
|
54
|
+
const key = keyOf(node);
|
|
55
|
+
const id = isFlowJsx(node) && node.name && CARD_TAGS.has(node.name) ? attr(node, 'id') : undefined;
|
|
56
|
+
const card = id && isFlowJsx(node) ? `${node.name}#${id}` : undefined;
|
|
57
|
+
return [{ start, end, node, key, card, ident: card ?? `=${key}`, shape: shapeOf(node) }];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function textOf(region, block) {
|
|
61
|
+
return region.text.slice(block.start, block.end);
|
|
62
|
+
}
|
|
63
|
+
function words(text) {
|
|
64
|
+
return new Set(text.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? []);
|
|
65
|
+
}
|
|
66
|
+
/** How alike two texts read, 0 to 1, by the words they share. */
|
|
67
|
+
function similarity(a, b) {
|
|
68
|
+
const left = words(a);
|
|
69
|
+
const right = words(b);
|
|
70
|
+
if (left.size === 0 && right.size === 0)
|
|
71
|
+
return 1;
|
|
72
|
+
let shared = 0;
|
|
73
|
+
for (const word of left)
|
|
74
|
+
if (right.has(word))
|
|
75
|
+
shared += 1;
|
|
76
|
+
return (2 * shared) / (left.size + right.size);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* For each base block, the index of the same block in `other`, or undefined when `other` has no
|
|
80
|
+
* such block. Cards match by id, other blocks by meaning, in order. A block that changed in place
|
|
81
|
+
* matches the block of the same shape between the same neighbours that reads most like it.
|
|
82
|
+
* `moves` also matches a block that only moved, by meaning.
|
|
83
|
+
*/
|
|
84
|
+
function matchBlocks(base, other, moves) {
|
|
85
|
+
const n = base.blocks.length;
|
|
86
|
+
const m = other.blocks.length;
|
|
87
|
+
const matched = new Array(n).fill(undefined);
|
|
88
|
+
const used = new Set();
|
|
89
|
+
// Longest run of the same blocks, in order.
|
|
90
|
+
const table = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
|
|
91
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
92
|
+
for (let j = m - 1; j >= 0; j--) {
|
|
93
|
+
table[i][j] =
|
|
94
|
+
base.blocks[i].ident === other.blocks[j].ident ? table[i + 1][j + 1] + 1 : Math.max(table[i + 1][j], table[i][j + 1]);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const anchors = [];
|
|
98
|
+
for (let i = 0, j = 0; i < n && j < m;) {
|
|
99
|
+
if (base.blocks[i].ident === other.blocks[j].ident) {
|
|
100
|
+
anchors.push([i, j]);
|
|
101
|
+
matched[i] = j;
|
|
102
|
+
used.add(j);
|
|
103
|
+
i += 1;
|
|
104
|
+
j += 1;
|
|
105
|
+
}
|
|
106
|
+
else if (table[i + 1][j] >= table[i][j + 1]) {
|
|
107
|
+
i += 1;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
j += 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// A card keeps its id wherever it went.
|
|
114
|
+
const claim = (test) => {
|
|
115
|
+
for (let i = 0; i < n; i++) {
|
|
116
|
+
if (matched[i] !== undefined)
|
|
117
|
+
continue;
|
|
118
|
+
const j = other.blocks.findIndex((block, index) => !used.has(index) && test(block, i));
|
|
119
|
+
if (j < 0)
|
|
120
|
+
continue;
|
|
121
|
+
matched[i] = j;
|
|
122
|
+
used.add(j);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
claim((block, i) => base.blocks[i].card !== undefined && block.card === base.blocks[i].card);
|
|
126
|
+
if (moves)
|
|
127
|
+
claim((block, i) => block.key === base.blocks[i].key);
|
|
128
|
+
// Between two matched neighbours, pair the blocks that changed in place.
|
|
129
|
+
const bounds = [[-1, -1], ...anchors, [n, m]];
|
|
130
|
+
for (let k = 0; k + 1 < bounds.length; k++) {
|
|
131
|
+
const [fromI, fromJ] = bounds[k];
|
|
132
|
+
const [toI, toJ] = bounds[k + 1];
|
|
133
|
+
const left = [];
|
|
134
|
+
const right = [];
|
|
135
|
+
for (let i = fromI + 1; i < toI; i++)
|
|
136
|
+
if (matched[i] === undefined)
|
|
137
|
+
left.push(i);
|
|
138
|
+
for (let j = fromJ + 1; j < toJ; j++)
|
|
139
|
+
if (!used.has(j))
|
|
140
|
+
right.push(j);
|
|
141
|
+
for (const [i, j] of alignChanged(base, left, other, right)) {
|
|
142
|
+
matched[i] = j;
|
|
143
|
+
used.add(j);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return matched;
|
|
147
|
+
}
|
|
148
|
+
/** Pair blocks of the same shape, in order, most pairs first and then the most alike. */
|
|
149
|
+
function alignChanged(base, left, other, right) {
|
|
150
|
+
if (left.length === 0 || right.length === 0)
|
|
151
|
+
return [];
|
|
152
|
+
const pairScore = (i, j) => {
|
|
153
|
+
const a = base.blocks[left[i]];
|
|
154
|
+
const b = other.blocks[right[j]];
|
|
155
|
+
if (a.shape !== b.shape)
|
|
156
|
+
return Number.NEGATIVE_INFINITY;
|
|
157
|
+
return 1 + similarity(textOf(base, a), textOf(other, b));
|
|
158
|
+
};
|
|
159
|
+
const rows = left.length;
|
|
160
|
+
const cols = right.length;
|
|
161
|
+
const score = Array.from({ length: rows + 1 }, () => new Array(cols + 1).fill(0));
|
|
162
|
+
for (let i = rows - 1; i >= 0; i--) {
|
|
163
|
+
for (let j = cols - 1; j >= 0; j--) {
|
|
164
|
+
score[i][j] = Math.max(score[i + 1][j], score[i][j + 1], pairScore(i, j) + score[i + 1][j + 1]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const pairs = [];
|
|
168
|
+
for (let i = 0, j = 0; i < rows && j < cols;) {
|
|
169
|
+
const here = score[i][j];
|
|
170
|
+
const pair = pairScore(i, j);
|
|
171
|
+
if (pair !== Number.NEGATIVE_INFINITY && here === pair + score[i + 1][j + 1]) {
|
|
172
|
+
pairs.push([left[i], right[j]]);
|
|
173
|
+
i += 1;
|
|
174
|
+
j += 1;
|
|
175
|
+
}
|
|
176
|
+
else if (here === score[i + 1][j]) {
|
|
177
|
+
i += 1;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
j += 1;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return pairs;
|
|
184
|
+
}
|
|
185
|
+
function invert(matched, size) {
|
|
186
|
+
const out = new Array(size).fill(undefined);
|
|
187
|
+
matched.forEach((j, i) => {
|
|
188
|
+
if (j !== undefined)
|
|
189
|
+
out[j] = i;
|
|
190
|
+
});
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
193
|
+
function plainText(node) {
|
|
194
|
+
if (!node || typeof node !== 'object')
|
|
195
|
+
return '';
|
|
196
|
+
const value = node;
|
|
197
|
+
if ((value.type === 'text' || value.type === 'inlineCode' || value.type === 'code') && typeof value.value === 'string') {
|
|
198
|
+
return value.value;
|
|
199
|
+
}
|
|
200
|
+
return Array.isArray(value.children) ? value.children.map(plainText).join(' ') : '';
|
|
201
|
+
}
|
|
202
|
+
/** One line of at most `max` characters, cut at a word when there is one near the end. */
|
|
203
|
+
function short(text, max) {
|
|
204
|
+
const line = text.replace(/\s+/g, ' ').trim();
|
|
205
|
+
if (line.length <= max)
|
|
206
|
+
return line;
|
|
207
|
+
const cut = line.slice(0, max - 1);
|
|
208
|
+
const space = cut.lastIndexOf(' ');
|
|
209
|
+
return `${(space > max * 0.6 ? cut.slice(0, space) : cut).trimEnd()}…`;
|
|
210
|
+
}
|
|
211
|
+
/** The block's heading text, card title, or first line. */
|
|
212
|
+
function labelOf(region, block) {
|
|
213
|
+
const node = block.node;
|
|
214
|
+
if (isFlowJsx(node)) {
|
|
215
|
+
const named = attr(node, 'title') ?? attr(node, 'prompt') ?? attr(node, 'label') ?? attr(node, 'id');
|
|
216
|
+
if (named)
|
|
217
|
+
return short(named, 60);
|
|
218
|
+
const text = plainText(node);
|
|
219
|
+
if (text.trim())
|
|
220
|
+
return short(text.split('\n').find((line) => line.trim()) ?? text, 60);
|
|
221
|
+
return `<${node.name ?? 'block'}>`;
|
|
222
|
+
}
|
|
223
|
+
if (node.type === 'heading')
|
|
224
|
+
return short(plainText(node), 60);
|
|
225
|
+
if (node.type === 'code') {
|
|
226
|
+
const first = node.value.split('\n').find((line) => line.trim());
|
|
227
|
+
return short(first ?? `${node.lang ?? 'Code'} block`, 60);
|
|
228
|
+
}
|
|
229
|
+
const first = (plainText(node) || textOf(region, block)).split('\n').find((line) => line.trim()) ?? '';
|
|
230
|
+
return short(first, 60) || short(textOf(region, block), 60);
|
|
231
|
+
}
|
|
232
|
+
const PREVIEW = 90;
|
|
233
|
+
/**
|
|
234
|
+
* A line of the person's version for the Apply bar. A long block shows the part where it starts to
|
|
235
|
+
* differ from `was` (the block before the person changed it), so the line shows what they wrote.
|
|
236
|
+
*/
|
|
237
|
+
function previewOf(region, block, was) {
|
|
238
|
+
const own = plainText(block.node).replace(/\s+/g, ' ').trim();
|
|
239
|
+
if (!own)
|
|
240
|
+
return short(labelOf(region, block), PREVIEW);
|
|
241
|
+
if (own.length <= PREVIEW || !was)
|
|
242
|
+
return short(own, PREVIEW);
|
|
243
|
+
const other = plainText(was.node).replace(/\s+/g, ' ').trim();
|
|
244
|
+
let at = 0;
|
|
245
|
+
while (at < own.length && at < other.length && own[at] === other[at])
|
|
246
|
+
at += 1;
|
|
247
|
+
// Start a few words before the first difference, at a word.
|
|
248
|
+
let start = Math.max(0, Math.min(at - 30, own.length - PREVIEW));
|
|
249
|
+
if (start > 0) {
|
|
250
|
+
const space = own.indexOf(' ', start);
|
|
251
|
+
start = space < 0 || space >= at ? start : space + 1;
|
|
252
|
+
}
|
|
253
|
+
if (start === 0)
|
|
254
|
+
return short(own, PREVIEW);
|
|
255
|
+
return short(`…${own.slice(start)}`, PREVIEW);
|
|
256
|
+
}
|
|
257
|
+
/** A gap that separates two blocks, or a blank line when it would join them. */
|
|
258
|
+
function blankGap(gap) {
|
|
259
|
+
return gap !== undefined && /\n[ \t]*\n/.test(gap) ? gap : '\n\n';
|
|
260
|
+
}
|
|
261
|
+
/** The merged region: theirs, with its own spacing wherever two of its blocks stay neighbours. */
|
|
262
|
+
function assemble(theirs, items, top) {
|
|
263
|
+
const { text, blocks } = theirs;
|
|
264
|
+
if (blocks.length === 0) {
|
|
265
|
+
if (items.length === 0)
|
|
266
|
+
return text.slice(theirs.from, theirs.to);
|
|
267
|
+
return `${top ? '' : '\n'}${items.map((item) => item.text).join('\n\n')}\n`;
|
|
268
|
+
}
|
|
269
|
+
const gap = (index) => index >= 0 && index + 1 < blocks.length ? text.slice(blocks[index].end, blocks[index + 1].start) : undefined;
|
|
270
|
+
const lead = text.slice(theirs.from, blocks[0].start);
|
|
271
|
+
const trail = text.slice(blocks[blocks.length - 1].end, theirs.to);
|
|
272
|
+
if (items.length === 0)
|
|
273
|
+
return top ? `${lead}${trail}` : '\n';
|
|
274
|
+
let out = lead;
|
|
275
|
+
let previous = null;
|
|
276
|
+
for (const item of items) {
|
|
277
|
+
if (previous) {
|
|
278
|
+
if (previous.kind === 'theirs' && item.kind === 'theirs' && item.index === previous.index + 1)
|
|
279
|
+
out += gap(previous.index) ?? '\n\n';
|
|
280
|
+
else if (item.kind === 'new')
|
|
281
|
+
out += '\n\n';
|
|
282
|
+
else if (previous.kind === 'theirs')
|
|
283
|
+
out += blankGap(gap(previous.index));
|
|
284
|
+
else
|
|
285
|
+
out += blankGap(gap(item.index - 1));
|
|
286
|
+
}
|
|
287
|
+
out += item.text;
|
|
288
|
+
previous = item;
|
|
289
|
+
}
|
|
290
|
+
return `${out}${trail}`;
|
|
291
|
+
}
|
|
292
|
+
function conflict(context, entry) {
|
|
293
|
+
const chosen = context.keep[entry.key];
|
|
294
|
+
if (chosen)
|
|
295
|
+
return chosen;
|
|
296
|
+
context.conflicts.push(entry);
|
|
297
|
+
return 'theirs';
|
|
298
|
+
}
|
|
299
|
+
/** Merge one run of sibling blocks. `path` prefixes the conflict keys; `within` names the phase. */
|
|
300
|
+
function mergeRegion(context, base, mine, theirs, path, within, top) {
|
|
301
|
+
const toMine = matchBlocks(base, mine, false);
|
|
302
|
+
const toTheirs = matchBlocks(base, theirs, true);
|
|
303
|
+
const mineBase = invert(toMine, mine.blocks.length);
|
|
304
|
+
const theirsBase = invert(toTheirs, theirs.blocks.length);
|
|
305
|
+
// What goes in each of theirs' blocks; null takes it out.
|
|
306
|
+
const out = theirs.blocks.map((block) => textOf(theirs, block));
|
|
307
|
+
// Base blocks the agent removed and the person changed, then kept.
|
|
308
|
+
const restored = new Set();
|
|
309
|
+
const where = within ? { within } : {};
|
|
310
|
+
for (const [index, block] of base.blocks.entries()) {
|
|
311
|
+
const mi = toMine[index];
|
|
312
|
+
const ti = toTheirs[index];
|
|
313
|
+
const mineBlock = mi === undefined ? undefined : mine.blocks[mi];
|
|
314
|
+
const theirsBlock = ti === undefined ? undefined : theirs.blocks[ti];
|
|
315
|
+
const key = `${path}${index}`;
|
|
316
|
+
let mineSame = mineBlock !== undefined && mineBlock.key === block.key;
|
|
317
|
+
if (!mineSame && mineBlock && top && wiringOnly(block, mineBlock, context.newIds)) {
|
|
318
|
+
// The person only added cards; their steps are wired again onto the agent's workflow below.
|
|
319
|
+
mineSame = true;
|
|
320
|
+
context.rewire = true;
|
|
321
|
+
}
|
|
322
|
+
if (mineBlock && mineSame)
|
|
323
|
+
continue;
|
|
324
|
+
const theirsSame = theirsBlock !== undefined && theirsBlock.key === block.key;
|
|
325
|
+
if (!mineBlock) {
|
|
326
|
+
// The person removed it.
|
|
327
|
+
if (ti === undefined || !theirsBlock)
|
|
328
|
+
continue;
|
|
329
|
+
if (theirsSame) {
|
|
330
|
+
out[ti] = null;
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
const side = conflict(context, {
|
|
334
|
+
key,
|
|
335
|
+
label: labelOf(theirs, theirsBlock),
|
|
336
|
+
...where,
|
|
337
|
+
mine: '',
|
|
338
|
+
theirs: textOf(theirs, theirsBlock),
|
|
339
|
+
minePreview: '',
|
|
340
|
+
});
|
|
341
|
+
if (side === 'mine')
|
|
342
|
+
out[ti] = null;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
// The person changed it.
|
|
346
|
+
if (ti === undefined || !theirsBlock) {
|
|
347
|
+
const side = conflict(context, {
|
|
348
|
+
key,
|
|
349
|
+
label: labelOf(mine, mineBlock),
|
|
350
|
+
...where,
|
|
351
|
+
mine: textOf(mine, mineBlock),
|
|
352
|
+
theirs: '',
|
|
353
|
+
minePreview: previewOf(mine, mineBlock, block),
|
|
354
|
+
});
|
|
355
|
+
if (side === 'mine')
|
|
356
|
+
restored.add(index);
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (theirsSame) {
|
|
360
|
+
out[ti] = textOf(mine, mineBlock);
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
// Both changed it. The same change is no conflict.
|
|
364
|
+
if (theirsBlock.key === mineBlock.key)
|
|
365
|
+
continue;
|
|
366
|
+
const nested = mergePhase(context, base, block, mine, mineBlock, theirs, theirsBlock, `${key}.`);
|
|
367
|
+
if (nested !== undefined) {
|
|
368
|
+
out[ti] = nested;
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
const side = conflict(context, {
|
|
372
|
+
key,
|
|
373
|
+
label: labelOf(theirs, theirsBlock),
|
|
374
|
+
...where,
|
|
375
|
+
mine: textOf(mine, mineBlock),
|
|
376
|
+
theirs: textOf(theirs, theirsBlock),
|
|
377
|
+
minePreview: previewOf(mine, mineBlock, block),
|
|
378
|
+
});
|
|
379
|
+
if (side === 'mine')
|
|
380
|
+
out[ti] = textOf(mine, mineBlock);
|
|
381
|
+
}
|
|
382
|
+
// The person's new blocks go after the block before them that the agent's plan still has.
|
|
383
|
+
const added = new Map();
|
|
384
|
+
const place = (anchor, text) => added.set(anchor, [...(added.get(anchor) ?? []), text]);
|
|
385
|
+
const theirsNew = theirs.blocks.map((_, index) => theirsBase[index] === undefined);
|
|
386
|
+
const claimed = new Set();
|
|
387
|
+
let anchor = 'start';
|
|
388
|
+
for (const [index, block] of mine.blocks.entries()) {
|
|
389
|
+
const bi = mineBase[index];
|
|
390
|
+
if (bi !== undefined) {
|
|
391
|
+
const ti = toTheirs[bi];
|
|
392
|
+
if (ti !== undefined)
|
|
393
|
+
anchor = ti;
|
|
394
|
+
else if (restored.has(bi))
|
|
395
|
+
place(anchor, textOf(mine, block));
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
// Both added a card with this id.
|
|
399
|
+
if (block.card) {
|
|
400
|
+
const twin = theirs.blocks.findIndex((other, ti) => theirsNew[ti] && !claimed.has(ti) && other.card === block.card);
|
|
401
|
+
if (twin >= 0) {
|
|
402
|
+
claimed.add(twin);
|
|
403
|
+
if (theirs.blocks[twin].key === block.key)
|
|
404
|
+
continue;
|
|
405
|
+
const side = conflict(context, {
|
|
406
|
+
key: `${path}new:${block.card}`,
|
|
407
|
+
label: labelOf(theirs, theirs.blocks[twin]),
|
|
408
|
+
...where,
|
|
409
|
+
mine: textOf(mine, block),
|
|
410
|
+
theirs: textOf(theirs, theirs.blocks[twin]),
|
|
411
|
+
minePreview: previewOf(mine, block, theirs.blocks[twin]),
|
|
412
|
+
});
|
|
413
|
+
if (side === 'mine')
|
|
414
|
+
out[twin] = textOf(mine, block);
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
// Both added the same block.
|
|
419
|
+
const same = theirs.blocks.findIndex((other, ti) => theirsNew[ti] && !claimed.has(ti) && other.key === block.key);
|
|
420
|
+
if (same >= 0) {
|
|
421
|
+
claimed.add(same);
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
place(anchor, textOf(mine, block));
|
|
425
|
+
}
|
|
426
|
+
const items = (added.get('start') ?? []).map((text) => ({ kind: 'new', text }));
|
|
427
|
+
for (const [index, text] of out.entries()) {
|
|
428
|
+
if (text !== null)
|
|
429
|
+
items.push({ kind: 'theirs', index, text });
|
|
430
|
+
for (const extra of added.get(index) ?? [])
|
|
431
|
+
items.push({ kind: 'new', text: extra });
|
|
432
|
+
}
|
|
433
|
+
return assemble(theirs, items, top);
|
|
434
|
+
}
|
|
435
|
+
/** A phase cut into its opening tag, the run of blocks inside, and its closing tag. */
|
|
436
|
+
function phaseParts(text, block) {
|
|
437
|
+
const node = block.node;
|
|
438
|
+
if (!isFlowJsx(node) || node.name !== 'phase')
|
|
439
|
+
return undefined;
|
|
440
|
+
const lastAttribute = node.attributes.at(-1);
|
|
441
|
+
const afterName = lastAttribute ? lastAttribute.position?.end.offset : block.start + 1 + node.name.length;
|
|
442
|
+
if (afterName === undefined)
|
|
443
|
+
return undefined;
|
|
444
|
+
const close = text.indexOf('>', afterName);
|
|
445
|
+
if (close < 0 || text.slice(afterName, close).trim() !== '')
|
|
446
|
+
return undefined;
|
|
447
|
+
const tagEnd = close + 1;
|
|
448
|
+
const closing = /<\/\s*phase\s*>$/.exec(text.slice(block.start, block.end));
|
|
449
|
+
if (!closing)
|
|
450
|
+
return undefined;
|
|
451
|
+
const closeStart = block.start + closing.index;
|
|
452
|
+
const blocks = toBlocks(node.children);
|
|
453
|
+
// A block inside is edited on its own only when it starts a line (src/planMdx/remarkBlockRanges.ts).
|
|
454
|
+
if (blocks.some((child) => child.node.position?.start.column !== 1 || child.start < tagEnd || child.end > closeStart))
|
|
455
|
+
return undefined;
|
|
456
|
+
return { node, tagEnd, closeStart, inner: { text, blocks, from: tagEnd, to: closeStart } };
|
|
457
|
+
}
|
|
458
|
+
function attributesOf(text, node) {
|
|
459
|
+
const out = new Map();
|
|
460
|
+
for (const attribute of node.attributes) {
|
|
461
|
+
const start = attribute.position?.start.offset;
|
|
462
|
+
const end = attribute.position?.end.offset;
|
|
463
|
+
if (start === undefined || end === undefined)
|
|
464
|
+
return undefined;
|
|
465
|
+
const slice = text.slice(start, end);
|
|
466
|
+
const name = attribute.type === 'mdxJsxAttribute' ? attribute.name : `{${slice}}`;
|
|
467
|
+
out.set(name, { name, text: slice, key: keyOf(attribute), start, end });
|
|
468
|
+
}
|
|
469
|
+
return out;
|
|
470
|
+
}
|
|
471
|
+
/** A phase both sides changed: its attributes one by one, then its blocks one by one. */
|
|
472
|
+
function mergePhase(context, base, baseBlock, mine, mineBlock, theirs, theirsBlock, path) {
|
|
473
|
+
const b = phaseParts(base.text, baseBlock);
|
|
474
|
+
const m = phaseParts(mine.text, mineBlock);
|
|
475
|
+
const t = phaseParts(theirs.text, theirsBlock);
|
|
476
|
+
if (!b || !m || !t)
|
|
477
|
+
return undefined;
|
|
478
|
+
const tag = mergeTag(context, theirs.text, theirsBlock, { base: [base.text, b], mine: [mine.text, m], theirs: [theirs.text, t] }, path);
|
|
479
|
+
if (tag === undefined)
|
|
480
|
+
return undefined;
|
|
481
|
+
const title = attr(t.node, 'title') ?? attr(m.node, 'title') ?? attr(t.node, 'id');
|
|
482
|
+
const inner = mergeRegion(context, b.inner, m.inner, t.inner, path, title, false);
|
|
483
|
+
return `${tag}${inner}${theirs.text.slice(t.closeStart, theirsBlock.end)}`;
|
|
484
|
+
}
|
|
485
|
+
/** The phase's opening tag: theirs, with the attributes only the person changed taken from theirs'. */
|
|
486
|
+
function mergeTag(context, text, theirsBlock, sides, path) {
|
|
487
|
+
const [baseText, b] = sides.base;
|
|
488
|
+
const [mineText, m] = sides.mine;
|
|
489
|
+
const [, t] = sides.theirs;
|
|
490
|
+
const baseAttrs = attributesOf(baseText, b.node);
|
|
491
|
+
const mineAttrs = attributesOf(mineText, m.node);
|
|
492
|
+
const theirsAttrs = attributesOf(text, t.node);
|
|
493
|
+
if (!baseAttrs || !mineAttrs || !theirsAttrs)
|
|
494
|
+
return undefined;
|
|
495
|
+
const names = [...theirsAttrs.keys(), ...[...mineAttrs.keys()].filter((name) => !theirsAttrs.has(name))];
|
|
496
|
+
const fromMine = [];
|
|
497
|
+
const clashing = [];
|
|
498
|
+
for (const name of names) {
|
|
499
|
+
const was = baseAttrs.get(name)?.key;
|
|
500
|
+
const mineKey = mineAttrs.get(name)?.key;
|
|
501
|
+
const theirsKey = theirsAttrs.get(name)?.key;
|
|
502
|
+
if (mineKey === was || mineKey === theirsKey)
|
|
503
|
+
continue;
|
|
504
|
+
if (theirsKey === was)
|
|
505
|
+
fromMine.push(name);
|
|
506
|
+
else
|
|
507
|
+
clashing.push(name);
|
|
508
|
+
}
|
|
509
|
+
const tagText = (source, parts, block) => source.slice(block.start, parts.tagEnd);
|
|
510
|
+
const theirsTag = tagText(text, t, theirsBlock);
|
|
511
|
+
if (clashing.length > 0) {
|
|
512
|
+
const title = attr(t.node, 'title') ?? attr(m.node, 'title') ?? attr(t.node, 'id') ?? 'Phase';
|
|
513
|
+
const mineBlockStart = m.node.position?.start.offset ?? 0;
|
|
514
|
+
const side = conflict(context, {
|
|
515
|
+
key: `${path}tag`,
|
|
516
|
+
label: `${short(title, 50)} (${clashing.join(', ')})`,
|
|
517
|
+
mine: mineText.slice(mineBlockStart, m.tagEnd),
|
|
518
|
+
theirs: theirsTag,
|
|
519
|
+
minePreview: clashing.map((name) => mineAttrs.get(name)?.text ?? `no ${name}`).join(' '),
|
|
520
|
+
});
|
|
521
|
+
if (side === 'mine')
|
|
522
|
+
fromMine.push(...clashing);
|
|
523
|
+
}
|
|
524
|
+
if (fromMine.length === 0)
|
|
525
|
+
return theirsTag;
|
|
526
|
+
// Edit theirs' tag in place, from the end, so earlier offsets hold.
|
|
527
|
+
const start = theirsBlock.start;
|
|
528
|
+
const lastTheirs = [...theirsAttrs.values()].at(-1);
|
|
529
|
+
const insertAt = (lastTheirs ? lastTheirs.end : start + 1 + 'phase'.length) - start;
|
|
530
|
+
const edits = [];
|
|
531
|
+
for (const name of fromMine) {
|
|
532
|
+
const ours = mineAttrs.get(name);
|
|
533
|
+
const current = theirsAttrs.get(name);
|
|
534
|
+
if (current && ours)
|
|
535
|
+
edits.push({ at: current.start - start, length: current.end - current.start, text: ours.text });
|
|
536
|
+
else if (current) {
|
|
537
|
+
const lead = /\s*$/.exec(theirsTag.slice(0, current.start - start))?.[0].length ?? 0;
|
|
538
|
+
edits.push({ at: current.start - start - lead, length: current.end - current.start + lead, text: '' });
|
|
539
|
+
}
|
|
540
|
+
else if (ours)
|
|
541
|
+
edits.push({ at: insertAt, length: 0, text: ` ${ours.text}` });
|
|
542
|
+
}
|
|
543
|
+
let tag = theirsTag;
|
|
544
|
+
for (const edit of edits.sort((x, y) => y.at - x.at))
|
|
545
|
+
tag = tag.slice(0, edit.at) + edit.text + tag.slice(edit.at + edit.length);
|
|
546
|
+
return tag;
|
|
547
|
+
}
|
|
548
|
+
function workflowLines(node) {
|
|
549
|
+
if (!isFlowJsx(node) || node.name !== 'workflow')
|
|
550
|
+
return undefined;
|
|
551
|
+
const fence = node.children.find((child) => child.type === 'code' && child.lang === 'workflow');
|
|
552
|
+
if (!fence)
|
|
553
|
+
return undefined;
|
|
554
|
+
const shell = keyOf({ ...node, children: node.children.map((child) => (child === fence ? { ...fence, value: '' } : child)) });
|
|
555
|
+
const lines = fence.value.split('\n');
|
|
556
|
+
const cut = lines.findIndex((line) => line.trim() === '--');
|
|
557
|
+
const head = cut < 0 ? lines : lines.slice(0, cut);
|
|
558
|
+
const tail = cut < 0 ? [] : lines.slice(cut + 1);
|
|
559
|
+
return {
|
|
560
|
+
shell,
|
|
561
|
+
nodes: head.map((line) => line.trim()).filter(Boolean),
|
|
562
|
+
edges: tail.map((line) => line.trim()).filter(Boolean),
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function edgeEnds(line) {
|
|
566
|
+
const match = /^(\S+)\s*->\s*(\S+)/.exec(line);
|
|
567
|
+
return match ? [match[1], match[2]] : undefined;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* True when the person's workflow differs from base only by the steps `wireNewSteps` wrote for
|
|
571
|
+
* cards they added: those steps' lines, their edges, and the base edges they were put between.
|
|
572
|
+
*/
|
|
573
|
+
function wiringOnly(base, mine, newIds) {
|
|
574
|
+
if (newIds.size === 0)
|
|
575
|
+
return false;
|
|
576
|
+
const was = workflowLines(base.node);
|
|
577
|
+
const now = workflowLines(mine.node);
|
|
578
|
+
if (!was || !now || was.shell !== now.shell)
|
|
579
|
+
return false;
|
|
580
|
+
const isNew = (line) => newIds.has(workflowNodeCells(line)?.[0] ?? '');
|
|
581
|
+
if (now.nodes.filter((line) => !isNew(line)).join('\n') !== was.nodes.join('\n'))
|
|
582
|
+
return false;
|
|
583
|
+
// A step `wireNewSteps` wrote is `id | label | id`. Anything else on a new step was typed by hand.
|
|
584
|
+
const written = (line) => {
|
|
585
|
+
const [id, , ref, ...rest] = workflowNodeCells(line) ?? [];
|
|
586
|
+
return id === ref && rest.length === 0;
|
|
587
|
+
};
|
|
588
|
+
if (!now.nodes.filter(isNew).every(written))
|
|
589
|
+
return false;
|
|
590
|
+
const touchesNew = (line) => {
|
|
591
|
+
const ends = edgeEnds(line);
|
|
592
|
+
return ends ? newIds.has(ends[0]) || newIds.has(ends[1]) : false;
|
|
593
|
+
};
|
|
594
|
+
if (now.edges.some((line) => touchesNew(line) && !/^\S+\s*->\s*\S+$/.test(line)))
|
|
595
|
+
return false;
|
|
596
|
+
const left = [...was.edges];
|
|
597
|
+
for (const line of now.edges.filter((edge) => !touchesNew(edge))) {
|
|
598
|
+
const at = left.indexOf(line);
|
|
599
|
+
if (at < 0)
|
|
600
|
+
return false;
|
|
601
|
+
left.splice(at, 1);
|
|
602
|
+
}
|
|
603
|
+
// Each base edge that is gone now runs through the new steps.
|
|
604
|
+
const next = new Map();
|
|
605
|
+
for (const line of now.edges) {
|
|
606
|
+
const ends = edgeEnds(line);
|
|
607
|
+
if (ends)
|
|
608
|
+
next.set(ends[0], [...(next.get(ends[0]) ?? []), ends[1]]);
|
|
609
|
+
}
|
|
610
|
+
return left.every((line) => {
|
|
611
|
+
const ends = edgeEnds(line);
|
|
612
|
+
if (!ends)
|
|
613
|
+
return false;
|
|
614
|
+
const [from, to] = ends;
|
|
615
|
+
const queue = (next.get(from) ?? []).filter((step) => newIds.has(step));
|
|
616
|
+
const seen = new Set(queue);
|
|
617
|
+
while (queue.length > 0) {
|
|
618
|
+
const step = queue.shift();
|
|
619
|
+
for (const after of next.get(step) ?? []) {
|
|
620
|
+
if (after === to)
|
|
621
|
+
return true;
|
|
622
|
+
if (newIds.has(after) && !seen.has(after)) {
|
|
623
|
+
seen.add(after);
|
|
624
|
+
queue.push(after);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return false;
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function bodyRegion(body) {
|
|
632
|
+
return { text: body, blocks: toBlocks(parse(body).children), from: 0, to: body.length };
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* The person's edits (`mine` against `base`) on top of the agent's plan (`theirs`).
|
|
636
|
+
*
|
|
637
|
+
* - A block the person did not change takes theirs.
|
|
638
|
+
* - A block the person changed that the agent did not change takes the person's.
|
|
639
|
+
* - A block the person added goes after the block before it, in theirs; when the agent removed that
|
|
640
|
+
* one, after the nearest block before it that theirs still has, or first when there is none.
|
|
641
|
+
* - A block the person removed that the agent did not change is removed.
|
|
642
|
+
* - A block both changed, each in its own way, is a conflict: the source keeps theirs and the
|
|
643
|
+
* conflict carries both texts, until `keep` picks a side. The same change on both sides is no conflict.
|
|
644
|
+
* - A phase both changed merges its attributes one by one and the blocks inside it one by one.
|
|
645
|
+
* - Front matter takes theirs unless only the person changed it.
|
|
646
|
+
* - When the person's workflow differs only by the steps for their new cards, the agent's
|
|
647
|
+
* workflow is kept and those cards are wired onto it again (`wireNewSteps`).
|
|
648
|
+
*
|
|
649
|
+
* Throws when a version does not parse as MDX.
|
|
650
|
+
*/
|
|
651
|
+
export function rebaseDraft(input) {
|
|
652
|
+
const { base, mine, theirs } = input;
|
|
653
|
+
if (mine === base || mine === theirs)
|
|
654
|
+
return { source: theirs, conflicts: [] };
|
|
655
|
+
if (theirs === base)
|
|
656
|
+
return { source: mine, conflicts: [] };
|
|
657
|
+
const b = splitFrontmatter(base);
|
|
658
|
+
const m = splitFrontmatter(mine);
|
|
659
|
+
const t = splitFrontmatter(theirs);
|
|
660
|
+
const frontmatter = m.frontmatter !== b.frontmatter && t.frontmatter === b.frontmatter ? m.frontmatter : t.frontmatter;
|
|
661
|
+
const baseIds = topEntryIds(b.body);
|
|
662
|
+
const theirsIds = topEntryIds(t.body);
|
|
663
|
+
const context = {
|
|
664
|
+
keep: input.keep ?? {},
|
|
665
|
+
conflicts: [],
|
|
666
|
+
newIds: new Set([...topEntryIds(m.body)].filter((id) => !baseIds.has(id))),
|
|
667
|
+
rewire: false,
|
|
668
|
+
};
|
|
669
|
+
let body = mergeRegion(context, bodyRegion(b.body), bodyRegion(m.body), bodyRegion(t.body), '', undefined, true);
|
|
670
|
+
if (context.rewire)
|
|
671
|
+
body = wireNewSteps(body, new Set([...baseIds, ...theirsIds]));
|
|
672
|
+
if (frontmatter && !frontmatter.endsWith('\n') && body && !body.startsWith('\n'))
|
|
673
|
+
body = `\n${body}`;
|
|
674
|
+
return { source: `${frontmatter}${body}`, conflicts: context.conflicts };
|
|
675
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type EstreeNode = {
|
|
2
|
+
type?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
value?: unknown;
|
|
5
|
+
callee?: EstreeNode;
|
|
6
|
+
arguments?: EstreeNode[];
|
|
7
|
+
object?: EstreeNode;
|
|
8
|
+
property?: EstreeNode;
|
|
9
|
+
computed?: boolean;
|
|
10
|
+
optional?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* MDX compiles unknown lowercase tags as intrinsic elements (`_jsx("phase")`),
|
|
14
|
+
* which ignores the component map. Point those tags at `_components.phase`
|
|
15
|
+
* so the plan vocabulary resolves through the map.
|
|
16
|
+
*/
|
|
17
|
+
export declare function recmaPlanComponents(): (tree: EstreeNode) => void;
|
|
18
|
+
export {};
|