@graphrefly/graphrefly 0.43.0 → 0.45.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 +21 -17
- package/dist/compat/index.cjs +20 -10
- package/dist/compat/index.cjs.map +1 -0
- package/dist/compat/index.d.cts +1 -22
- package/dist/compat/index.d.ts +1 -22
- package/dist/compat/index.js +3 -1
- package/dist/compat/index.js.map +1 -0
- package/dist/compat/jotai/index.cjs +21 -1
- package/dist/compat/jotai/index.cjs.map +1 -0
- package/dist/compat/jotai/index.d.cts +1 -2
- package/dist/compat/jotai/index.d.ts +1 -2
- package/dist/compat/jotai/index.js +3 -1
- package/dist/compat/jotai/index.js.map +1 -0
- package/dist/compat/nanostores/index.cjs +21 -1
- package/dist/compat/nanostores/index.cjs.map +1 -0
- package/dist/compat/nanostores/index.d.cts +1 -2
- package/dist/compat/nanostores/index.d.ts +1 -2
- package/dist/compat/nanostores/index.js +3 -1
- package/dist/compat/nanostores/index.js.map +1 -0
- package/dist/compat/nestjs/index.cjs +20 -10
- package/dist/compat/nestjs/index.cjs.map +1 -0
- package/dist/compat/nestjs/index.d.cts +1 -13
- package/dist/compat/nestjs/index.d.ts +1 -13
- package/dist/compat/nestjs/index.js +3 -1
- package/dist/compat/nestjs/index.js.map +1 -0
- package/dist/compat/react/index.cjs +21 -1
- package/dist/compat/react/index.cjs.map +1 -0
- package/dist/compat/react/index.d.cts +1 -2
- package/dist/compat/react/index.d.ts +1 -2
- package/dist/compat/react/index.js +3 -1
- package/dist/compat/react/index.js.map +1 -0
- package/dist/compat/solid/index.cjs +21 -1
- package/dist/compat/solid/index.cjs.map +1 -0
- package/dist/compat/solid/index.d.cts +1 -2
- package/dist/compat/solid/index.d.ts +1 -2
- package/dist/compat/solid/index.js +3 -1
- package/dist/compat/solid/index.js.map +1 -0
- package/dist/compat/svelte/index.cjs +21 -1
- package/dist/compat/svelte/index.cjs.map +1 -0
- package/dist/compat/svelte/index.d.cts +1 -2
- package/dist/compat/svelte/index.d.ts +1 -2
- package/dist/compat/svelte/index.js +3 -1
- package/dist/compat/svelte/index.js.map +1 -0
- package/dist/compat/vue/index.cjs +21 -1
- package/dist/compat/vue/index.cjs.map +1 -0
- package/dist/compat/vue/index.d.cts +1 -3
- package/dist/compat/vue/index.d.ts +1 -3
- package/dist/compat/vue/index.js +3 -1
- package/dist/compat/vue/index.js.map +1 -0
- package/dist/compat/zustand/index.cjs +21 -3
- package/dist/compat/zustand/index.cjs.map +1 -0
- package/dist/compat/zustand/index.d.cts +1 -6
- package/dist/compat/zustand/index.d.ts +1 -6
- package/dist/compat/zustand/index.js +3 -1
- package/dist/compat/zustand/index.js.map +1 -0
- package/dist/core/index.cjs +21 -1
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +1 -4
- package/dist/core/index.d.ts +1 -4
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -0
- package/dist/extra/browser.cjs +21 -1
- package/dist/extra/browser.cjs.map +1 -0
- package/dist/extra/browser.d.cts +1 -4
- package/dist/extra/browser.d.ts +1 -4
- package/dist/extra/browser.js +3 -1
- package/dist/extra/browser.js.map +1 -0
- package/dist/extra/index.cjs +20 -19
- package/dist/extra/index.cjs.map +1 -0
- package/dist/extra/index.d.cts +1 -17
- package/dist/extra/index.d.ts +1 -17
- package/dist/extra/index.js +3 -1
- package/dist/extra/index.js.map +1 -0
- package/dist/extra/node.cjs +21 -2
- package/dist/extra/node.cjs.map +1 -0
- package/dist/extra/node.d.cts +1 -187
- package/dist/extra/node.d.ts +1 -187
- package/dist/extra/node.js +3 -2
- package/dist/extra/node.js.map +1 -0
- package/dist/extra/operators.cjs +21 -1
- package/dist/extra/operators.cjs.map +1 -0
- package/dist/extra/operators.d.cts +1 -950
- package/dist/extra/operators.d.ts +1 -950
- package/dist/extra/operators.js +3 -1
- package/dist/extra/operators.js.map +1 -0
- package/dist/extra/reactive.cjs +21 -1
- package/dist/extra/reactive.cjs.map +1 -0
- package/dist/extra/reactive.d.cts +1 -353
- package/dist/extra/reactive.d.ts +1 -353
- package/dist/extra/reactive.js +3 -1
- package/dist/extra/reactive.js.map +1 -0
- package/dist/extra/render/index.cjs +21 -5
- package/dist/extra/render/index.cjs.map +1 -0
- package/dist/extra/render/index.d.cts +1 -183
- package/dist/extra/render/index.d.ts +1 -183
- package/dist/extra/render/index.js +3 -1
- package/dist/extra/render/index.js.map +1 -0
- package/dist/extra/sources.cjs +21 -3
- package/dist/extra/sources.cjs.map +1 -0
- package/dist/extra/sources.d.cts +1 -584
- package/dist/extra/sources.d.ts +1 -584
- package/dist/extra/sources.js +3 -1
- package/dist/extra/sources.js.map +1 -0
- package/dist/extra/storage-browser.cjs +21 -1
- package/dist/extra/storage-browser.cjs.map +1 -0
- package/dist/extra/storage-browser.d.cts +1 -37
- package/dist/extra/storage-browser.d.ts +1 -37
- package/dist/extra/storage-browser.js +3 -1
- package/dist/extra/storage-browser.js.map +1 -0
- package/dist/extra/storage-core.cjs +21 -1
- package/dist/extra/storage-core.cjs.map +1 -0
- package/dist/extra/storage-core.d.cts +1 -28
- package/dist/extra/storage-core.d.ts +1 -28
- package/dist/extra/storage-core.js +3 -1
- package/dist/extra/storage-core.js.map +1 -0
- package/dist/extra/storage-node.cjs +20 -0
- package/dist/extra/storage-node.cjs.map +1 -0
- package/dist/extra/storage-node.d.cts +1 -2
- package/dist/extra/storage-node.d.ts +1 -2
- package/dist/extra/storage-node.js +3 -0
- package/dist/extra/storage-node.js.map +1 -0
- package/dist/extra/storage-tiers-browser.cjs +21 -1
- package/dist/extra/storage-tiers-browser.cjs.map +1 -0
- package/dist/extra/storage-tiers-browser.d.cts +1 -120
- package/dist/extra/storage-tiers-browser.d.ts +1 -120
- package/dist/extra/storage-tiers-browser.js +3 -1
- package/dist/extra/storage-tiers-browser.js.map +1 -0
- package/dist/extra/storage-tiers-node.cjs +21 -1
- package/dist/extra/storage-tiers-node.cjs.map +1 -0
- package/dist/extra/storage-tiers-node.d.cts +1 -210
- package/dist/extra/storage-tiers-node.d.ts +1 -210
- package/dist/extra/storage-tiers-node.js +3 -1
- package/dist/extra/storage-tiers-node.js.map +1 -0
- package/dist/extra/storage-tiers.cjs +21 -1
- package/dist/extra/storage-tiers.cjs.map +1 -0
- package/dist/extra/storage-tiers.d.cts +1 -412
- package/dist/extra/storage-tiers.d.ts +1 -412
- package/dist/extra/storage-tiers.js +3 -1
- package/dist/extra/storage-tiers.js.map +1 -0
- package/dist/extra/storage-wal.cjs +21 -0
- package/dist/extra/storage-wal.cjs.map +1 -0
- package/dist/extra/storage-wal.d.cts +1 -0
- package/dist/extra/storage-wal.d.ts +1 -0
- package/dist/extra/storage-wal.js +3 -0
- package/dist/extra/storage-wal.js.map +1 -0
- package/dist/graph/index.cjs +21 -7
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +1 -7
- package/dist/graph/index.d.ts +1 -7
- package/dist/graph/index.js +3 -1
- package/dist/graph/index.js.map +1 -0
- package/dist/index.cjs +20 -227
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +45 -96
- package/dist/index.d.ts +45 -96
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -0
- package/dist/patterns/ai/browser.cjs +20 -7
- package/dist/patterns/ai/browser.cjs.map +1 -0
- package/dist/patterns/ai/browser.d.cts +1 -127
- package/dist/patterns/ai/browser.d.ts +1 -127
- package/dist/patterns/ai/browser.js +3 -3
- package/dist/patterns/ai/browser.js.map +1 -0
- package/dist/patterns/ai/index.cjs +20 -73
- package/dist/patterns/ai/index.cjs.map +1 -0
- package/dist/patterns/ai/index.d.cts +1 -21
- package/dist/patterns/ai/index.d.ts +1 -21
- package/dist/patterns/ai/index.js +3 -1
- package/dist/patterns/ai/index.js.map +1 -0
- package/dist/patterns/ai/node.cjs +21 -1
- package/dist/patterns/ai/node.cjs.map +1 -0
- package/dist/patterns/ai/node.d.cts +1 -59
- package/dist/patterns/ai/node.d.ts +1 -59
- package/dist/patterns/ai/node.js +3 -1
- package/dist/patterns/ai/node.js.map +1 -0
- package/dist/patterns/cqrs/index.cjs +21 -3
- package/dist/patterns/cqrs/index.cjs.map +1 -0
- package/dist/patterns/cqrs/index.d.cts +1 -8
- package/dist/patterns/cqrs/index.d.ts +1 -8
- package/dist/patterns/cqrs/index.js +3 -1
- package/dist/patterns/cqrs/index.js.map +1 -0
- package/dist/patterns/demo-shell/index.cjs +21 -5
- package/dist/patterns/demo-shell/index.cjs.map +1 -0
- package/dist/patterns/demo-shell/index.d.cts +1 -7
- package/dist/patterns/demo-shell/index.d.ts +1 -7
- package/dist/patterns/demo-shell/index.js +3 -1
- package/dist/patterns/demo-shell/index.js.map +1 -0
- package/dist/patterns/domain-templates/index.cjs +21 -3
- package/dist/patterns/domain-templates/index.cjs.map +1 -0
- package/dist/patterns/domain-templates/index.d.cts +1 -6
- package/dist/patterns/domain-templates/index.d.ts +1 -6
- package/dist/patterns/domain-templates/index.js +3 -1
- package/dist/patterns/domain-templates/index.js.map +1 -0
- package/dist/patterns/graphspec/index.cjs +21 -86
- package/dist/patterns/graphspec/index.cjs.map +1 -0
- package/dist/patterns/graphspec/index.d.cts +1 -8
- package/dist/patterns/graphspec/index.d.ts +1 -8
- package/dist/patterns/graphspec/index.js +3 -1
- package/dist/patterns/graphspec/index.js.map +1 -0
- package/dist/patterns/harness/index.cjs +21 -48
- package/dist/patterns/harness/index.cjs.map +1 -0
- package/dist/patterns/harness/index.d.cts +1 -14
- package/dist/patterns/harness/index.d.ts +1 -14
- package/dist/patterns/harness/index.js +3 -1
- package/dist/patterns/harness/index.js.map +1 -0
- package/dist/patterns/inspect/index.cjs +21 -3
- package/dist/patterns/inspect/index.cjs.map +1 -0
- package/dist/patterns/inspect/index.d.cts +1 -9
- package/dist/patterns/inspect/index.d.ts +1 -9
- package/dist/patterns/inspect/index.js +3 -1
- package/dist/patterns/inspect/index.js.map +1 -0
- package/dist/patterns/job-queue/index.cjs +21 -3
- package/dist/patterns/job-queue/index.cjs.map +1 -0
- package/dist/patterns/job-queue/index.d.cts +1 -9
- package/dist/patterns/job-queue/index.d.ts +1 -9
- package/dist/patterns/job-queue/index.js +3 -1
- package/dist/patterns/job-queue/index.js.map +1 -0
- package/dist/patterns/memory/index.cjs +21 -3
- package/dist/patterns/memory/index.cjs.map +1 -0
- package/dist/patterns/memory/index.d.cts +1 -8
- package/dist/patterns/memory/index.d.ts +1 -8
- package/dist/patterns/memory/index.js +3 -1
- package/dist/patterns/memory/index.js.map +1 -0
- package/dist/patterns/messaging/index.cjs +21 -3
- package/dist/patterns/messaging/index.cjs.map +1 -0
- package/dist/patterns/messaging/index.d.cts +1 -7
- package/dist/patterns/messaging/index.d.ts +1 -7
- package/dist/patterns/messaging/index.js +3 -1
- package/dist/patterns/messaging/index.js.map +1 -0
- package/dist/patterns/orchestration/index.cjs +21 -3
- package/dist/patterns/orchestration/index.cjs.map +1 -0
- package/dist/patterns/orchestration/index.d.cts +1 -9
- package/dist/patterns/orchestration/index.d.ts +1 -9
- package/dist/patterns/orchestration/index.js +3 -1
- package/dist/patterns/orchestration/index.js.map +1 -0
- package/dist/patterns/process/index.cjs +21 -1
- package/dist/patterns/process/index.cjs.map +1 -0
- package/dist/patterns/process/index.d.cts +1 -10
- package/dist/patterns/process/index.d.ts +1 -10
- package/dist/patterns/process/index.js +3 -1
- package/dist/patterns/process/index.js.map +1 -0
- package/dist/patterns/reactive-layout/index.cjs +21 -4
- package/dist/patterns/reactive-layout/index.cjs.map +1 -0
- package/dist/patterns/reactive-layout/index.d.cts +1 -7
- package/dist/patterns/reactive-layout/index.d.ts +1 -7
- package/dist/patterns/reactive-layout/index.js +3 -1
- package/dist/patterns/reactive-layout/index.js.map +1 -0
- package/dist/patterns/reduction/index.cjs +21 -3
- package/dist/patterns/reduction/index.cjs.map +1 -0
- package/dist/patterns/reduction/index.d.cts +1 -6
- package/dist/patterns/reduction/index.d.ts +1 -6
- package/dist/patterns/reduction/index.js +3 -1
- package/dist/patterns/reduction/index.js.map +1 -0
- package/dist/patterns/surface/index.cjs +21 -13
- package/dist/patterns/surface/index.cjs.map +1 -0
- package/dist/patterns/surface/index.d.cts +1 -9
- package/dist/patterns/surface/index.d.ts +1 -9
- package/dist/patterns/surface/index.js +3 -1
- package/dist/patterns/surface/index.js.map +1 -0
- package/dist/patterns/topology-view/index.cjs +21 -0
- package/dist/patterns/topology-view/index.cjs.map +1 -0
- package/dist/patterns/topology-view/index.d.cts +1 -0
- package/dist/patterns/topology-view/index.d.ts +1 -0
- package/dist/patterns/topology-view/index.js +3 -0
- package/dist/patterns/topology-view/index.js.map +1 -0
- package/dist/testing/index.cjs +21 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +608 -584
- package/dist/backoff-HPZMEZNF.js +0 -1
- package/dist/cascading-CH-_VwG9.d.cts +0 -199
- package/dist/cascading-OgKQZjsa.d.ts +0 -199
- package/dist/chunk-35JTVPOX.js +0 -1
- package/dist/chunk-3G5U5QNE.js +0 -5
- package/dist/chunk-3XDYJRYU.js +0 -1
- package/dist/chunk-4I45FVQS.js +0 -1
- package/dist/chunk-4VVTGLXJ.js +0 -1
- package/dist/chunk-4YAN45KM.js +0 -1
- package/dist/chunk-5QDBSZBV.js +0 -1
- package/dist/chunk-626TESAC.js +0 -3
- package/dist/chunk-6HOSXQKF.js +0 -1
- package/dist/chunk-6QZNQS5B.js +0 -1
- package/dist/chunk-C72GO4IZ.js +0 -1
- package/dist/chunk-CE72X3WO.js +0 -1
- package/dist/chunk-CK2E7BTU.js +0 -1
- package/dist/chunk-CLD3F4R5.js +0 -1
- package/dist/chunk-CUNIRONA.js +0 -1
- package/dist/chunk-D27JNOLZ.js +0 -1
- package/dist/chunk-D5RFJOZ2.js +0 -1
- package/dist/chunk-EBW4V6JN.js +0 -1
- package/dist/chunk-ESMPEKEV.js +0 -1
- package/dist/chunk-F3IGTWCQ.js +0 -1
- package/dist/chunk-F672GV32.js +0 -1
- package/dist/chunk-FDQGFWLF.js +0 -1
- package/dist/chunk-FG4TKHMC.js +0 -1
- package/dist/chunk-GPW2V3RE.js +0 -1
- package/dist/chunk-I7IGYPSL.js +0 -1
- package/dist/chunk-INQD2KRQ.js +0 -1
- package/dist/chunk-JNWRYDJN.js +0 -1
- package/dist/chunk-JQFH2DV6.js +0 -1
- package/dist/chunk-K2Q24F5T.js +0 -1
- package/dist/chunk-KGKJCHEK.js +0 -1
- package/dist/chunk-KRH66M4O.js +0 -1
- package/dist/chunk-KVV66NN2.js +0 -1
- package/dist/chunk-L6NSJVJZ.js +0 -1
- package/dist/chunk-LYCLF26R.js +0 -1
- package/dist/chunk-NNKJUORL.js +0 -1
- package/dist/chunk-NON4NLIC.js +0 -45
- package/dist/chunk-O2BLLH7M.js +0 -18
- package/dist/chunk-OCKEEPRJ.js +0 -2
- package/dist/chunk-OFZG3TB3.js +0 -9
- package/dist/chunk-OYJKFY7V.js +0 -1
- package/dist/chunk-P6C4WHZO.js +0 -5
- package/dist/chunk-PT7W5FCD.js +0 -5
- package/dist/chunk-Q4U3A3L5.js +0 -1
- package/dist/chunk-QE4IGY7I.js +0 -61
- package/dist/chunk-QYADASLV.js +0 -1
- package/dist/chunk-QYVXF7GW.js +0 -1
- package/dist/chunk-S3EEIPO7.js +0 -1
- package/dist/chunk-SUWT3ZON.js +0 -1
- package/dist/chunk-TPKQW72B.js +0 -1
- package/dist/chunk-TSOYJ743.js +0 -1
- package/dist/chunk-TZQPPQEQ.js +0 -1
- package/dist/chunk-V5A7M7RJ.js +0 -1
- package/dist/chunk-VIMF6LGM.js +0 -1
- package/dist/chunk-VJLMUKOI.js +0 -1
- package/dist/chunk-VN6RDSK2.js +0 -1
- package/dist/chunk-VNC3TMVY.js +0 -1
- package/dist/chunk-VOPGGIL7.js +0 -1
- package/dist/chunk-VQ4A6T2A.js +0 -1
- package/dist/chunk-XG62INFA.js +0 -1
- package/dist/chunk-Y4NI3X7O.js +0 -84
- package/dist/content-addressed-storage-4-ST1tYk.d.cts +0 -124
- package/dist/content-addressed-storage-DuYMjV7o.d.ts +0 -124
- package/dist/decay-2ZukgQ4o.d.cts +0 -112
- package/dist/decay-CdEBmDIs.d.ts +0 -112
- package/dist/fallback-CqYVLL6X.d.ts +0 -250
- package/dist/fallback-Ctlj2tMY.d.cts +0 -250
- package/dist/graph-7VguS7a4.d.ts +0 -1668
- package/dist/graph-C4SHb3Ly.d.cts +0 -1668
- package/dist/index-0rKFCVFp.d.cts +0 -557
- package/dist/index-B-i4_g3k.d.ts +0 -651
- package/dist/index-B5iz82A3.d.cts +0 -2655
- package/dist/index-BAOD98JD.d.cts +0 -754
- package/dist/index-BG0BN3PB.d.ts +0 -44
- package/dist/index-BJX94aud.d.cts +0 -34
- package/dist/index-BP8a88zx.d.ts +0 -385
- package/dist/index-BTQtTb_H.d.cts +0 -301
- package/dist/index-BVpm6noz.d.cts +0 -36
- package/dist/index-Bc41FuHp.d.cts +0 -291
- package/dist/index-BdGtBX-X.d.cts +0 -515
- package/dist/index-Bf7eqeSF.d.ts +0 -113
- package/dist/index-BiX1Nkgx.d.cts +0 -1844
- package/dist/index-BoLv_OfD.d.cts +0 -651
- package/dist/index-BojK2fwH.d.cts +0 -299
- package/dist/index-BsT7F2et.d.ts +0 -291
- package/dist/index-BwLvVVsy.d.cts +0 -189
- package/dist/index-C59mYFKp.d.ts +0 -121
- package/dist/index-C7O6r5fV.d.ts +0 -37
- package/dist/index-C9kSENB4.d.cts +0 -127
- package/dist/index-C9pjcz3l.d.cts +0 -209
- package/dist/index-CAC_rNzm.d.ts +0 -189
- package/dist/index-CCq87F7t.d.ts +0 -127
- package/dist/index-CDXc9zKM.d.cts +0 -26
- package/dist/index-CJK1JkYy.d.ts +0 -36
- package/dist/index-CLon-IWF.d.cts +0 -374
- package/dist/index-COD1kVoS.d.cts +0 -468
- package/dist/index-CPT7C_f1.d.ts +0 -374
- package/dist/index-CQG3D1cp.d.ts +0 -468
- package/dist/index-CZQXo5tH.d.ts +0 -209
- package/dist/index-CZjOhcBy.d.cts +0 -113
- package/dist/index-ChOyVLKm.d.cts +0 -86
- package/dist/index-CvrqGfNS.d.ts +0 -34
- package/dist/index-D-AEQVLo.d.ts +0 -2655
- package/dist/index-D4Y1cMG0.d.ts +0 -26
- package/dist/index-DBHK8O6H.d.ts +0 -301
- package/dist/index-DBevwHj_.d.ts +0 -515
- package/dist/index-DIOoAZUX.d.ts +0 -45
- package/dist/index-DSZ3ZCHF.d.ts +0 -3402
- package/dist/index-Dgs8zcj7.d.ts +0 -102
- package/dist/index-Dh_HJ82K.d.ts +0 -299
- package/dist/index-Dhc7a7Xo.d.cts +0 -102
- package/dist/index-Dmqp7KjD.d.ts +0 -86
- package/dist/index-Dn-wI9g4.d.ts +0 -231
- package/dist/index-Du7u1lSf.d.cts +0 -385
- package/dist/index-DwigL4lY.d.ts +0 -1844
- package/dist/index-DyR7eU5S.d.cts +0 -779
- package/dist/index-JZUPJIJy.d.ts +0 -779
- package/dist/index-K0_0eR8g.d.ts +0 -557
- package/dist/index-O16yXPK4.d.cts +0 -3402
- package/dist/index-O7fucFrU.d.cts +0 -121
- package/dist/index-RV_yDjOX.d.cts +0 -198
- package/dist/index-cm1GNcWE.d.ts +0 -754
- package/dist/index-f5IivDUX.d.cts +0 -37
- package/dist/index-hHcaFlJX.d.cts +0 -45
- package/dist/index-tJoTcnHh.d.cts +0 -231
- package/dist/index-wAzD9yVj.d.ts +0 -198
- package/dist/index-z96luz5O.d.cts +0 -44
- package/dist/meta-BgVAsg9j.d.ts +0 -102
- package/dist/meta-vE8bxW1E.d.cts +0 -102
- package/dist/node-ClS5yC-B.d.cts +0 -1347
- package/dist/node-ClS5yC-B.d.ts +0 -1347
- package/dist/observable-BsBzUrcI.d.ts +0 -36
- package/dist/observable-DLGPPtb8.d.cts +0 -36
- package/dist/pipeline-graph-DPqKDk59.d.cts +0 -137
- package/dist/pipeline-graph-loP57TBA.d.ts +0 -137
- package/dist/reactive-layout-Dsvob4zD.d.cts +0 -183
- package/dist/reactive-layout-v7KPvxoc.d.ts +0 -183
- package/dist/reactive-log-B00laMSQ.d.cts +0 -223
- package/dist/reactive-log-BezYsbA_.d.ts +0 -223
- package/dist/reactive-map-48mnZ-nu.d.cts +0 -296
- package/dist/reactive-map-BVVPdvmi.d.ts +0 -296
- package/dist/resilience-YIWPK4YC.js +0 -1
- package/dist/sugar-DLwvMr3F.d.ts +0 -223
- package/dist/sugar-DyVGtczU.d.cts +0 -223
- package/dist/topology-tree-BNGvuG82.d.ts +0 -25
- package/dist/topology-tree-BSdfSwMi.d.cts +0 -25
- package/dist/types-B1jDWVsM.d.cts +0 -442
- package/dist/types-DkzUUs0H.d.ts +0 -442
package/dist/decay-CdEBmDIs.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { N as Node, a as NodeOptions } from './node-ClS5yC-B.js';
|
|
2
|
-
import { R as ReactiveMapBundle, b as ReactiveMapOptions } from './reactive-map-BVVPdvmi.js';
|
|
3
|
-
import { NodeInput } from './extra/sources.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Composite data patterns (roadmap §3.2b).
|
|
7
|
-
*
|
|
8
|
-
* These helpers compose existing primitives (`node`, `switchMap`, `reactiveMap`,
|
|
9
|
-
* `dynamicNode`, `fromAny`) without introducing new protocol semantics.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Verification payload shape is intentionally user-defined.
|
|
14
|
-
*/
|
|
15
|
-
type VerifyValue = unknown;
|
|
16
|
-
type VerifiableOptions<TVerify = VerifyValue> = Omit<NodeOptions, "describeKind" | "initial"> & {
|
|
17
|
-
/** Reactive re-verification trigger. */
|
|
18
|
-
trigger?: NodeInput<unknown>;
|
|
19
|
-
/** Re-run verification whenever `source` settles. */
|
|
20
|
-
autoVerify?: boolean;
|
|
21
|
-
/** Initial verification companion value. */
|
|
22
|
-
initialVerified?: TVerify | null;
|
|
23
|
-
};
|
|
24
|
-
type VerifiableBundle<T, TVerify = VerifyValue> = {
|
|
25
|
-
/** Coerced source node. */
|
|
26
|
-
node: Node<T>;
|
|
27
|
-
/** Latest verification result (`null` before first verification). */
|
|
28
|
-
verified: Node<TVerify | null>;
|
|
29
|
-
/** Effective trigger node used for verification, if any. */
|
|
30
|
-
trigger: Node<unknown> | null;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Composes a value node with a reactive verification companion.
|
|
34
|
-
*
|
|
35
|
-
* Uses `switchMap` so newer triggers cancel stale in-flight verification work.
|
|
36
|
-
*/
|
|
37
|
-
declare function verifiable<T, TVerify = VerifyValue>(source: NodeInput<T>, verifyFn: (value: T) => NodeInput<TVerify>, opts?: VerifiableOptions<TVerify>): VerifiableBundle<T, TVerify>;
|
|
38
|
-
type Extraction<TMem> = {
|
|
39
|
-
upsert: Array<{
|
|
40
|
-
key: string;
|
|
41
|
-
value: TMem;
|
|
42
|
-
}>;
|
|
43
|
-
remove?: string[];
|
|
44
|
-
};
|
|
45
|
-
type DistillOptions<TMem> = {
|
|
46
|
-
score: (mem: TMem, context: unknown) => number;
|
|
47
|
-
cost: (mem: TMem) => number;
|
|
48
|
-
budget?: number;
|
|
49
|
-
evict?: (key: string, mem: TMem) => boolean | Node<boolean>;
|
|
50
|
-
consolidate?: (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
|
|
51
|
-
consolidateTrigger?: NodeInput<unknown>;
|
|
52
|
-
context?: NodeInput<unknown>;
|
|
53
|
-
mapOptions?: ReactiveMapOptions<string, TMem>;
|
|
54
|
-
};
|
|
55
|
-
type DistillBundle<TMem> = {
|
|
56
|
-
store: ReactiveMapBundle<string, TMem>;
|
|
57
|
-
compact: Node<Array<{
|
|
58
|
-
key: string;
|
|
59
|
-
value: TMem;
|
|
60
|
-
score: number;
|
|
61
|
-
}>>;
|
|
62
|
-
size: Node<number>;
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Budget-constrained reactive memory composition.
|
|
66
|
-
*
|
|
67
|
-
* **Tier 1.5.4 (Session A.5 lock, 2026-04-27):** `extractFn` receives the
|
|
68
|
-
* source and existing-store as `Node`s. Distill calls `extractFn` ONCE at
|
|
69
|
-
* wiring time and consumes the returned stream of extractions. The user
|
|
70
|
-
* controls reactive composition — wrap with `switchMap` for cancel-on-new-input,
|
|
71
|
-
* `mergeMap` for parallel, `derived` for sync transforms. See COMPOSITION-GUIDE
|
|
72
|
-
* §40 for the recipe.
|
|
73
|
-
*/
|
|
74
|
-
declare function distill<TRaw, TMem>(source: NodeInput<TRaw>, extractFn: (raw: Node<TRaw>, existing: Node<ReadonlyMap<string, TMem>>) => NodeInput<Extraction<TMem>>, opts: DistillOptions<TMem>): DistillBundle<TMem>;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Pure exponential-decay utility (Tier 2.2 promotion from `patterns/memory/`).
|
|
78
|
-
*
|
|
79
|
-
* Used by `collection`, `agentMemory`, harness `strategy.ts`, and any
|
|
80
|
-
* downstream consumer that needs decay-with-floor scoring. Promoted to
|
|
81
|
-
* `extra/utils/` because the math has zero domain semantics and is reusable
|
|
82
|
-
* by non-memory primitives (e.g. routing weight decay, retry-attempt aging).
|
|
83
|
-
*
|
|
84
|
-
* @module
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* Default exponential-decay rate corresponding to a 7-day half-life.
|
|
88
|
-
*
|
|
89
|
-
* `Math.LN2 / (7 × 86_400)` ≈ `1.146e-6`. Imported by memory tiers + any
|
|
90
|
-
* consumer that wants the same default cadence as `agentMemory`'s active
|
|
91
|
-
* tier. Tier 4.4 (Wave AM Unit 1) — promoted from
|
|
92
|
-
* `patterns/ai/memory/tiers.ts` so non-memory consumers can share the
|
|
93
|
-
* canonical default without reaching across domains.
|
|
94
|
-
*/
|
|
95
|
-
declare const DEFAULT_DECAY_RATE: number;
|
|
96
|
-
/**
|
|
97
|
-
* Exponential decay with floor: `score = max(minScore, baseScore * exp(-ratePerSecond * ageSeconds))`.
|
|
98
|
-
*
|
|
99
|
-
* Tolerant fallbacks (deliberate for use inside reactive derived fns):
|
|
100
|
-
* - non-finite `baseScore` → `minScore`
|
|
101
|
-
* - non-positive `ageSeconds` (incl. clock skew) → `max(minScore, baseScore)` (no decay)
|
|
102
|
-
* - non-positive `ratePerSecond` → `max(minScore, baseScore)` (no decay; rate=0 disables)
|
|
103
|
-
*
|
|
104
|
-
* Underflow boundary: `Math.exp(-745) === 0`. For very long ages × rates the
|
|
105
|
-
* result clamps to `minScore`; if you need slow decay over years, choose a
|
|
106
|
-
* smaller `ratePerSecond` rather than relying on graceful underflow.
|
|
107
|
-
*
|
|
108
|
-
* Half-life conversion: `ratePerSecond = Math.LN2 / halfLifeSeconds`.
|
|
109
|
-
*/
|
|
110
|
-
declare function decay(baseScore: number, ageSeconds: number, ratePerSecond: number, minScore?: number): number;
|
|
111
|
-
|
|
112
|
-
export { type DistillBundle as D, type Extraction as E, type VerifiableBundle as V, type DistillOptions as a, type VerifiableOptions as b, type VerifyValue as c, decay as d, distill as e, DEFAULT_DECAY_RATE as f, verifiable as v };
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { KvStorageTier } from './extra/storage-tiers.js';
|
|
2
|
-
import { C as ChatMessage, a as LLMInvokeOptions, L as LLMAdapter, b as LLMResponse, S as StreamDelta } from './types-DkzUUs0H.js';
|
|
3
|
-
import { d as canonicalJson$1 } from './content-addressed-storage-DuYMjV7o.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* `withReplayCache` — content-addressed response cache over `KvStorageTier`.
|
|
7
|
-
*
|
|
8
|
-
* - Key: sha256 of canonicalized (messages + invoke options minus `signal`).
|
|
9
|
-
* - `"read-write"` (default): returns cached response if present; on miss,
|
|
10
|
-
* passes through and stores the result.
|
|
11
|
-
* - `"write-only"`: never reads; populates the cache for later runs.
|
|
12
|
-
* - `"read"`: reads only; on miss, passes through without writing.
|
|
13
|
-
* - `"read-strict"`: reads only; on miss, **throws `ReplayCacheMissError`**
|
|
14
|
-
* instead of passing through. Use for fixture-driven tests or offline
|
|
15
|
-
* fallback adapters where any cache miss is a test failure or a signal to
|
|
16
|
-
* degrade.
|
|
17
|
-
*
|
|
18
|
-
* Reuses the library's existing `KvStorageTier` abstraction — any kv tier
|
|
19
|
-
* (memoryKv / fileKv / sqliteKv / indexedDbKv / custom).
|
|
20
|
-
*
|
|
21
|
-
* **Concurrent cache-miss dedup:** uses `singleFromAny` so two concurrent
|
|
22
|
-
* calls with the same key share one upstream request. Second caller sees the
|
|
23
|
-
* same response that the first caller fetched; no duplicate provider spend.
|
|
24
|
-
*
|
|
25
|
-
* **Circular-ref safe:** `canonicalJson` uses a seen-set replacer so
|
|
26
|
-
* user-supplied `ToolDefinition.parameters` with `$ref` cycles don't stack-
|
|
27
|
-
* overflow the key computation.
|
|
28
|
-
*
|
|
29
|
-
* **Stream cadence capture:** when `cacheStreaming: true` AND
|
|
30
|
-
* `captureStreamCadence: true`, per-chunk delays (ms since previous chunk)
|
|
31
|
-
* are recorded alongside the content. Replay honors the recorded cadence
|
|
32
|
-
* unless `replaySpeed` is set, which multiplies the effective per-chunk
|
|
33
|
-
* delay (`replaySpeed: 2` → 2× faster; `replaySpeed: 0` → instant).
|
|
34
|
-
* Without `captureStreamCadence`, replay is instant regardless.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
type ReplayCacheMode = "read" | "read-strict" | "write-only" | "read-write";
|
|
38
|
-
declare class ReplayCacheMissError extends Error {
|
|
39
|
-
readonly key: string;
|
|
40
|
-
readonly method: "invoke" | "stream";
|
|
41
|
-
name: string;
|
|
42
|
-
constructor(key: string, method: "invoke" | "stream");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Context object passed to {@link WithReplayCacheOptions.keyFn}. Extending
|
|
46
|
-
* with additional fields is forward-compatible — current implementations
|
|
47
|
-
* ignoring unknown fields continue to work.
|
|
48
|
-
*/
|
|
49
|
-
interface ReplayCacheKeyContext {
|
|
50
|
-
readonly messages: readonly ChatMessage[];
|
|
51
|
-
readonly opts: LLMInvokeOptions | undefined;
|
|
52
|
-
/** Shortcut to `opts?.keyContext` — avoids an extra guard in callers. */
|
|
53
|
-
readonly context: unknown;
|
|
54
|
-
}
|
|
55
|
-
interface WithReplayCacheOptions {
|
|
56
|
-
storage: KvStorageTier;
|
|
57
|
-
mode?: ReplayCacheMode;
|
|
58
|
-
/**
|
|
59
|
-
* Custom key function. Receives a {@link ReplayCacheKeyContext} with the
|
|
60
|
-
* chat messages, the invoke options, and the caller-supplied
|
|
61
|
-
* `opts.keyContext`. Defaults to sha256 of canonical JSON over
|
|
62
|
-
* `(messages, opts without signal/keyContext)`.
|
|
63
|
-
*
|
|
64
|
-
* Legacy 2-arg form `(messages, opts?)` also accepted — the adapter
|
|
65
|
-
* detects arity and dispatches. Prefer the object form for new code.
|
|
66
|
-
*/
|
|
67
|
-
keyFn?: ((ctx: ReplayCacheKeyContext) => string | Promise<string>) | ((messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string | Promise<string>);
|
|
68
|
-
/** Prefix for cached keys (useful when sharing a tier across domains). */
|
|
69
|
-
keyPrefix?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Whether to cache streaming responses (by consuming the full stream
|
|
72
|
-
* and replaying it as one synthetic token chunk). Default `false`.
|
|
73
|
-
*/
|
|
74
|
-
cacheStreaming?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When `cacheStreaming: true`, also record per-chunk delays (ms since
|
|
77
|
-
* previous chunk) so replay can honor the original streaming cadence.
|
|
78
|
-
* Default `false` (chunks replay instantly).
|
|
79
|
-
*/
|
|
80
|
-
captureStreamCadence?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Stream replay speed multiplier. `1` = original cadence (requires
|
|
83
|
-
* `captureStreamCadence`). `2` = 2× faster. `0` = instant. Default `1`.
|
|
84
|
-
*/
|
|
85
|
-
replaySpeed?: number;
|
|
86
|
-
}
|
|
87
|
-
/** Wrap an adapter with a replay cache. */
|
|
88
|
-
declare function withReplayCache(inner: LLMAdapter, opts: WithReplayCacheOptions): LLMAdapter;
|
|
89
|
-
/**
|
|
90
|
-
* Canonical JSON — re-exported from `src/extra/content-addressed-storage.ts`
|
|
91
|
-
* so `fallbackAdapter` and other cache-adjacent code that historically
|
|
92
|
-
* imported from here continue to work. Same behavior.
|
|
93
|
-
*/
|
|
94
|
-
declare const canonicalJson: typeof canonicalJson$1;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* `fallbackAdapter` — fixture-backed {@link LLMAdapter} for offline demos,
|
|
98
|
-
* deterministic tests, and graceful degradation in production.
|
|
99
|
-
*
|
|
100
|
-
* A peer of `anthropicAdapter` / `openAICompatAdapter` / `googleAdapter` /
|
|
101
|
-
* `ollamaAdapter` / `dryRunAdapter`, but whose role is to serve pre-recorded
|
|
102
|
-
* or canned responses when real providers aren't reachable. Install it as a
|
|
103
|
-
* tier via the existing routing primitives (no new composer needed):
|
|
104
|
-
*
|
|
105
|
-
* ```ts
|
|
106
|
-
* // Graceful offline fallback for a user app:
|
|
107
|
-
* resilientAdapter(anthropicAdapter({ ... }), {
|
|
108
|
-
* fallback: fallbackAdapter({ fixturesDir: "./fixtures" }),
|
|
109
|
-
* });
|
|
110
|
-
*
|
|
111
|
-
* // Or the general N-tier shape:
|
|
112
|
-
* cascadingLlmAdapter([
|
|
113
|
-
* { name: "primary", adapter: anthropicAdapter({ ... }) },
|
|
114
|
-
* { name: "fallback", adapter: fallbackAdapter({ fixturesDir: "./fixtures" }) },
|
|
115
|
-
* ]);
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* The `provider` field is `"fallback"` so its role is self-documenting in
|
|
119
|
-
* logs, stats, cost tables, and audit trails.
|
|
120
|
-
*
|
|
121
|
-
* ## Three fixture sources (mutually exclusive)
|
|
122
|
-
*
|
|
123
|
-
* Pick exactly one of:
|
|
124
|
-
*
|
|
125
|
-
* 1. **`fixtures: FallbackFixture[]`** — inline, hand-authored. Supports
|
|
126
|
-
* both hash-keyed and messages-keyed shapes; the adapter computes the
|
|
127
|
-
* canonical hash for messages-keyed entries at init time. Ideal when you
|
|
128
|
-
* want full control in code (tests, small demos).
|
|
129
|
-
*
|
|
130
|
-
* 2. **`fixturesStorage: KvStorageTier`** — the escape hatch for any backend.
|
|
131
|
-
* Pass a `memoryKv()`, `indexedDbKv(...)`, `sqliteKv(...)`,
|
|
132
|
-
* `cascadingCache(...)`, or a custom tier. You own the layout — no
|
|
133
|
-
* auto-namespacing.
|
|
134
|
-
*
|
|
135
|
-
* **Filesystem directories (Node only):** the core `fallbackAdapter`
|
|
136
|
-
* does NOT import `node:fs` / `node:path` — it's safe to bundle for
|
|
137
|
-
* browsers. For a directory convenience, import `fallbackAdapter` from
|
|
138
|
-
* `@graphrefly/graphrefly/patterns/ai/node` (node subpath);
|
|
139
|
-
* that variant adds `fixturesDir: string` (auto-namespaced to
|
|
140
|
-
* `join(dir, keyPrefix)`, cache-format validated at init).
|
|
141
|
-
*
|
|
142
|
-
* ## Record mode
|
|
143
|
-
*
|
|
144
|
-
* `record: { adapter: real, storage }` proxies every call to `real` AND
|
|
145
|
-
* persists the response through the provided tier. Use the node subpath's
|
|
146
|
-
* `fallbackAdapter` for `record.dir` (auto-namespaced + `record.dir` defaults
|
|
147
|
-
* to `fixturesDir` when both are file-backed).
|
|
148
|
-
*
|
|
149
|
-
* ## Three use cases, one implementation
|
|
150
|
-
*
|
|
151
|
-
* | Use case | Config |
|
|
152
|
-
* |---|---|
|
|
153
|
-
* | **User apps** — degrade when the cloud provider errors or network is down | `fallbackAdapter({ fixturesStorage: ... })` installed as a fallback tier |
|
|
154
|
-
* | **Tests** — deterministic replays, fail loudly on miss | `fallbackAdapter({ fixturesStorage: ..., onMiss: "throw" })` |
|
|
155
|
-
* | **Eval offline replay** — zero-spend repeat runs | `fallbackAdapter({ fixturesStorage: ... })` as the only adapter |
|
|
156
|
-
*
|
|
157
|
-
* ## Implementation
|
|
158
|
-
*
|
|
159
|
-
* Thin sugar over {@link withReplayCache}. Key shape comes from its
|
|
160
|
-
* `canonicalJson` — fixtures written by either tool are interchangeable.
|
|
161
|
-
*
|
|
162
|
-
* @module
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
type FallbackMissPolicy = "throw" | "respond";
|
|
166
|
-
/**
|
|
167
|
-
* Thrown when `fallbackAdapter({ onMiss: "throw" })` receives a request that
|
|
168
|
-
* has no matching fixture. Alias of `ReplayCacheMissError` for now — the
|
|
169
|
-
* adapter is a thin sugar over `withReplayCache` and shares its miss-error.
|
|
170
|
-
*/
|
|
171
|
-
declare const FallbackMissError: typeof ReplayCacheMissError;
|
|
172
|
-
type FallbackMissError = ReplayCacheMissError;
|
|
173
|
-
/**
|
|
174
|
-
* One recorded fixture. Two authoring shapes:
|
|
175
|
-
* - **Hash-keyed** — `{ key, response, stream? }`. Key is `sha256(canonicalJson({messages, opts}))`
|
|
176
|
-
* with `fallback:` prefix. This is what `record` mode writes.
|
|
177
|
-
* - **Messages-keyed** — `{ messages, invokeOpts?, response }`. The adapter
|
|
178
|
-
* computes the key at init time. Ergonomic for hand-authored fixtures.
|
|
179
|
-
*/
|
|
180
|
-
type FallbackFixture = {
|
|
181
|
-
readonly key: string;
|
|
182
|
-
readonly response: LLMResponse;
|
|
183
|
-
readonly stream?: {
|
|
184
|
-
readonly chunks: readonly StreamDelta[];
|
|
185
|
-
readonly delaysMs?: readonly number[];
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
readonly messages: readonly ChatMessage[];
|
|
189
|
-
readonly invokeOpts?: Omit<LLMInvokeOptions, "signal">;
|
|
190
|
-
readonly response: LLMResponse;
|
|
191
|
-
};
|
|
192
|
-
interface FallbackAdapterOptions {
|
|
193
|
-
/** Adapter provider label. Default `"fallback"`. */
|
|
194
|
-
readonly provider?: string;
|
|
195
|
-
/** Adapter model label. Default `"fallback"`. */
|
|
196
|
-
readonly model?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Inline hand-authored fixtures. Supports both hash-keyed (`{key, response, stream?}`)
|
|
199
|
-
* and messages-keyed (`{messages, invokeOpts?, response}`) shapes — the adapter
|
|
200
|
-
* computes the canonical hash for messages-keyed entries at init time. Held in
|
|
201
|
-
* an internal `memoryKv`. Mutually exclusive with `fixturesDir` and
|
|
202
|
-
* `fixturesStorage`.
|
|
203
|
-
*/
|
|
204
|
-
readonly fixtures?: readonly FallbackFixture[];
|
|
205
|
-
/**
|
|
206
|
-
* Bring-your-own `KvStorageTier` (`memoryKv`, `sqliteKv`,
|
|
207
|
-
* `indexedDbKv`, `cascadingCache`, or a custom tier). You own the
|
|
208
|
-
* layout — no auto-namespacing. Mutually exclusive with `fixtures`.
|
|
209
|
-
*
|
|
210
|
-
* For filesystem directories, use the node subpath's `fallbackAdapter`
|
|
211
|
-
* with its `fixturesDir` option (auto-namespaced + validated).
|
|
212
|
-
*/
|
|
213
|
-
readonly fixturesStorage?: KvStorageTier;
|
|
214
|
-
/**
|
|
215
|
-
* Called on fixture miss when `onMiss === "respond"`. If not provided and
|
|
216
|
-
* `onMiss === "respond"`, a canned "service unavailable" response is
|
|
217
|
-
* returned (marked with `metadata.degraded: true`).
|
|
218
|
-
*/
|
|
219
|
-
readonly respond?: (messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string | LLMResponse;
|
|
220
|
-
/** Miss policy. Default `"respond"`. */
|
|
221
|
-
readonly onMiss?: FallbackMissPolicy;
|
|
222
|
-
/**
|
|
223
|
-
* Record mode. Proxies every call to `record.adapter` AND persists the
|
|
224
|
-
* result through `record.storage`. For filesystem `record.dir` convenience,
|
|
225
|
-
* use the node subpath's `fallbackAdapter`.
|
|
226
|
-
*/
|
|
227
|
-
readonly record?: {
|
|
228
|
-
readonly adapter: LLMAdapter;
|
|
229
|
-
readonly storage?: KvStorageTier;
|
|
230
|
-
};
|
|
231
|
-
/** Stream replay speed multiplier. See {@link withReplayCache}. Default `1`. */
|
|
232
|
-
readonly replaySpeed?: number;
|
|
233
|
-
/** Key prefix. Kept compatible with `withReplayCache` defaults. Default `"fallback"`. */
|
|
234
|
-
readonly keyPrefix?: string;
|
|
235
|
-
/**
|
|
236
|
-
* Custom key function — forwarded directly to the underlying
|
|
237
|
-
* {@link withReplayCache}. Use to shard fixtures by `invokeOpts.keyContext`
|
|
238
|
-
* (tenant, session, feature flag). Accepts either the new
|
|
239
|
-
* {@link ReplayCacheKeyContext} object form or the legacy 2-arg
|
|
240
|
-
* `(messages, opts?)` form.
|
|
241
|
-
*/
|
|
242
|
-
readonly keyFn?: ((ctx: ReplayCacheKeyContext) => string) | ((messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string);
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Build a fixture-backed {@link LLMAdapter}. See module docs for use cases
|
|
246
|
-
* (offline demo, tests, degraded-mode) and recipe snippets.
|
|
247
|
-
*/
|
|
248
|
-
declare function fallbackAdapter(opts?: FallbackAdapterOptions): LLMAdapter;
|
|
249
|
-
|
|
250
|
-
export { type FallbackAdapterOptions as F, type ReplayCacheKeyContext as R, type WithReplayCacheOptions as W, type FallbackFixture as a, FallbackMissError as b, type FallbackMissPolicy as c, ReplayCacheMissError as d, type ReplayCacheMode as e, canonicalJson as f, fallbackAdapter as g, withReplayCache as w };
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { KvStorageTier } from './extra/storage-tiers.cjs';
|
|
2
|
-
import { C as ChatMessage, a as LLMInvokeOptions, L as LLMAdapter, b as LLMResponse, S as StreamDelta } from './types-B1jDWVsM.cjs';
|
|
3
|
-
import { d as canonicalJson$1 } from './content-addressed-storage-4-ST1tYk.cjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* `withReplayCache` — content-addressed response cache over `KvStorageTier`.
|
|
7
|
-
*
|
|
8
|
-
* - Key: sha256 of canonicalized (messages + invoke options minus `signal`).
|
|
9
|
-
* - `"read-write"` (default): returns cached response if present; on miss,
|
|
10
|
-
* passes through and stores the result.
|
|
11
|
-
* - `"write-only"`: never reads; populates the cache for later runs.
|
|
12
|
-
* - `"read"`: reads only; on miss, passes through without writing.
|
|
13
|
-
* - `"read-strict"`: reads only; on miss, **throws `ReplayCacheMissError`**
|
|
14
|
-
* instead of passing through. Use for fixture-driven tests or offline
|
|
15
|
-
* fallback adapters where any cache miss is a test failure or a signal to
|
|
16
|
-
* degrade.
|
|
17
|
-
*
|
|
18
|
-
* Reuses the library's existing `KvStorageTier` abstraction — any kv tier
|
|
19
|
-
* (memoryKv / fileKv / sqliteKv / indexedDbKv / custom).
|
|
20
|
-
*
|
|
21
|
-
* **Concurrent cache-miss dedup:** uses `singleFromAny` so two concurrent
|
|
22
|
-
* calls with the same key share one upstream request. Second caller sees the
|
|
23
|
-
* same response that the first caller fetched; no duplicate provider spend.
|
|
24
|
-
*
|
|
25
|
-
* **Circular-ref safe:** `canonicalJson` uses a seen-set replacer so
|
|
26
|
-
* user-supplied `ToolDefinition.parameters` with `$ref` cycles don't stack-
|
|
27
|
-
* overflow the key computation.
|
|
28
|
-
*
|
|
29
|
-
* **Stream cadence capture:** when `cacheStreaming: true` AND
|
|
30
|
-
* `captureStreamCadence: true`, per-chunk delays (ms since previous chunk)
|
|
31
|
-
* are recorded alongside the content. Replay honors the recorded cadence
|
|
32
|
-
* unless `replaySpeed` is set, which multiplies the effective per-chunk
|
|
33
|
-
* delay (`replaySpeed: 2` → 2× faster; `replaySpeed: 0` → instant).
|
|
34
|
-
* Without `captureStreamCadence`, replay is instant regardless.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
type ReplayCacheMode = "read" | "read-strict" | "write-only" | "read-write";
|
|
38
|
-
declare class ReplayCacheMissError extends Error {
|
|
39
|
-
readonly key: string;
|
|
40
|
-
readonly method: "invoke" | "stream";
|
|
41
|
-
name: string;
|
|
42
|
-
constructor(key: string, method: "invoke" | "stream");
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Context object passed to {@link WithReplayCacheOptions.keyFn}. Extending
|
|
46
|
-
* with additional fields is forward-compatible — current implementations
|
|
47
|
-
* ignoring unknown fields continue to work.
|
|
48
|
-
*/
|
|
49
|
-
interface ReplayCacheKeyContext {
|
|
50
|
-
readonly messages: readonly ChatMessage[];
|
|
51
|
-
readonly opts: LLMInvokeOptions | undefined;
|
|
52
|
-
/** Shortcut to `opts?.keyContext` — avoids an extra guard in callers. */
|
|
53
|
-
readonly context: unknown;
|
|
54
|
-
}
|
|
55
|
-
interface WithReplayCacheOptions {
|
|
56
|
-
storage: KvStorageTier;
|
|
57
|
-
mode?: ReplayCacheMode;
|
|
58
|
-
/**
|
|
59
|
-
* Custom key function. Receives a {@link ReplayCacheKeyContext} with the
|
|
60
|
-
* chat messages, the invoke options, and the caller-supplied
|
|
61
|
-
* `opts.keyContext`. Defaults to sha256 of canonical JSON over
|
|
62
|
-
* `(messages, opts without signal/keyContext)`.
|
|
63
|
-
*
|
|
64
|
-
* Legacy 2-arg form `(messages, opts?)` also accepted — the adapter
|
|
65
|
-
* detects arity and dispatches. Prefer the object form for new code.
|
|
66
|
-
*/
|
|
67
|
-
keyFn?: ((ctx: ReplayCacheKeyContext) => string | Promise<string>) | ((messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string | Promise<string>);
|
|
68
|
-
/** Prefix for cached keys (useful when sharing a tier across domains). */
|
|
69
|
-
keyPrefix?: string;
|
|
70
|
-
/**
|
|
71
|
-
* Whether to cache streaming responses (by consuming the full stream
|
|
72
|
-
* and replaying it as one synthetic token chunk). Default `false`.
|
|
73
|
-
*/
|
|
74
|
-
cacheStreaming?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* When `cacheStreaming: true`, also record per-chunk delays (ms since
|
|
77
|
-
* previous chunk) so replay can honor the original streaming cadence.
|
|
78
|
-
* Default `false` (chunks replay instantly).
|
|
79
|
-
*/
|
|
80
|
-
captureStreamCadence?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Stream replay speed multiplier. `1` = original cadence (requires
|
|
83
|
-
* `captureStreamCadence`). `2` = 2× faster. `0` = instant. Default `1`.
|
|
84
|
-
*/
|
|
85
|
-
replaySpeed?: number;
|
|
86
|
-
}
|
|
87
|
-
/** Wrap an adapter with a replay cache. */
|
|
88
|
-
declare function withReplayCache(inner: LLMAdapter, opts: WithReplayCacheOptions): LLMAdapter;
|
|
89
|
-
/**
|
|
90
|
-
* Canonical JSON — re-exported from `src/extra/content-addressed-storage.ts`
|
|
91
|
-
* so `fallbackAdapter` and other cache-adjacent code that historically
|
|
92
|
-
* imported from here continue to work. Same behavior.
|
|
93
|
-
*/
|
|
94
|
-
declare const canonicalJson: typeof canonicalJson$1;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* `fallbackAdapter` — fixture-backed {@link LLMAdapter} for offline demos,
|
|
98
|
-
* deterministic tests, and graceful degradation in production.
|
|
99
|
-
*
|
|
100
|
-
* A peer of `anthropicAdapter` / `openAICompatAdapter` / `googleAdapter` /
|
|
101
|
-
* `ollamaAdapter` / `dryRunAdapter`, but whose role is to serve pre-recorded
|
|
102
|
-
* or canned responses when real providers aren't reachable. Install it as a
|
|
103
|
-
* tier via the existing routing primitives (no new composer needed):
|
|
104
|
-
*
|
|
105
|
-
* ```ts
|
|
106
|
-
* // Graceful offline fallback for a user app:
|
|
107
|
-
* resilientAdapter(anthropicAdapter({ ... }), {
|
|
108
|
-
* fallback: fallbackAdapter({ fixturesDir: "./fixtures" }),
|
|
109
|
-
* });
|
|
110
|
-
*
|
|
111
|
-
* // Or the general N-tier shape:
|
|
112
|
-
* cascadingLlmAdapter([
|
|
113
|
-
* { name: "primary", adapter: anthropicAdapter({ ... }) },
|
|
114
|
-
* { name: "fallback", adapter: fallbackAdapter({ fixturesDir: "./fixtures" }) },
|
|
115
|
-
* ]);
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* The `provider` field is `"fallback"` so its role is self-documenting in
|
|
119
|
-
* logs, stats, cost tables, and audit trails.
|
|
120
|
-
*
|
|
121
|
-
* ## Three fixture sources (mutually exclusive)
|
|
122
|
-
*
|
|
123
|
-
* Pick exactly one of:
|
|
124
|
-
*
|
|
125
|
-
* 1. **`fixtures: FallbackFixture[]`** — inline, hand-authored. Supports
|
|
126
|
-
* both hash-keyed and messages-keyed shapes; the adapter computes the
|
|
127
|
-
* canonical hash for messages-keyed entries at init time. Ideal when you
|
|
128
|
-
* want full control in code (tests, small demos).
|
|
129
|
-
*
|
|
130
|
-
* 2. **`fixturesStorage: KvStorageTier`** — the escape hatch for any backend.
|
|
131
|
-
* Pass a `memoryKv()`, `indexedDbKv(...)`, `sqliteKv(...)`,
|
|
132
|
-
* `cascadingCache(...)`, or a custom tier. You own the layout — no
|
|
133
|
-
* auto-namespacing.
|
|
134
|
-
*
|
|
135
|
-
* **Filesystem directories (Node only):** the core `fallbackAdapter`
|
|
136
|
-
* does NOT import `node:fs` / `node:path` — it's safe to bundle for
|
|
137
|
-
* browsers. For a directory convenience, import `fallbackAdapter` from
|
|
138
|
-
* `@graphrefly/graphrefly/patterns/ai/node` (node subpath);
|
|
139
|
-
* that variant adds `fixturesDir: string` (auto-namespaced to
|
|
140
|
-
* `join(dir, keyPrefix)`, cache-format validated at init).
|
|
141
|
-
*
|
|
142
|
-
* ## Record mode
|
|
143
|
-
*
|
|
144
|
-
* `record: { adapter: real, storage }` proxies every call to `real` AND
|
|
145
|
-
* persists the response through the provided tier. Use the node subpath's
|
|
146
|
-
* `fallbackAdapter` for `record.dir` (auto-namespaced + `record.dir` defaults
|
|
147
|
-
* to `fixturesDir` when both are file-backed).
|
|
148
|
-
*
|
|
149
|
-
* ## Three use cases, one implementation
|
|
150
|
-
*
|
|
151
|
-
* | Use case | Config |
|
|
152
|
-
* |---|---|
|
|
153
|
-
* | **User apps** — degrade when the cloud provider errors or network is down | `fallbackAdapter({ fixturesStorage: ... })` installed as a fallback tier |
|
|
154
|
-
* | **Tests** — deterministic replays, fail loudly on miss | `fallbackAdapter({ fixturesStorage: ..., onMiss: "throw" })` |
|
|
155
|
-
* | **Eval offline replay** — zero-spend repeat runs | `fallbackAdapter({ fixturesStorage: ... })` as the only adapter |
|
|
156
|
-
*
|
|
157
|
-
* ## Implementation
|
|
158
|
-
*
|
|
159
|
-
* Thin sugar over {@link withReplayCache}. Key shape comes from its
|
|
160
|
-
* `canonicalJson` — fixtures written by either tool are interchangeable.
|
|
161
|
-
*
|
|
162
|
-
* @module
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
type FallbackMissPolicy = "throw" | "respond";
|
|
166
|
-
/**
|
|
167
|
-
* Thrown when `fallbackAdapter({ onMiss: "throw" })` receives a request that
|
|
168
|
-
* has no matching fixture. Alias of `ReplayCacheMissError` for now — the
|
|
169
|
-
* adapter is a thin sugar over `withReplayCache` and shares its miss-error.
|
|
170
|
-
*/
|
|
171
|
-
declare const FallbackMissError: typeof ReplayCacheMissError;
|
|
172
|
-
type FallbackMissError = ReplayCacheMissError;
|
|
173
|
-
/**
|
|
174
|
-
* One recorded fixture. Two authoring shapes:
|
|
175
|
-
* - **Hash-keyed** — `{ key, response, stream? }`. Key is `sha256(canonicalJson({messages, opts}))`
|
|
176
|
-
* with `fallback:` prefix. This is what `record` mode writes.
|
|
177
|
-
* - **Messages-keyed** — `{ messages, invokeOpts?, response }`. The adapter
|
|
178
|
-
* computes the key at init time. Ergonomic for hand-authored fixtures.
|
|
179
|
-
*/
|
|
180
|
-
type FallbackFixture = {
|
|
181
|
-
readonly key: string;
|
|
182
|
-
readonly response: LLMResponse;
|
|
183
|
-
readonly stream?: {
|
|
184
|
-
readonly chunks: readonly StreamDelta[];
|
|
185
|
-
readonly delaysMs?: readonly number[];
|
|
186
|
-
};
|
|
187
|
-
} | {
|
|
188
|
-
readonly messages: readonly ChatMessage[];
|
|
189
|
-
readonly invokeOpts?: Omit<LLMInvokeOptions, "signal">;
|
|
190
|
-
readonly response: LLMResponse;
|
|
191
|
-
};
|
|
192
|
-
interface FallbackAdapterOptions {
|
|
193
|
-
/** Adapter provider label. Default `"fallback"`. */
|
|
194
|
-
readonly provider?: string;
|
|
195
|
-
/** Adapter model label. Default `"fallback"`. */
|
|
196
|
-
readonly model?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Inline hand-authored fixtures. Supports both hash-keyed (`{key, response, stream?}`)
|
|
199
|
-
* and messages-keyed (`{messages, invokeOpts?, response}`) shapes — the adapter
|
|
200
|
-
* computes the canonical hash for messages-keyed entries at init time. Held in
|
|
201
|
-
* an internal `memoryKv`. Mutually exclusive with `fixturesDir` and
|
|
202
|
-
* `fixturesStorage`.
|
|
203
|
-
*/
|
|
204
|
-
readonly fixtures?: readonly FallbackFixture[];
|
|
205
|
-
/**
|
|
206
|
-
* Bring-your-own `KvStorageTier` (`memoryKv`, `sqliteKv`,
|
|
207
|
-
* `indexedDbKv`, `cascadingCache`, or a custom tier). You own the
|
|
208
|
-
* layout — no auto-namespacing. Mutually exclusive with `fixtures`.
|
|
209
|
-
*
|
|
210
|
-
* For filesystem directories, use the node subpath's `fallbackAdapter`
|
|
211
|
-
* with its `fixturesDir` option (auto-namespaced + validated).
|
|
212
|
-
*/
|
|
213
|
-
readonly fixturesStorage?: KvStorageTier;
|
|
214
|
-
/**
|
|
215
|
-
* Called on fixture miss when `onMiss === "respond"`. If not provided and
|
|
216
|
-
* `onMiss === "respond"`, a canned "service unavailable" response is
|
|
217
|
-
* returned (marked with `metadata.degraded: true`).
|
|
218
|
-
*/
|
|
219
|
-
readonly respond?: (messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string | LLMResponse;
|
|
220
|
-
/** Miss policy. Default `"respond"`. */
|
|
221
|
-
readonly onMiss?: FallbackMissPolicy;
|
|
222
|
-
/**
|
|
223
|
-
* Record mode. Proxies every call to `record.adapter` AND persists the
|
|
224
|
-
* result through `record.storage`. For filesystem `record.dir` convenience,
|
|
225
|
-
* use the node subpath's `fallbackAdapter`.
|
|
226
|
-
*/
|
|
227
|
-
readonly record?: {
|
|
228
|
-
readonly adapter: LLMAdapter;
|
|
229
|
-
readonly storage?: KvStorageTier;
|
|
230
|
-
};
|
|
231
|
-
/** Stream replay speed multiplier. See {@link withReplayCache}. Default `1`. */
|
|
232
|
-
readonly replaySpeed?: number;
|
|
233
|
-
/** Key prefix. Kept compatible with `withReplayCache` defaults. Default `"fallback"`. */
|
|
234
|
-
readonly keyPrefix?: string;
|
|
235
|
-
/**
|
|
236
|
-
* Custom key function — forwarded directly to the underlying
|
|
237
|
-
* {@link withReplayCache}. Use to shard fixtures by `invokeOpts.keyContext`
|
|
238
|
-
* (tenant, session, feature flag). Accepts either the new
|
|
239
|
-
* {@link ReplayCacheKeyContext} object form or the legacy 2-arg
|
|
240
|
-
* `(messages, opts?)` form.
|
|
241
|
-
*/
|
|
242
|
-
readonly keyFn?: ((ctx: ReplayCacheKeyContext) => string) | ((messages: readonly ChatMessage[], opts?: LLMInvokeOptions) => string);
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Build a fixture-backed {@link LLMAdapter}. See module docs for use cases
|
|
246
|
-
* (offline demo, tests, degraded-mode) and recipe snippets.
|
|
247
|
-
*/
|
|
248
|
-
declare function fallbackAdapter(opts?: FallbackAdapterOptions): LLMAdapter;
|
|
249
|
-
|
|
250
|
-
export { type FallbackAdapterOptions as F, type ReplayCacheKeyContext as R, type WithReplayCacheOptions as W, type FallbackFixture as a, FallbackMissError as b, type FallbackMissPolicy as c, ReplayCacheMissError as d, type ReplayCacheMode as e, canonicalJson as f, fallbackAdapter as g, withReplayCache as w };
|