@graphrefly/graphrefly 0.45.0 → 0.46.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 +811 -0
- package/dist/base/composition/index.cjs.map +1 -0
- package/dist/base/composition/index.d.cts +469 -0
- package/dist/base/composition/index.d.ts +469 -0
- package/dist/base/composition/index.js +40 -0
- package/dist/base/composition/index.js.map +1 -0
- package/dist/base/index.cjs +6336 -0
- package/dist/base/index.cjs.map +1 -0
- package/dist/base/index.d.cts +22 -0
- package/dist/base/index.d.ts +22 -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-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-3QZY5BI7.js +92 -0
- package/dist/chunk-3QZY5BI7.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-5THCXDWY.js +725 -0
- package/dist/chunk-5THCXDWY.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-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-FR6RGA3B.js +1277 -0
- package/dist/chunk-FR6RGA3B.js.map +1 -0
- package/dist/chunk-FW23JYNQ.js +454 -0
- package/dist/chunk-FW23JYNQ.js.map +1 -0
- package/dist/chunk-GBCENOLN.js +1575 -0
- package/dist/chunk-GBCENOLN.js.map +1 -0
- package/dist/chunk-HL7HUJIX.js +1 -0
- package/dist/chunk-HL7HUJIX.js.map +1 -0
- package/dist/chunk-HULCUY35.js +2508 -0
- package/dist/chunk-HULCUY35.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-KIIXR252.js +211 -0
- package/dist/chunk-KIIXR252.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-LBAJK24K.js +1071 -0
- package/dist/chunk-LBAJK24K.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-OO5BM6CJ.js +1153 -0
- package/dist/chunk-OO5BM6CJ.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-RGL53X5G.js +574 -0
- package/dist/chunk-RGL53X5G.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-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-W2BOPXTI.js +1 -0
- package/dist/chunk-W2BOPXTI.js.map +1 -0
- package/dist/chunk-WKSWLSCX.js +207 -0
- package/dist/chunk-WKSWLSCX.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-Z6EGP5D7.js +92 -0
- package/dist/chunk-Z6EGP5D7.js.map +1 -0
- package/dist/compat/index.cjs +3083 -2
- 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 +2224 -2
- 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 +77 -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-5SU_O78r.d.cts +754 -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-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-CEXCtYYJ.d.ts +754 -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-dX9IzPqj.d.cts +86 -0
- package/dist/index-dX9IzPqj.d.ts +86 -0
- package/dist/index.cjs +25950 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -42
- package/dist/index.d.ts +56 -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-BXQoW1P-.d.cts +36 -0
- package/dist/observable-BXQoW1P-.d.ts +36 -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 +17609 -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 +1451 -0
- package/dist/utils/memory/index.cjs.map +1 -0
- package/dist/utils/memory/index.d.cts +582 -0
- package/dist/utils/memory/index.d.ts +582 -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 -237
- 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,629 @@
|
|
|
1
|
+
import { NodeInput, ReactiveMapBundle } from '@graphrefly/pure-ts/extra';
|
|
2
|
+
import { Graph, GraphOptions } from '@graphrefly/pure-ts/graph';
|
|
3
|
+
import { c as LLMResponse, j as ToolCall, L as LLMAdapter, k as ToolDefinition, i as TokenUsage } from './types-BB5Lw-pB.cjs';
|
|
4
|
+
import { Node } from '@graphrefly/pure-ts/core';
|
|
5
|
+
import { C as ChatStreamGraph, o as ToolRegistryGraph, q as ToolResult, d as MemoryTiersBundle, h as MemoryWithTiersGraph, m as RetrievalQuery, R as RetrievalEntry, e as MemoryTiersOptions } from './memory-composers-BryDrRBX.cjs';
|
|
6
|
+
import { D as DistillBundle, E as Extraction } from './distill-De6Rnn15.cjs';
|
|
7
|
+
import { VectorIndexGraph, KnowledgeGraph } from './utils/memory/index.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Reactive agent loop — autonomous multi-turn LLM agent with tool execution.
|
|
11
|
+
*/
|
|
12
|
+
type AgentLoopStatus = "idle" | "thinking" | "acting" | "done" | "error";
|
|
13
|
+
|
|
14
|
+
type AgentLoopOptions = {
|
|
15
|
+
graph?: GraphOptions;
|
|
16
|
+
adapter: LLMAdapter;
|
|
17
|
+
tools?: readonly ToolDefinition[];
|
|
18
|
+
systemPrompt?: string;
|
|
19
|
+
maxTurns?: number;
|
|
20
|
+
stopWhen?: (response: LLMResponse) => boolean;
|
|
21
|
+
onToolCall?: (call: ToolCall) => void;
|
|
22
|
+
maxMessages?: number;
|
|
23
|
+
model?: string;
|
|
24
|
+
temperature?: number;
|
|
25
|
+
maxTokens?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Reactive tool-call splice (COMPOSITION-GUIDE §31 "interception is security").
|
|
28
|
+
* When set, the raw `toolCalls` node is piped through this transform before
|
|
29
|
+
* reaching the executor. The transform is a pure reactive composition —
|
|
30
|
+
* `(calls: Node<readonly ToolCall[]>) => Node<readonly ToolCall[]>` — so the
|
|
31
|
+
* gate is visible in `describe()` / `explain()` as a real edge (no hidden
|
|
32
|
+
* imperative wraps; §24).
|
|
33
|
+
*
|
|
34
|
+
* Typical uses:
|
|
35
|
+
* - **Filter / block** — `derived([calls, policy], ([raw, p]) => raw.filter(p))`
|
|
36
|
+
* - **Throttle / debounce** — `throttle(calls, windowMs)`
|
|
37
|
+
* - **Human-in-the-loop approval** — pipe through a `gate` controller so
|
|
38
|
+
* calls wait for human approval before reaching the executor.
|
|
39
|
+
*
|
|
40
|
+
* The public `agent.toolCalls` node surfaces the POST-intercept stream, so
|
|
41
|
+
* audit / telemetry consumers see what the executor actually runs. The raw
|
|
42
|
+
* pre-intercept stream is not exposed — tests that need it should run
|
|
43
|
+
* without `interceptToolCalls` set (the identity case).
|
|
44
|
+
*/
|
|
45
|
+
interceptToolCalls?: (calls: Node<readonly ToolCall[]>) => Node<readonly ToolCall[]>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Reactive agent loop.
|
|
49
|
+
*
|
|
50
|
+
* The loop is a reactive state machine wired entirely from graph primitives:
|
|
51
|
+
* `chat.messages` + `tools.schemas` + gating state feed a `promptInput`
|
|
52
|
+
* derived; `switchMap` turns non-null inputs into an LLM invocation via
|
|
53
|
+
* `fromAny(adapter.invoke(...))`. The LLM response drives chat writes and
|
|
54
|
+
* status transitions via effects. Tool calls flow through a reactive
|
|
55
|
+
* executor (`retrySource` + `rescue`) that retries once on error and
|
|
56
|
+
* surfaces terminal errors as JSON-shaped `ToolResult` payloads for the
|
|
57
|
+
* LLM to react to.
|
|
58
|
+
*
|
|
59
|
+
* **No imperative control flow inside the reactive layer** (spec §5.8-5.12):
|
|
60
|
+
* no `while` loops, no manual `await adapter.invoke`, no polling.
|
|
61
|
+
* `agent.run()` is a thin `awaitSettled` bridge so callers can still `await`
|
|
62
|
+
* the loop if they want a Promise.
|
|
63
|
+
*
|
|
64
|
+
* Public surface:
|
|
65
|
+
* - `chat` / `tools` — subgraphs (imperative `append` at boundary, reactive `executeReactive` for tool invocation)
|
|
66
|
+
* - `status` / `turn` / `aborted` — state nodes with explicit initials
|
|
67
|
+
* - `lastResponse` / `toolCalls` / `toolResults` — reactive outputs (SENTINEL until first emission; callers use `awaitSettled` / `subscribe`)
|
|
68
|
+
* - `run(userMessage?, signal?)` — optional user append + Promise bridge
|
|
69
|
+
* - `abort()` — imperative abort shim; flips `aborted` state
|
|
70
|
+
*
|
|
71
|
+
* **Lifecycle: single-mount.** `AgentLoopGraph` instances expect to be
|
|
72
|
+
* constructed once and used until `destroy()`. The internal closure mirrors
|
|
73
|
+
* (`latestTurn` / `latestAborted` / `latestStatus`) are wired by
|
|
74
|
+
* subscribe-and-capture at construction time; their `addDisposer`-registered
|
|
75
|
+
* subscriptions are torn down on subgraph unmount or `destroy()`. After
|
|
76
|
+
* teardown the mirrors freeze at their last value, so re-using a destroyed
|
|
77
|
+
* instance — calling `run()` again, or remounting under a new parent —
|
|
78
|
+
* would silently feed stale mirror data into reactive fn bodies. If you
|
|
79
|
+
* need to "reset" an agent, build a fresh `AgentLoopGraph` instance instead
|
|
80
|
+
* of recycling.
|
|
81
|
+
*/
|
|
82
|
+
declare class AgentLoopGraph extends Graph {
|
|
83
|
+
readonly chat: ChatStreamGraph;
|
|
84
|
+
readonly tools: ToolRegistryGraph;
|
|
85
|
+
/** Current agent status. `initial: "idle"` — always has a real value. */
|
|
86
|
+
readonly status: Node<AgentLoopStatus>;
|
|
87
|
+
/** Turn count (completed LLM invocations this run). `initial: 0`. */
|
|
88
|
+
readonly turn: Node<number>;
|
|
89
|
+
/** Aborted flag; flipped by `abort()` or external `AbortSignal`. `initial: false`. */
|
|
90
|
+
readonly aborted: Node<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Most recent LLM response. State-backed mirror driven by the response
|
|
93
|
+
* effect. **Stays SENTINEL** (`cache === undefined`, no DATA emitted)
|
|
94
|
+
* until the first real response — bridge subscribers see no spurious
|
|
95
|
+
* push-on-subscribe DATA. After a real response, holds the latest
|
|
96
|
+
* `LLMResponse`. Reset between `run()` calls via `[[INVALIDATE]]` (clears
|
|
97
|
+
* cache back to SENTINEL) so a second run with a pre-aborted signal
|
|
98
|
+
* cannot leak the prior run's response. Bridge with
|
|
99
|
+
* `awaitSettled(lastResponse)` for the first DATA as a Promise; consumers
|
|
100
|
+
* inside reactive fns gate on `ctx.prevData[i] === undefined`.
|
|
101
|
+
*/
|
|
102
|
+
readonly lastResponse: Node<LLMResponse>;
|
|
103
|
+
/** Tool-call batch emitted by the most recent LLM response. SENTINEL. */
|
|
104
|
+
readonly toolCalls: Node<readonly ToolCall[]>;
|
|
105
|
+
/** Tool-result batch (one entry per call) after reactive execution. SENTINEL. */
|
|
106
|
+
readonly toolResults: Node<readonly ToolResult[]>;
|
|
107
|
+
private readonly _terminalResult;
|
|
108
|
+
private readonly _disposeRunWiring;
|
|
109
|
+
/** Guards against overlapping `run()` calls. */
|
|
110
|
+
private _running;
|
|
111
|
+
/**
|
|
112
|
+
* Abort controller for the currently-running `adapter.invoke`. Minted per
|
|
113
|
+
* switchMap project; aborted when the reactive `aborted` node flips true
|
|
114
|
+
* OR when the caller's external `AbortSignal` fires. Threaded into
|
|
115
|
+
* `adapter.invoke({ signal })` AND `fromAny(promise, { signal })`, so the
|
|
116
|
+
* reactive layer sees ERROR when the wire call is cancelled.
|
|
117
|
+
*/
|
|
118
|
+
private _currentAbortController;
|
|
119
|
+
constructor(name: string, opts: AgentLoopOptions);
|
|
120
|
+
/**
|
|
121
|
+
* Bridge to `Promise<LLMResponse>` over the reactive pipeline.
|
|
122
|
+
*
|
|
123
|
+
* - If `userMessage` is provided, appends it as a user message and
|
|
124
|
+
* transitions status to `"thinking"` to kick the loop.
|
|
125
|
+
* - If `signal` is provided, binds it to the reactive `aborted` node
|
|
126
|
+
* AND threads into `adapter.invoke({ signal })` so the wire call can
|
|
127
|
+
* cancel mid-flight. The reactive `aborted` state + effect 3 guarantee
|
|
128
|
+
* that even an adapter that ignores `signal` will stop emitting into
|
|
129
|
+
* the agent graph.
|
|
130
|
+
* - Resolves when `status === "done"` with the final LLM response.
|
|
131
|
+
* Rejects with `AbortError` when the abort signal fires pre-response.
|
|
132
|
+
* Rejects with the stage error when `status === "error"`.
|
|
133
|
+
*
|
|
134
|
+
* **Concurrency:** `run()` refuses to overlap with a pending call on the
|
|
135
|
+
* same agent. Attempting to call `run()` while a previous `run()` is
|
|
136
|
+
* still in-flight throws a `RangeError` immediately. Stale-resolution
|
|
137
|
+
* safety is provided by `awaitSettled({skipCurrent: true})`, which
|
|
138
|
+
* ignores the cached initial DATA from any previous run and resolves
|
|
139
|
+
* only on a fresh post-subscribe emission of `_terminalResult`.
|
|
140
|
+
*/
|
|
141
|
+
run(userMessage?: string, signal?: AbortSignal): Promise<LLMResponse | null>;
|
|
142
|
+
/**
|
|
143
|
+
* Flip the reactive `aborted` state. Equivalent to setting an external
|
|
144
|
+
* `AbortSignal` — the pipeline observes and transitions to `"done"`.
|
|
145
|
+
*/
|
|
146
|
+
abort(): void;
|
|
147
|
+
destroy(): void;
|
|
148
|
+
}
|
|
149
|
+
declare function agentLoop(name: string, opts: AgentLoopOptions): AgentLoopGraph;
|
|
150
|
+
|
|
151
|
+
type AgentMemoryOptions<TMem = unknown> = {
|
|
152
|
+
graph?: GraphOptions;
|
|
153
|
+
/** LLM adapter for extraction and consolidation. */
|
|
154
|
+
adapter?: LLMAdapter;
|
|
155
|
+
/** System prompt for the extractor LLM. */
|
|
156
|
+
extractPrompt?: string;
|
|
157
|
+
/** Custom extractFn (overrides adapter + extractPrompt). */
|
|
158
|
+
extractFn?: (raw: unknown, existing: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
|
|
159
|
+
/** System prompt for the consolidation LLM. */
|
|
160
|
+
consolidatePrompt?: string;
|
|
161
|
+
/** Custom consolidateFn (overrides adapter + consolidatePrompt). */
|
|
162
|
+
consolidateFn?: (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
|
|
163
|
+
/** Reactive trigger for consolidation (caller supplies e.g. `fromTimer`). */
|
|
164
|
+
consolidateTrigger?: NodeInput<unknown>;
|
|
165
|
+
/** Score function for budget packing (required). */
|
|
166
|
+
score: (mem: TMem, context: unknown) => number;
|
|
167
|
+
/** Cost function for budget packing (required). */
|
|
168
|
+
cost: (mem: TMem) => number;
|
|
169
|
+
/** Token budget for compact view (default 2000). */
|
|
170
|
+
budget?: number;
|
|
171
|
+
/** Context node for scoring. */
|
|
172
|
+
context?: NodeInput<unknown>;
|
|
173
|
+
/** Admission filter (default: admit all). */
|
|
174
|
+
admissionFilter?: (candidate: unknown) => boolean;
|
|
175
|
+
/** Vector index dimensions (> 0 enables vector index for retrieval). */
|
|
176
|
+
vectorDimensions?: number;
|
|
177
|
+
/**
|
|
178
|
+
* B12: optional accessor for an entry's hierarchical context breadcrumb
|
|
179
|
+
* (e.g. `["projects", "auth", "tokens"]`). When supplied alongside
|
|
180
|
+
* `contextWeight > 0`, retrieval applies a score boost for entries whose
|
|
181
|
+
* context shares a prefix with the query's `context`. Entries without
|
|
182
|
+
* a breadcrumb are scored flatly.
|
|
183
|
+
*/
|
|
184
|
+
contextOf?: (mem: TMem) => readonly string[] | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* B12: hierarchical context boost multiplier. Score is scaled by
|
|
187
|
+
* `(1 + contextWeight * sharedDepth / queryDepth)` when both the query
|
|
188
|
+
* and entry supply a `context`. Default: 0.
|
|
189
|
+
*/
|
|
190
|
+
contextWeight?: number;
|
|
191
|
+
/** Extract embedding vector from a memory entry (enables vector index). */
|
|
192
|
+
embedFn?: (mem: TMem) => readonly number[] | undefined;
|
|
193
|
+
/** Enable knowledge graph for entity/relation tracking. */
|
|
194
|
+
enableKnowledgeGraph?: boolean;
|
|
195
|
+
/** Extract entities and relations from a memory entry. */
|
|
196
|
+
entityFn?: (key: string, mem: TMem) => {
|
|
197
|
+
entities?: Array<{
|
|
198
|
+
id: string;
|
|
199
|
+
value: unknown;
|
|
200
|
+
}>;
|
|
201
|
+
relations?: Array<{
|
|
202
|
+
from: string;
|
|
203
|
+
to: string;
|
|
204
|
+
relation: string;
|
|
205
|
+
weight?: number;
|
|
206
|
+
}>;
|
|
207
|
+
} | undefined;
|
|
208
|
+
/** 3-tier storage configuration. Omit to use single-tier (existing behavior). */
|
|
209
|
+
tiers?: MemoryTiersOptions<TMem>;
|
|
210
|
+
/** Retrieval pipeline configuration. Requires vector index or knowledge graph. */
|
|
211
|
+
retrieval?: {
|
|
212
|
+
/** Max candidates from vector search (default 20). */
|
|
213
|
+
topK?: number;
|
|
214
|
+
/** KG expansion depth in hops (default 1). */
|
|
215
|
+
graphDepth?: number;
|
|
216
|
+
};
|
|
217
|
+
/** Periodic reflection/consolidation configuration. */
|
|
218
|
+
reflection?: {
|
|
219
|
+
/** Interval in ms between consolidation runs (default 300_000 = 5 min). */
|
|
220
|
+
interval?: number;
|
|
221
|
+
/** Enable/disable periodic reflection (default true when consolidateFn is available). */
|
|
222
|
+
enabled?: boolean;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Pre-wired agentic memory graph. Sugar over `distill` plus the
|
|
227
|
+
* `memoryWithVectors` / `memoryWithKG` / `memoryWithTiers` / `memoryRetrieval`
|
|
228
|
+
* composers. Power users who want a subset of capabilities can call those
|
|
229
|
+
* composers directly; this class bundles them into one ergonomic Graph subclass.
|
|
230
|
+
*
|
|
231
|
+
* Mounts:
|
|
232
|
+
* - `tiers/*` — present when `opts.tiers` configured (replaces the
|
|
233
|
+
* default distill bundle).
|
|
234
|
+
* - `vectors/*` — present when `opts.vectorDimensions > 0 && opts.embedFn`.
|
|
235
|
+
* - `knowledge/*` — present when `opts.enableKnowledgeGraph`.
|
|
236
|
+
* - `retrieval/*` — present when vectors or kg configured.
|
|
237
|
+
*
|
|
238
|
+
* When `opts.tiers` is omitted, `store` / `compact` / `size` are added as
|
|
239
|
+
* top-level nodes on this graph (visible in `describe()` / `explain()`).
|
|
240
|
+
*/
|
|
241
|
+
declare class AgentMemoryGraph<TMem = unknown> extends Graph {
|
|
242
|
+
readonly distillBundle: DistillBundle<TMem>;
|
|
243
|
+
readonly compact: Node<Array<{
|
|
244
|
+
key: string;
|
|
245
|
+
value: TMem;
|
|
246
|
+
score: number;
|
|
247
|
+
}>>;
|
|
248
|
+
readonly size: Node<number>;
|
|
249
|
+
/** Vector index bundle (null if not enabled). */
|
|
250
|
+
readonly vectors: VectorIndexGraph<TMem> | null;
|
|
251
|
+
/** Knowledge graph (null if not enabled). */
|
|
252
|
+
readonly kg: KnowledgeGraph<unknown, string> | null;
|
|
253
|
+
/** Memory tiers bundle (null if not configured). */
|
|
254
|
+
readonly memoryTiers: MemoryTiersBundle<TMem> | null;
|
|
255
|
+
/**
|
|
256
|
+
* The mounted `MemoryWithTiersGraph` subgraph (null when `opts.tiers` was
|
|
257
|
+
* omitted). Surfaces the inner graph for `describe()` / `explain()` walks
|
|
258
|
+
* and for callers that need direct access to the tiers subgraph (e.g.
|
|
259
|
+
* to register additional disposers or attach storage). Companion to
|
|
260
|
+
* `memoryTiers`, which carries only the bundle's reactive surface (B5e).
|
|
261
|
+
*/
|
|
262
|
+
readonly tiers: MemoryWithTiersGraph<unknown, TMem> | null;
|
|
263
|
+
/**
|
|
264
|
+
* Reactive consumer API. Given a reactive `RetrievalQuery | null` source,
|
|
265
|
+
* returns a `Node` emitting the packed retrieval results. Composable with
|
|
266
|
+
* graph topology — subscribe it, chain it into `promptNode`, or switchMap
|
|
267
|
+
* over a user-input node.
|
|
268
|
+
*
|
|
269
|
+
* Each call mounts its own per-input subgraph at
|
|
270
|
+
* `retrieval::retrieve_${id}` (via `MemoryRetrievalGraph`); concurrent
|
|
271
|
+
* calls don't share state mirrors. One-shot consumers wrap with
|
|
272
|
+
* `awaitSettled(retrieveReactive(query))`.
|
|
273
|
+
*
|
|
274
|
+
* Null when no retrieval pipeline is configured.
|
|
275
|
+
*
|
|
276
|
+
* **QA F-9 (2026-04-30):** the prior `retrieval` / `retrievalTrace`
|
|
277
|
+
* shared state-node mirrors have been dropped. Use `retrieveReactive`
|
|
278
|
+
* for per-call reactive results; one-shot trace consumers should
|
|
279
|
+
* subscribe to the projection's upstream `result` derived directly
|
|
280
|
+
* via `view.target.resolve("retrieval::retrieve_${id}::result")`.
|
|
281
|
+
*/
|
|
282
|
+
readonly retrieveReactive: ((queryInput: NodeInput<RetrievalQuery | null>) => Node<ReadonlyArray<RetrievalEntry<TMem>>>) | null;
|
|
283
|
+
constructor(name: string, source: NodeInput<unknown>, opts: AgentMemoryOptions<TMem>);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Pre-wired agentic memory graph. Sugar over `distill` plus the
|
|
287
|
+
* `memoryWithVectors` / `memoryWithKG` / `memoryWithTiers` / `memoryRetrieval`
|
|
288
|
+
* composers. Power users who want a subset of capabilities can call those
|
|
289
|
+
* composers directly; this factory bundles them into one ergonomic call.
|
|
290
|
+
*
|
|
291
|
+
* Returns an {@link AgentMemoryGraph} subclass instance — `instanceof
|
|
292
|
+
* AgentMemoryGraph` narrows in callers (e.g. Phase 13.G `agent(spec)`).
|
|
293
|
+
*/
|
|
294
|
+
declare function agentMemory<TMem = unknown>(name: string, source: NodeInput<unknown>, opts: AgentMemoryOptions<TMem>): AgentMemoryGraph<TMem>;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Phase 13.G — `AgentBundle<TIn, TOut>` interface + `class AgentGraph extends Graph`.
|
|
298
|
+
*
|
|
299
|
+
* Source: `archive/docs/SESSION-multi-agent-gap-analysis.md` G1 lock B.
|
|
300
|
+
*
|
|
301
|
+
* Composes the existing substrate (`agentLoop`, `toolRegistry`,
|
|
302
|
+
* `agentMemory`) into a typed inbox/outbox subgraph that other parts of a
|
|
303
|
+
* multi-agent system can wire to. Sibling preset `agent()` (in
|
|
304
|
+
* `./agents.ts`) is the ergonomic factory; this file is the contract.
|
|
305
|
+
*
|
|
306
|
+
* **Cross-cut #1 lock (no `agent.run()`):** caller-side runtime entry is
|
|
307
|
+
* `bundle.in.emit(input)` + `awaitSettled(bundle.out)`. The legacy
|
|
308
|
+
* `agentLoop.run()` is still available on `bundle.graph.loop` for
|
|
309
|
+
* single-shot Promise-bridge use cases, but `agent()` does NOT expose a
|
|
310
|
+
* `run()` method on the bundle.
|
|
311
|
+
*
|
|
312
|
+
* **Memory partition default:** private memory per agent (each `agent(...)`
|
|
313
|
+
* call creates its own `AgentMemoryGraph` if none passed). Pass an explicit
|
|
314
|
+
* shared instance for §29 handoff context-transfer.
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Lifecycle status of an {@link AgentGraph}.
|
|
319
|
+
*
|
|
320
|
+
* - `idle` — no input has been received since construction or last reset.
|
|
321
|
+
* - `running` — inputs are flowing through the underlying agentLoop
|
|
322
|
+
* (collapses the loop's `thinking` + `acting` substates so consumers
|
|
323
|
+
* don't have to model the tool-call inner loop).
|
|
324
|
+
* - `verifying` — verifier subgraph is in flight (reserved; lights up when
|
|
325
|
+
* the verifier slot is added in a future wave per G7 recipe).
|
|
326
|
+
* - `done` — the most recent input has settled with a verified response.
|
|
327
|
+
* - `error` — the loop or verifier produced a terminal error.
|
|
328
|
+
*
|
|
329
|
+
* **Note (Phase 13.G, 2026-05-01):** v1 of `agent()` has no built-in
|
|
330
|
+
* verifier slot — `verifying` is reserved but never produced. When a
|
|
331
|
+
* verifier consumer surfaces, this enum widens (non-breaking type
|
|
332
|
+
* widening; existing consumers see the same `idle | running | done | error`
|
|
333
|
+
* subset).
|
|
334
|
+
*/
|
|
335
|
+
type AgentStatus = "idle" | "running" | "verifying" | "done" | "error";
|
|
336
|
+
/**
|
|
337
|
+
* Aggregated cost for an agent's run, surfaced as a `Node<CostState>` on
|
|
338
|
+
* the bundle. **Wraps the canonical {@link TokenUsage}** so consumers get
|
|
339
|
+
* the full provider-disaggregated token classes (cache-read /
|
|
340
|
+
* cache-write-5m / cache-write-1h / audio / image / video / tool-use /
|
|
341
|
+
* reasoning / prediction-accepted / prediction-rejected / extensions /
|
|
342
|
+
* auxiliary non-token costs / raw escape-hatch) without losing fidelity
|
|
343
|
+
* for downstream pricing. USD conversion is a downstream `derived` over
|
|
344
|
+
* `usage`.
|
|
345
|
+
*
|
|
346
|
+
* - `usage` — accumulated {@link TokenUsage} across all turns of the
|
|
347
|
+
* current input.
|
|
348
|
+
* - `turns` — number of completed agentLoop iterations (LLM invocations).
|
|
349
|
+
*
|
|
350
|
+
* **Counter scope:** resets to {@link ZERO_COST} on each new `bundle.in`
|
|
351
|
+
* emit (per-input cost rather than per-agent-lifetime). Sum across multiple
|
|
352
|
+
* inputs by snapshotting `cost` at `done` and accumulating externally —
|
|
353
|
+
* a per-lifetime cost is a downstream `scan` over this.
|
|
354
|
+
*
|
|
355
|
+
* **Helpers.** Use `sumInputTokens(usage)` / `sumOutputTokens(usage)` from
|
|
356
|
+
* `@graphrefly/graphrefly-ts` to flatten to scalars when the caller wants
|
|
357
|
+
* a single number.
|
|
358
|
+
*/
|
|
359
|
+
interface CostState {
|
|
360
|
+
readonly usage: TokenUsage;
|
|
361
|
+
readonly turns: number;
|
|
362
|
+
}
|
|
363
|
+
/** Empty cost. Used as the initial value and the per-input reset baseline. */
|
|
364
|
+
declare const ZERO_COST: CostState;
|
|
365
|
+
/**
|
|
366
|
+
* Accumulates two {@link TokenUsage} snapshots. All field classes are
|
|
367
|
+
* summed; optional fields propagate as `undefined` when absent from both
|
|
368
|
+
* sides, otherwise treated as 0 for the missing side. `auxiliary` and
|
|
369
|
+
* `extensions` merge by key. `raw` is dropped — it's a per-call escape
|
|
370
|
+
* hatch, not summable.
|
|
371
|
+
*
|
|
372
|
+
* @category extra
|
|
373
|
+
*/
|
|
374
|
+
declare function addUsage(a: TokenUsage, b: TokenUsage): TokenUsage;
|
|
375
|
+
/**
|
|
376
|
+
* Spec for {@link agent} (in `./agents.ts`). Required fields are minimal —
|
|
377
|
+
* `name` and `adapter` cover the common case where the input is a string
|
|
378
|
+
* and the output is the raw `LLMResponse`. Optional fields shape the
|
|
379
|
+
* agent's behavior:
|
|
380
|
+
*
|
|
381
|
+
* - **Mappers** (`inMapper` / `outMapper`) translate between caller-typed
|
|
382
|
+
* `TIn` / `TOut` and the loop's internal `string` / `LLMResponse`. Default
|
|
383
|
+
* identity mappers are wired automatically when `TIn` extends `string`
|
|
384
|
+
* and `TOut` extends `LLMResponse`.
|
|
385
|
+
* - **`tools`** is a reactive `NodeInput<readonly ToolDefinition[]>` —
|
|
386
|
+
* `agent()` subscribes and reconciles the underlying `toolRegistry`'s
|
|
387
|
+
* registrations on each emit. Static-array form is also accepted.
|
|
388
|
+
* - **`memory`** is an explicit `AgentMemoryGraph` instance for shared
|
|
389
|
+
* memory across agents (§29 handoff context transfer). Default: private
|
|
390
|
+
* memory per agent (each `agent()` call mints its own).
|
|
391
|
+
* - **`maxIterations`** caps the underlying agentLoop's tool-call inner
|
|
392
|
+
* loop. Default 10 (matches `agentLoop`).
|
|
393
|
+
* - **Verifier slot** is intentionally not in v1 — G7 reframe locks it as
|
|
394
|
+
* a caller-composed recipe. When a real consumer surfaces, a
|
|
395
|
+
* `verifier?: (out: Node<TOut>) => NodeInput<VerifierResult>` field
|
|
396
|
+
* lands here additively.
|
|
397
|
+
*/
|
|
398
|
+
interface AgentSpec<TIn, TOut> {
|
|
399
|
+
/** Local mount name when wired to a parent graph. Required. */
|
|
400
|
+
readonly name: string;
|
|
401
|
+
/** LLM adapter for the underlying agentLoop. Required. */
|
|
402
|
+
readonly adapter: LLMAdapter;
|
|
403
|
+
/** Optional system prompt. Static today; reactive widening pending. */
|
|
404
|
+
readonly systemPrompt?: string;
|
|
405
|
+
/**
|
|
406
|
+
* Optional reactive tool list. When a Node, the agent subscribes and
|
|
407
|
+
* reconciles the underlying `toolRegistry` registrations on each emit
|
|
408
|
+
* (additions registered, removals unregistered). When a static array,
|
|
409
|
+
* tools are registered once at construction.
|
|
410
|
+
*/
|
|
411
|
+
readonly tools?: Node<readonly ToolDefinition[]> | readonly ToolDefinition[];
|
|
412
|
+
/**
|
|
413
|
+
* Optional shared memory. Default: private (agent mints its own
|
|
414
|
+
* `AgentMemoryGraph` if needed; not yet wired into the loop's chat —
|
|
415
|
+
* that wiring is a separate follow-up). Pass an explicit instance to
|
|
416
|
+
* share memory across agents for §29 handoff context transfer.
|
|
417
|
+
*/
|
|
418
|
+
readonly memory?: AgentMemoryGraph<unknown>;
|
|
419
|
+
/**
|
|
420
|
+
* Maps caller-typed input → string for the underlying chat. Defaults to
|
|
421
|
+
* identity when `TIn extends string`; required otherwise.
|
|
422
|
+
*/
|
|
423
|
+
readonly inMapper?: (input: TIn) => string;
|
|
424
|
+
/**
|
|
425
|
+
* Maps the agentLoop's `LLMResponse` → caller-typed output. Defaults to
|
|
426
|
+
* identity when `TOut extends LLMResponse`; required otherwise.
|
|
427
|
+
*/
|
|
428
|
+
readonly outMapper?: (response: LLMResponse) => TOut;
|
|
429
|
+
/** Caps tool-call inner-loop iterations. Default 10. */
|
|
430
|
+
readonly maxIterations?: number;
|
|
431
|
+
/** Escape hatch for non-core fields. Surfaced in `describe()` via meta. */
|
|
432
|
+
readonly meta?: Record<string, unknown>;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Public contract for an agent — typed inbox/outbox + lifecycle / cost
|
|
436
|
+
* observables + the underlying graph for inspection / mounting.
|
|
437
|
+
*
|
|
438
|
+
* **Reactive entry:** caller writes to `in` (e.g. `bundle.in.emit(input)`).
|
|
439
|
+
* The agent reactively kicks the underlying loop and produces `out`.
|
|
440
|
+
*
|
|
441
|
+
* **Reactive exit:** caller reads `out` via `subscribe` (continuous) or
|
|
442
|
+
* `awaitSettled(out)` (single-shot). Both `in` and `out` stay SENTINEL
|
|
443
|
+
* (`cache === undefined`) until the first real emission — no `null`
|
|
444
|
+
* push-on-subscribe trap (per `feedback_use_prevdata_for_sentinel`).
|
|
445
|
+
*
|
|
446
|
+
* **Cross-graph wiring:** the bundle's `graph` is mountable under any
|
|
447
|
+
* parent via `parent.mount(name, bundle.graph)`. After mount, the bundle's
|
|
448
|
+
* Nodes are reachable through both the bundle reference (direct) and via
|
|
449
|
+
* `parent.node("<name>::out")` etc. (qualified path).
|
|
450
|
+
*/
|
|
451
|
+
interface AgentBundle<TIn, TOut> {
|
|
452
|
+
readonly in: Node<TIn>;
|
|
453
|
+
readonly out: Node<TOut>;
|
|
454
|
+
readonly status: Node<AgentStatus>;
|
|
455
|
+
readonly cost: Node<CostState>;
|
|
456
|
+
readonly graph: AgentGraph<TIn, TOut>;
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Graph subclass implementing {@link AgentBundle}. Mounts an inner
|
|
460
|
+
* {@link AgentLoopGraph} at `loop/`; `in` / `out` / `status` / `cost`
|
|
461
|
+
* surface the bundle contract as top-level nodes.
|
|
462
|
+
*
|
|
463
|
+
* Construction is internal — use the {@link agent} factory in
|
|
464
|
+
* `./agents.ts` for normal use. Direct `new AgentGraph(name, spec)` is
|
|
465
|
+
* supported for callers that want full control over mount order.
|
|
466
|
+
*
|
|
467
|
+
* **Topology:**
|
|
468
|
+
* ```
|
|
469
|
+
* <name>
|
|
470
|
+
* ├── loop (AgentLoopGraph subgraph)
|
|
471
|
+
* │ ├── chat
|
|
472
|
+
* │ ├── tools
|
|
473
|
+
* │ ├── status / turn / aborted / lastResponse / ...
|
|
474
|
+
* ├── in (Node<TIn>, SENTINEL until first emit)
|
|
475
|
+
* ├── out (Node<TOut>, SENTINEL until first response)
|
|
476
|
+
* ├── status (Node<AgentStatus>, mirror of loop.status)
|
|
477
|
+
* └── cost (Node<CostState>)
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* **Lifecycle:**
|
|
481
|
+
* - On `in` emit: `inMapper` projects to `string`; appended to
|
|
482
|
+
* `loop.chat`; loop status reset (`turn=0`, `aborted=false`,
|
|
483
|
+
* `status="thinking"`); per-input cost counters reset to zero.
|
|
484
|
+
* - On `loop.lastResponse` emit: cost rolls forward; `out` emits
|
|
485
|
+
* `outMapper(response)`.
|
|
486
|
+
* - On `loop.status="done"`: agent's status emits `"done"`.
|
|
487
|
+
* - On `loop.status="error"` (or any ERROR propagation): agent's status
|
|
488
|
+
* emits `"error"`.
|
|
489
|
+
*/
|
|
490
|
+
declare class AgentGraph<TIn, TOut> extends Graph {
|
|
491
|
+
/** The agent's typed inbox. Writable; `in.emit(value)` kicks the loop. */
|
|
492
|
+
readonly in: Node<TIn>;
|
|
493
|
+
/** The agent's typed outbox. SENTINEL until first response. */
|
|
494
|
+
readonly out: Node<TOut>;
|
|
495
|
+
/** Lifecycle status (translated from the underlying loop's substates). */
|
|
496
|
+
readonly status: Node<AgentStatus>;
|
|
497
|
+
/** Cumulative cost for the current / most-recent input. */
|
|
498
|
+
readonly cost: Node<CostState>;
|
|
499
|
+
/** The underlying agentLoop — exposed for inspection / advanced wiring. */
|
|
500
|
+
readonly loop: AgentLoopGraph;
|
|
501
|
+
/** Optional shared memory subgraph (mounted at `memory/` if provided). */
|
|
502
|
+
readonly memory: AgentMemoryGraph<unknown> | null;
|
|
503
|
+
constructor(spec: AgentSpec<TIn, TOut>, opts?: GraphOptions);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Phase 13.H — `agent(spec)` preset + `presetRegistry` sugar.
|
|
508
|
+
*
|
|
509
|
+
* Source: `archive/docs/SESSION-multi-agent-gap-analysis.md` G1 + G2.
|
|
510
|
+
*
|
|
511
|
+
* `agent()` is the ergonomic factory — given a parent Graph and an
|
|
512
|
+
* `AgentSpec`, mints an `AgentGraph`, mounts it under the parent at
|
|
513
|
+
* `spec.name`, and returns the `AgentBundle` contract.
|
|
514
|
+
*
|
|
515
|
+
* `presetRegistry()` is thin sugar over `reactiveMap` — a typed reactive
|
|
516
|
+
* map of `<id, preset>`. Pairs with `materialize` (Phase 13.C) for
|
|
517
|
+
* dynamic preset selection: callers store specs / factories / configs in
|
|
518
|
+
* the registry and `materialize` mounts the matching one based on a
|
|
519
|
+
* routing key.
|
|
520
|
+
*
|
|
521
|
+
* **Cross-cut #1 lock:** no `agent.run()` imperative sugar — caller-side
|
|
522
|
+
* runtime is `bundle.in.emit(input)` + `awaitSettled(bundle.out)`.
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Mints an {@link AgentGraph} from `spec`, mounts it under `parent` at
|
|
527
|
+
* `spec.name`, and returns the {@link AgentBundle} contract.
|
|
528
|
+
*
|
|
529
|
+
* **Default type parameters.** When called without explicit type params,
|
|
530
|
+
* `TIn` defaults to `string` and `TOut` to `LLMResponse` — the common
|
|
531
|
+
* case where the caller writes a user message and reads the raw response.
|
|
532
|
+
* Custom types require both `inMapper` and `outMapper` in the spec; the
|
|
533
|
+
* default mappers throw at runtime if `TIn` / `TOut` aren't string /
|
|
534
|
+
* LLMResponse.
|
|
535
|
+
*
|
|
536
|
+
* **Memory partition default.** Each `agent()` call mints its own
|
|
537
|
+
* `AgentMemoryGraph` if `spec.memory` is omitted (private memory; the
|
|
538
|
+
* common case). Pass an explicit shared instance — e.g.
|
|
539
|
+
* `agent(parent, { ..., memory: sharedMemory })` for two agents — to
|
|
540
|
+
* implement §29 handoff context transfer.
|
|
541
|
+
*
|
|
542
|
+
* **Reactive entry / exit:**
|
|
543
|
+
* - `bundle.in.emit(input)` kicks the loop reactively (no imperative
|
|
544
|
+
* `.run()` per cross-cut #1 lock).
|
|
545
|
+
* - `awaitSettled(bundle.out, { skipCurrent: true })` resolves on the
|
|
546
|
+
* first response after the kick. `skipCurrent` matters for the second
|
|
547
|
+
* call onward — `out` caches the prior response.
|
|
548
|
+
*
|
|
549
|
+
* **Mounting.** The factory mounts under `parent.mount(spec.name, ...)`.
|
|
550
|
+
* The slot name must be free on `parent` at construction time. To keep
|
|
551
|
+
* the agent unmounted, construct `new AgentGraph(spec)` directly.
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```ts
|
|
555
|
+
* import { agent, awaitSettled, Graph } from "@graphrefly/graphrefly-ts";
|
|
556
|
+
*
|
|
557
|
+
* const parent = new Graph("parent");
|
|
558
|
+
* const a = agent(parent, {
|
|
559
|
+
* name: "researcher",
|
|
560
|
+
* adapter: openaiAdapter,
|
|
561
|
+
* systemPrompt: "Research the user's question carefully.",
|
|
562
|
+
* });
|
|
563
|
+
* a.in.emit("What's the capital of France?");
|
|
564
|
+
* const resp = await awaitSettled(a.out, { skipCurrent: true });
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @category patterns
|
|
568
|
+
*/
|
|
569
|
+
declare function agent<TIn = string, TOut = LLMResponse>(parent: Graph, spec: AgentSpec<TIn, TOut>): AgentBundle<TIn, TOut>;
|
|
570
|
+
/**
|
|
571
|
+
* The bundle returned by {@link presetRegistry}. Wraps a `reactiveMap`
|
|
572
|
+
* with imperative `put` / `remove` shortcuts and exposes the underlying
|
|
573
|
+
* `registry` for direct reactive consumption (`.entries` is a
|
|
574
|
+
* `Node<ReadonlyMap<string, TPreset>>`).
|
|
575
|
+
*
|
|
576
|
+
* Use the `registry.entries` Node directly with {@link materialize} (Phase
|
|
577
|
+
* 13.C) — pass it as the `factories` argument when `TPreset` is itself
|
|
578
|
+
* a `() => Graph` factory thunk, or transform via `derived` when
|
|
579
|
+
* `TPreset` is a richer spec type that needs a `spec → factory` adapter.
|
|
580
|
+
*/
|
|
581
|
+
interface PresetRegistryBundle<TPreset> {
|
|
582
|
+
/**
|
|
583
|
+
* The underlying reactive map. `registry.entries` is the
|
|
584
|
+
* `Node<ReadonlyMap<string, TPreset>>` — pass directly to
|
|
585
|
+
* {@link materialize} when preset shape matches the factories arg.
|
|
586
|
+
*/
|
|
587
|
+
readonly registry: ReactiveMapBundle<string, TPreset>;
|
|
588
|
+
/** Imperative add / replace. Always emits a fresh snapshot. */
|
|
589
|
+
put(id: string, preset: TPreset): void;
|
|
590
|
+
/** Imperative remove. Returns `true` if the id was present. */
|
|
591
|
+
remove(id: string): boolean;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Thin sugar over `reactiveMap` — a typed registry of `<id, preset>` for
|
|
595
|
+
* agent / strategy / persona / skill catalogs.
|
|
596
|
+
*
|
|
597
|
+
* **Generic over preset shape.** `TPreset` is open — could be an
|
|
598
|
+
* {@link AgentSpec}, a `() => Graph` factory thunk, a static config
|
|
599
|
+
* object, or anything else. Decoupled from `agent()` so the same primitive
|
|
600
|
+
* powers harnessLoop strategy registries, pipelineGraph stage catalogs,
|
|
601
|
+
* etc.
|
|
602
|
+
*
|
|
603
|
+
* **Composes with `materialize`.** When `TPreset` is a `() => Graph`
|
|
604
|
+
* factory, pass `registry.entries` directly to
|
|
605
|
+
* {@link materialize} as the `factories` argument. When `TPreset` is a
|
|
606
|
+
* spec, transform via `derived` to build a `Map<id, () => Graph>` adapter:
|
|
607
|
+
*
|
|
608
|
+
* ```ts
|
|
609
|
+
* const presets = presetRegistry<AgentSpec<string, LLMResponse>>();
|
|
610
|
+
* presets.put("researcher", { name: "researcher", adapter, systemPrompt: "..." });
|
|
611
|
+
*
|
|
612
|
+
* // Adapter: spec → factory.
|
|
613
|
+
* const factories = derived(
|
|
614
|
+
* [presets.registry.entries],
|
|
615
|
+
* ([m]) => new Map(
|
|
616
|
+
* [...m].map(([id, spec]) => [id, () => new AgentGraph(spec)]),
|
|
617
|
+
* ),
|
|
618
|
+
* );
|
|
619
|
+
* const slot = materialize(activeKey, factories, parent);
|
|
620
|
+
* ```
|
|
621
|
+
*
|
|
622
|
+
* @param initial - Optional initial entries.
|
|
623
|
+
* @returns {@link PresetRegistryBundle}.
|
|
624
|
+
*
|
|
625
|
+
* @category patterns
|
|
626
|
+
*/
|
|
627
|
+
declare function presetRegistry<TPreset>(initial?: ReadonlyMap<string, TPreset>): PresetRegistryBundle<TPreset>;
|
|
628
|
+
|
|
629
|
+
export { type AgentBundle as A, type CostState as C, type PresetRegistryBundle as P, ZERO_COST as Z, AgentGraph as a, AgentLoopGraph as b, type AgentLoopOptions as c, type AgentLoopStatus as d, AgentMemoryGraph as e, type AgentMemoryOptions as f, type AgentSpec as g, type AgentStatus as h, addUsage as i, agent as j, agentLoop as k, agentMemory as l, presetRegistry as p };
|