@graphrefly/graphrefly 0.27.0 → 0.29.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/dist/backoff-HPZMEZNF.js +1 -0
- package/dist/cascading-Bp99ckMJ.d.ts +180 -0
- package/dist/cascading-CcAgRacD.d.cts +180 -0
- package/dist/chunk-22F4K3G7.js +1 -0
- package/dist/chunk-22SVXUPB.js +64 -0
- package/dist/chunk-2GQREQ6C.js +1 -0
- package/dist/chunk-3JXNEPCD.js +2 -0
- package/dist/chunk-4JJCCD5S.js +2 -0
- package/dist/chunk-4OFIQ66T.js +1 -0
- package/dist/chunk-4V4C7K56.js +1 -0
- package/dist/chunk-4VVTGLXJ.js +1 -0
- package/dist/chunk-567NWZ3T.js +1 -0
- package/dist/chunk-5JDE5JHE.js +1 -0
- package/dist/chunk-5QDBSZBV.js +1 -0
- package/dist/chunk-5Z4HDCO6.js +1 -0
- package/dist/chunk-63FFOHLA.js +1 -0
- package/dist/chunk-6QZNQS5B.js +1 -0
- package/dist/chunk-7JDLFI6N.js +1 -0
- package/dist/chunk-7TDOES3L.js +1 -0
- package/dist/chunk-A7IAQQ63.js +1 -0
- package/dist/chunk-AMG5VBHW.js +1 -0
- package/dist/chunk-AUY2YKCO.js +1 -0
- package/dist/chunk-AV3PIDFQ.js +1 -0
- package/dist/chunk-BA5URFYW.js +1 -0
- package/dist/chunk-BKPLTBL5.js +1 -0
- package/dist/chunk-BZP5T4X6.js +1 -0
- package/dist/chunk-CK2E7BTU.js +1 -0
- package/dist/chunk-CSJE2EKV.js +1 -0
- package/dist/chunk-E3AXATVZ.js +9 -0
- package/dist/chunk-ESMPEKEV.js +1 -0
- package/dist/chunk-GJR3P6JG.js +1 -0
- package/dist/chunk-GNCBXARM.js +1 -0
- package/dist/chunk-GPW2V3RE.js +1 -0
- package/dist/chunk-HSIEYSDY.js +1 -0
- package/dist/chunk-I6VIH3VA.js +1 -0
- package/dist/chunk-ISCENNXS.js +1 -0
- package/dist/chunk-JYOUF6UQ.js +1 -0
- package/dist/chunk-KASHOCF5.js +1 -0
- package/dist/chunk-LGSNR4LU.js +5 -0
- package/dist/chunk-LVGBLZM2.js +1 -0
- package/dist/chunk-MGKAO4EK.js +7 -0
- package/dist/chunk-NSG4C6BF.js +23 -0
- package/dist/chunk-OL33ZI6R.js +1 -0
- package/dist/chunk-PCZ35NXD.js +78 -0
- package/dist/chunk-PGMUCUHG.js +43 -0
- package/dist/chunk-QYADASLV.js +1 -0
- package/dist/chunk-RD52SNH2.js +1 -0
- package/dist/chunk-SLMYTGTU.js +1 -0
- package/dist/chunk-TWMEGG45.js +1 -0
- package/dist/chunk-UVJQ35G2.js +1 -0
- package/dist/chunk-VGTCGNRX.js +18 -0
- package/dist/chunk-VIMF6LGM.js +1 -0
- package/dist/chunk-VJLMUKOI.js +1 -0
- package/dist/chunk-VWPRPPKR.js +1 -0
- package/dist/chunk-W4TSQ6RJ.js +1 -0
- package/dist/chunk-WM7H7WTY.js +3 -0
- package/dist/chunk-Y32RJO24.js +1 -0
- package/dist/chunk-Y53B6NS4.js +1 -0
- package/dist/compat/index.cjs +15 -7656
- package/dist/compat/index.d.cts +15 -14
- package/dist/compat/index.d.ts +15 -14
- package/dist/compat/index.js +1 -50
- package/dist/compat/jotai/index.cjs +1 -2048
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -9
- package/dist/compat/nanostores/index.cjs +1 -2175
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -23
- package/dist/compat/nestjs/index.cjs +15 -6782
- package/dist/compat/nestjs/index.d.cts +7 -6
- package/dist/compat/nestjs/index.d.ts +7 -6
- package/dist/compat/nestjs/index.js +1 -83
- package/dist/compat/react/index.cjs +1 -141
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/react/index.js +1 -12
- package/dist/compat/solid/index.cjs +1 -128
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/solid/index.js +1 -12
- package/dist/compat/svelte/index.cjs +1 -131
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/svelte/index.js +1 -12
- package/dist/compat/vue/index.cjs +1 -146
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/vue/index.js +1 -12
- package/dist/compat/zustand/index.cjs +7 -4931
- package/dist/compat/zustand/index.d.cts +5 -5
- package/dist/compat/zustand/index.d.ts +5 -5
- package/dist/compat/zustand/index.js +1 -12
- package/dist/composite-BL-llbnE.d.ts +69 -0
- package/dist/composite-Dze--DaA.d.cts +69 -0
- package/dist/core/index.cjs +1 -2271
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -110
- package/dist/extra/browser.cjs +1 -0
- package/dist/extra/browser.d.cts +3 -0
- package/dist/extra/browser.d.ts +3 -0
- package/dist/extra/browser.js +1 -0
- package/dist/extra/index.cjs +24 -9971
- package/dist/extra/index.d.cts +13 -6
- package/dist/extra/index.d.ts +13 -6
- package/dist/extra/index.js +1 -381
- package/dist/extra/node.cjs +3 -0
- package/dist/extra/node.d.cts +81 -0
- package/dist/extra/node.d.ts +81 -0
- package/dist/extra/node.js +2 -0
- package/dist/extra/operators.cjs +1 -0
- package/dist/extra/operators.d.cts +910 -0
- package/dist/extra/operators.d.ts +910 -0
- package/dist/extra/operators.js +1 -0
- package/dist/extra/reactive.cjs +1 -0
- package/dist/extra/reactive.d.cts +352 -0
- package/dist/extra/reactive.d.ts +352 -0
- package/dist/extra/reactive.js +1 -0
- package/dist/extra/sources.cjs +1 -2486
- package/dist/extra/sources.d.cts +6 -2
- package/dist/extra/sources.d.ts +6 -2
- package/dist/extra/sources.js +1 -57
- package/dist/extra/storage-browser.cjs +1 -0
- package/dist/extra/storage-browser.d.cts +71 -0
- package/dist/extra/storage-browser.d.ts +71 -0
- package/dist/extra/storage-browser.js +1 -0
- package/dist/extra/storage-core.cjs +1 -0
- package/dist/extra/storage-core.d.cts +98 -0
- package/dist/extra/storage-core.d.ts +98 -0
- package/dist/extra/storage-core.js +1 -0
- package/dist/extra/storage-node.cjs +2 -0
- package/dist/extra/storage-node.d.cts +60 -0
- package/dist/extra/storage-node.d.ts +60 -0
- package/dist/extra/storage-node.js +1 -0
- package/dist/fallback-BaTS7vVY.d.cts +258 -0
- package/dist/fallback-eOm3LNxP.d.ts +258 -0
- package/dist/graph/index.cjs +7 -5030
- package/dist/graph/index.d.cts +6 -5
- package/dist/graph/index.d.ts +6 -5
- package/dist/graph/index.js +1 -50
- package/dist/{graph-DNCrvZSn.d.cts → graph-DgohqXK-.d.cts} +151 -32
- package/dist/{graph-CCwGKLCm.d.ts → graph-Qjg9gWHI.d.ts} +151 -32
- package/dist/{index-BwfLUNw4.d.ts → index-2BVuRCI4.d.ts} +173 -2040
- package/dist/{index-BPVt8kqc.d.ts → index-2NvguqQA.d.ts} +10 -195
- package/dist/index-A65LZhoM.d.ts +186 -0
- package/dist/{index-DlLp-2Xn.d.cts → index-B-8FCEua.d.cts} +10 -195
- package/dist/index-B-gqvYel.d.ts +135 -0
- package/dist/index-B2PRuolf.d.cts +86 -0
- package/dist/index-BJqt9EwW.d.ts +231 -0
- package/dist/{index-BHlKbUwO.d.cts → index-BKjT5DiZ.d.cts} +173 -2040
- package/dist/{index-C0svESO4.d.ts → index-BM8BU4q6.d.ts} +1 -1
- package/dist/{index-VdHQMPy1.d.ts → index-BQaEnxBf.d.ts} +1 -1
- package/dist/index-BSfwiy5B.d.ts +192 -0
- package/dist/index-BTSkeCZs.d.cts +291 -0
- package/dist/index-BUVtw1Ay.d.cts +186 -0
- package/dist/index-BUi57v_p.d.ts +163 -0
- package/dist/{messaging-Gt4LPbyA.d.cts → index-BanNUILp.d.cts} +31 -93
- package/dist/{audit-DRlSzBu9.d.ts → index-BayHDRx6.d.cts} +27 -21
- package/dist/{index-B6D3QNSA.d.ts → index-BiyjsZ0m.d.ts} +148 -20
- package/dist/index-BqZ6vB2A.d.ts +2057 -0
- package/dist/{memory-li6FL5RM.d.ts → index-BuVidq3D.d.cts} +26 -26
- package/dist/index-Byh-xTyp.d.ts +105 -0
- package/dist/index-C08QPDcV.d.cts +321 -0
- package/dist/{demo-shell-BDkOptd6.d.ts → index-C66RJiX8.d.ts} +14 -14
- package/dist/index-C8RfjffH.d.ts +291 -0
- package/dist/index-CA1Cu7Ud.d.ts +873 -0
- package/dist/{index-ByQxazQJ.d.cts → index-CABbltIu.d.cts} +1 -1
- package/dist/{index-VHqptjhu.d.cts → index-CHEBsnYv.d.cts} +1 -1
- package/dist/{index-BuEoe-Qu.d.ts → index-CI0yDnLp.d.ts} +9 -9
- package/dist/{index-B9B7_HEY.d.ts → index-CJ45TW-h.d.ts} +1 -1
- package/dist/{index-CO8uBlUh.d.cts → index-CJZKZoo4.d.cts} +148 -20
- package/dist/{index-wEn0eFe8.d.ts → index-CX2tFJL1.d.ts} +1 -1
- package/dist/{index-BaSM3aYt.d.ts → index-CcWOJ6F0.d.ts} +3 -3
- package/dist/{audit-ClmqGOCx.d.cts → index-CiaVoZGo.d.ts} +27 -21
- package/dist/{index-Dzk2hrlR.d.ts → index-Ct5CWc4E.d.ts} +1 -1
- package/dist/index-D38duMCv.d.cts +357 -0
- package/dist/{index-C8oil6M6.d.ts → index-D5XJ2tSx.d.ts} +30 -6
- package/dist/{index-DO_6JN9Z.d.cts → index-D80do5jX.d.cts} +1 -1
- package/dist/index-D9HKAH_-.d.cts +231 -0
- package/dist/index-DBe_8XW5.d.cts +143 -0
- package/dist/{memory-C6Z2tGpC.d.cts → index-DCeTyFlB.d.ts} +26 -26
- package/dist/index-DDy8eeXS.d.ts +321 -0
- package/dist/index-DJ5oNBc8.d.ts +143 -0
- package/dist/{index-CI3DprxP.d.cts → index-DP0_O3ls.d.cts} +30 -6
- package/dist/{demo-shell-Crid1WdR.d.cts → index-DX8xS-yB.d.cts} +14 -14
- package/dist/index-DiZejfCI.d.cts +2057 -0
- package/dist/index-DknyJ2Fu.d.cts +163 -0
- package/dist/index-DoWMs-Kk.d.cts +135 -0
- package/dist/{messaging-XDoYablx.d.ts → index-DuB5aO4-.d.ts} +31 -93
- package/dist/index-DwjJGKxV.d.ts +357 -0
- package/dist/{index-B6EhDnjH.d.cts → index-H_oxVec5.d.cts} +1 -1
- package/dist/{index-3lsddbbS.d.ts → index-IMAHq-ia.d.ts} +1 -1
- package/dist/{index-B1tloyhO.d.cts → index-U1nir7MX.d.cts} +1 -1
- package/dist/index-Vg7tORgk.d.ts +86 -0
- package/dist/index-dig-r2tQ.d.cts +873 -0
- package/dist/{index-CxFrXH4m.d.ts → index-gsT79Xu9.d.ts} +1 -1
- package/dist/{index-D8wS_PeY.d.cts → index-i99Ka8s7.d.cts} +9 -9
- package/dist/index-iKkyJosF.d.cts +105 -0
- package/dist/{index-Xi3u0HCQ.d.cts → index-jleeotBT.d.cts} +1 -1
- package/dist/{index-DVGiGFGT.d.cts → index-kykKWwV-.d.cts} +3 -3
- package/dist/index-vgcLF5TH.d.cts +192 -0
- package/dist/{index-DYme44FM.d.cts → index-y1RllPn4.d.cts} +1 -1
- package/dist/index.cjs +151 -24142
- package/dist/index.d.cts +69 -2099
- package/dist/index.d.ts +69 -2099
- package/dist/index.js +1 -3868
- package/dist/{meta-CbznRPYJ.d.ts → meta-CX7YsOzp.d.cts} +5 -5
- package/dist/{meta-BxCA7rcr.d.cts → meta-CckhhFRd.d.ts} +5 -5
- package/dist/{node-BmerH3kS.d.cts → node-Dd6wHSib.d.cts} +71 -11
- package/dist/{node-BmerH3kS.d.ts → node-Dd6wHSib.d.ts} +71 -11
- package/dist/{observable-BgGUwcqp.d.ts → observable-BZJgo616.d.ts} +1 -1
- package/dist/{observable-DJt_AxzQ.d.cts → observable-kwzpLvbi.d.cts} +1 -1
- package/dist/patterns/ai/browser.cjs +25 -0
- package/dist/patterns/ai/browser.d.cts +127 -0
- package/dist/patterns/ai/browser.d.ts +127 -0
- package/dist/patterns/ai/browser.js +3 -0
- package/dist/patterns/ai/index.cjs +92 -0
- package/dist/patterns/ai/index.d.cts +17 -0
- package/dist/patterns/ai/index.d.ts +17 -0
- package/dist/patterns/ai/index.js +1 -0
- package/dist/patterns/ai/node.cjs +2 -0
- package/dist/patterns/ai/node.d.cts +58 -0
- package/dist/patterns/ai/node.d.ts +58 -0
- package/dist/patterns/ai/node.js +1 -0
- package/dist/patterns/audit/index.cjs +7 -0
- package/dist/patterns/audit/index.d.cts +6 -0
- package/dist/patterns/audit/index.d.ts +6 -0
- package/dist/patterns/audit/index.js +1 -0
- package/dist/patterns/cqrs/index.cjs +7 -0
- package/dist/patterns/cqrs/index.d.cts +5 -0
- package/dist/patterns/cqrs/index.d.ts +5 -0
- package/dist/patterns/cqrs/index.js +1 -0
- package/dist/patterns/demo-shell/index.cjs +8 -0
- package/dist/patterns/demo-shell/index.d.cts +6 -0
- package/dist/patterns/demo-shell/index.d.ts +6 -0
- package/dist/patterns/demo-shell/index.js +1 -0
- package/dist/patterns/domain-templates/index.cjs +7 -0
- package/dist/patterns/domain-templates/index.d.cts +5 -0
- package/dist/patterns/domain-templates/index.d.ts +5 -0
- package/dist/patterns/domain-templates/index.js +1 -0
- package/dist/patterns/graphspec/index.cjs +84 -0
- package/dist/patterns/graphspec/index.d.cts +7 -0
- package/dist/patterns/graphspec/index.d.ts +7 -0
- package/dist/patterns/graphspec/index.js +1 -0
- package/dist/patterns/guarded-execution/index.cjs +7 -0
- package/dist/patterns/guarded-execution/index.d.cts +7 -0
- package/dist/patterns/guarded-execution/index.d.ts +7 -0
- package/dist/patterns/guarded-execution/index.js +1 -0
- package/dist/patterns/harness/index.cjs +49 -0
- package/dist/patterns/harness/index.d.cts +11 -0
- package/dist/patterns/harness/index.d.ts +11 -0
- package/dist/patterns/harness/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +7 -0
- package/dist/patterns/job-queue/index.d.cts +5 -0
- package/dist/patterns/job-queue/index.d.ts +5 -0
- package/dist/patterns/job-queue/index.js +1 -0
- package/dist/patterns/lens/index.cjs +7 -0
- package/dist/patterns/lens/index.d.cts +7 -0
- package/dist/patterns/lens/index.d.ts +7 -0
- package/dist/patterns/lens/index.js +1 -0
- package/dist/patterns/memory/index.cjs +7 -0
- package/dist/patterns/memory/index.d.cts +5 -0
- package/dist/patterns/memory/index.d.ts +5 -0
- package/dist/patterns/memory/index.js +1 -0
- package/dist/patterns/messaging/index.cjs +7 -0
- package/dist/patterns/messaging/index.d.cts +5 -0
- package/dist/patterns/messaging/index.d.ts +5 -0
- package/dist/patterns/messaging/index.js +1 -0
- package/dist/patterns/orchestration/index.cjs +7 -0
- package/dist/patterns/orchestration/index.d.cts +6 -0
- package/dist/patterns/orchestration/index.d.ts +6 -0
- package/dist/patterns/orchestration/index.js +1 -0
- package/dist/patterns/reactive-layout/index.cjs +8 -6444
- package/dist/patterns/reactive-layout/index.d.cts +6 -6
- package/dist/patterns/reactive-layout/index.d.ts +6 -6
- package/dist/patterns/reactive-layout/index.js +1 -56
- package/dist/patterns/reduction/index.cjs +7 -0
- package/dist/patterns/reduction/index.d.cts +5 -0
- package/dist/patterns/reduction/index.d.ts +5 -0
- package/dist/patterns/reduction/index.js +1 -0
- package/dist/patterns/refine-loop/index.cjs +9 -0
- package/dist/patterns/refine-loop/index.d.cts +7 -0
- package/dist/patterns/refine-loop/index.d.ts +7 -0
- package/dist/patterns/refine-loop/index.js +1 -0
- package/dist/patterns/resilient-pipeline/index.cjs +1 -0
- package/dist/patterns/resilient-pipeline/index.d.cts +7 -0
- package/dist/patterns/resilient-pipeline/index.d.ts +7 -0
- package/dist/patterns/resilient-pipeline/index.js +1 -0
- package/dist/patterns/surface/index.cjs +15 -0
- package/dist/patterns/surface/index.d.cts +8 -0
- package/dist/patterns/surface/index.d.ts +8 -0
- package/dist/patterns/surface/index.js +1 -0
- package/dist/{reactive-layout-u5Ulnqag.d.ts → reactive-layout-BkBwVvwm.d.ts} +2 -2
- package/dist/{reactive-layout-MQP--J3F.d.cts → reactive-layout-PiFwVaWS.d.cts} +2 -2
- package/dist/reactive-log-1QTyx10a.d.ts +190 -0
- package/dist/reactive-log-BiVoSxke.d.cts +190 -0
- package/dist/{composite-aUCvjZVR.d.ts → reactive-map-CwO_COHy.d.cts} +2 -67
- package/dist/{composite-C7PcQvcs.d.cts → reactive-map-FeuTVAJb.d.ts} +2 -67
- package/dist/resilience-CBfYJW5C.d.ts +493 -0
- package/dist/resilience-XRUF267O.js +1 -0
- package/dist/resilience-uBz4yvYB.d.cts +493 -0
- package/dist/{sugar-CCOxXK1e.d.ts → sugar-CY-MCfZ9.d.ts} +17 -15
- package/dist/{sugar-D02n5JjF.d.cts → sugar-DHttV0LX.d.cts} +17 -15
- package/dist/topology-tree-CVjt2gp7.d.cts +25 -0
- package/dist/topology-tree-one6oSKY.d.ts +25 -0
- package/dist/types-O3GzJY2U.d.cts +401 -0
- package/dist/types-u64Ose53.d.ts +401 -0
- package/package.json +252 -22
- package/dist/ai-CaR_912Q.d.cts +0 -1033
- package/dist/ai-WlRltJV7.d.ts +0 -1033
- package/dist/chunk-3ZWCKRHX.js +0 -117
- package/dist/chunk-3ZWCKRHX.js.map +0 -1
- package/dist/chunk-7TAQJHQV.js +0 -103
- package/dist/chunk-7TAQJHQV.js.map +0 -1
- package/dist/chunk-APFNLIRG.js +0 -62
- package/dist/chunk-APFNLIRG.js.map +0 -1
- package/dist/chunk-AT5LKYNL.js +0 -395
- package/dist/chunk-AT5LKYNL.js.map +0 -1
- package/dist/chunk-BQ6RQQFF.js +0 -5087
- package/dist/chunk-BQ6RQQFF.js.map +0 -1
- package/dist/chunk-BVZYTZ5H.js +0 -599
- package/dist/chunk-BVZYTZ5H.js.map +0 -1
- package/dist/chunk-DST5DKZS.js +0 -1371
- package/dist/chunk-DST5DKZS.js.map +0 -1
- package/dist/chunk-GTE6PWRZ.js +0 -866
- package/dist/chunk-GTE6PWRZ.js.map +0 -1
- package/dist/chunk-HXZEYDUR.js +0 -94
- package/dist/chunk-HXZEYDUR.js.map +0 -1
- package/dist/chunk-J22W6HV3.js +0 -107
- package/dist/chunk-J22W6HV3.js.map +0 -1
- package/dist/chunk-J2VBW3DZ.js +0 -302
- package/dist/chunk-J2VBW3DZ.js.map +0 -1
- package/dist/chunk-JSCT3CR4.js +0 -38
- package/dist/chunk-JSCT3CR4.js.map +0 -1
- package/dist/chunk-JWBCY4NC.js +0 -330
- package/dist/chunk-JWBCY4NC.js.map +0 -1
- package/dist/chunk-K2AUJHVP.js +0 -2251
- package/dist/chunk-K2AUJHVP.js.map +0 -1
- package/dist/chunk-MJ2NKQQL.js +0 -119
- package/dist/chunk-MJ2NKQQL.js.map +0 -1
- package/dist/chunk-N6UR7YVY.js +0 -198
- package/dist/chunk-N6UR7YVY.js.map +0 -1
- package/dist/chunk-NC6S43JJ.js +0 -456
- package/dist/chunk-NC6S43JJ.js.map +0 -1
- package/dist/chunk-OFVJBJXR.js +0 -98
- package/dist/chunk-OFVJBJXR.js.map +0 -1
- package/dist/chunk-OHISZPOJ.js +0 -97
- package/dist/chunk-OHISZPOJ.js.map +0 -1
- package/dist/chunk-OU5CQKNW.js +0 -102
- package/dist/chunk-OU5CQKNW.js.map +0 -1
- package/dist/chunk-PF7GRZMW.js +0 -2712
- package/dist/chunk-PF7GRZMW.js.map +0 -1
- package/dist/chunk-PHOUUNK7.js +0 -2291
- package/dist/chunk-PHOUUNK7.js.map +0 -1
- package/dist/chunk-RNHBMHKA.js +0 -1665
- package/dist/chunk-RNHBMHKA.js.map +0 -1
- package/dist/chunk-SX52TAR4.js +0 -110
- package/dist/chunk-SX52TAR4.js.map +0 -1
- package/dist/chunk-VYPWMZ6H.js +0 -98
- package/dist/chunk-VYPWMZ6H.js.map +0 -1
- package/dist/chunk-WBZOVTYK.js +0 -171
- package/dist/chunk-WBZOVTYK.js.map +0 -1
- package/dist/chunk-WKNUIZOY.js +0 -354
- package/dist/chunk-WKNUIZOY.js.map +0 -1
- package/dist/chunk-X3VMZYBT.js +0 -713
- package/dist/chunk-X3VMZYBT.js.map +0 -1
- package/dist/chunk-X5R3GL6H.js +0 -525
- package/dist/chunk-X5R3GL6H.js.map +0 -1
- package/dist/chunk-XGPU467M.js +0 -136
- package/dist/chunk-XGPU467M.js.map +0 -1
- package/dist/compat/index.cjs.map +0 -1
- package/dist/compat/index.js.map +0 -1
- package/dist/compat/jotai/index.cjs.map +0 -1
- package/dist/compat/jotai/index.js.map +0 -1
- package/dist/compat/nanostores/index.cjs.map +0 -1
- package/dist/compat/nanostores/index.js.map +0 -1
- package/dist/compat/nestjs/index.cjs.map +0 -1
- package/dist/compat/nestjs/index.js.map +0 -1
- package/dist/compat/react/index.cjs.map +0 -1
- package/dist/compat/react/index.js.map +0 -1
- package/dist/compat/solid/index.cjs.map +0 -1
- package/dist/compat/solid/index.js.map +0 -1
- package/dist/compat/svelte/index.cjs.map +0 -1
- package/dist/compat/svelte/index.js.map +0 -1
- package/dist/compat/vue/index.cjs.map +0 -1
- package/dist/compat/vue/index.js.map +0 -1
- package/dist/compat/zustand/index.cjs.map +0 -1
- package/dist/compat/zustand/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.js.map +0 -1
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/patterns/ai.cjs +0 -7930
- package/dist/patterns/ai.cjs.map +0 -1
- package/dist/patterns/ai.d.cts +0 -10
- package/dist/patterns/ai.d.ts +0 -10
- package/dist/patterns/ai.js +0 -71
- package/dist/patterns/ai.js.map +0 -1
- package/dist/patterns/audit.cjs +0 -5805
- package/dist/patterns/audit.cjs.map +0 -1
- package/dist/patterns/audit.d.cts +0 -6
- package/dist/patterns/audit.d.ts +0 -6
- package/dist/patterns/audit.js +0 -29
- package/dist/patterns/audit.js.map +0 -1
- package/dist/patterns/demo-shell.cjs +0 -5604
- package/dist/patterns/demo-shell.cjs.map +0 -1
- package/dist/patterns/demo-shell.d.cts +0 -6
- package/dist/patterns/demo-shell.d.ts +0 -6
- package/dist/patterns/demo-shell.js +0 -15
- package/dist/patterns/demo-shell.js.map +0 -1
- package/dist/patterns/memory.cjs +0 -5283
- package/dist/patterns/memory.cjs.map +0 -1
- package/dist/patterns/memory.d.cts +0 -5
- package/dist/patterns/memory.d.ts +0 -5
- package/dist/patterns/memory.js +0 -20
- package/dist/patterns/memory.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/storage-CMjUUuxn.d.ts +0 -190
- package/dist/storage-DdWlZo6U.d.cts +0 -190
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as NodeDescribeKind, a as Node, A as Actor } from './node-Dd6wHSib.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* JSON-shaped slice of a node for `Graph.describe()`
|
|
@@ -25,11 +25,11 @@ type DescribeNodeOutput = {
|
|
|
25
25
|
timestamp_ns: number;
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
|
-
* Latest
|
|
29
|
-
* when present. Populated by
|
|
30
|
-
* has no graph context.
|
|
28
|
+
* Latest annotation attached via `graph.trace(path, annotation)` or via
|
|
29
|
+
* `graph.add(node, { name: path, annotation })`, when present. Populated by
|
|
30
|
+
* `Graph.describe` only — `describeNode` has no graph context.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
annotation?: string;
|
|
33
33
|
};
|
|
34
34
|
/** Detail level for progressive disclosure (Phase 3.3b). */
|
|
35
35
|
type DescribeDetail = "minimal" | "standard" | "full";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as NodeDescribeKind, a as Node, A as Actor } from './node-Dd6wHSib.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* JSON-shaped slice of a node for `Graph.describe()`
|
|
@@ -25,11 +25,11 @@ type DescribeNodeOutput = {
|
|
|
25
25
|
timestamp_ns: number;
|
|
26
26
|
}>;
|
|
27
27
|
/**
|
|
28
|
-
* Latest
|
|
29
|
-
* when present. Populated by
|
|
30
|
-
* has no graph context.
|
|
28
|
+
* Latest annotation attached via `graph.trace(path, annotation)` or via
|
|
29
|
+
* `graph.add(node, { name: path, annotation })`, when present. Populated by
|
|
30
|
+
* `Graph.describe` only — `describeNode` has no graph context.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
annotation?: string;
|
|
33
33
|
};
|
|
34
34
|
/** Detail level for progressive disclosure (Phase 3.3b). */
|
|
35
35
|
type DescribeDetail = "minimal" | "standard" | "full";
|
|
@@ -600,12 +600,31 @@ type NodeTransportOptions = {
|
|
|
600
600
|
};
|
|
601
601
|
/**
|
|
602
602
|
* Cleanup return shape from a node {@link NodeFn}.
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
603
|
+
*
|
|
604
|
+
* Two forms, discriminated on return type:
|
|
605
|
+
*
|
|
606
|
+
* - `() => void` — fires before the next fn run AND on deactivation AND on
|
|
607
|
+
* INVALIDATE. The simplest form: one cleanup function for every transition
|
|
608
|
+
* away from the current run. Use when the same teardown logic applies to
|
|
609
|
+
* all three.
|
|
610
|
+
*
|
|
611
|
+
* - `{ beforeRun?, deactivate?, invalidate? }` — granular hooks. Each hook
|
|
612
|
+
* fires exactly once on its named transition; missing hooks are no-ops.
|
|
613
|
+
* Use when only some transitions should flush resources (e.g. a measurement
|
|
614
|
+
* cache that should survive re-runs but reset on deactivation).
|
|
615
|
+
*
|
|
616
|
+
* - `beforeRun` fires before the next fn invocation (same point as the
|
|
617
|
+
* function-form cleanup's pre-run hook).
|
|
618
|
+
* - `deactivate` fires on deactivation (last-sink unsubscribe or TEARDOWN).
|
|
619
|
+
* - `invalidate` fires on INVALIDATE (spec v0.4 graph-wide flush signal).
|
|
620
|
+
*
|
|
621
|
+
* Closure access: both forms are declared inside `NodeFn`, so hooks see the
|
|
622
|
+
* same closure as the fn body (per-run locals, `ctx.store`, dep refs).
|
|
606
623
|
*/
|
|
607
624
|
type NodeFnCleanup = (() => void) | {
|
|
608
|
-
|
|
625
|
+
beforeRun?: () => void;
|
|
626
|
+
deactivate?: () => void;
|
|
627
|
+
invalidate?: () => void;
|
|
609
628
|
};
|
|
610
629
|
/**
|
|
611
630
|
* Fn-time context exposing per-wave metadata and a per-node persistent
|
|
@@ -647,8 +666,10 @@ interface FnCtx {
|
|
|
647
666
|
* the latest; iterate for multi-emission processing.
|
|
648
667
|
*
|
|
649
668
|
* Emission is explicit via `actions.emit(v)` (sugar: equals + framing) or
|
|
650
|
-
* `actions.down(msgs)` (raw). Return a cleanup
|
|
651
|
-
* `
|
|
669
|
+
* `actions.down(msgs)` (raw). Return a cleanup shape to register teardown:
|
|
670
|
+
* `() => void` (fires on every transition) or
|
|
671
|
+
* `{ beforeRun?, deactivate?, invalidate? }` (each hook fires on its named
|
|
672
|
+
* transition only). See {@link NodeFnCleanup}. Any non-cleanup return value
|
|
652
673
|
* is ignored. The `| void` leg lets arrow-block bodies satisfy `NodeFn`
|
|
653
674
|
* without an explicit `return undefined`.
|
|
654
675
|
*
|
|
@@ -679,6 +700,29 @@ interface NodeOptions<T = unknown> {
|
|
|
679
700
|
* explicitly via `ctx.terminalDeps`.
|
|
680
701
|
*/
|
|
681
702
|
errorWhenDepsError?: boolean;
|
|
703
|
+
/**
|
|
704
|
+
* First-run gate (§2.7). When `false` (default — matches the universal
|
|
705
|
+
* contract "fn does not fire until every declared dep has delivered"), fn
|
|
706
|
+
* is held until every declared dep has delivered at least one DATA or
|
|
707
|
+
* terminal. Sugar constructors (`derived`, `effect`) inherit the default
|
|
708
|
+
* so multi-parent activation produces one combined initial wave
|
|
709
|
+
* `[[START], [DIRTY], [DATA, fn(init...)]]` instead of the sequential
|
|
710
|
+
* `[[START], [DIRTY], [RESOLVED], [DIRTY], [DATA]]` shape produced by
|
|
711
|
+
* per-dep push-on-subscribe firings.
|
|
712
|
+
*
|
|
713
|
+
* When `true`, fn fires as soon as `_dirtyDepCount === 0` regardless of
|
|
714
|
+
* whether any dep is still sentinel. Operators like `withLatestFrom`,
|
|
715
|
+
* `valve`, and worker-bridge aggregators that deliberately fire on
|
|
716
|
+
* partial deps pass `partial: true` explicitly. Zero-dep producer-pattern
|
|
717
|
+
* factories (`stratify`, `budgetGate`, etc.) are unaffected either way —
|
|
718
|
+
* an empty `_deps` array has nothing for the gate to hold on.
|
|
719
|
+
*
|
|
720
|
+
* Gate scope: applies only until fn has fired once (`_hasCalledFnOnce`).
|
|
721
|
+
* Subsequent waves, INVALIDATE, and `_addDep` do not re-gate. Terminal
|
|
722
|
+
* reset (resubscribable node reconnect) resets `_hasCalledFnOnce` and
|
|
723
|
+
* re-arms the gate.
|
|
724
|
+
*/
|
|
725
|
+
partial?: boolean;
|
|
682
726
|
/**
|
|
683
727
|
* Tier-2 PAUSE/RESUME handling.
|
|
684
728
|
* - `true` (default): wave completion suppressed while paused; fn fires
|
|
@@ -756,8 +800,9 @@ interface Node<T = unknown> {
|
|
|
756
800
|
* - `true` — dep sent COMPLETE.
|
|
757
801
|
* - anything else — dep sent ERROR with that payload.
|
|
758
802
|
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
803
|
+
* `[ERROR, undefined]` is rejected at the dispatch boundary (`_emit`) per
|
|
804
|
+
* spec §1.2 — `undefined` would collide with the "live" encoding here.
|
|
805
|
+
* Always pass meaningful error values (Error objects, domain tags).
|
|
761
806
|
*/
|
|
762
807
|
interface DepRecord {
|
|
763
808
|
readonly node: Node;
|
|
@@ -885,6 +930,15 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
885
930
|
readonly _autoComplete: boolean;
|
|
886
931
|
readonly _autoError: boolean;
|
|
887
932
|
readonly _pausable: boolean | "resumeAll";
|
|
933
|
+
/**
|
|
934
|
+
* @internal First-run-gate override. `false` (default) holds fn until every
|
|
935
|
+
* dep has delivered DATA or a terminal — spec §2.7 first-run gate. `true`
|
|
936
|
+
* disables the gate; fn fires as soon as `_dirtyDepCount === 0`, regardless
|
|
937
|
+
* of dep sentinel state. Operators that need partial firing
|
|
938
|
+
* (`withLatestFrom`, `valve`, worker-bridge aggregators) pass
|
|
939
|
+
* `partial: true` explicitly at construction.
|
|
940
|
+
*/
|
|
941
|
+
readonly _partial: boolean;
|
|
888
942
|
readonly _guard: NodeGuard | undefined;
|
|
889
943
|
/**
|
|
890
944
|
* @internal Additional guards stacked at runtime via {@link NodeImpl._pushGuard}
|
|
@@ -1092,8 +1146,14 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1092
1146
|
private _maybeRunFnOnSettlement;
|
|
1093
1147
|
private _maybeAutoTerminalAfterWave;
|
|
1094
1148
|
/**
|
|
1095
|
-
* @internal Runs the node fn once.
|
|
1096
|
-
*
|
|
1149
|
+
* @internal Runs the node fn once.
|
|
1150
|
+
*
|
|
1151
|
+
* Cleanup firing:
|
|
1152
|
+
* - Function-form cleanup — fires here (pre-run) AND on deactivation AND
|
|
1153
|
+
* on INVALIDATE. Cleared before the new fn runs.
|
|
1154
|
+
* - Object-form cleanup — only `beforeRun` fires here; `deactivate` and
|
|
1155
|
+
* `invalidate` hooks survive across re-runs. The cleanup reference
|
|
1156
|
+
* itself is preserved so `deactivate`/`invalidate` still fire later.
|
|
1097
1157
|
*/
|
|
1098
1158
|
private _execFn;
|
|
1099
1159
|
private _clearWaveFlags;
|
|
@@ -1212,4 +1272,4 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1212
1272
|
*/
|
|
1213
1273
|
declare function node<T = unknown>(depsOrFn?: readonly Node[] | NodeFn | NodeOptions<T>, fnOrOpts?: NodeFn | NodeOptions<T>, optsArg?: NodeOptions<T>): Node<T>;
|
|
1214
1274
|
|
|
1215
|
-
export {
|
|
1275
|
+
export { START as $, type Actor as A, type NodeInspectorHook as B, COMPLETE as C, DATA as D, ERROR as E, type FnCtx as F, type GuardAction as G, type HashFn as H, INVALIDATE as I, type NodeInspectorHookEvent as J, type NodeSink as K, type NodeStatus as L, type Message as M, type NodeOptions as N, type NodeTransportOptions as O, type PolicyRuleData as P, type NodeVersionInfo as Q, type OnMessageHandler as R, type OnSubscribeHandler as S, PAUSE as T, type PolicyAllow as U, type VersioningLevel as V, type PolicyDeny as W, RESOLVED as X, RESOLVED_MSG as Y, RESOLVED_ONLY_BATCH as Z, RESUME as _, type Node as a, START_MSG as a0, type SubscribeContext as a1, TEARDOWN as a2, TEARDOWN_MSG as a3, TEARDOWN_ONLY_BATCH as a4, type V0 as a5, type V1 as a6, type VersioningOptions as a7, accessHintForGuard as a8, advanceVersion as a9, configure as aa, createVersioning as ab, defaultConfig as ac, defaultHash as ad, isV1 as ae, node as af, normalizeActor as ag, policy as ah, policyFromRules as ai, registerBuiltins as aj, type Messages as b, type NodeActions as c, type NodeFnCleanup as d, type NodeDescribeKind as e, COMPLETE_MSG as f, COMPLETE_ONLY_BATCH as g, DEFAULT_ACTOR as h, DIRTY as i, DIRTY_MSG as j, DIRTY_ONLY_BATCH as k, type DepRecord as l, type GlobalInspectorEvent as m, type GlobalInspectorHook as n, GraphReFlyConfig as o, GuardDenied as p, type GuardDeniedDetails as q, INVALIDATE_MSG as r, INVALIDATE_ONLY_BATCH as s, type MessageContext as t, type MessageTypeRegistration as u, type MessageTypeRegistrationInput as v, type NodeCtx as w, type NodeFn as x, type NodeGuard as y, NodeImpl as z };
|
|
@@ -600,12 +600,31 @@ type NodeTransportOptions = {
|
|
|
600
600
|
};
|
|
601
601
|
/**
|
|
602
602
|
* Cleanup return shape from a node {@link NodeFn}.
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
*
|
|
603
|
+
*
|
|
604
|
+
* Two forms, discriminated on return type:
|
|
605
|
+
*
|
|
606
|
+
* - `() => void` — fires before the next fn run AND on deactivation AND on
|
|
607
|
+
* INVALIDATE. The simplest form: one cleanup function for every transition
|
|
608
|
+
* away from the current run. Use when the same teardown logic applies to
|
|
609
|
+
* all three.
|
|
610
|
+
*
|
|
611
|
+
* - `{ beforeRun?, deactivate?, invalidate? }` — granular hooks. Each hook
|
|
612
|
+
* fires exactly once on its named transition; missing hooks are no-ops.
|
|
613
|
+
* Use when only some transitions should flush resources (e.g. a measurement
|
|
614
|
+
* cache that should survive re-runs but reset on deactivation).
|
|
615
|
+
*
|
|
616
|
+
* - `beforeRun` fires before the next fn invocation (same point as the
|
|
617
|
+
* function-form cleanup's pre-run hook).
|
|
618
|
+
* - `deactivate` fires on deactivation (last-sink unsubscribe or TEARDOWN).
|
|
619
|
+
* - `invalidate` fires on INVALIDATE (spec v0.4 graph-wide flush signal).
|
|
620
|
+
*
|
|
621
|
+
* Closure access: both forms are declared inside `NodeFn`, so hooks see the
|
|
622
|
+
* same closure as the fn body (per-run locals, `ctx.store`, dep refs).
|
|
606
623
|
*/
|
|
607
624
|
type NodeFnCleanup = (() => void) | {
|
|
608
|
-
|
|
625
|
+
beforeRun?: () => void;
|
|
626
|
+
deactivate?: () => void;
|
|
627
|
+
invalidate?: () => void;
|
|
609
628
|
};
|
|
610
629
|
/**
|
|
611
630
|
* Fn-time context exposing per-wave metadata and a per-node persistent
|
|
@@ -647,8 +666,10 @@ interface FnCtx {
|
|
|
647
666
|
* the latest; iterate for multi-emission processing.
|
|
648
667
|
*
|
|
649
668
|
* Emission is explicit via `actions.emit(v)` (sugar: equals + framing) or
|
|
650
|
-
* `actions.down(msgs)` (raw). Return a cleanup
|
|
651
|
-
* `
|
|
669
|
+
* `actions.down(msgs)` (raw). Return a cleanup shape to register teardown:
|
|
670
|
+
* `() => void` (fires on every transition) or
|
|
671
|
+
* `{ beforeRun?, deactivate?, invalidate? }` (each hook fires on its named
|
|
672
|
+
* transition only). See {@link NodeFnCleanup}. Any non-cleanup return value
|
|
652
673
|
* is ignored. The `| void` leg lets arrow-block bodies satisfy `NodeFn`
|
|
653
674
|
* without an explicit `return undefined`.
|
|
654
675
|
*
|
|
@@ -679,6 +700,29 @@ interface NodeOptions<T = unknown> {
|
|
|
679
700
|
* explicitly via `ctx.terminalDeps`.
|
|
680
701
|
*/
|
|
681
702
|
errorWhenDepsError?: boolean;
|
|
703
|
+
/**
|
|
704
|
+
* First-run gate (§2.7). When `false` (default — matches the universal
|
|
705
|
+
* contract "fn does not fire until every declared dep has delivered"), fn
|
|
706
|
+
* is held until every declared dep has delivered at least one DATA or
|
|
707
|
+
* terminal. Sugar constructors (`derived`, `effect`) inherit the default
|
|
708
|
+
* so multi-parent activation produces one combined initial wave
|
|
709
|
+
* `[[START], [DIRTY], [DATA, fn(init...)]]` instead of the sequential
|
|
710
|
+
* `[[START], [DIRTY], [RESOLVED], [DIRTY], [DATA]]` shape produced by
|
|
711
|
+
* per-dep push-on-subscribe firings.
|
|
712
|
+
*
|
|
713
|
+
* When `true`, fn fires as soon as `_dirtyDepCount === 0` regardless of
|
|
714
|
+
* whether any dep is still sentinel. Operators like `withLatestFrom`,
|
|
715
|
+
* `valve`, and worker-bridge aggregators that deliberately fire on
|
|
716
|
+
* partial deps pass `partial: true` explicitly. Zero-dep producer-pattern
|
|
717
|
+
* factories (`stratify`, `budgetGate`, etc.) are unaffected either way —
|
|
718
|
+
* an empty `_deps` array has nothing for the gate to hold on.
|
|
719
|
+
*
|
|
720
|
+
* Gate scope: applies only until fn has fired once (`_hasCalledFnOnce`).
|
|
721
|
+
* Subsequent waves, INVALIDATE, and `_addDep` do not re-gate. Terminal
|
|
722
|
+
* reset (resubscribable node reconnect) resets `_hasCalledFnOnce` and
|
|
723
|
+
* re-arms the gate.
|
|
724
|
+
*/
|
|
725
|
+
partial?: boolean;
|
|
682
726
|
/**
|
|
683
727
|
* Tier-2 PAUSE/RESUME handling.
|
|
684
728
|
* - `true` (default): wave completion suppressed while paused; fn fires
|
|
@@ -756,8 +800,9 @@ interface Node<T = unknown> {
|
|
|
756
800
|
* - `true` — dep sent COMPLETE.
|
|
757
801
|
* - anything else — dep sent ERROR with that payload.
|
|
758
802
|
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
803
|
+
* `[ERROR, undefined]` is rejected at the dispatch boundary (`_emit`) per
|
|
804
|
+
* spec §1.2 — `undefined` would collide with the "live" encoding here.
|
|
805
|
+
* Always pass meaningful error values (Error objects, domain tags).
|
|
761
806
|
*/
|
|
762
807
|
interface DepRecord {
|
|
763
808
|
readonly node: Node;
|
|
@@ -885,6 +930,15 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
885
930
|
readonly _autoComplete: boolean;
|
|
886
931
|
readonly _autoError: boolean;
|
|
887
932
|
readonly _pausable: boolean | "resumeAll";
|
|
933
|
+
/**
|
|
934
|
+
* @internal First-run-gate override. `false` (default) holds fn until every
|
|
935
|
+
* dep has delivered DATA or a terminal — spec §2.7 first-run gate. `true`
|
|
936
|
+
* disables the gate; fn fires as soon as `_dirtyDepCount === 0`, regardless
|
|
937
|
+
* of dep sentinel state. Operators that need partial firing
|
|
938
|
+
* (`withLatestFrom`, `valve`, worker-bridge aggregators) pass
|
|
939
|
+
* `partial: true` explicitly at construction.
|
|
940
|
+
*/
|
|
941
|
+
readonly _partial: boolean;
|
|
888
942
|
readonly _guard: NodeGuard | undefined;
|
|
889
943
|
/**
|
|
890
944
|
* @internal Additional guards stacked at runtime via {@link NodeImpl._pushGuard}
|
|
@@ -1092,8 +1146,14 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1092
1146
|
private _maybeRunFnOnSettlement;
|
|
1093
1147
|
private _maybeAutoTerminalAfterWave;
|
|
1094
1148
|
/**
|
|
1095
|
-
* @internal Runs the node fn once.
|
|
1096
|
-
*
|
|
1149
|
+
* @internal Runs the node fn once.
|
|
1150
|
+
*
|
|
1151
|
+
* Cleanup firing:
|
|
1152
|
+
* - Function-form cleanup — fires here (pre-run) AND on deactivation AND
|
|
1153
|
+
* on INVALIDATE. Cleared before the new fn runs.
|
|
1154
|
+
* - Object-form cleanup — only `beforeRun` fires here; `deactivate` and
|
|
1155
|
+
* `invalidate` hooks survive across re-runs. The cleanup reference
|
|
1156
|
+
* itself is preserved so `deactivate`/`invalidate` still fire later.
|
|
1097
1157
|
*/
|
|
1098
1158
|
private _execFn;
|
|
1099
1159
|
private _clearWaveFlags;
|
|
@@ -1212,4 +1272,4 @@ declare class NodeImpl<T = unknown> implements Node<T> {
|
|
|
1212
1272
|
*/
|
|
1213
1273
|
declare function node<T = unknown>(depsOrFn?: readonly Node[] | NodeFn | NodeOptions<T>, fnOrOpts?: NodeFn | NodeOptions<T>, optsArg?: NodeOptions<T>): Node<T>;
|
|
1214
1274
|
|
|
1215
|
-
export {
|
|
1275
|
+
export { START as $, type Actor as A, type NodeInspectorHook as B, COMPLETE as C, DATA as D, ERROR as E, type FnCtx as F, type GuardAction as G, type HashFn as H, INVALIDATE as I, type NodeInspectorHookEvent as J, type NodeSink as K, type NodeStatus as L, type Message as M, type NodeOptions as N, type NodeTransportOptions as O, type PolicyRuleData as P, type NodeVersionInfo as Q, type OnMessageHandler as R, type OnSubscribeHandler as S, PAUSE as T, type PolicyAllow as U, type VersioningLevel as V, type PolicyDeny as W, RESOLVED as X, RESOLVED_MSG as Y, RESOLVED_ONLY_BATCH as Z, RESUME as _, type Node as a, START_MSG as a0, type SubscribeContext as a1, TEARDOWN as a2, TEARDOWN_MSG as a3, TEARDOWN_ONLY_BATCH as a4, type V0 as a5, type V1 as a6, type VersioningOptions as a7, accessHintForGuard as a8, advanceVersion as a9, configure as aa, createVersioning as ab, defaultConfig as ac, defaultHash as ad, isV1 as ae, node as af, normalizeActor as ag, policy as ah, policyFromRules as ai, registerBuiltins as aj, type Messages as b, type NodeActions as c, type NodeFnCleanup as d, type NodeDescribeKind as e, COMPLETE_MSG as f, COMPLETE_ONLY_BATCH as g, DEFAULT_ACTOR as h, DIRTY as i, DIRTY_MSG as j, DIRTY_ONLY_BATCH as k, type DepRecord as l, type GlobalInspectorEvent as m, type GlobalInspectorHook as n, GraphReFlyConfig as o, GuardDenied as p, type GuardDeniedDetails as q, INVALIDATE_MSG as r, INVALIDATE_ONLY_BATCH as s, type MessageContext as t, type MessageTypeRegistration as u, type MessageTypeRegistrationInput as v, type NodeCtx as w, type NodeFn as x, type NodeGuard as y, NodeImpl as z };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";var Ie=Object.create;var P=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Fe=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var M=(e,t)=>()=>(e&&(t=e(e=0)),t);var je=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},te=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of De(t))!Ke.call(e,i)&&i!==r&&P(e,i,{get:()=>t[i],enumerable:!(n=Ue(t,i))||n.enumerable});return e};var Be=(e,t,r)=>(r=e!=null?Ie(Fe(e)):{},te(t||!e||!e.__esModule?P(r,"default",{value:e,enumerable:!0}):r,e)),Ge=e=>te(P({},"__esModule",{value:!0}),e);function h(){return Math.trunc(performance.now()*1e6)}function I(){return Date.now()*1e6}var A=M(()=>{"use strict"});var T,V=M(()=>{"use strict";T=class{_timer;_gen=0;start(t,r){this.cancel(),this._gen+=1;let n=this._gen;this._timer=setTimeout(()=>{this._timer=void 0,n===this._gen&&r()},t)}cancel(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}get pending(){return this._timer!==void 0}}});var Xe,de,ue,pe,Qe,Ze,Y,fe,et,tt,nt,Kt,rt,ot,jt,Bt,Gt,$t,Wt,me=M(()=>{"use strict";Xe=Symbol.for("graphrefly/START"),de=Symbol.for("graphrefly/DATA"),ue=Symbol.for("graphrefly/DIRTY"),pe=Symbol.for("graphrefly/RESOLVED"),Qe=Symbol.for("graphrefly/INVALIDATE"),Ze=Symbol.for("graphrefly/TEARDOWN"),Y=Symbol.for("graphrefly/COMPLETE"),fe=Symbol.for("graphrefly/ERROR"),et=Object.freeze([ue]),tt=Object.freeze([pe]),nt=Object.freeze([Qe]),Kt=Object.freeze([Xe]),rt=Object.freeze([Y]),ot=Object.freeze([Ze]),jt=Object.freeze([et]),Bt=Object.freeze([tt]),Gt=Object.freeze([nt]),$t=Object.freeze([rt]),Wt=Object.freeze([ot])});function ge(e){return new Promise((t,r)=>{let n=!1,i=!1,a;a=e.subscribe(s=>{for(let o of s){if(n)return;if(o[0]===de){n=!0,t(o[1]),a?(a(),a=void 0):i=!0;return}if(o[0]===fe){n=!0,r(o[1]),a?(a(),a=void 0):i=!0;return}if(o[0]===Y){n=!0,r(new Error("completed without DATA")),a?(a(),a=void 0):i=!0;return}}}),i&&(a?.(),a=void 0)})}var ye=M(()=>{"use strict";me()});function At(e){return e<0?0:e}function Ne(e){let t=Math.max(1,e?.failureThreshold??5),r=At(e?.cooldownNs??30*1e9),n=e?.cooldown??null,i=Math.max(1,e?.halfOpenMax??1),a=e?.now??h,s="closed",o=0,c=0,u=0,l=r,d=0;function p(){if(!n)return r;let g=n(c);return g!==null?g:r}function m(){s="open",l=p(),u=a(),d=0}return{canExecute(){return s==="closed"?!0:s==="open"?a()-u>=l?(s="half-open",d=1,!0):!1:d<i?(d++,!0):!1},recordSuccess(){s==="half-open"?(s="closed",o=0,c=0):s==="closed"&&(o=0)},recordFailure(g){if(s==="half-open"){c++,m();return}s==="closed"&&(o++,o>=t&&m())},get state(){return s},get failureCount(){return o},reset(){s="closed",o=0,c=0,d=0}}}var Pe=M(()=>{"use strict";A()});var Tt={};je(Tt,{chromeNanoAdapter:()=>C,cloudFirstPreset:()=>xt,localFirstPreset:()=>Lt,offlinePreset:()=>Rt,webllmAdapter:()=>S});module.exports=Ge(Tt);A();function ne(){let e=new Error("aborted");return e.name="AbortError",e}function C(e={}){let t=e.streamMode??"accumulated",r=e.navigatorOverride??globalThis.navigator,n=()=>{let o=r?.ai;if(!o?.languageModel)throw new Error("chromeNanoAdapter: Chrome AI languageModel not available (requires Chrome 131+ with flag/OT).");return o},i=async o=>n().languageModel.create({systemPrompt:o?.systemPrompt??e.systemPrompt,temperature:o?.temperature??e.temperature,topK:e.topK,signal:o?.signal}),a=o=>{let c=[];for(let u of o)u.role!=="system"&&c.push(`${u.role}: ${u.content}`);return c.join(`
|
|
2
|
+
|
|
3
|
+
`)},s=()=>({input:{regular:0},output:{regular:0}});return{provider:"chrome-nano",model:"chrome-nano",async invoke(o,c){let u=await i(c);try{let l=a(o),d=h(),p=await u.prompt(l,{signal:c?.signal}),m=Math.max(0,(h()-d)/1e6);return{content:p,usage:s(),finishReason:"stop",latencyMs:m,model:"chrome-nano",provider:"chrome-nano"}}finally{u.destroy?.()}},async*stream(o,c){let u=await i(c);try{let l=a(o);if(t==="delta")for await(let d of u.promptStreaming(l,{signal:c?.signal})){if(c?.signal?.aborted)throw ne();d&&(yield{type:"token",delta:d})}else{let d="";for await(let p of u.promptStreaming(l,{signal:c?.signal})){if(c?.signal?.aborted)throw ne();let m=p.startsWith(d)?p.slice(d.length):p;d=p,m&&(yield{type:"token",delta:m})}}yield{type:"usage",usage:s()},yield{type:"finish",reason:"stop"}}finally{u.destroy?.()}}}}A();function $e(){let e=new Error("aborted");return e.name="AbortError",e}function S(e){let t=e.engine,r=async()=>{if(t)return t;if(!We(e.navigatorOverride))throw new Error("webllmAdapter: WebGPU not available in this environment");let s=(await import("@mlc-ai/web-llm").catch(()=>{throw new Error("webllmAdapter: @mlc-ai/web-llm not installed. Add it as a peer dependency or pass opts.engine.")})).CreateMLCEngine;if(!s)throw new Error("webllmAdapter: @mlc-ai/web-llm missing CreateMLCEngine export");return t=await s(e.model,{initProgressCallback:e.initProgressCallback}),t},n=(a,s)=>{let o=[];s?.systemPrompt&&o.push({role:"system",content:s.systemPrompt});for(let c of a)o.push({role:c.role==="tool"?"user":c.role,content:c.content});return o},i=a=>({input:{regular:a?.prompt_tokens??0},output:{regular:a?.completion_tokens??0},raw:a});return{provider:"webllm",model:e.model,async invoke(a,s){let o=await r(),c=h(),u=await o.chat.completions.create({model:s?.model??e.model,messages:n(a,s),max_tokens:s?.maxTokens,temperature:s?.temperature},{signal:s?.signal}),l=Math.max(0,(h()-c)/1e6),d=u.choices?.[0];return{content:d?.message?.content??"",usage:i(u.usage),finishReason:d?.finish_reason,latencyMs:l,model:e.model,provider:"webllm"}},async*stream(a,s){let c=await(await r()).chat.completions.create({model:s?.model??e.model,messages:n(a,s),max_tokens:s?.maxTokens,temperature:s?.temperature,stream:!0},{signal:s?.signal}),u,l;for await(let d of c){if(s?.signal?.aborted)throw $e();let p=d.choices?.[0];p?.delta?.content&&(yield{type:"token",delta:p.delta.content}),p?.finish_reason&&(l=p.finish_reason),d.usage&&(u=d.usage)}u&&(yield{type:"usage",usage:i(u)}),yield{type:"finish",reason:l??"stop"}}}}function We(e){let t=e??globalThis.navigator;return!!(t&&"gpu"in t&&t.gpu)}A();function ae(e={}){return e.sdk?Ye(e):He(e)}function U(e,t,r,n){let i=t?.model??r;if(!i)throw new Error("anthropicAdapter: model must be set via options.model or invokeOpts.model");let{system:a,chat:s}=Je(e,t?.systemPrompt),o={model:i,messages:s.map(qe),max_tokens:t?.maxTokens??4096};return a&&(o.system=a),t?.temperature!=null&&(o.temperature=t.temperature),t?.tools&&t.tools.length>0&&(o.tools=t.tools.map(Ve)),t?.maxReasoningTokens!=null&&(o.thinking={type:"enabled",budget_tokens:t.maxReasoningTokens}),t?.cacheHint,n&&(o.stream=!0),t?.providerExtras&&Object.assign(o,t.providerExtras),o}function Je(e,t){let r=[];t&&r.push(t);let n=[];for(let i of e)i.role==="system"?r.push(i.content):n.push(i);return{system:r.length>0?r.join(`
|
|
4
|
+
|
|
5
|
+
`):void 0,chat:n}}function qe(e){if(e.role==="tool")return{role:"user",content:[{type:"tool_result",tool_use_id:e.toolCallId,content:e.content}]};if(e.role==="assistant"&&e.toolCalls&&e.toolCalls.length>0){let t=[];e.content&&t.push({type:"text",text:e.content});for(let r of e.toolCalls)t.push({type:"tool_use",id:r.id,name:r.name,input:r.arguments});return{role:"assistant",content:t}}return{role:e.role,content:e.content}}function Ve(e){return{name:e.name,description:e.description,input_schema:e.parameters}}function D(e,t){if(!e)return{...t};let r={...e};return t.input_tokens!=null&&(r.input_tokens=t.input_tokens),t.output_tokens!=null&&(r.output_tokens=t.output_tokens),t.cache_read_input_tokens!=null&&(r.cache_read_input_tokens=t.cache_read_input_tokens),t.cache_creation_input_tokens!=null&&(r.cache_creation_input_tokens=t.cache_creation_input_tokens),t.cache_creation&&(r.cache_creation={...e.cache_creation??{},...t.cache_creation}),t.server_tool_use&&(r.server_tool_use={...e.server_tool_use??{},...t.server_tool_use}),r}function q(e){let t={input:{regular:e?.input_tokens??0},output:{regular:e?.output_tokens??0},raw:e};return e?.cache_read_input_tokens&&(t.input.cacheRead=e.cache_read_input_tokens),e?.cache_creation?(e.cache_creation.ephemeral_5m_input_tokens&&(t.input.cacheWrite5m=e.cache_creation.ephemeral_5m_input_tokens),e.cache_creation.ephemeral_1h_input_tokens&&(t.input.cacheWrite1h=e.cache_creation.ephemeral_1h_input_tokens)):e?.cache_creation_input_tokens&&(t.input.cacheWrite5m=e.cache_creation_input_tokens),e?.server_tool_use?.web_search_requests&&(t.auxiliary={webSearchRequests:e.server_tool_use.web_search_requests}),t}function ie(e,t){let r=[],n=[];for(let i of e.content)if(i.type==="text"&&typeof i.text=="string")r.push(i.text);else if(i.type==="tool_use"){let a=i;n.push({id:a.id,name:a.name,arguments:a.input??{}})}return{content:r.join(""),toolCalls:n.length>0?n:void 0,usage:q(e.usage),finishReason:e.stop_reason,latencyMs:t,model:e.model,provider:"anthropic"}}function He(e){let t=e.apiKey??globalThis.process?.env?.ANTHROPIC_API_KEY,r=e.baseURL??"https://api.anthropic.com",n=e.anthropicVersion??"2023-06-01",i=e.fetchImpl??fetch,a=()=>{if(!t)throw new Error("anthropicAdapter: apiKey required for invoke/stream (or provide opts.sdk)");return{"x-api-key":t,"anthropic-version":n,"content-type":"application/json",...e.headers??{}}};return{provider:"anthropic",model:e.model,async invoke(s,o){let c=U(s,o,e.model,!1),u=h(),l=await i(`${r}/v1/messages`,{method:"POST",headers:a(),body:JSON.stringify(c),signal:o?.signal});if(!l.ok)throw await se(l);let d=await l.json(),p=Math.max(0,(h()-u)/1e6);return ie(d,p)},async*stream(s,o){let c=U(s,o,e.model,!0),u=await i(`${r}/v1/messages`,{method:"POST",headers:{...a(),accept:"text/event-stream"},body:JSON.stringify(c),signal:o?.signal});if(!u.ok)throw await se(u);if(!u.body)throw new Error("anthropicAdapter: streaming response has no body");let l,d,p=new Map;for await(let m of ze(u.body)){let w=m.data;if(!w)continue;let g;try{g=JSON.parse(w)}catch{continue}switch(g.type){case"message_start":{l=D(l,g.message.usage);break}case"content_block_start":{let f=g,y=f.content_block;y.type==="tool_use"&&(p.set(f.index,{id:String(y.id??""),name:String(y.name??""),argBuf:""}),yield{type:"tool-call-delta",delta:{id:String(y.id??""),name:String(y.name??"")}});break}case"content_block_delta":{let f=g,y=f.delta;if(y.type==="text_delta"&&typeof y.text=="string")yield{type:"token",delta:y.text};else if(y.type==="input_json_delta"&&typeof y.partial_json=="string"){let k=p.get(f.index);k&&(k.argBuf+=y.partial_json),yield{type:"tool-call-delta",delta:{argumentsDelta:y.partial_json}}}else y.type==="thinking_delta"&&typeof y.thinking=="string"&&(yield{type:"thinking",delta:y.thinking});break}case"message_delta":{let f=g;f.delta.stop_reason&&(d=f.delta.stop_reason),f.delta.usage&&(l=D(l,f.delta.usage));break}case"message_stop":break}}l&&(yield{type:"usage",usage:q(l)}),yield{type:"finish",reason:d??"stop"}}}}function Ye(e){let t=e.sdk;if(!t)throw new Error("sdkBackedAnthropic: sdk instance required");return{provider:"anthropic",model:e.model,async invoke(r,n){let i=U(r,n,e.model,!1),a=h(),s=await t.messages.create(i,{signal:n?.signal}),o=Math.max(0,(h()-a)/1e6);return ie(s,o)},async*stream(r,n){if(!t.messages.stream)throw new Error("sdkBackedAnthropic: SDK instance does not expose .messages.stream");let i=U(r,n,e.model,!0),a,s;for await(let o of t.messages.stream(i,{signal:n?.signal}))switch(o.type){case"message_start":a=D(a,o.message.usage);break;case"content_block_delta":{let c=o.delta;c?.type==="text_delta"&&typeof c.text=="string"?yield{type:"token",delta:c.text}:c?.type==="input_json_delta"&&typeof c.partial_json=="string"?yield{type:"tool-call-delta",delta:{argumentsDelta:c.partial_json}}:c?.type==="thinking_delta"&&typeof c.thinking=="string"&&(yield{type:"thinking",delta:c.thinking});break}case"message_delta":{let c=o;c.delta.stop_reason&&(s=c.delta.stop_reason),c.delta.usage&&(a=D(a,c.delta.usage));break}}a&&(yield{type:"usage",usage:q(a)}),yield{type:"finish",reason:s??"stop"}}}}async function*ze(e){let t=e.getReader(),r=new TextDecoder,n="";try{for(;;){let{done:i,value:a}=await t.read();if(i){n.length>0&&(yield re(n));return}n+=r.decode(a,{stream:!0});let s=oe(n);for(;s!==null;){let o=n.slice(0,s.index);n=n.slice(s.index+s.length);let c=re(o);(c.data||c.event)&&(yield c),s=oe(n)}}}finally{t.releaseLock()}}function re(e){let t={},r=[];for(let n of e.split(`
|
|
6
|
+
`)){let i=n.endsWith("\r")?n.slice(0,-1):n;if(!i||i.startsWith(":"))continue;let a=i.indexOf(":"),s=a===-1?i:i.slice(0,a),o=a===-1?"":i.slice(a+1).replace(/^ /,"");s==="data"?r.push(o):s==="event"?t.event=o:s==="id"&&(t.id=o)}return r.length>0&&(t.data=r.join(`
|
|
7
|
+
`)),t}function oe(e){let t=e.indexOf(`\r
|
|
8
|
+
\r
|
|
9
|
+
`),r=e.indexOf(`
|
|
10
|
+
|
|
11
|
+
`),n=null;return t!==-1&&(n={index:t,length:4}),r!==-1&&(n===null||r<n.index)&&(n={index:r,length:2}),n}async function se(e){let t;try{t=await e.text()}catch{t=""}let r=new Error(`Anthropic API ${e.status}: ${e.statusText}${t?` \u2014 ${t}`:""}`);return r.status=e.status,r.headers=e.headers,r}V();function F(){let e=new Error("aborted");return e.name="AbortError",e}function ce(e,t){return e<=0?Promise.resolve():t?.aborted?Promise.reject(F()):new Promise((r,n)=>{let i=new T,a,s=()=>{i.cancel(),t&&a&&t.removeEventListener("abort",a)};i.start(e,()=>{s(),r()}),t&&(a=()=>{s(),n(F())},t.addEventListener("abort",a,{once:!0}))})}function K(e={}){let t=e.provider??"dry-run",r=e.model??"dry-run-v1",n=e.latencyMs??0,i=Math.max(1,e.streamChunkSize??16),a=e.respond??(o=>{let c=[...o].reverse().find(u=>u.role==="user");return c?`echo: ${c.content}`:"dry-run: no user message"}),s=e.usage??((o,c)=>{let u=o.reduce((l,d)=>l+d.content.length,0);return{input:{regular:Math.ceil(u/4)},output:{regular:Math.ceil(c.length/4)}}});return{provider:t,model:r,async invoke(o,c){if(await ce(n,c?.signal),c?.signal?.aborted)throw F();let u=a(o,c),l=s(o,u);return{content:u,usage:l,finishReason:"stop",model:c?.model??r,provider:t,tier:c?.tier,metadata:{dryRun:!0}}},async*stream(o,c){let u=a(o,c),l=s(o,u),d=Math.ceil(u.length/i)||1,p=n>0?n/d:0;for(let m=0;m<u.length;m+=i){if(c?.signal?.aborted)throw F();await ce(p,c?.signal),yield{type:"token",delta:u.slice(m,m+i)}}yield{type:"usage",usage:l},yield{type:"finish",reason:"stop"}}}}A();async function j(e){let t=typeof e=="string"?new TextEncoder().encode(e):e,r=await globalThis.crypto.subtle.digest("SHA-256",t),n=new Uint8Array(r),i="";for(let a=0;a<n.length;a++)i+=le[n[a]];return i}var le=new Array(256);for(let e=0;e<256;e++)le[e]=e.toString(16).padStart(2,"0");function H(){let e=new Map;return{save(t,r){e.set(t,JSON.parse(JSON.stringify(r)))},load(t){let r=e.get(t);return r===void 0?null:JSON.parse(JSON.stringify(r))},clear(t){e.delete(t)},list(){return[...e.keys()].sort()}}}A();ye();function he(e,t={}){let r=t.keyFn??(i=>String(i)),n=new Map;return i=>{let a=r(i),s=n.get(a);if(s)return s;let o=e(i),c;o!=null&&typeof o.then=="function"?c=Promise.resolve(o):o!=null&&typeof o=="object"&&"subscribe"in o&&"cache"in o?c=ge(o):o!=null&&typeof o=="object"&&Symbol.asyncIterator in o?c=(async()=>{let d=o[Symbol.asyncIterator]();try{let{value:p,done:m}=await d.next();if(m)throw new Error("singleFromAny: factory returned empty async iterable");return p}finally{await d.return?.()}})():o!=null&&typeof o=="object"&&Symbol.iterator in o?c=(async()=>{let d=o[Symbol.iterator]();try{let{value:p,done:m}=d.next();if(m)throw new Error("singleFromAny: factory returned empty iterable");return p}finally{d.return?.()}})():c=Promise.resolve(o);let u,l=()=>{n.get(a)===u&&n.delete(a)};return u=c.then(d=>(l(),d),d=>{throw l(),d}),n.set(a,u),u}}V();var E=class extends Error{constructor(r,n){super(`withReplayCache: no cached response for ${n} (key=${r}, mode=read-strict)`);this.key=r;this.method=n}name="ReplayCacheMissError"};function be(e,t){let r=t.mode??"read-write",n=t.cacheStreaming??!1,i=t.captureStreamCadence??!1,a=t.replaySpeed??1,s=t.keyPrefix??"llm-replay",o=t.storage,c=r==="read"||r==="read-strict",u=async(g,f)=>{if(t.keyFn){let R=t.keyFn;if(R.length<=1){let v={messages:g,opts:f,context:f?.keyContext},b=await R(v);return`${s}:${b}`}let N=await R(g,f);return`${s}:${N}`}let{signal:y,keyContext:k,...x}=f??{},_=z({messages:g,opts:x}),O=await j(_);return`${s}:${O}`},l=async g=>{if(r==="write-only")return;let f=await o.load(g);if(f!=null)try{return typeof f=="string"?JSON.parse(f):f}catch{return}},d=async g=>(await l(g))?.response,p=async(g,f,y)=>{if(c)return;let k={response:f,storedAtNs:I(),...y?{streamChunks:y.chunks,streamCadenceMs:y.delaysMs}:{}};await o.save(g,k)},m=g=>g<=0?Promise.resolve():new Promise(f=>{new T().start(g,()=>f())}),w=he(async({messages:g,invokeOpts:f})=>{let y=e.invoke(g,f);return await st(y)},{keyFn:({_precomputedKey:g})=>g});return{provider:e.provider,model:e.model,capabilities:e.capabilities?.bind(e),async invoke(g,f){let y=await u(g,f),k=await d(y);if(k)return{...k,metadata:{...k.metadata??{},replayCache:"hit"}};if(r==="read-strict")throw new E(y,"invoke");let x=await w({messages:g,invokeOpts:f,_precomputedKey:y});return await p(y,x),x},async*stream(g,f){if(!n){for await(let b of e.stream(g,f))yield b;return}let y=await u(g,f),k=await l(y);if(k){let b=k.response;if(k.streamChunks&&k.streamCadenceMs)for(let L=0;L<k.streamChunks.length;L++){let J=k.streamCadenceMs[L]??0,ee=a>0?J/a:0;ee>0&&await m(ee),yield{type:"token",delta:k.streamChunks[L]?.delta??""}}else b.content&&(yield{type:"token",delta:b.content});b.usage&&(yield{type:"usage",usage:b.usage}),yield{type:"finish",reason:b.finishReason??"stop"};return}if(r==="read-strict")throw new E(y,"stream");let x="",_,O,R=[],N=[],v;for await(let b of e.stream(g,f)){if(b.type==="token"&&(x+=b.delta,i)){let L=h(),J=v===void 0?0:(L-v)/1e6;N.push(J),v=L,R.push({delta:b.delta})}b.type==="usage"&&(_=b.usage),b.type==="finish"&&(O=b.reason),yield b}if(x||_){let b={content:x,usage:_??{input:{regular:0},output:{regular:0}},finishReason:O,model:e.model??f?.model??"",provider:e.provider};await p(y,b,i?{chunks:R,delaysMs:N}:void 0)}}}}function z(e){let t=new Set,r=n=>{if(n===null||typeof n!="object")return n;let i=n;if(t.has(i))return{__cycle:!0};t.add(i);try{if(Array.isArray(n))return n.map(r);let a={};for(let s of Object.keys(n).sort())a[s]=r(n[s]);return a}finally{t.delete(i)}};return JSON.stringify(r(e))}async function st(e){if(e!=null&&typeof e.then=="function")return await e;if(e&&typeof e=="object"&&"content"in e)return e;throw new Error("withReplayCache: adapter.invoke must return Promise or LLMResponse (Node input not supported in cache path)")}function ke(e,t){return{content:"[fallback: no cached response available for this request]",usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:t,provider:e,metadata:{degraded:!0,reason:"no-fixture"}}}function we(e,t,r){return typeof e=="string"?{content:e,usage:{input:{regular:0},output:{regular:0}},finishReason:"stop",model:r,provider:t,metadata:{degraded:!0,reason:"respond"}}:e}async function at(e,t){if("key"in e)return e.key;let r=z({messages:e.messages,opts:e.invokeOpts??{}}),n=await j(r);return`${t}:${n}`}function it(e){let t={response:e.response,storedAtNs:I()};if("key"in e&&e.stream){let r=e.stream.chunks.filter(n=>n.type==="token");return{...t,streamChunks:r.map(n=>({delta:n.delta})),streamCadenceMs:e.stream.delaysMs??r.map(()=>0)}}return t}function ct(e,t){let r=[];if(e.fixtures!=null&&r.push("fixtures"),e.fixturesStorage!=null&&r.push("fixturesStorage"),r.length>1)throw new TypeError(`fallbackAdapter: \`fixtures\` and \`fixturesStorage\` are mutually exclusive; got both ${r.join(" and ")}. Pick one source. For filesystem directories use the node subpath's \`fallbackAdapter\`.`);if(e.fixtures){let n=H(),i=e.fixtures,a=(async()=>{for(let s of i){let o=await at(s,t);await n.save(o,it(s))}})();return a.catch(()=>{}),{tier:n,seedReady:a}}return e.fixturesStorage?{tier:e.fixturesStorage,seedReady:Promise.resolve()}:{tier:void 0,seedReady:Promise.resolve()}}function Ae(e={}){let t=e.provider??"fallback",r=e.model??"fallback",n=e.onMiss??"respond",i=e.keyPrefix??"fallback",a=e.record?e.record.adapter:n==="throw"?K({provider:t,model:r,respond:()=>"[unreachable: read-strict mode throws on miss]"}):{provider:t,model:r,async invoke(l,d){let p=e.respond?e.respond(l,d):ke(t,r);return we(p,t,r)},async*stream(l,d){let p=e.respond?e.respond(l,d):ke(t,r),m=we(p,t,r);yield{type:"token",delta:m.content},m.usage&&(yield{type:"usage",usage:m.usage}),yield{type:"finish",reason:m.finishReason??"stop"}}},s,o=Promise.resolve();if(e.record){if(!e.record.storage)throw new TypeError("fallbackAdapter: `record.storage` is required in record mode. For filesystem `record.dir` convenience, use the node subpath's `fallbackAdapter`.");s=e.record.storage}else{let l=ct(e,i);s=l.tier??H(),o=l.seedReady}let c=e.record?"read-write":n==="throw"?"read-strict":"read",u=be(a,{storage:s,mode:c,keyPrefix:i,cacheStreaming:!0,captureStreamCadence:!0,replaySpeed:e.replaySpeed,...e.keyFn?{keyFn:e.keyFn}:{}});return{provider:t,model:r,capabilities:u.capabilities?.bind(u),async invoke(l,d){return await o,u.invoke(l,d)},async*stream(l,d){await o;for await(let p of u.stream(l,d))yield p}}}A();function Te(e={}){return e.sdk?pt(e):ut(e)}function B(e,t){let r=[],n=[];t?.systemPrompt&&r.push(t.systemPrompt);for(let s of e){if(s.role==="system"){r.push(s.content);continue}if(s.role==="tool"){n.push({role:"user",parts:[{functionResponse:{name:s.name??s.toolCallId??"tool",response:{result:s.content}}}]});continue}if(s.role==="assistant"&&s.toolCalls&&s.toolCalls.length>0){let o=[];s.content&&o.push({text:s.content});for(let c of s.toolCalls)o.push({functionCall:{name:c.name,args:c.arguments}});n.push({role:"model",parts:o});continue}n.push({role:s.role==="assistant"?"model":"user",parts:[{text:s.content}]})}let i={contents:n};r.length>0&&(i.systemInstruction={role:"system",parts:[{text:r.join(`
|
|
12
|
+
|
|
13
|
+
`)}]});let a={};return t?.maxTokens!=null&&(a.maxOutputTokens=t.maxTokens),t?.temperature!=null&&(a.temperature=t.temperature),t?.maxReasoningTokens!=null&&(a.thinkingConfig={thinkingBudget:t.maxReasoningTokens}),Object.keys(a).length>0&&(i.generationConfig=a),t?.tools&&t.tools.length>0&&(i.tools=[{functionDeclarations:t.tools.map(lt)}]),t?.providerExtras&&Object.assign(i,t.providerExtras),i}function lt(e){return{name:e.name,description:e.description,parameters:e.parameters}}function X(e){let t={input:{regular:0},output:{regular:0},raw:e};if(!e)return t;let r=e.promptTokenCount??0,n=e.cachedContentTokenCount??0;if(t.input.regular=Math.max(0,r-n),n>0&&(t.input.cacheRead=n),e.toolUsePromptTokenCount&&(t.input.toolUse=e.toolUsePromptTokenCount),e.promptTokensDetails)for(let i of e.promptTokensDetails){let a=i.modality?.toLowerCase();a==="image"?t.input.image=(t.input.image??0)+i.tokenCount:a==="audio"?t.input.audio=(t.input.audio??0)+i.tokenCount:a==="video"&&(t.input.video=(t.input.video??0)+i.tokenCount)}return t.output.regular=e.candidatesTokenCount??0,e.thoughtsTokenCount&&(t.output.reasoning=e.thoughtsTokenCount),t}function _e(e,t){let r=e.candidates?.[0],n=r?.content?.parts??[],i=[],a=[],s=0;for(let o of n)typeof o.text=="string"&&i.push(o.text),o.functionCall&&a.push({id:`${o.functionCall.name}-${s++}`,name:o.functionCall.name,arguments:o.functionCall.args??{}});return{content:i.join(""),toolCalls:a.length>0?a:void 0,usage:X(e.usageMetadata),finishReason:r?.finishReason,latencyMs:t,model:e.modelVersion,provider:"google"}}function dt(e){if(e.apiKey)return e.apiKey;let t=globalThis.process?.env;return t?.GOOGLE_API_KEY??t?.GEMINI_API_KEY}function ut(e){let t=e.baseURL??"https://generativelanguage.googleapis.com/v1beta",r=e.fetchImpl??fetch,n=a=>{let s=a?.model??e.model;if(!s)throw new Error("googleAdapter: model must be set via options.model or invokeOpts.model");return s},i=()=>{let a=dt(e);if(!a)throw new Error("googleAdapter: apiKey required for invoke/stream");return`key=${encodeURIComponent(a)}`};return{provider:"google",model:e.model,async invoke(a,s){let o=n(s),c=B(a,s),u=h(),l=`${t}/models/${encodeURIComponent(o)}:generateContent?${i()}`,d=await r(l,{method:"POST",headers:{"content-type":"application/json",...e.headers??{}},body:JSON.stringify(c),signal:s?.signal});if(!d.ok)throw await Re(d);let p=await d.json(),m=Math.max(0,(h()-u)/1e6);return _e(p,m)},async*stream(a,s){let o=n(s),c=B(a,s),u=`${t}/models/${encodeURIComponent(o)}:streamGenerateContent?alt=sse&${i()}`,l=await r(u,{method:"POST",headers:{"content-type":"application/json",accept:"text/event-stream",...e.headers??{}},body:JSON.stringify(c),signal:s?.signal});if(!l.ok)throw await Re(l);if(!l.body)throw new Error("googleAdapter: streaming response has no body");let d,p;for await(let m of ft(l.body)){if(!m.data)continue;let w;try{w=JSON.parse(m.data)}catch{continue}let g=w.candidates?.[0];for(let f of g?.content?.parts??[])typeof f.text=="string"&&(f.thought?yield{type:"thinking",delta:f.text}:yield{type:"token",delta:f.text}),f.functionCall&&(yield{type:"tool-call-delta",delta:{name:f.functionCall.name,argumentsDelta:JSON.stringify(f.functionCall.args??{})}});g?.finishReason&&(p=g.finishReason),w.usageMetadata&&(d=w.usageMetadata)}d&&(yield{type:"usage",usage:X(d)}),yield{type:"finish",reason:p??"stop"}}}}function pt(e){let t=e.sdk;if(!t)throw new Error("sdkBackedGoogle: sdk instance required");return{provider:"google",model:e.model,async invoke(r,n){let i=B(r,n),a=n?.model??e.model;if(!a)throw new Error("googleAdapter: model required");let s=h(),o=await t.models.generateContent({...i,model:a},{signal:n?.signal}),c=Math.max(0,(h()-s)/1e6);return _e(o,c)},async*stream(r,n){if(!t.models.generateContentStream)throw new Error("sdkBackedGoogle: SDK instance does not expose generateContentStream");let i=B(r,n),a=n?.model??e.model;if(!a)throw new Error("googleAdapter: model required");let s,o;for await(let c of t.models.generateContentStream({...i,model:a},{signal:n?.signal})){let u=c.candidates?.[0];for(let l of u?.content?.parts??[])typeof l.text=="string"&&(l.thought?yield{type:"thinking",delta:l.text}:yield{type:"token",delta:l.text}),l.functionCall&&(yield{type:"tool-call-delta",delta:{name:l.functionCall.name,argumentsDelta:JSON.stringify(l.functionCall.args??{})}});u?.finishReason&&(o=u.finishReason),c.usageMetadata&&(s=c.usageMetadata)}s&&(yield{type:"usage",usage:X(s)}),yield{type:"finish",reason:o??"stop"}}}}async function*ft(e){let t=e.getReader(),r=new TextDecoder,n="";try{for(;;){let{done:i,value:a}=await t.read();if(i){n.length>0&&(yield xe(n));return}n+=r.decode(a,{stream:!0});let s=Le(n);for(;s!==null;){let o=n.slice(0,s.index);n=n.slice(s.index+s.length);let c=xe(o);(c.data||c.event)&&(yield c),s=Le(n)}}}finally{t.releaseLock()}}function xe(e){let t={},r=[];for(let n of e.split(`
|
|
14
|
+
`)){let i=n.endsWith("\r")?n.slice(0,-1):n;if(!i||i.startsWith(":"))continue;let a=i.indexOf(":"),s=a===-1?i:i.slice(0,a),o=a===-1?"":i.slice(a+1).replace(/^ /,"");s==="data"?r.push(o):s==="event"?t.event=o:s==="id"&&(t.id=o)}return r.length>0&&(t.data=r.join(`
|
|
15
|
+
`)),t}function Le(e){let t=e.indexOf(`\r
|
|
16
|
+
\r
|
|
17
|
+
`),r=e.indexOf(`
|
|
18
|
+
|
|
19
|
+
`),n=null;return t!==-1&&(n={index:t,length:4}),r!==-1&&(n===null||r<n.index)&&(n={index:r,length:2}),n}async function Re(e){let t;try{t=await e.text()}catch{t=""}let r=new Error(`Google API ${e.status}: ${e.statusText}${t?` \u2014 ${t}`:""}`);return r.status=e.status,r.headers=e.headers,r}A();var mt={openai:{baseURL:"https://api.openai.com/v1",apiKeyEnv:"OPENAI_API_KEY",provider:"openai"},openrouter:{baseURL:"https://openrouter.ai/api/v1",apiKeyEnv:"OPENROUTER_API_KEY",provider:"openrouter"},groq:{baseURL:"https://api.groq.com/openai/v1",apiKeyEnv:"GROQ_API_KEY",provider:"groq"},ollama:{baseURL:"http://localhost:11434/v1",provider:"ollama"},deepseek:{baseURL:"https://api.deepseek.com/v1",apiKeyEnv:"DEEPSEEK_API_KEY",provider:"deepseek"},xai:{baseURL:"https://api.x.ai/v1",apiKeyEnv:"XAI_API_KEY",provider:"xai"}};function Se(e={}){return e.sdk?kt(e):bt(e)}function G(e,t,r,n,i){let a=t?.model??r;if(!a)throw new Error("openAICompatAdapter: model must be set via options.model or invokeOpts.model");let s=e.map(gt);t?.systemPrompt&&!e.some(c=>c.role==="system")&&s.unshift({role:"system",content:t.systemPrompt});let o={model:a,messages:s};return t?.maxTokens!=null&&(o.max_tokens=t.maxTokens),t?.temperature!=null&&(o.temperature=t.temperature),t?.tools&&t.tools.length>0&&(o.tools=t.tools.map(yt)),t?.maxReasoningTokens!=null&&(o.reasoning={max_tokens:t.maxReasoningTokens}),n&&(o.stream=!0,o.stream_options={include_usage:!0}),i&&Object.assign(o,i),t?.providerExtras&&Object.assign(o,t.providerExtras),o}function gt(e){return e.role==="tool"?{role:"tool",tool_call_id:e.toolCallId,content:e.content}:e.role==="assistant"&&e.toolCalls&&e.toolCalls.length>0?{role:"assistant",content:e.content||null,tool_calls:e.toolCalls.map(t=>({id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.arguments)}}))}:{role:e.role,content:e.content}}function yt(e){return{type:"function",function:{name:e.name,description:e.description,parameters:e.parameters}}}function Q(e){let t={input:{regular:0},output:{regular:0},raw:e};if(!e)return t;let r=e.prompt_tokens??0,n=e.prompt_tokens_details?.cached_tokens??0;e.prompt_cache_hit_tokens!=null?(n=e.prompt_cache_hit_tokens,t.input.regular=e.prompt_cache_miss_tokens??Math.max(0,r-n)):t.input.regular=Math.max(0,r-n),n>0&&(t.input.cacheRead=n),e.prompt_tokens_details?.audio_tokens&&(t.input.audio=e.prompt_tokens_details.audio_tokens);let i=e.completion_tokens??0,a=e.completion_tokens_details?.reasoning_tokens??0;return t.output.regular=Math.max(0,i-a),a>0&&(t.output.reasoning=a),e.completion_tokens_details?.audio_tokens&&(t.output.audio=e.completion_tokens_details.audio_tokens),e.completion_tokens_details?.accepted_prediction_tokens&&(t.output.predictionAccepted=e.completion_tokens_details.accepted_prediction_tokens),e.completion_tokens_details?.rejected_prediction_tokens&&(t.output.predictionRejected=e.completion_tokens_details.rejected_prediction_tokens),t}function Ee(e,t,r){let n=e.choices[0],i=n?.message,a=i?.content??"",s=(i?.tool_calls??[]).map(o=>({id:o.id,name:o.function.name,arguments:ht(o.function.arguments)}));return{content:a,toolCalls:s.length>0?s:void 0,usage:Q(e.usage),finishReason:n?.finish_reason,latencyMs:t,model:e.model,provider:r}}function ht(e){try{let t=JSON.parse(e);return typeof t=="object"&&t!=null?t:{_raw:e}}catch{return{_raw:e}}}function Oe(e){let t=e.preset??"openai",r=mt[t],n=e.baseURL??r.baseURL,i=e.provider??r.provider,a=r.apiKeyEnv,s=e.apiKey??(a?globalThis.process?.env?.[a]:void 0);return{provider:i,baseURL:n,apiKey:s}}function bt(e){let{provider:t,baseURL:r,apiKey:n}=Oe(e),i=e.fetchImpl??fetch,a=t!=="ollama",s=()=>{let o={"content-type":"application/json",...e.headers??{}};if(a){if(!n)throw new Error(`openAICompatAdapter[${t}]: apiKey required for invoke/stream`);o.authorization=`Bearer ${n}`}return o};return{provider:t,model:e.model,async invoke(o,c){let u=G(o,c,e.model,!1,e.bodyExtras),l=h(),d=await i(`${r}/chat/completions`,{method:"POST",headers:s(),body:JSON.stringify(u),signal:c?.signal});if(!d.ok)throw await Ce(d,t);let p=await d.json(),m=Math.max(0,(h()-l)/1e6);return Ee(p,m,t)},async*stream(o,c){let u=G(o,c,e.model,!0,e.bodyExtras),l=await i(`${r}/chat/completions`,{method:"POST",headers:{...s(),accept:"text/event-stream"},body:JSON.stringify(u),signal:c?.signal});if(!l.ok)throw await Ce(l,t);if(!l.body)throw new Error(`openAICompatAdapter[${t}]: streaming response has no body`);let d,p;for await(let m of wt(l.body)){if(!m.data||m.data==="[DONE]")continue;let w;try{w=JSON.parse(m.data)}catch{continue}let g=w.choices;if(g){let f=g[0];if(f?.delta?.content&&(yield{type:"token",delta:f.delta.content}),f?.delta?.reasoning_content&&(yield{type:"thinking",delta:f.delta.reasoning_content}),f?.delta?.tool_calls)for(let y of f.delta.tool_calls)yield{type:"tool-call-delta",delta:{id:y.id,name:y.function?.name,argumentsDelta:y.function?.arguments}};f?.finish_reason&&(p=f.finish_reason)}w.usage&&(d=w.usage,yield{type:"usage",usage:Q(d)})}yield{type:"finish",reason:p??"stop"}}}}function kt(e){let t=e.sdk;if(!t)throw new Error("sdkBackedOpenAI: sdk instance required");let{provider:r}=Oe(e);return{provider:r,model:e.model,async invoke(n,i){let a=G(n,i,e.model,!1,e.bodyExtras),s=h(),o=await t.chat.completions.create(a,{signal:i?.signal}),c=Math.max(0,(h()-s)/1e6);return Ee(o,c,r)},async*stream(n,i){let a=G(n,i,e.model,!0,e.bodyExtras),s=await t.chat.completions.create(a,{signal:i?.signal}),o,c;for await(let u of s){let l=u.choices;if(l){let p=l[0];if(p?.delta?.content&&(yield{type:"token",delta:p.delta.content}),p?.delta?.reasoning_content&&(yield{type:"thinking",delta:p.delta.reasoning_content}),p?.delta?.tool_calls)for(let m of p.delta.tool_calls)yield{type:"tool-call-delta",delta:{id:m.id,name:m.function?.name,argumentsDelta:m.function?.arguments}};p?.finish_reason&&(c=p.finish_reason)}let d=u.usage;d&&(o=d,yield{type:"usage",usage:Q(d)})}yield{type:"finish",reason:c??"stop"}}}}async function*wt(e){let t=e.getReader(),r=new TextDecoder,n="";try{for(;;){let{done:i,value:a}=await t.read();if(i){n.length>0&&(yield ve(n));return}n+=r.decode(a,{stream:!0});let s=Me(n);for(;s!==null;){let o=n.slice(0,s.index);n=n.slice(s.index+s.length);let c=ve(o);(c.data||c.event)&&(yield c),s=Me(n)}}}finally{t.releaseLock()}}function ve(e){let t={},r=[];for(let n of e.split(`
|
|
20
|
+
`)){let i=n.endsWith("\r")?n.slice(0,-1):n;if(!i||i.startsWith(":"))continue;let a=i.indexOf(":"),s=a===-1?i:i.slice(0,a),o=a===-1?"":i.slice(a+1).replace(/^ /,"");s==="data"?r.push(o):s==="event"?t.event=o:s==="id"&&(t.id=o)}return r.length>0&&(t.data=r.join(`
|
|
21
|
+
`)),t}function Me(e){let t=e.indexOf(`\r
|
|
22
|
+
\r
|
|
23
|
+
`),r=e.indexOf(`
|
|
24
|
+
|
|
25
|
+
`),n=null;return t!==-1&&(n={index:t,length:4}),r!==-1&&(n===null||r<n.index)&&(n={index:r,length:2}),n}async function Ce(e,t){let r;try{r=await e.text()}catch{r=""}let n=new Error(`${t} API ${e.status}: ${e.statusText}${r?` \u2014 ${r}`:""}`);return n.status=e.status,n.headers=e.headers,n}function Z(e){switch(e.provider){case"anthropic":{let t={apiKey:e.apiKey,model:e.model,baseURL:e.baseURL,headers:e.headers,sdk:e.sdk,fetchImpl:e.fetchImpl,...e.extras};return ae(t)}case"google":{let t={apiKey:e.apiKey,model:e.model,baseURL:e.baseURL,headers:e.headers,sdk:e.sdk,fetchImpl:e.fetchImpl,...e.extras};return Te(t)}case"dry-run":{let t={model:e.model,...e.extras};return K(t)}case"fallback":{let t={provider:e.provider,model:e.model,...e.extras};return Ae(t)}case"openai":case"openrouter":case"groq":case"ollama":case"deepseek":case"xai":{let t={preset:e.provider,apiKey:e.apiKey,model:e.model,baseURL:e.baseURL,headers:e.headers,bodyExtras:e.bodyExtras,sdk:e.sdk,fetchImpl:e.fetchImpl,...e.extras};return Se(t)}default:{let t=e.provider;throw new Error(`createAdapter: unknown provider: ${String(t)}`)}}}Pe();var $=class extends Error{name="AllTiersExhaustedError";skipped;failed;constructor(t){let r=[];t.failed.size>0&&r.push(`failed=[${[...t.failed.keys()].join(",")}]`),t.skipped.length>0&&r.push(`skipped=[${t.skipped.map(n=>`${n.name}(${n.reason})`).join(",")}]`),super(`All LLM adapter tiers exhausted: ${r.join(" ")}`),this.skipped=t.skipped,this.failed=t.failed}};function W(e,t={}){if(e.length===0)throw new RangeError("cascadingLlmAdapter: tiers must be non-empty");let r=e.map(i=>({name:i.name,adapter:i.adapter,filter:i.filter,breaker:i.breaker?"canExecute"in i.breaker?i.breaker:Ne(i.breaker):void 0})),n=t.streamRetryBeforeFirstChunk??!0;return{provider:"cascading",model:void 0,async invoke(i,a){let s=[],o=new Map;for(let u=0;u<r.length;u++){let l=r[u];if(l.filter&&!l.filter(i,a)){s.push({name:l.name,reason:"filter"});continue}if(l.breaker&&!l.breaker.canExecute()){s.push({name:l.name,reason:"breaker"});continue}try{let d=await Promise.resolve(l.adapter.invoke(i,a));return l.breaker?.recordSuccess(),{...d,metadata:{...d.metadata??{},tier:l.name}}}catch(d){o.set(l.name,d),l.breaker?.recordFailure(d);let p=r[u+1];p&&t.onFallback?.(l.name,p.name,d)}}let c={skipped:s,failed:o};throw t.onExhausted?.(c),new $(c)},async*stream(i,a){let s=[],o=new Map;for(let u=0;u<r.length;u++){let l=r[u];if(l.filter&&!l.filter(i,a)){s.push({name:l.name,reason:"filter"});continue}if(l.breaker&&!l.breaker.canExecute()){s.push({name:l.name,reason:"breaker"});continue}let d=!1;try{for await(let p of l.adapter.stream(i,a))d=!0,yield p;l.breaker?.recordSuccess();return}catch(p){if(o.set(l.name,p),l.breaker?.recordFailure(p),d||!n)throw p;let m=r[u+1];m&&t.onFallback?.(l.name,m.name,p)}}let c={skipped:s,failed:o};throw t.onExhausted?.(c),new $(c)}}}function xt(e){let t=[{name:"cloud",adapter:Z(e.cloud)}];return e.webllmModel&&t.push({name:"webllm",adapter:S({model:e.webllmModel})}),e.chromeNano!==!1&&t.push({name:"chrome-nano",adapter:C(),filter:(r,n)=>!n?.tools||n.tools.length===0}),W(t,e.cascade)}function Lt(e){let t=[{name:"ollama",adapter:Z({provider:"ollama",model:e.ollamaModel,baseURL:e.ollamaBaseURL})}];return e.webllmModel&&t.push({name:"webllm",adapter:S({model:e.webllmModel})}),e.chromeNano!==!1&&t.push({name:"chrome-nano",adapter:C(),filter:(r,n)=>!n?.tools||n.tools.length===0}),W(t,e.cascade)}function Rt(e){let t=[{name:"webllm",adapter:S({model:e.webllmModel})}];return e.chromeNano!==!1&&t.push({name:"chrome-nano",adapter:C(),filter:(r,n)=>!n?.tools||n.tools.length===0}),W(t,e.cascade)}0&&(module.exports={chromeNanoAdapter,cloudFirstPreset,localFirstPreset,offlinePreset,webllmAdapter});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { L as LLMAdapter } from '../../types-O3GzJY2U.cjs';
|
|
2
|
+
import { c as createAdapter, C as CascadingLlmAdapterOptions } from '../../cascading-CcAgRacD.cjs';
|
|
3
|
+
import '../../extra/sources.cjs';
|
|
4
|
+
import '../../node-Dd6wHSib.cjs';
|
|
5
|
+
import '../../resilience-uBz4yvYB.cjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ChromeNanoAdapter — Chrome Built-in AI Prompt API.
|
|
9
|
+
*
|
|
10
|
+
* Uses `navigator.ai.languageModel` (Chrome 131+, origin trial / flag gated).
|
|
11
|
+
* Zero download, instant startup — but limited capability (no tool use on
|
|
12
|
+
* most versions, no rich system prompts on some).
|
|
13
|
+
*
|
|
14
|
+
* **Stream mode:** Chrome AI has historically switched between emitting
|
|
15
|
+
* accumulated (each chunk is the full text so far) and delta (each chunk is
|
|
16
|
+
* only the new tokens) streams across versions. Default `streamMode: "accumulated"`
|
|
17
|
+
* matches current behavior; pass `"delta"` if you've verified your browser
|
|
18
|
+
* emits pure deltas.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface ChromeNanoAdapterOptions {
|
|
22
|
+
/** Override the navigator object (for tests). */
|
|
23
|
+
navigatorOverride?: Navigator;
|
|
24
|
+
/** Initial system prompt for the session (Chrome AI supports it in 131+). */
|
|
25
|
+
systemPrompt?: string;
|
|
26
|
+
/** Temperature (0..1). */
|
|
27
|
+
temperature?: number;
|
|
28
|
+
/** Top-K sampling (Chrome AI only). */
|
|
29
|
+
topK?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Stream chunk shape. `"accumulated"` (default) — each chunk contains the
|
|
32
|
+
* full cumulative text; adapter computes deltas by string diffing.
|
|
33
|
+
* `"delta"` — each chunk already contains only the new tokens; adapter
|
|
34
|
+
* forwards directly.
|
|
35
|
+
*/
|
|
36
|
+
streamMode?: "accumulated" | "delta";
|
|
37
|
+
}
|
|
38
|
+
declare function chromeNanoAdapter(opts?: ChromeNanoAdapterOptions): LLMAdapter;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* WebLLMAdapter — browser-only, WebGPU-based inference via `@mlc-ai/web-llm`.
|
|
42
|
+
*
|
|
43
|
+
* Dynamic import + WebGPU feature detection. No server dependency. Typical
|
|
44
|
+
* use: fallback tier in `cascadingLlmAdapter` after a BYOK cloud adapter.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface WebLLMAdapterOptions {
|
|
48
|
+
model: string;
|
|
49
|
+
/**
|
|
50
|
+
* User-provided engine instance (from `CreateMLCEngine(...)`). If omitted,
|
|
51
|
+
* the adapter lazy-creates one on first call via dynamic import.
|
|
52
|
+
*/
|
|
53
|
+
engine?: WebLLMEngineLike;
|
|
54
|
+
/** Pass-through to `CreateMLCEngine`. */
|
|
55
|
+
initProgressCallback?: (progress: unknown) => void;
|
|
56
|
+
/** Navigator override (for tests). */
|
|
57
|
+
navigatorOverride?: Navigator;
|
|
58
|
+
}
|
|
59
|
+
interface WebLLMEngineLike {
|
|
60
|
+
chat: {
|
|
61
|
+
completions: {
|
|
62
|
+
create(params: Record<string, unknown>, opts?: {
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
}): Promise<{
|
|
65
|
+
choices: ReadonlyArray<{
|
|
66
|
+
message?: {
|
|
67
|
+
content?: string;
|
|
68
|
+
};
|
|
69
|
+
finish_reason?: string;
|
|
70
|
+
}>;
|
|
71
|
+
usage?: {
|
|
72
|
+
prompt_tokens?: number;
|
|
73
|
+
completion_tokens?: number;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
declare function webllmAdapter(opts: WebLLMAdapterOptions): LLMAdapter;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Curated `cascadingLlmAdapter` presets that depend on browser-only adapters
|
|
83
|
+
* (`webllmAdapter`, `chromeNanoAdapter`).
|
|
84
|
+
*
|
|
85
|
+
* Split out from `routing/presets.ts` so that importing `patterns/ai` in a
|
|
86
|
+
* Node bundle doesn't transitively pull in `@mlc-ai/web-llm` / Chrome Nano
|
|
87
|
+
* dynamic imports, and so browser-only consumers can opt in cleanly via
|
|
88
|
+
* the `@graphrefly/graphrefly/patterns/ai/browser` subpath.
|
|
89
|
+
*
|
|
90
|
+
* @module
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
interface CloudFirstPresetOptions {
|
|
94
|
+
/** BYOK config — passed directly to `createAdapter`. */
|
|
95
|
+
cloud: Parameters<typeof createAdapter>[0];
|
|
96
|
+
/** WebLLM model name. Pass `null` to skip the WebLLM tier. */
|
|
97
|
+
webllmModel?: string | null;
|
|
98
|
+
/** Pass `null` to skip the Chrome Nano tier. */
|
|
99
|
+
chromeNano?: boolean;
|
|
100
|
+
/** Cascade options. */
|
|
101
|
+
cascade?: CascadingLlmAdapterOptions;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Cloud-first with local fallback: BYOK → WebLLM → Chrome Nano.
|
|
105
|
+
*/
|
|
106
|
+
declare function cloudFirstPreset(opts: CloudFirstPresetOptions): LLMAdapter;
|
|
107
|
+
interface LocalFirstPresetOptions {
|
|
108
|
+
/** Ollama model. */
|
|
109
|
+
ollamaModel: string;
|
|
110
|
+
/** Ollama base URL. Default http://localhost:11434/v1. */
|
|
111
|
+
ollamaBaseURL?: string;
|
|
112
|
+
webllmModel?: string | null;
|
|
113
|
+
chromeNano?: boolean;
|
|
114
|
+
cascade?: CascadingLlmAdapterOptions;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Local-first: nothing leaves the machine. Ollama → WebLLM → Chrome Nano.
|
|
118
|
+
*/
|
|
119
|
+
declare function localFirstPreset(opts: LocalFirstPresetOptions): LLMAdapter;
|
|
120
|
+
interface OfflinePresetOptions {
|
|
121
|
+
webllmModel: string;
|
|
122
|
+
chromeNano?: boolean;
|
|
123
|
+
cascade?: CascadingLlmAdapterOptions;
|
|
124
|
+
}
|
|
125
|
+
declare function offlinePreset(opts: OfflinePresetOptions): LLMAdapter;
|
|
126
|
+
|
|
127
|
+
export { type ChromeNanoAdapterOptions, type CloudFirstPresetOptions, type LocalFirstPresetOptions, type OfflinePresetOptions, type WebLLMAdapterOptions, type WebLLMEngineLike, chromeNanoAdapter, cloudFirstPreset, localFirstPreset, offlinePreset, webllmAdapter };
|