nolzu 0.0.1 → 0.1.0
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/LICENSE +105 -0
- package/README.md +24 -7
- package/build/client/_app/immutable/assets/0.SPD4wYkc.css +1 -0
- package/build/client/_app/immutable/assets/1.BRilEoOO.css +1 -0
- package/build/client/_app/immutable/assets/10.DwLiBGDj.css +1 -0
- package/build/client/_app/immutable/assets/11.D_TtWT3D.css +1 -0
- package/build/client/_app/immutable/assets/12.CSVGmtUY.css +1 -0
- package/build/client/_app/immutable/assets/13.qTa7IHbg.css +1 -0
- package/build/client/_app/immutable/assets/19.CbCFXKb8.css +1 -0
- package/build/client/_app/immutable/assets/2.CfHhgI77.css +1 -0
- package/build/client/_app/immutable/assets/20.C5CSZhyT.css +1 -0
- package/build/client/_app/immutable/assets/21.BBpYkZcc.css +1 -0
- package/build/client/_app/immutable/assets/22.C9RgY9kl.css +1 -0
- package/build/client/_app/immutable/assets/23.B6Dp9RJO.css +1 -0
- package/build/client/_app/immutable/assets/24.C7g2abUW.css +1 -0
- package/build/client/_app/immutable/assets/26.DTMI6ROV.css +1 -0
- package/build/client/_app/immutable/assets/27.AxXMpDkB.css +1 -0
- package/build/client/_app/immutable/assets/28.939ac-98.css +1 -0
- package/build/client/_app/immutable/assets/3.3lqex1t-.css +1 -0
- package/build/client/_app/immutable/assets/4.C52MzO_d.css +1 -0
- package/build/client/_app/immutable/assets/5.CsfJAwvS.css +1 -0
- package/build/client/_app/immutable/assets/8.ByspUp-s.css +1 -0
- package/build/client/_app/immutable/assets/9.BCSFZmce.css +1 -0
- package/build/client/_app/immutable/assets/Banner.DDqfpWLD.css +1 -0
- package/build/client/_app/immutable/assets/BoardOff.mpX08-Be.css +1 -0
- package/build/client/_app/immutable/assets/Button.BlwsEgUc.css +1 -0
- package/build/client/_app/immutable/assets/Chip.qAAa6_e5.css +1 -0
- package/build/client/_app/immutable/assets/Dialog.D5Ln60a8.css +1 -0
- package/build/client/_app/immutable/assets/FeaturePanels.DZ_Mth5M.css +1 -0
- package/build/client/_app/immutable/assets/FolderBrowser.DBmRWDCH.css +1 -0
- package/build/client/_app/immutable/assets/Geist-Variable.Bj2R_7yk.woff2 +0 -0
- package/build/client/_app/immutable/assets/GeistMono-Variable.Dispecij.woff2 +0 -0
- package/build/client/_app/immutable/assets/HelpTip.DF6T9nns.css +1 -0
- package/build/client/_app/immutable/assets/InfoBox.CpavOykF.css +1 -0
- package/build/client/_app/immutable/assets/KeyCaps.D2t-lY-8.css +1 -0
- package/build/client/_app/immutable/assets/LogLine.Bu4feLn5.css +1 -0
- package/build/client/_app/immutable/assets/Markdown.DI6AtWAc.css +1 -0
- package/build/client/_app/immutable/assets/ModelPicker.DQzj7Nj8.css +1 -0
- package/build/client/_app/immutable/assets/OptionButtons.BYiyOXOE.css +1 -0
- package/build/client/_app/immutable/assets/PeekPanel.DzMdHoqg.css +1 -0
- package/build/client/_app/immutable/assets/ScoutPage.CVIiLy5c.css +1 -0
- package/build/client/_app/immutable/assets/SetupSteps.B6pZP1Bk.css +1 -0
- package/build/client/_app/immutable/assets/Skeleton.BC-1_U5d.css +1 -0
- package/build/client/_app/immutable/assets/SlotsMeter.Dq7GGYlD.css +1 -0
- package/build/client/_app/immutable/assets/StartConfirm.DxNN2AOb.css +1 -0
- package/build/client/_app/immutable/assets/StatePill.CGWFVUUg.css +1 -0
- package/build/client/_app/immutable/assets/Streamed.DpZ6wgO2.css +1 -0
- package/build/client/_app/immutable/assets/card-pulls.C5uGMuAh.css +1 -0
- package/build/client/_app/immutable/assets/next-step.CKg1w06J.css +1 -0
- package/build/client/_app/immutable/chunks/-B5EclhK.js +1 -0
- package/build/client/_app/immutable/chunks/-Q3zApAy.js +1 -0
- package/build/client/_app/immutable/chunks/6-hwN_Ik.js +3 -0
- package/build/client/_app/immutable/chunks/B16UF4PA.js +11 -0
- package/build/client/_app/immutable/chunks/B1V3h1VF.js +1 -0
- package/build/client/_app/immutable/chunks/B2d2Mkuz.js +68 -0
- package/build/client/_app/immutable/chunks/B2yzhiEa.js +1 -0
- package/build/client/_app/immutable/chunks/B5zDDQUU.js +2 -0
- package/build/client/_app/immutable/chunks/B8DHSiWf.js +1 -0
- package/build/client/_app/immutable/chunks/B8z33EzI.js +1 -0
- package/build/client/_app/immutable/chunks/BCRkrH6c.js +1 -0
- package/build/client/_app/immutable/chunks/BCScjOxu.js +1 -0
- package/build/client/_app/immutable/chunks/BMUQtCEC.js +1 -0
- package/build/client/_app/immutable/chunks/BNnfkvZM.js +1 -0
- package/build/client/_app/immutable/chunks/BelWyZaW.js +1 -0
- package/build/client/_app/immutable/chunks/BhZpqODT.js +1 -0
- package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
- package/build/client/_app/immutable/chunks/BmafI-Bs.js +1 -0
- package/build/client/_app/immutable/chunks/BvRk9kiK.js +0 -0
- package/build/client/_app/immutable/chunks/C4i6bdQg.js +1 -0
- package/build/client/_app/immutable/chunks/C8u5TyIB.js +1 -0
- package/build/client/_app/immutable/chunks/CFs2xhoy.js +1 -0
- package/build/client/_app/immutable/chunks/CIm2DioU.js +1 -0
- package/build/client/_app/immutable/chunks/CONqGBXC.js +1 -0
- package/build/client/_app/immutable/chunks/CSOz40qO.js +1 -0
- package/build/client/_app/immutable/chunks/CXxuD1ef.js +3 -0
- package/build/client/_app/immutable/chunks/CarrGsZA.js +2 -0
- package/build/client/_app/immutable/chunks/CdrmTD44.js +1 -0
- package/build/client/_app/immutable/chunks/CfJRH9gh.js +2 -0
- package/build/client/_app/immutable/chunks/Ci7C9Cki.js +1 -0
- package/build/client/_app/immutable/chunks/CkOTL1vK.js +1 -0
- package/build/client/_app/immutable/chunks/CngTtGc_.js +1 -0
- package/build/client/_app/immutable/chunks/Cp3A1zR8.js +1 -0
- package/build/client/_app/immutable/chunks/CwtMnwNL.js +3 -0
- package/build/client/_app/immutable/chunks/Cy7f_oXg.js +1 -0
- package/build/client/_app/immutable/chunks/D-wwLm5t.js +1 -0
- package/build/client/_app/immutable/chunks/D2imbgaf.js +1 -0
- package/build/client/_app/immutable/chunks/D32mip60.js +1 -0
- package/build/client/_app/immutable/chunks/D46Vk19W.js +1 -0
- package/build/client/_app/immutable/chunks/DCUUgo-6.js +1 -0
- package/build/client/_app/immutable/chunks/DFjnjJjy.js +1 -0
- package/build/client/_app/immutable/chunks/DHMbSbMg.js +1 -0
- package/build/client/_app/immutable/chunks/DJOFx2wx.js +1 -0
- package/build/client/_app/immutable/chunks/DV4tvxHp.js +3 -0
- package/build/client/_app/immutable/chunks/DXk_5YEw.js +1 -0
- package/build/client/_app/immutable/chunks/DjgnRLJt.js +1 -0
- package/build/client/_app/immutable/chunks/DlWlQ_vP.js +1 -0
- package/build/client/_app/immutable/chunks/DpIAei2y.js +2 -0
- package/build/client/_app/immutable/chunks/Dt-HX3Vu.js +1 -0
- package/build/client/_app/immutable/chunks/DuSthUWX.js +1 -0
- package/build/client/_app/immutable/chunks/Ecfl8TOn.js +2 -0
- package/build/client/_app/immutable/chunks/ITHE99Aa.js +1 -0
- package/build/client/_app/immutable/chunks/Khdge0KS.js +1 -0
- package/build/client/_app/immutable/chunks/LMEKNlm0.js +1 -0
- package/build/client/_app/immutable/chunks/OnIeaiuO.js +1 -0
- package/build/client/_app/immutable/chunks/VFQLu55q.js +1 -0
- package/build/client/_app/immutable/chunks/ZsUxKnQw.js +1 -0
- package/build/client/_app/immutable/chunks/aWP8DVhV.js +1 -0
- package/build/client/_app/immutable/chunks/bB04Xp1f.js +1 -0
- package/build/client/_app/immutable/chunks/eylBqhv8.js +3 -0
- package/build/client/_app/immutable/chunks/hx0ssLL_.js +2 -0
- package/build/client/_app/immutable/chunks/mumDj17t.js +1 -0
- package/build/client/_app/immutable/chunks/pZYp3_TE.js +1 -0
- package/build/client/_app/immutable/chunks/tImwjqWn.js +1 -0
- package/build/client/_app/immutable/chunks/uBIymjUX.js +1 -0
- package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
- package/build/client/_app/immutable/entry/app.DVZ1wE36.js +2 -0
- package/build/client/_app/immutable/entry/start.DluCc61B.js +1 -0
- package/build/client/_app/immutable/nodes/0.CwNFevXf.js +1 -0
- package/build/client/_app/immutable/nodes/1.BR6FYiC-.js +1 -0
- package/build/client/_app/immutable/nodes/10.wNwBFtom.js +2 -0
- package/build/client/_app/immutable/nodes/11.DpoIbMNF.js +2 -0
- package/build/client/_app/immutable/nodes/12.CWdUJ8l3.js +2 -0
- package/build/client/_app/immutable/nodes/13.CZ2uTvNS.js +1 -0
- package/build/client/_app/immutable/nodes/14.CzgyXuvL.js +1 -0
- package/build/client/_app/immutable/nodes/15.CzgyXuvL.js +1 -0
- package/build/client/_app/immutable/nodes/16.odL9eB2N.js +1 -0
- package/build/client/_app/immutable/nodes/17.B-RnUeVU.js +1 -0
- package/build/client/_app/immutable/nodes/18.BLYKxyq2.js +1 -0
- package/build/client/_app/immutable/nodes/19.CgyFfPqF.js +3 -0
- package/build/client/_app/immutable/nodes/2.CCWT41Qr.js +1 -0
- package/build/client/_app/immutable/nodes/20.BBk5-krg.js +1 -0
- package/build/client/_app/immutable/nodes/21.CJoU3s1A.js +2 -0
- package/build/client/_app/immutable/nodes/22.CoRvPh8m.js +1 -0
- package/build/client/_app/immutable/nodes/23.zXO3NjnM.js +3 -0
- package/build/client/_app/immutable/nodes/24.CmO27TED.js +1 -0
- package/build/client/_app/immutable/nodes/26.TVKNr_xX.js +18 -0
- package/build/client/_app/immutable/nodes/27.RojtGU_o.js +1 -0
- package/build/client/_app/immutable/nodes/28.CVTdeeSI.js +2 -0
- package/build/client/_app/immutable/nodes/3.Cgib7Vi6.js +1 -0
- package/build/client/_app/immutable/nodes/4.CnMwOCec.js +1 -0
- package/build/client/_app/immutable/nodes/5.-NqYtQj_.js +1 -0
- package/build/client/_app/immutable/nodes/6.D5xk-UBM.js +1 -0
- package/build/client/_app/immutable/nodes/7.IL4b-DII.js +1 -0
- package/build/client/_app/immutable/nodes/8.DJrguHjO.js +11 -0
- package/build/client/_app/immutable/nodes/9.DTUSzWiK.js +1 -0
- package/build/client/_app/version.json +1 -0
- package/build/client/favicon.svg +7 -0
- package/build/env.js +70 -0
- package/build/handler.js +26 -0
- package/build/index.js +149 -0
- package/build/server/chunks/chunks/Banner.js-D4mtxUfF.js +17 -0
- package/build/server/chunks/chunks/BoardOff.js-Dg5-LoR3.js +1627 -0
- package/build/server/chunks/chunks/Button.js-Buh9rnpu.js +43 -0
- package/build/server/chunks/chunks/Chip.js-xZ7vFkHx.js +12 -0
- package/build/server/chunks/chunks/Dialog.js-CGpwdpM-.js +60 -0
- package/build/server/chunks/chunks/FeaturePanels.js-B2sKozgF.js +84 -0
- package/build/server/chunks/chunks/FolderBrowser.js-DUHFhDaX.js +28 -0
- package/build/server/chunks/chunks/HelpTip.js-CzemvmjC.js +19 -0
- package/build/server/chunks/chunks/InfoBox.js-BJiVzZgw.js +10 -0
- package/build/server/chunks/chunks/KeyCaps.js-BMI2Hrh2.js +37 -0
- package/build/server/chunks/chunks/LogLine.js-2b7uX__H.js +35 -0
- package/build/server/chunks/chunks/Markdown.js-Clud88KU.js +4233 -0
- package/build/server/chunks/chunks/ModelPicker.js-FuBgyKIA.js +141 -0
- package/build/server/chunks/chunks/OptionButtons.js-LQKrAwUX.js +28 -0
- package/build/server/chunks/chunks/PeekPanel.js-aZ-r_v3N.js +375 -0
- package/build/server/chunks/chunks/ScoutPage.js-2DcNia96.js +733 -0
- package/build/server/chunks/chunks/SetupSteps.js-D7TAF7xa.js +66 -0
- package/build/server/chunks/chunks/Skeleton.js-diCP2sd5.js +30 -0
- package/build/server/chunks/chunks/SlotsMeter.js-BV_sAGf5.js +18 -0
- package/build/server/chunks/chunks/StartConfirm.js-CzEdFtbO.js +124 -0
- package/build/server/chunks/chunks/StatePill.js-CM7-HXNM.js +27 -0
- package/build/server/chunks/chunks/Streamed.js-_NgwNMMs.js +43 -0
- package/build/server/chunks/chunks/_page.server.js-BaGoctEY.js +1419 -0
- package/build/server/chunks/chunks/activity.js-CSoPUQLq.js +84 -0
- package/build/server/chunks/chunks/add-repo.js-DtHEobfm.js +305 -0
- package/build/server/chunks/chunks/app-header.js-CCflgeEQ.js +13 -0
- package/build/server/chunks/chunks/app.js-CuPn8jtk.js +12 -0
- package/build/server/chunks/chunks/bin.js-Cyb2cYLc.js +58 -0
- package/build/server/chunks/chunks/board-keys.js-CW3qw-MC.js +32 -0
- package/build/server/chunks/chunks/board-page.js-D0tdsE9J.js +860 -0
- package/build/server/chunks/chunks/board.js-BxL3CjB1.js +203 -0
- package/build/server/chunks/chunks/browser-test.js-DJEpOoVz.js +170 -0
- package/build/server/chunks/chunks/card-pulls.js-d_uGmBB3.js +229 -0
- package/build/server/chunks/chunks/card-repos.js-QaMCxiyV.js +59 -0
- package/build/server/chunks/chunks/chain-store.js-D42m8DUo.js +91 -0
- package/build/server/chunks/chunks/chain.js-CJFRywIC.js +52 -0
- package/build/server/chunks/chunks/changes.js-D8ITRMgU.js +513 -0
- package/build/server/chunks/chunks/checkout.js-Ys5L_gA4.js +319 -0
- package/build/server/chunks/chunks/client.js-B7jIMDuS.js +68 -0
- package/build/server/chunks/chunks/clipboard.js-qXskOBim.js +12 -0
- package/build/server/chunks/chunks/cloud-status.js-hy-9zUVX.js +95 -0
- package/build/server/chunks/chunks/coach.js-BhNB14rV.js +296 -0
- package/build/server/chunks/chunks/comments.js-1nWJQptB.js +311 -0
- package/build/server/chunks/chunks/commit-message.js-CMcNZUZw.js +8 -0
- package/build/server/chunks/chunks/create-card.js-DKtprMG6.js +498 -0
- package/build/server/chunks/chunks/db.js-pqoVpAzG.js +80 -0
- package/build/server/chunks/chunks/diff-comments.js-BSCuay_U.js +95 -0
- package/build/server/chunks/chunks/discussion.js-rJ5OMfvX.js +355 -0
- package/build/server/chunks/chunks/display.js-Bf-vGQ7Q.js +61 -0
- package/build/server/chunks/chunks/elapsed.js-DikkNhaD.js +27 -0
- package/build/server/chunks/chunks/engine.js-DS5zUwsE.js +115 -0
- package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
- package/build/server/chunks/chunks/estimate.js-BHTYVTaQ.js +2484 -0
- package/build/server/chunks/chunks/evidence-timeline.js-Dk0dTZIy.js +253 -0
- package/build/server/chunks/chunks/evidence.js-CT3tWdbB.js +257 -0
- package/build/server/chunks/chunks/exports.js-Hn-WQRMB.js +150 -0
- package/build/server/chunks/chunks/features.svelte.js-DNsFmFZb.js +10 -0
- package/build/server/chunks/chunks/files.js-V46lE0-6.js +46 -0
- package/build/server/chunks/chunks/filter.js-CsmCtJMd.js +11 -0
- package/build/server/chunks/chunks/forms.js-03E8qnFz.js +35 -0
- package/build/server/chunks/chunks/gate.js-Cbqo8Yy0.js +82 -0
- package/build/server/chunks/chunks/getting-started.js-DKbHofN5.js +55 -0
- package/build/server/chunks/chunks/git.js-l43vBHqs.js +16 -0
- package/build/server/chunks/chunks/home-path.js-BXgrl3TP.js +11 -0
- package/build/server/chunks/chunks/hub-link.js-B5kjLyyd.js +1532 -0
- package/build/server/chunks/chunks/internal.js-DaSBO6jY.js +1239 -0
- package/build/server/chunks/chunks/internal2.js-D6AKyUgY.js +27 -0
- package/build/server/chunks/chunks/knowledge-page.js-D2ALB3v9.js +292 -0
- package/build/server/chunks/chunks/knowledge-revert.js-2eyN9Lcb.js +109 -0
- package/build/server/chunks/chunks/knowledge.js--eAgdzNx.js +394 -0
- package/build/server/chunks/chunks/last-board.js-BemeiK3t.js +23 -0
- package/build/server/chunks/chunks/log.js-R2zUph6T.js +228 -0
- package/build/server/chunks/chunks/loop.js-D3guWKLp.js +4038 -0
- package/build/server/chunks/chunks/loop2.js-B_Qd2m4y.js +67 -0
- package/build/server/chunks/chunks/navigation.js-DQJMz-SM.js +2 -0
- package/build/server/chunks/chunks/new-project.js-DNcr9JpB.js +305 -0
- package/build/server/chunks/chunks/next-step.js-B8Kl0Iv9.js +522 -0
- package/build/server/chunks/chunks/node.js-Bz2jT5wt.js +3381 -0
- package/build/server/chunks/chunks/now-live.svelte.js-hIaDgjJ3.js +13 -0
- package/build/server/chunks/chunks/now-snapshot.js-zGKLIzox.js +207 -0
- package/build/server/chunks/chunks/now.js-Dfm-o0Ha.js +765 -0
- package/build/server/chunks/chunks/onboard.js-LBqPOxyU.js +1525 -0
- package/build/server/chunks/chunks/ordinal.js-Bm_9QEBD.js +12 -0
- package/build/server/chunks/chunks/overview.js-C32iHkXD.js +1108 -0
- package/build/server/chunks/chunks/page-keys.svelte.js-D8vXA_8Z.js +14 -0
- package/build/server/chunks/chunks/patch.js-Bl7vwsUj.js +62 -0
- package/build/server/chunks/chunks/paths.js-DVRjNYFW.js +19 -0
- package/build/server/chunks/chunks/peek.js-D9sSjT9t.js +95 -0
- package/build/server/chunks/chunks/plan.js-DFq5ntMM.js +143 -0
- package/build/server/chunks/chunks/project-files-notice.js-CcqcBgUP.js +19 -0
- package/build/server/chunks/chunks/project-files.js-DTC4jUxy.js +52 -0
- package/build/server/chunks/chunks/project-folder.js-CoKgPiM0.js +22 -0
- package/build/server/chunks/chunks/projects.js-bw2V11od.js +989 -0
- package/build/server/chunks/chunks/prs.js-CLfImauu.js +118 -0
- package/build/server/chunks/chunks/publish.js-D2vWpIJU.js +195 -0
- package/build/server/chunks/chunks/pull-list.js-BCIBJdyz.js +691 -0
- package/build/server/chunks/chunks/qa-ask.svelte.js-8Hf1JWW2.js +47 -0
- package/build/server/chunks/chunks/qa-setup.js-DFOEcNxH.js +1241 -0
- package/build/server/chunks/chunks/quiet.js-1GKY40Ay.js +104 -0
- package/build/server/chunks/chunks/rail.js-BePBwOqZ.js +135 -0
- package/build/server/chunks/chunks/review.js-MPqnq9Gy.js +98 -0
- package/build/server/chunks/chunks/routing.js-B8s1QwSP.js +265 -0
- package/build/server/chunks/chunks/run-log.js-CnN2jOcg.js +94 -0
- package/build/server/chunks/chunks/run.js-COSejjLl.js +34 -0
- package/build/server/chunks/chunks/scout-findings.js-CqJti10a.js +940 -0
- package/build/server/chunks/chunks/scout.js-Bm7wQLX2.js +62 -0
- package/build/server/chunks/chunks/sentinels.js-BXvpnzr3.js +13 -0
- package/build/server/chunks/chunks/server.js-BR0D07DR.js +3803 -0
- package/build/server/chunks/chunks/settings-sections.js-V70W7BkZ.js +103 -0
- package/build/server/chunks/chunks/shared.js-BgfCUZUJ.js +776 -0
- package/build/server/chunks/chunks/sign-in.js-O-pBhi19.js +14 -0
- package/build/server/chunks/chunks/snapshot.js-BekzL_He.js +38 -0
- package/build/server/chunks/chunks/spend.js-BabnR69T.js +63 -0
- package/build/server/chunks/chunks/src.js-Cm8RAH_q.js +609 -0
- package/build/server/chunks/chunks/src2.js-CV8tsClO.js +1186 -0
- package/build/server/chunks/chunks/src3.js-h9tTEbVb.js +11222 -0
- package/build/server/chunks/chunks/stack.js-CMWXhMZS.js +13 -0
- package/build/server/chunks/chunks/standup.js-D-qBnMx4.js +103 -0
- package/build/server/chunks/chunks/state.js-BTDrgu7s.js +71 -0
- package/build/server/chunks/chunks/stream.js-D6r6iqjD.js +66 -0
- package/build/server/chunks/chunks/terms.js-DPZztSEn.js +88 -0
- package/build/server/chunks/chunks/ticket-system.js-Dj9R3XJw.js +147 -0
- package/build/server/chunks/chunks/ticket.js-6sj-2ZEM.js +110 -0
- package/build/server/chunks/chunks/timesheet.js-DfhIokoE.js +212 -0
- package/build/server/chunks/chunks/timesheet2.js-Cu95ddl3.js +84 -0
- package/build/server/chunks/chunks/to-workspace.js-DiOJP59J.js +308 -0
- package/build/server/chunks/chunks/toast-stack.svelte.js-CXIg3_KT.js +10 -0
- package/build/server/chunks/chunks/uneval.js-VnZcgzZr.js +488 -0
- package/build/server/chunks/chunks/utils.js-DQTBh7_6.js +1006 -0
- package/build/server/chunks/chunks/when-said.js-0F9asAma.js +35 -0
- package/build/server/chunks/chunks/workspace.js-BBdJRon9.js +212 -0
- package/build/server/chunks/entries/endpoints/api/board/_server.ts.js-BlYC_lpV.js +69 -0
- package/build/server/chunks/entries/endpoints/api/board/minimize/_server.ts.js-Wddt9YPR.js +68 -0
- package/build/server/chunks/entries/endpoints/api/board/move/_server.ts.js-BwZpCKx0.js +68 -0
- package/build/server/chunks/entries/endpoints/api/board/promote/_server.ts.js-Cw6kvkMq.js +68 -0
- package/build/server/chunks/entries/endpoints/api/board/pulls/_server.ts.js-DFhpbiMo.js +71 -0
- package/build/server/chunks/entries/endpoints/api/board/stop/_server.ts.js-D5eylDMw.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/answer/_server.ts.js-CG8xh52y.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/branch/_server.ts.js-a5_P9voA.js +40 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/chain/_server.ts.js-tJvQy6RK.js +70 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/checkouts/_server.ts.js-B2_gx6vF.js +41 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/choice/_server.ts.js-pmAdIQkK.js +34 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/comments/_id_/_server.ts.js-C5NxGWw3.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/comments/_server.ts.js-0rw7UNv8.js +64 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/commit/_server.ts.js-_yXWCOlQ.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/commit-diff/_server.ts.js-CRPV3z-g.js +61 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/commit-message/_server.ts.js-CO9mD3u6.js +82 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/context/_server.ts.js-7kzrigFz.js +42 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/delete/_server.ts.js-DH0nO9wG.js +516 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/file/_server.ts.js-D80SvJDi.js +35 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/files/_...path_/_server.ts.js-GxFjb2H0.js +34 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/fix/_server.ts.js-B-HAB050.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/knowledge/_server.ts.js-D4fN-j7X.js +81 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/link/_other_/_server.ts.js-C00pQDCu.js +42 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/log/_server.ts.js-BXW_tG-I.js +32 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/log/raw/_server.ts.js-pT8StZGR.js +32 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/message/_server.ts.js-ZMno2Hu6.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/models/_server.ts.js-DEZVpqO3.js +73 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/patch/_server.ts.js-BxfLi-Zs.js +61 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/peek/_server.ts.js-CsTKWIP_.js +169 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/_server.ts.js-CsOeAXkf.js +53 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/comments/_server.ts.js-DZ2XHOhF.js +71 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/discuss/_server.ts.js-CO8eM0e8.js +72 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/discussions/_server.ts.js-Lp7l0Yqv.js +71 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/fix/_server.ts.js-CeIhjpQ4.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/fix-all/_server.ts.js-D-DKoCpQ.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/links/_server.ts.js-B_q3jUP3.js +72 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/qa/_server.ts.js-BulVcJY9.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/seen/_server.ts.js-Z06A6MS1.js +71 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pr/triage/_server.ts.js-qADU4URF.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/pull/_server.ts.js-CHnTH9WK.js +58 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/push/_server.ts.js-BPdPwPo2.js +83 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/repos/_server.ts.js-Bjqa3Uoo.js +73 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/research/_server.ts.js-DzQjoHOZ.js +138 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/retry/_server.ts.js-CAodrXqd.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/send-back/_server.ts.js-CmJSnvTx.js +68 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/stack/_server.ts.js-DjI8S94J.js +82 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/tasks/_server.ts.js-BzX_nNJk.js +71 -0
- package/build/server/chunks/entries/endpoints/api/card/_key_/thread/_server.ts.js-Dn36Guxk.js +33 -0
- package/build/server/chunks/entries/endpoints/api/cards/_server.ts.js-DPMOBsvp.js +77 -0
- package/build/server/chunks/entries/endpoints/api/cards/context/_server.ts.js-D6y-g2O-.js +52 -0
- package/build/server/chunks/entries/endpoints/api/cards/next/_server.ts.js-C2se67rf.js +55 -0
- package/build/server/chunks/entries/endpoints/api/chain/_server.ts.js-DKO5Q8GV.js +70 -0
- package/build/server/chunks/entries/endpoints/api/clones/_server.ts.js-Bgcc_Beg.js +56 -0
- package/build/server/chunks/entries/endpoints/api/current-project/_server.ts.js-DZCtSlXs.js +81 -0
- package/build/server/chunks/entries/endpoints/api/evidence/timesheet/_server.ts.js-xJwzSrcl.js +32 -0
- package/build/server/chunks/entries/endpoints/api/folders/_server.ts.js-BdcE7k8S.js +83 -0
- package/build/server/chunks/entries/endpoints/api/gh/_server.ts.js-CGvM8fn7.js +66 -0
- package/build/server/chunks/entries/endpoints/api/gh/name/_server.ts.js-CHh3tAu7.js +36 -0
- package/build/server/chunks/entries/endpoints/api/health/_server.ts.js-DLUfrHo6.js +22 -0
- package/build/server/chunks/entries/endpoints/api/login-item/_server.ts.js-Cya7S7W6.js +77 -0
- package/build/server/chunks/entries/endpoints/api/notes/_server.ts.js-DaUFVqSM.js +26 -0
- package/build/server/chunks/entries/endpoints/api/notifications/_server.ts.js-DK6NFnII.js +76 -0
- package/build/server/chunks/entries/endpoints/api/now/_server.ts.js-xW0jeJdy.js +83 -0
- package/build/server/chunks/entries/endpoints/api/package/entry/_server.ts.js-DQyZanpo.js +35 -0
- package/build/server/chunks/entries/endpoints/api/projects/_server.ts.js-CzXJTj_l.js +58 -0
- package/build/server/chunks/entries/endpoints/api/qa-setup/_server.ts.js-DujrYbEP.js +76 -0
- package/build/server/chunks/entries/endpoints/api/remove-check/_server.ts.js-1KAi9LDi.js +58 -0
- package/build/server/chunks/entries/endpoints/api/setup/_server.ts.js-D0MKtjR7.js +69 -0
- package/build/server/chunks/entries/endpoints/api/tickets/jira/_server.ts.js-Z2LdOr5l.js +39 -0
- package/build/server/chunks/entries/endpoints/api/tickets/read/_server.ts.js-BziHtc8Y.js +68 -0
- package/build/server/chunks/entries/endpoints/api/tools/_server.ts.js-oyvq8i1y.js +30 -0
- package/build/server/chunks/entries/endpoints/api/workspace/_server.ts.js-CMGBL5cX.js +58 -0
- package/build/server/chunks/entries/endpoints/api/workspace/commit/_server.ts.js-BZQQJ1YG.js +66 -0
- package/build/server/chunks/entries/endpoints/api/workspace/patch/_server.ts.js-xrjgHECx.js +64 -0
- package/build/server/chunks/entries/endpoints/api/workspace/push/_server.ts.js-CTdia7Uz.js +66 -0
- package/build/server/chunks/entries/hooks.server.js-B0jE-ELC.js +211 -0
- package/build/server/chunks/entries/pages/_error.svelte.js-DPcKI5sX.js +25 -0
- package/build/server/chunks/entries/pages/_layout.server.ts.js-Jj3i2Th9.js +134 -0
- package/build/server/chunks/entries/pages/_layout.svelte.js-Cu3ghN80.js +1251 -0
- package/build/server/chunks/entries/pages/_page.svelte.js-DEYydBCm.js +662 -0
- package/build/server/chunks/entries/pages/accept/_page.server.ts.js-BF7MrA5s.js +29 -0
- package/build/server/chunks/entries/pages/accept/_page.svelte.js-8yPsedd-.js +54 -0
- package/build/server/chunks/entries/pages/b/_board_/_page.svelte.js-S9acLF3f.js +68 -0
- package/build/server/chunks/entries/pages/b/_board_/_page.ts.js-BcKdG_Tp.js +21 -0
- package/build/server/chunks/entries/pages/b/research/_page.svelte.js-FW6Hw9g5.js +68 -0
- package/build/server/chunks/entries/pages/b/research/_page.ts.js-Ds2AjFFK.js +13 -0
- package/build/server/chunks/entries/pages/evidence/_page.server.ts.js-uwu2X7bA.js +1382 -0
- package/build/server/chunks/entries/pages/evidence/_page.svelte.js-DBCjiT59.js +594 -0
- package/build/server/chunks/entries/pages/f/_...path_/_page.svelte.js-DxwJaJzh.js +58 -0
- package/build/server/chunks/entries/pages/knowledge/_page.server.ts.js-BAUvFEcM.js +80 -0
- package/build/server/chunks/entries/pages/knowledge/_page.svelte.js-D9117gHM.js +732 -0
- package/build/server/chunks/entries/pages/new/_page.server.ts.js-BNCQQpyw.js +110 -0
- package/build/server/chunks/entries/pages/new/_page.svelte.js-Ben8-N_h.js +503 -0
- package/build/server/chunks/entries/pages/new/idea/_page.server.ts.js-jssA29y3.js +46 -0
- package/build/server/chunks/entries/pages/new/idea/_page.svelte.js-XoKspqAc.js +210 -0
- package/build/server/chunks/entries/pages/new/task/_page.server.ts.js-CmZgfvyt.js +66 -0
- package/build/server/chunks/entries/pages/new/task/_page.svelte.js-BKpERKvm.js +169 -0
- package/build/server/chunks/entries/pages/onboard/_page.server.ts.js-pmc_pXvs.js +12 -0
- package/build/server/chunks/entries/pages/onboard/_page.svelte.js-C7LNK-ba.js +5 -0
- package/build/server/chunks/entries/pages/projects/_page.server.ts.js-BEhLRfJ_.js +12 -0
- package/build/server/chunks/entries/pages/projects/_page.svelte.js-OraOjsyb.js +5 -0
- package/build/server/chunks/entries/pages/scout/_page.server.ts.js-hQYnMHwY.js +10 -0
- package/build/server/chunks/entries/pages/scout/_page.svelte.js-7q4d044Z.js +40 -0
- package/build/server/chunks/entries/pages/scout/f/_id_/_page.server.ts.js-BN4TnSpB.js +22 -0
- package/build/server/chunks/entries/pages/scout/f/_id_/_page.svelte.js-GzpLhARi.js +40 -0
- package/build/server/chunks/entries/pages/settings/_layout.server.ts.js-B5LgqMMT.js +12 -0
- package/build/server/chunks/entries/pages/settings/_layout.svelte.js-CSCpV6qA.js +81 -0
- package/build/server/chunks/entries/pages/settings/_page.svelte.js-DNpsNFo0.js +25 -0
- package/build/server/chunks/entries/pages/settings/_section_/_page.server.ts.js-nRDEV3i_.js +348 -0
- package/build/server/chunks/entries/pages/settings/_section_/_page.svelte.js-BihUf-nY.js +1052 -0
- package/build/server/chunks/entries/pages/settings/integrations/_page.server.ts.js-BTuRpg8m.js +58 -0
- package/build/server/chunks/entries/pages/settings/integrations/_page.svelte.js-C8i8ZmZR.js +161 -0
- package/build/server/chunks/entries/pages/settings/mcp/_page.server.ts.js-TFISfO1a.js +925 -0
- package/build/server/chunks/entries/pages/settings/mcp/_page.svelte.js-D1X0TNOm.js +433 -0
- package/build/server/chunks/entries/pages/settings/phases/_page.server.ts.js-CgK7MTZf.js +48 -0
- package/build/server/chunks/entries/pages/settings/phases/_page.svelte.js-u-sTQ-ue.js +80 -0
- package/build/server/chunks/entries/pages/settings/project/_page.server.ts.js-CCnk9WbO.js +363 -0
- package/build/server/chunks/entries/pages/settings/project/_page.svelte.js-MxvNqYlQ.js +1269 -0
- package/build/server/chunks/entries/pages/settings/wall/_page.server.ts.js-Bt5siY_N.js +12 -0
- package/build/server/chunks/entries/pages/settings/wall/_page.svelte.js-CMR4zSAt.js +43 -0
- package/build/server/chunks/entries/pages/t/_key_/_layout.server.ts.js-W6YPvOCA.js +124 -0
- package/build/server/chunks/entries/pages/t/_key_/_layout.svelte.js-CK0PiWsz.js +543 -0
- package/build/server/chunks/entries/pages/t/_key_/_page.server.ts.js-CdB7v0WX.js +15 -0
- package/build/server/chunks/entries/pages/t/_key_/_tab_/_page.server.ts.js-Bksaje8R.js +75 -0
- package/build/server/chunks/entries/pages/t/_key_/_tab_/_page.svelte.js-9OQ2eQxu.js +4607 -0
- package/build/server/chunks/entries/pages/team/_page.svelte.js-BdUSXC04.js +18 -0
- package/build/server/chunks/entries/pages/team/_page.ts.js-DfhJmoZI.js +20 -0
- package/build/server/chunks/entries/pages/workspace/_page.svelte.js-DLaWe23r.js +579 -0
- package/build/server/chunks/handler-Dlwmumt5.js +1735 -0
- package/build/server/chunks/index.js-BX0fZD5G.js +3701 -0
- package/build/server/chunks/manifest.js-B2Of6Dj7.js +761 -0
- package/build/server/chunks/nodes/0.js-DSzhdY0D.js +87 -0
- package/build/server/chunks/nodes/1.js-j4osL1br.js +9 -0
- package/build/server/chunks/nodes/10.js-jkvevEFY.js +75 -0
- package/build/server/chunks/nodes/11.js-plyiDP2n.js +72 -0
- package/build/server/chunks/nodes/12.js-DwtvDAyM.js +78 -0
- package/build/server/chunks/nodes/13.js-BpxwqFh4.js +72 -0
- package/build/server/chunks/nodes/14.js-B5iNIKGy.js +15 -0
- package/build/server/chunks/nodes/15.js-CXCAqUsG.js +15 -0
- package/build/server/chunks/nodes/16.js-oxkLEH0n.js +76 -0
- package/build/server/chunks/nodes/17.js-B-ZJEo9K.js +76 -0
- package/build/server/chunks/nodes/18.js-C0OUCEux.js +9 -0
- package/build/server/chunks/nodes/19.js-M8EAQJdW.js +76 -0
- package/build/server/chunks/nodes/2.js-ZedduK-3.js +33 -0
- package/build/server/chunks/nodes/20.js-BHvsLNjD.js +72 -0
- package/build/server/chunks/nodes/21.js-eOaW4si1.js +76 -0
- package/build/server/chunks/nodes/22.js-CbJ6tQSs.js +38 -0
- package/build/server/chunks/nodes/23.js-DXk8ejlx.js +81 -0
- package/build/server/chunks/nodes/24.js-C4qGJc4X.js +33 -0
- package/build/server/chunks/nodes/25.js-Cal8uT5V.js +21 -0
- package/build/server/chunks/nodes/26.js-Cp5jBcrN.js +80 -0
- package/build/server/chunks/nodes/27.js-Do55o_cb.js +17 -0
- package/build/server/chunks/nodes/28.js-SNz3QVix.js +9 -0
- package/build/server/chunks/nodes/3.js-DyivQ5dN.js +75 -0
- package/build/server/chunks/nodes/4.js-BGgTTQFR.js +9 -0
- package/build/server/chunks/nodes/5.js-DQYA2BBI.js +31 -0
- package/build/server/chunks/nodes/6.js-BVTi2KFL.js +24 -0
- package/build/server/chunks/nodes/7.js-CnprIn3p.js +12 -0
- package/build/server/chunks/nodes/8.js-Bdicn369.js +50 -0
- package/build/server/chunks/nodes/9.js-DVclPGXf.js +9 -0
- package/build/shims.js +33 -0
- package/dist/THIRD-PARTY-NOTICES.md +659 -0
- package/dist/detect-BmI_gskA.js +585 -0
- package/dist/fonts/OFL.txt +92 -0
- package/dist/nolzu.js +48 -0
- package/dist/package-vezZOzhD.js +181 -0
- package/dist/shared/finish.md +110 -0
- package/dist/shared/knowledge.md +72 -0
- package/dist/shared/verdict.md +42 -0
- package/dist/skills/.gitkeep +0 -0
- package/dist/skills/nolzu-architecture/SKILL.md +140 -0
- package/dist/skills/nolzu-architecture/finish.md +110 -0
- package/dist/skills/nolzu-assess/SKILL.md +99 -0
- package/dist/skills/nolzu-assess/finish.md +110 -0
- package/dist/skills/nolzu-design/SKILL.md +115 -0
- package/dist/skills/nolzu-design/finish.md +110 -0
- package/dist/skills/nolzu-feedback/SKILL.md +107 -0
- package/dist/skills/nolzu-feedback/finish.md +110 -0
- package/dist/skills/nolzu-implement/SKILL.md +138 -0
- package/dist/skills/nolzu-implement/finish.md +110 -0
- package/dist/skills/nolzu-investigate/SKILL.md +139 -0
- package/dist/skills/nolzu-investigate/finish.md +110 -0
- package/dist/skills/nolzu-learn-repo/SKILL.md +115 -0
- package/dist/skills/nolzu-learn-repo/finish.md +110 -0
- package/dist/skills/nolzu-learn-repo/knowledge.md +72 -0
- package/dist/skills/nolzu-optimize/SKILL.md +82 -0
- package/dist/skills/nolzu-optimize/finish.md +110 -0
- package/dist/skills/nolzu-optimize/knowledge.md +72 -0
- package/dist/skills/nolzu-orient/SKILL.md +115 -0
- package/dist/skills/nolzu-orient/finish.md +110 -0
- package/dist/skills/nolzu-orient/knowledge.md +72 -0
- package/dist/skills/nolzu-plan/SKILL.md +165 -0
- package/dist/skills/nolzu-plan/finish.md +110 -0
- package/dist/skills/nolzu-pr-review/SKILL.md +150 -0
- package/dist/skills/nolzu-pr-review/finish.md +110 -0
- package/dist/skills/nolzu-qa/SKILL.md +177 -0
- package/dist/skills/nolzu-qa/finish.md +110 -0
- package/dist/skills/nolzu-qa/verdict.md +42 -0
- package/dist/skills/nolzu-refine/SKILL.md +145 -0
- package/dist/skills/nolzu-refine/finish.md +110 -0
- package/dist/skills/nolzu-research/SKILL.md +140 -0
- package/dist/skills/nolzu-research/finish.md +110 -0
- package/dist/skills/nolzu-wrapup/SKILL.md +126 -0
- package/dist/skills/nolzu-wrapup/finish.md +110 -0
- package/dist/skills/nolzu-wrapup/knowledge.md +72 -0
- package/dist/src-BG8LaXLS.js +723 -0
- package/dist/src-DPfcvRqs.js +4 -0
- package/dist/start-ItZOcBtM.js +362 -0
- package/package.json +49 -9
- package/bin/nolzu.js +0 -8
|
@@ -0,0 +1,1532 @@
|
|
|
1
|
+
import { i as isBoardKind } from './board.js-BxL3CjB1.js';
|
|
2
|
+
import { s as shows } from './display.js-Bf-vGQ7Q.js';
|
|
3
|
+
import { g as phaseOnEnter, a1 as learnGates, a2 as setupSteps, e as projectRepos, a3 as SETUP_STEPS, a4 as SETUP_MARKS } from './estimate.js-BHTYVTaQ.js';
|
|
4
|
+
import { i as isFakeMode, g as getSetting, r as resolveDataDir, O as registeredProjects, L as allRuns, P as allScoutFindings, w as writeSetting, Q as scoutSources, M as allCardMoves, R as moveCard, N as NOT_A_PASS, C as storedQuestionOptions, S as addNotification, T as setMinimized, p as pendingKnowledgeChanges, e as projectProfiles, U as bumpVersion, V as knowledgeChangesOfRun, W as returnKnowledgeChanges, X as readRun, Y as applyKnowledgeChanges, Z as ENDED, _ as scoutSource, $ as scoutFindingOf, a0 as saveScoutFindings } from './node.js-Bz2jT5wt.js';
|
|
5
|
+
import { k as hubEnvelope, S as SERVER_MESSAGES, v as capSummary, r as readProjectList } from './src.js-Cm8RAH_q.js';
|
|
6
|
+
import { s as shortReason } from './run.js-COSejjLl.js';
|
|
7
|
+
import { c as cardStarts } from './snapshot.js-BekzL_He.js';
|
|
8
|
+
import { K as KB_MAINTENANCE_KEY, b as repoOfLearnKey, k as resolveKnowledgeDir, r as repoKnowledgePath, A as isRepoStub, i as isMaintenanceKey, B as learnRepoKey, R as RUN_RECIPE_FILE, C as recipeSectionOf, e as withRecipeSection, n as isDeliveryPhase } from './src2.js-CV8tsClO.js';
|
|
9
|
+
import { Q as createKeychain, R as runKeychain, ab as hubUrl, ac as connectToHub, ad as teamHubUrl, ae as applyKnowledge, g as git, a as gitEnv } from './src3.js-h9tTEbVb.js';
|
|
10
|
+
import { s as stackAnswered, a as answerFirst, q as qaHasBrowser, b as answerAgain } from './qa-setup.js-DFOEcNxH.js';
|
|
11
|
+
import { w as waitsOn } from './gate.js-Cbqo8Yy0.js';
|
|
12
|
+
import { u as unsentWork } from './checkout.js-Ys5L_gA4.js';
|
|
13
|
+
import { p as personStarted } from './coach.js-BhNB14rV.js';
|
|
14
|
+
import { m as modelsFor, a as measured } from './overview.js-C32iHkXD.js';
|
|
15
|
+
import { p as projectName } from './app-header.js-CCflgeEQ.js';
|
|
16
|
+
import { a as knowledgeLane } from './knowledge-page.js-D2ALB3v9.js';
|
|
17
|
+
import { h as heldDisplay } from './evidence.js-CT3tWdbB.js';
|
|
18
|
+
import { mkdirSync, writeFileSync, existsSync, readFileSync, rmSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { randomUUID } from 'node:crypto';
|
|
21
|
+
|
|
22
|
+
//#region src/lib/knowledge-learn.ts
|
|
23
|
+
function learnAsking(db) {
|
|
24
|
+
const row = db.prepare(`SELECT id, phase, state, question, question_options, session_id, engine FROM runs WHERE card_key = ? AND ${NOT_A_PASS} ORDER BY id DESC LIMIT 1`).get(KB_MAINTENANCE_KEY);
|
|
25
|
+
if (row === void 0 || row.phase !== "orient" || row.state !== "complete" || row.question === null || row.question.trim() === "") return null;
|
|
26
|
+
return {
|
|
27
|
+
runId: row.id,
|
|
28
|
+
question: row.question,
|
|
29
|
+
options: storedQuestionOptions(row.question_options) ?? [],
|
|
30
|
+
sessionId: row.session_id,
|
|
31
|
+
engine: row.engine
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function startLearnPost(live, form) {
|
|
35
|
+
const repo = form.get("repo")?.toString().trim() ?? "";
|
|
36
|
+
try {
|
|
37
|
+
if (!live.learn(repo === "" ? void 0 : repo)) return {
|
|
38
|
+
ok: false,
|
|
39
|
+
message: "Learn this project did not start, so nothing was read. Try it again."
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
ok: true,
|
|
43
|
+
message: `${repo === "" ? "Learn this project is reading what people wrote." : `Learn this project is reading what people wrote, starting with ${repo}.`} Its questions and the files it writes wait on Knowledge, and nothing is applied before you approve it.`
|
|
44
|
+
};
|
|
45
|
+
} catch (error) {
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
message: error.message
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function answerLearnPost(live, form) {
|
|
53
|
+
const text = form.get("answer")?.toString() ?? "";
|
|
54
|
+
if (text.trim() === "") return {
|
|
55
|
+
ok: false,
|
|
56
|
+
message: "The answer is empty. Pick one of the answers or write your own, then send it."
|
|
57
|
+
};
|
|
58
|
+
try {
|
|
59
|
+
if (!live.answer("kb-maintenance", text)) return {
|
|
60
|
+
ok: false,
|
|
61
|
+
message: "The run did not go on, so your answer was not read. Try it again."
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
ok: true,
|
|
65
|
+
message: "Sent. Learn this project goes on with your answer. Open Knowledge again to see what it asks or writes next."
|
|
66
|
+
};
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
message: error.message
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function repoStubs(db) {
|
|
75
|
+
const folder = resolveKnowledgeDir({
|
|
76
|
+
knowledgeDir: getSetting(db, "knowledgeDir"),
|
|
77
|
+
projectPath: getSetting(db, "projectPath")
|
|
78
|
+
});
|
|
79
|
+
const stub = (path) => {
|
|
80
|
+
const file = folder === null ? null : join(folder, repoKnowledgePath(path));
|
|
81
|
+
return file === null || !existsSync(file) || isRepoStub(readFileSync(file, "utf8"));
|
|
82
|
+
};
|
|
83
|
+
return projectRepos({
|
|
84
|
+
repos: getSetting(db, "repos"),
|
|
85
|
+
baseBranch: getSetting(db, "baseBranch")
|
|
86
|
+
}).map((repo) => ({
|
|
87
|
+
path: repo.path,
|
|
88
|
+
stub: stub(repo.path)
|
|
89
|
+
}));
|
|
90
|
+
}
|
|
91
|
+
function learnReposOffer(db, models, wall, queue) {
|
|
92
|
+
const waiting = pendingKnowledgeChanges(db).map((change) => change.filePath);
|
|
93
|
+
const inQueue = (path) => queue?.running.some((job) => job.cardKey === learnRepoKey(path)) ? "running" : queue?.waiting.some((job) => job.cardKey === learnRepoKey(path)) ? "waiting" : void 0;
|
|
94
|
+
const repos = repoStubs(db).map((repo) => {
|
|
95
|
+
const file = repoKnowledgePath(repo.path);
|
|
96
|
+
const queued = inQueue(repo.path);
|
|
97
|
+
return {
|
|
98
|
+
...repo,
|
|
99
|
+
waiting: waiting.some((path) => path === file || path.endsWith(`/${file}`)),
|
|
100
|
+
...queued === void 0 ? {} : { queued }
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
const profiles = projectProfiles(db);
|
|
104
|
+
const row = modelsFor(db, models, wall).rows.find((one) => one.action === "learn-repo");
|
|
105
|
+
if (row === void 0) throw new Error("The model table has no Learn your repositories row.");
|
|
106
|
+
const { engine, model, effort } = row.resolved;
|
|
107
|
+
const estimate = measured(db, "learn-repo", row.resolved, profiles);
|
|
108
|
+
const like = estimate === void 0 ? measured(db, "refine", row.resolved, profiles) : void 0;
|
|
109
|
+
return {
|
|
110
|
+
repos,
|
|
111
|
+
starts: {
|
|
112
|
+
engine,
|
|
113
|
+
model,
|
|
114
|
+
effort,
|
|
115
|
+
severalProfiles: profiles.length > 1,
|
|
116
|
+
...estimate === void 0 ? {} : { estimate },
|
|
117
|
+
...like === void 0 ? {} : { like }
|
|
118
|
+
},
|
|
119
|
+
refusal: row.warning
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function startLearnReposPost(live, form) {
|
|
123
|
+
const repos = form.getAll("repo").map((value) => value.toString().trim()).filter((value) => value !== "");
|
|
124
|
+
try {
|
|
125
|
+
const started = live.learnRepos(repos);
|
|
126
|
+
if (started === 0) return {
|
|
127
|
+
ok: false,
|
|
128
|
+
message: "No run started, so nothing was read. Try it again."
|
|
129
|
+
};
|
|
130
|
+
return {
|
|
131
|
+
ok: true,
|
|
132
|
+
message: `Learning ${started === 1 ? "1 repository" : `${started} repositories, one after another`}. What each run writes waits here for your review, and nothing is applied before you approve it.`
|
|
133
|
+
};
|
|
134
|
+
} catch (error) {
|
|
135
|
+
return {
|
|
136
|
+
ok: false,
|
|
137
|
+
message: error.message
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/lib/setup.ts
|
|
143
|
+
/**
|
|
144
|
+
* Set up the project (T39), the server side: the steps read off the project, the marks a press
|
|
145
|
+
* stores, the Learn gate on the first run, and "Learn and then start".
|
|
146
|
+
*/
|
|
147
|
+
function setupFor(db) {
|
|
148
|
+
const marks = getSetting(db, "setupSteps") ?? {};
|
|
149
|
+
return setupSteps({
|
|
150
|
+
marks,
|
|
151
|
+
learned: marks.learn === void 0 && repoStubs(db).every((repo) => !repo.stub),
|
|
152
|
+
browser: qaHasBrowser(db),
|
|
153
|
+
tickets: getSetting(db, "ticketSystem") !== "local"
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function setupView(db) {
|
|
157
|
+
const steps = setupFor(db);
|
|
158
|
+
return {
|
|
159
|
+
steps,
|
|
160
|
+
gates: getSetting(db, "setupSteps") !== null && learnGates(steps, personStarted(db))
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function markSetup(db, step, mark) {
|
|
164
|
+
writeSetting(db, "setupSteps", {
|
|
165
|
+
...getSetting(db, "setupSteps") ?? {},
|
|
166
|
+
[step]: mark
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function learnFirst(db, key) {
|
|
170
|
+
return setupView(db).gates ? `Learn your repositories comes before the first run. Start ${key} again from its board to choose: learn them first, or write the knowledge yourself.` : null;
|
|
171
|
+
}
|
|
172
|
+
function startLearnRepos(live, form) {
|
|
173
|
+
const answer = startLearnReposPost(live, form);
|
|
174
|
+
if (answer.ok) {
|
|
175
|
+
markSetup(live.db, "learn", "done");
|
|
176
|
+
live.changed();
|
|
177
|
+
}
|
|
178
|
+
return answer;
|
|
179
|
+
}
|
|
180
|
+
var learning = (live) => {
|
|
181
|
+
const queue = live.scheduler.queue();
|
|
182
|
+
return [...queue.running, ...queue.waiting].find((job) => repoOfLearnKey(job.cardKey) !== null);
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Learn and then start: one Learn run per repository not learned yet, and the card's move once every
|
|
186
|
+
* one has left the queue, however it ended. The press is the consent for both. The move is stored, so
|
|
187
|
+
* `followLearn` makes it after a restart too.
|
|
188
|
+
*/
|
|
189
|
+
function learnThenStart(live, key, to) {
|
|
190
|
+
const repos = repoStubs(live.db).filter((repo) => repo.stub).map((repo) => repo.path);
|
|
191
|
+
live.learnRepos(repos);
|
|
192
|
+
markSetup(live.db, "learn", "done");
|
|
193
|
+
writeSetting(live.db, "afterLearn", [...getSetting(live.db, "afterLearn").filter((one) => one.key !== key), {
|
|
194
|
+
key,
|
|
195
|
+
to,
|
|
196
|
+
at: (/* @__PURE__ */ new Date()).toISOString()
|
|
197
|
+
}]);
|
|
198
|
+
bumpVersion(live.db);
|
|
199
|
+
live.changed();
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The check that makes the moves Learn and then start holds, once no Learn run is left in the queue.
|
|
203
|
+
* The loop calls it on every change it tells, and once when it starts, so a move held when Nolzu
|
|
204
|
+
* stopped is made when it starts again. It is no listener of the loop's, so a shut down loop holds
|
|
205
|
+
* none. Each move goes once, whatever it answers, as a drag does.
|
|
206
|
+
*/
|
|
207
|
+
function followLearn(live, move) {
|
|
208
|
+
return () => {
|
|
209
|
+
const held = getSetting(live.db, "afterLearn");
|
|
210
|
+
if (held.length === 0 || learning(live) !== void 0) return;
|
|
211
|
+
writeSetting(live.db, "afterLearn", []);
|
|
212
|
+
for (const one of held) {
|
|
213
|
+
saySkippedLearn(live.db, one);
|
|
214
|
+
move(one.key, one.to);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function saySkippedLearn(db, one) {
|
|
219
|
+
const failed = db.prepare(`SELECT card_key AS key, error FROM runs AS one WHERE phase = 'learn-repo' AND ended_at >= ? AND state IN ('failed', 'interrupted')
|
|
220
|
+
AND id = (SELECT max(id) FROM runs WHERE phase = 'learn-repo' AND card_key = one.card_key) ORDER BY id`).all(one.at);
|
|
221
|
+
if (failed.length === 0) return;
|
|
222
|
+
const repos = failed.map((run) => repoOfLearnKey(run.key) ?? run.key).join(", ");
|
|
223
|
+
const reason = failed.map((run) => run.error).find((error) => error !== null);
|
|
224
|
+
const text = `${one.key} started without Learn, because learning ${repos} did not finish${reason === void 0 ? "." : `: ${shortReason(reason)}`}`;
|
|
225
|
+
addNotification(db, {
|
|
226
|
+
id: `after-learn:${one.key}:${one.at}`,
|
|
227
|
+
kind: "warning",
|
|
228
|
+
card: one.key,
|
|
229
|
+
text,
|
|
230
|
+
href: "/knowledge"
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The board as it draws a card Learn and then start holds: the column it starts after Learn, the
|
|
235
|
+
* repository a Learn run reads now, and when the person pressed.
|
|
236
|
+
*/
|
|
237
|
+
function withAfterLearn(snapshot, live) {
|
|
238
|
+
const held = getSetting(live.db, "afterLearn");
|
|
239
|
+
if (held.length === 0) return snapshot;
|
|
240
|
+
const job = learning(live);
|
|
241
|
+
const repo = job === void 0 ? null : repoOfLearnKey(job.cardKey);
|
|
242
|
+
const cards = snapshot.cards.map((card) => {
|
|
243
|
+
const one = held.find((wait) => wait.key === card.key);
|
|
244
|
+
if (one === void 0) return card;
|
|
245
|
+
const column = snapshot.stages.find((stage) => stage.id === one.to)?.label ?? one.to;
|
|
246
|
+
return {
|
|
247
|
+
...card,
|
|
248
|
+
afterLearn: {
|
|
249
|
+
column,
|
|
250
|
+
repo,
|
|
251
|
+
since: one.at
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
...snapshot,
|
|
257
|
+
cards
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
var answer$1 = (body, status = 200) => new Response(JSON.stringify(body), {
|
|
261
|
+
status,
|
|
262
|
+
headers: { "content-type": "application/json" }
|
|
263
|
+
});
|
|
264
|
+
var isStep = (value) => SETUP_STEPS.includes(value);
|
|
265
|
+
var isMark = (value) => SETUP_MARKS.includes(value);
|
|
266
|
+
/**
|
|
267
|
+
* The one write of the steps: `{ step, mark }` stores a mark, and `{ then: { key, to } }` is Learn and
|
|
268
|
+
* then start. Each tells the open streams, so the banner and the gate change on every page.
|
|
269
|
+
*/
|
|
270
|
+
async function postSetup(live, request) {
|
|
271
|
+
const body = await request.json().catch(() => null) ?? {};
|
|
272
|
+
if (body.then !== void 0) {
|
|
273
|
+
const { key, to } = body.then;
|
|
274
|
+
if (typeof key !== "string" || typeof to !== "string") return answer$1({ message: "Learn and then start needs a card key and the column it goes to." }, 400);
|
|
275
|
+
try {
|
|
276
|
+
learnThenStart(live, key, to);
|
|
277
|
+
} catch (error) {
|
|
278
|
+
return answer$1({ message: error.message }, 409);
|
|
279
|
+
}
|
|
280
|
+
return answer$1({ ok: true });
|
|
281
|
+
}
|
|
282
|
+
if (!isStep(body.step) || !isMark(body.mark)) return answer$1({ message: "A setup step needs its name, such as learn, and done, self or dismissed." }, 400);
|
|
283
|
+
if (body.mark === "dismissed" && body.step === "learn") return answer$1({ message: "Learn your repositories is required, so it cannot be put away. Choose \"I will write it myself\" instead." }, 400);
|
|
284
|
+
markSetup(live.db, body.step, body.mark);
|
|
285
|
+
live.changed();
|
|
286
|
+
return answer$1({ ok: true });
|
|
287
|
+
}
|
|
288
|
+
function learnGateOffer(live) {
|
|
289
|
+
const offer = learnReposOffer(live.db, live.models());
|
|
290
|
+
return {
|
|
291
|
+
...offer,
|
|
292
|
+
repos: offer.repos.filter((repo) => repo.stub)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/routes/api/board/writes.ts
|
|
297
|
+
var said = (message, status) => new Response(JSON.stringify({ message }), {
|
|
298
|
+
status,
|
|
299
|
+
headers: { "content-type": "application/json" }
|
|
300
|
+
});
|
|
301
|
+
var ok = () => new Response(JSON.stringify({ ok: true }), {
|
|
302
|
+
status: 200,
|
|
303
|
+
headers: { "content-type": "application/json" }
|
|
304
|
+
});
|
|
305
|
+
var body = async (request) => {
|
|
306
|
+
try {
|
|
307
|
+
const parsed = await request.json();
|
|
308
|
+
return typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
309
|
+
} catch {
|
|
310
|
+
return {};
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
async function move(live, request) {
|
|
314
|
+
const asked = await body(request);
|
|
315
|
+
const key = asked.key;
|
|
316
|
+
const to = asked.to;
|
|
317
|
+
if (typeof key !== "string" || typeof to !== "string") return said("A move needs a card key and a stage to move it to.", 400);
|
|
318
|
+
const reason = asked.reason === void 0 ? null : typeof asked.reason === "string" ? asked.reason.replace(/\s+/g, " ").trim() : "";
|
|
319
|
+
if (reason === "") return said(`Write one line on why ${key} goes on, for the trail. The reviewer reads it there.`, 400);
|
|
320
|
+
if (reason !== null && reason.length > REASON_LIMIT) return said(`The reason is over ${REASON_LIMIT} characters. One line is enough.`, 400);
|
|
321
|
+
const refused = asked.stop === true ? await stopThenMove(live, key, to) : await moveTo(live, key, to, "you", reason);
|
|
322
|
+
return refused === null ? ok() : said(refused.message, refused.status);
|
|
323
|
+
}
|
|
324
|
+
var REASON_LIMIT = 500;
|
|
325
|
+
var STOP_WAIT_MS = 3e4;
|
|
326
|
+
/**
|
|
327
|
+
* A move back of a card whose run is in the queue: stop the run, wait until it has left the queue and
|
|
328
|
+
* its row has ended, then move the card through `moveTo`, as a drop on that column does.
|
|
329
|
+
*
|
|
330
|
+
* The run leaves the queue only after its row is written and the card is let go, so a move sent then
|
|
331
|
+
* meets an idle card. Sent at once it would meet a card that still says running and be refused. A
|
|
332
|
+
* card that runs nothing moves at once. Null when the card moved, and the sentence when it did not.
|
|
333
|
+
*/
|
|
334
|
+
async function stopThenMove(live, key, to, waitMs = STOP_WAIT_MS) {
|
|
335
|
+
const queued = () => {
|
|
336
|
+
const queue = live.scheduler.queue();
|
|
337
|
+
return [...queue.running, ...queue.waiting].find((job) => job.cardKey === key);
|
|
338
|
+
};
|
|
339
|
+
const job = queued();
|
|
340
|
+
const board = live.boardOf(key);
|
|
341
|
+
const at = (id) => board.stages.findIndex((stage) => stage.id === id);
|
|
342
|
+
const from = live.db.prepare("SELECT stage FROM cards WHERE key = ?").get(key)?.stage ?? "";
|
|
343
|
+
const back = at(to) >= 0 && at(to) < at(from);
|
|
344
|
+
if (job === void 0) {
|
|
345
|
+
const waiting = live.db.prepare("SELECT id FROM runs WHERE card_key = ? AND state = 'waiting_review' ORDER BY id DESC LIMIT 1").get(key);
|
|
346
|
+
if (waiting !== void 0 && back) live.stop(waiting.id);
|
|
347
|
+
return moveTo(live, key, to);
|
|
348
|
+
}
|
|
349
|
+
if (!back) return {
|
|
350
|
+
status: 409,
|
|
351
|
+
message: `${key} is running, and only a move back stops its run first. Stop it, or wait for it to end.`
|
|
352
|
+
};
|
|
353
|
+
const over = () => queued()?.runId !== job.runId && ENDED.includes(readRun(live.db, job.runId)?.state ?? null);
|
|
354
|
+
if (!await new Promise((resolve) => {
|
|
355
|
+
const finish = (done) => {
|
|
356
|
+
leave();
|
|
357
|
+
clearTimeout(timer);
|
|
358
|
+
resolve(done);
|
|
359
|
+
};
|
|
360
|
+
const leave = live.onChange(() => {
|
|
361
|
+
if (over()) finish(true);
|
|
362
|
+
});
|
|
363
|
+
const timer = setTimeout(() => finish(false), waitMs);
|
|
364
|
+
live.stop(job.runId);
|
|
365
|
+
if (over()) finish(true);
|
|
366
|
+
})) return {
|
|
367
|
+
status: 409,
|
|
368
|
+
message: `${key} did not stop in time, so it stayed in ${board.stages.find((stage) => stage.id === from)?.label ?? from}. Stop it again, then move it back.`
|
|
369
|
+
};
|
|
370
|
+
return moveTo(live, key, to);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* The move itself, over parsed arguments, with the route above as its wrapper.
|
|
374
|
+
*
|
|
375
|
+
* Null when the move went through, and the sentence with its status when it did not. The hub adapter
|
|
376
|
+
* calls this, so a move asked for from a phone reaches the same writer as a drag and there is no
|
|
377
|
+
* second path to keep in step. The chain a person allowed in advance calls it too, as "auto".
|
|
378
|
+
*/
|
|
379
|
+
async function moveTo(live, key, to, who = "you", reason = null) {
|
|
380
|
+
const unsent = await unsentRefusal(live, key, to);
|
|
381
|
+
if (unsent !== null) return {
|
|
382
|
+
status: 409,
|
|
383
|
+
message: unsent
|
|
384
|
+
};
|
|
385
|
+
const board = live.boardOf(key);
|
|
386
|
+
const from = live.db.prepare("SELECT stage FROM cards WHERE key = ?").get(key)?.stage;
|
|
387
|
+
const starts = from === void 0 ? void 0 : phaseOnEnter(board, from, to);
|
|
388
|
+
if (starts === "qa" && !stackAnswered(live.db, key)) return {
|
|
389
|
+
status: 409,
|
|
390
|
+
message: answerFirst(key)
|
|
391
|
+
};
|
|
392
|
+
const waits = starts === void 0 ? null : waitsOn(live.db, key, starts);
|
|
393
|
+
if (waits !== null) return {
|
|
394
|
+
status: 409,
|
|
395
|
+
message: waits
|
|
396
|
+
};
|
|
397
|
+
const learn = starts === void 0 ? null : learnFirst(live.db, key);
|
|
398
|
+
if (learn !== null) return {
|
|
399
|
+
status: 409,
|
|
400
|
+
message: learn
|
|
401
|
+
};
|
|
402
|
+
let starting = false;
|
|
403
|
+
try {
|
|
404
|
+
await moveCard(live.db, board, key, to, (card, phase) => {
|
|
405
|
+
starting = true;
|
|
406
|
+
live.start(card, phase);
|
|
407
|
+
starting = false;
|
|
408
|
+
}, who, reason);
|
|
409
|
+
live.changed();
|
|
410
|
+
return null;
|
|
411
|
+
} catch (error) {
|
|
412
|
+
if (starting) {
|
|
413
|
+
live.changed();
|
|
414
|
+
return {
|
|
415
|
+
status: 500,
|
|
416
|
+
message: `${key} moved to ${to}, but its run did not start. The card is marked failed.`
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
status: 409,
|
|
421
|
+
message: error.message
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* A Delivery card goes on from Review to Pull request, and from there to Wrap-up, only once its work is
|
|
427
|
+
* on a remote or a pull request is linked. Opening the pull request is the person's step on the Changes
|
|
428
|
+
* tab, and without this a drag closed a card whose work was never committed. A move back passes.
|
|
429
|
+
*/
|
|
430
|
+
async function unsentRefusal(live, key, to) {
|
|
431
|
+
const board = live.boardOf(key);
|
|
432
|
+
const from = live.db.prepare("SELECT stage FROM cards WHERE key = ?").get(key)?.stage;
|
|
433
|
+
const guarded = from === "review" && to === "pr-watch" || from === "pr-watch" && to === "wrapup";
|
|
434
|
+
if (board.kind !== "delivery" || !guarded) return null;
|
|
435
|
+
if (live.db.prepare("SELECT 1 AS one FROM card_pulls WHERE card_key = ? LIMIT 1").get(key) !== void 0) return null;
|
|
436
|
+
const { files, commits } = await unsentWork(live.db, key, process.env);
|
|
437
|
+
if (files + commits === 0) return null;
|
|
438
|
+
const count = (n, one, many) => n === 0 ? "" : `${n} ${n === 1 ? one : many}`;
|
|
439
|
+
return `${key} has ${[count(files, "file not committed", "files not committed"), count(commits, "commit not pushed", "commits not pushed")].filter((part) => part !== "").join(" and ")} and no pull request, so it stays in ${board.stages.find((stage) => stage.id === from)?.label ?? from}. Commit them and push on its Changes tab first.`;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Send back from the web or the phone, as a `card.move` job with a note: a move to an earlier column, with
|
|
443
|
+
* the note kept to one line and stored as the move's reason, which the trail shows. A move back starts no
|
|
444
|
+
* run. An empty note is a plain move back, as a drag back is, and a note on a forward move is refused, so
|
|
445
|
+
* the note is never dropped without a word. Null when the card moved, and the sentence when it did not.
|
|
446
|
+
*/
|
|
447
|
+
async function moveBackWithNote(live, key, to, note) {
|
|
448
|
+
const line = note.replace(/\s+/g, " ").trim();
|
|
449
|
+
if (line === "") return moveTo(live, key, to);
|
|
450
|
+
if (line.length > REASON_LIMIT) return {
|
|
451
|
+
status: 400,
|
|
452
|
+
message: `The note is over ${REASON_LIMIT} characters, so ${key} stayed where it was.`
|
|
453
|
+
};
|
|
454
|
+
const stages = live.boardOf(key).stages;
|
|
455
|
+
const at = (id) => stages.findIndex((stage) => stage.id === id);
|
|
456
|
+
const from = live.db.prepare("SELECT stage FROM cards WHERE key = ?").get(key)?.stage;
|
|
457
|
+
if (from !== void 0 && at(to) >= 0 && at(to) >= at(from)) return {
|
|
458
|
+
status: 409,
|
|
459
|
+
message: `A note goes only with a move back, so ${key} stayed where it was.`
|
|
460
|
+
};
|
|
461
|
+
return moveTo(live, key, to, "you", line);
|
|
462
|
+
}
|
|
463
|
+
async function minimize(live, request) {
|
|
464
|
+
const asked = await body(request);
|
|
465
|
+
if (typeof asked.key !== "string" || typeof asked.minimized !== "boolean") return said("Minimizing needs a card key, and whether the card is to be minimized or restored.", 400);
|
|
466
|
+
if (!setMinimized(live.db, asked.key, asked.minimized)) return said(`The board has no card ${asked.key}, so there is nothing to minimize.`, 404);
|
|
467
|
+
live.changed();
|
|
468
|
+
return ok();
|
|
469
|
+
}
|
|
470
|
+
async function stop(live, request) {
|
|
471
|
+
const asked = await body(request);
|
|
472
|
+
if (typeof asked.runId !== "number") return said("Stopping a run needs its run id.", 400);
|
|
473
|
+
live.stop(asked.runId);
|
|
474
|
+
return ok();
|
|
475
|
+
}
|
|
476
|
+
async function promote(live, request) {
|
|
477
|
+
const asked = await body(request);
|
|
478
|
+
if (typeof asked.runId !== "number") return said("Promoting a run needs its run id.", 400);
|
|
479
|
+
live.scheduler.promote(asked.runId);
|
|
480
|
+
return ok();
|
|
481
|
+
}
|
|
482
|
+
async function answer(live, key, request) {
|
|
483
|
+
const asked = await body(request);
|
|
484
|
+
if (typeof asked.answer !== "string") return said("An answer needs its text.", 400);
|
|
485
|
+
return restarted(key, () => live.answer(key, asked.answer), "go on with the answer");
|
|
486
|
+
}
|
|
487
|
+
async function retry(live, key, request) {
|
|
488
|
+
const asked = request === void 0 ? {} : await body(request);
|
|
489
|
+
if (asked.engine !== void 0 && typeof asked.engine !== "string") return said("Running this card on another engine profile needs the id of that profile.", 400);
|
|
490
|
+
const on = asked.engine ?? null;
|
|
491
|
+
const stage = live.db.prepare("SELECT stage FROM cards WHERE key = ?").get(key)?.stage;
|
|
492
|
+
if (live.boardOf(key).stages.find((one) => one.id === stage)?.phase === "qa" && !stackAnswered(live.db, key)) return said(answerAgain(key), 409);
|
|
493
|
+
return restarted(key, () => live.retry(key, on), on === null ? "start again" : `start on ${on}`);
|
|
494
|
+
}
|
|
495
|
+
async function fix(live, key) {
|
|
496
|
+
return restarted(key, () => live.fix(key), "start Implement again");
|
|
497
|
+
}
|
|
498
|
+
async function sendBack(live, key) {
|
|
499
|
+
return restarted(key, () => live.sendBack(key), "start Implement again");
|
|
500
|
+
}
|
|
501
|
+
async function triage(live, key) {
|
|
502
|
+
return restarted(key, () => live.triage(key), "start triage");
|
|
503
|
+
}
|
|
504
|
+
function fixFeedback(live, key, body) {
|
|
505
|
+
const ref = body?.ref;
|
|
506
|
+
if (typeof ref !== "string" || ref === "") return said("Send the ref of the comment to fix, as in T1.", 400);
|
|
507
|
+
let started;
|
|
508
|
+
try {
|
|
509
|
+
started = live.fixFeedback(key, ref);
|
|
510
|
+
} catch (error) {
|
|
511
|
+
return said(error.message, 409);
|
|
512
|
+
}
|
|
513
|
+
if (!started) return said(`The fix of ${ref} could not start. Its row on the PRs tab says why.`, 500);
|
|
514
|
+
return ok();
|
|
515
|
+
}
|
|
516
|
+
function fixAll(live, key) {
|
|
517
|
+
let started;
|
|
518
|
+
try {
|
|
519
|
+
started = live.fixAll(key);
|
|
520
|
+
} catch (error) {
|
|
521
|
+
return said(error.message, 409);
|
|
522
|
+
}
|
|
523
|
+
if (!started) return said("Fix all could not start. The rows on the PRs tab say why.", 500);
|
|
524
|
+
return ok();
|
|
525
|
+
}
|
|
526
|
+
function qaFixes(live, key) {
|
|
527
|
+
let started;
|
|
528
|
+
try {
|
|
529
|
+
started = live.qaFixes(key);
|
|
530
|
+
} catch (error) {
|
|
531
|
+
return said(error.message, 409);
|
|
532
|
+
}
|
|
533
|
+
if (!started) return said("QA of the fixes could not start. Its run on the Log tab says why.", 500);
|
|
534
|
+
return ok();
|
|
535
|
+
}
|
|
536
|
+
async function restarted(key, restart, what) {
|
|
537
|
+
let started;
|
|
538
|
+
try {
|
|
539
|
+
started = await restart();
|
|
540
|
+
} catch (error) {
|
|
541
|
+
return said(error.message, 409);
|
|
542
|
+
}
|
|
543
|
+
if (!started) return said(`${key} could not ${what}. The card is marked failed with the reason.`, 500);
|
|
544
|
+
return ok();
|
|
545
|
+
}
|
|
546
|
+
//#endregion
|
|
547
|
+
//#region src/lib/knowledge-review.ts
|
|
548
|
+
/**
|
|
549
|
+
* Approve and Return, the two answers a person gives a knowledge change that waits for review.
|
|
550
|
+
*
|
|
551
|
+
* With the review setting on, a run's own writing is kept aside and the folder is put back, so
|
|
552
|
+
* nothing the person did not approve sits in their knowledge files. Approve writes the kept copy
|
|
553
|
+
* back and commits it under the same card and run as an applied run's commit. Return drops the
|
|
554
|
+
* kept copy and stores the note, which the next wrap-up of that card reads in its prompt.
|
|
555
|
+
*
|
|
556
|
+
* Both act on a whole run, because one run is one commit.
|
|
557
|
+
*/
|
|
558
|
+
var heldPath = (dataDir, runId) => join(dataDir, "knowledge-held", `${runId}.json`);
|
|
559
|
+
function keepHeld(dataDir, held) {
|
|
560
|
+
mkdirSync(join(dataDir, "knowledge-held"), { recursive: true });
|
|
561
|
+
writeFileSync(heldPath(dataDir, held.runId), JSON.stringify(held));
|
|
562
|
+
}
|
|
563
|
+
function readHeld(dataDir, runId) {
|
|
564
|
+
try {
|
|
565
|
+
return JSON.parse(readFileSync(heldPath(dataDir, runId), "utf8"));
|
|
566
|
+
} catch {
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* A kept change as Apply would write it now.
|
|
572
|
+
*
|
|
573
|
+
* Learn your repositories writes one section of the run recipe per repository, and each run's change
|
|
574
|
+
* waits on its own. Its kept copy of the recipe was read before the other runs were applied, so it
|
|
575
|
+
* is taken as that one section put into the recipe as it is now. Applying one repository never drops
|
|
576
|
+
* the section another one's change applied, and the screen shows the section alone as the change.
|
|
577
|
+
* Every other change goes back as it was kept.
|
|
578
|
+
*/
|
|
579
|
+
function readHeldNow(db, dataDir, runId) {
|
|
580
|
+
const held = readHeld(dataDir, runId);
|
|
581
|
+
const repo = held === null ? null : repoOfLearnKey(held.cardKey);
|
|
582
|
+
if (held === null || repo === null) return held;
|
|
583
|
+
const folder = resolveKnowledgeDir({
|
|
584
|
+
knowledgeDir: getSetting(db, "knowledgeDir"),
|
|
585
|
+
projectPath: getSetting(db, "projectPath")
|
|
586
|
+
});
|
|
587
|
+
const recipe = folder === null ? null : join(folder, RUN_RECIPE_FILE);
|
|
588
|
+
if (recipe === null || !existsSync(recipe)) return held;
|
|
589
|
+
const now = readFileSync(recipe, "utf8");
|
|
590
|
+
return {
|
|
591
|
+
...held,
|
|
592
|
+
files: held.files.map((file) => {
|
|
593
|
+
const section = file.content === null || !(file.path === "run-recipe.md" || file.path.endsWith(`/run-recipe.md`)) ? null : recipeSectionOf(file.content, repo);
|
|
594
|
+
return section === null ? file : {
|
|
595
|
+
...file,
|
|
596
|
+
content: withRecipeSection(now, repo, section)
|
|
597
|
+
};
|
|
598
|
+
})
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
var dropHeld = (dataDir, runId) => rmSync(heldPath(dataDir, runId), { force: true });
|
|
602
|
+
var files = (count) => `${count} ${count === 1 ? "file" : "files"}`;
|
|
603
|
+
function refuse(rows, runId) {
|
|
604
|
+
if (!Number.isInteger(runId)) return "That form named no run, so there was nothing to answer.";
|
|
605
|
+
if (rows.length === 0) return `There is no knowledge change from run ${runId}.`;
|
|
606
|
+
if (rows.some((row) => row.status === "pending")) return null;
|
|
607
|
+
const applied = rows.find((row) => row.status === "applied");
|
|
608
|
+
if (applied !== void 0) return `The knowledge change of run ${runId} was applied already, as commit ${applied.commitSha?.slice(0, 7)}. Nothing was applied a second time.`;
|
|
609
|
+
if (rows[0]?.status === "returned") return `The knowledge change of run ${runId} was returned already. Run the wrap-up again to write it fresh.`;
|
|
610
|
+
return `The knowledge change of run ${runId} was applied and then reverted. There is nothing left to answer.`;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Writes an approved change back into the knowledge folder and commits it.
|
|
614
|
+
*
|
|
615
|
+
* The rows read applied with the sha when this answers ok. When git refuses the commit, or the
|
|
616
|
+
* rows cannot be written, the commit is taken back and the change stays pending, so the person can
|
|
617
|
+
* read what their repository said and try again.
|
|
618
|
+
*/
|
|
619
|
+
async function approveKnowledge(db, options) {
|
|
620
|
+
const refused = refuse(knowledgeChangesOfRun(db, options.runId), options.runId);
|
|
621
|
+
if (refused !== null) return {
|
|
622
|
+
ok: false,
|
|
623
|
+
message: refused
|
|
624
|
+
};
|
|
625
|
+
const busy = options.busy ?? null;
|
|
626
|
+
if (busy !== null) return {
|
|
627
|
+
ok: false,
|
|
628
|
+
message: `${isMaintenanceKey(busy) ? "A maintenance run" : busy} is writing the knowledge folder right now. Approve this change once that run has ended.`
|
|
629
|
+
};
|
|
630
|
+
const held = readHeldNow(db, options.dataDir, options.runId);
|
|
631
|
+
if (held === null) return {
|
|
632
|
+
ok: false,
|
|
633
|
+
message: `The kept copy of this change is gone from ${heldPath(options.dataDir, options.runId)}, so there is nothing to apply. Return the change and run the wrap-up again.`
|
|
634
|
+
};
|
|
635
|
+
const folder = resolveKnowledgeDir({
|
|
636
|
+
knowledgeDir: getSetting(db, "knowledgeDir"),
|
|
637
|
+
projectPath: getSetting(db, "projectPath")
|
|
638
|
+
});
|
|
639
|
+
if (folder === null || !existsSync(folder)) return {
|
|
640
|
+
ok: false,
|
|
641
|
+
message: `There is no knowledge folder${folder === null ? "" : ` ${folder}`} to commit in. Make a project on New project at /new.`
|
|
642
|
+
};
|
|
643
|
+
const env = options.env ?? process.env;
|
|
644
|
+
const run = (args) => git(args, {
|
|
645
|
+
cwd: folder,
|
|
646
|
+
env: gitEnv(env)
|
|
647
|
+
});
|
|
648
|
+
try {
|
|
649
|
+
const commit = await applyKnowledge({
|
|
650
|
+
run,
|
|
651
|
+
held,
|
|
652
|
+
record: (sha) => {
|
|
653
|
+
if (applyKnowledgeChanges(db, options.runId, sha) === 0) throw new Error(`The knowledge change of run ${options.runId} was answered while this one was being applied. Nothing was committed.`);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
dropHeld(options.dataDir, options.runId);
|
|
657
|
+
return {
|
|
658
|
+
ok: true,
|
|
659
|
+
message: `Applied ${files(held.files.length)} as commit ${commit.slice(0, 7)}.`
|
|
660
|
+
};
|
|
661
|
+
} catch (error) {
|
|
662
|
+
return {
|
|
663
|
+
ok: false,
|
|
664
|
+
message: error.message
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Drops a change the person sent back, and stores the note they wrote with it.
|
|
670
|
+
*
|
|
671
|
+
* The folder is already back to what it was: the run's own writing was kept aside when the run
|
|
672
|
+
* ended. So a return is a row update and a file the kept copy lived in, and no git work at all.
|
|
673
|
+
*/
|
|
674
|
+
function returnKnowledge(db, options) {
|
|
675
|
+
const rows = knowledgeChangesOfRun(db, options.runId);
|
|
676
|
+
const refused = refuse(rows, options.runId);
|
|
677
|
+
if (refused !== null) return {
|
|
678
|
+
ok: false,
|
|
679
|
+
message: refused
|
|
680
|
+
};
|
|
681
|
+
const note = options.note.trim();
|
|
682
|
+
if (note === "") return {
|
|
683
|
+
ok: false,
|
|
684
|
+
message: "Write what the next run should do differently. It reads the note in its prompt, and a return with no note is a delete."
|
|
685
|
+
};
|
|
686
|
+
returnKnowledgeChanges(db, options.runId, note);
|
|
687
|
+
dropHeld(options.dataDir, options.runId);
|
|
688
|
+
const cardKey = rows[0]?.cardKey;
|
|
689
|
+
const phase = readRun(db, options.runId)?.phase;
|
|
690
|
+
const maintenance = phase === "learn-repo" ? "The next Learn your repositories run of that repository" : phase === "orient" ? "The next Learn this project run" : "The next Optimize run";
|
|
691
|
+
return {
|
|
692
|
+
ok: true,
|
|
693
|
+
message: `Returned. ${cardKey === void 0 || isMaintenanceKey(cardKey) ? maintenance : `The next wrap-up of ${cardKey}`} reads the note.`
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
var asked = (form) => Number.parseInt(form.get("run")?.toString() ?? "", 10);
|
|
697
|
+
var answerApprove = (db, live, form) => approveKnowledge(db, {
|
|
698
|
+
dataDir: live.dataDir,
|
|
699
|
+
runId: asked(form),
|
|
700
|
+
busy: knowledgeLane(live.snapshot())
|
|
701
|
+
});
|
|
702
|
+
/**
|
|
703
|
+
* Apply all: the runs the screen showed, oldest first, each its own commit as Apply makes it. The first
|
|
704
|
+
* refusal stops it, so nothing is applied past a change the person would have to read about, and the
|
|
705
|
+
* answer says how many went in before it. Only the runs the post names, so a run that ended after the
|
|
706
|
+
* page drew still waits for a person.
|
|
707
|
+
*/
|
|
708
|
+
async function answerApproveAll(db, live, form, env) {
|
|
709
|
+
const runs = [...new Set(form.getAll("run").map((one) => Number.parseInt(one.toString(), 10)))].filter(Number.isInteger).sort((a, b) => a - b);
|
|
710
|
+
if (runs.length === 0) return {
|
|
711
|
+
ok: false,
|
|
712
|
+
message: "Nothing waits for a person, so there is nothing to apply."
|
|
713
|
+
};
|
|
714
|
+
const word = (count) => `${count} ${count === 1 ? "change" : "changes"}`;
|
|
715
|
+
for (const [done, runId] of runs.entries()) {
|
|
716
|
+
const answer = await approveKnowledge(db, {
|
|
717
|
+
dataDir: live.dataDir,
|
|
718
|
+
runId,
|
|
719
|
+
busy: knowledgeLane(live.snapshot()),
|
|
720
|
+
env
|
|
721
|
+
});
|
|
722
|
+
if (!answer.ok) return {
|
|
723
|
+
ok: false,
|
|
724
|
+
message: done === 0 ? answer.message : `Applied ${done} of ${word(runs.length)}, then stopped. ${answer.message}`
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
return {
|
|
728
|
+
ok: true,
|
|
729
|
+
message: runs.length === 1 ? "Applied 1 change." : `Applied ${word(runs.length)}, one commit each.`
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
var answerReturn = (db, live, form) => returnKnowledge(db, {
|
|
733
|
+
dataDir: live.dataDir,
|
|
734
|
+
runId: asked(form),
|
|
735
|
+
note: form.get("note")?.toString() ?? ""
|
|
736
|
+
});
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/lib/hub-jobs.ts
|
|
739
|
+
var projectKey = (mark) => mark === "teamHubJobDone" ? "teamProjectId" : "projectId";
|
|
740
|
+
var fields = (payload) => typeof payload === "object" && payload !== null && !Array.isArray(payload) ? payload : {};
|
|
741
|
+
var textOf = (payload, name, type) => {
|
|
742
|
+
const value = fields(payload)[name];
|
|
743
|
+
if (typeof value !== "string" || value.trim() === "") throw new Error(`A ${type} job from the hub carries no ${name}.`);
|
|
744
|
+
return value;
|
|
745
|
+
};
|
|
746
|
+
var findingOf = (payload, sourceKind, type) => {
|
|
747
|
+
const finding = fields(fields(payload).finding);
|
|
748
|
+
if (Object.keys(finding).length === 0) throw new Error(`A ${type} job from the hub carries no finding.`);
|
|
749
|
+
const occurrences = finding.occurrences;
|
|
750
|
+
if (typeof occurrences !== "number" || !Number.isInteger(occurrences) || occurrences < 1 || occurrences > 1e9) throw new Error(`A ${type} job from the hub names no occurrence count a finding can hold.`);
|
|
751
|
+
const location = typeof finding.location === "string" ? finding.location : "";
|
|
752
|
+
const occurrence = (message) => ({
|
|
753
|
+
sourceKind,
|
|
754
|
+
errorType: "",
|
|
755
|
+
message,
|
|
756
|
+
location
|
|
757
|
+
});
|
|
758
|
+
return {
|
|
759
|
+
fingerprint: textOf(finding, "fingerprint", type),
|
|
760
|
+
count: occurrences,
|
|
761
|
+
first: occurrence(textOf(finding, "firstMessage", type)),
|
|
762
|
+
last: occurrence(textOf(finding, "lastMessage", type))
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
async function run(live, message, send, mark) {
|
|
766
|
+
const payload = message.payload;
|
|
767
|
+
if (message.type === "run.start") {
|
|
768
|
+
const key = textOf(payload, "key", message.type);
|
|
769
|
+
const phase = fields(payload).phase;
|
|
770
|
+
if (typeof phase !== "string" || !isDeliveryPhase(phase)) throw new Error("A run.start job from the hub names no delivery phase.");
|
|
771
|
+
live.start(key, phase);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (message.type === "question.answer") {
|
|
775
|
+
live.answer(textOf(payload, "key", message.type), textOf(payload, "answer", message.type));
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
if (message.type === "card.move") {
|
|
779
|
+
const key = textOf(payload, "key", message.type);
|
|
780
|
+
const to = textOf(payload, "to", message.type);
|
|
781
|
+
const note = fields(payload).note;
|
|
782
|
+
if (note !== void 0 && note !== null && typeof note !== "string") throw new Error(`A ${message.type} job from the hub carries a note that is not text.`);
|
|
783
|
+
const refused = typeof note === "string" ? await moveBackWithNote(live, key, to, note) : await moveTo(live, key, to);
|
|
784
|
+
if (refused !== null) throw new Error(refused.message);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
if (message.type === "scout.assess") {
|
|
788
|
+
if (textOf(payload, "projectId", message.type) !== getSetting(live.db, projectKey(mark))) throw new Error(`A ${message.type} job from the hub names another project, so no finding was stored.`);
|
|
789
|
+
const sourceId = Number(textOf(payload, "sourceId", message.type));
|
|
790
|
+
if (!Number.isSafeInteger(sourceId) || sourceId < 1) throw new Error(`A ${message.type} job from the hub names no source.`);
|
|
791
|
+
const source = scoutSource(live.db, sourceId);
|
|
792
|
+
if (source === null) throw new Error(`A ${message.type} job from the hub names a source this machine does not have.`);
|
|
793
|
+
const group = findingOf(payload, source.kind, message.type);
|
|
794
|
+
const held = scoutFindingOf(live.db, sourceId, group.fingerprint);
|
|
795
|
+
saveScoutFindings(live.db, sourceId, [{
|
|
796
|
+
...group,
|
|
797
|
+
count: held === null ? group.count : 0,
|
|
798
|
+
last: {
|
|
799
|
+
...group.last,
|
|
800
|
+
location: group.last.location === "" && held !== null ? held.location : group.last.location
|
|
801
|
+
}
|
|
802
|
+
}]);
|
|
803
|
+
if (held !== null) return;
|
|
804
|
+
const found = scoutFindingOf(live.db, sourceId, group.fingerprint);
|
|
805
|
+
if (found === null) throw new Error(`A ${message.type} job stored its finding and could not read it back.`);
|
|
806
|
+
live.assess(found.id);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
if (message.type === "report.write") return;
|
|
810
|
+
if (message.type === "project.join") {
|
|
811
|
+
const teamProjectId = fields(payload).teamProjectId;
|
|
812
|
+
if (typeof teamProjectId !== "string" || teamProjectId.trim() === "") throw new Error("A project.join job from the hub names no team project.");
|
|
813
|
+
if (getSetting(live.db, "teamProjectId") !== teamProjectId) writeSetting(live.db, "teamHubJobDone", 0);
|
|
814
|
+
writeSetting(live.db, "teamProjectId", teamProjectId);
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
if (message.type === "knowledge.commit") {
|
|
818
|
+
if (mark !== "teamHubJobDone") throw new Error(`A ${message.type} job came from the personal hub, and only the team hub sends one. Nothing was committed.`);
|
|
819
|
+
if (textOf(payload, "teamProjectId", message.type) !== getSetting(live.db, "teamProjectId")) throw new Error(`A ${message.type} job from the hub names another team project, so nothing was committed.`);
|
|
820
|
+
const cardKey = textOf(payload, "cardKey", message.type);
|
|
821
|
+
const runId = fields(payload).runId;
|
|
822
|
+
if (typeof runId !== "number" || !Number.isSafeInteger(runId) || runId < 1) throw new Error(`A ${message.type} job from the hub names no run.`);
|
|
823
|
+
const rows = knowledgeChangesOfRun(live.db, runId);
|
|
824
|
+
if (rows.length > 0 && rows[0]?.cardKey !== cardKey) throw new Error(`A ${message.type} job names run ${runId}, and that run here belongs to another card. Nothing was committed.`);
|
|
825
|
+
if (rows.length > 0 && rows.every((row) => row.status === "applied")) return;
|
|
826
|
+
const answer = await approveKnowledge(live.db, {
|
|
827
|
+
dataDir: live.dataDir,
|
|
828
|
+
runId,
|
|
829
|
+
busy: knowledgeLane(live.snapshot())
|
|
830
|
+
});
|
|
831
|
+
if (!answer.ok) throw new Error(`The team approved the knowledge change of ${rows[0]?.cardKey ?? "a card"} run ${runId}, and it was not committed. ${answer.message}`);
|
|
832
|
+
live.reviewAnswered();
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
if (message.type === "project.list") {
|
|
836
|
+
if (mark !== "hubJobDone") throw new Error(`A ${message.type} job came from the team hub, and only your own hub sends one. Nothing was stored.`);
|
|
837
|
+
writeSetting(live.db, "accountProjects", readProjectList(payload).projects);
|
|
838
|
+
return;
|
|
839
|
+
}
|
|
840
|
+
if (message.type === "claim.answer") {
|
|
841
|
+
console.error(`A ${message.type} job arrived from the hub. This build takes it and does not run it yet.`);
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
const unknown = message.type;
|
|
845
|
+
throw new Error(`A job of the type ${String(unknown)} is one this build does not run.`);
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Take one job from the hub, or throw the sentence that says why it could not be taken.
|
|
849
|
+
*
|
|
850
|
+
* A job at or below the high-water mark has run already and is dropped. The socket acks it all the
|
|
851
|
+
* same, so the hub drops its queue row and stops sending it.
|
|
852
|
+
*
|
|
853
|
+
* The mark moves after the work, not before it, so it holds what this machine has finished. A crash
|
|
854
|
+
* between the work and the mark is the one case a redelivered job runs twice. The case the mark is here
|
|
855
|
+
* for is an ack the hub never got, from a socket that died on the way: the hub keeps the row and sends
|
|
856
|
+
* the job again on the next connect.
|
|
857
|
+
*
|
|
858
|
+
* One mark per hub, named by the caller. A job id counts from 1 inside each hub, so a machine that has
|
|
859
|
+
* finished 57 jobs on one hub would drop the other hub's first 57 without running them and ack every
|
|
860
|
+
* one. The socket a job came in on is what picks the mark, and the same socket is handed `send`, so an
|
|
861
|
+
* ack goes back to the hub that asked and never to the other one. A mark is only safe while the counter
|
|
862
|
+
* it tracks keeps growing, so the `project.join` branch above puts the team mark back to zero when the
|
|
863
|
+
* machine joins another team and meets another counter.
|
|
864
|
+
*
|
|
865
|
+
* The ack is on the wire before the work starts. `connectHub` acks as soon as the reader returns, and
|
|
866
|
+
* the reader in `hub-link.ts` only adds the job to a queue. So a job the hub has already dropped is lost
|
|
867
|
+
* if the process stops before that job's turn comes. Making the ack mean done needs `connectHub` to
|
|
868
|
+
* await the reader, which changes what the hub is allowed to delete a queue row on.
|
|
869
|
+
*/
|
|
870
|
+
async function takeHubJob(live, message, send, mark) {
|
|
871
|
+
if (message.job <= getSetting(live.db, mark)) return;
|
|
872
|
+
await run(live, message, send, mark);
|
|
873
|
+
writeSetting(live.db, mark, Math.max(message.job, getSetting(live.db, mark)));
|
|
874
|
+
}
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/lib/hub-sync.ts
|
|
877
|
+
var CHUNK = 200;
|
|
878
|
+
var RUN_FAILED = "The run failed. The reason is on the machine that ran it.";
|
|
879
|
+
function cardRows(db) {
|
|
880
|
+
return db.prepare("SELECT key, board, stage, state, title, source, source_ref, pr_author, pr_decision, pr_head_at, pr_draft, pr_state FROM cards ORDER BY key").all();
|
|
881
|
+
}
|
|
882
|
+
var cardSync = (row) => ({
|
|
883
|
+
key: row.key,
|
|
884
|
+
title: row.title,
|
|
885
|
+
stage: row.stage,
|
|
886
|
+
state: row.state,
|
|
887
|
+
source: row.source,
|
|
888
|
+
sourceRef: row.source_ref,
|
|
889
|
+
pull: row.pr_decision === null ? null : {
|
|
890
|
+
author: row.pr_author,
|
|
891
|
+
decision: row.pr_decision,
|
|
892
|
+
headCommittedAt: row.pr_head_at,
|
|
893
|
+
draft: row.pr_draft === 1,
|
|
894
|
+
...row.pr_state === null ? {} : { state: row.pr_state }
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
/** The board rows as the hub reads them, keyed so two reads can be compared row by row. */
|
|
898
|
+
function boardRows(db, withRuns, snapshot) {
|
|
899
|
+
const boardOf = /* @__PURE__ */ new Map();
|
|
900
|
+
const rows = [];
|
|
901
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
902
|
+
const vendors = new Map(getSetting(db, "engineProfiles").map((profile) => [profile.id, profile.vendor]));
|
|
903
|
+
for (const row of cardRows(db)) {
|
|
904
|
+
if (!isBoardKind(row.board)) continue;
|
|
905
|
+
boardOf.set(row.key, row.board);
|
|
906
|
+
const card = cardSync(row);
|
|
907
|
+
if (snapshot !== void 0) {
|
|
908
|
+
const board = snapshots.get(row.board) ?? snapshot(row.board);
|
|
909
|
+
snapshots.set(row.board, board);
|
|
910
|
+
const start = startOf(board, row.key, vendors);
|
|
911
|
+
if (start !== void 0) card.start = start;
|
|
912
|
+
}
|
|
913
|
+
rows.push({
|
|
914
|
+
key: `card ${row.key}`,
|
|
915
|
+
kind: row.board,
|
|
916
|
+
item: { card }
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
const extras = new Map((withRuns ? db.prepare("SELECT id, plain_summary, question_options, thread FROM runs").all() : []).map((row) => [row.id, row]));
|
|
920
|
+
const kindOf = (key) => boardOf.get(key) ?? "delivery";
|
|
921
|
+
for (const move of allCardMoves(db)) rows.push({
|
|
922
|
+
key: `move ${move.id}`,
|
|
923
|
+
kind: kindOf(move.cardKey),
|
|
924
|
+
item: { event: move }
|
|
925
|
+
});
|
|
926
|
+
for (const run of withRuns ? allRuns(db) : []) {
|
|
927
|
+
if (run.phase === "commit-message" || run.phase === "thread-title" || run.phase === "ask") continue;
|
|
928
|
+
const comments = run.phase === "feedback" || extras.get(run.id)?.thread != null;
|
|
929
|
+
rows.push({
|
|
930
|
+
key: `run ${run.id}`,
|
|
931
|
+
kind: kindOf(run.cardKey),
|
|
932
|
+
item: { run: {
|
|
933
|
+
id: run.id,
|
|
934
|
+
cardKey: run.cardKey,
|
|
935
|
+
phase: run.phase,
|
|
936
|
+
engine: run.engine,
|
|
937
|
+
model: run.model,
|
|
938
|
+
effort: run.effort,
|
|
939
|
+
state: run.state,
|
|
940
|
+
lane: run.lane,
|
|
941
|
+
attempt: run.attempt,
|
|
942
|
+
startedAt: run.startedAt,
|
|
943
|
+
endedAt: run.endedAt,
|
|
944
|
+
question: comments ? null : run.question,
|
|
945
|
+
error: run.failureReason === null ? null : RUN_FAILED,
|
|
946
|
+
verdict: run.verdict,
|
|
947
|
+
verdictReason: run.verdictReason,
|
|
948
|
+
costUsd: run.costUsd,
|
|
949
|
+
durationMs: run.durationMs,
|
|
950
|
+
tokens: run.tokens,
|
|
951
|
+
...comments ? {} : runExtras(run.question, extras.get(run.id))
|
|
952
|
+
} }
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
return rows;
|
|
956
|
+
}
|
|
957
|
+
function runExtras(question, row) {
|
|
958
|
+
const summary = row?.plain_summary?.trim() ? capSummary(row.plain_summary) : null;
|
|
959
|
+
const options = question === null ? null : storedQuestionOptions(row?.question_options ?? null);
|
|
960
|
+
return {
|
|
961
|
+
...summary === null ? {} : { summary },
|
|
962
|
+
...options === null ? {} : { questionOptions: options }
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* What the go button on the card page would start, as the board resolved it: the next stage for a card
|
|
967
|
+
* that waits on nobody, its own stage for a failed one to retry. Nothing for a card that runs, waits,
|
|
968
|
+
* asks or sits in a stage that starts no run, and nothing on a row whose model or login is not there,
|
|
969
|
+
* because that start would be refused.
|
|
970
|
+
*
|
|
971
|
+
* ponytail: a QA FAIL offers Fix it and open diff comments offer Send back on the card page; both read
|
|
972
|
+
* here as the plain next start. Send the decision's own start once the phone draws those two.
|
|
973
|
+
*/
|
|
974
|
+
function startOf(board, key, vendors) {
|
|
975
|
+
const card = board.cards.find((one) => one.key === key);
|
|
976
|
+
if (card === void 0) return void 0;
|
|
977
|
+
const at = board.stages.findIndex((stage) => stage.id === card.stage);
|
|
978
|
+
const stage = card.state === "idle" || card.state === "ready" ? board.stages[at + 1] : card.state === "failed" ? board.stages[at] : void 0;
|
|
979
|
+
const starts = stage === void 0 || at < 0 ? null : cardStarts(stage, card);
|
|
980
|
+
const engine = starts === null ? void 0 : vendors.get(starts.engine);
|
|
981
|
+
if (starts === null || starts.modelState !== "ok" || engine === void 0) return void 0;
|
|
982
|
+
return {
|
|
983
|
+
phase: starts.phase,
|
|
984
|
+
engine,
|
|
985
|
+
model: starts.model,
|
|
986
|
+
effort: starts.effort,
|
|
987
|
+
...starts.estimate === void 0 ? {} : { estimate: starts.estimate }
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* A run's cost as `run.cost` carries it to the team hub, or null for a run that has not started.
|
|
992
|
+
*
|
|
993
|
+
* Field by field from the run row, so a column added to the row later does not reach the team on its
|
|
994
|
+
* own. The question, the verdict reason, the failure, the log path, the session id, the effort and the
|
|
995
|
+
* engine profile are on the row and are not read here.
|
|
996
|
+
*/
|
|
997
|
+
function runCostOf(run) {
|
|
998
|
+
if (run.startedAt === null) return null;
|
|
999
|
+
return {
|
|
1000
|
+
runId: run.id,
|
|
1001
|
+
cardKey: run.cardKey,
|
|
1002
|
+
phase: run.phase,
|
|
1003
|
+
model: run.model,
|
|
1004
|
+
startedAt: run.startedAt,
|
|
1005
|
+
costUsd: run.costUsd,
|
|
1006
|
+
durationMs: run.durationMs,
|
|
1007
|
+
tokens: run.tokens
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
function dayOf(item) {
|
|
1011
|
+
if ("event" in item) return item.event.at.slice(0, 10);
|
|
1012
|
+
if ("run" in item) return item.run.startedAt?.slice(0, 10) ?? null;
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
function createHubSync(db, send, { runs = true, snapshot } = {}) {
|
|
1016
|
+
let sent = /* @__PURE__ */ new Map();
|
|
1017
|
+
return {
|
|
1018
|
+
reset() {
|
|
1019
|
+
sent = /* @__PURE__ */ new Map();
|
|
1020
|
+
},
|
|
1021
|
+
board() {
|
|
1022
|
+
const changed = boardRows(db, runs, snapshot).flatMap((row) => {
|
|
1023
|
+
const text = JSON.stringify(row.item);
|
|
1024
|
+
return sent.get(row.key) === text ? [] : [{
|
|
1025
|
+
...row,
|
|
1026
|
+
text
|
|
1027
|
+
}];
|
|
1028
|
+
});
|
|
1029
|
+
const days = /* @__PURE__ */ new Set();
|
|
1030
|
+
for (const kind of new Set(changed.map((row) => row.kind))) {
|
|
1031
|
+
const ofKind = changed.filter((row) => row.kind === kind);
|
|
1032
|
+
for (let at = 0; at < ofKind.length; at += CHUNK) {
|
|
1033
|
+
const part = ofKind.slice(at, at + CHUNK);
|
|
1034
|
+
const payload = {
|
|
1035
|
+
kind,
|
|
1036
|
+
cards: [],
|
|
1037
|
+
events: [],
|
|
1038
|
+
runs: []
|
|
1039
|
+
};
|
|
1040
|
+
for (const { item } of part) if ("card" in item) payload.cards.push(item.card);
|
|
1041
|
+
else if ("event" in item) payload.events.push(item.event);
|
|
1042
|
+
else payload.runs.push(item.run);
|
|
1043
|
+
if (!send("card.state", payload)) return [...days];
|
|
1044
|
+
for (const row of part) {
|
|
1045
|
+
sent.set(row.key, row.text);
|
|
1046
|
+
const day = dayOf(row.item);
|
|
1047
|
+
if (day !== null) days.add(day);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
return [...days];
|
|
1052
|
+
},
|
|
1053
|
+
async evidence(days) {},
|
|
1054
|
+
findings() {
|
|
1055
|
+
const projectId = getSetting(db, "projectId");
|
|
1056
|
+
if (projectId === null) return;
|
|
1057
|
+
const changed = allScoutFindings(db).flatMap((one) => {
|
|
1058
|
+
const finding = {
|
|
1059
|
+
sourceId: one.sourceId,
|
|
1060
|
+
fingerprint: one.fingerprint,
|
|
1061
|
+
kind: one.kind,
|
|
1062
|
+
status: one.status,
|
|
1063
|
+
occurrences: one.occurrences,
|
|
1064
|
+
firstSeen: one.firstSeen,
|
|
1065
|
+
lastSeen: one.lastSeen,
|
|
1066
|
+
location: one.location,
|
|
1067
|
+
externalKey: one.externalKey,
|
|
1068
|
+
cardKey: one.cardKey
|
|
1069
|
+
};
|
|
1070
|
+
const key = `finding ${one.sourceId} ${one.fingerprint}`;
|
|
1071
|
+
const text = JSON.stringify(finding);
|
|
1072
|
+
return sent.get(key) === text ? [] : [{
|
|
1073
|
+
key,
|
|
1074
|
+
text,
|
|
1075
|
+
finding
|
|
1076
|
+
}];
|
|
1077
|
+
});
|
|
1078
|
+
for (let at = 0; at < changed.length; at += CHUNK) {
|
|
1079
|
+
const part = changed.slice(at, at + CHUNK);
|
|
1080
|
+
if (!send("finding.results", {
|
|
1081
|
+
projectId,
|
|
1082
|
+
findings: part.map((one) => one.finding)
|
|
1083
|
+
})) return;
|
|
1084
|
+
for (const one of part) sent.set(one.key, one.text);
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
runCosts() {
|
|
1088
|
+
const teamProjectId = getSetting(db, "teamProjectId");
|
|
1089
|
+
if (teamProjectId === null) return;
|
|
1090
|
+
const changed = allRuns(db).flatMap((run) => {
|
|
1091
|
+
const cost = runCostOf(run);
|
|
1092
|
+
if (cost === null) return [];
|
|
1093
|
+
const key = `cost ${run.id}`;
|
|
1094
|
+
const text = JSON.stringify(cost);
|
|
1095
|
+
return sent.get(key) === text ? [] : [{
|
|
1096
|
+
key,
|
|
1097
|
+
text,
|
|
1098
|
+
cost
|
|
1099
|
+
}];
|
|
1100
|
+
});
|
|
1101
|
+
for (let at = 0; at < changed.length; at += CHUNK) {
|
|
1102
|
+
const part = changed.slice(at, at + CHUNK);
|
|
1103
|
+
if (!send("run.cost", {
|
|
1104
|
+
teamProjectId,
|
|
1105
|
+
runs: part.map((one) => one.cost)
|
|
1106
|
+
})) return;
|
|
1107
|
+
for (const one of part) sent.set(one.key, one.text);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
/** The last `count` UTC days, today first. */
|
|
1113
|
+
function recentDays(count, now = /* @__PURE__ */ new Date()) {
|
|
1114
|
+
return Array.from({ length: count }, (_, back) => (/* @__PURE__ */ new Date(now.getTime() - back * 864e5)).toISOString().slice(0, 10));
|
|
1115
|
+
}
|
|
1116
|
+
//#endregion
|
|
1117
|
+
//#region src/lib/hub-link.ts
|
|
1118
|
+
var reason = (error) => error instanceof Error ? error.message : String(error);
|
|
1119
|
+
var sentFrames = 0;
|
|
1120
|
+
var lastSent = null;
|
|
1121
|
+
var reading = null;
|
|
1122
|
+
var started = null;
|
|
1123
|
+
var dialled = null;
|
|
1124
|
+
var idleLink = () => ({
|
|
1125
|
+
status: () => "closed",
|
|
1126
|
+
teamStatus: () => "closed",
|
|
1127
|
+
send: () => false,
|
|
1128
|
+
sendTeam: () => false,
|
|
1129
|
+
projectsChanged: () => {},
|
|
1130
|
+
close: () => {},
|
|
1131
|
+
ready: Promise.resolve()
|
|
1132
|
+
});
|
|
1133
|
+
var dialledFor = null;
|
|
1134
|
+
var accountKey = (document) => [
|
|
1135
|
+
document.id,
|
|
1136
|
+
document.plan,
|
|
1137
|
+
document.seats,
|
|
1138
|
+
[...document.features].sort().join(" ")
|
|
1139
|
+
].join("|");
|
|
1140
|
+
/**
|
|
1141
|
+
* Register this machine's project with the hub, and resend the schedules it holds.
|
|
1142
|
+
*
|
|
1143
|
+
* On every connect and not once. The hub may have lost the row, the fields below may have changed
|
|
1144
|
+
* while the link was down, and a sync costs one frame. It runs here, where the connect happens, and
|
|
1145
|
+
* never in a page load: reading the keychain and opening the socket both take time, and a load may
|
|
1146
|
+
* not wait on either.
|
|
1147
|
+
*
|
|
1148
|
+
* The id is minted on this machine. Nothing in the local database is stable enough for the hub to key
|
|
1149
|
+
* a project row on: the `projects` table is written by nothing, the project path follows a folder that
|
|
1150
|
+
* a person may move, and the name is that path's last part. So the first connect after this version
|
|
1151
|
+
* mints one and stores it, which is what every machine in existence does on its next start, and the
|
|
1152
|
+
* project keeps that id from then on.
|
|
1153
|
+
*
|
|
1154
|
+
* A machine with no project path sends nothing and mints nothing. There is no project to register, and
|
|
1155
|
+
* an id minted now would belong to whatever folder the person picks later.
|
|
1156
|
+
*
|
|
1157
|
+
* Answers whether the registration went out. The hub refuses a board row from a socket that has not
|
|
1158
|
+
* named its project, so board sync waits on this.
|
|
1159
|
+
*/
|
|
1160
|
+
function registerProject(db, send) {
|
|
1161
|
+
const name = projectName(db);
|
|
1162
|
+
if (name === null) return false;
|
|
1163
|
+
const stored = getSetting(db, "projectId");
|
|
1164
|
+
const id = stored ?? randomUUID();
|
|
1165
|
+
if (stored === null) writeSetting(db, "projectId", id);
|
|
1166
|
+
if (!send("project.sync", {
|
|
1167
|
+
id,
|
|
1168
|
+
name,
|
|
1169
|
+
flow: getSetting(db, "deliveryFlow"),
|
|
1170
|
+
clientName: getSetting(db, "clientName"),
|
|
1171
|
+
hourlyRate: getSetting(db, "hourlyRate"),
|
|
1172
|
+
currency: getSetting(db, "currency"),
|
|
1173
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1174
|
+
handles: SERVER_MESSAGES,
|
|
1175
|
+
team: getSetting(db, "teamProjectId") !== null
|
|
1176
|
+
})) return false;
|
|
1177
|
+
for (const source of scoutSources(db)) {
|
|
1178
|
+
if (source.scheduleMinutes === 0) continue;
|
|
1179
|
+
const on = source.enabled;
|
|
1180
|
+
send("scout.schedule", {
|
|
1181
|
+
projectId: id,
|
|
1182
|
+
sourceId: source.id,
|
|
1183
|
+
intervalMinutes: on ? source.scheduleMinutes : 0,
|
|
1184
|
+
notify: on && source.notify,
|
|
1185
|
+
createCards: source.createCards,
|
|
1186
|
+
autoAssess: source.autoAssess
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
return true;
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* What the connection is doing, for a screen.
|
|
1193
|
+
*
|
|
1194
|
+
* `closed` before the dial has started, on a machine with no account, and after the app has been told
|
|
1195
|
+
* to shut down, because none of the three has a connection to report on.
|
|
1196
|
+
*/
|
|
1197
|
+
var hubStatus = () => started?.status() ?? "closed";
|
|
1198
|
+
/**
|
|
1199
|
+
* Send one frame to the hub, and answer whether it went.
|
|
1200
|
+
*
|
|
1201
|
+
* False on a machine with no account, on one whose link is down, and in fake mode, because none of
|
|
1202
|
+
* them has a socket. The caller owes the person a sentence in that case: what was stored here is
|
|
1203
|
+
* stored, and the hub does not have it. A frame that did not go is not held for a retry: the
|
|
1204
|
+
* registration on the next connect is what sends the stored schedules again.
|
|
1205
|
+
*/
|
|
1206
|
+
var sendToHub = (type, payload, project) => started?.send(type, payload, project) ?? false;
|
|
1207
|
+
/**
|
|
1208
|
+
* Tell the link a project was registered, so it is synced now and not at the next server start.
|
|
1209
|
+
*
|
|
1210
|
+
* New project calls this once the new project has its folder, because the hub refuses a project with
|
|
1211
|
+
* no name. Nothing happens on a machine with no link.
|
|
1212
|
+
*/
|
|
1213
|
+
var hubProjectsChanged = () => started?.projectsChanged();
|
|
1214
|
+
/**
|
|
1215
|
+
* Dial the hub for the account this machine is signed in as.
|
|
1216
|
+
*
|
|
1217
|
+
* The dial is not awaited. Reading the keychain can raise an OS password dialog whose refusal throws,
|
|
1218
|
+
* and the app has to be serving pages by then. A client with no device token dials nothing, which is
|
|
1219
|
+
* what `connectToHub` answering null means, and that is the free client and not a fault.
|
|
1220
|
+
*
|
|
1221
|
+
* Fake mode dials nothing either, unless a test hands in its own socket. A demo walk runs on a machine
|
|
1222
|
+
* that may be signed in, and it has no business opening a socket to the real hub while a person is
|
|
1223
|
+
* looking at a board full of made-up cards.
|
|
1224
|
+
*
|
|
1225
|
+
* One personal socket for the machine, and one team socket for each team project. A team socket goes to
|
|
1226
|
+
* the team hub on a path of its own, and it is opened only for a project that holds the id the team hub
|
|
1227
|
+
* minted. The personal socket does not change: it is dialled first, its status is the one a screen reads,
|
|
1228
|
+
* and a team hub that is down or will not serve this machine costs it nothing.
|
|
1229
|
+
*
|
|
1230
|
+
* The personal socket carries every project the link serves: each registers with its own `project.sync`
|
|
1231
|
+
* and pushes its own board, each frame naming its project. On Free that is the one open project, as
|
|
1232
|
+
* before a machine could hold several (owner question 10).
|
|
1233
|
+
*/
|
|
1234
|
+
function startHubLink(live, env, deps = {}) {
|
|
1235
|
+
dialled = {
|
|
1236
|
+
live,
|
|
1237
|
+
env,
|
|
1238
|
+
deps
|
|
1239
|
+
};
|
|
1240
|
+
const say = deps.say ?? ((line) => console.error(line));
|
|
1241
|
+
const display = deps.display ?? heldDisplay;
|
|
1242
|
+
let stopped = false;
|
|
1243
|
+
let waiting = Promise.resolve();
|
|
1244
|
+
const served = /* @__PURE__ */ new Map();
|
|
1245
|
+
if ((isFakeMode(env), deps.socket === void 0) || getSetting(live.db, "syncPaused")) {
|
|
1246
|
+
started = idleLink();
|
|
1247
|
+
return started;
|
|
1248
|
+
}
|
|
1249
|
+
const keychain = deps.keychain ?? createKeychain(process.platform, runKeychain, resolveDataDir(env));
|
|
1250
|
+
const loopFor = async (project) => {
|
|
1251
|
+
const registered = registeredProjects(live.db).map((one) => one.id);
|
|
1252
|
+
const id = project ?? registered[0];
|
|
1253
|
+
if (id === void 0 || !registered.includes(id)) throw new Error(`It names project ${project}, and this machine has no such project, so no project ran it.`);
|
|
1254
|
+
if (id === live.project) return live;
|
|
1255
|
+
if (deps.projectLoop !== void 0) return deps.projectLoop(id);
|
|
1256
|
+
const { loop } = await import('./loop2.js-B_Qd2m4y.js');
|
|
1257
|
+
return loop(env, id);
|
|
1258
|
+
};
|
|
1259
|
+
const servedIds = () => {
|
|
1260
|
+
const ids = registeredProjects(live.db).map((one) => one.id);
|
|
1261
|
+
return shows(display(), "hub-projects") ? ids : ids.slice(0, 1);
|
|
1262
|
+
};
|
|
1263
|
+
const dial = (url, mark, where, watch, owner) => {
|
|
1264
|
+
const wire = {
|
|
1265
|
+
status: "closed",
|
|
1266
|
+
connection: null,
|
|
1267
|
+
closed: false,
|
|
1268
|
+
post: (type, payload, project = owner ?? live.project) => {
|
|
1269
|
+
if (wire.status !== "open" || wire.connection === null) return false;
|
|
1270
|
+
const went = wire.connection.send(hubEnvelope(type, ++sentFrames, payload, project));
|
|
1271
|
+
if (went) lastSent = Date.now();
|
|
1272
|
+
return went;
|
|
1273
|
+
},
|
|
1274
|
+
close: () => {
|
|
1275
|
+
wire.closed = true;
|
|
1276
|
+
wire.connection?.close();
|
|
1277
|
+
wire.connection = null;
|
|
1278
|
+
},
|
|
1279
|
+
ready: Promise.resolve()
|
|
1280
|
+
};
|
|
1281
|
+
wire.ready = connectToHub({
|
|
1282
|
+
keychain,
|
|
1283
|
+
url,
|
|
1284
|
+
socket: deps.socket,
|
|
1285
|
+
onStatus: (next) => {
|
|
1286
|
+
wire.status = next;
|
|
1287
|
+
watch(next);
|
|
1288
|
+
},
|
|
1289
|
+
onMessage: (message) => {
|
|
1290
|
+
waiting = waiting.then(async () => {
|
|
1291
|
+
if (owner !== void 0 && message.project !== void 0 && message.project !== owner) throw new Error(`It names project ${message.project} on the team socket of project ${owner}, so no project ran it.`);
|
|
1292
|
+
const target = await loopFor(owner ?? message.project);
|
|
1293
|
+
await takeHubJob(target, message, (type, payload) => wire.post(type, payload, target.project), mark);
|
|
1294
|
+
}).catch((error) => say(`A job from the hub did not run: ${reason(error)}`)).then(serveProjects).catch((error) => say(`Nolzu could not dial its team hub: ${reason(error)}`));
|
|
1295
|
+
},
|
|
1296
|
+
onUnreadable: (sentence) => say(sentence),
|
|
1297
|
+
onDeleted: () => {
|
|
1298
|
+
writeSetting(live.db, "syncPaused", true);
|
|
1299
|
+
say("Your cloud data was deleted, so Nolzu paused sync. Turn it back on in Settings, Cloud.");
|
|
1300
|
+
link.close();
|
|
1301
|
+
started = idleLink();
|
|
1302
|
+
}
|
|
1303
|
+
}).then((made) => {
|
|
1304
|
+
wire.connection = made;
|
|
1305
|
+
if (stopped || wire.closed) made?.close();
|
|
1306
|
+
}).catch((error) => {
|
|
1307
|
+
wire.status = "closed";
|
|
1308
|
+
say(`Nolzu could not reach ${where}: ${reason(error)}`);
|
|
1309
|
+
});
|
|
1310
|
+
return wire;
|
|
1311
|
+
};
|
|
1312
|
+
function syncProject(one) {
|
|
1313
|
+
try {
|
|
1314
|
+
return registerProject(one.live.db, (type, payload) => own.post(type, payload, one.live.project));
|
|
1315
|
+
} catch (error) {
|
|
1316
|
+
say(`Nolzu could not register its project with the hub: ${reason(error)}`);
|
|
1317
|
+
return false;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
function pushBoard(one, onOpen) {
|
|
1321
|
+
if (!one.registered) {
|
|
1322
|
+
if (own.status !== "open") return;
|
|
1323
|
+
one.registered = syncProject(one);
|
|
1324
|
+
if (!one.registered) return;
|
|
1325
|
+
onOpen = true;
|
|
1326
|
+
}
|
|
1327
|
+
try {
|
|
1328
|
+
const touched = one.sync.board();
|
|
1329
|
+
one.sync.findings();
|
|
1330
|
+
const days = onOpen ? recentDays(7) : touched;
|
|
1331
|
+
if (days.length > 0) one.sync.evidence(days).catch((error) => stopped || say(`Nolzu could not send its evidence to the hub: ${reason(error)}`));
|
|
1332
|
+
} catch (error) {
|
|
1333
|
+
say(`Nolzu could not send its board to the hub: ${reason(error)}`);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
function pushTeamBoard(one) {
|
|
1337
|
+
if (one.team?.status !== "open" || getSetting(one.live.db, "teamProjectId") === null) return;
|
|
1338
|
+
try {
|
|
1339
|
+
one.teamSync.board();
|
|
1340
|
+
one.teamSync.runCosts();
|
|
1341
|
+
} catch (error) {
|
|
1342
|
+
say(`Nolzu could not send its board to the team hub: ${reason(error)}`);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
function serve(project) {
|
|
1346
|
+
const one = {
|
|
1347
|
+
live: project,
|
|
1348
|
+
registered: false,
|
|
1349
|
+
sync: createHubSync(project.db, (type, payload) => own.post(type, payload, project.project), { snapshot: project.snapshot }),
|
|
1350
|
+
teamSync: createHubSync(project.db, (type, payload) => one.team?.post(type, payload) ?? false, { runs: false }),
|
|
1351
|
+
team: null,
|
|
1352
|
+
teamFor: null,
|
|
1353
|
+
leave: project.onChange(() => {
|
|
1354
|
+
pushBoard(one, false);
|
|
1355
|
+
pushTeamBoard(one);
|
|
1356
|
+
})
|
|
1357
|
+
};
|
|
1358
|
+
served.set(project.project, one);
|
|
1359
|
+
return one;
|
|
1360
|
+
}
|
|
1361
|
+
function openTeamHub(one) {
|
|
1362
|
+
if (stopped) return;
|
|
1363
|
+
const id = getSetting(one.live.db, "teamProjectId");
|
|
1364
|
+
if (id === null) return;
|
|
1365
|
+
if (one.team !== null && id === one.teamFor) return;
|
|
1366
|
+
one.team?.close();
|
|
1367
|
+
one.teamFor = id;
|
|
1368
|
+
one.team = dial(teamHubUrl(env), "teamHubJobDone", "its team hub", (next) => {
|
|
1369
|
+
if (next === "open") {
|
|
1370
|
+
one.teamSync.reset();
|
|
1371
|
+
pushTeamBoard(one);
|
|
1372
|
+
}
|
|
1373
|
+
if (next === "unpaid") say("This plan does not open the team hub, so nothing from the team board reaches this machine. The rest of Nolzu goes on working.");
|
|
1374
|
+
if (next === "refused") say("The team hub turned this machine down, so nothing from the team board reaches it. Run `npx nolzu@latest login` again, and update Nolzu if that does not help.");
|
|
1375
|
+
}, one.live.project);
|
|
1376
|
+
syncProject(one);
|
|
1377
|
+
}
|
|
1378
|
+
async function serveProjects() {
|
|
1379
|
+
for (const id of servedIds()) {
|
|
1380
|
+
if (stopped) return;
|
|
1381
|
+
let one = served.get(id);
|
|
1382
|
+
if (one === void 0) {
|
|
1383
|
+
const project = await loopFor(id);
|
|
1384
|
+
if (stopped || served.has(id)) continue;
|
|
1385
|
+
one = serve(project);
|
|
1386
|
+
pushBoard(one, true);
|
|
1387
|
+
}
|
|
1388
|
+
openTeamHub(one);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
const projectsChanged = () => {
|
|
1392
|
+
waiting = waiting.then(serveProjects).catch((error) => say(`Nolzu could not send a project to the hub: ${reason(error)}`));
|
|
1393
|
+
};
|
|
1394
|
+
const own = dial(hubUrl(env), "hubJobDone", "its hub", (next) => {
|
|
1395
|
+
if (next === "unpaid") writeSetting(live.db, "accountProjects", null);
|
|
1396
|
+
if (next !== "open") {
|
|
1397
|
+
for (const one of served.values()) one.registered = false;
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
for (const one of served.values()) {
|
|
1401
|
+
one.sync.reset();
|
|
1402
|
+
one.registered = false;
|
|
1403
|
+
pushBoard(one, true);
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
const read = own.ready;
|
|
1407
|
+
reading = read;
|
|
1408
|
+
read.then(() => {
|
|
1409
|
+
if (reading === read) reading = null;
|
|
1410
|
+
});
|
|
1411
|
+
if (servedIds().includes(live.project)) openTeamHub(serve(live));
|
|
1412
|
+
projectsChanged();
|
|
1413
|
+
const link = {
|
|
1414
|
+
status: () => own.status,
|
|
1415
|
+
teamStatus: () => {
|
|
1416
|
+
const all = [...served.values()].flatMap((one) => one.team === null ? [] : [one.team.status]);
|
|
1417
|
+
return all.find((status) => status === "refused" || status === "unpaid") ?? all[0] ?? "closed";
|
|
1418
|
+
},
|
|
1419
|
+
send: (type, payload, project) => own.post(type, payload, project),
|
|
1420
|
+
sendTeam: (type, payload, project = live.project) => served.get(project)?.team?.post(type, payload) ?? false,
|
|
1421
|
+
projectsChanged,
|
|
1422
|
+
ready: own.ready,
|
|
1423
|
+
close() {
|
|
1424
|
+
stopped = true;
|
|
1425
|
+
own.close();
|
|
1426
|
+
for (const one of served.values()) {
|
|
1427
|
+
one.leave();
|
|
1428
|
+
one.team?.close();
|
|
1429
|
+
}
|
|
1430
|
+
if (started === link) started = null;
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
started = link;
|
|
1434
|
+
return link;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Dial again when a document says the account changed under a link that stopped for good.
|
|
1438
|
+
*
|
|
1439
|
+
* `connectHub` gives up for the life of the process on a refusal code, so a plan bought in the browser
|
|
1440
|
+
* would otherwise reach this machine only at the next server start, and a run started from the cloud
|
|
1441
|
+
* would wait that long. The signed display document is the trigger the client already has:
|
|
1442
|
+
* `currentDisplay` refreshes it on a page load and it carries the plan.
|
|
1443
|
+
*
|
|
1444
|
+
* One dial per document change, never one per page load, because the document changes when the account
|
|
1445
|
+
* did. `unpaid` waits for a plan that opens the board, so a document without that feature changes
|
|
1446
|
+
* nothing here. `refused` waits for a token or a newer build, and the document shows neither, so the
|
|
1447
|
+
* first document to arrive after the refusal is the signal there.
|
|
1448
|
+
*
|
|
1449
|
+
* Either socket is enough. A team hub that turned this machine down stops its own loop for the life of
|
|
1450
|
+
* the process, the same way the personal one does, and nothing else dials it again, so a Team plan
|
|
1451
|
+
* bought in the browser would never reach the team board. The team half is dialled again on any changed
|
|
1452
|
+
* document and not on a feature this file names: the client cannot say which word the team hub gates on,
|
|
1453
|
+
* that word is the hub's, and a document that changed is already an account that changed. The whole link
|
|
1454
|
+
* goes down and up, which costs the personal socket one reconnect.
|
|
1455
|
+
*
|
|
1456
|
+
* Answers whether it dialled, for a test. The dial inside is not awaited, the way the dial from `init`
|
|
1457
|
+
* is not, so a page load never waits for a keychain that may put an OS password dialog on the screen.
|
|
1458
|
+
* Fake mode never gets here: it dials nothing, so there is no stopped link and `hubStatus` says
|
|
1459
|
+
* `closed`.
|
|
1460
|
+
*/
|
|
1461
|
+
function dialHubAgain(document) {
|
|
1462
|
+
const status = hubStatus();
|
|
1463
|
+
const own = status === "refused" || status === "unpaid" && shows(document, "cloud-board");
|
|
1464
|
+
const team = started?.teamStatus();
|
|
1465
|
+
if (!own && team !== "unpaid" && team !== "refused") return false;
|
|
1466
|
+
if (dialled === null) return false;
|
|
1467
|
+
const key = accountKey(document);
|
|
1468
|
+
if (key === dialledFor) return false;
|
|
1469
|
+
dialledFor = key;
|
|
1470
|
+
started?.close();
|
|
1471
|
+
startHubLink(dialled.live, dialled.env, dialled.deps);
|
|
1472
|
+
return true;
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* When a frame last went to a hub, or null when none has since Nolzu started.
|
|
1476
|
+
*/
|
|
1477
|
+
var hubLastSent = () => lastSent;
|
|
1478
|
+
var REDIAL_WAIT_MS = 5e3;
|
|
1479
|
+
/**
|
|
1480
|
+
* Dial again because a person pressed Connect again on Settings, Cloud. Answers whether it dialled.
|
|
1481
|
+
*
|
|
1482
|
+
* Only from `closed`, the one stopped state nothing leaves by itself: the keychain read failed or found
|
|
1483
|
+
* no token, so `connectHub` never started its loop. `connecting` and `waiting` are dialling already and
|
|
1484
|
+
* `open` has nothing to fix. `refused` and `unpaid` wait for the account to change, and `dialHubAgain`
|
|
1485
|
+
* dials on the document that says it did. A link whose keychain read is still going reads `closed` too,
|
|
1486
|
+
* and is left to finish (`reading`). No load and no timer calls this, only the `redial` action.
|
|
1487
|
+
*
|
|
1488
|
+
* The press waits for the keychain read, so the load that follows the press says Connecting, or
|
|
1489
|
+
* Offline again when there is still no token, and not the Offline the person pressed on.
|
|
1490
|
+
*/
|
|
1491
|
+
async function redialHub() {
|
|
1492
|
+
if (dialled === null || reading !== null || hubStatus() !== "closed") return false;
|
|
1493
|
+
await dialForPress(dialled);
|
|
1494
|
+
return true;
|
|
1495
|
+
}
|
|
1496
|
+
async function dialForPress(from) {
|
|
1497
|
+
started?.close();
|
|
1498
|
+
const link = startHubLink(from.live, from.env, from.deps);
|
|
1499
|
+
let timer;
|
|
1500
|
+
await Promise.race([link.ready, new Promise((resolve) => timer = setTimeout(resolve, REDIAL_WAIT_MS))]);
|
|
1501
|
+
clearTimeout(timer);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Turn sync back on after Delete my cloud data, from Settings, Cloud. Clears the pause and dials at once,
|
|
1505
|
+
* and the open sends the whole board, as every connect does. Answers whether it dialled: false when no
|
|
1506
|
+
* link was ever started, such as in fake mode, where the cleared setting is the whole job, and while a
|
|
1507
|
+
* keychain read from an earlier press still goes.
|
|
1508
|
+
*/
|
|
1509
|
+
async function resumeSync(db = dialled?.live.db ?? null) {
|
|
1510
|
+
if (db !== null) writeSetting(db, "syncPaused", false);
|
|
1511
|
+
if (dialled === null || reading !== null) return false;
|
|
1512
|
+
await dialForPress(dialled);
|
|
1513
|
+
return true;
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Close the link this module holds and forget the account it was dialled for.
|
|
1517
|
+
*
|
|
1518
|
+
* The quit path in `hooks.server.ts` calls this, and so does a test. A dial again starts a link no
|
|
1519
|
+
* caller has a handle on, so the only close that reaches the live socket and its heartbeat is one that
|
|
1520
|
+
* reads what the module holds now.
|
|
1521
|
+
*/
|
|
1522
|
+
var closeHubLink = () => {
|
|
1523
|
+
started?.close();
|
|
1524
|
+
started = null;
|
|
1525
|
+
dialled = null;
|
|
1526
|
+
dialledFor = null;
|
|
1527
|
+
lastSent = null;
|
|
1528
|
+
reading = null;
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
export { move as A, promote as B, stop as C, answer as D, fix as E, fixAll as F, fixFeedback as G, qaFixes as H, triage as I, retry as J, sendBack as K, learnGateOffer as L, postSetup as M, setupView as a, startLearnRepos as b, closeHubLink as c, dialHubAgain as d, answerLearnPost as e, followLearn as f, startLearnPost as g, hubStatus as h, answerReturn as i, answerApproveAll as j, keepHeld as k, learnAsking as l, moveTo as m, answerApprove as n, learnReposOffer as o, hubProjectsChanged as p, setupFor as q, readHeldNow as r, startHubLink as s, sendToHub as t, resumeSync as u, redialHub as v, withAfterLearn as w, hubLastSent as x, markSetup as y, minimize as z };
|
|
1532
|
+
//# sourceMappingURL=hub-link.js-B5kjLyyd.js.map
|