@demlik/tea 0.13.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 +637 -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-RH5EFRVJ.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-O4MVQTEJ.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-DMYGQB4O.js → chunk-HYDWG35Q.js} +23 -6
- package/dist/chunk-HYDWG35Q.js.map +1 -0
- package/dist/{chunk-YUXP55T2.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-Co0LWkIA.d.ts → core-CTzMJ82M.d.ts} +72 -23
- 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 +42 -29
- package/dist/do/index.js +36 -25
- package/dist/do/index.js.map +1 -1
- package/dist/{durable-effects-C6uwzjb5.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
- package/dist/extension/index.d.ts +300 -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 -12
- package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -9
- 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 -78
- package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -13
- package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -7
- package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -9
- package/dist/index.d.ts +711 -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 +1 -1
- package/dist/machine-viz/index.js +12 -5
- package/dist/machine-viz/index.js.map +1 -1
- package/dist/mem/index.d.ts +18 -3
- package/dist/mem/index.js +22 -2
- package/dist/mem/index.js.map +1 -1
- package/dist/node/index.d.ts +104 -6
- package/dist/node/index.js +132 -9
- 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 +4 -10
- package/dist/parity/index.js +4 -7
- package/dist/parity/index.js.map +1 -1
- package/dist/pbt/index.d.ts +247 -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 -5
- package/dist/persistence/index.js +6 -0
- package/dist/react/index.d.ts +2 -2
- 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 +2 -2
- package/dist/testing/index.js +1 -2
- package/dist/testing/index.js.map +1 -1
- package/dist/{throttled-input → timing}/index.d.ts +143 -12
- package/dist/{throttled-input → timing}/index.js +57 -12
- package/dist/timing/index.js.map +1 -0
- package/dist/{types-XS_miRnB.d.ts → types-DP3f5NIl.d.ts} +1 -1
- package/dist/work-queue/index.d.ts +130 -54
- package/dist/work-queue/index.js +3 -2
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +45 -218
- package/dist/authed-call/index.d.ts +0 -120
- 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 -101
- 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 -152
- package/dist/cache/index.js +0 -8
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -16
- package/dist/chart/index.js.map +0 -1
- package/dist/chart/inspect/index.d.ts +0 -86
- package/dist/chart/inspect/index.js +0 -5
- package/dist/chart/inspect/react.d.ts +0 -113
- 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 -362
- 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 -84
- 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 -117
- 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-3I52QZZ5.js +0 -519
- package/dist/chunk-3I52QZZ5.js.map +0 -1
- package/dist/chunk-3ZAFFRRB.js +0 -457
- package/dist/chunk-3ZAFFRRB.js.map +0 -1
- package/dist/chunk-4EQZ76JC.js +0 -33
- package/dist/chunk-4EQZ76JC.js.map +0 -1
- package/dist/chunk-4KLG43GY.js +0 -223
- package/dist/chunk-4KLG43GY.js.map +0 -1
- package/dist/chunk-7FRZ2CT2.js +0 -424
- package/dist/chunk-7FRZ2CT2.js.map +0 -1
- package/dist/chunk-AZZLE7XR.js +0 -62
- package/dist/chunk-AZZLE7XR.js.map +0 -1
- package/dist/chunk-BYQUGDD3.js +0 -16
- package/dist/chunk-BYQUGDD3.js.map +0 -1
- package/dist/chunk-CIQG5L42.js +0 -685
- package/dist/chunk-CIQG5L42.js.map +0 -1
- package/dist/chunk-CLM6ERNO.js +0 -61
- package/dist/chunk-CLM6ERNO.js.map +0 -1
- package/dist/chunk-COS5MSTO.js +0 -88
- package/dist/chunk-COS5MSTO.js.map +0 -1
- package/dist/chunk-CRPZJVD2.js +0 -71
- package/dist/chunk-CRPZJVD2.js.map +0 -1
- package/dist/chunk-D62FDQKE.js +0 -53
- package/dist/chunk-D62FDQKE.js.map +0 -1
- package/dist/chunk-D736QUGF.js.map +0 -1
- package/dist/chunk-DGE4PV4A.js +0 -26
- package/dist/chunk-DGE4PV4A.js.map +0 -1
- package/dist/chunk-DMYGQB4O.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-J6527VRQ.js.map +0 -1
- package/dist/chunk-JELSZN25.js +0 -47
- package/dist/chunk-JELSZN25.js.map +0 -1
- package/dist/chunk-K575PT4S.js.map +0 -1
- package/dist/chunk-L57ZOT5K.js +0 -184
- package/dist/chunk-L57ZOT5K.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-NR7BU22N.js +0 -758
- package/dist/chunk-NR7BU22N.js.map +0 -1
- package/dist/chunk-O4MVQTEJ.js.map +0 -1
- package/dist/chunk-OOYD44JI.js +0 -317
- package/dist/chunk-OOYD44JI.js.map +0 -1
- package/dist/chunk-Q2UM7BXU.js.map +0 -1
- package/dist/chunk-RH5EFRVJ.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-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-VYFAZN3F.js +0 -372
- package/dist/chunk-VYFAZN3F.js.map +0 -1
- package/dist/chunk-WRAA7GVZ.js +0 -209
- package/dist/chunk-WRAA7GVZ.js.map +0 -1
- package/dist/chunk-XGELA764.js +0 -163
- package/dist/chunk-XGELA764.js.map +0 -1
- package/dist/chunk-YUXP55T2.js.map +0 -1
- package/dist/chunk-YWIKDKHY.js +0 -307
- package/dist/chunk-YWIKDKHY.js.map +0 -1
- package/dist/chunk-ZJ5AOYBH.js +0 -8
- package/dist/chunk-ZJ5AOYBH.js.map +0 -1
- package/dist/chunk-ZSUUOEPL.js +0 -731
- package/dist/chunk-ZSUUOEPL.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/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 -45
- 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-BJPdjc9w.d.ts +0 -435
- package/dist/graph-B3L5e0N1.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 -188
- package/dist/idempotent-intake/index.js +0 -7
- package/dist/idempotent-intake/index.js.map +0 -1
- package/dist/journal/index.d.ts +0 -373
- package/dist/journal/index.js +0 -3
- package/dist/journal/index.js.map +0 -1
- package/dist/llm-call/index.d.ts +0 -311
- package/dist/llm-call/index.js +0 -16
- package/dist/llm-call/index.js.map +0 -1
- package/dist/machine-BtFWQmmq.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 -235
- 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 -136
- 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 -118
- package/dist/pbt/runners/index.js +0 -5
- package/dist/pbt/runners/index.js.map +0 -1
- package/dist/poller/index.d.ts +0 -352
- package/dist/poller/index.js +0 -115
- package/dist/poller/index.js.map +0 -1
- package/dist/prediction/index.d.ts +0 -131
- 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 -3
- 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 -193
- 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-4GNR6b8B.d.ts +0 -447
- package/dist/resilient-call/index.d.ts +0 -320
- 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-pAcmBpah.d.ts +0 -713
- package/dist/runtime-types-CNLmhWif.d.ts +0 -517
- package/dist/saga/index.d.ts +0 -241
- package/dist/saga/index.js +0 -150
- package/dist/saga/index.js.map +0 -1
- package/dist/samples-B3My5oh2.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 -472
- 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 -216
- 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 -197
- 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 -225
- 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 -150
- 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 -84
- 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 -71
- package/dist/work-queue/ops.js +0 -3
- package/dist/work-queue/ops.js.map +0 -1
- package/dist/workflow/index.d.ts +0 -485
- 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,517 +0,0 @@
|
|
|
1
|
-
import { Result } from 'better-result';
|
|
2
|
-
import { a as Port, N as NoCellError, C as Cmd, c as Reducer, A as AnyCmdDef, S as Sub, M as Machine, d as Settled, e as CmdOf, T as Transitions, f as NeedsOf, P as PortEmitter, O as OkOf, E as ErrOf, U as UpdateForm, g as InterpretDetached } from './core-Co0LWkIA.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @demlik/tea runtime interface surface + pure helpers — the public types,
|
|
6
|
-
* interfaces, and construction/composition helpers the runtime (`./run`)
|
|
7
|
-
* implements against: `Store`, the error-sink and supervision contracts, the
|
|
8
|
-
* `RuntimeRef` / `BootingRuntime` / `Runtime` handle hierarchy, `definePort`, the
|
|
9
|
-
* identity-typed constructors `defineMachine` / `asReducer`, and the pure tools
|
|
10
|
-
* `replay` (compose without running) and `tryInterpret` (Railway).
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
declare const ReducerBrand: unique symbol;
|
|
14
|
-
type Branded<T> = T & {
|
|
15
|
-
readonly [ReducerBrand]: true;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Compile-time exhaustiveness assertion for default branches of switches over
|
|
19
|
-
* discriminated unions narrowed by hand (Sub handlers, message-bridge
|
|
20
|
-
* dispatchers, port fanouts) — TS narrows the operand to `never` only if every
|
|
21
|
-
* variant is covered, so adding one produces a compile error at the `absurd(x)`
|
|
22
|
-
* site. Strengthens invariant 7 (identity is explicit).
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* switch (msg.type) {
|
|
26
|
-
* case "a": return ...;
|
|
27
|
-
* case "b": return ...;
|
|
28
|
-
* default: return absurd(msg); // compile error if a "c" is added
|
|
29
|
-
* }
|
|
30
|
-
*/
|
|
31
|
-
declare function absurd(x: never): never;
|
|
32
|
-
declare const noop: <S, M, C extends Cmd>(state: S, _msg: M) => readonly [S, readonly C[]];
|
|
33
|
-
/**
|
|
34
|
-
* Thrown by `definePort` when a name has already been registered in the current
|
|
35
|
-
* process. Symmetric with `SubIdCollisionError` (thrown by `reconcileSubs`) —
|
|
36
|
-
* both mechanize invariant 7 (identity is explicit) at the runtime layer the
|
|
37
|
-
* type system cannot reach (string names compared at runtime).
|
|
38
|
-
*/
|
|
39
|
-
declare class PortNameCollisionError extends Error {
|
|
40
|
-
readonly name = "PortNameCollisionError";
|
|
41
|
-
readonly _tag: "PortNameCollisionError";
|
|
42
|
-
constructor(portName: string);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Thrown by `reconcileSubs` when, within ONE desired subscription set, two subs
|
|
46
|
-
* share an `id` but declare different `type`s — a silent bug class the type
|
|
47
|
-
* system cannot reach (ids are strings compared at runtime). The symmetric twin
|
|
48
|
-
* of `PortNameCollisionError`: both mechanize invariant 7 (identity is explicit)
|
|
49
|
-
* at the runtime layer. Same id across transitions is the no-churn case and does
|
|
50
|
-
* NOT throw; only a within-set type conflict does.
|
|
51
|
-
*/
|
|
52
|
-
declare class SubIdCollisionError extends Error {
|
|
53
|
-
readonly name = "SubIdCollisionError";
|
|
54
|
-
readonly _tag: "SubIdCollisionError";
|
|
55
|
-
constructor(id: string, declaredType: string, conflictingType: string);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Test-only escape hatch — clears the module-level port-name registry so the
|
|
59
|
-
* collision assert in `definePort` doesn't false-positive across vitest's
|
|
60
|
-
* non-isolated runs. Production code MUST NOT call this.
|
|
61
|
-
*
|
|
62
|
-
* @internal test-only
|
|
63
|
-
*/
|
|
64
|
-
declare function __resetPortRegistry(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Which otherwise-unattributable runtime path produced an error. Every fanout is
|
|
67
|
-
* throw-isolated so one bad consumer never strands its siblings, and the
|
|
68
|
-
* isolated throw routes to the `OnError` sink rather than a bare `console.error`.
|
|
69
|
-
*
|
|
70
|
-
* - `"follow-up"` — a follow-up Msg an interpret handler returned rejected when
|
|
71
|
-
* re-dispatched (the original dispatcher already resolved, so no caller).
|
|
72
|
-
* A rejection caused by `stop()`'s own teardown is NOT this phase — see
|
|
73
|
-
* `"discard"`.
|
|
74
|
-
* - `"stop-save"` — the final `store.save(state)` inside `stop()` threw
|
|
75
|
-
* (`stop()` resolves regardless, so without the sink this was silent loss).
|
|
76
|
-
* - `"reduce"` — the pure `update` (reducer) threw synchronously; the configured
|
|
77
|
-
* `Supervision` strategy decides what happens next, but the throw is surfaced
|
|
78
|
-
* here as data first.
|
|
79
|
-
* - `"listener"` — a `runtime.subscribe(...)` listener threw during fanout.
|
|
80
|
-
* - `"observer"` — a `runtime.observe(...)` observer threw during fanout.
|
|
81
|
-
* - `"event"` — the `events` projector or an `on(type, ...)` handler threw.
|
|
82
|
-
* - `"boot"` — an `onBoot` handler threw (boot fanout, or a late registration).
|
|
83
|
-
* - `"port-emit"` — a `subscribePort` listener threw during a port emission.
|
|
84
|
-
* - `"sub-cleanup"` — a subscription's cleanup threw (reconcile-removal or
|
|
85
|
-
* `stop()` teardown).
|
|
86
|
-
* - `"discard"` — work lost to a teardown the host asked for. Two witnesses,
|
|
87
|
-
* both carrying a `RuntimeDiscardNotice`: `stop()` was called while interpret
|
|
88
|
-
* handlers were still awaiting (`RuntimeDiscardedError`), and a Msg that
|
|
89
|
-
* arrived DURING `stop()`'s drain and so could not be delivered
|
|
90
|
-
* (`DispatchDiscardedError`), and teardown work that did not settle inside
|
|
91
|
-
* `disposeTimeoutMs` (`DisposeTimeoutNotice`). The one phase that is a
|
|
92
|
-
* LIFECYCLE report rather than a failure: legal, merely lossy.
|
|
93
|
-
* - `"identity-drop"` — the `Identity` filter dropped a message addressed to a
|
|
94
|
-
* different instance (`IdentityDropNotice`). Its own phase rather than
|
|
95
|
-
* `"discard"`: the loss is the FILTER WORKING, not a teardown, and a host
|
|
96
|
-
* routing it (a metric, a 409 back to the caller) wants it apart from
|
|
97
|
-
* unmount-time noise. Warn-only, like every `RuntimeDiscardNotice`.
|
|
98
|
-
*
|
|
99
|
-
* The phase never decides fatality — the ERROR CLASS does (`RuntimeDiscardNotice`
|
|
100
|
-
* warns, everything else rethrows). A phase is attached by the report site, so a
|
|
101
|
-
* consumer sink that throws while handling a `"discard"` report inherits that
|
|
102
|
-
* phase; keying the warn-only path on it would make the sink's own defect vanish.
|
|
103
|
-
*/
|
|
104
|
-
type RuntimeErrorPhase = "follow-up" | "stop-save" | "reduce" | "listener" | "observer" | "event" | "boot" | "port-emit" | "sub-cleanup" | "discard" | "identity-drop";
|
|
105
|
-
/** Context handed to an `OnError` sink alongside the error itself. */
|
|
106
|
-
interface RuntimeErrorContext {
|
|
107
|
-
readonly phase: RuntimeErrorPhase;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Sink for runtime failures that have no caller to reject at. Configured via
|
|
111
|
-
* `run(machine, { onError })`. Should be total — a throw inside the sink is
|
|
112
|
-
* itself surfaced via the default sink, so it can never re-introduce a silent
|
|
113
|
-
* failure.
|
|
114
|
-
*/
|
|
115
|
-
type OnError = (error: unknown, context: RuntimeErrorContext) => void;
|
|
116
|
-
/** The three declared reducer-throw supervision strategies. */
|
|
117
|
-
type SupervisionStrategy = "stop" | "escalate" | "restart";
|
|
118
|
-
/**
|
|
119
|
-
* Declared supervision policy for a reducer (`update`) throw, at
|
|
120
|
-
* `run(machine, { supervision })`. The bare-string shorthands (`"stop"` /
|
|
121
|
-
* `"escalate"`) are accepted for the two strategies that need no host data;
|
|
122
|
-
* `restart` MUST be the object form because it carries the `rehydrate` callback,
|
|
123
|
-
* which MUST return a valid `S` synchronously (the reducer is synchronous, so
|
|
124
|
-
* recovery is too — no suspension across the single-writer slot).
|
|
125
|
-
*/
|
|
126
|
-
type Supervision<S, M extends {
|
|
127
|
-
type: string;
|
|
128
|
-
}> = "stop" | "escalate" | {
|
|
129
|
-
readonly strategy: "stop";
|
|
130
|
-
} | {
|
|
131
|
-
readonly strategy: "escalate";
|
|
132
|
-
} | {
|
|
133
|
-
readonly strategy: "restart";
|
|
134
|
-
/**
|
|
135
|
-
* Host-provided rehydration to last-known-good state. Invoked when the
|
|
136
|
-
* reducer throws; its return value becomes the new state and the transition
|
|
137
|
-
* continues from there. Receives the pre-throw `state`, the `msg` that
|
|
138
|
-
* triggered the throw, and the thrown `error` so the host can route by
|
|
139
|
-
* cause.
|
|
140
|
-
*/
|
|
141
|
-
readonly rehydrate: (state: S, msg: M, error: unknown) => S;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Raised by `idle()` when the quiescence wait hits its iteration cap without the
|
|
145
|
-
* dispatch tail stabilizing — `idle()` REJECTS rather than silently resolving,
|
|
146
|
-
* so a livelocking machine surfaces instead of masquerading as quiescent.
|
|
147
|
-
* Mechanizes invariant 6 at the runtime layer, the role `PortNameCollisionError`
|
|
148
|
-
* plays for invariant 7.
|
|
149
|
-
*/
|
|
150
|
-
declare class QuiescenceTimeoutError extends Error {
|
|
151
|
-
readonly iterations: number;
|
|
152
|
-
readonly name = "QuiescenceTimeoutError";
|
|
153
|
-
readonly _tag: "QuiescenceTimeoutError";
|
|
154
|
-
constructor(iterations: number);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Base of the LOSSY-BUT-LEGAL teardown facts: work the host discarded by letting
|
|
158
|
-
* go of a runtime that still had something outstanding. Reported under
|
|
159
|
-
* `phase: "discard"`, never raised.
|
|
160
|
-
*
|
|
161
|
-
* It exists so "is this fatal?" has ONE definition — `error instanceof
|
|
162
|
-
* RuntimeDiscardNotice` — that the default sink can ask about any error from any
|
|
163
|
-
* site. The phase cannot answer it: a report site attaches the phase, so a
|
|
164
|
-
* consumer sink that throws while handling a `"discard"` report carries that
|
|
165
|
-
* phase into the sink-failure path, and a phase-keyed warn branch would swallow
|
|
166
|
-
* the sink's own defect. Sub-classing is how a new teardown fact opts into the
|
|
167
|
-
* warn-only treatment; nothing else can.
|
|
168
|
-
*/
|
|
169
|
-
declare abstract class RuntimeDiscardNotice extends Error {
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Reported to the `OnError` sink under `phase: "discard"` when `stop()` is
|
|
173
|
-
* called while `interpret` handlers are still awaiting. The host is dropping
|
|
174
|
-
* its only handle on that work: `stop()` drains the tail, but the listeners,
|
|
175
|
-
* observers and event handlers that would have consumed the resulting
|
|
176
|
-
* transitions are gone, so the Cmds' results reach nobody.
|
|
177
|
-
*
|
|
178
|
-
* The motivating shape is `@demlik/tea/react`'s `useMachine`, which memoizes on
|
|
179
|
-
* `[machine, ctx, store]` — a ctx re-derived mid-flight replaces the runtime,
|
|
180
|
-
* and the in-flight mutation's response arrives for a runtime the UI no longer
|
|
181
|
-
* renders, silently rewinding the visible state. Never a throw: tearing a
|
|
182
|
-
* runtime down mid-flight is legal (a navigation does it every time), so this
|
|
183
|
-
* is surfaced as data, not raised. Mechanizes invariant 6 (no silent failures)
|
|
184
|
-
* at the teardown seam, the role `QuiescenceTimeoutError` plays for `idle()`.
|
|
185
|
-
*/
|
|
186
|
-
declare class RuntimeDiscardedError extends RuntimeDiscardNotice {
|
|
187
|
-
readonly pendingCmds: number;
|
|
188
|
-
readonly name = "RuntimeDiscardedError";
|
|
189
|
-
readonly _tag: "RuntimeDiscardedError";
|
|
190
|
-
constructor(pendingCmds: number);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Reported to the `OnError` sink under `phase: "identity-drop"` when the
|
|
194
|
-
* `Identity` filter drops a message addressed to a different instance.
|
|
195
|
-
*
|
|
196
|
-
* The drop itself is the feature — it is what lets a reducer stop repeating
|
|
197
|
-
* `if (msg.runId !== state.runId) return`. What was missing is that it was
|
|
198
|
-
* INVISIBLE: the dispatch resolved exactly like an applied one, so a reusable
|
|
199
|
-
* Durable Object serving run A and then run B lost every run-B message and
|
|
200
|
-
* reported success to each caller. The comment claiming "the one observable
|
|
201
|
-
* enforcement point" described this notice before it existed.
|
|
202
|
-
*
|
|
203
|
-
* Never fatal (`RuntimeDiscardNotice`): a mis-addressed message is a normal
|
|
204
|
-
* consequence of instance reuse, not a defect. A host that wants to act on it
|
|
205
|
-
* — a metric, a 409 to the caller, a re-route — reads `phase: "identity-drop"`
|
|
206
|
-
* in its own sink.
|
|
207
|
-
*/
|
|
208
|
-
declare class IdentityDropNotice extends RuntimeDiscardNotice {
|
|
209
|
-
readonly msgType: string;
|
|
210
|
-
readonly name = "IdentityDropNotice";
|
|
211
|
-
readonly _tag: "IdentityDropNotice";
|
|
212
|
-
constructor(msgType: string);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Reported to the `OnError` sink under `phase: "discard"` when `stop()`'s wait
|
|
216
|
-
* for async teardown work hits `disposeTimeoutMs`.
|
|
217
|
-
*
|
|
218
|
-
* `stop()` awaits the disposals it started so `await runtime.stop()` can mean
|
|
219
|
-
* "safe to evict". A `release` that never settles must not turn that guarantee
|
|
220
|
-
* into a host that never shuts down, so the wait is bounded and expiry is
|
|
221
|
-
* REPORTED rather than silently tolerated — the resource is genuinely still
|
|
222
|
-
* open at that point, and only the host can decide what that costs.
|
|
223
|
-
*/
|
|
224
|
-
declare class DisposeTimeoutNotice extends RuntimeDiscardNotice {
|
|
225
|
-
readonly pendingDisposals: number;
|
|
226
|
-
readonly timeoutMs: number;
|
|
227
|
-
readonly name = "DisposeTimeoutNotice";
|
|
228
|
-
readonly _tag: "DisposeTimeoutNotice";
|
|
229
|
-
constructor(pendingDisposals: number, timeoutMs: number);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* The rejection of a dispatch that arrived DURING `stop()`'s drain — an in-flight
|
|
233
|
-
* interpret handler's follow-up Msg, a detached handler's terminal Msg, or a Sub
|
|
234
|
-
* that is still live because subs are torn down only after the drain. The stop
|
|
235
|
-
* barrier is absolute (the Msg is refused, never folded), so this names the loss.
|
|
236
|
-
*
|
|
237
|
-
* It is the SECOND witness of `RuntimeDiscardedError`'s fact, and it is why the
|
|
238
|
-
* drain window is a distinct runtime state rather than a plain `stopped` flag:
|
|
239
|
-
* a Msg refused inside the window was discarded BY the teardown, while the same
|
|
240
|
-
* refusal after `stop()` has returned is a consumer dispatching into a runtime it
|
|
241
|
-
* already retired — a real error, and still loud (`phase: "follow-up"`, or the
|
|
242
|
-
* caller's own rejection). The distinction is the state at refusal time, never
|
|
243
|
-
* the message text.
|
|
244
|
-
*/
|
|
245
|
-
declare class DispatchDiscardedError extends RuntimeDiscardNotice {
|
|
246
|
-
readonly msgType: string;
|
|
247
|
-
readonly name = "DispatchDiscardedError";
|
|
248
|
-
readonly _tag: "DispatchDiscardedError";
|
|
249
|
-
constructor(msgType: string);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Define a typed port. `name` is metadata (devtools / debug logs); port identity
|
|
253
|
-
* is by reference. Each definePort call must use a unique `name` — a second call
|
|
254
|
-
* with the same name throws `PortNameCollisionError`. Use ports for "data leaving
|
|
255
|
-
* the runtime selectively" (cursor announcements, DOM-mutation broadcasts,
|
|
256
|
-
* telemetry) that should NOT be folded into State. Strengthens invariant 7.
|
|
257
|
-
*/
|
|
258
|
-
declare function definePort<T>(name: string): Port<T>;
|
|
259
|
-
interface Store<S> {
|
|
260
|
-
load(): Promise<unknown>;
|
|
261
|
-
save(state: S): Promise<void>;
|
|
262
|
-
migrate(raw: unknown): S | null;
|
|
263
|
-
}
|
|
264
|
-
interface Schema<S> {
|
|
265
|
-
safeParse(raw: unknown): {
|
|
266
|
-
success: true;
|
|
267
|
-
data: S;
|
|
268
|
-
} | {
|
|
269
|
-
success: false;
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Build a `Store.migrate` from a schema (job 1) and an optional thin `upcast`
|
|
274
|
-
* (job 2). `upcast` maps a recognized-but-OLD raw shape forward into the shape
|
|
275
|
-
* the schema validates; it defaults to identity (no version migration yet).
|
|
276
|
-
*
|
|
277
|
-
* Never throws — a shape the schema rejects returns `null`, the substrate's
|
|
278
|
-
* fresh-boot path, per the `Store.migrate` contract. An `upcast` that itself
|
|
279
|
-
* throws on a corrupt blob is caught and collapses to `null` (same posture).
|
|
280
|
-
*/
|
|
281
|
-
declare function schemaMigrate<S>(schema: Schema<S>, upcast?: (raw: unknown) => unknown): (raw: unknown) => S | null;
|
|
282
|
-
type DispatchSettle = "quiescent" | "once";
|
|
283
|
-
interface RuntimeRef<M extends {
|
|
284
|
-
type: string;
|
|
285
|
-
}> {
|
|
286
|
-
/**
|
|
287
|
-
* Put a Msg in the runtime's inbox and resolve once processed. Runs to
|
|
288
|
-
* QUIESCENCE by default: settles only after the dispatched Msg AND every
|
|
289
|
-
* transitive interpret follow-up has drained. Pass `{ settle: "once" }` (or
|
|
290
|
-
* call `dispatchOnce`) for the single-step case.
|
|
291
|
-
*
|
|
292
|
-
* Rejection ordering: the ONE dispatched transition's own failure surfaces
|
|
293
|
-
* first, here. If it succeeds but the follow-up chain never stabilizes, the
|
|
294
|
-
* quiescent drain rejects with `QuiescenceTimeoutError`. Follow-up Msg
|
|
295
|
-
* rejections themselves route to the `onError` sink, never here.
|
|
296
|
-
*/
|
|
297
|
-
dispatch(msg: M, opts?: {
|
|
298
|
-
readonly settle?: DispatchSettle;
|
|
299
|
-
}): Promise<void>;
|
|
300
|
-
/**
|
|
301
|
-
* Dispatch `msg` and resolve after exactly ONE transition's effects settle,
|
|
302
|
-
* WITHOUT draining the follow-up chain — equivalent to
|
|
303
|
-
* `dispatch(msg, { settle: "once" })`. Prefer plain `dispatch` unless you will
|
|
304
|
-
* `await runtime.idle()` yourself; the un-awaited follow-up chain is the
|
|
305
|
-
* footgun the quiescent default removed.
|
|
306
|
-
*/
|
|
307
|
-
dispatchOnce(msg: M): Promise<void>;
|
|
308
|
-
}
|
|
309
|
-
interface BootingRuntime<S, M extends {
|
|
310
|
-
type: string;
|
|
311
|
-
}, E extends {
|
|
312
|
-
type: string;
|
|
313
|
-
} = never> extends RuntimeRef<M> {
|
|
314
|
-
dispatch(msg: M, opts?: {
|
|
315
|
-
readonly settle?: DispatchSettle;
|
|
316
|
-
}): Promise<void>;
|
|
317
|
-
dispatchOnce(msg: M): Promise<void>;
|
|
318
|
-
subscribe(listener: () => void): () => void;
|
|
319
|
-
observe(observer: (msg: M, state: S) => void): () => void;
|
|
320
|
-
/**
|
|
321
|
-
* Subscribe to the INITIAL State — the boot transition. Fires exactly once:
|
|
322
|
-
* immediately if boot already completed (so a late subscriber never misses
|
|
323
|
-
* it), otherwise on the boot fanout. Returns a cleanup (a no-op once fired).
|
|
324
|
-
*/
|
|
325
|
-
onBoot(handler: (state: S) => void): () => void;
|
|
326
|
-
/**
|
|
327
|
-
* Subscribe to a SEMANTIC event of `type`. The handler receives exactly the
|
|
328
|
-
* `E` member whose `type` matches `K`, so a consumer never touches another
|
|
329
|
-
* event's shape and never references the machine's PRIVATE Msg names. Multiple
|
|
330
|
-
* handlers per type; fanout is synchronous and throw-isolated. Fires only when
|
|
331
|
-
* the machine's `events` projector (wired on `run`) emits that type.
|
|
332
|
-
*/
|
|
333
|
-
on<K extends E["type"]>(type: K, handler: (event: Extract<E, {
|
|
334
|
-
type: K;
|
|
335
|
-
}>) => void): () => void;
|
|
336
|
-
/**
|
|
337
|
-
* Subscribe to a typed Port. Multiple listeners per port; fanout is synchronous
|
|
338
|
-
* and isolated. Ports are for "data leaving the runtime selectively" (see
|
|
339
|
-
* `definePort`) — distinct from `observe` (every transition) and State.
|
|
340
|
-
*/
|
|
341
|
-
subscribePort<T>(port: Port<T>, listener: (value: T) => void): () => void;
|
|
342
|
-
/**
|
|
343
|
-
* Emit a value on a Port from OUTSIDE an interpret handler — same synchronous
|
|
344
|
-
* fanout as `ctx.emit`. The canonical use is `observe`-driven emission (one
|
|
345
|
-
* runtime publishing a state-derived signal another subscribes to via
|
|
346
|
-
* `subscribePort`) without spawning a "tell the outside world" Cmd per
|
|
347
|
-
* transition.
|
|
348
|
-
*/
|
|
349
|
-
emitPort<T>(port: Port<T>, value: T): void;
|
|
350
|
-
/**
|
|
351
|
-
* Resolves to the booted `Runtime<S, M>` after boot completes (or rejects with
|
|
352
|
-
* the boot error). This is the ONLY way to obtain a `Runtime` — and a
|
|
353
|
-
* `Runtime` is the only handle whose `getState()` is total. Awaiting `ready` is
|
|
354
|
-
* the single gate between "boot in flight" and "State exists":
|
|
355
|
-
*
|
|
356
|
-
* ```ts
|
|
357
|
-
* const runtime = await run(machine, opts).ready;
|
|
358
|
-
* runtime.getState(); // total — never throws-before-boot
|
|
359
|
-
* ```
|
|
360
|
-
*
|
|
361
|
-
* Idempotent — the same settled promise, resolving to the same `Runtime`, comes
|
|
362
|
-
* back on every read. Expresses canon §2.3 (boot is a named, awaitable moment).
|
|
363
|
-
*/
|
|
364
|
-
ready: Promise<Runtime<S, M, E>>;
|
|
365
|
-
stop(): Promise<void>;
|
|
366
|
-
}
|
|
367
|
-
interface Runtime<S, M extends {
|
|
368
|
-
type: string;
|
|
369
|
-
}, E extends {
|
|
370
|
-
type: string;
|
|
371
|
-
} = never> extends BootingRuntime<S, M, E> {
|
|
372
|
-
/**
|
|
373
|
-
* The current State. TOTAL — never throws. Obtaining a `Runtime` requires
|
|
374
|
-
* awaiting `ready`, which only resolves AFTER boot has run `init` and set the
|
|
375
|
-
* initial State.
|
|
376
|
-
*/
|
|
377
|
-
getState(): S;
|
|
378
|
-
/** Resolves to this same `Runtime` once boot completes. Idempotent. */
|
|
379
|
-
ready: Promise<Runtime<S, M, E>>;
|
|
380
|
-
/**
|
|
381
|
-
* Resolves once the runtime has reached QUIESCENCE — every dispatched Msg AND
|
|
382
|
-
* every transitive interpret follow-up has been processed, with no further step
|
|
383
|
-
* pending on the tail. Since plain `dispatch` already runs to quiescence, this
|
|
384
|
-
* is mainly for follow-ups left by a `dispatchOnce` single step, or a chain
|
|
385
|
-
* kicked off by a Sub / boot `init` cmds with no `dispatch` to await.
|
|
386
|
-
*
|
|
387
|
-
* Idempotent and re-entrant-safe. Tail rejections are NOT surfaced here (a
|
|
388
|
-
* failing dispatch surfaces on its OWN promise; follow-up rejections route to
|
|
389
|
-
* `onError`). The one rejection `idle()` produces is `QuiescenceTimeoutError`
|
|
390
|
-
* on hitting the iteration cap — so a livelock stays distinguishable from a
|
|
391
|
-
* genuine quiesce (invariant 6). A poll is still correct when waiting on an
|
|
392
|
-
* EXTERNAL event the runtime cannot enqueue itself.
|
|
393
|
-
*/
|
|
394
|
-
idle(): Promise<void>;
|
|
395
|
-
/**
|
|
396
|
-
* The terminal State of the run, or `undefined` while in flight — "terminal"
|
|
397
|
-
* per the `terminal` predicate passed to `run()` (no predicate → never
|
|
398
|
-
* terminal → always `undefined`). The first-class result read: the run's
|
|
399
|
-
* product off the State the machine already owns, NOT scraped off the `observe`
|
|
400
|
-
* firehose by matching an internal Msg name. Total — never throws.
|
|
401
|
-
*/
|
|
402
|
-
result(): S | undefined;
|
|
403
|
-
/**
|
|
404
|
-
* Resolves with the terminal State the first time the run reaches one (per the
|
|
405
|
-
* `terminal` predicate). If ALREADY terminal, resolves immediately; otherwise
|
|
406
|
-
* on the transition that first makes `terminal` hold. The awaitable companion
|
|
407
|
-
* to `result()`. With no predicate this never resolves. Idempotent and
|
|
408
|
-
* multi-caller safe.
|
|
409
|
-
*/
|
|
410
|
-
done(): Promise<S>;
|
|
411
|
-
}
|
|
412
|
-
declare function defineMachine<S, M extends {
|
|
413
|
-
type: string;
|
|
414
|
-
}, D extends AnyCmdDef, U extends Sub, Ctx>(m: Omit<Machine<S, M | Settled<D>, CmdOf<D>, U, Ctx>, "update" | "cmds"> & {
|
|
415
|
-
readonly cmds: readonly D[];
|
|
416
|
-
update: [S] extends [{
|
|
417
|
-
type: string;
|
|
418
|
-
}] ? Transitions<S, M | Settled<D>, CmdOf<D>> : never;
|
|
419
|
-
}): Machine<S, M | Settled<D>, CmdOf<D>, U, Ctx>;
|
|
420
|
-
declare function defineMachine<S, M extends {
|
|
421
|
-
type: string;
|
|
422
|
-
}, D extends AnyCmdDef, U extends Sub, Ctx>(m: Omit<Machine<S, M | Settled<D>, CmdOf<D>, U, Ctx>, "update" | "cmds"> & {
|
|
423
|
-
readonly cmds: readonly D[];
|
|
424
|
-
update: Reducer<S, M | Settled<D>, CmdOf<D>>;
|
|
425
|
-
}): Machine<S, M | Settled<D>, CmdOf<D>, U, Ctx>;
|
|
426
|
-
declare function defineMachine<S, M extends {
|
|
427
|
-
type: string;
|
|
428
|
-
}, C extends Cmd, U extends Sub, Ctx>(m: Omit<Machine<S, M, C, U, Ctx>, "update"> & {
|
|
429
|
-
update: [S] extends [{
|
|
430
|
-
type: string;
|
|
431
|
-
}] ? Transitions<S, M, C> : never;
|
|
432
|
-
}): Machine<S, M, C, U, Ctx>;
|
|
433
|
-
declare function defineMachine<S, M extends {
|
|
434
|
-
type: string;
|
|
435
|
-
}, C extends Cmd, U extends Sub, Ctx>(m: Omit<Machine<S, M, C, U, Ctx>, "update"> & {
|
|
436
|
-
update: Reducer<S, M, C>;
|
|
437
|
-
}): Machine<S, M, C, U, Ctx>;
|
|
438
|
-
declare function asReducer<S, M extends {
|
|
439
|
-
type: string;
|
|
440
|
-
}, C extends Cmd>(reducer: Reducer<S, M, C>): Branded<Reducer<S, M, C>>;
|
|
441
|
-
type CtxArg<Ctx> = [Record<never, never>] extends [Ctx] ? {
|
|
442
|
-
ctx?: Ctx;
|
|
443
|
-
} : {
|
|
444
|
-
ctx: Ctx;
|
|
445
|
-
};
|
|
446
|
-
declare function replay<S, M extends {
|
|
447
|
-
type: string;
|
|
448
|
-
}, C extends Cmd, U extends Sub, Ctx>(machine: Machine<S, M, C, U, Ctx>, opts: {
|
|
449
|
-
msgs: readonly M[];
|
|
450
|
-
ctx: Ctx;
|
|
451
|
-
loaded?: S | null;
|
|
452
|
-
}): {
|
|
453
|
-
state: S;
|
|
454
|
-
cmds: C[];
|
|
455
|
-
subs: U[];
|
|
456
|
-
depSubs: {
|
|
457
|
-
index: number;
|
|
458
|
-
id: string;
|
|
459
|
-
}[];
|
|
460
|
-
};
|
|
461
|
-
declare function wrapDetached<C extends Cmd, M extends {
|
|
462
|
-
type: string;
|
|
463
|
-
}, Allowed extends M, Ctx>(handler: InterpretDetached<C, Allowed, Ctx>): (cmd: C, ctx: Ctx & PortEmitter, dispatch?: (msg: M) => void) => Promise<void>;
|
|
464
|
-
/**
|
|
465
|
-
* `applyCell` with the missing-cell case in the return type.
|
|
466
|
-
*
|
|
467
|
-
* `Ok` carries the cell's `[nextState, cmds]` verbatim; `Err` carries the same
|
|
468
|
-
* `NoCellError` (msg.type + state name) `applyCell` would have thrown. Dispatch
|
|
469
|
-
* inside `run` keeps using the throwing `applyCell` — this is for callers that
|
|
470
|
-
* step a machine themselves.
|
|
471
|
-
*/
|
|
472
|
-
declare function tryApplyCell<S, M extends {
|
|
473
|
-
type: string;
|
|
474
|
-
}, C extends Cmd>(machine: {
|
|
475
|
-
update: object;
|
|
476
|
-
__form?: UpdateForm;
|
|
477
|
-
}, state: S, msg: M): Result<readonly [S, readonly C[]], NoCellError>;
|
|
478
|
-
/**
|
|
479
|
-
* The refusal `tryFoldMsgs` reports: WHICH msg in the log had no cell, where.
|
|
480
|
-
*
|
|
481
|
-
* A plain record, not a new `Error` subclass — it is a `Result` payload, never
|
|
482
|
-
* thrown, and the actual error is the existing `NoCellError` it carries. The
|
|
483
|
-
* package's thrown-error idiom (`class extends Error` + `_tag`, pinned by
|
|
484
|
-
* `error-idiom.test.ts`) applies to errors raised at the runtime edge; this one
|
|
485
|
-
* is never raised, so adding a class would state a promise it does not make.
|
|
486
|
-
*/
|
|
487
|
-
interface FoldRefusal<M> {
|
|
488
|
-
/** Index into the `msgs` array the fold was given. */
|
|
489
|
-
readonly index: number;
|
|
490
|
-
/** The offending Msg itself — so the caller can print it, not just point. */
|
|
491
|
-
readonly msg: M;
|
|
492
|
-
/** The underlying cell-lookup failure, carrying msg.type + state name. */
|
|
493
|
-
readonly error: NoCellError;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* `foldMsgs` with the missing-cell case in the return type, INCLUDING which
|
|
497
|
-
* message failed.
|
|
498
|
-
*
|
|
499
|
-
* The motivating use is "this persisted log does not replay — tell the user
|
|
500
|
-
* where". A bare `Result<S, NoCellError>` cannot: the error names the msg.type
|
|
501
|
-
* and the state, but a log usually contains that type many times, so the
|
|
502
|
-
* INDEX is the load-bearing fact. The fold stops at the first refusal (state
|
|
503
|
-
* past that point is not defined) and returns it.
|
|
504
|
-
*
|
|
505
|
-
* Shares `foldMsgs`' dev-mode discipline: `deepFreeze` the input state,
|
|
506
|
-
* `assertPureResult` the cell's return. Both compile out of production.
|
|
507
|
-
*/
|
|
508
|
-
declare function tryFoldMsgs<S, M extends {
|
|
509
|
-
type: string;
|
|
510
|
-
}, C extends Cmd>(machine: {
|
|
511
|
-
update: object;
|
|
512
|
-
__form?: UpdateForm;
|
|
513
|
-
}, base: S, msgs: readonly M[]): Result<S, FoldRefusal<M>>;
|
|
514
|
-
declare function settle<D extends AnyCmdDef, Ctx>(def: D, work: (cmd: CmdOf<D>, ctx: Ctx & NeedsOf<CmdOf<D>> & PortEmitter) => Promise<Result<OkOf<D>, ErrOf<D>>>): (cmd: CmdOf<D>, ctx: Ctx & NeedsOf<CmdOf<D>> & PortEmitter) => Promise<Settled<D>>;
|
|
515
|
-
declare function tryInterpret<C extends Cmd, Ok, M, Ctx>(work: (cmd: C, ctx: Ctx) => Promise<Ok>, onOk: (value: Ok, cmd: C) => M, onErr: (error: unknown, cmd: C) => M): (cmd: C, ctx: Ctx) => Promise<M>;
|
|
516
|
-
|
|
517
|
-
export { type BootingRuntime as B, type CtxArg as C, DispatchDiscardedError as D, type FoldRefusal as F, IdentityDropNotice as I, type OnError as O, PortNameCollisionError as P, QuiescenceTimeoutError as Q, type Runtime as R, type Store as S, __resetPortRegistry as _, type Supervision as a, type Branded as b, type DispatchSettle as c, DisposeTimeoutNotice as d, RuntimeDiscardNotice as e, RuntimeDiscardedError as f, type RuntimeErrorContext as g, type RuntimeErrorPhase as h, type RuntimeRef as i, type Schema as j, SubIdCollisionError as k, type SupervisionStrategy as l, absurd as m, asReducer as n, defineMachine as o, definePort as p, noop as q, replay as r, schemaMigrate as s, settle as t, tryApplyCell as u, tryFoldMsgs as v, tryInterpret as w, wrapDetached as x };
|