@graphrefly/graphrefly 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/_internal-B23BagFd.d.cts +33 -0
- package/dist/_internal-B23BagFd.d.ts +33 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
- package/dist/agents-C0Ji9ldU.d.cts +629 -0
- package/dist/agents-C9zexT7I.d.ts +629 -0
- package/dist/audit-BAXb3VOg.d.ts +246 -0
- package/dist/audit-C_bPfkqS.d.cts +246 -0
- package/dist/backoff-7KIK3WQW.js +24 -0
- package/dist/backoff-7KIK3WQW.js.map +1 -0
- package/dist/backoff-Bnb9OoPh.d.cts +6 -0
- package/dist/backoff-Bnb9OoPh.d.ts +6 -0
- package/dist/base/composition/index.cjs +865 -0
- package/dist/base/composition/index.cjs.map +1 -0
- package/dist/base/composition/index.d.cts +468 -0
- package/dist/base/composition/index.d.ts +468 -0
- package/dist/base/composition/index.js +40 -0
- package/dist/base/composition/index.js.map +1 -0
- package/dist/base/index.cjs +6390 -0
- package/dist/base/index.cjs.map +1 -0
- package/dist/base/index.d.cts +21 -0
- package/dist/base/index.d.ts +21 -0
- package/dist/base/index.js +259 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/io/index.cjs +3270 -0
- package/dist/base/io/index.cjs.map +1 -0
- package/dist/base/io/index.d.cts +2245 -0
- package/dist/base/io/index.d.ts +2245 -0
- package/dist/base/io/index.js +117 -0
- package/dist/base/io/index.js.map +1 -0
- package/dist/base/meta/index.cjs +43 -0
- package/dist/base/meta/index.cjs.map +1 -0
- package/dist/base/meta/index.d.cts +45 -0
- package/dist/base/meta/index.d.ts +45 -0
- package/dist/base/meta/index.js +13 -0
- package/dist/base/meta/index.js.map +1 -0
- package/dist/base/mutation/index.cjs +200 -0
- package/dist/base/mutation/index.cjs.map +1 -0
- package/dist/base/mutation/index.d.cts +177 -0
- package/dist/base/mutation/index.d.ts +177 -0
- package/dist/base/mutation/index.js +22 -0
- package/dist/base/mutation/index.js.map +1 -0
- package/dist/base/render/index.cjs +1120 -0
- package/dist/base/render/index.cjs.map +1 -0
- package/dist/base/render/index.d.cts +227 -0
- package/dist/base/render/index.d.ts +227 -0
- package/dist/base/render/index.js +24 -0
- package/dist/base/render/index.js.map +1 -0
- package/dist/base/sources/browser/index.cjs +172 -0
- package/dist/base/sources/browser/index.cjs.map +1 -0
- package/dist/base/sources/browser/index.d.cts +84 -0
- package/dist/base/sources/browser/index.d.ts +84 -0
- package/dist/base/sources/browser/index.js +151 -0
- package/dist/base/sources/browser/index.js.map +1 -0
- package/dist/base/sources/event/index.cjs +98 -0
- package/dist/base/sources/event/index.cjs.map +1 -0
- package/dist/base/sources/event/index.d.cts +91 -0
- package/dist/base/sources/event/index.d.ts +91 -0
- package/dist/base/sources/event/index.js +13 -0
- package/dist/base/sources/event/index.js.map +1 -0
- package/dist/base/sources/index.cjs +755 -0
- package/dist/base/sources/index.cjs.map +1 -0
- package/dist/base/sources/index.d.cts +357 -0
- package/dist/base/sources/index.d.ts +357 -0
- package/dist/base/sources/index.js +42 -0
- package/dist/base/sources/index.js.map +1 -0
- package/dist/base/sources/node/index.cjs +320 -0
- package/dist/base/sources/node/index.cjs.map +1 -0
- package/dist/base/sources/node/index.d.cts +185 -0
- package/dist/base/sources/node/index.d.ts +185 -0
- package/dist/base/sources/node/index.js +306 -0
- package/dist/base/sources/node/index.js.map +1 -0
- package/dist/base/utils/index.cjs +37 -0
- package/dist/base/utils/index.cjs.map +1 -0
- package/dist/base/utils/index.d.cts +37 -0
- package/dist/base/utils/index.d.ts +37 -0
- package/dist/base/utils/index.js +11 -0
- package/dist/base/utils/index.js.map +1 -0
- package/dist/base/worker/index.cjs +548 -0
- package/dist/base/worker/index.cjs.map +1 -0
- package/dist/base/worker/index.d.cts +207 -0
- package/dist/base/worker/index.d.ts +207 -0
- package/dist/base/worker/index.js +20 -0
- package/dist/base/worker/index.js.map +1 -0
- package/dist/breaker-C9skL3d8.d.ts +175 -0
- package/dist/breaker-ugSdq54q.d.cts +175 -0
- package/dist/cascading-CSSbKGrJ.d.ts +199 -0
- package/dist/cascading-baGkiihI.d.cts +199 -0
- package/dist/chunk-22SG74BD.js +207 -0
- package/dist/chunk-22SG74BD.js.map +1 -0
- package/dist/chunk-255UCBG4.js +58 -0
- package/dist/chunk-255UCBG4.js.map +1 -0
- package/dist/chunk-2LO3EL4W.js +1 -0
- package/dist/chunk-2LO3EL4W.js.map +1 -0
- package/dist/chunk-2OB3CEJS.js +1065 -0
- package/dist/chunk-2OB3CEJS.js.map +1 -0
- package/dist/chunk-36NMM65U.js +144 -0
- package/dist/chunk-36NMM65U.js.map +1 -0
- package/dist/chunk-3CEXCBN6.js +1 -0
- package/dist/chunk-3CEXCBN6.js.map +1 -0
- package/dist/chunk-3MUSLI6E.js +105 -0
- package/dist/chunk-3MUSLI6E.js.map +1 -0
- package/dist/chunk-3PSLNJDU.js +884 -0
- package/dist/chunk-3PSLNJDU.js.map +1 -0
- package/dist/chunk-42FQ27MQ.js +594 -0
- package/dist/chunk-42FQ27MQ.js.map +1 -0
- package/dist/chunk-4GYMCUDZ.js +1085 -0
- package/dist/chunk-4GYMCUDZ.js.map +1 -0
- package/dist/chunk-4S53H2KR.js +382 -0
- package/dist/chunk-4S53H2KR.js.map +1 -0
- package/dist/chunk-4XCHZRUJ.js +128 -0
- package/dist/chunk-4XCHZRUJ.js.map +1 -0
- package/dist/chunk-5IMMNARC.js +1153 -0
- package/dist/chunk-5IMMNARC.js.map +1 -0
- package/dist/chunk-6XZYT4SW.js +256 -0
- package/dist/chunk-6XZYT4SW.js.map +1 -0
- package/dist/chunk-7EGRP2VX.js +76 -0
- package/dist/chunk-7EGRP2VX.js.map +1 -0
- package/dist/chunk-A7KV5UK4.js +150 -0
- package/dist/chunk-A7KV5UK4.js.map +1 -0
- package/dist/chunk-APY2SS5X.js +156 -0
- package/dist/chunk-APY2SS5X.js.map +1 -0
- package/dist/chunk-AZDQPQ3V.js +66 -0
- package/dist/chunk-AZDQPQ3V.js.map +1 -0
- package/dist/chunk-BU3SEFA5.js +90 -0
- package/dist/chunk-BU3SEFA5.js.map +1 -0
- package/dist/chunk-BXGZFGZ4.js +189 -0
- package/dist/chunk-BXGZFGZ4.js.map +1 -0
- package/dist/chunk-CGHORL6G.js +579 -0
- package/dist/chunk-CGHORL6G.js.map +1 -0
- package/dist/chunk-CXANAIZU.js +530 -0
- package/dist/chunk-CXANAIZU.js.map +1 -0
- package/dist/chunk-CZQHCKKG.js +1 -0
- package/dist/chunk-CZQHCKKG.js.map +1 -0
- package/dist/chunk-DKNHAICT.js +133 -0
- package/dist/chunk-DKNHAICT.js.map +1 -0
- package/dist/chunk-DM4OMPWK.js +584 -0
- package/dist/chunk-DM4OMPWK.js.map +1 -0
- package/dist/chunk-DMSNO6ZB.js +452 -0
- package/dist/chunk-DMSNO6ZB.js.map +1 -0
- package/dist/chunk-E5OZPDIW.js +229 -0
- package/dist/chunk-E5OZPDIW.js.map +1 -0
- package/dist/chunk-EHRRQ4IC.js +211 -0
- package/dist/chunk-EHRRQ4IC.js.map +1 -0
- package/dist/chunk-EVYY4X5A.js +509 -0
- package/dist/chunk-EVYY4X5A.js.map +1 -0
- package/dist/chunk-FDFD67UO.js +1 -0
- package/dist/chunk-FDFD67UO.js.map +1 -0
- package/dist/chunk-FMPF42Q4.js +13 -0
- package/dist/chunk-FMPF42Q4.js.map +1 -0
- package/dist/chunk-FW23JYNQ.js +454 -0
- package/dist/chunk-FW23JYNQ.js.map +1 -0
- package/dist/chunk-GWRNLJNW.js +2508 -0
- package/dist/chunk-GWRNLJNW.js.map +1 -0
- package/dist/chunk-HL7HUJIX.js +1 -0
- package/dist/chunk-HL7HUJIX.js.map +1 -0
- package/dist/chunk-IHTWQEDR.js +169 -0
- package/dist/chunk-IHTWQEDR.js.map +1 -0
- package/dist/chunk-IJRR6YAI.js +128 -0
- package/dist/chunk-IJRR6YAI.js.map +1 -0
- package/dist/chunk-JGFRAFDL.js +221 -0
- package/dist/chunk-JGFRAFDL.js.map +1 -0
- package/dist/chunk-JKTC747G.js +725 -0
- package/dist/chunk-JKTC747G.js.map +1 -0
- package/dist/chunk-KN3H5CNT.js +11 -0
- package/dist/chunk-KN3H5CNT.js.map +1 -0
- package/dist/chunk-KPG3DGLA.js +1 -0
- package/dist/chunk-KPG3DGLA.js.map +1 -0
- package/dist/chunk-KRNQ6RGQ.js +1 -0
- package/dist/chunk-KRNQ6RGQ.js.map +1 -0
- package/dist/chunk-MLTPJMH6.js +417 -0
- package/dist/chunk-MLTPJMH6.js.map +1 -0
- package/dist/chunk-N3SZ7BMH.js +95 -0
- package/dist/chunk-N3SZ7BMH.js.map +1 -0
- package/dist/chunk-NDUD3IMO.js +540 -0
- package/dist/chunk-NDUD3IMO.js.map +1 -0
- package/dist/chunk-NY2PYHNC.js +873 -0
- package/dist/chunk-NY2PYHNC.js.map +1 -0
- package/dist/chunk-O3MT7DYI.js +225 -0
- package/dist/chunk-O3MT7DYI.js.map +1 -0
- package/dist/chunk-OCUDSN63.js +2386 -0
- package/dist/chunk-OCUDSN63.js.map +1 -0
- package/dist/chunk-OIWU3NYV.js +199 -0
- package/dist/chunk-OIWU3NYV.js.map +1 -0
- package/dist/chunk-OQUIJT7A.js +1 -0
- package/dist/chunk-OQUIJT7A.js.map +1 -0
- package/dist/chunk-P5LBT622.js +105 -0
- package/dist/chunk-P5LBT622.js.map +1 -0
- package/dist/chunk-PKGQG5QQ.js +519 -0
- package/dist/chunk-PKGQG5QQ.js.map +1 -0
- package/dist/chunk-PKPO3JTZ.js +561 -0
- package/dist/chunk-PKPO3JTZ.js.map +1 -0
- package/dist/chunk-PL5UDIQ5.js +118 -0
- package/dist/chunk-PL5UDIQ5.js.map +1 -0
- package/dist/chunk-PZWISPIQ.js +432 -0
- package/dist/chunk-PZWISPIQ.js.map +1 -0
- package/dist/chunk-Q3EYOCZB.js +510 -0
- package/dist/chunk-Q3EYOCZB.js.map +1 -0
- package/dist/chunk-QMBYUVRL.js +15 -0
- package/dist/chunk-QMBYUVRL.js.map +1 -0
- package/dist/chunk-RAGGHLCV.js +200 -0
- package/dist/chunk-RAGGHLCV.js.map +1 -0
- package/dist/chunk-RJOG4IJU.js +1039 -0
- package/dist/chunk-RJOG4IJU.js.map +1 -0
- package/dist/chunk-SOOKUYVM.js +403 -0
- package/dist/chunk-SOOKUYVM.js.map +1 -0
- package/dist/chunk-T5BN5KG7.js +1 -0
- package/dist/chunk-T5BN5KG7.js.map +1 -0
- package/dist/chunk-TNX5ZGDJ.js +574 -0
- package/dist/chunk-TNX5ZGDJ.js.map +1 -0
- package/dist/chunk-TP7244Y6.js +207 -0
- package/dist/chunk-TP7244Y6.js.map +1 -0
- package/dist/chunk-TSBFTJKM.js +57 -0
- package/dist/chunk-TSBFTJKM.js.map +1 -0
- package/dist/chunk-URQ2CBBF.js +143 -0
- package/dist/chunk-URQ2CBBF.js.map +1 -0
- package/dist/chunk-VLAGJZSL.js +1079 -0
- package/dist/chunk-VLAGJZSL.js.map +1 -0
- package/dist/chunk-W2BOPXTI.js +1 -0
- package/dist/chunk-W2BOPXTI.js.map +1 -0
- package/dist/chunk-Y52CS6YA.js +88 -0
- package/dist/chunk-Y52CS6YA.js.map +1 -0
- package/dist/chunk-YCBUWK77.js +92 -0
- package/dist/chunk-YCBUWK77.js.map +1 -0
- package/dist/chunk-YJ4U2D2C.js +314 -0
- package/dist/chunk-YJ4U2D2C.js.map +1 -0
- package/dist/chunk-Z4YXAUDN.js +239 -0
- package/dist/chunk-Z4YXAUDN.js.map +1 -0
- package/dist/chunk-Z65DVDEQ.js +146 -0
- package/dist/chunk-Z65DVDEQ.js.map +1 -0
- package/dist/chunk-Z6EGP5D7.js +92 -0
- package/dist/chunk-Z6EGP5D7.js.map +1 -0
- package/dist/chunk-ZT4WMQW4.js +1575 -0
- package/dist/chunk-ZT4WMQW4.js.map +1 -0
- package/dist/chunk-ZVXXDWIB.js +1282 -0
- package/dist/chunk-ZVXXDWIB.js.map +1 -0
- package/dist/compat/index.cjs +3150 -6
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +116 -1
- package/dist/compat/index.d.ts +116 -1
- package/dist/compat/index.js +175 -2
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/jotai/index.cjs +130 -2
- package/dist/compat/jotai/index.cjs.map +1 -1
- package/dist/compat/jotai/index.d.cts +2 -1
- package/dist/compat/jotai/index.d.ts +2 -1
- package/dist/compat/jotai/index.js +7 -2
- package/dist/compat/jotai/index.js.map +1 -1
- package/dist/compat/nanostores/index.cjs +186 -2
- package/dist/compat/nanostores/index.cjs.map +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -1
- package/dist/compat/nanostores/index.d.ts +2 -1
- package/dist/compat/nanostores/index.js +21 -2
- package/dist/compat/nanostores/index.js.map +1 -1
- package/dist/compat/nestjs/index.cjs +2291 -6
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +10 -1
- package/dist/compat/nestjs/index.d.ts +10 -1
- package/dist/compat/nestjs/index.js +76 -2
- package/dist/compat/nestjs/index.js.map +1 -1
- package/dist/compat/react/index.cjs +95 -2
- package/dist/compat/react/index.cjs.map +1 -1
- package/dist/compat/react/index.d.cts +2 -1
- package/dist/compat/react/index.d.ts +2 -1
- package/dist/compat/react/index.js +11 -2
- package/dist/compat/react/index.js.map +1 -1
- package/dist/compat/solid/index.cjs +82 -2
- package/dist/compat/solid/index.cjs.map +1 -1
- package/dist/compat/solid/index.d.cts +2 -1
- package/dist/compat/solid/index.d.ts +2 -1
- package/dist/compat/solid/index.js +11 -2
- package/dist/compat/solid/index.js.map +1 -1
- package/dist/compat/svelte/index.cjs +85 -2
- package/dist/compat/svelte/index.cjs.map +1 -1
- package/dist/compat/svelte/index.d.cts +2 -1
- package/dist/compat/svelte/index.d.ts +2 -1
- package/dist/compat/svelte/index.js +11 -2
- package/dist/compat/svelte/index.js.map +1 -1
- package/dist/compat/vue/index.cjs +100 -2
- package/dist/compat/vue/index.cjs.map +1 -1
- package/dist/compat/vue/index.d.cts +3 -1
- package/dist/compat/vue/index.d.ts +3 -1
- package/dist/compat/vue/index.js +11 -2
- package/dist/compat/vue/index.js.map +1 -1
- package/dist/compat/zustand/index.cjs +50 -2
- package/dist/compat/zustand/index.cjs.map +1 -1
- package/dist/compat/zustand/index.d.cts +2 -1
- package/dist/compat/zustand/index.d.ts +2 -1
- package/dist/compat/zustand/index.js +7 -2
- package/dist/compat/zustand/index.js.map +1 -1
- package/dist/distill-De6Rnn15.d.cts +48 -0
- package/dist/distill-De6Rnn15.d.ts +48 -0
- package/dist/external-register-CWyroXb_.d.cts +138 -0
- package/dist/external-register-CWyroXb_.d.ts +138 -0
- package/dist/fallback-Bx46zqky.d.cts +243 -0
- package/dist/fallback-pIWW8A2d.d.ts +243 -0
- package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
- package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
- package/dist/index-B6pxYJzO.d.cts +36 -0
- package/dist/index-B6pxYJzO.d.ts +36 -0
- package/dist/index-BFsng6v1.d.cts +44 -0
- package/dist/index-BFsng6v1.d.ts +44 -0
- package/dist/index-B_p8tnvf.d.cts +770 -0
- package/dist/index-Bg-LwEt-.d.cts +45 -0
- package/dist/index-Bg-LwEt-.d.ts +45 -0
- package/dist/index-Brp888t0.d.cts +127 -0
- package/dist/index-Brp888t0.d.ts +127 -0
- package/dist/index-CDfk6jHN.d.cts +37 -0
- package/dist/index-CDfk6jHN.d.ts +37 -0
- package/dist/index-DLAxYaN5.d.cts +169 -0
- package/dist/index-DLAxYaN5.d.ts +169 -0
- package/dist/index-DeWbQzMe.d.cts +34 -0
- package/dist/index-DeWbQzMe.d.ts +34 -0
- package/dist/index-_HDSmPyp.d.ts +770 -0
- package/dist/index-dX9IzPqj.d.cts +86 -0
- package/dist/index-dX9IzPqj.d.ts +86 -0
- package/dist/index.cjs +26009 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -42
- package/dist/index.d.ts +55 -42
- package/dist/index.js +849 -0
- package/dist/index.js.map +1 -1
- package/dist/layout-types-B5aiHYgk.d.cts +72 -0
- package/dist/layout-types-B5aiHYgk.d.ts +72 -0
- package/dist/memory-composers-BryDrRBX.d.cts +529 -0
- package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
- package/dist/observable-B25XqCbZ.d.cts +59 -0
- package/dist/observable-B25XqCbZ.d.ts +59 -0
- package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
- package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
- package/dist/presets/ai/index.cjs +4377 -0
- package/dist/presets/ai/index.cjs.map +1 -0
- package/dist/presets/ai/index.d.cts +98 -0
- package/dist/presets/ai/index.d.ts +98 -0
- package/dist/presets/ai/index.js +54 -0
- package/dist/presets/ai/index.js.map +1 -0
- package/dist/presets/harness/index.cjs +5929 -0
- package/dist/presets/harness/index.cjs.map +1 -0
- package/dist/presets/harness/index.d.cts +566 -0
- package/dist/presets/harness/index.d.ts +566 -0
- package/dist/presets/harness/index.js +71 -0
- package/dist/presets/harness/index.js.map +1 -0
- package/dist/presets/index.cjs +9782 -0
- package/dist/presets/index.cjs.map +1 -0
- package/dist/presets/index.d.cts +28 -0
- package/dist/presets/index.d.ts +28 -0
- package/dist/presets/index.js +129 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/inspect/index.cjs +1087 -0
- package/dist/presets/inspect/index.cjs.map +1 -0
- package/dist/presets/inspect/index.d.cts +172 -0
- package/dist/presets/inspect/index.d.ts +172 -0
- package/dist/presets/inspect/index.js +21 -0
- package/dist/presets/inspect/index.js.map +1 -0
- package/dist/presets/resilience/index.cjs +1593 -0
- package/dist/presets/resilience/index.cjs.map +1 -0
- package/dist/presets/resilience/index.d.cts +205 -0
- package/dist/presets/resilience/index.d.ts +205 -0
- package/dist/presets/resilience/index.js +18 -0
- package/dist/presets/resilience/index.js.map +1 -0
- package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
- package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
- package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
- package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
- package/dist/retry-BDbRZ_gx.d.ts +125 -0
- package/dist/retry-DWuhjvsA.d.cts +125 -0
- package/dist/solutions/index.cjs +8200 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +23 -0
- package/dist/solutions/index.d.ts +23 -0
- package/dist/solutions/index.js +55 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/spawnable-5mDY501F.d.cts +746 -0
- package/dist/spawnable-D3lR0oQu.d.ts +746 -0
- package/dist/status-U-rUI79b.d.cts +84 -0
- package/dist/status-U-rUI79b.d.ts +84 -0
- package/dist/timeout-U5O4ESK3.js +12 -0
- package/dist/timeout-U5O4ESK3.js.map +1 -0
- package/dist/types-BB5Lw-pB.d.cts +442 -0
- package/dist/types-BB5Lw-pB.d.ts +442 -0
- package/dist/types-CJWIMJiZ.d.ts +548 -0
- package/dist/types-vCq7ShIm.d.cts +548 -0
- package/dist/utils/ai/browser.cjs +2169 -0
- package/dist/utils/ai/browser.cjs.map +1 -0
- package/dist/utils/ai/browser.d.cts +129 -0
- package/dist/utils/ai/browser.d.ts +129 -0
- package/dist/utils/ai/browser.js +255 -0
- package/dist/utils/ai/browser.js.map +1 -0
- package/dist/utils/ai/index.cjs +8468 -0
- package/dist/utils/ai/index.cjs.map +1 -0
- package/dist/utils/ai/index.d.cts +1777 -0
- package/dist/utils/ai/index.d.ts +1777 -0
- package/dist/utils/ai/index.js +173 -0
- package/dist/utils/ai/index.js.map +1 -0
- package/dist/utils/ai/node.cjs +648 -0
- package/dist/utils/ai/node.cjs.map +1 -0
- package/dist/utils/ai/node.d.cts +57 -0
- package/dist/utils/ai/node.d.ts +57 -0
- package/dist/utils/ai/node.js +84 -0
- package/dist/utils/ai/node.js.map +1 -0
- package/dist/utils/cqrs/index.cjs +1036 -0
- package/dist/utils/cqrs/index.cjs.map +1 -0
- package/dist/utils/cqrs/index.d.cts +438 -0
- package/dist/utils/cqrs/index.d.ts +438 -0
- package/dist/utils/cqrs/index.js +18 -0
- package/dist/utils/cqrs/index.js.map +1 -0
- package/dist/utils/demo-shell/index.cjs +865 -0
- package/dist/utils/demo-shell/index.cjs.map +1 -0
- package/dist/utils/demo-shell/index.d.cts +90 -0
- package/dist/utils/demo-shell/index.d.ts +90 -0
- package/dist/utils/demo-shell/index.js +13 -0
- package/dist/utils/demo-shell/index.js.map +1 -0
- package/dist/utils/domain-templates/index.cjs +732 -0
- package/dist/utils/domain-templates/index.cjs.map +1 -0
- package/dist/utils/domain-templates/index.d.cts +214 -0
- package/dist/utils/domain-templates/index.d.ts +214 -0
- package/dist/utils/domain-templates/index.js +17 -0
- package/dist/utils/domain-templates/index.js.map +1 -0
- package/dist/utils/graphspec/index.cjs +1174 -0
- package/dist/utils/graphspec/index.cjs.map +1 -0
- package/dist/utils/graphspec/index.d.cts +449 -0
- package/dist/utils/graphspec/index.d.ts +449 -0
- package/dist/utils/graphspec/index.js +35 -0
- package/dist/utils/graphspec/index.js.map +1 -0
- package/dist/utils/harness/index.cjs +656 -0
- package/dist/utils/harness/index.cjs.map +1 -0
- package/dist/utils/harness/index.d.cts +542 -0
- package/dist/utils/harness/index.d.ts +542 -0
- package/dist/utils/harness/index.js +56 -0
- package/dist/utils/harness/index.js.map +1 -0
- package/dist/utils/index.cjs +17614 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +96 -0
- package/dist/utils/index.d.ts +96 -0
- package/dist/utils/index.js +514 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/inspect/index.cjs +807 -0
- package/dist/utils/inspect/index.cjs.map +1 -0
- package/dist/utils/inspect/index.d.cts +123 -0
- package/dist/utils/inspect/index.d.ts +123 -0
- package/dist/utils/inspect/index.js +30 -0
- package/dist/utils/inspect/index.js.map +1 -0
- package/dist/utils/job-queue/index.cjs +717 -0
- package/dist/utils/job-queue/index.cjs.map +1 -0
- package/dist/utils/job-queue/index.d.cts +200 -0
- package/dist/utils/job-queue/index.d.ts +200 -0
- package/dist/utils/job-queue/index.js +18 -0
- package/dist/utils/job-queue/index.js.map +1 -0
- package/dist/utils/memory/index.cjs +1456 -0
- package/dist/utils/memory/index.cjs.map +1 -0
- package/dist/utils/memory/index.d.cts +660 -0
- package/dist/utils/memory/index.d.ts +660 -0
- package/dist/utils/memory/index.js +19 -0
- package/dist/utils/memory/index.js.map +1 -0
- package/dist/utils/messaging/index.cjs +666 -0
- package/dist/utils/messaging/index.cjs.map +1 -0
- package/dist/utils/messaging/index.d.cts +562 -0
- package/dist/utils/messaging/index.d.ts +562 -0
- package/dist/utils/messaging/index.js +50 -0
- package/dist/utils/messaging/index.js.map +1 -0
- package/dist/utils/orchestration/index.cjs +876 -0
- package/dist/utils/orchestration/index.cjs.map +1 -0
- package/dist/utils/orchestration/index.d.cts +233 -0
- package/dist/utils/orchestration/index.d.ts +233 -0
- package/dist/utils/orchestration/index.js +19 -0
- package/dist/utils/orchestration/index.js.map +1 -0
- package/dist/utils/process/index.cjs +743 -0
- package/dist/utils/process/index.cjs.map +1 -0
- package/dist/utils/process/index.d.cts +411 -0
- package/dist/utils/process/index.d.ts +411 -0
- package/dist/utils/process/index.js +14 -0
- package/dist/utils/process/index.js.map +1 -0
- package/dist/utils/reactive-layout/index.cjs +1607 -0
- package/dist/utils/reactive-layout/index.cjs.map +1 -0
- package/dist/utils/reactive-layout/index.d.cts +492 -0
- package/dist/utils/reactive-layout/index.d.ts +492 -0
- package/dist/utils/reactive-layout/index.js +52 -0
- package/dist/utils/reactive-layout/index.js.map +1 -0
- package/dist/utils/reduction/index.cjs +203 -0
- package/dist/utils/reduction/index.cjs.map +1 -0
- package/dist/utils/reduction/index.d.cts +102 -0
- package/dist/utils/reduction/index.d.ts +102 -0
- package/dist/utils/reduction/index.js +14 -0
- package/dist/utils/reduction/index.js.map +1 -0
- package/dist/utils/resilience/index.cjs +1617 -0
- package/dist/utils/resilience/index.cjs.map +1 -0
- package/dist/utils/resilience/index.d.cts +9 -0
- package/dist/utils/resilience/index.d.ts +9 -0
- package/dist/utils/resilience/index.js +44 -0
- package/dist/utils/resilience/index.js.map +1 -0
- package/dist/utils/surface/index.cjs +1070 -0
- package/dist/utils/surface/index.cjs.map +1 -0
- package/dist/utils/surface/index.d.cts +240 -0
- package/dist/utils/surface/index.d.ts +240 -0
- package/dist/utils/surface/index.js +30 -0
- package/dist/utils/surface/index.js.map +1 -0
- package/dist/utils/topology-view/index.cjs +620 -0
- package/dist/utils/topology-view/index.cjs.map +1 -0
- package/dist/utils/topology-view/index.d.cts +68 -0
- package/dist/utils/topology-view/index.d.ts +68 -0
- package/dist/utils/topology-view/index.js +11 -0
- package/dist/utils/topology-view/index.js.map +1 -0
- package/package.json +293 -241
- package/dist/core/index.cjs +0 -21
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/extra/browser.cjs +0 -21
- package/dist/extra/browser.cjs.map +0 -1
- package/dist/extra/browser.d.cts +0 -1
- package/dist/extra/browser.d.ts +0 -1
- package/dist/extra/browser.js +0 -3
- package/dist/extra/browser.js.map +0 -1
- package/dist/extra/index.cjs +0 -21
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.d.cts +0 -1
- package/dist/extra/index.d.ts +0 -1
- package/dist/extra/index.js +0 -3
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/node.cjs +0 -21
- package/dist/extra/node.cjs.map +0 -1
- package/dist/extra/node.d.cts +0 -1
- package/dist/extra/node.d.ts +0 -1
- package/dist/extra/node.js +0 -3
- package/dist/extra/node.js.map +0 -1
- package/dist/extra/operators.cjs +0 -21
- package/dist/extra/operators.cjs.map +0 -1
- package/dist/extra/operators.d.cts +0 -1
- package/dist/extra/operators.d.ts +0 -1
- package/dist/extra/operators.js +0 -3
- package/dist/extra/operators.js.map +0 -1
- package/dist/extra/reactive.cjs +0 -21
- package/dist/extra/reactive.cjs.map +0 -1
- package/dist/extra/reactive.d.cts +0 -1
- package/dist/extra/reactive.d.ts +0 -1
- package/dist/extra/reactive.js +0 -3
- package/dist/extra/reactive.js.map +0 -1
- package/dist/extra/render/index.cjs +0 -21
- package/dist/extra/render/index.cjs.map +0 -1
- package/dist/extra/render/index.d.cts +0 -1
- package/dist/extra/render/index.d.ts +0 -1
- package/dist/extra/render/index.js +0 -3
- package/dist/extra/render/index.js.map +0 -1
- package/dist/extra/sources.cjs +0 -21
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.d.cts +0 -1
- package/dist/extra/sources.d.ts +0 -1
- package/dist/extra/sources.js +0 -3
- package/dist/extra/sources.js.map +0 -1
- package/dist/extra/storage-browser.cjs +0 -21
- package/dist/extra/storage-browser.cjs.map +0 -1
- package/dist/extra/storage-browser.d.cts +0 -1
- package/dist/extra/storage-browser.d.ts +0 -1
- package/dist/extra/storage-browser.js +0 -3
- package/dist/extra/storage-browser.js.map +0 -1
- package/dist/extra/storage-core.cjs +0 -21
- package/dist/extra/storage-core.cjs.map +0 -1
- package/dist/extra/storage-core.d.cts +0 -1
- package/dist/extra/storage-core.d.ts +0 -1
- package/dist/extra/storage-core.js +0 -3
- package/dist/extra/storage-core.js.map +0 -1
- package/dist/extra/storage-node.cjs +0 -21
- package/dist/extra/storage-node.cjs.map +0 -1
- package/dist/extra/storage-node.d.cts +0 -1
- package/dist/extra/storage-node.d.ts +0 -1
- package/dist/extra/storage-node.js +0 -3
- package/dist/extra/storage-node.js.map +0 -1
- package/dist/extra/storage-tiers-browser.cjs +0 -21
- package/dist/extra/storage-tiers-browser.cjs.map +0 -1
- package/dist/extra/storage-tiers-browser.d.cts +0 -1
- package/dist/extra/storage-tiers-browser.d.ts +0 -1
- package/dist/extra/storage-tiers-browser.js +0 -3
- package/dist/extra/storage-tiers-browser.js.map +0 -1
- package/dist/extra/storage-tiers-node.cjs +0 -21
- package/dist/extra/storage-tiers-node.cjs.map +0 -1
- package/dist/extra/storage-tiers-node.d.cts +0 -1
- package/dist/extra/storage-tiers-node.d.ts +0 -1
- package/dist/extra/storage-tiers-node.js +0 -3
- package/dist/extra/storage-tiers-node.js.map +0 -1
- package/dist/extra/storage-tiers.cjs +0 -21
- package/dist/extra/storage-tiers.cjs.map +0 -1
- package/dist/extra/storage-tiers.d.cts +0 -1
- package/dist/extra/storage-tiers.d.ts +0 -1
- package/dist/extra/storage-tiers.js +0 -3
- package/dist/extra/storage-tiers.js.map +0 -1
- package/dist/extra/storage-wal.cjs +0 -21
- package/dist/extra/storage-wal.cjs.map +0 -1
- package/dist/extra/storage-wal.d.cts +0 -1
- package/dist/extra/storage-wal.d.ts +0 -1
- package/dist/extra/storage-wal.js +0 -3
- package/dist/extra/storage-wal.js.map +0 -1
- package/dist/graph/index.cjs +0 -21
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.d.cts +0 -1
- package/dist/graph/index.d.ts +0 -1
- package/dist/graph/index.js +0 -3
- package/dist/graph/index.js.map +0 -1
- package/dist/patterns/ai/browser.cjs +0 -21
- package/dist/patterns/ai/browser.cjs.map +0 -1
- package/dist/patterns/ai/browser.d.cts +0 -1
- package/dist/patterns/ai/browser.d.ts +0 -1
- package/dist/patterns/ai/browser.js +0 -3
- package/dist/patterns/ai/browser.js.map +0 -1
- package/dist/patterns/ai/index.cjs +0 -21
- package/dist/patterns/ai/index.cjs.map +0 -1
- package/dist/patterns/ai/index.d.cts +0 -1
- package/dist/patterns/ai/index.d.ts +0 -1
- package/dist/patterns/ai/index.js +0 -3
- package/dist/patterns/ai/index.js.map +0 -1
- package/dist/patterns/ai/node.cjs +0 -21
- package/dist/patterns/ai/node.cjs.map +0 -1
- package/dist/patterns/ai/node.d.cts +0 -1
- package/dist/patterns/ai/node.d.ts +0 -1
- package/dist/patterns/ai/node.js +0 -3
- package/dist/patterns/ai/node.js.map +0 -1
- package/dist/patterns/cqrs/index.cjs +0 -21
- package/dist/patterns/cqrs/index.cjs.map +0 -1
- package/dist/patterns/cqrs/index.d.cts +0 -1
- package/dist/patterns/cqrs/index.d.ts +0 -1
- package/dist/patterns/cqrs/index.js +0 -3
- package/dist/patterns/cqrs/index.js.map +0 -1
- package/dist/patterns/demo-shell/index.cjs +0 -21
- package/dist/patterns/demo-shell/index.cjs.map +0 -1
- package/dist/patterns/demo-shell/index.d.cts +0 -1
- package/dist/patterns/demo-shell/index.d.ts +0 -1
- package/dist/patterns/demo-shell/index.js +0 -3
- package/dist/patterns/demo-shell/index.js.map +0 -1
- package/dist/patterns/domain-templates/index.cjs +0 -21
- package/dist/patterns/domain-templates/index.cjs.map +0 -1
- package/dist/patterns/domain-templates/index.d.cts +0 -1
- package/dist/patterns/domain-templates/index.d.ts +0 -1
- package/dist/patterns/domain-templates/index.js +0 -3
- package/dist/patterns/domain-templates/index.js.map +0 -1
- package/dist/patterns/graphspec/index.cjs +0 -21
- package/dist/patterns/graphspec/index.cjs.map +0 -1
- package/dist/patterns/graphspec/index.d.cts +0 -1
- package/dist/patterns/graphspec/index.d.ts +0 -1
- package/dist/patterns/graphspec/index.js +0 -3
- package/dist/patterns/graphspec/index.js.map +0 -1
- package/dist/patterns/harness/index.cjs +0 -21
- package/dist/patterns/harness/index.cjs.map +0 -1
- package/dist/patterns/harness/index.d.cts +0 -1
- package/dist/patterns/harness/index.d.ts +0 -1
- package/dist/patterns/harness/index.js +0 -3
- package/dist/patterns/harness/index.js.map +0 -1
- package/dist/patterns/inspect/index.cjs +0 -21
- package/dist/patterns/inspect/index.cjs.map +0 -1
- package/dist/patterns/inspect/index.d.cts +0 -1
- package/dist/patterns/inspect/index.d.ts +0 -1
- package/dist/patterns/inspect/index.js +0 -3
- package/dist/patterns/inspect/index.js.map +0 -1
- package/dist/patterns/job-queue/index.cjs +0 -21
- package/dist/patterns/job-queue/index.cjs.map +0 -1
- package/dist/patterns/job-queue/index.d.cts +0 -1
- package/dist/patterns/job-queue/index.d.ts +0 -1
- package/dist/patterns/job-queue/index.js +0 -3
- package/dist/patterns/job-queue/index.js.map +0 -1
- package/dist/patterns/memory/index.cjs +0 -21
- package/dist/patterns/memory/index.cjs.map +0 -1
- package/dist/patterns/memory/index.d.cts +0 -1
- package/dist/patterns/memory/index.d.ts +0 -1
- package/dist/patterns/memory/index.js +0 -3
- package/dist/patterns/memory/index.js.map +0 -1
- package/dist/patterns/messaging/index.cjs +0 -21
- package/dist/patterns/messaging/index.cjs.map +0 -1
- package/dist/patterns/messaging/index.d.cts +0 -1
- package/dist/patterns/messaging/index.d.ts +0 -1
- package/dist/patterns/messaging/index.js +0 -3
- package/dist/patterns/messaging/index.js.map +0 -1
- package/dist/patterns/orchestration/index.cjs +0 -21
- package/dist/patterns/orchestration/index.cjs.map +0 -1
- package/dist/patterns/orchestration/index.d.cts +0 -1
- package/dist/patterns/orchestration/index.d.ts +0 -1
- package/dist/patterns/orchestration/index.js +0 -3
- package/dist/patterns/orchestration/index.js.map +0 -1
- package/dist/patterns/process/index.cjs +0 -21
- package/dist/patterns/process/index.cjs.map +0 -1
- package/dist/patterns/process/index.d.cts +0 -1
- package/dist/patterns/process/index.d.ts +0 -1
- package/dist/patterns/process/index.js +0 -3
- package/dist/patterns/process/index.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs +0 -21
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.d.cts +0 -1
- package/dist/patterns/reactive-layout/index.d.ts +0 -1
- package/dist/patterns/reactive-layout/index.js +0 -3
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/patterns/reduction/index.cjs +0 -21
- package/dist/patterns/reduction/index.cjs.map +0 -1
- package/dist/patterns/reduction/index.d.cts +0 -1
- package/dist/patterns/reduction/index.d.ts +0 -1
- package/dist/patterns/reduction/index.js +0 -3
- package/dist/patterns/reduction/index.js.map +0 -1
- package/dist/patterns/surface/index.cjs +0 -21
- package/dist/patterns/surface/index.cjs.map +0 -1
- package/dist/patterns/surface/index.d.cts +0 -1
- package/dist/patterns/surface/index.d.ts +0 -1
- package/dist/patterns/surface/index.js +0 -3
- package/dist/patterns/surface/index.js.map +0 -1
- package/dist/patterns/topology-view/index.cjs +0 -21
- package/dist/patterns/topology-view/index.cjs.map +0 -1
- package/dist/patterns/topology-view/index.d.cts +0 -1
- package/dist/patterns/topology-view/index.d.ts +0 -1
- package/dist/patterns/topology-view/index.js +0 -3
- package/dist/patterns/topology-view/index.js.map +0 -1
- package/dist/testing/index.cjs +0 -21
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -3
- package/dist/testing/index.js.map +0 -1
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import { Node } from '@graphrefly/pure-ts/core';
|
|
2
|
+
import { NodeInput } from '@graphrefly/pure-ts/extra';
|
|
3
|
+
import { GraphOptions, Graph } from '@graphrefly/pure-ts/graph';
|
|
4
|
+
import { TopicGraph, MessagingHubGraph, TopicMessage } from './utils/messaging/index.cjs';
|
|
5
|
+
import { L as LLMAdapter, c as LLMResponse } from './types-BB5Lw-pB.cjs';
|
|
6
|
+
import { G as GateController } from './pipeline-graph-Ce47CB6Y.cjs';
|
|
7
|
+
import { e as HarnessJobPayload, k as QueueRoute, p as TriagedItem, n as StrategyModelGraph, I as IntakeItem, r as VerifyResult, c as ExecutePromptFn, H as HarnessExecutor, q as VerifyPromptFn, g as HarnessVerifier, f as HarnessLoopOptions } from './types-vCq7ShIm.cjs';
|
|
8
|
+
import { JobFlowGraph, JobQueueGraph } from './utils/job-queue/index.cjs';
|
|
9
|
+
import { A as AgentBundle, P as PresetRegistryBundle, g as AgentSpec } from './agents-C0Ji9ldU.cjs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* refineLoop — universal prompt/artifact optimization loop as a reactive Graph.
|
|
13
|
+
*
|
|
14
|
+
* Roadmap §9.8 (Wave 2.5). The loop is a 4-topic reactive pipeline:
|
|
15
|
+
*
|
|
16
|
+
* iterationTrigger ──▶ GENERATE ──▶ EVALUATE ──▶ ANALYZE ──▶ DECIDE
|
|
17
|
+
* │ │
|
|
18
|
+
* └─────── feedback + trigger ◀─────┘
|
|
19
|
+
*
|
|
20
|
+
* Each stage is a `TopicGraph` so dispatches stay O(1) per subscriber (cursor-
|
|
21
|
+
* based) and every iteration is observable, replayable, and checkpointable.
|
|
22
|
+
*
|
|
23
|
+
* Composition invariants (from COMPOSITION-GUIDE):
|
|
24
|
+
* - §7 feedback cycle: only `iterationTrigger` drives re-generation. Strategy
|
|
25
|
+
* + feedback + dataset are read via closure updaters (§28 factory-time seed)
|
|
26
|
+
* so mid-run swaps apply to the NEXT iteration, never retrigger the current.
|
|
27
|
+
* - §28 factory-time seed: strategy, lastFeedback, prevCandidates, dataset
|
|
28
|
+
* closures captured at wiring time + updated via subscribe handlers so the
|
|
29
|
+
* first activation doesn't drop the initial pair.
|
|
30
|
+
* - §32 nested-drain state-mirror: the decide-effect writes `lastFeedback`
|
|
31
|
+
* BEFORE bumping `iterationTrigger` inside its `batch()`, guaranteeing the
|
|
32
|
+
* mirror is current when the next-iteration wave reaches the generate fn.
|
|
33
|
+
* - §19 terminal-emission: history / best emit once per iteration (settled),
|
|
34
|
+
* not on every intermediate wave.
|
|
35
|
+
* - §27 attachSnapshotStorage: the whole graph is checkpointable — pause overnight,
|
|
36
|
+
* resume tomorrow from the exact iteration count, candidate set, strategy.
|
|
37
|
+
*
|
|
38
|
+
* Scope clamp (v1): core factory + `RefineStrategy<T>` + `blindVariation` and
|
|
39
|
+
* `errorCritique` built-ins + budget gating + checkpoint/resume.
|
|
40
|
+
* `mutateAndRefine` / registry / `autoSelectStrategy` / `optimizeCatalog` /
|
|
41
|
+
* `refineExecutor` are deferred.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/** A single task row — the unit the evaluator scores one candidate against. */
|
|
47
|
+
interface DatasetItem {
|
|
48
|
+
readonly id: string;
|
|
49
|
+
readonly [k: string]: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One candidate's score on one task. Higher is better by convention.
|
|
53
|
+
*
|
|
54
|
+
* Set `candidateIndex` when the evaluator fans out scores across multiple
|
|
55
|
+
* candidates (e.g. `candidates × tasks`). `pickBest` aggregates mean scores
|
|
56
|
+
* per `candidateIndex` when present; when absent, falls back to positional
|
|
57
|
+
* alignment (`scores[i]` ↔ `candidates[i]`).
|
|
58
|
+
*/
|
|
59
|
+
interface EvalResult {
|
|
60
|
+
readonly taskId: string;
|
|
61
|
+
readonly score: number;
|
|
62
|
+
readonly error?: string;
|
|
63
|
+
readonly detail?: unknown;
|
|
64
|
+
/** 0-based index into the `candidates` batch this score belongs to. */
|
|
65
|
+
readonly candidateIndex?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Aggregated feedback the strategy produces from a scores batch. */
|
|
68
|
+
interface Feedback {
|
|
69
|
+
readonly summary: string;
|
|
70
|
+
readonly critique?: unknown;
|
|
71
|
+
readonly weakTasks?: readonly string[];
|
|
72
|
+
readonly score: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Strategy interface — plain object, no base class. Strategies implement three
|
|
76
|
+
* pure hooks; the loop infrastructure wraps them in reactive nodes so every
|
|
77
|
+
* decision is visible in `describe()`.
|
|
78
|
+
*
|
|
79
|
+
* `generate` may be sync or async. Async generates yield a microtask per
|
|
80
|
+
* iteration — that's what gives `pause()` / `setStrategy()` a window to
|
|
81
|
+
* interleave. **A fully synchronous `generate` will drain the entire loop
|
|
82
|
+
* during factory activation** (all iterations run before `refineLoop()`
|
|
83
|
+
* returns), which is usually not what you want for observable, steerable
|
|
84
|
+
* loops. Real strategies that call LLMs / evals are async and Just Work;
|
|
85
|
+
* custom sync strategies for tests are fine but should be marked `async`
|
|
86
|
+
* to match real cadence.
|
|
87
|
+
*/
|
|
88
|
+
interface RefineStrategy<T> {
|
|
89
|
+
readonly name: string;
|
|
90
|
+
/** Produce initial candidates from the seed. Called at iteration 0. */
|
|
91
|
+
seed(seed: T): readonly T[];
|
|
92
|
+
/** Reduce scores to feedback. Pure function. */
|
|
93
|
+
analyze(scores: readonly EvalResult[], candidates: readonly T[]): Feedback;
|
|
94
|
+
/**
|
|
95
|
+
* Generate next-iteration candidates from feedback + prior candidates.
|
|
96
|
+
* Async allowed — the loop awaits via `fromAny`.
|
|
97
|
+
*/
|
|
98
|
+
generate(feedback: Feedback, candidates: readonly T[]): Promise<readonly T[]> | readonly T[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Evaluator shape — Shape 4 (2026-04-22): both `candidates` and `dataset` are
|
|
102
|
+
* reactive nodes; the evaluator's returned node IS the EVALUATE topic's source
|
|
103
|
+
* (no glue). Implementers can batch-eval (e.g. `funnel` with concurrency) or
|
|
104
|
+
* map per-candidate — user's code.
|
|
105
|
+
*
|
|
106
|
+
* **Cancel-on-input contract (load-bearing).** Evaluators with async work
|
|
107
|
+
* (LLM calls, network requests, etc.) MUST cancel any in-flight work when
|
|
108
|
+
* `candidates` emits a new batch. The canonical pattern is `switchMap` over
|
|
109
|
+
* `candidates`. If an evaluator does NOT cancel — e.g. naively kicks a
|
|
110
|
+
* `Promise.all` per-batch and emits whatever resolves — late scores from a
|
|
111
|
+
* prior iteration can arrive after the loop has already moved to the next
|
|
112
|
+
* iteration (especially after `pause()` / `resume()`). Such stale scores
|
|
113
|
+
* trip {@link refineLoop}'s `feedbackEnvelopeNode` with mismatched
|
|
114
|
+
* `iter`/`scores`/`items`, producing an incorrect `DecideEvent` and (worse)
|
|
115
|
+
* marking the iter as decided so the real iter's scores get skipped by
|
|
116
|
+
* de-dup, stalling the loop. See `optimizations.md` "refineLoop async-
|
|
117
|
+
* evaluator stale-scores follow-up" for the proposed `wrapEvaluator()`
|
|
118
|
+
* helper that would enforce cancellation.
|
|
119
|
+
*
|
|
120
|
+
* **`EvalResult.candidateIndex` semantics.** Optional per-result field.
|
|
121
|
+
* When present, multi-candidate aggregators ({@link errorCritique}'s
|
|
122
|
+
* `pickBest`) score per index, picking the candidate with the highest
|
|
123
|
+
* mean score. When absent across all results, those aggregators fall back
|
|
124
|
+
* to positional matching against `candidates[0]` — meaning a strategy that
|
|
125
|
+
* generates >1 candidate but emits unindexed scores effectively only ever
|
|
126
|
+
* critiques the first candidate. Set `candidateIndex` whenever the
|
|
127
|
+
* evaluator's score corresponds to a specific candidate in the batch.
|
|
128
|
+
*/
|
|
129
|
+
type Evaluator<T> = (candidates: Node<readonly T[]>, dataset: Node<readonly DatasetItem[]>) => Node<readonly EvalResult[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Early-stop controls. Each field fans into its own derived node; the four
|
|
132
|
+
* combine via `||` into `converged: Node<boolean>`. Callers see exactly
|
|
133
|
+
* which rule tripped via `status` / the DECIDE topic's `reason`.
|
|
134
|
+
*/
|
|
135
|
+
interface ConvergenceOptions {
|
|
136
|
+
/** Stop when aggregate score has not improved for N iterations. */
|
|
137
|
+
patience?: number;
|
|
138
|
+
/** Stop when aggregate score reaches or exceeds this. */
|
|
139
|
+
minScore?: number;
|
|
140
|
+
/** Stop when absolute delta between consecutive scores falls below this. */
|
|
141
|
+
minDelta?: number;
|
|
142
|
+
/** Stop after N total evaluations (iteration count × per-iter candidates). */
|
|
143
|
+
maxEvaluations?: number;
|
|
144
|
+
/** Stop after N iterations. Always set a finite bound in production. */
|
|
145
|
+
maxIterations?: number;
|
|
146
|
+
}
|
|
147
|
+
/** Emitted to the GENERATE topic each time the strategy produces a batch. */
|
|
148
|
+
interface GenerateEvent<T> {
|
|
149
|
+
readonly iteration: number;
|
|
150
|
+
readonly candidates: readonly T[];
|
|
151
|
+
readonly timestamp_ns: number;
|
|
152
|
+
}
|
|
153
|
+
/** Emitted to the EVALUATE topic when scores settle for an iteration. */
|
|
154
|
+
interface EvaluateEvent<T> {
|
|
155
|
+
readonly iteration: number;
|
|
156
|
+
readonly candidates: readonly T[];
|
|
157
|
+
readonly scores: readonly EvalResult[];
|
|
158
|
+
readonly timestamp_ns: number;
|
|
159
|
+
}
|
|
160
|
+
/** Emitted to the ANALYZE topic — strategy's reduction over scores. */
|
|
161
|
+
interface AnalyzeEvent<T> {
|
|
162
|
+
readonly iteration: number;
|
|
163
|
+
readonly candidates: readonly T[];
|
|
164
|
+
readonly feedback: Feedback;
|
|
165
|
+
readonly timestamp_ns: number;
|
|
166
|
+
}
|
|
167
|
+
/** Emitted to the DECIDE topic — branch taken this iteration. */
|
|
168
|
+
interface DecideEvent {
|
|
169
|
+
readonly iteration: number;
|
|
170
|
+
readonly decision: "continue" | "converged" | "budget" | "paused";
|
|
171
|
+
readonly reason?: string;
|
|
172
|
+
readonly timestamp_ns: number;
|
|
173
|
+
}
|
|
174
|
+
type RefineStatus = "running" | "converged" | "budget" | "paused" | "errored";
|
|
175
|
+
interface Iteration<T> {
|
|
176
|
+
readonly n: number;
|
|
177
|
+
readonly candidates: readonly T[];
|
|
178
|
+
readonly scores: readonly EvalResult[];
|
|
179
|
+
readonly feedback: Feedback;
|
|
180
|
+
/** `null` iff the candidate batch for this iteration was empty. */
|
|
181
|
+
readonly best: T | null;
|
|
182
|
+
readonly bestScore: number;
|
|
183
|
+
readonly timestamp_ns: number;
|
|
184
|
+
}
|
|
185
|
+
interface RefineLoopOptions extends ConvergenceOptions {
|
|
186
|
+
/** Reactive dataset OR a plain array (auto-wrapped into `state`). */
|
|
187
|
+
dataset: NodeInput<readonly DatasetItem[]> | readonly DatasetItem[];
|
|
188
|
+
/** Total teacher calls cap across iterations. Default: unlimited. */
|
|
189
|
+
budget?: number;
|
|
190
|
+
/** Graph name. Default: `"refine-loop"`. */
|
|
191
|
+
name?: string;
|
|
192
|
+
/** Extra graph options forwarded to the underlying `Graph`. */
|
|
193
|
+
graph?: GraphOptions;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* `class RefineLoopGraph<T> extends Graph` — the universal prompt/artifact
|
|
197
|
+
* optimization loop as a reactive Graph subclass.
|
|
198
|
+
*
|
|
199
|
+
* Constructed via the {@link refineLoop} factory in normal use; exported as a
|
|
200
|
+
* class so consumers can `instanceof`-narrow on returned values (Phase 13.G
|
|
201
|
+
* `agent(spec)` is the consumer that motivated the migration). All
|
|
202
|
+
* observability tools (`describe`, `explain`, `observe`, `attachSnapshotStorage`,
|
|
203
|
+
* `snapshot`) Just Work since this `extends Graph`.
|
|
204
|
+
*
|
|
205
|
+
* **Phase 12.D (2026-04-30):** Migrated from `Object.assign(graph, ...)` factory
|
|
206
|
+
* pattern to `class extends Graph` (Tier R5.1 deferral lifted; mirrors the
|
|
207
|
+
* `MemoryWith*Graph` precedent). `setStrategy` / `pause` / `resume` are now
|
|
208
|
+
* instance methods that read `this.strategy` / `this._pauseState` / `this.status`
|
|
209
|
+
* / `this._iteration` instead of factory-local closures.
|
|
210
|
+
*/
|
|
211
|
+
declare class RefineLoopGraph<T> extends Graph {
|
|
212
|
+
readonly best: Node<T | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Best score so far. Pseudo-private (`_score`) to avoid colliding with any
|
|
215
|
+
* future `Graph.prototype.score` method (B5d forward-compat hazard
|
|
216
|
+
* prevention). Typed-public — read via `loop._score.cache` /
|
|
217
|
+
* `loop._score.subscribe(...)` from external code.
|
|
218
|
+
*/
|
|
219
|
+
readonly _score: Node<number>;
|
|
220
|
+
readonly status: Node<RefineStatus>;
|
|
221
|
+
readonly history: Node<readonly Iteration<T>[]>;
|
|
222
|
+
readonly strategy: Node<RefineStrategy<T>>;
|
|
223
|
+
/**
|
|
224
|
+
* Monotonic iteration counter. Pseudo-private (`_iteration`) to avoid
|
|
225
|
+
* colliding with any future `Graph.prototype.iteration` method (B5d
|
|
226
|
+
* forward-compat hazard prevention). Typed-public — read via
|
|
227
|
+
* `loop._iteration.cache` / `loop._iteration.subscribe(...)`.
|
|
228
|
+
*/
|
|
229
|
+
readonly _iteration: Node<number>;
|
|
230
|
+
/** Stage topic — subscribe for per-stage streaming / cursor consumers. */
|
|
231
|
+
readonly generate: TopicGraph<GenerateEvent<T>>;
|
|
232
|
+
/** Stage topic — subscribe for per-stage streaming / cursor consumers. */
|
|
233
|
+
readonly evaluate: TopicGraph<EvaluateEvent<T>>;
|
|
234
|
+
/** Stage topic — subscribe for per-stage streaming / cursor consumers. */
|
|
235
|
+
readonly analyze: TopicGraph<AnalyzeEvent<T>>;
|
|
236
|
+
/** Stage topic — subscribe for per-stage streaming / cursor consumers. */
|
|
237
|
+
readonly decide: TopicGraph<DecideEvent>;
|
|
238
|
+
/** Internal: paused-flag node. Mounted as "paused" in describe(). */
|
|
239
|
+
private readonly _pauseState;
|
|
240
|
+
constructor(seed: T, evaluator: Evaluator<T>, initialStrategy: RefineStrategy<T>, opts: RefineLoopOptions);
|
|
241
|
+
/** Swap the active strategy mid-run (human-in-the-loop handoff). */
|
|
242
|
+
setStrategy(next: RefineStrategy<T>): void;
|
|
243
|
+
/** Pause after the current iteration completes. */
|
|
244
|
+
pause(): void;
|
|
245
|
+
/**
|
|
246
|
+
* Resume a paused loop. Idempotent: only un-pauses from the "paused"
|
|
247
|
+
* terminal state. Converged / budget / errored are permanent — a user
|
|
248
|
+
* wanting to start over should construct a fresh refineLoop.
|
|
249
|
+
*/
|
|
250
|
+
resume(): void;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Construct a {@link RefineLoopGraph} — the universal prompt/artifact
|
|
254
|
+
* optimization loop. Thin wrapper over `new RefineLoopGraph(...)` for
|
|
255
|
+
* call-site ergonomics.
|
|
256
|
+
*/
|
|
257
|
+
declare function refineLoop<T>(seed: T, evaluator: Evaluator<T>, initialStrategy: RefineStrategy<T>, opts: RefineLoopOptions): RefineLoopGraph<T>;
|
|
258
|
+
/**
|
|
259
|
+
* Context passed to a `blindVariation` teacher per call. `reportCost` is a
|
|
260
|
+
* per-call hook — see `BlindVariationOptions.tokens`.
|
|
261
|
+
*/
|
|
262
|
+
interface BlindVariationContext<T> {
|
|
263
|
+
readonly prior: T;
|
|
264
|
+
/**
|
|
265
|
+
* Report tokens consumed by this teacher call. Aggregated per iteration
|
|
266
|
+
* and flushed to `opts.tokens` in the strategy's `finally` block so
|
|
267
|
+
* partial spend is preserved when the teacher throws mid-batch.
|
|
268
|
+
*/
|
|
269
|
+
readonly reportCost: (tokens: number) => void;
|
|
270
|
+
}
|
|
271
|
+
interface BlindVariationOptions<T> {
|
|
272
|
+
/** Name — default: `"blindVariation"`. */
|
|
273
|
+
name?: string;
|
|
274
|
+
/** Number of candidates generated per iteration. Default: 4. */
|
|
275
|
+
width?: number;
|
|
276
|
+
/**
|
|
277
|
+
* Run teacher calls in parallel via `Promise.all`. Default `true` — the
|
|
278
|
+
* common case (independent LLM calls). Set `false` to run sequentially
|
|
279
|
+
* via `for/await` when teachers share stateful resources (rate limiters,
|
|
280
|
+
* rolling context, serial API ordering) that don't tolerate concurrency.
|
|
281
|
+
*/
|
|
282
|
+
parallel?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Optional cost counter node. Running total tokens reported via
|
|
285
|
+
* `ctx.reportCost` during each iteration is added to this node in the
|
|
286
|
+
* strategy's `finally` block — fires on success AND on teacher throw so
|
|
287
|
+
* partial spend is never lost. User owns the node; wire to `budgetGate`,
|
|
288
|
+
* `attachSnapshotStorage`, telemetry, etc.
|
|
289
|
+
*/
|
|
290
|
+
tokens?: Node<number>;
|
|
291
|
+
/**
|
|
292
|
+
* Teacher — given `{prior, reportCost}`, produce one variant. Async
|
|
293
|
+
* allowed. Called `width` times per iteration. Call `ctx.reportCost(n)`
|
|
294
|
+
* to track tokens consumed per call (optional, no-op if `opts.tokens`
|
|
295
|
+
* is not set).
|
|
296
|
+
*/
|
|
297
|
+
teacher: (ctx: BlindVariationContext<T>) => Promise<T> | T;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Simplest built-in strategy: generate N variants per iteration via the
|
|
301
|
+
* supplied `teacher`; no feedback-informed steering (equivalent to Random
|
|
302
|
+
* Search). Validates the loop infrastructure end-to-end and is the baseline
|
|
303
|
+
* every other strategy should outperform.
|
|
304
|
+
*
|
|
305
|
+
* `analyze` records the mean score and flags the worst task — strategies that
|
|
306
|
+
* care about per-task critique layer on top.
|
|
307
|
+
*/
|
|
308
|
+
declare function blindVariation<T>(opts: BlindVariationOptions<T>): RefineStrategy<T>;
|
|
309
|
+
/**
|
|
310
|
+
* Context passed to an `errorCritique` teacher. `critique` is the pre-formatted
|
|
311
|
+
* summary a prompt template can drop in verbatim; `failures` carries the
|
|
312
|
+
* structured evidence (per-task error / score / detail) for richer prompts.
|
|
313
|
+
*/
|
|
314
|
+
interface ErrorCritiqueContext<T> {
|
|
315
|
+
readonly prior: T;
|
|
316
|
+
readonly critique: string;
|
|
317
|
+
readonly failures: readonly EvalResult[];
|
|
318
|
+
/**
|
|
319
|
+
* Report tokens consumed by this teacher call. Aggregated per iteration
|
|
320
|
+
* and flushed to `opts.tokens` in the strategy's `finally` block so
|
|
321
|
+
* partial spend is preserved when the teacher throws mid-batch.
|
|
322
|
+
*/
|
|
323
|
+
readonly reportCost: (tokens: number) => void;
|
|
324
|
+
}
|
|
325
|
+
interface ErrorCritiqueOptions<T> {
|
|
326
|
+
/** Name — default: `"errorCritique"`. */
|
|
327
|
+
name?: string;
|
|
328
|
+
/** Number of candidates generated per iteration. Default: 4. */
|
|
329
|
+
width?: number;
|
|
330
|
+
/**
|
|
331
|
+
* Cut-off below which a task is classified as a failure and fed into the
|
|
332
|
+
* critique. Default: the batch mean — any task scoring below the batch
|
|
333
|
+
* mean is a failure. Pass a number for an absolute cut-off, or a function
|
|
334
|
+
* for per-batch computation (e.g. a percentile). When the default mean
|
|
335
|
+
* is non-finite (NaN / ±Infinity from a degenerate evaluator), ALL scores
|
|
336
|
+
* are treated as failures so the critique loop continues to steer.
|
|
337
|
+
*/
|
|
338
|
+
failureThreshold?: number | ((scores: readonly EvalResult[]) => number);
|
|
339
|
+
/** Cap on failure samples packed into the critique. Default: 5. */
|
|
340
|
+
maxFailureSamples?: number;
|
|
341
|
+
/**
|
|
342
|
+
* Format failures into the `critique` string passed to the teacher. Default
|
|
343
|
+
* joins `- taskId (score=N) | error: …` lines. Override to shape LLM prompts.
|
|
344
|
+
*
|
|
345
|
+
* **Note:** the `feedback` argument is a shell with `{score, weakTasks}`
|
|
346
|
+
* populated; `summary` is empty because `analyze` computes the final summary
|
|
347
|
+
* AFTER `formatCritique` runs (the summary embeds the formatted count).
|
|
348
|
+
* Rely on `failures` and `feedback.score` — do not read `feedback.summary`
|
|
349
|
+
* here.
|
|
350
|
+
*/
|
|
351
|
+
formatCritique?: (failures: readonly EvalResult[], feedback: Feedback) => string;
|
|
352
|
+
/**
|
|
353
|
+
* Run teacher calls in parallel via `Promise.all`. Default `true` — the
|
|
354
|
+
* common case (independent LLM calls). Set `false` to run sequentially
|
|
355
|
+
* via `for/await` when teachers share stateful resources (rate limiters,
|
|
356
|
+
* rolling context, serial API ordering) that don't tolerate concurrency.
|
|
357
|
+
*/
|
|
358
|
+
parallel?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Optional cost counter node. Running total tokens reported via
|
|
361
|
+
* `ctx.reportCost` during each iteration is added to this node in the
|
|
362
|
+
* strategy's `finally` block — fires on success AND on teacher throw so
|
|
363
|
+
* partial spend is never lost. User owns the node; wire to `budgetGate`,
|
|
364
|
+
* `attachSnapshotStorage`, telemetry, etc.
|
|
365
|
+
*/
|
|
366
|
+
tokens?: Node<number>;
|
|
367
|
+
/**
|
|
368
|
+
* Teacher — given `{prior, critique, failures, reportCost}`, produce one
|
|
369
|
+
* refined variant. Called `width` times per iteration. Async allowed.
|
|
370
|
+
* Call `ctx.reportCost(n)` to track tokens consumed per call (optional,
|
|
371
|
+
* no-op if `opts.tokens` is not set).
|
|
372
|
+
*/
|
|
373
|
+
teacher: (ctx: ErrorCritiqueContext<T>) => Promise<T> | T;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Critique-driven strategy (ProTeGi-style "textual gradient"). Each iteration:
|
|
377
|
+
* 1. `analyze` classifies tasks scoring below a threshold as failures, picks
|
|
378
|
+
* the best candidate from the batch, and packs both plus a formatted
|
|
379
|
+
* critique string into `feedback.critique` as a private payload.
|
|
380
|
+
* 2. `generate` unpacks that payload and calls the teacher with
|
|
381
|
+
* `{prior, critique, failures, reportCost}` `width` times, returning the
|
|
382
|
+
* refined batch.
|
|
383
|
+
*
|
|
384
|
+
* The teacher receives a pre-formatted string (drop into an LLM prompt) AND
|
|
385
|
+
* the structured failure list (for richer prompts that want per-task detail).
|
|
386
|
+
* Throws on empty candidate batches — matches `blindVariation`'s contract
|
|
387
|
+
* (no silent zero-candidate cycles).
|
|
388
|
+
*
|
|
389
|
+
* When `setStrategy()` swaps this strategy in mid-run, the first `generate`
|
|
390
|
+
* may receive a `Feedback` produced by the prior strategy (no private payload);
|
|
391
|
+
* the fallback path uses `candidates[last]` as the prior and the feedback
|
|
392
|
+
* summary as the critique, so the loop keeps running without a stall. When a
|
|
393
|
+
* private payload IS present, `priv.critiqueText` takes precedence over any
|
|
394
|
+
* edits a caller made to `feedback.summary` — treat `critique` as the
|
|
395
|
+
* strategy-owned channel.
|
|
396
|
+
*/
|
|
397
|
+
declare function errorCritique<T>(opts: ErrorCritiqueOptions<T>): RefineStrategy<T>;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* harnessLoop() factory (roadmap §9.0).
|
|
401
|
+
*
|
|
402
|
+
* Wires the static 7-stage topology: INTAKE → TRIAGE → QUEUE → GATE →
|
|
403
|
+
* EXECUTE → VERIFY → REFLECT. Static topology, flowing data — the Kafka
|
|
404
|
+
* insight applied to human+LLM collaboration.
|
|
405
|
+
*
|
|
406
|
+
* **Hub model (Wave B Unit 20 C + Q1).** All reactive-wire-crossing topics
|
|
407
|
+
* live in one `MessagingHubGraph` exposed as `HarnessGraph.queues`: the
|
|
408
|
+
* four per-route queues, an `__unrouted` dead-letter, plus `intake`,
|
|
409
|
+
* `retry`, `verify-results`, and the `triage-output` fan-in topic. The
|
|
410
|
+
* router is a single derived/effect pair that publishes to `triage-output`;
|
|
411
|
+
* per-route `topicBridge`s fan out by `map:` predicate. Routing is data
|
|
412
|
+
* (topic name), not code — every routing decision is a visible edge in
|
|
413
|
+
* `describe()` / `explain()`.
|
|
414
|
+
*
|
|
415
|
+
* **EXECUTE/VERIFY via JobFlow (Tier 6.5 C2 lock, 2026-04-28).** The
|
|
416
|
+
* stages 5–6 EXECUTE → VERIFY pair runs through an internal `executeFlow`
|
|
417
|
+
* JobFlow with two stages (`execute`, `verify`). Each stage's pump owns
|
|
418
|
+
* `claim → work → ack` for one claim; the verify stage's payload contains
|
|
419
|
+
* `{ item, execution, verify }` so the post-completed dispatch effect can
|
|
420
|
+
* route the 3-way verdict (verified / self-correctable retry / structural
|
|
421
|
+
* + reingest) without any cross-wave `withLatestFrom` pairing. Items
|
|
422
|
+
* arriving from per-route topics + retry feedback enter via a single
|
|
423
|
+
* `enqueueEffect` that pushes to `executeFlow.queue("execute")`.
|
|
424
|
+
*
|
|
425
|
+
* @module
|
|
426
|
+
*/
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Build the default EXECUTE work fn — calls `adapter.invoke()` once per
|
|
430
|
+
* claimed job, parses the JSON response into an `ExecuteOutput<A>`, and
|
|
431
|
+
* returns a {@link HarnessJobPayload} with `execution` filled in.
|
|
432
|
+
*
|
|
433
|
+
* Errors (parse failure, adapter throw, malformed JSON) are caught and
|
|
434
|
+
* surfaced as a `failure`-outcome payload — the dispatch effect routes
|
|
435
|
+
* the item rather than dropping it via pump nack (see C2 contract on
|
|
436
|
+
* {@link HarnessExecutor}).
|
|
437
|
+
*
|
|
438
|
+
* Subsumes the pre-Tier-6.5 `promptNode`-based default: per-claim LLM
|
|
439
|
+
* calls don't benefit from `promptNode`'s cross-wave switchMap, and a
|
|
440
|
+
* fresh per-claim subgraph would be wasteful. Direct `adapter.invoke`
|
|
441
|
+
* is the right shape inside JobFlow pumps.
|
|
442
|
+
*
|
|
443
|
+
* @param adapter - LLMAdapter for the execute call.
|
|
444
|
+
* @param prompt - Prompt template (string or `(item) => string`). Defaults
|
|
445
|
+
* to the harness's built-in execute prompt.
|
|
446
|
+
*/
|
|
447
|
+
declare function defaultLlmExecutor<A = unknown>(adapter: LLMAdapter, prompt?: string | ExecutePromptFn): HarnessExecutor<A>;
|
|
448
|
+
/**
|
|
449
|
+
* Build the default VERIFY work fn — calls `adapter.invoke()` once per
|
|
450
|
+
* claimed job to review the prior-stage execution, parses the JSON
|
|
451
|
+
* response into a `VerifyOutput`, and returns a {@link HarnessJobPayload}
|
|
452
|
+
* with `verify` filled in.
|
|
453
|
+
*
|
|
454
|
+
* Same C2 error semantics as {@link defaultLlmExecutor}: parse / adapter
|
|
455
|
+
* failures are surfaced as a structural-failure verify payload so the
|
|
456
|
+
* dispatch effect routes the item.
|
|
457
|
+
*/
|
|
458
|
+
declare function defaultLlmVerifier<A = unknown>(adapter: LLMAdapter, prompt?: string | VerifyPromptFn<A>): HarnessVerifier<A>;
|
|
459
|
+
/**
|
|
460
|
+
* The graph returned by {@link harnessLoop}. Wraps a single
|
|
461
|
+
* {@link MessagingHubGraph} that owns all reactive-wire-crossing topics
|
|
462
|
+
* (intake, per-route queues, `__unrouted`, retry, verify-results,
|
|
463
|
+
* triage-output), plus an `executeFlow` JobFlow that owns the
|
|
464
|
+
* EXECUTE → VERIFY pipeline (Tier 6.5 C2). Sugar getters expose the
|
|
465
|
+
* canonical topics so the surface stays ergonomic.
|
|
466
|
+
*/
|
|
467
|
+
declare class HarnessGraph<A = unknown> extends Graph {
|
|
468
|
+
/** Messaging hub — the routing-data plane. Queue topics live here. */
|
|
469
|
+
readonly queues: MessagingHubGraph;
|
|
470
|
+
/**
|
|
471
|
+
* EXECUTE → VERIFY JobFlow (Tier 6.5 C2). Pumps own claim/ack/nack
|
|
472
|
+
* lifecycle for each stage. Inspect via:
|
|
473
|
+
* - `harness.executeFlow.queue("execute").pending` — pending depth.
|
|
474
|
+
* - `harness.executeFlow.queue("verify").pending` — items mid-execute.
|
|
475
|
+
* - `harness.executeFlow.completed` — verified items waiting for the
|
|
476
|
+
* dispatch effect's 3-way routing.
|
|
477
|
+
* - `harness.executeFlow.completedCount` — total terminal completions.
|
|
478
|
+
*/
|
|
479
|
+
readonly executeFlow: JobFlowGraph<HarnessJobPayload<A>>;
|
|
480
|
+
/**
|
|
481
|
+
* Per-route JobQueueGraph audit mirrors. Each triaged item that reaches
|
|
482
|
+
* a queue is also enqueued here, giving reactive `depth` + `pending` +
|
|
483
|
+
* `jobs` observables per route. The dispatch effect ack/removeBy-id's
|
|
484
|
+
* the matching job on terminal verdict. The executeFlow JobFlow handles
|
|
485
|
+
* the EXECUTE → VERIFY data flow; this is a parallel audit-side ledger
|
|
486
|
+
* for per-route depth metrics. Inspect via
|
|
487
|
+
* `harness.jobs.get(route).depth.cache` for backpressure metrics.
|
|
488
|
+
*/
|
|
489
|
+
readonly jobs: ReadonlyMap<QueueRoute, JobQueueGraph<TriagedItem>>;
|
|
490
|
+
/** Per-route gate controllers (only for gated queues). */
|
|
491
|
+
readonly gates: ReadonlyMap<QueueRoute, GateController<TriagedItem>>;
|
|
492
|
+
/**
|
|
493
|
+
* Per-route queue topics — typed accessor for the four
|
|
494
|
+
* {@link QUEUE_NAMES} entries (`auto-fix`, `needs-decision`,
|
|
495
|
+
* `investigation`, `backlog`). Mirrors the `gates` / `jobs` map
|
|
496
|
+
* shape so callers can iterate `[route, topic]` pairs without
|
|
497
|
+
* hand-rolling `harness.queues.topicNames()` + meta-topic exclusion.
|
|
498
|
+
*
|
|
499
|
+
* Excludes the meta topics that share the hub:
|
|
500
|
+
* `intake` (use {@link intake}), `verify-results` (use
|
|
501
|
+
* {@link verifyResults}), `retry` (use {@link retry}), `__unrouted`
|
|
502
|
+
* (use {@link unrouted}), and the internal `triage-output` fan-in.
|
|
503
|
+
*/
|
|
504
|
+
readonly queueTopics: ReadonlyMap<QueueRoute, TopicGraph<TriagedItem>>;
|
|
505
|
+
/** Strategy model — `auditedSuccessTracker` keyed by `StrategyKey`. */
|
|
506
|
+
readonly strategy: StrategyModelGraph;
|
|
507
|
+
/** Global retry count across all items (circuit breaker). Reactive — subscribable. */
|
|
508
|
+
readonly totalRetries: Node<number>;
|
|
509
|
+
/** Global reingestion count across all items (circuit breaker). Reactive — subscribable. */
|
|
510
|
+
readonly totalReingestions: Node<number>;
|
|
511
|
+
/**
|
|
512
|
+
* Per-route priority score nodes, populated only when `opts.priority` is
|
|
513
|
+
* set on {@link harnessLoop}. Each node emits a score combining severity,
|
|
514
|
+
* attention decay, and strategy-model effectiveness for the route's
|
|
515
|
+
* current head-of-queue item. `undefined` means the caller did not opt
|
|
516
|
+
* in to priority scoring.
|
|
517
|
+
*/
|
|
518
|
+
readonly priorityScores?: ReadonlyMap<QueueRoute, Node<number>>;
|
|
519
|
+
/**
|
|
520
|
+
* REFLECT-stage tick marker — emits one DATA per terminal verdict observed
|
|
521
|
+
* on `executeFlow.completed`. `equals: () => false` so each completion
|
|
522
|
+
* produces an observable tick (no Object.is collapse on identical
|
|
523
|
+
* `null` payloads). Inspection tools (`harnessTrace`, dashboards) can
|
|
524
|
+
* subscribe directly here instead of resolving by string path
|
|
525
|
+
* (`harness.node("reflect")`) — the field is the lock against rename
|
|
526
|
+
* drift.
|
|
527
|
+
*/
|
|
528
|
+
readonly reflect: Node<null>;
|
|
529
|
+
constructor(name: string, queues: MessagingHubGraph, executeFlow: JobFlowGraph<HarnessJobPayload<A>>, queueTopics: Map<QueueRoute, TopicGraph<TriagedItem>>, jobs: Map<QueueRoute, JobQueueGraph<TriagedItem>>, gates: Map<QueueRoute, GateController<TriagedItem>>, strategy: StrategyModelGraph, totalRetries: Node<number>, totalReingestions: Node<number>, reflect: Node<null>, priorityScores?: Map<QueueRoute, Node<number>>);
|
|
530
|
+
/** Intake topic — publish items here to enter the loop. */
|
|
531
|
+
get intake(): TopicGraph<IntakeItem>;
|
|
532
|
+
/** Verify results topic — subscribe to see verification outcomes. */
|
|
533
|
+
get verifyResults(): TopicGraph<VerifyResult<A>>;
|
|
534
|
+
/** Retry feedback topic — fast-retry re-entry point. */
|
|
535
|
+
get retry(): TopicGraph<TriagedItem>;
|
|
536
|
+
/** Dead-letter topic for items whose LLM-chosen route is unknown. */
|
|
537
|
+
get unrouted(): TopicGraph<TriagedItem>;
|
|
538
|
+
/**
|
|
539
|
+
* Stage-label → observe-path map for the 7 pipeline stages.
|
|
540
|
+
*
|
|
541
|
+
* Decouples inspection tools (`harnessTrace`, `harnessProfile`, custom
|
|
542
|
+
* dashboards) from mount-structure churn: hub migration, future stage
|
|
543
|
+
* splits, gate remounting, or the Tier 6.5 C2 JobFlow rewire shouldn't
|
|
544
|
+
* require edits to `trace.ts` as long as this method stays accurate.
|
|
545
|
+
*
|
|
546
|
+
* Each stage yields `{ label, paths }`; consumers iterate paths per
|
|
547
|
+
* stage and attach observers. Tier 6.5: EXECUTE / VERIFY paths now
|
|
548
|
+
* resolve to the `executeFlow` stage queues + the `verify-dispatch`
|
|
549
|
+
* effect node.
|
|
550
|
+
*/
|
|
551
|
+
stageNodes(): ReadonlyArray<{
|
|
552
|
+
label: string;
|
|
553
|
+
paths: readonly string[];
|
|
554
|
+
}>;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Wire the reactive collaboration loop as a static-topology graph.
|
|
558
|
+
*
|
|
559
|
+
* The loop has 7 stages:
|
|
560
|
+
* 1. **INTAKE** — items arrive from multiple sources via `intake.publish()`
|
|
561
|
+
* 2. **TRIAGE** — promptNode classifies, routes, and prioritizes
|
|
562
|
+
* 3. **QUEUE** — 4 priority-ordered TopicGraphs (auto-fix, needs-decision, investigation, backlog)
|
|
563
|
+
* 4. **GATE** — human approval on configurable queues
|
|
564
|
+
* 5. **EXECUTE** — JobFlow `execute` stage; user-supplied or default work fn
|
|
565
|
+
* 6. **VERIFY** — JobFlow `verify` stage; verifies the executed artifact
|
|
566
|
+
* 7. **REFLECT** — strategy model records outcomes; dispatch effect routes 3-way
|
|
567
|
+
*
|
|
568
|
+
* @param name - Graph name.
|
|
569
|
+
* @param opts - Configuration.
|
|
570
|
+
* @returns HarnessGraph with controller accessors.
|
|
571
|
+
*/
|
|
572
|
+
declare function harnessLoop<A = unknown>(name: string, opts: HarnessLoopOptions<A>): HarnessGraph<A>;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Phase 13.I — `spawnable()` harness preset.
|
|
576
|
+
*
|
|
577
|
+
* Source: `archive/docs/SESSION-multi-agent-gap-analysis.md` G3 lock B + G5
|
|
578
|
+
* reframe.
|
|
579
|
+
*
|
|
580
|
+
* Wraps a {@link MessagingHubGraph} + {@link presetRegistry} +
|
|
581
|
+
* (per-request) {@link agent} mounting + depth-cap + termination contract.
|
|
582
|
+
* Consumers emit a `TopicMessage<SpawnPayload>` to the well-known
|
|
583
|
+
* {@link SPAWNS_TOPIC}; `spawnable()` mints a fresh agent from the
|
|
584
|
+
* matching preset, mounts it, and tracks it in `activeSlot` until the
|
|
585
|
+
* agent settles or expires. Out-of-policy requests (depth-cap exceeded,
|
|
586
|
+
* unknown presetId, schema-invalid, expired) flow to the `rejected`
|
|
587
|
+
* topic.
|
|
588
|
+
*
|
|
589
|
+
* **Cross-cut #1 lock (no `agent.run()`):** spawnable kicks each agent
|
|
590
|
+
* via `bundle.in.emit(taskInput)`; status transitions are observed via
|
|
591
|
+
* the agent's reactive `status` Node.
|
|
592
|
+
*
|
|
593
|
+
* **Termination contract:**
|
|
594
|
+
* - `done` / `error` from the agent's `status` → unmount + remove from
|
|
595
|
+
* `activeSlot`.
|
|
596
|
+
* - `expiresAt` (set on the request envelope, ISO 8601) — when the wall
|
|
597
|
+
* clock passes the deadline AND the agent is still active, the agent is
|
|
598
|
+
* aborted (via `loop.abort()`) and reported on `rejected` with
|
|
599
|
+
* `reason: "expired"`. (Per-spawn timeout via the `timeout` operator
|
|
600
|
+
* recipe is documented in COMPOSITION-GUIDE-PATTERNS.)
|
|
601
|
+
*
|
|
602
|
+
* **Depth-cap:** locked recipe (DS-13.I) is `valve(spawnTopic, derived(
|
|
603
|
+
* [depthCounter], n => n < cap))`, but the practical pattern in
|
|
604
|
+
* `spawnable()` checks depth per-request inside the request handler so
|
|
605
|
+
* over-cap requests can be reported on `rejected`. Callers who want hard
|
|
606
|
+
* cuts (no rejection signal) can wrap their own publish path with
|
|
607
|
+
* `valve` per the recipe.
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Payload of a spawn request envelope. Wraps in a {@link Message}<...>:
|
|
612
|
+
* the request body sets `presetId` (the preset registry key) and
|
|
613
|
+
* `taskInput` (the typed input passed to the spawned agent's `bundle.in`).
|
|
614
|
+
*/
|
|
615
|
+
interface SpawnPayload<TIn> {
|
|
616
|
+
readonly presetId: string;
|
|
617
|
+
readonly taskInput: TIn;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* Rejection record published to the `rejected` topic when a spawn request
|
|
621
|
+
* is denied. `reason` is a short human-readable code.
|
|
622
|
+
*/
|
|
623
|
+
interface SpawnRejection<TIn> {
|
|
624
|
+
readonly request: TopicMessage<SpawnPayload<TIn>>;
|
|
625
|
+
readonly reason: string;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Options for {@link spawnable}.
|
|
629
|
+
*/
|
|
630
|
+
interface SpawnableOpts<TIn, TOut> {
|
|
631
|
+
/** Existing messaging hub. {@link SPAWNS_TOPIC} is created lazily on it. */
|
|
632
|
+
readonly hub: MessagingHubGraph;
|
|
633
|
+
/** Preset registry — keys must match `request.payload.presetId`. */
|
|
634
|
+
readonly registry: PresetRegistryBundle<AgentSpec<TIn, TOut>>;
|
|
635
|
+
/**
|
|
636
|
+
* Local mount name on the hub for this spawnable's subgraph. Multiple
|
|
637
|
+
* spawnable instances on the same hub must use distinct names. Default
|
|
638
|
+
* `"spawnable"`.
|
|
639
|
+
*/
|
|
640
|
+
readonly name?: string;
|
|
641
|
+
/** Maximum concurrently-active agents. Default unbounded. */
|
|
642
|
+
readonly depthCap?: number;
|
|
643
|
+
/**
|
|
644
|
+
* Initial cursor for the spawn-topic subscription. Default `"now"` —
|
|
645
|
+
* pre-existing retained spawn requests are NOT replayed at construction.
|
|
646
|
+
* Pass `"retained"` to replay or a number for explicit cursor offset.
|
|
647
|
+
*/
|
|
648
|
+
readonly from?: "now" | "retained" | number;
|
|
649
|
+
/**
|
|
650
|
+
* Optional caller-supplied validator. Returns `true` to accept the
|
|
651
|
+
* request, `false` to reject. Reject reason on the `rejected` topic is
|
|
652
|
+
* `"schema validation failed"`. Pair with the `Message.schema` field carried
|
|
653
|
+
* in the envelope when full JSON-Schema validation is needed (consumer
|
|
654
|
+
* supplies the validator — ajv / zod / valibot — and reads the schema
|
|
655
|
+
* from the envelope to gate). The substrate itself does NOT ship a
|
|
656
|
+
* JSON-Schema validator; the `Message.schema` field is wire convention.
|
|
657
|
+
*/
|
|
658
|
+
readonly validate?: (request: TopicMessage<SpawnPayload<TIn>>) => boolean;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* The bundle returned by {@link spawnable}.
|
|
662
|
+
*/
|
|
663
|
+
interface SpawnableBundle<TIn, TOut> {
|
|
664
|
+
/** The well-known spawn topic — emit `TopicMessage<SpawnPayload<TIn>>` here. */
|
|
665
|
+
readonly spawnTopic: TopicGraph<TopicMessage<SpawnPayload<TIn>>>;
|
|
666
|
+
/** Reactive map of currently-active agent bundles, keyed by request id. */
|
|
667
|
+
readonly activeSlot: Node<ReadonlyMap<string, AgentBundle<TIn, TOut>>>;
|
|
668
|
+
/** Topic of rejected requests with reason. */
|
|
669
|
+
readonly rejected: TopicGraph<SpawnRejection<TIn>>;
|
|
670
|
+
/** The internal SpawnableGraph subgraph (mounted under the hub). */
|
|
671
|
+
readonly graph: SpawnableGraph<TIn, TOut>;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Graph subclass implementing {@link SpawnableBundle}'s topology.
|
|
675
|
+
* Mounted under the hub at `opts.name` (default `"spawnable"`).
|
|
676
|
+
*
|
|
677
|
+
* Topology:
|
|
678
|
+
* ```
|
|
679
|
+
* <hub>
|
|
680
|
+
* ├── spawns (TopicGraph; well-known well-named spawn topic)
|
|
681
|
+
* └── <name> (SpawnableGraph)
|
|
682
|
+
* ├── spawn-sub (SubscriptionGraph over hub::spawns::events)
|
|
683
|
+
* ├── rejected (TopicGraph<SpawnRejection>)
|
|
684
|
+
* ├── active-slot (Node<ReadonlyMap<id, AgentBundle>>)
|
|
685
|
+
* └── spawn-{req.id}/ (mounted AgentGraph per active spawn)
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
declare class SpawnableGraph<TIn, TOut> extends Graph {
|
|
689
|
+
readonly spawnTopic: TopicGraph<TopicMessage<SpawnPayload<TIn>>>;
|
|
690
|
+
readonly rejected: TopicGraph<SpawnRejection<TIn>>;
|
|
691
|
+
readonly activeSlot: Node<ReadonlyMap<string, AgentBundle<TIn, TOut>>>;
|
|
692
|
+
private readonly _spawnSub;
|
|
693
|
+
private readonly _registry;
|
|
694
|
+
private readonly _depthCap;
|
|
695
|
+
private readonly _validate;
|
|
696
|
+
private _disposed;
|
|
697
|
+
constructor(opts: SpawnableOpts<TIn, TOut>);
|
|
698
|
+
private _processRequest;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Constructs a {@link SpawnableGraph}, mounts it under `opts.hub` at
|
|
702
|
+
* `opts.name` (default `"spawnable"`), and returns the
|
|
703
|
+
* {@link SpawnableBundle} contract.
|
|
704
|
+
*
|
|
705
|
+
* **Composition with Phase 13 substrate:**
|
|
706
|
+
* - Builds on **13.B** ({@link Message} envelope, {@link SPAWNS_TOPIC}).
|
|
707
|
+
* - Builds on **13.G/H** ({@link agent}, {@link AgentBundle}).
|
|
708
|
+
* - Builds on **13.H** ({@link presetRegistry}).
|
|
709
|
+
* - The depth-cap gate is documented as a **13.D recipe**
|
|
710
|
+
* (`valve(spawnTopic, derived([depthCounter], n => n < cap))`); inside
|
|
711
|
+
* `spawnable()` the depth check is per-request so over-cap requests
|
|
712
|
+
* surface on `rejected`. Callers wanting a hard cut (no rejection
|
|
713
|
+
* signal) can wrap their publish path with `valve`.
|
|
714
|
+
*
|
|
715
|
+
* **Strategy-key axis (DS-13.I):** when `harnessLoop` is wired to a
|
|
716
|
+
* spawnable, downstream `strategy.record(...)` calls should pass the
|
|
717
|
+
* spawning agent's `presetId` for the {@link strategyKey} first axis.
|
|
718
|
+
* Single-agent harness keeps using {@link DEFAULT_PRESET_ID} as before.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```ts
|
|
722
|
+
* const hub = messagingHub("hub");
|
|
723
|
+
* const presets = presetRegistry<AgentSpec<string, LLMResponse>>();
|
|
724
|
+
* presets.put("researcher", { name: "researcher", adapter: openai, systemPrompt: "..." });
|
|
725
|
+
* presets.put("coder", { name: "coder", adapter: anthropic, systemPrompt: "..." });
|
|
726
|
+
*
|
|
727
|
+
* const sp = spawnable({ hub, registry: presets, depthCap: 5 });
|
|
728
|
+
*
|
|
729
|
+
* // Trigger a spawn:
|
|
730
|
+
* sp.spawnTopic.publish({
|
|
731
|
+
* id: "req-42",
|
|
732
|
+
* payload: { presetId: "researcher", taskInput: "what is reactive graph composition?" },
|
|
733
|
+
* });
|
|
734
|
+
*
|
|
735
|
+
* // Observe active agents:
|
|
736
|
+
* sp.activeSlot.subscribe((msgs) => { ... });
|
|
737
|
+
*
|
|
738
|
+
* // Observe rejections:
|
|
739
|
+
* sp.rejected.events.subscribe((msgs) => { ... });
|
|
740
|
+
* ```
|
|
741
|
+
*
|
|
742
|
+
* @category patterns
|
|
743
|
+
*/
|
|
744
|
+
declare function spawnable<TIn = string, TOut = LLMResponse>(opts: SpawnableOpts<TIn, TOut>): SpawnableBundle<TIn, TOut>;
|
|
745
|
+
|
|
746
|
+
export { type AnalyzeEvent as A, type BlindVariationContext as B, type ConvergenceOptions as C, type DatasetItem as D, type ErrorCritiqueContext as E, type Feedback as F, type GenerateEvent as G, HarnessGraph as H, type Iteration as I, RefineLoopGraph as R, type SpawnPayload as S, type BlindVariationOptions as a, type DecideEvent as b, type ErrorCritiqueOptions as c, type EvalResult as d, type EvaluateEvent as e, type Evaluator as f, type RefineLoopOptions as g, type RefineStatus as h, type RefineStrategy as i, type SpawnRejection as j, type SpawnableBundle as k, SpawnableGraph as l, type SpawnableOpts as m, blindVariation as n, defaultLlmExecutor as o, defaultLlmVerifier as p, errorCritique as q, harnessLoop as r, refineLoop as s, spawnable as t };
|