@theokit/sdk 4.63.4 → 5.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +847 -23
- package/dist/a2a/index.cjs +29 -13
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +26 -11
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +26 -3
- package/dist/a2a/message-bus.d.ts +26 -3
- package/dist/a2a/subagent.d.cts +8 -3
- package/dist/a2a/subagent.d.ts +8 -3
- package/dist/{agent-X0DKA943.d.cts → agent-C3KO5LKm.d.cts} +251 -36
- package/dist/{agent-BFno7Sfn.d.ts → agent-CvmTR9uf.d.ts} +251 -36
- package/dist/agent-GPV2JWZG.cjs +67 -0
- package/dist/{agent-UX7WFI6B.cjs.map → agent-GPV2JWZG.cjs.map} +1 -1
- package/dist/agent-Y24I5JBM.js +58 -0
- package/dist/{agent-A5XMIVNP.js.map → agent-Y24I5JBM.js.map} +1 -1
- package/dist/agent-session-store-AFML3AXC.js +6 -0
- package/dist/{agent-session-store-OPGRB4XM.js.map → agent-session-store-AFML3AXC.js.map} +1 -1
- package/dist/agent-session-store-MTSIY3MH.cjs +23 -0
- package/dist/{agent-session-store-6EL5NPA4.cjs.map → agent-session-store-MTSIY3MH.cjs.map} +1 -1
- package/dist/agent.d.ts +1 -1
- package/dist/auth/index.cjs +33 -34
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +6 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-BXYTW2DP.cjs → batch-I6T6MXZO.cjs} +58 -40
- package/dist/batch-I6T6MXZO.cjs.map +1 -0
- package/dist/{batch-L4ZXS46M.js → batch-US4F6WPK.js} +42 -24
- package/dist/batch-US4F6WPK.js.map +1 -0
- package/dist/chunk-24MGQDK3.js +31 -0
- package/dist/chunk-24MGQDK3.js.map +1 -0
- package/dist/{chunk-UGT7GK7I.cjs → chunk-24SYBZPL.cjs} +36 -18
- package/dist/chunk-24SYBZPL.cjs.map +1 -0
- package/dist/{chunk-KYAJINUI.cjs → chunk-2HPNT6HH.cjs} +581 -401
- package/dist/chunk-2HPNT6HH.cjs.map +1 -0
- package/dist/{chunk-VLVVJLDH.cjs → chunk-2NE7DTOK.cjs} +234 -193
- package/dist/chunk-2NE7DTOK.cjs.map +1 -0
- package/dist/{chunk-N2U4AZGB.js → chunk-2WXHA33T.js} +3 -3
- package/dist/chunk-2WXHA33T.js.map +1 -0
- package/dist/chunk-2XC6KDJM.js +22 -0
- package/dist/chunk-2XC6KDJM.js.map +1 -0
- package/dist/{chunk-L3MTL4NA.js → chunk-2ZLVT7H3.js} +223 -182
- package/dist/chunk-2ZLVT7H3.js.map +1 -0
- package/dist/{chunk-2GUYQR5P.js → chunk-3JHIFQ4I.js} +39 -13
- package/dist/chunk-3JHIFQ4I.js.map +1 -0
- package/dist/{chunk-BU4KFWXF.js → chunk-44I6UYVH.js} +8 -17
- package/dist/chunk-44I6UYVH.js.map +1 -0
- package/dist/{chunk-UNYXQ4M5.js → chunk-47TF32NQ.js} +10 -5
- package/dist/chunk-47TF32NQ.js.map +1 -0
- package/dist/{chunk-WNO3C3N2.cjs → chunk-4A3SKJ53.cjs} +56 -27
- package/dist/chunk-4A3SKJ53.cjs.map +1 -0
- package/dist/{chunk-YML4ME27.cjs → chunk-4HS6FFGL.cjs} +55 -46
- package/dist/chunk-4HS6FFGL.cjs.map +1 -0
- package/dist/{chunk-C72AZW7J.js → chunk-4MMWFSCD.js} +4 -4
- package/dist/chunk-4MMWFSCD.js.map +1 -0
- package/dist/{chunk-6HKGLTJI.cjs → chunk-4NLCWGH7.cjs} +15 -15
- package/dist/chunk-4NLCWGH7.cjs.map +1 -0
- package/dist/{chunk-LKBEROHN.js → chunk-4S5TWFIZ.js} +14 -14
- package/dist/chunk-4S5TWFIZ.js.map +1 -0
- package/dist/{chunk-UBDMVMBZ.js → chunk-55GB6JYQ.js} +33 -22
- package/dist/chunk-55GB6JYQ.js.map +1 -0
- package/dist/{chunk-U6IFHFWK.js → chunk-5WKQDIGO.js} +8 -17
- package/dist/chunk-5WKQDIGO.js.map +1 -0
- package/dist/chunk-67ADYSTW.js +120 -0
- package/dist/chunk-67ADYSTW.js.map +1 -0
- package/dist/{chunk-XL7Q7HB2.cjs → chunk-6LHQPOMI.cjs} +39 -6
- package/dist/chunk-6LHQPOMI.cjs.map +1 -0
- package/dist/{chunk-A4JVILQU.js → chunk-6M2OIS4Y.js} +7 -7
- package/dist/chunk-6M2OIS4Y.js.map +1 -0
- package/dist/{chunk-LWGSI6M3.js → chunk-6PWOWXMC.js} +4 -4
- package/dist/{chunk-LWGSI6M3.js.map → chunk-6PWOWXMC.js.map} +1 -1
- package/dist/{chunk-RNB4APBZ.js → chunk-6WAKKTBO.js} +9 -5
- package/dist/chunk-6WAKKTBO.js.map +1 -0
- package/dist/{chunk-V2BOS4WF.cjs → chunk-7A6535RA.cjs} +11 -11
- package/dist/chunk-7A6535RA.cjs.map +1 -0
- package/dist/{chunk-ZLQSWSJ2.cjs → chunk-7FDKWDA2.cjs} +11 -11
- package/dist/{chunk-ZLQSWSJ2.cjs.map → chunk-7FDKWDA2.cjs.map} +1 -1
- package/dist/{chunk-4VPXM6UU.js → chunk-7I5Z3UBJ.js} +3 -3
- package/dist/{chunk-4VPXM6UU.js.map → chunk-7I5Z3UBJ.js.map} +1 -1
- package/dist/{chunk-B4EOJWOY.cjs → chunk-7JJ3A6AT.cjs} +13 -7
- package/dist/chunk-7JJ3A6AT.cjs.map +1 -0
- package/dist/{chunk-WJVHMTKB.cjs → chunk-AA27GEYS.cjs} +3 -3
- package/dist/{chunk-WJVHMTKB.cjs.map → chunk-AA27GEYS.cjs.map} +1 -1
- package/dist/{chunk-BP46RJ5X.js → chunk-AAEZSPTC.js} +5 -5
- package/dist/{chunk-BP46RJ5X.js.map → chunk-AAEZSPTC.js.map} +1 -1
- package/dist/chunk-AGACYRJ2.js +11 -0
- package/dist/chunk-AGACYRJ2.js.map +1 -0
- package/dist/{chunk-ZZMZWBR6.js → chunk-ALUN2B4W.js} +81 -58
- package/dist/chunk-ALUN2B4W.js.map +1 -0
- package/dist/chunk-ANMJJD6D.cjs +18 -0
- package/dist/chunk-ANMJJD6D.cjs.map +1 -0
- package/dist/{chunk-DXGZ2NUG.cjs → chunk-ATT276RD.cjs} +12 -11
- package/dist/chunk-ATT276RD.cjs.map +1 -0
- package/dist/{chunk-4FFBAUFS.js → chunk-AWINL3ZC.js} +6 -6
- package/dist/chunk-AWINL3ZC.js.map +1 -0
- package/dist/{chunk-UU36SHFY.cjs → chunk-BJUJT5ED.cjs} +9 -8
- package/dist/chunk-BJUJT5ED.cjs.map +1 -0
- package/dist/{chunk-D4CUGAKZ.js → chunk-CZJ6Q7CW.js} +36 -6
- package/dist/chunk-CZJ6Q7CW.js.map +1 -0
- package/dist/{chunk-KQ7TS7WW.cjs → chunk-D6POWE7E.cjs} +37 -26
- package/dist/chunk-D6POWE7E.cjs.map +1 -0
- package/dist/{chunk-AWO27VRZ.js → chunk-DMRT67Y6.js} +6 -5
- package/dist/chunk-DMRT67Y6.js.map +1 -0
- package/dist/{chunk-5VB22SYX.cjs → chunk-DQZU7JK6.cjs} +7 -7
- package/dist/{chunk-5VB22SYX.cjs.map → chunk-DQZU7JK6.cjs.map} +1 -1
- package/dist/{chunk-3NSS2OIZ.cjs → chunk-DRL7URI4.cjs} +6 -6
- package/dist/{chunk-3NSS2OIZ.cjs.map → chunk-DRL7URI4.cjs.map} +1 -1
- package/dist/{chunk-RFXWMRFC.js → chunk-EFMFILPG.js} +14 -6
- package/dist/chunk-EFMFILPG.js.map +1 -0
- package/dist/{chunk-HS7AVXTF.js → chunk-EH6XD3FY.js} +4 -4
- package/dist/chunk-EH6XD3FY.js.map +1 -0
- package/dist/{chunk-KQRW2GPZ.js → chunk-EIQFAOFD.js} +6 -6
- package/dist/chunk-EIQFAOFD.js.map +1 -0
- package/dist/{chunk-XJCXEKMD.cjs → chunk-EXTRW7GW.cjs} +4 -4
- package/dist/chunk-EXTRW7GW.cjs.map +1 -0
- package/dist/{chunk-U54XCYG3.js → chunk-FJWQP6EE.js} +12 -6
- package/dist/chunk-FJWQP6EE.js.map +1 -0
- package/dist/{chunk-O7DK5PBJ.cjs → chunk-FUSDYC2B.cjs} +26 -42
- package/dist/chunk-FUSDYC2B.cjs.map +1 -0
- package/dist/{chunk-4QZSA2HJ.js → chunk-G7BLGBRN.js} +4 -4
- package/dist/chunk-G7BLGBRN.js.map +1 -0
- package/dist/{chunk-BZRFXJHA.js → chunk-GBCVPKHE.js} +55 -26
- package/dist/chunk-GBCVPKHE.js.map +1 -0
- package/dist/chunk-GGZ5GPE3.cjs +130 -0
- package/dist/chunk-GGZ5GPE3.cjs.map +1 -0
- package/dist/{chunk-5HEG4CQH.cjs → chunk-GZV6AVRL.cjs} +8 -8
- package/dist/{chunk-5HEG4CQH.cjs.map → chunk-GZV6AVRL.cjs.map} +1 -1
- package/dist/{chunk-VCLBZAZU.cjs → chunk-H6YM3PV6.cjs} +17 -17
- package/dist/chunk-H6YM3PV6.cjs.map +1 -0
- package/dist/{chunk-RFMBZPOW.cjs → chunk-HCT4HPCL.cjs} +10 -10
- package/dist/chunk-HCT4HPCL.cjs.map +1 -0
- package/dist/{chunk-OSEG74VJ.js → chunk-HFEJE7AC.js} +52 -43
- package/dist/chunk-HFEJE7AC.js.map +1 -0
- package/dist/{chunk-52NKC5HT.cjs → chunk-HUFSABUZ.cjs} +12 -8
- package/dist/chunk-HUFSABUZ.cjs.map +1 -0
- package/dist/{chunk-4CLOXP6H.cjs → chunk-HW7SEELD.cjs} +4 -4
- package/dist/{chunk-4CLOXP6H.cjs.map → chunk-HW7SEELD.cjs.map} +1 -1
- package/dist/{chunk-ZSWPZ23K.cjs → chunk-I2PWY7VM.cjs} +5 -5
- package/dist/chunk-I2PWY7VM.cjs.map +1 -0
- package/dist/{chunk-VJ26EKGJ.cjs → chunk-IJ7M6GOG.cjs} +3 -3
- package/dist/chunk-IJ7M6GOG.cjs.map +1 -0
- package/dist/{chunk-SAVIWMZB.js → chunk-ILGZ2ZZV.js} +3 -3
- package/dist/chunk-ILGZ2ZZV.js.map +1 -0
- package/dist/{chunk-4ZHTIJNE.cjs → chunk-J7J7J2GN.cjs} +87 -63
- package/dist/chunk-J7J7J2GN.cjs.map +1 -0
- package/dist/{chunk-UALX2J2Q.cjs → chunk-JLRLCBJ4.cjs} +38 -11
- package/dist/chunk-JLRLCBJ4.cjs.map +1 -0
- package/dist/{chunk-2QDYBS2A.js → chunk-JMDDYA22.js} +4 -4
- package/dist/chunk-JMDDYA22.js.map +1 -0
- package/dist/{chunk-LXQ6HKPS.js → chunk-JNAA4G4H.js} +3 -3
- package/dist/{chunk-LXQ6HKPS.js.map → chunk-JNAA4G4H.js.map} +1 -1
- package/dist/{chunk-UMP6OJIM.js → chunk-JOFVLOFY.js} +4 -4
- package/dist/{chunk-UMP6OJIM.js.map → chunk-JOFVLOFY.js.map} +1 -1
- package/dist/{chunk-A46SWMIF.js → chunk-K2VMFZQ5.js} +7 -7
- package/dist/chunk-K2VMFZQ5.js.map +1 -0
- package/dist/{chunk-DN2PACRI.js → chunk-K3NH62DG.js} +461 -282
- package/dist/chunk-K3NH62DG.js.map +1 -0
- package/dist/{chunk-LYTOXSRH.js → chunk-KDR53EO7.js} +1939 -1864
- package/dist/chunk-KDR53EO7.js.map +1 -0
- package/dist/{chunk-XWTLIGO3.cjs → chunk-KTTHHYEW.cjs} +5 -5
- package/dist/chunk-KTTHHYEW.cjs.map +1 -0
- package/dist/{chunk-3FFAEAUJ.cjs → chunk-KVSAY6NZ.cjs} +18 -18
- package/dist/chunk-KVSAY6NZ.cjs.map +1 -0
- package/dist/{chunk-IAHZCGBE.cjs → chunk-LHSWHYF3.cjs} +120 -146
- package/dist/chunk-LHSWHYF3.cjs.map +1 -0
- package/dist/{chunk-3OR54XG4.js → chunk-NJWYQWDL.js} +12 -8
- package/dist/chunk-NJWYQWDL.js.map +1 -0
- package/dist/chunk-NVXXWAU7.cjs +13 -0
- package/dist/chunk-NVXXWAU7.cjs.map +1 -0
- package/dist/{chunk-2D34UTDC.js → chunk-O6USDERH.js} +31 -11
- package/dist/chunk-O6USDERH.js.map +1 -0
- package/dist/{chunk-XO4SOZN6.js → chunk-OR6XIWLB.js} +4 -4
- package/dist/{chunk-XO4SOZN6.js.map → chunk-OR6XIWLB.js.map} +1 -1
- package/dist/{chunk-4PYZ5AX3.cjs → chunk-PRZ3BES7.cjs} +16 -8
- package/dist/chunk-PRZ3BES7.cjs.map +1 -0
- package/dist/{chunk-HCZD23VS.cjs → chunk-QC55H6RJ.cjs} +65 -39
- package/dist/chunk-QC55H6RJ.cjs.map +1 -0
- package/dist/{chunk-4O5TGQBW.cjs → chunk-QME6FDFG.cjs} +9 -5
- package/dist/chunk-QME6FDFG.cjs.map +1 -0
- package/dist/chunk-QOGNZMHD.cjs +34 -0
- package/dist/chunk-QOGNZMHD.cjs.map +1 -0
- package/dist/{chunk-7VT4P3Z4.cjs → chunk-QUAEOKDW.cjs} +1642 -1567
- package/dist/chunk-QUAEOKDW.cjs.map +1 -0
- package/dist/{chunk-B2J4ZMZL.cjs → chunk-QWD3CZWE.cjs} +6 -5
- package/dist/chunk-QWD3CZWE.cjs.map +1 -0
- package/dist/{chunk-SZVR77EJ.cjs → chunk-QWD4RDZ3.cjs} +15 -24
- package/dist/chunk-QWD4RDZ3.cjs.map +1 -0
- package/dist/{chunk-7BG5UH3T.cjs → chunk-RHZ6HP23.cjs} +4 -4
- package/dist/chunk-RHZ6HP23.cjs.map +1 -0
- package/dist/{chunk-2HVF2WJY.cjs → chunk-RQMCOFAI.cjs} +8 -8
- package/dist/{chunk-2HVF2WJY.cjs.map → chunk-RQMCOFAI.cjs.map} +1 -1
- package/dist/{chunk-VKJ7V7EB.cjs → chunk-SA6K24NB.cjs} +3 -3
- package/dist/chunk-SA6K24NB.cjs.map +1 -0
- package/dist/{chunk-7AD3ZTZL.js → chunk-SAGRF4IB.js} +3 -3
- package/dist/chunk-SAGRF4IB.js.map +1 -0
- package/dist/{chunk-PUAEFLYK.js → chunk-SVQIW5RJ.js} +4 -4
- package/dist/{chunk-PUAEFLYK.js.map → chunk-SVQIW5RJ.js.map} +1 -1
- package/dist/{chunk-43ZQRWAP.cjs → chunk-SYVWE64W.cjs} +22 -22
- package/dist/chunk-SYVWE64W.cjs.map +1 -0
- package/dist/{chunk-3O42QOMJ.js → chunk-TA3K7SBK.js} +7 -6
- package/dist/chunk-TA3K7SBK.js.map +1 -0
- package/dist/{chunk-LYRDF5TQ.cjs → chunk-TFG5IBZS.cjs} +14 -23
- package/dist/chunk-TFG5IBZS.cjs.map +1 -0
- package/dist/{chunk-GKEFRLU7.cjs → chunk-TMKTSYDS.cjs} +6 -6
- package/dist/{chunk-GKEFRLU7.cjs.map → chunk-TMKTSYDS.cjs.map} +1 -1
- package/dist/{chunk-J24VJOH3.cjs → chunk-UADQJBHR.cjs} +31 -11
- package/dist/chunk-UADQJBHR.cjs.map +1 -0
- package/dist/{chunk-TAZVKYWJ.js → chunk-UBR5PWD7.js} +26 -40
- package/dist/chunk-UBR5PWD7.js.map +1 -0
- package/dist/{chunk-IPYYKCRC.js → chunk-UFPUHJWS.js} +5 -5
- package/dist/{chunk-IPYYKCRC.js.map → chunk-UFPUHJWS.js.map} +1 -1
- package/dist/{chunk-OHLDPWTA.cjs → chunk-UGRS7ZA7.cjs} +15 -15
- package/dist/{chunk-OHLDPWTA.cjs.map → chunk-UGRS7ZA7.cjs.map} +1 -1
- package/dist/{chunk-RIAM53CP.js → chunk-UKMBRMGT.js} +3 -3
- package/dist/chunk-UKMBRMGT.js.map +1 -0
- package/dist/{chunk-L4BDVXIM.js → chunk-UNK4HNJH.js} +97 -123
- package/dist/chunk-UNK4HNJH.js.map +1 -0
- package/dist/{chunk-C3NT3PVE.js → chunk-V22DZIXO.js} +3 -3
- package/dist/chunk-V22DZIXO.js.map +1 -0
- package/dist/{chunk-OFRFZRQ4.cjs → chunk-V6ZY4AX6.cjs} +24 -14
- package/dist/chunk-V6ZY4AX6.cjs.map +1 -0
- package/dist/{chunk-B3IMEBOA.js → chunk-VE6DFSKU.js} +3 -3
- package/dist/{chunk-B3IMEBOA.js.map → chunk-VE6DFSKU.js.map} +1 -1
- package/dist/{chunk-WLQNMXQE.js → chunk-VWUXIVEI.js} +53 -26
- package/dist/chunk-VWUXIVEI.js.map +1 -0
- package/dist/{chunk-GMLBYDW4.cjs → chunk-VXDEKILY.cjs} +108 -109
- package/dist/chunk-VXDEKILY.cjs.map +1 -0
- package/dist/{chunk-ACDLHN3W.js → chunk-WJXOICRC.js} +16 -6
- package/dist/chunk-WJXOICRC.js.map +1 -0
- package/dist/{chunk-7YGCPMGB.js → chunk-XB4GI5RZ.js} +27 -12
- package/dist/chunk-XB4GI5RZ.js.map +1 -0
- package/dist/{chunk-O73J46PV.js → chunk-XDANGA2C.js} +5 -5
- package/dist/{chunk-O73J46PV.js.map → chunk-XDANGA2C.js.map} +1 -1
- package/dist/{chunk-NDGGJQTZ.js → chunk-XJZEBGXD.js} +10 -10
- package/dist/chunk-XJZEBGXD.js.map +1 -0
- package/dist/{chunk-UTSRIDKZ.js → chunk-XYFGKVZ7.js} +3 -3
- package/dist/chunk-XYFGKVZ7.js.map +1 -0
- package/dist/{chunk-RMWTPV3M.cjs → chunk-Y2KYR2ED.cjs} +27 -27
- package/dist/chunk-Y2KYR2ED.cjs.map +1 -0
- package/dist/{chunk-O7LZFG6O.cjs → chunk-YIFFF23U.cjs} +5 -5
- package/dist/chunk-YIFFF23U.cjs.map +1 -0
- package/dist/{chunk-4OTIXDMU.cjs → chunk-YJNYDJ2T.cjs} +12 -4
- package/dist/chunk-YJNYDJ2T.cjs.map +1 -0
- package/dist/{chunk-6JSIEDKL.cjs → chunk-YSTXFWQE.cjs} +13 -7
- package/dist/chunk-YSTXFWQE.cjs.map +1 -0
- package/dist/{chunk-I6HGWHPU.cjs → chunk-Z3NTRKIC.cjs} +4 -4
- package/dist/{chunk-I6HGWHPU.cjs.map → chunk-Z3NTRKIC.cjs.map} +1 -1
- package/dist/{chunk-32WTYBUH.js → chunk-ZH26RNQA.js} +91 -92
- package/dist/chunk-ZH26RNQA.js.map +1 -0
- package/dist/compact-session-BHTPCIHA.cjs +61 -0
- package/dist/{compact-session-QV57KR66.cjs.map → compact-session-BHTPCIHA.cjs.map} +1 -1
- package/dist/compact-session-W4WLJTHA.js +24 -0
- package/dist/{compact-session-RIGOWC4Y.js.map → compact-session-W4WLJTHA.js.map} +1 -1
- package/dist/compaction.cjs +20 -17
- package/dist/compaction.d.cts +15 -1
- package/dist/compaction.d.ts +15 -1
- package/dist/compaction.js +3 -4
- package/dist/concurrency.cjs +6 -7
- package/dist/concurrency.cjs.map +1 -1
- package/dist/concurrency.d.cts +6 -3
- package/dist/concurrency.d.ts +6 -3
- package/dist/concurrency.js +4 -5
- package/dist/concurrency.js.map +1 -1
- package/dist/context/index.cjs +6 -6
- package/dist/context/index.js +3 -3
- package/dist/context-NI33FS2R.cjs +23 -0
- package/dist/{context-WFLTTMK3.cjs.map → context-NI33FS2R.cjs.map} +1 -1
- package/dist/context-Y7B7SI5X.js +6 -0
- package/dist/{context-WI2DFG7V.js.map → context-Y7B7SI5X.js.map} +1 -1
- package/dist/create-skill.d.ts +4 -1
- package/dist/{cron-BuiRPrvt.d.cts → cron-C3PhZED0.d.cts} +8 -2
- package/dist/{cron-C2SIi31n.d.ts → cron-crfMMdAw.d.ts} +8 -2
- package/dist/cron.cjs +46 -45
- package/dist/cron.d.cts +5 -4
- package/dist/cron.d.ts +5 -4
- package/dist/cron.js +45 -44
- package/dist/{errors-BgJH9PHi.d.cts → errors-CLOAyuiv.d.ts} +133 -95
- package/dist/{errors-C5fJUqLk.d.ts → errors-DrDEgyz1.d.cts} +133 -95
- package/dist/errors-base-B5g01neU.d.cts +75 -0
- package/dist/errors-base-B5g01neU.d.ts +75 -0
- package/dist/errors-base.d.ts +73 -0
- package/dist/errors.cjs +25 -22
- package/dist/errors.d.cts +3 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.js +2 -3
- package/dist/eval.cjs +74 -78
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +64 -68
- package/dist/eval.js.map +1 -1
- package/dist/{executor-6CYCA7MI.cjs → executor-XQAOQOHD.cjs} +60 -54
- package/dist/executor-XQAOQOHD.cjs.map +1 -0
- package/dist/{executor-QSEC3MRH.js → executor-ZNDQDX6Q.js} +43 -37
- package/dist/executor-ZNDQDX6Q.js.map +1 -0
- package/dist/filesystem/index.cjs +24 -26
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +20 -22
- package/dist/filesystem/index.js.map +1 -1
- package/dist/filesystem/types.d.cts +11 -5
- package/dist/filesystem/types.d.ts +11 -5
- package/dist/{fork-agent-RSV4E3EA.js → fork-agent-S2EPIML7.js} +3 -3
- package/dist/fork-agent-S2EPIML7.js.map +1 -0
- package/dist/{fork-agent-Y2IK2RYU.cjs → fork-agent-WAEQI2DL.cjs} +4 -4
- package/dist/fork-agent-WAEQI2DL.cjs.map +1 -0
- package/dist/fs-session-store-77JU46UZ.js +10 -0
- package/dist/{fs-session-store-NM6YSTE2.js.map → fs-session-store-77JU46UZ.js.map} +1 -1
- package/dist/fs-session-store-E4U3P56L.cjs +19 -0
- package/dist/{fs-session-store-4PIHT5UX.cjs.map → fs-session-store-E4U3P56L.cjs.map} +1 -1
- package/dist/generate-object-BXV7BZRP.js +7 -0
- package/dist/{generate-object-GUNAUVBX.js.map → generate-object-BXV7BZRP.js.map} +1 -1
- package/dist/generate-object-YBI2TDJ3.cjs +20 -0
- package/dist/{generate-object-R7HTMW7F.cjs.map → generate-object-YBI2TDJ3.cjs.map} +1 -1
- package/dist/generate-object.d.ts +2 -4
- package/dist/index-manager-DXR2RSFI.cjs +26 -0
- package/dist/{index-manager-2SRX45WJ.cjs.map → index-manager-DXR2RSFI.cjs.map} +1 -1
- package/dist/index-manager-QH6OXEV5.js +17 -0
- package/dist/{index-manager-SP4ISSDX.js.map → index-manager-QH6OXEV5.js.map} +1 -1
- package/dist/index.cjs +234 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +243 -41
- package/dist/index.d.ts +243 -41
- package/dist/index.js +140 -102
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-DAR7OUCW.js → inject-session-SUM6TDJF.js} +9 -9
- package/dist/{inject-session-DAR7OUCW.js.map → inject-session-SUM6TDJF.js.map} +1 -1
- package/dist/inject-session-W6A46J3E.cjs +29 -0
- package/dist/{inject-session-WQKMC3GR.cjs.map → inject-session-W6A46J3E.cjs.map} +1 -1
- package/dist/interactive/index.cjs +12 -6
- package/dist/interactive/index.cjs.map +1 -1
- package/dist/interactive/index.js +12 -6
- package/dist/interactive/index.js.map +1 -1
- package/dist/interactive/types.d.cts +14 -4
- package/dist/interactive/types.d.ts +14 -4
- package/dist/internal/agent-loop/loop-context-init.d.ts +1 -1
- package/dist/internal/agent-loop/loop-finalize.d.ts +25 -0
- package/dist/internal/agent-loop/loop.d.ts +1 -1
- package/dist/internal/agent-loop/message-builders.d.ts +1 -1
- package/dist/internal/agent-loop/tool-dispatch.d.ts +2 -2
- package/dist/internal/agent-loop/usage-and-cost.d.ts +1 -1
- package/dist/internal/auth/credential-availability.d.ts +61 -0
- package/dist/internal/auth/credential-store.d.ts +1 -1
- package/dist/internal/auth/oauth-device.d.ts +1 -1
- package/dist/internal/auth/oauth-engine.d.ts +1 -1
- package/dist/internal/auth/resolve-credential.d.ts +1 -1
- package/dist/internal/base-url.d.ts +14 -0
- package/dist/internal/cloud-agent/cloud-config-serializer.d.ts +1 -1
- package/dist/internal/{runtime/concurrency → concurrency}/subagent-credentials.d.ts +2 -2
- package/dist/internal/emit-run-event.d.ts +16 -0
- package/dist/internal/error-mappers/shared.d.ts +14 -1
- package/dist/internal/eval/assert.d.ts +2 -1
- package/dist/internal/eval/single-flight.d.ts +2 -1
- package/dist/internal/global-singleton.d.ts +6 -3
- package/dist/internal/llm/responses.d.ts +10 -0
- package/dist/internal/local-agent/local-agent-bootstrap.d.ts +5 -3
- package/dist/internal/local-agent/local-agent-capabilities.d.ts +38 -0
- package/dist/internal/local-agent/local-agent-dispatch.d.ts +2 -2
- package/dist/internal/local-agent/local-agent-memory-provider.d.ts +1 -1
- package/dist/internal/local-agent/local-agent-personality-extensions.d.ts +25 -1
- package/dist/internal/local-agent/local-agent-send.d.ts +42 -1
- package/dist/internal/local-agent/real-local-run-mcp.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-options.d.ts +26 -0
- package/dist/internal/local-agent/real-local-run-tools.d.ts +21 -4
- package/dist/internal/local-agent/real-local-run.d.ts +2 -2
- package/dist/internal/mcp/handshake-timeout.d.ts +53 -0
- package/dist/internal/memory/active-memory.d.ts +1 -1
- package/dist/internal/memory/adapters/index.cjs +10 -10
- package/dist/internal/memory/adapters/index.js +9 -9
- package/dist/internal/memory/adapters/openai-embedding.d.cts +10 -0
- package/dist/internal/memory/adapters/openai-embedding.d.ts +10 -0
- package/dist/internal/memory/corpus-sync.d.ts +23 -0
- package/dist/internal/memory/index-db.d.ts +15 -1
- package/dist/internal/memory/index-manager-contract.d.ts +12 -0
- package/dist/internal/memory/index-manager.d.ts +4 -10
- package/dist/internal/memory/index-repository.d.ts +58 -0
- package/dist/internal/memory/lance-memory-adapter.d.ts +16 -14
- package/dist/internal/memory/memory-index.d.ts +15 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +54 -1
- package/dist/internal/memory/storage/index.cjs +39 -40
- package/dist/internal/memory/storage/index.js +10 -11
- package/dist/internal/memory/storage/memory-root.d.cts +2 -3
- package/dist/internal/memory/storage/memory-root.d.ts +2 -3
- package/dist/internal/persistence/atomic-write.d.cts +4 -4
- package/dist/internal/persistence/atomic-write.d.ts +4 -4
- package/dist/internal/persistence/index.cjs +24 -25
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +7 -8
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/jsonl.d.cts +3 -1
- package/dist/internal/persistence/jsonl.d.ts +3 -1
- package/dist/internal/persistence/paths.d.cts +25 -12
- package/dist/internal/persistence/paths.d.ts +25 -12
- package/dist/internal/persistence/transcript-ops.d.cts +11 -2
- package/dist/internal/persistence/transcript-ops.d.ts +11 -2
- package/dist/internal/plugins/context.d.cts +0 -10
- package/dist/internal/plugins/context.d.ts +0 -10
- package/dist/internal/plugins/types.d.cts +1 -1
- package/dist/internal/plugins/types.d.ts +1 -1
- package/dist/internal/providers/catalog-schema.d.ts +94 -0
- package/dist/internal/providers/catalog-source-models-dev.d.ts +11 -0
- package/dist/internal/runtime/compat/compat-config-file.d.ts +31 -0
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +58 -34
- package/dist/internal/runtime/compression/compression-model-registry.d.ts +1 -1
- package/dist/internal/runtime/compression/compression-summarizer.d.ts +5 -1
- package/dist/internal/runtime/fixtures/fixture-events.d.ts +1 -1
- package/dist/internal/runtime/fixtures/fixture-mode.d.ts +8 -14
- package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +1 -1
- package/dist/internal/runtime/fixtures/fixture-scripts.d.ts +2 -2
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +6 -1
- package/dist/internal/runtime/lifecycle/wrap-completion-check-run.d.ts +1 -1
- package/dist/internal/runtime/{memory → memory-glue}/memory-provider.d.ts +1 -1
- package/dist/internal/runtime/{plugins → plugin-loader}/plugin-bundles.d.ts +4 -1
- package/dist/internal/runtime/processors/wrap-output-run.d.ts +1 -1
- package/dist/internal/runtime/registry/live-agent-registry.d.ts +9 -1
- package/dist/internal/runtime/system-prompt/local-assembly.d.ts +2 -1
- package/dist/internal/scorers/llm-judge.d.ts +12 -0
- package/dist/internal/security/index.cjs +14 -15
- package/dist/internal/security/index.d.cts +6 -1
- package/dist/internal/security/index.d.ts +6 -1
- package/dist/internal/security/index.js +4 -5
- package/dist/internal/security/path-containment.d.ts +24 -0
- package/dist/internal/session/agent-session-store.d.ts +1 -1
- package/dist/internal/session/agent-session.d.ts +1 -1
- package/dist/internal/session/index.d.ts +1 -1
- package/dist/internal/session/session-cache.d.ts +9 -3
- package/dist/internal/task/registry.d.ts +1 -1
- package/dist/internal/task/store.d.ts +1 -1
- package/dist/internal/task/subscribe.d.ts +1 -1
- package/dist/internal/task/task-id.d.ts +22 -0
- package/dist/internal/telemetry/adapter-registry.d.ts +12 -2
- package/dist/internal/telemetry/adapters/braintrust.d.ts +6 -1
- package/dist/internal/telemetry/adapters/langsmith.d.ts +6 -1
- package/dist/internal/workflow/executor.d.ts +2 -1
- package/dist/internal/workflow/snapshot-store.d.ts +1 -1
- package/dist/internal/workflow/step-branch.d.ts +2 -2
- package/dist/internal/workflow/step-dowhile.d.ts +2 -2
- package/dist/internal/workflow/step-execution.d.ts +25 -0
- package/dist/internal/workflow/step-foreach.d.ts +2 -2
- package/dist/internal/workflow/step-parallel.d.ts +2 -2
- package/dist/judge-call-6MVARKU2.js +5 -0
- package/dist/{judge-call-LVXABPS3.js.map → judge-call-6MVARKU2.js.map} +1 -1
- package/dist/judge-call-I3P4D5QR.cjs +22 -0
- package/dist/{judge-call-LAHMBJ57.cjs.map → judge-call-I3P4D5QR.cjs.map} +1 -1
- package/dist/mcp-auth.cjs +14 -15
- package/dist/mcp-auth.cjs.map +1 -1
- package/dist/mcp-auth.d.cts +2 -0
- package/dist/mcp-auth.d.ts +2 -0
- package/dist/mcp-auth.js +4 -5
- package/dist/mcp-auth.js.map +1 -1
- package/dist/models.cjs +52 -42
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +39 -29
- package/dist/models.js.map +1 -1
- package/dist/oauth-transaction-store-5RIR6D5C.js +5 -0
- package/dist/{oauth-transaction-store-W52KVHQ4.js.map → oauth-transaction-store-5RIR6D5C.js.map} +1 -1
- package/dist/oauth-transaction-store-SXIE57OD.cjs +38 -0
- package/dist/{oauth-transaction-store-BT4GLTLK.cjs.map → oauth-transaction-store-SXIE57OD.cjs.map} +1 -1
- package/dist/path-safety.cjs +11 -12
- package/dist/path-safety.d.cts +2 -0
- package/dist/path-safety.d.ts +2 -0
- package/dist/path-safety.js +4 -5
- package/dist/permission-engine.d.ts +10 -17
- package/dist/persistence.cjs +31 -31
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +9 -1
- package/dist/persistence.d.ts +9 -1
- package/dist/persistence.js +12 -13
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -6
- package/dist/project.cjs.map +1 -1
- package/dist/project.js +3 -4
- package/dist/project.js.map +1 -1
- package/dist/providers.cjs +10 -10
- package/dist/providers.d.cts +2 -0
- package/dist/providers.d.ts +2 -0
- package/dist/providers.js +8 -8
- package/dist/registry-BZQFYRTL.cjs +46 -0
- package/dist/{registry-V7BDQ6QB.cjs.map → registry-BZQFYRTL.cjs.map} +1 -1
- package/dist/registry-DMWCJKRF.js +9 -0
- package/dist/{registry-75W33OGL.js.map → registry-DMWCJKRF.js.map} +1 -1
- package/dist/retry.cjs +4 -5
- package/dist/retry.d.cts +20 -5
- package/dist/retry.d.ts +20 -5
- package/dist/retry.js +3 -4
- package/dist/{run-BYSHf58D.d.ts → run-CTAdRU3U.d.cts} +120 -152
- package/dist/{run-BYSHf58D.d.cts → run-CTAdRU3U.d.ts} +120 -152
- package/dist/{run-until-HEQOUVU6.js → run-until-6D6TQ4JN.js} +27 -59
- package/dist/run-until-6D6TQ4JN.js.map +1 -0
- package/dist/{run-until-U2B5FJJI.cjs → run-until-DG2KXWB2.cjs} +27 -59
- package/dist/run-until-DG2KXWB2.cjs.map +1 -0
- package/dist/sandbox/bwrap.d.cts +11 -1
- package/dist/sandbox/bwrap.d.ts +11 -1
- package/dist/sandbox/index.cjs +26 -30
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +8 -1
- package/dist/sandbox/index.d.ts +8 -1
- package/dist/sandbox/index.js +10 -14
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +20 -4
- package/dist/sandbox/linux-sandbox.d.ts +20 -4
- package/dist/sandbox/types.d.cts +18 -2
- package/dist/sandbox/types.d.ts +18 -2
- package/dist/sanitize/index.cjs +2 -2
- package/dist/sanitize/index.js +1 -1
- package/dist/sanitize/types.d.cts +15 -2
- package/dist/sanitize/types.d.ts +15 -2
- package/dist/{sdk-agent-D8qJVkuV.d.ts → sdk-agent-BOiKqOgL.d.cts} +197 -117
- package/dist/{sdk-agent-DEoKhA8a.d.cts → sdk-agent-D4a_BR_6.d.ts} +197 -117
- package/dist/server/auth/errors.d.cts +4 -3
- package/dist/server/auth/errors.d.ts +4 -3
- package/dist/server/auth/index.cjs +28 -28
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.d.cts +28 -5
- package/dist/server/auth/index.d.ts +28 -5
- package/dist/server/auth/index.js +13 -13
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/oauth-transaction-store.d.cts +2 -1
- package/dist/server/auth/oauth-transaction-store.d.ts +2 -1
- package/dist/server/auth/orchestrator.d.cts +4 -1
- package/dist/server/auth/orchestrator.d.ts +4 -1
- package/dist/server/auth/types.d.cts +18 -0
- package/dist/server/auth/types.d.ts +18 -0
- package/dist/server/errors-envelope.cjs +14 -15
- package/dist/server/errors-envelope.cjs.map +1 -1
- package/dist/server/errors-envelope.d.cts +3 -3
- package/dist/server/errors-envelope.d.ts +3 -3
- package/dist/server/errors-envelope.js +3 -4
- package/dist/server/errors-envelope.js.map +1 -1
- package/dist/session-transcript-LGHSNVY5.cjs +62 -0
- package/dist/{session-transcript-6WNITKRE.cjs.map → session-transcript-LGHSNVY5.cjs.map} +1 -1
- package/dist/session-transcript-VTBTCGQX.js +5 -0
- package/dist/{session-transcript-XAEKW6P7.js.map → session-transcript-VTBTCGQX.js.map} +1 -1
- package/dist/skills.cjs +8 -9
- package/dist/skills.js +6 -7
- package/dist/stream-object-HBFMIZLD.js +7 -0
- package/dist/{stream-object-UF4QRQRU.js.map → stream-object-HBFMIZLD.js.map} +1 -1
- package/dist/stream-object-QSKHISDJ.cjs +20 -0
- package/dist/{stream-object-ZJTQNKY3.cjs.map → stream-object-QSKHISDJ.cjs.map} +1 -1
- package/dist/stream-object.d.ts +2 -4
- package/dist/subagents-loader-TPZLTXYZ.cjs +16 -0
- package/dist/{subagents-loader-UCNO7FUH.cjs.map → subagents-loader-TPZLTXYZ.cjs.map} +1 -1
- package/dist/subagents-loader-Y6JFYXAY.js +7 -0
- package/dist/{subagents-loader-XP5ERVDZ.js.map → subagents-loader-Y6JFYXAY.js.map} +1 -1
- package/dist/subagents-loader.cjs +7 -8
- package/dist/subagents-loader.cjs.map +1 -1
- package/dist/subagents-loader.d.cts +5 -3
- package/dist/subagents-loader.d.ts +5 -3
- package/dist/subagents-loader.js +5 -6
- package/dist/subagents-loader.js.map +1 -1
- package/dist/subagents.cjs +2 -2
- package/dist/subagents.cjs.map +1 -1
- package/dist/subagents.js +1 -1
- package/dist/subagents.js.map +1 -1
- package/dist/subscription/define-subscription.d.cts +4 -1
- package/dist/subscription/define-subscription.d.ts +4 -1
- package/dist/subscription/index.cjs +4 -5
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.d.cts +2 -0
- package/dist/subscription/index.d.ts +2 -0
- package/dist/subscription/index.js +3 -4
- package/dist/subscription/index.js.map +1 -1
- package/dist/subscription/internal/server-integration.d.cts +5 -0
- package/dist/subscription/internal/server-integration.d.ts +5 -0
- package/dist/subscription/internal/subscription-runtime.d.cts +13 -1
- package/dist/subscription/internal/subscription-runtime.d.ts +13 -1
- package/dist/task-errors.d.ts +58 -0
- package/dist/task-store.cjs +7 -8
- package/dist/task-store.d.cts +2 -0
- package/dist/task-store.d.ts +2 -0
- package/dist/task-store.js +4 -5
- package/dist/types/agent-prims.d.ts +21 -0
- package/dist/types/agent.d.ts +109 -15
- package/dist/types/batch.d.ts +3 -0
- package/dist/types/budget-tracker.d.ts +3 -0
- package/dist/types/budget.d.ts +12 -3
- package/dist/types/content-blocks.d.ts +3 -0
- package/dist/types/context.d.ts +3 -0
- package/dist/types/conversation.d.ts +5 -0
- package/dist/types/cron.d.ts +5 -0
- package/dist/types/env-policy.d.ts +3 -0
- package/dist/types/eval.d.ts +3 -0
- package/dist/types/fork.d.ts +3 -0
- package/dist/types/goal-events.d.ts +3 -0
- package/dist/types/mcp.d.ts +5 -0
- package/dist/types/memory-adapter.d.ts +3 -0
- package/dist/types/memory-provider.d.ts +44 -5
- package/dist/types/messages-base.d.ts +4 -0
- package/dist/types/messages.d.ts +5 -0
- package/dist/types/plugin.d.ts +32 -4
- package/dist/types/processors.d.ts +3 -0
- package/dist/types/provider-profile.d.ts +3 -0
- package/dist/types/providers.d.ts +3 -0
- package/dist/types/run-events.d.ts +36 -9
- package/dist/types/run.d.ts +29 -2
- package/dist/types/sdk-agent.d.ts +71 -1
- package/dist/types/session-message.d.ts +3 -0
- package/dist/types/session-record.d.ts +3 -0
- package/dist/types/session-store.d.ts +45 -0
- package/dist/types/task.d.ts +3 -11
- package/dist/types/theokit.d.ts +3 -0
- package/dist/types/trajectory.d.ts +3 -0
- package/dist/types/updates.d.ts +5 -0
- package/dist/types/usage.d.ts +4 -1
- package/dist/types/workflow.d.ts +13 -135
- package/dist/workflow-as-tool.d.ts +66 -0
- package/dist/workflow-errors.d.ts +164 -0
- package/dist/workflow.cjs +29 -30
- package/dist/workflow.d.cts +135 -74
- package/dist/workflow.d.ts +135 -74
- package/dist/workflow.js +8 -9
- package/docs/adr/README.md +2604 -0
- package/docs/error-codes.md +139 -105
- package/docs/harness-capability-map.md +32 -20
- package/docs/memory-decisions.md +1 -1
- package/package.json +3 -7
- package/bin/theokit-migrate-config.mjs +0 -278
- package/bin/theokit-migrate-memory.mjs +0 -116
- package/dist/agent-A5XMIVNP.js +0 -57
- package/dist/agent-UX7WFI6B.cjs +0 -66
- package/dist/agent-session-store-6EL5NPA4.cjs +0 -24
- package/dist/agent-session-store-OPGRB4XM.js +0 -7
- package/dist/batch-BXYTW2DP.cjs.map +0 -1
- package/dist/batch-L4ZXS46M.js.map +0 -1
- package/dist/chunk-247ZTLNU.js +0 -73
- package/dist/chunk-247ZTLNU.js.map +0 -1
- package/dist/chunk-2D34UTDC.js.map +0 -1
- package/dist/chunk-2GUYQR5P.js.map +0 -1
- package/dist/chunk-2QDYBS2A.js.map +0 -1
- package/dist/chunk-32WTYBUH.js.map +0 -1
- package/dist/chunk-3FFAEAUJ.cjs.map +0 -1
- package/dist/chunk-3O42QOMJ.js.map +0 -1
- package/dist/chunk-3OR54XG4.js.map +0 -1
- package/dist/chunk-43ZQRWAP.cjs.map +0 -1
- package/dist/chunk-4FFBAUFS.js.map +0 -1
- package/dist/chunk-4O5TGQBW.cjs.map +0 -1
- package/dist/chunk-4OTIXDMU.cjs.map +0 -1
- package/dist/chunk-4PYZ5AX3.cjs.map +0 -1
- package/dist/chunk-4QZSA2HJ.js.map +0 -1
- package/dist/chunk-4ZHTIJNE.cjs.map +0 -1
- package/dist/chunk-52NKC5HT.cjs.map +0 -1
- package/dist/chunk-6HKGLTJI.cjs.map +0 -1
- package/dist/chunk-6JSIEDKL.cjs.map +0 -1
- package/dist/chunk-7AD3ZTZL.js.map +0 -1
- package/dist/chunk-7BG5UH3T.cjs.map +0 -1
- package/dist/chunk-7VT4P3Z4.cjs.map +0 -1
- package/dist/chunk-7YGCPMGB.js.map +0 -1
- package/dist/chunk-A46SWMIF.js.map +0 -1
- package/dist/chunk-A4JVILQU.js.map +0 -1
- package/dist/chunk-ACDLHN3W.js.map +0 -1
- package/dist/chunk-AKJP2STZ.cjs +0 -81
- package/dist/chunk-AKJP2STZ.cjs.map +0 -1
- package/dist/chunk-AWO27VRZ.js.map +0 -1
- package/dist/chunk-B2J4ZMZL.cjs.map +0 -1
- package/dist/chunk-B4EOJWOY.cjs.map +0 -1
- package/dist/chunk-BU4KFWXF.js.map +0 -1
- package/dist/chunk-BZRFXJHA.js.map +0 -1
- package/dist/chunk-C3NT3PVE.js.map +0 -1
- package/dist/chunk-C72AZW7J.js.map +0 -1
- package/dist/chunk-D4CUGAKZ.js.map +0 -1
- package/dist/chunk-DN2PACRI.js.map +0 -1
- package/dist/chunk-DXGZ2NUG.cjs.map +0 -1
- package/dist/chunk-EG4QM7ZJ.cjs +0 -39
- package/dist/chunk-EG4QM7ZJ.cjs.map +0 -1
- package/dist/chunk-GMLBYDW4.cjs.map +0 -1
- package/dist/chunk-HCZD23VS.cjs.map +0 -1
- package/dist/chunk-HS7AVXTF.js.map +0 -1
- package/dist/chunk-IAHZCGBE.cjs.map +0 -1
- package/dist/chunk-J24VJOH3.cjs.map +0 -1
- package/dist/chunk-JPBKYL3B.cjs +0 -18
- package/dist/chunk-JPBKYL3B.cjs.map +0 -1
- package/dist/chunk-KQ7TS7WW.cjs.map +0 -1
- package/dist/chunk-KQRW2GPZ.js.map +0 -1
- package/dist/chunk-KYAJINUI.cjs.map +0 -1
- package/dist/chunk-L3MTL4NA.js.map +0 -1
- package/dist/chunk-L4BDVXIM.js.map +0 -1
- package/dist/chunk-LKBEROHN.js.map +0 -1
- package/dist/chunk-LYRDF5TQ.cjs.map +0 -1
- package/dist/chunk-LYTOXSRH.js.map +0 -1
- package/dist/chunk-N2U4AZGB.js.map +0 -1
- package/dist/chunk-NDGGJQTZ.js.map +0 -1
- package/dist/chunk-O7DK5PBJ.cjs.map +0 -1
- package/dist/chunk-O7LZFG6O.cjs.map +0 -1
- package/dist/chunk-OFRFZRQ4.cjs.map +0 -1
- package/dist/chunk-OSEG74VJ.js.map +0 -1
- package/dist/chunk-RFMBZPOW.cjs.map +0 -1
- package/dist/chunk-RFXWMRFC.js.map +0 -1
- package/dist/chunk-RIAM53CP.js.map +0 -1
- package/dist/chunk-RMWTPV3M.cjs.map +0 -1
- package/dist/chunk-RNB4APBZ.js.map +0 -1
- package/dist/chunk-SAVIWMZB.js.map +0 -1
- package/dist/chunk-SZVR77EJ.cjs.map +0 -1
- package/dist/chunk-TAZVKYWJ.js.map +0 -1
- package/dist/chunk-U54XCYG3.js.map +0 -1
- package/dist/chunk-U6IFHFWK.js.map +0 -1
- package/dist/chunk-UALX2J2Q.cjs.map +0 -1
- package/dist/chunk-UBDMVMBZ.js.map +0 -1
- package/dist/chunk-UGT7GK7I.cjs.map +0 -1
- package/dist/chunk-UNYXQ4M5.js.map +0 -1
- package/dist/chunk-UTSRIDKZ.js.map +0 -1
- package/dist/chunk-UU36SHFY.cjs.map +0 -1
- package/dist/chunk-V2BOS4WF.cjs.map +0 -1
- package/dist/chunk-VCLBZAZU.cjs.map +0 -1
- package/dist/chunk-VJ26EKGJ.cjs.map +0 -1
- package/dist/chunk-VKJ7V7EB.cjs.map +0 -1
- package/dist/chunk-VLVVJLDH.cjs.map +0 -1
- package/dist/chunk-WLQNMXQE.js.map +0 -1
- package/dist/chunk-WNO3C3N2.cjs.map +0 -1
- package/dist/chunk-WTMU7J4U.js +0 -14
- package/dist/chunk-WTMU7J4U.js.map +0 -1
- package/dist/chunk-XEQ3TM66.js +0 -35
- package/dist/chunk-XEQ3TM66.js.map +0 -1
- package/dist/chunk-XJCXEKMD.cjs.map +0 -1
- package/dist/chunk-XL7Q7HB2.cjs.map +0 -1
- package/dist/chunk-XWTLIGO3.cjs.map +0 -1
- package/dist/chunk-YML4ME27.cjs.map +0 -1
- package/dist/chunk-ZSWPZ23K.cjs.map +0 -1
- package/dist/chunk-ZZMZWBR6.js.map +0 -1
- package/dist/compact-session-QV57KR66.cjs +0 -59
- package/dist/compact-session-RIGOWC4Y.js +0 -22
- package/dist/context-WFLTTMK3.cjs +0 -24
- package/dist/context-WI2DFG7V.js +0 -7
- package/dist/executor-6CYCA7MI.cjs.map +0 -1
- package/dist/executor-QSEC3MRH.js.map +0 -1
- package/dist/fork-agent-RSV4E3EA.js.map +0 -1
- package/dist/fork-agent-Y2IK2RYU.cjs.map +0 -1
- package/dist/fs-session-store-4PIHT5UX.cjs +0 -20
- package/dist/fs-session-store-NM6YSTE2.js +0 -11
- package/dist/generate-object-GUNAUVBX.js +0 -8
- package/dist/generate-object-R7HTMW7F.cjs +0 -21
- package/dist/index-manager-2SRX45WJ.cjs +0 -27
- package/dist/index-manager-SP4ISSDX.js +0 -18
- package/dist/inject-session-WQKMC3GR.cjs +0 -29
- package/dist/internal/persistence/credential-pool-store.d.cts +0 -32
- package/dist/internal/persistence/credential-pool-store.d.ts +0 -32
- package/dist/internal/runtime/memory/memory-path-selector.d.ts +0 -73
- package/dist/judge-call-LAHMBJ57.cjs +0 -23
- package/dist/judge-call-LVXABPS3.js +0 -6
- package/dist/oauth-transaction-store-BT4GLTLK.cjs +0 -36
- package/dist/oauth-transaction-store-W52KVHQ4.js +0 -3
- package/dist/registry-75W33OGL.js +0 -10
- package/dist/registry-V7BDQ6QB.cjs +0 -47
- package/dist/run-until-HEQOUVU6.js.map +0 -1
- package/dist/run-until-U2B5FJJI.cjs.map +0 -1
- package/dist/server/adapter/express.d.cts +0 -9
- package/dist/server/adapter/express.d.ts +0 -9
- package/dist/server/adapter/fastify.d.cts +0 -9
- package/dist/server/adapter/fastify.d.ts +0 -9
- package/dist/server/adapter/hono.d.cts +0 -9
- package/dist/server/adapter/hono.d.ts +0 -9
- package/dist/server/adapter/shared-handler.d.cts +0 -9
- package/dist/server/adapter/shared-handler.d.ts +0 -9
- package/dist/server/adapter/types.d.cts +0 -33
- package/dist/server/adapter/types.d.ts +0 -33
- package/dist/session-transcript-6WNITKRE.cjs +0 -63
- package/dist/session-transcript-XAEKW6P7.js +0 -6
- package/dist/stream-object-UF4QRQRU.js +0 -8
- package/dist/stream-object-ZJTQNKY3.cjs +0 -21
- package/dist/subagents-loader-UCNO7FUH.cjs +0 -17
- package/dist/subagents-loader-XP5ERVDZ.js +0 -8
- /package/dist/{batch.d.ts → internal/agent/batch.d.ts} +0 -0
- /package/dist/{agent-helpers.d.ts → internal/agent/helpers.d.ts} +0 -0
- /package/dist/internal/agent-loop/{loop-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/auth/{auth-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/cloud-agent/{cloud-payload-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/abort-utils.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/async-local-storage.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/async-semaphore.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/delegation-depth.d.ts +0 -0
- /package/dist/internal/{runtime/concurrency → concurrency}/map-with-concurrency.d.ts +0 -0
- /package/dist/internal/{runtime/retry → error-mappers}/default-retriable.d.ts +0 -0
- /package/dist/internal/{runtime/fixtures/fixture-types.d.ts → memory/storage/list-markdown.d.cts} +0 -0
- /package/dist/internal/{runtime/plugins/plugins-manager.d.ts → memory/storage/list-markdown.d.ts} +0 -0
- /package/dist/internal/{resilience → retry}/circuit-breaker.d.ts +0 -0
- /package/dist/internal/{runtime/retry → retry}/with-retry.d.ts +0 -0
- /package/dist/internal/{security/secret-redactor.d.cts → runtime/fixtures/types.d.ts} +0 -0
- /package/dist/internal/runtime/{memory → memory-glue}/memory-store.d.ts +0 -0
- /package/dist/internal/runtime/{memory → memory-glue}/select-facts.d.ts +0 -0
- /package/dist/internal/runtime/{plugins → plugin-loader}/plugin-frontmatter.d.ts +0 -0
- /package/dist/internal/{security/secret-redactor.d.ts → runtime/plugin-loader/plugins-manager.d.ts} +0 -0
- /package/dist/internal/runtime/{reasoning → system-prompt}/native-reasoning.d.ts +0 -0
- /package/dist/internal/{runtime/context/path-containment.d.ts → security/path-containment.d.cts} +0 -0
- /package/dist/internal/session/{session-types.d.ts → types.d.ts} +0 -0
- /package/dist/internal/{zod/to-json-schema.d.ts → zod-to-json-schema.d.ts} +0 -0
- /package/dist/subscription/internal/{adapter-types.d.cts → types.d.cts} +0 -0
- /package/dist/subscription/internal/{adapter-types.d.ts → types.d.ts} +0 -0
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
+
* Owner: `types/` (2 of 2 importers: conversation.ts, updates.ts). The only module in this folder
|
|
5
|
+
* whose owner IS the layer — it exists to break a type-only cycle BETWEEN two of its siblings, so
|
|
6
|
+
* pointing it at a subsystem would name something that does not use it.
|
|
7
|
+
*
|
|
4
8
|
* Type-leaf — base message types shared between `conversation.ts` and
|
|
5
9
|
* `updates.ts`. Extracted to break LOW type-only cycle #6 (audit
|
|
6
10
|
* `architecture-output/final_report.md`) per plan arch-review-fixes-2026-06-06
|
|
@@ -21,6 +25,12 @@ interface UserMessage {
|
|
|
21
25
|
text: string;
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Owner: `internal/agent-loop/` (1 of 1 importers). Derived from the import graph, not declared —
|
|
30
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
35
|
* Single tool call event. The internal `args` and `result` shapes are NOT stable.
|
|
26
36
|
*
|
|
@@ -201,148 +211,9 @@ interface ShellOutputDeltaUpdate {
|
|
|
201
211
|
type InteractionUpdate = TextDeltaUpdate | ThinkingDeltaUpdate | ThinkingCompletedUpdate | ToolCallStartedUpdate | ToolCallCompletedUpdate | PartialToolCallUpdate | TokenDeltaUpdate | StepStartedUpdate | StepCompletedUpdate | TurnEndedUpdate | UserMessageAppendedUpdate | SummaryUpdate | SummaryStartedUpdate | SummaryCompletedUpdate | ShellOutputDeltaUpdate;
|
|
202
212
|
|
|
203
213
|
/**
|
|
204
|
-
* `
|
|
205
|
-
*
|
|
206
|
-
* Evaluates a tool name (and optional arguments, #55) against an ordered list
|
|
207
|
-
* of rules. First matching rule wins; when no rule matches the `defaultAction`
|
|
208
|
-
* is returned. #55 — the default is now `"ask"` (FAIL-CLOSED): a permission
|
|
209
|
-
* engine that cannot positively allow must not silently allow. Opt back into
|
|
210
|
-
* the previous fail-open behavior with `{ defaultAction: "allow" }`.
|
|
211
|
-
*/
|
|
212
|
-
type PermissionAction = "allow" | "deny" | "ask";
|
|
213
|
-
/**
|
|
214
|
-
* SE1 — a per-run permission MODE that adjusts the rule-engine verdict globally.
|
|
215
|
-
* A PURE post-processor of the verdict (no tool-safety metadata needed, so it fits
|
|
216
|
-
* a bring-your-own-tools runtime). Grounded in a peer project (plan agent = deny-all,
|
|
217
|
-
* `dangerously-skip-permissions`) + Codex (`AskForApproval`: `OnRequest` default,
|
|
218
|
-
* `Never`, `UnlessTrusted`). See {@link applyMode} for the exact table.
|
|
219
|
-
*
|
|
220
|
-
* - `default` — verdict as-is (rules decide; unmatched ⇒ `ask`, fail-closed).
|
|
221
|
-
* - `plan` — read-only: `allow` rules pass, everything else ⇒ `deny` (mutations blocked).
|
|
222
|
-
* NOTE: `plan` gates on the resolved verdict, so an engine configured with
|
|
223
|
-
* `{ defaultAction: "allow" }` still yields `allow` for UNMATCHED calls under
|
|
224
|
-
* `plan` — pair `plan` with the default fail-closed engine (`defaultAction: "ask"`)
|
|
225
|
-
* for full read-only behavior.
|
|
226
|
-
* - `acceptEdits` — auto-approve the UNMATCHED verdict, but STILL honor an explicit
|
|
227
|
-
* `ask` rule (a caller gates a risky tool with an ask rule). Codex `UnlessTrusted`.
|
|
228
|
-
* - `bypass` (alias `bypassPermissions`, the Anthropic-exact name) — everything ⇒
|
|
229
|
-
* `allow` EXCEPT an explicit `deny` rule. Never asks. a peer project
|
|
230
|
-
* `dangerously-skip-permissions` / Codex `Never` / Anthropic `bypassPermissions`.
|
|
231
|
-
*/
|
|
232
|
-
type PermissionMode = "default" | "plan" | "acceptEdits" | "bypass" | "bypassPermissions";
|
|
233
|
-
/**
|
|
234
|
-
* SE1 — apply a {@link PermissionMode} to a rule-engine verdict. Pure.
|
|
235
|
-
*
|
|
236
|
-
* `explicit` is `true` when the verdict came from a rule that matched by name (and
|
|
237
|
-
* args), `false` when it is the fail-closed default for an unmatched call. The flag
|
|
238
|
-
* is load-bearing for `acceptEdits`, which auto-approves the unmatched default but
|
|
239
|
-
* keeps honoring an explicit `ask` rule (unlike `bypass`, which allows even that).
|
|
240
|
-
*
|
|
241
|
-
* INVARIANT (both a peer project + Codex): an explicit `deny` is immune to EVERY
|
|
242
|
-
* auto-approve mode — `bypass`/`acceptEdits` never un-deny.
|
|
243
|
-
*/
|
|
244
|
-
declare function applyMode(verdict: PermissionAction, mode: PermissionMode, explicit: boolean): PermissionAction;
|
|
245
|
-
/**
|
|
246
|
-
* #55 — an argument matcher. A rule with `args` gates on the tool's argument
|
|
247
|
-
* VALUES, not just its name: an exact string, a RegExp (tested against the
|
|
248
|
-
* stringified value), or a predicate. Every declared arg must match for the
|
|
249
|
-
* rule to apply — so `{ tool: "shell", args: { command: /rm\s+-rf/ } }` denies
|
|
250
|
-
* a destructive shell call while leaving `ls` to fall through.
|
|
251
|
-
*/
|
|
252
|
-
type ArgMatcher = string | RegExp | ((value: unknown) => boolean);
|
|
253
|
-
/**
|
|
254
|
-
* One entry in a {@link PermissionEngine}'s ordered rule list.
|
|
255
|
-
*
|
|
256
|
-
* Order is the semantics. The engine walks the list and the first rule whose `tool` matches — and
|
|
257
|
-
* whose `args` matchers all pass, when it declares any — decides; nothing after it is consulted. Put
|
|
258
|
-
* the narrow rules first: a catch-all `tool` RegExp placed above a specific deny makes that deny
|
|
259
|
-
* unreachable, and nothing warns you.
|
|
260
|
-
*
|
|
261
|
-
* `args` is what lets one tool name resolve differently depending on what it is asked to do —
|
|
262
|
-
* `{ tool: "shell", args: { command: /rm\s+-rf/ }, action: "deny" }` blocks the destructive call and
|
|
263
|
-
* leaves `ls` to fall through to a later rule. Every declared matcher must pass.
|
|
264
|
-
*
|
|
265
|
-
* **A missing argument is NOT handled uniformly, and the difference bites in the unsafe direction.**
|
|
266
|
-
* For a string or RegExp matcher, an argument the call did not supply fails the matcher, so the rule
|
|
267
|
-
* does not match and evaluation continues. For a PREDICATE matcher the function is called anyway,
|
|
268
|
-
* with `undefined`:
|
|
269
|
-
*
|
|
270
|
-
* ```ts
|
|
271
|
-
* { tool: "shell", args: { command: (v) => v !== "prod" }, action: "allow" }
|
|
272
|
-
* // evaluate("shell", {}) → the predicate gets `undefined`, returns true, the rule MATCHES,
|
|
273
|
-
* // and a call that supplied no arguments at all is authorized.
|
|
214
|
+
* Owner: `internal/agent-loop/` (3 of 11 importers). Derived from the import graph, not declared —
|
|
215
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
274
216
|
*
|
|
275
|
-
* { tool: "shell", args: { command: (v) => v.includes("rm") }, action: "deny" }
|
|
276
|
-
* // evaluate("shell", {}) → TypeError thrown out of the permission gate.
|
|
277
|
-
* ```
|
|
278
|
-
*
|
|
279
|
-
* Until that is fixed (issue #367), guard the parameter in every predicate you write —
|
|
280
|
-
* `(v) => typeof v === "string" && v !== "prod"` — rather than relying on the matcher never being
|
|
281
|
-
* reached.
|
|
282
|
-
*
|
|
283
|
-
* A rule that matches yields an EXPLICIT verdict, and that is what makes it survive a permissive
|
|
284
|
-
* `PermissionMode`: `acceptEdits` auto-approves the unmatched default but still honours an explicit
|
|
285
|
-
* `ask` rule, and an explicit `deny` is immune to every mode, `bypass` included.
|
|
286
|
-
*/
|
|
287
|
-
interface PermissionRule {
|
|
288
|
-
/** Tool name (exact string) or pattern (RegExp). */
|
|
289
|
-
tool: string | RegExp;
|
|
290
|
-
/**
|
|
291
|
-
* #55 — optional per-argument matchers. When present, the rule matches only
|
|
292
|
-
* if the tool name matches AND every declared arg predicate matches the
|
|
293
|
-
* corresponding call argument. A missing/undefined arg fails its predicate
|
|
294
|
-
* (the rule does not match) — never throws.
|
|
295
|
-
*/
|
|
296
|
-
args?: Record<string, ArgMatcher>;
|
|
297
|
-
/** Action to take when rule matches. */
|
|
298
|
-
action: PermissionAction;
|
|
299
|
-
}
|
|
300
|
-
/** Options for {@link PermissionEngine}. */
|
|
301
|
-
interface PermissionEngineOptions {
|
|
302
|
-
/**
|
|
303
|
-
* Action when no rule matches. #55 — default is now `"ask"` (fail-closed): a
|
|
304
|
-
* permission engine that cannot positively allow must not silently allow.
|
|
305
|
-
* Pass `"allow"` to restore the previous fail-open behavior.
|
|
306
|
-
*/
|
|
307
|
-
readonly defaultAction?: PermissionAction;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Ordered first-match permission rules for tool invocations — the policy object you hand to
|
|
311
|
-
* `PermissionPlugin.create()` to have it enforced.
|
|
312
|
-
*
|
|
313
|
-
* On its own it enforces nothing. `evaluate(toolName, args, mode)` is a pure function returning
|
|
314
|
-
* `"allow" | "deny" | "ask"`, and no part of the SDK calls it until the engine is wrapped in a plugin
|
|
315
|
-
* and that plugin is registered on an agent. The plugin is where a verdict becomes behaviour: `deny`
|
|
316
|
-
* blocks the tool call, `allow` passes it through, and `ask` is routed to the host's `canUseTool`
|
|
317
|
-
* gate — with no gate configured, `ask` blocks. So constructing an engine and never registering it
|
|
318
|
-
* is a policy that does nothing, which is the mistake worth knowing about first.
|
|
319
|
-
*
|
|
320
|
-
* It is fail-closed by default: a call no rule matches resolves to `"ask"`, not `"allow"`, so a tool
|
|
321
|
-
* the rules never mention needs a human — or an explicit `{ defaultAction: "allow" }` — before it
|
|
322
|
-
* runs. Keep that default if you intend to use `PermissionMode: "plan"` for read-only behaviour,
|
|
323
|
-
* because `plan` gates on the RESOLVED verdict: an engine built with `defaultAction: "allow"` still
|
|
324
|
-
* allows every unmatched call under `plan`.
|
|
325
|
-
*
|
|
326
|
-
* The rules array is stored by reference and walked afresh on every `evaluate` call. Mutating the
|
|
327
|
-
* array you passed in therefore changes the policy of a live engine; build a new engine when you
|
|
328
|
-
* want a policy change to be a deliberate, visible event.
|
|
329
|
-
*/
|
|
330
|
-
declare class PermissionEngine {
|
|
331
|
-
#private;
|
|
332
|
-
private readonly rules;
|
|
333
|
-
private readonly defaultAction;
|
|
334
|
-
constructor(rules: PermissionRule[], options?: PermissionEngineOptions);
|
|
335
|
-
/**
|
|
336
|
-
* Evaluate a tool name (and optional arguments) against the rules. First
|
|
337
|
-
* match wins; falls back to the configured `defaultAction` (default `"ask"`,
|
|
338
|
-
* fail-closed) when no rule matches. #55 — a rule with `args` gates on the
|
|
339
|
-
* argument values, so the same tool name can resolve to different actions
|
|
340
|
-
* depending on what it is asked to do.
|
|
341
|
-
*/
|
|
342
|
-
evaluate(toolName: string, args?: Record<string, unknown>, mode?: PermissionMode): PermissionAction;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
217
|
* SE2 — typed runtime EVENT stream, ADDITIVE to the `SDKMessage` content stream.
|
|
347
218
|
*
|
|
348
219
|
* `Run.stream()` yields `SDKMessage`s (the conversation content). `RunEvent`s are
|
|
@@ -360,7 +231,7 @@ declare class PermissionEngine {
|
|
|
360
231
|
*
|
|
361
232
|
* @public
|
|
362
233
|
*/
|
|
363
|
-
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunCompactionFallbackEvent | RunTripwireEvent | RunCompletionCheckEvent | RunMcpServerFailedEvent | RunMcpServerReadyEvent;
|
|
234
|
+
type RunEvent = RunToolProgressEvent | RunRateLimitEvent | RunPermissionDeniedEvent | RunTaskStartedEvent | RunTaskUpdatedEvent | RunTaskCompletedEvent | RunCompactBoundaryEvent | RunCompactionFallbackEvent | RunTripwireEvent | RunCompletionCheckEvent | RunMcpServerFailedEvent | RunMcpServerReadyEvent | RunMemoryDegradedEvent;
|
|
364
235
|
/**
|
|
365
236
|
* theokit#188 — an MCP server was configured but its tools could not be listed, so NONE of its
|
|
366
237
|
* tools exist for this run.
|
|
@@ -501,19 +372,46 @@ interface RunCompactionFallbackEvent {
|
|
|
501
372
|
readonly window: number;
|
|
502
373
|
}
|
|
503
374
|
/**
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
*
|
|
375
|
+
* A memory stage failed and the run continued without it.
|
|
376
|
+
*
|
|
377
|
+
* The same shape of gap {@link RunMcpServerFailedEvent} closed for MCP, in the module next door.
|
|
378
|
+
* `initLoopContext` had three bare `catch { <field> = <empty> }` blocks: an init failure meant no
|
|
379
|
+
* memory tool was registered, a `buildTools` failure meant no provider tools, and a `runActivePass`
|
|
380
|
+
* failure meant no recalled context in the system prompt. The agent then answered without the memory
|
|
381
|
+
* it was configured with, and nothing recorded it — not stderr, not this sink, not the span in scope.
|
|
382
|
+
*
|
|
383
|
+
* Degrading to a working agent is the right BEHAVIOUR. This event exists because the degradation was
|
|
384
|
+
* unobservable, so a host UI showed a healthy run.
|
|
385
|
+
*
|
|
386
|
+
* Emitted once per failing stage per run.
|
|
387
|
+
*
|
|
388
|
+
* @public
|
|
507
389
|
*/
|
|
508
|
-
|
|
390
|
+
interface RunMemoryDegradedEvent {
|
|
391
|
+
readonly type: "memory_degraded";
|
|
392
|
+
/** Which stage failed: `init`, `buildTools`, or `activePass`. */
|
|
393
|
+
readonly stage: string;
|
|
394
|
+
/** Why it failed, as the provider reported it. */
|
|
395
|
+
readonly message: string;
|
|
396
|
+
}
|
|
509
397
|
/**
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
398
|
+
* Receives every {@link RunEvent} a run emits, in emission order.
|
|
399
|
+
*
|
|
400
|
+
* Wired through `onRunEvent` on the run options. The sink is observability, never control flow: it
|
|
401
|
+
* cannot cancel, alter, or delay the run, and {@link emitRunEvent} swallows anything it throws — a
|
|
402
|
+
* broken sink degrades what you can see, never what the agent does.
|
|
403
|
+
*
|
|
404
|
+
* Synchronous by signature, so a slow sink slows the run. Hand work off rather than awaiting inside
|
|
405
|
+
* it; returning a promise here would be ignored, not awaited.
|
|
406
|
+
*
|
|
407
|
+
* @public
|
|
513
408
|
*/
|
|
514
|
-
|
|
409
|
+
type RunEventSink = (event: RunEvent) => void;
|
|
515
410
|
|
|
516
411
|
/**
|
|
412
|
+
* Owner: `internal/runtime/processors/` (3 of 4 importers). Derived from the import graph, not declared —
|
|
413
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
414
|
+
*
|
|
517
415
|
* SE24 — guardrail processor pipeline. A `Processor` inspects/transforms/blocks
|
|
518
416
|
* the user message (input) or the model's final text (output). Processors run in
|
|
519
417
|
* order; each may rewrite its payload, `abort(reason)` to stop the run (surfaced
|
|
@@ -599,6 +497,9 @@ interface ProcessorTripwire {
|
|
|
599
497
|
}
|
|
600
498
|
|
|
601
499
|
/**
|
|
500
|
+
* Owner: `src/` (2 of 7 importers). Derived from the import graph, not declared —
|
|
501
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
502
|
+
*
|
|
602
503
|
* Leaf module for content-block types shared by `messages.ts` (assistant/user
|
|
603
504
|
* content) and `agent-prims.ts` (`CustomTool` handler results). Kept
|
|
604
505
|
* import-free so both can depend on it WITHOUT the `agent-prims ↔ messages`
|
|
@@ -647,6 +548,9 @@ interface ImageBlock {
|
|
|
647
548
|
type ToolResultContentBlock = TextBlock | ImageBlock;
|
|
648
549
|
|
|
649
550
|
/**
|
|
551
|
+
* Owner: `internal/agent-loop/` (3 of 11 importers). Derived from the import graph, not
|
|
552
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
553
|
+
*
|
|
650
554
|
* Type-leaf — primitives shared between `agent.ts`, `run.ts`, and
|
|
651
555
|
* `messages.ts`. Extracted to break LOW type-only cycles #5 and #7
|
|
652
556
|
* (audit `architecture-output/final_report.md`) per plan
|
|
@@ -762,6 +666,30 @@ interface CustomTool {
|
|
|
762
666
|
threadId?: string;
|
|
763
667
|
}) => string | ToolResultContentBlock[] | Promise<string | ToolResultContentBlock[]>;
|
|
764
668
|
}
|
|
669
|
+
/**
|
|
670
|
+
* How the permission engine treats the UNMATCHED verdict.
|
|
671
|
+
*
|
|
672
|
+
* - `default` — ask.
|
|
673
|
+
* - `plan` — read-only.
|
|
674
|
+
* - `acceptEdits` — auto-approve the unmatched verdict, but still honour an explicit `ask` rule.
|
|
675
|
+
* - `bypass` (alias `bypassPermissions`, the Anthropic-exact name) — everything allowed EXCEPT an
|
|
676
|
+
* explicit `deny`. Never asks.
|
|
677
|
+
*
|
|
678
|
+
* G7 / DIP — defined in this type leaf rather than in `permission-engine.ts`, which is a RUNTIME
|
|
679
|
+
* module. `types/agent.ts`, `types/run.ts` and `types/plugin.ts` all need the union, and each one
|
|
680
|
+
* used to reach into the engine for it: three of the nine violations the `types-dont-import-runtime`
|
|
681
|
+
* rule reported the moment it was able to see type-only edges at all. The engine re-exports it, so
|
|
682
|
+
* `import type { PermissionMode } from "@theokit/sdk"` is unchanged.
|
|
683
|
+
*
|
|
684
|
+
* @public
|
|
685
|
+
*/
|
|
686
|
+
type PermissionMode = "default" | "plan" | "acceptEdits" | "bypass" | "bypassPermissions";
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Owner: `internal/agent-loop/` (4 of 8 importers). Derived from the import graph, not
|
|
690
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
691
|
+
*
|
|
692
|
+
*/
|
|
765
693
|
|
|
766
694
|
/**
|
|
767
695
|
* Plain assistant message in a conversation history.
|
|
@@ -884,6 +812,9 @@ type ConversationTurn = {
|
|
|
884
812
|
};
|
|
885
813
|
|
|
886
814
|
/**
|
|
815
|
+
* Owner: `sandbox/` (1 of 2 importers). Derived from the import graph, not
|
|
816
|
+
* declared — `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
817
|
+
*
|
|
887
818
|
* Child-process environment policy contract (#54).
|
|
888
819
|
*
|
|
889
820
|
* The DIP-correct home for the `EnvPolicy` contract type: the domain `types/`
|
|
@@ -902,6 +833,12 @@ type ConversationTurn = {
|
|
|
902
833
|
*/
|
|
903
834
|
type EnvPolicy = "inherit-scrubbed" | "core" | "all";
|
|
904
835
|
|
|
836
|
+
/**
|
|
837
|
+
* Owner: `internal/mcp/` (2 of 5 importers). Derived from the import graph, not declared —
|
|
838
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
839
|
+
*
|
|
840
|
+
*/
|
|
841
|
+
|
|
905
842
|
/**
|
|
906
843
|
* MCP server configuration accepted by `Agent.create()` and `agent.send()`.
|
|
907
844
|
*
|
|
@@ -987,6 +924,12 @@ type McpHttpServerConfig = {
|
|
|
987
924
|
*/
|
|
988
925
|
type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig;
|
|
989
926
|
|
|
927
|
+
/**
|
|
928
|
+
* Owner: `internal/agent-loop/` (4 of 16 importers). Derived from the import graph, not declared —
|
|
929
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
930
|
+
*
|
|
931
|
+
*/
|
|
932
|
+
|
|
990
933
|
/**
|
|
991
934
|
* Tool invocation block emitted by the assistant.
|
|
992
935
|
*
|
|
@@ -1142,6 +1085,9 @@ interface SDKObjectDelta {
|
|
|
1142
1085
|
type SDKMessage = SDKSystemMessage | SDKUserMessageEvent | SDKAssistantMessage | SDKThinkingMessage | SDKToolUseMessage | SDKStatusMessage | SDKTaskMessage | SDKRequestMessage | SDKObjectDelta;
|
|
1143
1086
|
|
|
1144
1087
|
/**
|
|
1088
|
+
* Owner: `internal/budget/` (3 of 8 importers). Derived from the import graph, not declared —
|
|
1089
|
+
* `tests/lint/types-name-their-owner.test.ts` re-derives it.
|
|
1090
|
+
*
|
|
1145
1091
|
* Public type contract for token usage + cost tracking (ADRs D376-D379).
|
|
1146
1092
|
*
|
|
1147
1093
|
* Surfaces via `RunResult.usage` + `RunResult.cost` after every Run.
|
|
@@ -1184,7 +1130,7 @@ type CostSource = "openrouter_api" | "litellm_snapshot" | "user_override" | "sub
|
|
|
1184
1130
|
/**
|
|
1185
1131
|
* Cost breakdown attached to `RunResult.cost`. When `status === "unknown"`,
|
|
1186
1132
|
* `amountUsd` is `undefined` — DO NOT default to 0 (a lie). The UI shows
|
|
1187
|
-
* `n/a`
|
|
1133
|
+
* `n/a` for unknown, `~$1.23` for estimated, `$1.23` for actual.
|
|
1188
1134
|
*/
|
|
1189
1135
|
interface CostBreakdown {
|
|
1190
1136
|
readonly amountUsd: number | undefined;
|
|
@@ -1507,6 +1453,28 @@ interface SDKUserMessage {
|
|
|
1507
1453
|
/**
|
|
1508
1454
|
* Per-send overrides and callbacks.
|
|
1509
1455
|
*
|
|
1456
|
+
* ## Which options do I need?
|
|
1457
|
+
*
|
|
1458
|
+
* Twenty-one optional fields with genuinely different audiences, so most callers read all of them to
|
|
1459
|
+
* find their two. This table is the fix that was chosen; the alternative — nesting the groups under
|
|
1460
|
+
* `observe?` and `toolPolicy?` and carrying the flat keys as deprecated aliases for one major — would
|
|
1461
|
+
* have added surface to remove surface, and the harm here is the READING cost, not a representable
|
|
1462
|
+
* illegal state. There is no measured defect behind this grouping and no consumer census; the fields
|
|
1463
|
+
* and the audiences are what was measured.
|
|
1464
|
+
*
|
|
1465
|
+
* | If you are… | you want |
|
|
1466
|
+
* |---|---|
|
|
1467
|
+
* | rendering a live UI | `onDelta`, `onStep`, `onRunEvent` |
|
|
1468
|
+
* | applying a policy | `permissionMode`, `activeTools`, `toolChoice`, `toolResultGuard`, `perToolTimeoutMs` |
|
|
1469
|
+
* | running an eval or a harness | `maxIterations`, `completionCheck`, `doomLoop`, `signal` |
|
|
1470
|
+
* | orchestrating agents | `origin`, `task`, `context` |
|
|
1471
|
+
* | overriding this one send | `model`, `systemPrompt`, `tools`, `mcpServers`, `contextPaths`, `local` |
|
|
1472
|
+
*
|
|
1473
|
+
* Every field appears in exactly one row, and
|
|
1474
|
+
* `tests/lint/send-options-audience-table.test.ts` fails when one is added without a row — a table
|
|
1475
|
+
* that silently stops covering the type is worse than none, because a reader trusts it and stops
|
|
1476
|
+
* looking.
|
|
1477
|
+
*
|
|
1510
1478
|
* @public
|
|
1511
1479
|
*/
|
|
1512
1480
|
interface SendOptions {
|
|
@@ -1842,4 +1810,4 @@ interface GenerateRunResult<O> {
|
|
|
1842
1810
|
};
|
|
1843
1811
|
}
|
|
1844
1812
|
|
|
1845
|
-
export {
|
|
1813
|
+
export type { RunTripwireEvent as $, AgentConversationTurn as A, RunCompletionCheckEvent as B, CustomTool as C, DoomLoopThresholds as D, RunErrorDetail as E, RunEvent as F, GenerateOptions as G, RunGitInfo as H, ImageBlock as I, RunMemoryDegradedEvent as J, RunOperation as K, RunPermissionDeniedEvent as L, ModelSelection as M, RunRateLimitEvent as N, OutputProcessorContext as O, Processor as P, RunStatus as Q, RunResult as R, SDKMessage as S, ToolResultContentBlock as T, RunTaskCompletedEvent as U, RunTaskStartedEvent as V, RunTaskUpdatedEvent as W, RunTimelineEvent as X, RunToCompletionOptions as Y, RunToCompletionResult as Z, RunToolProgressEvent as _, McpServerConfig as a, SDKAssistantMessage as a0, SDKImage as a1, SDKImageDimension as a2, SDKObjectDelta as a3, SDKRequestMessage as a4, SDKStatusMessage as a5, SDKSystemMessage as a6, SDKTaskMessage as a7, SDKThinkingMessage as a8, SDKToolUseMessage as a9, ToolUseBlock as aA, TurnEndedUpdate as aB, UserMessage as aC, UserMessageAppendedUpdate as aD, SDKUserMessage as aa, SDKUserMessageEvent as ab, SendOptions as ac, ShellCommand as ad, ShellConversationTurn as ae, ShellOutput as af, ShellOutputDeltaUpdate as ag, StepCompletedUpdate as ah, StepStartedUpdate as ai, StreamToCompletionResult as aj, SummaryCompletedUpdate as ak, SummaryStartedUpdate as al, SummaryUpdate as am, TextBlock as an, TextDeltaUpdate as ao, ThinkingCompletedUpdate as ap, ThinkingDeltaUpdate as aq, ThinkingMessage as ar, TokenDeltaUpdate as as, TokenUsage as at, ToolCall as au, ToolCallCompletedUpdate as av, ToolCallStartedUpdate as aw, ToolContextMessage as ax, ToolResult as ay, ToolResultGuardOptions as az, Run as b, PermissionMode as c, RunEventSink as d, AssistantMessage as e, CompletionCheck as f, CompletionCheckResult as g, ConversationStep as h, ConversationTurn as i, CostBreakdown as j, CostSource as k, CostStatus as l, GenerateRunResult as m, InputProcessorContext as n, InteractionUpdate as o, McpAuthConfig as p, McpHttpServerConfig as q, McpOAuthConfig as r, McpStdioServerConfig as s, MessageOrigin as t, ModelParameterValue as u, PartialToolCallUpdate as v, ProcessorControls as w, ProcessorTripwire as x, ProcessorViolation as y, RunCompactBoundaryEvent as z };
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { GOAL_CONTINUATION_MARKER } from './chunk-PY2RQOA7.js';
|
|
2
2
|
|
|
3
3
|
// src/internal/runtime/lifecycle/run-until.ts
|
|
4
|
+
var ABORTED_MID_RUN = "aborted via AbortSignal";
|
|
5
|
+
var pausedBy = (reason) => ({
|
|
6
|
+
type: "status_change",
|
|
7
|
+
status: "paused",
|
|
8
|
+
reason
|
|
9
|
+
});
|
|
4
10
|
async function* runUntilImpl(agent, goal, options, deps) {
|
|
5
11
|
const maxTurns = options?.maxTurns ?? 20;
|
|
6
12
|
const maxFails = options?.maxConsecutiveJudgeFailures ?? 3;
|
|
@@ -11,31 +17,28 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
11
17
|
let consecutiveFailures = 0;
|
|
12
18
|
let tokensUsed = 0;
|
|
13
19
|
let lastResponse = "";
|
|
20
|
+
const finish = (status) => ({
|
|
21
|
+
status,
|
|
22
|
+
turnsUsed: turn,
|
|
23
|
+
tokensUsed,
|
|
24
|
+
finalResponse: lastResponse || void 0
|
|
25
|
+
});
|
|
14
26
|
if (isAborted()) {
|
|
15
|
-
yield
|
|
16
|
-
|
|
17
|
-
status: "paused",
|
|
18
|
-
reason: "aborted via AbortSignal before first turn"
|
|
19
|
-
};
|
|
20
|
-
return { status: "paused", turnsUsed: 0, tokensUsed, finalResponse: void 0 };
|
|
27
|
+
yield pausedBy("aborted via AbortSignal before first turn");
|
|
28
|
+
return finish("paused");
|
|
21
29
|
}
|
|
22
30
|
yield { type: "status_change", status: "active", reason: "Goal started" };
|
|
23
31
|
while (turn < maxTurns) {
|
|
24
32
|
if (isAborted()) {
|
|
25
|
-
yield
|
|
26
|
-
return
|
|
27
|
-
status: "paused",
|
|
28
|
-
turnsUsed: turn,
|
|
29
|
-
tokensUsed,
|
|
30
|
-
finalResponse: lastResponse || void 0
|
|
31
|
-
};
|
|
33
|
+
yield pausedBy(ABORTED_MID_RUN);
|
|
34
|
+
return finish("paused");
|
|
32
35
|
}
|
|
33
36
|
turn += 1;
|
|
34
37
|
yield { type: "turn_start", turn, goal };
|
|
35
38
|
const continuationPrompt = turn === 1 ? goal : composeContinuation(goal, lastResponse);
|
|
36
39
|
const run = await agent.send(continuationPrompt);
|
|
37
40
|
const cancelOnAbort = () => {
|
|
38
|
-
void run.cancel
|
|
41
|
+
void run.cancel();
|
|
39
42
|
};
|
|
40
43
|
if (signal !== void 0) {
|
|
41
44
|
if (signal.aborted) cancelOnAbort();
|
|
@@ -47,13 +50,8 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
47
50
|
const turnTokens = result.usage?.totalTokens;
|
|
48
51
|
if (typeof turnTokens === "number") tokensUsed += turnTokens;
|
|
49
52
|
if (isAborted()) {
|
|
50
|
-
yield
|
|
51
|
-
return
|
|
52
|
-
status: "paused",
|
|
53
|
-
turnsUsed: turn,
|
|
54
|
-
tokensUsed,
|
|
55
|
-
finalResponse: lastResponse || void 0
|
|
56
|
-
};
|
|
53
|
+
yield pausedBy(ABORTED_MID_RUN);
|
|
54
|
+
return finish("paused");
|
|
57
55
|
}
|
|
58
56
|
yield { type: "agent_response", turn, content: lastResponse };
|
|
59
57
|
const judgeOpts = {};
|
|
@@ -78,33 +76,18 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
78
76
|
status: "failed",
|
|
79
77
|
reason: `judge model too unreliable (${consecutiveFailures} parse failures in a row)`
|
|
80
78
|
};
|
|
81
|
-
return
|
|
82
|
-
status: "failed",
|
|
83
|
-
turnsUsed: turn,
|
|
84
|
-
tokensUsed,
|
|
85
|
-
finalResponse: lastResponse || void 0
|
|
86
|
-
};
|
|
79
|
+
return finish("failed");
|
|
87
80
|
}
|
|
88
81
|
} else {
|
|
89
82
|
consecutiveFailures = 0;
|
|
90
83
|
}
|
|
91
84
|
if (judgment.verdict === "done") {
|
|
92
85
|
yield { type: "status_change", status: "completed", reason: judgment.reason };
|
|
93
|
-
return
|
|
94
|
-
status: "completed",
|
|
95
|
-
turnsUsed: turn,
|
|
96
|
-
tokensUsed,
|
|
97
|
-
finalResponse: lastResponse || void 0
|
|
98
|
-
};
|
|
86
|
+
return finish("completed");
|
|
99
87
|
}
|
|
100
88
|
if (judgment.verdict === "blocked") {
|
|
101
89
|
yield { type: "status_change", status: "blocked", reason: judgment.reason };
|
|
102
|
-
return
|
|
103
|
-
status: "blocked",
|
|
104
|
-
turnsUsed: turn,
|
|
105
|
-
tokensUsed,
|
|
106
|
-
finalResponse: lastResponse || void 0
|
|
107
|
-
};
|
|
90
|
+
return finish("blocked");
|
|
108
91
|
}
|
|
109
92
|
if (judgment.verdict === "skipped") {
|
|
110
93
|
yield {
|
|
@@ -112,12 +95,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
112
95
|
status: "completed",
|
|
113
96
|
reason: `skipped: ${judgment.reason}`
|
|
114
97
|
};
|
|
115
|
-
return
|
|
116
|
-
status: "completed",
|
|
117
|
-
turnsUsed: turn,
|
|
118
|
-
tokensUsed,
|
|
119
|
-
finalResponse: lastResponse || void 0
|
|
120
|
-
};
|
|
98
|
+
return finish("completed");
|
|
121
99
|
}
|
|
122
100
|
if (tokenBudget !== void 0 && tokensUsed >= tokenBudget) {
|
|
123
101
|
yield {
|
|
@@ -125,12 +103,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
125
103
|
status: "budget_limited",
|
|
126
104
|
reason: `token budget (${tokenBudget}) reached: ${tokensUsed} used`
|
|
127
105
|
};
|
|
128
|
-
return
|
|
129
|
-
status: "budget_limited",
|
|
130
|
-
turnsUsed: turn,
|
|
131
|
-
tokensUsed,
|
|
132
|
-
finalResponse: lastResponse || void 0
|
|
133
|
-
};
|
|
106
|
+
return finish("budget_limited");
|
|
134
107
|
}
|
|
135
108
|
yield { type: "continuation", turn, prompt: continuationPrompt };
|
|
136
109
|
}
|
|
@@ -139,12 +112,7 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
139
112
|
status: "failed",
|
|
140
113
|
reason: `max turns (${maxTurns}) exhausted`
|
|
141
114
|
};
|
|
142
|
-
return
|
|
143
|
-
status: "failed",
|
|
144
|
-
turnsUsed: turn,
|
|
145
|
-
tokensUsed,
|
|
146
|
-
finalResponse: lastResponse || void 0
|
|
147
|
-
};
|
|
115
|
+
return finish("failed");
|
|
148
116
|
}
|
|
149
117
|
function composeContinuation(goal, lastResponse) {
|
|
150
118
|
return [
|
|
@@ -174,5 +142,5 @@ ${lastResponse.slice(-1e3)}`
|
|
|
174
142
|
}
|
|
175
143
|
|
|
176
144
|
export { composeContinuation, runUntilImpl };
|
|
177
|
-
//# sourceMappingURL=run-until-
|
|
178
|
-
//# sourceMappingURL=run-until-
|
|
145
|
+
//# sourceMappingURL=run-until-6D6TQ4JN.js.map
|
|
146
|
+
//# sourceMappingURL=run-until-6D6TQ4JN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/lifecycle/run-until.ts"],"names":[],"mappings":"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","file":"run-until-6D6TQ4JN.js","sourcesContent":["/**\n * Goal-driven Ralph loop (T3.2, ADRs D115-D121).\n *\n * `runUntilImpl` is an `AsyncGenerator<GoalEvent, GoalResult, void>`:\n * yields events as the loop progresses, returns the final result when\n * the goal completes, fails, or is paused. The auxiliary judge model is\n * injected via `deps.judge` so the generator stays free of the `Agent`\n * façade import.\n *\n * EC-C fix: pre-aborted signals emit only `[paused]`, not `[active, paused]`.\n * EC-D: `maxTurns: 0` is supported (vacuous yield active → failed).\n *\n * @internal\n */\n\nimport type { SDKAgent } from \"../../../types/agent.js\";\nimport type {\n GoalEvent,\n GoalOptions,\n GoalResult,\n JudgeResult,\n} from \"../../../types/goal-events.js\";\nimport type { JudgeContext, JudgeOptions } from \"../../judge/judge-call.js\";\nimport { GOAL_CONTINUATION_MARKER } from \"./goal-marker.js\";\n\n/** DI contract: the judge is the only external touchpoint. */\nexport interface RunUntilDeps {\n judge: (ctx: JudgeContext, opts?: JudgeOptions) => Promise<JudgeResult>;\n}\n\n/** The reason both in-loop abort checks report; the pre-loop one distinguishes itself. */\nconst ABORTED_MID_RUN = \"aborted via AbortSignal\";\n\n/**\n * The pause event, built in one place. Three sites emitted the same four-line literal with only the\n * reason varying — the same duplicated-knowledge shape as `finish` below, at the event boundary\n * instead of the result boundary.\n */\nconst pausedBy = (reason: string): GoalEvent => ({\n type: \"status_change\",\n status: \"paused\",\n reason,\n});\n\n// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: the goal-loop interleaves turn-start, send, judge, continuation, abort-check and failure-bail — extracting the CONTROL FLOW into helpers harms that linear narrative, and this defends only that. What it never covered were the nine hand-built result literals and the three pause events, which moved to `finish` and `pausedBy` above: neither removes a branch. Measured 2026-09-01: 43 -> 31 cognitive, 150 -> 117 lines.\nexport async function* runUntilImpl(\n agent: SDKAgent,\n goal: string,\n options: GoalOptions | undefined,\n deps: RunUntilDeps,\n): AsyncGenerator<GoalEvent, GoalResult, void> {\n const maxTurns = options?.maxTurns ?? 20;\n const maxFails = options?.maxConsecutiveJudgeFailures ?? 3;\n const tokenBudget = options?.tokenBudget; // M55 — undefined ⇒ unlimited\n const signal = options?.signal;\n // Use a function (not direct property access) so TS does not narrow\n // `signal.aborted` to `false | undefined` after the initial check.\n // AbortSignal.aborted is a getter that can flip true between calls.\n // biome-ignore lint/complexity/useOptionalChain: optional-chain would re-narrow signal?.aborted to `false | undefined` after the first check, defeating the purpose of this helper.\n const isAborted = (): boolean => signal !== undefined && signal.aborted;\n let turn = 0;\n let consecutiveFailures = 0;\n let tokensUsed = 0; // M55 — the observed sum (0 when usage is absent — fail-open)\n let lastResponse = \"\";\n /**\n * The one place a `GoalResult` is built. Every exit went through the same four-field literal with\n * only the status varying, nine times, each restating the convention that an empty final response\n * collapses to `undefined` — duplicated KNOWLEDGE, so adding a field to `GoalResult` was a\n * nine-site edit where missing one produces a result wrong on a single branch.\n *\n * It is a closure over `turn`, `tokensUsed` and `lastResponse` rather than a module function\n * precisely so the call sites stay one word long: the biome-ignore below argues that the loop's\n * narrative must read linearly, and this removes no branch and moves no decision.\n */\n const finish = (status: GoalResult[\"status\"]): GoalResult => ({\n status,\n turnsUsed: turn,\n tokensUsed,\n finalResponse: lastResponse || undefined,\n });\n\n // EC-C: signal already aborted BEFORE first event → emit only [paused].\n if (isAborted()) {\n yield pausedBy(\"aborted via AbortSignal before first turn\");\n // `turn` is 0 and `lastResponse` is \"\" at this point, so this is the literal it replaces.\n return finish(\"paused\");\n }\n\n yield { type: \"status_change\", status: \"active\", reason: \"Goal started\" };\n\n while (turn < maxTurns) {\n if (isAborted()) {\n yield pausedBy(ABORTED_MID_RUN);\n return finish(\"paused\");\n }\n\n turn += 1;\n yield { type: \"turn_start\", turn, goal };\n\n const continuationPrompt = turn === 1 ? goal : composeContinuation(goal, lastResponse);\n\n const run = await agent.send(continuationPrompt);\n // M55 review HIGH — thread the abort INTO the in-flight run: without this, Esc mid-turn is\n // cosmetic (the turn keeps mutating the workspace until it finishes on its own). `run.cancel()`\n // aborts the stream + in-flight tool calls (types/run.ts contract).\n // Called directly, not through a hand-written shape. `SDKAgent.send()` returns `Promise<Run>`\n // and `Run.cancel(): Promise<void>` is declared in `types/run.ts` — the cast re-declared, less\n // precisely, what the compiler already knew, and `cancel?.()` through it meant a rename would\n // keep compiling while Esc mid-turn silently went back to being cosmetic. Which is the exact\n // defect the comment above says this was added to fix.\n const cancelOnAbort = (): void => {\n void run.cancel();\n };\n if (signal !== undefined) {\n if (signal.aborted) cancelOnAbort();\n else signal.addEventListener(\"abort\", cancelOnAbort, { once: true });\n }\n const result = await run.wait();\n if (signal !== undefined) signal.removeEventListener(\"abort\", cancelOnAbort);\n lastResponse = result.result ?? \"\";\n // M55 — token accounting fails open: it only sums when the run reports usage.\n const turnTokens = result.usage?.totalTokens;\n if (typeof turnTokens === \"number\") tokensUsed += turnTokens;\n // Re-check aborted right after the turn lands: a cancelled turn must NOT spend a judge call.\n if (isAborted()) {\n yield pausedBy(ABORTED_MID_RUN);\n return finish(\"paused\");\n }\n yield { type: \"agent_response\", turn, content: lastResponse };\n\n const judgeOpts: JudgeOptions = {};\n if (options?.judgeModel !== undefined) judgeOpts.judgeModel = options.judgeModel;\n if (options?.judgeApiKey !== undefined) judgeOpts.apiKey = options.judgeApiKey;\n // M80 — forwards the driven agent's model so the judge can derive when `judgeModel` is omitted.\n if (options?.agentModel !== undefined) judgeOpts.agentModel = options.agentModel;\n const judgeCtx: JudgeContext = { goal, lastResponse };\n if (options?.subgoals !== undefined) judgeCtx.subgoals = options.subgoals;\n const judgment = await deps.judge(judgeCtx, judgeOpts);\n yield {\n type: \"judge_verdict\",\n turn,\n verdict: judgment.verdict,\n reason: judgment.reason,\n parseFailed: judgment.parseFailed,\n };\n\n if (judgment.parseFailed) {\n consecutiveFailures += 1;\n if (consecutiveFailures >= maxFails) {\n yield {\n type: \"status_change\",\n status: \"failed\",\n reason: `judge model too unreliable (${consecutiveFailures} parse failures in a row)`,\n };\n return finish(\"failed\");\n }\n } else {\n consecutiveFailures = 0;\n }\n\n if (judgment.verdict === \"done\") {\n yield { type: \"status_change\", status: \"completed\", reason: judgment.reason };\n return finish(\"completed\");\n }\n // M80 — the missing arm. Without it, a judge recognizing impossibility could only say\n // \"continue\", and the loop repeated the same turn until it blew the budget — reporting `failed` on\n // a limit rather than `blocked` on impossibility. Two distinct causes with the same\n // visible outcome, and the consumer had to reconcile after the loop to tell them apart.\n if (judgment.verdict === \"blocked\") {\n yield { type: \"status_change\", status: \"blocked\", reason: judgment.reason };\n return finish(\"blocked\");\n }\n if (judgment.verdict === \"skipped\") {\n yield {\n type: \"status_change\",\n status: \"completed\",\n reason: `skipped: ${judgment.reason}`,\n };\n return finish(\"completed\");\n }\n\n // M55 — token-budget check AFTER the turn (Codex: gentle wind-down, stops the loop).\n if (tokenBudget !== undefined && tokensUsed >= tokenBudget) {\n yield {\n type: \"status_change\",\n status: \"budget_limited\",\n reason: `token budget (${tokenBudget}) reached: ${tokensUsed} used`,\n };\n return finish(\"budget_limited\");\n }\n\n yield { type: \"continuation\", turn, prompt: continuationPrompt };\n }\n\n yield {\n type: \"status_change\",\n status: \"failed\",\n reason: `max turns (${maxTurns}) exhausted`,\n };\n return finish(\"failed\");\n}\n\n/**\n * Build the continuation user message for turns 2+. Keeps last response\n * preview short so we don't bloat the prompt cache.\n *\n * @internal\n */\n\nexport function composeContinuation(goal: string, lastResponse: string): string {\n // M55 — Codex-faithful continuation (ext/goal templates/goals/continuation.md): keep the FULL\n // objective intact, work from current-state evidence, and audit completion requirement-by-requirement\n // before declaring done. Improves the quality of what the judge then evaluates.\n return [\n GOAL_CONTINUATION_MARKER,\n \"Continue working toward the active goal.\",\n \"\",\n `<objective>\\n${goal}\\n</objective>`,\n \"\",\n \"Continuation behavior:\",\n \"- This goal persists across turns. Keep the full objective intact; if it cannot be finished now,\",\n \" make concrete progress toward the real requested end state and do not redefine success around a\",\n \" smaller or easier task.\",\n \"\",\n \"Work from evidence:\",\n \"- Use the current worktree and external state as authoritative. Inspect the current state before\",\n \" relying on it. Improve, replace, or remove existing work as needed to satisfy the actual objective.\",\n \"\",\n \"Completion audit:\",\n \"- Before deciding the goal is achieved, treat completion as unproven and verify it against the actual\",\n \" current state, requirement by requirement. Treat uncertain or indirect evidence as not achieved.\",\n \"\",\n `Your last response was:\\n${lastResponse.slice(-1000)}`,\n ].join(\"\\n\");\n}\n"]}
|