@graphrefly/graphrefly 0.41.0 → 0.43.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/{cascading-Cxs1eztH.d.cts → cascading-CH-_VwG9.d.cts} +2 -2
- package/dist/{cascading-BNfxffgc.d.ts → cascading-OgKQZjsa.d.ts} +2 -2
- package/dist/chunk-3XDYJRYU.js +1 -0
- package/dist/{chunk-AI7QC7J6.js → chunk-4YAN45KM.js} +1 -1
- package/dist/chunk-626TESAC.js +3 -0
- package/dist/chunk-6HOSXQKF.js +1 -0
- package/dist/{chunk-G3M3IMEV.js → chunk-CUNIRONA.js} +1 -1
- package/dist/chunk-EBW4V6JN.js +1 -0
- package/dist/chunk-FDQGFWLF.js +1 -0
- package/dist/{chunk-33N4TU3X.js → chunk-FG4TKHMC.js} +1 -1
- package/dist/{chunk-YQRN4CIV.js → chunk-I7IGYPSL.js} +1 -1
- package/dist/chunk-INQD2KRQ.js +1 -0
- package/dist/{chunk-7PQLZMOG.js → chunk-JNWRYDJN.js} +1 -1
- package/dist/{chunk-TT4C7DXW.js → chunk-JQFH2DV6.js} +1 -1
- package/dist/{chunk-M3FQSXEW.js → chunk-K2Q24F5T.js} +1 -1
- package/dist/chunk-KVV66NN2.js +1 -0
- package/dist/chunk-NON4NLIC.js +45 -0
- package/dist/{chunk-CYOSWFT2.js → chunk-O2BLLH7M.js} +3 -3
- package/dist/{chunk-OV5AA6HJ.js → chunk-OCKEEPRJ.js} +1 -1
- package/dist/{chunk-X7QKTXXC.js → chunk-OFZG3TB3.js} +3 -3
- package/dist/chunk-OYJKFY7V.js +1 -0
- package/dist/{chunk-SC27WTSG.js → chunk-P6C4WHZO.js} +1 -1
- package/dist/{chunk-VV62MIG4.js → chunk-PT7W5FCD.js} +1 -1
- package/dist/{chunk-UISPDFJ3.js → chunk-Q4U3A3L5.js} +1 -1
- package/dist/chunk-QE4IGY7I.js +61 -0
- package/dist/{chunk-5VEZLQFN.js → chunk-QYVXF7GW.js} +1 -1
- package/dist/{chunk-ZAJ7J7TO.js → chunk-S3EEIPO7.js} +1 -1
- package/dist/{chunk-GI4Q7PNY.js → chunk-SUWT3ZON.js} +1 -1
- package/dist/{chunk-CGNOWGV6.js → chunk-TPKQW72B.js} +1 -1
- package/dist/{chunk-L77I47VU.js → chunk-V5A7M7RJ.js} +1 -1
- package/dist/chunk-VNC3TMVY.js +1 -0
- package/dist/{chunk-AK5RHMC5.js → chunk-VOPGGIL7.js} +1 -1
- package/dist/chunk-VQ4A6T2A.js +1 -0
- package/dist/{chunk-KNVCCBIU.js → chunk-XG62INFA.js} +1 -1
- package/dist/{chunk-F7VUYPP6.js → chunk-Y4NI3X7O.js} +1 -1
- package/dist/compat/index.cjs +5 -5
- package/dist/compat/index.d.cts +16 -16
- package/dist/compat/index.d.ts +16 -16
- package/dist/compat/index.js +1 -1
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nestjs/index.cjs +5 -5
- package/dist/compat/nestjs/index.d.cts +8 -8
- package/dist/compat/nestjs/index.d.ts +8 -8
- package/dist/compat/nestjs/index.js +1 -1
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/zustand/index.cjs +3 -3
- package/dist/compat/zustand/index.d.cts +4 -4
- package/dist/compat/zustand/index.d.ts +4 -4
- package/dist/compat/zustand/index.js +1 -1
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/{decay-C25AyNAj.d.cts → decay-2ZukgQ4o.d.cts} +2 -2
- package/dist/{decay-BnrlbxSv.d.ts → decay-CdEBmDIs.d.ts} +2 -2
- package/dist/extra/browser.d.cts +1 -1
- package/dist/extra/browser.d.ts +1 -1
- package/dist/extra/index.cjs +14 -14
- package/dist/extra/index.d.cts +10 -11
- package/dist/extra/index.d.ts +10 -11
- package/dist/extra/index.js +1 -1
- package/dist/extra/node.cjs +2 -2
- package/dist/extra/node.d.cts +1 -1
- package/dist/extra/node.d.ts +1 -1
- package/dist/extra/node.js +1 -1
- package/dist/extra/operators.cjs +1 -1
- package/dist/extra/operators.d.cts +1 -1
- package/dist/extra/operators.d.ts +1 -1
- package/dist/extra/operators.js +1 -1
- package/dist/extra/reactive.d.cts +3 -3
- package/dist/extra/reactive.d.ts +3 -3
- package/dist/extra/reactive.js +1 -1
- package/dist/extra/render/index.d.cts +3 -3
- package/dist/extra/render/index.d.ts +3 -3
- package/dist/extra/sources.cjs +3 -1
- package/dist/extra/sources.d.cts +1 -1
- package/dist/extra/sources.d.ts +1 -1
- package/dist/extra/sources.js +1 -1
- package/dist/extra/storage-browser.d.cts +1 -1
- package/dist/extra/storage-browser.d.ts +1 -1
- package/dist/{fallback-CMZl39L5.d.ts → fallback-CqYVLL6X.d.ts} +1 -1
- package/dist/{fallback-8JYU8tlT.d.cts → fallback-Ctlj2tMY.d.cts} +1 -1
- package/dist/graph/index.cjs +7 -7
- package/dist/graph/index.d.cts +5 -5
- package/dist/graph/index.d.ts +5 -5
- package/dist/graph/index.js +1 -1
- package/dist/{graph-BkIkog4h.d.ts → graph-7VguS7a4.d.ts} +3 -3
- package/dist/{graph-E6likq7w.d.cts → graph-C4SHb3Ly.d.cts} +3 -3
- package/dist/{index-DgJc8Zgc.d.cts → index-0rKFCVFp.d.cts} +90 -5
- package/dist/{index-BAQrjuZF.d.ts → index-B-i4_g3k.d.ts} +2 -2
- package/dist/{index-DpiGqtrs.d.cts → index-B5iz82A3.d.cts} +441 -381
- package/dist/{index-Bd91Nmf4.d.cts → index-BAOD98JD.d.cts} +4 -4
- package/dist/{index-2n8Eai6M.d.ts → index-BG0BN3PB.d.ts} +1 -1
- package/dist/{index-z8WFPVI8.d.cts → index-BJX94aud.d.cts} +1 -1
- package/dist/{index-DhLyOHYZ.d.ts → index-BP8a88zx.d.ts} +11 -4
- package/dist/{index-Cnr1WrlX.d.cts → index-BTQtTb_H.d.cts} +14 -3
- package/dist/{index-DOBLxOti.d.cts → index-BVpm6noz.d.cts} +1 -1
- package/dist/{index-Cczxgd2D.d.ts → index-Bc41FuHp.d.cts} +3 -3
- package/dist/{index-BiHUBEKq.d.cts → index-BdGtBX-X.d.cts} +3 -3
- package/dist/{index-da2V5vPy.d.ts → index-Bf7eqeSF.d.ts} +2 -2
- package/dist/{index-DuRsN9ae.d.cts → index-BiX1Nkgx.d.cts} +383 -18
- package/dist/{index-DGTo1yka.d.cts → index-BoLv_OfD.d.cts} +2 -2
- package/dist/{index-DVAlsmEU.d.cts → index-BojK2fwH.d.cts} +3 -3
- package/dist/{index-B72TQQHd.d.cts → index-BsT7F2et.d.ts} +3 -3
- package/dist/{index-DGD4_fj6.d.cts → index-BwLvVVsy.d.cts} +8 -5
- package/dist/{index-CQtWm7jS.d.ts → index-C59mYFKp.d.ts} +9 -9
- package/dist/{index-C6ZUaos7.d.ts → index-C7O6r5fV.d.ts} +1 -1
- package/dist/{index-CL7oilfm.d.cts → index-C9kSENB4.d.cts} +1 -1
- package/dist/{index-DVDapw2k.d.cts → index-C9pjcz3l.d.cts} +35 -36
- package/dist/{index-CG33HeBW.d.ts → index-CAC_rNzm.d.ts} +8 -5
- package/dist/{index-yLt-aPMp.d.ts → index-CCq87F7t.d.ts} +1 -1
- package/dist/{index-D4uimgee.d.cts → index-CDXc9zKM.d.cts} +1 -1
- package/dist/{index-B2RUoIUz.d.ts → index-CJK1JkYy.d.ts} +1 -1
- package/dist/{index-DktLSZOc.d.cts → index-CLon-IWF.d.cts} +4 -4
- package/dist/{index-DQQCOIt8.d.cts → index-COD1kVoS.d.cts} +10 -5
- package/dist/{index-bXXLSvor.d.ts → index-CPT7C_f1.d.ts} +4 -4
- package/dist/{index-CD2dBMet.d.ts → index-CQG3D1cp.d.ts} +10 -5
- package/dist/{index-BQ1fR4li.d.ts → index-CZQXo5tH.d.ts} +35 -36
- package/dist/{index-A3U3CSve.d.cts → index-CZjOhcBy.d.cts} +2 -2
- package/dist/{index-DYTBbF8T.d.cts → index-ChOyVLKm.d.cts} +1 -1
- package/dist/{index-BJSZxSFX.d.ts → index-CvrqGfNS.d.ts} +1 -1
- package/dist/{index-DhnsQfa3.d.ts → index-D-AEQVLo.d.ts} +441 -381
- package/dist/{index-CAP3UGsq.d.ts → index-D4Y1cMG0.d.ts} +1 -1
- package/dist/{index-40ZT4MHj.d.ts → index-DBHK8O6H.d.ts} +14 -3
- package/dist/{index-3k4Gg6-n.d.ts → index-DBevwHj_.d.ts} +3 -3
- package/dist/{index-Ctb7_2sG.d.ts → index-DIOoAZUX.d.ts} +1 -1
- package/dist/{index-WSlcjhQF.d.ts → index-DSZ3ZCHF.d.ts} +124 -13
- package/dist/{index-DH4fm2Ck.d.ts → index-Dgs8zcj7.d.ts} +2 -2
- package/dist/{index-BaA-xpSw.d.ts → index-Dh_HJ82K.d.ts} +3 -3
- package/dist/{index-CtFNGe-m.d.cts → index-Dhc7a7Xo.d.cts} +2 -2
- package/dist/{index-CoM4rzyB.d.ts → index-Dmqp7KjD.d.ts} +1 -1
- package/dist/{index-B6iTqKtJ.d.ts → index-Dn-wI9g4.d.ts} +2 -2
- package/dist/{index-C-dkXOpB.d.cts → index-Du7u1lSf.d.cts} +11 -4
- package/dist/{index-DfOK_oL5.d.ts → index-DwigL4lY.d.ts} +383 -18
- package/dist/index-DyR7eU5S.d.cts +779 -0
- package/dist/index-JZUPJIJy.d.ts +779 -0
- package/dist/{index-I1cCY3ZI.d.ts → index-K0_0eR8g.d.ts} +90 -5
- package/dist/{index-BilOa6AE.d.cts → index-O16yXPK4.d.cts} +124 -13
- package/dist/{index-CRm0YIzC.d.cts → index-O7fucFrU.d.cts} +9 -9
- package/dist/{index-MxYuWOrf.d.cts → index-RV_yDjOX.d.cts} +3 -3
- package/dist/{index-C5cQ7Gfx.d.ts → index-cm1GNcWE.d.ts} +4 -4
- package/dist/{index-CgnCFhr2.d.cts → index-f5IivDUX.d.cts} +1 -1
- package/dist/{index-PgwvGWa1.d.cts → index-hHcaFlJX.d.cts} +1 -1
- package/dist/{index-tV3AA9hI.d.cts → index-tJoTcnHh.d.cts} +2 -2
- package/dist/{index-eaQuGJnv.d.ts → index-wAzD9yVj.d.ts} +3 -3
- package/dist/{index-D3ayz3hy.d.cts → index-z96luz5O.d.cts} +1 -1
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +45 -50
- package/dist/index.d.ts +45 -50
- package/dist/index.js +1 -1
- package/dist/{meta-D8OyedKp.d.ts → meta-BgVAsg9j.d.ts} +1 -1
- package/dist/{meta-Ct9nqQS5.d.cts → meta-vE8bxW1E.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.cts → node-ClS5yC-B.d.cts} +1 -1
- package/dist/{node-BYInONRr.d.ts → node-ClS5yC-B.d.ts} +1 -1
- package/dist/{observable-DO8DDEzv.d.ts → observable-BsBzUrcI.d.ts} +1 -1
- package/dist/{observable-DMIlYJV1.d.cts → observable-DLGPPtb8.d.cts} +1 -1
- package/dist/patterns/ai/browser.d.cts +4 -4
- package/dist/patterns/ai/browser.d.ts +4 -4
- package/dist/patterns/ai/browser.js +1 -1
- package/dist/patterns/ai/index.cjs +17 -17
- package/dist/patterns/ai/index.d.cts +17 -17
- package/dist/patterns/ai/index.d.ts +17 -17
- package/dist/patterns/ai/index.js +1 -1
- package/dist/patterns/ai/node.d.cts +4 -4
- package/dist/patterns/ai/node.d.ts +4 -4
- package/dist/patterns/ai/node.js +1 -1
- package/dist/patterns/cqrs/index.cjs +3 -3
- package/dist/patterns/cqrs/index.d.cts +6 -6
- package/dist/patterns/cqrs/index.d.ts +6 -6
- package/dist/patterns/cqrs/index.js +1 -1
- package/dist/patterns/demo-shell/index.cjs +5 -5
- package/dist/patterns/demo-shell/index.d.cts +5 -5
- package/dist/patterns/demo-shell/index.d.ts +5 -5
- package/dist/patterns/demo-shell/index.js +1 -1
- package/dist/patterns/domain-templates/index.cjs +3 -3
- package/dist/patterns/domain-templates/index.d.cts +4 -4
- package/dist/patterns/domain-templates/index.d.ts +4 -4
- package/dist/patterns/domain-templates/index.js +1 -1
- package/dist/patterns/graphspec/index.cjs +12 -12
- package/dist/patterns/graphspec/index.d.cts +5 -5
- package/dist/patterns/graphspec/index.d.ts +5 -5
- package/dist/patterns/graphspec/index.js +1 -1
- package/dist/patterns/harness/index.cjs +10 -8
- package/dist/patterns/harness/index.d.cts +11 -12
- package/dist/patterns/harness/index.d.ts +11 -12
- package/dist/patterns/harness/index.js +1 -1
- package/dist/patterns/inspect/index.cjs +3 -0
- package/dist/patterns/inspect/index.d.cts +9 -0
- package/dist/patterns/inspect/index.d.ts +9 -0
- package/dist/patterns/inspect/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +3 -3
- package/dist/patterns/job-queue/index.d.cts +6 -6
- package/dist/patterns/job-queue/index.d.ts +6 -6
- package/dist/patterns/job-queue/index.js +1 -1
- package/dist/patterns/memory/index.cjs +3 -3
- package/dist/patterns/memory/index.d.cts +6 -6
- package/dist/patterns/memory/index.d.ts +6 -6
- package/dist/patterns/memory/index.js +1 -1
- package/dist/patterns/messaging/index.cjs +3 -3
- package/dist/patterns/messaging/index.d.cts +5 -5
- package/dist/patterns/messaging/index.d.ts +5 -5
- package/dist/patterns/messaging/index.js +1 -1
- package/dist/patterns/orchestration/index.cjs +3 -3
- package/dist/patterns/orchestration/index.d.cts +7 -7
- package/dist/patterns/orchestration/index.d.ts +7 -7
- package/dist/patterns/orchestration/index.js +1 -1
- package/dist/patterns/process/index.cjs +1 -1
- package/dist/patterns/process/index.d.cts +7 -7
- package/dist/patterns/process/index.d.ts +7 -7
- package/dist/patterns/process/index.js +1 -1
- package/dist/patterns/reactive-layout/index.cjs +4 -4
- package/dist/patterns/reactive-layout/index.d.cts +5 -5
- package/dist/patterns/reactive-layout/index.d.ts +5 -5
- package/dist/patterns/reactive-layout/index.js +1 -1
- package/dist/patterns/reduction/index.cjs +3 -3
- package/dist/patterns/reduction/index.d.cts +4 -4
- package/dist/patterns/reduction/index.d.ts +4 -4
- package/dist/patterns/reduction/index.js +1 -1
- package/dist/patterns/surface/index.cjs +8 -8
- package/dist/patterns/surface/index.d.cts +6 -6
- package/dist/patterns/surface/index.d.ts +6 -6
- package/dist/patterns/surface/index.js +1 -1
- package/dist/{pipeline-graph-MWrQZXCq.d.cts → pipeline-graph-DPqKDk59.d.cts} +5 -5
- package/dist/{pipeline-graph-CB4La-UW.d.ts → pipeline-graph-loP57TBA.d.ts} +5 -5
- package/dist/{reactive-layout-BtZfUKuL.d.cts → reactive-layout-Dsvob4zD.d.cts} +2 -2
- package/dist/{reactive-layout-KJj4E2dT.d.ts → reactive-layout-v7KPvxoc.d.ts} +2 -2
- package/dist/{reactive-log-_zeEnB9H.d.cts → reactive-log-B00laMSQ.d.cts} +1 -1
- package/dist/{reactive-log-BlAsPLl2.d.ts → reactive-log-BezYsbA_.d.ts} +1 -1
- package/dist/{reactive-map-6P_k3AQM.d.cts → reactive-map-48mnZ-nu.d.cts} +1 -1
- package/dist/{reactive-map-CjXByDV-.d.ts → reactive-map-BVVPdvmi.d.ts} +1 -1
- package/dist/resilience-YIWPK4YC.js +1 -0
- package/dist/{sugar-DzePN5-g.d.cts → sugar-DLwvMr3F.d.ts} +24 -4
- package/dist/{sugar-BhfjgetH.d.ts → sugar-DyVGtczU.d.cts} +24 -4
- package/dist/{topology-tree-mF7Emqzm.d.ts → topology-tree-BNGvuG82.d.ts} +1 -1
- package/dist/{topology-tree-3LBKFsUo.d.cts → topology-tree-BSdfSwMi.d.cts} +1 -1
- package/dist/{types-1Dhoi7HM.d.cts → types-B1jDWVsM.d.cts} +1 -1
- package/dist/{types-39jk0kaV.d.ts → types-DkzUUs0H.d.ts} +1 -1
- package/package.json +11 -51
- package/dist/budget-gate-CmmVtasH.d.ts +0 -115
- package/dist/budget-gate-DiP_nK0n.d.cts +0 -115
- package/dist/chunk-2W553JJC.js +0 -1
- package/dist/chunk-4MKL6Q3K.js +0 -1
- package/dist/chunk-5B3JDG5F.js +0 -1
- package/dist/chunk-5QSXEMXG.js +0 -1
- package/dist/chunk-5TEFC2ZX.js +0 -1
- package/dist/chunk-5TOPVRN6.js +0 -1
- package/dist/chunk-EC2WNSZ7.js +0 -1
- package/dist/chunk-ELAASRBT.js +0 -3
- package/dist/chunk-H5SCWHWP.js +0 -1
- package/dist/chunk-OLIKJUKI.js +0 -1
- package/dist/chunk-POXANAJ6.js +0 -3
- package/dist/chunk-RSMEXK53.js +0 -43
- package/dist/chunk-SGS4OJGS.js +0 -1
- package/dist/chunk-URJ2VFNC.js +0 -1
- package/dist/chunk-VXPLLA4P.js +0 -1
- package/dist/chunk-WZYB3JQS.js +0 -1
- package/dist/chunk-Z6X7B6A4.js +0 -61
- package/dist/index-8s-Qm-gz.d.ts +0 -218
- package/dist/index-BgjS2b8N.d.ts +0 -366
- package/dist/index-BmSQLAZo.d.cts +0 -244
- package/dist/index-CGhMJNHb.d.cts +0 -128
- package/dist/index-CUIkE1l9.d.cts +0 -230
- package/dist/index-Ck35nA-T.d.ts +0 -244
- package/dist/index-CuPUehFa.d.cts +0 -218
- package/dist/index-D1Gc7wV5.d.ts +0 -230
- package/dist/index-N2MAxt7_.d.ts +0 -128
- package/dist/index-t6L2qpHh.d.cts +0 -366
- package/dist/patterns/audit/index.cjs +0 -3
- package/dist/patterns/audit/index.d.cts +0 -8
- package/dist/patterns/audit/index.d.ts +0 -8
- package/dist/patterns/audit/index.js +0 -1
- package/dist/patterns/guarded-execution/index.cjs +0 -3
- package/dist/patterns/guarded-execution/index.d.cts +0 -9
- package/dist/patterns/guarded-execution/index.d.ts +0 -9
- package/dist/patterns/guarded-execution/index.js +0 -1
- package/dist/patterns/lens/index.cjs +0 -3
- package/dist/patterns/lens/index.d.cts +0 -7
- package/dist/patterns/lens/index.d.ts +0 -7
- package/dist/patterns/lens/index.js +0 -1
- package/dist/patterns/refine-loop/index.cjs +0 -5
- package/dist/patterns/refine-loop/index.d.cts +0 -9
- package/dist/patterns/refine-loop/index.d.ts +0 -9
- package/dist/patterns/refine-loop/index.js +0 -1
- package/dist/patterns/resilient-pipeline/index.cjs +0 -3
- package/dist/patterns/resilient-pipeline/index.d.cts +0 -8
- package/dist/patterns/resilient-pipeline/index.d.ts +0 -8
- package/dist/patterns/resilient-pipeline/index.js +0 -1
- package/dist/resilience-JISHQD2F.js +0 -1
package/dist/index-8s-Qm-gz.d.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { N as Node, A as Actor, P as PolicyRuleData } from './node-BYInONRr.js';
|
|
2
|
-
import { G as Graph, b as GraphDescribeOutput, a as GraphOptions, d as GraphDescribeOptions, D as DescribeFilter } from './graph-BkIkog4h.js';
|
|
3
|
-
import { P as PolicyGateGraph, a as PolicyViolation } from './index-Ck35nA-T.js';
|
|
4
|
-
import { T as TopicGraph } from './index-40ZT4MHj.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Composable safety layer (roadmap §9.0b — Tier 5.1 Wave-B rebuild).
|
|
8
|
-
*
|
|
9
|
-
* {@link guardedExecution} wraps any {@link Graph} with:
|
|
10
|
-
*
|
|
11
|
-
* - {@link policyGate} — reactive ABAC (Tier 2.3 rename of `policyEnforcer`),
|
|
12
|
-
* policies stored as a `Node` so LLMs / humans can update them at runtime.
|
|
13
|
-
* Full transitive dynamic coverage via `watchTopologyTree`.
|
|
14
|
-
* - Reactive {@link GuardedExecutionGraph.scopedDescribeNode} — a thin
|
|
15
|
-
* delegate over `target.describe({ reactive: true, actor })` that re-derives
|
|
16
|
-
* on every settle (topology change, error transition, actor swap).
|
|
17
|
-
* - The enforcer's `violations` topic is republished as `violations` on
|
|
18
|
-
* the wrapper, composable with {@link graphLens}'s `health`.
|
|
19
|
-
* - The wrapper-level `lints` topic surfaces non-policy diagnostic warnings
|
|
20
|
-
* (`empty-policies` / `audit-no-effect` / `no-actor`) so misconfigurations
|
|
21
|
-
* are caught reactively rather than via thrown errors at scattered call sites.
|
|
22
|
-
* - The `scope` derived publishes the current configuration tuple
|
|
23
|
-
* (`{actor, mode, policiesCount}`) for dashboards.
|
|
24
|
-
*
|
|
25
|
-
* V1 scope: policies + actor + reactive scoped describe + lints + scope.
|
|
26
|
-
* Budget-as-option is NOT in V1 — it requires a cost-tracking design that
|
|
27
|
-
* hasn't landed yet. Callers who need a budget limit today append a
|
|
28
|
-
* budget-aware {@link PolicyRuleData} to the policies list (check current
|
|
29
|
-
* cost and `deny` when exhausted).
|
|
30
|
-
*
|
|
31
|
-
* @module
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/** Diagnostic warning published on {@link GuardedExecutionGraph.lints}. */
|
|
35
|
-
interface GuardedExecutionLint {
|
|
36
|
-
/**
|
|
37
|
-
* - `"empty-policies"` — `policies` Node emitted an empty array in
|
|
38
|
-
* `mode: "enforce"`. Static empty arrays throw at construction; this
|
|
39
|
-
* covers the reactive case.
|
|
40
|
-
* - `"audit-no-effect"` — `mode: "audit"` plus the target has no per-node
|
|
41
|
-
* guards, so `scopedDescribeNode` filters by per-node guards only and
|
|
42
|
-
* policies will never gate visibility (they still populate `violations`
|
|
43
|
-
* on writes).
|
|
44
|
-
* - `"no-actor"` — neither a wrapper-configured nor per-call actor was
|
|
45
|
-
* supplied. `scopedDescribeNode` falls back to "describe everything"
|
|
46
|
-
* for the corresponding subscription.
|
|
47
|
-
*/
|
|
48
|
-
kind: "empty-policies" | "audit-no-effect" | "no-actor";
|
|
49
|
-
message: string;
|
|
50
|
-
timestamp_ns: number;
|
|
51
|
-
}
|
|
52
|
-
/** Configuration tuple published on {@link GuardedExecutionGraph.scope}. */
|
|
53
|
-
interface GuardedScope {
|
|
54
|
-
/** The wrapper-configured default actor, or `null` when none configured. */
|
|
55
|
-
actor: Actor | null;
|
|
56
|
-
mode: "audit" | "enforce";
|
|
57
|
-
/** Current policy count (reactive — re-emits on `policies` Node updates). */
|
|
58
|
-
policiesCount: number;
|
|
59
|
-
}
|
|
60
|
-
/** Options for {@link guardedExecution}. */
|
|
61
|
-
interface GuardedExecutionOptions {
|
|
62
|
-
/**
|
|
63
|
-
* Policies enforced against every guarded write. Static list or a live
|
|
64
|
-
* `Node<readonly PolicyRuleData[]>` (LLM-updatable).
|
|
65
|
-
*
|
|
66
|
-
* **Empty-policies handling:**
|
|
67
|
-
* - Static empty array + `mode: "enforce"` throws `RangeError` at
|
|
68
|
-
* construction (deny-by-default is almost certainly a misconfiguration).
|
|
69
|
-
* - Node-supplied empty array + `mode: "enforce"` emits a one-time
|
|
70
|
-
* `"empty-policies"` lint on first such emission (the wrapper can't
|
|
71
|
-
* throw mid-run — surface the warning reactively).
|
|
72
|
-
* - `mode: "audit"` tolerates empty policies (no guards stacked; policies
|
|
73
|
-
* only feed the `violations` channel on writes).
|
|
74
|
-
*/
|
|
75
|
-
policies: readonly PolicyRuleData[] | Node<readonly PolicyRuleData[]>;
|
|
76
|
-
/**
|
|
77
|
-
* Default actor used when the caller invokes
|
|
78
|
-
* {@link GuardedExecutionGraph.scopedDescribeNode} without an override.
|
|
79
|
-
* Accepts a static {@link Actor} or a `Node<Actor>` — when a Node is
|
|
80
|
-
* supplied, the reactive describe re-derives on every actor emission so
|
|
81
|
-
* harnesses binding a per-turn actor get a single live describe Node
|
|
82
|
-
* instead of re-creating one per turn.
|
|
83
|
-
*
|
|
84
|
-
* Omit to scope per-call only. A `"no-actor"` lint fires once per instance
|
|
85
|
-
* if neither a configured nor per-call actor is ever supplied (the
|
|
86
|
-
* resulting describe is unscoped — full visibility).
|
|
87
|
-
*/
|
|
88
|
-
actor?: Actor | Node<Actor>;
|
|
89
|
-
/**
|
|
90
|
-
* `"enforce"` (default) — push guards onto target nodes so disallowed
|
|
91
|
-
* writes throw {@link GuardDenied}.
|
|
92
|
-
* `"audit"` — record would-be denials to the `violations` topic without
|
|
93
|
-
* blocking writes.
|
|
94
|
-
*/
|
|
95
|
-
mode?: "audit" | "enforce";
|
|
96
|
-
/** Ring-buffer cap for the `violations` topic. Default 1000 (inherited from policyGate). */
|
|
97
|
-
violationsLimit?: number;
|
|
98
|
-
/** Ring-buffer cap for the `lints` topic. Default 64 — each lint kind fires at most once per instance. */
|
|
99
|
-
lintsLimit?: number;
|
|
100
|
-
/** Wrapper graph name. Default `${target.name}_guarded`. */
|
|
101
|
-
name?: string;
|
|
102
|
-
/** Wrapper graph options. */
|
|
103
|
-
graph?: GraphOptions;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Wrapper over a target {@link Graph} providing reactive ABAC + reactive
|
|
107
|
-
* scoped describe + diagnostic lints. Mounts a {@link PolicyGateGraph} under
|
|
108
|
-
* `enforcer`, a {@link TopicGraph} of {@link GuardedExecutionLint} under
|
|
109
|
-
* `lints`, and a `scope` derived publishing `{actor, mode, policiesCount}`.
|
|
110
|
-
*
|
|
111
|
-
* @category patterns
|
|
112
|
-
*/
|
|
113
|
-
declare class GuardedExecutionGraph extends Graph {
|
|
114
|
-
readonly enforcer: PolicyGateGraph;
|
|
115
|
-
readonly violations: TopicGraph<PolicyViolation>;
|
|
116
|
-
readonly lints: TopicGraph<GuardedExecutionLint>;
|
|
117
|
-
readonly scope: Node<GuardedScope>;
|
|
118
|
-
/**
|
|
119
|
-
* Canonical reactive describe scoped to the wrapper's configured `actor`.
|
|
120
|
-
* Subscribes ONCE at construction; lifecycle owned by the wrapper (disposed
|
|
121
|
-
* on `wrapper.destroy()`). Use this property for the common case
|
|
122
|
-
* (long-lived consumer wanting "describe scoped to my actor"); use
|
|
123
|
-
* {@link scopedDescribeNode} only when a per-call actor override or
|
|
124
|
-
* different `detail`/`fields` is required.
|
|
125
|
-
*
|
|
126
|
-
* Re-derives on every settle of the target graph: structural changes,
|
|
127
|
-
* status transitions (errors flip nodes into `"errored"`), and actor
|
|
128
|
-
* emissions (when a `Node<Actor>` is bound, including the SENTINEL bridge
|
|
129
|
-
* applied internally — see qa G1B).
|
|
130
|
-
*/
|
|
131
|
-
readonly scopedDescribe: Node<GraphDescribeOutput>;
|
|
132
|
-
private readonly _target;
|
|
133
|
-
private readonly _actorNode;
|
|
134
|
-
private readonly _mode;
|
|
135
|
-
private readonly _firedLintKinds;
|
|
136
|
-
constructor(target: Graph, opts: GuardedExecutionOptions);
|
|
137
|
-
private _fireLint;
|
|
138
|
-
/**
|
|
139
|
-
* **Per-call escape hatch.** Prefer {@link scopedDescribe} (the mounted
|
|
140
|
-
* property) for the common case of "describe scoped to my actor." Use
|
|
141
|
-
* this method ONLY when you need a per-call actor override or different
|
|
142
|
-
* `detail`/`fields`/`filter`.
|
|
143
|
-
*
|
|
144
|
-
* Returns a live `Node<GraphDescribeOutput>` scoped to the supplied (or
|
|
145
|
-
* configured) actor, plus an explicit `dispose` for caller-controlled
|
|
146
|
-
* lifecycle. Re-derives on every settle of the target graph: structural
|
|
147
|
-
* changes, status transitions, and actor emissions (when a `Node<Actor>`
|
|
148
|
-
* is bound).
|
|
149
|
-
*
|
|
150
|
-
* **Lifecycle (qa G1A — EC1 fix).** Each call instantiates a fresh
|
|
151
|
-
* `target.describe({reactive: true})` handle (with its own version state,
|
|
152
|
-
* observe handle, transitive topology subscriptions, derived + keepalive).
|
|
153
|
-
* The caller MUST invoke the returned `dispose()` when finished to release
|
|
154
|
-
* these resources. Disposers ARE also tracked on the wrapper graph so
|
|
155
|
-
* `wrapper.destroy()` cleans up any handles the caller forgot — but a
|
|
156
|
-
* long-lived wrapper with heavy per-call usage will leak until destroy
|
|
157
|
-
* unless `dispose()` is called explicitly.
|
|
158
|
-
*
|
|
159
|
-
* @param actorOverride - Optional per-call override. Static {@link Actor}
|
|
160
|
-
* or `Node<Actor>`. Omit to use the wrapper-configured default.
|
|
161
|
-
* @param opts - Standard {@link GraphDescribeOptions} fields (`detail`,
|
|
162
|
-
* `fields`, `filter`). `actor` / `reactive` / `reactiveName` are
|
|
163
|
-
* controlled by the wrapper.
|
|
164
|
-
* @returns `{node, dispose}` — `node` is the live describe Node; `dispose`
|
|
165
|
-
* tears down the underlying reactive describe subscription idempotently.
|
|
166
|
-
*/
|
|
167
|
-
scopedDescribeNode(actorOverride?: Actor | Node<Actor>, opts?: Omit<GraphDescribeOptions, "actor" | "reactive" | "reactiveName">): {
|
|
168
|
-
node: Node<GraphDescribeOutput>;
|
|
169
|
-
dispose: () => void;
|
|
170
|
-
};
|
|
171
|
-
/** The wrapped graph (escape hatch for tooling). */
|
|
172
|
-
get target(): Graph;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Wrap a {@link Graph} with {@link policyGate} plus a reactive scoped describe
|
|
176
|
-
* lens. Returns a {@link GuardedExecutionGraph} that can be mounted, diffed,
|
|
177
|
-
* or composed with {@link graphLens}.
|
|
178
|
-
*
|
|
179
|
-
* @param target - The graph to guard.
|
|
180
|
-
* @param opts - See {@link GuardedExecutionOptions}.
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* const guarded = guardedExecution(app, {
|
|
185
|
-
* actor: state<Actor>({ type: "human", id: "alice" }), // reactive — re-derive on swap
|
|
186
|
-
* policies: [
|
|
187
|
-
* { effect: "allow", action: "read", actorType: "human" },
|
|
188
|
-
* { effect: "deny", action: "write", pathPattern: "system::*" },
|
|
189
|
-
* ],
|
|
190
|
-
* mode: "enforce",
|
|
191
|
-
* });
|
|
192
|
-
*
|
|
193
|
-
* // Canonical: subscribe to the mounted reactive describe (no per-call leak).
|
|
194
|
-
* guarded.scopedDescribe.subscribe((msgs) => { /* live describe per actor / topology change *\/ });
|
|
195
|
-
* // Per-call escape hatch (different actor / detail) — caller manages dispose.
|
|
196
|
-
* const detailed = guarded.scopedDescribeNode(undefined, { detail: "standard" });
|
|
197
|
-
* try { detailed.node.subscribe(/* … *\/); } finally { detailed.dispose(); }
|
|
198
|
-
* guarded.violations.events.subscribe(msgs => console.log("violations:", msgs));
|
|
199
|
-
* guarded.lints.events.subscribe(msgs => console.warn("lints:", msgs));
|
|
200
|
-
* guarded.scope.subscribe(msgs => console.log("scope:", msgs));
|
|
201
|
-
* ```
|
|
202
|
-
*
|
|
203
|
-
* @category patterns
|
|
204
|
-
*/
|
|
205
|
-
declare function guardedExecution(target: Graph, opts: GuardedExecutionOptions): GuardedExecutionGraph;
|
|
206
|
-
|
|
207
|
-
declare const index_DescribeFilter: typeof DescribeFilter;
|
|
208
|
-
type index_GuardedExecutionGraph = GuardedExecutionGraph;
|
|
209
|
-
declare const index_GuardedExecutionGraph: typeof GuardedExecutionGraph;
|
|
210
|
-
type index_GuardedExecutionLint = GuardedExecutionLint;
|
|
211
|
-
type index_GuardedExecutionOptions = GuardedExecutionOptions;
|
|
212
|
-
type index_GuardedScope = GuardedScope;
|
|
213
|
-
declare const index_guardedExecution: typeof guardedExecution;
|
|
214
|
-
declare namespace index {
|
|
215
|
-
export { index_DescribeFilter as DescribeFilter, index_GuardedExecutionGraph as GuardedExecutionGraph, type index_GuardedExecutionLint as GuardedExecutionLint, type index_GuardedExecutionOptions as GuardedExecutionOptions, type index_GuardedScope as GuardedScope, index_guardedExecution as guardedExecution };
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export { GuardedExecutionGraph as G, type GuardedExecutionLint as a, type GuardedExecutionOptions as b, type GuardedScope as c, guardedExecution as g, index as i };
|
package/dist/index-BgjS2b8N.d.ts
DELETED
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
import { N as Node } from './node-BYInONRr.js';
|
|
2
|
-
import { NodeInput } from './extra/sources.js';
|
|
3
|
-
import { a as GraphOptions, G as Graph } from './graph-BkIkog4h.js';
|
|
4
|
-
import { T as TopicGraph } from './index-40ZT4MHj.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* refineLoop — universal prompt/artifact optimization loop as a reactive Graph.
|
|
8
|
-
*
|
|
9
|
-
* Roadmap §9.8 (Wave 2.5). The loop is a 4-topic reactive pipeline:
|
|
10
|
-
*
|
|
11
|
-
* iterationTrigger ──▶ GENERATE ──▶ EVALUATE ──▶ ANALYZE ──▶ DECIDE
|
|
12
|
-
* │ │
|
|
13
|
-
* └─────── feedback + trigger ◀─────┘
|
|
14
|
-
*
|
|
15
|
-
* Each stage is a `TopicGraph` so dispatches stay O(1) per subscriber (cursor-
|
|
16
|
-
* based) and every iteration is observable, replayable, and checkpointable.
|
|
17
|
-
*
|
|
18
|
-
* Composition invariants (from COMPOSITION-GUIDE):
|
|
19
|
-
* - §7 feedback cycle: only `iterationTrigger` drives re-generation. Strategy
|
|
20
|
-
* + feedback + dataset are read via closure updaters (§28 factory-time seed)
|
|
21
|
-
* so mid-run swaps apply to the NEXT iteration, never retrigger the current.
|
|
22
|
-
* - §28 factory-time seed: strategy, lastFeedback, prevCandidates, dataset
|
|
23
|
-
* closures captured at wiring time + updated via subscribe handlers so the
|
|
24
|
-
* first activation doesn't drop the initial pair.
|
|
25
|
-
* - §32 nested-drain state-mirror: the decide-effect writes `lastFeedback`
|
|
26
|
-
* BEFORE bumping `iterationTrigger` inside its `batch()`, guaranteeing the
|
|
27
|
-
* mirror is current when the next-iteration wave reaches the generate fn.
|
|
28
|
-
* - §19 terminal-emission: history / best emit once per iteration (settled),
|
|
29
|
-
* not on every intermediate wave.
|
|
30
|
-
* - §27 attachSnapshotStorage: the whole graph is checkpointable — pause overnight,
|
|
31
|
-
* resume tomorrow from the exact iteration count, candidate set, strategy.
|
|
32
|
-
*
|
|
33
|
-
* Scope clamp (v1): core factory + `RefineStrategy<T>` + `blindVariation` and
|
|
34
|
-
* `errorCritique` built-ins + budget gating + checkpoint/resume.
|
|
35
|
-
* `mutateAndRefine` / registry / `autoSelectStrategy` / `optimizeCatalog` /
|
|
36
|
-
* `refineExecutor` are deferred.
|
|
37
|
-
*
|
|
38
|
-
* @module
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/** A single task row — the unit the evaluator scores one candidate against. */
|
|
42
|
-
interface DatasetItem {
|
|
43
|
-
readonly id: string;
|
|
44
|
-
readonly [k: string]: unknown;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* One candidate's score on one task. Higher is better by convention.
|
|
48
|
-
*
|
|
49
|
-
* Set `candidateIndex` when the evaluator fans out scores across multiple
|
|
50
|
-
* candidates (e.g. `candidates × tasks`). `pickBest` aggregates mean scores
|
|
51
|
-
* per `candidateIndex` when present; when absent, falls back to positional
|
|
52
|
-
* alignment (`scores[i]` ↔ `candidates[i]`).
|
|
53
|
-
*/
|
|
54
|
-
interface EvalResult {
|
|
55
|
-
readonly taskId: string;
|
|
56
|
-
readonly score: number;
|
|
57
|
-
readonly error?: string;
|
|
58
|
-
readonly detail?: unknown;
|
|
59
|
-
/** 0-based index into the `candidates` batch this score belongs to. */
|
|
60
|
-
readonly candidateIndex?: number;
|
|
61
|
-
}
|
|
62
|
-
/** Aggregated feedback the strategy produces from a scores batch. */
|
|
63
|
-
interface Feedback {
|
|
64
|
-
readonly summary: string;
|
|
65
|
-
readonly critique?: unknown;
|
|
66
|
-
readonly weakTasks?: readonly string[];
|
|
67
|
-
readonly score: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Strategy interface — plain object, no base class. Strategies implement three
|
|
71
|
-
* pure hooks; the loop infrastructure wraps them in reactive nodes so every
|
|
72
|
-
* decision is visible in `describe()`.
|
|
73
|
-
*
|
|
74
|
-
* `generate` may be sync or async. Async generates yield a microtask per
|
|
75
|
-
* iteration — that's what gives `pause()` / `setStrategy()` a window to
|
|
76
|
-
* interleave. **A fully synchronous `generate` will drain the entire loop
|
|
77
|
-
* during factory activation** (all iterations run before `refineLoop()`
|
|
78
|
-
* returns), which is usually not what you want for observable, steerable
|
|
79
|
-
* loops. Real strategies that call LLMs / evals are async and Just Work;
|
|
80
|
-
* custom sync strategies for tests are fine but should be marked `async`
|
|
81
|
-
* to match real cadence.
|
|
82
|
-
*/
|
|
83
|
-
interface RefineStrategy<T> {
|
|
84
|
-
readonly name: string;
|
|
85
|
-
/** Produce initial candidates from the seed. Called at iteration 0. */
|
|
86
|
-
seed(seed: T): readonly T[];
|
|
87
|
-
/** Reduce scores to feedback. Pure function. */
|
|
88
|
-
analyze(scores: readonly EvalResult[], candidates: readonly T[]): Feedback;
|
|
89
|
-
/**
|
|
90
|
-
* Generate next-iteration candidates from feedback + prior candidates.
|
|
91
|
-
* Async allowed — the loop awaits via `fromAny`.
|
|
92
|
-
*/
|
|
93
|
-
generate(feedback: Feedback, candidates: readonly T[]): Promise<readonly T[]> | readonly T[];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Evaluator shape — Shape 4 (2026-04-22): both `candidates` and `dataset` are
|
|
97
|
-
* reactive nodes; the evaluator's returned node IS the EVALUATE topic's source
|
|
98
|
-
* (no glue). Implementers can batch-eval (e.g. `funnel` with concurrency) or
|
|
99
|
-
* map per-candidate — user's code.
|
|
100
|
-
*
|
|
101
|
-
* **`EvalResult.candidateIndex` semantics.** Optional per-result field.
|
|
102
|
-
* When present, multi-candidate aggregators ({@link errorCritique}'s
|
|
103
|
-
* `pickBest`) score per index, picking the candidate with the highest
|
|
104
|
-
* mean score. When absent across all results, those aggregators fall back
|
|
105
|
-
* to positional matching against `candidates[0]` — meaning a strategy that
|
|
106
|
-
* generates >1 candidate but emits unindexed scores effectively only ever
|
|
107
|
-
* critiques the first candidate. Set `candidateIndex` whenever the
|
|
108
|
-
* evaluator's score corresponds to a specific candidate in the batch.
|
|
109
|
-
*/
|
|
110
|
-
type Evaluator<T> = (candidates: Node<readonly T[]>, dataset: Node<readonly DatasetItem[]>) => Node<readonly EvalResult[]>;
|
|
111
|
-
/**
|
|
112
|
-
* Early-stop controls. Each field fans into its own derived node; the four
|
|
113
|
-
* combine via `||` into `converged: Node<boolean>`. Callers see exactly
|
|
114
|
-
* which rule tripped via `status` / the DECIDE topic's `reason`.
|
|
115
|
-
*/
|
|
116
|
-
interface ConvergenceOptions {
|
|
117
|
-
/** Stop when aggregate score has not improved for N iterations. */
|
|
118
|
-
patience?: number;
|
|
119
|
-
/** Stop when aggregate score reaches or exceeds this. */
|
|
120
|
-
minScore?: number;
|
|
121
|
-
/** Stop when absolute delta between consecutive scores falls below this. */
|
|
122
|
-
minDelta?: number;
|
|
123
|
-
/** Stop after N total evaluations (iteration count × per-iter candidates). */
|
|
124
|
-
maxEvaluations?: number;
|
|
125
|
-
/** Stop after N iterations. Always set a finite bound in production. */
|
|
126
|
-
maxIterations?: number;
|
|
127
|
-
}
|
|
128
|
-
/** Emitted to the GENERATE topic each time the strategy produces a batch. */
|
|
129
|
-
interface GenerateEvent<T> {
|
|
130
|
-
readonly iteration: number;
|
|
131
|
-
readonly candidates: readonly T[];
|
|
132
|
-
readonly timestamp_ns: number;
|
|
133
|
-
}
|
|
134
|
-
/** Emitted to the EVALUATE topic when scores settle for an iteration. */
|
|
135
|
-
interface EvaluateEvent<T> {
|
|
136
|
-
readonly iteration: number;
|
|
137
|
-
readonly candidates: readonly T[];
|
|
138
|
-
readonly scores: readonly EvalResult[];
|
|
139
|
-
readonly timestamp_ns: number;
|
|
140
|
-
}
|
|
141
|
-
/** Emitted to the ANALYZE topic — strategy's reduction over scores. */
|
|
142
|
-
interface AnalyzeEvent<T> {
|
|
143
|
-
readonly iteration: number;
|
|
144
|
-
readonly candidates: readonly T[];
|
|
145
|
-
readonly feedback: Feedback;
|
|
146
|
-
readonly timestamp_ns: number;
|
|
147
|
-
}
|
|
148
|
-
/** Emitted to the DECIDE topic — branch taken this iteration. */
|
|
149
|
-
interface DecideEvent {
|
|
150
|
-
readonly iteration: number;
|
|
151
|
-
readonly decision: "continue" | "converged" | "budget" | "paused";
|
|
152
|
-
readonly reason?: string;
|
|
153
|
-
readonly timestamp_ns: number;
|
|
154
|
-
}
|
|
155
|
-
type RefineStatus = "running" | "converged" | "budget" | "paused" | "errored";
|
|
156
|
-
interface Iteration<T> {
|
|
157
|
-
readonly n: number;
|
|
158
|
-
readonly candidates: readonly T[];
|
|
159
|
-
readonly scores: readonly EvalResult[];
|
|
160
|
-
readonly feedback: Feedback;
|
|
161
|
-
/** `null` iff the candidate batch for this iteration was empty. */
|
|
162
|
-
readonly best: T | null;
|
|
163
|
-
readonly bestScore: number;
|
|
164
|
-
readonly timestamp_ns: number;
|
|
165
|
-
}
|
|
166
|
-
interface RefineLoopOptions extends ConvergenceOptions {
|
|
167
|
-
/** Reactive dataset OR a plain array (auto-wrapped into `state`). */
|
|
168
|
-
dataset: NodeInput<readonly DatasetItem[]> | readonly DatasetItem[];
|
|
169
|
-
/** Total teacher calls cap across iterations. Default: unlimited. */
|
|
170
|
-
budget?: number;
|
|
171
|
-
/** Graph name. Default: `"refine-loop"`. */
|
|
172
|
-
name?: string;
|
|
173
|
-
/** Extra graph options forwarded to the underlying `Graph`. */
|
|
174
|
-
graph?: GraphOptions;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Return type — extends Graph so all observability tools (`describe`,
|
|
178
|
-
* `explain`, `observe`, `attachSnapshotStorage`, `snapshot`) Just Work.
|
|
179
|
-
*/
|
|
180
|
-
interface RefineLoopGraph<T> extends Graph {
|
|
181
|
-
readonly best: Node<T | null>;
|
|
182
|
-
readonly score: Node<number>;
|
|
183
|
-
readonly status: Node<RefineStatus>;
|
|
184
|
-
readonly history: Node<readonly Iteration<T>[]>;
|
|
185
|
-
readonly strategy: Node<RefineStrategy<T>>;
|
|
186
|
-
readonly iteration: Node<number>;
|
|
187
|
-
/** Stage topics — subscribe for per-stage streaming / cursor consumers. */
|
|
188
|
-
readonly generate: TopicGraph<GenerateEvent<T>>;
|
|
189
|
-
readonly evaluate: TopicGraph<EvaluateEvent<T>>;
|
|
190
|
-
readonly analyze: TopicGraph<AnalyzeEvent<T>>;
|
|
191
|
-
readonly decide: TopicGraph<DecideEvent>;
|
|
192
|
-
/** Swap the active strategy mid-run (human-in-the-loop handoff). */
|
|
193
|
-
setStrategy(next: RefineStrategy<T>): void;
|
|
194
|
-
/** Pause after the current iteration completes. */
|
|
195
|
-
pause(): void;
|
|
196
|
-
/** Resume a paused loop. */
|
|
197
|
-
resume(): void;
|
|
198
|
-
}
|
|
199
|
-
declare function refineLoop<T>(seed: T, evaluator: Evaluator<T>, initialStrategy: RefineStrategy<T>, opts: RefineLoopOptions): RefineLoopGraph<T>;
|
|
200
|
-
/**
|
|
201
|
-
* Context passed to a `blindVariation` teacher per call. `reportCost` is a
|
|
202
|
-
* per-call hook — see `BlindVariationOptions.tokens`.
|
|
203
|
-
*/
|
|
204
|
-
interface BlindVariationContext<T> {
|
|
205
|
-
readonly prior: T;
|
|
206
|
-
/**
|
|
207
|
-
* Report tokens consumed by this teacher call. Aggregated per iteration
|
|
208
|
-
* and flushed to `opts.tokens` in the strategy's `finally` block so
|
|
209
|
-
* partial spend is preserved when the teacher throws mid-batch.
|
|
210
|
-
*/
|
|
211
|
-
readonly reportCost: (tokens: number) => void;
|
|
212
|
-
}
|
|
213
|
-
interface BlindVariationOptions<T> {
|
|
214
|
-
/** Name — default: `"blindVariation"`. */
|
|
215
|
-
name?: string;
|
|
216
|
-
/** Number of candidates generated per iteration. Default: 4. */
|
|
217
|
-
width?: number;
|
|
218
|
-
/**
|
|
219
|
-
* Run teacher calls in parallel via `Promise.all`. Default `true` — the
|
|
220
|
-
* common case (independent LLM calls). Set `false` to run sequentially
|
|
221
|
-
* via `for/await` when teachers share stateful resources (rate limiters,
|
|
222
|
-
* rolling context, serial API ordering) that don't tolerate concurrency.
|
|
223
|
-
*/
|
|
224
|
-
parallel?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Optional cost counter node. Running total tokens reported via
|
|
227
|
-
* `ctx.reportCost` during each iteration is added to this node in the
|
|
228
|
-
* strategy's `finally` block — fires on success AND on teacher throw so
|
|
229
|
-
* partial spend is never lost. User owns the node; wire to `budgetGate`,
|
|
230
|
-
* `attachSnapshotStorage`, telemetry, etc.
|
|
231
|
-
*/
|
|
232
|
-
tokens?: Node<number>;
|
|
233
|
-
/**
|
|
234
|
-
* Teacher — given `{prior, reportCost}`, produce one variant. Async
|
|
235
|
-
* allowed. Called `width` times per iteration. Call `ctx.reportCost(n)`
|
|
236
|
-
* to track tokens consumed per call (optional, no-op if `opts.tokens`
|
|
237
|
-
* is not set).
|
|
238
|
-
*/
|
|
239
|
-
teacher: (ctx: BlindVariationContext<T>) => Promise<T> | T;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Simplest built-in strategy: generate N variants per iteration via the
|
|
243
|
-
* supplied `teacher`; no feedback-informed steering (equivalent to Random
|
|
244
|
-
* Search). Validates the loop infrastructure end-to-end and is the baseline
|
|
245
|
-
* every other strategy should outperform.
|
|
246
|
-
*
|
|
247
|
-
* `analyze` records the mean score and flags the worst task — strategies that
|
|
248
|
-
* care about per-task critique layer on top.
|
|
249
|
-
*/
|
|
250
|
-
declare function blindVariation<T>(opts: BlindVariationOptions<T>): RefineStrategy<T>;
|
|
251
|
-
/**
|
|
252
|
-
* Context passed to an `errorCritique` teacher. `critique` is the pre-formatted
|
|
253
|
-
* summary a prompt template can drop in verbatim; `failures` carries the
|
|
254
|
-
* structured evidence (per-task error / score / detail) for richer prompts.
|
|
255
|
-
*/
|
|
256
|
-
interface ErrorCritiqueContext<T> {
|
|
257
|
-
readonly prior: T;
|
|
258
|
-
readonly critique: string;
|
|
259
|
-
readonly failures: readonly EvalResult[];
|
|
260
|
-
/**
|
|
261
|
-
* Report tokens consumed by this teacher call. Aggregated per iteration
|
|
262
|
-
* and flushed to `opts.tokens` in the strategy's `finally` block so
|
|
263
|
-
* partial spend is preserved when the teacher throws mid-batch.
|
|
264
|
-
*/
|
|
265
|
-
readonly reportCost: (tokens: number) => void;
|
|
266
|
-
}
|
|
267
|
-
interface ErrorCritiqueOptions<T> {
|
|
268
|
-
/** Name — default: `"errorCritique"`. */
|
|
269
|
-
name?: string;
|
|
270
|
-
/** Number of candidates generated per iteration. Default: 4. */
|
|
271
|
-
width?: number;
|
|
272
|
-
/**
|
|
273
|
-
* Cut-off below which a task is classified as a failure and fed into the
|
|
274
|
-
* critique. Default: the batch mean — any task scoring below the batch
|
|
275
|
-
* mean is a failure. Pass a number for an absolute cut-off, or a function
|
|
276
|
-
* for per-batch computation (e.g. a percentile). When the default mean
|
|
277
|
-
* is non-finite (NaN / ±Infinity from a degenerate evaluator), ALL scores
|
|
278
|
-
* are treated as failures so the critique loop continues to steer.
|
|
279
|
-
*/
|
|
280
|
-
failureThreshold?: number | ((scores: readonly EvalResult[]) => number);
|
|
281
|
-
/** Cap on failure samples packed into the critique. Default: 5. */
|
|
282
|
-
maxFailureSamples?: number;
|
|
283
|
-
/**
|
|
284
|
-
* Format failures into the `critique` string passed to the teacher. Default
|
|
285
|
-
* joins `- taskId (score=N) | error: …` lines. Override to shape LLM prompts.
|
|
286
|
-
*
|
|
287
|
-
* **Note:** the `feedback` argument is a shell with `{score, weakTasks}`
|
|
288
|
-
* populated; `summary` is empty because `analyze` computes the final summary
|
|
289
|
-
* AFTER `formatCritique` runs (the summary embeds the formatted count).
|
|
290
|
-
* Rely on `failures` and `feedback.score` — do not read `feedback.summary`
|
|
291
|
-
* here.
|
|
292
|
-
*/
|
|
293
|
-
formatCritique?: (failures: readonly EvalResult[], feedback: Feedback) => string;
|
|
294
|
-
/**
|
|
295
|
-
* Run teacher calls in parallel via `Promise.all`. Default `true` — the
|
|
296
|
-
* common case (independent LLM calls). Set `false` to run sequentially
|
|
297
|
-
* via `for/await` when teachers share stateful resources (rate limiters,
|
|
298
|
-
* rolling context, serial API ordering) that don't tolerate concurrency.
|
|
299
|
-
*/
|
|
300
|
-
parallel?: boolean;
|
|
301
|
-
/**
|
|
302
|
-
* Optional cost counter node. Running total tokens reported via
|
|
303
|
-
* `ctx.reportCost` during each iteration is added to this node in the
|
|
304
|
-
* strategy's `finally` block — fires on success AND on teacher throw so
|
|
305
|
-
* partial spend is never lost. User owns the node; wire to `budgetGate`,
|
|
306
|
-
* `attachSnapshotStorage`, telemetry, etc.
|
|
307
|
-
*/
|
|
308
|
-
tokens?: Node<number>;
|
|
309
|
-
/**
|
|
310
|
-
* Teacher — given `{prior, critique, failures, reportCost}`, produce one
|
|
311
|
-
* refined variant. Called `width` times per iteration. Async allowed.
|
|
312
|
-
* Call `ctx.reportCost(n)` to track tokens consumed per call (optional,
|
|
313
|
-
* no-op if `opts.tokens` is not set).
|
|
314
|
-
*/
|
|
315
|
-
teacher: (ctx: ErrorCritiqueContext<T>) => Promise<T> | T;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Critique-driven strategy (ProTeGi-style "textual gradient"). Each iteration:
|
|
319
|
-
* 1. `analyze` classifies tasks scoring below a threshold as failures, picks
|
|
320
|
-
* the best candidate from the batch, and packs both plus a formatted
|
|
321
|
-
* critique string into `feedback.critique` as a private payload.
|
|
322
|
-
* 2. `generate` unpacks that payload and calls the teacher with
|
|
323
|
-
* `{prior, critique, failures, reportCost}` `width` times, returning the
|
|
324
|
-
* refined batch.
|
|
325
|
-
*
|
|
326
|
-
* The teacher receives a pre-formatted string (drop into an LLM prompt) AND
|
|
327
|
-
* the structured failure list (for richer prompts that want per-task detail).
|
|
328
|
-
* Throws on empty candidate batches — matches `blindVariation`'s contract
|
|
329
|
-
* (no silent zero-candidate cycles).
|
|
330
|
-
*
|
|
331
|
-
* When `setStrategy()` swaps this strategy in mid-run, the first `generate`
|
|
332
|
-
* may receive a `Feedback` produced by the prior strategy (no private payload);
|
|
333
|
-
* the fallback path uses `candidates[last]` as the prior and the feedback
|
|
334
|
-
* summary as the critique, so the loop keeps running without a stall. When a
|
|
335
|
-
* private payload IS present, `priv.critiqueText` takes precedence over any
|
|
336
|
-
* edits a caller made to `feedback.summary` — treat `critique` as the
|
|
337
|
-
* strategy-owned channel.
|
|
338
|
-
*/
|
|
339
|
-
declare function errorCritique<T>(opts: ErrorCritiqueOptions<T>): RefineStrategy<T>;
|
|
340
|
-
|
|
341
|
-
type index_AnalyzeEvent<T> = AnalyzeEvent<T>;
|
|
342
|
-
type index_BlindVariationContext<T> = BlindVariationContext<T>;
|
|
343
|
-
type index_BlindVariationOptions<T> = BlindVariationOptions<T>;
|
|
344
|
-
type index_ConvergenceOptions = ConvergenceOptions;
|
|
345
|
-
type index_DatasetItem = DatasetItem;
|
|
346
|
-
type index_DecideEvent = DecideEvent;
|
|
347
|
-
type index_ErrorCritiqueContext<T> = ErrorCritiqueContext<T>;
|
|
348
|
-
type index_ErrorCritiqueOptions<T> = ErrorCritiqueOptions<T>;
|
|
349
|
-
type index_EvalResult = EvalResult;
|
|
350
|
-
type index_EvaluateEvent<T> = EvaluateEvent<T>;
|
|
351
|
-
type index_Evaluator<T> = Evaluator<T>;
|
|
352
|
-
type index_Feedback = Feedback;
|
|
353
|
-
type index_GenerateEvent<T> = GenerateEvent<T>;
|
|
354
|
-
type index_Iteration<T> = Iteration<T>;
|
|
355
|
-
type index_RefineLoopGraph<T> = RefineLoopGraph<T>;
|
|
356
|
-
type index_RefineLoopOptions = RefineLoopOptions;
|
|
357
|
-
type index_RefineStatus = RefineStatus;
|
|
358
|
-
type index_RefineStrategy<T> = RefineStrategy<T>;
|
|
359
|
-
declare const index_blindVariation: typeof blindVariation;
|
|
360
|
-
declare const index_errorCritique: typeof errorCritique;
|
|
361
|
-
declare const index_refineLoop: typeof refineLoop;
|
|
362
|
-
declare namespace index {
|
|
363
|
-
export { type index_AnalyzeEvent as AnalyzeEvent, type index_BlindVariationContext as BlindVariationContext, type index_BlindVariationOptions as BlindVariationOptions, type index_ConvergenceOptions as ConvergenceOptions, type index_DatasetItem as DatasetItem, type index_DecideEvent as DecideEvent, type index_ErrorCritiqueContext as ErrorCritiqueContext, type index_ErrorCritiqueOptions as ErrorCritiqueOptions, type index_EvalResult as EvalResult, type index_EvaluateEvent as EvaluateEvent, type index_Evaluator as Evaluator, type index_Feedback as Feedback, type index_GenerateEvent as GenerateEvent, type index_Iteration as Iteration, type index_RefineLoopGraph as RefineLoopGraph, type index_RefineLoopOptions as RefineLoopOptions, type index_RefineStatus as RefineStatus, type index_RefineStrategy as RefineStrategy, index_blindVariation as blindVariation, index_errorCritique as errorCritique, index_refineLoop as refineLoop };
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
export { type AnalyzeEvent as A, type BlindVariationContext as B, type ConvergenceOptions as C, type DatasetItem as D, type Evaluator as E, type Feedback as F, type GenerateEvent as G, type Iteration as I, type RefineStrategy as R, type EvalResult as a, type RefineLoopOptions as b, type RefineStatus as c, type BlindVariationOptions as d, type DecideEvent as e, type ErrorCritiqueContext as f, type ErrorCritiqueOptions as g, type EvaluateEvent as h, index as i, type RefineLoopGraph as j, blindVariation as k, errorCritique as l, refineLoop as r };
|