fnloom 0.2.0 → 0.3.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/README.md +102 -5
- package/package.json +12 -11
- package/packages/build/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +2 -1
- package/packages/cli/src/command.ts +2 -0
- package/packages/cli/src/commands/install.ts +103 -7
- package/packages/cli/src/commands/manage.ts +7 -5
- package/packages/cli/src/commands/store.ts +172 -0
- package/packages/cli/src/hub.ts +26 -7
- package/packages/cli/src/io.ts +1 -0
- package/packages/cli/src/testing.ts +2 -1
- package/packages/core/package.json +4 -4
- package/packages/core/src/context-files.ts +3 -1
- package/packages/core/src/context-graph.ts +4 -0
- package/packages/core/src/context-plan.ts +451 -0
- package/packages/core/src/context-questions.ts +305 -0
- package/packages/core/src/fn-facts.ts +32 -4
- package/packages/core/src/identity.ts +1 -1
- package/packages/core/src/index.ts +4 -1
- package/packages/core/src/link.ts +70 -0
- package/packages/core/src/manifest.ts +20 -1
- package/packages/core/src/model-calls.ts +11 -2
- package/packages/core/src/package.ts +10 -0
- package/packages/core/src/query.ts +3 -2
- package/packages/core/src/records/content.ts +10 -2
- package/packages/core/src/records/runs.ts +12 -0
- package/packages/core/src/records/systems.ts +87 -5
- package/packages/core/src/run.ts +5 -0
- package/packages/core/src/stores.ts +473 -0
- package/packages/core/src/suggestions.ts +3 -0
- package/packages/core/src/system-pages.ts +14 -1
- package/packages/core/src/web.ts +114 -9
- package/packages/hub/package.json +13 -12
- package/packages/hub/src/access/hits.ts +1 -1
- package/packages/hub/src/api/admin-ops.ts +36 -4
- package/packages/hub/src/api/auth.ts +8 -4
- package/packages/hub/src/api/person-ops.ts +6 -0
- package/packages/hub/src/api/store-ops.ts +54 -0
- package/packages/hub/src/api/testing/rig.ts +2 -2
- package/packages/hub/src/api/tls.ts +2 -2
- package/packages/hub/src/api/web/build5.ts +2 -1
- package/packages/hub/src/api/web/context-plans.ts +25 -0
- package/packages/hub/src/api/web/context-review.ts +43 -0
- package/packages/hub/src/api/web/index.ts +4 -0
- package/packages/hub/src/api/web/pages.ts +14 -1
- package/packages/hub/src/api/web/review.ts +16 -0
- package/packages/hub/src/api/web/systems.ts +14 -2
- package/packages/hub/src/boot/admin-fns.ts +8 -0
- package/packages/hub/src/boot/admin-secrets.ts +10 -4
- package/packages/hub/src/boot/env.ts +6 -1
- package/packages/hub/src/boot/hub-fns.ts +3 -3
- package/packages/hub/src/boot/hub-groups.ts +2 -2
- package/packages/hub/src/boot/identity.ts +1 -1
- package/packages/hub/src/boot/index.ts +9 -0
- package/packages/hub/src/boot/modules.ts +12 -3
- package/packages/hub/src/boot/person-fns.ts +5 -0
- package/packages/hub/src/boot/plan-fns.ts +39 -0
- package/packages/hub/src/boot/start.ts +2 -1
- package/packages/hub/src/catalog/catalog.ts +44 -14
- package/packages/hub/src/catalog/index.ts +6 -2
- package/packages/hub/src/chat/testing.ts +2 -2
- package/packages/hub/src/contextor/brought.ts +5 -3
- package/packages/hub/src/contextor/testing.ts +4 -4
- package/packages/hub/src/execution/create.ts +2 -0
- package/packages/hub/src/execution/env.ts +2 -0
- package/packages/hub/src/execution/errors.ts +12 -0
- package/packages/hub/src/execution/executors.ts +14 -2
- package/packages/hub/src/execution/index.ts +8 -0
- package/packages/hub/src/execution/link-handlers.ts +16 -4
- package/packages/hub/src/execution/runs.ts +212 -11
- package/packages/hub/src/execution/testing.ts +2 -1
- package/packages/hub/src/fns/search.ts +23 -4
- package/packages/hub/src/graph/graph.ts +2 -2
- package/packages/hub/src/index/index.ts +9 -2
- package/packages/hub/src/index/indexer.ts +67 -16
- package/packages/hub/src/index/search.ts +1 -0
- package/packages/hub/src/index/suggester.ts +2 -2
- package/packages/hub/src/link/build.ts +47 -10
- package/packages/hub/src/link/connections.ts +41 -3
- package/packages/hub/src/link/describer.ts +19 -2
- package/packages/hub/src/link/env.ts +10 -0
- package/packages/hub/src/link/handlers.ts +6 -0
- package/packages/hub/src/link/index.ts +16 -4
- package/packages/hub/src/link/lifecycle.ts +11 -4
- package/packages/hub/src/link/packages.ts +17 -4
- package/packages/hub/src/link/pairing.ts +2 -2
- package/packages/hub/src/link/process.ts +10 -4
- package/packages/hub/src/link/rig.ts +6 -2
- package/packages/hub/src/link/status.ts +14 -0
- package/packages/hub/src/link/supervisor.ts +17 -1
- package/packages/hub/src/link/systems.ts +16 -5
- package/packages/hub/src/models/roles.ts +74 -7
- package/packages/hub/src/query/columns.ts +4 -1
- package/packages/hub/src/query/contexts.ts +10 -3
- package/packages/hub/src/questions/apply.ts +163 -0
- package/packages/hub/src/questions/carry.ts +30 -0
- package/packages/hub/src/questions/duplicates.ts +181 -0
- package/packages/hub/src/questions/index.ts +112 -0
- package/packages/hub/src/questions/metadata.ts +142 -0
- package/packages/hub/src/questions/pending.ts +64 -0
- package/packages/hub/src/questions/plan-match.ts +79 -0
- package/packages/hub/src/questions/plan-prompts.ts +110 -0
- package/packages/hub/src/questions/planner.ts +382 -0
- package/packages/hub/src/questions/plans.ts +353 -0
- package/packages/hub/src/questions/review.ts +253 -0
- package/packages/hub/src/questions/setting.ts +50 -0
- package/packages/hub/src/questions/testing.ts +131 -0
- package/packages/hub/src/questions/worker.ts +182 -0
- package/packages/hub/src/resources/context.ts +58 -20
- package/packages/hub/src/resources/create.ts +16 -4
- package/packages/hub/src/resources/env.ts +4 -0
- package/packages/hub/src/resources/fns.ts +6 -2
- package/packages/hub/src/resources/index.ts +8 -2
- package/packages/hub/src/resources/testing.ts +18 -2
- package/packages/hub/src/store/codec.ts +23 -5
- package/packages/hub/src/store/context-status.ts +56 -0
- package/packages/hub/src/store/derived.ts +53 -0
- package/packages/hub/src/store/hybrid.ts +33 -6
- package/packages/hub/src/store/lists.ts +2 -1
- package/packages/hub/src/store/migrate-fn-names.ts +5 -2
- package/packages/hub/src/store/rows.ts +8 -1
- package/packages/hub/src/store/schema.ts +2 -1
- package/packages/hub/src/store/sqlite.ts +2 -1
- package/packages/hub/src/stores/backups.ts +163 -0
- package/packages/hub/src/stores/drivers.ts +100 -0
- package/packages/hub/src/stores/guard.ts +116 -0
- package/packages/hub/src/stores/host.ts +459 -0
- package/packages/hub/src/stores/moves.ts +380 -0
- package/packages/hub/src/stores/plugin.ts +42 -0
- package/packages/hub/src/stores/service.ts +340 -0
- package/packages/hub/src/stores/testing.ts +149 -0
- package/packages/sdk/AUTHORING.md +1813 -218
- package/packages/sdk/package.json +12 -8
- package/packages/sdk/src/build.ts +3 -0
- package/packages/sdk/src/client.ts +22 -0
- package/packages/sdk/src/ctx.ts +51 -17
- package/packages/sdk/src/declare.ts +36 -12
- package/packages/sdk/src/hub.ts +222 -10
- package/packages/sdk/src/impl.ts +3 -3
- package/packages/sdk/src/index.ts +6 -3
- package/packages/sdk/src/manifest.ts +5 -0
- package/packages/sdk/src/providers.ts +2 -2
- package/packages/sdk/src/server/asks.ts +12 -1
- package/packages/sdk/src/server/env.ts +13 -1
- package/packages/sdk/src/server/host.ts +81 -10
- package/packages/sdk/src/server/index.ts +21 -2
- package/packages/sdk/src/server/package.ts +11 -2
- package/packages/sdk/src/server/run.ts +6 -1
- package/packages/sdk/src/server/runtime.ts +78 -22
- package/packages/sdk/src/server/start-gate.ts +174 -0
- package/packages/sdk/src/server/store/checksum.ts +162 -0
- package/packages/sdk/src/server/store/engines.ts +400 -0
- package/packages/sdk/src/server/store/extend.ts +25 -0
- package/packages/sdk/src/server/store/keeper.ts +392 -0
- package/packages/sdk/src/server/store/link-driver.ts +142 -0
- package/packages/sdk/src/server/store/measure.ts +45 -0
- package/packages/sdk/src/server/store/migrations.ts +238 -0
- package/packages/sdk/src/server/store/move.ts +488 -0
- package/packages/sdk/src/server/store/portable.ts +288 -0
- package/packages/sdk/src/server/store/stable.ts +146 -0
- package/packages/sdk/src/server/store/tables.ts +28 -0
- package/packages/sdk/src/server/store/vectors.ts +185 -0
- package/packages/sdk/src/server/store/work-checks.ts +288 -0
- package/packages/sdk/src/server/store/work.ts +369 -0
- package/packages/sdk/src/server/table.ts +3 -1
- package/packages/sdk/src/server/testing.ts +116 -3
- package/packages/sdk/src/store.ts +91 -0
- package/packages/sdk/src/system.ts +58 -30
- package/packages/sdk/src/testing/hub.ts +18 -5
- package/packages/web/dist/assets/{ActorSettingsView-BuMYRDqv.js → ActorSettingsView-v2k7v454.js} +2 -2
- package/packages/web/dist/assets/{AdminLayout-sLjVTrmV.js → AdminLayout-B6Jrc_4W.js} +2 -2
- package/packages/web/dist/assets/{ApiServiceForm-BrMTU-7u.js → ApiServiceForm-CuuQgOJc.js} +2 -2
- package/packages/web/dist/assets/{ApiServiceView-BMF2zD6Q.js → ApiServiceView-7bTHSO_Z.js} +2 -2
- package/packages/web/dist/assets/{ApiServicesView-bjLAWO_j.js → ApiServicesView-BXi24n49.js} +2 -2
- package/packages/web/dist/assets/{AppPage-DSzDKCFz.js → AppPage-CFmKZS8G.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-nV38ALjl.js → AutoPairPicker-C61gihmh.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Bic7U7jN.js → BrowserFrame-Sq9EmQRT.js} +2 -2
- package/packages/web/dist/assets/{ChartVisual-DWw7WsfN.js → ChartVisual-C4mgw4wh.js} +4 -4
- package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +4 -0
- package/packages/web/dist/assets/{CodeViewer-xHS3Xah9.js → CodeViewer-tUNXZB77.js} +2 -2
- package/packages/web/dist/assets/{ConfigWithCustom-DreTUdf0.js → ConfigWithCustom-D_-rY66L.js} +3 -3
- package/packages/web/dist/assets/{ConfirmDialog-DjQUzNqk.js → ConfirmDialog-Dd3E4sJt.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CfRDrXvJ.js → ConnectPage-CX9acyQH.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-Cv4G0k_o.css +1 -0
- package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +2 -0
- package/packages/web/dist/assets/ContextPage-C8u0UnYl.css +1 -0
- package/packages/web/dist/assets/ContextPage-CtefzyKg.js +3 -0
- package/packages/web/dist/assets/ContextRow-Chx99Xac.css +1 -0
- package/packages/web/dist/assets/ContextRow-DrtPumZ5.js +2 -0
- package/packages/web/dist/assets/{DataPage-wSIoGcb5.js → DataPage-DDSsxHro.js} +2 -2
- package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +2 -0
- package/packages/web/dist/assets/{DesignPage-DidMUX8m.js → DesignPage-6e0XbOFC.js} +2 -2
- package/packages/web/dist/assets/{ExplorePage-MUyVydVB.js → ExplorePage-B7ND0W0l.js} +2 -2
- package/packages/web/dist/assets/{FnList-CjQRwYaT.js → FnList-Bx6H-kux.js} +2 -2
- package/packages/web/dist/assets/{FnPill-BshAvm2I.js → FnPill-Cp3KuLmP.js} +2 -2
- package/packages/web/dist/assets/FnView-C0XZdnsS.js +2 -0
- package/packages/web/dist/assets/{FnsView-CeqIoaBT.js → FnsView-GTH3p7a0.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DYVUwZrd.js → GinExprView-DGxns6lH.js} +2 -2
- package/packages/web/dist/assets/{GinForm-D3mwMRTQ.js → GinForm-BDBUzuDP.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-C0YifSmE.js → GinTypeView-CUsymbVf.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-HfEPq9le.js → GinValueView-jsKIfiEA.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-ySnuA4Hp.js → GraphPage-BCcPPsHu.js} +2 -2
- package/packages/web/dist/assets/{GraphPanel-Cy5-KGo1.js → GraphPanel-9tztGHmu.js} +2 -2
- package/packages/web/dist/assets/{HubPicker-C_vA752L.js → HubPicker-EoOErgmk.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-DcPCCmZ5.js → InboxApprovals-Dkq7DFp_.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-C2DT2nuF.js → InboxPage-CHhslePq.js} +2 -2
- package/packages/web/dist/assets/{InjectedList-CJsEFEbz.js → InjectedList-CSWqRiON.js} +2 -2
- package/packages/web/dist/assets/InstallDialog-D-VwfZYF.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-yWLZK_zN.css → InstallDialog-K-j0sdHm.css} +1 -1
- package/packages/web/dist/assets/InstanceTypes-CwVSAULg.css +1 -0
- package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +2 -0
- package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +2 -0
- package/packages/web/dist/assets/InstanceView-_9uE70tS.css +1 -0
- package/packages/web/dist/assets/{ItemHistory-CUGa8b6s.js → ItemHistory-NQAP69ma.js} +2 -2
- package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +2 -0
- package/packages/web/dist/assets/ListSearch-BunVrDO0.js +2 -0
- package/packages/web/dist/assets/{LlmCallDetails-2yQftCqd.js → LlmCallDetails-BoVNDTVs.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-DOHX3r0K.js → LlmCallsView-BGpV92RC.js} +2 -2
- package/packages/web/dist/assets/{LoadState-DeXfLvYv.js → LoadState-h-K9bTYc.js} +2 -2
- package/packages/web/dist/assets/{McpDialog-CA_0WKWF.js → McpDialog-DhOCk6_E.js} +2 -2
- package/packages/web/dist/assets/{McpServerForm-CAG8Wp2N.js → McpServerForm-Cor3fI7s.js} +2 -2
- package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +2 -0
- package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +2 -0
- package/packages/web/dist/assets/{McpView-CC2oNOMa.js → McpView-GPXdCMne.js} +2 -2
- package/packages/web/dist/assets/{McpsView-CwJvyyxV.js → McpsView-DJIR2JX5.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-Dbvh5uLq.js → MemoryDialog-BTeIHQyA.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-RvnW3EBP.js → ModelCallsView-DMcnwF2S.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-DcjwQFHC.js → ModelPicker-CgkMFxSO.js} +2 -2
- package/packages/web/dist/assets/ModelsView-cMHygeiK.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-CeSwzTV-.js → NotFoundPage-Tk92K7HN.js} +2 -2
- package/packages/web/dist/assets/PairPage-D0BK8CCw.js +2 -0
- package/packages/web/dist/assets/PairPage-D_aPS1Ot.css +1 -0
- package/packages/web/dist/assets/{PanelHost-BkrFAnPa.js → PanelHost-C-gKrxAk.js} +2 -2
- package/packages/web/dist/assets/{PeopleView-D1QGPYp7.js → PeopleView-DRfeNWK5.js} +2 -2
- package/packages/web/dist/assets/PoliciesView-BRi-QAuo.js +2 -0
- package/packages/web/dist/assets/{RefusalList-DQoyUoPG.js → RefusalList-DVO0bmeB.js} +2 -2
- package/packages/web/dist/assets/{RemoteAuthFields-nxGWfmhf.js → RemoteAuthFields-CgiufuqQ.js} +2 -2
- package/packages/web/dist/assets/{ResourceViewer-Po24y4pj.js → ResourceViewer-Do0chYxU.js} +2 -2
- package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +2 -0
- package/packages/web/dist/assets/{ResultGrid-uoq4yUYj.js → ResultGrid-Bj-0I5HY.js} +2 -2
- package/packages/web/dist/assets/{ReviewSummaryStrip-k3HevESg.js → ReviewSummaryStrip-DO3p64Qj.js} +2 -2
- package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +3 -0
- package/packages/web/dist/assets/{RuleRow-CoXDA-SH.js → RuleRow-DX9v4iGP.js} +2 -2
- package/packages/web/dist/assets/{RunCard-CBSGdwdQ.js → RunCard-BnrtK2Yp.js} +2 -2
- package/packages/web/dist/assets/{RunDetails-CGhQQ6OI.js → RunDetails-DjR206q6.js} +2 -2
- package/packages/web/dist/assets/{RunDot-Ch_45985.js → RunDot-lHRICdM5.js} +2 -2
- package/packages/web/dist/assets/{RunPage-C_t20pB7.js → RunPage-CbAQ_WPR.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-VrZUHUEC.js → RunProgress-C3-B4tQf.js} +2 -2
- package/packages/web/dist/assets/RunsView-DMkPmkqX.js +2 -0
- package/packages/web/dist/assets/ServiceRows-4WythFpF.js +2 -0
- package/packages/web/dist/assets/{ServiceRows-6BU4-MeL.css → ServiceRows-HPQ0pN6b.css} +1 -1
- package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +3 -0
- package/packages/web/dist/assets/{SignInPage-DrXZ1sG2.js → SignInPage-ByqGEZfj.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-Dpb9uG5e.js → StatusBadge-CXne0sRZ.js} +2 -2
- package/packages/web/dist/assets/StorePlacementStep-B6SwTmdM.js +2 -0
- package/packages/web/dist/assets/StorePlacementStep-D_G4e3ue.css +1 -0
- package/packages/web/dist/assets/{SystemConfig-72qKRkUk.js → SystemConfig-vQDL_eUl.js} +2 -2
- package/packages/web/dist/assets/{SystemPageHost-DLNg2FYK.js → SystemPageHost-DrMrEPyh.js} +2 -2
- package/packages/web/dist/assets/SystemView-Be6TBM4j.js +2 -0
- package/packages/web/dist/assets/{SystemView-C8ScHUe2.css → SystemView-_9q6eDfV.css} +1 -1
- package/packages/web/dist/assets/{SystemsView-B6HEL9VS.css → SystemsView-CWKnupLW.css} +1 -1
- package/packages/web/dist/assets/SystemsView-DZtT3laz.js +2 -0
- package/packages/web/dist/assets/{TableViewer-BQ7bYLOP.js → TableViewer-Boxx86f5.js} +3 -3
- package/packages/web/dist/assets/{ThemePicker-C2nJ21Vd.js → ThemePicker-CIg_oRQX.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-CORdfTHj.js → TurnTree-Ecm0yA5g.js} +2 -2
- package/packages/web/dist/assets/UserMessage-BlnqZDVU.js +9 -0
- package/packages/web/dist/assets/{ValueVisual-aXEUaQ5Y.js → ValueVisual-C-MWpp7c.js} +2 -2
- package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +3 -0
- package/packages/web/dist/assets/actor-names-OdvpVZeb.js +4 -0
- package/packages/web/dist/assets/{fn-modal-DqcxUhOQ.js → fn-modal-B98MR7JN.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-BYaH6IoA.js → fn-notices-CfTa1E8y.js} +2 -2
- package/packages/web/dist/assets/{formats-DI__ADVG.js → formats-JwoKfXIq.js} +2 -2
- package/packages/web/dist/assets/index-6ScWTFy2.js +4 -0
- package/packages/web/dist/assets/{index-CSisx5mi.css → index-CEslGcrX.css} +1 -1
- package/packages/web/dist/assets/{labels-BhJpmLWA.js → labels-BFbk11BE.js} +2 -2
- package/packages/web/dist/assets/{layout-DQKldU13.js → layout-D1gf481r.js} +2 -2
- package/packages/web/dist/assets/{metrics-Cio5ykX6.js → metrics-CBPX3W5Y.js} +2 -2
- package/packages/web/dist/assets/{problems-BZY0Dwif.js → problems-t1E_ovSz.js} +2 -2
- package/packages/web/dist/assets/{push-payload-D5efGCzd.js → push-payload-BeU1ADYt.js} +64 -64
- package/packages/web/dist/assets/{record-edits-CveFEsal.js → record-edits-Bfsi4lU3.js} +2 -2
- package/packages/web/dist/assets/{remote-config-BkaarDf3.js → remote-config-BNQhSDzB.js} +2 -2
- package/packages/web/dist/assets/{review-CGUGvRV9.js → review-fP-l9D6H.js} +3 -3
- package/packages/web/dist/assets/routes-DV4IJpwe.js +4 -0
- package/packages/web/dist/assets/runs-CveC2kKo.js +2 -0
- package/packages/web/dist/assets/{shared-DTpYDMc_.js → shared-LbaIHjbV.js} +2 -2
- package/packages/web/dist/assets/{size-BwnshyOe.js → size-Bh__w5aI.js} +2 -2
- package/packages/web/dist/assets/{sources-Bm-TrxhL.js → sources-VPrtgLIi.js} +2 -2
- package/packages/web/dist/assets/src-CT3TeFaM.js +43 -0
- package/packages/web/dist/assets/state-xfQqaQPX.js +2 -0
- package/packages/web/dist/assets/{systems-DIp94AET.js → systems-BqE3WTSF.js} +2 -2
- package/packages/web/dist/assets/ui-BzgWquIU.js +17 -0
- package/packages/web/dist/assets/{ui-C7ZH_6oC.css → ui-DycHjPTZ.css} +1 -1
- package/packages/web/dist/assets/{url-BIg5IhGs.js → url-DKGcECT1.js} +2 -2
- package/packages/web/dist/assets/{widget-host-BCf6Tlt5.js → widget-host-B87MTaTn.js} +2 -2
- package/packages/web/dist/assets/{widgets-CrbkovMT.js → widgets-BBCuSS6E.js} +2 -2
- package/packages/web/dist/index.html +44 -44
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/package.json +2 -2
- package/premade/claude.zip +0 -0
- package/premade/database.zip +0 -0
- package/premade/web.zip +0 -0
- package/scripts/run-stack.ts +3 -2
- package/scripts/stack.ts +73 -16
- package/scripts/start.ts +11 -2
- package/systems/api/package.json +3 -3
- package/systems/code/package.json +3 -3
- package/systems/embedder/package.json +1 -1
- package/systems/fs/client/fakes.ts +2 -0
- package/systems/fs/client/index.ts +4 -2
- package/systems/fs/client/machines/CoreHeatmap.vue +94 -0
- package/systems/fs/client/machines/MachineFiles.vue +121 -0
- package/systems/fs/client/machines/MachineMetrics.vue +330 -0
- package/systems/fs/client/machines/MachinesPage.vue +119 -0
- package/systems/fs/client/machines/TimeChart.vue +128 -0
- package/systems/fs/client/machines/fakes.ts +95 -0
- package/systems/fs/client/machines/files/ChangesPane.vue +90 -0
- package/systems/fs/client/machines/files/CodeView.vue +158 -0
- package/systems/fs/client/machines/files/CommentComposer.vue +86 -0
- package/systems/fs/client/machines/files/CommentThread.vue +115 -0
- package/systems/fs/client/machines/files/CommitPane.vue +80 -0
- package/systems/fs/client/machines/files/ComparePane.vue +81 -0
- package/systems/fs/client/machines/files/FileHistory.vue +89 -0
- package/systems/fs/client/machines/files/FilePane.vue +199 -0
- package/systems/fs/client/machines/files/FileTree.vue +26 -0
- package/systems/fs/client/machines/files/FolderPane.vue +154 -0
- package/systems/fs/client/machines/files/HistoryPane.vue +106 -0
- package/systems/fs/client/machines/files/ImageView.vue +160 -0
- package/systems/fs/client/machines/files/PatchView.vue +31 -0
- package/systems/fs/client/machines/files/QuickOpen.vue +67 -0
- package/systems/fs/client/machines/files/SearchPane.vue +87 -0
- package/systems/fs/client/machines/files/TreeNode.vue +72 -0
- package/systems/fs/client/machines/files/api.ts +127 -0
- package/systems/fs/client/machines/files/fake-kinds.ts +16 -0
- package/systems/fs/client/machines/files/fakes.ts +305 -0
- package/systems/fs/client/machines/files/ink.ts +117 -0
- package/systems/fs/client/machines/files/logic.ts +205 -0
- package/systems/fs/client/machines/files/state.ts +187 -0
- package/systems/fs/client/machines/files/viewers/CsvView.vue +29 -0
- package/systems/fs/client/machines/files/viewers/HexView.vue +27 -0
- package/systems/fs/client/machines/files/viewers/HtmlView.vue +17 -0
- package/systems/fs/client/machines/files/viewers/JsonNode.vue +45 -0
- package/systems/fs/client/machines/files/viewers/JsonView.vue +25 -0
- package/systems/fs/client/machines/metrics.ts +245 -0
- package/systems/fs/client/machines/palette.ts +97 -0
- package/systems/fs/client/preview/machines.ts +323 -0
- package/systems/fs/context/authoring/index.md +4 -0
- package/systems/fs/context/authoring/parts/actions.md +5 -1
- package/systems/fs/context/authoring/parts/actions.reference.md +6 -2
- package/systems/fs/context/authoring/parts/calling.md +5 -1
- package/systems/fs/context/authoring/parts/calling.reference.md +4 -0
- package/systems/fs/context/authoring/parts/client.md +9 -1
- package/systems/fs/context/authoring/parts/client.reference/client.md +4 -0
- package/systems/fs/context/authoring/parts/client.reference/resultview.md +56 -53
- package/systems/fs/context/authoring/parts/client.reference/{fnpillprops.md → textareaprops.md} +58 -4
- package/systems/fs/context/authoring/parts/client.reference.md +8 -4
- package/systems/fs/context/authoring/parts/context/questions.md +49 -0
- package/systems/fs/context/authoring/parts/context.md +23 -1
- package/systems/fs/context/authoring/parts/context.reference.md +27 -3
- package/systems/fs/context/authoring/parts/contract.md +10 -0
- package/systems/fs/context/authoring/parts/contract.reference.md +26 -9
- package/systems/fs/context/authoring/parts/core-types/access-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/admin-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +11 -7
- package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/checks-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/claims-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/connections-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +8 -0
- package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/context-questions-ts.md +26 -0
- package/systems/fs/context/authoring/parts/core-types/contextdecl.md +9 -1
- package/systems/fs/context/authoring/parts/core-types/data-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +11 -0
- package/systems/fs/context/authoring/parts/core-types/gin-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/grants-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +18 -5
- package/systems/fs/context/authoring/parts/core-types/link-ts.md +7 -3
- package/systems/fs/context/authoring/parts/core-types/llm-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/manifest.md +15 -2
- package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +9 -1
- package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/modes-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/package-ts.md +9 -0
- package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/query-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +7 -3
- package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/registries-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/resources-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/run-ts.md +7 -0
- package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/stores-ts.md +199 -0
- package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +8 -1
- package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/validation-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/web-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types.md +12 -2
- package/systems/fs/context/authoring/parts/ctx/update-result.md +33 -0
- package/systems/fs/context/authoring/parts/ctx.md +11 -1
- package/systems/fs/context/authoring/parts/ctx.reference/{hubai.md → adminnotices.md} +45 -4
- package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +21 -23
- package/systems/fs/context/authoring/parts/ctx.reference.md +8 -4
- package/systems/fs/context/authoring/parts/data.md +11 -6
- package/systems/fs/context/authoring/parts/data.reference.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/package-json.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-env-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +10 -0
- package/systems/fs/context/authoring/parts/examples/system-json.md +4 -0
- package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-1-189.md → systems-fs-shared-index-ts-lines-1-178.md} +23 -30
- package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-190-370.md → systems-fs-shared-index-ts-lines-179-382.md} +33 -6
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-383-567.md +210 -0
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +117 -0
- package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +5 -1
- package/systems/fs/context/authoring/parts/examples.md +18 -11
- package/systems/fs/context/authoring/parts/fns.md +5 -1
- package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +5 -1
- package/systems/fs/context/authoring/parts/fns.reference/fn.md +6 -2
- package/systems/fs/context/authoring/parts/fns.reference.md +4 -0
- package/systems/fs/context/authoring/parts/folder.md +4 -0
- package/systems/fs/context/authoring/parts/gin.md +4 -0
- package/systems/fs/context/authoring/parts/gin.reference.md +4 -0
- package/systems/fs/context/authoring/parts/handlers-progress.md +5 -1
- package/systems/fs/context/authoring/parts/handlers-progress.reference.md +4 -0
- package/systems/fs/context/authoring/parts/hooks.md +5 -1
- package/systems/fs/context/authoring/parts/hooks.reference.md +5 -1
- package/systems/fs/context/authoring/parts/hub/context-questions.md +40 -0
- package/systems/fs/context/authoring/parts/hub/{hub-run-background.md → hub-ctx-from-resource.md} +51 -56
- package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +35 -42
- package/systems/fs/context/authoring/parts/hub/hub-install-package.md +327 -0
- package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +8 -0
- package/systems/fs/context/authoring/parts/hub.md +14 -8
- package/systems/fs/context/authoring/parts/hub.reference.md +9 -0
- package/systems/fs/context/authoring/parts/internals/manifestof.md +4 -0
- package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -0
- package/systems/fs/context/authoring/parts/internals/usagefromwire.md +47 -2
- package/systems/fs/context/authoring/parts/internals.md +6 -2
- package/systems/fs/context/authoring/parts/kinds-agents.md +5 -1
- package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +4 -0
- package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +7 -3
- package/systems/fs/context/authoring/parts/kinds-agents.reference.md +4 -0
- package/systems/fs/context/authoring/parts/lifecycle.md +8 -3
- package/systems/fs/context/authoring/parts/lifecycle.reference.md +6 -2
- package/systems/fs/context/authoring/parts/mentions.md +5 -1
- package/systems/fs/context/authoring/parts/mentions.reference.md +6 -2
- package/systems/fs/context/authoring/parts/mistakes.md +7 -2
- package/systems/fs/context/authoring/parts/named-types.md +4 -0
- package/systems/fs/context/authoring/parts/named-types.reference.md +6 -2
- package/systems/fs/context/authoring/parts/outcomes.md +5 -1
- package/systems/fs/context/authoring/parts/outcomes.reference.md +4 -0
- package/systems/fs/context/authoring/parts/owner-runs.md +5 -1
- package/systems/fs/context/authoring/parts/owner-runs.reference.md +36 -11
- package/systems/fs/context/authoring/parts/packaging.md +10 -3
- package/systems/fs/context/authoring/parts/packaging.reference.md +7 -2
- package/systems/fs/context/authoring/parts/providers.md +5 -1
- package/systems/fs/context/authoring/parts/providers.reference.md +5 -1
- package/systems/fs/context/authoring/parts/remote.md +5 -1
- package/systems/fs/context/authoring/parts/remote.reference.md +4 -0
- package/systems/fs/context/authoring/parts/resources.md +5 -1
- package/systems/fs/context/authoring/parts/resources.reference.md +4 -0
- package/systems/fs/context/authoring/parts/server.md +5 -1
- package/systems/fs/context/authoring/parts/server.reference.md +41 -20
- package/systems/fs/context/authoring/parts/settings-attachments.md +5 -1
- package/systems/fs/context/authoring/parts/settings-attachments.reference.md +4 -0
- package/systems/fs/context/authoring/parts/start.md +5 -1
- package/systems/fs/context/authoring/parts/state-forms.md +5 -1
- package/systems/fs/context/authoring/parts/state-forms.reference.md +4 -0
- package/systems/fs/context/authoring/parts/store/ctx-store.md +49 -0
- package/systems/fs/context/authoring/parts/store/declare.md +32 -0
- package/systems/fs/context/authoring/parts/store/engines.md +25 -0
- package/systems/fs/context/authoring/parts/store/migrations.md +53 -0
- package/systems/fs/context/authoring/parts/store/moves.md +38 -0
- package/systems/fs/context/authoring/parts/store/placement.md +25 -0
- package/systems/fs/context/authoring/parts/store/serve.md +30 -0
- package/systems/fs/context/authoring/parts/store/store-tables.md +24 -0
- package/systems/fs/context/authoring/parts/store/vectors.md +32 -0
- package/systems/fs/context/authoring/parts/store/when-to-use.md +27 -0
- package/systems/fs/context/authoring/parts/store/work.md +37 -0
- package/systems/fs/context/authoring/parts/store.md +65 -0
- package/systems/fs/context/authoring/parts/store.reference.md +459 -0
- package/systems/fs/context/authoring/parts/testing.md +14 -1
- package/systems/fs/context/authoring/parts/testing.reference/{memoryjournal.md → equal.md} +55 -48
- package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +26 -45
- package/systems/fs/context/authoring/parts/testing.reference/{toolcall.md → kindprops.md} +111 -4
- package/systems/fs/context/authoring/parts/testing.reference/openmemorystore.md +105 -0
- package/systems/fs/context/authoring/parts/testing.reference.md +16 -9
- package/systems/fs/context/authoring/parts/widgets.md +5 -1
- package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +4 -0
- package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +4 -0
- package/systems/fs/context/authoring/parts/widgets.reference.md +4 -0
- package/systems/fs/context/authoring/topics/begin.md +4 -0
- package/systems/fs/context/authoring/topics/client.md +4 -0
- package/systems/fs/context/authoring/topics/declare.md +4 -0
- package/systems/fs/context/authoring/topics/examples.md +4 -0
- package/systems/fs/context/authoring/topics/fns.md +4 -0
- package/systems/fs/context/authoring/topics/server.md +4 -0
- package/systems/fs/context/authoring/topics/types.md +8 -1
- package/systems/fs/context/comments/answer.md +21 -0
- package/systems/fs/context/comments/find.md +23 -0
- package/systems/fs/context/comments/read.md +26 -0
- package/systems/fs/context/comments.md +23 -0
- package/systems/fs/context/files-page.md +30 -0
- package/systems/fs/context/guide/attachments.md +16 -0
- package/systems/fs/context/guide/change.md +23 -0
- package/systems/fs/context/guide/commands.md +19 -0
- package/systems/fs/context/guide/documents.md +21 -0
- package/systems/fs/context/guide/find.md +25 -0
- package/systems/fs/context/guide/paths.md +24 -0
- package/systems/fs/context/guide/read.md +21 -0
- package/systems/fs/context/machine/history.md +25 -0
- package/systems/fs/context/machine/now.md +25 -0
- package/systems/fs/context/machine/processes.md +20 -0
- package/systems/fs/context/machine/recording.md +19 -0
- package/systems/fs/context/machine.md +24 -0
- package/systems/fs/package.json +5 -3
- package/systems/fs/server/files-page/browse.ts +391 -0
- package/systems/fs/server/files-page/comments.ts +439 -0
- package/systems/fs/server/files-page/fns.ts +158 -0
- package/systems/fs/server/files-page/git-view.ts +391 -0
- package/systems/fs/server/files-page/kinds.ts +56 -0
- package/systems/fs/server/impl.ts +66 -7
- package/systems/fs/server/main.ts +20 -4
- package/systems/fs/server/metrics/collector.ts +424 -0
- package/systems/fs/server/metrics/index.ts +181 -0
- package/systems/fs/server/metrics/os.ts +144 -0
- package/systems/fs/server/metrics/parsers.ts +268 -0
- package/systems/fs/server/metrics/rrd.ts +363 -0
- package/systems/fs/server/metrics/testing.ts +80 -0
- package/systems/fs/server/snapshots.ts +216 -33
- package/systems/fs/server/testing.ts +15 -9
- package/systems/fs/shared/files-page.ts +506 -0
- package/systems/fs/shared/index.ts +137 -10
- package/systems/fs/shared/metrics.ts +179 -0
- package/systems/fs/system.json +10 -1
- package/systems/google-calendar/package.json +1 -1
- package/systems/input/package.json +3 -3
- package/systems/mcp/package.json +3 -3
- package/systems/mcp/server/oauth.ts +1 -1
- package/systems/ollama/package.json +3 -3
- package/systems/schedule/package.json +3 -4
- package/systems/schedule/server/env.ts +1 -1
- package/systems/schedule/server/fns.ts +5 -4
- package/systems/schedule/server/impl.ts +2 -2
- package/systems/schedule/server/import.ts +189 -0
- package/systems/schedule/server/index.ts +2 -0
- package/systems/schedule/server/main.ts +3 -1
- package/systems/schedule/server/placements.ts +41 -0
- package/systems/schedule/server/store.ts +159 -79
- package/systems/schedule/server/timer.ts +142 -107
- package/systems/schedule/shared/index.ts +2 -1
- package/systems/schedule/system.json +5 -1
- package/systems/schedule/tsconfig.json +1 -1
- package/systems/template/package.json +1 -1
- package/systems/widgets/package.json +3 -3
- package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +0 -4
- package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +0 -2
- package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +0 -1
- package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +0 -2
- package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +0 -1
- package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +0 -1
- package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +0 -2
- package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +0 -4
- package/packages/web/dist/assets/FnView-B8MGAOoB.js +0 -2
- package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +0 -1
- package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +0 -1
- package/packages/web/dist/assets/InstanceView-p7tMaylE.js +0 -2
- package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +0 -2
- package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +0 -2
- package/packages/web/dist/assets/McpServerView-CD8qw6W_.js +0 -2
- package/packages/web/dist/assets/McpServersView-DNycG35u.js +0 -2
- package/packages/web/dist/assets/ModelsView-C_iN19xt.js +0 -2
- package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +0 -1
- package/packages/web/dist/assets/PairPage-TEXPpsqi.js +0 -2
- package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +0 -2
- package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +0 -2
- package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +0 -3
- package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +0 -2
- package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +0 -2
- package/packages/web/dist/assets/SettingsPage-CykfuYj1.js +0 -3
- package/packages/web/dist/assets/SystemView-Es5wtkYU.js +0 -2
- package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +0 -2
- package/packages/web/dist/assets/UserMessage-qyc8dG5D.js +0 -9
- package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +0 -3
- package/packages/web/dist/assets/index-Bv42jNvr.js +0 -4
- package/packages/web/dist/assets/routes-qP_j74V5.js +0 -4
- package/packages/web/dist/assets/runs-k76usGfd.js +0 -2
- package/packages/web/dist/assets/src-DLK1P7oz.js +0 -43
- package/packages/web/dist/assets/state-CjE-qA2w.js +0 -2
- package/packages/web/dist/assets/ui-W12UYhVu.js +0 -17
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +0 -183
- package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +0 -189
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The schedule system's timer (docs/plans/schedule-system.md, "Durability across restarts", "When a firing happens",
|
|
3
|
-
* "What the owner is told"). It keeps each schedule's next firing on an `@ayepi/work` queue
|
|
4
|
-
*
|
|
5
|
-
* schedule fn as its owner with `ctx.runs.start` (key
|
|
3
|
+
* "What the owner is told"). It keeps each schedule's next firing on an `@ayepi/work` queue in the system's store
|
|
4
|
+
* (`storeWorkBackend` over `ctx.store`, wherever the admin put it; one delayed `due` item per schedule, at the planned
|
|
5
|
+
* instant) and, when one is due, starts the schedule fn as its owner with `ctx.runs.start` (key
|
|
6
|
+
* `schedule:<fn>@<instant>`, so a doubled start is the same run).
|
|
7
|
+
*
|
|
8
|
+
* - **Its store** opens before anything runs. On the first start with it, an older version's `schedule.db` in the data
|
|
9
|
+
* folder is brought into it (`import.ts`), so no schedule loses its place.
|
|
6
10
|
*
|
|
7
11
|
* - **Reconcile** at start and on `fns` events: every schedule fn from `ctx.runs.kindFns`, each one's next firing
|
|
8
12
|
* queued from the last instant it handled (so firings that fell due while the system was down come due at once).
|
|
@@ -21,12 +25,11 @@
|
|
|
21
25
|
* the waits for approval and a way to cancel its target, with no round trip.
|
|
22
26
|
*/
|
|
23
27
|
import { ApiError, DISCONNECTED_STATUS } from '@ayepi/core';
|
|
24
|
-
import { sqliteBackend } from '@ayepi/sqlite';
|
|
25
28
|
import { createWork, defineWork, WorkDelayError } from '@ayepi/work';
|
|
26
29
|
import { splitName, type Json, type QualifiedName, type RunId, type RunStatus, type SystemEvent } from '@harness/core';
|
|
27
30
|
import type { KindFn, SystemImpl } from '@harness/sdk';
|
|
28
31
|
import { kindRunLookups } from '@harness/sdk/program';
|
|
29
|
-
import {
|
|
32
|
+
import { storeWorkBackend } from '@harness/sdk/server';
|
|
30
33
|
import { resolve } from 'node:path';
|
|
31
34
|
import { limitsOf, schedule, type Limits, type ScheduleContract } from '../shared/index.ts';
|
|
32
35
|
import { FiringShape, SchedulePayload, type Fire, type FiringStatus, type PreviousFiring } from '../shared/types.ts';
|
|
@@ -34,10 +37,11 @@ import { clockWords, dayWords, firingsBetween, fromOccurrenceKey, nextFirings, o
|
|
|
34
37
|
import { localNow, localString, zonedTime } from '../shared/zoned.ts';
|
|
35
38
|
import { ArgsFailed, evaluateArgs } from './args.ts';
|
|
36
39
|
import type { ScheduleSettings } from './env.ts';
|
|
37
|
-
import {
|
|
40
|
+
import { importScheduleDb } from './import.ts';
|
|
41
|
+
import { TimerStore, type EndReason, type FiringRow, type ScheduleDb, type ScheduleRow, type ScheduleStore } from './store.ts';
|
|
38
42
|
import { spanWords, summaryLine, tells, titleOf, toneOf } from './summary.ts';
|
|
39
43
|
|
|
40
|
-
type Impl = SystemImpl<ScheduleContract['defs']>;
|
|
44
|
+
type Impl = SystemImpl<ScheduleContract['defs'], ScheduleDb>;
|
|
41
45
|
/** The system context the timer acts in (lifecycle, events). */
|
|
42
46
|
export type ScheduleCtx = Parameters<NonNullable<NonNullable<Impl['lifecycle']>['started']>>[0];
|
|
43
47
|
/** A schedule fn's run context. */
|
|
@@ -145,6 +149,8 @@ export class Timer {
|
|
|
145
149
|
readonly #chains = new Map<string, Promise<void>>();
|
|
146
150
|
/** When `kindFns` was last read whole or since. */
|
|
147
151
|
#syncedAt: number | undefined;
|
|
152
|
+
/** Items enqueued and not yet on the queue, by id: each one's wait ends when the engine says it is queued. */
|
|
153
|
+
readonly #landing = new Map<string, () => void>();
|
|
148
154
|
|
|
149
155
|
constructor(deps: TimerDeps) {
|
|
150
156
|
this.#settings = deps.settings;
|
|
@@ -173,8 +179,8 @@ export class Timer {
|
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
/** What the timer keeps of a schedule (its last firing that ran, for `previous`; how many ran), once started. */
|
|
176
|
-
row(fn: string): ScheduleRow | undefined {
|
|
177
|
-
return this.#store?.schedule(fn);
|
|
182
|
+
async row(fn: string): Promise<ScheduleRow | undefined> {
|
|
183
|
+
return await this.#store?.schedule(fn);
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
/** The config changed (or was first given): the limits follow it. */
|
|
@@ -185,8 +191,8 @@ export class Timer {
|
|
|
185
191
|
|
|
186
192
|
// ─── life ───────────────────────────────────────────────────────────────────
|
|
187
193
|
|
|
188
|
-
/** The queue
|
|
189
|
-
createQueue(store:
|
|
194
|
+
/** The queue in the store: `due` firings and `expire` waits for approval. */
|
|
195
|
+
createQueue(store: ScheduleStore) {
|
|
190
196
|
const due = defineWork('due', async (input: { fn: string; at: number }, ctx) => {
|
|
191
197
|
await this.#safely('due', () => this.#due(input.fn, input.at));
|
|
192
198
|
return ctx.void();
|
|
@@ -195,7 +201,7 @@ export class Timer {
|
|
|
195
201
|
await this.#safely('expire', () => this.#expire(input.id));
|
|
196
202
|
return ctx.void();
|
|
197
203
|
}, { retry: { attempts: 1 } });
|
|
198
|
-
const backend =
|
|
204
|
+
const backend = storeWorkBackend(store, { now: () => this.#clock.now() });
|
|
199
205
|
const work = createWork({
|
|
200
206
|
work: [due, expire] as const,
|
|
201
207
|
queue: backend.queue, store: backend.store, pubsub: backend.pubsub,
|
|
@@ -203,33 +209,59 @@ export class Timer {
|
|
|
203
209
|
pollInterval: this.#settings.SCHEDULE_POLL,
|
|
204
210
|
autoStart: false,
|
|
205
211
|
onError: (error, phase) => { this.#ctx?.log.warn('schedule.work', { phase, error: error instanceof Error ? error.message : String(error) }); },
|
|
212
|
+
onEvent: (event) => {
|
|
213
|
+
if (event.kind !== 'queued') { return; }
|
|
214
|
+
this.#landing.get(event.id)?.();
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
return { work, due, expire, backend };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Wait until an item just enqueued is on the queue. The engine writes it after its own bookkeeping in the store, and
|
|
222
|
+
* counts its delay from when it was enqueued, so waiting keeps the next step (and a clock a test moves) after the
|
|
223
|
+
* item is there at its planned time. Gives up waiting after `SCHEDULE_START_TIMEOUT` (the write failing is logged).
|
|
224
|
+
*/
|
|
225
|
+
#landed(id: string): Promise<void> {
|
|
226
|
+
return new Promise<void>((resolve) => {
|
|
227
|
+
const done = (): void => {
|
|
228
|
+
clearTimeout(timer);
|
|
229
|
+
this.#landing.delete(id);
|
|
230
|
+
resolve();
|
|
231
|
+
};
|
|
232
|
+
const timer = setTimeout(done, this.#settings.SCHEDULE_START_TIMEOUT);
|
|
233
|
+
this.#landing.set(id, done);
|
|
206
234
|
});
|
|
207
|
-
return { work, due, expire };
|
|
208
235
|
}
|
|
209
236
|
|
|
210
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Take up the store and queue, reconcile every schedule, and start the queue. Every (re)connect calls it. The first
|
|
239
|
+
* time (or when the store opened somewhere new, after a move) an older version's `schedule.db` is brought in first.
|
|
240
|
+
*/
|
|
211
241
|
async start(ctx: ScheduleCtx): Promise<void> {
|
|
212
242
|
this.configure(ctx);
|
|
213
|
-
if (this.#store
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
this.#
|
|
243
|
+
if (this.#store?.db !== ctx.store) {
|
|
244
|
+
await this.#stopQueue();
|
|
245
|
+
await importScheduleDb(ctx.store, resolve(ctx.dataDir, this.#settings.SCHEDULE_DB), { now: this.#clock.now(), log: ctx.log });
|
|
246
|
+
this.#store = new TimerStore(ctx.store);
|
|
247
|
+
this.#work = this.createQueue(ctx.store);
|
|
217
248
|
}
|
|
218
249
|
await this.reconcile(ctx);
|
|
219
250
|
this.#work?.work.start();
|
|
220
251
|
}
|
|
221
252
|
|
|
222
|
-
/**
|
|
223
|
-
|
|
224
|
-
this.#
|
|
253
|
+
/** Stop the queue and let the store go (the SDK keeps it, and closes it when the system stops). */
|
|
254
|
+
async stop(): Promise<void> {
|
|
255
|
+
await this.#stopQueue();
|
|
256
|
+
this.#store = undefined;
|
|
225
257
|
}
|
|
226
258
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
await this.#work?.work.stop();
|
|
259
|
+
async #stopQueue(): Promise<void> {
|
|
260
|
+
const work = this.#work;
|
|
230
261
|
this.#work = undefined;
|
|
231
|
-
|
|
232
|
-
|
|
262
|
+
if (work === undefined) { return; }
|
|
263
|
+
await work.work.stop();
|
|
264
|
+
work.backend.pubsub.close();
|
|
233
265
|
}
|
|
234
266
|
|
|
235
267
|
/** Every schedule fn read again, each one's next firing queued, and what the system missed while it was down. */
|
|
@@ -244,20 +276,20 @@ export class Timer {
|
|
|
244
276
|
for (const fn of listed) {
|
|
245
277
|
await this.#chain(fn.fn, () => this.#adopt(fn, ctx, false));
|
|
246
278
|
}
|
|
247
|
-
for (const row of store.schedules()) {
|
|
248
|
-
if (!this.#fns.has(row.fn)) { store.removeSchedule(row.fn); }
|
|
279
|
+
for (const row of await store.schedules()) {
|
|
280
|
+
if (!this.#fns.has(row.fn)) { await store.removeSchedule(row.fn); }
|
|
249
281
|
}
|
|
250
282
|
// firings still marked going with no run of theirs here: the hub may still restart them; past a while they're lost
|
|
251
|
-
for (const row of store.allActive()) {
|
|
283
|
+
for (const row of await store.allActive()) {
|
|
252
284
|
if (!this.#handles.has(row.id) && now - row.created > this.#settings.SCHEDULE_LOST_AFTER) {
|
|
253
285
|
await this.#chain(row.fn, () => this.#settle(row.id, { status: 'failed', reason: 'It was lost when the schedule system restarted.' }));
|
|
254
286
|
}
|
|
255
287
|
}
|
|
256
288
|
// settled firings whose telling wasn't decided (the system stopped between the record and the notice)
|
|
257
|
-
for (const row of store.untold()) {
|
|
289
|
+
for (const row of await store.untold()) {
|
|
258
290
|
await this.#chain(row.fn, () => this.#tell(row.id, false));
|
|
259
291
|
}
|
|
260
|
-
store.forgetBefore(now - KEEP_ROWS);
|
|
292
|
+
await store.forgetBefore(now - KEEP_ROWS);
|
|
261
293
|
}
|
|
262
294
|
|
|
263
295
|
/** Fns came, went or changed: the schedules among them are read again and planned again. */
|
|
@@ -265,7 +297,7 @@ export class Timer {
|
|
|
265
297
|
this.configure(ctx);
|
|
266
298
|
if (this.#store === undefined) { return; }
|
|
267
299
|
for (const name of event.removed) {
|
|
268
|
-
if (this.#fns.has(name)) { await this.#chain(name, () =>
|
|
300
|
+
if (this.#fns.has(name)) { await this.#chain(name, () => this.#forget(name)); }
|
|
269
301
|
}
|
|
270
302
|
const since = this.#syncedAt === undefined ? undefined : this.#syncedAt - SYNC_MARGIN;
|
|
271
303
|
const now = this.#clock.now();
|
|
@@ -273,7 +305,7 @@ export class Timer {
|
|
|
273
305
|
this.#syncedAt = now;
|
|
274
306
|
for (const fn of listed) {
|
|
275
307
|
if (fn.removed) {
|
|
276
|
-
await this.#chain(fn.fn, () =>
|
|
308
|
+
await this.#chain(fn.fn, () => this.#forget(fn.fn));
|
|
277
309
|
continue;
|
|
278
310
|
}
|
|
279
311
|
const before = this.#fns.get(fn.fn);
|
|
@@ -305,14 +337,14 @@ export class Timer {
|
|
|
305
337
|
async #adopt(fn: ScheduleFn, ctx: ScheduleCtx, changedLive: boolean): Promise<void> {
|
|
306
338
|
const store = this.store;
|
|
307
339
|
const now = this.#clock.now();
|
|
308
|
-
let row = store.schedule(fn.fn);
|
|
340
|
+
let row = await store.schedule(fn.fn);
|
|
309
341
|
if (row === undefined) {
|
|
310
342
|
const last = await this.#lastRecorded(fn, ctx);
|
|
311
|
-
row = store.putSchedule({ fn: fn.fn, owner: fn.owner, version: fn.version, lastAt: last?.at ?? now, count: last?.count ?? 0 });
|
|
343
|
+
row = await store.putSchedule({ fn: fn.fn, owner: fn.owner, version: fn.version, lastAt: last?.at ?? now, count: last?.count ?? 0 });
|
|
312
344
|
} else if (row.version !== fn.version || row.owner !== fn.owner) {
|
|
313
|
-
row = store.putSchedule({ ...row, owner: fn.owner, version: fn.version, lastAt: changedLive ? Math.max(row.lastAt, now) : row.lastAt });
|
|
345
|
+
row = await store.putSchedule({ ...row, owner: fn.owner, version: fn.version, lastAt: changedLive ? Math.max(row.lastAt, now) : row.lastAt });
|
|
314
346
|
}
|
|
315
|
-
this.#plan(fn, row);
|
|
347
|
+
await this.#plan(fn, row);
|
|
316
348
|
}
|
|
317
349
|
|
|
318
350
|
/** The latest firing record of a schedule, when the timer has no row for it (a lost data folder). */
|
|
@@ -328,29 +360,29 @@ export class Timer {
|
|
|
328
360
|
}
|
|
329
361
|
|
|
330
362
|
/** A schedule removed: its queued firing dropped (the queue item finds no row) and its row forgotten; its firings stay. */
|
|
331
|
-
#forget(fn: string): void {
|
|
363
|
+
async #forget(fn: string): Promise<void> {
|
|
332
364
|
this.#fns.delete(fn);
|
|
333
|
-
this.store.removeSchedule(fn);
|
|
365
|
+
await this.store.removeSchedule(fn);
|
|
334
366
|
}
|
|
335
367
|
|
|
336
368
|
/**
|
|
337
369
|
* Queue the schedule's next firing after the last instant it handled (or after its pause ends): one `due` item at
|
|
338
370
|
* that instant, unless that one is queued already. A paused schedule with no end day queues nothing.
|
|
339
371
|
*/
|
|
340
|
-
#plan(fn: ScheduleFn, row: ScheduleRow): void {
|
|
372
|
+
async #plan(fn: ScheduleFn, row: ScheduleRow): Promise<void> {
|
|
341
373
|
const payload = payloadOf(fn);
|
|
342
374
|
const paused = payload.paused;
|
|
343
375
|
let from = row.lastAt + 1;
|
|
344
376
|
if (paused !== undefined) {
|
|
345
|
-
if (paused.until === undefined) { this.store.putSchedule({ ...row, plannedAt: undefined }); return; }
|
|
377
|
+
if (paused.until === undefined) { await this.store.putSchedule({ ...row, plannedAt: undefined }); return; }
|
|
346
378
|
from = Math.max(from, zonedTime(paused.until, 0, payload.zone));
|
|
347
379
|
}
|
|
348
380
|
const next = nextFirings(payload.when, payload.zone, from, 1)[0];
|
|
349
|
-
if (next === undefined) { this.store.putSchedule({ ...row, plannedAt: undefined }); return; }
|
|
381
|
+
if (next === undefined) { await this.store.putSchedule({ ...row, plannedAt: undefined }); return; }
|
|
350
382
|
if (row.plannedAt === next.at) { return; }
|
|
351
|
-
this.store.putSchedule({ ...row, plannedAt: next.at });
|
|
383
|
+
await this.store.putSchedule({ ...row, plannedAt: next.at });
|
|
352
384
|
const work = this.#work;
|
|
353
|
-
if (work !== undefined) { work.work.enqueue(work.due({ fn: fn.fn, at: next.at }), { runAt: next.at }); }
|
|
385
|
+
if (work !== undefined) { await this.#landed(work.work.enqueue(work.due({ fn: fn.fn, at: next.at }), { runAt: next.at }).id); }
|
|
354
386
|
}
|
|
355
387
|
|
|
356
388
|
// ─── firings ────────────────────────────────────────────────────────────────
|
|
@@ -358,7 +390,7 @@ export class Timer {
|
|
|
358
390
|
/** A queued firing is due: unless it is stale (the schedule changed or went), catch up on it. */
|
|
359
391
|
async #due(fn: string, at: number): Promise<void> {
|
|
360
392
|
await this.#chain(fn, async () => {
|
|
361
|
-
const row = this.#store?.schedule(fn);
|
|
393
|
+
const row = await this.#store?.schedule(fn);
|
|
362
394
|
const kindFn = this.#fns.get(fn);
|
|
363
395
|
if (row === undefined || kindFn === undefined || row.plannedAt !== at) { return; }
|
|
364
396
|
await this.#catchUp(kindFn, row);
|
|
@@ -378,7 +410,7 @@ export class Timer {
|
|
|
378
410
|
const due = firingsBetween(payload.when, payload.zone, row.lastAt + 1, now + 1, 10_000)
|
|
379
411
|
.filter((firing) => pausedUntil === undefined || firing.at >= pausedUntil);
|
|
380
412
|
const latest = due.at(-1);
|
|
381
|
-
if (latest === undefined) { this.#plan(fn, this.store.schedule(fn.fn) ?? row); return; }
|
|
413
|
+
if (latest === undefined) { await this.#plan(fn, (await this.store.schedule(fn.fn)) ?? row); return; }
|
|
382
414
|
const earlier = due.slice(0, -1);
|
|
383
415
|
const late = now - latest.at;
|
|
384
416
|
const runs = late <= this.#settings.SCHEDULE_ON_TIME || (payload.missed === 'latest' && late <= this.#limits.grace);
|
|
@@ -391,7 +423,7 @@ export class Timer {
|
|
|
391
423
|
}
|
|
392
424
|
if (missed.length > 0) {
|
|
393
425
|
// handled up to the last missed one, so a retry of the latest doesn't record them again
|
|
394
|
-
this.store.updateSchedule(fn.fn, (current) => ({ ...current, lastAt: Math.max(current.lastAt, missed.at(-1)?.at ?? current.lastAt) }));
|
|
426
|
+
await this.store.updateSchedule(fn.fn, (current) => ({ ...current, lastAt: Math.max(current.lastAt, missed.at(-1)?.at ?? current.lastAt) }));
|
|
395
427
|
}
|
|
396
428
|
if (runs) {
|
|
397
429
|
const started = await this.#fire(fn, latest, ctx, { missedBefore: earlier.length });
|
|
@@ -401,8 +433,8 @@ export class Timer {
|
|
|
401
433
|
} else if (missed.length > 0) {
|
|
402
434
|
await this.#tellMissed(fn, missed, ctx);
|
|
403
435
|
}
|
|
404
|
-
const current = this.store.updateSchedule(fn.fn, (r) => ({ ...r, lastAt: Math.max(r.lastAt, latest.at) }));
|
|
405
|
-
if (current !== undefined) { this.#plan(fn, current); }
|
|
436
|
+
const current = await this.store.updateSchedule(fn.fn, (r) => ({ ...r, lastAt: Math.max(r.lastAt, latest.at) }));
|
|
437
|
+
if (current !== undefined) { await this.#plan(fn, current); }
|
|
406
438
|
}
|
|
407
439
|
|
|
408
440
|
/** The timer's context, or a wait: nothing can start before the system is connected. */
|
|
@@ -419,33 +451,33 @@ export class Timer {
|
|
|
419
451
|
const store = this.store;
|
|
420
452
|
const payload = payloadOf(fn);
|
|
421
453
|
const now = this.#clock.now();
|
|
422
|
-
const limit = this.#limitProblem(fn, now);
|
|
454
|
+
const limit = await this.#limitProblem(fn, now);
|
|
423
455
|
if (limit !== undefined) {
|
|
424
456
|
await this.#recordNoRun(fn, occurrence, 'refused', limit, ctx);
|
|
425
457
|
return 'held';
|
|
426
458
|
}
|
|
427
|
-
const active = store.active(fn.fn);
|
|
459
|
+
const active = await store.active(fn.fn);
|
|
428
460
|
if (active !== undefined && !(await this.#expiredNow(active, now))) {
|
|
429
461
|
if (payload.overlap === 'skip') {
|
|
430
462
|
await this.#recordNoRun(fn, occurrence, 'skipped', `The run before it (${whenWords(active.value.key)}) was still going.`, ctx, active.run);
|
|
431
463
|
return 'held';
|
|
432
464
|
}
|
|
433
465
|
if (payload.overlap === 'queue') {
|
|
434
|
-
const row = store.schedule(fn.fn);
|
|
466
|
+
const row = await store.schedule(fn.fn);
|
|
435
467
|
const waiting = row?.queued;
|
|
436
468
|
if (waiting !== undefined) {
|
|
437
469
|
await this.#recordNoRun(fn, { at: waiting.at, key: waiting.key, ...fromOccurrenceKey(waiting.key) }, 'skipped', `A later run took its place in the queue behind ${whenWords(active.value.key)}.`, ctx, active.run);
|
|
438
470
|
}
|
|
439
|
-
store.updateSchedule(fn.fn, (r) => ({ ...r, queued: { at: occurrence.at, key: occurrence.key } }));
|
|
471
|
+
await store.updateSchedule(fn.fn, (r) => ({ ...r, queued: { at: occurrence.at, key: occurrence.key } }));
|
|
440
472
|
return 'held';
|
|
441
473
|
}
|
|
442
474
|
// replace: the running one is cancelled, and this one starts
|
|
443
475
|
await this.#handles.get(active.id)?.cancel('replaced');
|
|
444
476
|
}
|
|
445
477
|
const id = plannedId(fn.fn, occurrence.at);
|
|
446
|
-
const existing = store.firing(id);
|
|
478
|
+
const existing = await store.firing(id);
|
|
447
479
|
if (existing === undefined || existing.run === undefined) {
|
|
448
|
-
store.putFiring({
|
|
480
|
+
await store.putFiring({
|
|
449
481
|
id, fn: fn.fn, owner: fn.owner, at: occurrence.at, status: 'running', missed: options.missedBefore, byPerson: false, told: false, created: now,
|
|
450
482
|
value: { schedule: fn.fn, version: fn.version, at: occurrence.at, key: occurrence.key, manual: false, status: 'running', notified: false },
|
|
451
483
|
...(existing?.record === undefined ? {} : { record: existing.record }),
|
|
@@ -457,13 +489,13 @@ export class Timer {
|
|
|
457
489
|
args: { at: new Date(occurrence.at).toISOString() }, key: `schedule:${id}`, priority: 'background',
|
|
458
490
|
...(payload.maxSpend === undefined ? {} : { maxSpend: payload.maxSpend }),
|
|
459
491
|
}));
|
|
460
|
-
store.updateFiring(id, (row) => ({ ...row, run: row.run ?? started.run }));
|
|
492
|
+
await store.updateFiring(id, (row) => ({ ...row, run: row.run ?? started.run }));
|
|
461
493
|
ctx.log.info('schedule.started', { fn: fn.fn, at: occurrence.at, run: started.run });
|
|
462
494
|
// a run the hub ended before it answered (its args refused, say) sent its settled event before the firing knew
|
|
463
495
|
// its run: settled here from the status the start gave, so it is recorded and told all the same
|
|
464
496
|
const ended = firingStatusOf(started.status);
|
|
465
|
-
if (ended !== undefined && !this.#handles.has(id) && (store.firing(id)?.status === 'running')) {
|
|
466
|
-
store.updateFiring(id, (row) => ({ ...row, value: { ...row.value, run: row.value.run ?? started.run } }));
|
|
497
|
+
if (ended !== undefined && !this.#handles.has(id) && ((await store.firing(id))?.status === 'running')) {
|
|
498
|
+
await store.updateFiring(id, (row) => ({ ...row, value: { ...row.value, run: row.value.run ?? started.run } }));
|
|
467
499
|
await this.#settle(id, { status: ended, reason: started.status === 'invalid-input' ? 'The hub refused the args it was started with, so it never ran.' : `Its run ended at once (${started.status}).` });
|
|
468
500
|
}
|
|
469
501
|
return 'started';
|
|
@@ -471,11 +503,11 @@ export class Timer {
|
|
|
471
503
|
const refused = refusalOf(error);
|
|
472
504
|
if (refused === undefined) {
|
|
473
505
|
// the hub couldn't be reached (or didn't answer): the same key is the same run, so trying again is safe
|
|
474
|
-
if (store.firing(id)?.record === undefined) { store.removeFiring(id); }
|
|
506
|
+
if ((await store.firing(id))?.record === undefined) { await store.removeFiring(id); }
|
|
475
507
|
ctx.log.warn('schedule.start.unreachable', { fn: fn.fn, at: occurrence.at, error: error instanceof Error ? error.message : String(error) });
|
|
476
508
|
return 'retry';
|
|
477
509
|
}
|
|
478
|
-
store.removeFiring(id);
|
|
510
|
+
await store.removeFiring(id);
|
|
479
511
|
await this.#recordNoRun(fn, occurrence, 'refused', `The hub refused to start it: ${refused.message}`, ctx, undefined, refused.code);
|
|
480
512
|
return 'held';
|
|
481
513
|
}
|
|
@@ -495,13 +527,13 @@ export class Timer {
|
|
|
495
527
|
}
|
|
496
528
|
|
|
497
529
|
/** Why a firing can't start under the limits: its owner has too many schedules, or too many firings today. */
|
|
498
|
-
#limitProblem(fn: ScheduleFn, now: number): string | undefined {
|
|
530
|
+
async #limitProblem(fn: ScheduleFn, now: number): Promise<string | undefined> {
|
|
499
531
|
const limits = this.#limits;
|
|
500
532
|
const theirs = [...this.#fns.values()].filter((other) => other.owner === fn.owner && !other.removed).sort((a, b) => a.updatedAt - b.updatedAt || a.fn.localeCompare(b.fn));
|
|
501
533
|
if (theirs.length > limits.perPerson && theirs.findIndex((other) => other.fn === fn.fn) >= limits.perPerson) {
|
|
502
534
|
return `Its owner has ${String(theirs.length)} schedules, more than the ${String(limits.perPerson)} one person may have, so the newest don't run.`;
|
|
503
535
|
}
|
|
504
|
-
if (this.store.startedSince(fn.owner, now - PER_DAY) >= limits.firingsPerDay) {
|
|
536
|
+
if (await this.store.startedSince(fn.owner, now - PER_DAY) >= limits.firingsPerDay) {
|
|
505
537
|
return `Its owner's schedules ran ${String(limits.firingsPerDay)} times in the last day, the most one person's may.`;
|
|
506
538
|
}
|
|
507
539
|
return undefined;
|
|
@@ -520,7 +552,7 @@ export class Timer {
|
|
|
520
552
|
const store = this.store;
|
|
521
553
|
const id = `${fn.fn}@${String(occurrence.at)}:${status}`;
|
|
522
554
|
const summary = summaryLine({ status, target: payloadOf(fn).fn, reason });
|
|
523
|
-
const row = store.putFiring({
|
|
555
|
+
const row = await store.putFiring({
|
|
524
556
|
id, fn: fn.fn, owner: fn.owner, at: occurrence.at, status, missed: 0, byPerson: false, told: false, created: this.#clock.now(),
|
|
525
557
|
value: { schedule: fn.fn, version: fn.version, at: occurrence.at, key: occurrence.key, manual: false, status, summary, notified: false, ...(waitedOn === undefined ? {} : { run: waitedOn }) },
|
|
526
558
|
});
|
|
@@ -529,17 +561,17 @@ export class Timer {
|
|
|
529
561
|
await this.#tell(id, false);
|
|
530
562
|
if (code === 'OWNER_GONE') { await this.#tellAdminsOnce(fn, reason, ctx); }
|
|
531
563
|
} else if (status === 'skipped') {
|
|
532
|
-
store.updateFiring(id, (r) => ({ ...r, told: true }));
|
|
564
|
+
await store.updateFiring(id, (r) => ({ ...r, told: true }));
|
|
533
565
|
}
|
|
534
566
|
// missed ones are told together by the caller (or folded into the latest's notice)
|
|
535
567
|
}
|
|
536
568
|
|
|
537
569
|
/** The admins hear once that a schedule's owner is gone (its firings are refused). */
|
|
538
570
|
async #tellAdminsOnce(fn: ScheduleFn, reason: string, ctx: ScheduleCtx): Promise<void> {
|
|
539
|
-
const row = this.store.schedule(fn.fn);
|
|
571
|
+
const row = await this.store.schedule(fn.fn);
|
|
540
572
|
if (row?.adminsTold === reason) { return; }
|
|
541
573
|
await ctx.notifyAdmins({ title: `${fn.title} can't run`, body: `${fn.fn} runs as its owner, who can no longer use the hub. ${reason}` });
|
|
542
|
-
this.store.updateSchedule(fn.fn, (r) => ({ ...r, adminsTold: reason }));
|
|
574
|
+
await this.store.updateSchedule(fn.fn, (r) => ({ ...r, adminsTold: reason }));
|
|
543
575
|
}
|
|
544
576
|
|
|
545
577
|
/** Missed firings found together: one notice ("… missed 3 runs"), unless the schedule says never. */
|
|
@@ -557,12 +589,12 @@ export class Timer {
|
|
|
557
589
|
link: { page: schedule.page.item, path: [localOf(fn.fn)], query: { firing: last.key } },
|
|
558
590
|
});
|
|
559
591
|
for (const id of ids) {
|
|
560
|
-
const row = store.updateFiring(id, (r) => ({ ...r, told: true, value: { ...r.value, notified: true } }));
|
|
592
|
+
const row = await store.updateFiring(id, (r) => ({ ...r, told: true, value: { ...r.value, notified: true } }));
|
|
561
593
|
if (row !== undefined) { await this.#saveRecord(row, ctx); }
|
|
562
594
|
}
|
|
563
595
|
return;
|
|
564
596
|
}
|
|
565
|
-
for (const id of ids) { store.updateFiring(id, (r) => ({ ...r, told: true })); }
|
|
597
|
+
for (const id of ids) { await store.updateFiring(id, (r) => ({ ...r, told: true })); }
|
|
566
598
|
}
|
|
567
599
|
|
|
568
600
|
// ─── the kind's run ─────────────────────────────────────────────────────────
|
|
@@ -583,30 +615,30 @@ export class Timer {
|
|
|
583
615
|
const manual = at === undefined;
|
|
584
616
|
const plannedAt = at ?? now;
|
|
585
617
|
const id = manual ? `${fn}@run:${ctx.run.id}` : plannedId(fn, plannedAt);
|
|
586
|
-
const
|
|
587
|
-
const
|
|
618
|
+
const base = await store.firing(id);
|
|
619
|
+
const key = base?.value.key ?? this.#keyAt(payload, plannedAt);
|
|
620
|
+
const schedRow = await store.schedule(fn);
|
|
588
621
|
const late = manual ? 0 : Math.max(0, now - plannedAt);
|
|
589
|
-
|
|
590
|
-
let row = store.putFiring({
|
|
622
|
+
let row = await store.putFiring({
|
|
591
623
|
id, fn, owner: ctx.run.user.id, at: plannedAt, status: 'running', missed: base?.missed ?? 0, byPerson: false, told: false, created: base?.created ?? now,
|
|
592
624
|
run: ctx.run.id, ...(base?.record === undefined ? {} : { record: base.record }),
|
|
593
625
|
value: { schedule: fn, version: kindFn?.version ?? schedRow?.version ?? 1, at: plannedAt, key, manual, status: 'running', run: ctx.run.id, startedAt: now, notified: false },
|
|
594
626
|
});
|
|
595
|
-
store.updateSchedule(fn, (r) => ({ ...r, count: r.count + 1 }));
|
|
627
|
+
await store.updateSchedule(fn, (r) => ({ ...r, count: r.count + 1 }));
|
|
596
628
|
const { day, time } = fromOccurrenceKey(key);
|
|
597
629
|
const fire: Fire = { at: plannedAt, local: localString(plannedAt, payload.zone), day, ...(time === undefined ? {} : { time }), zone: payload.zone, count: schedRow?.count ?? 0, late, manual };
|
|
598
630
|
// one save at a time, in order, for the run's person. Saved by the system outside the run, naming its owner: the
|
|
599
631
|
// schedule fn's mode is its target's, and a fn declared `read` (a reminder) may not save records in its run
|
|
600
632
|
let saving: Promise<unknown> = Promise.resolve();
|
|
601
|
-
const save = (change: (r: FiringRow) => FiringRow): Promise<void> => {
|
|
602
|
-
const next = store.updateFiring(id, change);
|
|
603
|
-
if (next === undefined) { return
|
|
633
|
+
const save = async (change: (r: FiringRow) => FiringRow): Promise<void> => {
|
|
634
|
+
const next = await store.updateFiring(id, change);
|
|
635
|
+
if (next === undefined) { return; }
|
|
604
636
|
row = next;
|
|
605
637
|
const system = this.#ctx;
|
|
606
638
|
// read again when its turn comes, so a save queued behind the first updates the record that one made
|
|
607
|
-
const latest = (): FiringRow => store.firing(id) ?? next;
|
|
608
|
-
saving = saving.then(() => (system === undefined ? this.#saveRecord(latest(), undefined, ctx) : this.#saveRecord(latest(), system))).catch((error: unknown) => { ctx.log.warn('schedule.record.failed', { id, error: error instanceof Error ? error.message : String(error) }); });
|
|
609
|
-
|
|
639
|
+
const latest = async (): Promise<FiringRow> => (await store.firing(id)) ?? next;
|
|
640
|
+
saving = saving.then(async () => { await (system === undefined ? this.#saveRecord(await latest(), undefined, ctx) : this.#saveRecord(await latest(), system)); }).catch((error: unknown) => { ctx.log.warn('schedule.record.failed', { id, error: error instanceof Error ? error.message : String(error) }); });
|
|
641
|
+
await saving;
|
|
610
642
|
};
|
|
611
643
|
const finish = async (status: FiringStatus, summary: string, extra: Partial<FiringShape> = {}): Promise<void> => {
|
|
612
644
|
await save((r) => ({ ...r, status, value: { ...r.value, ...extra, status, summary, endedAt: this.#clock.now() } }));
|
|
@@ -630,7 +662,7 @@ export class Timer {
|
|
|
630
662
|
const call = ctx.call(payload.fn, input, { key: 'target' });
|
|
631
663
|
this.#handles.set(id, {
|
|
632
664
|
cancel: async (reason) => {
|
|
633
|
-
store.updateFiring(id, (r) => ({ ...r, reason }));
|
|
665
|
+
await store.updateFiring(id, (r) => ({ ...r, reason }));
|
|
634
666
|
await call.cancel();
|
|
635
667
|
},
|
|
636
668
|
});
|
|
@@ -639,31 +671,34 @@ export class Timer {
|
|
|
639
671
|
if (update.type !== 'status') { return; }
|
|
640
672
|
if (update.status === 'done' && update.text !== undefined) { doneText = update.text.one; }
|
|
641
673
|
if (update.status === 'awaiting-approval') { void this.#awaiting(id, payload, plannedAt, save, ctx); }
|
|
642
|
-
if (update.status === 'running'
|
|
643
|
-
|
|
674
|
+
if (update.status === 'running') {
|
|
675
|
+
// approved: a firing that was waiting runs again
|
|
676
|
+
void store.firing(id).then(async (current) => {
|
|
677
|
+
if (current?.status === 'waiting') { await save((r) => ({ ...r, status: 'running', until: undefined, value: { ...r.value, status: 'running' } })); }
|
|
678
|
+
});
|
|
644
679
|
}
|
|
645
680
|
});
|
|
646
681
|
const settled = await call.settled;
|
|
647
682
|
unwatch();
|
|
648
683
|
this.#handles.delete(id);
|
|
649
684
|
await saving;
|
|
650
|
-
const reason = store.firing(id)?.reason;
|
|
685
|
+
const reason = (await store.firing(id))?.reason;
|
|
651
686
|
const byPerson = ctx.signal.aborted;
|
|
652
687
|
switch (settled.status) {
|
|
653
688
|
case 'done': {
|
|
654
689
|
await finish('ran', summaryLine({ status: 'ran', target: payload.fn, result: settled.result, doneText, late, onTime: this.#settings.SCHEDULE_ON_TIME }));
|
|
655
|
-
this.#ran(fn, { at: plannedAt, status: 'ran', result: settled.result });
|
|
690
|
+
await this.#ran(fn, { at: plannedAt, status: 'ran', result: settled.result });
|
|
656
691
|
return ctx.done(settled.result);
|
|
657
692
|
}
|
|
658
693
|
case 'failed': {
|
|
659
694
|
await finish('failed', summaryLine({ status: 'failed', target: payload.fn, reason: settled.error.message, late, onTime: this.#settings.SCHEDULE_ON_TIME }));
|
|
660
|
-
this.#ran(fn, { at: plannedAt, status: 'failed' });
|
|
695
|
+
await this.#ran(fn, { at: plannedAt, status: 'failed' });
|
|
661
696
|
return ctx.fail(settled.error.class, settled.error.message, settled.error.code === undefined ? {} : { code: settled.error.code });
|
|
662
697
|
}
|
|
663
698
|
case 'cancelled': {
|
|
664
699
|
const status: FiringStatus = reason === 'expired' ? 'expired' : reason === 'refused' ? 'refused' : 'cancelled';
|
|
665
|
-
const words = this.#endWords(reason, payload, store.firing(id) ?? row);
|
|
666
|
-
store.updateFiring(id, (r) => ({ ...r, byPerson }));
|
|
700
|
+
const words = this.#endWords(reason, payload, (await store.firing(id)) ?? row);
|
|
701
|
+
await store.updateFiring(id, (r) => ({ ...r, byPerson }));
|
|
667
702
|
await finish(status, summaryLine({ status, target: payload.fn, reason: words }));
|
|
668
703
|
return ctx.cancelled();
|
|
669
704
|
}
|
|
@@ -693,13 +728,13 @@ export class Timer {
|
|
|
693
728
|
const until = Math.min(next ?? Number.POSITIVE_INFINITY, now + this.#settings.SCHEDULE_APPROVAL_WAIT);
|
|
694
729
|
await save((r) => ({ ...r, status: 'waiting', until, value: { ...r.value, status: 'waiting' } }));
|
|
695
730
|
const work = this.#work;
|
|
696
|
-
if (work !== undefined) { work.work.enqueue(work.expire({ id }), { runAt: until }); }
|
|
731
|
+
if (work !== undefined) { await this.#landed(work.work.enqueue(work.expire({ id }), { runAt: until }).id); }
|
|
697
732
|
ctx.log.info('schedule.waiting', { id, until });
|
|
698
733
|
}
|
|
699
734
|
|
|
700
735
|
/** A wait for approval reached its end: the firing gives up (its run is cancelled, and it is recorded as expired). */
|
|
701
736
|
async #expire(id: string): Promise<void> {
|
|
702
|
-
const row = this.#store?.firing(id);
|
|
737
|
+
const row = await this.#store?.firing(id);
|
|
703
738
|
if (row?.status !== 'waiting' || row.until === undefined || row.until > this.#clock.now()) { return; }
|
|
704
739
|
const handle = this.#handles.get(id);
|
|
705
740
|
if (handle !== undefined) { await handle.cancel('expired'); return; }
|
|
@@ -708,8 +743,8 @@ export class Timer {
|
|
|
708
743
|
}
|
|
709
744
|
|
|
710
745
|
/** The firing ran or failed: `previous` for the next one, and a refusal may be told again. */
|
|
711
|
-
#ran(fn: string, previous: PreviousFiring): void {
|
|
712
|
-
this.store.updateSchedule(fn, (r) => ({ ...r, previous, ...(previous.status === 'ran' ? { refused: undefined, adminsTold: undefined } : {}) }));
|
|
746
|
+
async #ran(fn: string, previous: PreviousFiring): Promise<void> {
|
|
747
|
+
await this.store.updateSchedule(fn, (r) => ({ ...r, previous, ...(previous.status === 'ran' ? { refused: undefined, adminsTold: undefined } : {}) }));
|
|
713
748
|
}
|
|
714
749
|
|
|
715
750
|
/** The key of a "run now" at an instant: its day and minute in the schedule's zone (its day alone with no times). */
|
|
@@ -727,12 +762,12 @@ export class Timer {
|
|
|
727
762
|
if (event.update.type !== 'status' || this.#store === undefined) { return; }
|
|
728
763
|
const status = firingStatusOf(event.update.status);
|
|
729
764
|
if (status === undefined) { return; }
|
|
730
|
-
const row = this.#store.firingByRun(event.run);
|
|
765
|
+
const row = await this.#store.firingByRun(event.run);
|
|
731
766
|
if (row === undefined) { return; }
|
|
732
767
|
this.configure(ctx);
|
|
733
768
|
const text = event.update.text?.one;
|
|
734
769
|
await this.#chain(row.fn, async () => {
|
|
735
|
-
const current = this.store.firing(row.id);
|
|
770
|
+
const current = await this.store.firing(row.id);
|
|
736
771
|
if (current === undefined) { return; }
|
|
737
772
|
if (current.status === 'running' || current.status === 'waiting') {
|
|
738
773
|
// its run ended without this process recording it (a restart): what the hub says
|
|
@@ -746,7 +781,7 @@ export class Timer {
|
|
|
746
781
|
|
|
747
782
|
/** A firing whose run this process no longer follows, settled from what is known, recorded and told. */
|
|
748
783
|
async #settle(id: string, outcome: { status: FiringStatus; reason?: string | undefined }): Promise<void> {
|
|
749
|
-
const row = this.store.updateFiring(id, (r) => {
|
|
784
|
+
const row = await this.store.updateFiring(id, (r) => {
|
|
750
785
|
const summary = summaryLine({ status: outcome.status, target: payloadOf(this.#fns.get(r.fn))?.fn ?? r.fn, reason: outcome.reason });
|
|
751
786
|
return { ...r, status: outcome.status, until: undefined, value: { ...r.value, status: outcome.status, summary, endedAt: this.#clock.now() } };
|
|
752
787
|
});
|
|
@@ -758,15 +793,15 @@ export class Timer {
|
|
|
758
793
|
|
|
759
794
|
/** The firing queued behind the one that just settled (overlap `queue`) starts now, late. */
|
|
760
795
|
async #startQueued(fn: string, ctx: ScheduleCtx): Promise<void> {
|
|
761
|
-
const row = this.store.schedule(fn);
|
|
796
|
+
const row = await this.store.schedule(fn);
|
|
762
797
|
const kindFn = this.#fns.get(fn);
|
|
763
|
-
if (row?.queued === undefined || kindFn === undefined || this.store.active(fn) !== undefined) { return; }
|
|
798
|
+
if (row?.queued === undefined || kindFn === undefined || (await this.store.active(fn)) !== undefined) { return; }
|
|
764
799
|
const queued = row.queued;
|
|
765
|
-
this.store.putSchedule({ ...row, queued: undefined });
|
|
800
|
+
await this.store.putSchedule({ ...row, queued: undefined });
|
|
766
801
|
const occurrence: Occurrence = { at: queued.at, key: queued.key, ...fromOccurrenceKey(queued.key) };
|
|
767
802
|
if (await this.#fire(kindFn, occurrence, ctx, { missedBefore: 0 }) === 'retry') {
|
|
768
803
|
// the hub went away meanwhile: it is queued again for when it is back
|
|
769
|
-
this.store.updateSchedule(fn, (r) => ({ ...r, queued }));
|
|
804
|
+
await this.store.updateSchedule(fn, (r) => ({ ...r, queued }));
|
|
770
805
|
}
|
|
771
806
|
}
|
|
772
807
|
|
|
@@ -776,19 +811,19 @@ export class Timer {
|
|
|
776
811
|
*/
|
|
777
812
|
async #tell(id: string, notifiedByRun: boolean): Promise<void> {
|
|
778
813
|
const store = this.store;
|
|
779
|
-
const row = store.firing(id);
|
|
814
|
+
const row = await store.firing(id);
|
|
780
815
|
const ctx = this.#ctx;
|
|
781
816
|
if (row === undefined || row.told || ctx === undefined) { return; }
|
|
782
817
|
const fn = this.#fns.get(row.fn);
|
|
783
818
|
const reason = row.value.summary;
|
|
784
|
-
const schedRow = store.schedule(row.fn);
|
|
819
|
+
const schedRow = await store.schedule(row.fn);
|
|
785
820
|
const tell = fn !== undefined && tells({
|
|
786
821
|
notify: payloadOf(fn).notify, status: row.status, manual: row.value.manual, notifiedByRun, byPerson: row.byPerson,
|
|
787
822
|
refusedBefore: schedRow?.refused, reason,
|
|
788
823
|
});
|
|
789
824
|
if (!tell) {
|
|
790
825
|
// a run that told its person itself (a reminder): the owner was notified of this firing, by its run
|
|
791
|
-
const told = store.updateFiring(id, (r) => ({ ...r, told: true, ...(notifiedByRun && row.status === 'ran' ? { value: { ...r.value, notified: true } } : {}) }));
|
|
826
|
+
const told = await store.updateFiring(id, (r) => ({ ...r, told: true, ...(notifiedByRun && row.status === 'ran' ? { value: { ...r.value, notified: true } } : {}) }));
|
|
792
827
|
if (notifiedByRun && row.status === 'ran' && told !== undefined) { await this.#saveRecord(told, ctx); }
|
|
793
828
|
return;
|
|
794
829
|
}
|
|
@@ -802,8 +837,8 @@ export class Timer {
|
|
|
802
837
|
? { run: row.value.run }
|
|
803
838
|
: { page: schedule.page.item, path: [localOf(fn.fn)], query: { firing: row.value.key } },
|
|
804
839
|
});
|
|
805
|
-
if (row.status === 'refused' && reason !== undefined) { store.updateSchedule(row.fn, (r) => ({ ...r, refused: reason })); }
|
|
806
|
-
const told = store.updateFiring(id, (r) => ({ ...r, told: true, value: { ...r.value, notified: true } }));
|
|
840
|
+
if (row.status === 'refused' && reason !== undefined) { await store.updateSchedule(row.fn, (r) => ({ ...r, refused: reason })); }
|
|
841
|
+
const told = await store.updateFiring(id, (r) => ({ ...r, told: true, value: { ...r.value, notified: true } }));
|
|
807
842
|
if (told !== undefined) { await this.#saveRecord(told, ctx); }
|
|
808
843
|
}
|
|
809
844
|
|
|
@@ -830,13 +865,13 @@ export class Timer {
|
|
|
830
865
|
const value = FiringShape.parse(row.value);
|
|
831
866
|
if (run !== undefined) {
|
|
832
867
|
const saved = await run.data.save(schedule.types.Firing, value, row.record === undefined ? {} : { id: row.record });
|
|
833
|
-
this.store.updateFiring(row.id, (r) => ({ ...r, record: saved.id }));
|
|
868
|
+
await this.store.updateFiring(row.id, (r) => ({ ...r, record: saved.id }));
|
|
834
869
|
return;
|
|
835
870
|
}
|
|
836
871
|
if (ctx === undefined) { return; }
|
|
837
872
|
try {
|
|
838
873
|
const saved = await ctx.data.save(schedule.types.Firing, value, row.record === undefined ? { owner: row.owner } : { id: row.record });
|
|
839
|
-
this.store.updateFiring(row.id, (r) => ({ ...r, record: saved.id }));
|
|
874
|
+
await this.store.updateFiring(row.id, (r) => ({ ...r, record: saved.id }));
|
|
840
875
|
} catch (error) {
|
|
841
876
|
ctx.log.warn('schedule.record.failed', { id: row.id, error: error instanceof Error ? error.message : String(error) });
|
|
842
877
|
}
|
|
@@ -844,10 +879,10 @@ export class Timer {
|
|
|
844
879
|
|
|
845
880
|
/** A schedule's firing records beyond the newest `keep.perSchedule`, or older than `keep.days`, removed (at most daily). */
|
|
846
881
|
async #prune(fn: string, ctx: ScheduleCtx): Promise<void> {
|
|
847
|
-
const row = this.store.schedule(fn);
|
|
882
|
+
const row = await this.store.schedule(fn);
|
|
848
883
|
const now = this.#clock.now();
|
|
849
884
|
if (row === undefined || (row.prunedAt !== undefined && now - row.prunedAt < PRUNE_EVERY)) { return; }
|
|
850
|
-
this.store.putSchedule({ ...row, prunedAt: now });
|
|
885
|
+
await this.store.putSchedule({ ...row, prunedAt: now });
|
|
851
886
|
const { perSchedule, days } = this.#limits.keep;
|
|
852
887
|
const cutoff = now - days * DAY;
|
|
853
888
|
try {
|