@callbag-recharge/callbag-recharge 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/http.cjs +4 -4
- package/dist/adapters/http.d.cts +3 -3
- package/dist/adapters/http.d.ts +3 -3
- package/dist/adapters/http.js +1 -1
- package/dist/adapters/index.cjs +12 -12
- package/dist/adapters/index.d.cts +3 -3
- package/dist/adapters/index.d.ts +3 -3
- package/dist/adapters/index.js +1 -1
- package/dist/adapters/llm.cjs +5 -5
- package/dist/adapters/llm.d.cts +3 -3
- package/dist/adapters/llm.d.ts +3 -3
- package/dist/adapters/llm.js +1 -1
- package/dist/adapters/mcp.cjs +5 -5
- package/dist/adapters/mcp.d.cts +3 -3
- package/dist/adapters/mcp.d.ts +3 -3
- package/dist/adapters/mcp.js +1 -1
- package/dist/adapters/sse.cjs +10 -10
- package/dist/adapters/sse.d.cts +2 -2
- package/dist/adapters/sse.d.ts +2 -2
- package/dist/adapters/sse.js +1 -1
- package/dist/adapters/webhook.cjs +4 -4
- package/dist/adapters/webhook.d.cts +3 -3
- package/dist/adapters/webhook.d.ts +3 -3
- package/dist/adapters/webhook.js +1 -1
- package/dist/adapters/websocket.cjs +4 -4
- package/dist/adapters/websocket.d.cts +5 -5
- package/dist/adapters/websocket.d.ts +5 -5
- package/dist/adapters/websocket.js +1 -1
- package/dist/chunk-3AE6AS32.js +1 -0
- package/dist/chunk-3CHC2PEC.js +1 -0
- package/dist/chunk-4CRFPOTP.js +1 -0
- package/dist/chunk-5WFSQQDI.js +1 -0
- package/dist/chunk-6AITKURG.js +1 -0
- package/dist/chunk-6HLLZVDR.js +1 -0
- package/dist/chunk-6L3J4GGT.js +1 -0
- package/dist/{chunk-LDYBNZRJ.js → chunk-6ZKDN5EW.js} +1 -1
- package/dist/{chunk-SMRLX65A.js → chunk-7D7FHBCO.js} +1 -1
- package/dist/{chunk-FMVP37XC.js → chunk-7IW7ADDI.js} +1 -1
- package/dist/{chunk-M76W372U.js → chunk-7MY7DDET.js} +1 -1
- package/dist/chunk-A3YLDNEZ.js +1 -0
- package/dist/chunk-AJJTUL2L.js +1 -0
- package/dist/chunk-AQFWFFHP.js +1 -0
- package/dist/chunk-ATMRBZH2.js +1 -0
- package/dist/{chunk-WJ324SEE.js → chunk-BERYVZLY.js} +1 -1
- package/dist/chunk-BO6RJZ2Z.js +1 -0
- package/dist/{chunk-2IPYZVLQ.js → chunk-BQOJYKJT.js} +1 -1
- package/dist/{chunk-JR7AWDIG.js → chunk-C45X5AKN.js} +1 -1
- package/dist/chunk-CCB7OSCT.js +1 -0
- package/dist/{chunk-PUJBUJ22.js → chunk-CV6GBX5N.js} +1 -1
- package/dist/chunk-D6NMIIMQ.js +1 -0
- package/dist/chunk-EE6I3ASX.js +1 -0
- package/dist/{chunk-H2YDDQLL.js → chunk-EGJGBVCR.js} +1 -1
- package/dist/{chunk-GIXPYYX7.js → chunk-ER32MJVM.js} +1 -1
- package/dist/{chunk-QVJVAMYW.js → chunk-F4CU5CTA.js} +1 -1
- package/dist/{chunk-3AKMJ3CZ.js → chunk-FCEJOYU4.js} +1 -1
- package/dist/{chunk-LMOUWL76.js → chunk-FJNLQSK3.js} +1 -1
- package/dist/{chunk-KWTA2EOH.js → chunk-FV76ERZO.js} +1 -1
- package/dist/chunk-G7XILF6J.js +1 -0
- package/dist/chunk-GMLWTZFM.js +1 -0
- package/dist/chunk-GPHUNLET.js +1 -0
- package/dist/{chunk-HE2JY76U.js → chunk-GWRUTGV5.js} +1 -1
- package/dist/{chunk-HZW5L62J.js → chunk-HDPUS5OO.js} +1 -1
- package/dist/{chunk-SAJ7SY4Z.js → chunk-HILO5AS5.js} +1 -1
- package/dist/{chunk-V7QCYGUL.js → chunk-I2PZF4K6.js} +1 -1
- package/dist/chunk-I3BXIZVS.js +1 -0
- package/dist/{chunk-IVMTQFPB.js → chunk-IDTXL7PH.js} +1 -1
- package/dist/{chunk-E4AFG53N.js → chunk-KQDEYS2F.js} +1 -1
- package/dist/{chunk-LLLQTXBH.js → chunk-KUPHN4EE.js} +1 -1
- package/dist/{chunk-P5MXN4AF.js → chunk-KYY5ZPIG.js} +1 -1
- package/dist/chunk-LJNELNJP.js +1 -0
- package/dist/chunk-LUIHMMPZ.js +1 -0
- package/dist/{chunk-R7KF4ZVM.js → chunk-LXMAXJR5.js} +1 -1
- package/dist/{chunk-2OD7DSKQ.js → chunk-N2NDQCQO.js} +1 -1
- package/dist/chunk-NJEXVXD4.js +11 -0
- package/dist/{chunk-ZNFMGI2B.js → chunk-O2MPU5AE.js} +1 -1
- package/dist/{chunk-HMTVETW3.js → chunk-O3PSGN2O.js} +1 -1
- package/dist/{chunk-HGQF7SDJ.js → chunk-O6DCBOUE.js} +1 -1
- package/dist/{chunk-V347V3CS.js → chunk-ODY2WVV5.js} +1 -1
- package/dist/chunk-PP6QV2U4.js +1 -0
- package/dist/{chunk-VK3KSIWC.js → chunk-R363TL2A.js} +1 -1
- package/dist/{chunk-HP3Y5P4H.js → chunk-RQAJX7IG.js} +1 -1
- package/dist/{chunk-6EGOWDWF.js → chunk-S7ZMYSVO.js} +1 -1
- package/dist/chunk-SD5J4GZV.js +1 -0
- package/dist/chunk-SVCEBPU2.js +1 -0
- package/dist/{chunk-UMEIL4ZR.js → chunk-T4VDAIVN.js} +1 -1
- package/dist/chunk-TUPD47IE.js +1 -0
- package/dist/chunk-UC4T2SXM.js +1 -0
- package/dist/{chunk-6QYIOJBL.js → chunk-UEV5KYZK.js} +1 -1
- package/dist/chunk-ULFYO3TG.js +1 -0
- package/dist/chunk-UMSWDYDW.js +1 -0
- package/dist/{chunk-POETNQZ3.js → chunk-UQF6RSKP.js} +1 -1
- package/dist/{chunk-ULBRGC4X.js → chunk-UQTRJP46.js} +1 -1
- package/dist/{chunk-UGLHK25A.js → chunk-UY6CC6LO.js} +1 -1
- package/dist/{chunk-6HF3HFK2.js → chunk-UZUDFSE5.js} +1 -1
- package/dist/chunk-VO7NNLTJ.js +1 -0
- package/dist/chunk-VZ5VR7ON.js +1 -0
- package/dist/chunk-WUG5FVJK.js +1 -0
- package/dist/{chunk-CZ7UWY4Z.js → chunk-WWRDVOBH.js} +1 -1
- package/dist/{chunk-WGPBJVHE.js → chunk-XUYHR7J6.js} +1 -1
- package/dist/chunk-Z47453CJ.js +1 -0
- package/dist/chunk-ZOWERC3D.js +1 -0
- package/dist/compat/jotai/index.cjs +4 -4
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -1
- package/dist/compat/nanostores/index.cjs +4 -4
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -1
- package/dist/compat/react/index.cjs +1 -1
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/react/index.js +1 -1
- package/dist/compat/signals/index.cjs +4 -4
- package/dist/compat/signals/index.d.cts +6 -2
- package/dist/compat/signals/index.d.ts +6 -2
- package/dist/compat/signals/index.js +1 -1
- package/dist/compat/vue/index.cjs +1 -1
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/vue/index.js +1 -1
- package/dist/compat/zustand/index.cjs +4 -4
- package/dist/compat/zustand/index.d.cts +1 -1
- package/dist/compat/zustand/index.d.ts +1 -1
- package/dist/compat/zustand/index.js +1 -1
- package/dist/data/index.cjs +4 -4
- package/dist/data/index.d.cts +4 -4
- package/dist/data/index.d.ts +4 -4
- package/dist/data/index.js +1 -1
- package/dist/extra/buffer.cjs +4 -4
- package/dist/extra/buffer.d.cts +2 -2
- package/dist/extra/buffer.d.ts +2 -2
- package/dist/extra/buffer.js +1 -1
- package/dist/extra/bufferTime.cjs +4 -4
- package/dist/extra/bufferTime.d.cts +2 -2
- package/dist/extra/bufferTime.d.ts +2 -2
- package/dist/extra/bufferTime.js +1 -1
- package/dist/extra/combine.cjs +4 -4
- package/dist/extra/combine.d.cts +2 -2
- package/dist/extra/combine.d.ts +2 -2
- package/dist/extra/combine.js +1 -1
- package/dist/extra/concat.cjs +4 -4
- package/dist/extra/concat.d.cts +2 -2
- package/dist/extra/concat.d.ts +2 -2
- package/dist/extra/concat.js +1 -1
- package/dist/extra/concatMap.cjs +4 -4
- package/dist/extra/concatMap.d.cts +2 -2
- package/dist/extra/concatMap.d.ts +2 -2
- package/dist/extra/concatMap.js +1 -1
- package/dist/extra/debounce.cjs +4 -4
- package/dist/extra/debounce.d.cts +2 -2
- package/dist/extra/debounce.d.ts +2 -2
- package/dist/extra/debounce.js +1 -1
- package/dist/extra/delay.cjs +4 -4
- package/dist/extra/delay.d.cts +2 -2
- package/dist/extra/delay.d.ts +2 -2
- package/dist/extra/delay.js +1 -1
- package/dist/extra/distinctUntilChanged.cjs +4 -4
- package/dist/extra/distinctUntilChanged.d.cts +2 -2
- package/dist/extra/distinctUntilChanged.d.ts +2 -2
- package/dist/extra/distinctUntilChanged.js +1 -1
- package/dist/extra/elementAt.cjs +4 -4
- package/dist/extra/elementAt.d.cts +2 -2
- package/dist/extra/elementAt.d.ts +2 -2
- package/dist/extra/elementAt.js +1 -1
- package/dist/extra/empty.cjs +4 -4
- package/dist/extra/empty.d.cts +2 -2
- package/dist/extra/empty.d.ts +2 -2
- package/dist/extra/empty.js +1 -1
- package/dist/extra/exhaustMap.cjs +4 -4
- package/dist/extra/exhaustMap.d.cts +2 -2
- package/dist/extra/exhaustMap.d.ts +2 -2
- package/dist/extra/exhaustMap.js +1 -1
- package/dist/extra/filter.cjs +4 -4
- package/dist/extra/filter.d.cts +2 -2
- package/dist/extra/filter.d.ts +2 -2
- package/dist/extra/filter.js +1 -1
- package/dist/extra/find.cjs +4 -4
- package/dist/extra/find.d.cts +2 -2
- package/dist/extra/find.d.ts +2 -2
- package/dist/extra/find.js +1 -1
- package/dist/extra/first.cjs +4 -4
- package/dist/extra/first.d.cts +2 -2
- package/dist/extra/first.d.ts +2 -2
- package/dist/extra/first.js +1 -1
- package/dist/extra/flat.cjs +4 -4
- package/dist/extra/flat.d.cts +2 -2
- package/dist/extra/flat.d.ts +2 -2
- package/dist/extra/flat.js +1 -1
- package/dist/extra/forEach.cjs +1 -1
- package/dist/extra/forEach.d.cts +5 -5
- package/dist/extra/forEach.d.ts +5 -5
- package/dist/extra/forEach.js +1 -1
- package/dist/extra/fromEvent.cjs +4 -4
- package/dist/extra/fromEvent.d.cts +2 -2
- package/dist/extra/fromEvent.d.ts +2 -2
- package/dist/extra/fromEvent.js +1 -1
- package/dist/extra/fromIter.cjs +4 -4
- package/dist/extra/fromIter.d.cts +2 -2
- package/dist/extra/fromIter.d.ts +2 -2
- package/dist/extra/fromIter.js +1 -1
- package/dist/extra/fromObs.cjs +4 -4
- package/dist/extra/fromObs.d.cts +2 -2
- package/dist/extra/fromObs.d.ts +2 -2
- package/dist/extra/fromObs.js +1 -1
- package/dist/extra/fromPromise.cjs +4 -4
- package/dist/extra/fromPromise.d.cts +2 -2
- package/dist/extra/fromPromise.d.ts +2 -2
- package/dist/extra/fromPromise.js +1 -1
- package/dist/extra/index.cjs +4 -4
- package/dist/extra/index.d.cts +2 -2
- package/dist/extra/index.d.ts +2 -2
- package/dist/extra/index.js +1 -1
- package/dist/extra/interval.cjs +4 -4
- package/dist/extra/interval.d.cts +2 -2
- package/dist/extra/interval.d.ts +2 -2
- package/dist/extra/interval.js +1 -1
- package/dist/extra/last.cjs +4 -4
- package/dist/extra/last.d.cts +2 -2
- package/dist/extra/last.d.ts +2 -2
- package/dist/extra/last.js +1 -1
- package/dist/extra/map.cjs +4 -4
- package/dist/extra/map.d.cts +2 -2
- package/dist/extra/map.d.ts +2 -2
- package/dist/extra/map.js +1 -1
- package/dist/extra/merge.cjs +4 -4
- package/dist/extra/merge.d.cts +2 -2
- package/dist/extra/merge.d.ts +2 -2
- package/dist/extra/merge.js +1 -1
- package/dist/extra/never.cjs +4 -4
- package/dist/extra/never.d.cts +2 -2
- package/dist/extra/never.d.ts +2 -2
- package/dist/extra/never.js +1 -1
- package/dist/extra/of.cjs +4 -4
- package/dist/extra/of.d.cts +2 -2
- package/dist/extra/of.d.ts +2 -2
- package/dist/extra/of.js +1 -1
- package/dist/extra/pairwise.cjs +4 -4
- package/dist/extra/pairwise.d.cts +2 -2
- package/dist/extra/pairwise.d.ts +2 -2
- package/dist/extra/pairwise.js +1 -1
- package/dist/extra/partition.cjs +4 -4
- package/dist/extra/partition.d.cts +2 -2
- package/dist/extra/partition.d.ts +2 -2
- package/dist/extra/partition.js +1 -1
- package/dist/extra/pipeRaw.cjs +4 -4
- package/dist/extra/pipeRaw.d.cts +2 -2
- package/dist/extra/pipeRaw.d.ts +2 -2
- package/dist/extra/pipeRaw.js +1 -1
- package/dist/extra/remember.cjs +4 -4
- package/dist/extra/remember.d.cts +2 -2
- package/dist/extra/remember.d.ts +2 -2
- package/dist/extra/remember.js +1 -1
- package/dist/extra/repeat.cjs +4 -4
- package/dist/extra/repeat.d.cts +2 -2
- package/dist/extra/repeat.d.ts +2 -2
- package/dist/extra/repeat.js +1 -1
- package/dist/extra/rescue.cjs +4 -4
- package/dist/extra/rescue.d.cts +2 -2
- package/dist/extra/rescue.d.ts +2 -2
- package/dist/extra/rescue.js +1 -1
- package/dist/extra/sample.cjs +4 -4
- package/dist/extra/sample.d.cts +2 -2
- package/dist/extra/sample.d.ts +2 -2
- package/dist/extra/sample.js +1 -1
- package/dist/extra/scan.cjs +4 -4
- package/dist/extra/scan.d.cts +2 -2
- package/dist/extra/scan.d.ts +2 -2
- package/dist/extra/scan.js +1 -1
- package/dist/extra/share.d.cts +2 -2
- package/dist/extra/share.d.ts +2 -2
- package/dist/extra/skip.cjs +4 -4
- package/dist/extra/skip.d.cts +2 -2
- package/dist/extra/skip.d.ts +2 -2
- package/dist/extra/skip.js +1 -1
- package/dist/extra/startWith.cjs +4 -4
- package/dist/extra/startWith.d.cts +2 -2
- package/dist/extra/startWith.d.ts +2 -2
- package/dist/extra/startWith.js +1 -1
- package/dist/extra/streamParse.cjs +4 -4
- package/dist/extra/streamParse.d.cts +2 -2
- package/dist/extra/streamParse.d.ts +2 -2
- package/dist/extra/streamParse.js +1 -1
- package/dist/extra/subject.cjs +4 -4
- package/dist/extra/subject.d.cts +2 -2
- package/dist/extra/subject.d.ts +2 -2
- package/dist/extra/subject.js +1 -1
- package/dist/extra/subscribe.cjs +1 -1
- package/dist/extra/subscribe.d.cts +14 -17
- package/dist/extra/subscribe.d.ts +14 -17
- package/dist/extra/subscribe.js +1 -1
- package/dist/extra/switchMap.cjs +4 -4
- package/dist/extra/switchMap.d.cts +2 -2
- package/dist/extra/switchMap.d.ts +2 -2
- package/dist/extra/switchMap.js +1 -1
- package/dist/extra/take.cjs +4 -4
- package/dist/extra/take.d.cts +2 -2
- package/dist/extra/take.d.ts +2 -2
- package/dist/extra/take.js +1 -1
- package/dist/extra/takeUntil.cjs +4 -4
- package/dist/extra/takeUntil.d.cts +2 -2
- package/dist/extra/takeUntil.d.ts +2 -2
- package/dist/extra/takeUntil.js +1 -1
- package/dist/extra/takeWhile.cjs +4 -4
- package/dist/extra/takeWhile.d.cts +2 -2
- package/dist/extra/takeWhile.d.ts +2 -2
- package/dist/extra/takeWhile.js +1 -1
- package/dist/extra/tap.cjs +4 -4
- package/dist/extra/tap.d.cts +2 -2
- package/dist/extra/tap.d.ts +2 -2
- package/dist/extra/tap.js +1 -1
- package/dist/extra/throttle.cjs +4 -4
- package/dist/extra/throttle.d.cts +2 -2
- package/dist/extra/throttle.d.ts +2 -2
- package/dist/extra/throttle.js +1 -1
- package/dist/extra/throwError.cjs +4 -4
- package/dist/extra/throwError.d.cts +2 -2
- package/dist/extra/throwError.d.ts +2 -2
- package/dist/extra/throwError.js +1 -1
- package/dist/extra/timeout.cjs +4 -4
- package/dist/extra/timeout.d.cts +2 -2
- package/dist/extra/timeout.d.ts +2 -2
- package/dist/extra/timeout.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +4 -4
- package/dist/memory/index.d.ts +4 -4
- package/dist/memory/index.js +1 -1
- package/dist/orchestrate/index.cjs +8 -6
- package/dist/orchestrate/index.d.cts +375 -18
- package/dist/orchestrate/index.d.ts +375 -18
- package/dist/orchestrate/index.js +5 -3
- package/dist/patterns/agentLoop/index.cjs +4 -4
- package/dist/patterns/agentLoop/index.d.cts +2 -2
- package/dist/patterns/agentLoop/index.d.ts +2 -2
- package/dist/patterns/agentLoop/index.js +1 -1
- package/dist/patterns/chatStream/index.cjs +4 -4
- package/dist/patterns/chatStream/index.d.cts +2 -2
- package/dist/patterns/chatStream/index.d.ts +2 -2
- package/dist/patterns/chatStream/index.js +1 -1
- package/dist/patterns/createStore/index.cjs +4 -4
- package/dist/patterns/createStore/index.d.cts +4 -3
- package/dist/patterns/createStore/index.d.ts +4 -3
- package/dist/patterns/createStore/index.js +1 -1
- package/dist/patterns/formField/index.cjs +4 -4
- package/dist/patterns/formField/index.d.cts +2 -2
- package/dist/patterns/formField/index.d.ts +2 -2
- package/dist/patterns/formField/index.js +1 -1
- package/dist/patterns/hybridRoute/index.cjs +4 -4
- package/dist/patterns/hybridRoute/index.d.cts +2 -2
- package/dist/patterns/hybridRoute/index.d.ts +2 -2
- package/dist/patterns/hybridRoute/index.js +1 -1
- package/dist/patterns/memoryStore/index.cjs +4 -4
- package/dist/patterns/memoryStore/index.d.cts +4 -4
- package/dist/patterns/memoryStore/index.d.ts +4 -4
- package/dist/patterns/memoryStore/index.js +1 -1
- package/dist/patterns/pagination/index.cjs +4 -4
- package/dist/patterns/pagination/index.d.cts +2 -2
- package/dist/patterns/pagination/index.d.ts +2 -2
- package/dist/patterns/pagination/index.js +1 -1
- package/dist/patterns/rateLimiter/index.cjs +4 -4
- package/dist/patterns/rateLimiter/index.d.cts +2 -2
- package/dist/patterns/rateLimiter/index.d.ts +2 -2
- package/dist/patterns/rateLimiter/index.js +1 -1
- package/dist/patterns/textBuffer/index.cjs +7 -7
- package/dist/patterns/textBuffer/index.d.cts +2 -2
- package/dist/patterns/textBuffer/index.d.ts +2 -2
- package/dist/patterns/textBuffer/index.js +1 -1
- package/dist/patterns/textEditor/index.cjs +15 -15
- package/dist/patterns/textEditor/index.d.cts +3 -3
- package/dist/patterns/textEditor/index.d.ts +3 -3
- package/dist/patterns/textEditor/index.js +9 -9
- package/dist/patterns/toolCallState/index.cjs +4 -4
- package/dist/patterns/toolCallState/index.d.cts +2 -2
- package/dist/patterns/toolCallState/index.d.ts +2 -2
- package/dist/patterns/toolCallState/index.js +1 -1
- package/dist/patterns/undoRedo/index.cjs +4 -4
- package/dist/patterns/undoRedo/index.d.cts +2 -2
- package/dist/patterns/undoRedo/index.d.ts +2 -2
- package/dist/patterns/undoRedo/index.js +1 -1
- package/dist/{protocol-BVxRx57r.d.cts → protocol-fwiQ1TAS.d.cts} +20 -2
- package/dist/{protocol-BVxRx57r.d.ts → protocol-fwiQ1TAS.d.ts} +20 -2
- package/dist/{retry-dPqizArs.d.cts → retry-BLWpwKES.d.cts} +2 -2
- package/dist/{retry-CzvIREKf.d.ts → retry-KAgppYVn.d.ts} +2 -2
- package/dist/{types-CxUi8apg.d.cts → types-BHpdU2-O.d.cts} +2 -2
- package/dist/{types-BwU0Zcuz.d.cts → types-BohB8jJr.d.cts} +1 -1
- package/dist/{types-DGII6w5S.d.ts → types-CB1htCM8.d.ts} +1 -1
- package/dist/{types-BgibwR4K.d.cts → types-CrTRz6Oy.d.cts} +1 -1
- package/dist/{types-CuaRJ4Jz.d.ts → types-DETBg0QM.d.ts} +2 -2
- package/dist/{types-C46oZpWV.d.ts → types-Ds0-O16t.d.ts} +1 -1
- package/dist/utils/index.cjs +4 -4
- package/dist/utils/index.d.cts +33 -52
- package/dist/utils/index.d.ts +33 -52
- package/dist/utils/index.js +1 -1
- package/dist/{validationPipeline-DWE3jF8O.d.cts → validationPipeline-BI_SE3Cz.d.cts} +1 -1
- package/dist/{validationPipeline-U1qQHWFh.d.ts → validationPipeline-JPHJzW3f.d.ts} +1 -1
- package/dist/{withStatus-BJI4TOZV.d.ts → withStatus---CFNir7.d.ts} +1 -1
- package/dist/{withStatus-BQCWdfrH.d.cts → withStatus-ByT_R2Rz.d.cts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-246NHV2C.js +0 -1
- package/dist/chunk-27ALPEGS.js +0 -1
- package/dist/chunk-2DSZBUDC.js +0 -1
- package/dist/chunk-2SUJFXLJ.js +0 -1
- package/dist/chunk-4QMLJ5NF.js +0 -1
- package/dist/chunk-57POOBOS.js +0 -1
- package/dist/chunk-7OBLM7WJ.js +0 -1
- package/dist/chunk-AHPGP6IY.js +0 -1
- package/dist/chunk-AWNDBSWN.js +0 -1
- package/dist/chunk-BXJY72NZ.js +0 -1
- package/dist/chunk-CWP55MPE.js +0 -1
- package/dist/chunk-CXF5XC6M.js +0 -1
- package/dist/chunk-DKV5ERLQ.js +0 -1
- package/dist/chunk-EJWPOQ3M.js +0 -1
- package/dist/chunk-G6E4ECVJ.js +0 -1
- package/dist/chunk-HIHLITY7.js +0 -1
- package/dist/chunk-J3QF6BR6.js +0 -1
- package/dist/chunk-JESACHQB.js +0 -1
- package/dist/chunk-JZEPFPK5.js +0 -1
- package/dist/chunk-K3CTYYBO.js +0 -1
- package/dist/chunk-LEK3WMVM.js +0 -1
- package/dist/chunk-N67ZXLEF.js +0 -1
- package/dist/chunk-PHO4NMDP.js +0 -1
- package/dist/chunk-Q6BCSEZ2.js +0 -1
- package/dist/chunk-T2XJDIOR.js +0 -1
- package/dist/chunk-TTLPYOAV.js +0 -1
- package/dist/chunk-UNEFE3LZ.js +0 -1
- package/dist/chunk-UVLBN37H.js +0 -1
- package/dist/chunk-VTOKDWUK.js +0 -1
- package/dist/chunk-X6RLUCXO.js +0 -11
- package/dist/chunk-XZV5OCPF.js +0 -1
- package/dist/chunk-YJXCVG35.js +0 -1
- package/dist/chunk-YN4VWXAF.js +0 -1
- package/dist/chunk-YOAFIOPU.js +0 -1
package/dist/adapters/http.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}static _observe(e,i,n){let s=null,r=i??t.getName(e),o={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:r,dispose:()=>s?.(
|
|
3
|
-
`)}static toD2(e){let i=e?.direction??"down",n=t.snapshot(),s=[`direction: ${i}`,""],r={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},o=new Map;function a(c){let
|
|
4
|
-
`)}static annotate(e,i){if(!t.enabled)return;t._annotations.set(e,i);let n={node:t._resolveKey(e),reason:i,timestamp:Date.now()},s=t.maxTraceEntries;s<=0||(t._traceLog.length<s?t._traceLog.push(n):(t._traceLog[t._traceHead]=n,t._traceFull=!0),t._traceHead=(t._traceHead+1)%s)}static getAnnotation(e){return t._annotations.get(e)}static traceLog(){return t._traceFull?[...t._traceLog.slice(t._traceHead),...t._traceLog.slice(0,t._traceHead)]:t._traceLog.slice(0,t._traceHead||t._traceLog.length)}static clearTrace(){t._traceLog=[],t._traceHead=0,t._traceFull=!1}static _reset(){t._names=new WeakMap,t._kinds=new WeakMap,t._keys=new WeakMap,t._stores=new Set,t._edges=new Map,t._usedKeys=new Set,t._nextId=0,t._explicitEnabled=null,t._cachedDefault=null,t._annotations=new WeakMap,t._traceLog=[],t._traceHead=0,t._traceFull=!1,t.maxTraceEntries=1e3}};var
|
|
1
|
+
"use strict";var et=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var wt=Object.getOwnPropertyNames;var Lt=Object.prototype.hasOwnProperty;var Ot=(t,e)=>{for(var i in e)et(t,i,{get:e[i],enumerable:!0})},At=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of wt(e))!Lt.call(t,s)&&s!==i&&et(t,s,{get:()=>e[s],enumerable:!(n=Rt(e,s))||n.enumerable});return t};var It=t=>At(et({},"__esModule",{value:!0}),t);var jt={};Ot(jt,{fromHTTP:()=>Ct});module.exports=It(jt);var k=Symbol("DIRTY"),G=Symbol("RESOLVED"),lt=Symbol("SINGLE_DEP"),$=Symbol("RESET"),st=Symbol("PAUSE"),it=Symbol("RESUME"),rt=Symbol("TEARDOWN");function ut(t){return t===$||t===st||t===it||t===rt}var ct=0,ft=1,dt=2,pt=3,gt=4,ht=5,R=7,ot=7<<R,$t=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function _t(t){return $t[(t&ot)>>>R]}var _=0,v=1,h=2,S=3,H=0,Y=[],nt=!1;function M(t){H++;try{return t()}finally{if(H--,H===0&&!nt){nt=!0;for(let e=0;e<Y.length;e++)Y[e]();Y.length=0,nt=!1}}}function z(){return H>0}function B(t){Y.push(t)}var q=0,V=[];function St(){q++}function Tt(){if(q--,q===0){for(let t=0;t<V.length;t++)V[t]();V.length=0}}function mt(t){q>0?V.push(t):t()}var A=class t{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static _annotations=new WeakMap;static _traceLog=[];static _traceHead=0;static _traceFull=!1;static maxTraceEntries=1e3;static get enabled(){if(t._explicitEnabled!==null)return t._explicitEnabled;if(t._cachedDefault!==null)return t._cachedDefault;try{t._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{t._cachedDefault=!0}return t._cachedDefault}static set enabled(e){t._explicitEnabled=e}static _depSuffix(e){if(!e?.length)return;let n=e.map(s=>t._names.get(s)??"?").join(",");return n.length>40?`${n.slice(0,37)}...`:n}static _resolveKey(e){let i=t._keys.get(e)??t._names.get(e);if(i)return i;let n=`anonymous_${t._nextId++}`;return t._keys.set(e,n),n}static register(e,i){if(!t.enabled)return;i?.name&&t._names.set(e,i.name),i?.kind&&t._kinds.set(e,i.kind);let n=t._nextId++,s=i?.name;if(!(s&&!t._usedKeys.has(s)))if(s){let r=t._depSuffix(i?.deps);s=r?`${s}(${r})`:`${s}_${n}`,t._usedKeys.has(s)&&(s=`${s}_${n}`)}else{let r=i?.kind??"store",o=t._depSuffix(i?.deps);s=o?`${r}(${o})`:`${r}_${n}`,t._usedKeys.has(s)&&(s=`${s}_${n}`)}t._usedKeys.add(s),t._keys.set(e,s),t._stores.add(new WeakRef(e))}static registerEdge(e,i){if(!t.enabled)return;let n=t._resolveKey(e),s=t._resolveKey(i),r=t._edges.get(n);r?r.includes(s)||r.push(s):t._edges.set(n,[s])}static getEdges(){return new Map(t._edges)}static getName(e){if(t.enabled)return t._names.get(e)}static getKind(e){return t._kinds.get(e)}static inspect(e){return{name:t._names.get(e),kind:t._kinds.get(e)??"unknown",value:typeof e.get=="function"?e.get():void 0,status:e._status}}static graph(){let e=new Map,i=new Set;for(let n of t._stores){let s=n.deref();if(!s){t._stores.delete(n);continue}let r=t._resolveKey(s);i.add(r),e.set(r,t.inspect(s))}for(let[n,s]of t._edges){if(!i.has(n)){t._edges.delete(n),t._usedKeys.delete(n);continue}let r=s.filter(o=>i.has(o));r.length===0?t._edges.delete(n):r.length!==s.length&&t._edges.set(n,r)}return e}static trace(e,i){let n=null,s=e.get();return e.source(_,(r,o)=>{if(r===_&&(n=o),r===h){n=null;return}if(r===1){let a=o;if(!Object.is(a,s)){let l=s;s=a,i(a,l)}}}),()=>n?.(h)}static dumpGraph(){let e=t.graph(),i=t.getEdges(),n=new Map;for(let[o,a]of i)for(let l of a){let d=n.get(l);d?d.includes(o)||d.push(o):n.set(l,[o])}let s=[];for(let[o,a]of e){let l=n.get(o),d=i.get(o),c=l?.length?` \u2190 [${l.join(", ")}]`:"",u=d?.length?` \u2192 [${d.join(", ")}]`:"";s.push(` ${o} (${a.kind}) = ${JSON.stringify(a.value)} [${a.status??"?"}]${c}${u}`)}return[`Store Graph (${e.size} nodes):`,...s].join(`
|
|
2
|
+
`)}static _observe(e,i,n){let s=null,r=i??t.getName(e),o={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:r,dispose:()=>s?.(h)};return e.source(_,(a,l)=>{if(a===_){s=l;return}a===v?(o.values.push(l),o.events.push({type:"data",data:l}),n&&n(`[${r}] DATA:`,l)):a===S?(o.signals.push(l),o.events.push({type:"signal",data:l}),l===k?o.dirtyCount++:l===G&&o.resolvedCount++,n&&n(`[${r}] STATE:`,l)):a===h&&(o.ended=!0,o.endError=l,o.events.push({type:"end",data:l}),n&&n(`[${r}] END`,l!==void 0?l:""),s=null)}),o}static observe(e){return t._observe(e)}static tap(e,i){let n=i??`tap(${t.getName(e)??"anon"})`,s={get:()=>e.get(),source:e.source};return t.register(s,{name:n,kind:"tap"}),t.registerEdge(e,s),s}static spy(e,i){let n=i?.name??t.getName(e)??"spy",s=i?.log??console.log;return t._observe(e,n,s)}static snapshot(){let e=t.graph(),i=t.getEdges(),n=new Map;for(let o of t._stores){let a=o.deref();if(!a)continue;let l=t._annotations.get(a);l!==void 0&&n.set(t._resolveKey(a),l)}let s=[];for(let[o,a]of e){let l={name:o,kind:a.kind,value:a.value,status:a.status},d=n.get(o);d!==void 0&&(l.annotation=d),s.push(l)}let r=[];for(let[o,a]of i)for(let l of a)r.push({from:o,to:l});return{nodes:s,edges:r,trace:t.traceLog()}}static toMermaid(e){let i=e?.direction??"TD",n=t.snapshot(),s=[`graph ${i}`],r={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},o=new Map;function a(c){let u=c.replace(/[^a-zA-Z0-9_]/g,"_"),f=o.get(u);return f===void 0?(o.set(u,1),u):(o.set(u,f+1),`${u}__${f}`)}let l=new Map;function d(c){let u=JSON.stringify(c);return u&&u.length>30?`${u.slice(0,27)}...`:u??"undefined"}for(let c of n.nodes){let u=a(c.name);l.set(c.name,u);let f=`${c.name} (${c.kind}) = ${d(c.value)}`,p=r[c.status??""]??"";s.push(` ${u}["${f}"]${p}`)}for(let c of n.edges){let u=l.get(c.from)??a(c.from),f=l.get(c.to)??a(c.to);s.push(` ${u} --> ${f}`)}return s.push(""),s.push(" classDef settled fill:#d4edda,stroke:#28a745"),s.push(" classDef dirty fill:#fff3cd,stroke:#ffc107"),s.push(" classDef errored fill:#f8d7da,stroke:#dc3545"),s.push(" classDef completed fill:#cce5ff,stroke:#007bff"),s.join(`
|
|
3
|
+
`)}static toD2(e){let i=e?.direction??"down",n=t.snapshot(),s=[`direction: ${i}`,""],r={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},o=new Map;function a(c){let u=c.replace(/[^a-zA-Z0-9_]/g,"_"),f=o.get(u);return f===void 0?(o.set(u,1),u):(o.set(u,f+1),`${u}__${f}`)}let l=new Map;function d(c){let u=JSON.stringify(c);return u&&u.length>30?`${u.slice(0,27)}...`:u??"undefined"}for(let c of n.nodes){let u=a(c.name);l.set(c.name,u);let f=r[c.kind]??"rectangle",p=`${c.name} (${c.kind}) = ${d(c.value)}`,m=c.status?` [${c.status}]`:"";s.push(`${u}: "${p}${m}" { shape: ${f} }`)}n.edges.length>0&&s.push("");for(let c of n.edges){let u=l.get(c.from)??a(c.from),f=l.get(c.to)??a(c.to);s.push(`${u} -> ${f}`)}return s.join(`
|
|
4
|
+
`)}static annotate(e,i){if(!t.enabled)return;t._annotations.set(e,i);let n={node:t._resolveKey(e),reason:i,timestamp:Date.now()},s=t.maxTraceEntries;s<=0||(t._traceLog.length<s?t._traceLog.push(n):(t._traceLog[t._traceHead]=n,t._traceFull=!0),t._traceHead=(t._traceHead+1)%s)}static getAnnotation(e){return t._annotations.get(e)}static traceLog(){return t._traceFull?[...t._traceLog.slice(t._traceHead),...t._traceLog.slice(0,t._traceHead)]:t._traceLog.slice(0,t._traceHead||t._traceLog.length)}static clearTrace(){t._traceLog=[],t._traceHead=0,t._traceFull=!1}static _reset(){t._names=new WeakMap,t._kinds=new WeakMap,t._keys=new WeakMap,t._stores=new Set,t._edges=new Map,t._usedKeys=new Set,t._nextId=0,t._explicitEnabled=null,t._cachedDefault=null,t._annotations=new WeakMap,t._traceLog=[],t._traceHead=0,t._traceFull=!1,t.maxTraceEntries=1e3}};var J=1,b=64,T=2,P=4,yt=8,Et=16,I=32,D=1024,g=ot,N=ft<<R,C=dt<<R,Z=ct<<R,Pt=gt<<R,Nt=ht<<R,Mt=pt<<R,j=class{_value;_output=null;_flags;get _status(){return _t(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(e,i){this._value=i?.initial,this._fn=e,this._eqFn=i?.equals,this._getterFn=i?.getter,this._initial=i?.initial;let n=0;i?.autoDirty!==!1&&(n|=P),i?.resetOnTeardown&&(n|=yt),i?.resubscribable&&(n|=Et),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),i?._skipInspect||A.register(this,{kind:"producer",...i})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(e,i){let n=this._output;if(n)if(this._flags&b)for(let s of n)s(e,i);else n(e,i)}emit(e){this._flags&T||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,e)||(this._value=e,this._output&&(z()?this._flags&I||(this._flags|=I,this._flags&P&&(this._flags=this._flags&~g|N,this._dispatch(S,k)),B(()=>{this._flags&=~I,this._flags=this._flags&~g|C,this._dispatch(v,this._value)})):(this._flags&P&&!(this._flags&D)&&(this._flags=this._flags&~g|N,this._dispatch(S,k)),this._flags=this._flags&~g|C,this._dispatch(v,this._value))))}signal(e){this._flags&T||!this._output||(e===k?this._flags=this._flags&~g|N:e===G&&(this._flags=this._flags&~g|Mt),this._dispatch(S,e))}complete(){if(this._flags&T)return;this._flags=(this._flags|T)&~g|Pt;let e=this._output,i=this._flags&b;if(this._output=null,this._flags&=~(b|D),this._singleDepCount=0,this._stop(),e)if(i)for(let n of e)n(h);else e(h)}error(e){if(this._flags&T)return;this._flags=(this._flags|T)&~g|Nt;let i=this._output,n=this._flags&b;if(this._output=null,this._flags&=~(b|D),this._singleDepCount=0,this._stop(),i)if(n)for(let s of i)s(h,e);else i(h,e)}_start(){if(this._flags&J||!this._fn)return;this._flags|=J,this._onLifecycleSignal=void 0;let e=this._fn({emit:this.emit,signal:i=>this.signal(i),complete:()=>this.complete(),error:i=>this.error(i),onSignal:i=>{this._onLifecycleSignal=i}});this._cleanup=typeof e=="function"?e:void 0}_stop(){this._flags&J&&(this._flags&=~J,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&yt&&(this._value=this._initial),this._flags&T||(this._flags=this._flags&~g|Z))}_handleLifecycleSignal(e){if(!(this._flags&T)){if(e===rt){this._onLifecycleSignal?.(e),this.complete();return}e===$&&(this._value=this._initial,this._flags&=~I),this._onLifecycleSignal?.(e),e===$&&this.emit(this._initial)}}source(e,i){if(e===_){let n=i;if(this._flags&T)if(this._flags&Et&&this._output===null)this._flags=this._flags&~(T|g)|Z;else{n(_,r=>{}),n(h);return}if(this._output===null)this._output=n;else if(this._flags&b)this._output.add(n);else{let r=new Set;r.add(this._output),r.add(n),this._output=r,this._flags=(this._flags|b)&~D}let s=!1;n(_,(r,o)=>{if(r===v&&n(v,this._value),r===S){o===lt&&!s?(s=!0,this._singleDepCount++,this._flags&b||(this._flags|=D)):ut(o)&&this._handleLifecycleSignal(o);return}if(r===h){if(s&&(s=!1,this._singleDepCount--),this._output===null)return;if(this._flags&b){let a=this._output;a.delete(n),a.size===1?(this._output=a.values().next().value,this._flags&=~b,this._singleDepCount>0&&(this._flags|=D)):a.size===0&&(this._output=null,this._flags&=~(b|D),this._singleDepCount=0,this._flags=this._flags&~g|Z,this._stop())}else this._output===n&&(this._output=null,this._flags&=~D,this._singleDepCount=0,this._flags=this._flags&~g|Z,this._stop())}}),mt(()=>this._start())}}};function Q(t,e){return new j(t,e)}var at=class extends j{constructor(e,i){super(void 0,{initial:e,autoDirty:!0,equals:i?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),A.register(this,{kind:"state",...i})}get(){return this._value}set(e){this._flags&T||this._value!==void 0&&this._eqFn(this._value,e)||(this._value=e,this._output&&(z()?this._flags&I||(this._flags|=I,this._flags&P&&(this._flags=this._flags&~g|N,this._dispatch(S,k)),B(()=>{this._flags&=~I,this._flags=this._flags&~g|C,this._dispatch(v,this._value)})):(this._flags&P&&!(this._flags&D)&&(this._flags=this._flags&~g|N,this._dispatch(S,k)),this._flags=this._flags&~g|C,this._dispatch(v,this._value))))}update(e){this.set(e(this._value))}};function W(t,e){return new at(t,e)}function bt(t,e,i){let n=null;St(),t.source(_,(r,o)=>{if(r===_&&(n=o),r===h){n=null,i?.onEnd?.(o);return}if(r===1){let a=o,l=s;s=a,e(a,l)}});let s;try{s=t.get()}catch{}return Tt(),{unsubscribe(){n?.(h),n=null},signal(r){n?.(S,r)}}}function vt(t,e){let i=e?.initialStatus??"pending",n=W(i,{name:"withStatus:status",equals:Object.is}),s=W(void 0,{name:"withStatus:error",equals:Object.is}),r=Q(({emit:a,complete:l,error:d})=>{n.set(i),s.set(void 0);let c=bt(t,u=>{n.get()==="errored"?M(()=>{s.set(void 0),n.set("active")}):n.set("active"),a(u)},{onEnd:u=>{if(u!==void 0){let f=u instanceof Error?u:new Error(String(u));M(()=>{s.set(f),n.set("errored")}),d(u)}else n.set("completed"),l()}});return()=>{c.unsubscribe()}},{initial:t.get(),resubscribable:!0}),o={get:()=>t.get(),source:(a,l)=>r.source(a,l),get _status(){return r._status},status:n,error:s};return A.register(o,{kind:"withStatus"}),o}function Ct(t,e){let i=e?.name??"http",n=e?.method??"GET",s=e?.headers,r=e?.body,o=e?.poll??0,a=e?.transform??(w=>w.json()),l=e?.timeout??3e4,d=W(0,{name:`${i}:fetchCount`}),c=null,u=null,f=null,p=null,m=null,y=!1;async function F(){if(!y||!c)return;m=new AbortController;let w=[m.signal];e?.signal&&w.push(e.signal);let L=new AbortController;for(let E of w){if(E.aborted){L.abort(E.reason);break}E.addEventListener("abort",()=>L.abort(E.reason),{once:!0})}let tt=setTimeout(()=>L.abort(new Error("Request timeout")),l);try{let E=r!==void 0?typeof r=="string"?r:JSON.stringify(r):void 0,O=await fetch(t,{method:n,headers:s,body:E,signal:L.signal});if(!y)return;if(!O.ok)throw new Error(`HTTP ${O.status}: ${O.statusText}`);let xt=await a(O);if(!y)return;M(()=>{d.update(kt=>kt+1),c?.(xt)})}catch(E){if(!y||E?.name==="AbortError")return;u?.(E)}finally{clearTimeout(tt),m=null}}function K(){!y||x||o<=0||(p=setTimeout(()=>{p=null,F().then(()=>{y&&!x&&K()}).catch(()=>{})},o))}let X=null,x=!1,Dt=Q(({emit:w,error:L,complete:tt,onSignal:E})=>(c=w,u=L,f=tt,y=!0,x=!1,X=()=>{F()},E(O=>{O===st?(x=!0,p!==null&&(clearTimeout(p),p=null)):O===it?(x=!1,K()):O===$&&(m?.abort(),m=null,p!==null&&(clearTimeout(p),p=null),d.set(0),x=!1,F().then(()=>{y&&!x&&K()}))}),F().then(()=>{y&&!x&&K()}),()=>{y=!1,x=!1,c=null,u=null,f=null,X=null,m?.abort(),m=null,p!==null&&(clearTimeout(p),p=null)}),{name:i,kind:"http"}),U=vt(Dt);return{get:()=>U.get(),source:(w,L)=>U.source(w,L),status:U.status,error:U.error,fetchCount:d,refetch(){X?.()},stop(){y=!1,m?.abort(),m=null,p!==null&&(clearTimeout(p),p=null),f?.()}}}0&&(module.exports={fromHTTP});
|
package/dist/adapters/http.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
2
|
-
import { W as WithStatusStatus } from '../withStatus-
|
|
3
|
-
import '../protocol-
|
|
1
|
+
import { S as Store } from '../types-BohB8jJr.cjs';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-ByT_R2Rz.cjs';
|
|
3
|
+
import '../protocol-fwiQ1TAS.cjs';
|
|
4
4
|
|
|
5
5
|
interface FromHTTPOptions {
|
|
6
6
|
/** HTTP method. Default: "GET". */
|
package/dist/adapters/http.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
2
|
-
import { W as WithStatusStatus } from '../withStatus
|
|
3
|
-
import '../protocol-
|
|
1
|
+
import { S as Store } from '../types-CB1htCM8.js';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus---CFNir7.js';
|
|
3
|
+
import '../protocol-fwiQ1TAS.js';
|
|
4
4
|
|
|
5
5
|
interface FromHTTPOptions {
|
|
6
6
|
/** HTTP method. Default: "GET". */
|
package/dist/adapters/http.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-3AE6AS32.js";import"../chunk-GWRUTGV5.js";import"../chunk-GMLWTZFM.js";import"../chunk-KYY5ZPIG.js";import"../chunk-3CHC2PEC.js";import"../chunk-7MY7DDET.js";import"../chunk-TUPD47IE.js";import"../chunk-I7AUKTXE.js";export{a as fromHTTP};
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}static _observe(t,n,r){let o=null,
|
|
3
|
-
`)}static toD2(t){let n=t?.direction??"down",r=e.snapshot(),o=[`direction: ${n}`,""],
|
|
4
|
-
`)}static annotate(t,n){if(!e.enabled)return;e._annotations.set(t,n);let r={node:e._resolveKey(t),reason:n,timestamp:Date.now()},o=e.maxTraceEntries;o<=0||(e._traceLog.length<o?e._traceLog.push(r):(e._traceLog[e._traceHead]=r,e._traceFull=!0),e._traceHead=(e._traceHead+1)%o)}static getAnnotation(t){return e._annotations.get(t)}static traceLog(){return e._traceFull?[...e._traceLog.slice(e._traceHead),...e._traceLog.slice(0,e._traceHead)]:e._traceLog.slice(0,e._traceHead||e._traceLog.length)}static clearTrace(){e._traceLog=[],e._traceHead=0,e._traceFull=!1}static _reset(){e._names=new WeakMap,e._kinds=new WeakMap,e._keys=new WeakMap,e._stores=new Set,e._edges=new Map,e._usedKeys=new Set,e._nextId=0,e._explicitEnabled=null,e._cachedDefault=null,e._annotations=new WeakMap,e._traceLog=[],e._traceHead=0,e._traceFull=!1,e.maxTraceEntries=1e3}};var
|
|
5
|
-
`);E
|
|
6
|
-
`),
|
|
7
|
-
data: ${
|
|
1
|
+
"use strict";var Ne=Object.create;var ne=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var Ue=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Fe=Object.prototype.hasOwnProperty;var qe=(e,t)=>{for(var n in t)ne(e,n,{get:t[n],enumerable:!0})},he=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ue(t))!Fe.call(e,o)&&o!==n&&ne(e,o,{get:()=>t[o],enumerable:!(r=je(t,o))||r.enumerable});return e};var Be=(e,t,n)=>(n=e!=null?Ne(He(e)):{},he(t||!e||!e.__esModule?ne(n,"default",{value:e,enumerable:!0}):n,e)),Ke=e=>he(ne({},"__esModule",{value:!0}),e);var rt={};qe(rt,{fromHTTP:()=>Ce,fromLLM:()=>Ae,fromMCP:()=>Oe,fromWebSocket:()=>We,fromWebhook:()=>$e,toSSE:()=>Me,toWebSocket:()=>Ie});module.exports=Ke(rt);var H=Symbol("DIRTY"),ae=Symbol("RESOLVED"),Se=Symbol("SINGLE_DEP"),N=Symbol("RESET"),K=Symbol("PAUSE"),z=Symbol("RESUME"),pe=Symbol("TEARDOWN");function Te(e){return e===N||e===K||e===z||e===pe}var ye=0,be=1,_e=2,ke=3,ve=4,Ee=5,F=7,ge=7<<F,ze=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function we(e){return ze[(e&ge)>>>F]}var M=0,j=1,D=2,$=3,re=0,oe=[],de=!1;function P(e){re++;try{return e()}finally{if(re--,re===0&&!de){de=!0;for(let t=0;t<oe.length;t++)oe[t]();oe.length=0,de=!1}}}function le(){return re>0}function ue(e){oe.push(e)}var ie=0,se=[];function xe(){ie++}function Re(){if(ie--,ie===0){for(let e=0;e<se.length;e++)se[e]();se.length=0}}function Le(e){ie>0?se.push(e):e()}var C=class e{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static _annotations=new WeakMap;static _traceLog=[];static _traceHead=0;static _traceFull=!1;static maxTraceEntries=1e3;static get enabled(){if(e._explicitEnabled!==null)return e._explicitEnabled;if(e._cachedDefault!==null)return e._cachedDefault;try{e._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{e._cachedDefault=!0}return e._cachedDefault}static set enabled(t){e._explicitEnabled=t}static _depSuffix(t){if(!t?.length)return;let r=t.map(o=>e._names.get(o)??"?").join(",");return r.length>40?`${r.slice(0,37)}...`:r}static _resolveKey(t){let n=e._keys.get(t)??e._names.get(t);if(n)return n;let r=`anonymous_${e._nextId++}`;return e._keys.set(t,r),r}static register(t,n){if(!e.enabled)return;n?.name&&e._names.set(t,n.name),n?.kind&&e._kinds.set(t,n.kind);let r=e._nextId++,o=n?.name;if(!(o&&!e._usedKeys.has(o)))if(o){let a=e._depSuffix(n?.deps);o=a?`${o}(${a})`:`${o}_${r}`,e._usedKeys.has(o)&&(o=`${o}_${r}`)}else{let a=n?.kind??"store",i=e._depSuffix(n?.deps);o=i?`${a}(${i})`:`${a}_${r}`,e._usedKeys.has(o)&&(o=`${o}_${r}`)}e._usedKeys.add(o),e._keys.set(t,o),e._stores.add(new WeakRef(t))}static registerEdge(t,n){if(!e.enabled)return;let r=e._resolveKey(t),o=e._resolveKey(n),a=e._edges.get(r);a?a.includes(o)||a.push(o):e._edges.set(r,[o])}static getEdges(){return new Map(e._edges)}static getName(t){if(e.enabled)return e._names.get(t)}static getKind(t){return e._kinds.get(t)}static inspect(t){return{name:e._names.get(t),kind:e._kinds.get(t)??"unknown",value:typeof t.get=="function"?t.get():void 0,status:t._status}}static graph(){let t=new Map,n=new Set;for(let r of e._stores){let o=r.deref();if(!o){e._stores.delete(r);continue}let a=e._resolveKey(o);n.add(a),t.set(a,e.inspect(o))}for(let[r,o]of e._edges){if(!n.has(r)){e._edges.delete(r),e._usedKeys.delete(r);continue}let a=o.filter(i=>n.has(i));a.length===0?e._edges.delete(r):a.length!==o.length&&e._edges.set(r,a)}return t}static trace(t,n){let r=null,o=t.get();return t.source(M,(a,i)=>{if(a===M&&(r=i),a===D){r=null;return}if(a===1){let s=i;if(!Object.is(s,o)){let c=o;o=s,n(s,c)}}}),()=>r?.(D)}static dumpGraph(){let t=e.graph(),n=e.getEdges(),r=new Map;for(let[i,s]of n)for(let c of s){let f=r.get(c);f?f.includes(i)||f.push(i):r.set(c,[i])}let o=[];for(let[i,s]of t){let c=r.get(i),f=n.get(i),u=c?.length?` \u2190 [${c.join(", ")}]`:"",l=f?.length?` \u2192 [${f.join(", ")}]`:"";o.push(` ${i} (${s.kind}) = ${JSON.stringify(s.value)} [${s.status??"?"}]${u}${l}`)}return[`Store Graph (${t.size} nodes):`,...o].join(`
|
|
2
|
+
`)}static _observe(t,n,r){let o=null,a=n??e.getName(t),i={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:a,dispose:()=>o?.(D)};return t.source(M,(s,c)=>{if(s===M){o=c;return}s===j?(i.values.push(c),i.events.push({type:"data",data:c}),r&&r(`[${a}] DATA:`,c)):s===$?(i.signals.push(c),i.events.push({type:"signal",data:c}),c===H?i.dirtyCount++:c===ae&&i.resolvedCount++,r&&r(`[${a}] STATE:`,c)):s===D&&(i.ended=!0,i.endError=c,i.events.push({type:"end",data:c}),r&&r(`[${a}] END`,c!==void 0?c:""),o=null)}),i}static observe(t){return e._observe(t)}static tap(t,n){let r=n??`tap(${e.getName(t)??"anon"})`,o={get:()=>t.get(),source:t.source};return e.register(o,{name:r,kind:"tap"}),e.registerEdge(t,o),o}static spy(t,n){let r=n?.name??e.getName(t)??"spy",o=n?.log??console.log;return e._observe(t,r,o)}static snapshot(){let t=e.graph(),n=e.getEdges(),r=new Map;for(let i of e._stores){let s=i.deref();if(!s)continue;let c=e._annotations.get(s);c!==void 0&&r.set(e._resolveKey(s),c)}let o=[];for(let[i,s]of t){let c={name:i,kind:s.kind,value:s.value,status:s.status},f=r.get(i);f!==void 0&&(c.annotation=f),o.push(c)}let a=[];for(let[i,s]of n)for(let c of s)a.push({from:i,to:c});return{nodes:o,edges:a,trace:e.traceLog()}}static toMermaid(t){let n=t?.direction??"TD",r=e.snapshot(),o=[`graph ${n}`],a={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},i=new Map;function s(u){let l=u.replace(/[^a-zA-Z0-9_]/g,"_"),g=i.get(l);return g===void 0?(i.set(l,1),l):(i.set(l,g+1),`${l}__${g}`)}let c=new Map;function f(u){let l=JSON.stringify(u);return l&&l.length>30?`${l.slice(0,27)}...`:l??"undefined"}for(let u of r.nodes){let l=s(u.name);c.set(u.name,l);let g=`${u.name} (${u.kind}) = ${f(u.value)}`,m=a[u.status??""]??"";o.push(` ${l}["${g}"]${m}`)}for(let u of r.edges){let l=c.get(u.from)??s(u.from),g=c.get(u.to)??s(u.to);o.push(` ${l} --> ${g}`)}return o.push(""),o.push(" classDef settled fill:#d4edda,stroke:#28a745"),o.push(" classDef dirty fill:#fff3cd,stroke:#ffc107"),o.push(" classDef errored fill:#f8d7da,stroke:#dc3545"),o.push(" classDef completed fill:#cce5ff,stroke:#007bff"),o.join(`
|
|
3
|
+
`)}static toD2(t){let n=t?.direction??"down",r=e.snapshot(),o=[`direction: ${n}`,""],a={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},i=new Map;function s(u){let l=u.replace(/[^a-zA-Z0-9_]/g,"_"),g=i.get(l);return g===void 0?(i.set(l,1),l):(i.set(l,g+1),`${l}__${g}`)}let c=new Map;function f(u){let l=JSON.stringify(u);return l&&l.length>30?`${l.slice(0,27)}...`:l??"undefined"}for(let u of r.nodes){let l=s(u.name);c.set(u.name,l);let g=a[u.kind]??"rectangle",m=`${u.name} (${u.kind}) = ${f(u.value)}`,y=u.status?` [${u.status}]`:"";o.push(`${l}: "${m}${y}" { shape: ${g} }`)}r.edges.length>0&&o.push("");for(let u of r.edges){let l=c.get(u.from)??s(u.from),g=c.get(u.to)??s(u.to);o.push(`${l} -> ${g}`)}return o.join(`
|
|
4
|
+
`)}static annotate(t,n){if(!e.enabled)return;e._annotations.set(t,n);let r={node:e._resolveKey(t),reason:n,timestamp:Date.now()},o=e.maxTraceEntries;o<=0||(e._traceLog.length<o?e._traceLog.push(r):(e._traceLog[e._traceHead]=r,e._traceFull=!0),e._traceHead=(e._traceHead+1)%o)}static getAnnotation(t){return e._annotations.get(t)}static traceLog(){return e._traceFull?[...e._traceLog.slice(e._traceHead),...e._traceLog.slice(0,e._traceHead)]:e._traceLog.slice(0,e._traceHead||e._traceLog.length)}static clearTrace(){e._traceLog=[],e._traceHead=0,e._traceFull=!1}static _reset(){e._names=new WeakMap,e._kinds=new WeakMap,e._keys=new WeakMap,e._stores=new Set,e._edges=new Map,e._usedKeys=new Set,e._nextId=0,e._explicitEnabled=null,e._cachedDefault=null,e._annotations=new WeakMap,e._traceLog=[],e._traceHead=0,e._traceFull=!1,e.maxTraceEntries=1e3}};var ce=1,I=64,W=2,V=4,De=8,Pe=16,q=32,U=1024,R=ge,Y=be<<F,Z=_e<<F,fe=ye<<F,Je=ve<<F,Ve=Ee<<F,Ye=ke<<F,X=class{_value;_output=null;_flags;get _status(){return we(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,n){this._value=n?.initial,this._fn=t,this._eqFn=n?.equals,this._getterFn=n?.getter,this._initial=n?.initial;let r=0;n?.autoDirty!==!1&&(r|=V),n?.resetOnTeardown&&(r|=De),n?.resubscribable&&(r|=Pe),this._flags=r,this.source=this.source.bind(this),this.emit=this.emit.bind(this),n?._skipInspect||C.register(this,{kind:"producer",...n})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,n){let r=this._output;if(r)if(this._flags&I)for(let o of r)o(t,n);else r(t,n)}emit(t){this._flags&W||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(le()?this._flags&q||(this._flags|=q,this._flags&V&&(this._flags=this._flags&~R|Y,this._dispatch($,H)),ue(()=>{this._flags&=~q,this._flags=this._flags&~R|Z,this._dispatch(j,this._value)})):(this._flags&V&&!(this._flags&U)&&(this._flags=this._flags&~R|Y,this._dispatch($,H)),this._flags=this._flags&~R|Z,this._dispatch(j,this._value))))}signal(t){this._flags&W||!this._output||(t===H?this._flags=this._flags&~R|Y:t===ae&&(this._flags=this._flags&~R|Ye),this._dispatch($,t))}complete(){if(this._flags&W)return;this._flags=(this._flags|W)&~R|Je;let t=this._output,n=this._flags&I;if(this._output=null,this._flags&=~(I|U),this._singleDepCount=0,this._stop(),t)if(n)for(let r of t)r(D);else t(D)}error(t){if(this._flags&W)return;this._flags=(this._flags|W)&~R|Ve;let n=this._output,r=this._flags&I;if(this._output=null,this._flags&=~(I|U),this._singleDepCount=0,this._stop(),n)if(r)for(let o of n)o(D,t);else n(D,t)}_start(){if(this._flags&ce||!this._fn)return;this._flags|=ce,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:n=>this.signal(n),complete:()=>this.complete(),error:n=>this.error(n),onSignal:n=>{this._onLifecycleSignal=n}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&ce&&(this._flags&=~ce,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&De&&(this._value=this._initial),this._flags&W||(this._flags=this._flags&~R|fe))}_handleLifecycleSignal(t){if(!(this._flags&W)){if(t===pe){this._onLifecycleSignal?.(t),this.complete();return}t===N&&(this._value=this._initial,this._flags&=~q),this._onLifecycleSignal?.(t),t===N&&this.emit(this._initial)}}source(t,n){if(t===M){let r=n;if(this._flags&W)if(this._flags&Pe&&this._output===null)this._flags=this._flags&~(W|R)|fe;else{r(M,a=>{}),r(D);return}if(this._output===null)this._output=r;else if(this._flags&I)this._output.add(r);else{let a=new Set;a.add(this._output),a.add(r),this._output=a,this._flags=(this._flags|I)&~U}let o=!1;r(M,(a,i)=>{if(a===j&&r(j,this._value),a===$){i===Se&&!o?(o=!0,this._singleDepCount++,this._flags&I||(this._flags|=U)):Te(i)&&this._handleLifecycleSignal(i);return}if(a===D){if(o&&(o=!1,this._singleDepCount--),this._output===null)return;if(this._flags&I){let s=this._output;s.delete(r),s.size===1?(this._output=s.values().next().value,this._flags&=~I,this._singleDepCount>0&&(this._flags|=U)):s.size===0&&(this._output=null,this._flags&=~(I|U),this._singleDepCount=0,this._flags=this._flags&~R|fe,this._stop())}else this._output===r&&(this._output=null,this._flags&=~U,this._singleDepCount=0,this._flags=this._flags&~R|fe,this._stop())}}),Le(()=>this._start())}}};function B(e,t){return new X(e,t)}var me=class extends X{constructor(t,n){super(void 0,{initial:t,autoDirty:!0,equals:n?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),C.register(this,{kind:"state",...n})}get(){return this._value}set(t){this._flags&W||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(le()?this._flags&q||(this._flags|=q,this._flags&V&&(this._flags=this._flags&~R|Y,this._dispatch($,H)),ue(()=>{this._flags&=~q,this._flags=this._flags&~R|Z,this._dispatch(j,this._value)})):(this._flags&V&&!(this._flags&U)&&(this._flags=this._flags&~R|Y,this._dispatch($,H)),this._flags=this._flags&~R|Z,this._dispatch(j,this._value))))}update(t){this.set(t(this._value))}};function v(e,t){return new me(e,t)}function G(e,t,n){let r=null;xe(),e.source(M,(a,i)=>{if(a===M&&(r=i),a===D){r=null,n?.onEnd?.(i);return}if(a===1){let s=i,c=o;o=s,t(s,c)}});let o;try{o=e.get()}catch{}return Re(),{unsubscribe(){r?.(D),r=null},signal(a){r?.($,a)}}}function Q(e,t){let n=t?.initialStatus??"pending",r=v(n,{name:"withStatus:status",equals:Object.is}),o=v(void 0,{name:"withStatus:error",equals:Object.is}),a=B(({emit:s,complete:c,error:f})=>{r.set(n),o.set(void 0);let u=G(e,l=>{r.get()==="errored"?P(()=>{o.set(void 0),r.set("active")}):r.set("active"),s(l)},{onEnd:l=>{if(l!==void 0){let g=l instanceof Error?l:new Error(String(l));P(()=>{o.set(g),r.set("errored")}),f(l)}else r.set("completed"),c()}});return()=>{u.unsubscribe()}},{initial:e.get(),resubscribable:!0}),i={get:()=>e.get(),source:(s,c)=>a.source(s,c),get _status(){return a._status},status:r,error:o};return C.register(i,{kind:"withStatus"}),i}function Ce(e,t){let n=t?.name??"http",r=t?.method??"GET",o=t?.headers,a=t?.body,i=t?.poll??0,s=t?.transform??(w=>w.json()),c=t?.timeout??3e4,f=v(0,{name:`${n}:fetchCount`}),u=null,l=null,g=null,m=null,y=null,T=!1;async function x(){if(!T||!u)return;y=new AbortController;let w=[y.signal];t?.signal&&w.push(t.signal);let _=new AbortController;for(let E of w){if(E.aborted){_.abort(E.reason);break}E.addEventListener("abort",()=>_.abort(E.reason),{once:!0})}let k=setTimeout(()=>_.abort(new Error("Request timeout")),c);try{let E=a!==void 0?typeof a=="string"?a:JSON.stringify(a):void 0,L=await fetch(e,{method:r,headers:o,body:E,signal:_.signal});if(!T)return;if(!L.ok)throw new Error(`HTTP ${L.status}: ${L.statusText}`);let O=await s(L);if(!T)return;P(()=>{f.update(A=>A+1),u?.(O)})}catch(E){if(!T||E?.name==="AbortError")return;l?.(E)}finally{clearTimeout(k),y=null}}function h(){!T||p||i<=0||(m=setTimeout(()=>{m=null,x().then(()=>{T&&!p&&h()}).catch(()=>{})},i))}let d=null,p=!1,S=B(({emit:w,error:_,complete:k,onSignal:E})=>(u=w,l=_,g=k,T=!0,p=!1,d=()=>{x()},E(L=>{L===K?(p=!0,m!==null&&(clearTimeout(m),m=null)):L===z?(p=!1,h()):L===N&&(y?.abort(),y=null,m!==null&&(clearTimeout(m),m=null),f.set(0),p=!1,x().then(()=>{T&&!p&&h()}))}),x().then(()=>{T&&!p&&h()}),()=>{T=!1,p=!1,u=null,l=null,g=null,d=null,y?.abort(),y=null,m!==null&&(clearTimeout(m),m=null)}),{name:n,kind:"http"}),b=Q(S);return{get:()=>b.get(),source:(w,_)=>b.source(w,_),status:b.status,error:b.error,fetchCount:f,refetch(){d?.()},stop(){T=!1,y?.abort(),y=null,m!==null&&(clearTimeout(m),m=null),g?.()}}}function Ge(e){switch(e){case"openai":return"https://api.openai.com/v1";case"ollama":return"http://localhost:11434";default:return""}}function Qe(e,t){switch(e){case"openai":case"custom":return`${t}/chat/completions`;case"ollama":return`${t}/api/chat`;default:return`${t}/chat/completions`}}function Ze(e,t,n,r){let o={model:t,messages:n,stream:!0};return r?.temperature!==void 0&&(o.temperature=r.temperature),r?.maxTokens!==void 0&&(e==="ollama"?o.options={num_predict:r.maxTokens}:o.max_tokens=r.maxTokens),r?.stop&&(o.stop=r.stop),o}function Xe(e,t){let n={"Content-Type":"application/json"};return t&&(n.Authorization=`Bearer ${t}`),n}function Ae(e){let t=e.name??"llm",n=e.provider,r=e.baseURL??Ge(n),o=e.model??"",a=e.fetch??globalThis.fetch,i=v("",{name:`${t}.store`}),s=v({},{name:`${t}.tokens`}),c=v("pending",{name:`${t}.status`}),f=v(void 0,{name:`${t}.error`}),u=null;function l(){u&&(u.abort(),u=null),c.get()==="active"&&P(()=>{i.set(""),c.set("pending")})}function g(y,T){l(),u=new AbortController;let x=T?.signal?nt(u.signal,T.signal):u.signal;P(()=>{i.set(""),s.set({}),f.set(void 0),c.set("active")});let h=Qe(n,r),d=Ze(n,o,y,T),p=Xe(n,e.apiKey);m(h,p,d,x).catch(()=>{})}async function m(y,T,x,h){try{let d=await a(y,{method:"POST",headers:T,body:JSON.stringify(x),signal:h});if(!d.ok){let _=await d.text().catch(()=>"");throw new Error(`LLM API error ${d.status}: ${_}`)}let p=d.body?.getReader();if(!p)throw new Error("No response body");let S=new TextDecoder,b="",w="";for(;;){if(h.aborted)return;let{done:_,value:k}=await p.read();if(_)break;w+=S.decode(k,{stream:!0});let E=w.split(`
|
|
5
|
+
`);w=E.pop()??"";for(let L of E){if(h.aborted)return;let O=L.trim();if(!O||O.startsWith(":")||!O.startsWith("data: "))continue;let A=O.slice(6);if(A!=="[DONE]")try{let ee=JSON.parse(A),J=et(n,ee);J&&(b+=J,i.set(b));let te=tt(n,ee);te&&s.set(te)}catch{}}}if(S.decode(),h.aborted)return;c.set("completed"),u=null}catch(d){if(h.aborted)return;P(()=>{f.set(d),c.set("errored")}),u=null}finally{h._cleanup?.()}}return{get:()=>i.get(),source:(y,T)=>i.source(y,T),tokens:s,status:c,error:f,generate:g,abort:l}}function et(e,t){return e==="ollama"?t?.message?.content:t?.choices?.[0]?.delta?.content}function tt(e,t){let n=e==="ollama"?t:t?.usage;if(n){if(e==="ollama")return t.eval_count!==void 0||t.prompt_eval_count!==void 0?{promptTokens:t.prompt_eval_count,completionTokens:t.eval_count,totalTokens:(t.prompt_eval_count??0)+(t.eval_count??0)}:void 0;if(n.prompt_tokens!==void 0||n.completion_tokens!==void 0)return{promptTokens:n.prompt_tokens,completionTokens:n.completion_tokens,totalTokens:n.total_tokens}}}function nt(e,t){let n=new AbortController,r=()=>{e.removeEventListener("abort",o),t.removeEventListener("abort",o)},o=()=>{n.abort(),r()};e.addEventListener("abort",o,{once:!0}),t.addEventListener("abort",o,{once:!0});let a=n.signal;return a._cleanup=r,a}function Oe(e){let t=e.name??"mcp",n=e.client,r=v([],{name:`${t}.tools`}),o=v([],{name:`${t}.resources`}),a=v(void 0,{name:`${t}.refreshError`});function i(f){a.set(f);let u=e.onRefreshError;if(u==="warn")console.warn(`[${t}] refresh error:`,f);else{if(u==="error")throw f;typeof u=="function"&&u(f)}}async function s(){if(a.set(void 0),n.listTools)try{let f=await n.listTools();r.set(f.tools)}catch(f){i(f)}if(n.listResources)try{let f=await n.listResources();o.set(f.resources)}catch(f){i(f)}}function c(f){let u=`${t}:${f}`,l=v(void 0,{name:`${u}.result`}),g=v("idle",{name:`${u}.status`}),m=v(void 0,{name:`${u}.error`}),y=v(void 0,{name:`${u}.lastArgs`}),T=v(void 0,{name:`${u}.duration`}),x=!1;async function h(d){if(x)return;x=!0,P(()=>{y.set(d),m.set(void 0),g.set("active")});let p=Date.now();try{let S=await n.callTool({name:f,arguments:d}),b=Date.now()-p;if(S.isError){let k=S.content.filter(L=>L.type==="text").map(L=>L.text??"").join(`
|
|
6
|
+
`),E=new Error(k||"MCP tool returned error");P(()=>{T.set(b),m.set(E),g.set("errored")});return}let w=S.content.filter(k=>k.type==="text"),_;if(w.length===1){let k=w[0].text;if(k!==void 0)try{_=JSON.parse(k)}catch{_=k}}else w.length>1?_=w.map(k=>k.text??""):_=S.content;P(()=>{T.set(b),l.set(_),g.set("completed")})}catch(S){let b=Date.now()-p;P(()=>{T.set(b),m.set(S),g.set("errored")})}finally{x=!1}}return{get:()=>l.get(),source:(d,p)=>l.source(d,p),status:g,error:m,call:h,lastArgs:y,duration:T}}return{tool:c,tools:r,resources:o,refresh:s,refreshError:a}}function Me(e,t){let n=t?.path??"/",r=t?.name??"sse",o=t?.hostname??"0.0.0.0",a=t?.serialize??JSON.stringify,i=t?.eventName??"message",s=t?.pingInterval??3e4,c=v(0,{name:`${r}:connections`}),f=new Set,u=new Map,l=null;function g(){l||(l=G(e,d=>{let p=a(d),S=`event: ${i}
|
|
7
|
+
data: ${p}
|
|
8
8
|
|
|
9
|
-
`;for(let
|
|
9
|
+
`;for(let b of f)try{b.write(S)}catch{m(b)}}))}function m(d){f.delete(d);let p=u.get(d);p&&(clearInterval(p),u.delete(d)),c.set(f.size),f.size===0&&l&&(l.unsubscribe(),l=null)}function y(d,p){let S=d.method?.toUpperCase();if((d.url??"/").split("?")[0]!==n){p.writeHead(404,{"Content-Type":"text/plain"}),p.end("Not found");return}if(S==="OPTIONS"){p.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Cache-Control"}),p.end();return}if(S!=="GET"){p.writeHead(405,{"Content-Type":"text/plain"}),p.end("Method not allowed");return}p.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}),p.write(`:ok
|
|
10
10
|
|
|
11
|
-
`),f.add(
|
|
12
|
-
data: ${
|
|
11
|
+
`),f.add(p),c.set(f.size);try{let _=e.get();if(_!==void 0){let k=a(_);p.write(`event: ${i}
|
|
12
|
+
data: ${k}
|
|
13
13
|
|
|
14
|
-
`)}}catch{}if(
|
|
14
|
+
`)}}catch{}if(s>0){let _=setInterval(()=>{try{p.write(`:ping
|
|
15
15
|
|
|
16
|
-
`)}catch{
|
|
16
|
+
`)}catch{m(p)}},s);u.set(p,_)}d.on("close",()=>m(p)),g()}let T=null;async function x(){if(!t?.port)throw new Error("toSSE: port is required for listen()");if(T)throw new Error("toSSE: already listening. Call close() first.");let d=await import("http");return new Promise((p,S)=>{T=d.createServer(y),T.once("listening",()=>p()),T.once("error",b=>{T=null,S(b)}),T.listen(t.port,o)})}function h(){for(let d of f)try{d.end()}catch{}f.clear();for(let d of u.values())clearInterval(d);u.clear(),c.set(0),l?.unsubscribe(),l=null,T?.close(),T=null}return C.register(c,{kind:"sse"}),{connectionCount:c,handler:y,listen:x,close:h}}function $e(e){let t=e?.path??"/",n=e?.parse??JSON.parse,r=e?.name??"webhook",o=e?.hostname??"0.0.0.0",a=e?.maxBodySize??1024*1024,i=e?.responseTimeout??3e4,s=v(0,{name:`${r}:count`}),c=null,f=!1,u=B(({emit:h,onSignal:d})=>(c=h,f=!1,d(p=>{p===K?f=!0:p===z?f=!1:p===N&&(f=!1,s.set(0))}),()=>{c=null,f=!1}),{name:r,kind:"webhook"});C.register(u,{kind:"webhook"});let l=Q(u),g=null,m=new Set;function y(h,d){let p=h.method?.toUpperCase(),b=(h.url??"/").split("?")[0];if(p!=="POST"||b!==t){d.writeHead(404,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Not found"}));return}if(f){d.writeHead(503,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Service paused"}));return}let w=[],_=0,k=!1;h.on("error",()=>{k=!0,d.headersSent||(d.writeHead(400,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Request aborted"})))}),h.on("data",E=>{if(!k){if(_+=E.length,_>a){k=!0,d.writeHead(413,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Payload too large"})),h.destroy?.();return}w.push(E)}}),h.on("end",()=>{if(!k)try{let E=Buffer.concat(w).toString("utf-8"),L=E.length>0?n(E):void 0;s.update(J=>J+1);let O=!1,A=null,ee={body:L,get responded(){return O},respond(J,te=200){O||(O=!0,A!==null&&(clearTimeout(A),m.delete(A),A=null),d.writeHead(te,{"Content-Type":"application/json"}),d.end(JSON.stringify(J)))}};A=setTimeout(()=>{m.delete(A),A=null,O||(O=!0,d.writeHead(504,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Response timeout"})))},i),m.add(A),c?.(ee)}catch(E){d.writeHead(400,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:E?.message??"Parse error"}))}})}function T(){return e?.port?g?Promise.reject(new Error("fromWebhook: already listening. Call close() first.")):new Promise((h,d)=>{try{g=require("http").createServer(y),g.once("listening",()=>h()),g.once("error",S=>{g=null,d(S)}),g.listen(e.port,o)}catch(p){d(p)}}):Promise.reject(new Error("fromWebhook: port is required for listen()"))}function x(){for(let h of m)clearTimeout(h);m.clear(),g?.close(),g=null}return{get:()=>l.get(),source:(h,d)=>l.source(h,d),status:l.status,error:l.error,requestCount:s,handler:y,listen:T,close:x}}function We(e,t){let n=t?.name??"websocket",r=t?.parse??(S=>S),o=t?.reconnect??!1,a=t?.onParseError??"warn",i=v("connecting",{name:`${n}:connectionState`,equals:()=>!1}),s=null,c=null,f=null,u=null,l=null,g=!1,m=null,y=[];function T(){for(;y.length>0&&s?.readyState===WebSocket.OPEN;)s.send(y.shift())}function x(){g=!1,i.set("connecting");try{s=new WebSocket(e,t?.protocols)}catch(S){i.set("closed"),f?.(S);return}s.onopen=()=>{i.set("open"),T()},s.onmessage=S=>{if(!h)try{let b=r(S.data);c?.(b)}catch(b){a==="error"?f?.(b):a==="warn"&&console.warn(`[${n}] parse error:`,b)}},s.onerror=()=>{m=new Error(`WebSocket error on ${e}`)},s.onclose=()=>{i.set("closed"),s=null;let S=m;m=null,!g&&o!==!1?l=setTimeout(()=>{l=null,c&&x()},o):S&&!g?f?.(S):u?.()}}let h=!1,d=B(({emit:S,error:b,complete:w,onSignal:_})=>(c=S,f=b,u=w,h=!1,x(),_(k=>{k===K?h=!0:k===z?h=!1:k===N&&(h=!1,y.length=0,l!==null&&(clearTimeout(l),l=null),s&&(g=!0,s.onopen=null,s.onmessage=null,s.onerror=null,s.onclose=null,s.close(),s=null),i.set("closed"),x())}),()=>{c=null,f=null,u=null,h=!1,g=!0,y.length=0,l!==null&&(clearTimeout(l),l=null),s&&(s.onopen=null,s.onmessage=null,s.onerror=null,s.onclose=null,s.close(),s=null),i.set("closed")}),{name:n,kind:"websocket"});C.register(d,{kind:"websocket"});let p=Q(d);return{get:()=>p.get(),source:(S,b)=>p.source(S,b),status:p.status,error:p.error,connectionState:i,send(S){s?.readyState===WebSocket.OPEN?s.send(S):y.push(S)},close(S,b){g=!0,y.length=0,l!==null&&(clearTimeout(l),l=null),s?.close(S,b)}}}function Ie(e,t,n){let r=i=>typeof i=="string"?i:JSON.stringify(i),o=n?.serialize??r,a="send"in e&&typeof e.send=="function"?e.send.bind(e):null;if(!a)throw new Error("toWebSocket: invalid WebSocket target");return G(t,i=>{try{let s=o(i);a(s)}catch{}})}0&&(module.exports={fromHTTP,fromLLM,fromMCP,fromWebSocket,fromWebhook,toSSE,toWebSocket});
|
|
@@ -4,6 +4,6 @@ export { MCPClientLike, MCPOptions, MCPResource, MCPResult, MCPToolInfo, MCPTool
|
|
|
4
4
|
export { SSEOptions, SSEStore, toSSE } from './sse.cjs';
|
|
5
5
|
export { WebhookOptions, WebhookRequest, WebhookStore, fromWebhook } from './webhook.cjs';
|
|
6
6
|
export { FromWebSocketOptions, ToWebSocketOptions, WebSocketConnectionState, WebSocketStore, fromWebSocket, toWebSocket } from './websocket.cjs';
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../protocol-
|
|
9
|
-
import '../withStatus-
|
|
7
|
+
import '../types-BohB8jJr.cjs';
|
|
8
|
+
import '../protocol-fwiQ1TAS.cjs';
|
|
9
|
+
import '../withStatus-ByT_R2Rz.cjs';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { MCPClientLike, MCPOptions, MCPResource, MCPResult, MCPToolInfo, MCPTool
|
|
|
4
4
|
export { SSEOptions, SSEStore, toSSE } from './sse.js';
|
|
5
5
|
export { WebhookOptions, WebhookRequest, WebhookStore, fromWebhook } from './webhook.js';
|
|
6
6
|
export { FromWebSocketOptions, ToWebSocketOptions, WebSocketConnectionState, WebSocketStore, fromWebSocket, toWebSocket } from './websocket.js';
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../protocol-
|
|
9
|
-
import '../withStatus
|
|
7
|
+
import '../types-CB1htCM8.js';
|
|
8
|
+
import '../protocol-fwiQ1TAS.js';
|
|
9
|
+
import '../withStatus---CFNir7.js';
|
package/dist/adapters/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-3AE6AS32.js";import{a as e}from"../chunk-FV76ERZO.js";import{a as t}from"../chunk-CV6GBX5N.js";import{a as r}from"../chunk-NJEXVXD4.js";import{a as p}from"../chunk-D6NMIIMQ.js";import{a as m,b as S}from"../chunk-LJNELNJP.js";import"../chunk-GWRUTGV5.js";import"../chunk-GMLWTZFM.js";import"../chunk-KYY5ZPIG.js";import"../chunk-3CHC2PEC.js";import"../chunk-7MY7DDET.js";import"../chunk-TUPD47IE.js";import"../chunk-I7AUKTXE.js";export{o as fromHTTP,e as fromLLM,t as fromMCP,m as fromWebSocket,p as fromWebhook,r as toSSE,S as toWebSocket};
|
package/dist/adapters/llm.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}static _observe(
|
|
3
|
-
`)}static toD2(
|
|
4
|
-
`)}static annotate(
|
|
5
|
-
`);
|
|
1
|
+
"use strict";var B=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var De=(e,t)=>{for(var n in t)B(e,n,{get:t[n],enumerable:!0})},ke=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ee(t))!be.call(e,i)&&i!==n&&B(e,i,{get:()=>t[i],enumerable:!(s=ve(t,i))||s.enumerable});return e};var Le=e=>ke(B({},"__esModule",{value:!0}),e);var Ye={};De(Ye,{fromLLM:()=>Ue});module.exports=Le(Ye);var y=Symbol("DIRTY"),j=Symbol("RESOLVED"),ae=Symbol("SINGLE_DEP"),U=Symbol("RESET"),xe=Symbol("PAUSE"),Re=Symbol("RESUME"),Z=Symbol("TEARDOWN");function ce(e){return e===U||e===xe||e===Re||e===Z}var le=0,ue=1,fe=2,de=3,ge=4,pe=5,v=7,Q=7<<v,we=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function he(e){return we[(e&Q)>>>v]}var E=0,S=1,p=2,T=3,N=0,C=[],J=!1;function K(e){N++;try{return e()}finally{if(N--,N===0&&!J){J=!0;for(let t=0;t<C.length;t++)C[t]();C.length=0,J=!1}}}function F(){return N>0}function W(e){C.push(e)}var $e=0,Ae=[];function _e(e){$e>0?Ae.push(e):e()}var R=class e{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static _annotations=new WeakMap;static _traceLog=[];static _traceHead=0;static _traceFull=!1;static maxTraceEntries=1e3;static get enabled(){if(e._explicitEnabled!==null)return e._explicitEnabled;if(e._cachedDefault!==null)return e._cachedDefault;try{e._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{e._cachedDefault=!0}return e._cachedDefault}static set enabled(t){e._explicitEnabled=t}static _depSuffix(t){if(!t?.length)return;let s=t.map(i=>e._names.get(i)??"?").join(",");return s.length>40?`${s.slice(0,37)}...`:s}static _resolveKey(t){let n=e._keys.get(t)??e._names.get(t);if(n)return n;let s=`anonymous_${e._nextId++}`;return e._keys.set(t,s),s}static register(t,n){if(!e.enabled)return;n?.name&&e._names.set(t,n.name),n?.kind&&e._kinds.set(t,n.kind);let s=e._nextId++,i=n?.name;if(!(i&&!e._usedKeys.has(i)))if(i){let r=e._depSuffix(n?.deps);i=r?`${i}(${r})`:`${i}_${s}`,e._usedKeys.has(i)&&(i=`${i}_${s}`)}else{let r=n?.kind??"store",o=e._depSuffix(n?.deps);i=o?`${r}(${o})`:`${r}_${s}`,e._usedKeys.has(i)&&(i=`${i}_${s}`)}e._usedKeys.add(i),e._keys.set(t,i),e._stores.add(new WeakRef(t))}static registerEdge(t,n){if(!e.enabled)return;let s=e._resolveKey(t),i=e._resolveKey(n),r=e._edges.get(s);r?r.includes(i)||r.push(i):e._edges.set(s,[i])}static getEdges(){return new Map(e._edges)}static getName(t){if(e.enabled)return e._names.get(t)}static getKind(t){return e._kinds.get(t)}static inspect(t){return{name:e._names.get(t),kind:e._kinds.get(t)??"unknown",value:typeof t.get=="function"?t.get():void 0,status:t._status}}static graph(){let t=new Map,n=new Set;for(let s of e._stores){let i=s.deref();if(!i){e._stores.delete(s);continue}let r=e._resolveKey(i);n.add(r),t.set(r,e.inspect(i))}for(let[s,i]of e._edges){if(!n.has(s)){e._edges.delete(s),e._usedKeys.delete(s);continue}let r=i.filter(o=>n.has(o));r.length===0?e._edges.delete(s):r.length!==i.length&&e._edges.set(s,r)}return t}static trace(t,n){let s=null,i=t.get();return t.source(E,(r,o)=>{if(r===E&&(s=o),r===p){s=null;return}if(r===1){let l=o;if(!Object.is(l,i)){let a=i;i=l,n(l,a)}}}),()=>s?.(p)}static dumpGraph(){let t=e.graph(),n=e.getEdges(),s=new Map;for(let[o,l]of n)for(let a of l){let f=s.get(a);f?f.includes(o)||f.push(o):s.set(a,[o])}let i=[];for(let[o,l]of t){let a=s.get(o),f=n.get(o),c=a?.length?` \u2190 [${a.join(", ")}]`:"",u=f?.length?` \u2192 [${f.join(", ")}]`:"";i.push(` ${o} (${l.kind}) = ${JSON.stringify(l.value)} [${l.status??"?"}]${c}${u}`)}return[`Store Graph (${t.size} nodes):`,...i].join(`
|
|
2
|
+
`)}static _observe(t,n,s){let i=null,r=n??e.getName(t),o={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:r,dispose:()=>i?.(p)};return t.source(E,(l,a)=>{if(l===E){i=a;return}l===S?(o.values.push(a),o.events.push({type:"data",data:a}),s&&s(`[${r}] DATA:`,a)):l===T?(o.signals.push(a),o.events.push({type:"signal",data:a}),a===y?o.dirtyCount++:a===j&&o.resolvedCount++,s&&s(`[${r}] STATE:`,a)):l===p&&(o.ended=!0,o.endError=a,o.events.push({type:"end",data:a}),s&&s(`[${r}] END`,a!==void 0?a:""),i=null)}),o}static observe(t){return e._observe(t)}static tap(t,n){let s=n??`tap(${e.getName(t)??"anon"})`,i={get:()=>t.get(),source:t.source};return e.register(i,{name:s,kind:"tap"}),e.registerEdge(t,i),i}static spy(t,n){let s=n?.name??e.getName(t)??"spy",i=n?.log??console.log;return e._observe(t,s,i)}static snapshot(){let t=e.graph(),n=e.getEdges(),s=new Map;for(let o of e._stores){let l=o.deref();if(!l)continue;let a=e._annotations.get(l);a!==void 0&&s.set(e._resolveKey(l),a)}let i=[];for(let[o,l]of t){let a={name:o,kind:l.kind,value:l.value,status:l.status},f=s.get(o);f!==void 0&&(a.annotation=f),i.push(a)}let r=[];for(let[o,l]of n)for(let a of l)r.push({from:o,to:a});return{nodes:i,edges:r,trace:e.traceLog()}}static toMermaid(t){let n=t?.direction??"TD",s=e.snapshot(),i=[`graph ${n}`],r={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},o=new Map;function l(c){let u=c.replace(/[^a-zA-Z0-9_]/g,"_"),d=o.get(u);return d===void 0?(o.set(u,1),u):(o.set(u,d+1),`${u}__${d}`)}let a=new Map;function f(c){let u=JSON.stringify(c);return u&&u.length>30?`${u.slice(0,27)}...`:u??"undefined"}for(let c of s.nodes){let u=l(c.name);a.set(c.name,u);let d=`${c.name} (${c.kind}) = ${f(c.value)}`,A=r[c.status??""]??"";i.push(` ${u}["${d}"]${A}`)}for(let c of s.edges){let u=a.get(c.from)??l(c.from),d=a.get(c.to)??l(c.to);i.push(` ${u} --> ${d}`)}return i.push(""),i.push(" classDef settled fill:#d4edda,stroke:#28a745"),i.push(" classDef dirty fill:#fff3cd,stroke:#ffc107"),i.push(" classDef errored fill:#f8d7da,stroke:#dc3545"),i.push(" classDef completed fill:#cce5ff,stroke:#007bff"),i.join(`
|
|
3
|
+
`)}static toD2(t){let n=t?.direction??"down",s=e.snapshot(),i=[`direction: ${n}`,""],r={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},o=new Map;function l(c){let u=c.replace(/[^a-zA-Z0-9_]/g,"_"),d=o.get(u);return d===void 0?(o.set(u,1),u):(o.set(u,d+1),`${u}__${d}`)}let a=new Map;function f(c){let u=JSON.stringify(c);return u&&u.length>30?`${u.slice(0,27)}...`:u??"undefined"}for(let c of s.nodes){let u=l(c.name);a.set(c.name,u);let d=r[c.kind]??"rectangle",A=`${c.name} (${c.kind}) = ${f(c.value)}`,L=c.status?` [${c.status}]`:"";i.push(`${u}: "${A}${L}" { shape: ${d} }`)}s.edges.length>0&&i.push("");for(let c of s.edges){let u=a.get(c.from)??l(c.from),d=a.get(c.to)??l(c.to);i.push(`${u} -> ${d}`)}return i.join(`
|
|
4
|
+
`)}static annotate(t,n){if(!e.enabled)return;e._annotations.set(t,n);let s={node:e._resolveKey(t),reason:n,timestamp:Date.now()},i=e.maxTraceEntries;i<=0||(e._traceLog.length<i?e._traceLog.push(s):(e._traceLog[e._traceHead]=s,e._traceFull=!0),e._traceHead=(e._traceHead+1)%i)}static getAnnotation(t){return e._annotations.get(t)}static traceLog(){return e._traceFull?[...e._traceLog.slice(e._traceHead),...e._traceLog.slice(0,e._traceHead)]:e._traceLog.slice(0,e._traceHead||e._traceLog.length)}static clearTrace(){e._traceLog=[],e._traceHead=0,e._traceFull=!1}static _reset(){e._names=new WeakMap,e._kinds=new WeakMap,e._keys=new WeakMap,e._stores=new Set,e._edges=new Map,e._usedKeys=new Set,e._nextId=0,e._explicitEnabled=null,e._cachedDefault=null,e._annotations=new WeakMap,e._traceLog=[],e._traceHead=0,e._traceFull=!1,e.maxTraceEntries=1e3}};var Y=1,_=64,h=2,w=4,Se=8,Te=16,k=32,m=1024,g=Q,$=ue<<v,M=fe<<v,V=le<<v,Me=ge<<v,Oe=pe<<v,Ie=de<<v,G=class{_value;_output=null;_flags;get _status(){return he(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,n){this._value=n?.initial,this._fn=t,this._eqFn=n?.equals,this._getterFn=n?.getter,this._initial=n?.initial;let s=0;n?.autoDirty!==!1&&(s|=w),n?.resetOnTeardown&&(s|=Se),n?.resubscribable&&(s|=Te),this._flags=s,this.source=this.source.bind(this),this.emit=this.emit.bind(this),n?._skipInspect||R.register(this,{kind:"producer",...n})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,n){let s=this._output;if(s)if(this._flags&_)for(let i of s)i(t,n);else s(t,n)}emit(t){this._flags&h||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(F()?this._flags&k||(this._flags|=k,this._flags&w&&(this._flags=this._flags&~g|$,this._dispatch(T,y)),W(()=>{this._flags&=~k,this._flags=this._flags&~g|M,this._dispatch(S,this._value)})):(this._flags&w&&!(this._flags&m)&&(this._flags=this._flags&~g|$,this._dispatch(T,y)),this._flags=this._flags&~g|M,this._dispatch(S,this._value))))}signal(t){this._flags&h||!this._output||(t===y?this._flags=this._flags&~g|$:t===j&&(this._flags=this._flags&~g|Ie),this._dispatch(T,t))}complete(){if(this._flags&h)return;this._flags=(this._flags|h)&~g|Me;let t=this._output,n=this._flags&_;if(this._output=null,this._flags&=~(_|m),this._singleDepCount=0,this._stop(),t)if(n)for(let s of t)s(p);else t(p)}error(t){if(this._flags&h)return;this._flags=(this._flags|h)&~g|Oe;let n=this._output,s=this._flags&_;if(this._output=null,this._flags&=~(_|m),this._singleDepCount=0,this._stop(),n)if(s)for(let i of n)i(p,t);else n(p,t)}_start(){if(this._flags&Y||!this._fn)return;this._flags|=Y,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:n=>this.signal(n),complete:()=>this.complete(),error:n=>this.error(n),onSignal:n=>{this._onLifecycleSignal=n}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&Y&&(this._flags&=~Y,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&Se&&(this._value=this._initial),this._flags&h||(this._flags=this._flags&~g|V))}_handleLifecycleSignal(t){if(!(this._flags&h)){if(t===Z){this._onLifecycleSignal?.(t),this.complete();return}t===U&&(this._value=this._initial,this._flags&=~k),this._onLifecycleSignal?.(t),t===U&&this.emit(this._initial)}}source(t,n){if(t===E){let s=n;if(this._flags&h)if(this._flags&Te&&this._output===null)this._flags=this._flags&~(h|g)|V;else{s(E,r=>{}),s(p);return}if(this._output===null)this._output=s;else if(this._flags&_)this._output.add(s);else{let r=new Set;r.add(this._output),r.add(s),this._output=r,this._flags=(this._flags|_)&~m}let i=!1;s(E,(r,o)=>{if(r===S&&s(S,this._value),r===T){o===ae&&!i?(i=!0,this._singleDepCount++,this._flags&_||(this._flags|=m)):ce(o)&&this._handleLifecycleSignal(o);return}if(r===p){if(i&&(i=!1,this._singleDepCount--),this._output===null)return;if(this._flags&_){let l=this._output;l.delete(s),l.size===1?(this._output=l.values().next().value,this._flags&=~_,this._singleDepCount>0&&(this._flags|=m)):l.size===0&&(this._output=null,this._flags&=~(_|m),this._singleDepCount=0,this._flags=this._flags&~g|V,this._stop())}else this._output===s&&(this._output=null,this._flags&=~m,this._singleDepCount=0,this._flags=this._flags&~g|V,this._stop())}}),_e(()=>this._start())}}};var X=class extends G{constructor(t,n){super(void 0,{initial:t,autoDirty:!0,equals:n?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),R.register(this,{kind:"state",...n})}get(){return this._value}set(t){this._flags&h||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(F()?this._flags&k||(this._flags|=k,this._flags&w&&(this._flags=this._flags&~g|$,this._dispatch(T,y)),W(()=>{this._flags&=~k,this._flags=this._flags&~g|M,this._dispatch(S,this._value)})):(this._flags&w&&!(this._flags&m)&&(this._flags=this._flags&~g|$,this._dispatch(T,y)),this._flags=this._flags&~g|M,this._dispatch(S,this._value))))}update(t){this.set(t(this._value))}};function O(e,t){return new X(e,t)}function Pe(e){switch(e){case"openai":return"https://api.openai.com/v1";case"ollama":return"http://localhost:11434";default:return""}}function Ne(e,t){switch(e){case"openai":case"custom":return`${t}/chat/completions`;case"ollama":return`${t}/api/chat`;default:return`${t}/chat/completions`}}function Ce(e,t,n,s){let i={model:t,messages:n,stream:!0};return s?.temperature!==void 0&&(i.temperature=s.temperature),s?.maxTokens!==void 0&&(e==="ollama"?i.options={num_predict:s.maxTokens}:i.max_tokens=s.maxTokens),s?.stop&&(i.stop=s.stop),i}function je(e,t){let n={"Content-Type":"application/json"};return t&&(n.Authorization=`Bearer ${t}`),n}function Ue(e){let t=e.name??"llm",n=e.provider,s=e.baseURL??Pe(n),i=e.model??"",r=e.fetch??globalThis.fetch,o=O("",{name:`${t}.store`}),l=O({},{name:`${t}.tokens`}),a=O("pending",{name:`${t}.status`}),f=O(void 0,{name:`${t}.error`}),c=null;function u(){c&&(c.abort(),c=null),a.get()==="active"&&K(()=>{o.set(""),a.set("pending")})}function d(L,x){u(),c=new AbortController;let H=x?.signal?We(c.signal,x.signal):c.signal;K(()=>{o.set(""),l.set({}),f.set(void 0),a.set("active")});let b=Ne(n,s),D=Ce(n,i,L,x),I=je(n,e.apiKey);A(b,I,D,H).catch(()=>{})}async function A(L,x,H,b){try{let D=await r(L,{method:"POST",headers:x,body:JSON.stringify(H),signal:b});if(!D.ok){let z=await D.text().catch(()=>"");throw new Error(`LLM API error ${D.status}: ${z}`)}let I=D.body?.getReader();if(!I)throw new Error("No response body");let ee=new TextDecoder,te="",q="";for(;;){if(b.aborted)return;let{done:z,value:me}=await I.read();if(z)break;q+=ee.decode(me,{stream:!0});let ne=q.split(`
|
|
5
|
+
`);q=ne.pop()??"";for(let ye of ne){if(b.aborted)return;let P=ye.trim();if(!P||P.startsWith(":")||!P.startsWith("data: "))continue;let se=P.slice(6);if(se!=="[DONE]")try{let ie=JSON.parse(se),oe=Ke(n,ie);oe&&(te+=oe,o.set(te));let re=Fe(n,ie);re&&l.set(re)}catch{}}}if(ee.decode(),b.aborted)return;a.set("completed"),c=null}catch(D){if(b.aborted)return;K(()=>{f.set(D),a.set("errored")}),c=null}finally{b._cleanup?.()}}return{get:()=>o.get(),source:(L,x)=>o.source(L,x),tokens:l,status:a,error:f,generate:d,abort:u}}function Ke(e,t){return e==="ollama"?t?.message?.content:t?.choices?.[0]?.delta?.content}function Fe(e,t){let n=e==="ollama"?t:t?.usage;if(n){if(e==="ollama")return t.eval_count!==void 0||t.prompt_eval_count!==void 0?{promptTokens:t.prompt_eval_count,completionTokens:t.eval_count,totalTokens:(t.prompt_eval_count??0)+(t.eval_count??0)}:void 0;if(n.prompt_tokens!==void 0||n.completion_tokens!==void 0)return{promptTokens:n.prompt_tokens,completionTokens:n.completion_tokens,totalTokens:n.total_tokens}}}function We(e,t){let n=new AbortController,s=()=>{e.removeEventListener("abort",i),t.removeEventListener("abort",i)},i=()=>{n.abort(),s()};e.addEventListener("abort",i,{once:!0}),t.addEventListener("abort",i,{once:!0});let r=n.signal;return r._cleanup=s,r}0&&(module.exports={fromLLM});
|
package/dist/adapters/llm.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
2
|
-
import { W as WithStatusStatus } from '../withStatus-
|
|
3
|
-
import '../protocol-
|
|
1
|
+
import { S as Store } from '../types-BohB8jJr.cjs';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-ByT_R2Rz.cjs';
|
|
3
|
+
import '../protocol-fwiQ1TAS.cjs';
|
|
4
4
|
|
|
5
5
|
interface LLMMessage {
|
|
6
6
|
role: "user" | "assistant" | "system";
|
package/dist/adapters/llm.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
2
|
-
import { W as WithStatusStatus } from '../withStatus
|
|
3
|
-
import '../protocol-
|
|
1
|
+
import { S as Store } from '../types-CB1htCM8.js';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus---CFNir7.js';
|
|
3
|
+
import '../protocol-fwiQ1TAS.js';
|
|
4
4
|
|
|
5
5
|
interface LLMMessage {
|
|
6
6
|
role: "user" | "assistant" | "system";
|
package/dist/adapters/llm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-FV76ERZO.js";import"../chunk-KYY5ZPIG.js";import"../chunk-3CHC2PEC.js";import"../chunk-7MY7DDET.js";import"../chunk-TUPD47IE.js";import"../chunk-I7AUKTXE.js";export{a as fromLLM};
|