@theokit/sdk 4.63.4 → 5.0.0-next.2
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/CHANGELOG.md +847 -23
- package/dist/a2a/index.cjs +29 -13
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +26 -11
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +26 -3
- package/dist/a2a/message-bus.d.ts +26 -3
- package/dist/a2a/subagent.d.cts +8 -3
- package/dist/a2a/subagent.d.ts +8 -3
- package/dist/{agent-X0DKA943.d.cts → agent-C3KO5LKm.d.cts} +251 -36
- package/dist/{agent-BFno7Sfn.d.ts → agent-CvmTR9uf.d.ts} +251 -36
- package/dist/agent-GPV2JWZG.cjs +67 -0
- package/dist/{agent-UX7WFI6B.cjs.map → agent-GPV2JWZG.cjs.map} +1 -1
- package/dist/agent-Y24I5JBM.js +58 -0
- package/dist/{agent-A5XMIVNP.js.map → agent-Y24I5JBM.js.map} +1 -1
- package/dist/agent-session-store-AFML3AXC.js +6 -0
- package/dist/{agent-session-store-OPGRB4XM.js.map → agent-session-store-AFML3AXC.js.map} +1 -1
- package/dist/agent-session-store-MTSIY3MH.cjs +23 -0
- package/dist/{agent-session-store-6EL5NPA4.cjs.map → agent-session-store-MTSIY3MH.cjs.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/auth/index.cjs +33 -34
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +6 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-BXYTW2DP.cjs → batch-I6T6MXZO.cjs} +58 -40
- package/dist/batch-I6T6MXZO.cjs.map +1 -0
- package/dist/{batch-L4ZXS46M.js → batch-US4F6WPK.js} +42 -24
- package/dist/batch-US4F6WPK.js.map +1 -0
- package/dist/chunk-24MGQDK3.js +31 -0
- package/dist/chunk-24MGQDK3.js.map +1 -0
- package/dist/{chunk-UGT7GK7I.cjs → chunk-24SYBZPL.cjs} +36 -18
- package/dist/chunk-24SYBZPL.cjs.map +1 -0
- package/dist/{chunk-KYAJINUI.cjs → chunk-2HPNT6HH.cjs} +581 -401
- package/dist/chunk-2HPNT6HH.cjs.map +1 -0
- package/dist/{chunk-VLVVJLDH.cjs → chunk-2NE7DTOK.cjs} +234 -193
- package/dist/chunk-2NE7DTOK.cjs.map +1 -0
- package/dist/{chunk-N2U4AZGB.js → chunk-2WXHA33T.js} +3 -3
- package/dist/chunk-2WXHA33T.js.map +1 -0
- package/dist/chunk-2XC6KDJM.js +22 -0
- package/dist/chunk-2XC6KDJM.js.map +1 -0
- package/dist/{chunk-L3MTL4NA.js → chunk-2ZLVT7H3.js} +223 -182
- package/dist/chunk-2ZLVT7H3.js.map +1 -0
- package/dist/{chunk-2GUYQR5P.js → chunk-3JHIFQ4I.js} +39 -13
- package/dist/chunk-3JHIFQ4I.js.map +1 -0
- package/dist/{chunk-BU4KFWXF.js → chunk-44I6UYVH.js} +8 -17
- package/dist/chunk-44I6UYVH.js.map +1 -0
- package/dist/{chunk-UNYXQ4M5.js → chunk-47TF32NQ.js} +10 -5
- package/dist/chunk-47TF32NQ.js.map +1 -0
- package/dist/{chunk-WNO3C3N2.cjs → chunk-4A3SKJ53.cjs} +56 -27
- package/dist/chunk-4A3SKJ53.cjs.map +1 -0
- package/dist/{chunk-YML4ME27.cjs → chunk-4HS6FFGL.cjs} +55 -46
- package/dist/chunk-4HS6FFGL.cjs.map +1 -0
- package/dist/{chunk-C72AZW7J.js → chunk-4MMWFSCD.js} +4 -4
- package/dist/chunk-4MMWFSCD.js.map +1 -0
- package/dist/{chunk-6HKGLTJI.cjs → chunk-4NLCWGH7.cjs} +15 -15
- package/dist/chunk-4NLCWGH7.cjs.map +1 -0
- package/dist/{chunk-LKBEROHN.js → chunk-4S5TWFIZ.js} +14 -14
- package/dist/chunk-4S5TWFIZ.js.map +1 -0
- package/dist/{chunk-UBDMVMBZ.js → chunk-55GB6JYQ.js} +33 -22
- package/dist/chunk-55GB6JYQ.js.map +1 -0
- package/dist/{chunk-U6IFHFWK.js → chunk-5WKQDIGO.js} +8 -17
- package/dist/chunk-5WKQDIGO.js.map +1 -0
- package/dist/chunk-67ADYSTW.js +120 -0
- package/dist/chunk-67ADYSTW.js.map +1 -0
- package/dist/{chunk-XL7Q7HB2.cjs → chunk-6LHQPOMI.cjs} +39 -6
- package/dist/chunk-6LHQPOMI.cjs.map +1 -0
- package/dist/{chunk-A4JVILQU.js → chunk-6M2OIS4Y.js} +7 -7
- package/dist/chunk-6M2OIS4Y.js.map +1 -0
- package/dist/{chunk-LWGSI6M3.js → chunk-6PWOWXMC.js} +4 -4
- package/dist/{chunk-LWGSI6M3.js.map → chunk-6PWOWXMC.js.map} +1 -1
- package/dist/{chunk-RNB4APBZ.js → chunk-6WAKKTBO.js} +9 -5
- package/dist/chunk-6WAKKTBO.js.map +1 -0
- package/dist/{chunk-V2BOS4WF.cjs → chunk-7A6535RA.cjs} +11 -11
- package/dist/chunk-7A6535RA.cjs.map +1 -0
- package/dist/{chunk-ZLQSWSJ2.cjs → chunk-7FDKWDA2.cjs} +11 -11
- package/dist/{chunk-ZLQSWSJ2.cjs.map → chunk-7FDKWDA2.cjs.map} +1 -1
- package/dist/{chunk-4VPXM6UU.js → chunk-7I5Z3UBJ.js} +3 -3
- package/dist/{chunk-4VPXM6UU.js.map → chunk-7I5Z3UBJ.js.map} +1 -1
- package/dist/{chunk-B4EOJWOY.cjs → chunk-7JJ3A6AT.cjs} +13 -7
- package/dist/chunk-7JJ3A6AT.cjs.map +1 -0
- package/dist/{chunk-WJVHMTKB.cjs → chunk-AA27GEYS.cjs} +3 -3
- package/dist/{chunk-WJVHMTKB.cjs.map → chunk-AA27GEYS.cjs.map} +1 -1
- package/dist/{chunk-BP46RJ5X.js → chunk-AAEZSPTC.js} +5 -5
- package/dist/{chunk-BP46RJ5X.js.map → chunk-AAEZSPTC.js.map} +1 -1
- package/dist/chunk-AGACYRJ2.js +11 -0
- package/dist/chunk-AGACYRJ2.js.map +1 -0
- package/dist/{chunk-ZZMZWBR6.js → chunk-ALUN2B4W.js} +81 -58
- package/dist/chunk-ALUN2B4W.js.map +1 -0
- package/dist/chunk-ANMJJD6D.cjs +18 -0
- package/dist/chunk-ANMJJD6D.cjs.map +1 -0
- package/dist/{chunk-DXGZ2NUG.cjs → chunk-ATT276RD.cjs} +12 -11
- package/dist/chunk-ATT276RD.cjs.map +1 -0
- package/dist/{chunk-4FFBAUFS.js → chunk-AWINL3ZC.js} +6 -6
- package/dist/chunk-AWINL3ZC.js.map +1 -0
- package/dist/{chunk-UU36SHFY.cjs → chunk-BJUJT5ED.cjs} +9 -8
- package/dist/chunk-BJUJT5ED.cjs.map +1 -0
- package/dist/{chunk-D4CUGAKZ.js → chunk-CZJ6Q7CW.js} +36 -6
- package/dist/chunk-CZJ6Q7CW.js.map +1 -0
- package/dist/{chunk-KQ7TS7WW.cjs → chunk-D6POWE7E.cjs} +37 -26
- package/dist/chunk-D6POWE7E.cjs.map +1 -0
- package/dist/{chunk-AWO27VRZ.js → chunk-DMRT67Y6.js} +6 -5
- package/dist/chunk-DMRT67Y6.js.map +1 -0
- package/dist/{chunk-5VB22SYX.cjs → chunk-DQZU7JK6.cjs} +7 -7
- package/dist/{chunk-5VB22SYX.cjs.map → chunk-DQZU7JK6.cjs.map} +1 -1
- package/dist/{chunk-3NSS2OIZ.cjs → chunk-DRL7URI4.cjs} +6 -6
- package/dist/{chunk-3NSS2OIZ.cjs.map → chunk-DRL7URI4.cjs.map} +1 -1
- package/dist/{chunk-RFXWMRFC.js → chunk-EFMFILPG.js} +14 -6
- package/dist/chunk-EFMFILPG.js.map +1 -0
- package/dist/{chunk-HS7AVXTF.js → chunk-EH6XD3FY.js} +4 -4
- package/dist/chunk-EH6XD3FY.js.map +1 -0
- package/dist/{chunk-KQRW2GPZ.js → chunk-EIQFAOFD.js} +6 -6
- package/dist/chunk-EIQFAOFD.js.map +1 -0
- package/dist/{chunk-XJCXEKMD.cjs → chunk-EXTRW7GW.cjs} +4 -4
- package/dist/chunk-EXTRW7GW.cjs.map +1 -0
- package/dist/{chunk-U54XCYG3.js → chunk-FJWQP6EE.js} +12 -6
- package/dist/chunk-FJWQP6EE.js.map +1 -0
- package/dist/{chunk-O7DK5PBJ.cjs → chunk-FUSDYC2B.cjs} +26 -42
- package/dist/chunk-FUSDYC2B.cjs.map +1 -0
- package/dist/{chunk-4QZSA2HJ.js → chunk-G7BLGBRN.js} +4 -4
- package/dist/chunk-G7BLGBRN.js.map +1 -0
- package/dist/{chunk-BZRFXJHA.js → chunk-GBCVPKHE.js} +55 -26
- package/dist/chunk-GBCVPKHE.js.map +1 -0
- package/dist/chunk-GGZ5GPE3.cjs +130 -0
- package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
- package/dist/{chunk-5HEG4CQH.cjs → chunk-GZV6AVRL.cjs} +8 -8
- package/dist/{chunk-5HEG4CQH.cjs.map → chunk-GZV6AVRL.cjs.map} +1 -1
- package/dist/{chunk-VCLBZAZU.cjs → chunk-H6YM3PV6.cjs} +17 -17
- package/dist/chunk-H6YM3PV6.cjs.map +1 -0
- package/dist/{chunk-RFMBZPOW.cjs → chunk-HCT4HPCL.cjs} +10 -10
- package/dist/chunk-HCT4HPCL.cjs.map +1 -0
- package/dist/{chunk-OSEG74VJ.js → chunk-HFEJE7AC.js} +52 -43
- package/dist/chunk-HFEJE7AC.js.map +1 -0
- package/dist/{chunk-52NKC5HT.cjs → chunk-HUFSABUZ.cjs} +12 -8
- package/dist/chunk-HUFSABUZ.cjs.map +1 -0
- package/dist/{chunk-4CLOXP6H.cjs → chunk-HW7SEELD.cjs} +4 -4
- package/dist/{chunk-4CLOXP6H.cjs.map → chunk-HW7SEELD.cjs.map} +1 -1
- package/dist/{chunk-ZSWPZ23K.cjs → chunk-I2PWY7VM.cjs} +5 -5
- package/dist/chunk-I2PWY7VM.cjs.map +1 -0
- package/dist/{chunk-VJ26EKGJ.cjs → chunk-IJ7M6GOG.cjs} +3 -3
- package/dist/chunk-IJ7M6GOG.cjs.map +1 -0
- package/dist/{chunk-SAVIWMZB.js → chunk-ILGZ2ZZV.js} +3 -3
- package/dist/chunk-ILGZ2ZZV.js.map +1 -0
- package/dist/{chunk-4ZHTIJNE.cjs → chunk-J7J7J2GN.cjs} +87 -63
- package/dist/chunk-J7J7J2GN.cjs.map +1 -0
- package/dist/{chunk-UALX2J2Q.cjs → chunk-JLRLCBJ4.cjs} +38 -11
- package/dist/chunk-JLRLCBJ4.cjs.map +1 -0
- package/dist/{chunk-2QDYBS2A.js → chunk-JMDDYA22.js} +4 -4
- package/dist/chunk-JMDDYA22.js.map +1 -0
- package/dist/{chunk-LXQ6HKPS.js → chunk-JNAA4G4H.js} +3 -3
- package/dist/{chunk-LXQ6HKPS.js.map → chunk-JNAA4G4H.js.map} +1 -1
- package/dist/{chunk-UMP6OJIM.js → chunk-JOFVLOFY.js} +4 -4
- package/dist/{chunk-UMP6OJIM.js.map → chunk-JOFVLOFY.js.map} +1 -1
- package/dist/{chunk-A46SWMIF.js → chunk-K2VMFZQ5.js} +7 -7
- package/dist/chunk-K2VMFZQ5.js.map +1 -0
- package/dist/{chunk-DN2PACRI.js → chunk-K3NH62DG.js} +461 -282
- package/dist/chunk-K3NH62DG.js.map +1 -0
- package/dist/{chunk-LYTOXSRH.js → chunk-KDR53EO7.js} +1939 -1864
- package/dist/chunk-KDR53EO7.js.map +1 -0
- package/dist/{chunk-XWTLIGO3.cjs → chunk-KTTHHYEW.cjs} +5 -5
- package/dist/chunk-KTTHHYEW.cjs.map +1 -0
- package/dist/{chunk-3FFAEAUJ.cjs → chunk-KVSAY6NZ.cjs} +18 -18
- package/dist/chunk-KVSAY6NZ.cjs.map +1 -0
- package/dist/{chunk-IAHZCGBE.cjs → chunk-LHSWHYF3.cjs} +120 -146
- package/dist/chunk-LHSWHYF3.cjs.map +1 -0
- package/dist/{chunk-3OR54XG4.js → chunk-NJWYQWDL.js} +12 -8
- package/dist/chunk-NJWYQWDL.js.map +1 -0
- package/dist/chunk-NVXXWAU7.cjs +13 -0
- package/dist/chunk-NVXXWAU7.cjs.map +1 -0
- package/dist/{chunk-2D34UTDC.js → chunk-O6USDERH.js} +31 -11
- package/dist/chunk-O6USDERH.js.map +1 -0
- package/dist/{chunk-XO4SOZN6.js → chunk-OR6XIWLB.js} +4 -4
- package/dist/{chunk-XO4SOZN6.js.map → chunk-OR6XIWLB.js.map} +1 -1
- package/dist/{chunk-4PYZ5AX3.cjs → chunk-PRZ3BES7.cjs} +16 -8
- package/dist/chunk-PRZ3BES7.cjs.map +1 -0
- package/dist/{chunk-HCZD23VS.cjs → chunk-QC55H6RJ.cjs} +65 -39
- package/dist/chunk-QC55H6RJ.cjs.map +1 -0
- package/dist/{chunk-4O5TGQBW.cjs → chunk-QME6FDFG.cjs} +9 -5
- package/dist/chunk-QME6FDFG.cjs.map +1 -0
- package/dist/chunk-QOGNZMHD.cjs +34 -0
- package/dist/chunk-QOGNZMHD.cjs.map +1 -0
- package/dist/{chunk-7VT4P3Z4.cjs → chunk-QUAEOKDW.cjs} +1642 -1567
- package/dist/chunk-QUAEOKDW.cjs.map +1 -0
- package/dist/{chunk-B2J4ZMZL.cjs → chunk-QWD3CZWE.cjs} +6 -5
- package/dist/chunk-QWD3CZWE.cjs.map +1 -0
- package/dist/{chunk-SZVR77EJ.cjs → chunk-QWD4RDZ3.cjs} +15 -24
- package/dist/chunk-QWD4RDZ3.cjs.map +1 -0
- package/dist/{chunk-7BG5UH3T.cjs → chunk-RHZ6HP23.cjs} +4 -4
- package/dist/chunk-RHZ6HP23.cjs.map +1 -0
- package/dist/{chunk-2HVF2WJY.cjs → chunk-RQMCOFAI.cjs} +8 -8
- package/dist/{chunk-2HVF2WJY.cjs.map → chunk-RQMCOFAI.cjs.map} +1 -1
- package/dist/{chunk-VKJ7V7EB.cjs → chunk-SA6K24NB.cjs} +3 -3
- package/dist/chunk-SA6K24NB.cjs.map +1 -0
- package/dist/{chunk-7AD3ZTZL.js → chunk-SAGRF4IB.js} +3 -3
- package/dist/chunk-SAGRF4IB.js.map +1 -0
- package/dist/{chunk-PUAEFLYK.js → chunk-SVQIW5RJ.js} +4 -4
- package/dist/{chunk-PUAEFLYK.js.map → chunk-SVQIW5RJ.js.map} +1 -1
- package/dist/{chunk-43ZQRWAP.cjs → chunk-SYVWE64W.cjs} +22 -22
- package/dist/chunk-SYVWE64W.cjs.map +1 -0
- package/dist/{chunk-3O42QOMJ.js → chunk-TA3K7SBK.js} +7 -6
- package/dist/chunk-TA3K7SBK.js.map +1 -0
- package/dist/{chunk-LYRDF5TQ.cjs → chunk-TFG5IBZS.cjs} +14 -23
- package/dist/chunk-TFG5IBZS.cjs.map +1 -0
- package/dist/{chunk-GKEFRLU7.cjs → chunk-TMKTSYDS.cjs} +6 -6
- package/dist/{chunk-GKEFRLU7.cjs.map → chunk-TMKTSYDS.cjs.map} +1 -1
- package/dist/{chunk-J24VJOH3.cjs → chunk-UADQJBHR.cjs} +31 -11
- package/dist/chunk-UADQJBHR.cjs.map +1 -0
- package/dist/{chunk-TAZVKYWJ.js → chunk-UBR5PWD7.js} +26 -40
- package/dist/chunk-UBR5PWD7.js.map +1 -0
- package/dist/{chunk-IPYYKCRC.js → chunk-UFPUHJWS.js} +5 -5
- package/dist/{chunk-IPYYKCRC.js.map → chunk-UFPUHJWS.js.map} +1 -1
- package/dist/{chunk-OHLDPWTA.cjs → chunk-UGRS7ZA7.cjs} +15 -15
- package/dist/{chunk-OHLDPWTA.cjs.map → chunk-UGRS7ZA7.cjs.map} +1 -1
- package/dist/{chunk-RIAM53CP.js → chunk-UKMBRMGT.js} +3 -3
- package/dist/chunk-UKMBRMGT.js.map +1 -0
- package/dist/{chunk-L4BDVXIM.js → chunk-UNK4HNJH.js} +97 -123
- package/dist/chunk-UNK4HNJH.js.map +1 -0
- package/dist/{chunk-C3NT3PVE.js → chunk-V22DZIXO.js} +3 -3
- package/dist/chunk-V22DZIXO.js.map +1 -0
- package/dist/{chunk-OFRFZRQ4.cjs → chunk-V6ZY4AX6.cjs} +24 -14
- package/dist/chunk-V6ZY4AX6.cjs.map +1 -0
- package/dist/{chunk-B3IMEBOA.js → chunk-VE6DFSKU.js} +3 -3
- package/dist/{chunk-B3IMEBOA.js.map → chunk-VE6DFSKU.js.map} +1 -1
- package/dist/{chunk-WLQNMXQE.js → chunk-VWUXIVEI.js} +53 -26
- package/dist/chunk-VWUXIVEI.js.map +1 -0
- package/dist/{chunk-GMLBYDW4.cjs → chunk-VXDEKILY.cjs} +108 -109
- package/dist/chunk-VXDEKILY.cjs.map +1 -0
- package/dist/{chunk-ACDLHN3W.js → chunk-WJXOICRC.js} +16 -6
- package/dist/chunk-WJXOICRC.js.map +1 -0
- package/dist/{chunk-7YGCPMGB.js → chunk-XB4GI5RZ.js} +27 -12
- package/dist/chunk-XB4GI5RZ.js.map +1 -0
- package/dist/{chunk-O73J46PV.js → chunk-XDANGA2C.js} +5 -5
- package/dist/{chunk-O73J46PV.js.map → chunk-XDANGA2C.js.map} +1 -1
- package/dist/{chunk-NDGGJQTZ.js → chunk-XJZEBGXD.js} +10 -10
- package/dist/chunk-XJZEBGXD.js.map +1 -0
- package/dist/{chunk-UTSRIDKZ.js → chunk-XYFGKVZ7.js} +3 -3
- package/dist/chunk-XYFGKVZ7.js.map +1 -0
- package/dist/{chunk-RMWTPV3M.cjs → chunk-Y2KYR2ED.cjs} +27 -27
- package/dist/chunk-Y2KYR2ED.cjs.map +1 -0
- package/dist/{chunk-O7LZFG6O.cjs → chunk-YIFFF23U.cjs} +5 -5
- package/dist/chunk-YIFFF23U.cjs.map +1 -0
- package/dist/{chunk-4OTIXDMU.cjs → chunk-YJNYDJ2T.cjs} +12 -4
- package/dist/chunk-YJNYDJ2T.cjs.map +1 -0
- package/dist/{chunk-6JSIEDKL.cjs → chunk-YSTXFWQE.cjs} +13 -7
- package/dist/chunk-YSTXFWQE.cjs.map +1 -0
- package/dist/{chunk-I6HGWHPU.cjs → chunk-Z3NTRKIC.cjs} +4 -4
- package/dist/{chunk-I6HGWHPU.cjs.map → chunk-Z3NTRKIC.cjs.map} +1 -1
- package/dist/{chunk-32WTYBUH.js → chunk-ZH26RNQA.js} +91 -92
- package/dist/chunk-ZH26RNQA.js.map +1 -0
- package/dist/compact-session-BHTPCIHA.cjs +61 -0
- package/dist/{compact-session-QV57KR66.cjs.map → compact-session-BHTPCIHA.cjs.map} +1 -1
- package/dist/compact-session-W4WLJTHA.js +24 -0
- package/dist/{compact-session-RIGOWC4Y.js.map → compact-session-W4WLJTHA.js.map} +1 -1
- package/dist/compaction.cjs +20 -17
- package/dist/compaction.d.cts +15 -1
- package/dist/compaction.d.ts +15 -1
- package/dist/compaction.js +3 -4
- package/dist/concurrency.cjs +6 -7
- package/dist/concurrency.cjs.map +1 -1
- package/dist/concurrency.d.cts +6 -3
- package/dist/concurrency.d.ts +6 -3
- package/dist/concurrency.js +4 -5
- package/dist/concurrency.js.map +1 -1
- package/dist/context/index.cjs +6 -6
- package/dist/context/index.js +3 -3
- package/dist/context-NI33FS2R.cjs +23 -0
- package/dist/{context-WFLTTMK3.cjs.map → context-NI33FS2R.cjs.map} +1 -1
- package/dist/context-Y7B7SI5X.js +6 -0
- package/dist/{context-WI2DFG7V.js.map → context-Y7B7SI5X.js.map} +1 -1
- package/dist/create-skill.d.ts +4 -1
- package/dist/{cron-BuiRPrvt.d.cts → cron-C3PhZED0.d.cts} +8 -2
- package/dist/{cron-C2SIi31n.d.ts → cron-crfMMdAw.d.ts} +8 -2
- package/dist/cron.cjs +46 -45
- package/dist/cron.d.cts +5 -4
- package/dist/cron.d.ts +5 -4
- package/dist/cron.js +45 -44
- package/dist/{errors-BgJH9PHi.d.cts → errors-CLOAyuiv.d.ts} +133 -95
- package/dist/{errors-C5fJUqLk.d.ts → errors-DrDEgyz1.d.cts} +133 -95
- package/dist/errors-base-B5g01neU.d.cts +75 -0
- package/dist/errors-base-B5g01neU.d.ts +75 -0
- package/dist/errors-base.d.ts +73 -0
- package/dist/errors.cjs +25 -22
- package/dist/errors.d.cts +3 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.js +2 -3
- package/dist/eval.cjs +74 -78
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +64 -68
- package/dist/eval.js.map +1 -1
- package/dist/{executor-6CYCA7MI.cjs → executor-XQAOQOHD.cjs} +60 -54
- package/dist/executor-XQAOQOHD.cjs.map +1 -0
- package/dist/{executor-QSEC3MRH.js → executor-ZNDQDX6Q.js} +43 -37
- package/dist/executor-ZNDQDX6Q.js.map +1 -0
- package/dist/filesystem/index.cjs +24 -26
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +20 -22
- package/dist/filesystem/index.js.map +1 -1
- package/dist/filesystem/types.d.cts +11 -5
- package/dist/filesystem/types.d.ts +11 -5
- package/dist/{fork-agent-RSV4E3EA.js → fork-agent-S2EPIML7.js} +3 -3
- package/dist/fork-agent-S2EPIML7.js.map +1 -0
- package/dist/{fork-agent-Y2IK2RYU.cjs → fork-agent-WAEQI2DL.cjs} +4 -4
- package/dist/fork-agent-WAEQI2DL.cjs.map +1 -0
- package/dist/fs-session-store-77JU46UZ.js +10 -0
- package/dist/{fs-session-store-NM6YSTE2.js.map → fs-session-store-77JU46UZ.js.map} +1 -1
- package/dist/fs-session-store-E4U3P56L.cjs +19 -0
- package/dist/{fs-session-store-4PIHT5UX.cjs.map → fs-session-store-E4U3P56L.cjs.map} +1 -1
- package/dist/generate-object-BXV7BZRP.js +7 -0
- package/dist/{generate-object-GUNAUVBX.js.map → generate-object-BXV7BZRP.js.map} +1 -1
- package/dist/generate-object-YBI2TDJ3.cjs +20 -0
- package/dist/{generate-object-R7HTMW7F.cjs.map → generate-object-YBI2TDJ3.cjs.map} +1 -1
- package/dist/generate-object.d.ts +2 -4
- package/dist/index-manager-DXR2RSFI.cjs +26 -0
- package/dist/{index-manager-2SRX45WJ.cjs.map → index-manager-DXR2RSFI.cjs.map} +1 -1
- package/dist/index-manager-QH6OXEV5.js +17 -0
- package/dist/{index-manager-SP4ISSDX.js.map → index-manager-QH6OXEV5.js.map} +1 -1
- package/dist/index.cjs +234 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +243 -41
- package/dist/index.d.ts +243 -41
- package/dist/index.js +140 -102
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-DAR7OUCW.js → inject-session-SUM6TDJF.js} +9 -9
- package/dist/{inject-session-DAR7OUCW.js.map → inject-session-SUM6TDJF.js.map} +1 -1
- package/dist/inject-session-W6A46J3E.cjs +29 -0
- package/dist/{inject-session-WQKMC3GR.cjs.map → inject-session-W6A46J3E.cjs.map} +1 -1
- package/dist/interactive/index.cjs +12 -6
- package/dist/interactive/index.cjs.map +1 -1
- package/dist/interactive/index.js +12 -6
- package/dist/interactive/index.js.map +1 -1
- package/dist/interactive/types.d.cts +14 -4
- package/dist/interactive/types.d.ts +14 -4
- package/dist/internal/agent-loop/loop-context-init.d.ts +1 -1
- package/dist/internal/agent-loop/loop-finalize.d.ts +25 -0
- package/dist/internal/agent-loop/loop.d.ts +1 -1
- package/dist/internal/agent-loop/message-builders.d.ts +1 -1
- package/dist/internal/agent-loop/tool-dispatch.d.ts +2 -2
- package/dist/internal/agent-loop/usage-and-cost.d.ts +1 -1
- package/dist/internal/auth/credential-availability.d.ts +61 -0
- package/dist/internal/auth/credential-store.d.ts +1 -1
- package/dist/internal/auth/oauth-device.d.ts +1 -1
- package/dist/internal/auth/oauth-engine.d.ts +1 -1
- package/dist/internal/auth/resolve-credential.d.ts +1 -1
- package/dist/internal/base-url.d.ts +14 -0
- package/dist/internal/cloud-agent/cloud-config-serializer.d.ts +1 -1
- package/dist/internal/{runtime/concurrency → concurrency}/subagent-credentials.d.ts +2 -2
- package/dist/internal/emit-run-event.d.ts +16 -0
- package/dist/internal/error-mappers/shared.d.ts +14 -1
- package/dist/internal/eval/assert.d.ts +2 -1
- package/dist/internal/eval/single-flight.d.ts +2 -1
- package/dist/internal/global-singleton.d.ts +6 -3
- package/dist/internal/llm/responses.d.ts +10 -0
- package/dist/internal/local-agent/local-agent-bootstrap.d.ts +5 -3
- package/dist/internal/local-agent/local-agent-capabilities.d.ts +38 -0
- package/dist/internal/local-agent/local-agent-dispatch.d.ts +2 -2
- package/dist/internal/local-agent/local-agent-memory-provider.d.ts +1 -1
- package/dist/internal/local-agent/local-agent-personality-extensions.d.ts +25 -1
- package/dist/internal/local-agent/local-agent-send.d.ts +42 -1
- package/dist/internal/local-agent/real-local-run-mcp.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-options.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +21 -4
- package/dist/internal/local-agent/real-local-run.d.ts +2 -2
- package/dist/internal/mcp/handshake-timeout.d.ts +53 -0
- package/dist/internal/memory/active-memory.d.ts +1 -1
- package/dist/internal/memory/adapters/index.cjs +10 -10
- package/dist/internal/memory/adapters/index.js +9 -9
- package/dist/internal/memory/adapters/openai-embedding.d.cts +10 -0
- package/dist/internal/memory/adapters/openai-embedding.d.ts +10 -0
- package/dist/internal/memory/corpus-sync.d.ts +23 -0
- package/dist/internal/memory/index-db.d.ts +15 -1
- package/dist/internal/memory/index-manager-contract.d.ts +12 -0
- package/dist/internal/memory/index-manager.d.ts +4 -10
- package/dist/internal/memory/index-repository.d.ts +58 -0
- package/dist/internal/memory/lance-memory-adapter.d.ts +16 -14
- package/dist/internal/memory/memory-index.d.ts +15 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +54 -1
- package/dist/internal/memory/storage/index.cjs +39 -40
- package/dist/internal/memory/storage/index.js +10 -11
- package/dist/internal/memory/storage/memory-root.d.cts +2 -3
- package/dist/internal/memory/storage/memory-root.d.ts +2 -3
- package/dist/internal/persistence/atomic-write.d.cts +4 -4
- package/dist/internal/persistence/atomic-write.d.ts +4 -4
- package/dist/internal/persistence/index.cjs +24 -25
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +7 -8
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/jsonl.d.cts +3 -1
- package/dist/internal/persistence/jsonl.d.ts +3 -1
- package/dist/internal/persistence/paths.d.cts +25 -12
- package/dist/internal/persistence/paths.d.ts +25 -12
- package/dist/internal/persistence/transcript-ops.d.cts +11 -2
- package/dist/internal/persistence/transcript-ops.d.ts +11 -2
- package/dist/internal/plugins/context.d.cts +0 -10
- package/dist/internal/plugins/context.d.ts +0 -10
- package/dist/internal/plugins/types.d.cts +1 -1
- package/dist/internal/plugins/types.d.ts +1 -1
- package/dist/internal/providers/catalog-schema.d.ts +94 -0
- package/dist/internal/providers/catalog-source-models-dev.d.ts +11 -0
- package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +58 -34
- package/dist/internal/runtime/compression/compression-model-registry.d.ts +1 -1
- package/dist/internal/runtime/compression/compression-summarizer.d.ts +5 -1
- package/dist/internal/runtime/fixtures/fixture-events.d.ts +1 -1
- package/dist/internal/runtime/fixtures/fixture-mode.d.ts +8 -14
- package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +1 -1
- package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +2 -2
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +6 -1
- package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +1 -1
- package/dist/internal/runtime/{memory → memory-glue}/memory-provider.d.ts +1 -1
- package/dist/internal/runtime/{plugins → plugin-loader}/plugin-bundles.d.ts +4 -1
- package/dist/internal/runtime/processors/wrap-output-run.d.ts +1 -1
- package/dist/internal/runtime/registry/live-agent-registry.d.ts +9 -1
- package/dist/internal/runtime/system-prompt/local-assembly.d.ts +2 -1
- package/dist/internal/scorers/llm-judge.d.ts +12 -0
- package/dist/internal/security/index.cjs +14 -15
- package/dist/internal/security/index.d.cts +6 -1
- package/dist/internal/security/index.d.ts +6 -1
- package/dist/internal/security/index.js +4 -5
- package/dist/internal/security/path-containment.d.ts +24 -0
- package/dist/internal/session/agent-session-store.d.ts +1 -1
- package/dist/internal/session/agent-session.d.ts +1 -1
- package/dist/internal/session/index.d.ts +1 -1
- package/dist/internal/session/session-cache.d.ts +9 -3
- package/dist/internal/task/registry.d.ts +1 -1
- package/dist/internal/task/store.d.ts +1 -1
- package/dist/internal/task/subscribe.d.ts +1 -1
- package/dist/internal/task/task-id.d.ts +22 -0
- package/dist/internal/telemetry/adapter-registry.d.ts +12 -2
- package/dist/internal/telemetry/adapters/braintrust.d.ts +6 -1
- package/dist/internal/telemetry/adapters/langsmith.d.ts +6 -1
- package/dist/internal/workflow/executor.d.ts +2 -1
- package/dist/internal/workflow/snapshot-store.d.ts +1 -1
- package/dist/internal/workflow/step-branch.d.ts +2 -2
- package/dist/internal/workflow/step-dowhile.d.ts +2 -2
- package/dist/internal/workflow/step-execution.d.ts +25 -0
- package/dist/internal/workflow/step-foreach.d.ts +2 -2
- package/dist/internal/workflow/step-parallel.d.ts +2 -2
- package/dist/judge-call-6MVARKU2.js +5 -0
- package/dist/{judge-call-LVXABPS3.js.map → judge-call-6MVARKU2.js.map} +1 -1
- package/dist/judge-call-I3P4D5QR.cjs +22 -0
- package/dist/{judge-call-LAHMBJ57.cjs.map → judge-call-I3P4D5QR.cjs.map} +1 -1
- package/dist/mcp-auth.cjs +14 -15
- package/dist/mcp-auth.cjs.map +1 -1
- package/dist/mcp-auth.d.cts +2 -0
- package/dist/mcp-auth.d.ts +2 -0
- package/dist/mcp-auth.js +4 -5
- package/dist/mcp-auth.js.map +1 -1
- package/dist/models.cjs +52 -42
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +39 -29
- package/dist/models.js.map +1 -1
- package/dist/oauth-transaction-store-5RIR6D5C.js +5 -0
- package/dist/{oauth-transaction-store-W52KVHQ4.js.map → oauth-transaction-store-5RIR6D5C.js.map} +1 -1
- package/dist/oauth-transaction-store-SXIE57OD.cjs +38 -0
- package/dist/{oauth-transaction-store-BT4GLTLK.cjs.map → oauth-transaction-store-SXIE57OD.cjs.map} +1 -1
- package/dist/path-safety.cjs +11 -12
- package/dist/path-safety.d.cts +2 -0
- package/dist/path-safety.d.ts +2 -0
- package/dist/path-safety.js +4 -5
- package/dist/permission-engine.d.ts +10 -17
- package/dist/persistence.cjs +31 -31
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +9 -1
- package/dist/persistence.d.ts +9 -1
- package/dist/persistence.js +12 -13
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -6
- package/dist/project.cjs.map +1 -1
- package/dist/project.js +3 -4
- package/dist/project.js.map +1 -1
- package/dist/providers.cjs +10 -10
- package/dist/providers.d.cts +2 -0
- package/dist/providers.d.ts +2 -0
- package/dist/providers.js +8 -8
- package/dist/registry-BZQFYRTL.cjs +46 -0
- package/dist/{registry-V7BDQ6QB.cjs.map → registry-BZQFYRTL.cjs.map} +1 -1
- package/dist/registry-DMWCJKRF.js +9 -0
- package/dist/{registry-75W33OGL.js.map → registry-DMWCJKRF.js.map} +1 -1
- package/dist/retry.cjs +4 -5
- package/dist/retry.d.cts +20 -5
- package/dist/retry.d.ts +20 -5
- package/dist/retry.js +3 -4
- package/dist/{run-BYSHf58D.d.ts → run-CTAdRU3U.d.cts} +120 -152
- package/dist/{run-BYSHf58D.d.cts → run-CTAdRU3U.d.ts} +120 -152
- package/dist/{run-until-HEQOUVU6.js → run-until-6D6TQ4JN.js} +27 -59
- package/dist/run-until-6D6TQ4JN.js.map +1 -0
- package/dist/{run-until-U2B5FJJI.cjs → run-until-DG2KXWB2.cjs} +27 -59
- package/dist/run-until-DG2KXWB2.cjs.map +1 -0
- package/dist/sandbox/bwrap.d.cts +11 -1
- package/dist/sandbox/bwrap.d.ts +11 -1
- package/dist/sandbox/index.cjs +26 -30
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +8 -1
- package/dist/sandbox/index.d.ts +8 -1
- package/dist/sandbox/index.js +10 -14
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +20 -4
- package/dist/sandbox/linux-sandbox.d.ts +20 -4
- package/dist/sandbox/types.d.cts +18 -2
- package/dist/sandbox/types.d.ts +18 -2
- package/dist/sanitize/index.cjs +2 -2
- package/dist/sanitize/index.js +1 -1
- package/dist/sanitize/types.d.cts +15 -2
- package/dist/sanitize/types.d.ts +15 -2
- package/dist/{sdk-agent-D8qJVkuV.d.ts → sdk-agent-BOiKqOgL.d.cts} +197 -117
- package/dist/{sdk-agent-DEoKhA8a.d.cts → sdk-agent-D4a_BR_6.d.ts} +197 -117
- package/dist/server/auth/errors.d.cts +4 -3
- package/dist/server/auth/errors.d.ts +4 -3
- package/dist/server/auth/index.cjs +28 -28
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.d.cts +28 -5
- package/dist/server/auth/index.d.ts +28 -5
- package/dist/server/auth/index.js +13 -13
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/oauth-transaction-store.d.cts +2 -1
- package/dist/server/auth/oauth-transaction-store.d.ts +2 -1
- package/dist/server/auth/orchestrator.d.cts +4 -1
- package/dist/server/auth/orchestrator.d.ts +4 -1
- package/dist/server/auth/types.d.cts +18 -0
- package/dist/server/auth/types.d.ts +18 -0
- package/dist/server/errors-envelope.cjs +14 -15
- package/dist/server/errors-envelope.cjs.map +1 -1
- package/dist/server/errors-envelope.d.cts +3 -3
- package/dist/server/errors-envelope.d.ts +3 -3
- package/dist/server/errors-envelope.js +3 -4
- package/dist/server/errors-envelope.js.map +1 -1
- package/dist/session-transcript-LGHSNVY5.cjs +62 -0
- package/dist/{session-transcript-6WNITKRE.cjs.map → session-transcript-LGHSNVY5.cjs.map} +1 -1
- package/dist/session-transcript-VTBTCGQX.js +5 -0
- package/dist/{session-transcript-XAEKW6P7.js.map → session-transcript-VTBTCGQX.js.map} +1 -1
- package/dist/skills.cjs +8 -9
- package/dist/skills.js +6 -7
- package/dist/stream-object-HBFMIZLD.js +7 -0
- package/dist/{stream-object-UF4QRQRU.js.map → stream-object-HBFMIZLD.js.map} +1 -1
- package/dist/stream-object-QSKHISDJ.cjs +20 -0
- package/dist/{stream-object-ZJTQNKY3.cjs.map → stream-object-QSKHISDJ.cjs.map} +1 -1
- package/dist/stream-object.d.ts +2 -4
- package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
- package/dist/{subagents-loader-UCNO7FUH.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
- package/dist/subagents-loader-Y6JFYXAY.js +7 -0
- package/dist/{subagents-loader-XP5ERVDZ.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
- package/dist/subagents-loader.cjs +7 -8
- package/dist/subagents-loader.cjs.map +1 -1
- package/dist/subagents-loader.d.cts +5 -3
- package/dist/subagents-loader.d.ts +5 -3
- package/dist/subagents-loader.js +5 -6
- package/dist/subagents-loader.js.map +1 -1
- package/dist/subagents.cjs +2 -2
- package/dist/subagents.cjs.map +1 -1
- package/dist/subagents.js +1 -1
- package/dist/subagents.js.map +1 -1
- package/dist/subscription/define-subscription.d.cts +4 -1
- package/dist/subscription/define-subscription.d.ts +4 -1
- package/dist/subscription/index.cjs +4 -5
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.d.cts +2 -0
- package/dist/subscription/index.d.ts +2 -0
- package/dist/subscription/index.js +3 -4
- package/dist/subscription/index.js.map +1 -1
- package/dist/subscription/internal/server-integration.d.cts +5 -0
- package/dist/subscription/internal/server-integration.d.ts +5 -0
- package/dist/subscription/internal/subscription-runtime.d.cts +13 -1
- package/dist/subscription/internal/subscription-runtime.d.ts +13 -1
- package/dist/task-errors.d.ts +58 -0
- package/dist/task-store.cjs +7 -8
- package/dist/task-store.d.cts +2 -0
- package/dist/task-store.d.ts +2 -0
- package/dist/task-store.js +4 -5
- package/dist/types/agent-prims.d.ts +21 -0
- package/dist/types/agent.d.ts +109 -15
- package/dist/types/batch.d.ts +3 -0
- package/dist/types/budget-tracker.d.ts +3 -0
- package/dist/types/budget.d.ts +12 -3
- package/dist/types/content-blocks.d.ts +3 -0
- package/dist/types/context.d.ts +3 -0
- package/dist/types/conversation.d.ts +5 -0
- package/dist/types/cron.d.ts +5 -0
- package/dist/types/env-policy.d.ts +3 -0
- package/dist/types/eval.d.ts +3 -0
- package/dist/types/fork.d.ts +3 -0
- package/dist/types/goal-events.d.ts +3 -0
- package/dist/types/mcp.d.ts +5 -0
- package/dist/types/memory-adapter.d.ts +3 -0
- package/dist/types/memory-provider.d.ts +44 -5
- package/dist/types/messages-base.d.ts +4 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugin.d.ts +32 -4
- package/dist/types/processors.d.ts +3 -0
- package/dist/types/provider-profile.d.ts +3 -0
- package/dist/types/providers.d.ts +3 -0
- package/dist/types/run-events.d.ts +36 -9
- package/dist/types/run.d.ts +29 -2
- package/dist/types/sdk-agent.d.ts +71 -1
- package/dist/types/session-message.d.ts +3 -0
- package/dist/types/session-record.d.ts +3 -0
- package/dist/types/session-store.d.ts +45 -0
- package/dist/types/task.d.ts +3 -11
- package/dist/types/theokit.d.ts +3 -0
- package/dist/types/trajectory.d.ts +3 -0
- package/dist/types/updates.d.ts +5 -0
- package/dist/types/usage.d.ts +4 -1
- package/dist/types/workflow.d.ts +13 -135
- package/dist/workflow-as-tool.d.ts +66 -0
- package/dist/workflow-errors.d.ts +164 -0
- package/dist/workflow.cjs +29 -30
- package/dist/workflow.d.cts +135 -74
- package/dist/workflow.d.ts +135 -74
- package/dist/workflow.js +8 -9
- package/docs/adr/README.md +2604 -0
- package/docs/error-codes.md +139 -105
- package/docs/harness-capability-map.md +32 -20
- package/docs/memory-decisions.md +1 -1
- package/package.json +3 -7
- package/bin/theokit-migrate-config.mjs +0 -278
- package/bin/theokit-migrate-memory.mjs +0 -116
- package/dist/agent-A5XMIVNP.js +0 -57
- package/dist/agent-UX7WFI6B.cjs +0 -66
- package/dist/agent-session-store-6EL5NPA4.cjs +0 -24
- package/dist/agent-session-store-OPGRB4XM.js +0 -7
- package/dist/batch-BXYTW2DP.cjs.map +0 -1
- package/dist/batch-L4ZXS46M.js.map +0 -1
- package/dist/chunk-247ZTLNU.js +0 -73
- package/dist/chunk-247ZTLNU.js.map +0 -1
- package/dist/chunk-2D34UTDC.js.map +0 -1
- package/dist/chunk-2GUYQR5P.js.map +0 -1
- package/dist/chunk-2QDYBS2A.js.map +0 -1
- package/dist/chunk-32WTYBUH.js.map +0 -1
- package/dist/chunk-3FFAEAUJ.cjs.map +0 -1
- package/dist/chunk-3O42QOMJ.js.map +0 -1
- package/dist/chunk-3OR54XG4.js.map +0 -1
- package/dist/chunk-43ZQRWAP.cjs.map +0 -1
- package/dist/chunk-4FFBAUFS.js.map +0 -1
- package/dist/chunk-4O5TGQBW.cjs.map +0 -1
- package/dist/chunk-4OTIXDMU.cjs.map +0 -1
- package/dist/chunk-4PYZ5AX3.cjs.map +0 -1
- package/dist/chunk-4QZSA2HJ.js.map +0 -1
- package/dist/chunk-4ZHTIJNE.cjs.map +0 -1
- package/dist/chunk-52NKC5HT.cjs.map +0 -1
- package/dist/chunk-6HKGLTJI.cjs.map +0 -1
- package/dist/chunk-6JSIEDKL.cjs.map +0 -1
- package/dist/chunk-7AD3ZTZL.js.map +0 -1
- package/dist/chunk-7BG5UH3T.cjs.map +0 -1
- package/dist/chunk-7VT4P3Z4.cjs.map +0 -1
- package/dist/chunk-7YGCPMGB.js.map +0 -1
- package/dist/chunk-A46SWMIF.js.map +0 -1
- package/dist/chunk-A4JVILQU.js.map +0 -1
- package/dist/chunk-ACDLHN3W.js.map +0 -1
- package/dist/chunk-AKJP2STZ.cjs +0 -81
- package/dist/chunk-AKJP2STZ.cjs.map +0 -1
- package/dist/chunk-AWO27VRZ.js.map +0 -1
- package/dist/chunk-B2J4ZMZL.cjs.map +0 -1
- package/dist/chunk-B4EOJWOY.cjs.map +0 -1
- package/dist/chunk-BU4KFWXF.js.map +0 -1
- package/dist/chunk-BZRFXJHA.js.map +0 -1
- package/dist/chunk-C3NT3PVE.js.map +0 -1
- package/dist/chunk-C72AZW7J.js.map +0 -1
- package/dist/chunk-D4CUGAKZ.js.map +0 -1
- package/dist/chunk-DN2PACRI.js.map +0 -1
- package/dist/chunk-DXGZ2NUG.cjs.map +0 -1
- package/dist/chunk-EG4QM7ZJ.cjs +0 -39
- package/dist/chunk-EG4QM7ZJ.cjs.map +0 -1
- package/dist/chunk-GMLBYDW4.cjs.map +0 -1
- package/dist/chunk-HCZD23VS.cjs.map +0 -1
- package/dist/chunk-HS7AVXTF.js.map +0 -1
- package/dist/chunk-IAHZCGBE.cjs.map +0 -1
- package/dist/chunk-J24VJOH3.cjs.map +0 -1
- package/dist/chunk-JPBKYL3B.cjs +0 -18
- package/dist/chunk-JPBKYL3B.cjs.map +0 -1
- package/dist/chunk-KQ7TS7WW.cjs.map +0 -1
- package/dist/chunk-KQRW2GPZ.js.map +0 -1
- package/dist/chunk-KYAJINUI.cjs.map +0 -1
- package/dist/chunk-L3MTL4NA.js.map +0 -1
- package/dist/chunk-L4BDVXIM.js.map +0 -1
- package/dist/chunk-LKBEROHN.js.map +0 -1
- package/dist/chunk-LYRDF5TQ.cjs.map +0 -1
- package/dist/chunk-LYTOXSRH.js.map +0 -1
- package/dist/chunk-N2U4AZGB.js.map +0 -1
- package/dist/chunk-NDGGJQTZ.js.map +0 -1
- package/dist/chunk-O7DK5PBJ.cjs.map +0 -1
- package/dist/chunk-O7LZFG6O.cjs.map +0 -1
- package/dist/chunk-OFRFZRQ4.cjs.map +0 -1
- package/dist/chunk-OSEG74VJ.js.map +0 -1
- package/dist/chunk-RFMBZPOW.cjs.map +0 -1
- package/dist/chunk-RFXWMRFC.js.map +0 -1
- package/dist/chunk-RIAM53CP.js.map +0 -1
- package/dist/chunk-RMWTPV3M.cjs.map +0 -1
- package/dist/chunk-RNB4APBZ.js.map +0 -1
- package/dist/chunk-SAVIWMZB.js.map +0 -1
- package/dist/chunk-SZVR77EJ.cjs.map +0 -1
- package/dist/chunk-TAZVKYWJ.js.map +0 -1
- package/dist/chunk-U54XCYG3.js.map +0 -1
- package/dist/chunk-U6IFHFWK.js.map +0 -1
- package/dist/chunk-UALX2J2Q.cjs.map +0 -1
- package/dist/chunk-UBDMVMBZ.js.map +0 -1
- package/dist/chunk-UGT7GK7I.cjs.map +0 -1
- package/dist/chunk-UNYXQ4M5.js.map +0 -1
- package/dist/chunk-UTSRIDKZ.js.map +0 -1
- package/dist/chunk-UU36SHFY.cjs.map +0 -1
- package/dist/chunk-V2BOS4WF.cjs.map +0 -1
- package/dist/chunk-VCLBZAZU.cjs.map +0 -1
- package/dist/chunk-VJ26EKGJ.cjs.map +0 -1
- package/dist/chunk-VKJ7V7EB.cjs.map +0 -1
- package/dist/chunk-VLVVJLDH.cjs.map +0 -1
- package/dist/chunk-WLQNMXQE.js.map +0 -1
- package/dist/chunk-WNO3C3N2.cjs.map +0 -1
- package/dist/chunk-WTMU7J4U.js +0 -14
- package/dist/chunk-WTMU7J4U.js.map +0 -1
- package/dist/chunk-XEQ3TM66.js +0 -35
- package/dist/chunk-XEQ3TM66.js.map +0 -1
- package/dist/chunk-XJCXEKMD.cjs.map +0 -1
- package/dist/chunk-XL7Q7HB2.cjs.map +0 -1
- package/dist/chunk-XWTLIGO3.cjs.map +0 -1
- package/dist/chunk-YML4ME27.cjs.map +0 -1
- package/dist/chunk-ZSWPZ23K.cjs.map +0 -1
- package/dist/chunk-ZZMZWBR6.js.map +0 -1
- package/dist/compact-session-QV57KR66.cjs +0 -59
- package/dist/compact-session-RIGOWC4Y.js +0 -22
- package/dist/context-WFLTTMK3.cjs +0 -24
- package/dist/context-WI2DFG7V.js +0 -7
- package/dist/executor-6CYCA7MI.cjs.map +0 -1
- package/dist/executor-QSEC3MRH.js.map +0 -1
- package/dist/fork-agent-RSV4E3EA.js.map +0 -1
- package/dist/fork-agent-Y2IK2RYU.cjs.map +0 -1
- package/dist/fs-session-store-4PIHT5UX.cjs +0 -20
- package/dist/fs-session-store-NM6YSTE2.js +0 -11
- package/dist/generate-object-GUNAUVBX.js +0 -8
- package/dist/generate-object-R7HTMW7F.cjs +0 -21
- package/dist/index-manager-2SRX45WJ.cjs +0 -27
- package/dist/index-manager-SP4ISSDX.js +0 -18
- package/dist/inject-session-WQKMC3GR.cjs +0 -29
- package/dist/internal/persistence/credential-pool-store.d.cts +0 -32
- package/dist/internal/persistence/credential-pool-store.d.ts +0 -32
- package/dist/internal/runtime/memory/memory-path-selector.d.ts +0 -73
- package/dist/judge-call-LAHMBJ57.cjs +0 -23
- package/dist/judge-call-LVXABPS3.js +0 -6
- package/dist/oauth-transaction-store-BT4GLTLK.cjs +0 -36
- package/dist/oauth-transaction-store-W52KVHQ4.js +0 -3
- package/dist/registry-75W33OGL.js +0 -10
- package/dist/registry-V7BDQ6QB.cjs +0 -47
- package/dist/run-until-HEQOUVU6.js.map +0 -1
- package/dist/run-until-U2B5FJJI.cjs.map +0 -1
- package/dist/server/adapter/express.d.cts +0 -9
- package/dist/server/adapter/express.d.ts +0 -9
- package/dist/server/adapter/fastify.d.cts +0 -9
- package/dist/server/adapter/fastify.d.ts +0 -9
- package/dist/server/adapter/hono.d.cts +0 -9
- package/dist/server/adapter/hono.d.ts +0 -9
- package/dist/server/adapter/shared-handler.d.cts +0 -9
- package/dist/server/adapter/shared-handler.d.ts +0 -9
- package/dist/server/adapter/types.d.cts +0 -33
- package/dist/server/adapter/types.d.ts +0 -33
- package/dist/session-transcript-6WNITKRE.cjs +0 -63
- package/dist/session-transcript-XAEKW6P7.js +0 -6
- package/dist/stream-object-UF4QRQRU.js +0 -8
- package/dist/stream-object-ZJTQNKY3.cjs +0 -21
- package/dist/subagents-loader-UCNO7FUH.cjs +0 -17
- package/dist/subagents-loader-XP5ERVDZ.js +0 -8
- /package/dist/{batch.d.ts → internal/agent/batch.d.ts} +0 -0
- /package/dist/{agent-helpers.d.ts → internal/agent/helpers.d.ts} +0 -0
- /package/dist/internal/agent-loop/{loop-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/auth/{auth-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/cloud-agent/{cloud-payload-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/abort-utils.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/async-local-storage.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/async-semaphore.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/delegation-depth.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/map-with-concurrency.d.ts +0 -0
- /package/dist/internal/{runtime/retry → error-mappers}/default-retriable.d.ts +0 -0
- /package/dist/internal/{runtime/fixtures/fixture-types.d.ts → memory/storage/list-markdown.d.cts} +0 -0
- /package/dist/internal/{runtime/plugins/plugins-manager.d.ts → memory/storage/list-markdown.d.ts} +0 -0
- /package/dist/internal/{resilience → retry}/circuit-breaker.d.ts +0 -0
- /package/dist/internal/{runtime/retry → retry}/with-retry.d.ts +0 -0
- /package/dist/internal/{security/secret-redactor.d.cts → runtime/fixtures/types.d.ts} +0 -0
- /package/dist/internal/runtime/{memory → memory-glue}/memory-store.d.ts +0 -0
- /package/dist/internal/runtime/{memory → memory-glue}/select-facts.d.ts +0 -0
- /package/dist/internal/runtime/{plugins → plugin-loader}/plugin-frontmatter.d.ts +0 -0
- /package/dist/internal/{security/secret-redactor.d.ts → runtime/plugin-loader/plugins-manager.d.ts} +0 -0
- /package/dist/internal/runtime/{reasoning → system-prompt}/native-reasoning.d.ts +0 -0
- /package/dist/internal/{runtime/context/path-containment.d.ts → security/path-containment.d.cts} +0 -0
- /package/dist/internal/session/{session-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/{zod/to-json-schema.d.ts → zod-to-json-schema.d.ts} +0 -0
- /package/dist/subscription/internal/{adapter-types.d.cts → types.d.cts} +0 -0
- /package/dist/subscription/internal/{adapter-types.d.ts → types.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/errors-envelope.ts"],"names":["TheokitAgentError","RateLimitError","CredentialPoolExhaustedError","AuthenticationError","ConfigurationError","NetworkError","AgentRunError","UnknownAgentError"],"mappings":";;;;;;;AAoEA,IAAM,YAAA,uBAA0D,GAAA,CAA8B;AAAA,EAC5F,CAAC,uBAAuB,cAAc,CAAA;AAAA,EACtC,CAAC,kBAAkB,cAAc,CAAA;AAAA,EACjC,CAAC,sBAAsB,sBAAsB,CAAA;AAAA,EAC7C,CAAC,gCAAgC,sBAAsB,CAAA;AAAA,EACvD,CAAC,gBAAgB,qBAAqB,CAAA;AAAA,EACtC,CAAC,iBAAiB,iBAAiB,CAAA;AAAA,EACnC,CAAC,uBAAuB,iBAAiB,CAAA;AAAA,EACzC,CAAC,gCAAgC,2BAA2B,CAAA;AAAA,EAC5D,CAAC,qBAAqB,uBAAuB,CAAA;AAAA,EAC7C,CAAC,sBAAsB,uBAAuB;AAChD,CAAC,CAAA;AAiBM,SAAS,WAAW,KAAA,EAAsC;AAC/D,EAAA,IAAI,EAAE,iBAAiB,KAAA,CAAA,EAAQ;AAC7B,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,uBAAA;AAAA,MACN,OAAA,EAAS,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ;AAAA,KAC/C;AAAA,EACF;AACA,EAAA,MAAM,OAAO,KAAA,CAAM,IAAA;AACnB,EAAA,MAAM,IAAA,GAAO,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA,IAAK,uBAAA;AACvC,EAAA,MAAM,IAAA,GAAO,SAAA,CAAU,IAAA,EAAM,KAAK,CAAA;AAClC,EAAA,MAAM,GAAA,GAAM,SAAS,KAAK,CAAA;AAC1B,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,SAAS,KAAA,CAAM,OAAA;AAAA,IACf,OAAQ,KAAA,CAAsC,KAAA;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EAC9D;AAAA,IACE,cAAA;AAAA,IACA,CAAC,GAAA,KAAQ,IAAIF,gCAAA,CAAe,IAAI,OAAA,EAAS,GAAA,CAAI,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,EAAO,GAAA,CAAI,KAAA,EAAM,GAAI,EAAE;AAAA,GAC9F;AAAA,EACA,CAAC,wBAAwB,CAAC,GAAA,KAAQ,IAAIG,oCAAA,CAAmB,GAAA,CAAI,OAAO,CAAC,CAAA;AAAA,EACrE,CAAC,uBAAuB,CAAC,GAAA,KAAQ,IAAIC,8BAAA,CAAa,GAAA,CAAI,OAAO,CAAC,CAAA;AAAA,EAC9D,CAAC,mBAAmB,CAAC,GAAA,KAAQ,IAAIA,8BAAA,CAAa,GAAA,CAAI,OAAO,CAAC,CAAA;AAAA,EAC1D;AAAA,IACE,iBAAA;AAAA,IACA,CAAC,GAAA,KACC,IAAIC,+BAAA,CAAc,IAAI,OAAA,EAAS;AAAA,MAC7B,IAAA,EAAM,SAAA;AAAA,MACN,GAAI,IAAI,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,EAAO,GAAA,CAAI,KAAA,EAAM,GAAI;AAAC,KACvD;AAAA,GACL;AAAA,EACA,CAAC,yBAAyB,CAAC,GAAA,KAAQ,IAAIC,mCAAA,CAAkB,GAAA,CAAI,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,CAAC,CAAA;AASM,SAAS,aAAa,GAAA,EAA8C;AACzE,EAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,GAAA,CAAI,GAAA,CAAI,IAAI,CAAA;AACxD,EAAA,IAAI,aAAA,EAAe,OAAO,aAAA,CAAc,GAAG,CAAA;AAI3C,EAAA,OAAO,IAAIA,mCAAA,CAAkB,GAAA,CAAI,OAAO,CAAA;AAC1C","file":"errors-envelope.cjs","sourcesContent":["/**\n * G5 T2.2 boundary translation — `@theokit/sdk/server/errors-envelope`.\n *\n * Per plan g5-error-envelope-cross-layer v1.0 § Phase 2 / T2.2.\n * Blueprint ADR D3 — SDK keeps the 15+ Error class hierarchy internally;\n * `toEnvelope(err)` translates outward at the Agent.send -> RunResult egress\n * edge, `fromEnvelope(env)` reconstructs class identity on the inbound edge\n * (so consumer code can keep using `instanceof RateLimitError` patterns).\n *\n * Structurally-compatible envelope shape: identical fields to theokit/server\n * `TheoErrorEnvelope`. Re-declared locally to keep `@theokit/sdk` free of any\n * dependency on `theokit`. Consumer code that uses both packages gets the\n * same shape via duck-typing.\n */\n\nimport {\n AgentRunError,\n AuthenticationError,\n ConfigurationError,\n CredentialPoolExhaustedError,\n MemoryAdapterError,\n NetworkError,\n RateLimitError,\n TheokitAgentError,\n UnknownAgentError,\n} from \"../errors.js\";\n\n/**\n * Canonical envelope code union for cross-layer SDK boundary. Subset of the\n * full `TheoErrorCode` (theokit/server) covering codes the SDK actually emits.\n * Other layers (theokit/server, theokit/client, theokit/ui) handle the broader\n * union; the SDK never needs the HTTP-only codes (PRECONDITION_FAILED, etc.).\n *\n * @public\n */\nexport type TheokitErrorCode =\n | \"UNAUTHORIZED\"\n | \"RATE_LIMITED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"SERVICE_UNAVAILABLE\"\n | \"GATEWAY_TIMEOUT\"\n // SDK / agent-domain\n | \"AGENT_RUN_ERROR\"\n | \"PROVIDER_KEY_MISSING\"\n | \"BUDGET_EXCEEDED\"\n | \"CREDENTIAL_POOL_EXHAUSTED\";\n\n/**\n * Envelope shape — structurally identical to theokit/server `TheoErrorEnvelope`.\n *\n * @public\n */\nexport interface TheokitErrorEnvelope<TExt = unknown> {\n readonly code: TheokitErrorCode;\n readonly message: string;\n readonly cause?: unknown;\n readonly meta?: Record<string, unknown>;\n readonly ext?: TExt;\n}\n\n/**\n * Class-name -> envelope code mapping. Indexed by `Error.name` string so\n * subclasses inherit the mapping unless they override their `name` field.\n *\n * `IntegrationNotConnectedError` (subclass of `ConfigurationError`) takes\n * its own row because its `name` is `IntegrationNotConnectedError` and the\n * map is name-exact, not prototype-walked.\n */\nconst NAME_TO_CODE: ReadonlyMap<string, TheokitErrorCode> = new Map<string, TheokitErrorCode>([\n [\"AuthenticationError\", \"UNAUTHORIZED\"],\n [\"RateLimitError\", \"RATE_LIMITED\"],\n [\"ConfigurationError\", \"PROVIDER_KEY_MISSING\"],\n [\"IntegrationNotConnectedError\", \"PROVIDER_KEY_MISSING\"],\n [\"NetworkError\", \"SERVICE_UNAVAILABLE\"],\n [\"AgentRunError\", \"AGENT_RUN_ERROR\"],\n [\"BudgetExceededError\", \"BUDGET_EXCEEDED\"],\n [\"CredentialPoolExhaustedError\", \"CREDENTIAL_POOL_EXHAUSTED\"],\n [\"UnknownAgentError\", \"INTERNAL_SERVER_ERROR\"],\n [\"MemoryAdapterError\", \"INTERNAL_SERVER_ERROR\"],\n]);\n\n/**\n * Translate any SDK error (or arbitrary thrown value) into the canonical\n * envelope shape at the wire boundary.\n *\n * - `TheokitAgentError` family → mapped by `Error.name` string.\n * - Plain `Error` → INTERNAL_SERVER_ERROR.\n * - Non-Error values → INTERNAL_SERVER_ERROR with synthetic message.\n *\n * Meta carries `sdkErrorName` for telemetry; provider metadata (when present\n * via SDK's `ErrorMetadata`) flows through `meta.provider` / `meta.endpoint`\n * / `meta.statusCode` for diagnostics. `RateLimitError` populates a\n * `RetryableExt`-shaped ext when `metadata.retryAfter` (seconds) is set.\n *\n * @public\n */\nexport function toEnvelope(value: unknown): TheokitErrorEnvelope {\n if (!(value instanceof Error)) {\n return {\n code: \"INTERNAL_SERVER_ERROR\",\n message: typeof value === \"string\" ? value : \"Unknown error\",\n };\n }\n const name = value.name;\n const code = NAME_TO_CODE.get(name) ?? \"INTERNAL_SERVER_ERROR\";\n const meta = buildMeta(name, value);\n const ext = buildExt(value);\n return {\n code,\n message: value.message,\n cause: (value as Error & { cause?: unknown }).cause,\n meta,\n ext,\n };\n}\n\nfunction buildMeta(name: string, err: Error): Record<string, unknown> {\n const meta: Record<string, unknown> = { sdkErrorName: name };\n if (err instanceof TheokitAgentError && err.metadata !== undefined) {\n meta.provider = err.metadata.provider;\n meta.endpoint = err.metadata.endpoint;\n if (err.metadata.statusCode !== undefined) {\n meta.statusCode = err.metadata.statusCode;\n }\n }\n return meta;\n}\n\nfunction buildExt(err: Error): unknown {\n if (err instanceof RateLimitError && err.metadata?.retryAfter !== undefined) {\n return {\n retryable: true as const,\n retryAfterMs: err.metadata.retryAfter * 1000,\n };\n }\n if (err instanceof CredentialPoolExhaustedError && err.nextRetryAt !== undefined) {\n const delayMs = Math.max(0, err.nextRetryAt - Date.now());\n return {\n retryable: true as const,\n retryAfterMs: delayMs,\n };\n }\n return undefined;\n}\n\n/**\n * Code -> reconstructor mapping. Each entry returns a fresh instance of the\n * SDK class hierarchy from an envelope, preserving message and (where the\n * constructor supports it) cause/ext context.\n *\n * Unmapped codes fall through to `UnknownAgentError` so consumer code that\n * relies on `err instanceof TheokitAgentError` still works.\n */\nconst CODE_TO_RECONSTRUCTOR: ReadonlyMap<\n TheokitErrorCode,\n (env: TheokitErrorEnvelope) => TheokitAgentError\n> = new Map<TheokitErrorCode, (env: TheokitErrorEnvelope) => TheokitAgentError>([\n [\"UNAUTHORIZED\", (env) => new AuthenticationError(env.message)],\n [\n \"RATE_LIMITED\",\n (env) => new RateLimitError(env.message, env.cause !== undefined ? { cause: env.cause } : {}),\n ],\n [\"PROVIDER_KEY_MISSING\", (env) => new ConfigurationError(env.message)],\n [\"SERVICE_UNAVAILABLE\", (env) => new NetworkError(env.message)],\n [\"GATEWAY_TIMEOUT\", (env) => new NetworkError(env.message)],\n [\n \"AGENT_RUN_ERROR\",\n (env) =>\n new AgentRunError(env.message, {\n code: \"unknown\",\n ...(env.cause !== undefined ? { cause: env.cause } : {}),\n }),\n ],\n [\"INTERNAL_SERVER_ERROR\", (env) => new UnknownAgentError(env.message)],\n // BUDGET_EXCEEDED + CREDENTIAL_POOL_EXHAUSTED reconstructors require\n // domain-specific args (budgetName, provider) that the envelope doesn't\n // always carry. Fall back to UnknownAgentError when those fields are\n // missing; consumer code that needs the typed class should call the\n // constructor directly.\n]);\n\n/**\n * Hydrate an envelope back into the SDK class hierarchy. Use at the inbound\n * boundary (e.g., on a worker process receiving an envelope from the main\n * process via IPC, or on a client deserializing a `RunResult.error`).\n *\n * @public\n */\nexport function fromEnvelope(env: TheokitErrorEnvelope): TheokitAgentError {\n const reconstructor = CODE_TO_RECONSTRUCTOR.get(env.code);\n if (reconstructor) return reconstructor(env);\n // Round-trip preservation: if the envelope's meta.sdkErrorName matches a\n // class without a generic reconstructor (e.g., BudgetExceededError), we\n // can't rebuild without domain args. Fall back to UnknownAgentError.\n return new UnknownAgentError(env.message);\n}\n\n// Re-export for ergonomic consumption alongside fromEnvelope.\nexport { MemoryAdapterError };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/server/errors-envelope.ts"],"names":["TheokitAgentError","RateLimitError","CredentialPoolExhaustedError","AuthenticationError","ConfigurationError","NetworkError","AgentRunError","UnknownAgentError"],"mappings":";;;;;;AAoEA,IAAM,YAAA,uBAA0D,GAAA,CAA8B;AAAA,EAC5F,CAAC,uBAAuB,cAAc,CAAA;AAAA,EACtC,CAAC,kBAAkB,cAAc,CAAA;AAAA,EACjC,CAAC,sBAAsB,sBAAsB,CAAA;AAAA,EAC7C,CAAC,gCAAgC,sBAAsB,CAAA;AAAA,EACvD,CAAC,gBAAgB,qBAAqB,CAAA;AAAA,EACtC,CAAC,iBAAiB,iBAAiB,CAAA;AAAA,EACnC,CAAC,uBAAuB,iBAAiB,CAAA;AAAA,EACzC,CAAC,gCAAgC,2BAA2B,CAAA;AAAA,EAC5D,CAAC,qBAAqB,uBAAuB,CAAA;AAAA,EAC7C,CAAC,sBAAsB,uBAAuB;AAChD,CAAC,CAAA;AAiBM,SAAS,WAAW,KAAA,EAAsC;AAC/D,EAAA,IAAI,EAAE,iBAAiB,KAAA,CAAA,EAAQ;AAC7B,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,uBAAA;AAAA,MACN,OAAA,EAAS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C;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,CAAC,CAAA;AASM,SAAS,aAAa,GAAA,EAA8C;AACzE,EAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,GAAA,CAAI,GAAA,CAAI,IAAI,CAAA;AACxD,EAAA,IAAI,aAAA,EAAe,OAAO,aAAA,CAAc,GAAG,CAAA;AAI3C,EAAA,OAAO,IAAIA,mCAAA,CAAkB,GAAA,CAAI,OAAO,CAAA;AAC1C","file":"errors-envelope.cjs","sourcesContent":["/**\n * G5 T2.2 boundary translation — `@theokit/sdk/server/errors-envelope`.\n *\n * Per plan g5-error-envelope-cross-layer v1.0 § Phase 2 / T2.2.\n * Blueprint ADR D3 — SDK keeps the 15+ Error class hierarchy internally;\n * `toEnvelope(err)` translates outward at the Agent.send -> RunResult egress\n * edge, `fromEnvelope(env)` reconstructs class identity on the inbound edge\n * (so consumer code can keep using `instanceof RateLimitError` patterns).\n *\n * Structurally-compatible envelope shape: identical fields to theokit/server\n * `TheoErrorEnvelope`. Re-declared locally to keep `@theokit/sdk` free of any\n * dependency on `theokit`. Consumer code that uses both packages gets the\n * same shape via duck-typing.\n */\n\nimport {\n AgentRunError,\n AuthenticationError,\n ConfigurationError,\n CredentialPoolExhaustedError,\n MemoryAdapterError,\n NetworkError,\n RateLimitError,\n TheokitAgentError,\n UnknownAgentError,\n} from \"../errors.js\";\n\n/**\n * Canonical envelope code union for cross-layer SDK boundary. Subset of the\n * full `TheoErrorCode` (theokit/server) covering codes the SDK actually emits.\n * Other layers (theokit/server, theokit/client, theokit/ui) handle the broader\n * union; the SDK never needs the HTTP-only codes (PRECONDITION_FAILED, etc.).\n *\n * @public\n */\nexport type TheokitErrorCode =\n | \"UNAUTHORIZED\"\n | \"RATE_LIMITED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"SERVICE_UNAVAILABLE\"\n | \"GATEWAY_TIMEOUT\"\n // SDK / agent-domain\n | \"AGENT_RUN_ERROR\"\n | \"PROVIDER_KEY_MISSING\"\n | \"BUDGET_EXCEEDED\"\n | \"CREDENTIAL_POOL_EXHAUSTED\";\n\n/**\n * Envelope shape — structurally identical to theokit/server `TheoErrorEnvelope`.\n *\n * @public\n */\nexport interface TheokitErrorEnvelope<TExt = unknown> {\n readonly code: TheokitErrorCode;\n readonly message: string;\n readonly cause?: unknown;\n readonly meta?: Record<string, unknown>;\n readonly ext?: TExt;\n}\n\n/**\n * Class-name -> envelope code mapping. Indexed by `Error.name` string so\n * subclasses inherit the mapping unless they override their `name` field.\n *\n * `IntegrationNotConnectedError` (subclass of `ConfigurationError`) takes\n * its own row because its `name` is `IntegrationNotConnectedError` and the\n * map is name-exact, not prototype-walked.\n */\nconst NAME_TO_CODE: ReadonlyMap<string, TheokitErrorCode> = new Map<string, TheokitErrorCode>([\n [\"AuthenticationError\", \"UNAUTHORIZED\"],\n [\"RateLimitError\", \"RATE_LIMITED\"],\n [\"ConfigurationError\", \"PROVIDER_KEY_MISSING\"],\n [\"IntegrationNotConnectedError\", \"PROVIDER_KEY_MISSING\"],\n [\"NetworkError\", \"SERVICE_UNAVAILABLE\"],\n [\"AgentRunError\", \"AGENT_RUN_ERROR\"],\n [\"BudgetExceededError\", \"BUDGET_EXCEEDED\"],\n [\"CredentialPoolExhaustedError\", \"CREDENTIAL_POOL_EXHAUSTED\"],\n [\"UnknownAgentError\", \"INTERNAL_SERVER_ERROR\"],\n [\"MemoryAdapterError\", \"INTERNAL_SERVER_ERROR\"],\n]);\n\n/**\n * Translate any SDK error (or arbitrary thrown value) into the canonical\n * envelope shape at the wire boundary.\n *\n * - `TheokitAgentError` family → mapped by `Error.name` string.\n * - Plain `Error` → INTERNAL_SERVER_ERROR.\n * - Non-Error values → INTERNAL_SERVER_ERROR with synthetic message.\n *\n * Meta carries `sdkErrorName` for telemetry; provider metadata (when present\n * via SDK's `ErrorMetadata`) flows through `meta.provider` / `meta.endpoint`\n * / `meta.statusCode` for diagnostics. `RateLimitError` populates a\n * `RetryableExt`-shaped ext when `metadata.retryAfter` (seconds) is set.\n *\n * @public\n */\nexport function toEnvelope(value: unknown): TheokitErrorEnvelope {\n if (!(value instanceof Error)) {\n return {\n code: \"INTERNAL_SERVER_ERROR\",\n message: typeof value === \"string\" ? value : \"Unknown error\",\n };\n }\n const name = value.name;\n const code = NAME_TO_CODE.get(name) ?? \"INTERNAL_SERVER_ERROR\";\n const meta = buildMeta(name, value);\n const ext = buildExt(value);\n return {\n code,\n message: value.message,\n cause: (value as Error & { cause?: unknown }).cause,\n meta,\n ext,\n };\n}\n\nfunction buildMeta(name: string, err: Error): Record<string, unknown> {\n const meta: Record<string, unknown> = { sdkErrorName: name };\n if (err instanceof TheokitAgentError && err.metadata !== undefined) {\n meta.provider = err.metadata.provider;\n meta.endpoint = err.metadata.endpoint;\n if (err.metadata.statusCode !== undefined) {\n meta.statusCode = err.metadata.statusCode;\n }\n }\n return meta;\n}\n\nfunction buildExt(err: Error): unknown {\n if (err instanceof RateLimitError && err.metadata?.retryAfter !== undefined) {\n return {\n retryable: true as const,\n retryAfterMs: err.metadata.retryAfter * 1000,\n };\n }\n if (err instanceof CredentialPoolExhaustedError && err.nextRetryAt !== undefined) {\n const delayMs = Math.max(0, err.nextRetryAt - Date.now());\n return {\n retryable: true as const,\n retryAfterMs: delayMs,\n };\n }\n return undefined;\n}\n\n/**\n * Code -> reconstructor mapping. Each entry returns a fresh instance of the\n * SDK class hierarchy from an envelope, preserving message and (where the\n * constructor supports it) cause/ext context.\n *\n * Unmapped codes fall through to `UnknownAgentError` so consumer code that\n * relies on `err instanceof TheokitAgentError` still works.\n */\nconst CODE_TO_RECONSTRUCTOR: ReadonlyMap<\n TheokitErrorCode,\n (env: TheokitErrorEnvelope) => TheokitAgentError\n> = new Map<TheokitErrorCode, (env: TheokitErrorEnvelope) => TheokitAgentError>([\n [\"UNAUTHORIZED\", (env) => new AuthenticationError(env.message)],\n [\n \"RATE_LIMITED\",\n (env) => new RateLimitError(env.message, env.cause !== undefined ? { cause: env.cause } : {}),\n ],\n [\"PROVIDER_KEY_MISSING\", (env) => new ConfigurationError(env.message)],\n [\"SERVICE_UNAVAILABLE\", (env) => new NetworkError(env.message)],\n [\"GATEWAY_TIMEOUT\", (env) => new NetworkError(env.message)],\n [\n \"AGENT_RUN_ERROR\",\n (env) =>\n new AgentRunError(env.message, {\n code: \"unknown\",\n ...(env.cause !== undefined ? { cause: env.cause } : {}),\n }),\n ],\n [\"INTERNAL_SERVER_ERROR\", (env) => new UnknownAgentError(env.message)],\n // BUDGET_EXCEEDED + CREDENTIAL_POOL_EXHAUSTED reconstructors require\n // domain-specific args (budgetName, provider) that the envelope doesn't\n // always carry. Fall back to UnknownAgentError when those fields are\n // missing; consumer code that needs the typed class should call the\n // constructor directly.\n]);\n\n/**\n * Hydrate an envelope back into the SDK class hierarchy. Use at the inbound\n * boundary (e.g., on a worker process receiving an envelope from the main\n * process via IPC, or on a client deserializing a `RunResult.error`).\n *\n * @public\n */\nexport function fromEnvelope(env: TheokitErrorEnvelope): TheokitAgentError {\n const reconstructor = CODE_TO_RECONSTRUCTOR.get(env.code);\n if (reconstructor) return reconstructor(env);\n // Round-trip preservation: if the envelope's meta.sdkErrorName matches a\n // class without a generic reconstructor (e.g., BudgetExceededError), we\n // can't rebuild without domain args. Fall back to UnknownAgentError.\n return new UnknownAgentError(env.message);\n}\n\n// Re-export for ergonomic consumption alongside fromEnvelope.\nexport { MemoryAdapterError };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '../run-
|
|
1
|
+
export { M as MemoryAdapterError } from '../errors-DrDEgyz1.cjs';
|
|
2
|
+
import { T as TheokitAgentError } from '../errors-base-B5g01neU.cjs';
|
|
3
|
+
import '../run-CTAdRU3U.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import '../run-
|
|
1
|
+
export { M as MemoryAdapterError } from '../errors-CLOAyuiv.js';
|
|
2
|
+
import { T as TheokitAgentError } from '../errors-base-B5g01neU.js';
|
|
3
|
+
import '../run-CTAdRU3U.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { TheokitAgentError, RateLimitError, CredentialPoolExhaustedError, UnknownAgentError, AuthenticationError, ConfigurationError, NetworkError, AgentRunError } from '../chunk-
|
|
2
|
-
export { MemoryAdapterError } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-XEQ3TM66.js';
|
|
1
|
+
import { TheokitAgentError, RateLimitError, CredentialPoolExhaustedError, UnknownAgentError, AuthenticationError, ConfigurationError, NetworkError, AgentRunError } from '../chunk-ALUN2B4W.js';
|
|
2
|
+
export { MemoryAdapterError } from '../chunk-ALUN2B4W.js';
|
|
3
|
+
import '../chunk-CZJ6Q7CW.js';
|
|
5
4
|
|
|
6
5
|
// src/server/errors-envelope.ts
|
|
7
6
|
var NAME_TO_CODE = /* @__PURE__ */ new Map([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/server/errors-envelope.ts"],"names":[],"mappings":";;;;;;AAoEA,IAAM,YAAA,uBAA0D,GAAA,CAA8B;AAAA,EAC5F,CAAC,uBAAuB,cAAc,CAAA;AAAA,EACtC,CAAC,kBAAkB,cAAc,CAAA;AAAA,EACjC,CAAC,sBAAsB,sBAAsB,CAAA;AAAA,EAC7C,CAAC,gCAAgC,sBAAsB,CAAA;AAAA,EACvD,CAAC,gBAAgB,qBAAqB,CAAA;AAAA,EACtC,CAAC,iBAAiB,iBAAiB,CAAA;AAAA,EACnC,CAAC,uBAAuB,iBAAiB,CAAA;AAAA,EACzC,CAAC,gCAAgC,2BAA2B,CAAA;AAAA,EAC5D,CAAC,qBAAqB,uBAAuB,CAAA;AAAA,EAC7C,CAAC,sBAAsB,uBAAuB;AAChD,CAAC,CAAA;AAiBM,SAA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KAAA,EAAM,GAAI;AAAC,KACvD;AAAA,GACL;AAAA,EACA,CAAC,yBAAyB,CAAC,GAAA,KAAQ,IAAI,iBAAA,CAAkB,GAAA,CAAI,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,CAAC,CAAA;AASM,SAAS,aAAa,GAAA,EAA8C;AACzE,EAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,GAAA,CAAI,GAAA,CAAI,IAAI,CAAA;AACxD,EAAA,IAAI,aAAA,EAAe,OAAO,aAAA,CAAc,GAAG,CAAA;AAI3C,EAAA,OAAO,IAAI,iBAAA,CAAkB,GAAA,CAAI,OAAO,CAAA;AAC1C","file":"errors-envelope.js","sourcesContent":["/**\n * G5 T2.2 boundary translation — `@theokit/sdk/server/errors-envelope`.\n *\n * Per plan g5-error-envelope-cross-layer v1.0 § Phase 2 / T2.2.\n * Blueprint ADR D3 — SDK keeps the 15+ Error class hierarchy internally;\n * `toEnvelope(err)` translates outward at the Agent.send -> RunResult egress\n * edge, `fromEnvelope(env)` reconstructs class identity on the inbound edge\n * (so consumer code can keep using `instanceof RateLimitError` patterns).\n *\n * Structurally-compatible envelope shape: identical fields to theokit/server\n * `TheoErrorEnvelope`. Re-declared locally to keep `@theokit/sdk` free of any\n * dependency on `theokit`. Consumer code that uses both packages gets the\n * same shape via duck-typing.\n */\n\nimport {\n AgentRunError,\n AuthenticationError,\n ConfigurationError,\n CredentialPoolExhaustedError,\n MemoryAdapterError,\n NetworkError,\n RateLimitError,\n TheokitAgentError,\n UnknownAgentError,\n} from \"../errors.js\";\n\n/**\n * Canonical envelope code union for cross-layer SDK boundary. Subset of the\n * full `TheoErrorCode` (theokit/server) covering codes the SDK actually emits.\n * Other layers (theokit/server, theokit/client, theokit/ui) handle the broader\n * union; the SDK never needs the HTTP-only codes (PRECONDITION_FAILED, etc.).\n *\n * @public\n */\nexport type TheokitErrorCode =\n | \"UNAUTHORIZED\"\n | \"RATE_LIMITED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"SERVICE_UNAVAILABLE\"\n | \"GATEWAY_TIMEOUT\"\n // SDK / agent-domain\n | \"AGENT_RUN_ERROR\"\n | \"PROVIDER_KEY_MISSING\"\n | \"BUDGET_EXCEEDED\"\n | \"CREDENTIAL_POOL_EXHAUSTED\";\n\n/**\n * Envelope shape — structurally identical to theokit/server `TheoErrorEnvelope`.\n *\n * @public\n */\nexport interface TheokitErrorEnvelope<TExt = unknown> {\n readonly code: TheokitErrorCode;\n readonly message: string;\n readonly cause?: unknown;\n readonly meta?: Record<string, unknown>;\n readonly ext?: TExt;\n}\n\n/**\n * Class-name -> envelope code mapping. Indexed by `Error.name` string so\n * subclasses inherit the mapping unless they override their `name` field.\n *\n * `IntegrationNotConnectedError` (subclass of `ConfigurationError`) takes\n * its own row because its `name` is `IntegrationNotConnectedError` and the\n * map is name-exact, not prototype-walked.\n */\nconst NAME_TO_CODE: ReadonlyMap<string, TheokitErrorCode> = new Map<string, TheokitErrorCode>([\n [\"AuthenticationError\", \"UNAUTHORIZED\"],\n [\"RateLimitError\", \"RATE_LIMITED\"],\n [\"ConfigurationError\", \"PROVIDER_KEY_MISSING\"],\n [\"IntegrationNotConnectedError\", \"PROVIDER_KEY_MISSING\"],\n [\"NetworkError\", \"SERVICE_UNAVAILABLE\"],\n [\"AgentRunError\", \"AGENT_RUN_ERROR\"],\n [\"BudgetExceededError\", \"BUDGET_EXCEEDED\"],\n [\"CredentialPoolExhaustedError\", \"CREDENTIAL_POOL_EXHAUSTED\"],\n [\"UnknownAgentError\", \"INTERNAL_SERVER_ERROR\"],\n [\"MemoryAdapterError\", \"INTERNAL_SERVER_ERROR\"],\n]);\n\n/**\n * Translate any SDK error (or arbitrary thrown value) into the canonical\n * envelope shape at the wire boundary.\n *\n * - `TheokitAgentError` family → mapped by `Error.name` string.\n * - Plain `Error` → INTERNAL_SERVER_ERROR.\n * - Non-Error values → INTERNAL_SERVER_ERROR with synthetic message.\n *\n * Meta carries `sdkErrorName` for telemetry; provider metadata (when present\n * via SDK's `ErrorMetadata`) flows through `meta.provider` / `meta.endpoint`\n * / `meta.statusCode` for diagnostics. `RateLimitError` populates a\n * `RetryableExt`-shaped ext when `metadata.retryAfter` (seconds) is set.\n *\n * @public\n */\nexport function toEnvelope(value: unknown): TheokitErrorEnvelope {\n if (!(value instanceof Error)) {\n return {\n code: \"INTERNAL_SERVER_ERROR\",\n message: typeof value === \"string\" ? value : \"Unknown error\",\n };\n }\n const name = value.name;\n const code = NAME_TO_CODE.get(name) ?? \"INTERNAL_SERVER_ERROR\";\n const meta = buildMeta(name, value);\n const ext = buildExt(value);\n return {\n code,\n message: value.message,\n cause: (value as Error & { cause?: unknown }).cause,\n meta,\n ext,\n };\n}\n\nfunction buildMeta(name: string, err: Error): Record<string, unknown> {\n const meta: Record<string, unknown> = { sdkErrorName: name };\n if (err instanceof TheokitAgentError && err.metadata !== undefined) {\n meta.provider = err.metadata.provider;\n meta.endpoint = err.metadata.endpoint;\n if (err.metadata.statusCode !== undefined) {\n meta.statusCode = err.metadata.statusCode;\n }\n }\n return meta;\n}\n\nfunction buildExt(err: Error): unknown {\n if (err instanceof RateLimitError && err.metadata?.retryAfter !== undefined) {\n return {\n retryable: true as const,\n retryAfterMs: err.metadata.retryAfter * 1000,\n };\n }\n if (err instanceof CredentialPoolExhaustedError && err.nextRetryAt !== undefined) {\n const delayMs = Math.max(0, err.nextRetryAt - Date.now());\n return {\n retryable: true as const,\n retryAfterMs: delayMs,\n };\n }\n return undefined;\n}\n\n/**\n * Code -> reconstructor mapping. Each entry returns a fresh instance of the\n * SDK class hierarchy from an envelope, preserving message and (where the\n * constructor supports it) cause/ext context.\n *\n * Unmapped codes fall through to `UnknownAgentError` so consumer code that\n * relies on `err instanceof TheokitAgentError` still works.\n */\nconst CODE_TO_RECONSTRUCTOR: ReadonlyMap<\n TheokitErrorCode,\n (env: TheokitErrorEnvelope) => TheokitAgentError\n> = new Map<TheokitErrorCode, (env: TheokitErrorEnvelope) => TheokitAgentError>([\n [\"UNAUTHORIZED\", (env) => new AuthenticationError(env.message)],\n [\n \"RATE_LIMITED\",\n (env) => new RateLimitError(env.message, env.cause !== undefined ? { cause: env.cause } : {}),\n ],\n [\"PROVIDER_KEY_MISSING\", (env) => new ConfigurationError(env.message)],\n [\"SERVICE_UNAVAILABLE\", (env) => new NetworkError(env.message)],\n [\"GATEWAY_TIMEOUT\", (env) => new NetworkError(env.message)],\n [\n \"AGENT_RUN_ERROR\",\n (env) =>\n new AgentRunError(env.message, {\n code: \"unknown\",\n ...(env.cause !== undefined ? { cause: env.cause } : {}),\n }),\n ],\n [\"INTERNAL_SERVER_ERROR\", (env) => new UnknownAgentError(env.message)],\n // BUDGET_EXCEEDED + CREDENTIAL_POOL_EXHAUSTED reconstructors require\n // domain-specific args (budgetName, provider) that the envelope doesn't\n // always carry. Fall back to UnknownAgentError when those fields are\n // missing; consumer code that needs the typed class should call the\n // constructor directly.\n]);\n\n/**\n * Hydrate an envelope back into the SDK class hierarchy. Use at the inbound\n * boundary (e.g., on a worker process receiving an envelope from the main\n * process via IPC, or on a client deserializing a `RunResult.error`).\n *\n * @public\n */\nexport function fromEnvelope(env: TheokitErrorEnvelope): TheokitAgentError {\n const reconstructor = CODE_TO_RECONSTRUCTOR.get(env.code);\n if (reconstructor) return reconstructor(env);\n // Round-trip preservation: if the envelope's meta.sdkErrorName matches a\n // class without a generic reconstructor (e.g., BudgetExceededError), we\n // can't rebuild without domain args. Fall back to UnknownAgentError.\n return new UnknownAgentError(env.message);\n}\n\n// Re-export for ergonomic consumption alongside fromEnvelope.\nexport { MemoryAdapterError };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/server/errors-envelope.ts"],"names":[],"mappings":";;;;;AAoEA,IAAM,YAAA,uBAA0D,GAAA,CAA8B;AAAA,EAC5F,CAAC,uBAAuB,cAAc,CAAA;AAAA,EACtC,CAAC,kBAAkB,cAAc,CAAA;AAAA,EACjC,CAAC,sBAAsB,sBAAsB,CAAA;AAAA,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C,CAAA;AAAA,EAC9D,CAAC,mBAAmB,CAAC,GAAA,KAAQ,IAAI,YAAA,CAAa,GAAA,CAAI,OAAO,CAAC,CAAA;AAAA,EAC1D;AAAA,IACE,iBAAA;AAAA,IACA,CAAC,GAAA,KACC,IAAI,aAAA,CAAc,IAAI,OAAA,EAAS;AAAA,MAC7B,IAAA,EAAM,SAAA;AAAA,MACN,GAAI,IAAI,KAAA,KAAU,MAAA,GAAY,EAAE,KAAA,EAAO,GAAA,CAAI,KAAA,EAAM,GAAI;AAAC,KACvD;AAAA,GACL;AAAA,EACA,CAAC,yBAAyB,CAAC,GAAA,KAAQ,IAAI,iBAAA,CAAkB,GAAA,CAAI,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAMvE,CAAC,CAAA;AASM,SAAS,aAAa,GAAA,EAA8C;AACzE,EAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,GAAA,CAAI,GAAA,CAAI,IAAI,CAAA;AACxD,EAAA,IAAI,aAAA,EAAe,OAAO,aAAA,CAAc,GAAG,CAAA;AAI3C,EAAA,OAAO,IAAI,iBAAA,CAAkB,GAAA,CAAI,OAAO,CAAA;AAC1C","file":"errors-envelope.js","sourcesContent":["/**\n * G5 T2.2 boundary translation — `@theokit/sdk/server/errors-envelope`.\n *\n * Per plan g5-error-envelope-cross-layer v1.0 § Phase 2 / T2.2.\n * Blueprint ADR D3 — SDK keeps the 15+ Error class hierarchy internally;\n * `toEnvelope(err)` translates outward at the Agent.send -> RunResult egress\n * edge, `fromEnvelope(env)` reconstructs class identity on the inbound edge\n * (so consumer code can keep using `instanceof RateLimitError` patterns).\n *\n * Structurally-compatible envelope shape: identical fields to theokit/server\n * `TheoErrorEnvelope`. Re-declared locally to keep `@theokit/sdk` free of any\n * dependency on `theokit`. Consumer code that uses both packages gets the\n * same shape via duck-typing.\n */\n\nimport {\n AgentRunError,\n AuthenticationError,\n ConfigurationError,\n CredentialPoolExhaustedError,\n MemoryAdapterError,\n NetworkError,\n RateLimitError,\n TheokitAgentError,\n UnknownAgentError,\n} from \"../errors.js\";\n\n/**\n * Canonical envelope code union for cross-layer SDK boundary. Subset of the\n * full `TheoErrorCode` (theokit/server) covering codes the SDK actually emits.\n * Other layers (theokit/server, theokit/client, theokit/ui) handle the broader\n * union; the SDK never needs the HTTP-only codes (PRECONDITION_FAILED, etc.).\n *\n * @public\n */\nexport type TheokitErrorCode =\n | \"UNAUTHORIZED\"\n | \"RATE_LIMITED\"\n | \"INTERNAL_SERVER_ERROR\"\n | \"SERVICE_UNAVAILABLE\"\n | \"GATEWAY_TIMEOUT\"\n // SDK / agent-domain\n | \"AGENT_RUN_ERROR\"\n | \"PROVIDER_KEY_MISSING\"\n | \"BUDGET_EXCEEDED\"\n | \"CREDENTIAL_POOL_EXHAUSTED\";\n\n/**\n * Envelope shape — structurally identical to theokit/server `TheoErrorEnvelope`.\n *\n * @public\n */\nexport interface TheokitErrorEnvelope<TExt = unknown> {\n readonly code: TheokitErrorCode;\n readonly message: string;\n readonly cause?: unknown;\n readonly meta?: Record<string, unknown>;\n readonly ext?: TExt;\n}\n\n/**\n * Class-name -> envelope code mapping. Indexed by `Error.name` string so\n * subclasses inherit the mapping unless they override their `name` field.\n *\n * `IntegrationNotConnectedError` (subclass of `ConfigurationError`) takes\n * its own row because its `name` is `IntegrationNotConnectedError` and the\n * map is name-exact, not prototype-walked.\n */\nconst NAME_TO_CODE: ReadonlyMap<string, TheokitErrorCode> = new Map<string, TheokitErrorCode>([\n [\"AuthenticationError\", \"UNAUTHORIZED\"],\n [\"RateLimitError\", \"RATE_LIMITED\"],\n [\"ConfigurationError\", \"PROVIDER_KEY_MISSING\"],\n [\"IntegrationNotConnectedError\", \"PROVIDER_KEY_MISSING\"],\n [\"NetworkError\", \"SERVICE_UNAVAILABLE\"],\n [\"AgentRunError\", \"AGENT_RUN_ERROR\"],\n [\"BudgetExceededError\", \"BUDGET_EXCEEDED\"],\n [\"CredentialPoolExhaustedError\", \"CREDENTIAL_POOL_EXHAUSTED\"],\n [\"UnknownAgentError\", \"INTERNAL_SERVER_ERROR\"],\n [\"MemoryAdapterError\", \"INTERNAL_SERVER_ERROR\"],\n]);\n\n/**\n * Translate any SDK error (or arbitrary thrown value) into the canonical\n * envelope shape at the wire boundary.\n *\n * - `TheokitAgentError` family → mapped by `Error.name` string.\n * - Plain `Error` → INTERNAL_SERVER_ERROR.\n * - Non-Error values → INTERNAL_SERVER_ERROR with synthetic message.\n *\n * Meta carries `sdkErrorName` for telemetry; provider metadata (when present\n * via SDK's `ErrorMetadata`) flows through `meta.provider` / `meta.endpoint`\n * / `meta.statusCode` for diagnostics. `RateLimitError` populates a\n * `RetryableExt`-shaped ext when `metadata.retryAfter` (seconds) is set.\n *\n * @public\n */\nexport function toEnvelope(value: unknown): TheokitErrorEnvelope {\n if (!(value instanceof Error)) {\n return {\n code: \"INTERNAL_SERVER_ERROR\",\n message: typeof value === \"string\" ? value : \"Unknown error\",\n };\n }\n const name = value.name;\n const code = NAME_TO_CODE.get(name) ?? \"INTERNAL_SERVER_ERROR\";\n const meta = buildMeta(name, value);\n const ext = buildExt(value);\n return {\n code,\n message: value.message,\n cause: (value as Error & { cause?: unknown }).cause,\n meta,\n ext,\n };\n}\n\nfunction buildMeta(name: string, err: Error): Record<string, unknown> {\n const meta: Record<string, unknown> = { sdkErrorName: name };\n if (err instanceof TheokitAgentError && err.metadata !== undefined) {\n meta.provider = err.metadata.provider;\n meta.endpoint = err.metadata.endpoint;\n if (err.metadata.statusCode !== undefined) {\n meta.statusCode = err.metadata.statusCode;\n }\n }\n return meta;\n}\n\nfunction buildExt(err: Error): unknown {\n if (err instanceof RateLimitError && err.metadata?.retryAfter !== undefined) {\n return {\n retryable: true as const,\n retryAfterMs: err.metadata.retryAfter * 1000,\n };\n }\n if (err instanceof CredentialPoolExhaustedError && err.nextRetryAt !== undefined) {\n const delayMs = Math.max(0, err.nextRetryAt - Date.now());\n return {\n retryable: true as const,\n retryAfterMs: delayMs,\n };\n }\n return undefined;\n}\n\n/**\n * Code -> reconstructor mapping. Each entry returns a fresh instance of the\n * SDK class hierarchy from an envelope, preserving message and (where the\n * constructor supports it) cause/ext context.\n *\n * Unmapped codes fall through to `UnknownAgentError` so consumer code that\n * relies on `err instanceof TheokitAgentError` still works.\n */\nconst CODE_TO_RECONSTRUCTOR: ReadonlyMap<\n TheokitErrorCode,\n (env: TheokitErrorEnvelope) => TheokitAgentError\n> = new Map<TheokitErrorCode, (env: TheokitErrorEnvelope) => TheokitAgentError>([\n [\"UNAUTHORIZED\", (env) => new AuthenticationError(env.message)],\n [\n \"RATE_LIMITED\",\n (env) => new RateLimitError(env.message, env.cause !== undefined ? { cause: env.cause } : {}),\n ],\n [\"PROVIDER_KEY_MISSING\", (env) => new ConfigurationError(env.message)],\n [\"SERVICE_UNAVAILABLE\", (env) => new NetworkError(env.message)],\n [\"GATEWAY_TIMEOUT\", (env) => new NetworkError(env.message)],\n [\n \"AGENT_RUN_ERROR\",\n (env) =>\n new AgentRunError(env.message, {\n code: \"unknown\",\n ...(env.cause !== undefined ? { cause: env.cause } : {}),\n }),\n ],\n [\"INTERNAL_SERVER_ERROR\", (env) => new UnknownAgentError(env.message)],\n // BUDGET_EXCEEDED + CREDENTIAL_POOL_EXHAUSTED reconstructors require\n // domain-specific args (budgetName, provider) that the envelope doesn't\n // always carry. Fall back to UnknownAgentError when those fields are\n // missing; consumer code that needs the typed class should call the\n // constructor directly.\n]);\n\n/**\n * Hydrate an envelope back into the SDK class hierarchy. Use at the inbound\n * boundary (e.g., on a worker process receiving an envelope from the main\n * process via IPC, or on a client deserializing a `RunResult.error`).\n *\n * @public\n */\nexport function fromEnvelope(env: TheokitErrorEnvelope): TheokitAgentError {\n const reconstructor = CODE_TO_RECONSTRUCTOR.get(env.code);\n if (reconstructor) return reconstructor(env);\n // Round-trip preservation: if the envelope's meta.sdkErrorName matches a\n // class without a generic reconstructor (e.g., BudgetExceededError), we\n // can't rebuild without domain args. Fall back to UnknownAgentError.\n return new UnknownAgentError(env.message);\n}\n\n// Re-export for ergonomic consumption alongside fromEnvelope.\nexport { MemoryAdapterError };\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.cjs');
|
|
4
|
+
require('./chunk-JLRLCBJ4.cjs');
|
|
5
|
+
require('./chunk-6LHQPOMI.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "SessionTranscript", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkGZV6AVRL_cjs.SessionTranscript; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "defaultBaseDir", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkGZV6AVRL_cjs.defaultBaseDir; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "encodeProjectDir", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkGZV6AVRL_cjs.encodeProjectDir; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "expandTilde", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkGZV6AVRL_cjs.expandTilde; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "isSessionUuid", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkGZV6AVRL_cjs.isSessionUuid; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "legacyTranscriptPath", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkGZV6AVRL_cjs.legacyTranscriptPath; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "readTranscript", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkGZV6AVRL_cjs.readTranscript; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "reconstructMessages", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkGZV6AVRL_cjs.reconstructMessages; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "safeSessionId", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkGZV6AVRL_cjs.safeSessionId; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "sessionUuidFor", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkGZV6AVRL_cjs.sessionUuidFor; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "transcriptPath", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkGZV6AVRL_cjs.transcriptPath; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "transcriptRoot", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkGZV6AVRL_cjs.transcriptRoot; }
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "writeTranscript", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return chunkGZV6AVRL_cjs.writeTranscript; }
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=session-transcript-LGHSNVY5.cjs.map
|
|
62
|
+
//# sourceMappingURL=session-transcript-LGHSNVY5.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-LGHSNVY5.cjs"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { SessionTranscript, defaultBaseDir, encodeProjectDir, expandTilde, isSessionUuid, legacyTranscriptPath, readTranscript, reconstructMessages, safeSessionId, sessionUuidFor, transcriptPath, transcriptRoot, writeTranscript } from './chunk-JOFVLOFY.js';
|
|
2
|
+
import './chunk-3JHIFQ4I.js';
|
|
3
|
+
import './chunk-CZJ6Q7CW.js';
|
|
4
|
+
//# sourceMappingURL=session-transcript-VTBTCGQX.js.map
|
|
5
|
+
//# sourceMappingURL=session-transcript-VTBTCGQX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"session-transcript-VTBTCGQX.js"}
|
package/dist/skills.cjs
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-EG4QM7ZJ.cjs');
|
|
3
|
+
var chunkUGRS7ZA7_cjs = require('./chunk-UGRS7ZA7.cjs');
|
|
4
|
+
require('./chunk-7A6535RA.cjs');
|
|
5
|
+
require('./chunk-SA6K24NB.cjs');
|
|
6
|
+
require('./chunk-HW7SEELD.cjs');
|
|
7
|
+
require('./chunk-J7J7J2GN.cjs');
|
|
8
|
+
require('./chunk-6LHQPOMI.cjs');
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
Object.defineProperty(exports, "buildSkillsBlock", {
|
|
14
13
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkUGRS7ZA7_cjs.buildSkillsBlock; }
|
|
16
15
|
});
|
|
17
16
|
Object.defineProperty(exports, "discoverSkills", {
|
|
18
17
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkUGRS7ZA7_cjs.discoverSkills; }
|
|
20
19
|
});
|
|
21
20
|
//# sourceMappingURL=skills.cjs.map
|
|
22
21
|
//# sourceMappingURL=skills.cjs.map
|
package/dist/skills.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { buildSkillsBlock, discoverSkills } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-XEQ3TM66.js';
|
|
1
|
+
export { buildSkillsBlock, discoverSkills } from './chunk-XDANGA2C.js';
|
|
2
|
+
import './chunk-EH6XD3FY.js';
|
|
3
|
+
import './chunk-UKMBRMGT.js';
|
|
4
|
+
import './chunk-JNAA4G4H.js';
|
|
5
|
+
import './chunk-ALUN2B4W.js';
|
|
6
|
+
import './chunk-CZJ6Q7CW.js';
|
|
8
7
|
//# sourceMappingURL=skills.js.map
|
|
9
8
|
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { StreamObjectError, streamObjectImpl } from './chunk-5WKQDIGO.js';
|
|
2
|
+
import './chunk-47TF32NQ.js';
|
|
3
|
+
import './chunk-7I5Z3UBJ.js';
|
|
4
|
+
import './chunk-ALUN2B4W.js';
|
|
5
|
+
import './chunk-CZJ6Q7CW.js';
|
|
6
|
+
//# sourceMappingURL=stream-object-HBFMIZLD.js.map
|
|
7
|
+
//# sourceMappingURL=stream-object-HBFMIZLD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-HBFMIZLD.js"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTFG5IBZS_cjs = require('./chunk-TFG5IBZS.cjs');
|
|
4
|
+
require('./chunk-7JJ3A6AT.cjs');
|
|
5
|
+
require('./chunk-AA27GEYS.cjs');
|
|
6
|
+
require('./chunk-J7J7J2GN.cjs');
|
|
7
|
+
require('./chunk-6LHQPOMI.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "StreamObjectError", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkTFG5IBZS_cjs.StreamObjectError; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "streamObjectImpl", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkTFG5IBZS_cjs.streamObjectImpl; }
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=stream-object-QSKHISDJ.cjs.map
|
|
20
|
+
//# sourceMappingURL=stream-object-QSKHISDJ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"stream-object-QSKHISDJ.cjs"}
|
package/dist/stream-object.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ZodType } from "zod";
|
|
2
|
+
import { StructuredOutputError } from "./errors.js";
|
|
2
3
|
import type { LocalOptions, ModelSelection } from "./types/agent.js";
|
|
3
4
|
import type { ProviderRoutingSettings } from "./types/providers.js";
|
|
4
5
|
/**
|
|
@@ -67,9 +68,6 @@ export type StreamObjectEvent<T> = {
|
|
|
67
68
|
*
|
|
68
69
|
* @public
|
|
69
70
|
*/
|
|
70
|
-
export declare class StreamObjectError extends
|
|
71
|
+
export declare class StreamObjectError extends StructuredOutputError {
|
|
71
72
|
readonly name = "StreamObjectError";
|
|
72
|
-
readonly code: "no_tool_call" | "parse_failed";
|
|
73
|
-
readonly cause?: unknown;
|
|
74
|
-
constructor(code: "no_tool_call" | "parse_failed", message: string, cause?: unknown);
|
|
75
73
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkSYVWE64W_cjs = require('./chunk-SYVWE64W.cjs');
|
|
4
|
+
require('./chunk-GGZ5GPE3.cjs');
|
|
5
|
+
require('./chunk-HW7SEELD.cjs');
|
|
6
|
+
require('./chunk-J7J7J2GN.cjs');
|
|
7
|
+
require('./chunk-6LHQPOMI.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
Object.defineProperty(exports, "loadSubagents", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkSYVWE64W_cjs.loadSubagents; }
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=subagents-loader-TPZLTXYZ.cjs.map
|
|
16
|
+
//# sourceMappingURL=subagents-loader-TPZLTXYZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-TPZLTXYZ.cjs"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { loadSubagents } from './chunk-4S5TWFIZ.js';
|
|
2
|
+
import './chunk-67ADYSTW.js';
|
|
3
|
+
import './chunk-JNAA4G4H.js';
|
|
4
|
+
import './chunk-ALUN2B4W.js';
|
|
5
|
+
import './chunk-CZJ6Q7CW.js';
|
|
6
|
+
//# sourceMappingURL=subagents-loader-Y6JFYXAY.js.map
|
|
7
|
+
//# sourceMappingURL=subagents-loader-Y6JFYXAY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-Y6JFYXAY.js"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-EG4QM7ZJ.cjs');
|
|
3
|
+
var chunkSYVWE64W_cjs = require('./chunk-SYVWE64W.cjs');
|
|
4
|
+
require('./chunk-GGZ5GPE3.cjs');
|
|
5
|
+
require('./chunk-HW7SEELD.cjs');
|
|
6
|
+
var chunkJ7J7J2GN_cjs = require('./chunk-J7J7J2GN.cjs');
|
|
7
|
+
require('./chunk-6LHQPOMI.cjs');
|
|
9
8
|
|
|
10
9
|
// src/subagents-loader.ts
|
|
11
10
|
var ACCEPTED_SOURCES = ["project"];
|
|
@@ -14,7 +13,7 @@ function resolveSources(options) {
|
|
|
14
13
|
if (declared === void 0) return ACCEPTED_SOURCES;
|
|
15
14
|
for (const source of declared) {
|
|
16
15
|
if (!ACCEPTED_SOURCES.includes(source)) {
|
|
17
|
-
throw new
|
|
16
|
+
throw new chunkJ7J7J2GN_cjs.ConfigurationError(
|
|
18
17
|
`Unknown subagent setting source "${String(source)}" (accepted: ${ACCEPTED_SOURCES.join(", ")})`,
|
|
19
18
|
{ code: "subagent_unknown_setting_source" }
|
|
20
19
|
);
|
|
@@ -24,7 +23,7 @@ function resolveSources(options) {
|
|
|
24
23
|
}
|
|
25
24
|
async function discoverSubagents(cwd, options) {
|
|
26
25
|
const sources = resolveSources(options);
|
|
27
|
-
return
|
|
26
|
+
return chunkSYVWE64W_cjs.loadSubagents(cwd, sources.includes("project"), void 0);
|
|
28
27
|
}
|
|
29
28
|
async function loadSubagentDefinition(name, cwd, options) {
|
|
30
29
|
return (await discoverSubagents(cwd, options))[name];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/subagents-loader.ts"],"names":["ConfigurationError","loadSubagents"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/subagents-loader.ts"],"names":["ConfigurationError","loadSubagents"],"mappings":";;;;;;;;;AAyCA,IAAM,gBAAA,GAA8C,CAAC,SAAS,CAAA;AAgB9D,SAAS,eAAe,OAAA,EAA0E;AAChG,EAAA,MAAM,WAAW,OAAA,EAAS,cAAA;AAC1B,EAAA,IAAI,QAAA,KAAa,QAAW,OAAO,gBAAA;AACnC,EAAA,KAAA,MAAW,UAAU,QAAA,EAAU;AAC7B,IAAA,IAAI,CAAC,gBAAA,CAAiB,QAAA,CAAS,MAAM,CAAA,EAAG;AACtC,MAAA,MAAM,IAAIA,oCAAA;AAAA,QACR,CAAA,iCAAA,EAAoC,OAAO,MAAM,CAAC,gBAAgB,gBAAA,CAAiB,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AAAA,QAC7F,EAAE,MAAM,iCAAA;AAAkC,OAC5C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,QAAA;AACT;AAOA,eAAsB,iBAAA,CACpB,KACA,OAAA,EAC0C;AAC1C,EAAA,MAAM,OAAA,GAAU,eAAe,OAAO,CAAA;AACtC,EAAA,OAAOC,gCAAc,GAAA,EAAK,OAAA,CAAQ,QAAA,CAAS,SAAS,GAAG,MAAS,CAAA;AAClE;AAQA,eAAsB,sBAAA,CACpB,IAAA,EACA,GAAA,EACA,OAAA,EACsC;AACtC,EAAA,OAAA,CAAQ,MAAM,iBAAA,CAAkB,GAAA,EAAK,OAAO,GAAG,IAAI,CAAA;AACrD","file":"subagents-loader.cjs","sourcesContent":["/**\n * Published as `@theokit/sdk/subagents-loader`.\n *\n * M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent\n * definitions with one import instead of hand-rolling a second parser.\n *\n * ## Why this file exists\n *\n * `src/skills.ts` already exposed `discoverSkills` for the sibling domain. Subagents had the same\n * loader — `internal/runtime/skills/subagents-loader.ts` — with no public door. A consumer behind\n * the layer boundary (the agent-builder never imports `@theokit/sdk*` directly) could not reach it,\n * so re-implementing was the only legal option. It re-implemented, and then wrote a test whose only\n * job was to watch the two parsers for drift. That test is the cleanest possible evidence that the\n * duplication should not exist.\n *\n * ## What crosses is the PARSED config\n *\n * The return is `AgentDefinition` — already interpreted — never the `.md` text or the frontmatter\n * shape. Exporting the file format would freeze an internal detail as public API; exporting the\n * parsed value leaves the format free to change.\n */\n\nimport { ConfigurationError } from \"./errors.js\";\nimport { loadSubagents } from \"./internal/runtime/skills/subagents-loader.js\";\nimport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * The parsed subagent definition this module hands back.\n *\n * Re-exported here — beside the loader that produces it — so a consumer can NAME the value it\n * receives without reaching into `types/agent`, which no subpath publishes. A layer above may then\n * alias it (`AgentDefinition as SubagentDefinition`) to sidestep a name it has already spent.\n */\nexport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * Where subagent definitions may be read from. A closed union rather than a boolean: a third\n * source can join it without breaking the signature, and the call site reads as what it means.\n */\nexport type SubagentSource = \"project\";\n\nconst ACCEPTED_SOURCES: readonly SubagentSource[] = [\"project\"];\n\n/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */\nexport interface DiscoverSubagentsOptions {\n /**\n * Which sources to read. Defaults to `[\"project\"]` — `<cwd>/.theokit/agents/*.md`.\n *\n * An empty list reads NOTHING: the directory is never opened, so a caller that has not yet\n * established trust in `cwd` can decline the read rather than filter its result.\n */\n readonly settingSources?: readonly SubagentSource[];\n}\n\n// Validated at the boundary (error-handling.md § 2): the union is erased at runtime, so a JS\n// caller — or a value crossing a serialization hop — can still carry a source nobody honors.\n// Dropping it silently would read as \"no subagents found\", which is the same shape as success.\nfunction resolveSources(options: DiscoverSubagentsOptions | undefined): readonly SubagentSource[] {\n const declared = options?.settingSources;\n if (declared === undefined) return ACCEPTED_SOURCES;\n for (const source of declared) {\n if (!ACCEPTED_SOURCES.includes(source)) {\n throw new ConfigurationError(\n `Unknown subagent setting source \"${String(source)}\" (accepted: ${ACCEPTED_SOURCES.join(\", \")})`,\n { code: \"subagent_unknown_setting_source\" },\n );\n }\n }\n return declared;\n}\n\n/**\n * Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.\n *\n * An absent directory yields `{}` — a project without subagents is the common case, not an error.\n */\nexport async function discoverSubagents(\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<Record<string, AgentDefinition>> {\n const sources = resolveSources(options);\n return loadSubagents(cwd, sources.includes(\"project\"), undefined);\n}\n\n/**\n * Load ONE subagent definition by name, or `undefined` when it is not defined on disk.\n *\n * A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the\n * whole point of this module.\n */\nexport async function loadSubagentDefinition(\n name: string,\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<AgentDefinition | undefined> {\n return (await discoverSubagents(cwd, options))[name];\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
3
|
-
import './run-
|
|
1
|
+
import { a as AgentDefinition } from './agent-C3KO5LKm.cjs';
|
|
2
|
+
import './sdk-agent-BOiKqOgL.cjs';
|
|
3
|
+
import './run-CTAdRU3U.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* Published as `@theokit/sdk/subagents-loader`.
|
|
8
|
+
*
|
|
7
9
|
* M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent
|
|
8
10
|
* definitions with one import instead of hand-rolling a second parser.
|
|
9
11
|
*
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { a as AgentDefinition } from './agent-
|
|
2
|
-
import './sdk-agent-
|
|
3
|
-
import './run-
|
|
1
|
+
import { a as AgentDefinition } from './agent-CvmTR9uf.js';
|
|
2
|
+
import './sdk-agent-D4a_BR_6.js';
|
|
3
|
+
import './run-CTAdRU3U.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* Published as `@theokit/sdk/subagents-loader`.
|
|
8
|
+
*
|
|
7
9
|
* M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent
|
|
8
10
|
* definitions with one import instead of hand-rolling a second parser.
|
|
9
11
|
*
|
package/dist/subagents-loader.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { loadSubagents } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
4
|
-
import { ConfigurationError } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-XEQ3TM66.js';
|
|
1
|
+
import { loadSubagents } from './chunk-4S5TWFIZ.js';
|
|
2
|
+
import './chunk-67ADYSTW.js';
|
|
3
|
+
import './chunk-JNAA4G4H.js';
|
|
4
|
+
import { ConfigurationError } from './chunk-ALUN2B4W.js';
|
|
5
|
+
import './chunk-CZJ6Q7CW.js';
|
|
7
6
|
|
|
8
7
|
// src/subagents-loader.ts
|
|
9
8
|
var ACCEPTED_SOURCES = ["project"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/subagents-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/subagents-loader.ts"],"names":[],"mappings":";;;;;;;AAyCA,IAAM,gBAAA,GAA8C,CAAC,SAAS,CAAA;AAgB9D,SAAS,eAAe,OAAA,EAA0E;AAChG,EAAA,MAAM,WAAW,OAAA,EAAS,cAAA;AAC1B,EAAA,IAAI,QAAA,KAAa,QAAW,OAAO,gBAAA;AACnC,EAAA,KAAA,MAAW,UAAU,QAAA,EAAU;AAC7B,IAAA,IAAI,CAAC,gBAAA,CAAiB,QAAA,CAAS,MAAM,CAAA,EAAG;AACtC,MAAA,MAAM,IAAI,kBAAA;AAAA,QACR,CAAA,iCAAA,EAAoC,OAAO,MAAM,CAAC,gBAAgB,gBAAA,CAAiB,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA,CAAA;AAAA,QAC7F,EAAE,MAAM,iCAAA;AAAkC,OAC5C;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,QAAA;AACT;AAOA,eAAsB,iBAAA,CACpB,KACA,OAAA,EAC0C;AAC1C,EAAA,MAAM,OAAA,GAAU,eAAe,OAAO,CAAA;AACtC,EAAA,OAAO,cAAc,GAAA,EAAK,OAAA,CAAQ,QAAA,CAAS,SAAS,GAAG,MAAS,CAAA;AAClE;AAQA,eAAsB,sBAAA,CACpB,IAAA,EACA,GAAA,EACA,OAAA,EACsC;AACtC,EAAA,OAAA,CAAQ,MAAM,iBAAA,CAAkB,GAAA,EAAK,OAAO,GAAG,IAAI,CAAA;AACrD","file":"subagents-loader.js","sourcesContent":["/**\n * Published as `@theokit/sdk/subagents-loader`.\n *\n * M81 — `.theokit/agents` discovery, exposed so a consumer can read the on-disk subagent\n * definitions with one import instead of hand-rolling a second parser.\n *\n * ## Why this file exists\n *\n * `src/skills.ts` already exposed `discoverSkills` for the sibling domain. Subagents had the same\n * loader — `internal/runtime/skills/subagents-loader.ts` — with no public door. A consumer behind\n * the layer boundary (the agent-builder never imports `@theokit/sdk*` directly) could not reach it,\n * so re-implementing was the only legal option. It re-implemented, and then wrote a test whose only\n * job was to watch the two parsers for drift. That test is the cleanest possible evidence that the\n * duplication should not exist.\n *\n * ## What crosses is the PARSED config\n *\n * The return is `AgentDefinition` — already interpreted — never the `.md` text or the frontmatter\n * shape. Exporting the file format would freeze an internal detail as public API; exporting the\n * parsed value leaves the format free to change.\n */\n\nimport { ConfigurationError } from \"./errors.js\";\nimport { loadSubagents } from \"./internal/runtime/skills/subagents-loader.js\";\nimport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * The parsed subagent definition this module hands back.\n *\n * Re-exported here — beside the loader that produces it — so a consumer can NAME the value it\n * receives without reaching into `types/agent`, which no subpath publishes. A layer above may then\n * alias it (`AgentDefinition as SubagentDefinition`) to sidestep a name it has already spent.\n */\nexport type { AgentDefinition } from \"./types/agent.js\";\n\n/**\n * Where subagent definitions may be read from. A closed union rather than a boolean: a third\n * source can join it without breaking the signature, and the call site reads as what it means.\n */\nexport type SubagentSource = \"project\";\n\nconst ACCEPTED_SOURCES: readonly SubagentSource[] = [\"project\"];\n\n/** Options for {@link discoverSubagents} / {@link loadSubagentDefinition}. */\nexport interface DiscoverSubagentsOptions {\n /**\n * Which sources to read. Defaults to `[\"project\"]` — `<cwd>/.theokit/agents/*.md`.\n *\n * An empty list reads NOTHING: the directory is never opened, so a caller that has not yet\n * established trust in `cwd` can decline the read rather than filter its result.\n */\n readonly settingSources?: readonly SubagentSource[];\n}\n\n// Validated at the boundary (error-handling.md § 2): the union is erased at runtime, so a JS\n// caller — or a value crossing a serialization hop — can still carry a source nobody honors.\n// Dropping it silently would read as \"no subagents found\", which is the same shape as success.\nfunction resolveSources(options: DiscoverSubagentsOptions | undefined): readonly SubagentSource[] {\n const declared = options?.settingSources;\n if (declared === undefined) return ACCEPTED_SOURCES;\n for (const source of declared) {\n if (!ACCEPTED_SOURCES.includes(source)) {\n throw new ConfigurationError(\n `Unknown subagent setting source \"${String(source)}\" (accepted: ${ACCEPTED_SOURCES.join(\", \")})`,\n { code: \"subagent_unknown_setting_source\" },\n );\n }\n }\n return declared;\n}\n\n/**\n * Discover the subagents defined under `<cwd>/.theokit/agents/*.md`.\n *\n * An absent directory yields `{}` — a project without subagents is the common case, not an error.\n */\nexport async function discoverSubagents(\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<Record<string, AgentDefinition>> {\n const sources = resolveSources(options);\n return loadSubagents(cwd, sources.includes(\"project\"), undefined);\n}\n\n/**\n * Load ONE subagent definition by name, or `undefined` when it is not defined on disk.\n *\n * A thin selector over {@link discoverSubagents} rather than a second reader: one parser is the\n * whole point of this module.\n */\nexport async function loadSubagentDefinition(\n name: string,\n cwd: string,\n options?: DiscoverSubagentsOptions,\n): Promise<AgentDefinition | undefined> {\n return (await discoverSubagents(cwd, options))[name];\n}\n"]}
|
package/dist/subagents.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIJ7M6GOG_cjs = require('./chunk-IJ7M6GOG.cjs');
|
|
4
4
|
|
|
5
5
|
// src/internal/runtime/skills/subagent-tool-scope.ts
|
|
6
6
|
function subagentToolWhitelist(definition) {
|
|
@@ -9,7 +9,7 @@ function subagentToolWhitelist(definition) {
|
|
|
9
9
|
}
|
|
10
10
|
function withSubagentToolScope(definition, fn) {
|
|
11
11
|
const whitelist = subagentToolWhitelist(definition);
|
|
12
|
-
return whitelist ?
|
|
12
|
+
return whitelist ? chunkIJ7M6GOG_cjs.withToolWhitelist(whitelist, fn) : fn();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
exports.subagentToolWhitelist = subagentToolWhitelist;
|
package/dist/subagents.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/runtime/skills/subagent-tool-scope.ts"],"names":["withToolWhitelist"],"mappings":";;;;;AAYO,SAAS,sBAAsB,UAAA,EAAsD;AAC1F,EAAA,MAAM,EAAE,OAAM,GAAI,UAAA;AAClB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,SAAS,CAAA,GAAI,IAAI,GAAA,CAAI,KAAK,CAAA,GAAI,MAAA;AACrE;AAeO,SAAS,qBAAA,CACd,YACA,EAAA,EACY;AACZ,EAAA,MAAM,SAAA,GAAY,sBAAsB,UAAU,CAAA;AAClD,EAAA,OAAO,SAAA,GAAYA,mCAAA,CAAkB,SAAA,EAAW,EAAE,IAAI,EAAA,EAAG;AAC3D","file":"subagents.cjs","sourcesContent":["import type { AgentDefinition } from \"../../../types/agent.js\";\nimport { withToolWhitelist } from \"
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/skills/subagent-tool-scope.ts"],"names":["withToolWhitelist"],"mappings":";;;;;AAYO,SAAS,sBAAsB,UAAA,EAAsD;AAC1F,EAAA,MAAM,EAAE,OAAM,GAAI,UAAA;AAClB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,SAAS,CAAA,GAAI,IAAI,GAAA,CAAI,KAAK,CAAA,GAAI,MAAA;AACrE;AAeO,SAAS,qBAAA,CACd,YACA,EAAA,EACY;AACZ,EAAA,MAAM,SAAA,GAAY,sBAAsB,UAAU,CAAA;AAClD,EAAA,OAAO,SAAA,GAAYA,mCAAA,CAAkB,SAAA,EAAW,EAAE,IAAI,EAAA,EAAG;AAC3D","file":"subagents.cjs","sourcesContent":["import type { AgentDefinition } from \"../../../types/agent.js\";\nimport { withToolWhitelist } from \"../../concurrency/async-local-storage.js\";\n\n/**\n * Resolve a sub-agent's tool whitelist from its {@link AgentDefinition.tools}\n * (M4-6). Returns a `Set` of allowed tool names when `tools` is a non-empty\n * array, else `undefined` (unscoped — the sub-agent inherits the parent's full\n * toolset). The `Set` is the exact shape `withToolWhitelist` /\n * `ForkOptions.allowedTools` consume.\n *\n * @public\n */\nexport function subagentToolWhitelist(definition: AgentDefinition): Set<string> | undefined {\n const { tools } = definition;\n return Array.isArray(tools) && tools.length > 0 ? new Set(tools) : undefined;\n}\n\n/**\n * Run `fn` under the sub-agent's tool whitelist (M4-6). When the definition\n * declares `tools`, the run executes inside `withToolWhitelist(set, fn)` — so\n * every tool call the sub-agent makes is vetoed at dispatch (`checkToolWhitelist`,\n * the same enforcement forks use) unless its canonical name is whitelisted: a\n * `tools: [\"read_file\"]` sub-agent provably cannot call `write_file`/`shell_exec`.\n * Enforcement is `withToolWhitelist`, NOT `PermissionEngine`.\n *\n * An unscoped definition (no/empty `tools`) runs `fn` directly — the parent's\n * full toolset is preserved.\n *\n * @public\n */\nexport function withSubagentToolScope<T>(\n definition: AgentDefinition,\n fn: () => Promise<T>,\n): Promise<T> {\n const whitelist = subagentToolWhitelist(definition);\n return whitelist ? withToolWhitelist(whitelist, fn) : fn();\n}\n"]}
|
package/dist/subagents.js
CHANGED
package/dist/subagents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/runtime/skills/subagent-tool-scope.ts"],"names":[],"mappings":";;;AAYO,SAAS,sBAAsB,UAAA,EAAsD;AAC1F,EAAA,MAAM,EAAE,OAAM,GAAI,UAAA;AAClB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,SAAS,CAAA,GAAI,IAAI,GAAA,CAAI,KAAK,CAAA,GAAI,MAAA;AACrE;AAeO,SAAS,qBAAA,CACd,YACA,EAAA,EACY;AACZ,EAAA,MAAM,SAAA,GAAY,sBAAsB,UAAU,CAAA;AAClD,EAAA,OAAO,SAAA,GAAY,iBAAA,CAAkB,SAAA,EAAW,EAAE,IAAI,EAAA,EAAG;AAC3D","file":"subagents.js","sourcesContent":["import type { AgentDefinition } from \"../../../types/agent.js\";\nimport { withToolWhitelist } from \"
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/skills/subagent-tool-scope.ts"],"names":[],"mappings":";;;AAYO,SAAS,sBAAsB,UAAA,EAAsD;AAC1F,EAAA,MAAM,EAAE,OAAM,GAAI,UAAA;AAClB,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,SAAS,CAAA,GAAI,IAAI,GAAA,CAAI,KAAK,CAAA,GAAI,MAAA;AACrE;AAeO,SAAS,qBAAA,CACd,YACA,EAAA,EACY;AACZ,EAAA,MAAM,SAAA,GAAY,sBAAsB,UAAU,CAAA;AAClD,EAAA,OAAO,SAAA,GAAY,iBAAA,CAAkB,SAAA,EAAW,EAAE,IAAI,EAAA,EAAG;AAC3D","file":"subagents.js","sourcesContent":["import type { AgentDefinition } from \"../../../types/agent.js\";\nimport { withToolWhitelist } from \"../../concurrency/async-local-storage.js\";\n\n/**\n * Resolve a sub-agent's tool whitelist from its {@link AgentDefinition.tools}\n * (M4-6). Returns a `Set` of allowed tool names when `tools` is a non-empty\n * array, else `undefined` (unscoped — the sub-agent inherits the parent's full\n * toolset). The `Set` is the exact shape `withToolWhitelist` /\n * `ForkOptions.allowedTools` consume.\n *\n * @public\n */\nexport function subagentToolWhitelist(definition: AgentDefinition): Set<string> | undefined {\n const { tools } = definition;\n return Array.isArray(tools) && tools.length > 0 ? new Set(tools) : undefined;\n}\n\n/**\n * Run `fn` under the sub-agent's tool whitelist (M4-6). When the definition\n * declares `tools`, the run executes inside `withToolWhitelist(set, fn)` — so\n * every tool call the sub-agent makes is vetoed at dispatch (`checkToolWhitelist`,\n * the same enforcement forks use) unless its canonical name is whitelisted: a\n * `tools: [\"read_file\"]` sub-agent provably cannot call `write_file`/`shell_exec`.\n * Enforcement is `withToolWhitelist`, NOT `PermissionEngine`.\n *\n * An unscoped definition (no/empty `tools`) runs `fn` directly — the parent's\n * full toolset is preserved.\n *\n * @public\n */\nexport function withSubagentToolScope<T>(\n definition: AgentDefinition,\n fn: () => Promise<T>,\n): Promise<T> {\n const whitelist = subagentToolWhitelist(definition);\n return whitelist ? withToolWhitelist(whitelist, fn) : fn();\n}\n"]}
|
|
@@ -61,7 +61,10 @@ export interface DefineSubscriptionOptions<TInput, TOutput> {
|
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
export declare function defineSubscription<TInput, TOutput>(opts: DefineSubscriptionOptions<TInput, TOutput>): SubscriptionDescriptor<TInput, TOutput>;
|
|
64
|
-
/** SE36 — `Subscription.create` replaces `defineSubscription` (ADR 0015). @public
|
|
64
|
+
/** SE36 — `Subscription.create` replaces `defineSubscription` (ADR 0015). @public *
|
|
65
|
+
* `Subscription.create` returns a **`SubscriptionDescriptor<TInput, TOutput>`**, not a
|
|
66
|
+
* `Subscription`. The class is the namespace; the descriptor is the product.
|
|
67
|
+
*/
|
|
65
68
|
export declare class Subscription {
|
|
66
69
|
private constructor();
|
|
67
70
|
static create<TInput, TOutput>(opts: DefineSubscriptionOptions<TInput, TOutput>): SubscriptionDescriptor<TInput, TOutput>;
|
|
@@ -61,7 +61,10 @@ export interface DefineSubscriptionOptions<TInput, TOutput> {
|
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
63
|
export declare function defineSubscription<TInput, TOutput>(opts: DefineSubscriptionOptions<TInput, TOutput>): SubscriptionDescriptor<TInput, TOutput>;
|
|
64
|
-
/** SE36 — `Subscription.create` replaces `defineSubscription` (ADR 0015). @public
|
|
64
|
+
/** SE36 — `Subscription.create` replaces `defineSubscription` (ADR 0015). @public *
|
|
65
|
+
* `Subscription.create` returns a **`SubscriptionDescriptor<TInput, TOutput>`**, not a
|
|
66
|
+
* `Subscription`. The class is the namespace; the descriptor is the product.
|
|
67
|
+
*/
|
|
65
68
|
export declare class Subscription {
|
|
66
69
|
private constructor();
|
|
67
70
|
static create<TInput, TOutput>(opts: DefineSubscriptionOptions<TInput, TOutput>): SubscriptionDescriptor<TInput, TOutput>;
|