@theokit/sdk 5.11.1 → 5.12.1
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 +115 -0
- package/dist/a2a/index.cjs +8 -8
- package/dist/a2a/index.js +3 -3
- package/dist/agent-BVKIUP7F.cjs +71 -0
- package/dist/{agent-OKP4LHG2.cjs.map → agent-BVKIUP7F.cjs.map} +1 -1
- package/dist/{agent-CmKwSyyD.d.ts → agent-CVzDy_Oj.d.ts} +17 -8
- package/dist/{agent-XMkGzff_.d.cts → agent-Cn0sphpA.d.cts} +17 -8
- package/dist/agent-IG7BP6GN.js +62 -0
- package/dist/{agent-DFV52V6E.js.map → agent-IG7BP6GN.js.map} +1 -1
- package/dist/agent-prims-CZyxfCmS.d.cts +206 -0
- package/dist/agent-prims-CZyxfCmS.d.ts +206 -0
- package/dist/agent-session-store-22GKA7O4.js +6 -0
- package/dist/{agent-session-store-ODD3IZCW.js.map → agent-session-store-22GKA7O4.js.map} +1 -1
- package/dist/agent-session-store-WP6NGDVX.cjs +23 -0
- package/dist/{agent-session-store-SVEJHSUA.cjs.map → agent-session-store-WP6NGDVX.cjs.map} +1 -1
- package/dist/auth/index.cjs +33 -33
- package/dist/auth/index.js +6 -6
- package/dist/{batch-427O54FQ.js → batch-EP3FCL6D.js} +9 -9
- package/dist/{batch-427O54FQ.js.map → batch-EP3FCL6D.js.map} +1 -1
- package/dist/{batch-U4SO4RLX.cjs → batch-IZ5EDKJ5.cjs} +29 -29
- package/dist/{batch-U4SO4RLX.cjs.map → batch-IZ5EDKJ5.cjs.map} +1 -1
- package/dist/{chunk-IIYJMXYW.cjs → chunk-27V5I2WW.cjs} +4 -4
- package/dist/{chunk-IIYJMXYW.cjs.map → chunk-27V5I2WW.cjs.map} +1 -1
- package/dist/{chunk-DPY2M74T.js → chunk-2C24NSNV.js} +5 -5
- package/dist/{chunk-DPY2M74T.js.map → chunk-2C24NSNV.js.map} +1 -1
- package/dist/{chunk-7F7XE6CM.js → chunk-2S4HQCDF.js} +3 -3
- package/dist/{chunk-7F7XE6CM.js.map → chunk-2S4HQCDF.js.map} +1 -1
- package/dist/{chunk-LZJXEPEQ.js → chunk-2SFLLOMN.js} +3 -3
- package/dist/{chunk-LZJXEPEQ.js.map → chunk-2SFLLOMN.js.map} +1 -1
- package/dist/{chunk-RGQICWFU.js → chunk-354F3OF5.js} +3 -3
- package/dist/{chunk-RGQICWFU.js.map → chunk-354F3OF5.js.map} +1 -1
- package/dist/{chunk-TX56N7FR.js → chunk-3FSBE4PS.js} +4 -4
- package/dist/{chunk-TX56N7FR.js.map → chunk-3FSBE4PS.js.map} +1 -1
- package/dist/{chunk-RQMCOFAI.cjs → chunk-3HA7N2BB.cjs} +8 -8
- package/dist/{chunk-RQMCOFAI.cjs.map → chunk-3HA7N2BB.cjs.map} +1 -1
- package/dist/{chunk-GM54F4FE.cjs → chunk-3KIUY67P.cjs} +9 -9
- package/dist/{chunk-GM54F4FE.cjs.map → chunk-3KIUY67P.cjs.map} +1 -1
- package/dist/{chunk-CZJ6Q7CW.js → chunk-3OY6H3I7.js} +66 -7
- package/dist/chunk-3OY6H3I7.js.map +1 -0
- package/dist/{chunk-ZWACQM5U.cjs → chunk-3WKWBYPO.cjs} +9 -9
- package/dist/{chunk-ZWACQM5U.cjs.map → chunk-3WKWBYPO.cjs.map} +1 -1
- package/dist/{chunk-Q34EBNYG.js → chunk-4GUFNDZR.js} +5 -5
- package/dist/{chunk-Q34EBNYG.js.map → chunk-4GUFNDZR.js.map} +1 -1
- package/dist/{chunk-XDUGSTYJ.cjs → chunk-4YD2WI57.cjs} +15 -15
- package/dist/{chunk-XDUGSTYJ.cjs.map → chunk-4YD2WI57.cjs.map} +1 -1
- package/dist/{chunk-SKDNCTXG.cjs → chunk-5A4UFBHW.cjs} +15 -15
- package/dist/{chunk-SKDNCTXG.cjs.map → chunk-5A4UFBHW.cjs.map} +1 -1
- package/dist/{chunk-SUVCHX4L.js → chunk-5AR6O7GW.js} +3 -3
- package/dist/{chunk-SUVCHX4L.js.map → chunk-5AR6O7GW.js.map} +1 -1
- package/dist/{chunk-SVCPJRUB.js → chunk-5HSMH2ZZ.js} +6 -6
- package/dist/{chunk-SVCPJRUB.js.map → chunk-5HSMH2ZZ.js.map} +1 -1
- package/dist/{chunk-GTX6FEDP.js → chunk-5IRDK5BC.js} +3 -3
- package/dist/{chunk-GTX6FEDP.js.map → chunk-5IRDK5BC.js.map} +1 -1
- package/dist/{chunk-H3CVJSFC.js → chunk-5IUDICRK.js} +3 -3
- package/dist/{chunk-H3CVJSFC.js.map → chunk-5IUDICRK.js.map} +1 -1
- package/dist/{chunk-FYEHYQ7T.cjs → chunk-6CXRYPG7.cjs} +15 -15
- package/dist/{chunk-FYEHYQ7T.cjs.map → chunk-6CXRYPG7.cjs.map} +1 -1
- package/dist/{chunk-NQVWSSX2.cjs → chunk-6OCJWGVD.cjs} +12 -12
- package/dist/{chunk-NQVWSSX2.cjs.map → chunk-6OCJWGVD.cjs.map} +1 -1
- package/dist/{chunk-MPR2ISL2.cjs → chunk-6XQLTQB6.cjs} +4 -4
- package/dist/{chunk-MPR2ISL2.cjs.map → chunk-6XQLTQB6.cjs.map} +1 -1
- package/dist/{chunk-72CPLZPC.cjs → chunk-7INPXUJI.cjs} +5 -5
- package/dist/{chunk-72CPLZPC.cjs.map → chunk-7INPXUJI.cjs.map} +1 -1
- package/dist/{chunk-HG5LKFG7.cjs → chunk-7WARNHWW.cjs} +16 -16
- package/dist/{chunk-HG5LKFG7.cjs.map → chunk-7WARNHWW.cjs.map} +1 -1
- package/dist/{chunk-KIKKTW5O.cjs → chunk-7YUPSBDV.cjs} +4 -4
- package/dist/{chunk-KIKKTW5O.cjs.map → chunk-7YUPSBDV.cjs.map} +1 -1
- package/dist/{chunk-IZDDSLL2.js → chunk-AB4OPJLD.js} +6 -6
- package/dist/{chunk-IZDDSLL2.js.map → chunk-AB4OPJLD.js.map} +1 -1
- package/dist/{chunk-XERM7PDQ.js → chunk-AGO5S5WD.js} +3 -3
- package/dist/{chunk-XERM7PDQ.js.map → chunk-AGO5S5WD.js.map} +1 -1
- package/dist/{chunk-ZWFTECOE.js → chunk-AHKS3DKI.js} +3 -3
- package/dist/{chunk-ZWFTECOE.js.map → chunk-AHKS3DKI.js.map} +1 -1
- package/dist/{chunk-ECD6ER3E.cjs → chunk-AIZ6WXSL.cjs} +4 -4
- package/dist/{chunk-ECD6ER3E.cjs.map → chunk-AIZ6WXSL.cjs.map} +1 -1
- package/dist/{chunk-KO6SHCEH.js → chunk-AQW54OWQ.js} +3 -3
- package/dist/{chunk-KO6SHCEH.js.map → chunk-AQW54OWQ.js.map} +1 -1
- package/dist/{chunk-P22BZE7G.cjs → chunk-AT2PESXB.cjs} +7 -7
- package/dist/{chunk-P22BZE7G.cjs.map → chunk-AT2PESXB.cjs.map} +1 -1
- package/dist/{chunk-MHIBYKWA.js → chunk-BJ7BPLQK.js} +131 -72
- package/dist/chunk-BJ7BPLQK.js.map +1 -0
- package/dist/{chunk-HV4V63CO.js → chunk-BO3PV3OP.js} +4 -4
- package/dist/{chunk-HV4V63CO.js.map → chunk-BO3PV3OP.js.map} +1 -1
- package/dist/{chunk-GHHIJEFX.cjs → chunk-BWYC7RZG.cjs} +9 -9
- package/dist/{chunk-GHHIJEFX.cjs.map → chunk-BWYC7RZG.cjs.map} +1 -1
- package/dist/{chunk-UNFBHV46.cjs → chunk-CEGU5AVD.cjs} +9 -9
- package/dist/chunk-CEGU5AVD.cjs.map +1 -0
- package/dist/{chunk-JV7JA7BM.cjs → chunk-CGH4BCIY.cjs} +11 -11
- package/dist/{chunk-JV7JA7BM.cjs.map → chunk-CGH4BCIY.cjs.map} +1 -1
- package/dist/{chunk-L3C6CCBG.cjs → chunk-CWQPQTUZ.cjs} +21 -21
- package/dist/{chunk-L3C6CCBG.cjs.map → chunk-CWQPQTUZ.cjs.map} +1 -1
- package/dist/{chunk-X3LOJJMO.js → chunk-DF77RBF4.js} +9 -9
- package/dist/{chunk-X3LOJJMO.js.map → chunk-DF77RBF4.js.map} +1 -1
- package/dist/{chunk-7NQ7HJ3E.cjs → chunk-EPANMGH7.cjs} +8 -7
- package/dist/chunk-EPANMGH7.cjs.map +1 -0
- package/dist/{chunk-NKIQTLFA.cjs → chunk-EQ5IDL6W.cjs} +4 -4
- package/dist/{chunk-NKIQTLFA.cjs.map → chunk-EQ5IDL6W.cjs.map} +1 -1
- package/dist/{chunk-D5KXKBEN.cjs → chunk-FEAWEBWN.cjs} +5 -5
- package/dist/{chunk-D5KXKBEN.cjs.map → chunk-FEAWEBWN.cjs.map} +1 -1
- package/dist/{chunk-NJSIAJEK.cjs → chunk-FLDMPVUC.cjs} +4 -4
- package/dist/{chunk-NJSIAJEK.cjs.map → chunk-FLDMPVUC.cjs.map} +1 -1
- package/dist/{chunk-ASK2OQM5.cjs → chunk-G7XBVM3T.cjs} +5 -5
- package/dist/{chunk-ASK2OQM5.cjs.map → chunk-G7XBVM3T.cjs.map} +1 -1
- package/dist/{chunk-U27XHOEF.js → chunk-H7G65PNI.js} +5 -5
- package/dist/{chunk-U27XHOEF.js.map → chunk-H7G65PNI.js.map} +1 -1
- package/dist/{chunk-JW3GVLM6.cjs → chunk-H7HD6RXO.cjs} +4 -4
- package/dist/{chunk-JW3GVLM6.cjs.map → chunk-H7HD6RXO.cjs.map} +1 -1
- package/dist/{chunk-ZHWKT2NI.js → chunk-HJ2LV464.js} +3 -3
- package/dist/{chunk-ZHWKT2NI.js.map → chunk-HJ2LV464.js.map} +1 -1
- package/dist/{chunk-KGZ66JVZ.cjs → chunk-HN4IKB6X.cjs} +14 -14
- package/dist/{chunk-KGZ66JVZ.cjs.map → chunk-HN4IKB6X.cjs.map} +1 -1
- package/dist/{chunk-XKMVJ443.js → chunk-HWMGR3HA.js} +6 -6
- package/dist/{chunk-XKMVJ443.js.map → chunk-HWMGR3HA.js.map} +1 -1
- package/dist/{chunk-EQ5NCH2Y.cjs → chunk-IO4RI5ZJ.cjs} +24 -24
- package/dist/{chunk-EQ5NCH2Y.cjs.map → chunk-IO4RI5ZJ.cjs.map} +1 -1
- package/dist/{chunk-OLSEWLK5.cjs → chunk-IOFMRS6T.cjs} +6 -6
- package/dist/{chunk-OLSEWLK5.cjs.map → chunk-IOFMRS6T.cjs.map} +1 -1
- package/dist/{chunk-7QJYKVP6.js → chunk-KCM3RMKR.js} +3 -3
- package/dist/{chunk-7QJYKVP6.js.map → chunk-KCM3RMKR.js.map} +1 -1
- package/dist/{chunk-7KIN3L2S.js → chunk-KU5O7WPK.js} +3 -3
- package/dist/{chunk-7KIN3L2S.js.map → chunk-KU5O7WPK.js.map} +1 -1
- package/dist/{chunk-J5623RIV.cjs → chunk-KX5QXLBS.cjs} +10 -10
- package/dist/{chunk-J5623RIV.cjs.map → chunk-KX5QXLBS.cjs.map} +1 -1
- package/dist/{chunk-J6GXS5A2.cjs → chunk-L7JPXZ2C.cjs} +17 -17
- package/dist/{chunk-J6GXS5A2.cjs.map → chunk-L7JPXZ2C.cjs.map} +1 -1
- package/dist/{chunk-P7NNKEWO.cjs → chunk-L7V4DDIE.cjs} +4 -4
- package/dist/{chunk-P7NNKEWO.cjs.map → chunk-L7V4DDIE.cjs.map} +1 -1
- package/dist/chunk-LO6LIUZ6.cjs +18 -0
- package/dist/{chunk-SGC7LSHF.cjs.map → chunk-LO6LIUZ6.cjs.map} +1 -1
- package/dist/{chunk-P5N3Q2NH.cjs → chunk-LSWHDOCL.cjs} +192 -148
- package/dist/chunk-LSWHDOCL.cjs.map +1 -0
- package/dist/{chunk-3JHIFQ4I.js → chunk-M4U24U6G.js} +3 -3
- package/dist/{chunk-3JHIFQ4I.js.map → chunk-M4U24U6G.js.map} +1 -1
- package/dist/{chunk-GGRPAQ3B.js → chunk-MLGETTYX.js} +5 -5
- package/dist/{chunk-GGRPAQ3B.js.map → chunk-MLGETTYX.js.map} +1 -1
- package/dist/{chunk-XZHJYSPB.js → chunk-MLJDW2YK.js} +4 -4
- package/dist/{chunk-XZHJYSPB.js.map → chunk-MLJDW2YK.js.map} +1 -1
- package/dist/{chunk-5Q4RTLMP.js → chunk-MS3TQSXU.js} +3 -3
- package/dist/{chunk-5Q4RTLMP.js.map → chunk-MS3TQSXU.js.map} +1 -1
- package/dist/{chunk-W2ZVTEOD.js → chunk-MSEL5E5P.js} +6 -6
- package/dist/{chunk-W2ZVTEOD.js.map → chunk-MSEL5E5P.js.map} +1 -1
- package/dist/{chunk-ZAM7BJXJ.cjs → chunk-MSW7LB2V.cjs} +5 -5
- package/dist/{chunk-ZAM7BJXJ.cjs.map → chunk-MSW7LB2V.cjs.map} +1 -1
- package/dist/{chunk-GMSRRJ53.js → chunk-NBNRQN6T.js} +5 -4
- package/dist/chunk-NBNRQN6T.js.map +1 -0
- package/dist/{chunk-7HUCU3KK.js → chunk-NHOEXFZT.js} +5 -5
- package/dist/{chunk-7HUCU3KK.js.map → chunk-NHOEXFZT.js.map} +1 -1
- package/dist/{chunk-6G4IRQUD.js → chunk-NJBJ3CUG.js} +6 -6
- package/dist/{chunk-6G4IRQUD.js.map → chunk-NJBJ3CUG.js.map} +1 -1
- package/dist/{chunk-I2ORT6QD.js → chunk-NKQVLWDF.js} +3 -3
- package/dist/{chunk-I2ORT6QD.js.map → chunk-NKQVLWDF.js.map} +1 -1
- package/dist/{chunk-N7KS3TIR.cjs → chunk-NP362THY.cjs} +28 -15
- package/dist/chunk-NP362THY.cjs.map +1 -0
- package/dist/{chunk-NWS2CS3Y.cjs → chunk-NWWTYBD3.cjs} +5 -5
- package/dist/{chunk-NWS2CS3Y.cjs.map → chunk-NWWTYBD3.cjs.map} +1 -1
- package/dist/{chunk-SVQIW5RJ.js → chunk-OLJOI4LK.js} +4 -4
- package/dist/{chunk-SVQIW5RJ.js.map → chunk-OLJOI4LK.js.map} +1 -1
- package/dist/{chunk-7JAKO3NM.js → chunk-ORLTGPOS.js} +3 -3
- package/dist/{chunk-7JAKO3NM.js.map → chunk-ORLTGPOS.js.map} +1 -1
- package/dist/{chunk-5DD4NJN3.js → chunk-PKRPV3R7.js} +3 -3
- package/dist/{chunk-5DD4NJN3.js.map → chunk-PKRPV3R7.js.map} +1 -1
- package/dist/{chunk-R5YPDAKD.cjs → chunk-POBZXULR.cjs} +4 -4
- package/dist/{chunk-R5YPDAKD.cjs.map → chunk-POBZXULR.cjs.map} +1 -1
- package/dist/{chunk-35KBC4BX.cjs → chunk-Q6WT5535.cjs} +446 -387
- package/dist/chunk-Q6WT5535.cjs.map +1 -0
- package/dist/{chunk-MQGSOKR3.js → chunk-Q7UG242V.js} +3 -3
- package/dist/{chunk-MQGSOKR3.js.map → chunk-Q7UG242V.js.map} +1 -1
- package/dist/{chunk-XKZFIP7Z.cjs → chunk-QG4SXZ2A.cjs} +4 -4
- package/dist/{chunk-XKZFIP7Z.cjs.map → chunk-QG4SXZ2A.cjs.map} +1 -1
- package/dist/{chunk-NAGPKWOD.cjs → chunk-QISSETTG.cjs} +4 -4
- package/dist/{chunk-NAGPKWOD.cjs.map → chunk-QISSETTG.cjs.map} +1 -1
- package/dist/{chunk-OR6XIWLB.js → chunk-QK2ERTO3.js} +4 -4
- package/dist/{chunk-OR6XIWLB.js.map → chunk-QK2ERTO3.js.map} +1 -1
- package/dist/{chunk-ZDYDBXSD.js → chunk-RN3XDZGS.js} +6 -6
- package/dist/{chunk-ZDYDBXSD.js.map → chunk-RN3XDZGS.js.map} +1 -1
- package/dist/{chunk-6LHQPOMI.cjs → chunk-RNXXYF22.cjs} +66 -7
- package/dist/chunk-RNXXYF22.cjs.map +1 -0
- package/dist/{chunk-TMKTSYDS.cjs → chunk-RS7YQR4X.cjs} +6 -6
- package/dist/{chunk-TMKTSYDS.cjs.map → chunk-RS7YQR4X.cjs.map} +1 -1
- package/dist/{chunk-HU666T3Q.cjs → chunk-S46WJTDL.cjs} +14 -14
- package/dist/{chunk-HU666T3Q.cjs.map → chunk-S46WJTDL.cjs.map} +1 -1
- package/dist/{chunk-ZD66GFH5.cjs → chunk-SDZ4XDWS.cjs} +35 -35
- package/dist/{chunk-ZD66GFH5.cjs.map → chunk-SDZ4XDWS.cjs.map} +1 -1
- package/dist/{chunk-ZJZ7LV3A.js → chunk-SV63WTA2.js} +3 -3
- package/dist/{chunk-ZJZ7LV3A.js.map → chunk-SV63WTA2.js.map} +1 -1
- package/dist/{chunk-CQYBJOB2.cjs → chunk-SXH37C7X.cjs} +4 -4
- package/dist/{chunk-CQYBJOB2.cjs.map → chunk-SXH37C7X.cjs.map} +1 -1
- package/dist/{chunk-GMRFAX4I.js → chunk-SZQFCHU6.js} +4 -4
- package/dist/{chunk-GMRFAX4I.js.map → chunk-SZQFCHU6.js.map} +1 -1
- package/dist/{chunk-6PB5AQCY.cjs → chunk-TLVI2OQK.cjs} +16 -16
- package/dist/{chunk-6PB5AQCY.cjs.map → chunk-TLVI2OQK.cjs.map} +1 -1
- package/dist/{chunk-B5MHRQJZ.js → chunk-TNFOU6SB.js} +3 -3
- package/dist/chunk-TNFOU6SB.js.map +1 -0
- package/dist/{chunk-N6OEX5TN.cjs → chunk-UDAKAE4Z.cjs} +16 -16
- package/dist/{chunk-N6OEX5TN.cjs.map → chunk-UDAKAE4Z.cjs.map} +1 -1
- package/dist/{chunk-26NEAJ6T.js → chunk-VVGFZQZC.js} +4 -4
- package/dist/{chunk-26NEAJ6T.js.map → chunk-VVGFZQZC.js.map} +1 -1
- package/dist/{chunk-XCQ432OX.js → chunk-VZGE7NAI.js} +3 -3
- package/dist/{chunk-XCQ432OX.js.map → chunk-VZGE7NAI.js.map} +1 -1
- package/dist/{chunk-C7GKRGKN.cjs → chunk-WDVG5R2Q.cjs} +19 -19
- package/dist/{chunk-C7GKRGKN.cjs.map → chunk-WDVG5R2Q.cjs.map} +1 -1
- package/dist/{chunk-FTZTZBCU.js → chunk-XESYJ4JC.js} +4 -4
- package/dist/{chunk-FTZTZBCU.js.map → chunk-XESYJ4JC.js.map} +1 -1
- package/dist/{chunk-OPAKPEPG.js → chunk-XJ3WU5CZ.js} +5 -5
- package/dist/{chunk-OPAKPEPG.js.map → chunk-XJ3WU5CZ.js.map} +1 -1
- package/dist/{chunk-BBJ77S62.js → chunk-XJ4C4NFX.js} +64 -20
- package/dist/chunk-XJ4C4NFX.js.map +1 -0
- package/dist/{chunk-AY43232P.js → chunk-XRPMZ7TO.js} +4 -4
- package/dist/{chunk-AY43232P.js.map → chunk-XRPMZ7TO.js.map} +1 -1
- package/dist/{chunk-X6DUEDAF.js → chunk-XZKIAENA.js} +3 -3
- package/dist/{chunk-X6DUEDAF.js.map → chunk-XZKIAENA.js.map} +1 -1
- package/dist/{chunk-X7EUUHXU.js → chunk-YMVTUV5K.js} +3 -3
- package/dist/{chunk-X7EUUHXU.js.map → chunk-YMVTUV5K.js.map} +1 -1
- package/dist/{chunk-3JANYJYS.cjs → chunk-YOVZMN4P.cjs} +8 -8
- package/dist/{chunk-3JANYJYS.cjs.map → chunk-YOVZMN4P.cjs.map} +1 -1
- package/dist/{chunk-TY56BKSK.cjs → chunk-YQ3XC6C2.cjs} +4 -4
- package/dist/{chunk-TY56BKSK.cjs.map → chunk-YQ3XC6C2.cjs.map} +1 -1
- package/dist/{chunk-JLIRFWUG.js → chunk-ZJAYFSVI.js} +22 -9
- package/dist/chunk-ZJAYFSVI.js.map +1 -0
- package/dist/{chunk-MU7IAA7G.js → chunk-ZLFFDPXC.js} +9 -9
- package/dist/{chunk-MU7IAA7G.js.map → chunk-ZLFFDPXC.js.map} +1 -1
- package/dist/{chunk-JLRLCBJ4.cjs → chunk-ZOFRNNZD.cjs} +4 -4
- package/dist/{chunk-JLRLCBJ4.cjs.map → chunk-ZOFRNNZD.cjs.map} +1 -1
- package/dist/{chunk-MPQJE3G4.cjs → chunk-ZWLFHSON.cjs} +15 -15
- package/dist/{chunk-MPQJE3G4.cjs.map → chunk-ZWLFHSON.cjs.map} +1 -1
- package/dist/compact-session-3U2JYTVG.js +25 -0
- package/dist/{compact-session-4HAUP3HK.js.map → compact-session-3U2JYTVG.js.map} +1 -1
- package/dist/{compact-session-Y56D3S57.cjs → compact-session-NM56BREJ.cjs} +24 -24
- package/dist/{compact-session-Y56D3S57.cjs.map → compact-session-NM56BREJ.cjs.map} +1 -1
- package/dist/compaction.cjs +18 -18
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context/index.cjs +9 -9
- package/dist/context/index.js +6 -6
- package/dist/context-4RSI3AXT.cjs +24 -0
- package/dist/{context-B5J4GX2F.cjs.map → context-4RSI3AXT.cjs.map} +1 -1
- package/dist/context-7EBZST3L.js +7 -0
- package/dist/{context-3FZRAO5K.js.map → context-7EBZST3L.js.map} +1 -1
- package/dist/{cron-Blj6wMYg.d.cts → cron-BWDYetbq.d.cts} +2 -2
- package/dist/{cron-BPccQCO8.d.ts → cron-CHn-F0fC.d.ts} +2 -2
- package/dist/cron.cjs +42 -42
- package/dist/cron.d.cts +4 -4
- package/dist/cron.d.ts +4 -4
- package/dist/cron.js +41 -41
- package/dist/{errors-BWOJeWTZ.d.cts → errors-BiDQFWTG.d.cts} +10 -7
- package/dist/{errors-DDvG18IB.d.ts → errors-Pf22PJJ-.d.ts} +10 -7
- package/dist/errors.cjs +23 -23
- package/dist/errors.d.cts +2 -3
- package/dist/errors.d.ts +2 -3
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +54 -54
- package/dist/eval.js +42 -42
- package/dist/{executor-3NI7KNL4.js → executor-3D2UDJHW.js} +8 -8
- package/dist/{executor-3NI7KNL4.js.map → executor-3D2UDJHW.js.map} +1 -1
- package/dist/{executor-2SUGI3ZT.cjs → executor-HKHT4CWS.cjs} +26 -26
- package/dist/{executor-2SUGI3ZT.cjs.map → executor-HKHT4CWS.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +12 -12
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-6ZCCJX3K.js +11 -0
- package/dist/{fs-session-store-3VI4CPTX.js.map → fs-session-store-6ZCCJX3K.js.map} +1 -1
- package/dist/fs-session-store-S2AXVJIX.cjs +20 -0
- package/dist/{fs-session-store-IQ6PEHYF.cjs.map → fs-session-store-S2AXVJIX.cjs.map} +1 -1
- package/dist/generate-object-S7MNVF2V.js +7 -0
- package/dist/{generate-object-NTKAWE7D.js.map → generate-object-S7MNVF2V.js.map} +1 -1
- package/dist/generate-object-XBWD2PU7.cjs +20 -0
- package/dist/{generate-object-YHTWG5DB.cjs.map → generate-object-XBWD2PU7.cjs.map} +1 -1
- package/dist/index-manager-HO456AVW.cjs +27 -0
- package/dist/{index-manager-YGXRFJMZ.cjs.map → index-manager-HO456AVW.cjs.map} +1 -1
- package/dist/index-manager-QDH56FER.js +18 -0
- package/dist/{index-manager-JVYIVTZG.js.map → index-manager-QDH56FER.js.map} +1 -1
- package/dist/index.cjs +172 -172
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +59 -59
- package/dist/{inject-session-R73PRM7B.cjs → inject-session-JVTZNQF6.cjs} +9 -9
- package/dist/{inject-session-R73PRM7B.cjs.map → inject-session-JVTZNQF6.cjs.map} +1 -1
- package/dist/{inject-session-LJX5JGV5.js → inject-session-THABTKJY.js} +7 -7
- package/dist/{inject-session-LJX5JGV5.js.map → inject-session-THABTKJY.js.map} +1 -1
- package/dist/interactive/index.cjs +4 -4
- package/dist/interactive/index.js +2 -2
- package/dist/internal/budget/normalize-usage.d.ts +5 -1
- package/dist/internal/error-mappers/openai-compatible.d.ts +3 -1
- package/dist/internal/memory/adapters/index.cjs +8 -8
- package/dist/internal/memory/adapters/index.js +7 -7
- package/dist/internal/memory/storage/index.cjs +42 -42
- package/dist/internal/memory/storage/index.js +10 -10
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.js +8 -8
- package/dist/internal/providers/catalog-schema.d.ts +1 -1
- package/dist/internal/runtime/lifecycle/throw-on-error-run.d.ts +18 -0
- package/dist/internal/runtime/model-selection.d.ts +1 -1
- package/dist/internal/runtime/system-prompt/native-reasoning.d.ts +2 -2
- package/dist/internal/runtime/typed-run-error.d.ts +16 -0
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/judge-call-4LR4IFVT.js +5 -0
- package/dist/{judge-call-LOL5FQEX.js.map → judge-call-4LR4IFVT.js.map} +1 -1
- package/dist/judge-call-ZTUQMQRL.cjs +22 -0
- package/dist/{judge-call-AQQYK6VT.cjs.map → judge-call-ZTUQMQRL.cjs.map} +1 -1
- package/dist/mcp-auth.cjs +14 -14
- package/dist/mcp-auth.js +4 -4
- package/dist/models.cjs +22 -22
- package/dist/models.js +8 -8
- package/dist/oauth-transaction-store-OMX436YB.cjs +38 -0
- package/dist/{oauth-transaction-store-ZINDV7AF.cjs.map → oauth-transaction-store-OMX436YB.cjs.map} +1 -1
- package/dist/oauth-transaction-store-U34YLEGP.js +5 -0
- package/dist/{oauth-transaction-store-NP2YHZ6D.js.map → oauth-transaction-store-U34YLEGP.js.map} +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +31 -31
- package/dist/persistence.js +10 -10
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/providers.cjs +9 -9
- package/dist/providers.js +7 -7
- package/dist/registry-5TDAF7RK.js +9 -0
- package/dist/{registry-5FK42CRV.js.map → registry-5TDAF7RK.js.map} +1 -1
- package/dist/registry-W7TSCLQO.cjs +46 -0
- package/dist/{registry-BVTNO73E.cjs.map → registry-W7TSCLQO.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-until-DG2KXWB2.cjs → run-until-4KHVF7YC.cjs} +8 -4
- package/dist/run-until-4KHVF7YC.cjs.map +1 -0
- package/dist/{run-until-6D6TQ4JN.js → run-until-G6BW2DWM.js} +8 -4
- package/dist/run-until-G6BW2DWM.js.map +1 -0
- package/dist/sandbox/index.cjs +114 -41
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +99 -26
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +24 -4
- package/dist/sandbox/linux-sandbox.d.ts +24 -4
- package/dist/sandbox/seccomp-delivery.d.cts +46 -0
- package/dist/sandbox/seccomp-delivery.d.ts +46 -0
- package/dist/{run-DsA5Ip2i.d.cts → sdk-agent-4-dXI2GS.d.cts} +1500 -753
- package/dist/{run-DsA5Ip2i.d.ts → sdk-agent-CTOJlWA_.d.ts} +1500 -753
- package/dist/server/auth/index.cjs +22 -22
- package/dist/server/auth/index.js +7 -7
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.d.cts +2 -3
- package/dist/server/errors-envelope.d.ts +2 -3
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-7TZ6HXSX.cjs +62 -0
- package/dist/{session-transcript-RACG7BK2.cjs.map → session-transcript-7TZ6HXSX.cjs.map} +1 -1
- package/dist/session-transcript-BSHZYYY6.js +5 -0
- package/dist/{session-transcript-AR7IBICT.js.map → session-transcript-BSHZYYY6.js.map} +1 -1
- package/dist/skills.cjs +8 -8
- package/dist/skills.js +5 -5
- package/dist/stream-object-R6SMYV4R.js +7 -0
- package/dist/{stream-object-QAEHG4YO.js.map → stream-object-R6SMYV4R.js.map} +1 -1
- package/dist/stream-object-TEEK3CAX.cjs +20 -0
- package/dist/{stream-object-TKVGGA54.cjs.map → stream-object-TEEK3CAX.cjs.map} +1 -1
- package/dist/subagents-loader-TXOA5EJJ.cjs +16 -0
- package/dist/{subagents-loader-5TZCAIYQ.cjs.map → subagents-loader-TXOA5EJJ.cjs.map} +1 -1
- package/dist/subagents-loader-Z744TAKD.js +7 -0
- package/dist/{subagents-loader-PEV3PD4Q.js.map → subagents-loader-Z744TAKD.js.map} +1 -1
- package/dist/subagents-loader.cjs +7 -7
- package/dist/subagents-loader.d.cts +4 -3
- package/dist/subagents-loader.d.ts +4 -3
- package/dist/subagents-loader.js +5 -5
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/types/agent-prims.d.ts +16 -0
- package/dist/types/agent.d.ts +15 -6
- package/dist/types/run.d.ts +14 -14
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.d.cts +2 -2
- package/dist/workflow.d.ts +2 -2
- package/dist/workflow.js +6 -6
- package/docs/error-codes.md +24 -23
- package/docs/harness-capability-map.md +5 -5
- package/package.json +1 -1
- package/dist/agent-DFV52V6E.js +0 -62
- package/dist/agent-OKP4LHG2.cjs +0 -71
- package/dist/agent-session-store-ODD3IZCW.js +0 -6
- package/dist/agent-session-store-SVEJHSUA.cjs +0 -23
- package/dist/chunk-35KBC4BX.cjs.map +0 -1
- package/dist/chunk-6LHQPOMI.cjs.map +0 -1
- package/dist/chunk-7NQ7HJ3E.cjs.map +0 -1
- package/dist/chunk-B5MHRQJZ.js.map +0 -1
- package/dist/chunk-BBJ77S62.js.map +0 -1
- package/dist/chunk-CZJ6Q7CW.js.map +0 -1
- package/dist/chunk-GMSRRJ53.js.map +0 -1
- package/dist/chunk-JLIRFWUG.js.map +0 -1
- package/dist/chunk-MHIBYKWA.js.map +0 -1
- package/dist/chunk-N7KS3TIR.cjs.map +0 -1
- package/dist/chunk-P5N3Q2NH.cjs.map +0 -1
- package/dist/chunk-SGC7LSHF.cjs +0 -18
- package/dist/chunk-UNFBHV46.cjs.map +0 -1
- package/dist/compact-session-4HAUP3HK.js +0 -25
- package/dist/context-3FZRAO5K.js +0 -7
- package/dist/context-B5J4GX2F.cjs +0 -24
- package/dist/fs-session-store-3VI4CPTX.js +0 -11
- package/dist/fs-session-store-IQ6PEHYF.cjs +0 -20
- package/dist/generate-object-NTKAWE7D.js +0 -7
- package/dist/generate-object-YHTWG5DB.cjs +0 -20
- package/dist/index-manager-JVYIVTZG.js +0 -18
- package/dist/index-manager-YGXRFJMZ.cjs +0 -27
- package/dist/judge-call-AQQYK6VT.cjs +0 -22
- package/dist/judge-call-LOL5FQEX.js +0 -5
- package/dist/oauth-transaction-store-NP2YHZ6D.js +0 -5
- package/dist/oauth-transaction-store-ZINDV7AF.cjs +0 -38
- package/dist/registry-5FK42CRV.js +0 -9
- package/dist/registry-BVTNO73E.cjs +0 -46
- package/dist/run-until-6D6TQ4JN.js.map +0 -1
- package/dist/run-until-DG2KXWB2.cjs.map +0 -1
- package/dist/sdk-agent-dNwjwCt5.d.cts +0 -940
- package/dist/sdk-agent-wEOLXD3F.d.ts +0 -940
- package/dist/session-transcript-AR7IBICT.js +0 -5
- package/dist/session-transcript-RACG7BK2.cjs +0 -62
- package/dist/stream-object-QAEHG4YO.js +0 -7
- package/dist/stream-object-TKVGGA54.cjs +0 -20
- package/dist/subagents-loader-5TZCAIYQ.cjs +0 -16
- package/dist/subagents-loader-PEV3PD4Q.js +0 -7
package/dist/providers.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { getProviderProfile, listProviders } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { getProviderProfile, listProviders } from './chunk-NKQVLWDF.js';
|
|
2
|
+
import './chunk-5HSMH2ZZ.js';
|
|
3
3
|
import './chunk-AGACYRJ2.js';
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
4
|
+
import './chunk-3FSBE4PS.js';
|
|
5
|
+
import './chunk-MS3TQSXU.js';
|
|
6
|
+
import './chunk-5IUDICRK.js';
|
|
7
7
|
import './chunk-Q7GYMXVC.js';
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
8
|
+
import './chunk-TNFOU6SB.js';
|
|
9
|
+
import './chunk-3OY6H3I7.js';
|
|
10
10
|
//# sourceMappingURL=providers.js.map
|
|
11
11
|
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { __getSubscribersCountForTests, __resetTaskRegistryForTests, cancel, configure, get, list, submit, subscribe } from './chunk-HWMGR3HA.js';
|
|
2
|
+
import './chunk-K2BQQ445.js';
|
|
3
|
+
import './chunk-AHKS3DKI.js';
|
|
4
|
+
import './chunk-MLGETTYX.js';
|
|
5
|
+
import './chunk-M4U24U6G.js';
|
|
6
|
+
import './chunk-TNFOU6SB.js';
|
|
7
|
+
import './chunk-3OY6H3I7.js';
|
|
8
|
+
//# sourceMappingURL=registry-5TDAF7RK.js.map
|
|
9
|
+
//# sourceMappingURL=registry-5TDAF7RK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"registry-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"registry-5TDAF7RK.js"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL7JPXZ2C_cjs = require('./chunk-L7JPXZ2C.cjs');
|
|
4
|
+
require('./chunk-BUUUWQMB.cjs');
|
|
5
|
+
require('./chunk-FLDMPVUC.cjs');
|
|
6
|
+
require('./chunk-BWYC7RZG.cjs');
|
|
7
|
+
require('./chunk-ZOFRNNZD.cjs');
|
|
8
|
+
require('./chunk-CEGU5AVD.cjs');
|
|
9
|
+
require('./chunk-RNXXYF22.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "__getSubscribersCountForTests", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkL7JPXZ2C_cjs.__getSubscribersCountForTests; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "__resetTaskRegistryForTests", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkL7JPXZ2C_cjs.__resetTaskRegistryForTests; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "cancel", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkL7JPXZ2C_cjs.cancel; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "configure", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkL7JPXZ2C_cjs.configure; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "get", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkL7JPXZ2C_cjs.get; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "list", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkL7JPXZ2C_cjs.list; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "submit", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkL7JPXZ2C_cjs.submit; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "subscribe", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkL7JPXZ2C_cjs.subscribe; }
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=registry-W7TSCLQO.cjs.map
|
|
46
|
+
//# sourceMappingURL=registry-W7TSCLQO.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"registry-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"registry-W7TSCLQO.cjs"}
|
package/dist/retry.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunk7INPXUJI_cjs = require('./chunk-7INPXUJI.cjs');
|
|
4
|
+
require('./chunk-CEGU5AVD.cjs');
|
|
5
|
+
require('./chunk-RNXXYF22.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "Retry", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk7INPXUJI_cjs.Retry; }
|
|
12
12
|
});
|
|
13
13
|
//# sourceMappingURL=retry.cjs.map
|
|
14
14
|
//# sourceMappingURL=retry.cjs.map
|
package/dist/retry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { Retry } from './chunk-
|
|
2
|
-
import './chunk-
|
|
3
|
-
import './chunk-
|
|
1
|
+
export { Retry } from './chunk-2S4HQCDF.js';
|
|
2
|
+
import './chunk-TNFOU6SB.js';
|
|
3
|
+
import './chunk-3OY6H3I7.js';
|
|
4
4
|
//# sourceMappingURL=retry.js.map
|
|
5
5
|
//# sourceMappingURL=retry.js.map
|
|
@@ -46,8 +46,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
46
46
|
if (signal.aborted) cancelOnAbort();
|
|
47
47
|
else signal.addEventListener("abort", cancelOnAbort, { once: true });
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
let result;
|
|
50
|
+
try {
|
|
51
|
+
result = await run.wait();
|
|
52
|
+
} finally {
|
|
53
|
+
if (signal !== void 0) signal.removeEventListener("abort", cancelOnAbort);
|
|
54
|
+
}
|
|
51
55
|
lastResponse = result.result ?? "";
|
|
52
56
|
const turnTokens = result.usage?.totalTokens;
|
|
53
57
|
if (typeof turnTokens === "number") tokensUsed += turnTokens;
|
|
@@ -145,5 +149,5 @@ ${lastResponse.slice(-1e3)}`
|
|
|
145
149
|
|
|
146
150
|
exports.composeContinuation = composeContinuation;
|
|
147
151
|
exports.runUntilImpl = runUntilImpl;
|
|
148
|
-
//# sourceMappingURL=run-until-
|
|
149
|
-
//# sourceMappingURL=run-until-
|
|
152
|
+
//# sourceMappingURL=run-until-4KHVF7YC.cjs.map
|
|
153
|
+
//# sourceMappingURL=run-until-4KHVF7YC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/runtime/lifecycle/run-until.ts"],"names":["GOAL_CONTINUATION_MARKER"],"mappings":";;;;;AA+BA,IAAM,eAAA,GAAkB,yBAAA;AAOxB,IAAM,QAAA,GAAW,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GAAA;AAAA,IACA,oGAAA;AAAA,IACA,EAAA;AAAA,IACA,CAAA;AAAA,EAA4B,YAAA,CAAa,KAAA,CAAM,IAAK,CAAC,CAAA;AAAA,GACvD,CAAE,KAAK,IAAI,CAAA;AACb","file":"run-until-4KHVF7YC.cjs","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 // B-498 — in a `finally`: under `throwOnError` a failed turn's `wait()` rejects, and the\n // listener must not outlive the turn on the caller's signal.\n let result: Awaited<ReturnType<typeof run.wait>>;\n try {\n result = await run.wait();\n } finally {\n if (signal !== undefined) signal.removeEventListener(\"abort\", cancelOnAbort);\n }\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"]}
|
|
@@ -44,8 +44,12 @@ async function* runUntilImpl(agent, goal, options, deps) {
|
|
|
44
44
|
if (signal.aborted) cancelOnAbort();
|
|
45
45
|
else signal.addEventListener("abort", cancelOnAbort, { once: true });
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
let result;
|
|
48
|
+
try {
|
|
49
|
+
result = await run.wait();
|
|
50
|
+
} finally {
|
|
51
|
+
if (signal !== void 0) signal.removeEventListener("abort", cancelOnAbort);
|
|
52
|
+
}
|
|
49
53
|
lastResponse = result.result ?? "";
|
|
50
54
|
const turnTokens = result.usage?.totalTokens;
|
|
51
55
|
if (typeof turnTokens === "number") tokensUsed += turnTokens;
|
|
@@ -142,5 +146,5 @@ ${lastResponse.slice(-1e3)}`
|
|
|
142
146
|
}
|
|
143
147
|
|
|
144
148
|
export { composeContinuation, runUntilImpl };
|
|
145
|
-
//# sourceMappingURL=run-until-
|
|
146
|
-
//# sourceMappingURL=run-until-
|
|
149
|
+
//# sourceMappingURL=run-until-G6BW2DWM.js.map
|
|
150
|
+
//# sourceMappingURL=run-until-G6BW2DWM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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A,IACA,EAAA;AAAA,IACA,qBAAA;AAAA,IACA,kGAAA;AAAA,IACA,uGAAA;AAAA,IACA,EAAA;AAAA,IACA,mBAAA;AAAA,IACA,uGAAA;AAAA,IACA,oGAAA;AAAA,IACA,EAAA;AAAA,IACA,CAAA;AAAA,EAA4B,YAAA,CAAa,KAAA,CAAM,IAAK,CAAC,CAAA;AAAA,GACvD,CAAE,KAAK,IAAI,CAAA;AACb","file":"run-until-G6BW2DWM.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 // B-498 — in a `finally`: under `throwOnError` a failed turn's `wait()` rejects, and the\n // listener must not outlive the turn on the caller's signal.\n let result: Awaited<ReturnType<typeof run.wait>>;\n try {\n result = await run.wait();\n } finally {\n if (signal !== undefined) signal.removeEventListener(\"abort\", cancelOnAbort);\n }\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"]}
|
package/dist/sandbox/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEPANMGH7_cjs = require('../chunk-EPANMGH7.cjs');
|
|
4
4
|
require('../chunk-2ZPEDVLM.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkCEGU5AVD_cjs = require('../chunk-CEGU5AVD.cjs');
|
|
6
|
+
var chunkRNXXYF22_cjs = require('../chunk-RNXXYF22.cjs');
|
|
7
7
|
var child_process = require('child_process');
|
|
8
8
|
var fs = require('fs');
|
|
9
9
|
var path = require('path');
|
|
@@ -185,7 +185,7 @@ function buildSeccompFilter(opts) {
|
|
|
185
185
|
const denyIdx = body.length - 1;
|
|
186
186
|
push(RET_K, SECCOMP_RET_KILL_PROCESS);
|
|
187
187
|
const killIdx = body.length - 1;
|
|
188
|
-
const
|
|
188
|
+
const resolve2 = (i, t) => {
|
|
189
189
|
const abs = t === ALLOW ? allowIdx : t === DENY ? denyIdx : t === KILL ? killIdx : i + 1 + t;
|
|
190
190
|
const off = abs - (i + 1);
|
|
191
191
|
if (off < 0 || off > 255) throw new RangeError(`seccomp jump out of range at ${i}: ${off}`);
|
|
@@ -193,7 +193,7 @@ function buildSeccompFilter(opts) {
|
|
|
193
193
|
};
|
|
194
194
|
for (const [i, b] of body.entries()) {
|
|
195
195
|
if (b.code === JEQ_K || b.code === JGE_K) {
|
|
196
|
-
insns.push(jmp(b.code, b.k,
|
|
196
|
+
insns.push(jmp(b.code, b.k, resolve2(i, b.jt), resolve2(i, b.jf)));
|
|
197
197
|
} else {
|
|
198
198
|
insns.push(stmt(b.code, b.k));
|
|
199
199
|
}
|
|
@@ -207,15 +207,90 @@ function buildSeccompFilter(opts) {
|
|
|
207
207
|
});
|
|
208
208
|
return buf;
|
|
209
209
|
}
|
|
210
|
+
function nonX64SeccompWarning(arch) {
|
|
211
|
+
return `[sandbox] seccomp syscall filter unsupported on ${arch} (x86_64 only in v1) \u2014 running without the filter; bwrap FS/network confinement still applies.`;
|
|
212
|
+
}
|
|
213
|
+
var warnedNonX64Program = false;
|
|
214
|
+
function seccompProgramForArch(arch, warn) {
|
|
215
|
+
if (arch !== "x64") {
|
|
216
|
+
if (!warnedNonX64Program) {
|
|
217
|
+
warnedNonX64Program = true;
|
|
218
|
+
warn(nonX64SeccompWarning(arch));
|
|
219
|
+
}
|
|
220
|
+
return void 0;
|
|
221
|
+
}
|
|
222
|
+
return buildSeccompFilter({ networkRestricted: true });
|
|
223
|
+
}
|
|
224
|
+
var memoizedProgram;
|
|
225
|
+
function restrictedSeccompProgram(warn) {
|
|
226
|
+
if (memoizedProgram === void 0)
|
|
227
|
+
memoizedProgram = seccompProgramForArch(process.arch, warn) ?? null;
|
|
228
|
+
return memoizedProgram ?? void 0;
|
|
229
|
+
}
|
|
230
|
+
function octalPrintfArg(program) {
|
|
231
|
+
let out = "";
|
|
232
|
+
for (const byte of program) out += `\\${byte.toString(8).padStart(3, "0")}`;
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
function assertSeccompProgramShape(program) {
|
|
236
|
+
if (program.length === 0 || program.length % 8 !== 0) {
|
|
237
|
+
throw new TypeError(
|
|
238
|
+
`seccompProgram must be a positive multiple of 8 bytes, got ${program.length}`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
var PIPE_SCRIPT = '{ p=$1; shift; printf "$p" | exec "$@" 3<&0 0<&4 4<&-; } 4<&0';
|
|
243
|
+
function wrapWithSeccompProgram(bwrapArgv, command, program) {
|
|
244
|
+
assertSeccompProgramShape(program);
|
|
245
|
+
const words = [octalPrintfArg(program), ...bwrapArgv, "--seccomp", "3", "--", "/bin/sh", "-c"];
|
|
246
|
+
return `exec /bin/sh -c ${chunkEPANMGH7_cjs.shellEscapePosix(PIPE_SCRIPT)} sh ${[...words, command].map(chunkEPANMGH7_cjs.shellEscapePosix).join(" ")}`;
|
|
247
|
+
}
|
|
248
|
+
var programsWritten = /* @__PURE__ */ new Map();
|
|
249
|
+
function rememberSeccompFile(path2, program) {
|
|
250
|
+
programsWritten.set(path.resolve(path2), Buffer.from(program));
|
|
251
|
+
}
|
|
252
|
+
function removeDirOnExit(dir) {
|
|
253
|
+
const cleanup = () => fs.rmSync(dir, { recursive: true, force: true });
|
|
254
|
+
process.once("exit", cleanup);
|
|
255
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
256
|
+
process.once(signal, () => {
|
|
257
|
+
cleanup();
|
|
258
|
+
if (process.listenerCount(signal) === 0) process.kill(process.pid, signal);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function wrapWithSeccompPath(bwrapArgv, policy, command, seccompPath) {
|
|
263
|
+
const program = programsWritten.get(path.resolve(seccompPath));
|
|
264
|
+
const bind = program === void 0 ? "--ro-bind" : "--ro-bind-try";
|
|
265
|
+
const flags = [
|
|
266
|
+
...bwrapArgv.slice(0, -3),
|
|
267
|
+
...readOnlyBindForSeccompPath(policy.mode, policy.cwd, seccompPath, bind),
|
|
268
|
+
...bwrapArgv.slice(-3, -1)
|
|
269
|
+
];
|
|
270
|
+
if (program !== void 0) return wrapWithSeccompProgram(flags, command, program);
|
|
271
|
+
return `${[...flags, "--seccomp", "3", "--"].map(chunkEPANMGH7_cjs.shellEscapePosix).join(" ")} /bin/sh -c ${chunkEPANMGH7_cjs.shellEscapePosix(command)} 3< ${chunkEPANMGH7_cjs.shellEscapePosix(seccompPath)}`;
|
|
272
|
+
}
|
|
273
|
+
function readOnlyBindForSeccompPath(mode, cwd, seccompPath, bind) {
|
|
274
|
+
const file = path.resolve(seccompPath);
|
|
275
|
+
const dir = path.dirname(file);
|
|
276
|
+
const roots = writableRootsFor(mode, path.resolve(cwd)) ?? [];
|
|
277
|
+
const covers = (root) => dir === "/" || root === dir || root.startsWith(`${dir}/`);
|
|
278
|
+
const target = roots.some(covers) ? file : dir;
|
|
279
|
+
return [bind, target, target];
|
|
280
|
+
}
|
|
210
281
|
|
|
211
282
|
// src/sandbox/linux-sandbox.ts
|
|
212
283
|
function wrapCommandForSandbox(mode, opts, command) {
|
|
213
284
|
const argv = buildBwrapArgv(mode, { cwd: opts.cwd, network: opts.network, env: opts.env });
|
|
214
285
|
if (argv === null) return null;
|
|
215
286
|
const bin = opts.bin ?? "bwrap";
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
287
|
+
if (opts.seccompProgram !== void 0) {
|
|
288
|
+
return wrapWithSeccompProgram([bin, ...argv.slice(0, -1)], command, opts.seccompProgram);
|
|
289
|
+
}
|
|
290
|
+
if (opts.seccompPath === void 0) {
|
|
291
|
+
return `${[bin, ...argv].map(chunkEPANMGH7_cjs.shellEscapePosix).join(" ")} /bin/sh -c ${chunkEPANMGH7_cjs.shellEscapePosix(command)}`;
|
|
292
|
+
}
|
|
293
|
+
return wrapWithSeccompPath([bin, ...argv], { mode, cwd: opts.cwd }, command, opts.seccompPath);
|
|
219
294
|
}
|
|
220
295
|
var ENV_ALLOWLIST = [
|
|
221
296
|
"PATH",
|
|
@@ -236,15 +311,16 @@ function allowlistedEnv(source = process.env) {
|
|
|
236
311
|
}
|
|
237
312
|
return out;
|
|
238
313
|
}
|
|
239
|
-
var LinuxSandbox = class extends
|
|
314
|
+
var LinuxSandbox = class extends chunkEPANMGH7_cjs.LocalSandbox {
|
|
240
315
|
mode;
|
|
241
316
|
network;
|
|
242
317
|
cwd;
|
|
243
318
|
bin;
|
|
244
319
|
env;
|
|
245
|
-
/**
|
|
246
|
-
*
|
|
247
|
-
|
|
320
|
+
/** B-600 — the cBPF seccomp program, piped to `bwrap --seccomp 3` from memory (never a file a
|
|
321
|
+
* confined command could replace). `undefined` when the network is unrestricted or the arch is not
|
|
322
|
+
* x86_64 (honest fallback). */
|
|
323
|
+
seccompProgram;
|
|
248
324
|
constructor(config, opts) {
|
|
249
325
|
super(config);
|
|
250
326
|
this.mode = opts.mode;
|
|
@@ -252,7 +328,7 @@ var LinuxSandbox = class extends chunk7NQ7HJ3E_cjs.LocalSandbox {
|
|
|
252
328
|
this.cwd = config.workDir ?? process.cwd();
|
|
253
329
|
this.bin = opts.bin ?? "bwrap";
|
|
254
330
|
this.env = opts.env ?? allowlistedEnv();
|
|
255
|
-
this.
|
|
331
|
+
this.seccompProgram = seccompProgramForNetwork(this.network);
|
|
256
332
|
}
|
|
257
333
|
/** Extracted for test visibility — delegates to the pure `wrapCommandForSandbox` (M57, single wrap SoT). */
|
|
258
334
|
wrapCommand(command) {
|
|
@@ -263,7 +339,7 @@ var LinuxSandbox = class extends chunk7NQ7HJ3E_cjs.LocalSandbox {
|
|
|
263
339
|
network: this.network,
|
|
264
340
|
env: this.env,
|
|
265
341
|
bin: this.bin,
|
|
266
|
-
|
|
342
|
+
seccompProgram: this.seccompProgram
|
|
267
343
|
},
|
|
268
344
|
command
|
|
269
345
|
);
|
|
@@ -286,7 +362,7 @@ var LinuxSandbox = class extends chunk7NQ7HJ3E_cjs.LocalSandbox {
|
|
|
286
362
|
const target = path2.startsWith("/") ? path2 : `${this.cwd}/${path2}`;
|
|
287
363
|
const b64 = Buffer.from(content).toString("base64");
|
|
288
364
|
const r = await this.execute(
|
|
289
|
-
`mkdir -p ${
|
|
365
|
+
`mkdir -p ${chunkEPANMGH7_cjs.shellEscapePosix(path.dirname(target))} && printf %s ${chunkEPANMGH7_cjs.shellEscapePosix(b64)} | base64 -d > ${chunkEPANMGH7_cjs.shellEscapePosix(target)}`
|
|
290
366
|
);
|
|
291
367
|
if (r.exitCode !== 0) {
|
|
292
368
|
throw new Error(
|
|
@@ -305,20 +381,17 @@ function seccompPathForArch(arch, warn) {
|
|
|
305
381
|
if (arch !== "x64") {
|
|
306
382
|
if (!warnedNonX64) {
|
|
307
383
|
warnedNonX64 = true;
|
|
308
|
-
warn(
|
|
309
|
-
`[sandbox] seccomp syscall filter unsupported on ${arch} (x86_64 only in v1) \u2014 running without the filter; bwrap FS/network confinement still applies.`
|
|
310
|
-
);
|
|
384
|
+
warn(nonX64SeccompWarning(arch));
|
|
311
385
|
}
|
|
312
386
|
return void 0;
|
|
313
387
|
}
|
|
314
388
|
try {
|
|
315
389
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "ab-seccomp-"));
|
|
316
390
|
const path2 = path.join(dir, "filter.bpf");
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
process.once("SIGTERM", cleanup);
|
|
391
|
+
const program = buildSeccompFilter({ networkRestricted: true });
|
|
392
|
+
fs.writeFileSync(path2, program);
|
|
393
|
+
rememberSeccompFile(path2, program);
|
|
394
|
+
removeDirOnExit(dir);
|
|
322
395
|
return path2;
|
|
323
396
|
} catch (err) {
|
|
324
397
|
warn(
|
|
@@ -330,7 +403,7 @@ function seccompPathForArch(arch, warn) {
|
|
|
330
403
|
var seccompFilterPath;
|
|
331
404
|
function restrictedSeccompPath() {
|
|
332
405
|
if (seccompFilterPath !== void 0) return seccompFilterPath ?? void 0;
|
|
333
|
-
const path2 = seccompPathForArch(process.arch, (m) => console.warn(
|
|
406
|
+
const path2 = seccompPathForArch(process.arch, (m) => console.warn(chunkRNXXYF22_cjs.redactSecrets(m)));
|
|
334
407
|
seccompFilterPath = path2 ?? null;
|
|
335
408
|
return path2;
|
|
336
409
|
}
|
|
@@ -350,17 +423,17 @@ function resolveSandboxPosture(opts) {
|
|
|
350
423
|
}
|
|
351
424
|
function createSandboxBackend(opts) {
|
|
352
425
|
const config = { workDir: opts.workDir, timeoutMs: opts.timeoutMs };
|
|
353
|
-
if (opts.mode === "danger-full-access") return new
|
|
426
|
+
if (opts.mode === "danger-full-access") return new chunkEPANMGH7_cjs.LocalSandbox(config);
|
|
354
427
|
const detection = (opts.detect ?? detectBwrapMemoized)();
|
|
355
428
|
if (!detection.ok) {
|
|
356
429
|
if (!warnedUnavailable) {
|
|
357
430
|
warnedUnavailable = true;
|
|
358
|
-
const warn = opts.warn ?? ((m) => console.warn(
|
|
431
|
+
const warn = opts.warn ?? ((m) => console.warn(chunkRNXXYF22_cjs.redactSecrets(m)));
|
|
359
432
|
warn(
|
|
360
433
|
`[sandbox] OS-level enforcement unavailable (${detection.reason}) \u2014 falling back to tool-level gating only (sandbox_mode=${opts.mode}).`
|
|
361
434
|
);
|
|
362
435
|
}
|
|
363
|
-
return new
|
|
436
|
+
return new chunkEPANMGH7_cjs.LocalSandbox(config);
|
|
364
437
|
}
|
|
365
438
|
return new LinuxSandbox(config, { mode: opts.mode, network: opts.network, bin: detection.bin });
|
|
366
439
|
}
|
|
@@ -368,8 +441,8 @@ var interactiveWarned = false;
|
|
|
368
441
|
function __resetInteractiveWarnLatchForTests() {
|
|
369
442
|
interactiveWarned = false;
|
|
370
443
|
}
|
|
371
|
-
function
|
|
372
|
-
return networkOpen ? void 0 :
|
|
444
|
+
function seccompProgramForNetwork(networkOpen) {
|
|
445
|
+
return networkOpen ? void 0 : restrictedSeccompProgram((m) => console.warn(chunkRNXXYF22_cjs.redactSecrets(m)));
|
|
373
446
|
}
|
|
374
447
|
function decideConfinement(opts) {
|
|
375
448
|
if (opts.mode === "danger-full-access") return null;
|
|
@@ -377,7 +450,7 @@ function decideConfinement(opts) {
|
|
|
377
450
|
if (detection.ok) return detection.bin;
|
|
378
451
|
if (!interactiveWarned) {
|
|
379
452
|
interactiveWarned = true;
|
|
380
|
-
const warn = opts.warn ?? ((m) => console.warn(
|
|
453
|
+
const warn = opts.warn ?? ((m) => console.warn(chunkRNXXYF22_cjs.redactSecrets(m)));
|
|
381
454
|
warn(
|
|
382
455
|
`[sandbox] OS-level enforcement unavailable (${detection.reason}) \u2014 interactive session runs WITHOUT kernel confinement (sandbox_mode=${opts.mode}).`
|
|
383
456
|
);
|
|
@@ -395,7 +468,7 @@ function interactiveWrapCommand(opts) {
|
|
|
395
468
|
network: opts.network ?? false,
|
|
396
469
|
env: allowlistedEnv(),
|
|
397
470
|
bin,
|
|
398
|
-
|
|
471
|
+
seccompProgram: seccompProgramForNetwork(opts.network ?? false)
|
|
399
472
|
},
|
|
400
473
|
command
|
|
401
474
|
);
|
|
@@ -403,7 +476,7 @@ function interactiveWrapCommand(opts) {
|
|
|
403
476
|
}
|
|
404
477
|
|
|
405
478
|
// src/sandbox/provision.ts
|
|
406
|
-
var RepoProvisionError = class extends
|
|
479
|
+
var RepoProvisionError = class extends chunkCEGU5AVD_cjs.TheokitAgentError {
|
|
407
480
|
constructor(instanceId, message, options = {}) {
|
|
408
481
|
super(`[${instanceId}] ${message}`, {
|
|
409
482
|
code: "repo_provision_failed",
|
|
@@ -417,7 +490,7 @@ var RepoProvisionError = class extends chunkUNFBHV46_cjs.TheokitAgentError {
|
|
|
417
490
|
};
|
|
418
491
|
var SAFE_INSTANCE_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
419
492
|
async function provisionRepo(sandboxOrOpts, maybeOpts) {
|
|
420
|
-
const sandbox = maybeOpts !== void 0 ? sandboxOrOpts : new
|
|
493
|
+
const sandbox = maybeOpts !== void 0 ? sandboxOrOpts : new chunkEPANMGH7_cjs.LocalSandbox();
|
|
421
494
|
const opts = maybeOpts ?? sandboxOrOpts;
|
|
422
495
|
const { repoUrl, ref, instanceId } = opts;
|
|
423
496
|
if (!SAFE_INSTANCE_ID.test(instanceId)) {
|
|
@@ -430,20 +503,20 @@ async function provisionRepo(sandboxOrOpts, maybeOpts) {
|
|
|
430
503
|
throw new RepoProvisionError(instanceId, `invalid ref: must not begin with '-' (got ${ref})`);
|
|
431
504
|
}
|
|
432
505
|
const clone = await sandbox.execute(
|
|
433
|
-
`git -c protocol.ext.allow=never clone --quiet -- ${
|
|
506
|
+
`git -c protocol.ext.allow=never clone --quiet -- ${chunkEPANMGH7_cjs.shellEscapePosix(repoUrl)} ${chunkEPANMGH7_cjs.shellEscapePosix(instanceId)}`
|
|
434
507
|
);
|
|
435
508
|
if (clone.exitCode !== 0) {
|
|
436
509
|
throw new RepoProvisionError(instanceId, `clone failed: ${clone.stderr.trim()}`);
|
|
437
510
|
}
|
|
438
511
|
const top = await sandbox.execute(
|
|
439
|
-
`git -C ${
|
|
512
|
+
`git -C ${chunkEPANMGH7_cjs.shellEscapePosix(instanceId)} rev-parse --show-toplevel`
|
|
440
513
|
);
|
|
441
514
|
if (top.exitCode !== 0) {
|
|
442
515
|
throw new RepoProvisionError(instanceId, `resolve repoDir failed: ${top.stderr.trim()}`);
|
|
443
516
|
}
|
|
444
517
|
const repoDir = top.stdout.trim();
|
|
445
518
|
const checkout = await sandbox.execute(
|
|
446
|
-
`git -C ${
|
|
519
|
+
`git -C ${chunkEPANMGH7_cjs.shellEscapePosix(repoDir)} checkout --quiet ${chunkEPANMGH7_cjs.shellEscapePosix(ref)}`
|
|
447
520
|
);
|
|
448
521
|
if (checkout.exitCode !== 0) {
|
|
449
522
|
throw new RepoProvisionError(instanceId, `checkout ${ref} failed: ${checkout.stderr.trim()}`);
|
|
@@ -453,23 +526,23 @@ async function provisionRepo(sandboxOrOpts, maybeOpts) {
|
|
|
453
526
|
|
|
454
527
|
Object.defineProperty(exports, "LocalSandbox", {
|
|
455
528
|
enumerable: true,
|
|
456
|
-
get: function () { return
|
|
529
|
+
get: function () { return chunkEPANMGH7_cjs.LocalSandbox; }
|
|
457
530
|
});
|
|
458
531
|
Object.defineProperty(exports, "SandboxBackend", {
|
|
459
532
|
enumerable: true,
|
|
460
|
-
get: function () { return
|
|
533
|
+
get: function () { return chunkEPANMGH7_cjs.SandboxBackend; }
|
|
461
534
|
});
|
|
462
535
|
Object.defineProperty(exports, "SandboxNotAvailableError", {
|
|
463
536
|
enumerable: true,
|
|
464
|
-
get: function () { return
|
|
537
|
+
get: function () { return chunkEPANMGH7_cjs.SandboxNotAvailableError; }
|
|
465
538
|
});
|
|
466
539
|
Object.defineProperty(exports, "SandboxSecurityError", {
|
|
467
540
|
enumerable: true,
|
|
468
|
-
get: function () { return
|
|
541
|
+
get: function () { return chunkEPANMGH7_cjs.SandboxSecurityError; }
|
|
469
542
|
});
|
|
470
543
|
Object.defineProperty(exports, "resolveSandbox", {
|
|
471
544
|
enumerable: true,
|
|
472
|
-
get: function () { return
|
|
545
|
+
get: function () { return chunkEPANMGH7_cjs.resolveSandbox; }
|
|
473
546
|
});
|
|
474
547
|
exports.LinuxSandbox = LinuxSandbox;
|
|
475
548
|
exports.RepoProvisionError = RepoProvisionError;
|