@theokit/sdk 4.24.0 → 4.26.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/dist/a2a/index.cjs +10 -171
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.js +3 -170
- package/dist/a2a/index.js.map +1 -1
- package/dist/agent-factory-registry-UU46BUMU.cjs +16 -0
- package/dist/agent-factory-registry-UU46BUMU.cjs.map +1 -0
- package/dist/agent-factory-registry-ZVTABLEY.js +3 -0
- package/dist/agent-factory-registry-ZVTABLEY.js.map +1 -0
- package/dist/auth/index.cjs +63 -367
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +6 -342
- package/dist/auth/index.js.map +1 -1
- package/dist/batch-2FSD2UNL.cjs +244 -0
- package/dist/batch-2FSD2UNL.cjs.map +1 -0
- package/dist/batch-MR2HKYMS.js +241 -0
- package/dist/batch-MR2HKYMS.js.map +1 -0
- package/dist/chunk-2HRYBRD7.cjs +31 -0
- package/dist/chunk-2HRYBRD7.cjs.map +1 -0
- package/dist/chunk-2MF3IE2D.cjs +2863 -0
- package/dist/chunk-2MF3IE2D.cjs.map +1 -0
- package/dist/chunk-2ONFGMBV.js +6 -0
- package/dist/chunk-2ONFGMBV.js.map +1 -0
- package/dist/chunk-2SFBB54R.js +23 -0
- package/dist/chunk-2SFBB54R.js.map +1 -0
- package/dist/chunk-2XLKLVVR.js +18 -0
- package/dist/chunk-2XLKLVVR.js.map +1 -0
- package/dist/chunk-4SXHEZIV.cjs +240 -0
- package/dist/chunk-4SXHEZIV.cjs.map +1 -0
- package/dist/chunk-4VPXM6UU.js +10 -0
- package/dist/chunk-4VPXM6UU.js.map +1 -0
- package/dist/chunk-4WL52CXU.cjs +148 -0
- package/dist/chunk-4WL52CXU.cjs.map +1 -0
- package/dist/chunk-5NBUH3NO.js +39 -0
- package/dist/chunk-5NBUH3NO.js.map +1 -0
- package/dist/chunk-5PZMMF4H.js +43 -0
- package/dist/chunk-5PZMMF4H.js.map +1 -0
- package/dist/chunk-6CLRANZA.js +289 -0
- package/dist/chunk-6CLRANZA.js.map +1 -0
- package/dist/chunk-6JSIEDKL.cjs +121 -0
- package/dist/chunk-6JSIEDKL.cjs.map +1 -0
- package/dist/chunk-6M4ODB2V.cjs +145 -0
- package/dist/chunk-6M4ODB2V.cjs.map +1 -0
- package/dist/chunk-6X6ID4MO.js +20 -0
- package/dist/chunk-6X6ID4MO.js.map +1 -0
- package/dist/chunk-77FOZCOT.js +165 -0
- package/dist/chunk-77FOZCOT.js.map +1 -0
- package/dist/chunk-7AD3ZTZL.js +25 -0
- package/dist/chunk-7AD3ZTZL.js.map +1 -0
- package/dist/chunk-7GFX45DD.js +57 -0
- package/dist/chunk-7GFX45DD.js.map +1 -0
- package/dist/chunk-7S7KKUO6.cjs +45 -0
- package/dist/chunk-7S7KKUO6.cjs.map +1 -0
- package/dist/chunk-7W7ZWMLQ.js +99 -0
- package/dist/chunk-7W7ZWMLQ.js.map +1 -0
- package/dist/chunk-A44COQJJ.cjs +353 -0
- package/dist/chunk-A44COQJJ.cjs.map +1 -0
- package/dist/chunk-AKSBP7OO.js +185 -0
- package/dist/chunk-AKSBP7OO.js.map +1 -0
- package/dist/chunk-ANIZEWTU.cjs +196 -0
- package/dist/chunk-ANIZEWTU.cjs.map +1 -0
- package/dist/chunk-BEURCLDV.cjs +139 -0
- package/dist/chunk-BEURCLDV.cjs.map +1 -0
- package/dist/chunk-BFWPZMG7.js +379 -0
- package/dist/chunk-BFWPZMG7.js.map +1 -0
- package/dist/chunk-BUUUWQMB.cjs +34 -0
- package/dist/chunk-BUUUWQMB.cjs.map +1 -0
- package/dist/chunk-BV2MWEMV.cjs +26 -0
- package/dist/chunk-BV2MWEMV.cjs.map +1 -0
- package/dist/chunk-BWT67BI4.cjs +268 -0
- package/dist/chunk-BWT67BI4.cjs.map +1 -0
- package/dist/chunk-BXV2QUIC.js +191 -0
- package/dist/chunk-BXV2QUIC.js.map +1 -0
- package/dist/chunk-C6Y6CWYD.cjs +44 -0
- package/dist/chunk-C6Y6CWYD.cjs.map +1 -0
- package/dist/chunk-C7PICHRF.cjs +68 -0
- package/dist/chunk-C7PICHRF.cjs.map +1 -0
- package/dist/chunk-CAH3G4IS.js +13 -0
- package/dist/chunk-CAH3G4IS.js.map +1 -0
- package/dist/chunk-D42XHI4O.cjs +565 -0
- package/dist/chunk-D42XHI4O.cjs.map +1 -0
- package/dist/chunk-DGRZNMTU.js +104 -0
- package/dist/chunk-DGRZNMTU.js.map +1 -0
- package/dist/chunk-DUK5WMKJ.js +71 -0
- package/dist/chunk-DUK5WMKJ.js.map +1 -0
- package/dist/chunk-EEZ7CFMM.js +14 -0
- package/dist/chunk-EEZ7CFMM.js.map +1 -0
- package/dist/chunk-EPYZOCOL.cjs +82 -0
- package/dist/chunk-EPYZOCOL.cjs.map +1 -0
- package/dist/chunk-EVADEGM7.cjs +168 -0
- package/dist/chunk-EVADEGM7.cjs.map +1 -0
- package/dist/chunk-FD2UT76F.js +3 -0
- package/dist/chunk-FD2UT76F.js.map +1 -0
- package/dist/chunk-FV3YEMQ7.js +179 -0
- package/dist/chunk-FV3YEMQ7.js.map +1 -0
- package/dist/chunk-G2F67XUR.cjs +184 -0
- package/dist/chunk-G2F67XUR.cjs.map +1 -0
- package/dist/chunk-G6GO6BXD.js +994 -0
- package/dist/chunk-G6GO6BXD.js.map +1 -0
- package/dist/chunk-GIW4L6HY.cjs +27 -0
- package/dist/chunk-GIW4L6HY.cjs.map +1 -0
- package/dist/chunk-GJAGKFTR.js +74 -0
- package/dist/chunk-GJAGKFTR.js.map +1 -0
- package/dist/chunk-HFPGOTVF.cjs +324 -0
- package/dist/chunk-HFPGOTVF.cjs.map +1 -0
- package/dist/chunk-HRA3CPGG.js +486 -0
- package/dist/chunk-HRA3CPGG.js.map +1 -0
- package/dist/chunk-HZQEDNF6.js +66 -0
- package/dist/chunk-HZQEDNF6.js.map +1 -0
- package/dist/chunk-IT3PWBW4.cjs +19 -0
- package/dist/chunk-IT3PWBW4.cjs.map +1 -0
- package/dist/chunk-JD74LN7R.cjs +171 -0
- package/dist/chunk-JD74LN7R.cjs.map +1 -0
- package/dist/chunk-JTFYYKDT.js +135 -0
- package/dist/chunk-JTFYYKDT.js.map +1 -0
- package/dist/chunk-K2BQQ445.js +30 -0
- package/dist/chunk-K2BQQ445.js.map +1 -0
- package/dist/chunk-KAP4GJHO.js +546 -0
- package/dist/chunk-KAP4GJHO.js.map +1 -0
- package/dist/chunk-KDNBTPY2.js +458 -0
- package/dist/chunk-KDNBTPY2.js.map +1 -0
- package/dist/chunk-KIO7QFIV.cjs +223 -0
- package/dist/chunk-KIO7QFIV.cjs.map +1 -0
- package/dist/chunk-KSKU6JY6.cjs +71 -0
- package/dist/chunk-KSKU6JY6.cjs.map +1 -0
- package/dist/chunk-LSLPF6OI.cjs +192 -0
- package/dist/chunk-LSLPF6OI.cjs.map +1 -0
- package/dist/chunk-LU7VALW5.js +312 -0
- package/dist/chunk-LU7VALW5.js.map +1 -0
- package/dist/chunk-LUSXDZPV.cjs +296 -0
- package/dist/chunk-LUSXDZPV.cjs.map +1 -0
- package/dist/chunk-M72RJVPC.js +69 -0
- package/dist/chunk-M72RJVPC.js.map +1 -0
- package/dist/chunk-MQLCZ4HJ.cjs +1010 -0
- package/dist/chunk-MQLCZ4HJ.cjs.map +1 -0
- package/dist/chunk-MUUQ2WFJ.cjs +4 -0
- package/dist/chunk-MUUQ2WFJ.cjs.map +1 -0
- package/dist/chunk-MZ5ZRORA.cjs +496 -0
- package/dist/chunk-MZ5ZRORA.cjs.map +1 -0
- package/dist/chunk-N24XBYNX.cjs +140 -0
- package/dist/chunk-N24XBYNX.cjs.map +1 -0
- package/dist/chunk-NINIJCHU.cjs +23 -0
- package/dist/chunk-NINIJCHU.cjs.map +1 -0
- package/dist/chunk-NRSH7RJY.js +2841 -0
- package/dist/chunk-NRSH7RJY.js.map +1 -0
- package/dist/chunk-OIYQBUW4.cjs +111 -0
- package/dist/chunk-OIYQBUW4.cjs.map +1 -0
- package/dist/chunk-PNVDQL5Y.cjs +15 -0
- package/dist/chunk-PNVDQL5Y.cjs.map +1 -0
- package/dist/chunk-POQT2OIF.js +214 -0
- package/dist/chunk-POQT2OIF.js.map +1 -0
- package/dist/chunk-PSJN532Q.js +10573 -0
- package/dist/chunk-PSJN532Q.js.map +1 -0
- package/dist/chunk-QUTUJ6P6.cjs +76 -0
- package/dist/chunk-QUTUJ6P6.cjs.map +1 -0
- package/dist/chunk-R43CNCES.cjs +460 -0
- package/dist/chunk-R43CNCES.cjs.map +1 -0
- package/dist/chunk-S2BBRVQX.js +68 -0
- package/dist/chunk-S2BBRVQX.js.map +1 -0
- package/dist/chunk-S5RCBTSF.js +145 -0
- package/dist/chunk-S5RCBTSF.js.map +1 -0
- package/dist/chunk-S7OEXQMI.cjs +136 -0
- package/dist/chunk-S7OEXQMI.cjs.map +1 -0
- package/dist/chunk-SKWVAQAY.js +129 -0
- package/dist/chunk-SKWVAQAY.js.map +1 -0
- package/dist/chunk-SQLZ7ONU.js +152 -0
- package/dist/chunk-SQLZ7ONU.js.map +1 -0
- package/dist/chunk-TIZ4TS5V.cjs +72 -0
- package/dist/chunk-TIZ4TS5V.cjs.map +1 -0
- package/dist/chunk-TQKCU7CL.js +142 -0
- package/dist/chunk-TQKCU7CL.js.map +1 -0
- package/dist/chunk-U54XCYG3.js +116 -0
- package/dist/chunk-U54XCYG3.js.map +1 -0
- package/dist/chunk-U6QGZHPN.js +29 -0
- package/dist/chunk-U6QGZHPN.js.map +1 -0
- package/dist/chunk-UCFONJBG.js +79 -0
- package/dist/chunk-UCFONJBG.js.map +1 -0
- package/dist/chunk-UJ7IQJAG.js +141 -0
- package/dist/chunk-UJ7IQJAG.js.map +1 -0
- package/dist/chunk-UVNG67DG.js +253 -0
- package/dist/chunk-UVNG67DG.js.map +1 -0
- package/dist/chunk-V4XRLPEF.js +25 -0
- package/dist/chunk-V4XRLPEF.js.map +1 -0
- package/dist/chunk-VJ26EKGJ.cjs +28 -0
- package/dist/chunk-VJ26EKGJ.cjs.map +1 -0
- package/dist/chunk-VK7MAV65.cjs +90 -0
- package/dist/chunk-VK7MAV65.cjs.map +1 -0
- package/dist/chunk-VYCKUKPA.cjs +106 -0
- package/dist/chunk-VYCKUKPA.cjs.map +1 -0
- package/dist/chunk-VYHJZVL5.cjs +29 -0
- package/dist/chunk-VYHJZVL5.cjs.map +1 -0
- package/dist/chunk-WA3FO4R7.js +155 -0
- package/dist/chunk-WA3FO4R7.js.map +1 -0
- package/dist/chunk-WJVHMTKB.cjs +12 -0
- package/dist/chunk-WJVHMTKB.cjs.map +1 -0
- package/dist/chunk-WLKFWQSJ.js +333 -0
- package/dist/chunk-WLKFWQSJ.js.map +1 -0
- package/dist/chunk-WPZTYOUX.cjs +59 -0
- package/dist/chunk-WPZTYOUX.cjs.map +1 -0
- package/dist/chunk-X2FR4OIT.js +27 -0
- package/dist/chunk-X2FR4OIT.js.map +1 -0
- package/dist/chunk-XIG2IE3L.js +134 -0
- package/dist/chunk-XIG2IE3L.js.map +1 -0
- package/dist/chunk-YLQQX5W2.cjs +20 -0
- package/dist/chunk-YLQQX5W2.cjs.map +1 -0
- package/dist/chunk-YPEPCZHF.cjs +147 -0
- package/dist/chunk-YPEPCZHF.cjs.map +1 -0
- package/dist/chunk-YPQF26X7.cjs +8 -0
- package/dist/chunk-YPQF26X7.cjs.map +1 -0
- package/dist/chunk-YU6KON2I.cjs +160 -0
- package/dist/chunk-YU6KON2I.cjs.map +1 -0
- package/dist/chunk-Z2OC3UIW.cjs +388 -0
- package/dist/chunk-Z2OC3UIW.cjs.map +1 -0
- package/dist/chunk-ZUBIEQJF.cjs +10590 -0
- package/dist/chunk-ZUBIEQJF.cjs.map +1 -0
- package/dist/chunk-ZZWTY3RX.js +230 -0
- package/dist/chunk-ZZWTY3RX.js.map +1 -0
- package/dist/compact-session-OO2GD76G.js +17 -0
- package/dist/compact-session-OO2GD76G.js.map +1 -0
- package/dist/compact-session-OO7NVWPB.cjs +54 -0
- package/dist/compact-session-OO7NVWPB.cjs.map +1 -0
- package/dist/compaction.cjs +54 -303
- package/dist/compaction.cjs.map +1 -1
- package/dist/compaction.js +3 -292
- package/dist/compaction.js.map +1 -1
- package/dist/concurrency.cjs +9 -81
- package/dist/concurrency.cjs.map +1 -1
- package/dist/concurrency.js +5 -80
- package/dist/concurrency.js.map +1 -1
- package/dist/context-GWANQLX4.js +5 -0
- package/dist/context-GWANQLX4.js.map +1 -0
- package/dist/context-KNWVTZSY.cjs +22 -0
- package/dist/context-KNWVTZSY.cjs.map +1 -0
- package/dist/{cron-x3muPNgg.d.cts → cron-D0JKR-yX.d.cts} +2 -1
- package/dist/{cron-B_NkE_VM.d.ts → cron-DivRaEmN.d.ts} +2 -1
- package/dist/cron.cjs +44 -20676
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.d.cts +1 -1
- package/dist/cron.d.ts +1 -1
- package/dist/cron.js +38 -20676
- package/dist/cron.js.map +1 -1
- package/dist/errors.cjs +78 -470
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +3 -424
- package/dist/errors.js +2 -455
- package/dist/errors.js.map +1 -1
- package/dist/eval.cjs +72 -20411
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +59 -20402
- package/dist/eval.js.map +1 -1
- package/dist/executor-ORJS5GV2.js +981 -0
- package/dist/executor-ORJS5GV2.js.map +1 -0
- package/dist/executor-Y4MKPIUD.cjs +985 -0
- package/dist/executor-Y4MKPIUD.cjs.map +1 -0
- package/dist/filesystem/index.cjs +7 -112
- package/dist/filesystem/index.cjs.map +1 -1
- package/dist/filesystem/index.js +4 -109
- package/dist/filesystem/index.js.map +1 -1
- package/dist/fork-agent-RSV4E3EA.js +61 -0
- package/dist/fork-agent-RSV4E3EA.js.map +1 -0
- package/dist/fork-agent-Y2IK2RYU.cjs +64 -0
- package/dist/fork-agent-Y2IK2RYU.cjs.map +1 -0
- package/dist/fs-session-store-KAUQYSGI.cjs +17 -0
- package/dist/fs-session-store-KAUQYSGI.cjs.map +1 -0
- package/dist/fs-session-store-ZKB5NN37.js +8 -0
- package/dist/fs-session-store-ZKB5NN37.js.map +1 -0
- package/dist/generate-object-H3RNAM6S.cjs +20 -0
- package/dist/generate-object-H3RNAM6S.cjs.map +1 -0
- package/dist/generate-object-YJPDV5BS.js +7 -0
- package/dist/generate-object-YJPDV5BS.js.map +1 -0
- package/dist/index-manager-CB6I7XFQ.cjs +19 -0
- package/dist/index-manager-CB6I7XFQ.cjs.map +1 -0
- package/dist/index-manager-L27Q3QAC.js +10 -0
- package/dist/index-manager-L27Q3QAC.js.map +1 -0
- package/dist/index.cjs +371 -22888
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -21
- package/dist/index.d.ts +16 -21
- package/dist/index.js +92 -22713
- package/dist/index.js.map +1 -1
- package/dist/inject-session-6MJUSGZP.cjs +27 -0
- package/dist/inject-session-6MJUSGZP.cjs.map +1 -0
- package/dist/inject-session-KOFHS5K3.js +25 -0
- package/dist/inject-session-KOFHS5K3.js.map +1 -0
- package/dist/internal/judge/judge-call.d.ts +32 -19
- package/dist/internal/persistence/index.cjs +93 -508
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +11 -489
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/security/index.cjs +44 -361
- package/dist/internal/security/index.cjs.map +1 -1
- package/dist/internal/security/index.js +4 -355
- package/dist/internal/security/index.js.map +1 -1
- package/dist/judge-call-CEQ3FYYD.js +126 -0
- package/dist/judge-call-CEQ3FYYD.js.map +1 -0
- package/dist/judge-call-QG4WZ7F3.cjs +130 -0
- package/dist/judge-call-QG4WZ7F3.cjs.map +1 -0
- package/dist/models.cjs +24 -919
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +11 -907
- package/dist/models.js.map +1 -1
- package/dist/oauth-transaction-store-7CKHPQRN.cjs +32 -0
- package/dist/oauth-transaction-store-7CKHPQRN.cjs.map +1 -0
- package/dist/oauth-transaction-store-W74I6EFD.js +3 -0
- package/dist/oauth-transaction-store-W74I6EFD.js.map +1 -0
- package/dist/path-safety.cjs +31 -200
- package/dist/path-safety.cjs.map +1 -1
- package/dist/path-safety.js +3 -197
- package/dist/path-safety.js.map +1 -1
- package/dist/persistence.cjs +73 -393
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +9 -381
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +8 -112
- package/dist/project.cjs.map +1 -1
- package/dist/project.js +6 -110
- package/dist/project.js.map +1 -1
- package/dist/registry-34IWWDQQ.js +9 -0
- package/dist/registry-34IWWDQQ.js.map +1 -0
- package/dist/registry-APYDISL6.cjs +46 -0
- package/dist/registry-APYDISL6.cjs.map +1 -0
- package/dist/retry.cjs +7 -87
- package/dist/retry.cjs.map +1 -1
- package/dist/retry.js +3 -90
- package/dist/retry.js.map +1 -1
- package/dist/run-to-completion-J73I6IY4.cjs +48 -0
- package/dist/run-to-completion-J73I6IY4.cjs.map +1 -0
- package/dist/run-to-completion-JDPIUKSH.js +3 -0
- package/dist/run-to-completion-JDPIUKSH.js.map +1 -0
- package/dist/run-until-PNO3QQLI.cjs +180 -0
- package/dist/run-until-PNO3QQLI.cjs.map +1 -0
- package/dist/run-until-XLHEHRQM.js +177 -0
- package/dist/run-until-XLHEHRQM.js.map +1 -0
- package/dist/sandbox/index.cjs +35 -337
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +7 -323
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sanitize/index.cjs +5 -112
- package/dist/sanitize/index.cjs.map +1 -1
- package/dist/sanitize/index.js +1 -114
- package/dist/sanitize/index.js.map +1 -1
- package/dist/server/auth/index.cjs +35 -175
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.js +7 -161
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/errors-envelope.cjs +17 -328
- package/dist/server/errors-envelope.cjs.map +1 -1
- package/dist/server/errors-envelope.js +4 -317
- package/dist/server/errors-envelope.js.map +1 -1
- package/dist/session-transcript-LPNZR3YS.cjs +46 -0
- package/dist/session-transcript-LPNZR3YS.cjs.map +1 -0
- package/dist/session-transcript-T7LGJUGW.js +5 -0
- package/dist/session-transcript-T7LGJUGW.js.map +1 -0
- package/dist/skills.cjs +12 -280
- package/dist/skills.cjs.map +1 -1
- package/dist/skills.js +4 -282
- package/dist/skills.js.map +1 -1
- package/dist/stream-object-QEQJJDTI.cjs +20 -0
- package/dist/stream-object-QEQJJDTI.cjs.map +1 -0
- package/dist/stream-object-WUQSSRY2.js +7 -0
- package/dist/stream-object-WUQSSRY2.js.map +1 -0
- package/dist/stream-to-completion-DFJ5T3BK.js +30 -0
- package/dist/stream-to-completion-DFJ5T3BK.js.map +1 -0
- package/dist/stream-to-completion-H2MHISSK.cjs +32 -0
- package/dist/stream-to-completion-H2MHISSK.cjs.map +1 -0
- package/dist/subagents.cjs +2 -8
- package/dist/subagents.cjs.map +1 -1
- package/dist/subagents.js +1 -7
- package/dist/subagents.js.map +1 -1
- package/dist/subscription/index.cjs +4 -17
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.js +3 -16
- package/dist/subscription/index.js.map +1 -1
- package/dist/task-store.cjs +16 -258
- package/dist/task-store.cjs.map +1 -1
- package/dist/task-store.js +4 -259
- package/dist/task-store.js.map +1 -1
- package/dist/types/goal-events.d.ts +2 -1
- package/dist/workflow.cjs +71 -2797
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.js +8 -2812
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import { resolveCredential, readStoredOAuth } from './chunk-LU7VALW5.js';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { homedir } from 'os';
|
|
7
|
+
|
|
8
|
+
// src/internal/global-singleton.ts
|
|
9
|
+
function globalSingleton(key, create) {
|
|
10
|
+
const g = globalThis;
|
|
11
|
+
const sym = Symbol.for(key);
|
|
12
|
+
if (g[sym] === void 0) g[sym] = create();
|
|
13
|
+
return g[sym];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/internal/providers/registry.ts
|
|
17
|
+
var REGISTRY = globalSingleton(
|
|
18
|
+
"theokit-sdk.providers.registry",
|
|
19
|
+
() => /* @__PURE__ */ new Map()
|
|
20
|
+
);
|
|
21
|
+
var ALIASES = globalSingleton("theokit-sdk.providers.aliases", () => /* @__PURE__ */ new Map());
|
|
22
|
+
function registerProvider(profile) {
|
|
23
|
+
if (REGISTRY.has(profile.name)) {
|
|
24
|
+
process.stderr.write(`[theokit-sdk] Provider "${profile.name}" overridden by user plugin.
|
|
25
|
+
`);
|
|
26
|
+
}
|
|
27
|
+
REGISTRY.set(profile.name, profile);
|
|
28
|
+
for (const alias of profile.aliases ?? []) {
|
|
29
|
+
const previous = ALIASES.get(alias);
|
|
30
|
+
if (previous !== void 0 && previous !== profile.name) {
|
|
31
|
+
process.stderr.write(
|
|
32
|
+
`[theokit-sdk] Alias "${alias}" collision: was "${previous}", now "${profile.name}".
|
|
33
|
+
`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
ALIASES.set(alias, profile.name);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getProviderProfile(name) {
|
|
40
|
+
const canonical = ALIASES.get(name) ?? name;
|
|
41
|
+
return REGISTRY.get(canonical);
|
|
42
|
+
}
|
|
43
|
+
function listProviders() {
|
|
44
|
+
return Array.from(REGISTRY.values());
|
|
45
|
+
}
|
|
46
|
+
var MODALITIES = ["text", "audio", "image", "video", "pdf"];
|
|
47
|
+
var costSchema = z.object({
|
|
48
|
+
/** USD per 1M tokens (models.dev convention). */
|
|
49
|
+
input: z.number().nonnegative(),
|
|
50
|
+
output: z.number().nonnegative(),
|
|
51
|
+
cache_read: z.number().nonnegative().optional(),
|
|
52
|
+
cache_write: z.number().nonnegative().optional()
|
|
53
|
+
}).loose();
|
|
54
|
+
var limitSchema = z.object({
|
|
55
|
+
context: z.number().positive(),
|
|
56
|
+
input: z.number().positive().optional(),
|
|
57
|
+
output: z.number().positive().optional()
|
|
58
|
+
}).loose();
|
|
59
|
+
var modalitiesSchema = z.object({
|
|
60
|
+
input: z.array(z.enum(MODALITIES)).optional(),
|
|
61
|
+
output: z.array(z.enum(MODALITIES)).optional()
|
|
62
|
+
}).loose();
|
|
63
|
+
var catalogModelSchema = z.object({
|
|
64
|
+
name: z.string().optional(),
|
|
65
|
+
release_date: z.string().optional(),
|
|
66
|
+
attachment: z.boolean().optional(),
|
|
67
|
+
reasoning: z.boolean().optional(),
|
|
68
|
+
temperature: z.boolean().optional(),
|
|
69
|
+
tool_call: z.boolean().optional(),
|
|
70
|
+
/** theokit extension — maps to ModelCapabilities.supportsStructuredOutput. */
|
|
71
|
+
structured_output: z.boolean().optional(),
|
|
72
|
+
/** theokit extension — maps to ModelCapabilities.supportsCacheControl. */
|
|
73
|
+
cache_control: z.boolean().optional(),
|
|
74
|
+
cost: costSchema.optional(),
|
|
75
|
+
limit: limitSchema.optional(),
|
|
76
|
+
modalities: modalitiesSchema.optional(),
|
|
77
|
+
status: z.enum(["alpha", "beta", "deprecated"]).optional()
|
|
78
|
+
}).loose();
|
|
79
|
+
|
|
80
|
+
// src/internal/providers/catalog-loader.ts
|
|
81
|
+
var __dirname_resolved = dirname(fileURLToPath(import.meta.url));
|
|
82
|
+
var modelInfoIndex = globalSingleton(
|
|
83
|
+
"theokit-sdk.providers.model-info-index",
|
|
84
|
+
() => /* @__PURE__ */ new Map()
|
|
85
|
+
);
|
|
86
|
+
var patchedModelKeys = globalSingleton(
|
|
87
|
+
"theokit-sdk.providers.model-info-patched",
|
|
88
|
+
() => /* @__PURE__ */ new Set()
|
|
89
|
+
);
|
|
90
|
+
var indexState = globalSingleton("theokit-sdk.providers.model-info-loaded", () => ({
|
|
91
|
+
loaded: false
|
|
92
|
+
}));
|
|
93
|
+
function getCatalogModelInfo(key) {
|
|
94
|
+
ensureModelIndexLoaded();
|
|
95
|
+
return modelInfoIndex.get(key);
|
|
96
|
+
}
|
|
97
|
+
function isPatchedModelKey(key) {
|
|
98
|
+
return patchedModelKeys.has(key);
|
|
99
|
+
}
|
|
100
|
+
function patchModelInfo(key, model) {
|
|
101
|
+
ensureModelIndexLoaded();
|
|
102
|
+
const existing = modelInfoIndex.get(key);
|
|
103
|
+
modelInfoIndex.set(key, existing === void 0 ? model : { ...existing, ...model });
|
|
104
|
+
patchedModelKeys.add(key);
|
|
105
|
+
}
|
|
106
|
+
function ensureModelIndexLoaded() {
|
|
107
|
+
if (indexState.loaded) return;
|
|
108
|
+
indexState.loaded = true;
|
|
109
|
+
try {
|
|
110
|
+
const catalog = loadProviderCatalog();
|
|
111
|
+
for (const entry of Object.values(catalog)) {
|
|
112
|
+
indexEntryModels(entry);
|
|
113
|
+
}
|
|
114
|
+
} catch (err) {
|
|
115
|
+
process.stderr.write(
|
|
116
|
+
`[theokit-sdk] WARN: provider catalog unavailable (${err.message}) \u2014 per-model data disabled
|
|
117
|
+
`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function indexEntryModels(entry) {
|
|
122
|
+
if (entry.models === void 0 || typeof entry.models !== "object") return;
|
|
123
|
+
for (const [modelId, raw] of Object.entries(entry.models)) {
|
|
124
|
+
const parsed = catalogModelSchema.safeParse(raw);
|
|
125
|
+
if (!parsed.success) {
|
|
126
|
+
process.stderr.write(
|
|
127
|
+
`[theokit-sdk] WARN: Skipping malformed catalog model "${entry.id}/${modelId}": ${parsed.error.issues[0]?.message ?? "invalid"}
|
|
128
|
+
`
|
|
129
|
+
);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
modelInfoIndex.set(`${entry.id}/${modelId}`, parsed.data);
|
|
133
|
+
for (const alias of entry.aliases ?? []) {
|
|
134
|
+
const key = `${alias}/${modelId}`;
|
|
135
|
+
if (!modelInfoIndex.has(key)) modelInfoIndex.set(key, parsed.data);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function validateEntry(raw) {
|
|
140
|
+
if (typeof raw.id !== "string" || typeof raw.displayName !== "string" || typeof raw.apiMode !== "string" || typeof raw.authType !== "string" || typeof raw.baseUrl !== "string" || !Array.isArray(raw.envVars) || !Array.isArray(raw.fallbackModels) || raw.capabilities == null || typeof raw.capabilities !== "object") {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return raw;
|
|
144
|
+
}
|
|
145
|
+
function loadProviderCatalog(opts) {
|
|
146
|
+
const catalogPath = join(__dirname_resolved, "provider-catalog.json");
|
|
147
|
+
const rawText = readFileSync(catalogPath, "utf-8");
|
|
148
|
+
let entries = JSON.parse(rawText);
|
|
149
|
+
if (opts?._testInjectMalformed) {
|
|
150
|
+
entries = [
|
|
151
|
+
...entries,
|
|
152
|
+
{ id: "malformed-provider", displayName: "Bad" }
|
|
153
|
+
];
|
|
154
|
+
}
|
|
155
|
+
const result = {};
|
|
156
|
+
for (const raw of entries) {
|
|
157
|
+
const validated = validateEntry(raw);
|
|
158
|
+
if (validated === null) {
|
|
159
|
+
process.stderr.write(
|
|
160
|
+
`[theokit-sdk] WARN: Skipping malformed catalog entry: ${JSON.stringify(raw).slice(0, 100)}
|
|
161
|
+
`
|
|
162
|
+
);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
result[validated.id] = validated;
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
var _capabilitiesCache = null;
|
|
170
|
+
function getCatalogCapabilities(providerId) {
|
|
171
|
+
if (_capabilitiesCache === null) {
|
|
172
|
+
const catalog = loadProviderCatalog();
|
|
173
|
+
_capabilitiesCache = {};
|
|
174
|
+
for (const entry of Object.values(catalog)) {
|
|
175
|
+
_capabilitiesCache[entry.id] = entry.capabilities;
|
|
176
|
+
for (const alias of entry.aliases ?? []) {
|
|
177
|
+
if (_capabilitiesCache[alias] === void 0) _capabilitiesCache[alias] = entry.capabilities;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return _capabilitiesCache[providerId];
|
|
182
|
+
}
|
|
183
|
+
function registerCatalogProviders(opts) {
|
|
184
|
+
const catalog = loadProviderCatalog(opts);
|
|
185
|
+
for (const entry of Object.values(catalog)) {
|
|
186
|
+
if (getProviderProfile(entry.id) !== void 0) continue;
|
|
187
|
+
if (entry.aliases?.some((a) => getProviderProfile(a) !== void 0)) continue;
|
|
188
|
+
const profile = {
|
|
189
|
+
name: entry.id,
|
|
190
|
+
apiMode: entry.apiMode,
|
|
191
|
+
authType: entry.authType,
|
|
192
|
+
baseUrl: entry.baseUrl,
|
|
193
|
+
envVars: entry.envVars,
|
|
194
|
+
fallbackModels: entry.fallbackModels,
|
|
195
|
+
displayName: entry.displayName,
|
|
196
|
+
aliases: entry.aliases,
|
|
197
|
+
modelsUrl: entry.modelsUrl,
|
|
198
|
+
hostname: entry.hostname,
|
|
199
|
+
extraHeaders: entry.extraHeaders
|
|
200
|
+
};
|
|
201
|
+
registerProvider(profile);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// src/internal/providers/builtin/anthropic.ts
|
|
206
|
+
var ANTHROPIC = {
|
|
207
|
+
name: "anthropic",
|
|
208
|
+
apiMode: "anthropic_messages",
|
|
209
|
+
envVars: ["ANTHROPIC_API_KEY"],
|
|
210
|
+
authType: "api_key",
|
|
211
|
+
baseUrl: "https://api.anthropic.com",
|
|
212
|
+
modelsUrl: "https://api.anthropic.com/v1/models",
|
|
213
|
+
hostname: "api.anthropic.com",
|
|
214
|
+
fallbackModels: ["claude-opus-4-7", "claude-sonnet-4-6", "claude-haiku-4-5-20251001"],
|
|
215
|
+
// M45 — the Anthropic beta-features header (interleaved thinking + fine-grained tool streaming). An
|
|
216
|
+
// Anthropic API constant, adapted verbatim from OpenCode's anthropic plugin (MIT © 2025 opencode). The
|
|
217
|
+
// SANCTIONED behavior delta of M45 (ADR D4) — consumed by the anthropic transport's extraHeaders wiring.
|
|
218
|
+
extraHeaders: {
|
|
219
|
+
"anthropic-beta": "interleaved-thinking-2025-05-14,fine-grained-tool-streaming-2025-05-14"
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// src/internal/providers/builtin/bedrock.ts
|
|
224
|
+
var BEDROCK = {
|
|
225
|
+
name: "bedrock",
|
|
226
|
+
apiMode: "bedrock_anthropic",
|
|
227
|
+
envVars: ["AWS_BEARER_TOKEN_BEDROCK"],
|
|
228
|
+
authType: "aws_bearer",
|
|
229
|
+
baseUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
|
|
230
|
+
modelsUrl: void 0,
|
|
231
|
+
hostname: "bedrock-runtime.amazonaws.com",
|
|
232
|
+
fallbackModels: [
|
|
233
|
+
"bedrock/us.anthropic.claude-sonnet-4-5-v1:0",
|
|
234
|
+
"bedrock/us.anthropic.claude-opus-4-7-v1:0",
|
|
235
|
+
"bedrock/global.anthropic.claude-haiku-4-5-v1:0"
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
function stripBedrockPrefix(modelId) {
|
|
239
|
+
return modelId.replace(/^bedrock\//, "");
|
|
240
|
+
}
|
|
241
|
+
function inferRegionFromModelId(modelId) {
|
|
242
|
+
const id = stripBedrockPrefix(modelId);
|
|
243
|
+
if (id.startsWith("global.")) return "us-east-1";
|
|
244
|
+
if (id.startsWith("us.")) return process.env.AWS_REGION ?? "us-east-1";
|
|
245
|
+
if (id.startsWith("eu.")) return process.env.AWS_REGION ?? "eu-west-1";
|
|
246
|
+
if (id.startsWith("apac.")) return process.env.AWS_REGION ?? "ap-southeast-1";
|
|
247
|
+
if (id.startsWith("jp.")) return "ap-northeast-1";
|
|
248
|
+
return void 0;
|
|
249
|
+
}
|
|
250
|
+
function resolveBedrockBaseUrl(modelId) {
|
|
251
|
+
const region = inferRegionFromModelId(modelId) ?? process.env.AWS_REGION ?? "us-east-1";
|
|
252
|
+
return `https://bedrock-runtime.${region}.amazonaws.com`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/internal/providers/builtin/openai-compatible.ts
|
|
256
|
+
function openAiCompatibleProfile(p) {
|
|
257
|
+
return {
|
|
258
|
+
apiMode: "chat_completions",
|
|
259
|
+
authType: "api_key",
|
|
260
|
+
fallbackModels: [],
|
|
261
|
+
...p
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// src/internal/providers/builtin/cerebras.ts
|
|
266
|
+
var CEREBRAS = openAiCompatibleProfile({
|
|
267
|
+
name: "cerebras",
|
|
268
|
+
baseUrl: "https://api.cerebras.ai/v1",
|
|
269
|
+
envVars: ["CEREBRAS_API_KEY"],
|
|
270
|
+
fallbackModels: ["gpt-oss-120b", "zai-glm-4.7"],
|
|
271
|
+
extraHeaders: { "X-Cerebras-3rd-Party-Integration": "theokit" },
|
|
272
|
+
hostname: "api.cerebras.ai"
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// src/internal/providers/builtin/cohere.ts
|
|
276
|
+
var COHERE = openAiCompatibleProfile({
|
|
277
|
+
name: "cohere",
|
|
278
|
+
baseUrl: "https://api.cohere.ai/compatibility/v1",
|
|
279
|
+
envVars: ["COHERE_API_KEY", "CO_API_KEY"],
|
|
280
|
+
fallbackModels: ["command-a-03-2025"],
|
|
281
|
+
hostname: "api.cohere.ai"
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
// src/internal/providers/builtin/deepinfra.ts
|
|
285
|
+
var DEEPINFRA = openAiCompatibleProfile({
|
|
286
|
+
name: "deepinfra",
|
|
287
|
+
baseUrl: "https://api.deepinfra.com/v1/openai",
|
|
288
|
+
envVars: ["DEEPINFRA_API_KEY"],
|
|
289
|
+
fallbackModels: ["Qwen/Qwen3-32B"],
|
|
290
|
+
hostname: "api.deepinfra.com"
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// src/internal/providers/builtin/gemini.ts
|
|
294
|
+
var GEMINI = {
|
|
295
|
+
name: "gemini",
|
|
296
|
+
apiMode: "chat_completions",
|
|
297
|
+
envVars: ["OPENROUTER_API_KEY"],
|
|
298
|
+
authType: "api_key",
|
|
299
|
+
baseUrl: "https://openrouter.ai/api",
|
|
300
|
+
hostname: "openrouter.ai",
|
|
301
|
+
fallbackModels: ["google/gemini-2.0-flash-001"]
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/internal/providers/builtin/google.ts
|
|
305
|
+
var GOOGLE = openAiCompatibleProfile({
|
|
306
|
+
name: "google",
|
|
307
|
+
baseUrl: "https://generativelanguage.googleapis.com/v1beta/openai",
|
|
308
|
+
envVars: ["GOOGLE_API_KEY", "GEMINI_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY"],
|
|
309
|
+
fallbackModels: ["gemini-2.5-pro", "gemini-2.5-flash"],
|
|
310
|
+
hostname: "generativelanguage.googleapis.com"
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
// src/internal/providers/builtin/groq.ts
|
|
314
|
+
var GROQ = openAiCompatibleProfile({
|
|
315
|
+
name: "groq",
|
|
316
|
+
baseUrl: "https://api.groq.com/openai/v1",
|
|
317
|
+
envVars: ["GROQ_API_KEY"],
|
|
318
|
+
fallbackModels: ["llama-3.3-70b-versatile", "llama-3.1-8b-instant"],
|
|
319
|
+
hostname: "api.groq.com"
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
// src/internal/providers/builtin/llamacpp.ts
|
|
323
|
+
var LLAMACPP = {
|
|
324
|
+
name: "llamacpp",
|
|
325
|
+
aliases: ["llama-cpp", "llama.cpp"],
|
|
326
|
+
apiMode: "chat_completions",
|
|
327
|
+
envVars: ["LLAMACPP_API_KEY"],
|
|
328
|
+
authType: "none",
|
|
329
|
+
baseUrl: "http://localhost:8080",
|
|
330
|
+
modelsUrl: "http://localhost:8080/v1/models",
|
|
331
|
+
hostname: "localhost",
|
|
332
|
+
fallbackModels: ["loaded-model"]
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
// src/internal/providers/builtin/lmstudio.ts
|
|
336
|
+
var LMSTUDIO = {
|
|
337
|
+
name: "lmstudio",
|
|
338
|
+
aliases: ["lm-studio", "lm_studio"],
|
|
339
|
+
apiMode: "chat_completions",
|
|
340
|
+
envVars: ["LMSTUDIO_API_KEY"],
|
|
341
|
+
authType: "none",
|
|
342
|
+
baseUrl: "http://localhost:1234",
|
|
343
|
+
modelsUrl: "http://localhost:1234/v1/models",
|
|
344
|
+
hostname: "localhost",
|
|
345
|
+
fallbackModels: ["loaded-model"]
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
// src/internal/providers/builtin/mistral.ts
|
|
349
|
+
var MISTRAL = openAiCompatibleProfile({
|
|
350
|
+
name: "mistral",
|
|
351
|
+
baseUrl: "https://api.mistral.ai/v1",
|
|
352
|
+
envVars: ["MISTRAL_API_KEY"],
|
|
353
|
+
fallbackModels: ["mistral-large-latest", "codestral-latest"],
|
|
354
|
+
hostname: "api.mistral.ai"
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// src/internal/providers/builtin/ollama.ts
|
|
358
|
+
var OLLAMA = {
|
|
359
|
+
name: "ollama",
|
|
360
|
+
apiMode: "chat_completions",
|
|
361
|
+
envVars: ["OLLAMA_API_KEY"],
|
|
362
|
+
authType: "none",
|
|
363
|
+
baseUrl: "http://localhost:11434",
|
|
364
|
+
modelsUrl: "http://localhost:11434/v1/models",
|
|
365
|
+
hostname: "localhost",
|
|
366
|
+
fallbackModels: ["llama3.2", "qwen2.5", "mistral"]
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// src/internal/providers/builtin/openai.ts
|
|
370
|
+
var OPENAI = {
|
|
371
|
+
name: "openai",
|
|
372
|
+
apiMode: "chat_completions",
|
|
373
|
+
envVars: ["OPENAI_API_KEY"],
|
|
374
|
+
authType: "api_key",
|
|
375
|
+
baseUrl: "https://api.openai.com",
|
|
376
|
+
modelsUrl: "https://api.openai.com/v1/models",
|
|
377
|
+
hostname: "api.openai.com",
|
|
378
|
+
fallbackModels: ["gpt-4o", "gpt-4o-mini"]
|
|
379
|
+
};
|
|
380
|
+
var DEFAULT_STORE = {
|
|
381
|
+
home: homedir(),
|
|
382
|
+
dirName: ".theokit",
|
|
383
|
+
fileName: "auth.json",
|
|
384
|
+
homeEnvVar: "THEOKIT_AUTH_HOME"
|
|
385
|
+
};
|
|
386
|
+
var OPENAI_OAUTH_CONFIG = {
|
|
387
|
+
provider: "openai",
|
|
388
|
+
authorizeEndpoint: "https://auth.openai.com/oauth/authorize",
|
|
389
|
+
tokenEndpoint: "https://auth.openai.com/oauth/token",
|
|
390
|
+
clientId: "app_EMoamEEZ73f0CkXaXp7hrann",
|
|
391
|
+
scopes: ["openid", "profile", "email", "offline_access"],
|
|
392
|
+
redirectUri: "https://auth.openai.com/deviceauth/callback"
|
|
393
|
+
};
|
|
394
|
+
function codexFetch() {
|
|
395
|
+
return (async (input, init) => {
|
|
396
|
+
const env = process.env;
|
|
397
|
+
const resolved = await resolveCredential({
|
|
398
|
+
provider: "openai",
|
|
399
|
+
store: DEFAULT_STORE,
|
|
400
|
+
oauth: OPENAI_OAUTH_CONFIG,
|
|
401
|
+
env
|
|
402
|
+
});
|
|
403
|
+
if (resolved === void 0) {
|
|
404
|
+
throw new Error(
|
|
405
|
+
'openai-chatgpt: no ChatGPT credential found \u2014 run the OpenAI device login (e.g. "/login openai") first.'
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
const accountId = readStoredOAuth(DEFAULT_STORE, env)?.account_id;
|
|
409
|
+
const headers = new Headers(init?.headers);
|
|
410
|
+
headers.set("authorization", `Bearer ${resolved.apiKey}`);
|
|
411
|
+
if (accountId !== void 0) headers.set("ChatGPT-Account-Id", accountId);
|
|
412
|
+
return fetch(input, { ...init, headers });
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
var OPENAI_CHATGPT = {
|
|
416
|
+
name: "openai-chatgpt",
|
|
417
|
+
apiMode: "responses_api",
|
|
418
|
+
authType: "oauth_device_code",
|
|
419
|
+
baseUrl: "https://chatgpt.com/backend-api/codex",
|
|
420
|
+
envVars: [],
|
|
421
|
+
fallbackModels: [
|
|
422
|
+
"openai-chatgpt/gpt-5.4",
|
|
423
|
+
"openai-chatgpt/gpt-5.4-mini",
|
|
424
|
+
"openai-chatgpt/gpt-5.5"
|
|
425
|
+
],
|
|
426
|
+
extraHeaders: { originator: "codex_cli_rs" },
|
|
427
|
+
transform: {
|
|
428
|
+
// Only `fetch` (async) can await the credential refresh; `headers` is sync and cannot.
|
|
429
|
+
fetch: () => codexFetch()
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
// src/internal/providers/builtin/openrouter.ts
|
|
434
|
+
var OPENROUTER = {
|
|
435
|
+
name: "openrouter",
|
|
436
|
+
apiMode: "chat_completions",
|
|
437
|
+
aliases: ["or"],
|
|
438
|
+
// Ordered fallback (EC-10): OPENROUTER_API_KEY preferred, OPENAI_API_KEY as compat.
|
|
439
|
+
envVars: ["OPENROUTER_API_KEY", "OPENAI_API_KEY"],
|
|
440
|
+
authType: "api_key",
|
|
441
|
+
baseUrl: "https://openrouter.ai/api",
|
|
442
|
+
modelsUrl: "https://openrouter.ai/api/v1/models",
|
|
443
|
+
hostname: "openrouter.ai",
|
|
444
|
+
// M45 — models refreshed (claude-3-haiku retired upstream).
|
|
445
|
+
fallbackModels: ["openai/gpt-4o-mini", "anthropic/claude-haiku-4-5"],
|
|
446
|
+
// M45 — OpenRouter app-attribution headers (mechanism from OpenCode's openrouter plugin, MIT; VALUES are
|
|
447
|
+
// theokit's own — copying another app's referer would misattribute traffic).
|
|
448
|
+
extraHeaders: { "HTTP-Referer": "https://usetheo.dev", "X-Title": "theokit" }
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
// src/internal/providers/builtin/perplexity.ts
|
|
452
|
+
var PERPLEXITY = openAiCompatibleProfile({
|
|
453
|
+
name: "perplexity",
|
|
454
|
+
baseUrl: "https://api.perplexity.ai",
|
|
455
|
+
chatCompletionsPath: "/chat/completions",
|
|
456
|
+
envVars: ["PERPLEXITY_API_KEY"],
|
|
457
|
+
fallbackModels: ["sonar-pro", "sonar"],
|
|
458
|
+
hostname: "api.perplexity.ai"
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
// src/internal/providers/builtin/together.ts
|
|
462
|
+
var TOGETHER = openAiCompatibleProfile({
|
|
463
|
+
name: "together",
|
|
464
|
+
aliases: ["togetherai"],
|
|
465
|
+
baseUrl: "https://api.together.xyz/v1",
|
|
466
|
+
envVars: ["TOGETHER_API_KEY"],
|
|
467
|
+
fallbackModels: ["Qwen/Qwen2.5-7B-Instruct-Turbo"],
|
|
468
|
+
hostname: "api.together.xyz"
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// src/internal/providers/builtin/vertex.ts
|
|
472
|
+
var VERTEX = {
|
|
473
|
+
name: "vertex",
|
|
474
|
+
apiMode: "anthropic_messages",
|
|
475
|
+
// sub-dispatched in selectTransport by profile.name
|
|
476
|
+
envVars: ["GOOGLE_APPLICATION_CREDENTIALS"],
|
|
477
|
+
authType: "gcp_oauth",
|
|
478
|
+
baseUrl: "https://us-central1-aiplatform.googleapis.com",
|
|
479
|
+
modelsUrl: void 0,
|
|
480
|
+
hostname: "aiplatform.googleapis.com",
|
|
481
|
+
fallbackModels: [
|
|
482
|
+
"vertex/anthropic/claude-sonnet-4-5@20250929",
|
|
483
|
+
"vertex/google/gemini-2.0-flash-001"
|
|
484
|
+
]
|
|
485
|
+
};
|
|
486
|
+
function resolveVertexBaseUrl(opts) {
|
|
487
|
+
const host = opts.location === "global" ? "aiplatform.googleapis.com" : `${opts.location}-aiplatform.googleapis.com`;
|
|
488
|
+
if (opts.modelDialect === "gemini") {
|
|
489
|
+
return `https://${host}/v1/projects/${opts.projectId}/locations/${opts.location}/endpoints/openapi`;
|
|
490
|
+
}
|
|
491
|
+
return `https://${host}/v1/projects/${opts.projectId}/locations/${opts.location}/publishers/anthropic`;
|
|
492
|
+
}
|
|
493
|
+
function inferModelDialect(modelId) {
|
|
494
|
+
if (modelId.includes("/anthropic/")) return "anthropic";
|
|
495
|
+
if (modelId.includes("/google/")) return "gemini";
|
|
496
|
+
return "gemini";
|
|
497
|
+
}
|
|
498
|
+
function stripVertexPrefix(modelId) {
|
|
499
|
+
return modelId.replace(/^vertex\/(anthropic|google)\//, "");
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/internal/providers/builtin/xai.ts
|
|
503
|
+
var XAI = openAiCompatibleProfile({
|
|
504
|
+
name: "xai",
|
|
505
|
+
aliases: ["grok"],
|
|
506
|
+
baseUrl: "https://api.x.ai/v1",
|
|
507
|
+
envVars: ["XAI_API_KEY"],
|
|
508
|
+
fallbackModels: ["grok-4.5", "grok-4.3"],
|
|
509
|
+
hostname: "api.x.ai"
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
// src/internal/providers/builtin/index.ts
|
|
513
|
+
var _registeredState = (() => {
|
|
514
|
+
const g = globalThis;
|
|
515
|
+
const sym = /* @__PURE__ */ Symbol.for("theokit-sdk.providers.builtins-registered");
|
|
516
|
+
if (g[sym] === void 0) g[sym] = { done: false };
|
|
517
|
+
return g[sym];
|
|
518
|
+
})();
|
|
519
|
+
function registerBuiltins() {
|
|
520
|
+
if (_registeredState.done) return;
|
|
521
|
+
_registeredState.done = true;
|
|
522
|
+
registerProvider(ANTHROPIC);
|
|
523
|
+
registerProvider(OPENAI);
|
|
524
|
+
registerProvider(OPENAI_CHATGPT);
|
|
525
|
+
registerProvider(OPENROUTER);
|
|
526
|
+
registerProvider(GEMINI);
|
|
527
|
+
registerProvider(OLLAMA);
|
|
528
|
+
registerProvider(LMSTUDIO);
|
|
529
|
+
registerProvider(LLAMACPP);
|
|
530
|
+
registerProvider(BEDROCK);
|
|
531
|
+
registerProvider(VERTEX);
|
|
532
|
+
registerProvider(GOOGLE);
|
|
533
|
+
registerProvider(MISTRAL);
|
|
534
|
+
registerProvider(GROQ);
|
|
535
|
+
registerProvider(COHERE);
|
|
536
|
+
registerProvider(DEEPINFRA);
|
|
537
|
+
registerProvider(TOGETHER);
|
|
538
|
+
registerProvider(XAI);
|
|
539
|
+
registerProvider(PERPLEXITY);
|
|
540
|
+
registerProvider(CEREBRAS);
|
|
541
|
+
registerCatalogProviders();
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export { catalogModelSchema, getCatalogCapabilities, getCatalogModelInfo, getProviderProfile, globalSingleton, inferModelDialect, inferRegionFromModelId, isPatchedModelKey, listProviders, loadProviderCatalog, patchModelInfo, registerBuiltins, registerProvider, resolveBedrockBaseUrl, resolveVertexBaseUrl, stripBedrockPrefix, stripVertexPrefix };
|
|
545
|
+
//# sourceMappingURL=chunk-KAP4GJHO.js.map
|
|
546
|
+
//# sourceMappingURL=chunk-KAP4GJHO.js.map
|