@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
package/dist/a2a/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQME6FDFG_cjs = require('../chunk-QME6FDFG.cjs');
|
|
4
4
|
require('../chunk-NINIJCHU.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkJ7J7J2GN_cjs = require('../chunk-J7J7J2GN.cjs');
|
|
6
|
+
var chunk6LHQPOMI_cjs = require('../chunk-6LHQPOMI.cjs');
|
|
6
7
|
|
|
7
8
|
// src/a2a/agent-mailbox.ts
|
|
8
9
|
var AgentMailbox = class {
|
|
@@ -28,22 +29,36 @@ var AgentMailbox = class {
|
|
|
28
29
|
this._handler = null;
|
|
29
30
|
}
|
|
30
31
|
_dispatch(msg) {
|
|
31
|
-
if (this._handler)
|
|
32
|
-
|
|
33
|
-
}
|
|
32
|
+
if (this._handler === null) return void 0;
|
|
33
|
+
return this._handler(msg);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// src/a2a/message-bus.ts
|
|
38
|
-
var
|
|
38
|
+
var A2APeerNotRegisteredError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
39
|
+
constructor(to) {
|
|
40
|
+
super(`Agent "${to}" not registered on MessageBus`, {
|
|
41
|
+
code: "a2a_peer_not_registered",
|
|
42
|
+
isRetryable: false
|
|
43
|
+
});
|
|
44
|
+
this.to = to;
|
|
45
|
+
}
|
|
46
|
+
to;
|
|
47
|
+
name = "A2APeerNotRegisteredError";
|
|
48
|
+
code = "a2a_peer_not_registered";
|
|
49
|
+
};
|
|
50
|
+
var A2ARequestTimeoutError = class extends chunkJ7J7J2GN_cjs.TheokitAgentError {
|
|
39
51
|
constructor(to, timeoutMs) {
|
|
40
|
-
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms
|
|
52
|
+
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`, {
|
|
53
|
+
code: "a2a_request_timeout",
|
|
54
|
+
isRetryable: true
|
|
55
|
+
});
|
|
41
56
|
this.to = to;
|
|
42
57
|
this.timeoutMs = timeoutMs;
|
|
43
|
-
this.name = "A2ARequestTimeoutError";
|
|
44
58
|
}
|
|
45
59
|
to;
|
|
46
60
|
timeoutMs;
|
|
61
|
+
name = "A2ARequestTimeoutError";
|
|
47
62
|
code = "a2a_request_timeout";
|
|
48
63
|
};
|
|
49
64
|
var MessageBus = class {
|
|
@@ -57,7 +72,7 @@ var MessageBus = class {
|
|
|
57
72
|
async send(from, to, partial) {
|
|
58
73
|
const handler = this._handlers.get(to);
|
|
59
74
|
if (!handler) {
|
|
60
|
-
throw new
|
|
75
|
+
throw new A2APeerNotRegisteredError(to);
|
|
61
76
|
}
|
|
62
77
|
const message = {
|
|
63
78
|
...partial,
|
|
@@ -69,14 +84,14 @@ var MessageBus = class {
|
|
|
69
84
|
};
|
|
70
85
|
void Promise.resolve(handler(message)).catch((cause) => {
|
|
71
86
|
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
72
|
-
|
|
87
|
+
chunk6LHQPOMI_cjs.diag(`[theokit-sdk] a2a: handler for "${to}" failed on a fire-and-forget send: ${reason}
|
|
73
88
|
`);
|
|
74
89
|
});
|
|
75
90
|
}
|
|
76
91
|
async request(from, to, partial, opts) {
|
|
77
92
|
const handler = this._handlers.get(to);
|
|
78
93
|
if (!handler) {
|
|
79
|
-
throw new
|
|
94
|
+
throw new A2APeerNotRegisteredError(to);
|
|
80
95
|
}
|
|
81
96
|
const timeoutMs = opts?.timeoutMs ?? 3e4;
|
|
82
97
|
const message = {
|
|
@@ -109,12 +124,13 @@ var MessageBus = class {
|
|
|
109
124
|
|
|
110
125
|
Object.defineProperty(exports, "MaxDelegationDepthError", {
|
|
111
126
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkQME6FDFG_cjs.MaxDelegationDepthError; }
|
|
113
128
|
});
|
|
114
129
|
Object.defineProperty(exports, "SubAgent", {
|
|
115
130
|
enumerable: true,
|
|
116
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkQME6FDFG_cjs.SubAgent; }
|
|
117
132
|
});
|
|
133
|
+
exports.A2APeerNotRegisteredError = A2APeerNotRegisteredError;
|
|
118
134
|
exports.A2ARequestTimeoutError = A2ARequestTimeoutError;
|
|
119
135
|
exports.AgentMailbox = AgentMailbox;
|
|
120
136
|
exports.MessageBus = MessageBus;
|
package/dist/a2a/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":["diag"],"mappings":";;;;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,EAClB;AAAA,EAEA,MAAM,IAAA,CAAK,EAAA,EAAY,OAAA,EAA4D;AACjF,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,IAAI,OAAO,CAAA;AAAA,EACjD;AAAA,EAEA,MAAM,OAAA,CACJ,EAAA,EACA,OAAA,EACA,IAAA,EACkB;AAClB,IAAA,OAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,KAAK,OAAA,EAAS,EAAA,EAAI,SAAS,IAAI,CAAA;AAAA,EAC1D;AAAA,EAEA,OAAA,GAAgB;A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A,CAAQ,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,QAChC,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,MAAA,KAAW;AACzB,UAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,MAAA,CAAO,IAAI,uBAAuB,EAAA,EAAI,SAAS,CAAC,CAAA,EAAG,SAAS,CAAA;AAAA,QACvF,CAAC;AAAA,OACF,CAAA;AAAA,IACH,CAAA,SAAE;AACA,MAAA,IAAI,KAAA,KAAU,MAAA,EAAW,YAAA,CAAa,KAAK,CAAA;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.cjs","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends Error {\n readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);\n this.name = \"A2ARequestTimeoutError\";\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":["TheokitAgentError","diag"],"mappings":";;;;;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,EAClB;AAAA,EAEA,MAAM,IAAA,CAAK,EAAA,EAAY,OAAA,EAA4D;AACjF,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAK,IAAA,CAAK,OAAA,EAAS,IAAI,OAAO,CAAA;AAAA,EACjD;AAAA,EAEA,MAAM,OAAA,CACJ,EAAA,EACA,OAAA,EACA,IAAA,EACkB;AAClB,IAAA,OAAO,KAAK,IAAA,CAAK,OAAA,CAAQ,KAAK,OAAA,EAAS,EAAA,EAAI,SAAS,IAAI,CAAA;AAAA,EAC1D;AAAA,EAEA,OAAA,GAAgB;AACd,IAAA,IAAA,CAAK,IAAA,CAAK,UAAA,CAAW,IAAA,CAAK,OAAO,CAAA;AACjC,IAAA,IAAA,CAA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AAAA,MACH,IAAA;AAAA,MACA,EAAA;AAAA,MACA,SAAA,EAAW,KAAK,GAAA,EAAI;AAAA;AAAA,MAEpB,MAAA,EAAQ,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA;AAAK,KAC/B;AAIA,IAAA,IAAI,KAAA;AACJ,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,QAAQ,IAAA,CAAK;AAAA,QACxB,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,QAChC,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,MAAA,KAAW;AACzB,UAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,MAAA,CAAO,IAAI,uBAAuB,EAAA,EAAI,SAAS,CAAC,CAAA,EAAG,SAAS,CAAA;AAAA,QACvF,CAAC;AAAA,OACF,CAAA;AAAA,IACH,CAAA,SAAE;AACA,MAAA,IAAI,KAAA,KAAU,MAAA,EAAW,YAAA,CAAa,KAAK,CAAA;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.cjs","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n // A disposed mailbox is still registered until the bus drops it, so a\n // message can arrive with no handler. `undefined` is the reply in that\n // case, and saying so explicitly is what lets `noImplicitReturns` hold.\n if (this._handler === null) return undefined;\n return this._handler(msg);\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { TheokitAgentError } from \"../errors.js\";\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * Thrown by {@link MessageBus.send} and {@link MessageBus.request} when `to` has no registered\n * handler.\n *\n * The sibling below records why a typed error was introduced for the TIMEOUT, quoting\n * `docs/error-codes.md`: \"Branch on `code`, never on the message: messages carry context (an id, a\n * path, a limit) and change with it, while a code is the contract.\" This failure had exactly the\n * shape that reasoning rejects — a bare `Error` whose message embeds the address — in the FIRST\n * branch of the same two methods whose second branch was fixed.\n *\n * @public\n */\nexport class A2APeerNotRegisteredError extends TheokitAgentError {\n override readonly name = \"A2APeerNotRegisteredError\";\n override readonly code = \"a2a_peer_not_registered\" as const;\n\n constructor(\n /** The address with no registered handler. */\n public readonly to: string,\n ) {\n // Not retryable: a peer registers or it does not, and re-sending does not register it. A caller\n // that expects it to appear should await registration, not retry the send.\n super(`Agent \"${to}\" not registered on MessageBus`, {\n code: \"a2a_peer_not_registered\",\n isRetryable: false,\n });\n }\n}\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends TheokitAgentError {\n override readonly name = \"A2ARequestTimeoutError\";\n override readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n // Retryable: a peer that missed one deadline may answer the next request.\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`, {\n code: \"a2a_request_timeout\",\n isRetryable: true,\n });\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with {@link A2APeerNotRegisteredError}\n * (code `a2a_peer_not_registered`, carrying `to`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new A2APeerNotRegisteredError(to);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new A2APeerNotRegisteredError(to);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
package/dist/a2a/index.d.cts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ToolContextMessage } from "../types/agent-prims.js";
|
|
7
7
|
export { AgentMailbox } from "./agent-mailbox.js";
|
|
8
|
-
export { A2ARequestTimeoutError, MessageBus, type RequestOptions } from "./message-bus.js";
|
|
8
|
+
export { A2APeerNotRegisteredError, A2ARequestTimeoutError, MessageBus, type RequestOptions, } from "./message-bus.js";
|
|
9
9
|
export { type DelegationCompleteContext, type DelegationCompleteDecision, type DelegationStartContext, type DelegationStartDecision, MaxDelegationDepthError, type MessageFilterArgs, SubAgent, type SubAgentSpec, } from "./subagent.js";
|
|
10
10
|
export type { A2AMessage, MessageHandler } from "./types.js";
|
package/dist/a2a/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export type { ToolContextMessage } from "../types/agent-prims.js";
|
|
7
7
|
export { AgentMailbox } from "./agent-mailbox.js";
|
|
8
|
-
export { A2ARequestTimeoutError, MessageBus, type RequestOptions } from "./message-bus.js";
|
|
8
|
+
export { A2APeerNotRegisteredError, A2ARequestTimeoutError, MessageBus, type RequestOptions, } from "./message-bus.js";
|
|
9
9
|
export { type DelegationCompleteContext, type DelegationCompleteDecision, type DelegationStartContext, type DelegationStartDecision, MaxDelegationDepthError, type MessageFilterArgs, SubAgent, type SubAgentSpec, } from "./subagent.js";
|
|
10
10
|
export type { A2AMessage, MessageHandler } from "./types.js";
|
package/dist/a2a/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { MaxDelegationDepthError, SubAgent } from '../chunk-
|
|
1
|
+
export { MaxDelegationDepthError, SubAgent } from '../chunk-6WAKKTBO.js';
|
|
2
2
|
import '../chunk-6X6ID4MO.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TheokitAgentError } from '../chunk-ALUN2B4W.js';
|
|
4
|
+
import { diag } from '../chunk-CZJ6Q7CW.js';
|
|
4
5
|
|
|
5
6
|
// src/a2a/agent-mailbox.ts
|
|
6
7
|
var AgentMailbox = class {
|
|
@@ -26,22 +27,36 @@ var AgentMailbox = class {
|
|
|
26
27
|
this._handler = null;
|
|
27
28
|
}
|
|
28
29
|
_dispatch(msg) {
|
|
29
|
-
if (this._handler)
|
|
30
|
-
|
|
31
|
-
}
|
|
30
|
+
if (this._handler === null) return void 0;
|
|
31
|
+
return this._handler(msg);
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
// src/a2a/message-bus.ts
|
|
36
|
-
var
|
|
36
|
+
var A2APeerNotRegisteredError = class extends TheokitAgentError {
|
|
37
|
+
constructor(to) {
|
|
38
|
+
super(`Agent "${to}" not registered on MessageBus`, {
|
|
39
|
+
code: "a2a_peer_not_registered",
|
|
40
|
+
isRetryable: false
|
|
41
|
+
});
|
|
42
|
+
this.to = to;
|
|
43
|
+
}
|
|
44
|
+
to;
|
|
45
|
+
name = "A2APeerNotRegisteredError";
|
|
46
|
+
code = "a2a_peer_not_registered";
|
|
47
|
+
};
|
|
48
|
+
var A2ARequestTimeoutError = class extends TheokitAgentError {
|
|
37
49
|
constructor(to, timeoutMs) {
|
|
38
|
-
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms
|
|
50
|
+
super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`, {
|
|
51
|
+
code: "a2a_request_timeout",
|
|
52
|
+
isRetryable: true
|
|
53
|
+
});
|
|
39
54
|
this.to = to;
|
|
40
55
|
this.timeoutMs = timeoutMs;
|
|
41
|
-
this.name = "A2ARequestTimeoutError";
|
|
42
56
|
}
|
|
43
57
|
to;
|
|
44
58
|
timeoutMs;
|
|
59
|
+
name = "A2ARequestTimeoutError";
|
|
45
60
|
code = "a2a_request_timeout";
|
|
46
61
|
};
|
|
47
62
|
var MessageBus = class {
|
|
@@ -55,7 +70,7 @@ var MessageBus = class {
|
|
|
55
70
|
async send(from, to, partial) {
|
|
56
71
|
const handler = this._handlers.get(to);
|
|
57
72
|
if (!handler) {
|
|
58
|
-
throw new
|
|
73
|
+
throw new A2APeerNotRegisteredError(to);
|
|
59
74
|
}
|
|
60
75
|
const message = {
|
|
61
76
|
...partial,
|
|
@@ -74,7 +89,7 @@ var MessageBus = class {
|
|
|
74
89
|
async request(from, to, partial, opts) {
|
|
75
90
|
const handler = this._handlers.get(to);
|
|
76
91
|
if (!handler) {
|
|
77
|
-
throw new
|
|
92
|
+
throw new A2APeerNotRegisteredError(to);
|
|
78
93
|
}
|
|
79
94
|
const timeoutMs = opts?.timeoutMs ?? 3e4;
|
|
80
95
|
const message = {
|
|
@@ -105,6 +120,6 @@ var MessageBus = class {
|
|
|
105
120
|
}
|
|
106
121
|
};
|
|
107
122
|
|
|
108
|
-
export { A2ARequestTimeoutError, AgentMailbox, MessageBus };
|
|
123
|
+
export { A2APeerNotRegisteredError, A2ARequestTimeoutError, AgentMailbox, MessageBus };
|
|
109
124
|
//# sourceMappingURL=index.js.map
|
|
110
125
|
//# sourceMappingURL=index.js.map
|
package/dist/a2a/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":[],"mappings":";;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,E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AA,GAAY,MAAM,SAAA,IAAa,GAAA;AACrC,IAAA,MAAM,OAAA,GAAsB;AAAA,MAC1B,GAAG,OAAA;AAAA,MACH,IAAA;AAAA,MACA,EAAA;AAAA,MACA,SAAA,EAAW,KAAK,GAAA,EAAI;AAAA;AAAA,MAEpB,MAAA,EAAQ,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA;AAAK,KAC/B;AAIA,IAAA,IAAI,KAAA;AACJ,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,QAAQ,IAAA,CAAK;AAAA,QACxB,OAAA,CAAQ,OAAA,CAAQ,OAAA,CAAQ,OAAO,CAAC,CAAA;AAAA,QAChC,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,MAAA,KAAW;AACzB,UAAA,KAAA,GAAQ,UAAA,CAAW,MAAM,MAAA,CAAO,IAAI,uBAAuB,EAAA,EAAI,SAAS,CAAC,CAAA,EAAG,SAAS,CAAA;AAAA,QACvF,CAAC;AAAA,OACF,CAAA;AAAA,IACH,CAAA,SAAE;AACA,MAAA,IAAI,KAAA,KAAU,MAAA,EAAW,YAAA,CAAa,KAAK,CAAA;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA,IAAI,OAAA,EAA0B;AAC5B,IAAA,OAAO,IAAA,CAAK,SAAA,CAAU,GAAA,CAAI,OAAO,CAAA;AAAA,EACnC;AAAA,EAEA,UAAA,GAAuB;AACrB,IAAA,OAAO,CAAC,GAAG,IAAA,CAAK,SAAA,CAAU,MAAM,CAAA;AAAA,EAClC;AACF","file":"index.js","sourcesContent":["/**\n * AgentMailbox — per-agent inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n if (this._handler) {\n return this._handler(msg);\n }\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends Error {\n readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`);\n this.name = \"A2ARequestTimeoutError\";\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with a plain `Error`\n * (`Agent \"<to>\" not registered on MessageBus`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new Error(`Agent \"${to}\" not registered on MessageBus`);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/a2a/agent-mailbox.ts","../../src/a2a/message-bus.ts"],"names":[],"mappings":";;;;;;AAuCO,IAAM,eAAN,MAAmB;AAAA,EACf,OAAA;AAAA,EACQ,IAAA;AAAA,EACT,QAAA,GAAkC,IAAA;AAAA,EAE1C,WAAA,CAAY,SAAiB,GAAA,EAAiB;AAC5C,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,GAAA;AACZ,IAAA,IAAA,CAAK,IAAA,CAAK,SAAS,OAAA,EAAS,CAAC,QAAQ,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA,EAC1D;AAAA,EAEA,UAAU,OAAA,EAA+B;AACvC,IAAA,IAAA,CAAK,QAAA,GAAW,OAAA;AAAA,EAClB;AAAA,EAEA,MAAM,IAAA,CAAK,EAAA,EAAY,OAAA,EAA4D;AACjF,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAK,IAAA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inbox for A2A communication (T20.1, ADR D453).\n *\n * Wraps MessageBus registration with a convenient API for sending,\n * receiving, and requesting messages.\n *\n * @public\n */\n\nimport type { MessageBus, RequestOptions } from \"./message-bus.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * One agent's endpoint on a {@link MessageBus}: registers `agentId` on\n * construction and forwards inbound messages to the handler installed by\n * `onMessage`.\n *\n * const mailbox = new AgentMailbox(\"worker\", bus);\n * mailbox.onMessage((m) => `echo:${m.payload}`);\n * await mailbox.send(\"boss\", { type: \"ready\", payload: null });\n *\n * Needs an already-constructed `MessageBus` — the mailbox does not create one, and\n * two mailboxes reach each other only through the SAME bus instance.\n *\n * How it fails: `send` and `request` are thin forwards, so they carry the bus's\n * failures unchanged (plain `Error` for an unregistered peer, plus a timeout\n * rejection for `request`).\n *\n * Traps:\n * - The constructor registers IMMEDIATELY, before `onMessage` can be called. A\n * message arriving in that window is dropped silently, and a peer's `request`\n * RESOLVES WITH `undefined` instead of timing out — install the handler in the\n * same tick as construction.\n * - Constructing a second mailbox with the same `agentId` on the same bus takes\n * the id over silently (`MessageBus.register` overwrites), and the loser's\n * `dispose()` then unregisters the WINNER.\n * - `dispose()` only unregisters and clears the handler. Requests already in\n * flight are neither cancelled nor rejected; they time out on the caller's side.\n */\nexport class AgentMailbox {\n readonly agentId: string;\n private readonly _bus: MessageBus;\n private _handler: MessageHandler | null = null;\n\n constructor(agentId: string, bus: MessageBus) {\n this.agentId = agentId;\n this._bus = bus;\n this._bus.register(agentId, (msg) => this._dispatch(msg));\n }\n\n onMessage(handler: MessageHandler): void {\n this._handler = handler;\n }\n\n async send(to: string, partial: { type: string; payload: unknown }): Promise<void> {\n return this._bus.send(this.agentId, to, partial);\n }\n\n async request(\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n return this._bus.request(this.agentId, to, partial, opts);\n }\n\n dispose(): void {\n this._bus.unregister(this.agentId);\n this._handler = null;\n }\n\n private _dispatch(msg: A2AMessage): unknown {\n // A disposed mailbox is still registered until the bus drops it, so a\n // message can arrive with no handler. `undefined` is the reply in that\n // case, and saying so explicitly is what lets `noImplicitReturns` hold.\n if (this._handler === null) return undefined;\n return this._handler(msg);\n }\n}\n","/**\n * MessageBus — in-process typed message router for A2A (T20.1, ADR D453).\n *\n * Routes messages between agents by ID. Supports fire-and-forget (send)\n * and request/response (request with timeout).\n *\n * @public\n */\n\nimport { TheokitAgentError } from \"../errors.js\";\nimport { diag } from \"../internal/diagnostics.js\";\nimport type { A2AMessage, MessageHandler } from \"./types.js\";\n\n/**\n * Thrown by {@link MessageBus.send} and {@link MessageBus.request} when `to` has no registered\n * handler.\n *\n * The sibling below records why a typed error was introduced for the TIMEOUT, quoting\n * `docs/error-codes.md`: \"Branch on `code`, never on the message: messages carry context (an id, a\n * path, a limit) and change with it, while a code is the contract.\" This failure had exactly the\n * shape that reasoning rejects — a bare `Error` whose message embeds the address — in the FIRST\n * branch of the same two methods whose second branch was fixed.\n *\n * @public\n */\nexport class A2APeerNotRegisteredError extends TheokitAgentError {\n override readonly name = \"A2APeerNotRegisteredError\";\n override readonly code = \"a2a_peer_not_registered\" as const;\n\n constructor(\n /** The address with no registered handler. */\n public readonly to: string,\n ) {\n // Not retryable: a peer registers or it does not, and re-sending does not register it. A caller\n // that expects it to appear should await registration, not retry the send.\n super(`Agent \"${to}\" not registered on MessageBus`, {\n code: \"a2a_peer_not_registered\",\n isRetryable: false,\n });\n }\n}\n\n/**\n * A peer did not answer a {@link MessageBus.request} within its timeout.\n *\n * Carries `code: \"a2a_request_timeout\"`, the peer's address and the limit as FIELDS, so a caller\n * branches on the contract rather than on prose — `docs/error-codes.md`: \"Branch on `code`, never\n * on the message: messages carry context (an id, a path, a limit) and change with it, while a code\n * is the contract.\" Until #380 this rejection was a plain `Error` with neither, and the message it\n * carried embeds both the address and the limit, so matching on it changed with context exactly as\n * that document warns.\n *\n * The distinction it restores is what a retry policy is built on. A peer that did not answer in\n * time is transient and worth retrying; a peer whose handler threw is likely deterministic and\n * retrying repeats the failure. A handler's own error propagates unchanged and is NOT this type —\n * an unattended agent can therefore tell the two apart without reading English.\n *\n * @public\n */\nexport class A2ARequestTimeoutError extends TheokitAgentError {\n override readonly name = \"A2ARequestTimeoutError\";\n override readonly code = \"a2a_request_timeout\" as const;\n constructor(\n /** The peer that did not answer. */\n public readonly to: string,\n /** The limit it exceeded, in milliseconds. */\n public readonly timeoutMs: number,\n ) {\n // Retryable: a peer that missed one deadline may answer the next request.\n super(`A2A request timeout: ${to} did not respond within ${timeoutMs}ms`, {\n code: \"a2a_request_timeout\",\n isRetryable: true,\n });\n }\n}\n\n/**\n * Per-call knobs for {@link MessageBus.request} / `AgentMailbox.request`.\n */\nexport interface RequestOptions {\n /**\n * How long to wait for the peer handler to settle before rejecting.\n * Default `30_000` (30 s). The rejection is an {@link A2ARequestTimeoutError} carrying\n * `code: \"a2a_request_timeout\"`, `to` and `timeoutMs` (#380), so a caller distinguishes a\n * timeout from a handler failure by branching on the code — a handler's own error propagates\n * unchanged and is not that type.\n */\n timeoutMs?: number;\n}\n\n/**\n * In-process router that delivers A2A messages between agents keyed by string id.\n *\n * Purely in-memory and single-process: nothing is persisted and nothing crosses a\n * process or network boundary. Register one handler per agent id, then `send`\n * (fire-and-forget) or `request` (await the handler's return value).\n *\n * const bus = new MessageBus();\n * bus.register(\"worker\", (m) => `echo:${m.payload}`);\n * const reply = await bus.request(\"boss\", \"worker\", { type: \"ping\", payload: 1 });\n *\n * Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,\n * `timestamp` and `origin` onto the delivered {@link A2AMessage}.\n *\n * How it fails: `send` and `request` both reject with {@link A2APeerNotRegisteredError}\n * (code `a2a_peer_not_registered`, carrying `to`) when `to` has no handler, and\n * `request` additionally rejects on timeout. No typed error class is exported for\n * either, so there is nothing to `instanceof`.\n *\n * Traps:\n * - `register` silently OVERWRITES an existing id; the previous handler simply\n * stops receiving anything. Call `has(id)` first when that matters.\n * - `send` is declared `async` but never awaits the handler. A handler that\n * rejects produces an UNHANDLED rejection that `await bus.send(...)` does not\n * observe — only the \"not registered\" failure reaches the caller. Use\n * `request` when the handler's failure has to be visible.\n * - `from` is whatever the caller passes; the bus never checks that the sender\n * is registered. It is self-asserted provenance, not authentication.\n */\nexport class MessageBus {\n private readonly _handlers = new Map<string, MessageHandler>();\n\n register(agentId: string, handler: MessageHandler): void {\n this._handlers.set(agentId, handler);\n }\n\n unregister(agentId: string): void {\n this._handlers.delete(agentId);\n }\n\n async send(from: string, to: string, partial: { type: string; payload: unknown }): Promise<void> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new A2APeerNotRegisteredError(to);\n }\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Fire-and-forget: the SENDER does not wait for the result, which is the whole point of\n // `send`. It does not mean nobody is told when delivery fails — that is the difference\n // between asynchronous and silent (#365).\n //\n // The returned promise used to be dropped on the floor. `MessageHandler` may return one, so a\n // rejecting handler became an unhandled rejection: fatal under Node's default\n // `--unhandled-rejections=throw`, and invisible to the caller, whose `await send(...)`\n // resolved cleanly either way. Attaching a catch keeps the call non-blocking and reports the\n // failure instead of discarding it (`error-handling.md` § 5).\n void Promise.resolve(handler(message)).catch((cause: unknown) => {\n const reason = cause instanceof Error ? cause.message : String(cause);\n diag(`[theokit-sdk] a2a: handler for \"${to}\" failed on a fire-and-forget send: ${reason}\\n`);\n });\n }\n\n async request(\n from: string,\n to: string,\n partial: { type: string; payload: unknown },\n opts?: RequestOptions,\n ): Promise<unknown> {\n const handler = this._handlers.get(to);\n if (!handler) {\n throw new A2APeerNotRegisteredError(to);\n }\n const timeoutMs = opts?.timeoutMs ?? 30_000;\n const message: A2AMessage = {\n ...partial,\n from,\n to,\n timestamp: Date.now(),\n // SE3 — provenance projection of the sender address (thin view over `from`).\n origin: { kind: \"peer\", from },\n };\n // Hold the timer so it can be cleared once the race settles — otherwise a\n // successful request leaks a live `setTimeout` that keeps the Node event loop\n // alive (the process hangs after the reply). Cleared in `finally`.\n let timer: ReturnType<typeof setTimeout> | undefined;\n try {\n return await Promise.race([\n Promise.resolve(handler(message)),\n new Promise((_, reject) => {\n timer = setTimeout(() => reject(new A2ARequestTimeoutError(to, timeoutMs)), timeoutMs);\n }),\n ]);\n } finally {\n if (timer !== undefined) clearTimeout(timer);\n }\n }\n\n has(agentId: string): boolean {\n return this._handlers.has(agentId);\n }\n\n listAgents(): string[] {\n return [...this._handlers.keys()];\n }\n}\n"]}
|
|
@@ -6,7 +6,29 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
+
import { TheokitAgentError } from "../errors.js";
|
|
9
10
|
import type { MessageHandler } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Thrown by {@link MessageBus.send} and {@link MessageBus.request} when `to` has no registered
|
|
13
|
+
* handler.
|
|
14
|
+
*
|
|
15
|
+
* The sibling below records why a typed error was introduced for the TIMEOUT, quoting
|
|
16
|
+
* `docs/error-codes.md`: "Branch on `code`, never on the message: messages carry context (an id, a
|
|
17
|
+
* path, a limit) and change with it, while a code is the contract." This failure had exactly the
|
|
18
|
+
* shape that reasoning rejects — a bare `Error` whose message embeds the address — in the FIRST
|
|
19
|
+
* branch of the same two methods whose second branch was fixed.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare class A2APeerNotRegisteredError extends TheokitAgentError {
|
|
24
|
+
/** The address with no registered handler. */
|
|
25
|
+
readonly to: string;
|
|
26
|
+
readonly name = "A2APeerNotRegisteredError";
|
|
27
|
+
readonly code: "a2a_peer_not_registered";
|
|
28
|
+
constructor(
|
|
29
|
+
/** The address with no registered handler. */
|
|
30
|
+
to: string);
|
|
31
|
+
}
|
|
10
32
|
/**
|
|
11
33
|
* A peer did not answer a {@link MessageBus.request} within its timeout.
|
|
12
34
|
*
|
|
@@ -24,11 +46,12 @@ import type { MessageHandler } from "./types.js";
|
|
|
24
46
|
*
|
|
25
47
|
* @public
|
|
26
48
|
*/
|
|
27
|
-
export declare class A2ARequestTimeoutError extends
|
|
49
|
+
export declare class A2ARequestTimeoutError extends TheokitAgentError {
|
|
28
50
|
/** The peer that did not answer. */
|
|
29
51
|
readonly to: string;
|
|
30
52
|
/** The limit it exceeded, in milliseconds. */
|
|
31
53
|
readonly timeoutMs: number;
|
|
54
|
+
readonly name = "A2ARequestTimeoutError";
|
|
32
55
|
readonly code: "a2a_request_timeout";
|
|
33
56
|
constructor(
|
|
34
57
|
/** The peer that did not answer. */
|
|
@@ -63,8 +86,8 @@ export interface RequestOptions {
|
|
|
63
86
|
* Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,
|
|
64
87
|
* `timestamp` and `origin` onto the delivered {@link A2AMessage}.
|
|
65
88
|
*
|
|
66
|
-
* How it fails: `send` and `request` both reject with
|
|
67
|
-
* (`
|
|
89
|
+
* How it fails: `send` and `request` both reject with {@link A2APeerNotRegisteredError}
|
|
90
|
+
* (code `a2a_peer_not_registered`, carrying `to`) when `to` has no handler, and
|
|
68
91
|
* `request` additionally rejects on timeout. No typed error class is exported for
|
|
69
92
|
* either, so there is nothing to `instanceof`.
|
|
70
93
|
*
|
|
@@ -6,7 +6,29 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
+
import { TheokitAgentError } from "../errors.js";
|
|
9
10
|
import type { MessageHandler } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Thrown by {@link MessageBus.send} and {@link MessageBus.request} when `to` has no registered
|
|
13
|
+
* handler.
|
|
14
|
+
*
|
|
15
|
+
* The sibling below records why a typed error was introduced for the TIMEOUT, quoting
|
|
16
|
+
* `docs/error-codes.md`: "Branch on `code`, never on the message: messages carry context (an id, a
|
|
17
|
+
* path, a limit) and change with it, while a code is the contract." This failure had exactly the
|
|
18
|
+
* shape that reasoning rejects — a bare `Error` whose message embeds the address — in the FIRST
|
|
19
|
+
* branch of the same two methods whose second branch was fixed.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare class A2APeerNotRegisteredError extends TheokitAgentError {
|
|
24
|
+
/** The address with no registered handler. */
|
|
25
|
+
readonly to: string;
|
|
26
|
+
readonly name = "A2APeerNotRegisteredError";
|
|
27
|
+
readonly code: "a2a_peer_not_registered";
|
|
28
|
+
constructor(
|
|
29
|
+
/** The address with no registered handler. */
|
|
30
|
+
to: string);
|
|
31
|
+
}
|
|
10
32
|
/**
|
|
11
33
|
* A peer did not answer a {@link MessageBus.request} within its timeout.
|
|
12
34
|
*
|
|
@@ -24,11 +46,12 @@ import type { MessageHandler } from "./types.js";
|
|
|
24
46
|
*
|
|
25
47
|
* @public
|
|
26
48
|
*/
|
|
27
|
-
export declare class A2ARequestTimeoutError extends
|
|
49
|
+
export declare class A2ARequestTimeoutError extends TheokitAgentError {
|
|
28
50
|
/** The peer that did not answer. */
|
|
29
51
|
readonly to: string;
|
|
30
52
|
/** The limit it exceeded, in milliseconds. */
|
|
31
53
|
readonly timeoutMs: number;
|
|
54
|
+
readonly name = "A2ARequestTimeoutError";
|
|
32
55
|
readonly code: "a2a_request_timeout";
|
|
33
56
|
constructor(
|
|
34
57
|
/** The peer that did not answer. */
|
|
@@ -63,8 +86,8 @@ export interface RequestOptions {
|
|
|
63
86
|
* Callers supply only `{ type, payload }`; the bus stamps `from`, `to`,
|
|
64
87
|
* `timestamp` and `origin` onto the delivered {@link A2AMessage}.
|
|
65
88
|
*
|
|
66
|
-
* How it fails: `send` and `request` both reject with
|
|
67
|
-
* (`
|
|
89
|
+
* How it fails: `send` and `request` both reject with {@link A2APeerNotRegisteredError}
|
|
90
|
+
* (code `a2a_peer_not_registered`, carrying `to`) when `to` has no handler, and
|
|
68
91
|
* `request` additionally rejects on timeout. No typed error class is exported for
|
|
69
92
|
* either, so there is nothing to `instanceof`.
|
|
70
93
|
*
|
package/dist/a2a/subagent.d.cts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { TheokitAgentError } from "../errors.js";
|
|
18
|
+
import { type InheritedCredentials } from "../internal/concurrency/subagent-credentials.js";
|
|
18
19
|
import type { AgentOptions, CustomTool, ToolContextMessage } from "../types/agent.js";
|
|
19
20
|
import type { ModelSelection } from "../types/agent-prims.js";
|
|
20
21
|
/** Arguments passed to {@link SubAgentSpec.messageFilter} (SE12). */
|
|
@@ -186,9 +187,10 @@ export interface SubAgentSpec {
|
|
|
186
187
|
* chain length now travels with the run (`internal/runtime/concurrency/delegation-depth.ts`),
|
|
187
188
|
* and a caller-threaded `parentDepth` still adds to it.
|
|
188
189
|
*/
|
|
189
|
-
export declare class MaxDelegationDepthError extends
|
|
190
|
+
export declare class MaxDelegationDepthError extends TheokitAgentError {
|
|
190
191
|
readonly currentDepth: number;
|
|
191
192
|
readonly maxDepth: number;
|
|
193
|
+
readonly name = "MaxDelegationDepthError";
|
|
192
194
|
readonly code: "max_delegation_depth";
|
|
193
195
|
constructor(currentDepth: number, maxDepth: number);
|
|
194
196
|
}
|
|
@@ -199,7 +201,10 @@ export declare class MaxDelegationDepthError extends Error {
|
|
|
199
201
|
* child's inner tool calls run under the same policy.
|
|
200
202
|
*/
|
|
201
203
|
export declare function buildChildCreateOptions(spec: SubAgentSpec, inherited: InheritedCredentials | undefined): AgentOptions;
|
|
202
|
-
/** SE36 — `SubAgent.create` replaces `defineSubAgent` (ADR 0015). @public
|
|
204
|
+
/** SE36 — `SubAgent.create` replaces `defineSubAgent` (ADR 0015). @public *
|
|
205
|
+
* `SubAgent.create` returns a **`CustomTool`** — the sub-agent is exposed to the
|
|
206
|
+
* parent as a callable tool, not as a `SubAgent` instance.
|
|
207
|
+
*/
|
|
203
208
|
export declare class SubAgent {
|
|
204
209
|
private constructor();
|
|
205
210
|
static create(spec: SubAgentSpec, parentDepth?: number): CustomTool;
|
package/dist/a2a/subagent.d.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
*
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { TheokitAgentError } from "../errors.js";
|
|
18
|
+
import { type InheritedCredentials } from "../internal/concurrency/subagent-credentials.js";
|
|
18
19
|
import type { AgentOptions, CustomTool, ToolContextMessage } from "../types/agent.js";
|
|
19
20
|
import type { ModelSelection } from "../types/agent-prims.js";
|
|
20
21
|
/** Arguments passed to {@link SubAgentSpec.messageFilter} (SE12). */
|
|
@@ -186,9 +187,10 @@ export interface SubAgentSpec {
|
|
|
186
187
|
* chain length now travels with the run (`internal/runtime/concurrency/delegation-depth.ts`),
|
|
187
188
|
* and a caller-threaded `parentDepth` still adds to it.
|
|
188
189
|
*/
|
|
189
|
-
export declare class MaxDelegationDepthError extends
|
|
190
|
+
export declare class MaxDelegationDepthError extends TheokitAgentError {
|
|
190
191
|
readonly currentDepth: number;
|
|
191
192
|
readonly maxDepth: number;
|
|
193
|
+
readonly name = "MaxDelegationDepthError";
|
|
192
194
|
readonly code: "max_delegation_depth";
|
|
193
195
|
constructor(currentDepth: number, maxDepth: number);
|
|
194
196
|
}
|
|
@@ -199,7 +201,10 @@ export declare class MaxDelegationDepthError extends Error {
|
|
|
199
201
|
* child's inner tool calls run under the same policy.
|
|
200
202
|
*/
|
|
201
203
|
export declare function buildChildCreateOptions(spec: SubAgentSpec, inherited: InheritedCredentials | undefined): AgentOptions;
|
|
202
|
-
/** SE36 — `SubAgent.create` replaces `defineSubAgent` (ADR 0015). @public
|
|
204
|
+
/** SE36 — `SubAgent.create` replaces `defineSubAgent` (ADR 0015). @public *
|
|
205
|
+
* `SubAgent.create` returns a **`CustomTool`** — the sub-agent is exposed to the
|
|
206
|
+
* parent as a callable tool, not as a `SubAgent` instance.
|
|
207
|
+
*/
|
|
203
208
|
export declare class SubAgent {
|
|
204
209
|
private constructor();
|
|
205
210
|
static create(spec: SubAgentSpec, parentDepth?: number): CustomTool;
|