@theokit/sdk 4.37.2 → 4.39.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 +309 -72
- package/dist/a2a/index.cjs +3 -3
- package/dist/a2a/index.js +1 -1
- package/dist/a2a/subagent.d.cts +1 -0
- package/dist/a2a/subagent.d.ts +1 -0
- package/dist/{agent-SmxntivO.d.ts → agent-D7bRK9Kg.d.cts} +108 -41
- package/dist/agent-I3EZZR6S.cjs +55 -0
- package/dist/{agent-IE6IE4NW.cjs.map → agent-I3EZZR6S.cjs.map} +1 -1
- package/dist/agent-KKZYLY5D.js +46 -0
- package/dist/{agent-DW2J37IH.js.map → agent-KKZYLY5D.js.map} +1 -1
- package/dist/{agent-DGv1-d81.d.cts → agent-ZCZa7YQv.d.ts} +108 -41
- package/dist/agent-session-store-N4TVKHBU.cjs +23 -0
- package/dist/agent-session-store-N4TVKHBU.cjs.map +1 -0
- package/dist/agent-session-store-RHMHP5DG.js +6 -0
- package/dist/agent-session-store-RHMHP5DG.js.map +1 -0
- package/dist/agent.d.ts +38 -2
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +4 -4
- package/dist/{batch-SY5GZLFD.js → batch-6KQM3EBA.js} +12 -12
- package/dist/batch-6KQM3EBA.js.map +1 -0
- package/dist/{batch-3SEPDXCU.cjs → batch-X6JKGDPK.cjs} +26 -26
- package/dist/batch-X6JKGDPK.cjs.map +1 -0
- package/dist/chunk-2RW7K6FN.cjs +34 -0
- package/dist/chunk-2RW7K6FN.cjs.map +1 -0
- package/dist/chunk-3I4B3OIX.js +105 -0
- package/dist/chunk-3I4B3OIX.js.map +1 -0
- package/dist/{chunk-2WFB5ZOX.js → chunk-42IFCKQZ.js} +5 -5
- package/dist/{chunk-2WFB5ZOX.js.map → chunk-42IFCKQZ.js.map} +1 -1
- package/dist/{chunk-DCJ5MCJ3.js → chunk-4F7JQZOX.js} +9 -36
- package/dist/chunk-4F7JQZOX.js.map +1 -0
- package/dist/{chunk-JNIWFCKI.js → chunk-4JSZYSGW.js} +3 -3
- package/dist/{chunk-JNIWFCKI.js.map → chunk-4JSZYSGW.js.map} +1 -1
- package/dist/{chunk-EEZ7CFMM.js → chunk-5KOW3GLE.js} +2 -2
- package/dist/chunk-5KOW3GLE.js.map +1 -0
- package/dist/{chunk-6VP3XGEK.js → chunk-65ONFZWM.js} +12 -11
- package/dist/chunk-65ONFZWM.js.map +1 -0
- package/dist/{chunk-CSZRJ4RE.js → chunk-6EEYRFJC.js} +5 -5
- package/dist/{chunk-CSZRJ4RE.js.map → chunk-6EEYRFJC.js.map} +1 -1
- package/dist/{chunk-FAY3QDGC.cjs → chunk-6LGQECT7.cjs} +11 -11
- package/dist/{chunk-FAY3QDGC.cjs.map → chunk-6LGQECT7.cjs.map} +1 -1
- package/dist/{chunk-PAEJPLVN.cjs → chunk-6NEHIHFU.cjs} +4 -4
- package/dist/{chunk-PAEJPLVN.cjs.map → chunk-6NEHIHFU.cjs.map} +1 -1
- package/dist/chunk-6YNYA7GD.cjs +103 -0
- package/dist/chunk-6YNYA7GD.cjs.map +1 -0
- package/dist/chunk-74D7KSBP.cjs +112 -0
- package/dist/chunk-74D7KSBP.cjs.map +1 -0
- package/dist/{chunk-FK4EJD2I.cjs → chunk-75DSEWTJ.cjs} +7 -7
- package/dist/{chunk-FK4EJD2I.cjs.map → chunk-75DSEWTJ.cjs.map} +1 -1
- package/dist/{chunk-SWIBQFPH.cjs → chunk-7OLG7VI4.cjs} +4 -4
- package/dist/{chunk-SWIBQFPH.cjs.map → chunk-7OLG7VI4.cjs.map} +1 -1
- package/dist/chunk-7U2HAAWB.cjs +199 -0
- package/dist/chunk-7U2HAAWB.cjs.map +1 -0
- package/dist/{chunk-YBFDBOUN.cjs → chunk-7YBJZS5P.cjs} +8 -8
- package/dist/{chunk-YBFDBOUN.cjs.map → chunk-7YBJZS5P.cjs.map} +1 -1
- package/dist/{chunk-GLUWH6JO.js → chunk-AECV3G5Z.js} +4 -4
- package/dist/{chunk-GLUWH6JO.js.map → chunk-AECV3G5Z.js.map} +1 -1
- package/dist/{chunk-UQPDFW4E.js → chunk-AR5MQZ3J.js} +3 -3
- package/dist/{chunk-UQPDFW4E.js.map → chunk-AR5MQZ3J.js.map} +1 -1
- package/dist/{chunk-G2F67XUR.cjs → chunk-B4YA6BRS.cjs} +13 -14
- package/dist/chunk-B4YA6BRS.cjs.map +1 -0
- package/dist/{chunk-LTCOPATU.cjs → chunk-BCQ3E2ZG.cjs} +12 -3
- package/dist/chunk-BCQ3E2ZG.cjs.map +1 -0
- package/dist/{chunk-ALU3KC4G.cjs → chunk-BPN5ONSW.cjs} +223 -277
- package/dist/chunk-BPN5ONSW.cjs.map +1 -0
- package/dist/{chunk-YHZXBDAW.js → chunk-BQDUEG4C.js} +16 -16
- package/dist/{chunk-YHZXBDAW.js.map → chunk-BQDUEG4C.js.map} +1 -1
- package/dist/{chunk-IT3PWBW4.cjs → chunk-BURYFNOM.cjs} +2 -2
- package/dist/chunk-BURYFNOM.cjs.map +1 -0
- package/dist/{chunk-BJMKQOY2.cjs → chunk-C7OP3FAK.cjs} +47 -11
- package/dist/chunk-C7OP3FAK.cjs.map +1 -0
- package/dist/{chunk-XAYVHS2B.cjs → chunk-CEIHCKTO.cjs} +4 -4
- package/dist/chunk-CEIHCKTO.cjs.map +1 -0
- package/dist/{chunk-2423XDPT.cjs → chunk-CN6UX5EV.cjs} +28 -56
- package/dist/chunk-CN6UX5EV.cjs.map +1 -0
- package/dist/{chunk-VNNK6AKU.js → chunk-D7IULBF2.js} +3 -3
- package/dist/chunk-D7IULBF2.js.map +1 -0
- package/dist/chunk-DCXRHCZJ.cjs +118 -0
- package/dist/chunk-DCXRHCZJ.cjs.map +1 -0
- package/dist/{chunk-ICYBIC6N.cjs → chunk-DGLLVCNB.cjs} +4 -4
- package/dist/chunk-DGLLVCNB.cjs.map +1 -0
- package/dist/{chunk-I35DI7ES.js → chunk-DKFGUOWL.js} +3 -3
- package/dist/{chunk-I35DI7ES.js.map → chunk-DKFGUOWL.js.map} +1 -1
- package/dist/{chunk-TQI3KRXZ.cjs → chunk-DMTZ3FII.cjs} +18 -18
- package/dist/{chunk-TQI3KRXZ.cjs.map → chunk-DMTZ3FII.cjs.map} +1 -1
- package/dist/{chunk-QFMXXUUT.js → chunk-DU7DE543.js} +3 -3
- package/dist/{chunk-QFMXXUUT.js.map → chunk-DU7DE543.js.map} +1 -1
- package/dist/{chunk-W4QN5CMG.cjs → chunk-DWY25VLP.cjs} +9 -9
- package/dist/{chunk-W4QN5CMG.cjs.map → chunk-DWY25VLP.cjs.map} +1 -1
- package/dist/chunk-E2FFG33C.js +109 -0
- package/dist/chunk-E2FFG33C.js.map +1 -0
- package/dist/{chunk-QUFSDDNU.cjs → chunk-E4IUN3JB.cjs} +15 -15
- package/dist/{chunk-QUFSDDNU.cjs.map → chunk-E4IUN3JB.cjs.map} +1 -1
- package/dist/{chunk-THEYGCYS.cjs → chunk-ECHGWE47.cjs} +4 -4
- package/dist/chunk-ECHGWE47.cjs.map +1 -0
- package/dist/{chunk-U2WLFOA3.cjs → chunk-ECW2MLEW.cjs} +4 -4
- package/dist/{chunk-U2WLFOA3.cjs.map → chunk-ECW2MLEW.cjs.map} +1 -1
- package/dist/{chunk-MXSMAGDU.js → chunk-ET6PHZRX.js} +33 -26
- package/dist/chunk-ET6PHZRX.js.map +1 -0
- package/dist/{chunk-G6AASL5T.cjs → chunk-FRUBE44B.cjs} +24 -24
- package/dist/{chunk-G6AASL5T.cjs.map → chunk-FRUBE44B.cjs.map} +1 -1
- package/dist/{chunk-3ILFUXNE.cjs → chunk-FWBSDQZ7.cjs} +5 -5
- package/dist/{chunk-3ILFUXNE.cjs.map → chunk-FWBSDQZ7.cjs.map} +1 -1
- package/dist/{chunk-7DXLNNKH.cjs → chunk-G2Q3ZC6C.cjs} +4 -4
- package/dist/{chunk-7DXLNNKH.cjs.map → chunk-G2Q3ZC6C.cjs.map} +1 -1
- package/dist/{chunk-56ZM6P7Z.cjs → chunk-G4XUXSRN.cjs} +12 -12
- package/dist/chunk-G4XUXSRN.cjs.map +1 -0
- package/dist/{chunk-VYJSHGAY.js → chunk-GIRD3RWH.js} +422 -295
- package/dist/chunk-GIRD3RWH.js.map +1 -0
- package/dist/{chunk-NQ4AC2U4.cjs → chunk-HIQFVHC6.cjs} +9 -9
- package/dist/{chunk-NQ4AC2U4.cjs.map → chunk-HIQFVHC6.cjs.map} +1 -1
- package/dist/{chunk-EXQV452X.js → chunk-HWNVAUK4.js} +3 -3
- package/dist/{chunk-EXQV452X.js.map → chunk-HWNVAUK4.js.map} +1 -1
- package/dist/{chunk-P34DHHYQ.cjs → chunk-I53ZQHU6.cjs} +34 -27
- package/dist/chunk-I53ZQHU6.cjs.map +1 -0
- package/dist/{chunk-MHCKWQR3.cjs → chunk-IHFNRNTJ.cjs} +8 -8
- package/dist/{chunk-MHCKWQR3.cjs.map → chunk-IHFNRNTJ.cjs.map} +1 -1
- package/dist/{chunk-W52DKZBR.cjs → chunk-INSFS5GT.cjs} +680 -553
- package/dist/chunk-INSFS5GT.cjs.map +1 -0
- package/dist/{chunk-TAPQWDW2.js → chunk-IVSD7L22.js} +12 -4
- package/dist/chunk-IVSD7L22.js.map +1 -0
- package/dist/{chunk-WDGCZDRG.js → chunk-J3UK2GMN.js} +3 -3
- package/dist/{chunk-WDGCZDRG.js.map → chunk-J3UK2GMN.js.map} +1 -1
- package/dist/{chunk-4YB7B3RP.cjs → chunk-J6T5LWJ4.cjs} +15 -14
- package/dist/chunk-J6T5LWJ4.cjs.map +1 -0
- package/dist/{chunk-XAEAMI5H.js → chunk-JRLXEYR4.js} +21 -5
- package/dist/chunk-JRLXEYR4.js.map +1 -0
- package/dist/{chunk-ZJN6NTHE.js → chunk-JZUPMTJY.js} +3 -3
- package/dist/{chunk-ZJN6NTHE.js.map → chunk-JZUPMTJY.js.map} +1 -1
- package/dist/{chunk-M5ZQBOIZ.js → chunk-KE6XKRLQ.js} +3 -3
- package/dist/{chunk-M5ZQBOIZ.js.map → chunk-KE6XKRLQ.js.map} +1 -1
- package/dist/chunk-KGRIHEDT.js +110 -0
- package/dist/chunk-KGRIHEDT.js.map +1 -0
- package/dist/{chunk-T4QWDOG6.js → chunk-KWUNN5J2.js} +5 -5
- package/dist/{chunk-T4QWDOG6.js.map → chunk-KWUNN5J2.js.map} +1 -1
- package/dist/{chunk-56OXYUZE.js → chunk-KX7JV5KM.js} +3 -3
- package/dist/chunk-KX7JV5KM.js.map +1 -0
- package/dist/{chunk-D4ZUJTFB.cjs → chunk-LALG2K33.cjs} +8 -8
- package/dist/{chunk-D4ZUJTFB.cjs.map → chunk-LALG2K33.cjs.map} +1 -1
- package/dist/{chunk-QGDKZDPN.js → chunk-LGILIGV3.js} +3 -3
- package/dist/{chunk-QGDKZDPN.js.map → chunk-LGILIGV3.js.map} +1 -1
- package/dist/{chunk-HEN5WXXI.js → chunk-LJX2SQV2.js} +6 -6
- package/dist/{chunk-HEN5WXXI.js.map → chunk-LJX2SQV2.js.map} +1 -1
- package/dist/{chunk-SDIBMLL5.js → chunk-MC5EINBV.js} +44 -8
- package/dist/chunk-MC5EINBV.js.map +1 -0
- package/dist/{chunk-F6Y4IEQM.js → chunk-ML5A5DOJ.js} +4 -4
- package/dist/{chunk-F6Y4IEQM.js.map → chunk-ML5A5DOJ.js.map} +1 -1
- package/dist/{chunk-6EDQBX7U.cjs → chunk-N475ETD6.cjs} +17 -17
- package/dist/{chunk-6EDQBX7U.cjs.map → chunk-N475ETD6.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-OXNYIMZZ.js +31 -0
- package/dist/chunk-OXNYIMZZ.js.map +1 -0
- package/dist/{chunk-NFCKEBHI.js → chunk-PI4RO4GR.js} +3 -3
- package/dist/{chunk-NFCKEBHI.js.map → chunk-PI4RO4GR.js.map} +1 -1
- package/dist/{chunk-2ONFGMBV.js → chunk-PY2RQOA7.js} +2 -2
- package/dist/chunk-PY2RQOA7.js.map +1 -0
- package/dist/chunk-QKE556YD.js +197 -0
- package/dist/chunk-QKE556YD.js.map +1 -0
- package/dist/{chunk-FV3YEMQ7.js → chunk-RP5HQVLD.js} +13 -14
- package/dist/chunk-RP5HQVLD.js.map +1 -0
- package/dist/chunk-SCFW5MJZ.js +100 -0
- package/dist/chunk-SCFW5MJZ.js.map +1 -0
- package/dist/{chunk-CD73YHEH.js → chunk-SG5ZWT6C.js} +3 -3
- package/dist/{chunk-CD73YHEH.js.map → chunk-SG5ZWT6C.js.map} +1 -1
- package/dist/{chunk-MRODLUGY.cjs → chunk-TIMPJL5V.cjs} +4 -4
- package/dist/{chunk-MRODLUGY.cjs.map → chunk-TIMPJL5V.cjs.map} +1 -1
- package/dist/{chunk-77WHPVXE.js → chunk-TOTP24P6.js} +4 -4
- package/dist/chunk-TOTP24P6.js.map +1 -0
- package/dist/{chunk-3O2ELBST.cjs → chunk-USZTVNUQ.cjs} +5 -5
- package/dist/{chunk-3O2ELBST.cjs.map → chunk-USZTVNUQ.cjs.map} +1 -1
- package/dist/{chunk-YDLNI7J6.js → chunk-V2RBCCN5.js} +3 -3
- package/dist/chunk-V2RBCCN5.js.map +1 -0
- package/dist/{chunk-NNSKJCBM.cjs → chunk-VJYSQXN6.cjs} +10 -10
- package/dist/{chunk-NNSKJCBM.cjs.map → chunk-VJYSQXN6.cjs.map} +1 -1
- package/dist/{chunk-GM7QDQ24.cjs → chunk-W4WKVOOQ.cjs} +11 -11
- package/dist/{chunk-GM7QDQ24.cjs.map → chunk-W4WKVOOQ.cjs.map} +1 -1
- package/dist/chunk-XYOHKCYG.cjs +109 -0
- package/dist/chunk-XYOHKCYG.cjs.map +1 -0
- package/dist/{chunk-ZW345YOI.js → chunk-YP67XZES.js} +4 -4
- package/dist/{chunk-ZW345YOI.js.map → chunk-YP67XZES.js.map} +1 -1
- package/dist/{chunk-YCXMSDSP.js → chunk-YRXY2A5L.js} +4 -4
- package/dist/{chunk-YCXMSDSP.js.map → chunk-YRXY2A5L.js.map} +1 -1
- package/dist/{chunk-IEUDKUPM.cjs → chunk-Z2CUEBXV.cjs} +25 -9
- package/dist/chunk-Z2CUEBXV.cjs.map +1 -0
- package/dist/{chunk-GL7CFBVC.js → chunk-ZYB6B7QJ.js} +112 -165
- package/dist/chunk-ZYB6B7QJ.js.map +1 -0
- package/dist/compact-session-PYEC3NZV.js +18 -0
- package/dist/{compact-session-WNKKIIDW.js.map → compact-session-PYEC3NZV.js.map} +1 -1
- package/dist/compact-session-VVT6IBJG.cjs +55 -0
- package/dist/{compact-session-H5TKLD55.cjs.map → compact-session-VVT6IBJG.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-2FZSC6VQ.cjs +22 -0
- package/dist/{context-ZV33V4DC.cjs.map → context-2FZSC6VQ.cjs.map} +1 -1
- package/dist/context-ATJJAFOS.js +5 -0
- package/dist/{context-VAYLPT4O.js.map → context-ATJJAFOS.js.map} +1 -1
- package/dist/{cron-Dx7B-3WB.d.ts → cron-Bx7tzm5R.d.ts} +54 -2
- package/dist/{cron-BiK_aNJI.d.cts → cron-D-DVjGQe.d.cts} +54 -2
- package/dist/cron.cjs +34 -30
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +33 -29
- package/dist/{errors-DyVbXdR4.d.cts → errors-DMY-gLSK.d.cts} +1 -1
- package/dist/{errors-Cua4WC9H.d.ts → errors-DjBQ4Tn8.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 +42 -37
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +38 -33
- package/dist/eval.js.map +1 -1
- package/dist/{executor-OZSYXDKF.cjs → executor-BMRICN46.cjs} +26 -25
- package/dist/executor-BMRICN46.cjs.map +1 -0
- package/dist/{executor-PAH72CB5.js → executor-T65PPOPT.js} +10 -9
- package/dist/executor-T65PPOPT.js.map +1 -0
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-J5MCFFUM.cjs +19 -0
- package/dist/{fs-session-store-7E7UPLF2.cjs.map → fs-session-store-J5MCFFUM.cjs.map} +1 -1
- package/dist/fs-session-store-O6FNHECD.js +10 -0
- package/dist/{fs-session-store-6MY7PNI2.js.map → fs-session-store-O6FNHECD.js.map} +1 -1
- package/dist/generate-object-UF6WIZLF.cjs +20 -0
- package/dist/{generate-object-5SCEH2EE.cjs.map → generate-object-UF6WIZLF.cjs.map} +1 -1
- package/dist/generate-object-XDCBYVK3.js +7 -0
- package/dist/{generate-object-I7UD4NWN.js.map → generate-object-XDCBYVK3.js.map} +1 -1
- package/dist/index-manager-N7RQYUKT.cjs +20 -0
- package/dist/{index-manager-R6ZJFEZF.cjs.map → index-manager-N7RQYUKT.cjs.map} +1 -1
- package/dist/index-manager-ZVZUHPP7.js +11 -0
- package/dist/{index-manager-KKAK7NT3.js.map → index-manager-ZVZUHPP7.js.map} +1 -1
- package/dist/index.cjs +154 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -43
- package/dist/index.d.ts +201 -43
- package/dist/index.js +62 -59
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-UXNJQTZ6.js → inject-session-GQMTDZUN.js} +8 -7
- package/dist/inject-session-GQMTDZUN.js.map +1 -0
- package/dist/{inject-session-DM4SKTZO.cjs → inject-session-LFCYVSLJ.cjs} +11 -10
- package/dist/inject-session-LFCYVSLJ.cjs.map +1 -0
- package/dist/internal/agent-loop/live-events.d.ts +46 -0
- package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
- package/dist/internal/agent-loop/message-builders.d.ts +12 -3
- package/dist/internal/budget/compute-cost.d.ts +1 -1
- package/dist/internal/diagnostics.d.ts +46 -31
- 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/anthropic-shared.d.ts +4 -4
- package/dist/internal/llm/retrying-client.d.ts +29 -29
- package/dist/internal/llm/transport-error.d.ts +2 -2
- package/dist/internal/llm/types.d.ts +49 -9
- package/dist/internal/local-agent/mcp-pool.d.ts +7 -3
- package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/catalog.d.cts +1 -0
- package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/index.cjs +28 -0
- package/dist/internal/memory/adapters/index.cjs.map +1 -0
- package/dist/internal/memory/adapters/index.d.cts +16 -0
- package/dist/internal/memory/adapters/index.d.ts +16 -0
- package/dist/internal/memory/adapters/index.js +11 -0
- package/dist/internal/memory/adapters/index.js.map +1 -0
- package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
- package/dist/internal/memory/adapters/openai-compatible.d.cts +51 -0
- package/dist/internal/memory/adapters/openai-compatible.d.ts +28 -0
- package/dist/internal/memory/adapters/openai-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
- package/dist/internal/memory/dreaming/diary.d.ts +4 -0
- package/dist/internal/memory/dreaming/phases.d.ts +15 -0
- package/dist/internal/memory/dreaming/run.d.ts +10 -0
- package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +15 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +21 -0
- 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 +13 -7
- package/dist/internal/persistence/session-transcript.d.ts +13 -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/concurrency/subagent-credentials.d.ts +35 -0
- 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-store.d.ts +1 -0
- package/dist/internal/session/agent-session.d.ts +14 -14
- package/dist/internal/session/session-cache.d.ts +9 -9
- package/dist/internal/session/session-types.d.ts +6 -1
- package/dist/judge-call-NA2G6ZMJ.js +5 -0
- package/dist/{judge-call-TAEIXMYG.js.map → judge-call-NA2G6ZMJ.js.map} +1 -1
- package/dist/judge-call-U2D33JOW.cjs +22 -0
- package/dist/{judge-call-SP3G3X2Y.cjs.map → judge-call-U2D33JOW.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 +43 -43
- 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-CAS6Y5ZY.js +9 -0
- package/dist/{registry-SOXE4RY6.js.map → registry-CAS6Y5ZY.js.map} +1 -1
- package/dist/registry-JSDI4WKA.cjs +46 -0
- package/dist/{registry-N3GTKYCI.cjs.map → registry-JSDI4WKA.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-CwEJtLPE.d.ts → run-i2-fUohR.d.cts} +217 -174
- package/dist/{run-CwEJtLPE.d.cts → run-i2-fUohR.d.ts} +217 -174
- 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/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-3B52DKTG.js +5 -0
- package/dist/{session-transcript-6WKLYIN4.js.map → session-transcript-3B52DKTG.js.map} +1 -1
- package/dist/session-transcript-H7NUFXXM.cjs +50 -0
- package/dist/{session-transcript-EAKR4D2W.cjs.map → session-transcript-H7NUFXXM.cjs.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-4FDU76YW.cjs +20 -0
- package/dist/{stream-object-Y7YCX3BI.cjs.map → stream-object-4FDU76YW.cjs.map} +1 -1
- package/dist/stream-object-HWDEEQN4.js +7 -0
- package/dist/{stream-object-OFM66VUT.js.map → stream-object-HWDEEQN4.js.map} +1 -1
- package/dist/subagents-loader-A4W6C3QP.cjs +15 -0
- package/dist/subagents-loader-A4W6C3QP.cjs.map +1 -0
- package/dist/subagents-loader-X33KH2SZ.js +6 -0
- package/dist/subagents-loader-X33KH2SZ.js.map +1 -0
- 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/agent.d.ts +68 -3
- package/dist/types/conversation.d.ts +7 -0
- package/dist/types/goal-events.d.ts +24 -23
- package/dist/types/messages.d.ts +9 -0
- package/dist/types/run.d.ts +27 -0
- package/dist/types/session-message.d.ts +59 -0
- package/dist/types/session-record.d.ts +14 -13
- package/dist/types/workflow.d.ts +36 -0
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.d.cts +17 -1
- package/dist/workflow.d.ts +17 -1
- package/dist/workflow.js +6 -6
- package/docs/harness-capability-map.md +22 -0
- package/package.json +22 -13
- package/dist/agent-DW2J37IH.js +0 -42
- package/dist/agent-IE6IE4NW.cjs +0 -51
- package/dist/batch-3SEPDXCU.cjs.map +0 -1
- package/dist/batch-SY5GZLFD.js.map +0 -1
- package/dist/chunk-2423XDPT.cjs.map +0 -1
- package/dist/chunk-2ONFGMBV.js.map +0 -1
- package/dist/chunk-4YB7B3RP.cjs.map +0 -1
- package/dist/chunk-56OXYUZE.js.map +0 -1
- package/dist/chunk-56ZM6P7Z.cjs.map +0 -1
- package/dist/chunk-5SB4V74H.js +0 -176
- package/dist/chunk-5SB4V74H.js.map +0 -1
- package/dist/chunk-6VP3XGEK.js.map +0 -1
- package/dist/chunk-77WHPVXE.js.map +0 -1
- package/dist/chunk-ALU3KC4G.cjs.map +0 -1
- package/dist/chunk-BJMKQOY2.cjs.map +0 -1
- package/dist/chunk-DCJ5MCJ3.js.map +0 -1
- package/dist/chunk-EEZ7CFMM.js.map +0 -1
- package/dist/chunk-FV3YEMQ7.js.map +0 -1
- package/dist/chunk-G2F67XUR.cjs.map +0 -1
- package/dist/chunk-GL7CFBVC.js.map +0 -1
- package/dist/chunk-H5YVJB4K.cjs +0 -185
- package/dist/chunk-H5YVJB4K.cjs.map +0 -1
- package/dist/chunk-ICYBIC6N.cjs.map +0 -1
- package/dist/chunk-IEUDKUPM.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-SDIBMLL5.js.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-XAYVHS2B.cjs.map +0 -1
- package/dist/chunk-YDLNI7J6.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/executor-OZSYXDKF.cjs.map +0 -1
- package/dist/executor-PAH72CB5.js.map +0 -1
- 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/inject-session-DM4SKTZO.cjs.map +0 -1
- package/dist/inject-session-UXNJQTZ6.js.map +0 -1
- 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,11 +1,12 @@
|
|
|
1
|
-
import { currentCredentialPool, computeBackoffMs, sleepWithAbort, newPooledCredential, CredentialPool } from './chunk-
|
|
2
|
-
import { invalidateSessionCache } from './chunk-
|
|
1
|
+
import { currentCredentialPool, computeBackoffMs, sleepWithAbort, newPooledCredential, CredentialPool } from './chunk-HWNVAUK4.js';
|
|
2
|
+
import { invalidateSessionCache } from './chunk-5KOW3GLE.js';
|
|
3
|
+
import { buildErrorMetadata, mapOpenAICompatibleError } from './chunk-SCFW5MJZ.js';
|
|
3
4
|
import { tryJson, isPlainObject, sanitizeToolInput } from './chunk-U54XCYG3.js';
|
|
4
|
-
import { reconstructMessages, SessionTranscript } from './chunk-
|
|
5
|
-
import { estimateTokens } from './chunk-
|
|
6
|
-
import { globalSingleton, registerProvider, registerBuiltins, getProviderProfile, inferModelDialect, inferRegionFromModelId, stripBedrockPrefix, resolveBedrockBaseUrl, resolveVertexBaseUrl, stripVertexPrefix } from './chunk-
|
|
7
|
-
import { NetworkError,
|
|
8
|
-
import { diag
|
|
5
|
+
import { reconstructMessages, SessionTranscript } from './chunk-JRLXEYR4.js';
|
|
6
|
+
import { estimateTokens } from './chunk-65ONFZWM.js';
|
|
7
|
+
import { globalSingleton, registerProvider, registerBuiltins, getProviderProfile, inferModelDialect, inferRegionFromModelId, stripBedrockPrefix, resolveBedrockBaseUrl, resolveVertexBaseUrl, stripVertexPrefix } from './chunk-TOTP24P6.js';
|
|
8
|
+
import { NetworkError, ConfigurationError, IntegrationNotConnectedError, AuthenticationError, RateLimitError, UnknownAgentError, CredentialPoolExhaustedError, isTransientError, TheokitAgentError } from './chunk-SG5ZWT6C.js';
|
|
9
|
+
import { diag } from './chunk-IVSD7L22.js';
|
|
9
10
|
import { existsSync, readFileSync } from 'fs';
|
|
10
11
|
import { readdir } from 'fs/promises';
|
|
11
12
|
import { homedir } from 'os';
|
|
@@ -105,37 +106,6 @@ async function loadOne(dir, entryName) {
|
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
// src/internal/error-mappers/shared.ts
|
|
109
|
-
var RAW_MAX_BYTES = 2048;
|
|
110
|
-
function parseRetryAfter(headers) {
|
|
111
|
-
if (headers === void 0) return void 0;
|
|
112
|
-
const raw = headers.get("retry-after");
|
|
113
|
-
if (raw === null) return void 0;
|
|
114
|
-
const n = Number(raw);
|
|
115
|
-
if (Number.isFinite(n) && n >= 0) return Math.ceil(n);
|
|
116
|
-
const dateMs = Date.parse(raw);
|
|
117
|
-
if (Number.isFinite(dateMs)) return Math.max(0, Math.ceil((dateMs - Date.now()) / 1e3));
|
|
118
|
-
return void 0;
|
|
119
|
-
}
|
|
120
|
-
function truncateRaw(body) {
|
|
121
|
-
if (body === null || body === void 0) return void 0;
|
|
122
|
-
const s = typeof body === "string" ? body : JSON.stringify(body);
|
|
123
|
-
const truncated = s.length <= RAW_MAX_BYTES ? s : `${s.slice(0, RAW_MAX_BYTES)}\u2026`;
|
|
124
|
-
return redactSecrets(truncated);
|
|
125
|
-
}
|
|
126
|
-
function buildErrorMetadata(args) {
|
|
127
|
-
const retryAfter = parseRetryAfter(args.headers);
|
|
128
|
-
const raw = truncateRaw(args.body);
|
|
129
|
-
return {
|
|
130
|
-
provider: args.provider,
|
|
131
|
-
endpoint: args.endpoint,
|
|
132
|
-
code: args.code,
|
|
133
|
-
statusCode: args.status,
|
|
134
|
-
...retryAfter !== void 0 ? { retryAfter } : {},
|
|
135
|
-
...raw !== void 0 ? { raw } : {}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
109
|
// src/internal/error-mappers/anthropic.ts
|
|
140
110
|
function mapAnthropicError(args) {
|
|
141
111
|
const { status, body, headers, endpoint } = args;
|
|
@@ -227,6 +197,7 @@ function makeLlmFinish(state) {
|
|
|
227
197
|
if (state.cacheReadTokens !== void 0) finish.cacheReadTokens = state.cacheReadTokens;
|
|
228
198
|
if (state.cacheWriteTokens !== void 0) finish.cacheWriteTokens = state.cacheWriteTokens;
|
|
229
199
|
if (state.reasoningTokens !== void 0) finish.reasoningTokens = state.reasoningTokens;
|
|
200
|
+
if (state.thinking !== void 0) finish.thinking = state.thinking;
|
|
230
201
|
return finish;
|
|
231
202
|
}
|
|
232
203
|
|
|
@@ -281,25 +252,28 @@ function mapAnthropicStopReason(reason) {
|
|
|
281
252
|
return "end_turn";
|
|
282
253
|
}
|
|
283
254
|
}
|
|
255
|
+
function thinkingToWireBlock(part) {
|
|
256
|
+
return part.signature === void 0 ? void 0 : { type: "thinking", thinking: part.text, signature: part.signature };
|
|
257
|
+
}
|
|
258
|
+
function partToWireBlock(part) {
|
|
259
|
+
if (part.type === "text") return { type: "text", text: part.text };
|
|
260
|
+
if (part.type === "tool_use") {
|
|
261
|
+
return { type: "tool_use", id: part.id, name: part.name, input: part.input };
|
|
262
|
+
}
|
|
263
|
+
if (part.type === "image") return { type: "image", source: part.source };
|
|
264
|
+
if (part.type === "thinking") return thinkingToWireBlock(part);
|
|
265
|
+
return {
|
|
266
|
+
type: "tool_result",
|
|
267
|
+
tool_use_id: part.toolUseId,
|
|
268
|
+
// SE7 — this wire is block-capable: strings pass through, structured
|
|
269
|
+
// text/image blocks are forwarded natively.
|
|
270
|
+
content: toBlockToolResultContent(part.content),
|
|
271
|
+
...part.isError === true ? { is_error: true } : {}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
284
274
|
function toAnthropicWireMessage(message) {
|
|
285
275
|
const role = message.role === "system" ? "user" : message.role;
|
|
286
|
-
const content = message.content.map((
|
|
287
|
-
if (part.type === "text") return { type: "text", text: part.text };
|
|
288
|
-
if (part.type === "tool_use") {
|
|
289
|
-
return { type: "tool_use", id: part.id, name: part.name, input: part.input };
|
|
290
|
-
}
|
|
291
|
-
if (part.type === "image") {
|
|
292
|
-
return { type: "image", source: part.source };
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
type: "tool_result",
|
|
296
|
-
tool_use_id: part.toolUseId,
|
|
297
|
-
// SE7 — this wire is block-capable: strings pass through, structured
|
|
298
|
-
// text/image blocks are forwarded natively.
|
|
299
|
-
content: toBlockToolResultContent(part.content),
|
|
300
|
-
...part.isError === true ? { is_error: true } : {}
|
|
301
|
-
};
|
|
302
|
-
});
|
|
276
|
+
const content = message.content.map(partToWireBlock).filter((b) => b !== void 0);
|
|
303
277
|
return { role, content };
|
|
304
278
|
}
|
|
305
279
|
function postAnthropicRequest(args) {
|
|
@@ -343,11 +317,21 @@ async function parseHttpErrorBody(response) {
|
|
|
343
317
|
return text;
|
|
344
318
|
}
|
|
345
319
|
}
|
|
320
|
+
function thinkingBudgetTokens(effort) {
|
|
321
|
+
if (effort === "low" || effort === "minimal") return 1024;
|
|
322
|
+
if (effort === "high" || effort === "max") return 16384;
|
|
323
|
+
return 4096;
|
|
324
|
+
}
|
|
346
325
|
function buildAnthropicCommonBody(request) {
|
|
347
326
|
const body = {
|
|
348
327
|
max_tokens: request.maxTokens ?? 4096,
|
|
349
328
|
messages: request.messages.map(toAnthropicWireMessage)
|
|
350
329
|
};
|
|
330
|
+
if (request.reasoning?.effort !== void 0) {
|
|
331
|
+
const budget = thinkingBudgetTokens(request.reasoning.effort);
|
|
332
|
+
body.thinking = { type: "enabled", budget_tokens: budget };
|
|
333
|
+
if (body.max_tokens <= budget) body.max_tokens = budget + 4096;
|
|
334
|
+
}
|
|
351
335
|
const wireSystem = encodeAnthropicSystem(request.system);
|
|
352
336
|
if (wireSystem !== void 0) body.system = wireSystem;
|
|
353
337
|
if (request.temperature !== void 0) body.temperature = request.temperature;
|
|
@@ -568,9 +552,17 @@ var AnthropicStreamAccumulator = class {
|
|
|
568
552
|
cacheWriteTokens;
|
|
569
553
|
toolCalls = /* @__PURE__ */ new Map();
|
|
570
554
|
toolBuffers = /* @__PURE__ */ new Map();
|
|
555
|
+
/**
|
|
556
|
+
* theokit#122 — the turn's thinking block. Text accumulates across `thinking_delta`s; the
|
|
557
|
+
* signature arrives once, on a `signature_delta` for the same block. Undefined until the model
|
|
558
|
+
* actually opens a thinking block, so a non-thinking turn reports nothing.
|
|
559
|
+
*/
|
|
560
|
+
thinking;
|
|
571
561
|
consume(event) {
|
|
572
562
|
if (event.type === "content_block_start") {
|
|
573
|
-
|
|
563
|
+
const block = event.content_block;
|
|
564
|
+
if (block.type === "thinking") this.handleThinkingStart(event);
|
|
565
|
+
else this.handleToolStart(event);
|
|
574
566
|
return [];
|
|
575
567
|
}
|
|
576
568
|
if (event.type === "content_block_delta") {
|
|
@@ -591,12 +583,31 @@ var AnthropicStreamAccumulator = class {
|
|
|
591
583
|
});
|
|
592
584
|
this.toolBuffers.set(start.index, "");
|
|
593
585
|
}
|
|
586
|
+
handleThinkingStart(start) {
|
|
587
|
+
this.thinking = {
|
|
588
|
+
text: start.content_block.thinking ?? "",
|
|
589
|
+
...start.content_block.signature !== void 0 ? { signature: start.content_block.signature } : {}
|
|
590
|
+
};
|
|
591
|
+
}
|
|
594
592
|
handleContentDelta(delta) {
|
|
595
593
|
if (delta.delta.type === "text_delta") {
|
|
596
594
|
const text = delta.delta.text;
|
|
597
595
|
this.text += text;
|
|
598
596
|
return [{ type: "text_delta", text }];
|
|
599
597
|
}
|
|
598
|
+
if (delta.delta.type === "thinking_delta") {
|
|
599
|
+
const text = delta.delta.thinking;
|
|
600
|
+
this.thinking = {
|
|
601
|
+
...this.thinking ?? { text: "" },
|
|
602
|
+
text: (this.thinking?.text ?? "") + text
|
|
603
|
+
};
|
|
604
|
+
return [{ type: "reasoning_delta", text }];
|
|
605
|
+
}
|
|
606
|
+
if (delta.delta.type === "signature_delta") {
|
|
607
|
+
const signature = delta.delta.signature;
|
|
608
|
+
this.thinking = { text: this.thinking?.text ?? "", signature };
|
|
609
|
+
return [{ type: "reasoning_delta", text: "", signature }];
|
|
610
|
+
}
|
|
600
611
|
const idx = delta.index;
|
|
601
612
|
const existing = this.toolBuffers.get(idx) ?? "";
|
|
602
613
|
this.toolBuffers.set(idx, existing + delta.delta.partial_json);
|
|
@@ -642,7 +653,9 @@ var AnthropicStreamAccumulator = class {
|
|
|
642
653
|
// T3.8 — surface Anthropic native cache-token counters when the
|
|
643
654
|
// request used `cache_control: {type:"ephemeral"}` on system blocks.
|
|
644
655
|
cacheReadTokens: this.cacheReadTokens,
|
|
645
|
-
cacheWriteTokens: this.cacheWriteTokens
|
|
656
|
+
cacheWriteTokens: this.cacheWriteTokens,
|
|
657
|
+
// theokit#122 — carry the thinking block + its signature so the turn can be replayed.
|
|
658
|
+
...this.thinking !== void 0 ? { thinking: { type: "thinking", ...this.thinking } } : {}
|
|
646
659
|
});
|
|
647
660
|
}
|
|
648
661
|
};
|
|
@@ -786,69 +799,6 @@ function buildBedrockBody(request) {
|
|
|
786
799
|
};
|
|
787
800
|
}
|
|
788
801
|
|
|
789
|
-
// src/internal/error-mappers/openai-compatible.ts
|
|
790
|
-
function mapOpenAICompatibleError(args) {
|
|
791
|
-
const { providerId, status, body, headers, endpoint } = args;
|
|
792
|
-
const code = mapOpenAiStatusToCode(status, body);
|
|
793
|
-
const message = formatMessage2(providerId, status, code);
|
|
794
|
-
const metadata = buildErrorMetadata({
|
|
795
|
-
provider: providerId,
|
|
796
|
-
endpoint,
|
|
797
|
-
code,
|
|
798
|
-
status,
|
|
799
|
-
headers,
|
|
800
|
-
body
|
|
801
|
-
});
|
|
802
|
-
if (status === 401 || status === 403) {
|
|
803
|
-
return new AuthenticationError(message, { code: `${providerId}_auth_failed`, metadata });
|
|
804
|
-
}
|
|
805
|
-
if (status === 429) {
|
|
806
|
-
return new RateLimitError(message, { code: `${providerId}_rate_limit`, metadata });
|
|
807
|
-
}
|
|
808
|
-
if (status === 400) {
|
|
809
|
-
return new ConfigurationError(message, { code: `${providerId}_${code}`, metadata });
|
|
810
|
-
}
|
|
811
|
-
if (status === 408) {
|
|
812
|
-
return new NetworkError(message, { code: `${providerId}_timeout`, metadata });
|
|
813
|
-
}
|
|
814
|
-
if (status >= 500 && status < 600) {
|
|
815
|
-
return new NetworkError(message, { code: `${providerId}_server_error`, metadata });
|
|
816
|
-
}
|
|
817
|
-
return new UnknownAgentError(message, { code: `${providerId}_unknown`, metadata });
|
|
818
|
-
}
|
|
819
|
-
function extractOpenAiErrorCode(body) {
|
|
820
|
-
if (body === null || typeof body !== "object") return void 0;
|
|
821
|
-
const err = body.error;
|
|
822
|
-
if (err === void 0 || err === null) return void 0;
|
|
823
|
-
if (typeof err.code === "string") return err.code;
|
|
824
|
-
if (typeof err.type === "string") return err.type;
|
|
825
|
-
return void 0;
|
|
826
|
-
}
|
|
827
|
-
function mapOpenAiStatusToCode(status, body) {
|
|
828
|
-
const rawCode = extractOpenAiErrorCode(body)?.toLowerCase() ?? "";
|
|
829
|
-
if (rawCode.includes("context_length") || rawCode.includes("context_window") || rawCode.includes("too_many_tokens") || rawCode.includes("max_tokens")) {
|
|
830
|
-
return "context_too_long";
|
|
831
|
-
}
|
|
832
|
-
if (rawCode.includes("content_filter") || rawCode.includes("content_policy") || rawCode.includes("safety")) {
|
|
833
|
-
return "content_filtered";
|
|
834
|
-
}
|
|
835
|
-
if (rawCode.includes("model_not_found") || rawCode.includes("model_unavailable") || rawCode.includes("invalid_model")) {
|
|
836
|
-
return "model_unavailable";
|
|
837
|
-
}
|
|
838
|
-
if (status === 402 || rawCode.includes("insufficient_quota") || rawCode.includes("quota_exceeded")) {
|
|
839
|
-
return "quota_exceeded";
|
|
840
|
-
}
|
|
841
|
-
if (status === 401 || status === 403) return "auth_failed";
|
|
842
|
-
if (status === 429) return "rate_limit";
|
|
843
|
-
if (status === 408) return "timeout";
|
|
844
|
-
if (status === 400) return "invalid_request";
|
|
845
|
-
if (status >= 500 && status < 600) return "server_error";
|
|
846
|
-
return "unknown";
|
|
847
|
-
}
|
|
848
|
-
function formatMessage2(providerId, status, code) {
|
|
849
|
-
return `${providerId} API error: ${code} (HTTP ${status})`;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
802
|
// src/internal/llm/fault-injection.ts
|
|
853
803
|
var ENV_GATE_KEY = "NODE_ENV";
|
|
854
804
|
var ENV_GATE_VALUE = "test";
|
|
@@ -888,7 +838,6 @@ var FaultInjectingLlmClient = class {
|
|
|
888
838
|
}
|
|
889
839
|
const text = extractText(parsed.body);
|
|
890
840
|
yield { type: "text_delta", text };
|
|
891
|
-
yield { type: "stop", reason: "end_turn" };
|
|
892
841
|
return {
|
|
893
842
|
stopReason: "end_turn",
|
|
894
843
|
text,
|
|
@@ -2247,7 +2196,6 @@ var ResponsesApiClient = class {
|
|
|
2247
2196
|
};
|
|
2248
2197
|
toolCalls.push(call);
|
|
2249
2198
|
delete pending[id];
|
|
2250
|
-
yield { type: "tool_use", id: call.id, name: call.name, input: call.input };
|
|
2251
2199
|
} else if (t === "response.completed" || t === "response.incomplete") {
|
|
2252
2200
|
const usage = event.response?.usage;
|
|
2253
2201
|
if (usage !== void 0) {
|
|
@@ -2270,7 +2218,6 @@ var ResponsesApiClient = class {
|
|
|
2270
2218
|
}
|
|
2271
2219
|
}
|
|
2272
2220
|
if (toolCalls.length > 0 && stopReason === "end_turn") stopReason = "tool_use";
|
|
2273
|
-
yield { type: "stop", reason: stopReason };
|
|
2274
2221
|
return makeLlmFinish({
|
|
2275
2222
|
stopReason,
|
|
2276
2223
|
text,
|
|
@@ -2289,32 +2236,32 @@ function abortError2(signal) {
|
|
|
2289
2236
|
}
|
|
2290
2237
|
|
|
2291
2238
|
// src/internal/llm/retrying-client.ts
|
|
2292
|
-
var
|
|
2293
|
-
function
|
|
2239
|
+
var MAX_ATTEMPTS = 3;
|
|
2240
|
+
function isRetriableError(err) {
|
|
2294
2241
|
if (!isTransientError(err)) return false;
|
|
2295
2242
|
if (err instanceof CredentialPoolExhaustedError) return false;
|
|
2296
2243
|
if (err instanceof TheokitAgentError && err.code === "circuit_open") return false;
|
|
2297
2244
|
if (err instanceof RateLimitError && err.metadata?.statusCode === 402) return false;
|
|
2298
2245
|
return true;
|
|
2299
2246
|
}
|
|
2300
|
-
function
|
|
2247
|
+
function retryAfterHintMs(err) {
|
|
2301
2248
|
if (!(err instanceof RateLimitError)) return void 0;
|
|
2302
|
-
const
|
|
2303
|
-
return typeof
|
|
2249
|
+
const seconds = err.metadata?.retryAfter;
|
|
2250
|
+
return typeof seconds === "number" && seconds > 0 ? seconds * 1e3 : void 0;
|
|
2304
2251
|
}
|
|
2305
|
-
async function*
|
|
2306
|
-
let
|
|
2307
|
-
while (
|
|
2308
|
-
|
|
2309
|
-
yield
|
|
2310
|
-
|
|
2252
|
+
async function* consume(gen, state) {
|
|
2253
|
+
let step = await gen.next();
|
|
2254
|
+
while (step.done !== true) {
|
|
2255
|
+
state.emitted = true;
|
|
2256
|
+
yield step.value;
|
|
2257
|
+
step = await gen.next();
|
|
2311
2258
|
}
|
|
2312
|
-
return
|
|
2259
|
+
return step.value;
|
|
2313
2260
|
}
|
|
2314
|
-
function
|
|
2315
|
-
if (
|
|
2316
|
-
if (
|
|
2317
|
-
return
|
|
2261
|
+
function canRetry(err, emitted, attempt) {
|
|
2262
|
+
if (emitted) return false;
|
|
2263
|
+
if (attempt === MAX_ATTEMPTS - 1) return false;
|
|
2264
|
+
return isRetriableError(err);
|
|
2318
2265
|
}
|
|
2319
2266
|
var RetryingLlmClient = class {
|
|
2320
2267
|
#inner;
|
|
@@ -2324,10 +2271,10 @@ var RetryingLlmClient = class {
|
|
|
2324
2271
|
this.#rng = opts?.rng;
|
|
2325
2272
|
}
|
|
2326
2273
|
/**
|
|
2327
|
-
*
|
|
2328
|
-
*
|
|
2329
|
-
* decorators.
|
|
2330
|
-
*
|
|
2274
|
+
* The decorated client. Public by the same convention as `FaultInjectingLlmClient.inner`: the
|
|
2275
|
+
* router's wiring tests assert `instanceof PoolAwareLlmClient` and need to see through the
|
|
2276
|
+
* decorators. Without this, adding a decorator breaks tests whose intent is still valid — which is
|
|
2277
|
+
* exactly what M93 did to 4 pre-existing tests.
|
|
2331
2278
|
*/
|
|
2332
2279
|
get inner() {
|
|
2333
2280
|
return this.#inner;
|
|
@@ -2336,35 +2283,35 @@ var RetryingLlmClient = class {
|
|
|
2336
2283
|
return this.#inner.name;
|
|
2337
2284
|
}
|
|
2338
2285
|
/**
|
|
2339
|
-
*
|
|
2286
|
+
* Waits out attempt `n`'s backoff, honoring the provider's `Retry-After` when one arrived.
|
|
2340
2287
|
*
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2343
|
-
* `stream`
|
|
2288
|
+
* Its own method because `stream` is a generator with a nested loop, and inlining the conditional
|
|
2289
|
+
* option assembly here pushed cognitive complexity to 19 (project ceiling: 10). The body of
|
|
2290
|
+
* `stream` stays nothing but the attempt machine.
|
|
2344
2291
|
*/
|
|
2345
|
-
async #
|
|
2346
|
-
const
|
|
2292
|
+
async #waitBackoff(err, attempt, signal) {
|
|
2293
|
+
const hint = retryAfterHintMs(err);
|
|
2347
2294
|
const ms = computeBackoffMs({
|
|
2348
|
-
attempt
|
|
2349
|
-
...
|
|
2295
|
+
attempt,
|
|
2296
|
+
...hint !== void 0 ? { retryAfterMs: hint } : {},
|
|
2350
2297
|
...this.#rng !== void 0 ? { rng: this.#rng } : {}
|
|
2351
2298
|
});
|
|
2352
2299
|
await sleepWithAbort(ms, signal);
|
|
2353
2300
|
}
|
|
2354
2301
|
async *stream(request, signal) {
|
|
2355
|
-
let
|
|
2356
|
-
for (let
|
|
2357
|
-
if (signal.aborted) throw
|
|
2358
|
-
const
|
|
2302
|
+
let lastError;
|
|
2303
|
+
for (let attempt = 0; attempt < MAX_ATTEMPTS; attempt++) {
|
|
2304
|
+
if (signal.aborted) throw lastError ?? abortError2(signal);
|
|
2305
|
+
const state = { emitted: false };
|
|
2359
2306
|
try {
|
|
2360
|
-
return yield*
|
|
2307
|
+
return yield* consume(this.#inner.stream(request, signal), state);
|
|
2361
2308
|
} catch (err) {
|
|
2362
|
-
|
|
2363
|
-
if (!
|
|
2364
|
-
await this.#
|
|
2309
|
+
lastError = err;
|
|
2310
|
+
if (!canRetry(err, state.emitted, attempt)) throw err;
|
|
2311
|
+
await this.#waitBackoff(err, attempt, signal);
|
|
2365
2312
|
}
|
|
2366
2313
|
}
|
|
2367
|
-
throw
|
|
2314
|
+
throw lastError ?? new Error("retries exhausted with no recorded error");
|
|
2368
2315
|
}
|
|
2369
2316
|
};
|
|
2370
2317
|
|
|
@@ -2743,13 +2690,13 @@ function selectTransport(profile, apiKey) {
|
|
|
2743
2690
|
const ctx = { apiKey };
|
|
2744
2691
|
return { fetch: profile.transform.fetch?.(ctx), headers: profile.transform.headers?.(ctx) };
|
|
2745
2692
|
};
|
|
2746
|
-
const comTransform = (opts,
|
|
2693
|
+
const comTransform = (opts, construct) => {
|
|
2747
2694
|
const t = applyTransform();
|
|
2748
2695
|
assertOAuthResolved(t);
|
|
2749
2696
|
if (t.fetch !== void 0) opts.fetch = t.fetch;
|
|
2750
2697
|
const merged = profile.extraHeaders !== void 0 || t.headers !== void 0 ? { ...profile.extraHeaders, ...t.headers } : void 0;
|
|
2751
2698
|
if (merged !== void 0) opts.extraHeaders = merged;
|
|
2752
|
-
return
|
|
2699
|
+
return construct(opts);
|
|
2753
2700
|
};
|
|
2754
2701
|
const assertOAuthResolved = (t) => {
|
|
2755
2702
|
if (apiKey !== "__oauth_lazy_token__") return;
|
|
@@ -3088,6 +3035,6 @@ async function autoCompactIfNeeded(opts) {
|
|
|
3088
3035
|
}
|
|
3089
3036
|
}
|
|
3090
3037
|
|
|
3091
|
-
export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CircuitBreaker, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, detectPrimaryProvider, discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, inferProviderFromApiKey, isCompactSummary, isFixtureApiKey, mapOllamaHttpError, mapOllamaTransportError,
|
|
3092
|
-
//# sourceMappingURL=chunk-
|
|
3093
|
-
//# sourceMappingURL=chunk-
|
|
3038
|
+
export { COMPACT_SUMMARY_MARKER, COMPACT_USER_MESSAGE_MAX_TOKENS, CircuitBreaker, autoCompactIfNeeded, buildDefaultSummarizer, compactSessionTranscript, detectPrimaryProvider, discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, inferProviderFromApiKey, isCompactSummary, isFixtureApiKey, mapOllamaHttpError, mapOllamaTransportError, parseSseStream, readErrorResponseBody, relayStream, renderToolResultContentText, resolveProviderChain, resolveSummarizerRoute, shouldAutoCompact, shouldUseFixtureMode, shouldUseRealLocalRuntime, tryFirstEvent };
|
|
3039
|
+
//# sourceMappingURL=chunk-ZYB6B7QJ.js.map
|
|
3040
|
+
//# sourceMappingURL=chunk-ZYB6B7QJ.js.map
|