@demlik/tea 0.12.0 → 0.14.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 +11 -9
- package/dist/agent/index.d.ts +638 -45
- package/dist/agent/index.js +9 -19
- package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
- package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
- package/dist/chunk-AQ6ZIMEA.js +421 -0
- package/dist/chunk-AQ6ZIMEA.js.map +1 -0
- package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
- package/dist/chunk-BLJ2JQSH.js.map +1 -0
- package/dist/{chunk-7SVIRMC6.js → chunk-F2US5BW6.js} +25 -5
- package/dist/chunk-F2US5BW6.js.map +1 -0
- package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
- package/dist/chunk-F7FMAWLA.js.map +1 -0
- package/dist/{chunk-7V4EVLZA.js → chunk-HUKZQX6U.js} +20 -16
- package/dist/chunk-HUKZQX6U.js.map +1 -0
- package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
- package/dist/chunk-HWVW4AXC.js.map +1 -0
- package/dist/{chunk-WLGO64WC.js → chunk-HYDWG35Q.js} +23 -6
- package/dist/chunk-HYDWG35Q.js.map +1 -0
- package/dist/{chunk-I5OV65MS.js → chunk-I5MQMJDW.js} +57 -7
- package/dist/chunk-I5MQMJDW.js.map +1 -0
- package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
- package/dist/chunk-LFZUK6J2.js.map +1 -0
- package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
- package/dist/chunk-LYLTKJWM.js.map +1 -0
- package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
- package/dist/chunk-MYXFNWAJ.js.map +1 -0
- package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
- package/dist/chunk-PR6TB3BL.js.map +1 -0
- package/dist/chunk-RQULHGYH.js +1804 -0
- package/dist/chunk-RQULHGYH.js.map +1 -0
- package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
- package/dist/chunk-TXN2KFHF.js.map +1 -0
- package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
- package/dist/chunk-VBDU4JL6.js.map +1 -0
- package/dist/chunk-Z2L3LSNV.js +1470 -0
- package/dist/chunk-Z2L3LSNV.js.map +1 -0
- package/dist/core-CTzMJ82M.d.ts +562 -0
- package/dist/devtools/index.d.ts +2 -2
- package/dist/devtools/index.js +207 -2
- package/dist/devtools/index.js.map +1 -1
- package/dist/do/index.d.ts +48 -31
- package/dist/do/index.js +36 -25
- package/dist/do/index.js.map +1 -1
- package/dist/{durable-effects-D8SqU_if.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
- package/dist/extension/index.d.ts +301 -3
- package/dist/extension/index.js +596 -5
- package/dist/extension/index.js.map +1 -1
- package/dist/flow/index.d.ts +1295 -0
- package/dist/flow/index.js +732 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/idempotency/index.d.ts +90 -116
- package/dist/idempotency/index.js +4 -1
- package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -11
- package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -8
- package/dist/index-B5BZ-_cT.d.ts +616 -0
- package/dist/index-Bc40JWVl.d.ts +131 -0
- package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
- package/dist/index-DJWIER_3.d.ts +69 -0
- package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -77
- package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -12
- package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -6
- package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -8
- package/dist/index.d.ts +719 -6
- package/dist/index.js +1 -2
- package/dist/jev/index.d.ts +634 -0
- package/dist/jev/index.js +433 -0
- package/dist/jev/index.js.map +1 -0
- package/dist/machine-CdIcN2Xm.d.ts +1773 -0
- package/dist/machine-viz/index.d.ts +2 -1
- package/dist/machine-viz/index.js +12 -5
- package/dist/machine-viz/index.js.map +1 -1
- package/dist/mem/index.d.ts +19 -3
- package/dist/mem/index.js +22 -2
- package/dist/mem/index.js.map +1 -1
- package/dist/node/index.d.ts +130 -4
- package/dist/node/index.js +222 -10
- package/dist/node/index.js.map +1 -1
- package/dist/{paginator → paginate}/index.d.ts +151 -6
- package/dist/paginate/index.js +7 -0
- package/dist/parity/index.d.ts +5 -10
- package/dist/parity/index.js +4 -7
- package/dist/parity/index.js.map +1 -1
- package/dist/pbt/index.d.ts +248 -5
- package/dist/pbt/index.js +124 -5
- package/dist/pbt/index.js.map +1 -1
- package/dist/{trace-replay → persistence}/index.d.ts +7 -4
- package/dist/persistence/index.js +6 -0
- package/dist/react/index.d.ts +4 -3
- package/dist/react/index.js +1 -2
- package/dist/react/index.js.map +1 -1
- package/dist/resilience/index.d.ts +743 -0
- package/dist/resilience/index.js +657 -0
- package/dist/resilience/index.js.map +1 -0
- package/dist/retry-backoff/index.d.ts +3 -2
- package/dist/retry-backoff/index.js +1 -1
- package/dist/runtime-types-LWDoi943.d.ts +998 -0
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +1 -2
- package/dist/testing/index.js.map +1 -1
- package/dist/{throttled-input → timing}/index.d.ts +144 -12
- package/dist/{throttled-input → timing}/index.js +57 -12
- package/dist/timing/index.js.map +1 -0
- package/dist/{types-D7u9DkH7.d.ts → types-DP3f5NIl.d.ts} +1 -1
- package/dist/work-queue/index.d.ts +131 -54
- package/dist/work-queue/index.js +3 -2
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +50 -216
- package/dist/authed-call/index.d.ts +0 -119
- package/dist/authed-call/index.js +0 -134
- package/dist/authed-call/index.js.map +0 -1
- package/dist/await-terminal/index.d.ts +0 -100
- package/dist/await-terminal/index.js +0 -76
- package/dist/await-terminal/index.js.map +0 -1
- package/dist/batch-window/index.js.map +0 -1
- package/dist/cache/index.d.ts +0 -151
- package/dist/cache/index.js +0 -8
- package/dist/chart/index.d.ts +0 -217
- package/dist/chart/index.js +0 -16
- package/dist/chart/index.js.map +0 -1
- package/dist/chart/inspect/index.d.ts +0 -85
- package/dist/chart/inspect/index.js +0 -5
- package/dist/chart/inspect/react.d.ts +0 -112
- package/dist/chart/inspect/react.js +0 -11
- package/dist/chart/inspect/react.js.map +0 -1
- package/dist/chart/inspect/styles.css +0 -286
- package/dist/chart/lane/index.d.ts +0 -361
- package/dist/chart/lane/index.js +0 -9
- package/dist/chart/lane/index.js.map +0 -1
- package/dist/chart/lane/react.d.ts +0 -83
- package/dist/chart/lane/react.js +0 -559
- package/dist/chart/lane/react.js.map +0 -1
- package/dist/chart/lane/server.d.ts +0 -148
- package/dist/chart/lane/server.js +0 -209
- package/dist/chart/lane/server.js.map +0 -1
- package/dist/chart/lane/styles.css +0 -498
- package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
- package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
- package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
- package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
- package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
- package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
- package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
- package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
- package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
- package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
- package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
- package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
- package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
- package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
- package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
- package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
- package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
- package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
- package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
- package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
- package/dist/chart/lane/viewer/index.html +0 -15
- package/dist/chart/report/index.d.ts +0 -116
- package/dist/chart/report/index.js +0 -32
- package/dist/chart/report/index.js.map +0 -1
- package/dist/chunk-2YFLOCWX.js +0 -15
- package/dist/chunk-2YFLOCWX.js.map +0 -1
- package/dist/chunk-3JU6657S.js +0 -372
- package/dist/chunk-3JU6657S.js.map +0 -1
- package/dist/chunk-4KTWLPL5.js +0 -33
- package/dist/chunk-4KTWLPL5.js.map +0 -1
- package/dist/chunk-5EHLEUTL.js +0 -686
- package/dist/chunk-5EHLEUTL.js.map +0 -1
- package/dist/chunk-5KJKJOFC.js +0 -758
- package/dist/chunk-5KJKJOFC.js.map +0 -1
- package/dist/chunk-7SVIRMC6.js.map +0 -1
- package/dist/chunk-7V4EVLZA.js.map +0 -1
- package/dist/chunk-A56OR5RF.js +0 -184
- package/dist/chunk-A56OR5RF.js.map +0 -1
- package/dist/chunk-AZZLE7XR.js +0 -62
- package/dist/chunk-AZZLE7XR.js.map +0 -1
- package/dist/chunk-B5VXOFMZ.js +0 -266
- package/dist/chunk-B5VXOFMZ.js.map +0 -1
- package/dist/chunk-BYQUGDD3.js +0 -16
- package/dist/chunk-BYQUGDD3.js.map +0 -1
- package/dist/chunk-D736QUGF.js.map +0 -1
- package/dist/chunk-E6GEDSF4.js +0 -307
- package/dist/chunk-E6GEDSF4.js.map +0 -1
- package/dist/chunk-EUF7XOEE.js +0 -223
- package/dist/chunk-EUF7XOEE.js.map +0 -1
- package/dist/chunk-EWJP3YYP.js.map +0 -1
- package/dist/chunk-FV3Z5MBE.js.map +0 -1
- package/dist/chunk-HCEVHFJ7.js +0 -54
- package/dist/chunk-HCEVHFJ7.js.map +0 -1
- package/dist/chunk-I5OV65MS.js.map +0 -1
- package/dist/chunk-J6527VRQ.js.map +0 -1
- package/dist/chunk-JELSZN25.js +0 -47
- package/dist/chunk-JELSZN25.js.map +0 -1
- package/dist/chunk-JER5O7PQ.js +0 -416
- package/dist/chunk-JER5O7PQ.js.map +0 -1
- package/dist/chunk-JGVL3WPL.js +0 -26
- package/dist/chunk-JGVL3WPL.js.map +0 -1
- package/dist/chunk-JP5D6GSL.js +0 -71
- package/dist/chunk-JP5D6GSL.js.map +0 -1
- package/dist/chunk-K575PT4S.js.map +0 -1
- package/dist/chunk-MU6MCIAC.js +0 -15
- package/dist/chunk-MU6MCIAC.js.map +0 -1
- package/dist/chunk-MUUROGIH.js.map +0 -1
- package/dist/chunk-ND3DH6KM.js +0 -88
- package/dist/chunk-ND3DH6KM.js.map +0 -1
- package/dist/chunk-Q2UM7BXU.js.map +0 -1
- package/dist/chunk-S2EGRPCM.js +0 -47
- package/dist/chunk-S2EGRPCM.js.map +0 -1
- package/dist/chunk-SINXE47Y.js +0 -55
- package/dist/chunk-SINXE47Y.js.map +0 -1
- package/dist/chunk-SUST46KO.js +0 -53
- package/dist/chunk-SUST46KO.js.map +0 -1
- package/dist/chunk-TP5UPGLY.js +0 -61
- package/dist/chunk-TP5UPGLY.js.map +0 -1
- package/dist/chunk-UF4MZSLT.js +0 -53
- package/dist/chunk-UF4MZSLT.js.map +0 -1
- package/dist/chunk-UOC2PL46.js +0 -13
- package/dist/chunk-UOC2PL46.js.map +0 -1
- package/dist/chunk-WLGO64WC.js.map +0 -1
- package/dist/chunk-WRAA7GVZ.js +0 -209
- package/dist/chunk-WRAA7GVZ.js.map +0 -1
- package/dist/chunk-ZCL7SCBK.js +0 -685
- package/dist/chunk-ZCL7SCBK.js.map +0 -1
- package/dist/chunk-ZD6PNZBK.js +0 -457
- package/dist/chunk-ZD6PNZBK.js.map +0 -1
- package/dist/chunk-ZF6WDK2D.js +0 -519
- package/dist/chunk-ZF6WDK2D.js.map +0 -1
- package/dist/chunk-ZJ5AOYBH.js +0 -8
- package/dist/chunk-ZJ5AOYBH.js.map +0 -1
- package/dist/chunk-ZVJZ72HY.js.map +0 -1
- package/dist/circuit-breaker/index.d.ts +0 -197
- package/dist/circuit-breaker/index.js +0 -3
- package/dist/circuit-breaker/index.js.map +0 -1
- package/dist/core-Bjc0bS8j.d.ts +0 -326
- package/dist/deadline/index.js +0 -6
- package/dist/deadline/index.js.map +0 -1
- package/dist/debounce/index.js +0 -3
- package/dist/debounce/index.js.map +0 -1
- package/dist/extension/react.d.ts +0 -121
- package/dist/extension/react.js +0 -75
- package/dist/extension/react.js.map +0 -1
- package/dist/extension/subs/index.d.ts +0 -44
- package/dist/extension/subs/index.js +0 -80
- package/dist/extension/subs/index.js.map +0 -1
- package/dist/extension/test-utils.d.ts +0 -128
- package/dist/extension/test-utils.js +0 -277
- package/dist/extension/test-utils.js.map +0 -1
- package/dist/fan-out/index.js +0 -5
- package/dist/fan-out/index.js.map +0 -1
- package/dist/fold-Blbhru48.d.ts +0 -435
- package/dist/graph-CcjWZVrd.d.ts +0 -923
- package/dist/idempotency/adapter.d.ts +0 -62
- package/dist/idempotency/adapter.js +0 -4
- package/dist/idempotency/adapter.js.map +0 -1
- package/dist/idempotent-intake/index.d.ts +0 -187
- package/dist/idempotent-intake/index.js +0 -7
- package/dist/idempotent-intake/index.js.map +0 -1
- package/dist/llm-call/index.d.ts +0 -310
- package/dist/llm-call/index.js +0 -16
- package/dist/llm-call/index.js.map +0 -1
- package/dist/machine-0OmPvsy_.d.ts +0 -804
- package/dist/monitored-run/index.js +0 -10
- package/dist/monitored-run/index.js.map +0 -1
- package/dist/paginated-walk/index.d.ts +0 -234
- package/dist/paginated-walk/index.js +0 -16
- package/dist/paginated-walk/index.js.map +0 -1
- package/dist/paginator/index.js +0 -3
- package/dist/paginator/index.js.map +0 -1
- package/dist/pbt/arbitraries/index.d.ts +0 -135
- package/dist/pbt/arbitraries/index.js +0 -3
- package/dist/pbt/arbitraries/index.js.map +0 -1
- package/dist/pbt/runners/index.d.ts +0 -117
- package/dist/pbt/runners/index.js +0 -5
- package/dist/pbt/runners/index.js.map +0 -1
- package/dist/poller/index.d.ts +0 -351
- package/dist/poller/index.js +0 -115
- package/dist/poller/index.js.map +0 -1
- package/dist/prediction/index.d.ts +0 -130
- package/dist/prediction/index.js +0 -4
- package/dist/prediction/index.js.map +0 -1
- package/dist/protocol-B5YmJr0d.d.ts +0 -45
- package/dist/pure/index.d.ts +0 -2
- package/dist/pure/index.js +0 -4
- package/dist/pure/index.js.map +0 -1
- package/dist/rate-limit/index.d.ts +0 -115
- package/dist/rate-limit/index.js +0 -3
- package/dist/rate-limit/index.js.map +0 -1
- package/dist/reconciler/index.d.ts +0 -192
- package/dist/reconciler/index.js +0 -164
- package/dist/reconciler/index.js.map +0 -1
- package/dist/recorder/index.js +0 -3
- package/dist/recorder/index.js.map +0 -1
- package/dist/reducer-BqyoVyBG.d.ts +0 -447
- package/dist/resilient-call/index.d.ts +0 -319
- package/dist/resilient-call/index.js +0 -14
- package/dist/resilient-call/index.js.map +0 -1
- package/dist/retry-to-success/index.d.ts +0 -109
- package/dist/retry-to-success/index.js +0 -37
- package/dist/retry-to-success/index.js.map +0 -1
- package/dist/run-BVeqJDBF.d.ts +0 -713
- package/dist/runtime-types-Bxc637bp.d.ts +0 -502
- package/dist/saga/index.d.ts +0 -240
- package/dist/saga/index.js +0 -150
- package/dist/saga/index.js.map +0 -1
- package/dist/samples-DCt6nF8H.d.ts +0 -59
- package/dist/snapshot/index.js +0 -5
- package/dist/snapshot/index.js.map +0 -1
- package/dist/subs/index.d.ts +0 -471
- package/dist/subs/index.js +0 -7
- package/dist/subs/index.js.map +0 -1
- package/dist/throttle/index.d.ts +0 -134
- package/dist/throttle/index.js +0 -3
- package/dist/throttle/index.js.map +0 -1
- package/dist/throttled-input/index.js.map +0 -1
- package/dist/token-refresh/index.d.ts +0 -215
- package/dist/token-refresh/index.js +0 -6
- package/dist/token-refresh/index.js.map +0 -1
- package/dist/trace-replay/index.js +0 -6
- package/dist/trace-replay/index.js.map +0 -1
- package/dist/with-deadline/index.d.ts +0 -196
- package/dist/with-deadline/index.js +0 -111
- package/dist/with-deadline/index.js.map +0 -1
- package/dist/with-resilience/index.d.ts +0 -224
- package/dist/with-resilience/index.js +0 -240
- package/dist/with-resilience/index.js.map +0 -1
- package/dist/with-telemetry/index.d.ts +0 -149
- package/dist/with-telemetry/index.js +0 -70
- package/dist/with-telemetry/index.js.map +0 -1
- package/dist/work-queue/adapter.d.ts +0 -83
- package/dist/work-queue/adapter.js +0 -4
- package/dist/work-queue/adapter.js.map +0 -1
- package/dist/work-queue/ops.d.ts +0 -70
- package/dist/work-queue/ops.js +0 -3
- package/dist/work-queue/ops.js.map +0 -1
- package/dist/workflow/index.d.ts +0 -484
- package/dist/workflow/index.js +0 -244
- package/dist/workflow/index.js.map +0 -1
- /package/dist/{cache → paginate}/index.js.map +0 -0
- /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { C as Cmd, S as Sub, M as Machine } from '../core-Bjc0bS8j.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @demlik/tea/prediction — the client-prediction ack primitive (epic #186, facet 2).
|
|
5
|
-
*
|
|
6
|
-
* The contract the Gambetta/Valve authoritative-server netcode loop needs:
|
|
7
|
-
* **command-seq-in → last-applied-seq-out.** A client tags each predicted
|
|
8
|
-
* command/`Msg` with a monotonic `seq`; the authoritative side replies with the
|
|
9
|
-
* `lastAppliedSeq` it has processed. `partitionByAck` then splits the client's
|
|
10
|
-
* pending buffer into the inputs the server has ACKED (`seq <= lastAppliedSeq`)
|
|
11
|
-
* and those still PENDING (`seq > lastAppliedSeq`) — the un-acked tail the
|
|
12
|
-
* reconciliation pass (#214) replays over the authoritative snapshot via
|
|
13
|
-
* `foldMsgs` (#211, `@demlik/tea/pure`).
|
|
14
|
-
*
|
|
15
|
-
* Deliberately **Model-shape-agnostic** (ADR 0006): the ack is a standalone
|
|
16
|
-
* value, NOT a field this module requires on the consumer's `State`. It
|
|
17
|
-
* generalizes the `lastAckedSeq`-on-the-Model + `seq`-threaded-through-the-Msg
|
|
18
|
-
* pattern vortex hand-rolled (epic #186). It is a LEAF module — pure and
|
|
19
|
-
* runtime-free, importing nothing from the tea core or host, so it can never
|
|
20
|
-
* drag `run`/the host into a client bundle.
|
|
21
|
-
*
|
|
22
|
-
* This is the read/ack side of the primitive; `tagSeq`/`nextSeq` are the write
|
|
23
|
-
* side, letting a client mint monotonic seqs from its pending buffer alone —
|
|
24
|
-
* again with no counter field on the Model.
|
|
25
|
-
*
|
|
26
|
-
* `reconcile` (the read side's payoff, #214) composes this ack partition with
|
|
27
|
-
* the pure fold seam `foldMsgs` (#211) to perform the whole Gambetta/Valve
|
|
28
|
-
* reconciliation step in one call. The `foldMsgs` import is the ONLY dependency
|
|
29
|
-
* this leaf takes, and it reaches into the pure-core leaf (`../pure/core`) — NOT
|
|
30
|
-
* the runtime root — so the module stays runtime-free and the `@demlik/tea/pure`
|
|
31
|
-
* import-graph guard (ADR 0006, #213) still holds.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A monotonic, non-negative sequence number tagging one client-predicted
|
|
36
|
-
* command. Monotonicity is the client's contract (mint successive seqs with
|
|
37
|
-
* `nextSeq`); this module only ever *compares* seqs.
|
|
38
|
-
*/
|
|
39
|
-
type Seq = number;
|
|
40
|
-
/** A command (or `Msg`) tagged with the `seq` the client assigned it. */
|
|
41
|
-
interface SeqTagged<T> {
|
|
42
|
-
readonly seq: Seq;
|
|
43
|
-
readonly value: T;
|
|
44
|
-
}
|
|
45
|
-
/** Tag a command/`Msg` with its sequence number. */
|
|
46
|
-
declare const tagSeq: <T>(seq: Seq, value: T) => SeqTagged<T>;
|
|
47
|
-
/**
|
|
48
|
-
* The authoritative side's acknowledgement: the highest `seq` it has applied.
|
|
49
|
-
* Everything with `seq <= lastAppliedSeq` is settled; everything above is still
|
|
50
|
-
* in flight. This *is* the whole "ack from the authoritative side" — a value
|
|
51
|
-
* the consumer carries however it likes (a wire field, a message payload),
|
|
52
|
-
* never a shape this module imposes on the Model.
|
|
53
|
-
*/
|
|
54
|
-
interface Ack {
|
|
55
|
-
readonly lastAppliedSeq: Seq;
|
|
56
|
-
}
|
|
57
|
-
/** Construct an `Ack` for a last-applied sequence number. */
|
|
58
|
-
declare const ack: (lastAppliedSeq: Seq) => Ack;
|
|
59
|
-
/**
|
|
60
|
-
* The "nothing applied yet" cursor — the ack value for a server that has applied
|
|
61
|
-
* no client input at all. Because `nextSeq` mints **0-based** seqs and
|
|
62
|
-
* `partitionByAck` acks **inclusively** (`seq <= lastAppliedSeq`), the pre-first
|
|
63
|
-
* cursor must sit strictly *below* seq 0: `lastAppliedSeq = 0` would falsely ack
|
|
64
|
-
* the seq-0 input before the server ever saw it. `-1` is "before any seq", and
|
|
65
|
-
* `partitionByAck(buffer, NO_ACK)` therefore leaves the whole buffer PENDING.
|
|
66
|
-
*
|
|
67
|
-
* This names the boundary value on the seam so no consumer has to re-discover it
|
|
68
|
-
* as a magic number: it is the primitive's own design (0-based mint + inclusive
|
|
69
|
-
* partition) that creates the trap, so it is the primitive's job to name the
|
|
70
|
-
* escape. Pair with {@link initAck} when an {@link Ack} is wanted instead of the
|
|
71
|
-
* bare `Seq`.
|
|
72
|
-
*/
|
|
73
|
-
declare const NO_ACK: Seq;
|
|
74
|
-
/**
|
|
75
|
-
* The `Ack` for a server that has applied nothing yet — `ack(NO_ACK)`. The `Ack`
|
|
76
|
-
* counterpart to the {@link NO_ACK} `Seq` sentinel, for a consumer that carries
|
|
77
|
-
* an `Ack` rather than a bare `lastAppliedSeq`.
|
|
78
|
-
*/
|
|
79
|
-
declare const initAck: () => Ack;
|
|
80
|
-
/** The result of splitting a seq-tagged buffer against an ack. */
|
|
81
|
-
interface AckPartition<T> {
|
|
82
|
-
/** Inputs the authoritative side has applied (`seq <= lastAppliedSeq`). */
|
|
83
|
-
readonly acked: readonly SeqTagged<T>[];
|
|
84
|
-
/** Inputs still in flight / un-acked (`seq > lastAppliedSeq`) — the replay tail. */
|
|
85
|
-
readonly pending: readonly SeqTagged<T>[];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Partition a buffer of seq-tagged commands into ACKED and PENDING against the
|
|
89
|
-
* authoritative `lastAppliedSeq`. Pure and total: every item lands in exactly
|
|
90
|
-
* one bucket, input order is preserved within each bucket, and the boundary
|
|
91
|
-
* `seq == lastAppliedSeq` is ACKED (inclusive `<=`). Routing is by `seq` value,
|
|
92
|
-
* not buffer position, so an out-of-order or duplicate-seq buffer partitions
|
|
93
|
-
* correctly. Accepts either an {@link Ack} or a bare `lastAppliedSeq` number, so
|
|
94
|
-
* a caller passes whichever it holds.
|
|
95
|
-
*/
|
|
96
|
-
declare const partitionByAck: <T>(buffer: readonly SeqTagged<T>[], ackOrSeq: Ack | Seq) => AckPartition<T>;
|
|
97
|
-
/**
|
|
98
|
-
* The next sequence number to assign: one past the highest `seq` in the buffer,
|
|
99
|
-
* or `0` for an empty buffer. Lets a client mint monotonic seqs from its pending
|
|
100
|
-
* buffer alone — no counter field on the Model — and is tolerant of an unordered
|
|
101
|
-
* buffer (it takes the max, not the last element).
|
|
102
|
-
*/
|
|
103
|
-
declare const nextSeq: <T>(buffer: readonly SeqTagged<T>[]) => Seq;
|
|
104
|
-
/**
|
|
105
|
-
* The client prediction/reconciliation helper — the Gambetta/Valve
|
|
106
|
-
* authoritative-server loop's reconcile step, generalized (#214, epic #186).
|
|
107
|
-
*
|
|
108
|
-
* Given the latest `authoritativeState` from the server, the server's
|
|
109
|
-
* `lastAppliedSeq` ack, and the client's `pending` buffer of seq-tagged inputs,
|
|
110
|
-
* it returns the corrected predicted state: drop the inputs the server has
|
|
111
|
-
* already applied (`seq <= lastAppliedSeq`) and replay ONLY the un-acked tail
|
|
112
|
-
* (`seq > lastAppliedSeq`) over the authoritative snapshot.
|
|
113
|
-
*
|
|
114
|
-
* It is **composed, not re-derived** (ADR 0006): the drop is {@link partitionByAck}
|
|
115
|
-
* (the ack primitive, #212) and the replay is `foldMsgs` (the pure fold seam,
|
|
116
|
-
* #211) — there is no second copy of the partition logic and no second copy of
|
|
117
|
-
* the fold. `lastAppliedSeq` accepts either an {@link Ack} or a bare `Seq`, so a
|
|
118
|
-
* caller passes whichever it holds, matching `partitionByAck`.
|
|
119
|
-
*
|
|
120
|
-
* Pure and host-agnostic: it takes the `machine` (which `foldMsgs` needs to
|
|
121
|
-
* dispatch `update`) but touches no `Store`, `interpret`, or subscription, and
|
|
122
|
-
* imports nothing from the runtime — so it ships on `@demlik/tea/prediction`
|
|
123
|
-
* and the client-safe `@demlik/tea/pure` umbrella without dragging `run` into a
|
|
124
|
-
* client bundle.
|
|
125
|
-
*/
|
|
126
|
-
declare function reconcile<S, M extends {
|
|
127
|
-
type: string;
|
|
128
|
-
}, C extends Cmd, U extends Sub, Ctx>(machine: Machine<S, M, C, U, Ctx>, authoritativeState: S, lastAppliedSeq: Ack | Seq, pending: readonly SeqTagged<M>[]): S;
|
|
129
|
-
|
|
130
|
-
export { type Ack, type AckPartition, NO_ACK, type Seq, type SeqTagged, ack, initAck, nextSeq, partitionByAck, reconcile, tagSeq };
|
package/dist/prediction/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The closed set of cross-module Msg/Cmd discriminant strings. Declared `as
|
|
3
|
-
* const` so each entry is usable as both a value (construction / reducer keys /
|
|
4
|
-
* switch labels) and, via `typeof MsgType.X`, a literal type (`readonly type:`
|
|
5
|
-
* fields). The single source of truth for issue #60.
|
|
6
|
-
*/
|
|
7
|
-
declare const MsgType: {
|
|
8
|
-
/** The "run the port for `key`" effect Cmd resilient-call emits. */
|
|
9
|
-
readonly ResilientRun: "resilient_run";
|
|
10
|
-
/** PRIVATE success settle Msg (read only by `agentEvents`, #47). */
|
|
11
|
-
readonly ResilientOk: "resilient_ok";
|
|
12
|
-
/** Failure settle Msg — routed to the `fail` verb (back off via retry). */
|
|
13
|
-
readonly ResilientErr: "resilient_err";
|
|
14
|
-
/** Begin a run. */
|
|
15
|
-
readonly AgentStart: "agent_start";
|
|
16
|
-
/** PRIVATE tool-fan-out success settle Msg (read only by `agentEvents`, #47). */
|
|
17
|
-
readonly AgentToolOk: "agent_tool_ok";
|
|
18
|
-
/** Tool-fan-out failure settle Msg. */
|
|
19
|
-
readonly AgentToolErr: "agent_tool_err";
|
|
20
|
-
/**
|
|
21
|
-
* Re-fire the one outstanding effect on rehydrate (the do↔agent seam). Fired
|
|
22
|
-
* by `do/host`'s `autoBoot` via the typed `agentBootMsg` constructor, matched
|
|
23
|
-
* by the agent reducer — see `AgentBootPort` in `../agent`.
|
|
24
|
-
*/
|
|
25
|
-
readonly AgentBoot: "agent_boot";
|
|
26
|
-
/**
|
|
27
|
-
* The "summarize the oldest N turns" effect Cmd the agent emits when its
|
|
28
|
-
* `CompactionPolicy` asks to compact before a brain call. A DEDICATED
|
|
29
|
-
* round-trip (design B1), distinct from the brain call's `resilient_run`, so
|
|
30
|
-
* compaction is its own honest `Awaiting` state — see `../agent`.
|
|
31
|
-
*/
|
|
32
|
-
readonly CompactRun: "compact_run";
|
|
33
|
-
/** Compaction round-trip resolved — carries the summary text the fold-back folds. */
|
|
34
|
-
readonly CompactOk: "compact_ok";
|
|
35
|
-
/** Compaction round-trip failed (exhausted retry) — surfaced as data, not a stall. */
|
|
36
|
-
readonly CompactErr: "compact_err";
|
|
37
|
-
/** Refresh port resolved — carries the fresh `Token`. */
|
|
38
|
-
readonly TokenRefreshed: "token_refreshed";
|
|
39
|
-
/** Refresh port rejected — carries the rejection (errors are data). */
|
|
40
|
-
readonly TokenRefreshFailed: "token_refresh_failed";
|
|
41
|
-
/** The 401 the consumer dispatches when a guarded call comes back unauthorized. */
|
|
42
|
-
readonly Unauthorized: "unauthorized";
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export { MsgType as M };
|
package/dist/pure/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { Ack, AckPartition, NO_ACK, Seq, SeqTagged, ack, initAck, nextSeq, partitionByAck, reconcile, tagSeq } from '../prediction/index.js';
|
|
2
|
-
export { C as Cmd, d as ContextFree, D as DepKeyedSub, e as Dispose, f as Identity, I as Interpret, c as InterpretDetached, M as Machine, g as MachineShape, N as NoCellError, h as NoCtx, a as Port, P as PortEmitter, R as Reducer, S as Sub, b as SubId, i as Subscribe, j as SyncReturn, T as Transitions, U as UpdateForm, k as acceptsOf, n as describeMachine, o as detectUpdateForm, p as foldMsgs, r as formOf, t as structuralHash, u as subId } from '../core-Bjc0bS8j.js';
|
package/dist/pure/index.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { NO_ACK, ack, initAck, nextSeq, partitionByAck, reconcile, tagSeq } from '../chunk-4KTWLPL5.js';
|
|
2
|
-
export { Cmd, NoCellError, acceptsOf, describeMachine, detectUpdateForm, foldMsgs, formOf, structuralHash, subId } from '../chunk-B5VXOFMZ.js';
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
package/dist/pure/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @demlik/tea/rate-limit — two rate limiters as pure state + ops.
|
|
3
|
-
*
|
|
4
|
-
* Same shape as `@demlik/tea/work-queue`'s `ops.ts`: a state type plus pure
|
|
5
|
-
* transition functions. Host-agnostic by construction — no `Date.now()`, no
|
|
6
|
-
* timers, no I/O. The caller injects the clock (`nowMs`) and wires the result
|
|
7
|
-
* into its own reducer / interpret. This keeps the limiters inside TEA's
|
|
8
|
-
* invariant 2 (transitions are pure: same inputs → same outputs, no `Date.now`)
|
|
9
|
-
* so a consumer can fold them through `update` and exercise them with `replay`
|
|
10
|
-
* / the pbt fold without a fake clock.
|
|
11
|
-
*
|
|
12
|
-
* Every op returns a NEW state value and never mutates its input (invariant 1 —
|
|
13
|
-
* state is a value, not a place). The `tryConsume` / `record` ops return a
|
|
14
|
-
* `[next, ok]` tuple so the caller branches on the decision while threading the
|
|
15
|
-
* advanced state forward; `refill` / `remaining` are read-shaped helpers.
|
|
16
|
-
*
|
|
17
|
-
* Two complementary algorithms, picked by the cost the caller wants to pay:
|
|
18
|
-
*
|
|
19
|
-
* - **Token bucket** — O(1) state (four numbers), smooths bursts against a
|
|
20
|
-
* steady refill rate. Allows a burst up to `capacity`, then throttles to
|
|
21
|
-
* `refillPerSec`. Cheapest; the default choice.
|
|
22
|
-
* - **Sliding window log** — O(limit) state (one timestamp per in-window
|
|
23
|
-
* hit), exact "no more than `limit` events per `windowMs`". Pay the memory
|
|
24
|
-
* for precise window edges when a token bucket's continuous refill would
|
|
25
|
-
* let through too many at a boundary.
|
|
26
|
-
*
|
|
27
|
-
* NOT exported from the package root — reached via the `@demlik/tea/rate-limit`
|
|
28
|
-
* subpath, same one-shape-per-package rule as `work-queue` and `do`.
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* A token bucket: `tokens` of `capacity` available now, replenished at
|
|
32
|
-
* `refillPerSec` tokens per second. `lastRefillMs` is the clock reading at
|
|
33
|
-
* which `tokens` was last computed — `refill` advances it. All four fields are
|
|
34
|
-
* plain numbers so the whole bucket is trivially JSON-serializable into a
|
|
35
|
-
* consumer's `Store<S>`.
|
|
36
|
-
*/
|
|
37
|
-
interface TokenBucket {
|
|
38
|
-
readonly tokens: number;
|
|
39
|
-
readonly capacity: number;
|
|
40
|
-
readonly refillPerSec: number;
|
|
41
|
-
readonly lastRefillMs: number;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Create a full bucket. Starts at `capacity` tokens (the conventional "a fresh
|
|
45
|
-
* limiter lets the first burst through" behavior) and stamps `lastRefillMs`
|
|
46
|
-
* with the caller's clock so the first `refill` measures elapsed time from
|
|
47
|
-
* boot, not from epoch 0.
|
|
48
|
-
*/
|
|
49
|
-
declare function initBucket(capacity: number, refillPerSec: number, nowMs: number): TokenBucket;
|
|
50
|
-
/**
|
|
51
|
-
* Add the tokens accrued since `lastRefillMs`, clamped to `capacity`, and
|
|
52
|
-
* advance `lastRefillMs` to `nowMs`. PURE — returns a new bucket; the input is
|
|
53
|
-
* untouched.
|
|
54
|
-
*
|
|
55
|
-
* A `nowMs` at or before `lastRefillMs` (clock not advanced, or skewed
|
|
56
|
-
* backwards) adds a non-positive amount; `Math.max(0, …)` floors the elapsed
|
|
57
|
-
* term so a backwards clock can never *remove* tokens. `lastRefillMs` still
|
|
58
|
-
* advances to `nowMs` so the bucket tracks the latest reading the caller
|
|
59
|
-
* presented — the next forward step measures from there, not from a stale
|
|
60
|
-
* future timestamp.
|
|
61
|
-
*/
|
|
62
|
-
declare function refill(bucket: TokenBucket, nowMs: number): TokenBucket;
|
|
63
|
-
/**
|
|
64
|
-
* Refill against `nowMs`, then attempt to take `n` tokens (default 1).
|
|
65
|
-
*
|
|
66
|
-
* On success returns `[next, true]` with `n` subtracted; on failure returns
|
|
67
|
-
* `[refilled, false]` — the refilled bucket (so the caller keeps the advanced
|
|
68
|
-
* clock + accrued tokens) with no tokens spent. Branch on the boolean, thread
|
|
69
|
-
* the bucket forward regardless:
|
|
70
|
-
*
|
|
71
|
-
* const [b1, ok] = tryConsume(bucket, nowMs);
|
|
72
|
-
* return ok ? [{ ...state, bucket: b1 }, [doWork]] : [{ ...state, bucket: b1 }, []];
|
|
73
|
-
*
|
|
74
|
-
* PURE — input bucket is never mutated.
|
|
75
|
-
*/
|
|
76
|
-
declare function tryConsume(bucket: TokenBucket, nowMs: number, n?: number): readonly [TokenBucket, boolean];
|
|
77
|
-
/**
|
|
78
|
-
* A sliding-window log: the timestamps of every hit still inside the trailing
|
|
79
|
-
* `windowMs`, capped at `limit` events per window. `hits` is `readonly` and
|
|
80
|
-
* kept oldest-first (pruning slices the stale prefix off the front, recording
|
|
81
|
-
* appends to the back), so the array is its own sorted index. Exact at the
|
|
82
|
-
* window edge — unlike a token bucket's continuous refill, a hit leaves the
|
|
83
|
-
* count the instant it ages past `windowMs`.
|
|
84
|
-
*/
|
|
85
|
-
interface SlidingWindow {
|
|
86
|
-
readonly hits: readonly number[];
|
|
87
|
-
readonly windowMs: number;
|
|
88
|
-
readonly limit: number;
|
|
89
|
-
}
|
|
90
|
-
/** Create an empty window. No hits recorded yet. */
|
|
91
|
-
declare function initWindow(windowMs: number, limit: number): SlidingWindow;
|
|
92
|
-
/**
|
|
93
|
-
* Prune hits older than `nowMs - windowMs`, then record `nowMs` if there is
|
|
94
|
-
* room. Returns `[next, true]` with the hit appended when `hits.length < limit`
|
|
95
|
-
* after pruning, else `[pruned, false]` — the pruned window (capacity recovers
|
|
96
|
-
* as old hits age out) with nothing appended.
|
|
97
|
-
*
|
|
98
|
-
* The cutoff is half-open (see {@link prune}): a hit exactly `windowMs` old is
|
|
99
|
-
* pruned, so a hit recorded at `t` no longer counts at `t + windowMs`. That
|
|
100
|
-
* makes the window's capacity fully recover `windowMs` after the last hit, the
|
|
101
|
-
* behavior tests pin.
|
|
102
|
-
*
|
|
103
|
-
* PURE — input window is never mutated; `hits` is rebuilt by `filter` +
|
|
104
|
-
* spread.
|
|
105
|
-
*/
|
|
106
|
-
declare function record(window: SlidingWindow, nowMs: number): readonly [SlidingWindow, boolean];
|
|
107
|
-
/**
|
|
108
|
-
* How many more hits `record` would accept at `nowMs` without blocking —
|
|
109
|
-
* `limit` minus the live (post-prune) hit count, floored at 0. Read-only: it
|
|
110
|
-
* prunes a local copy to answer but returns no new window. Use it to render a
|
|
111
|
-
* "N requests remaining" affordance without committing a hit.
|
|
112
|
-
*/
|
|
113
|
-
declare function remaining(window: SlidingWindow, nowMs: number): number;
|
|
114
|
-
|
|
115
|
-
export { type SlidingWindow, type TokenBucket, initBucket, initWindow, record, refill, remaining, tryConsume };
|
package/dist/rate-limit/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { CircuitConfig, RateLimitConfig, DeadlineConfig, ResilientPorts, RunCmd, FailMsg, SucceedMsg } from '../resilient-call/index.js';
|
|
2
|
-
import { TtlCache } from '../cache/index.js';
|
|
3
|
-
import { C as Cmd } from '../core-Bjc0bS8j.js';
|
|
4
|
-
import { PaginatedWalkState, PaginatedWalkTimerMsg, FetchPageCmd, PageErrMsg, PageOkMsg } from '../paginated-walk/index.js';
|
|
5
|
-
import { RetryPolicy } from '../retry-backoff/index.js';
|
|
6
|
-
import { DeadlineSub } from '../deadline/index.js';
|
|
7
|
-
export { deadlineSub, subscribeDeadline } from '../deadline/index.js';
|
|
8
|
-
import '../circuit-breaker/index.js';
|
|
9
|
-
import '../protocol-B5YmJr0d.js';
|
|
10
|
-
import '../rate-limit/index.js';
|
|
11
|
-
import '../types-D7u9DkH7.js';
|
|
12
|
-
import '../paginator/index.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The reconciler knob. Generic in:
|
|
16
|
-
* - `Actual` — one item of the ACTUAL world (a fleet node, an audited page, a
|
|
17
|
-
* table row). The scan accumulates these.
|
|
18
|
-
* - `Desired` — the DESIRED spec value the diff converges toward. Opaque to
|
|
19
|
-
* this module; only `diff` reads it.
|
|
20
|
-
* - `Page` — the shape one actual-list page fetch resolves with.
|
|
21
|
-
* - `Change` — one unit of remediation the diff produces and `apply` realizes.
|
|
22
|
-
* - `ApplyCmd`— the Cmd `apply(change)` yields (the effect that mutates the
|
|
23
|
-
* actual world toward desired).
|
|
24
|
-
*
|
|
25
|
-
* `diff` / `apply` / `idOf` / `nextCursor` / `itemsOf` are PURE config functions
|
|
26
|
-
* applied at the verb boundary, never stored in the slice or in a Cmd (Cmds are
|
|
27
|
-
* plain data, not closures). The resilience bricks (`retry` / `circuit` /
|
|
28
|
-
* `rateLimit` / `deadline`) are the SAME optional knobs `paginated-walk` /
|
|
29
|
-
* `resilient-call` expose — reconciler extends them; `rateLimit` keeps the scan
|
|
30
|
-
* from 429-ing the upstream listing API.
|
|
31
|
-
*/
|
|
32
|
-
interface ReconcilerConfig<Actual, Desired, Page, Change, ApplyCmd extends Cmd, Cursor = number> {
|
|
33
|
-
/**
|
|
34
|
-
* The DESIRED spec to converge on. Held verbatim and handed to `diff` once the
|
|
35
|
-
* scan completes. Any JSON-serializable value — a list of specs, a target map,
|
|
36
|
-
* a single target object — `diff` alone interprets it.
|
|
37
|
-
*/
|
|
38
|
-
readonly desired: Desired;
|
|
39
|
-
/**
|
|
40
|
-
* Compute the remediation plan: the ordered `Change[]` that moves `actual` to
|
|
41
|
-
* `desired`. Called once when the scan finishes (the full actual snapshot is in
|
|
42
|
-
* hand). An empty plan means "already in sync — nothing to apply". PURE +
|
|
43
|
-
* consumer-specific (only the consumer knows the domain's reconcile rules).
|
|
44
|
-
*/
|
|
45
|
-
readonly diff: (desired: Desired, actual: readonly Actual[]) => readonly Change[];
|
|
46
|
-
/**
|
|
47
|
-
* Realize one `Change` as the Cmd that mutates the actual world. Returns plain
|
|
48
|
-
* data (a `{ type, ... }` Cmd the consumer's interpret handler performs).
|
|
49
|
-
* PURE — the side effect happens when the runtime performs the emitted Cmd,
|
|
50
|
-
* never here.
|
|
51
|
-
*/
|
|
52
|
-
readonly apply: (change: Change) => ApplyCmd;
|
|
53
|
-
/**
|
|
54
|
-
* Stable identity for a `Change` — the applied-ledger cache key. A re-`applyNext`
|
|
55
|
-
* after eviction (or after a re-plan) skips a change whose id is already in the
|
|
56
|
-
* ledger (idempotent re-apply). MUST be a property of the change itself, NOT its
|
|
57
|
-
* position in the plan: the ledger has to survive re-planning. When omitted the
|
|
58
|
-
* default keys by the change's serialized CONTENT (`JSON.stringify(change)`) —
|
|
59
|
-
* a stable per-change identity that is unchanged by where the change sits in the
|
|
60
|
-
* plan. Supply a domain id (the target node id, the resource key) when one
|
|
61
|
-
* exists; it is cheaper than serializing and dedupes two changes that differ
|
|
62
|
-
* only in fields irrelevant to identity. PURE.
|
|
63
|
-
*
|
|
64
|
-
* Why NOT positional: keying by index silently drops changes on the documented
|
|
65
|
-
* re-plan path. After applying the index-0 change, its `"0"` ledger entry would
|
|
66
|
-
* match WHATEVER different, never-applied change lands at index 0 in the next
|
|
67
|
-
* plan — the apply loop skips it as "already done". Identity must be intrinsic
|
|
68
|
-
* to the change so the ledger means "this change settled", not "slot N settled".
|
|
69
|
-
*/
|
|
70
|
-
readonly idOf?: (change: Change) => string;
|
|
71
|
-
/**
|
|
72
|
-
* The cursor the actual-list scan fetches first. For an offset API typically
|
|
73
|
-
* `0`; for a token API whatever sentinel the API treats as page one.
|
|
74
|
-
*/
|
|
75
|
-
readonly firstPage: Cursor;
|
|
76
|
-
/**
|
|
77
|
-
* Extract the next scan cursor from a fetched page — a `Cursor` to keep
|
|
78
|
-
* scanning, or `null` when the actual listing is exhausted (scan finishes,
|
|
79
|
-
* plan computed). PURE + consumer-specific.
|
|
80
|
-
*/
|
|
81
|
-
readonly nextCursor: (page: Page) => Cursor | null;
|
|
82
|
-
/**
|
|
83
|
-
* Extract the actual items from one fetched page. Each page's items are
|
|
84
|
-
* appended to the running `actual` accumulator. PURE.
|
|
85
|
-
*/
|
|
86
|
-
readonly itemsOf: (page: Page) => readonly Actual[];
|
|
87
|
-
/** Exponential-backoff retry policy for a transient scan-page failure. */
|
|
88
|
-
readonly retry?: RetryPolicy;
|
|
89
|
-
/** Circuit breaker around the scan fetch (one upstream → one breaker). */
|
|
90
|
-
readonly circuit?: CircuitConfig;
|
|
91
|
-
/** Token-bucket rate limit on the scan — the "don't 429 the listing API" knob. */
|
|
92
|
-
readonly rateLimit?: RateLimitConfig;
|
|
93
|
-
/** Overall wall-clock deadline per individual scan-page fetch. */
|
|
94
|
-
readonly deadline?: DeadlineConfig;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Reconcile lifecycle phase. Discriminated on `phase`:
|
|
98
|
-
*
|
|
99
|
-
* - `idle` — created, never scanned. `scan` starts the actual-world walk.
|
|
100
|
-
* - `scanning` — the paginated-walk is traversing the actual listing; pages
|
|
101
|
-
* fold into `actual` as they arrive. The scan owns the `walk`
|
|
102
|
-
* sub-slice; this phase ends when the walk finishes.
|
|
103
|
-
* - `applying` — the scan finished, `diff` produced the `plan`, and changes are
|
|
104
|
-
* being applied one at a time. `appliedCursor` is the index of
|
|
105
|
-
* the next change to apply.
|
|
106
|
-
* - `done` — every planned change applied (or an empty plan: already in
|
|
107
|
-
* sync). Terminal.
|
|
108
|
-
* - `failed` — the scan failed terminally (the page-fetch retries were
|
|
109
|
-
* exhausted / a deadline fired). `error` carries why. Terminal.
|
|
110
|
-
*/
|
|
111
|
-
type ReconcilePhase = "idle" | "scanning" | "applying" | "done" | "failed";
|
|
112
|
-
/**
|
|
113
|
-
* The slice. Plain data end to end:
|
|
114
|
-
* - `phase` — the lifecycle discriminant.
|
|
115
|
-
* - `walk` — the `../paginated-walk` scan slice (cursor + resilience).
|
|
116
|
-
* Drives the actual-world traversal; POSITION survives
|
|
117
|
-
* eviction.
|
|
118
|
-
* - `actual` — the accumulated actual items, appended page by page during
|
|
119
|
-
* the scan. The full snapshot `diff` is computed against.
|
|
120
|
-
* - `plan` — the `Change[]` `diff` produced. Empty until the scan
|
|
121
|
-
* finishes; the apply loop walks it by `appliedCursor`.
|
|
122
|
-
* - `appliedCursor` — index of the NEXT change to apply (0 ≤ cursor ≤ plan.length).
|
|
123
|
-
* `cursor === plan.length` means every change applied.
|
|
124
|
-
* - `applied` — the applied-ledger cache: `idOf(change) → change`, written
|
|
125
|
-
* as each change settles. The idempotency memory the apply
|
|
126
|
-
* loop reads to skip already-applied changes after eviction.
|
|
127
|
-
*/
|
|
128
|
-
interface ReconcilerState<Actual, Change, Page, Cursor = number> {
|
|
129
|
-
readonly phase: ReconcilePhase;
|
|
130
|
-
readonly walk: PaginatedWalkState<Cursor, Page>;
|
|
131
|
-
readonly actual: readonly Actual[];
|
|
132
|
-
readonly plan: readonly Change[];
|
|
133
|
-
readonly appliedCursor: number;
|
|
134
|
-
readonly applied: TtlCache<Change>;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* The actual-list page-fetch effect: the inherited `resilient_run` Cmd from
|
|
138
|
-
* paginated-walk, whose `input` is the `Cursor` to fetch and whose `key` is the
|
|
139
|
-
* fixed `PAGE_KEY`. The consumer's `handlers(ports)` interprets it.
|
|
140
|
-
*/
|
|
141
|
-
type ScanPageCmd<Cursor> = FetchPageCmd<Cursor>;
|
|
142
|
-
/** Page-settled Msgs the scan `handlers` port dispatches back (inherited verbatim). */
|
|
143
|
-
type ScanPageOkMsg<Page> = PageOkMsg<Page>;
|
|
144
|
-
type ScanPageErrMsg = PageErrMsg;
|
|
145
|
-
/** The scan retry / deadline timer Msg — inherited from paginated-walk. */
|
|
146
|
-
type ReconcilerTimerMsg = PaginatedWalkTimerMsg;
|
|
147
|
-
/**
|
|
148
|
-
* Ports the consumer supplies to `handlers`. `run(cursor)` fetches ONE page of
|
|
149
|
-
* the ACTUAL listing for the given cursor; throwing routes to `pageErr` (and
|
|
150
|
-
* thus the scan backoff). Same shape as paginated-walk's port.
|
|
151
|
-
*/
|
|
152
|
-
interface ReconcilerPorts<Cursor, Page> extends ResilientPorts<Cursor, Page> {
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Build a reconciler knob from `config`. `rng` is injected for the underlying
|
|
156
|
-
* scan-retry jitter — pass a fixed `() => 0` in tests to pin backoff; defaults
|
|
157
|
-
* to `Math.random` (read at the verb boundary inside resilient-call, never in a
|
|
158
|
-
* reconciler verb). Inherited straight from paginated-walk.
|
|
159
|
-
*
|
|
160
|
-
* Returns the uniform L2 knob contract: `init()`, the verbs `scan` / `pageOk` /
|
|
161
|
-
* `pageErr` / `planned` / `applyNext` / `applied` / `onTimer`, the derived
|
|
162
|
-
* `isComplete`, `subs(state)`, and `handlers(ports)`.
|
|
163
|
-
*/
|
|
164
|
-
declare function createReconciler<Actual, Desired, Page, Change, ApplyCmd extends Cmd = Cmd, Cursor = number>(config: ReconcilerConfig<Actual, Desired, Page, Change, ApplyCmd, Cursor>, rng?: () => number): {
|
|
165
|
-
init: () => ReconcilerState<Actual, Change, Page, Cursor>;
|
|
166
|
-
scan: (s: ReconcilerState<Actual, Change, Page, Cursor>, at: number) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
167
|
-
pageOk: (s: ReconcilerState<Actual, Change, Page, Cursor>, page: Page, at: number) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
168
|
-
pageErr: (s: ReconcilerState<Actual, Change, Page, Cursor>, error: unknown, at: number) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
169
|
-
planned: (s: ReconcilerState<Actual, Change, Page, Cursor>, at: number, changes?: readonly Change[]) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
170
|
-
applyNext: (s: ReconcilerState<Actual, Change, Page, Cursor>, at: number) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
171
|
-
applied: (s: ReconcilerState<Actual, Change, Page, Cursor>, change: Change, at: number) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
172
|
-
onTimer: (s: ReconcilerState<Actual, Change, Page, Cursor>, msg: ReconcilerTimerMsg) => readonly [ReconcilerState<Actual, Change, Page, Cursor>, readonly (ApplyCmd | ScanPageCmd<Cursor>)[]];
|
|
173
|
-
isComplete: (s: ReconcilerState<Actual, Change, Page, Cursor>) => boolean;
|
|
174
|
-
subs: (s: ReconcilerState<Actual, Change, Page, Cursor>) => readonly DeadlineSub[];
|
|
175
|
-
handlers: (ports: ReconcilerPorts<Cursor, Page>) => {
|
|
176
|
-
resilient_run: (cmd: RunCmd<Cursor>, ctx: Readonly<Record<never, never>>) => Promise<FailMsg | SucceedMsg<Page>>;
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
/**
|
|
180
|
-
* Lift a knob result `[slice, cmds]` into a host `[State, cmds]` where the slice
|
|
181
|
-
* lives at `state.rec`. Convenience for the common single-slice host; hosts with
|
|
182
|
-
* a differently-named field spread by hand. PURE — a thin record rebuild, no
|
|
183
|
-
* clock / RNG.
|
|
184
|
-
*/
|
|
185
|
-
declare function liftReconciler<S extends {
|
|
186
|
-
rec: ReconcilerState<Actual, Change, Page, Cursor>;
|
|
187
|
-
}, Actual, Change, Page, Cursor, C extends Cmd>(state: S, [slice, cmds]: readonly [
|
|
188
|
-
ReconcilerState<Actual, Change, Page, Cursor>,
|
|
189
|
-
readonly C[]
|
|
190
|
-
]): readonly [S, readonly C[]];
|
|
191
|
-
|
|
192
|
-
export { DeadlineSub, type ReconcilePhase, type ReconcilerConfig, type ReconcilerPorts, type ReconcilerState, type ReconcilerTimerMsg, type ScanPageCmd, type ScanPageErrMsg, type ScanPageOkMsg, createReconciler, liftReconciler };
|