@callbag-recharge/callbag-recharge 0.26.0 → 0.28.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 +3 -3
- 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 +4 -4
- 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/mcp.cjs +4 -4
- 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 +8 -8
- 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 +3 -3
- package/dist/adapters/websocket.d.ts +3 -3
- package/dist/adapters/websocket.js +1 -1
- package/dist/ai/agentLoop/index.cjs +4 -4
- package/dist/ai/agentLoop/index.d.cts +3 -3
- package/dist/ai/agentLoop/index.d.ts +3 -3
- package/dist/ai/agentLoop/index.js +1 -1
- package/dist/ai/chatStream/index.cjs +4 -4
- package/dist/ai/chatStream/index.d.cts +2 -2
- package/dist/ai/chatStream/index.d.ts +2 -2
- package/dist/ai/chatStream/index.js +1 -1
- package/dist/ai/conversationSummary/index.cjs +2 -2
- package/dist/ai/conversationSummary/index.d.cts +3 -3
- package/dist/ai/conversationSummary/index.d.ts +3 -3
- package/dist/ai/conversationSummary/index.js +1 -1
- package/dist/ai/docIndex/index.cjs +2 -2
- package/dist/ai/docIndex/index.d.cts +2 -2
- package/dist/ai/docIndex/index.d.ts +2 -2
- package/dist/ai/docIndex/index.js +1 -1
- package/dist/ai/embeddingIndex/index.cjs +4 -4
- package/dist/ai/embeddingIndex/index.d.cts +2 -2
- package/dist/ai/embeddingIndex/index.d.ts +2 -2
- package/dist/ai/embeddingIndex/index.js +1 -1
- package/dist/ai/fromLLM.cjs +5 -5
- package/dist/ai/fromLLM.d.cts +3 -3
- package/dist/ai/fromLLM.d.ts +3 -3
- package/dist/ai/fromLLM.js +1 -1
- package/dist/ai/hybridRoute/index.cjs +2 -2
- package/dist/ai/hybridRoute/index.d.cts +2 -2
- package/dist/ai/hybridRoute/index.d.ts +2 -2
- package/dist/ai/hybridRoute/index.js +1 -1
- package/dist/ai/index.cjs +19 -19
- package/dist/ai/index.d.cts +11 -11
- package/dist/ai/index.d.ts +11 -11
- package/dist/ai/index.js +1 -1
- package/dist/ai/memoryStore/index.cjs +4 -4
- package/dist/ai/memoryStore/index.d.cts +4 -4
- package/dist/ai/memoryStore/index.d.ts +4 -4
- package/dist/ai/memoryStore/index.js +1 -1
- package/dist/ai/ragPipeline/index.cjs +2 -2
- package/dist/ai/ragPipeline/index.d.cts +5 -5
- package/dist/ai/ragPipeline/index.d.ts +5 -5
- package/dist/ai/ragPipeline/index.js +1 -1
- package/dist/ai/toolCallState/index.cjs +3 -3
- package/dist/ai/toolCallState/index.d.cts +2 -2
- package/dist/ai/toolCallState/index.d.ts +2 -2
- package/dist/ai/toolCallState/index.js +1 -1
- package/dist/{backoff-BXsH2Ago.d.cts → backoff-DTxCwT6Y.d.cts} +5 -1
- package/dist/{backoff-BXsH2Ago.d.ts → backoff-DTxCwT6Y.d.ts} +5 -1
- package/dist/{checkpoint-CC4tKs36.d.ts → checkpoint-BL3P4NKa.d.ts} +1 -1
- package/dist/{checkpoint-uaYS0fN4.d.cts → checkpoint-Ce5s55qK.d.cts} +1 -1
- package/dist/{chunk-RWOVH7KX.js → chunk-2CC5WOPJ.js} +1 -1
- package/dist/{chunk-5I4THZPQ.js → chunk-2HUNNHQ7.js} +1 -1
- package/dist/{chunk-LMR6RVT4.js → chunk-2HW3P76C.js} +1 -1
- package/dist/{chunk-A4HLU3K4.js → chunk-2S4KGZEZ.js} +1 -1
- package/dist/chunk-4TM5PZE7.js +1 -0
- package/dist/chunk-5ILLPD4O.js +1 -0
- package/dist/{chunk-DTYSGTF4.js → chunk-5IU7BRO3.js} +1 -1
- package/dist/chunk-5OKMOWXO.js +1 -0
- package/dist/{chunk-VHVYJSLE.js → chunk-5RHH6IBP.js} +1 -1
- package/dist/{chunk-YXMKE3MO.js → chunk-6J7KUCSP.js} +1 -1
- package/dist/{chunk-F5UMSRLI.js → chunk-6PPE32QX.js} +1 -1
- package/dist/{chunk-OA7V2X54.js → chunk-6X7DDCWD.js} +1 -1
- package/dist/{chunk-EV5DA5VJ.js → chunk-7QFSZNAS.js} +1 -1
- package/dist/{chunk-5LLYKN4X.js → chunk-7XVKW54N.js} +1 -1
- package/dist/chunk-AFW62HX3.js +1 -0
- package/dist/{chunk-TWZZYGMB.js → chunk-B6JVQ4UG.js} +1 -1
- package/dist/{chunk-3VEB4GWB.js → chunk-BR3ILKNJ.js} +1 -1
- package/dist/{chunk-NT5AUV6U.js → chunk-C2WEWVTY.js} +1 -1
- package/dist/{chunk-XD4BHZSL.js → chunk-CI6UDGFE.js} +1 -1
- package/dist/{chunk-Z6NJHBGT.js → chunk-CSMHDOAR.js} +1 -1
- package/dist/{chunk-6WZQIJIW.js → chunk-CYAX4SPJ.js} +1 -1
- package/dist/{chunk-VEJRX4GP.js → chunk-DGCSX5LB.js} +1 -1
- package/dist/chunk-E3ZMQ6Q4.js +1 -0
- package/dist/{chunk-FLKDEQGB.js → chunk-EBW4OE2G.js} +1 -1
- package/dist/{chunk-Y72LPOTS.js → chunk-ECHFG6CV.js} +1 -1
- package/dist/{chunk-ODEEQ7UH.js → chunk-ELLUOAQG.js} +1 -1
- package/dist/chunk-FFYLM7DC.js +1 -0
- package/dist/{chunk-BWH53TL4.js → chunk-FRMUZVGT.js} +1 -1
- package/dist/{chunk-CNTT2H6Y.js → chunk-GSBJP3FN.js} +1 -1
- package/dist/{chunk-VWMY3GUZ.js → chunk-GUA5WNVV.js} +1 -1
- package/dist/{chunk-2L6223KN.js → chunk-HKNYRLNU.js} +1 -1
- package/dist/{chunk-4RCV2AVX.js → chunk-HV7YDEJ4.js} +1 -1
- package/dist/{chunk-GI7IGLWO.js → chunk-HWQTFON4.js} +1 -1
- package/dist/chunk-IHAQFWGK.js +1 -0
- package/dist/{chunk-AA2V6B63.js → chunk-IU62HH3T.js} +1 -1
- package/dist/{chunk-3ORARRVS.js → chunk-IWNUA5CK.js} +1 -1
- package/dist/{chunk-TPKLTDRR.js → chunk-J33VTAG3.js} +1 -1
- package/dist/{chunk-ZJCF5NYF.js → chunk-JL22TTRW.js} +1 -1
- package/dist/{chunk-4PAUY5AJ.js → chunk-JM2F5OT6.js} +1 -1
- package/dist/chunk-JNSWP6KQ.js +1 -0
- package/dist/{chunk-OZKWHUA6.js → chunk-K7LNLSH3.js} +1 -1
- package/dist/{chunk-SWGLEZSU.js → chunk-KKYO3OUZ.js} +1 -1
- package/dist/{chunk-VFXNSORS.js → chunk-L4AO5VJL.js} +1 -1
- package/dist/{chunk-QX7UQF6F.js → chunk-LOIZTCS2.js} +1 -1
- package/dist/{chunk-DTTBQCH3.js → chunk-LUPWB4PV.js} +1 -1
- package/dist/{chunk-565W67EU.js → chunk-LUV6OCGP.js} +1 -1
- package/dist/{chunk-22FZRVAU.js → chunk-LXYAPCT4.js} +1 -1
- package/dist/{chunk-3TGYRIQB.js → chunk-MGYUSMHD.js} +1 -1
- package/dist/{chunk-QWMRZMRN.js → chunk-MQN6K4TJ.js} +1 -1
- package/dist/{chunk-7BXTCJFE.js → chunk-MV7JJFS6.js} +1 -1
- package/dist/{chunk-SFO5COGM.js → chunk-NHSRCO5R.js} +1 -1
- package/dist/{chunk-X2LL44CL.js → chunk-NMWR6BVH.js} +1 -1
- package/dist/{chunk-PKAASLJ7.js → chunk-OLKEEGDL.js} +1 -1
- package/dist/{chunk-CDEQNFFU.js → chunk-PLV5UA7W.js} +1 -1
- package/dist/{chunk-6SUM4DCC.js → chunk-QEQDW3GK.js} +1 -1
- package/dist/{chunk-JCENQEPP.js → chunk-QO3UGDBL.js} +1 -1
- package/dist/{chunk-6QFOVQRL.js → chunk-QV53T5W5.js} +1 -1
- package/dist/{chunk-5JSJZFLR.js → chunk-QYSMLMLL.js} +1 -1
- package/dist/chunk-RAMDA42C.js +1 -0
- package/dist/chunk-RGEXE4UN.js +1 -0
- package/dist/{chunk-HHJFEHV3.js → chunk-RMQXP2M2.js} +1 -1
- package/dist/{chunk-4CA73RLN.js → chunk-RP3UAWTS.js} +1 -1
- package/dist/chunk-RUSKMKKL.js +1 -0
- package/dist/{chunk-FZ6IJLYN.js → chunk-RXUHEF4P.js} +1 -1
- package/dist/{chunk-U3FGSR3I.js → chunk-SB4AKJUZ.js} +1 -1
- package/dist/{chunk-S67PXKAL.js → chunk-SCUDSBD7.js} +1 -1
- package/dist/{chunk-TLLIQ7WA.js → chunk-SYNLQQVQ.js} +1 -1
- package/dist/{chunk-2DNXE5W2.js → chunk-SZ4LWCTE.js} +1 -1
- package/dist/{chunk-ZCAW32S7.js → chunk-UEGKWX3G.js} +1 -1
- package/dist/{chunk-GMLWTZFM.js → chunk-UMDNGNOH.js} +1 -1
- package/dist/{chunk-YCYCWSXF.js → chunk-URSQTDBO.js} +1 -1
- package/dist/{chunk-54BT6MU4.js → chunk-UUKDAQ6G.js} +1 -1
- package/dist/{chunk-WEPYOEEV.js → chunk-UVLYAXFD.js} +1 -1
- package/dist/{chunk-ODNVGOOO.js → chunk-V7UYEUKU.js} +1 -1
- package/dist/{chunk-UVORPAQM.js → chunk-VLGFH66C.js} +1 -1
- package/dist/{chunk-YBVQC3GP.js → chunk-VPV4UELD.js} +1 -1
- package/dist/{chunk-LQ4T5H3N.js → chunk-VTHZ2EGB.js} +1 -1
- package/dist/{chunk-JTNG3QAI.js → chunk-X3SMBLN2.js} +1 -1
- package/dist/chunk-XDFHEM32.js +1 -0
- package/dist/{chunk-35BBDNSG.js → chunk-XVAJIW56.js} +1 -1
- package/dist/{chunk-PV347CGV.js → chunk-Y5P5HWLH.js} +1 -1
- package/dist/{chunk-FJ2VN2O3.js → chunk-YFS4TGFV.js} +1 -1
- package/dist/{chunk-QAHR7EMX.js → chunk-YLOA2CAG.js} +1 -1
- package/dist/{chunk-JW2KZLSD.js → chunk-YREY6NSW.js} +1 -1
- package/dist/{chunk-OGDTSFTW.js → chunk-ZAUOMQG7.js} +1 -1
- package/dist/{chunk-KJW2EGU5.js → chunk-ZVAIUTHT.js} +1 -1
- package/dist/{chunk-JVKWUVKQ.js → chunk-ZYDI5P3P.js} +1 -1
- package/dist/{circuitBreaker-eEj1lt8U.d.ts → circuitBreaker-VL2mNmlh.d.cts} +8 -2
- package/dist/{circuitBreaker--CJqUJ4u.d.cts → circuitBreaker-XCpH9Y1q.d.ts} +8 -2
- package/dist/compat/jotai/index.cjs +2 -2
- 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 +2 -2
- package/dist/compat/signals/index.d.ts +2 -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/{executionLog-EPbLbbSd.d.ts → executionLog-BGjxQVVr.d.ts} +2 -2
- package/dist/{executionLog-BIdo4sqy.d.cts → executionLog-BfSQ3GHA.d.cts} +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- package/dist/extra/forEach.d.ts +2 -2
- package/dist/extra/forEach.js +1 -1
- package/dist/extra/fromEvent.cjs +2 -2
- 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 +2 -2
- 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 +3 -3
- package/dist/extra/index.d.cts +3 -3
- package/dist/extra/index.d.ts +3 -3
- package/dist/extra/index.js +1 -1
- package/dist/extra/interval.cjs +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- package/dist/extra/subscribe.d.ts +2 -2
- 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.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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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/{fromTrigger-CPwRyr-E.d.cts → fromTrigger-B6Ju1eU7.d.cts} +1 -1
- package/dist/{fromTrigger-NowLcn6v.d.ts → fromTrigger-BE2UElL_.d.ts} +1 -1
- package/dist/{gate-DyykYri7.d.ts → gate-DHesrQsZ.d.ts} +1 -1
- package/dist/{gate-mtVc8Lmp.d.cts → gate-DwxiNkTU.d.cts} +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -1
- package/dist/memory/index.cjs +4 -4
- package/dist/memory/index.d.cts +5 -5
- package/dist/memory/index.d.ts +5 -5
- package/dist/memory/index.js +1 -1
- package/dist/messaging/index.cjs +9 -6
- package/dist/messaging/index.d.cts +261 -8
- package/dist/messaging/index.d.ts +261 -8
- package/dist/messaging/index.js +6 -3
- package/dist/orchestrate/executionLogAdapters.node.cjs +5 -5
- package/dist/orchestrate/executionLogAdapters.node.d.cts +4 -4
- package/dist/orchestrate/executionLogAdapters.node.d.ts +4 -4
- package/dist/orchestrate/executionLogAdapters.node.js +1 -1
- package/dist/orchestrate/index.cjs +6 -6
- package/dist/orchestrate/index.d.cts +136 -15
- package/dist/orchestrate/index.d.ts +136 -15
- package/dist/orchestrate/index.js +3 -3
- package/dist/patterns/createStore/index.cjs +4 -4
- package/dist/patterns/createStore/index.d.cts +3 -3
- package/dist/patterns/createStore/index.d.ts +3 -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/pagination/index.cjs +3 -3
- 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 +6 -6
- 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 +14 -14
- package/dist/patterns/textEditor/index.d.cts +3 -3
- package/dist/patterns/textEditor/index.d.ts +3 -3
- package/dist/patterns/textEditor/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-fwiQ1TAS.d.cts → protocol-BUYJYpNY.d.cts} +1 -1
- package/dist/{protocol-fwiQ1TAS.d.ts → protocol-BUYJYpNY.d.ts} +1 -1
- package/dist/{state-MV8qYwm5.d.ts → state-COBcpmfw.d.ts} +1 -1
- package/dist/{state-Ct6sOlOt.d.cts → state-Dzi-18Jk.d.cts} +1 -1
- package/dist/{tokenTracker-C1y5zB38.d.cts → tokenTracker-BNnszkmQ.d.cts} +2 -2
- package/dist/{tokenTracker-BRFP4C1K.d.ts → tokenTracker-DPPP_BFk.d.ts} +2 -2
- package/dist/{types-XRfOHCPC.d.cts → types-BH6fI4xa.d.cts} +11 -5
- package/dist/{types-n54oEEx_.d.ts → types-BhwFV4vQ.d.ts} +4 -2
- package/dist/{types-CB1htCM8.d.ts → types-C0BYZwdn.d.ts} +1 -1
- package/dist/{types-DbCdOVbw.d.cts → types-CxUiO1ko.d.cts} +2 -2
- package/dist/{types-CJKW4Ae9.d.ts → types-DpplCkXF.d.ts} +11 -5
- package/dist/{types-BohB8jJr.d.cts → types-d6KmLH4A.d.cts} +1 -1
- package/dist/{types-BRnNQbJn.d.cts → types-jcdA2zeu.d.cts} +4 -2
- package/dist/{types-ClmMSIr-.d.ts → types-vpHq4g8l.d.ts} +2 -2
- package/dist/utils/checkpointAdapters.node.d.cts +3 -3
- package/dist/utils/checkpointAdapters.node.d.ts +3 -3
- package/dist/utils/index.cjs +9 -9
- package/dist/utils/index.d.cts +10 -10
- package/dist/utils/index.d.ts +10 -10
- package/dist/utils/index.js +6 -6
- package/dist/{validationPipeline-BI_SE3Cz.d.cts → validationPipeline-Bzh3jftC.d.cts} +1 -1
- package/dist/{validationPipeline-JPHJzW3f.d.ts → validationPipeline-Dwg_zocb.d.ts} +1 -1
- package/dist/{withStatus-ByT_R2Rz.d.cts → withStatus-CvTKv5qu.d.cts} +1 -1
- package/dist/{withStatus---CFNir7.d.ts → withStatus-ZWYO2QC1.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2F6QWERG.js +0 -1
- package/dist/chunk-2HSHE2EI.js +0 -1
- package/dist/chunk-2ZFSL4MA.js +0 -1
- package/dist/chunk-5UIA6BIQ.js +0 -1
- package/dist/chunk-5WFSQQDI.js +0 -1
- package/dist/chunk-ABE7NDDH.js +0 -1
- package/dist/chunk-E2AW7OYE.js +0 -1
- package/dist/chunk-EAK2HKAD.js +0 -1
- package/dist/chunk-HTZLRRTE.js +0 -1
- package/dist/chunk-IB56FLRE.js +0 -1
- package/dist/chunk-TUPD47IE.js +0 -1
- package/dist/chunk-W7A67MEA.js +0 -1
package/dist/adapters/http.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var te=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var r in t)te(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Oe(t))!Pe.call(e,s)&&s!==r&&te(e,s,{get:()=>t[s],enumerable:!(n=Ie(t,s))||n.enumerable});return e};var Ne=e=>$e(te({},"__esModule",{value:!0}),e);var He={};Ce(He,{fromHTTP:()=>Ye});module.exports=Ne(He);var E=Symbol("DIRTY"),
|
|
2
|
-
`)}static _signalLabel(t){return t===E?"DIRTY":t===
|
|
1
|
+
"use strict";var te=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Pe=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var r in t)te(e,r,{get:t[r],enumerable:!0})},$e=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Oe(t))!Pe.call(e,s)&&s!==r&&te(e,s,{get:()=>t[s],enumerable:!(n=Ie(t,s))||n.enumerable});return e};var Ne=e=>$e(te({},"__esModule",{value:!0}),e);var He={};Ce(He,{fromHTTP:()=>Ye});module.exports=Ne(He);var E=Symbol("DIRTY"),M=Symbol("RESOLVED"),fe=Symbol("SINGLE_DEP"),j=Symbol("RESET"),se=Symbol("PAUSE"),re=Symbol("RESUME"),ie=Symbol("TEARDOWN");function de(e){return e===j||e===se||e===re||e===ie}var pe=0,ge=1,he=2,Te=3,me=4,Se=5,w=7,oe=7<<w,Me=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function _e(e){return Me[(e&oe)>>>w]}var h=0,y=1,g=2,_=3,H=0,q=[],ne=!1;function F(e){H++;let t,r,n=!1;try{t=e()}catch(i){r=i,n=!0}H--;let s;if(H===0&&!ne){ne=!0;try{for(let i=0;i<q.length;i++)try{q[i]()}catch(a){s??=a}}finally{q.length=0,ne=!1}}if(n)throw r;if(s)throw s;return t}function O(){return H>0}function z(e){q.push(e)}var G=0,B=[];function ye(){G++}function be(){if(G--,G===0){for(let e=0;e<B.length;e++)B[e]();B.length=0}}function ve(e){G>0?B.push(e):e()}var L=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 n=t.map(s=>e._names.get(s)??"?").join(",");return n.length>40?`${n.slice(0,37)}...`:n}static _resolveKey(t){let r=e._keys.get(t)??e._names.get(t);if(r)return r;let n=`anonymous_${e._nextId++}`;return e._keys.set(t,n),n}static register(t,r){if(!e.enabled)return;r?.name&&e._names.set(t,r.name),r?.kind&&e._kinds.set(t,r.kind);let n=e._nextId++,s=r?.name;if(!(s&&!e._usedKeys.has(s)))if(s){let i=e._depSuffix(r?.deps);s=i?`${s}(${i})`:`${s}_${n}`,e._usedKeys.has(s)&&(s=`${s}_${n}`)}else{let i=r?.kind??"store",a=e._depSuffix(r?.deps);s=a?`${i}(${a})`:`${i}_${n}`,e._usedKeys.has(s)&&(s=`${s}_${n}`)}e._usedKeys.add(s),e._keys.set(t,s),e._stores.add(new WeakRef(t))}static registerEdge(t,r){if(!e.enabled)return;let n=e._resolveKey(t),s=e._resolveKey(r),i=e._edges.get(n);i?i.includes(s)||i.push(s):e._edges.set(n,[s])}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,r=new Set;for(let n of e._stores){let s=n.deref();if(!s){e._stores.delete(n);continue}let i=e._resolveKey(s);r.add(i),t.set(i,e.inspect(s))}for(let[n,s]of e._edges){if(!r.has(n)){e._edges.delete(n),e._usedKeys.delete(n);continue}let i=s.filter(a=>r.has(a));i.length===0?e._edges.delete(n):i.length!==s.length&&e._edges.set(n,i)}return t}static trace(t,r){let n=null,s=t.get();return t.source(h,(i,a)=>{if(i===h&&(n=a),i===g){n=null;return}if(i===1){let u=a;if(!Object.is(u,s)){let l=s;s=u,r(u,l)}}}),()=>n?.(g)}static dumpGraph(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let[a,u]of r)for(let l of u){let f=n.get(l);f?f.includes(a)||f.push(a):n.set(l,[a])}let s=[];for(let[a,u]of t){let l=n.get(a),f=r.get(a),o=l?.length?` \u2190 [${l.join(", ")}]`:"",c=f?.length?` \u2192 [${f.join(", ")}]`:"";s.push(` ${a} (${u.kind}) = ${JSON.stringify(u.value)} [${u.status??"?"}]${o}${c}`)}return[`Store Graph (${t.size} nodes):`,...s].join(`
|
|
2
|
+
`)}static _signalLabel(t){return t===E?"DIRTY":t===M?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,r,n){let s=null,i=!1,a=r??e.getName(t),u=[],l={values:[],signals:[],events:[],ended:!1,endError:void 0,get completedCleanly(){return l.ended&&!i},get errored(){return l.ended&&i},dirtyCount:0,resolvedCount:0,name:a,get eventLog(){return u},dispose:()=>s?.(g),reconnect:()=>(s?.(g),e._observe(t,r,n))};return t.source(h,(f,o)=>{if(f===h){s=o;return}let c=O();f===y?(l.values.push(o),l.events.push({type:"data",data:o,inBatch:c}),u.push(o),n&&n(`[${a}] DATA:`,o)):f===_?(l.signals.push(o),l.events.push({type:"signal",data:o,inBatch:c}),u.push(e._signalLabel(o)),o===E?l.dirtyCount++:o===M&&l.resolvedCount++,n&&n(`[${a}] STATE:`,o)):f===g&&(l.ended=!0,l.endError=o,i=o!==void 0,l.events.push({type:"end",data:o,inBatch:c}),u.push(i?["END",o]:"END"),n&&n(`[${a}] END`,o!==void 0?o:""),s=null)}),l}static observe(t){return e._observe(t)}static activate(t){let r=null;return t.source(h,(n,s)=>{n===h&&(r=s),n===g&&(r=null)}),()=>r?.(g)}static tap(t,r){let n=r??`tap(${e.getName(t)??"anon"})`,s={get:()=>t.get(),source:t.source};return e.register(s,{name:n,kind:"tap"}),e.registerEdge(t,s),s}static spy(t,r){let n=r?.name??e.getName(t)??"spy",s=r?.log??console.log;return e._observe(t,n,s)}static snapshot(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let a of e._stores){let u=a.deref();if(!u)continue;let l=e._annotations.get(u);l!==void 0&&n.set(e._resolveKey(u),l)}let s=[];for(let[a,u]of t){let l={name:a,kind:u.kind,value:u.value,status:u.status},f=n.get(a);f!==void 0&&(l.annotation=f),s.push(l)}let i=[];for(let[a,u]of r)for(let l of u)i.push({from:a,to:l});return{nodes:s,edges:i,trace:e.traceLog()}}static toMermaid(t){let r=t?.direction??"TD",n=e.snapshot(),s=[`graph ${r}`],i={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},a=new Map;function u(o){let c=o.replace(/[^a-zA-Z0-9_]/g,"_"),d=a.get(c);return d===void 0?(a.set(c,1),c):(a.set(c,d+1),`${c}__${d}`)}let l=new Map;function f(o){let c=JSON.stringify(o);return c&&c.length>30?`${c.slice(0,27)}...`:c??"undefined"}for(let o of n.nodes){let c=u(o.name);l.set(o.name,c);let d=`${o.name} (${o.kind}) = ${f(o.value)}`,p=i[o.status??""]??"";s.push(` ${c}["${d}"]${p}`)}for(let o of n.edges){let c=l.get(o.from)??u(o.from),d=l.get(o.to)??u(o.to);s.push(` ${c} --> ${d}`)}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
3
|
`)}static toD2(t){let r=t?.direction??"down",n=e.snapshot(),s=[`direction: ${r}`,""],i={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},a=new Map;function u(o){let c=o.replace(/[^a-zA-Z0-9_]/g,"_"),d=a.get(c);return d===void 0?(a.set(c,1),c):(a.set(c,d+1),`${c}__${d}`)}let l=new Map;function f(o){let c=JSON.stringify(o);return c&&c.length>30?`${c.slice(0,27)}...`:c??"undefined"}for(let o of n.nodes){let c=u(o.name);l.set(o.name,c);let d=i[o.kind]??"rectangle",p=`${o.name} (${o.kind}) = ${f(o.value)}`,S=o.status?` [${o.status}]`:"";s.push(`${c}: "${p}${S}" { shape: ${d} }`)}n.edges.length>0&&s.push("");for(let o of n.edges){let c=l.get(o.from)??u(o.from),d=l.get(o.to)??u(o.to);s.push(`${c} -> ${d}`)}return s.join(`
|
|
4
|
-
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},s=e.maxTraceEntries;s<=0||(e._traceLog.length<s?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,e._traceFull=!0),e._traceHead=(e._traceHead+1)%s)}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 timeline(t){let r=null,n=[];return t.source(h,(s,i)=>{if(s===h){r=i;return}let a={timestamp:Date.now(),type:s===y?"data":s===_?"signal":"end",data:i,inBatch:O()};n.push(a),s===g&&(r=null)}),{entries:n,dispose:()=>r?.(g)}}static observeDerived(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:r};n._fn=()=>{let l=n._deps.map(o=>o.get()),f=s();return r.push({result:f,depValues:l,timestamp:Date.now()}),f};let i=e._observe(t),a=i.dispose;return{...i,evaluations:r,dispose:()=>{n._fn=s,a()},reconnect:()=>(n._fn=s,a(),e.observeDerived(t))}}static observeTaskState(t){let r=t.status.get(),n=[],s=null;return t.status.source(h,(i,a)=>{if(i===h){s=a;return}if(i===y){let u=a;if(u!==r){let l={from:r,to:u,timestamp:Date.now()};u==="error"&&(l.error=t.error.get()),n.push(l),r=u}}i===g&&(s=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{s?.(g)}}}static causalityTrace(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:r};let i=n._deps,a=i.map(o=>o.get());n._fn=()=>{let o=i.map(p=>p.get()),c=s(),d=-1;for(let p=0;p<i.length;p++)if(!Object.is(o[p],a[p])){d=p;break}return r.push({result:c,triggerDepIndex:d,triggerDepName:d>=0?e.getName(i[d]):void 0,depValues:o,timestamp:Date.now()}),a=o,c};let u=e._observe(t),l=u.dispose;return{...u,causality:r,dispose:()=>{n._fn=s,l()},reconnect:()=>(n._fn=s,l(),e.causalityTrace(t))}}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 J=1,v=64,b=2,$=4,Ee=8,De=16,L=32,D=1024,m=oe,N=ge<<x,W=he<<x,Z=pe<<x,je=me<<x,Fe=Se<<x,We=Te<<x,K=class{_value;_output=null;_flags;get _status(){return _e(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,r){this._value=r?.initial,this._fn=t,this._eqFn=r?.equals,this._getterFn=r?.getter,this._initial=r?.initial;let n=0;r?.autoDirty!==!1&&(n|=$),r?.resetOnTeardown&&(n|=Ee),r?.resubscribable&&(n|=De),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),r?._skipInspect||A.register(this,{kind:"producer",...r})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,r){let n=this._output;if(n)if(this._flags&v)for(let s of n)s(t,r);else n(t,r)}emit(t){this._flags&b||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(O()?this._flags&L||(this._flags|=L,this._flags&$&&(this._flags=this._flags&~m|N,this._dispatch(_,E)),z(()=>{this._flags&=~L,this._flags=this._flags&~m|W,this._dispatch(y,this._value)})):(this._flags&$&&!(this._flags&D)&&(this._flags=this._flags&~m|N,this._dispatch(_,E)),this._flags=this._flags&~m|W,this._dispatch(y,this._value))))}signal(t){this._flags&b||!this._output||(t===E?this._flags=this._flags&~m|N:t===j&&(this._flags=this._flags&~m|We),this._dispatch(_,t))}complete(){if(this._flags&b)return;this._flags=(this._flags|b)&~m|je;let t=this._output,r=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),t)if(r)for(let n of t)n(g);else t(g)}error(t){if(this._flags&b)return;this._flags=(this._flags|b)&~m|Fe;let r=this._output,n=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),r)if(n)for(let s of r)s(g,t);else r(g,t)}_start(){if(this._flags&J||!this._fn)return;this._flags|=J,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:r=>this.signal(r),complete:()=>this.complete(),error:r=>this.error(r),onSignal:r=>{this._onLifecycleSignal=r}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&J&&(this._flags&=~J,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&Ee&&(this._value=this._initial),this._flags&b||(this._flags=this._flags&~m|Z))}_handleLifecycleSignal(t){if(!(this._flags&b)){if(t===ie){this._onLifecycleSignal?.(t),this.complete();return}t===C&&(this._value=this._initial,this._flags&=~L),this._onLifecycleSignal?.(t),t===C&&this.emit(this._initial)}}source(t,r){if(t===h){let n=r;if(this._flags&b)if(this._flags&De&&this._output===null)this._flags=this._flags&~(b|m)|Z;else{n(h,i=>{}),n(g);return}if(this._output===null)this._output=n;else if(this._flags&v)this._output.add(n);else{let i=new Set;i.add(this._output),i.add(n),this._output=i,this._flags=(this._flags|v)&~D}let s=!1;n(h,(i,a)=>{if(i===y&&n(y,this._value),i===_){a===fe&&!s?(s=!0,this._singleDepCount++,this._flags&v||(this._flags|=D)):de(a)&&this._handleLifecycleSignal(a);return}if(i===g){if(s&&(s=!1,this._singleDepCount--),this._output===null)return;if(this._flags&v){let u=this._output;u.delete(n),u.size===1?(this._output=u.values().next().value,this._flags&=~v,this._singleDepCount>0&&(this._flags|=D)):u.size===0&&(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._flags=this._flags&~m|Z,this._stop())}else this._output===n&&(this._output=null,this._flags&=~D,this._singleDepCount=0,this._flags=this._flags&~m|Z,this._stop())}}),ve(()=>this._start())}}};function Q(e,t){return new K(e,t)}var ae=class extends K{constructor(t,r){super(void 0,{initial:t,autoDirty:!0,equals:r?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),A.register(this,{kind:"state",...r})}get(){return this._value}set(t){this._flags&b||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(O()?this._flags&L||(this._flags|=L,this._flags&$&&(this._flags=this._flags&~m|N,this._dispatch(_,E)),z(()=>{this._flags&=~L,this._flags=this._flags&~m|W,this._dispatch(y,this._value)})):(this._flags&$&&!(this._flags&D)&&(this._flags=this._flags&~m|N,this._dispatch(_,E)),this._flags=this._flags&~m|W,this._dispatch(y,this._value))))}update(t){this.set(t(this._value))}};function V(e,t){return new ae(e,t)}function ke(e){return(t,r)=>{if(t!==0)return;let n=new AbortController,s=n.signal,i=!1,a,u;try{a=typeof e=="function"?e():e,u=a[Symbol.asyncIterator]()}catch(f){r(0,()=>{}),r(2,f);return}r(0,f=>{f===2&&!i&&(i=!0,n.abort(),Promise.resolve(u.return?.()).catch(()=>{}))});async function l(){try{for(;!i&&!s.aborted;){let f=await u.next();if(i||s.aborted)break;if(f.done){i=!0,r(2);return}r(1,f.value)}}catch(f){!i&&!s.aborted&&(i=!0,r(2,f))}}l()}}function xe(e){return(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),e.then(s=>{n||(r(1,s),n||r(2))},s=>{n||r(2,s)})}}function Ke(e){return e!=null&&typeof e.then=="function"}function Ve(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function Ue(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function ue(e){return Ke(e)?xe(e):Ve(e)?ke(e):typeof e!="string"&&Ue(e)?(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)});for(let s of e){if(n)return;r(1,s)}n||r(2)}:(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),n||r(1,e),n||r(2)}}function le(e,t,r){let n=null;return e(0,(s,i)=>{if(s===0){n=i;return}if(s===2){n=null,r?.onEnd?.(i);return}s===1&&t(i)}),{unsubscribe(){n?.(2),n=null}}}function we(e,t,r){let n=null;ye(),e.source(h,(i,a)=>{if(i===h&&(n=a),i===g){n=null,r?.onEnd?.(a);return}if(i===1){let u=a,l=s;s=u,t(u,l)}});let s;try{s=e.get()}catch{}return be(),{unsubscribe(){n?.(g),n=null},signal(i){n?.(_,i)}}}function Re(e,t){let r=t?.initialStatus??"pending",n=V(r,{name:"withStatus:status",equals:Object.is}),s=V(void 0,{name:"withStatus:error",equals:Object.is}),i=Q(({emit:u,complete:l,error:f})=>{n.set(r),s.set(void 0);let o=we(e,c=>{n.get()==="errored"?F(()=>{s.set(void 0),n.set("active")}):n.set("active"),u(c)},{onEnd:c=>{if(c!==void 0){let d=c instanceof Error?c:new Error(String(c));F(()=>{s.set(d),n.set("errored")}),f(c)}else n.set("completed"),l()}});return()=>{o.unsubscribe()}},{initial:e.get(),resubscribable:!0}),a={get:()=>e.get(),source:(u,l)=>i.source(u,l),get _status(){return i._status},status:n,error:s};return A.register(a,{kind:"withStatus"}),a}function Ye(e,t){let r=t?.name??"http",n=t?.method??"GET",s=t?.headers,i=t?.body,a=t?.poll??0,u=t?.transform??(w=>w.json()),l=t?.timeout??3e4,f=V(0,{name:`${r}:fetchCount`}),o=null,c=null,d=null,p=null,S=null,k=!1;function U(){if(!k||!o)return;S=new AbortController;let w=[S.signal];t?.signal&&w.push(t.signal);let R=new AbortController;for(let T of w){if(T.aborted){R.abort(T.reason);break}T.addEventListener("abort",()=>R.abort(T.reason),{once:!0})}let I=setTimeout(()=>R.abort(new Error("Request timeout")),l),ee=i!==void 0?typeof i=="string"?i:JSON.stringify(i):void 0;le(ue(fetch(e,{method:n,headers:s,body:ee,signal:R.signal})),T=>{if(!k){clearTimeout(I),S=null;return}if(!T.ok){clearTimeout(I),S=null,c?.(new Error(`HTTP ${T.status}: ${T.statusText}`));return}le(ue(u(T)),M=>{clearTimeout(I),S=null,k&&(F(()=>{f.update(Le=>Le+1),o?.(M)}),ce())},{onEnd:M=>{if(clearTimeout(I),S=null,M!==void 0){if(!k||M?.name==="AbortError")return;c?.(M)}}})},{onEnd:T=>{if(clearTimeout(I),S=null,T!==void 0){if(!k||T?.name==="AbortError")return;c?.(T)}}})}function ce(){!k||P||a<=0||(p=setTimeout(()=>{p=null,U()},a))}let X=null,P=!1,Ae=Q(({emit:w,error:R,complete:I,onSignal:ee})=>(o=w,c=R,d=I,k=!0,P=!1,X=()=>{U()},ee(T=>{T===se?(P=!0,p!==null&&(clearTimeout(p),p=null)):T===re?(P=!1,ce()):T===C&&(S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null),f.set(0),P=!1,U())}),U(),()=>{k=!1,P=!1,o=null,c=null,d=null,X=null,S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null)}),{name:r,kind:"http"}),Y=Re(Ae);return{get:()=>Y.get(),source:(w,R)=>Y.source(w,R),status:Y.status,error:Y.error,fetchCount:f,refetch(){X?.()},stop(){k=!1,S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null),d?.()}}}0&&(module.exports={fromHTTP});
|
|
4
|
+
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},s=e.maxTraceEntries;s<=0||(e._traceLog.length<s?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,e._traceFull=!0),e._traceHead=(e._traceHead+1)%s)}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 timeline(t){let r=null,n=[];return t.source(h,(s,i)=>{if(s===h){r=i;return}let a={timestamp:Date.now(),type:s===y?"data":s===_?"signal":"end",data:i,inBatch:O()};n.push(a),s===g&&(r=null)}),{entries:n,dispose:()=>r?.(g)}}static observeDerived(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:r};n._fn=()=>{let l=n._deps.map(o=>o.get()),f=s();return r.push({result:f,depValues:l,timestamp:Date.now()}),f};let i=e._observe(t),a=i.dispose;return{...i,evaluations:r,dispose:()=>{n._fn=s,a()},reconnect:()=>(n._fn=s,a(),e.observeDerived(t))}}static observeTaskState(t){let r=t.status.get(),n=[],s=null;return t.status.source(h,(i,a)=>{if(i===h){s=a;return}if(i===y){let u=a;if(u!==r){let l={from:r,to:u,timestamp:Date.now()};u==="error"&&(l.error=t.error.get()),n.push(l),r=u}}i===g&&(s=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{s?.(g)}}}static causalityTrace(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:r};let i=n._deps,a=i.map(o=>o.get());n._fn=()=>{let o=i.map(p=>p.get()),c=s(),d=-1;for(let p=0;p<i.length;p++)if(!Object.is(o[p],a[p])){d=p;break}return r.push({result:c,triggerDepIndex:d,triggerDepName:d>=0?e.getName(i[d]):void 0,depValues:o,timestamp:Date.now()}),a=o,c};let u=e._observe(t),l=u.dispose;return{...u,causality:r,dispose:()=>{n._fn=s,l()},reconnect:()=>(n._fn=s,l(),e.causalityTrace(t))}}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 J=1,v=64,b=2,C=4,Ee=8,De=16,k=32,D=1024,m=oe,$=ge<<w,W=he<<w,Z=pe<<w,je=me<<w,Fe=Se<<w,We=Te<<w,K=class{_value;_output=null;_flags;get _status(){return _e(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,r){this._value=r?.initial,this._fn=t,this._eqFn=r?.equals,this._getterFn=r?.getter,this._initial=r?.initial;let n=0;r?.autoDirty!==!1&&(n|=C),r?.resetOnTeardown&&(n|=Ee),r?.resubscribable&&(n|=De),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),r?._skipInspect||L.register(this,{kind:"producer",...r})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,r){let n=this._output;if(n)if(this._flags&v)for(let s of n)s(t,r);else n(t,r)}emit(t){this._flags&b||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(O()?this._flags&k||(this._flags|=k,this._flags&C&&(this._flags=this._flags&~m|$,this._dispatch(_,E)),z(()=>{this._flags&k&&(this._flags&=~k,this._flags=this._flags&~m|W,this._dispatch(y,this._value))})):(this._flags&C&&!(this._flags&D)&&(this._flags=this._flags&~m|$,this._dispatch(_,E)),this._flags=this._flags&~m|W,this._dispatch(y,this._value))))}signal(t){this._flags&b||!this._output||(t===E?this._flags=this._flags&~m|$:t===M&&(this._flags=this._flags&~m|We),this._dispatch(_,t))}complete(){if(this._flags&b)return;this._flags=(this._flags|b)&~m|je;let t=this._output,r=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),t)if(r)for(let n of t)n(g);else t(g)}error(t){if(this._flags&b)return;this._flags=(this._flags|b)&~m|Fe;let r=this._output,n=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),r)if(n)for(let s of r)s(g,t);else r(g,t)}_start(){if(this._flags&J||!this._fn)return;this._flags|=J,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:r=>this.signal(r),complete:()=>this.complete(),error:r=>this.error(r),onSignal:r=>{this._onLifecycleSignal=r}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&J&&(this._flags&=~J,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&Ee&&(this._value=this._initial),this._flags&b||(this._flags=this._flags&~m|Z))}_handleLifecycleSignal(t){if(!(this._flags&b)){if(t===ie){this._onLifecycleSignal?.(t),this.complete();return}t===j&&(this._value=this._initial,this._flags&=~k),this._onLifecycleSignal?.(t)}}source(t,r){if(t===h){let n=r;if(this._flags&b)if(this._flags&De&&this._output===null)this._flags=this._flags&~(b|m)|Z;else{n(h,i=>{}),n(g);return}if(this._output===null)this._output=n;else if(this._flags&v)this._output.add(n);else{let i=new Set;i.add(this._output),i.add(n),this._output=i,this._flags=(this._flags|v)&~D}let s=!1;n(h,(i,a)=>{if(i===y&&n(y,this._value),i===_){a===fe&&!s?(s=!0,this._singleDepCount++,this._flags&v||(this._flags|=D)):de(a)&&this._handleLifecycleSignal(a);return}if(i===g){if(s&&(s=!1,this._singleDepCount--),this._output===null)return;if(this._flags&v){let u=this._output;u.delete(n),u.size===1?(this._output=u.values().next().value,this._flags&=~v,this._singleDepCount>0&&(this._flags|=D)):u.size===0&&(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._flags=this._flags&~m|Z,this._stop())}else this._output===n&&(this._output=null,this._flags&=~D,this._singleDepCount=0,this._flags=this._flags&~m|Z,this._stop())}}),ve(()=>this._start())}}};function Q(e,t){return new K(e,t)}var ae=class extends K{constructor(t,r){super(void 0,{initial:t,autoDirty:!0,equals:r?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),L.register(this,{kind:"state",...r})}get(){return this._value}set(t){this._flags&b||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(O()?this._flags&k||(this._flags|=k,this._flags&C&&(this._flags=this._flags&~m|$,this._dispatch(_,E)),z(()=>{this._flags&k&&(this._flags&=~k,this._flags=this._flags&~m|W,this._dispatch(y,this._value))})):(this._flags&C&&!(this._flags&D)&&(this._flags=this._flags&~m|$,this._dispatch(_,E)),this._flags=this._flags&~m|W,this._dispatch(y,this._value))))}update(t){this.set(t(this._value))}};function V(e,t){return new ae(e,t)}function ke(e){return(t,r)=>{if(t!==0)return;let n=new AbortController,s=n.signal,i=!1,a,u;try{a=typeof e=="function"?e():e,u=a[Symbol.asyncIterator]()}catch(f){r(0,()=>{}),r(2,f);return}r(0,f=>{f===2&&!i&&(i=!0,n.abort(),Promise.resolve(u.return?.()).catch(()=>{}))});async function l(){try{for(;!i&&!s.aborted;){let f=await u.next();if(i||s.aborted)break;if(f.done){i=!0,r(2);return}r(1,f.value)}}catch(f){!i&&!s.aborted&&(i=!0,r(2,f))}}l()}}function xe(e){return(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),e.then(s=>{n||(r(1,s),n||r(2))},s=>{n||r(2,s)})}}function Ke(e){return e!=null&&typeof e.then=="function"}function Ve(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function Ue(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function ue(e){return Ke(e)?xe(e):Ve(e)?ke(e):typeof e!="string"&&Ue(e)?(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)});for(let s of e){if(n)return;r(1,s)}n||r(2)}:(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),n||r(1,e),n||r(2)}}function le(e,t,r){let n=null;return e(0,(s,i)=>{if(s===0){n=i;return}if(s===2){n=null,r?.onEnd?.(i);return}s===1&&t(i)}),{unsubscribe(){n?.(2),n=null}}}function we(e,t,r){let n=null;ye(),e.source(h,(i,a)=>{if(i===h&&(n=a),i===g){n=null,r?.onEnd?.(a);return}if(i===1){let u=a,l=s;s=u,t(u,l)}});let s;try{s=e.get()}catch{}return be(),{unsubscribe(){n?.(g),n=null},signal(i){n?.(_,i)}}}function Re(e,t){let r=t?.initialStatus??"pending",n=V(r,{name:"withStatus:status",equals:Object.is}),s=V(void 0,{name:"withStatus:error",equals:Object.is}),i=Q(({emit:u,complete:l,error:f})=>{n.set(r),s.set(void 0);let o=we(e,c=>{n.get()==="errored"?F(()=>{s.set(void 0),n.set("active")}):n.set("active"),u(c)},{onEnd:c=>{if(c!==void 0){let d=c instanceof Error?c:new Error(String(c));F(()=>{s.set(d),n.set("errored")}),f(c)}else n.set("completed"),l()}});return()=>{o.unsubscribe()}},{initial:e.get(),resubscribable:!0}),a={get:()=>e.get(),source:(u,l)=>i.source(u,l),get _status(){return i._status},status:n,error:s};return L.register(a,{kind:"withStatus"}),a}function Ye(e,t){let r=t?.name??"http",n=t?.method??"GET",s=t?.headers,i=t?.body,a=t?.poll??0,u=t?.transform??(R=>R.json()),l=t?.timeout??3e4,f=V(0,{name:`${r}:fetchCount`}),o=null,c=null,d=null,p=null,S=null,x=!1;function U(){if(!x||!o)return;S=new AbortController;let R=[S.signal];t?.signal&&R.push(t.signal);let A=new AbortController;for(let T of R){if(T.aborted){A.abort(T.reason);break}T.addEventListener("abort",()=>A.abort(T.reason),{once:!0})}let I=setTimeout(()=>A.abort(new Error("Request timeout")),l),ee=i!==void 0?typeof i=="string"?i:JSON.stringify(i):void 0;le(ue(fetch(e,{method:n,headers:s,body:ee,signal:A.signal})),T=>{if(!x){clearTimeout(I),S=null;return}if(!T.ok){clearTimeout(I),S=null,c?.(new Error(`HTTP ${T.status}: ${T.statusText}`));return}le(ue(u(T)),N=>{clearTimeout(I),S=null,x&&(F(()=>{f.update(Le=>Le+1),o?.(N)}),ce())},{onEnd:N=>{if(clearTimeout(I),S=null,N!==void 0){if(!x||N?.name==="AbortError")return;c?.(N)}}})},{onEnd:T=>{if(clearTimeout(I),S=null,T!==void 0){if(!x||T?.name==="AbortError")return;c?.(T)}}})}function ce(){!x||P||a<=0||(p=setTimeout(()=>{p=null,U()},a))}let X=null,P=!1,Ae=Q(({emit:R,error:A,complete:I,onSignal:ee})=>(o=R,c=A,d=I,x=!0,P=!1,X=()=>{U()},ee(T=>{T===se?(P=!0,p!==null&&(clearTimeout(p),p=null)):T===re?(P=!1,ce()):T===j&&(S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null),f.set(0),P=!1,U())}),U(),()=>{x=!1,P=!1,o=null,c=null,d=null,X=null,S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null)}),{name:r,kind:"http"}),Y=Re(Ae);return{get:()=>Y.get(),source:(R,A)=>Y.source(R,A),status:Y.status,error:Y.error,fetchCount:f,refetch(){X?.()},stop(){x=!1,S?.abort(),S=null,p!==null&&(clearTimeout(p),p=null),d?.()}}}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-d6KmLH4A.cjs';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-CvTKv5qu.cjs';
|
|
3
|
+
import '../protocol-BUYJYpNY.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-C0BYZwdn.js';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-ZWYO2QC1.js';
|
|
3
|
+
import '../protocol-BUYJYpNY.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-YFS4TGFV.js";import"../chunk-7XVKW54N.js";import"../chunk-UMDNGNOH.js";import"../chunk-O2PONDZT.js";import"../chunk-J2E7GAMR.js";import"../chunk-4ILN4V4C.js";import"../chunk-Q3HIBGHR.js";import"../chunk-FFYLM7DC.js";import"../chunk-RUSKMKKL.js";import"../chunk-HKNYRLNU.js";import"../chunk-JNSWP6KQ.js";import"../chunk-I7AUKTXE.js";export{a as fromHTTP};
|
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var Be=Object.create;var re=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ue=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var ze=(e,t)=>{for(var r in t)re(e,r,{get:t[r],enumerable:!0})},he=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ue(t))!Ke.call(e,o)&&o!==r&&re(e,o,{get:()=>t[o],enumerable:!(n=qe(t,o))||n.enumerable});return e};var Ye=(e,t,r)=>(r=e!=null?Be(Ve(e)):{},he(t||!e||!e.__esModule?re(r,"default",{value:e,enumerable:!0}):r,e)),Je=e=>he(re({},"__esModule",{value:!0}),e);var rt={};ze(rt,{fromHTTP:()=>Le,fromMCP:()=>We,fromWebSocket:()=>Me,fromWebhook:()=>Ne,toSSE:()=>$e,toWebSocket:()=>je});module.exports=Je(rt);var M=Symbol("DIRTY"),ee=Symbol("RESOLVED"),Te=Symbol("SINGLE_DEP"),
|
|
1
|
+
"use strict";var Be=Object.create;var re=Object.defineProperty;var qe=Object.getOwnPropertyDescriptor;var Ue=Object.getOwnPropertyNames;var Ve=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var ze=(e,t)=>{for(var r in t)re(e,r,{get:t[r],enumerable:!0})},he=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ue(t))!Ke.call(e,o)&&o!==r&&re(e,o,{get:()=>t[o],enumerable:!(n=qe(t,o))||n.enumerable});return e};var Ye=(e,t,r)=>(r=e!=null?Be(Ve(e)):{},he(t||!e||!e.__esModule?re(r,"default",{value:e,enumerable:!0}):r,e)),Je=e=>he(re({},"__esModule",{value:!0}),e);var rt={};ze(rt,{fromHTTP:()=>Le,fromMCP:()=>We,fromWebSocket:()=>Me,fromWebhook:()=>Ne,toSSE:()=>$e,toWebSocket:()=>je});module.exports=Je(rt);var M=Symbol("DIRTY"),ee=Symbol("RESOLVED"),Te=Symbol("SINGLE_DEP"),q=Symbol("RESET"),z=Symbol("PAUSE"),Y=Symbol("RESUME"),ge=Symbol("TEARDOWN");function be(e){return e===q||e===z||e===Y||e===ge}var ye=0,_e=1,ve=2,Ee=3,ke=4,we=5,U=7,me=7<<U,Ge=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function xe(e){return Ge[(e&me)>>>U]}var R=0,I=1,w=2,P=3,oe=0,se=[],pe=!1;function j(e){oe++;let t,r,n=!1;try{t=e()}catch(s){r=s,n=!0}oe--;let o;if(oe===0&&!pe){pe=!0;try{for(let s=0;s<se.length;s++)try{se[s]()}catch(u){o??=u}}finally{se.length=0,pe=!1}}if(n)throw r;if(o)throw o;return t}function J(){return oe>0}function ue(e){se.push(e)}var ae=0,ie=[];function Re(){ae++}function De(){if(ae--,ae===0){for(let e=0;e<ie.length;e++)ie[e]();ie.length=0}}function Ce(e){ae>0?ie.push(e):e()}var A=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 n=t.map(o=>e._names.get(o)??"?").join(",");return n.length>40?`${n.slice(0,37)}...`:n}static _resolveKey(t){let r=e._keys.get(t)??e._names.get(t);if(r)return r;let n=`anonymous_${e._nextId++}`;return e._keys.set(t,n),n}static register(t,r){if(!e.enabled)return;r?.name&&e._names.set(t,r.name),r?.kind&&e._kinds.set(t,r.kind);let n=e._nextId++,o=r?.name;if(!(o&&!e._usedKeys.has(o)))if(o){let s=e._depSuffix(r?.deps);o=s?`${o}(${s})`:`${o}_${n}`,e._usedKeys.has(o)&&(o=`${o}_${n}`)}else{let s=r?.kind??"store",u=e._depSuffix(r?.deps);o=u?`${s}(${u})`:`${s}_${n}`,e._usedKeys.has(o)&&(o=`${o}_${n}`)}e._usedKeys.add(o),e._keys.set(t,o),e._stores.add(new WeakRef(t))}static registerEdge(t,r){if(!e.enabled)return;let n=e._resolveKey(t),o=e._resolveKey(r),s=e._edges.get(n);s?s.includes(o)||s.push(o):e._edges.set(n,[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,r=new Set;for(let n of e._stores){let o=n.deref();if(!o){e._stores.delete(n);continue}let s=e._resolveKey(o);r.add(s),t.set(s,e.inspect(o))}for(let[n,o]of e._edges){if(!r.has(n)){e._edges.delete(n),e._usedKeys.delete(n);continue}let s=o.filter(u=>r.has(u));s.length===0?e._edges.delete(n):s.length!==o.length&&e._edges.set(n,s)}return t}static trace(t,r){let n=null,o=t.get();return t.source(R,(s,u)=>{if(s===R&&(n=u),s===w){n=null;return}if(s===1){let i=u;if(!Object.is(i,o)){let f=o;o=i,r(i,f)}}}),()=>n?.(w)}static dumpGraph(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let[u,i]of r)for(let f of i){let c=n.get(f);c?c.includes(u)||c.push(u):n.set(f,[u])}let o=[];for(let[u,i]of t){let f=n.get(u),c=r.get(u),a=f?.length?` \u2190 [${f.join(", ")}]`:"",l=c?.length?` \u2192 [${c.join(", ")}]`:"";o.push(` ${u} (${i.kind}) = ${JSON.stringify(i.value)} [${i.status??"?"}]${a}${l}`)}return[`Store Graph (${t.size} nodes):`,...o].join(`
|
|
2
2
|
`)}static _signalLabel(t){return t===M?"DIRTY":t===ee?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,r,n){let o=null,s=!1,u=r??e.getName(t),i=[],f={values:[],signals:[],events:[],ended:!1,endError:void 0,get completedCleanly(){return f.ended&&!s},get errored(){return f.ended&&s},dirtyCount:0,resolvedCount:0,name:u,get eventLog(){return i},dispose:()=>o?.(w),reconnect:()=>(o?.(w),e._observe(t,r,n))};return t.source(R,(c,a)=>{if(c===R){o=a;return}let l=J();c===I?(f.values.push(a),f.events.push({type:"data",data:a,inBatch:l}),i.push(a),n&&n(`[${u}] DATA:`,a)):c===P?(f.signals.push(a),f.events.push({type:"signal",data:a,inBatch:l}),i.push(e._signalLabel(a)),a===M?f.dirtyCount++:a===ee&&f.resolvedCount++,n&&n(`[${u}] STATE:`,a)):c===w&&(f.ended=!0,f.endError=a,s=a!==void 0,f.events.push({type:"end",data:a,inBatch:l}),i.push(s?["END",a]:"END"),n&&n(`[${u}] END`,a!==void 0?a:""),o=null)}),f}static observe(t){return e._observe(t)}static activate(t){let r=null;return t.source(R,(n,o)=>{n===R&&(r=o),n===w&&(r=null)}),()=>r?.(w)}static tap(t,r){let n=r??`tap(${e.getName(t)??"anon"})`,o={get:()=>t.get(),source:t.source};return e.register(o,{name:n,kind:"tap"}),e.registerEdge(t,o),o}static spy(t,r){let n=r?.name??e.getName(t)??"spy",o=r?.log??console.log;return e._observe(t,n,o)}static snapshot(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let u of e._stores){let i=u.deref();if(!i)continue;let f=e._annotations.get(i);f!==void 0&&n.set(e._resolveKey(i),f)}let o=[];for(let[u,i]of t){let f={name:u,kind:i.kind,value:i.value,status:i.status},c=n.get(u);c!==void 0&&(f.annotation=c),o.push(f)}let s=[];for(let[u,i]of r)for(let f of i)s.push({from:u,to:f});return{nodes:o,edges:s,trace:e.traceLog()}}static toMermaid(t){let r=t?.direction??"TD",n=e.snapshot(),o=[`graph ${r}`],s={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},u=new Map;function i(a){let l=a.replace(/[^a-zA-Z0-9_]/g,"_"),g=u.get(l);return g===void 0?(u.set(l,1),l):(u.set(l,g+1),`${l}__${g}`)}let f=new Map;function c(a){let l=JSON.stringify(a);return l&&l.length>30?`${l.slice(0,27)}...`:l??"undefined"}for(let a of n.nodes){let l=i(a.name);f.set(a.name,l);let g=`${a.name} (${a.kind}) = ${c(a.value)}`,m=s[a.status??""]??"";o.push(` ${l}["${g}"]${m}`)}for(let a of n.edges){let l=f.get(a.from)??i(a.from),g=f.get(a.to)??i(a.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
3
|
`)}static toD2(t){let r=t?.direction??"down",n=e.snapshot(),o=[`direction: ${r}`,""],s={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},u=new Map;function i(a){let l=a.replace(/[^a-zA-Z0-9_]/g,"_"),g=u.get(l);return g===void 0?(u.set(l,1),l):(u.set(l,g+1),`${l}__${g}`)}let f=new Map;function c(a){let l=JSON.stringify(a);return l&&l.length>30?`${l.slice(0,27)}...`:l??"undefined"}for(let a of n.nodes){let l=i(a.name);f.set(a.name,l);let g=s[a.kind]??"rectangle",m=`${a.name} (${a.kind}) = ${c(a.value)}`,T=a.status?` [${a.status}]`:"";o.push(`${l}: "${m}${T}" { shape: ${g} }`)}n.edges.length>0&&o.push("");for(let a of n.edges){let l=f.get(a.from)??i(a.from),g=f.get(a.to)??i(a.to);o.push(`${l} -> ${g}`)}return o.join(`
|
|
4
|
-
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},o=e.maxTraceEntries;o<=0||(e._traceLog.length<o?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,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 timeline(t){let r=null,n=[];return t.source(R,(o,s)=>{if(o===R){r=s;return}let u={timestamp:Date.now(),type:o===I?"data":o===P?"signal":"end",data:s,inBatch:J()};n.push(u),o===w&&(r=null)}),{entries:n,dispose:()=>r?.(w)}}static observeDerived(t){let r=[],n=t,o=n._fn;if(typeof o!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:r};n._fn=()=>{let f=n._deps.map(a=>a.get()),c=o();return r.push({result:c,depValues:f,timestamp:Date.now()}),c};let s=e._observe(t),u=s.dispose;return{...s,evaluations:r,dispose:()=>{n._fn=o,u()},reconnect:()=>(n._fn=o,u(),e.observeDerived(t))}}static observeTaskState(t){let r=t.status.get(),n=[],o=null;return t.status.source(R,(s,u)=>{if(s===R){o=u;return}if(s===I){let i=u;if(i!==r){let f={from:r,to:i,timestamp:Date.now()};i==="error"&&(f.error=t.error.get()),n.push(f),r=i}}s===w&&(o=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{o?.(w)}}}static causalityTrace(t){let r=[],n=t,o=n._fn;if(typeof o!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:r};let s=n._deps,u=s.map(a=>a.get());n._fn=()=>{let a=s.map(m=>m.get()),l=o(),g=-1;for(let m=0;m<s.length;m++)if(!Object.is(a[m],u[m])){g=m;break}return r.push({result:l,triggerDepIndex:g,triggerDepName:g>=0?e.getName(s[g]):void 0,depValues:a,timestamp:Date.now()}),u=a,l};let i=e._observe(t),f=i.dispose;return{...i,causality:r,dispose:()=>{n._fn=o,f()},reconnect:()=>(n._fn=o,f(),e.causalityTrace(t))}}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 le=1,$=64,L=2,G=4,Ae=8,Oe=16,V=32,H=1024,C=me,Q=_e<<q,te=ve<<q,ce=ye<<q,Qe=ke<<q,Ze=we<<q,Xe=Ee<<q,ne=class{_value;_output=null;_flags;get _status(){return xe(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,r){this._value=r?.initial,this._fn=t,this._eqFn=r?.equals,this._getterFn=r?.getter,this._initial=r?.initial;let n=0;r?.autoDirty!==!1&&(n|=G),r?.resetOnTeardown&&(n|=Ae),r?.resubscribable&&(n|=Oe),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),r?._skipInspect||A.register(this,{kind:"producer",...r})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,r){let n=this._output;if(n)if(this._flags&$)for(let o of n)o(t,r);else n(t,r)}emit(t){this._flags&L||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(J()?this._flags&V||(this._flags|=V,this._flags&G&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),ue(()=>{this._flags&=~V,this._flags=this._flags&~C|te,this._dispatch(I,this._value)})):(this._flags&G&&!(this._flags&H)&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),this._flags=this._flags&~C|te,this._dispatch(I,this._value))))}signal(t){this._flags&L||!this._output||(t===M?this._flags=this._flags&~C|Q:t===ee&&(this._flags=this._flags&~C|Xe),this._dispatch(P,t))}complete(){if(this._flags&L)return;this._flags=(this._flags|L)&~C|Qe;let t=this._output,r=this._flags&$;if(this._output=null,this._flags&=~($|H),this._singleDepCount=0,this._stop(),t)if(r)for(let n of t)n(w);else t(w)}error(t){if(this._flags&L)return;this._flags=(this._flags|L)&~C|Ze;let r=this._output,n=this._flags&$;if(this._output=null,this._flags&=~($|H),this._singleDepCount=0,this._stop(),r)if(n)for(let o of r)o(w,t);else r(w,t)}_start(){if(this._flags&le||!this._fn)return;this._flags|=le,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:r=>this.signal(r),complete:()=>this.complete(),error:r=>this.error(r),onSignal:r=>{this._onLifecycleSignal=r}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&le&&(this._flags&=~le,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&Ae&&(this._value=this._initial),this._flags&L||(this._flags=this._flags&~C|ce))}_handleLifecycleSignal(t){if(!(this._flags&L)){if(t===ge){this._onLifecycleSignal?.(t),this.complete();return}t===j&&(this._value=this._initial,this._flags&=~V),this._onLifecycleSignal?.(t),t===j&&this.emit(this._initial)}}source(t,r){if(t===R){let n=r;if(this._flags&L)if(this._flags&Oe&&this._output===null)this._flags=this._flags&~(L|C)|ce;else{n(R,s=>{}),n(w);return}if(this._output===null)this._output=n;else if(this._flags&$)this._output.add(n);else{let s=new Set;s.add(this._output),s.add(n),this._output=s,this._flags=(this._flags|$)&~H}let o=!1;n(R,(s,u)=>{if(s===I&&n(I,this._value),s===P){u===Te&&!o?(o=!0,this._singleDepCount++,this._flags&$||(this._flags|=H)):be(u)&&this._handleLifecycleSignal(u);return}if(s===w){if(o&&(o=!1,this._singleDepCount--),this._output===null)return;if(this._flags&$){let i=this._output;i.delete(n),i.size===1?(this._output=i.values().next().value,this._flags&=~$,this._singleDepCount>0&&(this._flags|=H)):i.size===0&&(this._output=null,this._flags&=~($|H),this._singleDepCount=0,this._flags=this._flags&~C|ce,this._stop())}else this._output===n&&(this._output=null,this._flags&=~H,this._singleDepCount=0,this._flags=this._flags&~C|ce,this._stop())}}),Ce(()=>this._start())}}};function K(e,t){return new ne(e,t)}var Se=class extends ne{constructor(t,r){super(void 0,{initial:t,autoDirty:!0,equals:r?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),A.register(this,{kind:"state",...r})}get(){return this._value}set(t){this._flags&L||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(J()?this._flags&V||(this._flags|=V,this._flags&G&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),ue(()=>{this._flags&=~V,this._flags=this._flags&~C|te,this._dispatch(I,this._value)})):(this._flags&G&&!(this._flags&H)&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),this._flags=this._flags&~C|te,this._dispatch(I,this._value))))}update(t){this.set(t(this._value))}};function x(e,t){return new Se(e,t)}function Pe(e){return(t,r)=>{if(t!==0)return;let n=new AbortController,o=n.signal,s=!1,u,i;try{u=typeof e=="function"?e():e,i=u[Symbol.asyncIterator]()}catch(c){r(0,()=>{}),r(2,c);return}r(0,c=>{c===2&&!s&&(s=!0,n.abort(),Promise.resolve(i.return?.()).catch(()=>{}))});async function f(){try{for(;!s&&!o.aborted;){let c=await i.next();if(s||o.aborted)break;if(c.done){s=!0,r(2);return}r(1,c.value)}}catch(c){!s&&!o.aborted&&(s=!0,r(2,c))}}f()}}function Ie(e){return(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)}),e.then(o=>{n||(r(1,o),n||r(2))},o=>{n||r(2,o)})}}function et(e){return e!=null&&typeof e.then=="function"}function tt(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function nt(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function U(e){return et(e)?Ie(e):tt(e)?Pe(e):typeof e!="string"&&nt(e)?(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)});for(let o of e){if(n)return;r(1,o)}n||r(2)}:(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)}),n||r(1,e),n||r(2)}}function B(e,t,r){let n=null;return e(0,(o,s)=>{if(o===0){n=s;return}if(o===2){n=null,r?.onEnd?.(s);return}o===1&&t(s)}),{unsubscribe(){n?.(2),n=null}}}function Z(e,t,r){let n=null;Re(),e.source(R,(s,u)=>{if(s===R&&(n=u),s===w){n=null,r?.onEnd?.(u);return}if(s===1){let i=u,f=o;o=i,t(i,f)}});let o;try{o=e.get()}catch{}return De(),{unsubscribe(){n?.(w),n=null},signal(s){n?.(P,s)}}}function X(e,t){let r=t?.initialStatus??"pending",n=x(r,{name:"withStatus:status",equals:Object.is}),o=x(void 0,{name:"withStatus:error",equals:Object.is}),s=K(({emit:i,complete:f,error:c})=>{n.set(r),o.set(void 0);let a=Z(e,l=>{n.get()==="errored"?F(()=>{o.set(void 0),n.set("active")}):n.set("active"),i(l)},{onEnd:l=>{if(l!==void 0){let g=l instanceof Error?l:new Error(String(l));F(()=>{o.set(g),n.set("errored")}),c(l)}else n.set("completed"),f()}});return()=>{a.unsubscribe()}},{initial:e.get(),resubscribable:!0}),u={get:()=>e.get(),source:(i,f)=>s.source(i,f),get _status(){return s._status},status:n,error:o};return A.register(u,{kind:"withStatus"}),u}function Le(e,t){let r=t?.name??"http",n=t?.method??"GET",o=t?.headers,s=t?.body,u=t?.poll??0,i=t?.transform??(E=>E.json()),f=t?.timeout??3e4,c=x(0,{name:`${r}:fetchCount`}),a=null,l=null,g=null,m=null,T=null,_=!1;function D(){if(!_||!a)return;T=new AbortController;let E=[T.signal];t?.signal&&E.push(t.signal);let v=new AbortController;for(let k of E){if(k.aborted){v.abort(k.reason);break}k.addEventListener("abort",()=>v.abort(k.reason),{once:!0})}let y=setTimeout(()=>v.abort(new Error("Request timeout")),f),O=s!==void 0?typeof s=="string"?s:JSON.stringify(s):void 0;B(U(fetch(e,{method:n,headers:o,body:O,signal:v.signal})),k=>{if(!_){clearTimeout(y),T=null;return}if(!k.ok){clearTimeout(y),T=null,l?.(new Error(`HTTP ${k.status}: ${k.statusText}`));return}B(U(i(k)),W=>{clearTimeout(y),T=null,_&&(F(()=>{c.update(N=>N+1),a?.(W)}),h())},{onEnd:W=>{if(clearTimeout(y),T=null,W!==void 0){if(!_||W?.name==="AbortError")return;l?.(W)}}})},{onEnd:k=>{if(clearTimeout(y),T=null,k!==void 0){if(!_||k?.name==="AbortError")return;l?.(k)}}})}function h(){!_||p||u<=0||(m=setTimeout(()=>{m=null,D()},u))}let d=null,p=!1,S=K(({emit:E,error:v,complete:y,onSignal:O})=>(a=E,l=v,g=y,_=!0,p=!1,d=()=>{D()},O(k=>{k===z?(p=!0,m!==null&&(clearTimeout(m),m=null)):k===Y?(p=!1,h()):k===j&&(T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null),c.set(0),p=!1,D())}),D(),()=>{_=!1,p=!1,a=null,l=null,g=null,d=null,T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null)}),{name:r,kind:"http"}),b=X(S);return{get:()=>b.get(),source:(E,v)=>b.source(E,v),status:b.status,error:b.error,fetchCount:c,refetch(){d?.()},stop(){_=!1,T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null),g?.()}}}function We(e){let t=e.name??"mcp",r=e.client,n=x([],{name:`${t}.tools`}),o=x([],{name:`${t}.resources`}),s=x(void 0,{name:`${t}.refreshError`});function u(c){s.set(c);let a=e.onRefreshError;if(a==="warn")console.warn(`[${t}] refresh error:`,c);else{if(a==="error")throw c;typeof a=="function"&&a(c)}}function i(){s.set(void 0),r.listTools&&B(U(r.listTools()),c=>{n.set(c.tools)},{onEnd:c=>{c!==void 0&&u(c)}}),r.listResources&&B(U(r.listResources()),c=>{o.set(c.resources)},{onEnd:c=>{c!==void 0&&u(c)}})}function f(c){let a=`${t}:${c}`,l=x(void 0,{name:`${a}.result`}),g=x("idle",{name:`${a}.status`}),m=x(void 0,{name:`${a}.error`}),T=x(void 0,{name:`${a}.lastArgs`}),_=x(void 0,{name:`${a}.duration`}),D=!1;function h(d){if(D)return;D=!0,F(()=>{T.set(d),m.set(void 0),g.set("active")});let p=Date.now();B(U(r.callTool({name:c,arguments:d})),S=>{D=!1;let b=Date.now()-p;if(S.isError){let y=S.content.filter(k=>k.type==="text").map(k=>k.text??"").join(`
|
|
5
|
-
`),O=new Error(y||"MCP tool returned error");
|
|
4
|
+
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},o=e.maxTraceEntries;o<=0||(e._traceLog.length<o?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,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 timeline(t){let r=null,n=[];return t.source(R,(o,s)=>{if(o===R){r=s;return}let u={timestamp:Date.now(),type:o===I?"data":o===P?"signal":"end",data:s,inBatch:J()};n.push(u),o===w&&(r=null)}),{entries:n,dispose:()=>r?.(w)}}static observeDerived(t){let r=[],n=t,o=n._fn;if(typeof o!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:r};n._fn=()=>{let f=n._deps.map(a=>a.get()),c=o();return r.push({result:c,depValues:f,timestamp:Date.now()}),c};let s=e._observe(t),u=s.dispose;return{...s,evaluations:r,dispose:()=>{n._fn=o,u()},reconnect:()=>(n._fn=o,u(),e.observeDerived(t))}}static observeTaskState(t){let r=t.status.get(),n=[],o=null;return t.status.source(R,(s,u)=>{if(s===R){o=u;return}if(s===I){let i=u;if(i!==r){let f={from:r,to:i,timestamp:Date.now()};i==="error"&&(f.error=t.error.get()),n.push(f),r=i}}s===w&&(o=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{o?.(w)}}}static causalityTrace(t){let r=[],n=t,o=n._fn;if(typeof o!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:r};let s=n._deps,u=s.map(a=>a.get());n._fn=()=>{let a=s.map(m=>m.get()),l=o(),g=-1;for(let m=0;m<s.length;m++)if(!Object.is(a[m],u[m])){g=m;break}return r.push({result:l,triggerDepIndex:g,triggerDepName:g>=0?e.getName(s[g]):void 0,depValues:a,timestamp:Date.now()}),u=a,l};let i=e._observe(t),f=i.dispose;return{...i,causality:r,dispose:()=>{n._fn=o,f()},reconnect:()=>(n._fn=o,f(),e.causalityTrace(t))}}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 le=1,$=64,L=2,G=4,Ae=8,Oe=16,H=32,F=1024,C=me,Q=_e<<U,te=ve<<U,ce=ye<<U,Qe=ke<<U,Ze=we<<U,Xe=Ee<<U,ne=class{_value;_output=null;_flags;get _status(){return xe(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,r){this._value=r?.initial,this._fn=t,this._eqFn=r?.equals,this._getterFn=r?.getter,this._initial=r?.initial;let n=0;r?.autoDirty!==!1&&(n|=G),r?.resetOnTeardown&&(n|=Ae),r?.resubscribable&&(n|=Oe),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),r?._skipInspect||A.register(this,{kind:"producer",...r})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,r){let n=this._output;if(n)if(this._flags&$)for(let o of n)o(t,r);else n(t,r)}emit(t){this._flags&L||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(J()?this._flags&H||(this._flags|=H,this._flags&G&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),ue(()=>{this._flags&H&&(this._flags&=~H,this._flags=this._flags&~C|te,this._dispatch(I,this._value))})):(this._flags&G&&!(this._flags&F)&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),this._flags=this._flags&~C|te,this._dispatch(I,this._value))))}signal(t){this._flags&L||!this._output||(t===M?this._flags=this._flags&~C|Q:t===ee&&(this._flags=this._flags&~C|Xe),this._dispatch(P,t))}complete(){if(this._flags&L)return;this._flags=(this._flags|L)&~C|Qe;let t=this._output,r=this._flags&$;if(this._output=null,this._flags&=~($|F),this._singleDepCount=0,this._stop(),t)if(r)for(let n of t)n(w);else t(w)}error(t){if(this._flags&L)return;this._flags=(this._flags|L)&~C|Ze;let r=this._output,n=this._flags&$;if(this._output=null,this._flags&=~($|F),this._singleDepCount=0,this._stop(),r)if(n)for(let o of r)o(w,t);else r(w,t)}_start(){if(this._flags&le||!this._fn)return;this._flags|=le,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:r=>this.signal(r),complete:()=>this.complete(),error:r=>this.error(r),onSignal:r=>{this._onLifecycleSignal=r}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&le&&(this._flags&=~le,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&Ae&&(this._value=this._initial),this._flags&L||(this._flags=this._flags&~C|ce))}_handleLifecycleSignal(t){if(!(this._flags&L)){if(t===ge){this._onLifecycleSignal?.(t),this.complete();return}t===q&&(this._value=this._initial,this._flags&=~H),this._onLifecycleSignal?.(t)}}source(t,r){if(t===R){let n=r;if(this._flags&L)if(this._flags&Oe&&this._output===null)this._flags=this._flags&~(L|C)|ce;else{n(R,s=>{}),n(w);return}if(this._output===null)this._output=n;else if(this._flags&$)this._output.add(n);else{let s=new Set;s.add(this._output),s.add(n),this._output=s,this._flags=(this._flags|$)&~F}let o=!1;n(R,(s,u)=>{if(s===I&&n(I,this._value),s===P){u===Te&&!o?(o=!0,this._singleDepCount++,this._flags&$||(this._flags|=F)):be(u)&&this._handleLifecycleSignal(u);return}if(s===w){if(o&&(o=!1,this._singleDepCount--),this._output===null)return;if(this._flags&$){let i=this._output;i.delete(n),i.size===1?(this._output=i.values().next().value,this._flags&=~$,this._singleDepCount>0&&(this._flags|=F)):i.size===0&&(this._output=null,this._flags&=~($|F),this._singleDepCount=0,this._flags=this._flags&~C|ce,this._stop())}else this._output===n&&(this._output=null,this._flags&=~F,this._singleDepCount=0,this._flags=this._flags&~C|ce,this._stop())}}),Ce(()=>this._start())}}};function K(e,t){return new ne(e,t)}var Se=class extends ne{constructor(t,r){super(void 0,{initial:t,autoDirty:!0,equals:r?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),A.register(this,{kind:"state",...r})}get(){return this._value}set(t){this._flags&L||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(J()?this._flags&H||(this._flags|=H,this._flags&G&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),ue(()=>{this._flags&H&&(this._flags&=~H,this._flags=this._flags&~C|te,this._dispatch(I,this._value))})):(this._flags&G&&!(this._flags&F)&&(this._flags=this._flags&~C|Q,this._dispatch(P,M)),this._flags=this._flags&~C|te,this._dispatch(I,this._value))))}update(t){this.set(t(this._value))}};function x(e,t){return new Se(e,t)}function Pe(e){return(t,r)=>{if(t!==0)return;let n=new AbortController,o=n.signal,s=!1,u,i;try{u=typeof e=="function"?e():e,i=u[Symbol.asyncIterator]()}catch(c){r(0,()=>{}),r(2,c);return}r(0,c=>{c===2&&!s&&(s=!0,n.abort(),Promise.resolve(i.return?.()).catch(()=>{}))});async function f(){try{for(;!s&&!o.aborted;){let c=await i.next();if(s||o.aborted)break;if(c.done){s=!0,r(2);return}r(1,c.value)}}catch(c){!s&&!o.aborted&&(s=!0,r(2,c))}}f()}}function Ie(e){return(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)}),e.then(o=>{n||(r(1,o),n||r(2))},o=>{n||r(2,o)})}}function et(e){return e!=null&&typeof e.then=="function"}function tt(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function nt(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function V(e){return et(e)?Ie(e):tt(e)?Pe(e):typeof e!="string"&&nt(e)?(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)});for(let o of e){if(n)return;r(1,o)}n||r(2)}:(t,r)=>{if(t!==0)return;let n=!1;r(0,o=>{o===2&&(n=!0)}),n||r(1,e),n||r(2)}}function B(e,t,r){let n=null;return e(0,(o,s)=>{if(o===0){n=s;return}if(o===2){n=null,r?.onEnd?.(s);return}o===1&&t(s)}),{unsubscribe(){n?.(2),n=null}}}function Z(e,t,r){let n=null;Re(),e.source(R,(s,u)=>{if(s===R&&(n=u),s===w){n=null,r?.onEnd?.(u);return}if(s===1){let i=u,f=o;o=i,t(i,f)}});let o;try{o=e.get()}catch{}return De(),{unsubscribe(){n?.(w),n=null},signal(s){n?.(P,s)}}}function X(e,t){let r=t?.initialStatus??"pending",n=x(r,{name:"withStatus:status",equals:Object.is}),o=x(void 0,{name:"withStatus:error",equals:Object.is}),s=K(({emit:i,complete:f,error:c})=>{n.set(r),o.set(void 0);let a=Z(e,l=>{n.get()==="errored"?j(()=>{o.set(void 0),n.set("active")}):n.set("active"),i(l)},{onEnd:l=>{if(l!==void 0){let g=l instanceof Error?l:new Error(String(l));j(()=>{o.set(g),n.set("errored")}),c(l)}else n.set("completed"),f()}});return()=>{a.unsubscribe()}},{initial:e.get(),resubscribable:!0}),u={get:()=>e.get(),source:(i,f)=>s.source(i,f),get _status(){return s._status},status:n,error:o};return A.register(u,{kind:"withStatus"}),u}function Le(e,t){let r=t?.name??"http",n=t?.method??"GET",o=t?.headers,s=t?.body,u=t?.poll??0,i=t?.transform??(E=>E.json()),f=t?.timeout??3e4,c=x(0,{name:`${r}:fetchCount`}),a=null,l=null,g=null,m=null,T=null,_=!1;function D(){if(!_||!a)return;T=new AbortController;let E=[T.signal];t?.signal&&E.push(t.signal);let v=new AbortController;for(let k of E){if(k.aborted){v.abort(k.reason);break}k.addEventListener("abort",()=>v.abort(k.reason),{once:!0})}let y=setTimeout(()=>v.abort(new Error("Request timeout")),f),O=s!==void 0?typeof s=="string"?s:JSON.stringify(s):void 0;B(V(fetch(e,{method:n,headers:o,body:O,signal:v.signal})),k=>{if(!_){clearTimeout(y),T=null;return}if(!k.ok){clearTimeout(y),T=null,l?.(new Error(`HTTP ${k.status}: ${k.statusText}`));return}B(V(i(k)),W=>{clearTimeout(y),T=null,_&&(j(()=>{c.update(N=>N+1),a?.(W)}),h())},{onEnd:W=>{if(clearTimeout(y),T=null,W!==void 0){if(!_||W?.name==="AbortError")return;l?.(W)}}})},{onEnd:k=>{if(clearTimeout(y),T=null,k!==void 0){if(!_||k?.name==="AbortError")return;l?.(k)}}})}function h(){!_||p||u<=0||(m=setTimeout(()=>{m=null,D()},u))}let d=null,p=!1,S=K(({emit:E,error:v,complete:y,onSignal:O})=>(a=E,l=v,g=y,_=!0,p=!1,d=()=>{D()},O(k=>{k===z?(p=!0,m!==null&&(clearTimeout(m),m=null)):k===Y?(p=!1,h()):k===q&&(T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null),c.set(0),p=!1,D())}),D(),()=>{_=!1,p=!1,a=null,l=null,g=null,d=null,T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null)}),{name:r,kind:"http"}),b=X(S);return{get:()=>b.get(),source:(E,v)=>b.source(E,v),status:b.status,error:b.error,fetchCount:c,refetch(){d?.()},stop(){_=!1,T?.abort(),T=null,m!==null&&(clearTimeout(m),m=null),g?.()}}}function We(e){let t=e.name??"mcp",r=e.client,n=x([],{name:`${t}.tools`}),o=x([],{name:`${t}.resources`}),s=x(void 0,{name:`${t}.refreshError`});function u(c){s.set(c);let a=e.onRefreshError;if(a==="warn")console.warn(`[${t}] refresh error:`,c);else{if(a==="error")throw c;typeof a=="function"&&a(c)}}function i(){s.set(void 0),r.listTools&&B(V(r.listTools()),c=>{n.set(c.tools)},{onEnd:c=>{c!==void 0&&u(c)}}),r.listResources&&B(V(r.listResources()),c=>{o.set(c.resources)},{onEnd:c=>{c!==void 0&&u(c)}})}function f(c){let a=`${t}:${c}`,l=x(void 0,{name:`${a}.result`}),g=x("idle",{name:`${a}.status`}),m=x(void 0,{name:`${a}.error`}),T=x(void 0,{name:`${a}.lastArgs`}),_=x(void 0,{name:`${a}.duration`}),D=!1;function h(d){if(D)return;D=!0,j(()=>{T.set(d),m.set(void 0),g.set("active")});let p=Date.now();B(V(r.callTool({name:c,arguments:d})),S=>{D=!1;let b=Date.now()-p;if(S.isError){let y=S.content.filter(k=>k.type==="text").map(k=>k.text??"").join(`
|
|
5
|
+
`),O=new Error(y||"MCP tool returned error");j(()=>{_.set(b),m.set(O),g.set("errored")});return}let E=S.content.filter(y=>y.type==="text"),v;if(E.length===1){let y=E[0].text;if(y!==void 0)try{v=JSON.parse(y)}catch{v=y}}else E.length>1?v=E.map(y=>y.text??""):v=S.content;j(()=>{_.set(b),l.set(v),g.set("completed")})},{onEnd:S=>{if(D=!1,S===void 0)return;let b=Date.now()-p;j(()=>{_.set(b),m.set(S),g.set("errored")})}})}return{get:()=>l.get(),source:(d,p)=>l.source(d,p),status:g,error:m,call:h,lastArgs:T,duration:_}}return{tool:f,tools:n,resources:o,refresh:i,refreshError:s}}function fe(e){return(t,r)=>{if(t!==0)return;let n=!1,o;r(0,s=>{s===2&&!n&&(n=!0,o?.())});try{o=e(s=>{n||(n=!0,r(1,s),r(2))},s=>{n||(n=!0,r(2,s))})}catch(s){n||(n=!0,r(2,s))}}}function $e(e,t){let r=t?.path??"/",n=t?.name??"sse",o=t?.hostname??"0.0.0.0",s=t?.serialize??JSON.stringify,u=t?.eventName??"message",i=t?.pingInterval??3e4,f=x(0,{name:`${n}:connections`}),c=new Set,a=new Map,l=null;function g(){l||(l=Z(e,d=>{let p=s(d),S=`event: ${u}
|
|
6
6
|
data: ${p}
|
|
7
7
|
|
|
8
8
|
`;for(let b of c)try{b.write(S)}catch{m(b)}}))}function m(d){c.delete(d);let p=a.get(d);p&&(clearInterval(p),a.delete(d)),f.set(c.size),c.size===0&&l&&(l.unsubscribe(),l=null)}function T(d,p){let S=d.method?.toUpperCase();if((d.url??"/").split("?")[0]!==r){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
|
|
@@ -12,4 +12,4 @@ data: ${y}
|
|
|
12
12
|
|
|
13
13
|
`)}}catch{}if(i>0){let v=setInterval(()=>{try{p.write(`:ping
|
|
14
14
|
|
|
15
|
-
`)}catch{m(p)}},i);a.set(p,v)}d.on("close",()=>m(p)),g()}let _=null;function D(){return t?.port?_?(d,p)=>{d===0&&(p(0,()=>{}),p(2,new Error("toSSE: already listening. Call close() first.")))}:(d,p)=>{if(d!==0)return;let S=!1;p(0,b=>{b===2&&(S=!0)}),B(
|
|
15
|
+
`)}catch{m(p)}},i);a.set(p,v)}d.on("close",()=>m(p)),g()}let _=null;function D(){return t?.port?_?(d,p)=>{d===0&&(p(0,()=>{}),p(2,new Error("toSSE: already listening. Call close() first.")))}:(d,p)=>{if(d!==0)return;let S=!1;p(0,b=>{b===2&&(S=!0)}),B(V(import("http")),b=>{S||B(fe((E,v)=>{_=b.createServer(T),_.once("listening",()=>E()),_.once("error",y=>{_=null,v(y)}),_.listen(t.port,o)}),()=>{S||(p(1,void 0),p(2))},{onEnd:E=>{E!==void 0&&!S&&p(2,E)}})})}:(d,p)=>{d===0&&(p(0,()=>{}),p(2,new Error("toSSE: port is required for listen()")))}}function h(){for(let d of c)try{d.end()}catch{}c.clear();for(let d of a.values())clearInterval(d);a.clear(),f.set(0),l?.unsubscribe(),l=null,_?.close(),_=null}return A.register(f,{kind:"sse"}),{connectionCount:f,handler:T,listen:D,close:h}}function Ne(e){let t=e?.path??"/",r=e?.parse??JSON.parse,n=e?.name??"webhook",o=e?.hostname??"0.0.0.0",s=e?.maxBodySize??1024*1024,u=e?.responseTimeout??3e4,i=x(0,{name:`${n}:count`}),f=null,c=!1,a=K(({emit:h,onSignal:d})=>(f=h,c=!1,d(p=>{p===z?c=!0:p===Y?c=!1:p===q&&(c=!1,i.set(0))}),()=>{f=null,c=!1}),{name:n,kind:"webhook"});A.register(a,{kind:"webhook"});let l=X(a),g=null,m=new Set;function T(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(c){d.writeHead(503,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Service paused"}));return}let E=[],v=0,y=!1;h.on("error",()=>{y=!0,d.headersSent||(d.writeHead(400,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Request aborted"})))}),h.on("data",O=>{if(!y){if(v+=O.length,v>s){y=!0,d.writeHead(413,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Payload too large"})),h.destroy?.();return}E.push(O)}}),h.on("end",()=>{if(!y)try{let O=Buffer.concat(E).toString("utf-8"),k=O.length>0?r(O):void 0;i.update(de=>de+1);let W=!1,N=null,Fe={body:k,get responded(){return W},respond(de,He=200){W||(W=!0,N!==null&&(clearTimeout(N),m.delete(N),N=null),d.writeHead(He,{"Content-Type":"application/json"}),d.end(JSON.stringify(de)))}};N=setTimeout(()=>{m.delete(N),N=null,W||(W=!0,d.writeHead(504,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:"Response timeout"})))},u),m.add(N),f?.(Fe)}catch(O){d.writeHead(400,{"Content-Type":"application/json"}),d.end(JSON.stringify({error:O?.message??"Parse error"}))}})}function _(){return e?.port?g?(h,d)=>{h===0&&(d(0,()=>{}),d(2,new Error("fromWebhook: already listening. Call close() first.")))}:fe((h,d)=>{try{g=require("http").createServer(T),g.once("listening",()=>h()),g.once("error",S=>{g=null,d(S)}),g.listen(e.port,o);return}catch(p){d(p);return}}):(h,d)=>{h===0&&(d(0,()=>{}),d(2,new Error("fromWebhook: port is required for listen()")))}}function D(){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:i,handler:T,listen:_,close:D}}function Me(e,t){let r=t?.name??"websocket",n=t?.parse??(S=>S),o=t?.reconnect??!1,s=t?.onParseError??"warn",u=x("connecting",{name:`${r}:connectionState`,equals:()=>!1}),i=null,f=null,c=null,a=null,l=null,g=!1,m=null,T=[];function _(){for(;T.length>0&&i?.readyState===WebSocket.OPEN;)i.send(T.shift())}function D(){g=!1,u.set("connecting");try{i=new WebSocket(e,t?.protocols)}catch(S){u.set("closed"),c?.(S);return}i.onopen=()=>{u.set("open"),_()},i.onmessage=S=>{if(!h)try{let b=n(S.data);f?.(b)}catch(b){s==="error"?c?.(b):s==="warn"&&console.warn(`[${r}] parse error:`,b)}},i.onerror=()=>{m=new Error(`WebSocket error on ${e}`)},i.onclose=()=>{u.set("closed"),i=null;let S=m;m=null,!g&&o!==!1?l=setTimeout(()=>{l=null,f&&D()},o):S&&!g?c?.(S):a?.()}}let h=!1,d=K(({emit:S,error:b,complete:E,onSignal:v})=>(f=S,c=b,a=E,h=!1,D(),v(y=>{y===z?h=!0:y===Y?h=!1:y===q&&(h=!1,T.length=0,l!==null&&(clearTimeout(l),l=null),i&&(g=!0,i.onopen=null,i.onmessage=null,i.onerror=null,i.onclose=null,i.close(),i=null),u.set("closed"),D())}),()=>{f=null,c=null,a=null,h=!1,g=!0,T.length=0,l!==null&&(clearTimeout(l),l=null),i&&(i.onopen=null,i.onmessage=null,i.onerror=null,i.onclose=null,i.close(),i=null),u.set("closed")}),{name:r,kind:"websocket"});A.register(d,{kind:"websocket"});let p=X(d);return{get:()=>p.get(),source:(S,b)=>p.source(S,b),status:p.status,error:p.error,connectionState:u,send(S){i?.readyState===WebSocket.OPEN?i.send(S):T.push(S)},close(S,b){g=!0,T.length=0,l!==null&&(clearTimeout(l),l=null),i?.close(S,b)}}}function je(e,t,r){let n=u=>typeof u=="string"?u:JSON.stringify(u),o=r?.serialize??n,s="send"in e&&typeof e.send=="function"?e.send.bind(e):null;if(!s)throw new Error("toWebSocket: invalid WebSocket target");return Z(t,u=>{try{let i=o(u);s(i)}catch{}})}0&&(module.exports={fromHTTP,fromMCP,fromWebSocket,fromWebhook,toSSE,toWebSocket});
|
|
@@ -3,7 +3,7 @@ export { MCPClientLike, MCPOptions, MCPResource, MCPResult, MCPToolInfo, MCPTool
|
|
|
3
3
|
export { SSEOptions, SSEStore, toSSE } from './sse.cjs';
|
|
4
4
|
export { WebhookOptions, WebhookRequest, WebhookStore, fromWebhook } from './webhook.cjs';
|
|
5
5
|
export { FromWebSocketOptions, ToWebSocketOptions, WebSocketConnectionState, WebSocketStore, fromWebSocket, toWebSocket } from './websocket.cjs';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../protocol-
|
|
8
|
-
import '../withStatus-
|
|
6
|
+
import '../types-d6KmLH4A.cjs';
|
|
7
|
+
import '../protocol-BUYJYpNY.cjs';
|
|
8
|
+
import '../withStatus-CvTKv5qu.cjs';
|
|
9
9
|
import '../subscribe-BHH8VVDm.cjs';
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { MCPClientLike, MCPOptions, MCPResource, MCPResult, MCPToolInfo, MCPTool
|
|
|
3
3
|
export { SSEOptions, SSEStore, toSSE } from './sse.js';
|
|
4
4
|
export { WebhookOptions, WebhookRequest, WebhookStore, fromWebhook } from './webhook.js';
|
|
5
5
|
export { FromWebSocketOptions, ToWebSocketOptions, WebSocketConnectionState, WebSocketStore, fromWebSocket, toWebSocket } from './websocket.js';
|
|
6
|
-
import '../types-
|
|
7
|
-
import '../protocol-
|
|
8
|
-
import '../withStatus
|
|
6
|
+
import '../types-C0BYZwdn.js';
|
|
7
|
+
import '../protocol-BUYJYpNY.js';
|
|
8
|
+
import '../withStatus-ZWYO2QC1.js';
|
|
9
9
|
import '../subscribe-BHH8VVDm.js';
|
package/dist/adapters/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"../chunk-
|
|
1
|
+
import{a as o}from"../chunk-YFS4TGFV.js";import{a as e}from"../chunk-CYAX4SPJ.js";import{a as t}from"../chunk-LUV6OCGP.js";import{a as r}from"../chunk-URSQTDBO.js";import"../chunk-XEU7KSEO.js";import{a as p,b as S}from"../chunk-SB4AKJUZ.js";import"../chunk-7XVKW54N.js";import"../chunk-UMDNGNOH.js";import"../chunk-O2PONDZT.js";import"../chunk-J2E7GAMR.js";import"../chunk-4ILN4V4C.js";import"../chunk-Q3HIBGHR.js";import"../chunk-FFYLM7DC.js";import"../chunk-RUSKMKKL.js";import"../chunk-HKNYRLNU.js";import"../chunk-JNSWP6KQ.js";import"../chunk-I7AUKTXE.js";export{o as fromHTTP,e as fromMCP,p as fromWebSocket,r as fromWebhook,t as toSSE,S as toWebSocket};
|
package/dist/adapters/mcp.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`)}static _signalLabel(t){return t===b?"DIRTY":t===O?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,r,n){let s=null,i=!1,a=r??e.getName(t),u=[],l={values:[],signals:[],events:[],ended:!1,endError:void 0,get completedCleanly(){return l.ended&&!i},get errored(){return l.ended&&i},dirtyCount:0,resolvedCount:0,name:a,get eventLog(){return u},dispose:()=>s?.(g),reconnect:()=>(s?.(g),e._observe(t,r,n))};return t.source(T,(c,o)=>{if(c===T){s=o;return}let f=
|
|
1
|
+
"use strict";var Q=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var ve=Object.prototype.hasOwnProperty;var Ee=(e,t)=>{for(var r in t)Q(e,r,{get:t[r],enumerable:!0})},De=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of be(t))!ve.call(e,s)&&s!==r&&Q(e,s,{get:()=>t[s],enumerable:!(n=ye(t,s))||n.enumerable});return e};var ke=e=>De(Q({},"__esModule",{value:!0}),e);var je={};Ee(je,{fromMCP:()=>Ne});module.exports=ke(je);var b=Symbol("DIRTY"),O=Symbol("RESOLVED"),re=Symbol("SINGLE_DEP"),ee=Symbol("RESET"),we=Symbol("PAUSE"),xe=Symbol("RESUME"),te=Symbol("TEARDOWN");function ie(e){return e===ee||e===we||e===xe||e===te}var oe=0,ae=1,ue=2,le=3,ce=4,fe=5,k=7,ne=7<<k,Re=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function de(e){return Re[(e&ne)>>>k]}var T=0,m=1,g=2,S=3,Y=0,U=[],X=!1;function C(e){Y++;let t,r,n=!1;try{t=e()}catch(i){r=i,n=!0}Y--;let s;if(Y===0&&!X){X=!0;try{for(let i=0;i<U.length;i++)try{U[i]()}catch(a){s??=a}}finally{U.length=0,X=!1}}if(n)throw r;if(s)throw s;return t}function R(){return Y>0}function B(e){U.push(e)}var Ae=0,Ie=[];function ge(e){Ae>0?Ie.push(e):e()}var A=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 n=t.map(s=>e._names.get(s)??"?").join(",");return n.length>40?`${n.slice(0,37)}...`:n}static _resolveKey(t){let r=e._keys.get(t)??e._names.get(t);if(r)return r;let n=`anonymous_${e._nextId++}`;return e._keys.set(t,n),n}static register(t,r){if(!e.enabled)return;r?.name&&e._names.set(t,r.name),r?.kind&&e._kinds.set(t,r.kind);let n=e._nextId++,s=r?.name;if(!(s&&!e._usedKeys.has(s)))if(s){let i=e._depSuffix(r?.deps);s=i?`${s}(${i})`:`${s}_${n}`,e._usedKeys.has(s)&&(s=`${s}_${n}`)}else{let i=r?.kind??"store",a=e._depSuffix(r?.deps);s=a?`${i}(${a})`:`${i}_${n}`,e._usedKeys.has(s)&&(s=`${s}_${n}`)}e._usedKeys.add(s),e._keys.set(t,s),e._stores.add(new WeakRef(t))}static registerEdge(t,r){if(!e.enabled)return;let n=e._resolveKey(t),s=e._resolveKey(r),i=e._edges.get(n);i?i.includes(s)||i.push(s):e._edges.set(n,[s])}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,r=new Set;for(let n of e._stores){let s=n.deref();if(!s){e._stores.delete(n);continue}let i=e._resolveKey(s);r.add(i),t.set(i,e.inspect(s))}for(let[n,s]of e._edges){if(!r.has(n)){e._edges.delete(n),e._usedKeys.delete(n);continue}let i=s.filter(a=>r.has(a));i.length===0?e._edges.delete(n):i.length!==s.length&&e._edges.set(n,i)}return t}static trace(t,r){let n=null,s=t.get();return t.source(T,(i,a)=>{if(i===T&&(n=a),i===g){n=null;return}if(i===1){let u=a;if(!Object.is(u,s)){let l=s;s=u,r(u,l)}}}),()=>n?.(g)}static dumpGraph(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let[a,u]of r)for(let l of u){let c=n.get(l);c?c.includes(a)||c.push(a):n.set(l,[a])}let s=[];for(let[a,u]of t){let l=n.get(a),c=r.get(a),o=l?.length?` \u2190 [${l.join(", ")}]`:"",f=c?.length?` \u2192 [${c.join(", ")}]`:"";s.push(` ${a} (${u.kind}) = ${JSON.stringify(u.value)} [${u.status??"?"}]${o}${f}`)}return[`Store Graph (${t.size} nodes):`,...s].join(`
|
|
2
|
+
`)}static _signalLabel(t){return t===b?"DIRTY":t===O?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,r,n){let s=null,i=!1,a=r??e.getName(t),u=[],l={values:[],signals:[],events:[],ended:!1,endError:void 0,get completedCleanly(){return l.ended&&!i},get errored(){return l.ended&&i},dirtyCount:0,resolvedCount:0,name:a,get eventLog(){return u},dispose:()=>s?.(g),reconnect:()=>(s?.(g),e._observe(t,r,n))};return t.source(T,(c,o)=>{if(c===T){s=o;return}let f=R();c===m?(l.values.push(o),l.events.push({type:"data",data:o,inBatch:f}),u.push(o),n&&n(`[${a}] DATA:`,o)):c===S?(l.signals.push(o),l.events.push({type:"signal",data:o,inBatch:f}),u.push(e._signalLabel(o)),o===b?l.dirtyCount++:o===O&&l.resolvedCount++,n&&n(`[${a}] STATE:`,o)):c===g&&(l.ended=!0,l.endError=o,i=o!==void 0,l.events.push({type:"end",data:o,inBatch:f}),u.push(i?["END",o]:"END"),n&&n(`[${a}] END`,o!==void 0?o:""),s=null)}),l}static observe(t){return e._observe(t)}static activate(t){let r=null;return t.source(T,(n,s)=>{n===T&&(r=s),n===g&&(r=null)}),()=>r?.(g)}static tap(t,r){let n=r??`tap(${e.getName(t)??"anon"})`,s={get:()=>t.get(),source:t.source};return e.register(s,{name:n,kind:"tap"}),e.registerEdge(t,s),s}static spy(t,r){let n=r?.name??e.getName(t)??"spy",s=r?.log??console.log;return e._observe(t,n,s)}static snapshot(){let t=e.graph(),r=e.getEdges(),n=new Map;for(let a of e._stores){let u=a.deref();if(!u)continue;let l=e._annotations.get(u);l!==void 0&&n.set(e._resolveKey(u),l)}let s=[];for(let[a,u]of t){let l={name:a,kind:u.kind,value:u.value,status:u.status},c=n.get(a);c!==void 0&&(l.annotation=c),s.push(l)}let i=[];for(let[a,u]of r)for(let l of u)i.push({from:a,to:l});return{nodes:s,edges:i,trace:e.traceLog()}}static toMermaid(t){let r=t?.direction??"TD",n=e.snapshot(),s=[`graph ${r}`],i={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},a=new Map;function u(o){let f=o.replace(/[^a-zA-Z0-9_]/g,"_"),d=a.get(f);return d===void 0?(a.set(f,1),f):(a.set(f,d+1),`${f}__${d}`)}let l=new Map;function c(o){let f=JSON.stringify(o);return f&&f.length>30?`${f.slice(0,27)}...`:f??"undefined"}for(let o of n.nodes){let f=u(o.name);l.set(o.name,f);let d=`${o.name} (${o.kind}) = ${c(o.value)}`,h=i[o.status??""]??"";s.push(` ${f}["${d}"]${h}`)}for(let o of n.edges){let f=l.get(o.from)??u(o.from),d=l.get(o.to)??u(o.to);s.push(` ${f} --> ${d}`)}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
3
|
`)}static toD2(t){let r=t?.direction??"down",n=e.snapshot(),s=[`direction: ${r}`,""],i={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},a=new Map;function u(o){let f=o.replace(/[^a-zA-Z0-9_]/g,"_"),d=a.get(f);return d===void 0?(a.set(f,1),f):(a.set(f,d+1),`${f}__${d}`)}let l=new Map;function c(o){let f=JSON.stringify(o);return f&&f.length>30?`${f.slice(0,27)}...`:f??"undefined"}for(let o of n.nodes){let f=u(o.name);l.set(o.name,f);let d=i[o.kind]??"rectangle",h=`${o.name} (${o.kind}) = ${c(o.value)}`,M=o.status?` [${o.status}]`:"";s.push(`${f}: "${h}${M}" { shape: ${d} }`)}n.edges.length>0&&s.push("");for(let o of n.edges){let f=l.get(o.from)??u(o.from),d=l.get(o.to)??u(o.to);s.push(`${f} -> ${d}`)}return s.join(`
|
|
4
|
-
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},s=e.maxTraceEntries;s<=0||(e._traceLog.length<s?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,e._traceFull=!0),e._traceHead=(e._traceHead+1)%s)}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 timeline(t){let r=null,n=[];return t.source(T,(s,i)=>{if(s===T){r=i;return}let a={timestamp:Date.now(),type:s===m?"data":s===S?"signal":"end",data:i,inBatch:
|
|
5
|
-
`),Se=new Error(
|
|
4
|
+
`)}static annotate(t,r){if(!e.enabled)return;e._annotations.set(t,r);let n={node:e._resolveKey(t),reason:r,timestamp:Date.now()},s=e.maxTraceEntries;s<=0||(e._traceLog.length<s?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,e._traceFull=!0),e._traceHead=(e._traceHead+1)%s)}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 timeline(t){let r=null,n=[];return t.source(T,(s,i)=>{if(s===T){r=i;return}let a={timestamp:Date.now(),type:s===m?"data":s===S?"signal":"end",data:i,inBatch:R()};n.push(a),s===g&&(r=null)}),{entries:n,dispose:()=>r?.(g)}}static observeDerived(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:r};n._fn=()=>{let l=n._deps.map(o=>o.get()),c=s();return r.push({result:c,depValues:l,timestamp:Date.now()}),c};let i=e._observe(t),a=i.dispose;return{...i,evaluations:r,dispose:()=>{n._fn=s,a()},reconnect:()=>(n._fn=s,a(),e.observeDerived(t))}}static observeTaskState(t){let r=t.status.get(),n=[],s=null;return t.status.source(T,(i,a)=>{if(i===T){s=a;return}if(i===m){let u=a;if(u!==r){let l={from:r,to:u,timestamp:Date.now()};u==="error"&&(l.error=t.error.get()),n.push(l),r=u}}i===g&&(s=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{s?.(g)}}}static causalityTrace(t){let r=[],n=t,s=n._fn;if(typeof s!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:r};let i=n._deps,a=i.map(o=>o.get());n._fn=()=>{let o=i.map(h=>h.get()),f=s(),d=-1;for(let h=0;h<i.length;h++)if(!Object.is(o[h],a[h])){d=h;break}return r.push({result:f,triggerDepIndex:d,triggerDepName:d>=0?e.getName(i[d]):void 0,depValues:o,timestamp:Date.now()}),a=o,f};let u=e._observe(t),l=u.dispose;return{...u,causality:r,dispose:()=>{n._fn=s,l()},reconnect:()=>(n._fn=s,l(),e.causalityTrace(t))}}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 H=1,y=64,_=2,I=4,pe=8,he=16,E=32,v=1024,p=ne,L=ae<<k,$=ue<<k,q=oe<<k,Le=ce<<k,Pe=fe<<k,Oe=le<<k,G=class{_value;_output=null;_flags;get _status(){return de(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,r){this._value=r?.initial,this._fn=t,this._eqFn=r?.equals,this._getterFn=r?.getter,this._initial=r?.initial;let n=0;r?.autoDirty!==!1&&(n|=I),r?.resetOnTeardown&&(n|=pe),r?.resubscribable&&(n|=he),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),r?._skipInspect||A.register(this,{kind:"producer",...r})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,r){let n=this._output;if(n)if(this._flags&y)for(let s of n)s(t,r);else n(t,r)}emit(t){this._flags&_||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(R()?this._flags&E||(this._flags|=E,this._flags&I&&(this._flags=this._flags&~p|L,this._dispatch(S,b)),B(()=>{this._flags&E&&(this._flags&=~E,this._flags=this._flags&~p|$,this._dispatch(m,this._value))})):(this._flags&I&&!(this._flags&v)&&(this._flags=this._flags&~p|L,this._dispatch(S,b)),this._flags=this._flags&~p|$,this._dispatch(m,this._value))))}signal(t){this._flags&_||!this._output||(t===b?this._flags=this._flags&~p|L:t===O&&(this._flags=this._flags&~p|Oe),this._dispatch(S,t))}complete(){if(this._flags&_)return;this._flags=(this._flags|_)&~p|Le;let t=this._output,r=this._flags&y;if(this._output=null,this._flags&=~(y|v),this._singleDepCount=0,this._stop(),t)if(r)for(let n of t)n(g);else t(g)}error(t){if(this._flags&_)return;this._flags=(this._flags|_)&~p|Pe;let r=this._output,n=this._flags&y;if(this._output=null,this._flags&=~(y|v),this._singleDepCount=0,this._stop(),r)if(n)for(let s of r)s(g,t);else r(g,t)}_start(){if(this._flags&H||!this._fn)return;this._flags|=H,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:r=>this.signal(r),complete:()=>this.complete(),error:r=>this.error(r),onSignal:r=>{this._onLifecycleSignal=r}});this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&H&&(this._flags&=~H,this._onLifecycleSignal=void 0,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&pe&&(this._value=this._initial),this._flags&_||(this._flags=this._flags&~p|q))}_handleLifecycleSignal(t){if(!(this._flags&_)){if(t===te){this._onLifecycleSignal?.(t),this.complete();return}t===ee&&(this._value=this._initial,this._flags&=~E),this._onLifecycleSignal?.(t)}}source(t,r){if(t===T){let n=r;if(this._flags&_)if(this._flags&he&&this._output===null)this._flags=this._flags&~(_|p)|q;else{n(T,i=>{}),n(g);return}if(this._output===null)this._output=n;else if(this._flags&y)this._output.add(n);else{let i=new Set;i.add(this._output),i.add(n),this._output=i,this._flags=(this._flags|y)&~v}let s=!1;n(T,(i,a)=>{if(i===m&&n(m,this._value),i===S){a===re&&!s?(s=!0,this._singleDepCount++,this._flags&y||(this._flags|=v)):ie(a)&&this._handleLifecycleSignal(a);return}if(i===g){if(s&&(s=!1,this._singleDepCount--),this._output===null)return;if(this._flags&y){let u=this._output;u.delete(n),u.size===1?(this._output=u.values().next().value,this._flags&=~y,this._singleDepCount>0&&(this._flags|=v)):u.size===0&&(this._output=null,this._flags&=~(y|v),this._singleDepCount=0,this._flags=this._flags&~p|q,this._stop())}else this._output===n&&(this._output=null,this._flags&=~v,this._singleDepCount=0,this._flags=this._flags&~p|q,this._stop())}}),ge(()=>this._start())}}};var se=class extends G{constructor(t,r){super(void 0,{initial:t,autoDirty:!0,equals:r?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),A.register(this,{kind:"state",...r})}get(){return this._value}set(t){this._flags&_||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(R()?this._flags&E||(this._flags|=E,this._flags&I&&(this._flags=this._flags&~p|L,this._dispatch(S,b)),B(()=>{this._flags&E&&(this._flags&=~E,this._flags=this._flags&~p|$,this._dispatch(m,this._value))})):(this._flags&I&&!(this._flags&v)&&(this._flags=this._flags&~p|L,this._dispatch(S,b)),this._flags=this._flags&~p|$,this._dispatch(m,this._value))))}update(t){this.set(t(this._value))}};function w(e,t){return new se(e,t)}function Te(e){return(t,r)=>{if(t!==0)return;let n=new AbortController,s=n.signal,i=!1,a,u;try{a=typeof e=="function"?e():e,u=a[Symbol.asyncIterator]()}catch(c){r(0,()=>{}),r(2,c);return}r(0,c=>{c===2&&!i&&(i=!0,n.abort(),Promise.resolve(u.return?.()).catch(()=>{}))});async function l(){try{for(;!i&&!s.aborted;){let c=await u.next();if(i||s.aborted)break;if(c.done){i=!0,r(2);return}r(1,c.value)}}catch(c){!i&&!s.aborted&&(i=!0,r(2,c))}}l()}}function me(e){return(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),e.then(s=>{n||(r(1,s),n||r(2))},s=>{n||r(2,s)})}}function Ce(e){return e!=null&&typeof e.then=="function"}function $e(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function Me(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function z(e){return Ce(e)?me(e):$e(e)?Te(e):typeof e!="string"&&Me(e)?(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)});for(let s of e){if(n)return;r(1,s)}n||r(2)}:(t,r)=>{if(t!==0)return;let n=!1;r(0,s=>{s===2&&(n=!0)}),n||r(1,e),n||r(2)}}function J(e,t,r){let n=null;return e(0,(s,i)=>{if(s===0){n=i;return}if(s===2){n=null,r?.onEnd?.(i);return}s===1&&t(i)}),{unsubscribe(){n?.(2),n=null}}}function Ne(e){let t=e.name??"mcp",r=e.client,n=w([],{name:`${t}.tools`}),s=w([],{name:`${t}.resources`}),i=w(void 0,{name:`${t}.refreshError`});function a(c){i.set(c);let o=e.onRefreshError;if(o==="warn")console.warn(`[${t}] refresh error:`,c);else{if(o==="error")throw c;typeof o=="function"&&o(c)}}function u(){i.set(void 0),r.listTools&&J(z(r.listTools()),c=>{n.set(c.tools)},{onEnd:c=>{c!==void 0&&a(c)}}),r.listResources&&J(z(r.listResources()),c=>{s.set(c.resources)},{onEnd:c=>{c!==void 0&&a(c)}})}function l(c){let o=`${t}:${c}`,f=w(void 0,{name:`${o}.result`}),d=w("idle",{name:`${o}.status`}),h=w(void 0,{name:`${o}.error`}),M=w(void 0,{name:`${o}.lastArgs`}),N=w(void 0,{name:`${o}.duration`}),j=!1;function _e(F){if(j)return;j=!0,C(()=>{M.set(F),h.set(void 0),d.set("active")});let K=Date.now();J(z(r.callTool({name:c,arguments:F})),x=>{j=!1;let V=Date.now()-K;if(x.isError){let D=x.content.filter(Z=>Z.type==="text").map(Z=>Z.text??"").join(`
|
|
5
|
+
`),Se=new Error(D||"MCP tool returned error");C(()=>{N.set(V),h.set(Se),d.set("errored")});return}let W=x.content.filter(D=>D.type==="text"),P;if(W.length===1){let D=W[0].text;if(D!==void 0)try{P=JSON.parse(D)}catch{P=D}}else W.length>1?P=W.map(D=>D.text??""):P=x.content;C(()=>{N.set(V),f.set(P),d.set("completed")})},{onEnd:x=>{if(j=!1,x===void 0)return;let V=Date.now()-K;C(()=>{N.set(V),h.set(x),d.set("errored")})}})}return{get:()=>f.get(),source:(F,K)=>f.source(F,K),status:d,error:h,call:_e,lastArgs:M,duration:N}}return{tool:l,tools:n,resources:s,refresh:u,refreshError:i}}0&&(module.exports={fromMCP});
|
package/dist/adapters/mcp.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-d6KmLH4A.cjs';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-CvTKv5qu.cjs';
|
|
3
|
+
import '../protocol-BUYJYpNY.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Minimal MCP client interface. Compatible with @modelcontextprotocol/sdk Client.
|
package/dist/adapters/mcp.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-C0BYZwdn.js';
|
|
2
|
+
import { W as WithStatusStatus } from '../withStatus-ZWYO2QC1.js';
|
|
3
|
+
import '../protocol-BUYJYpNY.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Minimal MCP client interface. Compatible with @modelcontextprotocol/sdk Client.
|
package/dist/adapters/mcp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-CYAX4SPJ.js";import"../chunk-O2PONDZT.js";import"../chunk-J2E7GAMR.js";import"../chunk-4ILN4V4C.js";import"../chunk-Q3HIBGHR.js";import"../chunk-FFYLM7DC.js";import"../chunk-RUSKMKKL.js";import"../chunk-HKNYRLNU.js";import"../chunk-JNSWP6KQ.js";import"../chunk-I7AUKTXE.js";export{a as fromMCP};
|
package/dist/adapters/sse.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";var be=Object.create;var F=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var
|
|
2
|
-
`)}static _signalLabel(t){return t===E?"DIRTY":t===P?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,
|
|
3
|
-
`)}static toD2(t){let
|
|
4
|
-
`)}static annotate(t,
|
|
1
|
+
"use strict";var be=Object.create;var F=Object.defineProperty;var ve=Object.getOwnPropertyDescriptor;var Ee=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty;var ke=(e,t)=>{for(var s in t)F(e,s,{get:t[s],enumerable:!0})},Q=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ee(t))!we.call(e,r)&&r!==s&&F(e,r,{get:()=>t[r],enumerable:!(n=ve(t,r))||n.enumerable});return e};var xe=(e,t,s)=>(s=e!=null?be(De(e)):{},Q(t||!e||!e.__esModule?F(s,"default",{value:e,enumerable:!0}):s,e)),Re=e=>Q(F({},"__esModule",{value:!0}),e);var Ve={};ke(Ve,{toSSE:()=>Ke});module.exports=Re(Ve);var E=Symbol("DIRTY"),P=Symbol("RESOLVED"),X=Symbol("SINGLE_DEP"),B=Symbol("RESET"),Ie=Symbol("PAUSE"),Ae=Symbol("RESUME"),q=Symbol("TEARDOWN");function ee(e){return e===B||e===Ie||e===Ae||e===q}var te=0,ne=1,re=2,se=3,ie=4,oe=5,x=7,G=7<<x,Le=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function ae(e){return Le[(e&G)>>>x]}var T=0,_=1,g=2,S=3,Oe=0,Ce=[];function L(){return Oe>0}function U(e){Ce.push(e)}var V=0,K=[];function le(){V++}function ue(){if(V--,V===0){for(let e=0;e<K.length;e++)K[e]();K.length=0}}function ce(e){V>0?K.push(e):e()}var I=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 n=t.map(r=>e._names.get(r)??"?").join(",");return n.length>40?`${n.slice(0,37)}...`:n}static _resolveKey(t){let s=e._keys.get(t)??e._names.get(t);if(s)return s;let n=`anonymous_${e._nextId++}`;return e._keys.set(t,n),n}static register(t,s){if(!e.enabled)return;s?.name&&e._names.set(t,s.name),s?.kind&&e._kinds.set(t,s.kind);let n=e._nextId++,r=s?.name;if(!(r&&!e._usedKeys.has(r)))if(r){let i=e._depSuffix(s?.deps);r=i?`${r}(${i})`:`${r}_${n}`,e._usedKeys.has(r)&&(r=`${r}_${n}`)}else{let i=s?.kind??"store",a=e._depSuffix(s?.deps);r=a?`${i}(${a})`:`${i}_${n}`,e._usedKeys.has(r)&&(r=`${r}_${n}`)}e._usedKeys.add(r),e._keys.set(t,r),e._stores.add(new WeakRef(t))}static registerEdge(t,s){if(!e.enabled)return;let n=e._resolveKey(t),r=e._resolveKey(s),i=e._edges.get(n);i?i.includes(r)||i.push(r):e._edges.set(n,[r])}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,s=new Set;for(let n of e._stores){let r=n.deref();if(!r){e._stores.delete(n);continue}let i=e._resolveKey(r);s.add(i),t.set(i,e.inspect(r))}for(let[n,r]of e._edges){if(!s.has(n)){e._edges.delete(n),e._usedKeys.delete(n);continue}let i=r.filter(a=>s.has(a));i.length===0?e._edges.delete(n):i.length!==r.length&&e._edges.set(n,i)}return t}static trace(t,s){let n=null,r=t.get();return t.source(T,(i,a)=>{if(i===T&&(n=a),i===g){n=null;return}if(i===1){let l=a;if(!Object.is(l,r)){let u=r;r=l,s(l,u)}}}),()=>n?.(g)}static dumpGraph(){let t=e.graph(),s=e.getEdges(),n=new Map;for(let[a,l]of s)for(let u of l){let f=n.get(u);f?f.includes(a)||f.push(a):n.set(u,[a])}let r=[];for(let[a,l]of t){let u=n.get(a),f=s.get(a),o=u?.length?` \u2190 [${u.join(", ")}]`:"",c=f?.length?` \u2192 [${f.join(", ")}]`:"";r.push(` ${a} (${l.kind}) = ${JSON.stringify(l.value)} [${l.status??"?"}]${o}${c}`)}return[`Store Graph (${t.size} nodes):`,...r].join(`
|
|
2
|
+
`)}static _signalLabel(t){return t===E?"DIRTY":t===P?"RESOLVED":typeof t=="symbol"?t.description??String(t):String(t)}static _observe(t,s,n){let r=null,i=!1,a=s??e.getName(t),l=[],u={values:[],signals:[],events:[],ended:!1,endError:void 0,get completedCleanly(){return u.ended&&!i},get errored(){return u.ended&&i},dirtyCount:0,resolvedCount:0,name:a,get eventLog(){return l},dispose:()=>r?.(g),reconnect:()=>(r?.(g),e._observe(t,s,n))};return t.source(T,(f,o)=>{if(f===T){r=o;return}let c=L();f===_?(u.values.push(o),u.events.push({type:"data",data:o,inBatch:c}),l.push(o),n&&n(`[${a}] DATA:`,o)):f===S?(u.signals.push(o),u.events.push({type:"signal",data:o,inBatch:c}),l.push(e._signalLabel(o)),o===E?u.dirtyCount++:o===P&&u.resolvedCount++,n&&n(`[${a}] STATE:`,o)):f===g&&(u.ended=!0,u.endError=o,i=o!==void 0,u.events.push({type:"end",data:o,inBatch:c}),l.push(i?["END",o]:"END"),n&&n(`[${a}] END`,o!==void 0?o:""),r=null)}),u}static observe(t){return e._observe(t)}static activate(t){let s=null;return t.source(T,(n,r)=>{n===T&&(s=r),n===g&&(s=null)}),()=>s?.(g)}static tap(t,s){let n=s??`tap(${e.getName(t)??"anon"})`,r={get:()=>t.get(),source:t.source};return e.register(r,{name:n,kind:"tap"}),e.registerEdge(t,r),r}static spy(t,s){let n=s?.name??e.getName(t)??"spy",r=s?.log??console.log;return e._observe(t,n,r)}static snapshot(){let t=e.graph(),s=e.getEdges(),n=new Map;for(let a of e._stores){let l=a.deref();if(!l)continue;let u=e._annotations.get(l);u!==void 0&&n.set(e._resolveKey(l),u)}let r=[];for(let[a,l]of t){let u={name:a,kind:l.kind,value:l.value,status:l.status},f=n.get(a);f!==void 0&&(u.annotation=f),r.push(u)}let i=[];for(let[a,l]of s)for(let u of l)i.push({from:a,to:u});return{nodes:r,edges:i,trace:e.traceLog()}}static toMermaid(t){let s=t?.direction??"TD",n=e.snapshot(),r=[`graph ${s}`],i={SETTLED:":::settled",DIRTY:":::dirty",ERRORED:":::errored",COMPLETED:":::completed"},a=new Map;function l(o){let c=o.replace(/[^a-zA-Z0-9_]/g,"_"),p=a.get(c);return p===void 0?(a.set(c,1),c):(a.set(c,p+1),`${c}__${p}`)}let u=new Map;function f(o){let c=JSON.stringify(o);return c&&c.length>30?`${c.slice(0,27)}...`:c??"undefined"}for(let o of n.nodes){let c=l(o.name);u.set(o.name,c);let p=`${o.name} (${o.kind}) = ${f(o.value)}`,y=i[o.status??""]??"";r.push(` ${c}["${p}"]${y}`)}for(let o of n.edges){let c=u.get(o.from)??l(o.from),p=u.get(o.to)??l(o.to);r.push(` ${c} --> ${p}`)}return r.push(""),r.push(" classDef settled fill:#d4edda,stroke:#28a745"),r.push(" classDef dirty fill:#fff3cd,stroke:#ffc107"),r.push(" classDef errored fill:#f8d7da,stroke:#dc3545"),r.push(" classDef completed fill:#cce5ff,stroke:#007bff"),r.join(`
|
|
3
|
+
`)}static toD2(t){let s=t?.direction??"down",n=e.snapshot(),r=[`direction: ${s}`,""],i={state:"rectangle",derived:"hexagon",effect:"oval",producer:"rectangle",operator:"parallelogram","pipeline-step":"rectangle","pipeline-status":"diamond",checkpoint:"cylinder"},a=new Map;function l(o){let c=o.replace(/[^a-zA-Z0-9_]/g,"_"),p=a.get(c);return p===void 0?(a.set(c,1),c):(a.set(c,p+1),`${c}__${p}`)}let u=new Map;function f(o){let c=JSON.stringify(o);return c&&c.length>30?`${c.slice(0,27)}...`:c??"undefined"}for(let o of n.nodes){let c=l(o.name);u.set(o.name,c);let p=i[o.kind]??"rectangle",y=`${o.name} (${o.kind}) = ${f(o.value)}`,j=o.status?` [${o.status}]`:"";r.push(`${c}: "${y}${j}" { shape: ${p} }`)}n.edges.length>0&&r.push("");for(let o of n.edges){let c=u.get(o.from)??l(o.from),p=u.get(o.to)??l(o.to);r.push(`${c} -> ${p}`)}return r.join(`
|
|
4
|
+
`)}static annotate(t,s){if(!e.enabled)return;e._annotations.set(t,s);let n={node:e._resolveKey(t),reason:s,timestamp:Date.now()},r=e.maxTraceEntries;r<=0||(e._traceLog.length<r?e._traceLog.push(n):(e._traceLog[e._traceHead]=n,e._traceFull=!0),e._traceHead=(e._traceHead+1)%r)}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 timeline(t){let s=null,n=[];return t.source(T,(r,i)=>{if(r===T){s=i;return}let a={timestamp:Date.now(),type:r===_?"data":r===S?"signal":"end",data:i,inBatch:L()};n.push(a),r===g&&(s=null)}),{entries:n,dispose:()=>s?.(g)}}static observeDerived(t){let s=[],n=t,r=n._fn;if(typeof r!="function"||!Array.isArray(n._deps))return{...e.observe(t),evaluations:s};n._fn=()=>{let u=n._deps.map(o=>o.get()),f=r();return s.push({result:f,depValues:u,timestamp:Date.now()}),f};let i=e._observe(t),a=i.dispose;return{...i,evaluations:s,dispose:()=>{n._fn=r,a()},reconnect:()=>(n._fn=r,a(),e.observeDerived(t))}}static observeTaskState(t){let s=t.status.get(),n=[],r=null;return t.status.source(T,(i,a)=>{if(i===T){r=a;return}if(i===_){let l=a;if(l!==s){let u={from:s,to:l,timestamp:Date.now()};l==="error"&&(u.error=t.error.get()),n.push(u),s=l}}i===g&&(r=null)}),{transitions:n,get currentStatus(){return t.status.get()},dispose:()=>{r?.(g)}}}static causalityTrace(t){let s=[],n=t,r=n._fn;if(typeof r!="function"||!Array.isArray(n._deps))return{...e.observe(t),causality:s};let i=n._deps,a=i.map(o=>o.get());n._fn=()=>{let o=i.map(y=>y.get()),c=r(),p=-1;for(let y=0;y<i.length;y++)if(!Object.is(o[y],a[y])){p=y;break}return s.push({result:c,triggerDepIndex:p,triggerDepName:p>=0?e.getName(i[p]):void 0,depValues:o,timestamp:Date.now()}),a=o,c};let l=e._observe(t),u=l.dispose;return{...l,causality:s,dispose:()=>{n._fn=r,u()},reconnect:()=>(n._fn=r,u(),e.causalityTrace(t))}}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,v=64,b=2,C=4,fe=8,de=16,w=32,D=1024,m=G,$=ne<<x,M=re<<x,W=te<<x,$e=ie<<x,Ne=oe<<x,Pe=se<<x,H=class{_value;_output=null;_flags;get _status(){return ae(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;_singleDepCount=0;_onLifecycleSignal;constructor(t,s){this._value=s?.initial,this._fn=t,this._eqFn=s?.equals,this._getterFn=s?.getter,this._initial=s?.initial;let n=0;s?.autoDirty!==!1&&(n|=C),s?.resetOnTeardown&&(n|=fe),s?.resubscribable&&(n|=de),this._flags=n,this.source=this.source.bind(this),this.emit=this.emit.bind(this),s?._skipInspect||I.register(this,{kind:"producer",...s})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,s){let n=this._output;if(n)if(this._flags&v)for(let r of n)r(t,s);else n(t,s)}emit(t){this._flags&b||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(L()?this._flags&w||(this._flags|=w,this._flags&C&&(this._flags=this._flags&~m|$,this._dispatch(S,E)),U(()=>{this._flags&w&&(this._flags&=~w,this._flags=this._flags&~m|M,this._dispatch(_,this._value))})):(this._flags&C&&!(this._flags&D)&&(this._flags=this._flags&~m|$,this._dispatch(S,E)),this._flags=this._flags&~m|M,this._dispatch(_,this._value))))}signal(t){this._flags&b||!this._output||(t===E?this._flags=this._flags&~m|$:t===P&&(this._flags=this._flags&~m|Pe),this._dispatch(S,t))}complete(){if(this._flags&b)return;this._flags=(this._flags|b)&~m|$e;let t=this._output,s=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),t)if(s)for(let n of t)n(g);else t(g)}error(t){if(this._flags&b)return;this._flags=(this._flags|b)&~m|Ne;let s=this._output,n=this._flags&v;if(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._stop(),s)if(n)for(let r of s)r(g,t);else s(g,t)}_start(){if(this._flags&Y||!this._fn)return;this._flags|=Y,this._onLifecycleSignal=void 0;let t=this._fn({emit:this.emit,signal:s=>this.signal(s),complete:()=>this.complete(),error:s=>this.error(s),onSignal:s=>{this._onLifecycleSignal=s}});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&fe&&(this._value=this._initial),this._flags&b||(this._flags=this._flags&~m|W))}_handleLifecycleSignal(t){if(!(this._flags&b)){if(t===q){this._onLifecycleSignal?.(t),this.complete();return}t===B&&(this._value=this._initial,this._flags&=~w),this._onLifecycleSignal?.(t)}}source(t,s){if(t===T){let n=s;if(this._flags&b)if(this._flags&de&&this._output===null)this._flags=this._flags&~(b|m)|W;else{n(T,i=>{}),n(g);return}if(this._output===null)this._output=n;else if(this._flags&v)this._output.add(n);else{let i=new Set;i.add(this._output),i.add(n),this._output=i,this._flags=(this._flags|v)&~D}let r=!1;n(T,(i,a)=>{if(i===_&&n(_,this._value),i===S){a===X&&!r?(r=!0,this._singleDepCount++,this._flags&v||(this._flags|=D)):ee(a)&&this._handleLifecycleSignal(a);return}if(i===g){if(r&&(r=!1,this._singleDepCount--),this._output===null)return;if(this._flags&v){let l=this._output;l.delete(n),l.size===1?(this._output=l.values().next().value,this._flags&=~v,this._singleDepCount>0&&(this._flags|=D)):l.size===0&&(this._output=null,this._flags&=~(v|D),this._singleDepCount=0,this._flags=this._flags&~m|W,this._stop())}else this._output===n&&(this._output=null,this._flags&=~D,this._singleDepCount=0,this._flags=this._flags&~m|W,this._stop())}}),ce(()=>this._start())}}};var J=class extends H{constructor(t,s){super(void 0,{initial:t,autoDirty:!0,equals:s?.equals??Object.is,_skipInspect:!0}),this.set=this.set.bind(this),I.register(this,{kind:"state",...s})}get(){return this._value}set(t){this._flags&b||this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(L()?this._flags&w||(this._flags|=w,this._flags&C&&(this._flags=this._flags&~m|$,this._dispatch(S,E)),U(()=>{this._flags&w&&(this._flags&=~w,this._flags=this._flags&~m|M,this._dispatch(_,this._value))})):(this._flags&C&&!(this._flags&D)&&(this._flags=this._flags&~m|$,this._dispatch(S,E)),this._flags=this._flags&~m|M,this._dispatch(_,this._value))))}update(t){this.set(t(this._value))}};function pe(e,t){return new J(e,t)}function ge(e,t,s){let n=null;le(),e.source(T,(i,a)=>{if(i===T&&(n=a),i===g){n=null,s?.onEnd?.(a);return}if(i===1){let l=a,u=r;r=l,t(l,u)}});let r;try{r=e.get()}catch{}return ue(),{unsubscribe(){n?.(g),n=null},signal(i){n?.(S,i)}}}function he(e){return(t,s)=>{if(t!==0)return;let n=new AbortController,r=n.signal,i=!1,a,l;try{a=typeof e=="function"?e():e,l=a[Symbol.asyncIterator]()}catch(f){s(0,()=>{}),s(2,f);return}s(0,f=>{f===2&&!i&&(i=!0,n.abort(),Promise.resolve(l.return?.()).catch(()=>{}))});async function u(){try{for(;!i&&!r.aborted;){let f=await l.next();if(i||r.aborted)break;if(f.done){i=!0,s(2);return}s(1,f.value)}}catch(f){!i&&!r.aborted&&(i=!0,s(2,f))}}u()}}function Te(e){return(t,s)=>{if(t!==0)return;let n=!1;s(0,r=>{r===2&&(n=!0)}),e.then(r=>{n||(s(1,r),n||s(2))},r=>{n||s(2,r)})}}function Me(e){return e!=null&&typeof e.then=="function"}function je(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}function Fe(e){return e!=null&&typeof e[Symbol.iterator]=="function"}function me(e){return Me(e)?Te(e):je(e)?he(e):typeof e!="string"&&Fe(e)?(t,s)=>{if(t!==0)return;let n=!1;s(0,r=>{r===2&&(n=!0)});for(let r of e){if(n)return;s(1,r)}n||s(2)}:(t,s)=>{if(t!==0)return;let n=!1;s(0,r=>{r===2&&(n=!0)}),n||s(1,e),n||s(2)}}function ye(e){return(t,s)=>{if(t!==0)return;let n=!1,r;s(0,i=>{i===2&&!n&&(n=!0,r?.())});try{r=e(i=>{n||(n=!0,s(1,i),s(2))},i=>{n||(n=!0,s(2,i))})}catch(i){n||(n=!0,s(2,i))}}}function Z(e,t,s){let n=null;return e(0,(r,i)=>{if(r===0){n=i;return}if(r===2){n=null,s?.onEnd?.(i);return}r===1&&t(i)}),{unsubscribe(){n?.(2),n=null}}}function Ke(e,t){let s=t?.path??"/",n=t?.name??"sse",r=t?.hostname??"0.0.0.0",i=t?.serialize??JSON.stringify,a=t?.eventName??"message",l=t?.pingInterval??3e4,u=pe(0,{name:`${n}:connections`}),f=new Set,o=new Map,c=null;function p(){c||(c=ge(e,h=>{let d=i(h),k=`event: ${a}
|
|
5
5
|
data: ${d}
|
|
6
6
|
|
|
7
|
-
`;for(let A of f)try{A.write(
|
|
7
|
+
`;for(let A of f)try{A.write(k)}catch{y(A)}}))}function y(h){f.delete(h);let d=o.get(h);d&&(clearInterval(d),o.delete(h)),u.set(f.size),f.size===0&&c&&(c.unsubscribe(),c=null)}function j(h,d){let k=h.method?.toUpperCase();if((h.url??"/").split("?")[0]!==s){d.writeHead(404,{"Content-Type":"text/plain"}),d.end("Not found");return}if(k==="OPTIONS"){d.writeHead(204,{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET","Access-Control-Allow-Headers":"Cache-Control"}),d.end();return}if(k!=="GET"){d.writeHead(405,{"Content-Type":"text/plain"}),d.end("Method not allowed");return}d.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive","Access-Control-Allow-Origin":"*"}),d.write(`:ok
|
|
8
8
|
|
|
9
|
-
`),f.add(d),u.set(f.size);try{let O=e.get();if(O!==void 0){let
|
|
10
|
-
data: ${
|
|
9
|
+
`),f.add(d),u.set(f.size);try{let O=e.get();if(O!==void 0){let z=i(O);d.write(`event: ${a}
|
|
10
|
+
data: ${z}
|
|
11
11
|
|
|
12
12
|
`)}}catch{}if(l>0){let O=setInterval(()=>{try{d.write(`:ping
|
|
13
13
|
|
|
14
|
-
`)}catch{
|
|
14
|
+
`)}catch{y(d)}},l);o.set(d,O)}h.on("close",()=>y(d)),p()}let R=null;function Se(){return t?.port?R?(h,d)=>{h===0&&(d(0,()=>{}),d(2,new Error("toSSE: already listening. Call close() first.")))}:(h,d)=>{if(h!==0)return;let k=!1;d(0,A=>{A===2&&(k=!0)}),Z(me(import("http")),A=>{k||Z(ye((N,O)=>{R=A.createServer(j),R.once("listening",()=>N()),R.once("error",z=>{R=null,O(z)}),R.listen(t.port,r)}),()=>{k||(d(1,void 0),d(2))},{onEnd:N=>{N!==void 0&&!k&&d(2,N)}})})}:(h,d)=>{h===0&&(d(0,()=>{}),d(2,new Error("toSSE: port is required for listen()")))}}function _e(){for(let h of f)try{h.end()}catch{}f.clear();for(let h of o.values())clearInterval(h);o.clear(),u.set(0),c?.unsubscribe(),c=null,R?.close(),R=null}return I.register(u,{kind:"sse"}),{connectionCount:u,handler:j,listen:Se,close:_e}}0&&(module.exports={toSSE});
|
package/dist/adapters/sse.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
1
|
+
import { S as Store } from '../types-d6KmLH4A.cjs';
|
|
2
2
|
import { C as CallbagSource } from '../subscribe-BHH8VVDm.cjs';
|
|
3
|
-
import '../protocol-
|
|
3
|
+
import '../protocol-BUYJYpNY.cjs';
|
|
4
4
|
|
|
5
5
|
interface SSEOptions {
|
|
6
6
|
/** Port to listen on. Required when using `listen()`. */
|
package/dist/adapters/sse.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as Store } from '../types-
|
|
1
|
+
import { S as Store } from '../types-C0BYZwdn.js';
|
|
2
2
|
import { C as CallbagSource } from '../subscribe-BHH8VVDm.js';
|
|
3
|
-
import '../protocol-
|
|
3
|
+
import '../protocol-BUYJYpNY.js';
|
|
4
4
|
|
|
5
5
|
interface SSEOptions {
|
|
6
6
|
/** Port to listen on. Required when using `listen()`. */
|
package/dist/adapters/sse.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-LUV6OCGP.js";import"../chunk-XEU7KSEO.js";import"../chunk-UMDNGNOH.js";import"../chunk-O2PONDZT.js";import"../chunk-J2E7GAMR.js";import"../chunk-4ILN4V4C.js";import"../chunk-Q3HIBGHR.js";import"../chunk-FFYLM7DC.js";import"../chunk-RUSKMKKL.js";import"../chunk-HKNYRLNU.js";import"../chunk-JNSWP6KQ.js";import"../chunk-I7AUKTXE.js";export{a as toSSE};
|