@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,62 +0,0 @@
|
|
|
1
|
-
import { IdempotencyStore } from './index.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @demlik/tea/idempotency/adapter — the verb seam over the pure idempotency ops.
|
|
5
|
-
*
|
|
6
|
-
* The functions in `./index` (`seen` / `recall` / `remember` / `evictExpired`
|
|
7
|
-
* / `initStore`) are the BLESSED transitions, but their names and the
|
|
8
|
-
* `IdempotencyStore<V>` shape they read/return are the STORE's vocabulary. A
|
|
9
|
-
* consumer that owns an `IdempotencyStore<V>` slice (`idempotent-intake`,
|
|
10
|
-
* `poller`) used to import those functions by name and call them directly, so
|
|
11
|
-
* a change to the op surface — or to `IdempotencyStore`'s fields — cascaded to
|
|
12
|
-
* every call site.
|
|
13
|
-
*
|
|
14
|
-
* `IdempotencyMemory<V>` is the insulating interface: five VERBS (`isSeen` /
|
|
15
|
-
* `recall` / `remember` / `evict` / `init`) consumers depend on instead of the
|
|
16
|
-
* raw functions. The verbs keep the ops' pure contract — no I/O, no `Date.now`
|
|
17
|
-
* (the clock is injected as `now`) — so a consumer folding the adapter through
|
|
18
|
-
* its reducer stays inside invariant 2 (pure transitions). `isSeen` renames the
|
|
19
|
-
* blessed `seen` predicate (a noun-y `seen` reads ambiguously as a slice field;
|
|
20
|
-
* the verb form states the question it answers), and `evict` is the verb form
|
|
21
|
-
* of `evictExpired`.
|
|
22
|
-
*
|
|
23
|
-
* `idempotencyMemory<V>()` is the canonical implementation, a thin binding of
|
|
24
|
-
* the blessed ops. Because the verbs are the only surface consumers touch, an
|
|
25
|
-
* `IdempotencyStore` shape change is absorbed HERE rather than at the consumer
|
|
26
|
-
* call sites.
|
|
27
|
-
*
|
|
28
|
-
* INTERNAL seam (no public-API port): consumers import the adapter from this
|
|
29
|
-
* subpath the same way they imported the ops. The ops remain exported from
|
|
30
|
-
* `./index` for any call site that genuinely wants a function directly.
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The verb interface over an `IdempotencyStore<V>`. Each verb mirrors a blessed
|
|
35
|
-
* op's pure contract but speaks the consumer's dedupe vocabulary, so the
|
|
36
|
-
* consumer never names a store function or reaches into an `IdempotencyStore`
|
|
37
|
-
* field it did not put there.
|
|
38
|
-
*/
|
|
39
|
-
interface IdempotencyMemory<V> {
|
|
40
|
-
/** Create an empty store, optionally bounded by `capacity` and/or `ttlMs`. */
|
|
41
|
-
init(opts?: {
|
|
42
|
-
capacity?: number;
|
|
43
|
-
ttlMs?: number;
|
|
44
|
-
}): IdempotencyStore<V>;
|
|
45
|
-
/** True iff `key` is present AND not expired at `now`. Read-only. */
|
|
46
|
-
isSeen(store: IdempotencyStore<V>, key: string, now: number): boolean;
|
|
47
|
-
/** The cached value for `key` if present and unexpired at `now`. Read-only. */
|
|
48
|
-
recall(store: IdempotencyStore<V>, key: string, now: number): V | undefined;
|
|
49
|
-
/** Record `key → value` at `now`, enforcing the store's bounds. Returns a new store. */
|
|
50
|
-
remember(store: IdempotencyStore<V>, key: string, value: V, now: number): IdempotencyStore<V>;
|
|
51
|
-
/** Drop every entry expired at `now`. Returns a new store. */
|
|
52
|
-
evict(store: IdempotencyStore<V>, now: number): IdempotencyStore<V>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* The canonical `IdempotencyMemory<V>`, binding each verb to its blessed op.
|
|
56
|
-
* Pure and stateless — call once at module scope in a consumer and fold its
|
|
57
|
-
* verbs through the reducer. An `IdempotencyStore` shape change is absorbed by
|
|
58
|
-
* re-binding a verb here, not at the consumers.
|
|
59
|
-
*/
|
|
60
|
-
declare function idempotencyMemory<V>(): IdempotencyMemory<V>;
|
|
61
|
-
|
|
62
|
-
export { type IdempotencyMemory, idempotencyMemory };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"adapter.js"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { IdempotencyStore } from '../idempotency/index.js';
|
|
2
|
-
import { C as Cmd } from '../core-Bjc0bS8j.js';
|
|
3
|
-
import { QueueItem } from '../work-queue/index.js';
|
|
4
|
-
import '../runtime-types-Bxc637bp.js';
|
|
5
|
-
import 'better-result';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @demlik/tea/idempotent-intake — receive-once intake for webhooks / queue
|
|
9
|
-
* messages: dedupe by key, enqueue the new ones, replay the cached result to
|
|
10
|
-
* the duplicates. The "process this payload exactly once even though it
|
|
11
|
-
* arrives N times" knob.
|
|
12
|
-
*
|
|
13
|
-
* **The recipe.** This is a Level-2 composition — it owns no primitive
|
|
14
|
-
* queue/cache logic of its own, it *splices two L1 bricks into one Model slice*
|
|
15
|
-
* and DELEGATES every transition to their VERB SEAMS — `IdempotencyMemory`
|
|
16
|
-
* (`../idempotency/adapter`) and `QueueAdapter` (`../work-queue/adapter`) —
|
|
17
|
-
* so the store ops and the `QueueItem` / `IdempotencyStore` shapes stay
|
|
18
|
-
* insulated behind verbs the intake calls:
|
|
19
|
-
*
|
|
20
|
-
* - `../idempotency/adapter` — the dedupe-by-key + last-result cache. The
|
|
21
|
-
* `seen` half of the slice is its `IdempotencyStore`, keyed by
|
|
22
|
-
* `keyOf(payload)`. A key is recorded once `receive` calls `memory.remember`;
|
|
23
|
-
* `complete` calls `memory.remember` again to swap its cached value from
|
|
24
|
-
* `pending` to the finished `result`. The cache write is the brick's, never
|
|
25
|
-
* re-rolled here.
|
|
26
|
-
* - `../work-queue/adapter` — the pending-work list. The `queue` half of the
|
|
27
|
-
* slice is its `QueueItem<P>[]`. Every status flip routes through the
|
|
28
|
-
* adapter verbs: `receive` enqueues via `queue.enqueue`, `claimNext` stamps
|
|
29
|
-
* the `running` claim via `queue.patch`, `boot` re-arms a dead worker's
|
|
30
|
-
* claim via `queue.patch`. Intake owns only the SELECTION (which item,
|
|
31
|
-
* gated on the done-cache reconcile below) — the array transition is the
|
|
32
|
-
* brick's. The consumer drains it (claim → process → `complete`) at its own
|
|
33
|
-
* pace.
|
|
34
|
-
*
|
|
35
|
-
* Both bricks are pure-state + pure-ops, host- and clock-agnostic by
|
|
36
|
-
* construction, so the combined slice inherits TEA's two non-negotiables:
|
|
37
|
-
*
|
|
38
|
-
* - **Durable** — the slice is a plain serializable value (a record-backed
|
|
39
|
-
* idempotency store + an array of queue items, no `Map`, no closures), so
|
|
40
|
-
* it survives a Durable-Object eviction / reload and rehydrates whole.
|
|
41
|
-
* - **Replayable** — every verb is a pure `(state, …) => [state, Cmd[]]`
|
|
42
|
-
* transition; no `Date.now()`, no `Math.random()`, no I/O inside a verb.
|
|
43
|
-
* `at` (the clock) and `id` (the queue-item id) are *injected* at the call
|
|
44
|
-
* site, so `trace-replay` reconstructs each transition exactly.
|
|
45
|
-
*
|
|
46
|
-
* **The decision lives in a Cmd, not in a return shape.** `receive` cannot
|
|
47
|
-
* "return" what it decided (the knob contract pins the shape to
|
|
48
|
-
* `[State, Cmd[]]`), so the decision is *reified as a Cmd* the runtime
|
|
49
|
-
* performs:
|
|
50
|
-
*
|
|
51
|
-
* - first sighting of a key → mark it `pending`, enqueue the payload, emit
|
|
52
|
-
* `IntakeProcess` (go run the work).
|
|
53
|
-
* - a key already `pending` → drop silently (the original is in flight);
|
|
54
|
-
* emit nothing.
|
|
55
|
-
* - a key already `done` → emit `IntakeReplay` carrying the cached
|
|
56
|
-
* result so the duplicate caller gets the SAME response the first one
|
|
57
|
-
* produced, with zero re-execution of the side effect.
|
|
58
|
-
*
|
|
59
|
-
* **Two crash-safety guarantees the verbs enforce (and the unit specs alone
|
|
60
|
-
* missed — see the wired-machine test):**
|
|
61
|
-
*
|
|
62
|
-
* - *A slow worker is never double-enqueued.* The TTL clock starts at
|
|
63
|
-
* `complete`, not at `receive`: a `pending` entry NEVER ages out, so a
|
|
64
|
-
* duplicate of an in-flight key is always dropped no matter how long the
|
|
65
|
-
* worker takes. Only a `done` entry expires (see `liveEntry`).
|
|
66
|
-
* - *A complete-then-crash never re-runs.* `boot` and `claimNext` reconcile
|
|
67
|
-
* the queue against the done cache: a queue item whose key already resolved
|
|
68
|
-
* to `done` in `seen` is skipped (never reset to pending, never claimed),
|
|
69
|
-
* so a worker that finished and cached its result before the DO evicted is
|
|
70
|
-
* not re-executed on resume.
|
|
71
|
-
*
|
|
72
|
-
* Typical wiring (the combinator form — splice ~3 hooks into a host machine):
|
|
73
|
-
*
|
|
74
|
-
* const intake = createIntake<StripeEvent, ChargeResult>({
|
|
75
|
-
* keyOf: (e) => e.id, // Stripe's idempotency key
|
|
76
|
-
* ttlMs: 24 * 60 * 60 * 1000, // a replayed webhook 24h after it COMPLETED is re-run
|
|
77
|
-
* });
|
|
78
|
-
*
|
|
79
|
-
* // in `init`:
|
|
80
|
-
* intake: intake.init(),
|
|
81
|
-
* // in `update`, on the inbound-webhook Msg:
|
|
82
|
-
* const [next, cmds] = intake.receive(state.intake, payload, at, id);
|
|
83
|
-
* // …route `IntakeProcess` to your worker, `IntakeReplay` to the responder.
|
|
84
|
-
* // on the worker's done Msg:
|
|
85
|
-
* const [next, _] = intake.complete(state.intake, key, result, at);
|
|
86
|
-
* // once, after boot (DO reload), before resuming the drain:
|
|
87
|
-
* const [next, _] = intake.boot(state.intake);
|
|
88
|
-
*
|
|
89
|
-
* Escape hatch: reach the raw L1 ops via `@demlik/tea/idempotency` and
|
|
90
|
-
* `@demlik/tea/work-queue` and thread them by hand.
|
|
91
|
-
*/
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* A cached intake entry: either a key whose work is still in flight
|
|
95
|
-
* (`pending`) or one whose work has finished and whose `result` is held for
|
|
96
|
-
* replay to later duplicates (`done`). Discriminated on `phase` — `pending`
|
|
97
|
-
* carries no payload, `done` carries the result `R`.
|
|
98
|
-
*
|
|
99
|
-
* Lives inside the `seen` half of the slice (`IdempotencyStore<IntakeEntry<R>>`).
|
|
100
|
-
* It is the dedupe ledger's *value*; the ledger's *key* is `keyOf(payload)`.
|
|
101
|
-
*/
|
|
102
|
-
type IntakeEntry<R> = {
|
|
103
|
-
readonly phase: "pending";
|
|
104
|
-
} | {
|
|
105
|
-
readonly phase: "done";
|
|
106
|
-
readonly result: R;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* The intake knob's config — `keyOf` derives the idempotency key from a
|
|
110
|
-
* payload, `ttlMs` (optional) ages a *completed* cached key out so a webhook
|
|
111
|
-
* replayed long after the work finished is treated as new and re-processed.
|
|
112
|
-
*
|
|
113
|
-
* **The TTL clock starts at `complete`, not at `receive`.** A `pending` entry
|
|
114
|
-
* (work still in flight) NEVER ages out, no matter how slow the worker is —
|
|
115
|
-
* ageing a pending key would let the duplicate re-enqueue the in-flight
|
|
116
|
-
* payload and double-process it. Only a `done` entry expires, measured from
|
|
117
|
-
* the `at` passed to `complete` (the moment the result was cached). Inside the
|
|
118
|
-
* window a duplicate replays the cached result; at/after the window it is
|
|
119
|
-
* re-accepted and re-processed.
|
|
120
|
-
*
|
|
121
|
-
* Omit `ttlMs` for a cache whose `done` entries never expire by age (keys live
|
|
122
|
-
* forever — fine for a bounded universe of ids, unbounded growth otherwise).
|
|
123
|
-
*
|
|
124
|
-
* The TTL is owned HERE, not delegated to the composed `IdempotencyStore`: the
|
|
125
|
-
* store's uniform per-entry TTL cannot tell `pending` from `done`, so intake
|
|
126
|
-
* keeps the store TTL-free and applies the phase-aware rule itself (see
|
|
127
|
-
* `liveEntry`).
|
|
128
|
-
*/
|
|
129
|
-
interface IntakeConfig<P> {
|
|
130
|
-
/** Derive the idempotency key from a payload. Must be pure + deterministic. */
|
|
131
|
-
readonly keyOf: (payload: P) => string;
|
|
132
|
-
/**
|
|
133
|
-
* Age a *completed* key out after this many ms, measured from the `at`
|
|
134
|
-
* passed to `complete`. Pending keys never age out.
|
|
135
|
-
*/
|
|
136
|
-
readonly ttlMs?: number;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* The Model slice this knob owns. `seen` is the dedupe + last-result cache
|
|
140
|
-
* (the `../idempotency` brick); `queue` is the pending-work list (the
|
|
141
|
-
* `../work-queue` brick). Both are plain serializable values — the whole slice
|
|
142
|
-
* round-trips through `JSON` so it survives eviction and replays exactly.
|
|
143
|
-
*/
|
|
144
|
-
interface IntakeState<P, R> {
|
|
145
|
-
readonly seen: IdempotencyStore<IntakeEntry<R>>;
|
|
146
|
-
readonly queue: readonly QueueItem<P>[];
|
|
147
|
-
}
|
|
148
|
-
/** A genuinely-new payload was accepted and enqueued — go run the work. */
|
|
149
|
-
interface IntakeProcessCmd<P> extends Cmd<"intake:process"> {
|
|
150
|
-
/** The dedupe key the payload was filed under. */
|
|
151
|
-
readonly key: string;
|
|
152
|
-
/** The enqueued queue-item id (the same `id` passed to `receive`). */
|
|
153
|
-
readonly itemId: string;
|
|
154
|
-
/** The original payload, for the worker to process. */
|
|
155
|
-
readonly payload: P;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* A duplicate of an already-completed key arrived — replay the cached result
|
|
159
|
-
* to the caller instead of re-running the side effect.
|
|
160
|
-
*/
|
|
161
|
-
interface IntakeReplayCmd<R> extends Cmd<"intake:replay"> {
|
|
162
|
-
/** The dedupe key whose cached result is being replayed. */
|
|
163
|
-
readonly key: string;
|
|
164
|
-
/** The result the ORIGINAL request produced, recalled from the cache. */
|
|
165
|
-
readonly result: R;
|
|
166
|
-
}
|
|
167
|
-
/** The Cmd union the intake verbs emit. */
|
|
168
|
-
type IntakeCmd<P, R> = IntakeProcessCmd<P> | IntakeReplayCmd<R>;
|
|
169
|
-
/**
|
|
170
|
-
* Build an idempotent-intake knob from `config`. Returns the uniform L2
|
|
171
|
-
* contract — `init()` + the verbs (`receive`, `complete`, `boot`, `claimNext`).
|
|
172
|
-
* No `subs` / `handlers`: intake owns no timers and does no I/O of its own (the
|
|
173
|
-
* composed bricks are pure-ops; the worker that runs `IntakeProcess` and the
|
|
174
|
-
* responder that runs `IntakeReplay` live in the host's interpret map).
|
|
175
|
-
*/
|
|
176
|
-
declare function createIntake<P, R>(config: IntakeConfig<P>): {
|
|
177
|
-
init: () => IntakeState<P, R>;
|
|
178
|
-
receive: (state: IntakeState<P, R>, payload: P, at: number, id: string) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
|
|
179
|
-
complete: (state: IntakeState<P, R>, key: string, result: R, at: number) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
|
|
180
|
-
boot: (state: IntakeState<P, R>) => readonly [IntakeState<P, R>, readonly IntakeCmd<P, R>[]];
|
|
181
|
-
claimNext: (state: IntakeState<P, R>, at: number) => {
|
|
182
|
-
readonly state: IntakeState<P, R>;
|
|
183
|
-
readonly claimed: QueueItem<P>;
|
|
184
|
-
} | null;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export { type IntakeCmd, type IntakeConfig, type IntakeEntry, type IntakeProcessCmd, type IntakeReplayCmd, type IntakeState, createIntake };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/llm-call/index.d.ts
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { C as Cmd } from '../core-Bjc0bS8j.js';
|
|
2
|
-
import { RunCmd, SucceedMsg, FailMsg, ResilientState } from '../resilient-call/index.js';
|
|
3
|
-
import { RetryPolicy } from '../retry-backoff/index.js';
|
|
4
|
-
import { DeadlineExceeded, DeadlineSub } from '../deadline/index.js';
|
|
5
|
-
export { deadlineSub, subscribeDeadline } from '../deadline/index.js';
|
|
6
|
-
import '../cache/index.js';
|
|
7
|
-
import '../types-D7u9DkH7.js';
|
|
8
|
-
import '../circuit-breaker/index.js';
|
|
9
|
-
import '../protocol-B5YmJr0d.js';
|
|
10
|
-
import '../rate-limit/index.js';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @packageDocumentation
|
|
14
|
-
* @demlik/tea/llm-call — `resilient-call` + structured-output parse + a typed
|
|
15
|
-
* failure variant, around a purpose-discriminated LLM invocation.
|
|
16
|
-
*
|
|
17
|
-
* This is the ~60-line `call_llm` handler from the audit-agent seed
|
|
18
|
-
* (`interpret.ts` / `effects.ts`) collapsed into the uniform L2 knob: a config
|
|
19
|
-
* object, the resilient-call slice it inherits, and one interpret handler that
|
|
20
|
-
* assembles messages, binds the structured-output schema for the call's
|
|
21
|
-
* `purpose`, invokes the model (retry composed from `../resilient-call`, NOT
|
|
22
|
-
* reinvented), parses the output, and RETURNS the enriched resilient settle Msg
|
|
23
|
-
* (`resilient_ok` / `resilient_err`) so it re-enters the host reducer and drives
|
|
24
|
-
* the inherited succeed/fail → backoff → onTimer loop.
|
|
25
|
-
*
|
|
26
|
-
* ## What it adds over `../resilient-call`
|
|
27
|
-
*
|
|
28
|
-
* - **Two DI ports** (the seed's two seams):
|
|
29
|
-
* 1. `model: (modelId) => LLM` — the model factory. Tests pass a fake so
|
|
30
|
-
* the handler runs end-to-end without touching a real provider; the
|
|
31
|
-
* production worker wires `createChatModel(env, …)`.
|
|
32
|
-
* 2. `loadMessages: Loader` — the SDK / message loader. The seed lazy-
|
|
33
|
-
* imports `@langchain/core/messages` (a top-level `import type` blows
|
|
34
|
-
* up the workers test runner); the loader keeps that import lazy and
|
|
35
|
-
* stubbable. It produces the `BaseMessage[]` for a given call.
|
|
36
|
-
* - **Structured-output parse** — each `purpose` maps to a `Schema` in
|
|
37
|
-
* `config.schemas`. The handler binds `model.withStructuredOutput(schema)`
|
|
38
|
-
* so the invoke resolves to a typed object; a `Schema.parse` that throws
|
|
39
|
-
* becomes a `resilient_err` carrying an `LlmErr` (a parse failure is a
|
|
40
|
-
* failure, not a stall — "errors are data"). `withStructuredOutput` is the
|
|
41
|
-
* seed's brain-only path; the fake model in tests returns the typed object
|
|
42
|
-
* directly.
|
|
43
|
-
* - **A typed failure variant** — every failure (model throw, timeout-via-
|
|
44
|
-
* retry-exhaustion, schema parse) is surfaced as the `LlmErr` carried on the
|
|
45
|
-
* enriched `resilient_err` settle Msg, tagged with the `purpose` so the
|
|
46
|
-
* consumer's reducer routes per-stage. The seed dispatched
|
|
47
|
-
* `llm_failed{purpose}`; the consumer rebuilds that shape in its reducer arm
|
|
48
|
-
* from `m.error: LlmErr`.
|
|
49
|
-
*
|
|
50
|
-
* ## Inheriting resilient-call by composition (not reinvention)
|
|
51
|
-
*
|
|
52
|
-
* The retry / backoff lives in `../resilient-call`: `createLlmCall` builds a
|
|
53
|
-
* `createResilientCall` knob over the model-invoke port and DELEGATES `init`,
|
|
54
|
-
* `attempt`, `succeed`, `fail`, `onTimer`, `subs` to it verbatim — the slice is
|
|
55
|
-
* literally resilient-call's slice (the spec's "retry lives here"). There is no
|
|
56
|
-
* second backoff implementation here. The handler runs the invoke through the
|
|
57
|
-
* resilient-call handler so a transient model failure backs off exactly as a
|
|
58
|
-
* resilient HTTP call would; the `purpose`-branch + structured parse wrap the
|
|
59
|
-
* port the resilient handler drives.
|
|
60
|
-
*
|
|
61
|
-
* ## The two non-negotiables (canon, inherited)
|
|
62
|
-
*
|
|
63
|
-
* - **Durable** — the slice is resilient-call's plain-data slice (a Model
|
|
64
|
-
* field). Input carried on the `resilient_run` Cmd is the plain
|
|
65
|
-
* `LlmCall` request (purpose + modelId + payload) — no closures.
|
|
66
|
-
* - **Replayable** — every transition is a resilient-call verb; the handler
|
|
67
|
-
* is the only impurity, and the one clock read is `Date.now()` at the
|
|
68
|
-
* effect boundary (inside the handler), exactly as the seed stamped its
|
|
69
|
-
* `llm_responded` / `llm_failed` Msgs.
|
|
70
|
-
*
|
|
71
|
-
* ## Typical wiring
|
|
72
|
-
*
|
|
73
|
-
* const llm = createLlmCall<MyPurpose, MyOutputs>({
|
|
74
|
-
* model: (id) => createChatModel(env, id),
|
|
75
|
-
* schemas: { plan: planSchema, report: reportSchema },
|
|
76
|
-
* retry: defaultRetryPolicy,
|
|
77
|
-
* loadMessages: defaultMessagesLoader,
|
|
78
|
-
* });
|
|
79
|
-
*
|
|
80
|
-
* // in the machine:
|
|
81
|
-
* init: () => [{ resilience: llm.init() }, []],
|
|
82
|
-
* update: {
|
|
83
|
-
* call_llm: (s, m) => lift(s, llm.attempt(s.resilience, m.input, m.at)),
|
|
84
|
-
* // `resilient_ok` / `resilient_err` RE-ENTER from `handlers` (the settle
|
|
85
|
-
* // Msg the interpret handler returns). Run the inherited verb FIRST so the
|
|
86
|
-
* // succeed/fail → backoff → onTimer loop advances, THEN fold the enriched
|
|
87
|
-
* // payload (`m.result: LlmOk` / `m.error: LlmErr`) into the host's own
|
|
88
|
-
* // state — the enrichment lives in the reducer arm, not the handler.
|
|
89
|
-
* resilient_ok: (s, m) => {
|
|
90
|
-
* const [slice, cmds] = llm.succeed(s.resilience, m.key, m);
|
|
91
|
-
* return [{ ...s, resilience: slice, output: m.result.output }, cmds];
|
|
92
|
-
* },
|
|
93
|
-
* resilient_err: (s, m) => {
|
|
94
|
-
* const [slice, cmds] = llm.fail(s.resilience, m.key, m);
|
|
95
|
-
* return [{ ...s, resilience: slice, failure: m.error }, cmds];
|
|
96
|
-
* },
|
|
97
|
-
* deadline_exceeded: (s, m) => lift(s, llm.onTimer(s.resilience, m)),
|
|
98
|
-
* },
|
|
99
|
-
* subscriptions: (s) => llm.subs(s.resilience),
|
|
100
|
-
* subscribe: { deadline: subscribeDeadline },
|
|
101
|
-
* interpret: llm.handlers(),
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* The minimal structured-output schema contract: `parse(unknown) => T`, the
|
|
106
|
-
* zod-style call the handler uses to validate the model's output before it
|
|
107
|
-
* settles `resilient_ok`. A throwing `parse` (the zod contract on invalid
|
|
108
|
-
* input) propagates out of `invokeOne` and is caught by the resilient handler,
|
|
109
|
-
* which settles `resilient_err` (enriched to `LlmErr`) — a parse failure is a
|
|
110
|
-
* failure, never a silent pass. Structural so a real `z.ZodType<T>` satisfies
|
|
111
|
-
* it without an import.
|
|
112
|
-
*/
|
|
113
|
-
interface Schema<T> {
|
|
114
|
-
/** Validate + narrow `value` to `T`, or throw on mismatch (the zod contract). */
|
|
115
|
-
parse(value: unknown): T;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* The minimal chat-model contract every model the handler talks to must
|
|
119
|
-
* satisfy — the seed's `InjectableChatModel`, trimmed to the one operation
|
|
120
|
-
* llm-call drives for brain-only stages:
|
|
121
|
-
*
|
|
122
|
-
* `withStructuredOutput(schema)` → a runnable whose `invoke(messages)`
|
|
123
|
-
* resolves to a typed object matching `schema`.
|
|
124
|
-
*
|
|
125
|
-
* `BaseChatModel` from `@langchain/core` is the runtime type; this surface
|
|
126
|
-
* names only what llm-call calls so a test fake can ignore the rest. Generic
|
|
127
|
-
* over the message shape `Msg` so a consumer's loader and model agree on it
|
|
128
|
-
* without llm-call inspecting messages.
|
|
129
|
-
*/
|
|
130
|
-
interface Llm<Msg> {
|
|
131
|
-
withStructuredOutput<T>(schema: Schema<T>): {
|
|
132
|
-
invoke(messages: readonly Msg[]): Promise<T>;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Build the `Msg[]` the handler hands to the bound model for a given call. The
|
|
137
|
-
* SDK / message-assembly seam — the seed's `buildBaseMessages` + the lazy
|
|
138
|
-
* `loadMessages` loader rolled into one injected port. Async because the seed
|
|
139
|
-
* lazy-imports the SDK (a top-level `import type` of the langchain messages
|
|
140
|
-
* package explodes the workers test runner). Receives the full `LlmCall` so it
|
|
141
|
-
* can branch on `purpose` exactly as the seed's `buildBaseMessages` did.
|
|
142
|
-
*/
|
|
143
|
-
type MessageLoader<P extends string, Msg> = (call: LlmCall<P>) => Promise<readonly Msg[]>;
|
|
144
|
-
/**
|
|
145
|
-
* The model factory — the first DI port. `(modelId) => Llm`. Tests pass a fake
|
|
146
|
-
* builder; production wires `createChatModel(env, getModelConfig(id))`. `null`
|
|
147
|
-
* means "the host's default model" (the seed's `string | null`).
|
|
148
|
-
*/
|
|
149
|
-
type ModelFactory<Msg> = (modelId: string | null) => Llm<Msg>;
|
|
150
|
-
/**
|
|
151
|
-
* The llm-call knob. `model` and `schemas` are the load-bearing pair — the
|
|
152
|
-
* model factory DI port and the per-purpose structured-output targets; the
|
|
153
|
-
* rest is optional, exactly the resilient-call "omit a brick → omit its gate"
|
|
154
|
-
* story for `retry`:
|
|
155
|
-
*
|
|
156
|
-
* - `model` — DI port 1: the model factory.
|
|
157
|
-
* - `schemas` — one `Schema` per `Purpose`. The handler binds
|
|
158
|
-
* `schemas[call.purpose]` as the structured-output target.
|
|
159
|
-
* - `retry` — backoff policy, composed straight into `../resilient-
|
|
160
|
-
* call`. Omit it and a model failure is terminal (no
|
|
161
|
-
* backoff), exactly as resilient-call with no retry brick.
|
|
162
|
-
* - `loadMessages` — DI port 2: the SDK / message loader. Omit it and the
|
|
163
|
-
* handler invokes the bound model with `[]` (a degenerate
|
|
164
|
-
* but valid call) — provide it to assemble real messages.
|
|
165
|
-
*
|
|
166
|
-
* `P` is the purpose union (e.g. `"plan" | "report"`); `O` maps each purpose to
|
|
167
|
-
* its parsed output type; `Msg` is the model's message shape (threaded through
|
|
168
|
-
* the loader + model so llm-call never inspects a message).
|
|
169
|
-
*/
|
|
170
|
-
interface LlmCallConfig<P extends string, O extends Record<P, unknown>, Msg = unknown> {
|
|
171
|
-
/** DI port 1 — the model factory. `(modelId) => Llm`. */
|
|
172
|
-
readonly model: ModelFactory<Msg>;
|
|
173
|
-
/** One structured-output schema per purpose; the parse target the handler binds. */
|
|
174
|
-
readonly schemas: {
|
|
175
|
-
readonly [K in P]: Schema<O[K]>;
|
|
176
|
-
};
|
|
177
|
-
/** Backoff policy, composed into `../resilient-call`. Omit → no backoff. */
|
|
178
|
-
readonly retry?: RetryPolicy;
|
|
179
|
-
/** DI port 2 — the SDK / message loader. Omit → the handler invokes with `[]`. */
|
|
180
|
-
readonly loadMessages?: MessageLoader<P, Msg>;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* One LLM call request — the resilient-call `input` for this knob, carried on
|
|
184
|
-
* the `resilient_run` Cmd as plain data (no closures, invariant 3). Mirrors the
|
|
185
|
-
* seed's purpose-discriminated `CallLlmCmd`: a `purpose` selecting the schema +
|
|
186
|
-
* prompt assembly, the `model` id, and the opaque per-purpose `payload` the
|
|
187
|
-
* loader consumes.
|
|
188
|
-
*
|
|
189
|
-
* `key` defaults to `purpose` when the consumer calls `attempt(s, purpose, …)`,
|
|
190
|
-
* so one in-flight call per purpose is tracked under the resilient-call slice —
|
|
191
|
-
* the common single-call-per-stage shape. A consumer that fans out many calls
|
|
192
|
-
* of one purpose passes a distinct `key`.
|
|
193
|
-
*/
|
|
194
|
-
interface LlmCall<P extends string> {
|
|
195
|
-
/** The stage / schema selector — drives both `schemas[purpose]` and message assembly. */
|
|
196
|
-
readonly purpose: P;
|
|
197
|
-
/** The model id to invoke; `null` = the host's default model. */
|
|
198
|
-
readonly model: string | null;
|
|
199
|
-
/** The per-purpose prompt payload the `MessageLoader` consumes. Opaque to the knob. */
|
|
200
|
-
readonly payload: unknown;
|
|
201
|
-
}
|
|
202
|
-
/** The parsed, typed success carried on the `resilient_ok` settle Msg, tagged with its purpose. */
|
|
203
|
-
interface LlmOk<P extends string, O extends Record<P, unknown>> {
|
|
204
|
-
readonly key: string;
|
|
205
|
-
readonly purpose: P;
|
|
206
|
-
readonly output: O[P];
|
|
207
|
-
}
|
|
208
|
-
/** The typed failure variant — every failure path surfaces this, tagged by purpose. */
|
|
209
|
-
interface LlmErr<P extends string> {
|
|
210
|
-
readonly key: string;
|
|
211
|
-
readonly purpose: P;
|
|
212
|
-
/** A human-readable cause (model throw, retry-exhaustion, or schema parse). */
|
|
213
|
-
readonly reason: string;
|
|
214
|
-
/** The original error, carried untouched for the consumer to inspect. */
|
|
215
|
-
readonly error: unknown;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* The settle Msgs llm-call's handler RETURNS from `interpret` so the substrate
|
|
219
|
-
* enqueues them as follow-up Msgs (re-entry) into the host reducer — exactly as
|
|
220
|
-
* `../resilient-call` does. They are the resilient-call settle Msgs with the
|
|
221
|
-
* payloads ENRICHED to llm-call's typed variants: `result` is the parsed,
|
|
222
|
-
* purpose-tagged `LlmOk`; `error` is the typed `LlmErr` (purpose + reason +
|
|
223
|
-
* raw). The host wires `resilient_ok` → `succeed` and `resilient_err` → `fail`
|
|
224
|
-
* reducer arms (the doc-comment wiring), and folds the enriched payload into its
|
|
225
|
-
* own state there — llm-call never forces a Msg vocabulary on the host, and the
|
|
226
|
-
* settle Msg drives the inherited succeed/fail → backoff → onTimer loop instead
|
|
227
|
-
* of bypassing it.
|
|
228
|
-
*/
|
|
229
|
-
type LlmSucceedMsg<P extends string, O extends Record<P, unknown>> = SucceedMsg<LlmOk<P, O>>;
|
|
230
|
-
type LlmFailMsg<P extends string> = Omit<FailMsg, "error"> & {
|
|
231
|
-
readonly error: LlmErr<P>;
|
|
232
|
-
};
|
|
233
|
-
/** The retry / deadline timer Msg — `DeadlineExceeded`, inherited from resilient-call. */
|
|
234
|
-
type LlmTimerMsg = DeadlineExceeded;
|
|
235
|
-
/**
|
|
236
|
-
* The ports the LEGACY detached `handlers(ports)` form takes. Two outbound Msg
|
|
237
|
-
* builders the handler hands the typed Ok / Err; the consumer returns its own
|
|
238
|
-
* Msg (or `undefined`). KEPT only for `../agent`, which still inherits the
|
|
239
|
-
* detached shape; that path does NOT drive the retry loop (it dispatches the
|
|
240
|
-
* consumer's Msg directly and never re-enters the resilient settle Msg). New
|
|
241
|
-
* consumers use the no-arg `handlers()` form, which RETURNS the settle Msg for
|
|
242
|
-
* re-entry and drives the inherited succeed/fail → backoff → onTimer loop.
|
|
243
|
-
* `../agent` carries the same retry-loop gap and is fixed separately.
|
|
244
|
-
*
|
|
245
|
-
* The builders return `M | undefined` — `undefined` is the "dispatch nothing"
|
|
246
|
-
* sentinel the detached form checks (`!== undefined`), spelled as `undefined`
|
|
247
|
-
* rather than `void` so the union is unambiguous (a `void` member of a union is
|
|
248
|
-
* confusing and reads as "may return anything").
|
|
249
|
-
*/
|
|
250
|
-
interface LlmCallPorts<P extends string, O extends Record<P, unknown>, M> {
|
|
251
|
-
/** Build the Msg dispatched on a parsed success. Return `undefined` to dispatch nothing. */
|
|
252
|
-
readonly onOk: (ok: LlmOk<P, O>) => M | undefined;
|
|
253
|
-
/** Build the Msg dispatched on any failure (throw / retry-exhausted / parse). */
|
|
254
|
-
readonly onErr: (err: LlmErr<P>) => M | undefined;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* The effect Cmd the knob emits: run the LLM call for `key` with `input`. The
|
|
258
|
-
* `input` is the plain `LlmCall` request — the handler reads `purpose` /
|
|
259
|
-
* `model` / `payload` off it (invariant 3: Cmds are data).
|
|
260
|
-
*
|
|
261
|
-
* It is `../resilient-call`'s `RunCmd` specialized to the `LlmCall` input — NOT a
|
|
262
|
-
* re-declared shape — so the resilient verbs' return tuples (`[State, RunCmd[]]`)
|
|
263
|
-
* are this exact type and thread through `attempt` / `succeed` / `fail` /
|
|
264
|
-
* `onTimer` with no cast.
|
|
265
|
-
*/
|
|
266
|
-
type LlmRunCmd<P extends string> = RunCmd<LlmCall<P>>;
|
|
267
|
-
/**
|
|
268
|
-
* Build an llm-call knob from `config`. `rng` is injected for the inherited
|
|
269
|
-
* retry jitter (pass a fixed `() => 0.5` in tests to pin backoff; defaults to
|
|
270
|
-
* `Math.random`, read only at the resilient-call verb boundary).
|
|
271
|
-
*
|
|
272
|
-
* Returns the uniform L2 knob contract. The slice + verbs (`init`, `attempt`,
|
|
273
|
-
* `succeed`, `fail`, `onTimer`, `subs`) are DELEGATED to a `../resilient-call`
|
|
274
|
-
* knob built over the structured-output model-invoke port — no second backoff
|
|
275
|
-
* here. `handlers` is the one new piece: the purpose-branching, schema-parsing
|
|
276
|
-
* wrapper that returns the enriched resilient settle Msg for re-entry.
|
|
277
|
-
*
|
|
278
|
-
* `P` is the purpose union, `O` the purpose→output map, `Msg` the model's
|
|
279
|
-
* message shape.
|
|
280
|
-
*/
|
|
281
|
-
declare function createLlmCall<P extends string, O extends Record<P, unknown>, Msg = unknown>(config: LlmCallConfig<P, O, Msg>, rng?: () => number): {
|
|
282
|
-
init: () => ResilientState<LlmCall<P>, LlmOk<P, O>>;
|
|
283
|
-
attempt: (s: ResilientState<LlmCall<P>, LlmOk<P, O>>, input: LlmCall<P>, at: number, key?: string) => readonly [ResilientState<LlmCall<P>, LlmOk<P, O>>, readonly LlmRunCmd<P>[]];
|
|
284
|
-
succeed: (s: ResilientState<LlmCall<P>, LlmOk<P, O>>, key: string, msg: LlmSucceedMsg<P, O>) => readonly [ResilientState<LlmCall<P>, LlmOk<P, O>>, readonly LlmRunCmd<P>[]];
|
|
285
|
-
fail: (s: ResilientState<LlmCall<P>, LlmOk<P, O>>, key: string, msg: LlmFailMsg<P>) => readonly [ResilientState<LlmCall<P>, LlmOk<P, O>>, readonly LlmRunCmd<P>[]];
|
|
286
|
-
onTimer: (s: ResilientState<LlmCall<P>, LlmOk<P, O>>, msg: LlmTimerMsg) => readonly [ResilientState<LlmCall<P>, LlmOk<P, O>>, readonly LlmRunCmd<P>[]];
|
|
287
|
-
subs: (s: ResilientState<LlmCall<P>, LlmOk<P, O>>) => readonly DeadlineSub[];
|
|
288
|
-
handlers: {
|
|
289
|
-
(): {
|
|
290
|
-
resilient_run: (cmd: LlmRunCmd<P>) => Promise<LlmSucceedMsg<P, O> | LlmFailMsg<P>>;
|
|
291
|
-
};
|
|
292
|
-
<M>(ports: LlmCallPorts<P, O, M>): {
|
|
293
|
-
resilient_run: (cmd: LlmRunCmd<P>, ctx: {
|
|
294
|
-
waitUntil(p: Promise<unknown>): void;
|
|
295
|
-
dispatch(msg: M): unknown;
|
|
296
|
-
}) => void;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
invokeOne: (input: LlmCall<P>) => Promise<LlmOk<P, O>>;
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Lift a knob result `[slice, cmds]` into a host `[State, cmds]` where the
|
|
303
|
-
* slice lives at `state.resilience` — the same convenience `../resilient-call`
|
|
304
|
-
* ships, re-typed for the llm-call slice so consumers wire one import. Pure.
|
|
305
|
-
*/
|
|
306
|
-
declare function liftLlmCall<S extends {
|
|
307
|
-
resilience: ResilientState<LlmCall<P>, LlmOk<P, O>>;
|
|
308
|
-
}, P extends string, O extends Record<P, unknown>, C extends Cmd>(state: S, result: readonly [ResilientState<LlmCall<P>, LlmOk<P, O>>, readonly C[]]): readonly [S, readonly C[]];
|
|
309
|
-
|
|
310
|
-
export { DeadlineExceeded, DeadlineSub, type Llm, type LlmCall, type LlmCallConfig, type LlmCallPorts, type LlmErr, type LlmFailMsg, type LlmOk, type LlmRunCmd, type LlmSucceedMsg, type LlmTimerMsg, type MessageLoader, type ModelFactory, ResilientState, type Schema, createLlmCall, liftLlmCall };
|
package/dist/llm-call/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export { createLlmCall, liftLlmCall } from '../chunk-ND3DH6KM.js';
|
|
2
|
-
import '../chunk-EUF7XOEE.js';
|
|
3
|
-
import '../chunk-JELSZN25.js';
|
|
4
|
-
export { deadlineSub, subscribeDeadline } from '../chunk-JGVL3WPL.js';
|
|
5
|
-
import '../chunk-Q2UM7BXU.js';
|
|
6
|
-
import '../chunk-S2EGRPCM.js';
|
|
7
|
-
import '../chunk-UF4MZSLT.js';
|
|
8
|
-
import '../chunk-7SVIRMC6.js';
|
|
9
|
-
import '../chunk-3JU6657S.js';
|
|
10
|
-
import '../chunk-2YFLOCWX.js';
|
|
11
|
-
import '../chunk-ZJ5AOYBH.js';
|
|
12
|
-
import '../chunk-G5E74IJB.js';
|
|
13
|
-
import '../chunk-5EHLEUTL.js';
|
|
14
|
-
import '../chunk-B5VXOFMZ.js';
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|