@theokit/sdk 4.37.2 → 4.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -72
- package/dist/agent-2GZC4W2A.cjs +51 -0
- package/dist/{agent-IE6IE4NW.cjs.map → agent-2GZC4W2A.cjs.map} +1 -1
- package/dist/agent-3H3UKD6U.js +42 -0
- package/dist/{agent-DW2J37IH.js.map → agent-3H3UKD6U.js.map} +1 -1
- package/dist/{agent-SmxntivO.d.ts → agent-C3AEtM-W.d.ts} +39 -37
- package/dist/{agent-DGv1-d81.d.cts → agent-U3lBX-5t.d.cts} +39 -37
- package/dist/agent.d.ts +1 -1
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +4 -4
- package/dist/{batch-SY5GZLFD.js → batch-LXSALQC3.js} +9 -9
- package/dist/{batch-SY5GZLFD.js.map → batch-LXSALQC3.js.map} +1 -1
- package/dist/{batch-3SEPDXCU.cjs → batch-NZGN6SFV.cjs} +23 -23
- package/dist/{batch-3SEPDXCU.cjs.map → batch-NZGN6SFV.cjs.map} +1 -1
- package/dist/{chunk-D4ZUJTFB.cjs → chunk-2K7PRHDB.cjs} +8 -8
- package/dist/{chunk-D4ZUJTFB.cjs.map → chunk-2K7PRHDB.cjs.map} +1 -1
- package/dist/chunk-2R6NBT5F.cjs +112 -0
- package/dist/chunk-2R6NBT5F.cjs.map +1 -0
- package/dist/{chunk-2423XDPT.cjs → chunk-3BSP7LSG.cjs} +26 -26
- package/dist/{chunk-2423XDPT.cjs.map → chunk-3BSP7LSG.cjs.map} +1 -1
- package/dist/{chunk-6EDQBX7U.cjs → chunk-3MUIYMUG.cjs} +17 -17
- package/dist/{chunk-6EDQBX7U.cjs.map → chunk-3MUIYMUG.cjs.map} +1 -1
- package/dist/{chunk-P34DHHYQ.cjs → chunk-3VKTDQMX.cjs} +34 -27
- package/dist/chunk-3VKTDQMX.cjs.map +1 -0
- package/dist/{chunk-77WHPVXE.js → chunk-3XKVRLR2.js} +4 -4
- package/dist/chunk-3XKVRLR2.js.map +1 -0
- package/dist/{chunk-SWIBQFPH.cjs → chunk-3XRXORBS.cjs} +4 -4
- package/dist/{chunk-SWIBQFPH.cjs.map → chunk-3XRXORBS.cjs.map} +1 -1
- package/dist/{chunk-DCJ5MCJ3.js → chunk-4APWS2YF.js} +7 -7
- package/dist/{chunk-DCJ5MCJ3.js.map → chunk-4APWS2YF.js.map} +1 -1
- package/dist/{chunk-56ZM6P7Z.cjs → chunk-4MWBKBS4.cjs} +12 -12
- package/dist/chunk-4MWBKBS4.cjs.map +1 -0
- package/dist/chunk-4NVV3GRU.js +110 -0
- package/dist/chunk-4NVV3GRU.js.map +1 -0
- package/dist/{chunk-QGDKZDPN.js → chunk-4WIJSKFA.js} +3 -3
- package/dist/{chunk-QGDKZDPN.js.map → chunk-4WIJSKFA.js.map} +1 -1
- package/dist/{chunk-VNNK6AKU.js → chunk-5BVBNE2F.js} +3 -3
- package/dist/chunk-5BVBNE2F.js.map +1 -0
- package/dist/{chunk-EEZ7CFMM.js → chunk-5KOW3GLE.js} +2 -2
- package/dist/chunk-5KOW3GLE.js.map +1 -0
- package/dist/{chunk-FK4EJD2I.cjs → chunk-6OIO4FYX.cjs} +7 -7
- package/dist/{chunk-FK4EJD2I.cjs.map → chunk-6OIO4FYX.cjs.map} +1 -1
- package/dist/{chunk-IEUDKUPM.cjs → chunk-6OKPJZMX.cjs} +8 -8
- package/dist/{chunk-IEUDKUPM.cjs.map → chunk-6OKPJZMX.cjs.map} +1 -1
- package/dist/{chunk-QFMXXUUT.js → chunk-6XZBKFQ7.js} +3 -3
- package/dist/{chunk-QFMXXUUT.js.map → chunk-6XZBKFQ7.js.map} +1 -1
- package/dist/{chunk-H5YVJB4K.cjs → chunk-6ZGD7R27.cjs} +37 -37
- package/dist/chunk-6ZGD7R27.cjs.map +1 -0
- package/dist/{chunk-HEN5WXXI.js → chunk-7QDTZJRV.js} +6 -6
- package/dist/{chunk-HEN5WXXI.js.map → chunk-7QDTZJRV.js.map} +1 -1
- package/dist/{chunk-MHCKWQR3.cjs → chunk-A3MHE2MQ.cjs} +8 -8
- package/dist/{chunk-MHCKWQR3.cjs.map → chunk-A3MHE2MQ.cjs.map} +1 -1
- package/dist/{chunk-5SB4V74H.js → chunk-A4XXV2C6.js} +18 -18
- package/dist/chunk-A4XXV2C6.js.map +1 -0
- package/dist/{chunk-6VP3XGEK.js → chunk-A6GXYF2Q.js} +9 -9
- package/dist/{chunk-6VP3XGEK.js.map → chunk-A6GXYF2Q.js.map} +1 -1
- package/dist/{chunk-SDIBMLL5.js → chunk-ACHGT3D2.js} +8 -8
- package/dist/{chunk-SDIBMLL5.js.map → chunk-ACHGT3D2.js.map} +1 -1
- package/dist/{chunk-XAEAMI5H.js → chunk-AOZYORH7.js} +4 -4
- package/dist/chunk-AOZYORH7.js.map +1 -0
- package/dist/{chunk-LTCOPATU.cjs → chunk-BE3W4HYV.cjs} +2 -2
- package/dist/chunk-BE3W4HYV.cjs.map +1 -0
- package/dist/{chunk-NQ4AC2U4.cjs → chunk-BT6DFWZB.cjs} +9 -9
- package/dist/{chunk-NQ4AC2U4.cjs.map → chunk-BT6DFWZB.cjs.map} +1 -1
- package/dist/{chunk-XAYVHS2B.cjs → chunk-BUGVDCI5.cjs} +4 -4
- package/dist/{chunk-XAYVHS2B.cjs.map → chunk-BUGVDCI5.cjs.map} +1 -1
- package/dist/{chunk-IT3PWBW4.cjs → chunk-BURYFNOM.cjs} +2 -2
- package/dist/chunk-BURYFNOM.cjs.map +1 -0
- package/dist/{chunk-NNSKJCBM.cjs → chunk-D3SJLXYZ.cjs} +10 -10
- package/dist/{chunk-NNSKJCBM.cjs.map → chunk-D3SJLXYZ.cjs.map} +1 -1
- package/dist/{chunk-MRODLUGY.cjs → chunk-ED7ANP6W.cjs} +4 -4
- package/dist/{chunk-MRODLUGY.cjs.map → chunk-ED7ANP6W.cjs.map} +1 -1
- package/dist/{chunk-MXSMAGDU.js → chunk-EDI7DBWO.js} +33 -26
- package/dist/chunk-EDI7DBWO.js.map +1 -0
- package/dist/{chunk-T4QWDOG6.js → chunk-EE24WJJR.js} +5 -5
- package/dist/{chunk-T4QWDOG6.js.map → chunk-EE24WJJR.js.map} +1 -1
- package/dist/{chunk-ZJN6NTHE.js → chunk-EUB7YLU2.js} +3 -3
- package/dist/{chunk-ZJN6NTHE.js.map → chunk-EUB7YLU2.js.map} +1 -1
- package/dist/{chunk-ALU3KC4G.cjs → chunk-G7X2Y7Y2.cjs} +156 -156
- package/dist/chunk-G7X2Y7Y2.cjs.map +1 -0
- package/dist/{chunk-YCXMSDSP.js → chunk-HHUDNTZC.js} +4 -4
- package/dist/{chunk-YCXMSDSP.js.map → chunk-HHUDNTZC.js.map} +1 -1
- package/dist/{chunk-GL7CFBVC.js → chunk-HI6G3SNY.js} +48 -48
- package/dist/chunk-HI6G3SNY.js.map +1 -0
- package/dist/{chunk-G6AASL5T.cjs → chunk-HLK35TD7.cjs} +24 -24
- package/dist/{chunk-G6AASL5T.cjs.map → chunk-HLK35TD7.cjs.map} +1 -1
- package/dist/{chunk-4YB7B3RP.cjs → chunk-IBDE4R5L.cjs} +13 -13
- package/dist/{chunk-4YB7B3RP.cjs.map → chunk-IBDE4R5L.cjs.map} +1 -1
- package/dist/{chunk-WDGCZDRG.js → chunk-JCXIDFRI.js} +3 -3
- package/dist/{chunk-WDGCZDRG.js.map → chunk-JCXIDFRI.js.map} +1 -1
- package/dist/{chunk-I35DI7ES.js → chunk-JI34KBNC.js} +3 -3
- package/dist/{chunk-I35DI7ES.js.map → chunk-JI34KBNC.js.map} +1 -1
- package/dist/{chunk-TAPQWDW2.js → chunk-KCZW75PI.js} +2 -2
- package/dist/chunk-KCZW75PI.js.map +1 -0
- package/dist/{chunk-U2WLFOA3.cjs → chunk-KL7E244K.cjs} +4 -4
- package/dist/{chunk-U2WLFOA3.cjs.map → chunk-KL7E244K.cjs.map} +1 -1
- package/dist/{chunk-PAEJPLVN.cjs → chunk-KTXOHCAE.cjs} +4 -4
- package/dist/{chunk-PAEJPLVN.cjs.map → chunk-KTXOHCAE.cjs.map} +1 -1
- package/dist/{chunk-2WFB5ZOX.js → chunk-KWXC6ERT.js} +5 -5
- package/dist/{chunk-2WFB5ZOX.js.map → chunk-KWXC6ERT.js.map} +1 -1
- package/dist/{chunk-56OXYUZE.js → chunk-LGCEYEU2.js} +3 -3
- package/dist/chunk-LGCEYEU2.js.map +1 -0
- package/dist/{chunk-FAY3QDGC.cjs → chunk-M4OGSS66.cjs} +11 -11
- package/dist/{chunk-FAY3QDGC.cjs.map → chunk-M4OGSS66.cjs.map} +1 -1
- package/dist/{chunk-F6Y4IEQM.js → chunk-M6UUTNDT.js} +4 -4
- package/dist/{chunk-F6Y4IEQM.js.map → chunk-M6UUTNDT.js.map} +1 -1
- package/dist/{chunk-GM7QDQ24.cjs → chunk-MXRBNJ6D.cjs} +11 -11
- package/dist/{chunk-GM7QDQ24.cjs.map → chunk-MXRBNJ6D.cjs.map} +1 -1
- package/dist/{chunk-YPQF26X7.cjs → chunk-OBA6YK2R.cjs} +2 -2
- package/dist/chunk-OBA6YK2R.cjs.map +1 -0
- package/dist/{chunk-BJMKQOY2.cjs → chunk-OFWU6UKF.cjs} +11 -11
- package/dist/{chunk-BJMKQOY2.cjs.map → chunk-OFWU6UKF.cjs.map} +1 -1
- package/dist/{chunk-3O2ELBST.cjs → chunk-PG3QQLWS.cjs} +5 -5
- package/dist/{chunk-3O2ELBST.cjs.map → chunk-PG3QQLWS.cjs.map} +1 -1
- package/dist/{chunk-2ONFGMBV.js → chunk-PY2RQOA7.js} +2 -2
- package/dist/chunk-PY2RQOA7.js.map +1 -0
- package/dist/{chunk-UQPDFW4E.js → chunk-QFWQLXCL.js} +3 -3
- package/dist/{chunk-UQPDFW4E.js.map → chunk-QFWQLXCL.js.map} +1 -1
- package/dist/{chunk-YBFDBOUN.cjs → chunk-QJQ2MAZF.cjs} +8 -8
- package/dist/{chunk-YBFDBOUN.cjs.map → chunk-QJQ2MAZF.cjs.map} +1 -1
- package/dist/{chunk-QUFSDDNU.cjs → chunk-R4AMI7KD.cjs} +15 -15
- package/dist/{chunk-QUFSDDNU.cjs.map → chunk-R4AMI7KD.cjs.map} +1 -1
- package/dist/{chunk-CSZRJ4RE.js → chunk-SGTMDQ4O.js} +5 -5
- package/dist/{chunk-CSZRJ4RE.js.map → chunk-SGTMDQ4O.js.map} +1 -1
- package/dist/{chunk-3ILFUXNE.cjs → chunk-SRIF7HMN.cjs} +5 -5
- package/dist/{chunk-3ILFUXNE.cjs.map → chunk-SRIF7HMN.cjs.map} +1 -1
- package/dist/{chunk-THEYGCYS.cjs → chunk-TKDWD3MU.cjs} +4 -4
- package/dist/chunk-TKDWD3MU.cjs.map +1 -0
- package/dist/{chunk-ZW345YOI.js → chunk-UD2T7ISG.js} +4 -4
- package/dist/{chunk-ZW345YOI.js.map → chunk-UD2T7ISG.js.map} +1 -1
- package/dist/{chunk-EXQV452X.js → chunk-UWEALKAN.js} +3 -3
- package/dist/{chunk-EXQV452X.js.map → chunk-UWEALKAN.js.map} +1 -1
- package/dist/{chunk-W52DKZBR.cjs → chunk-UZBA6YYP.cjs} +454 -333
- package/dist/chunk-UZBA6YYP.cjs.map +1 -0
- package/dist/{chunk-VYJSHGAY.js → chunk-VUDH4D2M.js} +201 -80
- package/dist/chunk-VUDH4D2M.js.map +1 -0
- package/dist/{chunk-W4QN5CMG.cjs → chunk-VVMLMKYZ.cjs} +9 -9
- package/dist/{chunk-W4QN5CMG.cjs.map → chunk-VVMLMKYZ.cjs.map} +1 -1
- package/dist/{chunk-JNIWFCKI.js → chunk-VYD6BGKK.js} +3 -3
- package/dist/{chunk-JNIWFCKI.js.map → chunk-VYD6BGKK.js.map} +1 -1
- package/dist/{chunk-YHZXBDAW.js → chunk-XJ5TMOGA.js} +16 -16
- package/dist/{chunk-YHZXBDAW.js.map → chunk-XJ5TMOGA.js.map} +1 -1
- package/dist/{chunk-7DXLNNKH.cjs → chunk-XKBJT7WI.cjs} +4 -4
- package/dist/{chunk-7DXLNNKH.cjs.map → chunk-XKBJT7WI.cjs.map} +1 -1
- package/dist/{chunk-YDLNI7J6.js → chunk-XS7SKY2F.js} +3 -3
- package/dist/{chunk-YDLNI7J6.js.map → chunk-XS7SKY2F.js.map} +1 -1
- package/dist/{chunk-NFCKEBHI.js → chunk-YCHC45BY.js} +3 -3
- package/dist/{chunk-NFCKEBHI.js.map → chunk-YCHC45BY.js.map} +1 -1
- package/dist/{chunk-ICYBIC6N.cjs → chunk-YVI4YPUP.cjs} +4 -4
- package/dist/chunk-YVI4YPUP.cjs.map +1 -0
- package/dist/{chunk-TQI3KRXZ.cjs → chunk-ZET34IZE.cjs} +18 -18
- package/dist/{chunk-TQI3KRXZ.cjs.map → chunk-ZET34IZE.cjs.map} +1 -1
- package/dist/{chunk-GLUWH6JO.js → chunk-ZFZYPLQI.js} +4 -4
- package/dist/{chunk-GLUWH6JO.js.map → chunk-ZFZYPLQI.js.map} +1 -1
- package/dist/{chunk-M5ZQBOIZ.js → chunk-ZK3BJ4XQ.js} +3 -3
- package/dist/{chunk-M5ZQBOIZ.js.map → chunk-ZK3BJ4XQ.js.map} +1 -1
- package/dist/{chunk-CD73YHEH.js → chunk-ZYOHF37V.js} +3 -3
- package/dist/{chunk-CD73YHEH.js.map → chunk-ZYOHF37V.js.map} +1 -1
- package/dist/compact-session-RR3ILTES.js +17 -0
- package/dist/{compact-session-WNKKIIDW.js.map → compact-session-RR3ILTES.js.map} +1 -1
- package/dist/compact-session-YOWJJPPB.cjs +54 -0
- package/dist/{compact-session-H5TKLD55.cjs.map → compact-session-YOWJJPPB.cjs.map} +1 -1
- package/dist/compaction.cjs +19 -19
- package/dist/compaction.d.cts +9 -9
- package/dist/compaction.d.ts +9 -9
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context-Q6ISOCN2.cjs +22 -0
- package/dist/{context-ZV33V4DC.cjs.map → context-Q6ISOCN2.cjs.map} +1 -1
- package/dist/context-ZDBBPIHY.js +5 -0
- package/dist/{context-VAYLPT4O.js.map → context-ZDBBPIHY.js.map} +1 -1
- package/dist/{cron-BiK_aNJI.d.cts → cron-BdXOZco9.d.cts} +2 -2
- package/dist/{cron-Dx7B-3WB.d.ts → cron-ChQ6zcW2.d.ts} +2 -2
- package/dist/cron.cjs +29 -29
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +28 -28
- package/dist/{errors-DyVbXdR4.d.cts → errors-BUVjJGJA.d.cts} +1 -1
- package/dist/{errors-Cua4WC9H.d.ts → errors-CZIUKLHt.d.ts} +1 -1
- package/dist/errors.cjs +21 -21
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +32 -32
- package/dist/eval.js +28 -28
- package/dist/{executor-PAH72CB5.js → executor-ASDDIM2X.js} +7 -7
- package/dist/{executor-PAH72CB5.js.map → executor-ASDDIM2X.js.map} +1 -1
- package/dist/{executor-OZSYXDKF.cjs → executor-DPCBSI35.cjs} +23 -23
- package/dist/{executor-OZSYXDKF.cjs.map → executor-DPCBSI35.cjs.map} +1 -1
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-K5QUPNJZ.js +10 -0
- package/dist/{fs-session-store-6MY7PNI2.js.map → fs-session-store-K5QUPNJZ.js.map} +1 -1
- package/dist/fs-session-store-T5ZLQX42.cjs +19 -0
- package/dist/{fs-session-store-7E7UPLF2.cjs.map → fs-session-store-T5ZLQX42.cjs.map} +1 -1
- package/dist/generate-object-F56VIZ6U.cjs +20 -0
- package/dist/{generate-object-5SCEH2EE.cjs.map → generate-object-F56VIZ6U.cjs.map} +1 -1
- package/dist/generate-object-LPSO6GVW.js +7 -0
- package/dist/{generate-object-I7UD4NWN.js.map → generate-object-LPSO6GVW.js.map} +1 -1
- package/dist/index-manager-DBJ55ZSO.cjs +19 -0
- package/dist/{index-manager-R6ZJFEZF.cjs.map → index-manager-DBJ55ZSO.cjs.map} +1 -1
- package/dist/index-manager-F2H2RCZU.js +10 -0
- package/dist/{index-manager-KKAK7NT3.js.map → index-manager-F2H2RCZU.js.map} +1 -1
- package/dist/index.cjs +140 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -42
- package/dist/index.d.ts +42 -42
- package/dist/index.js +54 -54
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-DM4SKTZO.cjs → inject-session-25EC74WV.cjs} +10 -10
- package/dist/{inject-session-DM4SKTZO.cjs.map → inject-session-25EC74WV.cjs.map} +1 -1
- package/dist/{inject-session-UXNJQTZ6.js → inject-session-RKNLUE72.js} +7 -7
- package/dist/{inject-session-UXNJQTZ6.js.map → inject-session-RKNLUE72.js.map} +1 -1
- package/dist/internal/agent-loop/live-events.d.ts +46 -0
- package/dist/internal/budget/compute-cost.d.ts +1 -1
- package/dist/internal/diagnostics.d.ts +31 -29
- package/dist/internal/error-mappers/anthropic.d.ts +1 -1
- package/dist/internal/global-singleton.d.ts +7 -7
- package/dist/internal/judge/judge-call.d.ts +14 -14
- package/dist/internal/llm/retrying-client.d.ts +29 -29
- package/dist/internal/llm/transport-error.d.ts +2 -2
- package/dist/internal/persistence/exclusive-create.d.cts +2 -2
- package/dist/internal/persistence/exclusive-create.d.ts +2 -2
- package/dist/internal/persistence/fs-session-store.d.cts +18 -18
- package/dist/internal/persistence/fs-session-store.d.ts +18 -18
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/paths.d.cts +7 -7
- package/dist/internal/persistence/paths.d.ts +7 -7
- package/dist/internal/persistence/session-transcript.d.cts +7 -7
- package/dist/internal/persistence/session-transcript.d.ts +7 -7
- package/dist/internal/persistence/session-writer.d.cts +30 -13
- package/dist/internal/persistence/session-writer.d.ts +30 -13
- package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +45 -13
- package/dist/internal/runtime/lifecycle/goal-marker.d.ts +8 -8
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/internal/session/agent-session.d.ts +14 -14
- package/dist/internal/session/session-cache.d.ts +9 -9
- package/dist/judge-call-3S3T6O2Z.js +5 -0
- package/dist/{judge-call-TAEIXMYG.js.map → judge-call-3S3T6O2Z.js.map} +1 -1
- package/dist/judge-call-XIQJ5GIE.cjs +22 -0
- package/dist/{judge-call-SP3G3X2Y.cjs.map → judge-call-XIQJ5GIE.cjs.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +5 -5
- package/dist/models.js.map +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +34 -34
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +14 -14
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-BA3SLAN7.cjs +46 -0
- package/dist/{registry-N3GTKYCI.cjs.map → registry-BA3SLAN7.cjs.map} +1 -1
- package/dist/registry-KMI5RA22.js +9 -0
- package/dist/{registry-SOXE4RY6.js.map → registry-KMI5RA22.js.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-until-YZ2ODWOF.js → run-until-BK56WG4P.js} +3 -3
- package/dist/{run-until-YZ2ODWOF.js.map → run-until-BK56WG4P.js.map} +1 -1
- package/dist/{run-until-ZZ2JLPJM.cjs → run-until-L5KQD3PV.cjs} +4 -4
- package/dist/{run-until-ZZ2JLPJM.cjs.map → run-until-L5KQD3PV.cjs.map} +1 -1
- package/dist/{run-CwEJtLPE.d.ts → run-vJHg2eGw.d.cts} +201 -174
- package/dist/{run-CwEJtLPE.d.cts → run-vJHg2eGw.d.ts} +201 -174
- package/dist/sandbox/bwrap.d.cts +20 -20
- package/dist/sandbox/bwrap.d.ts +20 -20
- package/dist/sandbox/index.cjs +39 -39
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +35 -35
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +26 -21
- package/dist/sandbox/linux-sandbox.d.ts +26 -21
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.d.cts +6 -6
- package/dist/server/auth/index.d.ts +6 -6
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/orchestrator.d.cts +2 -2
- package/dist/server/auth/orchestrator.d.ts +2 -2
- package/dist/server/auth/types.d.cts +4 -4
- package/dist/server/auth/types.d.ts +4 -4
- package/dist/server/errors-envelope.cjs +14 -14
- 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 -3
- package/dist/session-transcript-DFGX6WNL.cjs +50 -0
- package/dist/{session-transcript-EAKR4D2W.cjs.map → session-transcript-DFGX6WNL.cjs.map} +1 -1
- package/dist/session-transcript-MMPWCESR.js +5 -0
- package/dist/{session-transcript-6WKLYIN4.js.map → session-transcript-MMPWCESR.js.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-AFERZU63.js +7 -0
- package/dist/{stream-object-OFM66VUT.js.map → stream-object-AFERZU63.js.map} +1 -1
- package/dist/stream-object-YPXZ4F5P.cjs +20 -0
- package/dist/{stream-object-Y7YCX3BI.cjs.map → stream-object-YPXZ4F5P.cjs.map} +1 -1
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/subagents-loader.js +4 -4
- 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 +4 -4
- package/dist/types/goal-events.d.ts +24 -23
- package/dist/types/run.d.ts +27 -0
- package/dist/types/session-record.d.ts +14 -13
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.js +6 -6
- package/package.json +12 -13
- package/dist/agent-DW2J37IH.js +0 -42
- package/dist/agent-IE6IE4NW.cjs +0 -51
- package/dist/chunk-2ONFGMBV.js.map +0 -1
- package/dist/chunk-56OXYUZE.js.map +0 -1
- package/dist/chunk-56ZM6P7Z.cjs.map +0 -1
- package/dist/chunk-5SB4V74H.js.map +0 -1
- package/dist/chunk-77WHPVXE.js.map +0 -1
- package/dist/chunk-ALU3KC4G.cjs.map +0 -1
- package/dist/chunk-EEZ7CFMM.js.map +0 -1
- package/dist/chunk-GL7CFBVC.js.map +0 -1
- package/dist/chunk-H5YVJB4K.cjs.map +0 -1
- package/dist/chunk-ICYBIC6N.cjs.map +0 -1
- package/dist/chunk-IT3PWBW4.cjs.map +0 -1
- package/dist/chunk-ITLS5LRF.cjs +0 -105
- package/dist/chunk-ITLS5LRF.cjs.map +0 -1
- package/dist/chunk-LTCOPATU.cjs.map +0 -1
- package/dist/chunk-MXSMAGDU.js.map +0 -1
- package/dist/chunk-P34DHHYQ.cjs.map +0 -1
- package/dist/chunk-TAPQWDW2.js.map +0 -1
- package/dist/chunk-THEYGCYS.cjs.map +0 -1
- package/dist/chunk-VNNK6AKU.js.map +0 -1
- package/dist/chunk-VYJSHGAY.js.map +0 -1
- package/dist/chunk-W52DKZBR.cjs.map +0 -1
- package/dist/chunk-XAEAMI5H.js.map +0 -1
- package/dist/chunk-YPQF26X7.cjs.map +0 -1
- package/dist/chunk-YVTNFKZO.js +0 -103
- package/dist/chunk-YVTNFKZO.js.map +0 -1
- package/dist/compact-session-H5TKLD55.cjs +0 -54
- package/dist/compact-session-WNKKIIDW.js +0 -17
- package/dist/context-VAYLPT4O.js +0 -5
- package/dist/context-ZV33V4DC.cjs +0 -22
- package/dist/fs-session-store-6MY7PNI2.js +0 -10
- package/dist/fs-session-store-7E7UPLF2.cjs +0 -19
- package/dist/generate-object-5SCEH2EE.cjs +0 -20
- package/dist/generate-object-I7UD4NWN.js +0 -7
- package/dist/index-manager-KKAK7NT3.js +0 -10
- package/dist/index-manager-R6ZJFEZF.cjs +0 -19
- package/dist/judge-call-SP3G3X2Y.cjs +0 -22
- package/dist/judge-call-TAEIXMYG.js +0 -5
- package/dist/registry-N3GTKYCI.cjs +0 -46
- package/dist/registry-SOXE4RY6.js +0 -9
- package/dist/session-transcript-6WKLYIN4.js +0 -5
- package/dist/session-transcript-EAKR4D2W.cjs +0 -50
- package/dist/stream-object-OFM66VUT.js +0 -7
- package/dist/stream-object-Y7YCX3BI.cjs +0 -20
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkKL7E244K_cjs = require('./chunk-KL7E244K.cjs');
|
|
4
|
+
var chunkBURYFNOM_cjs = require('./chunk-BURYFNOM.cjs');
|
|
5
5
|
var chunk6JSIEDKL_cjs = require('./chunk-6JSIEDKL.cjs');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
6
|
+
var chunk6OKPJZMX_cjs = require('./chunk-6OKPJZMX.cjs');
|
|
7
|
+
var chunkIBDE4R5L_cjs = require('./chunk-IBDE4R5L.cjs');
|
|
8
|
+
var chunk4MWBKBS4_cjs = require('./chunk-4MWBKBS4.cjs');
|
|
9
|
+
var chunkA3MHE2MQ_cjs = require('./chunk-A3MHE2MQ.cjs');
|
|
10
|
+
var chunkBE3W4HYV_cjs = require('./chunk-BE3W4HYV.cjs');
|
|
11
11
|
var fs = require('fs');
|
|
12
12
|
var promises = require('fs/promises');
|
|
13
13
|
var os = require('os');
|
|
@@ -16,7 +16,7 @@ var url = require('url');
|
|
|
16
16
|
var module$1 = require('module');
|
|
17
17
|
|
|
18
18
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
19
|
-
var discoveryState =
|
|
19
|
+
var discoveryState = chunk4MWBKBS4_cjs.globalSingleton("theokit-sdk.providers.discovered", () => ({
|
|
20
20
|
done: false
|
|
21
21
|
}));
|
|
22
22
|
function pluginsRoot() {
|
|
@@ -38,19 +38,19 @@ function loadTrustedNames() {
|
|
|
38
38
|
else discarded += 1;
|
|
39
39
|
}
|
|
40
40
|
if (discarded > 0) {
|
|
41
|
-
|
|
41
|
+
chunkBE3W4HYV_cjs.diag(
|
|
42
42
|
`[theokit-sdk] WARN: ${path} contains ${discarded} non-string entr${discarded === 1 ? "y" : "ies"} \u2014 discarded (entries must be plugin-name strings)
|
|
43
43
|
`
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
} else {
|
|
47
|
-
|
|
47
|
+
chunkBE3W4HYV_cjs.diag(
|
|
48
48
|
`[theokit-sdk] WARN: ${path} is not a JSON array \u2014 trusting NO provider plugins (fail-closed)
|
|
49
49
|
`
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
} catch {
|
|
53
|
-
|
|
53
|
+
chunkBE3W4HYV_cjs.diag(
|
|
54
54
|
`[theokit-sdk] WARN: ${path} is not valid JSON \u2014 trusting NO provider plugins (fail-closed)
|
|
55
55
|
`
|
|
56
56
|
);
|
|
@@ -76,7 +76,7 @@ async function discoverProviderPlugins() {
|
|
|
76
76
|
const trusted = loadTrustedNames();
|
|
77
77
|
for (const entry of entries) {
|
|
78
78
|
if (!trusted.has(entry)) {
|
|
79
|
-
|
|
79
|
+
chunkBE3W4HYV_cjs.diag(
|
|
80
80
|
`[theokit-sdk] WARN: provider plugin "${entry}" is present but NOT trusted \u2014 skipped. To trust it, add "${entry}" to ${trustFilePath()} (JSON array of names) or THEOKIT_TRUSTED_PROVIDERS (comma-separated), then restart the process.
|
|
81
81
|
`
|
|
82
82
|
);
|
|
@@ -95,13 +95,13 @@ async function loadOne(dir, entryName) {
|
|
|
95
95
|
if (plugin !== null && typeof plugin === "object" && plugin.kind === "model-provider") {
|
|
96
96
|
const profile = plugin.profile;
|
|
97
97
|
if (profile !== void 0 && typeof profile === "object") {
|
|
98
|
-
|
|
98
|
+
chunk4MWBKBS4_cjs.registerProvider(profile);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
return;
|
|
102
102
|
} catch (err) {
|
|
103
103
|
const msg = err instanceof Error ? err.message : String(err);
|
|
104
|
-
|
|
104
|
+
chunkBE3W4HYV_cjs.diag(`[theokit-sdk] failed to load provider plugin "${entryName}": ${msg}
|
|
105
105
|
`);
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
@@ -124,7 +124,7 @@ function truncateRaw(body) {
|
|
|
124
124
|
if (body === null || body === void 0) return void 0;
|
|
125
125
|
const s = typeof body === "string" ? body : JSON.stringify(body);
|
|
126
126
|
const truncated = s.length <= RAW_MAX_BYTES ? s : `${s.slice(0, RAW_MAX_BYTES)}\u2026`;
|
|
127
|
-
return
|
|
127
|
+
return chunkBE3W4HYV_cjs.redactSecrets(truncated);
|
|
128
128
|
}
|
|
129
129
|
function buildErrorMetadata(args) {
|
|
130
130
|
const retryAfter = parseRetryAfter(args.headers);
|
|
@@ -153,24 +153,24 @@ function mapAnthropicError(args) {
|
|
|
153
153
|
body
|
|
154
154
|
});
|
|
155
155
|
if (status === 401 || status === 403) {
|
|
156
|
-
return new
|
|
156
|
+
return new chunkA3MHE2MQ_cjs.AuthenticationError(message, { code: "anthropic_auth_failed", metadata });
|
|
157
157
|
}
|
|
158
158
|
if (status === 429) {
|
|
159
|
-
return new
|
|
159
|
+
return new chunkA3MHE2MQ_cjs.RateLimitError(message, { code: "anthropic_rate_limit", metadata });
|
|
160
160
|
}
|
|
161
161
|
if (status === 400) {
|
|
162
|
-
return new
|
|
162
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(message, {
|
|
163
163
|
code: `anthropic_${code}`,
|
|
164
164
|
metadata
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
if (status === 408) {
|
|
168
|
-
return new
|
|
168
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(message, { code: "anthropic_timeout", metadata });
|
|
169
169
|
}
|
|
170
170
|
if (status >= 500 && status < 600) {
|
|
171
|
-
return new
|
|
171
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(message, { code: "anthropic_server_error", metadata });
|
|
172
172
|
}
|
|
173
|
-
return new
|
|
173
|
+
return new chunkA3MHE2MQ_cjs.UnknownAgentError(message, { code: "anthropic_unknown", metadata });
|
|
174
174
|
}
|
|
175
175
|
function mapAnthropicStatusToCode(status, body) {
|
|
176
176
|
if (status === 401 || status === 403) return "auth_failed";
|
|
@@ -240,7 +240,7 @@ function toBlockToolResultContent(content) {
|
|
|
240
240
|
function toStringToolResultContent(content, providerName) {
|
|
241
241
|
if (typeof content === "string") return content;
|
|
242
242
|
if (content.some((block) => block.type === "image")) {
|
|
243
|
-
throw new
|
|
243
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
244
244
|
`provider "${providerName}" does not support image content in tool results`
|
|
245
245
|
);
|
|
246
246
|
}
|
|
@@ -406,7 +406,7 @@ function readWithIdleTimeout(reader, idleTimeoutMs) {
|
|
|
406
406
|
(resolve, reject) => {
|
|
407
407
|
const timer = setTimeout(() => {
|
|
408
408
|
reject(
|
|
409
|
-
new
|
|
409
|
+
new chunkA3MHE2MQ_cjs.NetworkError(`SSE stream idle for ${idleTimeoutMs}ms \u2014 upstream stalled`, {
|
|
410
410
|
code: "stream_idle_timeout"
|
|
411
411
|
})
|
|
412
412
|
);
|
|
@@ -483,9 +483,9 @@ function ehAbort(err) {
|
|
|
483
483
|
}
|
|
484
484
|
function wrapTransportError(err, ctx) {
|
|
485
485
|
if (ehAbort(err)) return err;
|
|
486
|
-
if (err instanceof
|
|
486
|
+
if (err instanceof chunkA3MHE2MQ_cjs.NetworkError) return err;
|
|
487
487
|
const detalhe = err instanceof Error ? err.message : String(err);
|
|
488
|
-
return new
|
|
488
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(`${ctx.providerId} transport failure on ${ctx.endpoint}: ${detalhe}`, {
|
|
489
489
|
code: "transport_failure",
|
|
490
490
|
cause: err
|
|
491
491
|
});
|
|
@@ -549,7 +549,7 @@ var AnthropicClient = class {
|
|
|
549
549
|
for (const event of events) yield event;
|
|
550
550
|
}
|
|
551
551
|
if (!accumulator.finishReasonSeen) {
|
|
552
|
-
throw new
|
|
552
|
+
throw new chunkA3MHE2MQ_cjs.NetworkError("Anthropic SSE stream truncated (no stop_reason)", {
|
|
553
553
|
code: "stream_truncated"
|
|
554
554
|
});
|
|
555
555
|
}
|
|
@@ -690,19 +690,19 @@ function mapBedrockError(args) {
|
|
|
690
690
|
const metadata = buildBedrockMetadata(args, code);
|
|
691
691
|
switch (code) {
|
|
692
692
|
case "rate_limit":
|
|
693
|
-
return new
|
|
693
|
+
return new chunkA3MHE2MQ_cjs.RateLimitError(`Bedrock throttled: ${message}`, { metadata });
|
|
694
694
|
case "auth_failed":
|
|
695
|
-
return new
|
|
695
|
+
return new chunkA3MHE2MQ_cjs.AuthenticationError(`Bedrock auth: ${message}`, { metadata });
|
|
696
696
|
case "invalid_request": {
|
|
697
697
|
const friendly = message.includes("use case details") ? `Bedrock account setup required: ${message} (AWS Console \u2192 Bedrock \u2192 Model access \u2192 Anthropic \u2192 Submit use case form, then retry in 15 min.)` : `Bedrock validation: ${message}`;
|
|
698
|
-
return new
|
|
698
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(friendly, { metadata });
|
|
699
699
|
}
|
|
700
700
|
case "timeout":
|
|
701
|
-
return new
|
|
701
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(`Bedrock timeout: ${message}`, { metadata });
|
|
702
702
|
case "server_error":
|
|
703
|
-
return new
|
|
703
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(`Bedrock server error: ${message}`, { metadata });
|
|
704
704
|
default:
|
|
705
|
-
return new
|
|
705
|
+
return new chunkA3MHE2MQ_cjs.UnknownAgentError(`Bedrock unknown: ${message}`, { metadata });
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
function parseBody(body) {
|
|
@@ -726,7 +726,7 @@ async function resolveBedrockToken(region) {
|
|
|
726
726
|
return cachedToken.value;
|
|
727
727
|
}
|
|
728
728
|
try {
|
|
729
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
729
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-G7X2Y7Y2.cjs', document.baseURI).href)));
|
|
730
730
|
const gen = r("@aws/bedrock-token-generator");
|
|
731
731
|
if (typeof gen.getToken !== "function") return void 0;
|
|
732
732
|
const providers = r("@aws-sdk/credential-providers");
|
|
@@ -754,16 +754,16 @@ var BedrockAnthropicClient = class {
|
|
|
754
754
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
755
755
|
const fromEnv = await resolveBedrockToken(region);
|
|
756
756
|
if (fromEnv !== void 0 && fromEnv.length > 0) return fromEnv;
|
|
757
|
-
throw new
|
|
757
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
758
758
|
"Bedrock requires AWS_BEARER_TOKEN_BEDROCK env var, or install `@aws/bedrock-token-generator` for auto-refresh, or pass apiKey explicitly.",
|
|
759
759
|
{ code: "auth_failed" }
|
|
760
760
|
);
|
|
761
761
|
}
|
|
762
762
|
async *stream(request, signal) {
|
|
763
|
-
const region =
|
|
763
|
+
const region = chunk4MWBKBS4_cjs.inferRegionFromModelId(request.model) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
764
764
|
const token = await this.resolveTokenOrThrow(region);
|
|
765
|
-
const bareModel =
|
|
766
|
-
const baseUrl = this.options.baseUrl ??
|
|
765
|
+
const bareModel = chunk4MWBKBS4_cjs.stripBedrockPrefix(request.model);
|
|
766
|
+
const baseUrl = this.options.baseUrl ?? chunk4MWBKBS4_cjs.resolveBedrockBaseUrl(request.model);
|
|
767
767
|
const endpoint = `/model/${encodeURIComponent(bareModel)}/invoke`;
|
|
768
768
|
const url = `${baseUrl}${endpoint}`;
|
|
769
769
|
const response = await postAnthropicRequest({
|
|
@@ -803,21 +803,21 @@ function mapOpenAICompatibleError(args) {
|
|
|
803
803
|
body
|
|
804
804
|
});
|
|
805
805
|
if (status === 401 || status === 403) {
|
|
806
|
-
return new
|
|
806
|
+
return new chunkA3MHE2MQ_cjs.AuthenticationError(message, { code: `${providerId}_auth_failed`, metadata });
|
|
807
807
|
}
|
|
808
808
|
if (status === 429) {
|
|
809
|
-
return new
|
|
809
|
+
return new chunkA3MHE2MQ_cjs.RateLimitError(message, { code: `${providerId}_rate_limit`, metadata });
|
|
810
810
|
}
|
|
811
811
|
if (status === 400) {
|
|
812
|
-
return new
|
|
812
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(message, { code: `${providerId}_${code}`, metadata });
|
|
813
813
|
}
|
|
814
814
|
if (status === 408) {
|
|
815
|
-
return new
|
|
815
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(message, { code: `${providerId}_timeout`, metadata });
|
|
816
816
|
}
|
|
817
817
|
if (status >= 500 && status < 600) {
|
|
818
|
-
return new
|
|
818
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(message, { code: `${providerId}_server_error`, metadata });
|
|
819
819
|
}
|
|
820
|
-
return new
|
|
820
|
+
return new chunkA3MHE2MQ_cjs.UnknownAgentError(message, { code: `${providerId}_unknown`, metadata });
|
|
821
821
|
}
|
|
822
822
|
function extractOpenAiErrorCode(body) {
|
|
823
823
|
if (body === null || typeof body !== "object") return void 0;
|
|
@@ -929,7 +929,7 @@ function parseOverrideOrWarnOnce() {
|
|
|
929
929
|
function warnInvalidJsonOnce(_raw) {
|
|
930
930
|
if (warnedInvalidJson) return;
|
|
931
931
|
warnedInvalidJson = true;
|
|
932
|
-
|
|
932
|
+
chunkBE3W4HYV_cjs.diag(
|
|
933
933
|
`[theokit-sdk] ${ENV_OVERRIDE_KEY} is set but value is not valid JSON of shape \`{"status": number, "body": object | string}\`. Falling back to real LLM call. This warning is shown once per process.
|
|
934
934
|
`
|
|
935
935
|
);
|
|
@@ -965,7 +965,7 @@ function mapOllamaTransportError(args) {
|
|
|
965
965
|
headers: void 0,
|
|
966
966
|
body: { cause: causeCode }
|
|
967
967
|
});
|
|
968
|
-
return new
|
|
968
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
969
969
|
"Ollama is not reachable. Run `ollama serve` to start the local runtime, or set OLLAMA_HOST to point at a remote Ollama server.",
|
|
970
970
|
{ code: "ollama_unreachable", metadata }
|
|
971
971
|
);
|
|
@@ -984,7 +984,7 @@ function mapOllamaHttpError(args) {
|
|
|
984
984
|
body: args.body
|
|
985
985
|
});
|
|
986
986
|
const pullCmd = modelHint !== void 0 ? `ollama pull ${modelHint}` : "ollama pull <model>";
|
|
987
|
-
return new
|
|
987
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
988
988
|
`Ollama model is not pulled. Run \`${pullCmd}\` to download it first.`,
|
|
989
989
|
{ code: "ollama_model_not_pulled", metadata }
|
|
990
990
|
);
|
|
@@ -998,7 +998,7 @@ function mapOllamaHttpError(args) {
|
|
|
998
998
|
headers: args.headers,
|
|
999
999
|
body: args.body
|
|
1000
1000
|
});
|
|
1001
|
-
return new
|
|
1001
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(
|
|
1002
1002
|
"Ollama model is loading. Retry in a few seconds \u2014 Ollama is warming up the model into memory.",
|
|
1003
1003
|
{ code: "ollama_model_loading", metadata }
|
|
1004
1004
|
);
|
|
@@ -1219,7 +1219,7 @@ function toOllamaMessages(message) {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
if (message.role === "user") {
|
|
1221
1221
|
if (message.content.some((p) => p.type === "image")) {
|
|
1222
|
-
throw new
|
|
1222
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
1223
1223
|
"image input is not supported on the ollama-native provider; use an OpenAI/OpenRouter model for multimodal turns",
|
|
1224
1224
|
{ code: "ollama_image_unsupported" }
|
|
1225
1225
|
);
|
|
@@ -1348,7 +1348,7 @@ async function safeFetch(fetchFn, url, init) {
|
|
|
1348
1348
|
try {
|
|
1349
1349
|
return await fetchFn(url, init);
|
|
1350
1350
|
} catch (cause) {
|
|
1351
|
-
throw new
|
|
1351
|
+
throw new chunkA3MHE2MQ_cjs.NetworkError("HTTP request failed", { code: "network_error", cause });
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
1354
|
async function safeParseJsonResponse(response) {
|
|
@@ -1375,7 +1375,7 @@ function mapHttpStatusToError(status, body) {
|
|
|
1375
1375
|
cause: body
|
|
1376
1376
|
};
|
|
1377
1377
|
if (envelope.code === "integration_not_connected") {
|
|
1378
|
-
return new
|
|
1378
|
+
return new chunkA3MHE2MQ_cjs.IntegrationNotConnectedError(message, {
|
|
1379
1379
|
provider: envelope.provider ?? "unknown",
|
|
1380
1380
|
helpUrl: envelope.helpUrl ?? "",
|
|
1381
1381
|
code: envelope.code,
|
|
@@ -1383,18 +1383,18 @@ function mapHttpStatusToError(status, body) {
|
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
1385
|
if (status === 401 || status === 403) {
|
|
1386
|
-
return new
|
|
1386
|
+
return new chunkA3MHE2MQ_cjs.AuthenticationError(message, errorOptions);
|
|
1387
1387
|
}
|
|
1388
1388
|
if (status === 429) {
|
|
1389
|
-
return new
|
|
1389
|
+
return new chunkA3MHE2MQ_cjs.RateLimitError(message, errorOptions);
|
|
1390
1390
|
}
|
|
1391
1391
|
if (status >= 400 && status < 500) {
|
|
1392
|
-
return new
|
|
1392
|
+
return new chunkA3MHE2MQ_cjs.ConfigurationError(message, errorOptions);
|
|
1393
1393
|
}
|
|
1394
1394
|
if (status >= 500) {
|
|
1395
|
-
return new
|
|
1395
|
+
return new chunkA3MHE2MQ_cjs.NetworkError(message, errorOptions);
|
|
1396
1396
|
}
|
|
1397
|
-
return new
|
|
1397
|
+
return new chunkA3MHE2MQ_cjs.UnknownAgentError(message, errorOptions);
|
|
1398
1398
|
}
|
|
1399
1399
|
function extractErrorEnvelope(body) {
|
|
1400
1400
|
if (!body || typeof body !== "object") return {};
|
|
@@ -1689,7 +1689,7 @@ var OpenAIClient = class {
|
|
|
1689
1689
|
for (const event of events) yield event;
|
|
1690
1690
|
}
|
|
1691
1691
|
if (!sawDone && !accumulator.finishReasonSeen) {
|
|
1692
|
-
throw new
|
|
1692
|
+
throw new chunkA3MHE2MQ_cjs.NetworkError("SSE stream truncated (no finish_reason / [DONE])", {
|
|
1693
1693
|
code: "stream_truncated"
|
|
1694
1694
|
});
|
|
1695
1695
|
}
|
|
@@ -1821,13 +1821,13 @@ var OpenAIStreamAccumulator = class {
|
|
|
1821
1821
|
toolCalls.push(...recovered.toolCalls);
|
|
1822
1822
|
text = recovered.residualText;
|
|
1823
1823
|
stopReason = "tool_use";
|
|
1824
|
-
|
|
1824
|
+
chunkBE3W4HYV_cjs.diag(
|
|
1825
1825
|
`[theokit-sdk] recovered ${recovered.toolCalls.length} leaked tool call(s) from assistant content (provider="${this.providerName}", names=${recovered.toolCalls.map((c) => c.name).join(",")})
|
|
1826
1826
|
`
|
|
1827
1827
|
);
|
|
1828
1828
|
}
|
|
1829
1829
|
if (recovered.droppedNames.length > 0) {
|
|
1830
|
-
|
|
1830
|
+
chunkBE3W4HYV_cjs.diag(
|
|
1831
1831
|
`[theokit-sdk] dropped ${recovered.droppedNames.length} leaked block(s) whose name is not a tool in the request (provider="${this.providerName}", names=${recovered.droppedNames.join(",")})
|
|
1832
1832
|
`
|
|
1833
1833
|
);
|
|
@@ -1949,10 +1949,10 @@ async function tryFirstEvent(client, request, signal, logFallback = false) {
|
|
|
1949
1949
|
const firstResult = await generator.next();
|
|
1950
1950
|
return { kind: "ok", generator, firstResult };
|
|
1951
1951
|
} catch (cause) {
|
|
1952
|
-
if (cause instanceof
|
|
1952
|
+
if (cause instanceof chunkA3MHE2MQ_cjs.NetworkError || cause instanceof chunkA3MHE2MQ_cjs.RateLimitError || cause instanceof chunkA3MHE2MQ_cjs.AuthenticationError) {
|
|
1953
1953
|
if (logFallback) {
|
|
1954
1954
|
const errCode = cause.metadata?.code ?? cause.code ?? "unknown";
|
|
1955
|
-
|
|
1955
|
+
chunkBE3W4HYV_cjs.diag(`[theokit-sdk] provider ${client.name} failed (${errCode}): falling back
|
|
1956
1956
|
`);
|
|
1957
1957
|
}
|
|
1958
1958
|
return { kind: "handshake_error", error: cause };
|
|
@@ -1994,7 +1994,7 @@ var PoolAwareLlmClient = class {
|
|
|
1994
1994
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: stream() must serialize pool-select → build client → first-event probe → classify → retry/rotate/propagate. Extracting helpers fragments the linear narrative; the comments above each branch keep it readable.
|
|
1995
1995
|
async *stream(request, signal) {
|
|
1996
1996
|
if (this.breaker.shouldSkip(this.pool.provider)) {
|
|
1997
|
-
throw new
|
|
1997
|
+
throw new chunkA3MHE2MQ_cjs.NetworkError(`${this.pool.provider} circuit open \u2014 failing fast`, {
|
|
1998
1998
|
code: "circuit_open"
|
|
1999
1999
|
});
|
|
2000
2000
|
}
|
|
@@ -2013,7 +2013,7 @@ var PoolAwareLlmClient = class {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
if (entry === null) {
|
|
2015
2015
|
this.breaker.recordTimeout(this.pool.provider);
|
|
2016
|
-
throw new
|
|
2016
|
+
throw new chunkA3MHE2MQ_cjs.CredentialPoolExhaustedError(
|
|
2017
2017
|
`All ${this.pool.provider} credentials exhausted; next retry available at ${this.nextRetryHint() ?? "unknown"}`,
|
|
2018
2018
|
{ provider: this.pool.provider, nextRetryAt: this.nextRetryHint() }
|
|
2019
2019
|
);
|
|
@@ -2027,13 +2027,13 @@ var PoolAwareLlmClient = class {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
const decision = classifyAndDecide(attempt.error, hasRetried429);
|
|
2029
2029
|
if (decision === "retry") {
|
|
2030
|
-
const backoffMs =
|
|
2030
|
+
const backoffMs = chunkKL7E244K_cjs.computeBackoffMs({
|
|
2031
2031
|
attempt: 0,
|
|
2032
2032
|
...this.backoffBaseMs !== void 0 ? { baseMs: this.backoffBaseMs } : {},
|
|
2033
2033
|
...this.rng !== void 0 ? { rng: this.rng } : {}
|
|
2034
2034
|
});
|
|
2035
2035
|
this.onRateLimit?.({ attempt: 1, retryAfterMs: backoffMs });
|
|
2036
|
-
await
|
|
2036
|
+
await chunkKL7E244K_cjs.sleepWithAbort(backoffMs, signal);
|
|
2037
2037
|
hasRetried429 = true;
|
|
2038
2038
|
continue;
|
|
2039
2039
|
}
|
|
@@ -2045,7 +2045,7 @@ var PoolAwareLlmClient = class {
|
|
|
2045
2045
|
...parseRetryAfterMs(attempt.error) !== void 0 ? { resetAtMs: parseRetryAfterMs(attempt.error) } : {}
|
|
2046
2046
|
});
|
|
2047
2047
|
} catch (persistErr) {
|
|
2048
|
-
|
|
2048
|
+
chunkBE3W4HYV_cjs.diag(
|
|
2049
2049
|
`[theokit-sdk] credential-pool: persist failed during rotate; continuing in-memory: ${persistErr instanceof Error ? persistErr.message : String(persistErr)}
|
|
2050
2050
|
`
|
|
2051
2051
|
);
|
|
@@ -2067,8 +2067,8 @@ var PoolAwareLlmClient = class {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
};
|
|
2069
2069
|
function classifyAndDecide(error, hasRetried429) {
|
|
2070
|
-
if (error instanceof
|
|
2071
|
-
if (error instanceof
|
|
2070
|
+
if (error instanceof chunkA3MHE2MQ_cjs.NetworkError) return "propagate";
|
|
2071
|
+
if (error instanceof chunkA3MHE2MQ_cjs.AuthenticationError) return "rotate";
|
|
2072
2072
|
const status = error.metadata?.statusCode ?? 429;
|
|
2073
2073
|
if (status === 402) return "rotate";
|
|
2074
2074
|
return hasRetried429 ? "rotate" : "retry";
|
|
@@ -2081,8 +2081,8 @@ function parseRetryAfterMs(error) {
|
|
|
2081
2081
|
return void 0;
|
|
2082
2082
|
}
|
|
2083
2083
|
function inferStatusCode(error) {
|
|
2084
|
-
if (error instanceof
|
|
2085
|
-
if (error instanceof
|
|
2084
|
+
if (error instanceof chunkA3MHE2MQ_cjs.AuthenticationError) return 401;
|
|
2085
|
+
if (error instanceof chunkA3MHE2MQ_cjs.RateLimitError) return 429;
|
|
2086
2086
|
return 0;
|
|
2087
2087
|
}
|
|
2088
2088
|
function abortError(signal) {
|
|
@@ -2292,32 +2292,32 @@ function abortError2(signal) {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
|
|
2294
2294
|
// src/internal/llm/retrying-client.ts
|
|
2295
|
-
var
|
|
2296
|
-
function
|
|
2297
|
-
if (!
|
|
2298
|
-
if (err instanceof
|
|
2299
|
-
if (err instanceof
|
|
2300
|
-
if (err instanceof
|
|
2295
|
+
var MAX_ATTEMPTS = 3;
|
|
2296
|
+
function isRetriableError(err) {
|
|
2297
|
+
if (!chunkA3MHE2MQ_cjs.isTransientError(err)) return false;
|
|
2298
|
+
if (err instanceof chunkA3MHE2MQ_cjs.CredentialPoolExhaustedError) return false;
|
|
2299
|
+
if (err instanceof chunkA3MHE2MQ_cjs.TheokitAgentError && err.code === "circuit_open") return false;
|
|
2300
|
+
if (err instanceof chunkA3MHE2MQ_cjs.RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2301
2301
|
return true;
|
|
2302
2302
|
}
|
|
2303
|
-
function
|
|
2304
|
-
if (!(err instanceof
|
|
2305
|
-
const
|
|
2306
|
-
return typeof
|
|
2303
|
+
function retryAfterHintMs(err) {
|
|
2304
|
+
if (!(err instanceof chunkA3MHE2MQ_cjs.RateLimitError)) return void 0;
|
|
2305
|
+
const seconds = err.metadata?.retryAfter;
|
|
2306
|
+
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2307
2307
|
}
|
|
2308
|
-
async function*
|
|
2309
|
-
let
|
|
2310
|
-
while (
|
|
2311
|
-
|
|
2312
|
-
yield
|
|
2313
|
-
|
|
2308
|
+
async function* consume(gen, state) {
|
|
2309
|
+
let step = await gen.next();
|
|
2310
|
+
while (step.done !== true) {
|
|
2311
|
+
state.emitted = true;
|
|
2312
|
+
yield step.value;
|
|
2313
|
+
step = await gen.next();
|
|
2314
2314
|
}
|
|
2315
|
-
return
|
|
2315
|
+
return step.value;
|
|
2316
2316
|
}
|
|
2317
|
-
function
|
|
2318
|
-
if (
|
|
2319
|
-
if (
|
|
2320
|
-
return
|
|
2317
|
+
function canRetry(err, emitted, attempt) {
|
|
2318
|
+
if (emitted) return false;
|
|
2319
|
+
if (attempt === MAX_ATTEMPTS - 1) return false;
|
|
2320
|
+
return isRetriableError(err);
|
|
2321
2321
|
}
|
|
2322
2322
|
var RetryingLlmClient = class {
|
|
2323
2323
|
#inner;
|
|
@@ -2327,10 +2327,10 @@ var RetryingLlmClient = class {
|
|
|
2327
2327
|
this.#rng = opts?.rng;
|
|
2328
2328
|
}
|
|
2329
2329
|
/**
|
|
2330
|
-
*
|
|
2331
|
-
*
|
|
2332
|
-
* decorators.
|
|
2333
|
-
*
|
|
2330
|
+
* The decorated client. Public by the same convention as `FaultInjectingLlmClient.inner`: the
|
|
2331
|
+
* router's wiring tests assert `instanceof PoolAwareLlmClient` and need to see through the
|
|
2332
|
+
* decorators. Without this, adding a decorator breaks tests whose intent is still valid — which is
|
|
2333
|
+
* exactly what M93 did to 4 pre-existing tests.
|
|
2334
2334
|
*/
|
|
2335
2335
|
get inner() {
|
|
2336
2336
|
return this.#inner;
|
|
@@ -2339,35 +2339,35 @@ var RetryingLlmClient = class {
|
|
|
2339
2339
|
return this.#inner.name;
|
|
2340
2340
|
}
|
|
2341
2341
|
/**
|
|
2342
|
-
*
|
|
2342
|
+
* Waits out attempt `n`'s backoff, honoring the provider's `Retry-After` when one arrived.
|
|
2343
2343
|
*
|
|
2344
|
-
*
|
|
2345
|
-
*
|
|
2346
|
-
* `stream`
|
|
2344
|
+
* Its own method because `stream` is a generator with a nested loop, and inlining the conditional
|
|
2345
|
+
* option assembly here pushed cognitive complexity to 19 (project ceiling: 10). The body of
|
|
2346
|
+
* `stream` stays nothing but the attempt machine.
|
|
2347
2347
|
*/
|
|
2348
|
-
async #
|
|
2349
|
-
const
|
|
2350
|
-
const ms =
|
|
2351
|
-
attempt
|
|
2352
|
-
...
|
|
2348
|
+
async #waitBackoff(err, attempt, signal) {
|
|
2349
|
+
const hint = retryAfterHintMs(err);
|
|
2350
|
+
const ms = chunkKL7E244K_cjs.computeBackoffMs({
|
|
2351
|
+
attempt,
|
|
2352
|
+
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2353
2353
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2354
2354
|
});
|
|
2355
|
-
await
|
|
2355
|
+
await chunkKL7E244K_cjs.sleepWithAbort(ms, signal);
|
|
2356
2356
|
}
|
|
2357
2357
|
async *stream(request, signal) {
|
|
2358
|
-
let
|
|
2359
|
-
for (let
|
|
2360
|
-
if (signal.aborted) throw
|
|
2361
|
-
const
|
|
2358
|
+
let lastError;
|
|
2359
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
2360
|
+
if (signal.aborted) throw lastError ?? abortError2(signal);
|
|
2361
|
+
const state = { emitted: false };
|
|
2362
2362
|
try {
|
|
2363
|
-
return yield*
|
|
2363
|
+
return yield* consume(this.#inner.stream(request, signal), state);
|
|
2364
2364
|
} catch (err) {
|
|
2365
|
-
|
|
2366
|
-
if (!
|
|
2367
|
-
await this.#
|
|
2365
|
+
lastError = err;
|
|
2366
|
+
if (!canRetry(err, state.emitted, attempt)) throw err;
|
|
2367
|
+
await this.#waitBackoff(err, attempt, signal);
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
|
-
throw
|
|
2370
|
+
throw lastError ?? new Error("retries exhausted with no recorded error");
|
|
2371
2371
|
}
|
|
2372
2372
|
};
|
|
2373
2373
|
|
|
@@ -2400,23 +2400,23 @@ function vertexMetadata(args, code) {
|
|
|
2400
2400
|
});
|
|
2401
2401
|
}
|
|
2402
2402
|
var VERTEX_ERROR_BUILDERS = {
|
|
2403
|
-
rate_limit: (args, msg) => new
|
|
2403
|
+
rate_limit: (args, msg) => new chunkA3MHE2MQ_cjs.RateLimitError(`Vertex quota exhausted: ${msg}`, {
|
|
2404
2404
|
metadata: vertexMetadata(args, "rate_limit")
|
|
2405
2405
|
}),
|
|
2406
|
-
auth_unauthenticated: (args, msg) => new
|
|
2406
|
+
auth_unauthenticated: (args, msg) => new chunkA3MHE2MQ_cjs.AuthenticationError(`Vertex unauthenticated: ${msg}`, {
|
|
2407
2407
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2408
2408
|
}),
|
|
2409
|
-
auth_permission: (args, msg) => new
|
|
2409
|
+
auth_permission: (args, msg) => new chunkA3MHE2MQ_cjs.AuthenticationError(`Vertex permission denied: ${msg}`, {
|
|
2410
2410
|
metadata: vertexMetadata(args, "auth_failed")
|
|
2411
2411
|
}),
|
|
2412
|
-
invalid_request: (args, msg) => new
|
|
2412
|
+
invalid_request: (args, msg) => new chunkA3MHE2MQ_cjs.ConfigurationError(`Vertex validation: ${msg}`, {
|
|
2413
2413
|
metadata: vertexMetadata(args, "invalid_request")
|
|
2414
2414
|
}),
|
|
2415
|
-
timeout: (args, msg) => new
|
|
2416
|
-
server_error: (args, msg) => new
|
|
2415
|
+
timeout: (args, msg) => new chunkA3MHE2MQ_cjs.NetworkError(`Vertex timeout: ${msg}`, { metadata: vertexMetadata(args, "timeout") }),
|
|
2416
|
+
server_error: (args, msg) => new chunkA3MHE2MQ_cjs.NetworkError(`Vertex server error: ${msg}`, {
|
|
2417
2417
|
metadata: vertexMetadata(args, "server_error")
|
|
2418
2418
|
}),
|
|
2419
|
-
unknown: (args, msg) => new
|
|
2419
|
+
unknown: (args, msg) => new chunkA3MHE2MQ_cjs.UnknownAgentError(`Vertex unknown: ${msg}`, { metadata: vertexMetadata(args, "unknown") })
|
|
2420
2420
|
};
|
|
2421
2421
|
function mapVertexError(args) {
|
|
2422
2422
|
const parsed = parseBody2(args.body);
|
|
@@ -2452,12 +2452,12 @@ async function resolveVertexAccessToken() {
|
|
|
2452
2452
|
async function getAuthClientOrThrow() {
|
|
2453
2453
|
let mod;
|
|
2454
2454
|
try {
|
|
2455
|
-
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
2455
|
+
const r = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-G7X2Y7Y2.cjs', document.baseURI).href)));
|
|
2456
2456
|
mod = r("google-auth-library");
|
|
2457
2457
|
} catch (err) {
|
|
2458
2458
|
const isModuleMissing = err instanceof Error && (err.message.includes("Cannot find module") || err.code === "MODULE_NOT_FOUND");
|
|
2459
2459
|
if (isModuleMissing) {
|
|
2460
|
-
throw new
|
|
2460
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2461
2461
|
"Vertex provider requires `google-auth-library`. Install: `pnpm add google-auth-library`.",
|
|
2462
2462
|
{ code: "auth_failed", cause: err }
|
|
2463
2463
|
);
|
|
@@ -2468,7 +2468,7 @@ async function getAuthClientOrThrow() {
|
|
|
2468
2468
|
const auth = new mod.GoogleAuth({ scopes: [SCOPE_CLOUD_PLATFORM] });
|
|
2469
2469
|
return await auth.getClient();
|
|
2470
2470
|
} catch (err) {
|
|
2471
|
-
|
|
2471
|
+
chunkBE3W4HYV_cjs.diag(
|
|
2472
2472
|
`[theokit-sdk] Vertex ADC initialization failed: ${err instanceof Error ? err.message : String(err)}
|
|
2473
2473
|
`
|
|
2474
2474
|
);
|
|
@@ -2494,7 +2494,7 @@ var VertexAnthropicClient = class {
|
|
|
2494
2494
|
resolveProjectOrThrow() {
|
|
2495
2495
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2496
2496
|
if (projectId !== void 0) return projectId;
|
|
2497
|
-
throw new
|
|
2497
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2498
2498
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2499
2499
|
{ code: "auth_failed" }
|
|
2500
2500
|
);
|
|
@@ -2504,7 +2504,7 @@ var VertexAnthropicClient = class {
|
|
|
2504
2504
|
if (fromOpts !== void 0 && fromOpts.length > 0) return fromOpts;
|
|
2505
2505
|
const fromAdc = await resolveVertexAccessToken();
|
|
2506
2506
|
if (fromAdc !== void 0 && fromAdc.length > 0) return fromAdc;
|
|
2507
|
-
throw new
|
|
2507
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2508
2508
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2509
2509
|
{ code: "auth_failed" }
|
|
2510
2510
|
);
|
|
@@ -2513,8 +2513,8 @@ var VertexAnthropicClient = class {
|
|
|
2513
2513
|
const projectId = this.resolveProjectOrThrow();
|
|
2514
2514
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2515
2515
|
const accessToken = await this.resolveTokenOrThrow();
|
|
2516
|
-
const baseUrl =
|
|
2517
|
-
const bareModel =
|
|
2516
|
+
const baseUrl = chunk4MWBKBS4_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "anthropic" });
|
|
2517
|
+
const bareModel = chunk4MWBKBS4_cjs.stripVertexPrefix(request.model);
|
|
2518
2518
|
const endpoint = `/models/${encodeURIComponent(bareModel)}:rawPredict`;
|
|
2519
2519
|
const url = `${baseUrl}${endpoint}`;
|
|
2520
2520
|
const response = await postAnthropicRequest({
|
|
@@ -2550,7 +2550,7 @@ var VertexGeminiClient = class {
|
|
|
2550
2550
|
async *stream(request, signal) {
|
|
2551
2551
|
const projectId = this.options.projectId ?? resolveVertexProjectId();
|
|
2552
2552
|
if (projectId === void 0) {
|
|
2553
|
-
throw new
|
|
2553
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2554
2554
|
"Vertex requires a project id. Set GOOGLE_CLOUD_PROJECT env var or run `gcloud config set project <id>`.",
|
|
2555
2555
|
{ code: "auth_failed" }
|
|
2556
2556
|
);
|
|
@@ -2558,12 +2558,12 @@ var VertexGeminiClient = class {
|
|
|
2558
2558
|
const location = this.options.location ?? resolveVertexLocation();
|
|
2559
2559
|
const accessToken = this.options.apiKey !== void 0 && this.options.apiKey.length > 0 ? this.options.apiKey : await resolveVertexAccessToken();
|
|
2560
2560
|
if (accessToken === void 0 || accessToken.length === 0) {
|
|
2561
|
-
throw new
|
|
2561
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2562
2562
|
"Vertex could not resolve an access token. Run `gcloud auth application-default login` or set GOOGLE_APPLICATION_CREDENTIALS to a service-account JSON path.",
|
|
2563
2563
|
{ code: "auth_failed" }
|
|
2564
2564
|
);
|
|
2565
2565
|
}
|
|
2566
|
-
const baseUrl =
|
|
2566
|
+
const baseUrl = chunk4MWBKBS4_cjs.resolveVertexBaseUrl({ projectId, location, modelDialect: "gemini" });
|
|
2567
2567
|
const url = `${baseUrl}/chat/completions`;
|
|
2568
2568
|
const innerFetch = this.options.fetch ?? fetch;
|
|
2569
2569
|
const rewriteFetch = (input, init) => {
|
|
@@ -2589,7 +2589,7 @@ var VertexRouterClient = class {
|
|
|
2589
2589
|
options;
|
|
2590
2590
|
name = "vertex";
|
|
2591
2591
|
async *stream(request, signal) {
|
|
2592
|
-
const dialect =
|
|
2592
|
+
const dialect = chunk4MWBKBS4_cjs.inferModelDialect(request.model);
|
|
2593
2593
|
if (dialect === "anthropic") {
|
|
2594
2594
|
const inner2 = new VertexAnthropicClient(this.options);
|
|
2595
2595
|
return yield* inner2.stream(request, signal);
|
|
@@ -2601,7 +2601,7 @@ var VertexRouterClient = class {
|
|
|
2601
2601
|
|
|
2602
2602
|
// src/internal/llm/router.ts
|
|
2603
2603
|
function resolveProviderChain(options) {
|
|
2604
|
-
|
|
2604
|
+
chunk4MWBKBS4_cjs.registerBuiltins();
|
|
2605
2605
|
return buildChain(options);
|
|
2606
2606
|
}
|
|
2607
2607
|
function buildChain(options) {
|
|
@@ -2618,7 +2618,7 @@ function buildChain(options) {
|
|
|
2618
2618
|
addClient(options.primary);
|
|
2619
2619
|
for (const fallback of options.fallback ?? []) addClient(fallback);
|
|
2620
2620
|
if (clients.length === 0) {
|
|
2621
|
-
throw new
|
|
2621
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2622
2622
|
`No provider client could be resolved (primary=${options.primary}). Set ANTHROPIC_API_KEY or OPENAI_API_KEY / OPENROUTER_API_KEY.`,
|
|
2623
2623
|
{ code: "provider_unresolved" }
|
|
2624
2624
|
);
|
|
@@ -2626,11 +2626,11 @@ function buildChain(options) {
|
|
|
2626
2626
|
return clients;
|
|
2627
2627
|
}
|
|
2628
2628
|
function buildClient(name, routerOptions) {
|
|
2629
|
-
const baseProfile =
|
|
2629
|
+
const baseProfile = chunk4MWBKBS4_cjs.getProviderProfile(name);
|
|
2630
2630
|
if (baseProfile === void 0) return void 0;
|
|
2631
2631
|
const profile = routerOptions.extractToolCallsFromContent === true && baseProfile.extractToolCallsFromContent !== true ? { ...baseProfile, extractToolCallsFromContent: true } : baseProfile;
|
|
2632
2632
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2633
|
-
const ambient =
|
|
2633
|
+
const ambient = chunkKL7E244K_cjs.currentCredentialPool(name);
|
|
2634
2634
|
if (ambient !== void 0) {
|
|
2635
2635
|
return new RetryingLlmClient(
|
|
2636
2636
|
new PoolAwareLlmClient(
|
|
@@ -2660,9 +2660,9 @@ function buildPoolOrSingle(args) {
|
|
|
2660
2660
|
if (poolKeys !== void 0 && poolKeys.length >= 2) {
|
|
2661
2661
|
const strategy = routerOptions.credentialPoolStrategy?.[name] ?? "fill_first";
|
|
2662
2662
|
const entries = poolKeys.map(
|
|
2663
|
-
(accessToken, priority) =>
|
|
2663
|
+
(accessToken, priority) => chunkKL7E244K_cjs.newPooledCredential({ provider: name, accessToken, priority, source: "manual" })
|
|
2664
2664
|
);
|
|
2665
|
-
const pool = new
|
|
2665
|
+
const pool = new chunkKL7E244K_cjs.CredentialPool(name, entries, strategy);
|
|
2666
2666
|
const resilience = routerOptions.onRateLimit !== void 0 ? { onRateLimit: routerOptions.onRateLimit } : {};
|
|
2667
2667
|
return new RetryingLlmClient(
|
|
2668
2668
|
new PoolAwareLlmClient(
|
|
@@ -2697,7 +2697,7 @@ var warnedNoAuthApiKeys = /* @__PURE__ */ new Set();
|
|
|
2697
2697
|
function warnNoAuthApiKeysIgnoredOnce(provider) {
|
|
2698
2698
|
if (warnedNoAuthApiKeys.has(provider)) return;
|
|
2699
2699
|
warnedNoAuthApiKeys.add(provider);
|
|
2700
|
-
|
|
2700
|
+
chunkBE3W4HYV_cjs.diag(
|
|
2701
2701
|
`[theokit-sdk] provider "${provider}" has authType: "none" \u2014 apiKeys ignored (no auth required for local runtime).
|
|
2702
2702
|
`
|
|
2703
2703
|
);
|
|
@@ -2723,10 +2723,10 @@ function warnUnknownProvidersInApiKeys(apiKeys) {
|
|
|
2723
2723
|
if (apiKeys === void 0) return;
|
|
2724
2724
|
for (const name of Object.keys(apiKeys)) {
|
|
2725
2725
|
if (warnedProviders.has(name)) continue;
|
|
2726
|
-
const profile =
|
|
2726
|
+
const profile = chunk4MWBKBS4_cjs.getProviderProfile(name);
|
|
2727
2727
|
if (profile === void 0) {
|
|
2728
2728
|
warnedProviders.add(name);
|
|
2729
|
-
|
|
2729
|
+
chunkBE3W4HYV_cjs.diag(
|
|
2730
2730
|
`[theokit-sdk] credential-pool: unknown provider "${name}" in apiKeys (no profile registered)
|
|
2731
2731
|
`
|
|
2732
2732
|
);
|
|
@@ -2746,19 +2746,19 @@ function selectTransport(profile, apiKey) {
|
|
|
2746
2746
|
const ctx = { apiKey };
|
|
2747
2747
|
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
2748
2748
|
};
|
|
2749
|
-
const comTransform = (opts,
|
|
2749
|
+
const comTransform = (opts, construct) => {
|
|
2750
2750
|
const t = applyTransform();
|
|
2751
2751
|
assertOAuthResolved(t);
|
|
2752
2752
|
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
2753
2753
|
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
2754
2754
|
if (merged !== void 0) opts.extraHeaders = merged;
|
|
2755
|
-
return
|
|
2755
|
+
return construct(opts);
|
|
2756
2756
|
};
|
|
2757
2757
|
const assertOAuthResolved = (t) => {
|
|
2758
2758
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
2759
2759
|
const auth = t.headers?.authorization ?? t.headers?.Authorization;
|
|
2760
2760
|
if (t.fetch === void 0 && auth === void 0) {
|
|
2761
|
-
throw new
|
|
2761
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2762
2762
|
`provider "${profile.name}" uses OAuth (authType: ${profile.authType}) but no credential was resolved. Register a ProviderProfile.transform whose fetch (or headers.authorization) supplies the bearer \u2014 typically via resolveCredential() from "@theokit/sdk/auth".`
|
|
2763
2763
|
);
|
|
2764
2764
|
}
|
|
@@ -2809,7 +2809,7 @@ function selectTransport(profile, apiKey) {
|
|
|
2809
2809
|
providerName: profile.name
|
|
2810
2810
|
});
|
|
2811
2811
|
}
|
|
2812
|
-
throw new
|
|
2812
|
+
throw new chunkA3MHE2MQ_cjs.ConfigurationError(
|
|
2813
2813
|
`Provider "${profile.name}" requires apiMode "${profile.apiMode}" but no transport is registered. Install a third-party transport plugin (@theokit-transport-${profile.apiMode}) or use a provider with apiMode "chat_completions" or "anthropic_messages".`,
|
|
2814
2814
|
{ code: "transport_unavailable" }
|
|
2815
2815
|
);
|
|
@@ -2824,7 +2824,7 @@ function inferProviderFromApiKey(apiKey) {
|
|
|
2824
2824
|
{ provider: "openai", prefix: "sk-" }
|
|
2825
2825
|
];
|
|
2826
2826
|
for (const { provider, prefix } of byPrefix) {
|
|
2827
|
-
if (apiKey.startsWith(prefix) &&
|
|
2827
|
+
if (apiKey.startsWith(prefix) && chunk4MWBKBS4_cjs.getProviderProfile(provider) !== void 0) {
|
|
2828
2828
|
return provider;
|
|
2829
2829
|
}
|
|
2830
2830
|
}
|
|
@@ -2963,7 +2963,7 @@ function plainText(content) {
|
|
|
2963
2963
|
}
|
|
2964
2964
|
async function compactSessionTranscript(opts) {
|
|
2965
2965
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
2966
|
-
const history =
|
|
2966
|
+
const history = chunk6OKPJZMX_cjs.reconstructMessages(prior);
|
|
2967
2967
|
const compressible = [];
|
|
2968
2968
|
for (const m of history) {
|
|
2969
2969
|
const text = plainText(m.content);
|
|
@@ -2971,14 +2971,14 @@ async function compactSessionTranscript(opts) {
|
|
|
2971
2971
|
compressible.push({ role: m.role, content: text });
|
|
2972
2972
|
}
|
|
2973
2973
|
}
|
|
2974
|
-
const preTokens =
|
|
2974
|
+
const preTokens = chunkIBDE4R5L_cjs.estimateTokens(compressible.map((m) => m.content).join("\n"));
|
|
2975
2975
|
const summaryBody = await opts.summarize(compressible);
|
|
2976
2976
|
const preserved = [];
|
|
2977
2977
|
let budget = 0;
|
|
2978
2978
|
for (let i = compressible.length - 1; i >= 0; i--) {
|
|
2979
2979
|
const m = compressible[i];
|
|
2980
2980
|
if (m === void 0 || m.role !== "user" || isCompactSummary(m.content)) continue;
|
|
2981
|
-
const cost =
|
|
2981
|
+
const cost = chunkIBDE4R5L_cjs.estimateTokens(m.content);
|
|
2982
2982
|
if (budget + cost > COMPACT_USER_MESSAGE_MAX_TOKENS) {
|
|
2983
2983
|
const remaining = COMPACT_USER_MESSAGE_MAX_TOKENS - budget;
|
|
2984
2984
|
if (remaining > 50) {
|
|
@@ -2992,7 +2992,7 @@ async function compactSessionTranscript(opts) {
|
|
|
2992
2992
|
}
|
|
2993
2993
|
const summary = `${COMPACT_SUMMARY_MARKER}
|
|
2994
2994
|
${summaryBody}`;
|
|
2995
|
-
const transcript =
|
|
2995
|
+
const transcript = chunk6OKPJZMX_cjs.SessionTranscript.fromRecords(prior, {
|
|
2996
2996
|
cwd: opts.loc.cwd,
|
|
2997
2997
|
sessionId: opts.sessionId,
|
|
2998
2998
|
model: opts.loc.model ?? "unknown"
|
|
@@ -3002,8 +3002,8 @@ ${summaryBody}`;
|
|
|
3002
3002
|
transcript.appendUserTurn(summary);
|
|
3003
3003
|
const delta = transcript.records().slice(prior.length);
|
|
3004
3004
|
await opts.store.appendRecords(opts.loc.agentId, delta);
|
|
3005
|
-
|
|
3006
|
-
const postTokens =
|
|
3005
|
+
chunkBURYFNOM_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
3006
|
+
const postTokens = chunkIBDE4R5L_cjs.estimateTokens([...preserved, summary].join("\n"));
|
|
3007
3007
|
return { preTokens, postTokens };
|
|
3008
3008
|
}
|
|
3009
3009
|
function resolveSummarizerRoute(opts) {
|
|
@@ -3012,9 +3012,9 @@ function resolveSummarizerRoute(opts) {
|
|
|
3012
3012
|
}
|
|
3013
3013
|
function buildDefaultSummarizer(opts) {
|
|
3014
3014
|
return async (messages) => {
|
|
3015
|
-
|
|
3015
|
+
chunk4MWBKBS4_cjs.registerBuiltins();
|
|
3016
3016
|
const modelPrefix = opts.agentModel.includes("/") ? opts.agentModel.slice(0, opts.agentModel.indexOf("/")) : void 0;
|
|
3017
|
-
const prefixProfile = modelPrefix !== void 0 ?
|
|
3017
|
+
const prefixProfile = modelPrefix !== void 0 ? chunk4MWBKBS4_cjs.getProviderProfile(modelPrefix) : void 0;
|
|
3018
3018
|
const prefixUsable = prefixProfile !== void 0 && (prefixProfile.authType !== "api_key" || prefixProfile.envVars.some((v) => (process.env[v] ?? "").length > 0));
|
|
3019
3019
|
const route = resolveSummarizerRoute({
|
|
3020
3020
|
keyProvider: inferProviderFromApiKey(opts.apiKey),
|
|
@@ -3085,7 +3085,7 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3085
3085
|
return true;
|
|
3086
3086
|
} catch (cause) {
|
|
3087
3087
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
3088
|
-
|
|
3088
|
+
chunkBE3W4HYV_cjs.diag(`[theokit-sdk] auto-compaction failed (left transcript untouched): ${msg}
|
|
3089
3089
|
`);
|
|
3090
3090
|
return false;
|
|
3091
3091
|
}
|
|
@@ -3117,5 +3117,5 @@ exports.shouldAutoCompact = shouldAutoCompact;
|
|
|
3117
3117
|
exports.shouldUseFixtureMode = shouldUseFixtureMode;
|
|
3118
3118
|
exports.shouldUseRealLocalRuntime = shouldUseRealLocalRuntime;
|
|
3119
3119
|
exports.tryFirstEvent = tryFirstEvent;
|
|
3120
|
-
//# sourceMappingURL=chunk-
|
|
3121
|
-
//# sourceMappingURL=chunk-
|
|
3120
|
+
//# sourceMappingURL=chunk-G7X2Y7Y2.cjs.map
|
|
3121
|
+
//# sourceMappingURL=chunk-G7X2Y7Y2.cjs.map
|