@namzu/cli 63.2.0 → 63.3.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 +57 -0
- package/README.md +36 -36
- package/dist/bin.js +1 -1
- package/dist/chunks/{acp-XC6FTO64.js → acp-J3TMCBRY.js} +242 -184
- package/dist/chunks/acp-J3TMCBRY.js.map +6 -0
- package/dist/chunks/{activity-command-PIH63SRU.js → activity-command-X25POZ3R.js} +15 -15
- package/dist/chunks/{add-CWIB4XVU.js → add-HL4MO6R2.js} +38 -38
- package/dist/chunks/{agent-CNRZCXHY.js → agent-MHH4MGYB.js} +67 -65
- package/dist/chunks/agent-session-OC32VSS6.js +107 -0
- package/dist/chunks/{apply-at-exit-CMRH3GQN.js → apply-at-exit-ADWMDFFQ.js} +7 -7
- package/dist/chunks/{archive-DPZ3PWUU.js → archive-6X2FED3E.js} +14 -14
- package/dist/chunks/{auth-JAKMDE4X.js → auth-KRORFNAA.js} +64 -27
- package/dist/chunks/auth-KRORFNAA.js.map +6 -0
- package/dist/chunks/{bin-main-V6PBLHRK.js → bin-main-74KBBJNG.js} +10 -9
- package/dist/chunks/bin-main-74KBBJNG.js.map +6 -0
- package/dist/chunks/{binding-UHJZD5Z3.js → binding-OXJ5TL6T.js} +3 -3
- package/dist/chunks/{browser-2QBVPHCB.js → browser-DFLZNRRZ.js} +7 -7
- package/dist/chunks/{chat-DJEP53BA.js → chat-PPSFN5JK.js} +18 -18
- package/dist/chunks/{chunk-4JKWOO7I.js → chunk-23AYRMS2.js} +4 -4
- package/dist/chunks/{chunk-5U4IA3HS.js → chunk-2AUUX6VA.js} +19 -1
- package/dist/chunks/chunk-2AUUX6VA.js.map +6 -0
- package/dist/chunks/{chunk-MUQOV75B.js → chunk-2H75JWKG.js} +3 -3
- package/dist/chunks/{chunk-NEOVE6D5.js → chunk-2JKQ6BFI.js} +2 -2
- package/dist/chunks/{chunk-UZVJQEYT.js → chunk-2KJUKF2E.js} +6 -6
- package/dist/chunks/{chunk-IYBVVKSB.js → chunk-2QGSHJ4Y.js} +3 -3
- package/dist/chunks/{chunk-ZNSVRCPH.js → chunk-2R6Z32IU.js} +3 -3
- package/dist/chunks/{chunk-7FGITTVH.js → chunk-2USTJGLA.js} +5 -5
- package/dist/chunks/{chunk-EIIJLF6W.js → chunk-333RR5BA.js} +4 -4
- package/dist/chunks/{chunk-MCIYCR57.js → chunk-33TGFQ2U.js} +5 -5
- package/dist/chunks/{chunk-C4RV2D57.js → chunk-3FFV4OSR.js} +4 -4
- package/dist/chunks/{chunk-QI4IEHLE.js → chunk-3QXUETDN.js} +4 -4
- package/dist/chunks/{chunk-4VTRURM6.js → chunk-3TLDTD6R.js} +14 -14
- package/dist/chunks/{chunk-ONEBRD5O.js → chunk-4ASXGRP5.js} +3 -3
- package/dist/chunks/{chunk-ZFOZVUUJ.js → chunk-4JPZYI6M.js} +2 -2
- package/dist/chunks/{chunk-7L3PTSKY.js → chunk-4OWFI7ZE.js} +16 -9
- package/dist/chunks/chunk-4OWFI7ZE.js.map +6 -0
- package/dist/chunks/{chunk-RBJDS73T.js → chunk-4TPXEWD5.js} +3 -3
- package/dist/chunks/{chunk-XJ4APISC.js → chunk-4U6TAYDK.js} +65 -12
- package/dist/chunks/chunk-4U6TAYDK.js.map +6 -0
- package/dist/chunks/chunk-4VKLCPVW.js +526 -0
- package/dist/chunks/chunk-4VKLCPVW.js.map +6 -0
- package/dist/chunks/{chunk-VVMI6HQM.js → chunk-554DVVVR.js} +611 -214
- package/dist/chunks/chunk-554DVVVR.js.map +6 -0
- package/dist/chunks/{chunk-COOW2AWX.js → chunk-5GJWIDVU.js} +3 -3
- package/dist/chunks/{chunk-RXFFBB7A.js → chunk-5PQHBLZI.js} +3 -3
- package/dist/chunks/{chunk-GMUWAUKQ.js → chunk-5UARTCJW.js} +2 -2
- package/dist/chunks/{chunk-Q5SAOE7Q.js → chunk-5XROCBT5.js} +9 -9
- package/dist/chunks/{chunk-WI6IGTC4.js → chunk-5YOREQIA.js} +3 -3
- package/dist/chunks/{chunk-4E5KFKJA.js → chunk-6CL7TQOC.js} +5 -5
- package/dist/chunks/{chunk-5B4BXZCI.js → chunk-75RHEPE7.js} +36 -3
- package/dist/chunks/chunk-75RHEPE7.js.map +6 -0
- package/dist/chunks/{chunk-N5YRJQPS.js → chunk-7RCI6OBE.js} +2 -2
- package/dist/chunks/{chunk-SIMI4VB7.js → chunk-7WPF7ATU.js} +3 -3
- package/dist/chunks/{chunk-DKZAHG7B.js → chunk-AAN4XLUD.js} +4 -4
- package/dist/chunks/{chunk-LDJXUI3Q.js → chunk-BB2RJOFI.js} +11 -11
- package/dist/chunks/{chunk-KGCHR4TQ.js → chunk-BBNACUZ3.js} +1527 -676
- package/dist/chunks/chunk-BBNACUZ3.js.map +6 -0
- package/dist/chunks/{chunk-ESWXNISI.js → chunk-BCHHHNLK.js} +2 -2
- package/dist/chunks/{chunk-C6JX3GVK.js → chunk-BUQCQMXH.js} +3 -3
- package/dist/chunks/{chunk-VLWMMDBY.js → chunk-COSMRH2Q.js} +5 -5
- package/dist/chunks/{chunk-4VMFD7UC.js → chunk-CPZEJQ2Z.js} +4 -4
- package/dist/chunks/{chunk-3AKPBYMA.js → chunk-DCVWFBYB.js} +2 -2
- package/dist/chunks/{chunk-ADGTOEHA.js → chunk-DD3BJ4GM.js} +9 -9
- package/dist/chunks/{chunk-4H2RPAXN.js → chunk-DKTU6RWO.js} +5 -5
- package/dist/chunks/{chunk-OWKPJJKH.js → chunk-EODC62SI.js} +4 -4
- package/dist/chunks/{chunk-IVTYJBJF.js → chunk-EOHPS7LC.js} +7 -7
- package/dist/chunks/{chunk-2LZAZAWT.js → chunk-EPSLHLT3.js} +8 -8
- package/dist/chunks/{chunk-SHUKR2A5.js → chunk-FAQQGJ2Z.js} +3 -3
- package/dist/chunks/{chunk-OQFX532E.js → chunk-FJPM4YAO.js} +4 -4
- package/dist/chunks/{chunk-TPMF64WM.js → chunk-FZSM7DSH.js} +11 -11
- package/dist/chunks/{chunk-MMQGQ7BJ.js → chunk-G3V2OKYP.js} +5 -5
- package/dist/chunks/{chunk-6WPK5S6Z.js → chunk-G4OR74MC.js} +10 -10
- package/dist/chunks/{chunk-TV7UBGX2.js → chunk-GCOTJ6XY.js} +147 -3
- package/dist/chunks/chunk-GCOTJ6XY.js.map +6 -0
- package/dist/chunks/{chunk-QWUHCBDT.js → chunk-HXZA5UUN.js} +2 -2
- package/dist/chunks/{chunk-2AWKLDCQ.js → chunk-IDIVB67E.js} +2 -2
- package/dist/chunks/{chunk-IISM3GHE.js → chunk-ISI36EUS.js} +3 -3
- package/dist/chunks/{chunk-SNHJJI52.js → chunk-IUMOIQKL.js} +10 -10
- package/dist/chunks/{chunk-P5LQ4NRD.js → chunk-J4NFH5T2.js} +2 -2
- package/dist/chunks/{chunk-HYHHGMBC.js → chunk-J6JBHNNR.js} +2 -2
- package/dist/chunks/{chunk-UGBHE6ZS.js → chunk-JCY3OPTY.js} +7 -7
- package/dist/chunks/{chunk-S76POTJP.js → chunk-JD7EWFIJ.js} +6 -6
- package/dist/chunks/chunk-JKMOMRIV.js +564 -0
- package/dist/chunks/chunk-JKMOMRIV.js.map +6 -0
- package/dist/chunks/{chunk-2K7EIRI2.js → chunk-JOVKHMJS.js} +8 -8
- package/dist/chunks/{chunk-GOKGPFXK.js → chunk-JQ7HNIBS.js} +6 -6
- package/dist/chunks/{chunk-I3HOLAAO.js → chunk-JSWFUARY.js} +3 -3
- package/dist/chunks/{chunk-NTUKFINL.js → chunk-JU3P3ZJJ.js} +3 -3
- package/dist/chunks/{chunk-ZLMO5YL4.js → chunk-JWBS363M.js} +2 -2
- package/dist/chunks/{chunk-HZGT5EHL.js → chunk-JXBSJNUF.js} +2 -2
- package/dist/chunks/{chunk-X6LDRLVN.js → chunk-JZTNWODR.js} +8 -8
- package/dist/chunks/{chunk-HJHZJKAD.js → chunk-K4AUROOC.js} +2 -2
- package/dist/chunks/{chunk-RL2CTUF2.js → chunk-KFFW7EYQ.js} +2 -2
- package/dist/chunks/{chunk-SEW4KEZ5.js → chunk-KGKVNHFC.js} +4 -4
- package/dist/chunks/{chunk-SOZSIDCY.js → chunk-KLIJLSWF.js} +2 -2
- package/dist/chunks/{chunk-ZZ7A2Y7O.js → chunk-LA6FHUOG.js} +4 -2
- package/dist/chunks/chunk-LA6FHUOG.js.map +6 -0
- package/dist/chunks/{chunk-BS3KGJJZ.js → chunk-LJFDFGFU.js} +8 -8
- package/dist/chunks/{chunk-O3T5CJQG.js → chunk-LZPPIRJW.js} +4 -4
- package/dist/chunks/{chunk-H624ADJH.js → chunk-MHEYQD24.js} +2 -2
- package/dist/chunks/{chunk-44KWXPBG.js → chunk-MM7HGD6H.js} +2 -2
- package/dist/chunks/{chunk-C56FUSQH.js → chunk-N4KE47J2.js} +2 -2
- package/dist/chunks/{chunk-QNRBLNA3.js → chunk-N4USZWBA.js} +3 -3
- package/dist/chunks/{chunk-GCLZEMDF.js → chunk-OIFFABSH.js} +4 -4
- package/dist/chunks/{chunk-NRR2SMR6.js → chunk-OKFU62GA.js} +3 -3
- package/dist/chunks/{chunk-G6YSAHKC.js → chunk-OWPDRJ6S.js} +2 -2
- package/dist/chunks/{chunk-LCZWTKIB.js → chunk-P4WMRT5Q.js} +2 -2
- package/dist/chunks/{chunk-EHKWQ7IS.js → chunk-PGHGBSS2.js} +2 -2
- package/dist/chunks/{chunk-OA76OH27.js → chunk-PLPVXHTM.js} +21 -21
- package/dist/chunks/{chunk-KE2RFCTY.js → chunk-PMA5NXWF.js} +6 -6
- package/dist/chunks/{chunk-VBG357AO.js → chunk-PP7AG46K.js} +293 -105
- package/dist/chunks/chunk-PP7AG46K.js.map +6 -0
- package/dist/chunks/{chunk-5RA5FZDM.js → chunk-PSRWFKFX.js} +2 -2
- package/dist/chunks/{chunk-NXFB5AP5.js → chunk-PTUICVCN.js} +5 -5
- package/dist/chunks/{chunk-YOPTDWON.js → chunk-Q23JN3PA.js} +3 -2
- package/dist/chunks/{chunk-YOPTDWON.js.map → chunk-Q23JN3PA.js.map} +1 -1
- package/dist/chunks/{chunk-ZIF4GK2U.js → chunk-Q5THGA3N.js} +2 -2
- package/dist/chunks/{chunk-AUDTDXWX.js → chunk-Q6NWIY5D.js} +35 -15
- package/dist/chunks/chunk-Q6NWIY5D.js.map +6 -0
- package/dist/chunks/{chunk-5SRVOPRS.js → chunk-QTR6UU63.js} +2 -2
- package/dist/chunks/{chunk-2YPRONTU.js → chunk-RBRBYXJX.js} +259 -103
- package/dist/chunks/chunk-RBRBYXJX.js.map +6 -0
- package/dist/chunks/{chunk-7BNKRTXM.js → chunk-RIVPA5TG.js} +5 -5
- package/dist/chunks/{chunk-HPUVBU7G.js → chunk-RQYSVELQ.js} +2 -2
- package/dist/chunks/{chunk-RKAZUYKY.js → chunk-RWSHMPFM.js} +2 -2
- package/dist/chunks/{chunk-CQNIP7QC.js → chunk-RZ3HYPV4.js} +6 -6
- package/dist/chunks/{chunk-3OHJYUFP.js → chunk-SCGWXYZW.js} +84 -37
- package/dist/chunks/chunk-SCGWXYZW.js.map +6 -0
- package/dist/chunks/{chunk-AFYS4U45.js → chunk-SDWOSB3L.js} +2 -2
- package/dist/chunks/{chunk-AT42FHTY.js → chunk-SPKNKEW5.js} +4 -4
- package/dist/chunks/{chunk-UUMISHVL.js → chunk-SQDZZCQJ.js} +2 -2
- package/dist/chunks/{chunk-KFB4RMNZ.js → chunk-SRNS347K.js} +2 -2
- package/dist/chunks/{chunk-GUOCXE6V.js → chunk-SX7FXWTB.js} +3 -3
- package/dist/chunks/{chunk-HS7PPGS3.js → chunk-T34DMFOM.js} +19 -7
- package/dist/chunks/chunk-T34DMFOM.js.map +6 -0
- package/dist/chunks/{chunk-WGN4AUAW.js → chunk-T6FMC7R5.js} +3 -3
- package/dist/chunks/{chunk-SHW5NXAS.js → chunk-TDCHFQVU.js} +2 -2
- package/dist/chunks/{chunk-6AINAG3P.js → chunk-TGQWC44Q.js} +2 -2
- package/dist/chunks/{chunk-XPTCRZ6F.js → chunk-TIM7OEJN.js} +3 -3
- package/dist/chunks/{chunk-MNQL7ZAW.js → chunk-TLSFOP3I.js} +170 -24
- package/dist/chunks/chunk-TLSFOP3I.js.map +6 -0
- package/dist/chunks/{chunk-TAPWAMDX.js → chunk-TO5ROEIW.js} +9 -9
- package/dist/chunks/{chunk-QTGW6FJG.js → chunk-TTBXKYFP.js} +6 -6
- package/dist/chunks/{chunk-757LAANV.js → chunk-TXCQMW7F.js} +5 -5
- package/dist/chunks/{chunk-WD5XJ5ZU.js → chunk-UCF6H5BB.js} +2 -2
- package/dist/chunks/{chunk-5ER7BU54.js → chunk-UP3ATLU6.js} +3 -3
- package/dist/chunks/{chunk-E5LJN2DV.js → chunk-UTC325FB.js} +3 -3
- package/dist/chunks/{chunk-A2GT47E2.js → chunk-V2DQFFLG.js} +1486 -1370
- package/dist/chunks/chunk-V2DQFFLG.js.map +6 -0
- package/dist/chunks/{chunk-C3UATI2T.js → chunk-VH647IFM.js} +2 -2
- package/dist/chunks/{chunk-5K6GFGCD.js → chunk-VMWPRI2S.js} +3 -3
- package/dist/chunks/{chunk-PTBKVAHY.js → chunk-VWJOJJNQ.js} +6 -6
- package/dist/chunks/{chunk-QVUF2FSM.js → chunk-W3QW6SK6.js} +13 -13
- package/dist/chunks/{chunk-P5UUY56J.js → chunk-W4EKIBRD.js} +3 -3
- package/dist/chunks/{chunk-SC3GK5QC.js → chunk-WMWRRDO2.js} +13 -13
- package/dist/chunks/{chunk-5TSOB5RI.js → chunk-WNBIAOXA.js} +2 -2
- package/dist/chunks/{chunk-Q7NB7LRR.js → chunk-WQL7MEOD.js} +2 -2
- package/dist/chunks/{chunk-335D56LG.js → chunk-X2LYTBDH.js} +3 -3
- package/dist/chunks/{chunk-OLX3IUKN.js → chunk-X4TVUANR.js} +9 -9
- package/dist/chunks/{chunk-EGRSUSP4.js → chunk-XBX3T6YY.js} +10 -10
- package/dist/chunks/{chunk-Z4UCKCEQ.js → chunk-XC6G27M2.js} +2 -2
- package/dist/chunks/{chunk-RXVJEZSV.js → chunk-XGH3FZ76.js} +2 -2
- package/dist/chunks/{chunk-6GCYUKNK.js → chunk-XK7NQIZA.js} +4 -4
- package/dist/chunks/{chunk-BHO3RAXS.js → chunk-XNMJLM5W.js} +12 -12
- package/dist/chunks/{chunk-G5MD6XCV.js → chunk-XORYHNZ3.js} +10 -10
- package/dist/chunks/{chunk-NJUB2ADX.js → chunk-XRAVC5W6.js} +36 -10
- package/dist/chunks/chunk-XRAVC5W6.js.map +6 -0
- package/dist/chunks/{chunk-EW2YVKTN.js → chunk-XTMUUGTN.js} +2 -2
- package/dist/chunks/{chunk-DO5JIP3I.js → chunk-Y36ZTLIJ.js} +4 -4
- package/dist/chunks/{chunk-NUMKSEG4.js → chunk-YCPK5ZTB.js} +3 -3
- package/dist/chunks/{chunk-HXINZ7D3.js → chunk-YRQ5PI7O.js} +3 -3
- package/dist/chunks/{chunk-V5DZWA6R.js → chunk-YVQE7BQ7.js} +242 -707
- package/dist/chunks/chunk-YVQE7BQ7.js.map +6 -0
- package/dist/chunks/{chunk-ORXNYBJU.js → chunk-YXR3LVZE.js} +3 -3
- package/dist/chunks/{chunk-4ABPUIBF.js → chunk-YYGE5EWH.js} +3 -3
- package/dist/chunks/{chunk-RJINNWMH.js → chunk-YZ6UKIKL.js} +4 -4
- package/dist/chunks/{chunk-L45TVHRJ.js → chunk-Z75IWPPX.js} +7 -7
- package/dist/chunks/{chunk-XNVZ6BPI.js → chunk-ZAQFM5BR.js} +6 -6
- package/dist/chunks/{chunk-FDLXZRE4.js → chunk-ZDJWREOA.js} +5 -5
- package/dist/chunks/{chunk-UGTDCLS5.js → chunk-ZKTDZOCC.js} +2 -2
- package/dist/chunks/{chunk-QHJJ333E.js → chunk-ZQL7XFSE.js} +8 -8
- package/dist/chunks/{cli-runtime-FK3WLEHC.js → cli-runtime-ZKBJFWOI.js} +29 -29
- package/dist/chunks/{commands-UVEHHHUD.js → commands-3WI6F2YZ.js} +6 -6
- package/dist/chunks/completion-shells-FUAKFK5A.js +167 -0
- package/dist/chunks/completion-shells-FUAKFK5A.js.map +6 -0
- package/dist/chunks/{computer-GABH2PJF.js → computer-WEEMTZUV.js} +2 -2
- package/dist/chunks/{config-PUASBICJ.js → config-E6UPAUGU.js} +19 -18
- package/dist/chunks/config-E6UPAUGU.js.map +6 -0
- package/dist/chunks/{cost-S6LUVWMS.js → cost-557HKPZ4.js} +5 -5
- package/dist/chunks/{crash-report-WSCK3UQK.js → crash-report-J47RFQ5T.js} +8 -8
- package/dist/chunks/{debug-DX3SZNDB.js → debug-WJJFYSZF.js} +21 -15
- package/dist/chunks/debug-WJJFYSZF.js.map +6 -0
- package/dist/chunks/{desktop-host-schedule-tool-X5AYUZMV.js → desktop-host-schedule-tool-IOOJNMPQ.js} +36 -36
- package/dist/chunks/{dist-WBDFP2PT.js → dist-665VSCM2.js} +2 -2
- package/dist/chunks/{dist-NJJDM4QY.js → dist-AQO44B7K.js} +2 -2
- package/dist/chunks/{dist-3GV6WNET.js → dist-D2RTUX7F.js} +24 -2
- package/dist/chunks/{dist-BFD35FTG.js → dist-JLTZUUMS.js} +2 -2
- package/dist/chunks/{dist-X7QK25WG.js → dist-L5C6AOXZ.js} +2 -2
- package/dist/chunks/{dist-K64KWQUG.js → dist-OIM6DSGL.js} +12 -2
- package/dist/chunks/{dist-K64KWQUG.js.map → dist-OIM6DSGL.js.map} +1 -1
- package/dist/chunks/{dist-AAPFBZPA.js → dist-SEISKEDK.js} +3 -3
- package/dist/chunks/{dist-XLMKK2FY.js → dist-VQVXULA5.js} +2 -2
- package/dist/chunks/doctor-ZRPCR5DP.js +104 -0
- package/dist/chunks/{drain-2WIWFYU3.js → drain-NHR22ZM6.js} +86 -30
- package/dist/chunks/drain-NHR22ZM6.js.map +6 -0
- package/dist/chunks/{entry-KSTSU23A.js → entry-TPBKHAWV.js} +6 -6
- package/dist/chunks/{eval-QJQ7H4E7.js → eval-HKBQQXOD.js} +53 -35
- package/dist/chunks/{eval-QJQ7H4E7.js.map → eval-HKBQQXOD.js.map} +1 -1
- package/dist/chunks/{exec-J55XOCSL.js → exec-R5U6FFFE.js} +138 -98
- package/dist/chunks/exec-R5U6FFFE.js.map +6 -0
- package/dist/chunks/{extension-3YMXVKLS.js → extension-KJJ7XNR4.js} +5 -5
- package/dist/chunks/{feed-66TKSG2Y.js → feed-LQNVF7M6.js} +4 -4
- package/dist/chunks/{github-7JHAZZC3.js → github-LMMBAQWI.js} +3 -3
- package/dist/chunks/{home-RJERCCZS.js → home-D7JCGXQE.js} +3 -3
- package/dist/chunks/{homes-P5UAFUPZ.js → homes-EKTHOMXX.js} +6 -6
- package/dist/chunks/{hooks-U2Z463DN.js → hooks-IT2ZUPG6.js} +27 -27
- package/dist/chunks/{hooks-report-FIPQINVZ.js → hooks-report-A7F26EDM.js} +23 -23
- package/dist/chunks/{host-IWAXBSUX.js → host-FS2RMOHW.js} +13 -13
- package/dist/chunks/{host-queries-3IRCFZ74.js → host-queries-OJXR2XYT.js} +18 -18
- package/dist/chunks/index-project-2UUHV7X3.js +134 -0
- package/dist/chunks/index-project-2UUHV7X3.js.map +6 -0
- package/dist/chunks/{installed-list-IBGMBHUJ.js → installed-list-27KYS56I.js} +4 -4
- package/dist/chunks/{launch-UHLESLJC.js → launch-33I3O7VJ.js} +32 -32
- package/dist/chunks/{learn-TQHDWYWB.js → learn-G5UEINB6.js} +18 -18
- package/dist/chunks/{learn-builtin-2OY2YL6U.js → learn-builtin-Y5FIKQSV.js} +21 -21
- package/dist/chunks/{lifecycle-ECBTALQV.js → lifecycle-NJQ7FIK2.js} +47 -47
- package/dist/chunks/{list-GECT7X6E.js → list-UKBQESKU.js} +24 -24
- package/dist/chunks/live-3YNFFWY5.js +103 -0
- package/dist/chunks/{load-LFCACQWA.js → load-KDS3CW6R.js} +14 -14
- package/dist/chunks/{logs-55HJKNP6.js → logs-3XKNKFY2.js} +5 -5
- package/dist/chunks/{mcp-XUKNYMSO.js → mcp-B2ZVGJQE.js} +31 -31
- package/dist/chunks/{mcp-serve-XYNR3BNJ.js → mcp-serve-DH63SWUH.js} +22 -22
- package/dist/chunks/{message-command-QF7YMZDH.js → message-command-KRDDHWLA.js} +73 -71
- package/dist/chunks/message-command-KRDDHWLA.js.map +6 -0
- package/dist/chunks/{notes-TQTBT2ZZ.js → notes-ZCY7LTUD.js} +6 -6
- package/dist/chunks/{open-CDLLQS4B.js → open-A4H4HWGO.js} +8 -8
- package/dist/chunks/{operator-tools-XAFRSL26.js → operator-tools-EH6R2JQC.js} +16 -16
- package/dist/chunks/{output-schema-5KOV6OJ6.js → output-schema-2NSAYRBS.js} +3 -3
- package/dist/chunks/{pal-7XHBGZ4S.js → pal-EANL2OUH.js} +17 -17
- package/dist/chunks/{peers-2MJG2EON.js → peers-H3ANL6XB.js} +9 -9
- package/dist/chunks/{peers-FJNLC7ZV.js → peers-W5KEFXN6.js} +25 -24
- package/dist/chunks/peers-W5KEFXN6.js.map +6 -0
- package/dist/chunks/{pending-4FM6EO26.js → pending-TRLAK2BR.js} +7 -7
- package/dist/chunks/{plugin-5J3GMENO.js → plugin-RAY3J2G2.js} +33 -32
- package/dist/chunks/plugin-RAY3J2G2.js.map +6 -0
- package/dist/chunks/{proposals-BGOU7KAM.js → proposals-YB3YJOPW.js} +39 -39
- package/dist/chunks/{providers-6PVAW2M3.js → providers-JA3AF524.js} +20 -20
- package/dist/chunks/{providers-ZFUFVRRD.js → providers-LVD7T5JI.js} +12 -12
- package/dist/chunks/{pty-3WHZDZXY.js → pty-66OF4YNF.js} +3 -3
- package/dist/chunks/resume-W4JBH2A7.js +28 -0
- package/dist/chunks/{resume-command-4VQ5ZTNJ.js → resume-command-J3VONMB5.js} +5 -5
- package/dist/chunks/{running-QT5QIYNC.js → running-5GQPD6OM.js} +4 -4
- package/dist/chunks/{say-JISSL5GL.js → say-7GQSUSTD.js} +21 -21
- package/dist/chunks/{schedule-5VVP4D3W.js → schedule-LMXNNMAZ.js} +16 -16
- package/dist/chunks/{send-F7EBK2UQ.js → send-Z35YQVV2.js} +20 -20
- package/dist/chunks/send-person-TIM427ZP.js +39 -0
- package/dist/chunks/{servers-WVOZNOUM.js → servers-4QP7GKOK.js} +8 -8
- package/dist/chunks/{service-7QGHSF2V.js → service-U244Z3VG.js} +48 -48
- package/dist/chunks/{session-options-WW5IDZEZ.js → session-options-ODKOXNAT.js} +5 -5
- package/dist/chunks/{setting-cli-AC5BEDWA.js → setting-cli-H5UKKB4F.js} +18 -17
- package/dist/chunks/{skills-QQ74IBRB.js → skills-ELR2D7WU.js} +33 -33
- package/dist/chunks/{source-deliveries-C2DRS4H6.js → source-deliveries-CI5K5DJQ.js} +20 -20
- package/dist/chunks/{start-check-5L262F53.js → start-check-JYINXXEG.js} +2 -2
- package/dist/chunks/{startup-failure-4PLTFEVA.js → startup-failure-G3HSW2U3.js} +2 -2
- package/dist/chunks/{state-BTF5VEKZ.js → state-EDIR4EM2.js} +25 -25
- package/dist/chunks/{store-WECWJFQV.js → store-4HJUNR5E.js} +3 -3
- package/dist/chunks/{store-WOSPWPH2.js → store-6SNBHHJA.js} +4 -4
- package/dist/chunks/{store-RTWBXAKA.js → store-ADMKKWZF.js} +13 -13
- package/dist/chunks/{store-OTVBA4G2.js → store-IKXRGI2L.js} +9 -9
- package/dist/chunks/{tui-EWG7SLNZ.js → tui-AKXFDXNZ.js} +122 -120
- package/dist/chunks/tui-AKXFDXNZ.js.map +6 -0
- package/dist/chunks/{update-7FGJLU2B.js → update-TYCWQEHZ.js} +315 -34
- package/dist/chunks/update-TYCWQEHZ.js.map +6 -0
- package/dist/chunks/{watch-KKQKQKA6.js → watch-RQYBCHYR.js} +124 -122
- package/dist/chunks/watch-RQYBCHYR.js.map +6 -0
- package/dist/chunks/{windows-home-VPSYQVOZ.js → windows-home-IZGCRSW7.js} +5 -5
- package/dist/chunks/{workspaces-7DZS6QLA.js → workspaces-6KGOMHCM.js} +30 -30
- package/dist/chunks/{worktree-XZ5Y74RZ.js → worktree-O7RSM3PC.js} +33 -33
- package/dist/cli.d.ts.map +1 -1
- package/dist/commands/acp.d.ts.map +1 -1
- package/dist/commands/action-help.d.ts +1 -1
- package/dist/commands/action-help.d.ts.map +1 -1
- package/dist/commands/actions/small.d.ts +1 -0
- package/dist/commands/actions/small.d.ts.map +1 -1
- package/dist/commands/auth-status.d.ts +1 -1
- package/dist/commands/auth-status.d.ts.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/completion-shells.d.ts +8 -0
- package/dist/commands/completion-shells.d.ts.map +1 -0
- package/dist/commands/completion.d.ts +6 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/debug.d.ts.map +1 -1
- package/dist/commands/desktop-chat-workspace.d.ts +25 -0
- package/dist/commands/desktop-chat-workspace.d.ts.map +1 -0
- package/dist/commands/desktop-host.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/drain.d.ts +19 -1
- package/dist/commands/drain.d.ts.map +1 -1
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/exec-json.d.ts.map +1 -1
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/index-project.d.ts +3 -0
- package/dist/commands/index-project.d.ts.map +1 -0
- package/dist/commands/manifest.d.ts +1 -0
- package/dist/commands/manifest.d.ts.map +1 -1
- package/dist/commands/registry.d.ts +1 -0
- package/dist/commands/registry.d.ts.map +1 -1
- package/dist/commands/update-migrate.d.ts +39 -0
- package/dist/commands/update-migrate.d.ts.map +1 -0
- package/dist/commands/update.d.ts +8 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/schema.d.ts +9 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/session-options.d.ts +1 -1
- package/dist/config/session-options.d.ts.map +1 -1
- package/dist/config/settings-descriptors.d.ts.map +1 -1
- package/dist/doctor/checks/chain.d.ts.map +1 -1
- package/dist/doctor/checks/credentials.d.ts.map +1 -1
- package/dist/doctor/checks/updates.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -57
- package/dist/integrations/auto-update/apply.d.ts.map +1 -1
- package/dist/integrations/auto-update/install-kind.d.ts +13 -0
- package/dist/integrations/auto-update/install-kind.d.ts.map +1 -1
- package/dist/integrations/auto-update/install-plan.d.ts +40 -0
- package/dist/integrations/auto-update/install-plan.d.ts.map +1 -0
- package/dist/integrations/auto-update/status.d.ts +8 -0
- package/dist/integrations/auto-update/status.d.ts.map +1 -1
- package/dist/integrations/auto-update/updater.d.ts.map +1 -1
- package/dist/integrations/images/generate-image.d.ts +2 -0
- package/dist/integrations/images/generate-image.d.ts.map +1 -1
- package/dist/integrations/providers/discover.d.ts +1 -0
- package/dist/integrations/providers/discover.d.ts.map +1 -1
- package/dist/integrations/providers/gemini-credentials.d.ts +2 -0
- package/dist/integrations/providers/gemini-credentials.d.ts.map +1 -1
- package/dist/integrations/semantic-search/chunk.d.ts +9 -0
- package/dist/integrations/semantic-search/chunk.d.ts.map +1 -0
- package/dist/integrations/semantic-search/consent.d.ts +4 -0
- package/dist/integrations/semantic-search/consent.d.ts.map +1 -0
- package/dist/integrations/semantic-search/embedding.d.ts +14 -0
- package/dist/integrations/semantic-search/embedding.d.ts.map +1 -0
- package/dist/integrations/semantic-search/index.d.ts +30 -0
- package/dist/integrations/semantic-search/index.d.ts.map +1 -0
- package/dist/integrations/semantic-search/tool.d.ts +3 -0
- package/dist/integrations/semantic-search/tool.d.ts.map +1 -0
- package/dist/integrations/sessions/uncheckpointed-turn.d.ts +47 -0
- package/dist/integrations/sessions/uncheckpointed-turn.d.ts.map +1 -0
- package/dist/plan/approval.d.ts +8 -6
- package/dist/plan/approval.d.ts.map +1 -1
- package/dist/plan/exit-plan-mode-tool.d.ts.map +1 -1
- package/dist/plan/handover.d.ts +23 -0
- package/dist/plan/handover.d.ts.map +1 -0
- package/dist/rounds/types.d.ts +2 -0
- package/dist/rounds/types.d.ts.map +1 -1
- package/dist/sdk-peer.js +23 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/Composer.d.ts +3 -1
- package/dist/tui/Composer.d.ts.map +1 -1
- package/dist/tui/PlanApprovalOverlay.d.ts +2 -2
- package/dist/tui/PlanApprovalOverlay.d.ts.map +1 -1
- package/dist/tui/StatusBar.d.ts +1 -7
- package/dist/tui/StatusBar.d.ts.map +1 -1
- package/dist/tui/agent.d.ts +21 -1
- package/dist/tui/agent.d.ts.map +1 -1
- package/dist/tui/computer-use-enable-offer.d.ts.map +1 -1
- package/dist/tui/message-closes-ask.d.ts +14 -0
- package/dist/tui/message-closes-ask.d.ts.map +1 -0
- package/dist/tui/plain-failure.d.ts.map +1 -1
- package/dist/tui/slash-argument-completion.d.ts +37 -0
- package/dist/tui/slash-argument-completion.d.ts.map +1 -0
- package/dist/tui/slashCommands.d.ts +3 -1
- package/dist/tui/slashCommands.d.ts.map +1 -1
- package/dist/tui/types.d.ts +1 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/usage-error.d.ts +0 -10
- package/dist/usage-error.d.ts.map +1 -1
- package/package.json +15 -15
- package/dist/chunks/acp-XC6FTO64.js.map +0 -6
- package/dist/chunks/agent-session-LYNJM6TP.js +0 -105
- package/dist/chunks/auth-JAKMDE4X.js.map +0 -6
- package/dist/chunks/bin-main-V6PBLHRK.js.map +0 -6
- package/dist/chunks/chunk-2YPRONTU.js.map +0 -6
- package/dist/chunks/chunk-3OHJYUFP.js.map +0 -6
- package/dist/chunks/chunk-5B4BXZCI.js.map +0 -6
- package/dist/chunks/chunk-5U4IA3HS.js.map +0 -6
- package/dist/chunks/chunk-7L3PTSKY.js.map +0 -6
- package/dist/chunks/chunk-A2GT47E2.js.map +0 -6
- package/dist/chunks/chunk-AUDTDXWX.js.map +0 -6
- package/dist/chunks/chunk-HS7PPGS3.js.map +0 -6
- package/dist/chunks/chunk-KGCHR4TQ.js.map +0 -6
- package/dist/chunks/chunk-MNQL7ZAW.js.map +0 -6
- package/dist/chunks/chunk-NJUB2ADX.js.map +0 -6
- package/dist/chunks/chunk-TV7UBGX2.js.map +0 -6
- package/dist/chunks/chunk-V5DZWA6R.js.map +0 -6
- package/dist/chunks/chunk-VBG357AO.js.map +0 -6
- package/dist/chunks/chunk-VVMI6HQM.js.map +0 -6
- package/dist/chunks/chunk-XJ4APISC.js.map +0 -6
- package/dist/chunks/chunk-ZZ7A2Y7O.js.map +0 -6
- package/dist/chunks/config-PUASBICJ.js.map +0 -6
- package/dist/chunks/debug-DX3SZNDB.js.map +0 -6
- package/dist/chunks/doctor-CPX7KDGR.js +0 -103
- package/dist/chunks/drain-2WIWFYU3.js.map +0 -6
- package/dist/chunks/exec-J55XOCSL.js.map +0 -6
- package/dist/chunks/live-LDWIFGRI.js +0 -102
- package/dist/chunks/message-command-QF7YMZDH.js.map +0 -6
- package/dist/chunks/peers-FJNLC7ZV.js.map +0 -6
- package/dist/chunks/plugin-5J3GMENO.js.map +0 -6
- package/dist/chunks/resume-IQMUIIBO.js +0 -28
- package/dist/chunks/send-person-LHJCPCAT.js +0 -39
- package/dist/chunks/tui-EWG7SLNZ.js.map +0 -6
- package/dist/chunks/update-7FGJLU2B.js.map +0 -6
- package/dist/chunks/watch-KKQKQKA6.js.map +0 -6
- /package/dist/chunks/{activity-command-PIH63SRU.js.map → activity-command-X25POZ3R.js.map} +0 -0
- /package/dist/chunks/{add-CWIB4XVU.js.map → add-HL4MO6R2.js.map} +0 -0
- /package/dist/chunks/{agent-CNRZCXHY.js.map → agent-MHH4MGYB.js.map} +0 -0
- /package/dist/chunks/{agent-session-LYNJM6TP.js.map → agent-session-OC32VSS6.js.map} +0 -0
- /package/dist/chunks/{apply-at-exit-CMRH3GQN.js.map → apply-at-exit-ADWMDFFQ.js.map} +0 -0
- /package/dist/chunks/{archive-DPZ3PWUU.js.map → archive-6X2FED3E.js.map} +0 -0
- /package/dist/chunks/{binding-UHJZD5Z3.js.map → binding-OXJ5TL6T.js.map} +0 -0
- /package/dist/chunks/{browser-2QBVPHCB.js.map → browser-DFLZNRRZ.js.map} +0 -0
- /package/dist/chunks/{chat-DJEP53BA.js.map → chat-PPSFN5JK.js.map} +0 -0
- /package/dist/chunks/{chunk-4JKWOO7I.js.map → chunk-23AYRMS2.js.map} +0 -0
- /package/dist/chunks/{chunk-MUQOV75B.js.map → chunk-2H75JWKG.js.map} +0 -0
- /package/dist/chunks/{chunk-NEOVE6D5.js.map → chunk-2JKQ6BFI.js.map} +0 -0
- /package/dist/chunks/{chunk-UZVJQEYT.js.map → chunk-2KJUKF2E.js.map} +0 -0
- /package/dist/chunks/{chunk-IYBVVKSB.js.map → chunk-2QGSHJ4Y.js.map} +0 -0
- /package/dist/chunks/{chunk-ZNSVRCPH.js.map → chunk-2R6Z32IU.js.map} +0 -0
- /package/dist/chunks/{chunk-7FGITTVH.js.map → chunk-2USTJGLA.js.map} +0 -0
- /package/dist/chunks/{chunk-EIIJLF6W.js.map → chunk-333RR5BA.js.map} +0 -0
- /package/dist/chunks/{chunk-MCIYCR57.js.map → chunk-33TGFQ2U.js.map} +0 -0
- /package/dist/chunks/{chunk-C4RV2D57.js.map → chunk-3FFV4OSR.js.map} +0 -0
- /package/dist/chunks/{chunk-QI4IEHLE.js.map → chunk-3QXUETDN.js.map} +0 -0
- /package/dist/chunks/{chunk-4VTRURM6.js.map → chunk-3TLDTD6R.js.map} +0 -0
- /package/dist/chunks/{chunk-ONEBRD5O.js.map → chunk-4ASXGRP5.js.map} +0 -0
- /package/dist/chunks/{chunk-ZFOZVUUJ.js.map → chunk-4JPZYI6M.js.map} +0 -0
- /package/dist/chunks/{chunk-RBJDS73T.js.map → chunk-4TPXEWD5.js.map} +0 -0
- /package/dist/chunks/{chunk-COOW2AWX.js.map → chunk-5GJWIDVU.js.map} +0 -0
- /package/dist/chunks/{chunk-RXFFBB7A.js.map → chunk-5PQHBLZI.js.map} +0 -0
- /package/dist/chunks/{chunk-GMUWAUKQ.js.map → chunk-5UARTCJW.js.map} +0 -0
- /package/dist/chunks/{chunk-Q5SAOE7Q.js.map → chunk-5XROCBT5.js.map} +0 -0
- /package/dist/chunks/{chunk-WI6IGTC4.js.map → chunk-5YOREQIA.js.map} +0 -0
- /package/dist/chunks/{chunk-4E5KFKJA.js.map → chunk-6CL7TQOC.js.map} +0 -0
- /package/dist/chunks/{chunk-N5YRJQPS.js.map → chunk-7RCI6OBE.js.map} +0 -0
- /package/dist/chunks/{chunk-SIMI4VB7.js.map → chunk-7WPF7ATU.js.map} +0 -0
- /package/dist/chunks/{chunk-DKZAHG7B.js.map → chunk-AAN4XLUD.js.map} +0 -0
- /package/dist/chunks/{chunk-LDJXUI3Q.js.map → chunk-BB2RJOFI.js.map} +0 -0
- /package/dist/chunks/{chunk-ESWXNISI.js.map → chunk-BCHHHNLK.js.map} +0 -0
- /package/dist/chunks/{chunk-C6JX3GVK.js.map → chunk-BUQCQMXH.js.map} +0 -0
- /package/dist/chunks/{chunk-VLWMMDBY.js.map → chunk-COSMRH2Q.js.map} +0 -0
- /package/dist/chunks/{chunk-4VMFD7UC.js.map → chunk-CPZEJQ2Z.js.map} +0 -0
- /package/dist/chunks/{chunk-3AKPBYMA.js.map → chunk-DCVWFBYB.js.map} +0 -0
- /package/dist/chunks/{chunk-ADGTOEHA.js.map → chunk-DD3BJ4GM.js.map} +0 -0
- /package/dist/chunks/{chunk-4H2RPAXN.js.map → chunk-DKTU6RWO.js.map} +0 -0
- /package/dist/chunks/{chunk-OWKPJJKH.js.map → chunk-EODC62SI.js.map} +0 -0
- /package/dist/chunks/{chunk-IVTYJBJF.js.map → chunk-EOHPS7LC.js.map} +0 -0
- /package/dist/chunks/{chunk-2LZAZAWT.js.map → chunk-EPSLHLT3.js.map} +0 -0
- /package/dist/chunks/{chunk-SHUKR2A5.js.map → chunk-FAQQGJ2Z.js.map} +0 -0
- /package/dist/chunks/{chunk-OQFX532E.js.map → chunk-FJPM4YAO.js.map} +0 -0
- /package/dist/chunks/{chunk-TPMF64WM.js.map → chunk-FZSM7DSH.js.map} +0 -0
- /package/dist/chunks/{chunk-MMQGQ7BJ.js.map → chunk-G3V2OKYP.js.map} +0 -0
- /package/dist/chunks/{chunk-6WPK5S6Z.js.map → chunk-G4OR74MC.js.map} +0 -0
- /package/dist/chunks/{chunk-QWUHCBDT.js.map → chunk-HXZA5UUN.js.map} +0 -0
- /package/dist/chunks/{chunk-2AWKLDCQ.js.map → chunk-IDIVB67E.js.map} +0 -0
- /package/dist/chunks/{chunk-IISM3GHE.js.map → chunk-ISI36EUS.js.map} +0 -0
- /package/dist/chunks/{chunk-SNHJJI52.js.map → chunk-IUMOIQKL.js.map} +0 -0
- /package/dist/chunks/{chunk-P5LQ4NRD.js.map → chunk-J4NFH5T2.js.map} +0 -0
- /package/dist/chunks/{chunk-HYHHGMBC.js.map → chunk-J6JBHNNR.js.map} +0 -0
- /package/dist/chunks/{chunk-UGBHE6ZS.js.map → chunk-JCY3OPTY.js.map} +0 -0
- /package/dist/chunks/{chunk-S76POTJP.js.map → chunk-JD7EWFIJ.js.map} +0 -0
- /package/dist/chunks/{chunk-2K7EIRI2.js.map → chunk-JOVKHMJS.js.map} +0 -0
- /package/dist/chunks/{chunk-GOKGPFXK.js.map → chunk-JQ7HNIBS.js.map} +0 -0
- /package/dist/chunks/{chunk-I3HOLAAO.js.map → chunk-JSWFUARY.js.map} +0 -0
- /package/dist/chunks/{chunk-NTUKFINL.js.map → chunk-JU3P3ZJJ.js.map} +0 -0
- /package/dist/chunks/{chunk-ZLMO5YL4.js.map → chunk-JWBS363M.js.map} +0 -0
- /package/dist/chunks/{chunk-HZGT5EHL.js.map → chunk-JXBSJNUF.js.map} +0 -0
- /package/dist/chunks/{chunk-X6LDRLVN.js.map → chunk-JZTNWODR.js.map} +0 -0
- /package/dist/chunks/{chunk-HJHZJKAD.js.map → chunk-K4AUROOC.js.map} +0 -0
- /package/dist/chunks/{chunk-RL2CTUF2.js.map → chunk-KFFW7EYQ.js.map} +0 -0
- /package/dist/chunks/{chunk-SEW4KEZ5.js.map → chunk-KGKVNHFC.js.map} +0 -0
- /package/dist/chunks/{chunk-SOZSIDCY.js.map → chunk-KLIJLSWF.js.map} +0 -0
- /package/dist/chunks/{chunk-BS3KGJJZ.js.map → chunk-LJFDFGFU.js.map} +0 -0
- /package/dist/chunks/{chunk-O3T5CJQG.js.map → chunk-LZPPIRJW.js.map} +0 -0
- /package/dist/chunks/{chunk-H624ADJH.js.map → chunk-MHEYQD24.js.map} +0 -0
- /package/dist/chunks/{chunk-44KWXPBG.js.map → chunk-MM7HGD6H.js.map} +0 -0
- /package/dist/chunks/{chunk-C56FUSQH.js.map → chunk-N4KE47J2.js.map} +0 -0
- /package/dist/chunks/{chunk-QNRBLNA3.js.map → chunk-N4USZWBA.js.map} +0 -0
- /package/dist/chunks/{chunk-GCLZEMDF.js.map → chunk-OIFFABSH.js.map} +0 -0
- /package/dist/chunks/{chunk-NRR2SMR6.js.map → chunk-OKFU62GA.js.map} +0 -0
- /package/dist/chunks/{chunk-G6YSAHKC.js.map → chunk-OWPDRJ6S.js.map} +0 -0
- /package/dist/chunks/{chunk-LCZWTKIB.js.map → chunk-P4WMRT5Q.js.map} +0 -0
- /package/dist/chunks/{chunk-EHKWQ7IS.js.map → chunk-PGHGBSS2.js.map} +0 -0
- /package/dist/chunks/{chunk-OA76OH27.js.map → chunk-PLPVXHTM.js.map} +0 -0
- /package/dist/chunks/{chunk-KE2RFCTY.js.map → chunk-PMA5NXWF.js.map} +0 -0
- /package/dist/chunks/{chunk-5RA5FZDM.js.map → chunk-PSRWFKFX.js.map} +0 -0
- /package/dist/chunks/{chunk-NXFB5AP5.js.map → chunk-PTUICVCN.js.map} +0 -0
- /package/dist/chunks/{chunk-ZIF4GK2U.js.map → chunk-Q5THGA3N.js.map} +0 -0
- /package/dist/chunks/{chunk-5SRVOPRS.js.map → chunk-QTR6UU63.js.map} +0 -0
- /package/dist/chunks/{chunk-7BNKRTXM.js.map → chunk-RIVPA5TG.js.map} +0 -0
- /package/dist/chunks/{chunk-HPUVBU7G.js.map → chunk-RQYSVELQ.js.map} +0 -0
- /package/dist/chunks/{chunk-RKAZUYKY.js.map → chunk-RWSHMPFM.js.map} +0 -0
- /package/dist/chunks/{chunk-CQNIP7QC.js.map → chunk-RZ3HYPV4.js.map} +0 -0
- /package/dist/chunks/{chunk-AFYS4U45.js.map → chunk-SDWOSB3L.js.map} +0 -0
- /package/dist/chunks/{chunk-AT42FHTY.js.map → chunk-SPKNKEW5.js.map} +0 -0
- /package/dist/chunks/{chunk-UUMISHVL.js.map → chunk-SQDZZCQJ.js.map} +0 -0
- /package/dist/chunks/{chunk-KFB4RMNZ.js.map → chunk-SRNS347K.js.map} +0 -0
- /package/dist/chunks/{chunk-GUOCXE6V.js.map → chunk-SX7FXWTB.js.map} +0 -0
- /package/dist/chunks/{chunk-WGN4AUAW.js.map → chunk-T6FMC7R5.js.map} +0 -0
- /package/dist/chunks/{chunk-SHW5NXAS.js.map → chunk-TDCHFQVU.js.map} +0 -0
- /package/dist/chunks/{chunk-6AINAG3P.js.map → chunk-TGQWC44Q.js.map} +0 -0
- /package/dist/chunks/{chunk-XPTCRZ6F.js.map → chunk-TIM7OEJN.js.map} +0 -0
- /package/dist/chunks/{chunk-TAPWAMDX.js.map → chunk-TO5ROEIW.js.map} +0 -0
- /package/dist/chunks/{chunk-QTGW6FJG.js.map → chunk-TTBXKYFP.js.map} +0 -0
- /package/dist/chunks/{chunk-757LAANV.js.map → chunk-TXCQMW7F.js.map} +0 -0
- /package/dist/chunks/{chunk-WD5XJ5ZU.js.map → chunk-UCF6H5BB.js.map} +0 -0
- /package/dist/chunks/{chunk-5ER7BU54.js.map → chunk-UP3ATLU6.js.map} +0 -0
- /package/dist/chunks/{chunk-E5LJN2DV.js.map → chunk-UTC325FB.js.map} +0 -0
- /package/dist/chunks/{chunk-C3UATI2T.js.map → chunk-VH647IFM.js.map} +0 -0
- /package/dist/chunks/{chunk-5K6GFGCD.js.map → chunk-VMWPRI2S.js.map} +0 -0
- /package/dist/chunks/{chunk-PTBKVAHY.js.map → chunk-VWJOJJNQ.js.map} +0 -0
- /package/dist/chunks/{chunk-QVUF2FSM.js.map → chunk-W3QW6SK6.js.map} +0 -0
- /package/dist/chunks/{chunk-P5UUY56J.js.map → chunk-W4EKIBRD.js.map} +0 -0
- /package/dist/chunks/{chunk-SC3GK5QC.js.map → chunk-WMWRRDO2.js.map} +0 -0
- /package/dist/chunks/{chunk-5TSOB5RI.js.map → chunk-WNBIAOXA.js.map} +0 -0
- /package/dist/chunks/{chunk-Q7NB7LRR.js.map → chunk-WQL7MEOD.js.map} +0 -0
- /package/dist/chunks/{chunk-335D56LG.js.map → chunk-X2LYTBDH.js.map} +0 -0
- /package/dist/chunks/{chunk-OLX3IUKN.js.map → chunk-X4TVUANR.js.map} +0 -0
- /package/dist/chunks/{chunk-EGRSUSP4.js.map → chunk-XBX3T6YY.js.map} +0 -0
- /package/dist/chunks/{chunk-Z4UCKCEQ.js.map → chunk-XC6G27M2.js.map} +0 -0
- /package/dist/chunks/{chunk-RXVJEZSV.js.map → chunk-XGH3FZ76.js.map} +0 -0
- /package/dist/chunks/{chunk-6GCYUKNK.js.map → chunk-XK7NQIZA.js.map} +0 -0
- /package/dist/chunks/{chunk-BHO3RAXS.js.map → chunk-XNMJLM5W.js.map} +0 -0
- /package/dist/chunks/{chunk-G5MD6XCV.js.map → chunk-XORYHNZ3.js.map} +0 -0
- /package/dist/chunks/{chunk-EW2YVKTN.js.map → chunk-XTMUUGTN.js.map} +0 -0
- /package/dist/chunks/{chunk-DO5JIP3I.js.map → chunk-Y36ZTLIJ.js.map} +0 -0
- /package/dist/chunks/{chunk-NUMKSEG4.js.map → chunk-YCPK5ZTB.js.map} +0 -0
- /package/dist/chunks/{chunk-HXINZ7D3.js.map → chunk-YRQ5PI7O.js.map} +0 -0
- /package/dist/chunks/{chunk-ORXNYBJU.js.map → chunk-YXR3LVZE.js.map} +0 -0
- /package/dist/chunks/{chunk-4ABPUIBF.js.map → chunk-YYGE5EWH.js.map} +0 -0
- /package/dist/chunks/{chunk-RJINNWMH.js.map → chunk-YZ6UKIKL.js.map} +0 -0
- /package/dist/chunks/{chunk-L45TVHRJ.js.map → chunk-Z75IWPPX.js.map} +0 -0
- /package/dist/chunks/{chunk-XNVZ6BPI.js.map → chunk-ZAQFM5BR.js.map} +0 -0
- /package/dist/chunks/{chunk-FDLXZRE4.js.map → chunk-ZDJWREOA.js.map} +0 -0
- /package/dist/chunks/{chunk-UGTDCLS5.js.map → chunk-ZKTDZOCC.js.map} +0 -0
- /package/dist/chunks/{chunk-QHJJ333E.js.map → chunk-ZQL7XFSE.js.map} +0 -0
- /package/dist/chunks/{cli-runtime-FK3WLEHC.js.map → cli-runtime-ZKBJFWOI.js.map} +0 -0
- /package/dist/chunks/{commands-UVEHHHUD.js.map → commands-3WI6F2YZ.js.map} +0 -0
- /package/dist/chunks/{computer-GABH2PJF.js.map → computer-WEEMTZUV.js.map} +0 -0
- /package/dist/chunks/{cost-S6LUVWMS.js.map → cost-557HKPZ4.js.map} +0 -0
- /package/dist/chunks/{crash-report-WSCK3UQK.js.map → crash-report-J47RFQ5T.js.map} +0 -0
- /package/dist/chunks/{desktop-host-schedule-tool-X5AYUZMV.js.map → desktop-host-schedule-tool-IOOJNMPQ.js.map} +0 -0
- /package/dist/chunks/{dist-WBDFP2PT.js.map → dist-665VSCM2.js.map} +0 -0
- /package/dist/chunks/{dist-NJJDM4QY.js.map → dist-AQO44B7K.js.map} +0 -0
- /package/dist/chunks/{dist-3GV6WNET.js.map → dist-D2RTUX7F.js.map} +0 -0
- /package/dist/chunks/{dist-BFD35FTG.js.map → dist-JLTZUUMS.js.map} +0 -0
- /package/dist/chunks/{dist-X7QK25WG.js.map → dist-L5C6AOXZ.js.map} +0 -0
- /package/dist/chunks/{dist-AAPFBZPA.js.map → dist-SEISKEDK.js.map} +0 -0
- /package/dist/chunks/{dist-XLMKK2FY.js.map → dist-VQVXULA5.js.map} +0 -0
- /package/dist/chunks/{doctor-CPX7KDGR.js.map → doctor-ZRPCR5DP.js.map} +0 -0
- /package/dist/chunks/{entry-KSTSU23A.js.map → entry-TPBKHAWV.js.map} +0 -0
- /package/dist/chunks/{extension-3YMXVKLS.js.map → extension-KJJ7XNR4.js.map} +0 -0
- /package/dist/chunks/{feed-66TKSG2Y.js.map → feed-LQNVF7M6.js.map} +0 -0
- /package/dist/chunks/{github-7JHAZZC3.js.map → github-LMMBAQWI.js.map} +0 -0
- /package/dist/chunks/{home-RJERCCZS.js.map → home-D7JCGXQE.js.map} +0 -0
- /package/dist/chunks/{homes-P5UAFUPZ.js.map → homes-EKTHOMXX.js.map} +0 -0
- /package/dist/chunks/{hooks-U2Z463DN.js.map → hooks-IT2ZUPG6.js.map} +0 -0
- /package/dist/chunks/{hooks-report-FIPQINVZ.js.map → hooks-report-A7F26EDM.js.map} +0 -0
- /package/dist/chunks/{host-IWAXBSUX.js.map → host-FS2RMOHW.js.map} +0 -0
- /package/dist/chunks/{host-queries-3IRCFZ74.js.map → host-queries-OJXR2XYT.js.map} +0 -0
- /package/dist/chunks/{installed-list-IBGMBHUJ.js.map → installed-list-27KYS56I.js.map} +0 -0
- /package/dist/chunks/{launch-UHLESLJC.js.map → launch-33I3O7VJ.js.map} +0 -0
- /package/dist/chunks/{learn-TQHDWYWB.js.map → learn-G5UEINB6.js.map} +0 -0
- /package/dist/chunks/{learn-builtin-2OY2YL6U.js.map → learn-builtin-Y5FIKQSV.js.map} +0 -0
- /package/dist/chunks/{lifecycle-ECBTALQV.js.map → lifecycle-NJQ7FIK2.js.map} +0 -0
- /package/dist/chunks/{list-GECT7X6E.js.map → list-UKBQESKU.js.map} +0 -0
- /package/dist/chunks/{live-LDWIFGRI.js.map → live-3YNFFWY5.js.map} +0 -0
- /package/dist/chunks/{load-LFCACQWA.js.map → load-KDS3CW6R.js.map} +0 -0
- /package/dist/chunks/{logs-55HJKNP6.js.map → logs-3XKNKFY2.js.map} +0 -0
- /package/dist/chunks/{mcp-XUKNYMSO.js.map → mcp-B2ZVGJQE.js.map} +0 -0
- /package/dist/chunks/{mcp-serve-XYNR3BNJ.js.map → mcp-serve-DH63SWUH.js.map} +0 -0
- /package/dist/chunks/{notes-TQTBT2ZZ.js.map → notes-ZCY7LTUD.js.map} +0 -0
- /package/dist/chunks/{open-CDLLQS4B.js.map → open-A4H4HWGO.js.map} +0 -0
- /package/dist/chunks/{operator-tools-XAFRSL26.js.map → operator-tools-EH6R2JQC.js.map} +0 -0
- /package/dist/chunks/{output-schema-5KOV6OJ6.js.map → output-schema-2NSAYRBS.js.map} +0 -0
- /package/dist/chunks/{pal-7XHBGZ4S.js.map → pal-EANL2OUH.js.map} +0 -0
- /package/dist/chunks/{peers-2MJG2EON.js.map → peers-H3ANL6XB.js.map} +0 -0
- /package/dist/chunks/{pending-4FM6EO26.js.map → pending-TRLAK2BR.js.map} +0 -0
- /package/dist/chunks/{proposals-BGOU7KAM.js.map → proposals-YB3YJOPW.js.map} +0 -0
- /package/dist/chunks/{providers-6PVAW2M3.js.map → providers-JA3AF524.js.map} +0 -0
- /package/dist/chunks/{providers-ZFUFVRRD.js.map → providers-LVD7T5JI.js.map} +0 -0
- /package/dist/chunks/{pty-3WHZDZXY.js.map → pty-66OF4YNF.js.map} +0 -0
- /package/dist/chunks/{resume-IQMUIIBO.js.map → resume-W4JBH2A7.js.map} +0 -0
- /package/dist/chunks/{resume-command-4VQ5ZTNJ.js.map → resume-command-J3VONMB5.js.map} +0 -0
- /package/dist/chunks/{running-QT5QIYNC.js.map → running-5GQPD6OM.js.map} +0 -0
- /package/dist/chunks/{say-JISSL5GL.js.map → say-7GQSUSTD.js.map} +0 -0
- /package/dist/chunks/{schedule-5VVP4D3W.js.map → schedule-LMXNNMAZ.js.map} +0 -0
- /package/dist/chunks/{send-F7EBK2UQ.js.map → send-Z35YQVV2.js.map} +0 -0
- /package/dist/chunks/{send-person-LHJCPCAT.js.map → send-person-TIM427ZP.js.map} +0 -0
- /package/dist/chunks/{servers-WVOZNOUM.js.map → servers-4QP7GKOK.js.map} +0 -0
- /package/dist/chunks/{service-7QGHSF2V.js.map → service-U244Z3VG.js.map} +0 -0
- /package/dist/chunks/{session-options-WW5IDZEZ.js.map → session-options-ODKOXNAT.js.map} +0 -0
- /package/dist/chunks/{setting-cli-AC5BEDWA.js.map → setting-cli-H5UKKB4F.js.map} +0 -0
- /package/dist/chunks/{skills-QQ74IBRB.js.map → skills-ELR2D7WU.js.map} +0 -0
- /package/dist/chunks/{source-deliveries-C2DRS4H6.js.map → source-deliveries-CI5K5DJQ.js.map} +0 -0
- /package/dist/chunks/{start-check-5L262F53.js.map → start-check-JYINXXEG.js.map} +0 -0
- /package/dist/chunks/{startup-failure-4PLTFEVA.js.map → startup-failure-G3HSW2U3.js.map} +0 -0
- /package/dist/chunks/{state-BTF5VEKZ.js.map → state-EDIR4EM2.js.map} +0 -0
- /package/dist/chunks/{store-OTVBA4G2.js.map → store-4HJUNR5E.js.map} +0 -0
- /package/dist/chunks/{store-RTWBXAKA.js.map → store-6SNBHHJA.js.map} +0 -0
- /package/dist/chunks/{store-WECWJFQV.js.map → store-ADMKKWZF.js.map} +0 -0
- /package/dist/chunks/{store-WOSPWPH2.js.map → store-IKXRGI2L.js.map} +0 -0
- /package/dist/chunks/{windows-home-VPSYQVOZ.js.map → windows-home-IZGCRSW7.js.map} +0 -0
- /package/dist/chunks/{workspaces-7DZS6QLA.js.map → workspaces-6KGOMHCM.js.map} +0 -0
- /package/dist/chunks/{worktree-XZ5Y74RZ.js.map → worktree-O7RSM3PC.js.map} +0 -0
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
selectAssistantText,
|
|
16
16
|
toToolResultBlocks,
|
|
17
17
|
toolResultToText
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BBNACUZ3.js";
|
|
19
19
|
import {
|
|
20
20
|
__name
|
|
21
21
|
} from "./chunk-76FLAFCG.js";
|
|
@@ -158,6 +158,145 @@ function servedSpeed(served, requested) {
|
|
|
158
158
|
}
|
|
159
159
|
__name(servedSpeed, "servedSpeed");
|
|
160
160
|
|
|
161
|
+
// ../providers/openai/dist/images.js
|
|
162
|
+
var CODEX_IMAGE_MODEL = "gpt-image-2";
|
|
163
|
+
var CODEX_DEFAULT_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
164
|
+
var IMAGE_TURN_HEADER = "x-codex-image-turn-id";
|
|
165
|
+
var ACTIVE_LIMIT_HEADER = "x-codex-active-limit";
|
|
166
|
+
var CODEX_IMAGE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
167
|
+
var CODEX_IMAGE_MAX_BYTES = 32 * 1024 * 1024;
|
|
168
|
+
var CODEX_IMAGE_LIMIT_IDS = ["image_gen", "imagegen_premium"];
|
|
169
|
+
var CodexImagesError = class extends Error {
|
|
170
|
+
static {
|
|
171
|
+
__name(this, "CodexImagesError");
|
|
172
|
+
}
|
|
173
|
+
status;
|
|
174
|
+
usageLimit;
|
|
175
|
+
requestId;
|
|
176
|
+
constructor(message, details = {}) {
|
|
177
|
+
super(message);
|
|
178
|
+
this.name = "CodexImagesError";
|
|
179
|
+
if (details.status !== void 0)
|
|
180
|
+
this.status = details.status;
|
|
181
|
+
if (details.usageLimit !== void 0)
|
|
182
|
+
this.usageLimit = details.usageLimit;
|
|
183
|
+
if (details.requestId !== void 0)
|
|
184
|
+
this.requestId = details.requestId;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
function asRecord(value) {
|
|
188
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
189
|
+
}
|
|
190
|
+
__name(asRecord, "asRecord");
|
|
191
|
+
function codexRequestHeaders(accountId) {
|
|
192
|
+
return {
|
|
193
|
+
...attributionHeaders(),
|
|
194
|
+
"ChatGPT-Account-Id": accountId,
|
|
195
|
+
originator: "Codex Namzu",
|
|
196
|
+
"User-Agent": "Codex Namzu/1.0"
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
__name(codexRequestHeaders, "codexRequestHeaders");
|
|
200
|
+
function sniffImageType(bytes) {
|
|
201
|
+
const head = bytes.subarray(0, 6).toString("latin1");
|
|
202
|
+
return head === "GIF87a" || head === "GIF89a" ? "image/gif" : "image/png";
|
|
203
|
+
}
|
|
204
|
+
__name(sniffImageType, "sniffImageType");
|
|
205
|
+
function failureFrom(status, text, headers) {
|
|
206
|
+
const requestId = headers.get("x-codex-imagegen-request-id") ?? void 0;
|
|
207
|
+
let body = null;
|
|
208
|
+
try {
|
|
209
|
+
body = asRecord(JSON.parse(text));
|
|
210
|
+
} catch {
|
|
211
|
+
body = null;
|
|
212
|
+
}
|
|
213
|
+
const error = asRecord(body?.error);
|
|
214
|
+
const type = typeof error?.type === "string" ? error.type : void 0;
|
|
215
|
+
const message = typeof error?.message === "string" && error.message || text.trim().slice(0, 300) || "";
|
|
216
|
+
if (status === 429 && type === "usage_limit_reached") {
|
|
217
|
+
const limitId = headers.get(ACTIVE_LIMIT_HEADER) ?? void 0;
|
|
218
|
+
const seconds = typeof error?.resets_at === "number" ? error.resets_at : void 0;
|
|
219
|
+
return new CodexImagesError("The image quota of this plan is used up.", {
|
|
220
|
+
status,
|
|
221
|
+
usageLimit: {
|
|
222
|
+
...limitId ? { limitId } : {},
|
|
223
|
+
...seconds !== void 0 ? { resetsAt: seconds * 1e3 } : {}
|
|
224
|
+
},
|
|
225
|
+
...requestId ? { requestId } : {}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
return new CodexImagesError(`HTTP ${status}${message ? `: ${message}` : ""}`, {
|
|
229
|
+
status,
|
|
230
|
+
...requestId ? { requestId } : {}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
__name(failureFrom, "failureFrom");
|
|
234
|
+
async function requestCodexImage(config, request) {
|
|
235
|
+
const base = (config.baseURL ?? CODEX_DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
236
|
+
const editing = request.images !== void 0 && request.images.length > 0;
|
|
237
|
+
const url = `${base}/images/${editing ? "edits" : "generations"}`;
|
|
238
|
+
const body = {
|
|
239
|
+
prompt: request.prompt,
|
|
240
|
+
model: CODEX_IMAGE_MODEL,
|
|
241
|
+
quality: "auto",
|
|
242
|
+
size: "auto",
|
|
243
|
+
background: request.transparentBackground === true ? "transparent" : "opaque",
|
|
244
|
+
...editing ? { images: request.images?.map((image_url) => ({ image_url })) } : {}
|
|
245
|
+
};
|
|
246
|
+
const timeout = AbortSignal.timeout(config.timeoutMs ?? CODEX_IMAGE_TIMEOUT_MS);
|
|
247
|
+
const signal = request.signal ? AbortSignal.any([request.signal, timeout]) : timeout;
|
|
248
|
+
const doFetch = config.fetch ?? fetch;
|
|
249
|
+
let response;
|
|
250
|
+
try {
|
|
251
|
+
response = await doFetch(url, {
|
|
252
|
+
method: "POST",
|
|
253
|
+
signal,
|
|
254
|
+
headers: {
|
|
255
|
+
...codexRequestHeaders(config.accountId),
|
|
256
|
+
...config.headers ?? {},
|
|
257
|
+
Authorization: `Bearer ${config.accessToken}`,
|
|
258
|
+
"Content-Type": "application/json",
|
|
259
|
+
Accept: "application/json",
|
|
260
|
+
...request.turnId ? { [IMAGE_TURN_HEADER]: request.turnId } : {}
|
|
261
|
+
},
|
|
262
|
+
body: JSON.stringify(body)
|
|
263
|
+
});
|
|
264
|
+
} catch (error) {
|
|
265
|
+
if (request.signal?.aborted)
|
|
266
|
+
throw request.signal.reason ?? error;
|
|
267
|
+
if (timeout.aborted)
|
|
268
|
+
throw new CodexImagesError("The image request timed out.");
|
|
269
|
+
throw new CodexImagesError(`The image request could not be sent: ${error instanceof Error ? error.message : String(error)}`);
|
|
270
|
+
}
|
|
271
|
+
const text = await response.text();
|
|
272
|
+
if (!response.ok)
|
|
273
|
+
throw failureFrom(response.status, text, response.headers);
|
|
274
|
+
const requestId = response.headers.get("x-codex-imagegen-request-id") ?? void 0;
|
|
275
|
+
let parsed = null;
|
|
276
|
+
try {
|
|
277
|
+
parsed = asRecord(JSON.parse(text));
|
|
278
|
+
} catch {
|
|
279
|
+
throw new CodexImagesError("The image response could not be read.", { requestId });
|
|
280
|
+
}
|
|
281
|
+
const first = Array.isArray(parsed?.data) ? asRecord(parsed.data[0]) : null;
|
|
282
|
+
const encoded = typeof first?.b64_json === "string" ? first.b64_json : "";
|
|
283
|
+
if (encoded === "")
|
|
284
|
+
throw new CodexImagesError("The image service returned no image data.");
|
|
285
|
+
if (Math.ceil(encoded.length * 0.75) > CODEX_IMAGE_MAX_BYTES + 3)
|
|
286
|
+
throw new CodexImagesError("The generated image is larger than 32 MiB and was not kept.");
|
|
287
|
+
const bytes = Buffer.from(encoded, "base64");
|
|
288
|
+
if (bytes.length === 0)
|
|
289
|
+
throw new CodexImagesError("The image service returned no image data.");
|
|
290
|
+
if (bytes.length > CODEX_IMAGE_MAX_BYTES)
|
|
291
|
+
throw new CodexImagesError("The generated image is larger than 32 MiB and was not kept.");
|
|
292
|
+
return {
|
|
293
|
+
bytes,
|
|
294
|
+
mediaType: sniffImageType(bytes),
|
|
295
|
+
...requestId ? { requestId } : {}
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
__name(requestCodexImage, "requestCodexImage");
|
|
299
|
+
|
|
161
300
|
// ../providers/openai/dist/model-limits.js
|
|
162
301
|
function asNumber(value) {
|
|
163
302
|
if (typeof value === "number")
|
|
@@ -209,1535 +348,1512 @@ function subscriptionLimits(row) {
|
|
|
209
348
|
}
|
|
210
349
|
__name(subscriptionLimits, "subscriptionLimits");
|
|
211
350
|
|
|
212
|
-
// ../providers/openai/dist/
|
|
213
|
-
var
|
|
214
|
-
|
|
351
|
+
// ../providers/openai/dist/codex.js
|
|
352
|
+
var CODEX_CAPABILITIES = {
|
|
353
|
+
supportsHostedWebSearch: true,
|
|
215
354
|
supportsTools: true,
|
|
216
355
|
supportsStreaming: true,
|
|
217
356
|
supportsFunctionCalling: true,
|
|
357
|
+
supportsNativeStructuredOutput: true,
|
|
218
358
|
supportsVision: true,
|
|
219
|
-
supportsDocuments:
|
|
220
|
-
supportsToolResultImages:
|
|
359
|
+
supportsDocuments: false,
|
|
360
|
+
supportsToolResultImages: true,
|
|
221
361
|
supportsToolResultDocuments: false
|
|
222
362
|
};
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
"low",
|
|
226
|
-
"medium",
|
|
227
|
-
"high"
|
|
228
|
-
];
|
|
229
|
-
var GPT_5_1_EFFORT = [
|
|
230
|
-
"none",
|
|
231
|
-
"low",
|
|
232
|
-
"medium",
|
|
233
|
-
"high"
|
|
234
|
-
];
|
|
235
|
-
var GPT_5_2_TO_5_5_EFFORT = [
|
|
236
|
-
"none",
|
|
237
|
-
"low",
|
|
238
|
-
"medium",
|
|
239
|
-
"high",
|
|
240
|
-
"xhigh"
|
|
241
|
-
];
|
|
242
|
-
var GPT_6_ASTRA_EFFORT = ["low", "medium", "high", "xhigh", "max"];
|
|
243
|
-
var GPT_5_6_EFFORT = [
|
|
363
|
+
var DEFAULT_CODEX_BASE_URL = CODEX_DEFAULT_BASE_URL;
|
|
364
|
+
var KNOWN_EFFORT_LEVELS = [
|
|
244
365
|
"none",
|
|
366
|
+
"minimal",
|
|
245
367
|
"low",
|
|
246
368
|
"medium",
|
|
247
369
|
"high",
|
|
248
370
|
"xhigh",
|
|
249
|
-
"max"
|
|
371
|
+
"max",
|
|
372
|
+
"ultra"
|
|
250
373
|
];
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return GPT_5_2_TO_5_5_EFFORT;
|
|
263
|
-
}
|
|
264
|
-
if (/^gpt-5\.2(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
265
|
-
return GPT_5_2_TO_5_5_EFFORT;
|
|
266
|
-
}
|
|
267
|
-
if (/^gpt-5\.1(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
268
|
-
return GPT_5_1_EFFORT;
|
|
269
|
-
}
|
|
270
|
-
if (/^gpt-5(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
271
|
-
return GPT_5_EFFORT;
|
|
374
|
+
function subscriptionReasoningProfile(item) {
|
|
375
|
+
if (!Array.isArray(item.supported_reasoning_levels))
|
|
376
|
+
return void 0;
|
|
377
|
+
const levels = [];
|
|
378
|
+
for (const entry of item.supported_reasoning_levels) {
|
|
379
|
+
const effort = record(entry)?.effort;
|
|
380
|
+
if (typeof effort !== "string" || !KNOWN_EFFORT_LEVELS.includes(effort))
|
|
381
|
+
return void 0;
|
|
382
|
+
if (levels.includes(effort))
|
|
383
|
+
return void 0;
|
|
384
|
+
levels.push(effort);
|
|
272
385
|
}
|
|
273
|
-
|
|
386
|
+
const defaultLevel = item.default_reasoning_level;
|
|
387
|
+
return {
|
|
388
|
+
levels: Object.freeze(levels),
|
|
389
|
+
...typeof defaultLevel === "string" && levels.includes(defaultLevel) ? { default: defaultLevel } : {}
|
|
390
|
+
};
|
|
274
391
|
}
|
|
275
|
-
__name(
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
if (normalized === "gpt-6-astra")
|
|
279
|
-
return true;
|
|
280
|
-
if (/^(?:ft:)?gpt-5(?![a-z0-9])/.test(normalized))
|
|
281
|
-
return !/-chat(?:-|$)/.test(normalized);
|
|
282
|
-
return /^(?:ft:)?o\d/.test(normalized);
|
|
392
|
+
__name(subscriptionReasoningProfile, "subscriptionReasoningProfile");
|
|
393
|
+
function sameRoute(left, right) {
|
|
394
|
+
return left.providerId === right.providerId && left.model === right.model && left.chainIndex === right.chainIndex;
|
|
283
395
|
}
|
|
284
|
-
__name(
|
|
285
|
-
function
|
|
286
|
-
return
|
|
396
|
+
__name(sameRoute, "sameRoute");
|
|
397
|
+
function record(value) {
|
|
398
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
287
399
|
}
|
|
288
|
-
__name(
|
|
289
|
-
function
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (!needsResponsesForToolsWithReasoning(model))
|
|
293
|
-
return;
|
|
294
|
-
if (params.effort === "none" || params.thinking?.type === "disabled")
|
|
295
|
-
return;
|
|
296
|
-
throw new Error(`OpenAIProvider: model "${model}" does not take function tools together with reasoning on Chat Completions (it needs the Responses API, which this driver does not use with an API key). Set \`effort\` to "none" for this request, drop the tools, or choose another model.`);
|
|
400
|
+
__name(record, "record");
|
|
401
|
+
function isRoute(value) {
|
|
402
|
+
const route = record(value);
|
|
403
|
+
return typeof route?.providerId === "string" && typeof route.model === "string" && Number.isInteger(route.chainIndex) && route.chainIndex >= 0;
|
|
297
404
|
}
|
|
298
|
-
__name(
|
|
299
|
-
function
|
|
300
|
-
return
|
|
405
|
+
__name(isRoute, "isRoute");
|
|
406
|
+
function durableToolCalls(message) {
|
|
407
|
+
return (message.toolCalls ?? []).map((call) => ({
|
|
408
|
+
id: call.id,
|
|
409
|
+
name: call.function.name,
|
|
410
|
+
arguments: call.function.arguments
|
|
411
|
+
}));
|
|
301
412
|
}
|
|
302
|
-
__name(
|
|
303
|
-
function
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return new URL(baseURL).hostname;
|
|
308
|
-
} catch {
|
|
309
|
-
return void 0;
|
|
413
|
+
__name(durableToolCalls, "durableToolCalls");
|
|
414
|
+
function isCodexReplayState(value) {
|
|
415
|
+
const state = record(value);
|
|
416
|
+
if (state?.kind !== "namzu.codex.responses" || state.version !== 1 || !isRoute(state.route) || state.content !== null && typeof state.content !== "string" || !Array.isArray(state.toolCalls) || !Array.isArray(state.items)) {
|
|
417
|
+
return false;
|
|
310
418
|
}
|
|
419
|
+
return state.toolCalls.every((item) => {
|
|
420
|
+
const call = record(item);
|
|
421
|
+
return typeof call?.id === "string" && typeof call.name === "string" && typeof call.arguments === "string";
|
|
422
|
+
});
|
|
311
423
|
}
|
|
312
|
-
__name(
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
328
|
-
}
|
|
329
|
-
__name(asRecord, "asRecord");
|
|
330
|
-
function ratePerMillion(value) {
|
|
331
|
-
const perToken = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
|
|
332
|
-
if (typeof perToken !== "number" || !Number.isFinite(perToken) || perToken < 0)
|
|
333
|
-
return void 0;
|
|
334
|
-
return Number((perToken * 1e6).toPrecision(12));
|
|
335
|
-
}
|
|
336
|
-
__name(ratePerMillion, "ratePerMillion");
|
|
337
|
-
function inputModalitiesOf(row, capabilities) {
|
|
338
|
-
if (capabilities?.vision === true)
|
|
339
|
-
return ["text", "image"];
|
|
340
|
-
if (capabilities?.vision === false)
|
|
341
|
-
return ["text"];
|
|
342
|
-
const declared = row.input_modalities ?? asRecord(row.architecture)?.input_modalities ?? // A plain `modalities` list is read for a chat model only: on another task it may name outputs.
|
|
343
|
-
(row.task === void 0 || row.task === "chat" ? row.modalities : void 0);
|
|
344
|
-
if (!Array.isArray(declared))
|
|
345
|
-
return void 0;
|
|
346
|
-
const known = INPUT_MODALITIES.filter((kind) => declared.includes(kind));
|
|
347
|
-
return known.length > 0 ? known : void 0;
|
|
424
|
+
__name(isCodexReplayState, "isCodexReplayState");
|
|
425
|
+
function replayItems(message, targetRoute) {
|
|
426
|
+
const source = message.source;
|
|
427
|
+
if (!source || source.type !== "model" || !sameRoute(source, targetRoute))
|
|
428
|
+
return null;
|
|
429
|
+
const state = source.replayState;
|
|
430
|
+
if (!isCodexReplayState(state) || !sameRoute(state.route, source))
|
|
431
|
+
return null;
|
|
432
|
+
if (state.content !== message.content)
|
|
433
|
+
return null;
|
|
434
|
+
if (state.textParts !== void 0 && JSON.stringify(state.textParts) !== JSON.stringify(message.textParts))
|
|
435
|
+
return null;
|
|
436
|
+
if (JSON.stringify(state.toolCalls) !== JSON.stringify(durableToolCalls(message)))
|
|
437
|
+
return null;
|
|
438
|
+
return state.items;
|
|
348
439
|
}
|
|
349
|
-
__name(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (contextWindow !== void 0)
|
|
356
|
-
result.contextWindow = contextWindow;
|
|
357
|
-
const maxOutputTokens = firstCount(row, ["maximum_output_tokens", "max_output_tokens", "max_completion_tokens"]) ?? firstCount(asRecord(row.top_provider), ["max_completion_tokens"]);
|
|
358
|
-
if (maxOutputTokens !== void 0)
|
|
359
|
-
result.maxOutputTokens = maxOutputTokens;
|
|
360
|
-
const inputModalities = inputModalitiesOf(row, capabilities);
|
|
361
|
-
if (inputModalities !== void 0)
|
|
362
|
-
result.inputModalities = inputModalities;
|
|
363
|
-
if (capabilities?.tools === false)
|
|
364
|
-
result.supportsToolUse = false;
|
|
365
|
-
const pricing = asRecord(row.pricing);
|
|
366
|
-
const currency = typeof pricing?.currency === "string" ? pricing.currency.toUpperCase() : void 0;
|
|
367
|
-
if (pricing && (currency === void 0 || currency === "USD")) {
|
|
368
|
-
const input = ratePerMillion(pricing.prompt);
|
|
369
|
-
const output = ratePerMillion(pricing.completion);
|
|
370
|
-
if (input !== void 0)
|
|
371
|
-
result.inputPrice = input;
|
|
372
|
-
if (output !== void 0)
|
|
373
|
-
result.outputPrice = output;
|
|
374
|
-
}
|
|
375
|
-
let offered = Array.isArray(row.supported_reasoning_efforts) ? row.supported_reasoning_efforts : void 0;
|
|
376
|
-
if (offered === void 0 && Array.isArray(capabilities?.reasoning_effort_values)) {
|
|
377
|
-
const aliases = asRecord(capabilities.reasoning_effort_aliases);
|
|
378
|
-
offered = [.../* @__PURE__ */ new Set([...capabilities.reasoning_effort_values, ...Object.keys(aliases ?? {})])];
|
|
379
|
-
}
|
|
380
|
-
const menu = offered !== void 0 && new Set(offered).size === offered.length && offered.every((level) => typeof level === "string" && EFFORT_VOCABULARY.includes(level)) ? offered : void 0;
|
|
381
|
-
if (menu) {
|
|
382
|
-
result.reasoningEffortLevels = [...menu];
|
|
383
|
-
const defaultEffort = row.reasoning_effort;
|
|
384
|
-
if (typeof defaultEffort === "string" && menu.includes(defaultEffort))
|
|
385
|
-
result.reasoningEffortDefault = defaultEffort;
|
|
386
|
-
} else if (offered === void 0 && capabilities?.reasoning_effort === false) {
|
|
387
|
-
result.reasoningEffortLevels = [];
|
|
440
|
+
__name(replayItems, "replayItems");
|
|
441
|
+
var IMAGE_MEDIA_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp", "image/gif"]);
|
|
442
|
+
var TOOL_RESULT_IMAGE_DETAIL = "high";
|
|
443
|
+
function codexImage(data, mediaType, source) {
|
|
444
|
+
if (!IMAGE_MEDIA_TYPES.has(mediaType)) {
|
|
445
|
+
throw new Error(`CodexProvider: ${source} image type '${mediaType}' is not supported. Use image/png, image/jpeg, image/webp, or image/gif.`);
|
|
388
446
|
}
|
|
389
|
-
return result;
|
|
390
|
-
}
|
|
391
|
-
__name(compatibleModelMetadata, "compatibleModelMetadata");
|
|
392
|
-
function assertOpenAIReasoningEffort(model, effort) {
|
|
393
|
-
if (effort === void 0)
|
|
394
|
-
return;
|
|
395
|
-
const supported = openAIReasoningEffortLevels(model);
|
|
396
|
-
if (supported === void 0 || supported.includes(effort))
|
|
397
|
-
return;
|
|
398
|
-
throw new Error(`OpenAIProvider: effort "${effort}" is not supported by model "${model}". Supported levels: ${supported.join(", ")}. Choose one of those levels or omit \`effort\`.`);
|
|
399
|
-
}
|
|
400
|
-
__name(assertOpenAIReasoningEffort, "assertOpenAIReasoningEffort");
|
|
401
|
-
function withReasoningEffort(request, effort) {
|
|
402
|
-
if (effort === void 0)
|
|
403
|
-
return request;
|
|
404
447
|
return {
|
|
405
|
-
|
|
406
|
-
|
|
448
|
+
type: "input_image",
|
|
449
|
+
detail: source === "tool result" ? TOOL_RESULT_IMAGE_DETAIL : "auto",
|
|
450
|
+
image_url: `data:${mediaType};base64,${data}`
|
|
407
451
|
};
|
|
408
452
|
}
|
|
409
|
-
__name(
|
|
410
|
-
function
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
453
|
+
__name(codexImage, "codexImage");
|
|
454
|
+
function codexUserContent(message) {
|
|
455
|
+
const attachments = message.attachments ?? [];
|
|
456
|
+
if (attachments.length === 0)
|
|
457
|
+
return message.content;
|
|
458
|
+
const content = [];
|
|
459
|
+
if (message.content.length > 0)
|
|
460
|
+
content.push({ type: "input_text", text: message.content });
|
|
461
|
+
for (const attachment of attachments) {
|
|
462
|
+
if (attachment.type === "stored") {
|
|
463
|
+
throw new Error("CodexProvider: an unresolved stored attachment reached the driver. Configure an AttachmentStore so Namzu can resolve its bytes before the model request.");
|
|
464
|
+
}
|
|
465
|
+
if (attachment.type === "document") {
|
|
466
|
+
throw new Error("CodexProvider: this subscription transport does not support document input. Route the turn to a document-capable provider.");
|
|
467
|
+
}
|
|
468
|
+
if (attachment.modelOmission) {
|
|
469
|
+
throw new Error("CodexProvider: an image marked for model omission reached the driver without request projection.");
|
|
470
|
+
}
|
|
471
|
+
content.push(codexImage(attachment.data, attachment.mediaType, "user attachment"));
|
|
421
472
|
}
|
|
473
|
+
return content;
|
|
422
474
|
}
|
|
423
|
-
__name(
|
|
424
|
-
function
|
|
425
|
-
if (
|
|
426
|
-
return
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
475
|
+
__name(codexUserContent, "codexUserContent");
|
|
476
|
+
function codexToolOutput(content) {
|
|
477
|
+
if (typeof content === "string")
|
|
478
|
+
return content;
|
|
479
|
+
if (content.length === 0)
|
|
480
|
+
return "";
|
|
481
|
+
const output = [];
|
|
482
|
+
for (const block of toToolResultBlocks(content)) {
|
|
483
|
+
if (block.type === "text") {
|
|
484
|
+
output.push({ type: "input_text", text: block.text });
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
if (block.type === "document") {
|
|
488
|
+
throw new Error("CodexProvider: this subscription transport does not support document tool results. Route the turn to a provider whose tool-result wire admits documents.");
|
|
489
|
+
}
|
|
490
|
+
if (block.modelOmission) {
|
|
491
|
+
throw new Error("CodexProvider: a tool image marked for model omission reached the driver without request projection.");
|
|
492
|
+
}
|
|
493
|
+
output.push(codexImage(block.data, block.mediaType, "tool result"));
|
|
494
|
+
}
|
|
495
|
+
return output;
|
|
496
|
+
}
|
|
497
|
+
__name(codexToolOutput, "codexToolOutput");
|
|
498
|
+
function toCodexInput(messages, targetRoute, openingSystemRun = messages.findIndex((message) => message.role !== "system"), laterSystemRole = "developer") {
|
|
499
|
+
const input = [];
|
|
500
|
+
const opening = openingSystemRun < 0 ? messages.length : openingSystemRun;
|
|
501
|
+
for (const [at, message] of messages.entries()) {
|
|
502
|
+
if (message.role === "system") {
|
|
503
|
+
if (at >= opening && message.content) {
|
|
504
|
+
input.push({ type: "message", role: laterSystemRole, content: message.content });
|
|
505
|
+
}
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (message.role === "user") {
|
|
509
|
+
input.push({
|
|
510
|
+
type: "message",
|
|
511
|
+
role: "user",
|
|
512
|
+
content: codexUserContent(message)
|
|
513
|
+
});
|
|
514
|
+
continue;
|
|
515
|
+
}
|
|
516
|
+
if (message.role === "tool") {
|
|
517
|
+
input.push({
|
|
518
|
+
type: "function_call_output",
|
|
519
|
+
call_id: message.toolCallId,
|
|
520
|
+
output: codexToolOutput(message.content)
|
|
521
|
+
});
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const replayed = replayItems(message, targetRoute);
|
|
525
|
+
if (replayed) {
|
|
526
|
+
input.push(...replayed);
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
if (message.content) {
|
|
530
|
+
input.push({
|
|
531
|
+
type: "message",
|
|
532
|
+
role: "assistant",
|
|
533
|
+
content: message.content
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
for (const call of message.toolCalls ?? []) {
|
|
537
|
+
input.push({
|
|
538
|
+
type: "function_call",
|
|
539
|
+
call_id: call.id,
|
|
540
|
+
name: call.function.name,
|
|
541
|
+
arguments: call.function.arguments
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return input;
|
|
546
|
+
}
|
|
547
|
+
__name(toCodexInput, "toCodexInput");
|
|
548
|
+
function toCodexTools(params, apiKey = false) {
|
|
549
|
+
const tools = (params.tools ?? []).map((tool) => ({
|
|
550
|
+
type: "function",
|
|
551
|
+
name: tool.function.name,
|
|
552
|
+
description: tool.function.description ?? "",
|
|
553
|
+
parameters: tool.function.parameters ?? {},
|
|
554
|
+
// The ChatGPT Codex backend validates `strict: true` against a narrower
|
|
555
|
+
// Responses schema than the Chat Completions endpoint. In particular,
|
|
556
|
+
// every composition branch needs an explicit type and every object
|
|
557
|
+
// property must also be required. Namzu model schemas deliberately keep
|
|
558
|
+
// conditional edit shapes optional and validate the selected shape at
|
|
559
|
+
// execution, so claiming strictness rejects the whole request before the
|
|
560
|
+
// model can answer. The Codex client uses the same boundary for its own
|
|
561
|
+
// tools: Responses function tools are sent with `strict: false` and tool
|
|
562
|
+
// inputs are validated by the runtime. `enforceToolInputSchema` remains a
|
|
563
|
+
// provider hint; this transport cannot truthfully consume it for Namzu's
|
|
564
|
+
// general tool-schema contract.
|
|
565
|
+
strict: false
|
|
566
|
+
}));
|
|
567
|
+
if (params.webSearch) {
|
|
568
|
+
if (params.webSearch.mode !== "live" && params.webSearch.mode !== "cached")
|
|
569
|
+
throw new Error("Invalid web search mode.");
|
|
570
|
+
const hosted = {
|
|
571
|
+
type: "web_search",
|
|
572
|
+
// The public API takes the plain tool; the access switch is a subscription-wire field.
|
|
573
|
+
...apiKey ? {} : { external_web_access: params.webSearch.mode === "live" }
|
|
432
574
|
};
|
|
575
|
+
tools.push(hosted);
|
|
433
576
|
}
|
|
434
|
-
|
|
435
|
-
|
|
577
|
+
return tools.length ? tools : void 0;
|
|
578
|
+
}
|
|
579
|
+
__name(toCodexTools, "toCodexTools");
|
|
580
|
+
function responseUsage(usage, servedTier, requestedSpeed, requestShape) {
|
|
581
|
+
const promptTokens = usage.input_tokens ?? 0;
|
|
582
|
+
const completionTokens = usage.output_tokens ?? 0;
|
|
436
583
|
return {
|
|
437
584
|
promptTokens,
|
|
438
585
|
completionTokens,
|
|
439
|
-
totalTokens:
|
|
440
|
-
cachedTokens:
|
|
586
|
+
totalTokens: usage.total_tokens ?? promptTokens + completionTokens,
|
|
587
|
+
cachedTokens: usage.input_tokens_details?.cached_tokens ?? 0,
|
|
441
588
|
cacheWriteTokens: 0,
|
|
442
|
-
...servedSpeed(servedTier, requestedSpeed)
|
|
589
|
+
...servedSpeed(servedTier, requestedSpeed),
|
|
590
|
+
...requestShape ? { requestShape } : {}
|
|
443
591
|
};
|
|
444
592
|
}
|
|
445
|
-
__name(
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
593
|
+
__name(responseUsage, "responseUsage");
|
|
594
|
+
function subscriptionSpeedTiers(item) {
|
|
595
|
+
const tiers = /* @__PURE__ */ new Set();
|
|
596
|
+
const note = /* @__PURE__ */ __name((id) => {
|
|
597
|
+
if (id === "priority" || id === "fast")
|
|
598
|
+
tiers.add("fast");
|
|
599
|
+
else if (id === "ultrafast")
|
|
600
|
+
tiers.add("ultrafast");
|
|
601
|
+
}, "note");
|
|
602
|
+
if (Array.isArray(item.service_tiers)) {
|
|
603
|
+
for (const entry of item.service_tiers)
|
|
604
|
+
note(record(entry)?.id);
|
|
453
605
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
__name(assertThinkingSupported, "assertThinkingSupported");
|
|
461
|
-
function assertCitationsSupported(attachment, index) {
|
|
462
|
-
if (!attachment.citations)
|
|
463
|
-
return;
|
|
464
|
-
const which = attachment.name ?? `attachment ${index}`;
|
|
465
|
-
throw new Error(`This provider cannot return citations, and ${which} asked for them. Drop \`citations\` to send the document without them, or use a provider whose capabilities include citation support.`);
|
|
606
|
+
if (Array.isArray(item.additional_speed_tiers)) {
|
|
607
|
+
for (const entry of item.additional_speed_tiers)
|
|
608
|
+
note(entry);
|
|
609
|
+
}
|
|
610
|
+
return ["fast", "ultrafast"].filter((tier) => tiers.has(tier));
|
|
466
611
|
}
|
|
467
|
-
__name(
|
|
468
|
-
function
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
612
|
+
__name(subscriptionSpeedTiers, "subscriptionSpeedTiers");
|
|
613
|
+
function buildRequest(params, model, targetRoute, supportedEffort, downgrade = NO_DOWNGRADE, apiKey = false) {
|
|
614
|
+
if (params.effort !== void 0 && supportedEffort !== void 0 && !supportedEffort.includes(params.effort)) {
|
|
615
|
+
throw new Error(`CodexProvider: effort "${params.effort}" is not supported by model "${model}". Supported levels: ${supportedEffort.join(", ")}. Choose one of those levels or omit \`effort\`.`);
|
|
616
|
+
}
|
|
617
|
+
if (params.thinking?.type === "enabled") {
|
|
618
|
+
throw new Error("CodexProvider: manual thinking budgets are not a Responses API capability. Use adaptive thinking or omit `thinking`.");
|
|
619
|
+
}
|
|
620
|
+
if (params.thinking?.type === "disabled" && params.effort !== "none") {
|
|
621
|
+
throw new Error('CodexProvider: disabling reasoning requires `effort: "none"`; omitting that level would not prove reasoning was disabled.');
|
|
622
|
+
}
|
|
623
|
+
let openingRun = 0;
|
|
624
|
+
while (params.messages[openingRun]?.role === "system")
|
|
625
|
+
openingRun++;
|
|
626
|
+
const instructions = params.messages.slice(0, openingRun).map((message) => message.content).join("\n\n");
|
|
627
|
+
const request = {
|
|
628
|
+
model,
|
|
629
|
+
stream: true,
|
|
630
|
+
store: false,
|
|
631
|
+
instructions: instructions || void 0,
|
|
632
|
+
input: toCodexInput(params.messages, targetRoute, openingRun, downgrade.noDeveloper ? "user" : "developer"),
|
|
633
|
+
// One key for the whole conversation routes every request to the same
|
|
634
|
+
// cache; without it the backend keys on the request alone.
|
|
635
|
+
...params.cacheKey && !downgrade.noCacheKey ? { prompt_cache_key: params.cacheKey } : {},
|
|
636
|
+
// An API key reaches the public Responses endpoint, which has the member and
|
|
637
|
+
// is told the budget the caller set.
|
|
638
|
+
...apiKey && params.maxTokens !== void 0 ? { max_output_tokens: params.maxTokens } : {},
|
|
639
|
+
// The Codex subscription request schema deliberately has no
|
|
640
|
+
// `max_output_tokens` member. `ChatCompletionParams.maxTokens` is a public
|
|
641
|
+
// API control, but projecting it onto this route makes the whole request
|
|
642
|
+
// invalid; the backend owns the output budget here.
|
|
643
|
+
// The subscription Responses backend expects these three fields even for a
|
|
644
|
+
// turn that exposes no tools. The ordinary public Responses endpoint admits
|
|
645
|
+
// their omission, which is why the generated client types all make them
|
|
646
|
+
// optional; the Codex wire does not have the same defaulting contract.
|
|
647
|
+
tools: toCodexTools(params, apiKey) ?? [],
|
|
648
|
+
tool_choice: params.toolChoice ?? "auto",
|
|
649
|
+
parallel_tool_calls: params.parallelToolCalls ?? true,
|
|
650
|
+
include: ["reasoning.encrypted_content"],
|
|
651
|
+
...params.responseFormat ? {
|
|
652
|
+
text: {
|
|
653
|
+
format: params.responseFormat.type === "json_schema" ? { type: "json_schema", ...params.responseFormat.json_schema } : { type: "json_object" }
|
|
500
654
|
}
|
|
501
|
-
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
role: "tool",
|
|
506
|
-
// Tool messages are text-only on this wire, so a content block
|
|
507
|
-
// degrades to an honest placeholder rather than having its
|
|
508
|
-
// base64 payload dumped as text.
|
|
509
|
-
content: toolResultToText(msg.content),
|
|
510
|
-
tool_call_id: msg.toolCallId
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
const assistant = {
|
|
514
|
-
role: "assistant",
|
|
515
|
-
content: msg.content
|
|
516
|
-
};
|
|
517
|
-
if ("toolCalls" in msg && msg.toolCalls && msg.toolCalls.length > 0) {
|
|
518
|
-
;
|
|
519
|
-
assistant.tool_calls = msg.toolCalls.map((tc) => ({
|
|
520
|
-
id: tc.id,
|
|
521
|
-
type: "function",
|
|
522
|
-
function: {
|
|
523
|
-
name: tc.function.name,
|
|
524
|
-
arguments: tc.function.arguments
|
|
525
|
-
}
|
|
526
|
-
}));
|
|
527
|
-
}
|
|
528
|
-
return assistant;
|
|
529
|
-
});
|
|
530
|
-
return converted.filter((msg) => msg.role !== "assistant" || Boolean(msg.content) || (msg.tool_calls?.length ?? 0) > 0);
|
|
655
|
+
} : {},
|
|
656
|
+
...params.effort !== void 0 ? { reasoning: { effort: params.effort, summary: "auto" } } : params.thinking?.type === "adaptive" ? { reasoning: { summary: "auto" } } : {}
|
|
657
|
+
};
|
|
658
|
+
return request;
|
|
531
659
|
}
|
|
532
|
-
__name(
|
|
533
|
-
|
|
534
|
-
|
|
660
|
+
__name(buildRequest, "buildRequest");
|
|
661
|
+
var NO_DOWNGRADE = {
|
|
662
|
+
noDeveloper: false,
|
|
663
|
+
noSessionHeader: false,
|
|
664
|
+
noCacheKey: false
|
|
665
|
+
};
|
|
666
|
+
var subscriptionDowngrade = { ...NO_DOWNGRADE };
|
|
667
|
+
function refusedNewShape(error) {
|
|
668
|
+
if (typeof error !== "object" || error === null)
|
|
535
669
|
return void 0;
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
670
|
+
const status = error.status;
|
|
671
|
+
if (!(error instanceof OpenAI.BadRequestError) && status !== 400)
|
|
672
|
+
return void 0;
|
|
673
|
+
const message = error.message;
|
|
674
|
+
if (typeof message !== "string")
|
|
675
|
+
return void 0;
|
|
676
|
+
const refused = {};
|
|
677
|
+
if (/\bdeveloper\b|input\[\d*\]\.role/i.test(message))
|
|
678
|
+
refused.noDeveloper = true;
|
|
679
|
+
if (/session_id/i.test(message))
|
|
680
|
+
refused.noSessionHeader = true;
|
|
681
|
+
if (/prompt_cache_key/i.test(message))
|
|
682
|
+
refused.noCacheKey = true;
|
|
683
|
+
return Object.keys(refused).length > 0 ? refused : void 0;
|
|
546
684
|
}
|
|
547
|
-
__name(
|
|
548
|
-
var
|
|
685
|
+
__name(refusedNewShape, "refusedNewShape");
|
|
686
|
+
var listingByAccount = /* @__PURE__ */ new Map();
|
|
687
|
+
var MODELS_CLIENT_VERSION = "1.0.0";
|
|
688
|
+
var WINDOW_LISTING_TIMEOUT_MS = 3e3;
|
|
689
|
+
var WINDOW_LISTING_RETRY_MS = 5 * 6e4;
|
|
690
|
+
var RESPONSES_API_BASE_URL = "https://api.openai.com/v1";
|
|
691
|
+
var CodexProvider = class {
|
|
549
692
|
static {
|
|
550
|
-
__name(this, "
|
|
693
|
+
__name(this, "CodexProvider");
|
|
551
694
|
}
|
|
552
|
-
id
|
|
553
|
-
name
|
|
554
|
-
capabilities =
|
|
695
|
+
id;
|
|
696
|
+
name;
|
|
697
|
+
capabilities = CODEX_CAPABILITIES;
|
|
698
|
+
/** True when an API key (not a subscription) is the credential. */
|
|
699
|
+
apiKeyRoute;
|
|
555
700
|
client;
|
|
556
701
|
defaultModel;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
702
|
+
reasoningProfiles = /* @__PURE__ */ new Map();
|
|
703
|
+
/** Per model, the speed tiers the account's listing offers. Absent until a listing has answered. */
|
|
704
|
+
speedTiers;
|
|
705
|
+
/** Per model, the window the account's listing states. Absent until a listing has answered. */
|
|
706
|
+
windows;
|
|
707
|
+
/** Per model, the compaction threshold the account's listing states or implies. */
|
|
708
|
+
compactLimits;
|
|
562
709
|
windowListingRetryAt = 0;
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
710
|
+
/** The listing in flight, shared by callers that arrive while it runs. */
|
|
711
|
+
windowListing;
|
|
712
|
+
listingKey;
|
|
566
713
|
constructor(config) {
|
|
567
|
-
if (
|
|
568
|
-
|
|
714
|
+
if ("responsesApi" in config) {
|
|
715
|
+
if (!config.apiKey)
|
|
716
|
+
throw new Error("OpenAI API key is required.");
|
|
717
|
+
this.id = "openai";
|
|
718
|
+
this.name = "OpenAI";
|
|
719
|
+
this.apiKeyRoute = true;
|
|
720
|
+
this.client = new OpenAI({
|
|
721
|
+
apiKey: config.apiKey,
|
|
722
|
+
baseURL: config.baseURL ?? RESPONSES_API_BASE_URL,
|
|
723
|
+
...config.organization ? { organization: config.organization } : {},
|
|
724
|
+
...config.project ? { project: config.project } : {},
|
|
725
|
+
...config.timeout !== void 0 ? { timeout: config.timeout } : {},
|
|
726
|
+
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {},
|
|
727
|
+
defaultHeaders: config.defaultHeaders ?? {}
|
|
728
|
+
});
|
|
729
|
+
this.defaultModel = config.model;
|
|
730
|
+
this.listingKey = "";
|
|
731
|
+
return;
|
|
569
732
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
if (config.
|
|
574
|
-
|
|
575
|
-
if (config.
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
};
|
|
587
|
-
this.client = new OpenAI(clientOptions);
|
|
733
|
+
this.id = "codex";
|
|
734
|
+
this.name = "OpenAI Codex";
|
|
735
|
+
this.apiKeyRoute = false;
|
|
736
|
+
if (!config.accessToken)
|
|
737
|
+
throw new Error("Codex access token is required.");
|
|
738
|
+
if (!config.accountId)
|
|
739
|
+
throw new Error("Codex ChatGPT account id is required.");
|
|
740
|
+
this.client = new OpenAI({
|
|
741
|
+
apiKey: config.accessToken,
|
|
742
|
+
baseURL: config.baseURL ?? DEFAULT_CODEX_BASE_URL,
|
|
743
|
+
timeout: config.timeout,
|
|
744
|
+
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {},
|
|
745
|
+
defaultHeaders: {
|
|
746
|
+
...codexRequestHeaders(config.accountId),
|
|
747
|
+
...config.defaultHeaders ?? {}
|
|
748
|
+
}
|
|
749
|
+
});
|
|
588
750
|
this.defaultModel = config.model;
|
|
589
|
-
this.
|
|
590
|
-
|
|
591
|
-
|
|
751
|
+
this.listingKey = `${config.accountId}\0${config.baseURL ?? DEFAULT_CODEX_BASE_URL}`;
|
|
752
|
+
const known = listingByAccount.get(this.listingKey);
|
|
753
|
+
if (known) {
|
|
754
|
+
this.speedTiers = known.speedTiers;
|
|
755
|
+
this.reasoningProfiles = known.reasoningProfiles;
|
|
756
|
+
this.windows = known.windows;
|
|
757
|
+
this.compactLimits = known.compactLimits;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
resolveModel(params) {
|
|
761
|
+
const model = params.model || this.defaultModel;
|
|
762
|
+
if (!model)
|
|
763
|
+
throw new Error("CodexProvider: model is required.");
|
|
764
|
+
return model;
|
|
765
|
+
}
|
|
766
|
+
reasoningEffortLevelsFor(model) {
|
|
767
|
+
return this.reasoningProfiles.get(model.toLowerCase())?.levels;
|
|
768
|
+
}
|
|
769
|
+
reasoningEffortDefaultFor(model) {
|
|
770
|
+
return this.reasoningProfiles.get(model.toLowerCase())?.default;
|
|
592
771
|
}
|
|
593
772
|
/**
|
|
594
|
-
* The
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
|
|
773
|
+
* The speed tiers the account's listing offers for `model`. `undefined`
|
|
774
|
+
* until a listing has answered; once one has, a model it does not carry
|
|
775
|
+
* offers none.
|
|
776
|
+
*/
|
|
777
|
+
speedTiersFor(model) {
|
|
778
|
+
if (this.speedTiers === void 0)
|
|
779
|
+
return void 0;
|
|
780
|
+
return this.speedTiers.get(model.toLowerCase()) ?? [];
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* The window the runtime measures compaction against, as the account's model listing states
|
|
784
|
+
* it (scaled by the effective-percent the listing sends, when it sends one), or `undefined`
|
|
785
|
+
* when the listing states none, which leaves the SDK's table to answer.
|
|
598
786
|
*
|
|
599
|
-
* The listing is asked once
|
|
600
|
-
*
|
|
601
|
-
*
|
|
787
|
+
* The listing is asked once per account and kept. A failure is remembered for a few minutes
|
|
788
|
+
* and a listing that hangs is cut short. Neither ever fails a turn; only the caller's own
|
|
789
|
+
* abort propagates.
|
|
602
790
|
*/
|
|
603
791
|
async resolveContextWindow(model, signal) {
|
|
604
792
|
signal?.throwIfAborted();
|
|
605
|
-
if (!this.
|
|
606
|
-
return void 0;
|
|
607
|
-
if (!this.declaredWindows) {
|
|
793
|
+
if (!this.windows) {
|
|
608
794
|
if (Date.now() < this.windowListingRetryAt)
|
|
609
795
|
return void 0;
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return void 0;
|
|
621
|
-
} finally {
|
|
622
|
-
clearTimeout(timer);
|
|
623
|
-
signal?.removeEventListener("abort", forward);
|
|
624
|
-
}
|
|
796
|
+
this.windowListing ??= this.listForWindow().finally(() => {
|
|
797
|
+
this.windowListing = void 0;
|
|
798
|
+
});
|
|
799
|
+
const abandoned = new Promise((_, reject) => {
|
|
800
|
+
if (signal?.aborted)
|
|
801
|
+
reject(signal.reason);
|
|
802
|
+
signal?.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
803
|
+
});
|
|
804
|
+
await Promise.race([this.windowListing, abandoned]);
|
|
805
|
+
signal?.throwIfAborted();
|
|
625
806
|
}
|
|
626
|
-
return this.
|
|
807
|
+
return this.windows?.get(model.toLowerCase());
|
|
627
808
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
809
|
+
/**
|
|
810
|
+
* The token count the account's listing says compaction starts at for `model`: its
|
|
811
|
+
* `auto_compact_token_limit` held to 90% of the window, or 90% of the window when it sends
|
|
812
|
+
* none. Shares the one listing `resolveContextWindow` asks for, with the same bounds.
|
|
813
|
+
*/
|
|
814
|
+
async resolveAutoCompactLimit(model, signal) {
|
|
815
|
+
await this.resolveContextWindow(model, signal);
|
|
816
|
+
return this.compactLimits?.get(model.toLowerCase());
|
|
634
817
|
}
|
|
635
|
-
|
|
636
|
-
|
|
818
|
+
/** One bounded listing for every caller waiting on it; a failure is remembered, never thrown. */
|
|
819
|
+
async listForWindow() {
|
|
820
|
+
const controller = new AbortController();
|
|
821
|
+
const timer = setTimeout(() => controller.abort(), WINDOW_LISTING_TIMEOUT_MS);
|
|
822
|
+
try {
|
|
823
|
+
await this.listModels(controller.signal);
|
|
824
|
+
return true;
|
|
825
|
+
} catch {
|
|
826
|
+
this.windowListingRetryAt = Date.now() + WINDOW_LISTING_RETRY_MS;
|
|
827
|
+
return false;
|
|
828
|
+
} finally {
|
|
829
|
+
clearTimeout(timer);
|
|
830
|
+
}
|
|
637
831
|
}
|
|
638
832
|
async *chatStream(params) {
|
|
639
833
|
const model = this.resolveModel(params);
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
const
|
|
646
|
-
const
|
|
647
|
-
const
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
834
|
+
const targetRoute = params.providerRoute ?? {
|
|
835
|
+
providerId: this.id,
|
|
836
|
+
model,
|
|
837
|
+
chainIndex: 0
|
|
838
|
+
};
|
|
839
|
+
const effortLevels = this.reasoningEffortLevelsFor(model);
|
|
840
|
+
const apiKey = this.apiKeyRoute;
|
|
841
|
+
const downgradeState = apiKey ? NO_DOWNGRADE : subscriptionDowngrade;
|
|
842
|
+
const built = buildRequest(params, model, targetRoute, effortLevels, downgradeState, apiKey);
|
|
843
|
+
const fast = params.speed === "fast" || params.speed === "ultrafast" ? assertFastModeAccepted({
|
|
844
|
+
route: apiKey ? "api" : "subscription",
|
|
845
|
+
model,
|
|
846
|
+
tier: params.speed,
|
|
847
|
+
advertised: apiKey ? void 0 : this.speedTiersFor(model),
|
|
848
|
+
firstPartyEndpoint: true
|
|
849
|
+
}) : void 0;
|
|
850
|
+
const withTier = /* @__PURE__ */ __name((body) => fast ? { ...body, service_tier: fast.wire } : body, "withTier");
|
|
851
|
+
const requestedSpeed = params.speed === "fast" || params.speed === "ultrafast" ? params.speed : void 0;
|
|
852
|
+
let wire = { cacheKey: false, sessionHeader: false };
|
|
853
|
+
const send = /* @__PURE__ */ __name((body, sessionHeader) => {
|
|
854
|
+
wire = {
|
|
855
|
+
cacheKey: Boolean(body.prompt_cache_key),
|
|
856
|
+
sessionHeader: Boolean(sessionHeader && params.cacheKey),
|
|
857
|
+
// Recorded from the downgrade state, not from the items built: a request
|
|
858
|
+
// with no guidance to send is not a refusal.
|
|
859
|
+
...downgradeState.noDeveloper ? { developerRefused: true } : {}
|
|
860
|
+
};
|
|
861
|
+
return this.client.responses.create(withTier(body), {
|
|
862
|
+
signal: params.signal,
|
|
863
|
+
...fast?.header || sessionHeader && params.cacheKey ? {
|
|
864
|
+
headers: {
|
|
865
|
+
...fast?.header ?? {},
|
|
866
|
+
...sessionHeader && params.cacheKey ? { session_id: params.cacheKey } : {}
|
|
867
|
+
}
|
|
868
|
+
} : {}
|
|
656
869
|
});
|
|
657
|
-
|
|
658
|
-
}
|
|
659
|
-
const requestedSpeed = params.speed === "fast" ? "fast" : void 0;
|
|
870
|
+
}, "send");
|
|
660
871
|
let stream;
|
|
661
872
|
try {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
{ signal: params.signal }
|
|
685
|
-
);
|
|
686
|
-
} catch (err) {
|
|
687
|
-
if (isCallerAbortError(err, params.signal))
|
|
688
|
-
throw params.signal?.reason ?? err;
|
|
689
|
-
if (isProviderRequestError(err))
|
|
690
|
-
throw err;
|
|
691
|
-
throw providerVendorError({ providerId: "openai", error: err });
|
|
873
|
+
try {
|
|
874
|
+
stream = await send(built, !apiKey && !subscriptionDowngrade.noSessionHeader);
|
|
875
|
+
} catch (error) {
|
|
876
|
+
const refused = refusedNewShape(error);
|
|
877
|
+
const newShapeSent = built.input !== void 0 && (Boolean(params.cacheKey) || Array.isArray(built.input) && built.input.some((item) => "role" in item && item.role === "developer"));
|
|
878
|
+
const fresh = refused && [
|
|
879
|
+
"noDeveloper",
|
|
880
|
+
"noSessionHeader",
|
|
881
|
+
"noCacheKey"
|
|
882
|
+
].filter((key) => refused[key] && !subscriptionDowngrade[key]);
|
|
883
|
+
if (apiKey || !fresh || fresh.length === 0 || !newShapeSent || params.signal?.aborted)
|
|
884
|
+
throw error;
|
|
885
|
+
for (const key of fresh)
|
|
886
|
+
subscriptionDowngrade[key] = true;
|
|
887
|
+
stream = await send(buildRequest(params, model, targetRoute, effortLevels, subscriptionDowngrade, apiKey), !subscriptionDowngrade.noSessionHeader);
|
|
888
|
+
}
|
|
889
|
+
} catch (error) {
|
|
890
|
+
if (isCallerAbortError(error, params.signal))
|
|
891
|
+
throw params.signal?.reason ?? error;
|
|
892
|
+
if (isProviderRequestError(error))
|
|
893
|
+
throw error;
|
|
894
|
+
throw providerVendorError({ providerId: this.id, error });
|
|
692
895
|
}
|
|
896
|
+
const callIndex = /* @__PURE__ */ new Map();
|
|
897
|
+
const completedItems = /* @__PURE__ */ new Map();
|
|
898
|
+
const textItems = /* @__PURE__ */ new Map();
|
|
899
|
+
let nextCallIndex = 0;
|
|
900
|
+
let responseId = "codex-response";
|
|
693
901
|
let finished = false;
|
|
694
|
-
let servedTier;
|
|
695
902
|
try {
|
|
696
|
-
for await (const
|
|
697
|
-
const echoed = chunk.service_tier;
|
|
698
|
-
if (typeof echoed === "string" && echoed.length > 0)
|
|
699
|
-
servedTier = echoed;
|
|
903
|
+
for await (const event of stream) {
|
|
700
904
|
params.signal?.throwIfAborted();
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
finished = true;
|
|
721
|
-
if (!hasDelta && !finishReason && !usage)
|
|
722
|
-
continue;
|
|
723
|
-
yield {
|
|
724
|
-
id: chunk.id,
|
|
725
|
-
delta: {
|
|
726
|
-
content: delta?.content ?? void 0,
|
|
727
|
-
...reasoning ? {
|
|
905
|
+
switch (event.type) {
|
|
906
|
+
case "response.created":
|
|
907
|
+
responseId = event.response.id;
|
|
908
|
+
break;
|
|
909
|
+
case "response.output_text.delta": {
|
|
910
|
+
const textPart = textItems.get(event.item_id);
|
|
911
|
+
yield {
|
|
912
|
+
id: responseId,
|
|
913
|
+
delta: {
|
|
914
|
+
content: event.delta,
|
|
915
|
+
...textPart ? { textPart } : {}
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
case "response.reasoning_summary_text.delta":
|
|
921
|
+
yield {
|
|
922
|
+
id: responseId,
|
|
923
|
+
delta: {
|
|
728
924
|
reasoning: {
|
|
729
|
-
index:
|
|
925
|
+
index: event.output_index,
|
|
730
926
|
type: "thinking",
|
|
731
|
-
text:
|
|
927
|
+
text: event.delta
|
|
732
928
|
}
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
break;
|
|
932
|
+
case "response.reasoning_summary_text.done":
|
|
933
|
+
yield {
|
|
934
|
+
id: responseId,
|
|
935
|
+
delta: {
|
|
936
|
+
reasoning: {
|
|
937
|
+
index: event.output_index,
|
|
938
|
+
type: "thinking",
|
|
939
|
+
done: true
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
break;
|
|
944
|
+
case "response.output_item.added":
|
|
945
|
+
if (event.item.type === "message" && (event.item.phase === "commentary" || event.item.phase === "final_answer"))
|
|
946
|
+
textItems.set(event.item.id, {
|
|
947
|
+
id: event.item.id,
|
|
948
|
+
phase: event.item.phase
|
|
949
|
+
});
|
|
950
|
+
if (event.item.type === "web_search_call") {
|
|
951
|
+
yield {
|
|
952
|
+
id: responseId,
|
|
953
|
+
delta: {
|
|
954
|
+
hostedTool: {
|
|
955
|
+
id: event.item.id,
|
|
956
|
+
name: "web_search",
|
|
957
|
+
status: "running",
|
|
958
|
+
...webSearchDetail(event.item)
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
if (event.item.type === "function_call") {
|
|
964
|
+
const index = nextCallIndex++;
|
|
965
|
+
callIndex.set(event.item.id ?? event.item.call_id, index);
|
|
966
|
+
callIndex.set(event.item.call_id, index);
|
|
967
|
+
yield {
|
|
968
|
+
id: responseId,
|
|
969
|
+
delta: {
|
|
970
|
+
toolCalls: [
|
|
971
|
+
{
|
|
972
|
+
index,
|
|
973
|
+
id: event.item.call_id,
|
|
974
|
+
type: "function",
|
|
975
|
+
function: {
|
|
976
|
+
name: event.item.name,
|
|
977
|
+
arguments: event.item.arguments
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
]
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
break;
|
|
985
|
+
case "response.function_call_arguments.delta": {
|
|
986
|
+
const index = callIndex.get(event.item_id) ?? event.output_index;
|
|
987
|
+
yield {
|
|
988
|
+
id: responseId,
|
|
989
|
+
delta: {
|
|
990
|
+
toolCalls: [{ index, function: { arguments: event.delta } }]
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
case "response.output_item.done":
|
|
996
|
+
completedItems.set(event.output_index, event.item);
|
|
997
|
+
if (event.item.type === "web_search_call") {
|
|
998
|
+
yield {
|
|
999
|
+
id: responseId,
|
|
1000
|
+
delta: {
|
|
1001
|
+
hostedTool: {
|
|
1002
|
+
id: event.item.id,
|
|
1003
|
+
name: "web_search",
|
|
1004
|
+
status: event.item.status === "completed" ? "completed" : "failed",
|
|
1005
|
+
...webSearchDetail(event.item)
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
if (event.item.type === "function_call") {
|
|
1011
|
+
yield {
|
|
1012
|
+
id: responseId,
|
|
1013
|
+
delta: {
|
|
1014
|
+
toolCallEnd: {
|
|
1015
|
+
index: callIndex.get(event.item.id ?? event.item.call_id) ?? event.output_index,
|
|
1016
|
+
id: event.item.call_id
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
break;
|
|
1022
|
+
case "response.completed": {
|
|
1023
|
+
const output = event.response.output?.length ? event.response.output : [...completedItems].sort(([left], [right]) => left - right).map(([, item]) => item);
|
|
1024
|
+
const calls = output.filter((item) => item.type === "function_call").map((item) => ({
|
|
1025
|
+
id: item.call_id,
|
|
1026
|
+
name: item.name,
|
|
1027
|
+
arguments: item.arguments
|
|
1028
|
+
}));
|
|
1029
|
+
const textParts = output.filter((item) => item.type === "message").map((item) => ({
|
|
1030
|
+
id: item.id,
|
|
1031
|
+
...item.phase === "commentary" || item.phase === "final_answer" ? { phase: item.phase } : {},
|
|
1032
|
+
text: item.content.filter((part) => part.type === "output_text").map((part) => part.text).join("")
|
|
1033
|
+
}));
|
|
1034
|
+
const phased = textParts.some((part) => part.phase !== void 0);
|
|
1035
|
+
let content = phased ? selectAssistantText(textParts) : textParts.map((part) => part.text).join("");
|
|
1036
|
+
const sources = /* @__PURE__ */ new Map();
|
|
1037
|
+
for (const item of output) {
|
|
1038
|
+
if (item.type !== "message")
|
|
1039
|
+
continue;
|
|
1040
|
+
for (const part of item.content) {
|
|
1041
|
+
if (part.type !== "output_text")
|
|
1042
|
+
continue;
|
|
1043
|
+
for (const annotation of part.annotations ?? []) {
|
|
1044
|
+
if (annotation.type === "url_citation" && /^https?:\/\//i.test(annotation.url) && !content.includes(annotation.url)) {
|
|
1045
|
+
sources.set(annotation.url, annotation.title);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
if (sources.size) {
|
|
1051
|
+
const links = [...sources].map(([url, title]) => `[${title.replace(/[\[\]\r\n]/g, " ")}](<${url.replace(/[<>\s]/g, (c) => encodeURIComponent(c))}>)`).join(" \xB7 ");
|
|
1052
|
+
const suffix = `
|
|
1053
|
+
|
|
1054
|
+
Sources: ${links}`;
|
|
1055
|
+
content += suffix;
|
|
1056
|
+
let partIndex = textParts.length - 1;
|
|
1057
|
+
for (let i = textParts.length - 1; i >= 0; i--) {
|
|
1058
|
+
if (textParts[i]?.phase === "final_answer") {
|
|
1059
|
+
partIndex = i;
|
|
1060
|
+
break;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
const part = textParts[partIndex];
|
|
1064
|
+
if (part)
|
|
1065
|
+
textParts[partIndex] = { ...part, text: part.text + suffix };
|
|
1066
|
+
yield {
|
|
1067
|
+
id: responseId,
|
|
1068
|
+
delta: { content: suffix, contentOrigin: "driver" }
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
const replayState = {
|
|
1072
|
+
kind: "namzu.codex.responses",
|
|
1073
|
+
version: 1,
|
|
1074
|
+
route: targetRoute,
|
|
1075
|
+
content: content || null,
|
|
1076
|
+
...phased ? { textParts } : {},
|
|
1077
|
+
toolCalls: calls,
|
|
1078
|
+
items: output
|
|
1079
|
+
};
|
|
1080
|
+
finished = true;
|
|
1081
|
+
yield {
|
|
1082
|
+
id: event.response.id,
|
|
1083
|
+
delta: {},
|
|
1084
|
+
...phased ? { textParts } : {},
|
|
1085
|
+
finishReason: calls.length > 0 ? "tool_calls" : "stop",
|
|
1086
|
+
usage: responseUsage(event.response.usage ?? {}, event.response.service_tier, requestedSpeed, wire),
|
|
1087
|
+
replayState
|
|
1088
|
+
};
|
|
1089
|
+
break;
|
|
1090
|
+
}
|
|
1091
|
+
case "response.incomplete": {
|
|
1092
|
+
const reason = event.response.incomplete_details?.reason;
|
|
1093
|
+
finished = true;
|
|
1094
|
+
yield {
|
|
1095
|
+
id: event.response.id,
|
|
1096
|
+
delta: {},
|
|
1097
|
+
finishReason: reason === "content_filter" ? "content_filter" : "length",
|
|
1098
|
+
...reason === "content_filter" ? { refusal: {} } : {},
|
|
1099
|
+
usage: responseUsage(event.response.usage ?? {}, event.response.service_tier, requestedSpeed, wire)
|
|
1100
|
+
};
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
case "error":
|
|
1104
|
+
case "response.failed":
|
|
1105
|
+
throw new ProviderRequestError({
|
|
1106
|
+
kind: "server",
|
|
1107
|
+
providerId: this.id,
|
|
1108
|
+
detail: apiKey ? "the Responses stream failed" : "the Codex Responses stream failed"
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
if (!finished) {
|
|
1113
|
+
throw new ProviderRequestError({
|
|
1114
|
+
kind: "network",
|
|
1115
|
+
providerId: this.id,
|
|
1116
|
+
detail: "the connection closed before the response finished"
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
} catch (error) {
|
|
1120
|
+
if (isCallerAbortError(error, params.signal))
|
|
1121
|
+
throw params.signal?.reason ?? error;
|
|
1122
|
+
if (isProviderRequestError(error))
|
|
1123
|
+
throw error;
|
|
1124
|
+
throw providerVendorError({ providerId: this.id, error });
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
async listModels(signal) {
|
|
1128
|
+
signal?.throwIfAborted();
|
|
1129
|
+
const response = await this.client.get(`/models?client_version=${MODELS_CLIENT_VERSION}`, {
|
|
1130
|
+
signal
|
|
1131
|
+
});
|
|
1132
|
+
signal?.throwIfAborted();
|
|
1133
|
+
const profiles = /* @__PURE__ */ new Map();
|
|
1134
|
+
const tiersBySlug = /* @__PURE__ */ new Map();
|
|
1135
|
+
const windows = /* @__PURE__ */ new Map();
|
|
1136
|
+
const compactLimits = /* @__PURE__ */ new Map();
|
|
1137
|
+
const models = (Array.isArray(response.models) ? response.models : []).flatMap((value) => {
|
|
1138
|
+
const item = record(value);
|
|
1139
|
+
if (typeof item?.slug !== "string" || item.slug.length === 0)
|
|
1140
|
+
return [];
|
|
1141
|
+
if (item.visibility === "hide" || item.visibility === "hidden")
|
|
1142
|
+
return [];
|
|
1143
|
+
const profile = subscriptionReasoningProfile(item);
|
|
1144
|
+
if (profile)
|
|
1145
|
+
profiles.set(item.slug.toLowerCase(), profile);
|
|
1146
|
+
const speedTiers = subscriptionSpeedTiers(item);
|
|
1147
|
+
tiersBySlug.set(item.slug.toLowerCase(), speedTiers);
|
|
1148
|
+
const { contextWindow, autoCompactTokenLimit } = subscriptionLimits(item);
|
|
1149
|
+
if (contextWindow !== void 0)
|
|
1150
|
+
windows.set(item.slug.toLowerCase(), contextWindow);
|
|
1151
|
+
if (autoCompactTokenLimit !== void 0)
|
|
1152
|
+
compactLimits.set(item.slug.toLowerCase(), autoCompactTokenLimit);
|
|
1153
|
+
return [
|
|
1154
|
+
{
|
|
1155
|
+
id: item.slug,
|
|
1156
|
+
name: typeof item.display_name === "string" ? item.display_name : item.slug,
|
|
1157
|
+
supportsToolUse: true,
|
|
1158
|
+
supportsStreaming: true,
|
|
1159
|
+
...profile ? { reasoningEffortLevels: profile.levels } : {},
|
|
1160
|
+
...profile?.default !== void 0 ? { reasoningEffortDefault: profile.default } : {},
|
|
1161
|
+
speedTiers,
|
|
1162
|
+
...contextWindow !== void 0 ? { contextWindow } : {},
|
|
1163
|
+
...autoCompactTokenLimit !== void 0 ? { autoCompactTokenLimit } : {}
|
|
1164
|
+
}
|
|
1165
|
+
];
|
|
1166
|
+
});
|
|
1167
|
+
this.reasoningProfiles = profiles;
|
|
1168
|
+
this.speedTiers = tiersBySlug;
|
|
1169
|
+
this.windows = windows;
|
|
1170
|
+
this.compactLimits = compactLimits;
|
|
1171
|
+
listingByAccount.set(this.listingKey, {
|
|
1172
|
+
speedTiers: tiersBySlug,
|
|
1173
|
+
reasoningProfiles: profiles,
|
|
1174
|
+
windows,
|
|
1175
|
+
compactLimits
|
|
1176
|
+
});
|
|
1177
|
+
return models;
|
|
1178
|
+
}
|
|
1179
|
+
async probeCredential(signal) {
|
|
1180
|
+
await this.listModels(signal);
|
|
789
1181
|
}
|
|
790
1182
|
async healthCheck() {
|
|
791
1183
|
try {
|
|
792
|
-
await this.
|
|
1184
|
+
await this.probeCredential();
|
|
793
1185
|
return true;
|
|
794
1186
|
} catch {
|
|
795
1187
|
return false;
|
|
796
1188
|
}
|
|
797
1189
|
}
|
|
798
1190
|
};
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
var CODEX_IMAGE_MAX_BYTES = 32 * 1024 * 1024;
|
|
807
|
-
var CODEX_IMAGE_LIMIT_IDS = ["image_gen", "imagegen_premium"];
|
|
808
|
-
var CodexImagesError = class extends Error {
|
|
809
|
-
static {
|
|
810
|
-
__name(this, "CodexImagesError");
|
|
811
|
-
}
|
|
812
|
-
status;
|
|
813
|
-
usageLimit;
|
|
814
|
-
requestId;
|
|
815
|
-
constructor(message, details = {}) {
|
|
816
|
-
super(message);
|
|
817
|
-
this.name = "CodexImagesError";
|
|
818
|
-
if (details.status !== void 0)
|
|
819
|
-
this.status = details.status;
|
|
820
|
-
if (details.usageLimit !== void 0)
|
|
821
|
-
this.usageLimit = details.usageLimit;
|
|
822
|
-
if (details.requestId !== void 0)
|
|
823
|
-
this.requestId = details.requestId;
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
function asRecord2(value) {
|
|
827
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
828
|
-
}
|
|
829
|
-
__name(asRecord2, "asRecord");
|
|
830
|
-
function codexRequestHeaders(accountId) {
|
|
1191
|
+
function webSearchDetail(item) {
|
|
1192
|
+
const action = item.action;
|
|
1193
|
+
if (!action || typeof action !== "object")
|
|
1194
|
+
return {};
|
|
1195
|
+
const queries = Array.isArray(action.queries) ? action.queries.filter((q) => typeof q === "string" && q.trim().length > 0) : [];
|
|
1196
|
+
const query = typeof action.query === "string" && action.query.trim().length > 0 ? action.query.trim() : queries[0]?.trim();
|
|
1197
|
+
const url = typeof action.url === "string" && action.url.length > 0 ? action.url : void 0;
|
|
831
1198
|
return {
|
|
832
|
-
...
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1199
|
+
...query ? { query } : {},
|
|
1200
|
+
...url && !query ? { url } : {},
|
|
1201
|
+
...Array.isArray(action.sources) ? { results: action.sources.length } : {},
|
|
1202
|
+
// One hosted item may run several queries; the count says so, the label names the first.
|
|
1203
|
+
...queries.length > 1 ? { searches: queries.length } : {}
|
|
836
1204
|
};
|
|
837
1205
|
}
|
|
838
|
-
__name(
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
let body = null;
|
|
847
|
-
try {
|
|
848
|
-
body = asRecord2(JSON.parse(text));
|
|
849
|
-
} catch {
|
|
850
|
-
body = null;
|
|
851
|
-
}
|
|
852
|
-
const error = asRecord2(body?.error);
|
|
853
|
-
const type = typeof error?.type === "string" ? error.type : void 0;
|
|
854
|
-
const message = typeof error?.message === "string" && error.message || text.trim().slice(0, 300) || "";
|
|
855
|
-
if (status === 429 && type === "usage_limit_reached") {
|
|
856
|
-
const limitId = headers.get(ACTIVE_LIMIT_HEADER) ?? void 0;
|
|
857
|
-
const seconds = typeof error?.resets_at === "number" ? error.resets_at : void 0;
|
|
858
|
-
return new CodexImagesError("The image quota of this plan is used up.", {
|
|
859
|
-
status,
|
|
860
|
-
usageLimit: {
|
|
861
|
-
...limitId ? { limitId } : {},
|
|
862
|
-
...seconds !== void 0 ? { resetsAt: seconds * 1e3 } : {}
|
|
863
|
-
},
|
|
864
|
-
...requestId ? { requestId } : {}
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
|
-
return new CodexImagesError(`HTTP ${status}${message ? `: ${message}` : ""}`, {
|
|
868
|
-
status,
|
|
869
|
-
...requestId ? { requestId } : {}
|
|
870
|
-
});
|
|
1206
|
+
__name(webSearchDetail, "webSearchDetail");
|
|
1207
|
+
|
|
1208
|
+
// ../providers/openai/dist/listed-chat-models.js
|
|
1209
|
+
var CHAT_FAMILY = /^(?:gpt-|o\d|chatgpt-|chat-latest)/;
|
|
1210
|
+
var NOT_CHAT = /(?:audio|realtime|gpt-live|transcribe|diarize|whisper|tts|image|sora|dall-e|embed|moderation|search-api|search-preview|computer-use|instruct|babbage|davinci)/;
|
|
1211
|
+
function isOpenAIChatModelId(id) {
|
|
1212
|
+
const normalized = id.toLowerCase().replace(/^ft:/, "");
|
|
1213
|
+
return CHAT_FAMILY.test(normalized) && !NOT_CHAT.test(normalized);
|
|
871
1214
|
}
|
|
872
|
-
__name(
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
const editing = request.images !== void 0 && request.images.length > 0;
|
|
876
|
-
const url = `${base}/images/${editing ? "edits" : "generations"}`;
|
|
877
|
-
const body = {
|
|
878
|
-
prompt: request.prompt,
|
|
879
|
-
model: CODEX_IMAGE_MODEL,
|
|
880
|
-
quality: "auto",
|
|
881
|
-
size: "auto",
|
|
882
|
-
background: request.transparentBackground === true ? "transparent" : "opaque",
|
|
883
|
-
...editing ? { images: request.images?.map((image_url) => ({ image_url })) } : {}
|
|
884
|
-
};
|
|
885
|
-
const timeout = AbortSignal.timeout(config.timeoutMs ?? CODEX_IMAGE_TIMEOUT_MS);
|
|
886
|
-
const signal = request.signal ? AbortSignal.any([request.signal, timeout]) : timeout;
|
|
887
|
-
const doFetch = config.fetch ?? fetch;
|
|
888
|
-
let response;
|
|
889
|
-
try {
|
|
890
|
-
response = await doFetch(url, {
|
|
891
|
-
method: "POST",
|
|
892
|
-
signal,
|
|
893
|
-
headers: {
|
|
894
|
-
...codexRequestHeaders(config.accountId),
|
|
895
|
-
...config.headers ?? {},
|
|
896
|
-
Authorization: `Bearer ${config.accessToken}`,
|
|
897
|
-
"Content-Type": "application/json",
|
|
898
|
-
Accept: "application/json",
|
|
899
|
-
...request.turnId ? { [IMAGE_TURN_HEADER]: request.turnId } : {}
|
|
900
|
-
},
|
|
901
|
-
body: JSON.stringify(body)
|
|
902
|
-
});
|
|
903
|
-
} catch (error) {
|
|
904
|
-
if (request.signal?.aborted)
|
|
905
|
-
throw request.signal.reason ?? error;
|
|
906
|
-
if (timeout.aborted)
|
|
907
|
-
throw new CodexImagesError("The image request timed out.");
|
|
908
|
-
throw new CodexImagesError(`The image request could not be sent: ${error instanceof Error ? error.message : String(error)}`);
|
|
909
|
-
}
|
|
910
|
-
const text = await response.text();
|
|
911
|
-
if (!response.ok)
|
|
912
|
-
throw failureFrom(response.status, text, response.headers);
|
|
913
|
-
const requestId = response.headers.get("x-codex-imagegen-request-id") ?? void 0;
|
|
914
|
-
let parsed = null;
|
|
915
|
-
try {
|
|
916
|
-
parsed = asRecord2(JSON.parse(text));
|
|
917
|
-
} catch {
|
|
918
|
-
throw new CodexImagesError("The image response could not be read.", { requestId });
|
|
919
|
-
}
|
|
920
|
-
const first = Array.isArray(parsed?.data) ? asRecord2(parsed.data[0]) : null;
|
|
921
|
-
const encoded = typeof first?.b64_json === "string" ? first.b64_json : "";
|
|
922
|
-
if (encoded === "")
|
|
923
|
-
throw new CodexImagesError("The image service returned no image data.");
|
|
924
|
-
if (Math.ceil(encoded.length * 0.75) > CODEX_IMAGE_MAX_BYTES + 3)
|
|
925
|
-
throw new CodexImagesError("The generated image is larger than 32 MiB and was not kept.");
|
|
926
|
-
const bytes = Buffer.from(encoded, "base64");
|
|
927
|
-
if (bytes.length === 0)
|
|
928
|
-
throw new CodexImagesError("The image service returned no image data.");
|
|
929
|
-
if (bytes.length > CODEX_IMAGE_MAX_BYTES)
|
|
930
|
-
throw new CodexImagesError("The generated image is larger than 32 MiB and was not kept.");
|
|
931
|
-
return {
|
|
932
|
-
bytes,
|
|
933
|
-
mediaType: sniffImageType(bytes),
|
|
934
|
-
...requestId ? { requestId } : {}
|
|
935
|
-
};
|
|
1215
|
+
__name(isOpenAIChatModelId, "isOpenAIChatModelId");
|
|
1216
|
+
function chatModelsOnly(rows) {
|
|
1217
|
+
return rows.filter((row) => isOpenAIChatModelId(row.id));
|
|
936
1218
|
}
|
|
937
|
-
__name(
|
|
1219
|
+
__name(chatModelsOnly, "chatModelsOnly");
|
|
938
1220
|
|
|
939
|
-
// ../providers/openai/dist/
|
|
940
|
-
var
|
|
941
|
-
|
|
1221
|
+
// ../providers/openai/dist/client.js
|
|
1222
|
+
var OPENAI_CAPABILITIES = {
|
|
1223
|
+
supportsNativeStructuredOutput: true,
|
|
942
1224
|
supportsTools: true,
|
|
943
1225
|
supportsStreaming: true,
|
|
944
1226
|
supportsFunctionCalling: true,
|
|
945
|
-
supportsNativeStructuredOutput: true,
|
|
946
1227
|
supportsVision: true,
|
|
947
|
-
supportsDocuments:
|
|
948
|
-
supportsToolResultImages:
|
|
1228
|
+
supportsDocuments: true,
|
|
1229
|
+
supportsToolResultImages: false,
|
|
949
1230
|
supportsToolResultDocuments: false
|
|
950
1231
|
};
|
|
951
|
-
var
|
|
952
|
-
var KNOWN_EFFORT_LEVELS = [
|
|
953
|
-
"none",
|
|
1232
|
+
var GPT_5_EFFORT = [
|
|
954
1233
|
"minimal",
|
|
955
1234
|
"low",
|
|
956
1235
|
"medium",
|
|
1236
|
+
"high"
|
|
1237
|
+
];
|
|
1238
|
+
var GPT_5_1_EFFORT = [
|
|
1239
|
+
"none",
|
|
1240
|
+
"low",
|
|
1241
|
+
"medium",
|
|
1242
|
+
"high"
|
|
1243
|
+
];
|
|
1244
|
+
var GPT_5_2_TO_5_5_EFFORT = [
|
|
1245
|
+
"none",
|
|
1246
|
+
"low",
|
|
1247
|
+
"medium",
|
|
1248
|
+
"high",
|
|
1249
|
+
"xhigh"
|
|
1250
|
+
];
|
|
1251
|
+
var GPT_6_ASTRA_EFFORT = ["low", "medium", "high", "xhigh", "max"];
|
|
1252
|
+
var GPT_5_6_EFFORT = [
|
|
1253
|
+
"none",
|
|
1254
|
+
"low",
|
|
1255
|
+
"medium",
|
|
957
1256
|
"high",
|
|
958
1257
|
"xhigh",
|
|
959
|
-
"max"
|
|
960
|
-
"ultra"
|
|
1258
|
+
"max"
|
|
961
1259
|
];
|
|
962
|
-
function
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
if (typeof effort !== "string" || !KNOWN_EFFORT_LEVELS.includes(effort))
|
|
969
|
-
return void 0;
|
|
970
|
-
if (levels.includes(effort))
|
|
971
|
-
return void 0;
|
|
972
|
-
levels.push(effort);
|
|
1260
|
+
function openAIReasoningEffortLevels(model) {
|
|
1261
|
+
const normalized = model.toLowerCase();
|
|
1262
|
+
if (normalized === "gpt-6-astra")
|
|
1263
|
+
return GPT_6_ASTRA_EFFORT;
|
|
1264
|
+
if (/^gpt-5\.6(?:-(?:sol|terra|luna))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1265
|
+
return GPT_5_6_EFFORT;
|
|
973
1266
|
}
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
1267
|
+
if (/^gpt-5\.5(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1268
|
+
return GPT_5_2_TO_5_5_EFFORT;
|
|
1269
|
+
}
|
|
1270
|
+
if (/^gpt-5\.4(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1271
|
+
return GPT_5_2_TO_5_5_EFFORT;
|
|
1272
|
+
}
|
|
1273
|
+
if (/^gpt-5\.2(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1274
|
+
return GPT_5_2_TO_5_5_EFFORT;
|
|
1275
|
+
}
|
|
1276
|
+
if (/^gpt-5\.1(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1277
|
+
return GPT_5_1_EFFORT;
|
|
1278
|
+
}
|
|
1279
|
+
if (/^gpt-5(?:-(?:mini|nano))?(?:-\d{4}-\d{2}-\d{2})?$/.test(normalized)) {
|
|
1280
|
+
return GPT_5_EFFORT;
|
|
1281
|
+
}
|
|
1282
|
+
return void 0;
|
|
979
1283
|
}
|
|
980
|
-
__name(
|
|
981
|
-
function
|
|
982
|
-
|
|
1284
|
+
__name(openAIReasoningEffortLevels, "openAIReasoningEffortLevels");
|
|
1285
|
+
function openAIModelNeedsResponses(model, params) {
|
|
1286
|
+
const id = model.toLowerCase().replace(/^ft:/, "");
|
|
1287
|
+
if (/^gpt-5\.6(?![a-z0-9.])/.test(id) || /^gpt-6(?![a-z0-9])/.test(id))
|
|
1288
|
+
return true;
|
|
1289
|
+
if (/^gpt-live(?![a-z0-9])/.test(id))
|
|
1290
|
+
return true;
|
|
1291
|
+
if (/-pro(?:-\d{4}-\d{2}-\d{2})?$/.test(id))
|
|
1292
|
+
return true;
|
|
1293
|
+
if (learnedResponsesModels.has(id))
|
|
1294
|
+
return true;
|
|
1295
|
+
const hasTools = (params.tools?.length ?? 0) > 0;
|
|
1296
|
+
if (hasTools && params.effort !== void 0 && /^gpt-5\.(?:4-mini|5)(?![a-z0-9.])/.test(id)) {
|
|
1297
|
+
return true;
|
|
1298
|
+
}
|
|
1299
|
+
return false;
|
|
983
1300
|
}
|
|
984
|
-
__name(
|
|
985
|
-
|
|
986
|
-
|
|
1301
|
+
__name(openAIModelNeedsResponses, "openAIModelNeedsResponses");
|
|
1302
|
+
var learnedResponsesModels = /* @__PURE__ */ new Set();
|
|
1303
|
+
function isResponsesOnlyRefusal(error) {
|
|
1304
|
+
const e = error;
|
|
1305
|
+
if (typeof e?.message !== "string")
|
|
1306
|
+
return false;
|
|
1307
|
+
if (e.status === 400)
|
|
1308
|
+
return /Function tools with reasoning_effort are not supported/i.test(e.message);
|
|
1309
|
+
return e.status === 404 && /not a chat model|only supported in v1\/responses|not supported in the v1\/chat\/completions endpoint|use the v1\/responses endpoint/i.test(e.message);
|
|
987
1310
|
}
|
|
988
|
-
__name(
|
|
989
|
-
function
|
|
990
|
-
|
|
991
|
-
return typeof route?.providerId === "string" && typeof route.model === "string" && Number.isInteger(route.chainIndex) && route.chainIndex >= 0;
|
|
1311
|
+
__name(isResponsesOnlyRefusal, "isResponsesOnlyRefusal");
|
|
1312
|
+
function isClassicChatModel(model) {
|
|
1313
|
+
return /^(?:ft:)?(?:gpt-3\.5|gpt-4|chatgpt-4)/.test(model.toLowerCase());
|
|
992
1314
|
}
|
|
993
|
-
__name(
|
|
994
|
-
function
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}));
|
|
1315
|
+
__name(isClassicChatModel, "isClassicChatModel");
|
|
1316
|
+
function takesSamplingFields(model, effort) {
|
|
1317
|
+
if (isClassicChatModel(model))
|
|
1318
|
+
return true;
|
|
1319
|
+
const id = model.toLowerCase();
|
|
1320
|
+
return /^(?:ft:)?gpt-5\.[1-4](?![a-z0-9.])(?!-(?:codex|pro|chat))/.test(id) && (effort === void 0 || effort === "none");
|
|
1000
1321
|
}
|
|
1001
|
-
__name(
|
|
1002
|
-
function
|
|
1003
|
-
|
|
1004
|
-
if (state?.kind !== "namzu.codex.responses" || state.version !== 1 || !isRoute(state.route) || state.content !== null && typeof state.content !== "string" || !Array.isArray(state.toolCalls) || !Array.isArray(state.items)) {
|
|
1005
|
-
return false;
|
|
1006
|
-
}
|
|
1007
|
-
return state.toolCalls.every((item) => {
|
|
1008
|
-
const call = record(item);
|
|
1009
|
-
return typeof call?.id === "string" && typeof call.name === "string" && typeof call.arguments === "string";
|
|
1010
|
-
});
|
|
1322
|
+
__name(takesSamplingFields, "takesSamplingFields");
|
|
1323
|
+
function refusesReasoningEffort(model) {
|
|
1324
|
+
return isClassicChatModel(model);
|
|
1011
1325
|
}
|
|
1012
|
-
__name(
|
|
1013
|
-
function
|
|
1014
|
-
|
|
1015
|
-
if (!source || source.type !== "model" || !sameRoute(source, targetRoute))
|
|
1016
|
-
return null;
|
|
1017
|
-
const state = source.replayState;
|
|
1018
|
-
if (!isCodexReplayState(state) || !sameRoute(state.route, source))
|
|
1019
|
-
return null;
|
|
1020
|
-
if (state.content !== message.content)
|
|
1021
|
-
return null;
|
|
1022
|
-
if (state.textParts !== void 0 && JSON.stringify(state.textParts) !== JSON.stringify(message.textParts))
|
|
1023
|
-
return null;
|
|
1024
|
-
if (JSON.stringify(state.toolCalls) !== JSON.stringify(durableToolCalls(message)))
|
|
1025
|
-
return null;
|
|
1026
|
-
return state.items;
|
|
1326
|
+
__name(refusesReasoningEffort, "refusesReasoningEffort");
|
|
1327
|
+
function isCompatibleHost(baseURL) {
|
|
1328
|
+
return !isFirstPartyOpenAIEndpoint(baseURL);
|
|
1027
1329
|
}
|
|
1028
|
-
__name(
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1330
|
+
__name(isCompatibleHost, "isCompatibleHost");
|
|
1331
|
+
function hostOf(baseURL) {
|
|
1332
|
+
if (!baseURL)
|
|
1333
|
+
return void 0;
|
|
1334
|
+
try {
|
|
1335
|
+
return new URL(baseURL).hostname;
|
|
1336
|
+
} catch {
|
|
1337
|
+
return void 0;
|
|
1034
1338
|
}
|
|
1035
|
-
return {
|
|
1036
|
-
type: "input_image",
|
|
1037
|
-
detail: source === "tool result" ? TOOL_RESULT_IMAGE_DETAIL : "auto",
|
|
1038
|
-
image_url: `data:${mediaType};base64,${data}`
|
|
1039
|
-
};
|
|
1040
1339
|
}
|
|
1041
|
-
__name(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
throw new Error("CodexProvider: an image marked for model omission reached the driver without request projection.");
|
|
1058
|
-
}
|
|
1059
|
-
content.push(codexImage(attachment.data, attachment.mediaType, "user attachment"));
|
|
1060
|
-
}
|
|
1061
|
-
return content;
|
|
1340
|
+
__name(hostOf, "hostOf");
|
|
1341
|
+
var WINDOW_LISTING_TIMEOUT_MS2 = 3e3;
|
|
1342
|
+
var WINDOW_LISTING_RETRY_MS2 = 5 * 6e4;
|
|
1343
|
+
var EFFORT_VOCABULARY = [
|
|
1344
|
+
"none",
|
|
1345
|
+
"minimal",
|
|
1346
|
+
"low",
|
|
1347
|
+
"medium",
|
|
1348
|
+
"high",
|
|
1349
|
+
"xhigh",
|
|
1350
|
+
"max",
|
|
1351
|
+
"ultra"
|
|
1352
|
+
];
|
|
1353
|
+
var INPUT_MODALITIES = ["text", "image", "document"];
|
|
1354
|
+
function asRecord2(value) {
|
|
1355
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
1062
1356
|
}
|
|
1063
|
-
__name(
|
|
1064
|
-
function
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
const output = [];
|
|
1070
|
-
for (const block of toToolResultBlocks(content)) {
|
|
1071
|
-
if (block.type === "text") {
|
|
1072
|
-
output.push({ type: "input_text", text: block.text });
|
|
1073
|
-
continue;
|
|
1074
|
-
}
|
|
1075
|
-
if (block.type === "document") {
|
|
1076
|
-
throw new Error("CodexProvider: this subscription transport does not support document tool results. Route the turn to a provider whose tool-result wire admits documents.");
|
|
1077
|
-
}
|
|
1078
|
-
if (block.modelOmission) {
|
|
1079
|
-
throw new Error("CodexProvider: a tool image marked for model omission reached the driver without request projection.");
|
|
1080
|
-
}
|
|
1081
|
-
output.push(codexImage(block.data, block.mediaType, "tool result"));
|
|
1082
|
-
}
|
|
1083
|
-
return output;
|
|
1357
|
+
__name(asRecord2, "asRecord");
|
|
1358
|
+
function ratePerMillion(value) {
|
|
1359
|
+
const perToken = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
|
|
1360
|
+
if (typeof perToken !== "number" || !Number.isFinite(perToken) || perToken < 0)
|
|
1361
|
+
return void 0;
|
|
1362
|
+
return Number((perToken * 1e6).toPrecision(12));
|
|
1084
1363
|
}
|
|
1085
|
-
__name(
|
|
1086
|
-
function
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
input.push({
|
|
1098
|
-
type: "message",
|
|
1099
|
-
role: "user",
|
|
1100
|
-
content: codexUserContent(message)
|
|
1101
|
-
});
|
|
1102
|
-
continue;
|
|
1103
|
-
}
|
|
1104
|
-
if (message.role === "tool") {
|
|
1105
|
-
input.push({
|
|
1106
|
-
type: "function_call_output",
|
|
1107
|
-
call_id: message.toolCallId,
|
|
1108
|
-
output: codexToolOutput(message.content)
|
|
1109
|
-
});
|
|
1110
|
-
continue;
|
|
1111
|
-
}
|
|
1112
|
-
const replayed = replayItems(message, targetRoute);
|
|
1113
|
-
if (replayed) {
|
|
1114
|
-
input.push(...replayed);
|
|
1115
|
-
continue;
|
|
1116
|
-
}
|
|
1117
|
-
if (message.content) {
|
|
1118
|
-
input.push({
|
|
1119
|
-
type: "message",
|
|
1120
|
-
role: "assistant",
|
|
1121
|
-
content: message.content
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
for (const call of message.toolCalls ?? []) {
|
|
1125
|
-
input.push({
|
|
1126
|
-
type: "function_call",
|
|
1127
|
-
call_id: call.id,
|
|
1128
|
-
name: call.function.name,
|
|
1129
|
-
arguments: call.function.arguments
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
return input;
|
|
1364
|
+
__name(ratePerMillion, "ratePerMillion");
|
|
1365
|
+
function inputModalitiesOf(row, capabilities) {
|
|
1366
|
+
if (capabilities?.vision === true)
|
|
1367
|
+
return ["text", "image"];
|
|
1368
|
+
if (capabilities?.vision === false)
|
|
1369
|
+
return ["text"];
|
|
1370
|
+
const declared = row.input_modalities ?? asRecord2(row.architecture)?.input_modalities ?? // A plain `modalities` list is read for a chat model only: on another task it may name outputs.
|
|
1371
|
+
(row.task === void 0 || row.task === "chat" ? row.modalities : void 0);
|
|
1372
|
+
if (!Array.isArray(declared))
|
|
1373
|
+
return void 0;
|
|
1374
|
+
const known = INPUT_MODALITIES.filter((kind) => declared.includes(kind));
|
|
1375
|
+
return known.length > 0 ? known : void 0;
|
|
1134
1376
|
}
|
|
1135
|
-
__name(
|
|
1136
|
-
function
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
if (
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
external_web_access: params.webSearch.mode === "live"
|
|
1161
|
-
};
|
|
1162
|
-
tools.push(hosted);
|
|
1377
|
+
__name(inputModalitiesOf, "inputModalitiesOf");
|
|
1378
|
+
function compatibleModelMetadata(model) {
|
|
1379
|
+
const row = asRecord2(model) ?? {};
|
|
1380
|
+
const capabilities = asRecord2(row.capabilities);
|
|
1381
|
+
const result = {};
|
|
1382
|
+
const contextWindow = declaredContextWindow(row);
|
|
1383
|
+
if (contextWindow !== void 0)
|
|
1384
|
+
result.contextWindow = contextWindow;
|
|
1385
|
+
const maxOutputTokens = firstCount(row, ["maximum_output_tokens", "max_output_tokens", "max_completion_tokens"]) ?? firstCount(asRecord2(row.top_provider), ["max_completion_tokens"]);
|
|
1386
|
+
if (maxOutputTokens !== void 0)
|
|
1387
|
+
result.maxOutputTokens = maxOutputTokens;
|
|
1388
|
+
const inputModalities = inputModalitiesOf(row, capabilities);
|
|
1389
|
+
if (inputModalities !== void 0)
|
|
1390
|
+
result.inputModalities = inputModalities;
|
|
1391
|
+
if (capabilities?.tools === false)
|
|
1392
|
+
result.supportsToolUse = false;
|
|
1393
|
+
const pricing = asRecord2(row.pricing);
|
|
1394
|
+
const currency = typeof pricing?.currency === "string" ? pricing.currency.toUpperCase() : void 0;
|
|
1395
|
+
if (pricing && (currency === void 0 || currency === "USD")) {
|
|
1396
|
+
const input = ratePerMillion(pricing.prompt);
|
|
1397
|
+
const output = ratePerMillion(pricing.completion);
|
|
1398
|
+
if (input !== void 0)
|
|
1399
|
+
result.inputPrice = input;
|
|
1400
|
+
if (output !== void 0)
|
|
1401
|
+
result.outputPrice = output;
|
|
1163
1402
|
}
|
|
1164
|
-
|
|
1403
|
+
let offered = Array.isArray(row.supported_reasoning_efforts) ? row.supported_reasoning_efforts : void 0;
|
|
1404
|
+
if (offered === void 0 && Array.isArray(capabilities?.reasoning_effort_values)) {
|
|
1405
|
+
const aliases = asRecord2(capabilities.reasoning_effort_aliases);
|
|
1406
|
+
offered = [.../* @__PURE__ */ new Set([...capabilities.reasoning_effort_values, ...Object.keys(aliases ?? {})])];
|
|
1407
|
+
}
|
|
1408
|
+
const menu = offered !== void 0 && new Set(offered).size === offered.length && offered.every((level) => typeof level === "string" && EFFORT_VOCABULARY.includes(level)) ? offered : void 0;
|
|
1409
|
+
if (menu) {
|
|
1410
|
+
result.reasoningEffortLevels = [...menu];
|
|
1411
|
+
const defaultEffort = row.reasoning_effort;
|
|
1412
|
+
if (typeof defaultEffort === "string" && menu.includes(defaultEffort))
|
|
1413
|
+
result.reasoningEffortDefault = defaultEffort;
|
|
1414
|
+
} else if (offered === void 0 && capabilities?.reasoning_effort === false) {
|
|
1415
|
+
result.reasoningEffortLevels = [];
|
|
1416
|
+
}
|
|
1417
|
+
return result;
|
|
1165
1418
|
}
|
|
1166
|
-
__name(
|
|
1167
|
-
function
|
|
1168
|
-
|
|
1169
|
-
|
|
1419
|
+
__name(compatibleModelMetadata, "compatibleModelMetadata");
|
|
1420
|
+
function assertOpenAIReasoningEffort(model, effort) {
|
|
1421
|
+
if (effort === void 0)
|
|
1422
|
+
return;
|
|
1423
|
+
const supported = openAIReasoningEffortLevels(model);
|
|
1424
|
+
if (supported === void 0 || supported.includes(effort))
|
|
1425
|
+
return;
|
|
1426
|
+
throw new Error(`OpenAIProvider: effort "${effort}" is not supported by model "${model}". Supported levels: ${supported.join(", ")}. Choose one of those levels or omit \`effort\`.`);
|
|
1427
|
+
}
|
|
1428
|
+
__name(assertOpenAIReasoningEffort, "assertOpenAIReasoningEffort");
|
|
1429
|
+
function withReasoningEffort(request, effort) {
|
|
1430
|
+
if (effort === void 0)
|
|
1431
|
+
return request;
|
|
1170
1432
|
return {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
totalTokens: usage.total_tokens ?? promptTokens + completionTokens,
|
|
1174
|
-
cachedTokens: usage.input_tokens_details?.cached_tokens ?? 0,
|
|
1175
|
-
cacheWriteTokens: 0,
|
|
1176
|
-
...servedSpeed(servedTier, requestedSpeed)
|
|
1433
|
+
...request,
|
|
1434
|
+
reasoning_effort: effort
|
|
1177
1435
|
};
|
|
1178
1436
|
}
|
|
1179
|
-
__name(
|
|
1180
|
-
function
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
}
|
|
1192
|
-
if (Array.isArray(item.additional_speed_tiers)) {
|
|
1193
|
-
for (const entry of item.additional_speed_tiers)
|
|
1194
|
-
note(entry);
|
|
1437
|
+
__name(withReasoningEffort, "withReasoningEffort");
|
|
1438
|
+
function mapFinishReason(reason) {
|
|
1439
|
+
switch (reason) {
|
|
1440
|
+
case "length":
|
|
1441
|
+
return "length";
|
|
1442
|
+
case "tool_calls":
|
|
1443
|
+
case "function_call":
|
|
1444
|
+
return "tool_calls";
|
|
1445
|
+
case "content_filter":
|
|
1446
|
+
return "content_filter";
|
|
1447
|
+
default:
|
|
1448
|
+
return "stop";
|
|
1195
1449
|
}
|
|
1196
|
-
return ["fast", "ultrafast"].filter((tier) => tiers.has(tier));
|
|
1197
1450
|
}
|
|
1198
|
-
__name(
|
|
1199
|
-
function
|
|
1200
|
-
if (
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1451
|
+
__name(mapFinishReason, "mapFinishReason");
|
|
1452
|
+
function parseUsage(raw, servedTier, requestedSpeed) {
|
|
1453
|
+
if (!raw) {
|
|
1454
|
+
return {
|
|
1455
|
+
promptTokens: 0,
|
|
1456
|
+
completionTokens: 0,
|
|
1457
|
+
totalTokens: 0,
|
|
1458
|
+
cachedTokens: 0,
|
|
1459
|
+
cacheWriteTokens: 0
|
|
1460
|
+
};
|
|
1208
1461
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
store: false,
|
|
1219
|
-
instructions: instructions || void 0,
|
|
1220
|
-
input: toCodexInput(params.messages, targetRoute, openingRun),
|
|
1221
|
-
// One key for the whole conversation routes every request to the same
|
|
1222
|
-
// cache; without it the backend keys on the request alone.
|
|
1223
|
-
...params.cacheKey && !downgrade.noCacheKey ? { prompt_cache_key: params.cacheKey } : {},
|
|
1224
|
-
// The Codex subscription request schema deliberately has no
|
|
1225
|
-
// `max_output_tokens` member. `ChatCompletionParams.maxTokens` is a public
|
|
1226
|
-
// API control, but projecting it onto this route makes the whole request
|
|
1227
|
-
// invalid; the backend owns the output budget here.
|
|
1228
|
-
// The subscription Responses backend expects these three fields even for a
|
|
1229
|
-
// turn that exposes no tools. The ordinary public Responses endpoint admits
|
|
1230
|
-
// their omission, which is why the generated client types all make them
|
|
1231
|
-
// optional; the Codex wire does not have the same defaulting contract.
|
|
1232
|
-
tools: toCodexTools(params) ?? [],
|
|
1233
|
-
tool_choice: params.toolChoice ?? "auto",
|
|
1234
|
-
parallel_tool_calls: params.parallelToolCalls ?? true,
|
|
1235
|
-
include: ["reasoning.encrypted_content"],
|
|
1236
|
-
...params.responseFormat ? {
|
|
1237
|
-
text: {
|
|
1238
|
-
format: params.responseFormat.type === "json_schema" ? { type: "json_schema", ...params.responseFormat.json_schema } : { type: "json_object" }
|
|
1239
|
-
}
|
|
1240
|
-
} : {},
|
|
1241
|
-
...params.effort !== void 0 ? { reasoning: { effort: params.effort, summary: "auto" } } : params.thinking?.type === "adaptive" ? { reasoning: { summary: "auto" } } : {}
|
|
1462
|
+
const promptTokens = raw.prompt_tokens ?? 0;
|
|
1463
|
+
const completionTokens = raw.completion_tokens ?? 0;
|
|
1464
|
+
return {
|
|
1465
|
+
promptTokens,
|
|
1466
|
+
completionTokens,
|
|
1467
|
+
totalTokens: raw.total_tokens ?? promptTokens + completionTokens,
|
|
1468
|
+
cachedTokens: raw.prompt_tokens_details?.cached_tokens ?? 0,
|
|
1469
|
+
cacheWriteTokens: 0,
|
|
1470
|
+
...servedSpeed(servedTier, requestedSpeed)
|
|
1242
1471
|
};
|
|
1243
|
-
return request;
|
|
1244
1472
|
}
|
|
1245
|
-
__name(
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
var REFUSED_SHAPE = /\bdeveloper\b|\brole\b|\binput\[\d*\]|session_id|prompt_cache_key/i;
|
|
1249
|
-
function refusedNewShape(error) {
|
|
1250
|
-
if (typeof error !== "object" || error === null)
|
|
1251
|
-
return void 0;
|
|
1252
|
-
const status = error.status;
|
|
1253
|
-
if (!(error instanceof OpenAI.BadRequestError) && status !== 400)
|
|
1473
|
+
__name(parseUsage, "parseUsage");
|
|
1474
|
+
function formatToolChoice(tc) {
|
|
1475
|
+
if (tc === void 0)
|
|
1254
1476
|
return void 0;
|
|
1255
|
-
|
|
1256
|
-
|
|
1477
|
+
if (tc === "auto" || tc === "none" || tc === "required")
|
|
1478
|
+
return tc;
|
|
1479
|
+
if (typeof tc === "object" && tc.type === "function") {
|
|
1480
|
+
return { type: "function", function: { name: tc.function.name } };
|
|
1481
|
+
}
|
|
1482
|
+
return void 0;
|
|
1483
|
+
}
|
|
1484
|
+
__name(formatToolChoice, "formatToolChoice");
|
|
1485
|
+
function assertThinkingSupported(params) {
|
|
1486
|
+
assertThinkingUnsupported("OpenAIProvider", { thinking: params.thinking });
|
|
1487
|
+
}
|
|
1488
|
+
__name(assertThinkingSupported, "assertThinkingSupported");
|
|
1489
|
+
function assertCitationsSupported(attachment, index) {
|
|
1490
|
+
if (!attachment.citations)
|
|
1491
|
+
return;
|
|
1492
|
+
const which = attachment.name ?? `attachment ${index}`;
|
|
1493
|
+
throw new Error(`This provider cannot return citations, and ${which} asked for them. Drop \`citations\` to send the document without them, or use a provider whose capabilities include citation support.`);
|
|
1494
|
+
}
|
|
1495
|
+
__name(assertCitationsSupported, "assertCitationsSupported");
|
|
1496
|
+
function toOpenAIMessages(messages) {
|
|
1497
|
+
const converted = messages.map((msg) => {
|
|
1498
|
+
if (msg.role === "system") {
|
|
1499
|
+
return { role: "system", content: msg.content };
|
|
1500
|
+
}
|
|
1501
|
+
if (msg.role === "user") {
|
|
1502
|
+
if (msg.attachments && msg.attachments.length > 0) {
|
|
1503
|
+
const parts = [];
|
|
1504
|
+
if (msg.content.length > 0) {
|
|
1505
|
+
parts.push({ type: "text", text: msg.content });
|
|
1506
|
+
}
|
|
1507
|
+
for (const [index, att] of msg.attachments.entries()) {
|
|
1508
|
+
if (att.type === "document") {
|
|
1509
|
+
assertCitationsSupported(att, index);
|
|
1510
|
+
parts.push({
|
|
1511
|
+
type: "file",
|
|
1512
|
+
file: {
|
|
1513
|
+
file_data: `data:${att.mediaType};base64,${att.data}`,
|
|
1514
|
+
...att.name ? { filename: att.name } : {}
|
|
1515
|
+
}
|
|
1516
|
+
});
|
|
1517
|
+
continue;
|
|
1518
|
+
}
|
|
1519
|
+
if (att.type === "stored") {
|
|
1520
|
+
throw new Error(`A stored attachment ("${att.ref}") reached the driver unresolved. Resolve it against the run's attachment store before sending.`);
|
|
1521
|
+
}
|
|
1522
|
+
parts.push({
|
|
1523
|
+
type: "image_url",
|
|
1524
|
+
image_url: { url: `data:${att.mediaType};base64,${att.data}` }
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
return { role: "user", content: parts };
|
|
1528
|
+
}
|
|
1529
|
+
return { role: "user", content: msg.content };
|
|
1530
|
+
}
|
|
1531
|
+
if (msg.role === "tool") {
|
|
1532
|
+
return {
|
|
1533
|
+
role: "tool",
|
|
1534
|
+
// Tool messages are text-only on this wire, so a content block
|
|
1535
|
+
// degrades to an honest placeholder rather than having its
|
|
1536
|
+
// base64 payload dumped as text.
|
|
1537
|
+
content: toolResultToText(msg.content),
|
|
1538
|
+
tool_call_id: msg.toolCallId
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
const assistant = {
|
|
1542
|
+
role: "assistant",
|
|
1543
|
+
content: msg.content
|
|
1544
|
+
};
|
|
1545
|
+
if ("toolCalls" in msg && msg.toolCalls && msg.toolCalls.length > 0) {
|
|
1546
|
+
;
|
|
1547
|
+
assistant.tool_calls = msg.toolCalls.map((tc) => ({
|
|
1548
|
+
id: tc.id,
|
|
1549
|
+
type: "function",
|
|
1550
|
+
function: {
|
|
1551
|
+
name: tc.function.name,
|
|
1552
|
+
arguments: tc.function.arguments
|
|
1553
|
+
}
|
|
1554
|
+
}));
|
|
1555
|
+
}
|
|
1556
|
+
return assistant;
|
|
1557
|
+
});
|
|
1558
|
+
return converted.filter((msg) => msg.role !== "assistant" || Boolean(msg.content) || (msg.tool_calls?.length ?? 0) > 0);
|
|
1559
|
+
}
|
|
1560
|
+
__name(toOpenAIMessages, "toOpenAIMessages");
|
|
1561
|
+
function toOpenAITools(params) {
|
|
1562
|
+
if (!params.tools || params.tools.length === 0)
|
|
1257
1563
|
return void 0;
|
|
1258
|
-
|
|
1564
|
+
const enforced = new Set(params.enforceToolInputSchema ?? []);
|
|
1565
|
+
return params.tools.map((t) => ({
|
|
1566
|
+
type: "function",
|
|
1567
|
+
function: {
|
|
1568
|
+
name: t.function.name,
|
|
1569
|
+
description: t.function.description ?? "",
|
|
1570
|
+
parameters: t.function.parameters ?? {},
|
|
1571
|
+
...enforced.has(t.function.name) && acceptsStrictSchema(t.function.parameters) ? { strict: true } : {}
|
|
1572
|
+
}
|
|
1573
|
+
}));
|
|
1259
1574
|
}
|
|
1260
|
-
__name(
|
|
1261
|
-
var
|
|
1262
|
-
var MODELS_CLIENT_VERSION = "1.0.0";
|
|
1263
|
-
var WINDOW_LISTING_TIMEOUT_MS2 = 3e3;
|
|
1264
|
-
var WINDOW_LISTING_RETRY_MS2 = 5 * 6e4;
|
|
1265
|
-
var CodexProvider = class {
|
|
1575
|
+
__name(toOpenAITools, "toOpenAITools");
|
|
1576
|
+
var OpenAIProvider = class {
|
|
1266
1577
|
static {
|
|
1267
|
-
__name(this, "
|
|
1578
|
+
__name(this, "OpenAIProvider");
|
|
1268
1579
|
}
|
|
1269
|
-
id = "
|
|
1270
|
-
name = "OpenAI
|
|
1271
|
-
capabilities =
|
|
1580
|
+
id = "openai";
|
|
1581
|
+
name = "OpenAI";
|
|
1582
|
+
capabilities = OPENAI_CAPABILITIES;
|
|
1272
1583
|
client;
|
|
1273
1584
|
defaultModel;
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
/** Per model, the compaction threshold the account's listing states or implies. */
|
|
1280
|
-
compactLimits;
|
|
1585
|
+
/** Whether requests go somewhere other than OpenAI's own API, which is where a model's window is worth asking for. */
|
|
1586
|
+
compatibleHost;
|
|
1587
|
+
/** The windows a compatible endpoint's last fulfilled listing declared, by model id. */
|
|
1588
|
+
declaredWindows;
|
|
1589
|
+
/** Before this time (ms since the epoch) a failed listing is not asked for again. */
|
|
1281
1590
|
windowListingRetryAt = 0;
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1591
|
+
thinkingOffFields;
|
|
1592
|
+
/** The base URL requests go to, kept to name the host when fast mode is refused there. */
|
|
1593
|
+
effectiveBaseURL;
|
|
1594
|
+
config;
|
|
1595
|
+
responses;
|
|
1285
1596
|
constructor(config) {
|
|
1286
|
-
if (!config.
|
|
1287
|
-
throw new Error("
|
|
1288
|
-
if (!config.accountId)
|
|
1289
|
-
throw new Error("Codex ChatGPT account id is required.");
|
|
1290
|
-
this.client = new OpenAI({
|
|
1291
|
-
apiKey: config.accessToken,
|
|
1292
|
-
baseURL: config.baseURL ?? DEFAULT_CODEX_BASE_URL,
|
|
1293
|
-
timeout: config.timeout,
|
|
1294
|
-
...config.maxRetries !== void 0 ? { maxRetries: config.maxRetries } : {},
|
|
1295
|
-
defaultHeaders: {
|
|
1296
|
-
...codexRequestHeaders(config.accountId),
|
|
1297
|
-
...config.defaultHeaders ?? {}
|
|
1298
|
-
}
|
|
1299
|
-
});
|
|
1300
|
-
this.defaultModel = config.model;
|
|
1301
|
-
this.listingKey = `${config.accountId}\0${config.baseURL ?? DEFAULT_CODEX_BASE_URL}`;
|
|
1302
|
-
const known = listingByAccount.get(this.listingKey);
|
|
1303
|
-
if (known) {
|
|
1304
|
-
this.speedTiers = known.speedTiers;
|
|
1305
|
-
this.reasoningProfiles = known.reasoningProfiles;
|
|
1306
|
-
this.windows = known.windows;
|
|
1307
|
-
this.compactLimits = known.compactLimits;
|
|
1597
|
+
if (!config.apiKey) {
|
|
1598
|
+
throw new Error("OpenAI API key is required. Set OPENAI_API_KEY env variable.");
|
|
1308
1599
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
if (
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1600
|
+
const clientOptions = {
|
|
1601
|
+
apiKey: config.apiKey
|
|
1602
|
+
};
|
|
1603
|
+
if (config.baseURL)
|
|
1604
|
+
clientOptions.baseURL = config.baseURL;
|
|
1605
|
+
if (config.organization)
|
|
1606
|
+
clientOptions.organization = config.organization;
|
|
1607
|
+
if (config.project)
|
|
1608
|
+
clientOptions.project = config.project;
|
|
1609
|
+
if (config.timeout !== void 0)
|
|
1610
|
+
clientOptions.timeout = config.timeout;
|
|
1611
|
+
if (config.maxRetries !== void 0)
|
|
1612
|
+
clientOptions.maxRetries = config.maxRetries;
|
|
1613
|
+
clientOptions.defaultHeaders = {
|
|
1614
|
+
...attributionHeaders(),
|
|
1615
|
+
...config.defaultHeaders ?? {}
|
|
1616
|
+
};
|
|
1617
|
+
this.client = new OpenAI(clientOptions);
|
|
1618
|
+
this.config = config;
|
|
1619
|
+
this.defaultModel = config.model;
|
|
1620
|
+
this.thinkingOffFields = config.thinkingOffFields;
|
|
1621
|
+
this.effectiveBaseURL = config.baseURL ?? process.env.OPENAI_BASE_URL;
|
|
1622
|
+
this.compatibleHost = isCompatibleHost(this.effectiveBaseURL);
|
|
1331
1623
|
}
|
|
1332
1624
|
/**
|
|
1333
|
-
* The window the runtime measures compaction against, as
|
|
1334
|
-
* it
|
|
1335
|
-
*
|
|
1625
|
+
* The window the runtime measures compaction against, as a compatible endpoint's own model
|
|
1626
|
+
* listing declares it, or `undefined` when it declares none, which leaves the SDK's table to
|
|
1627
|
+
* answer. The table is a hand-kept guess by model name; an endpoint that serves a model knows
|
|
1628
|
+
* how long a prompt it takes. OpenAI's own API declares no window, so it is not asked.
|
|
1336
1629
|
*
|
|
1337
|
-
* The listing is asked once
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1630
|
+
* The listing is asked once and a fulfilled one is kept. A failure is remembered for a few
|
|
1631
|
+
* minutes, so an endpoint with no usable listing is not asked at the start of every turn, and a
|
|
1632
|
+
* listing that hangs is cut short. Neither ever fails a turn.
|
|
1340
1633
|
*/
|
|
1341
1634
|
async resolveContextWindow(model, signal) {
|
|
1342
1635
|
signal?.throwIfAborted();
|
|
1343
|
-
if (!this.
|
|
1636
|
+
if (!this.compatibleHost)
|
|
1637
|
+
return void 0;
|
|
1638
|
+
if (!this.declaredWindows) {
|
|
1344
1639
|
if (Date.now() < this.windowListingRetryAt)
|
|
1345
1640
|
return void 0;
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
});
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
this.
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
const model = this.
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
phase: event.item.phase
|
|
1483
|
-
});
|
|
1484
|
-
if (event.item.type === "web_search_call") {
|
|
1485
|
-
yield {
|
|
1486
|
-
id: responseId,
|
|
1487
|
-
delta: {
|
|
1488
|
-
hostedTool: {
|
|
1489
|
-
id: event.item.id,
|
|
1490
|
-
name: "web_search",
|
|
1491
|
-
status: "running",
|
|
1492
|
-
...webSearchDetail(event.item)
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
}
|
|
1497
|
-
if (event.item.type === "function_call") {
|
|
1498
|
-
const index = nextCallIndex++;
|
|
1499
|
-
callIndex.set(event.item.id ?? event.item.call_id, index);
|
|
1500
|
-
callIndex.set(event.item.call_id, index);
|
|
1501
|
-
yield {
|
|
1502
|
-
id: responseId,
|
|
1503
|
-
delta: {
|
|
1504
|
-
toolCalls: [
|
|
1505
|
-
{
|
|
1506
|
-
index,
|
|
1507
|
-
id: event.item.call_id,
|
|
1508
|
-
type: "function",
|
|
1509
|
-
function: {
|
|
1510
|
-
name: event.item.name,
|
|
1511
|
-
arguments: event.item.arguments
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
]
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
}
|
|
1518
|
-
break;
|
|
1519
|
-
case "response.function_call_arguments.delta": {
|
|
1520
|
-
const index = callIndex.get(event.item_id) ?? event.output_index;
|
|
1521
|
-
yield {
|
|
1522
|
-
id: responseId,
|
|
1523
|
-
delta: {
|
|
1524
|
-
toolCalls: [{ index, function: { arguments: event.delta } }]
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1527
|
-
break;
|
|
1528
|
-
}
|
|
1529
|
-
case "response.output_item.done":
|
|
1530
|
-
completedItems.set(event.output_index, event.item);
|
|
1531
|
-
if (event.item.type === "web_search_call") {
|
|
1532
|
-
yield {
|
|
1533
|
-
id: responseId,
|
|
1534
|
-
delta: {
|
|
1535
|
-
hostedTool: {
|
|
1536
|
-
id: event.item.id,
|
|
1537
|
-
name: "web_search",
|
|
1538
|
-
status: event.item.status === "completed" ? "completed" : "failed",
|
|
1539
|
-
...webSearchDetail(event.item)
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
if (event.item.type === "function_call") {
|
|
1545
|
-
yield {
|
|
1546
|
-
id: responseId,
|
|
1547
|
-
delta: {
|
|
1548
|
-
toolCallEnd: {
|
|
1549
|
-
index: callIndex.get(event.item.id ?? event.item.call_id) ?? event.output_index,
|
|
1550
|
-
id: event.item.call_id
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
break;
|
|
1556
|
-
case "response.completed": {
|
|
1557
|
-
const output = event.response.output?.length ? event.response.output : [...completedItems].sort(([left], [right]) => left - right).map(([, item]) => item);
|
|
1558
|
-
const calls = output.filter((item) => item.type === "function_call").map((item) => ({
|
|
1559
|
-
id: item.call_id,
|
|
1560
|
-
name: item.name,
|
|
1561
|
-
arguments: item.arguments
|
|
1562
|
-
}));
|
|
1563
|
-
const textParts = output.filter((item) => item.type === "message").map((item) => ({
|
|
1564
|
-
id: item.id,
|
|
1565
|
-
...item.phase === "commentary" || item.phase === "final_answer" ? { phase: item.phase } : {},
|
|
1566
|
-
text: item.content.filter((part) => part.type === "output_text").map((part) => part.text).join("")
|
|
1567
|
-
}));
|
|
1568
|
-
const phased = textParts.some((part) => part.phase !== void 0);
|
|
1569
|
-
let content = phased ? selectAssistantText(textParts) : textParts.map((part) => part.text).join("");
|
|
1570
|
-
const sources = /* @__PURE__ */ new Map();
|
|
1571
|
-
for (const item of output) {
|
|
1572
|
-
if (item.type !== "message")
|
|
1573
|
-
continue;
|
|
1574
|
-
for (const part of item.content) {
|
|
1575
|
-
if (part.type !== "output_text")
|
|
1576
|
-
continue;
|
|
1577
|
-
for (const annotation of part.annotations ?? []) {
|
|
1578
|
-
if (annotation.type === "url_citation" && /^https?:\/\//i.test(annotation.url) && !content.includes(annotation.url)) {
|
|
1579
|
-
sources.set(annotation.url, annotation.title);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
if (sources.size) {
|
|
1585
|
-
const links = [...sources].map(([url, title]) => `[${title.replace(/[\[\]\r\n]/g, " ")}](<${url.replace(/[<>\s]/g, (c) => encodeURIComponent(c))}>)`).join(" \xB7 ");
|
|
1586
|
-
const suffix = `
|
|
1587
|
-
|
|
1588
|
-
Sources: ${links}`;
|
|
1589
|
-
content += suffix;
|
|
1590
|
-
let partIndex = textParts.length - 1;
|
|
1591
|
-
for (let i = textParts.length - 1; i >= 0; i--) {
|
|
1592
|
-
if (textParts[i]?.phase === "final_answer") {
|
|
1593
|
-
partIndex = i;
|
|
1594
|
-
break;
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
const part = textParts[partIndex];
|
|
1598
|
-
if (part)
|
|
1599
|
-
textParts[partIndex] = { ...part, text: part.text + suffix };
|
|
1600
|
-
yield {
|
|
1601
|
-
id: responseId,
|
|
1602
|
-
delta: { content: suffix, contentOrigin: "driver" }
|
|
1603
|
-
};
|
|
1604
|
-
}
|
|
1605
|
-
const replayState = {
|
|
1606
|
-
kind: "namzu.codex.responses",
|
|
1607
|
-
version: 1,
|
|
1608
|
-
route: targetRoute,
|
|
1609
|
-
content: content || null,
|
|
1610
|
-
...phased ? { textParts } : {},
|
|
1611
|
-
toolCalls: calls,
|
|
1612
|
-
items: output
|
|
1613
|
-
};
|
|
1614
|
-
finished = true;
|
|
1615
|
-
yield {
|
|
1616
|
-
id: event.response.id,
|
|
1617
|
-
delta: {},
|
|
1618
|
-
...phased ? { textParts } : {},
|
|
1619
|
-
finishReason: calls.length > 0 ? "tool_calls" : "stop",
|
|
1620
|
-
usage: responseUsage(event.response.usage ?? {}, event.response.service_tier, requestedSpeed),
|
|
1621
|
-
replayState
|
|
1622
|
-
};
|
|
1623
|
-
break;
|
|
1624
|
-
}
|
|
1625
|
-
case "response.incomplete": {
|
|
1626
|
-
const reason = event.response.incomplete_details?.reason;
|
|
1641
|
+
const controller = new AbortController();
|
|
1642
|
+
const forward = /* @__PURE__ */ __name(() => controller.abort(), "forward");
|
|
1643
|
+
signal?.addEventListener("abort", forward, { once: true });
|
|
1644
|
+
const timer = setTimeout(forward, WINDOW_LISTING_TIMEOUT_MS2);
|
|
1645
|
+
try {
|
|
1646
|
+
const listed = await this.listModels(controller.signal);
|
|
1647
|
+
this.declaredWindows ??= new Map(listed.flatMap((entry) => entry.contextWindow !== void 0 ? [[entry.id, entry.contextWindow]] : []));
|
|
1648
|
+
} catch {
|
|
1649
|
+
signal?.throwIfAborted();
|
|
1650
|
+
this.windowListingRetryAt = Date.now() + WINDOW_LISTING_RETRY_MS2;
|
|
1651
|
+
return void 0;
|
|
1652
|
+
} finally {
|
|
1653
|
+
clearTimeout(timer);
|
|
1654
|
+
signal?.removeEventListener("abort", forward);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
return this.declaredWindows.get(model);
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* The Responses transport for this key, built on the subscription driver's
|
|
1661
|
+
* request and stream handling. Only used on OpenAI's own endpoint.
|
|
1662
|
+
*/
|
|
1663
|
+
responsesRoute() {
|
|
1664
|
+
this.responses ??= new CodexProvider({
|
|
1665
|
+
responsesApi: true,
|
|
1666
|
+
apiKey: this.config.apiKey,
|
|
1667
|
+
model: this.defaultModel,
|
|
1668
|
+
...this.effectiveBaseURL ? { baseURL: this.effectiveBaseURL } : {},
|
|
1669
|
+
organization: this.config.organization,
|
|
1670
|
+
project: this.config.project,
|
|
1671
|
+
timeout: this.config.timeout,
|
|
1672
|
+
maxRetries: this.config.maxRetries,
|
|
1673
|
+
defaultHeaders: { ...attributionHeaders(), ...this.config.defaultHeaders ?? {} }
|
|
1674
|
+
});
|
|
1675
|
+
return this.responses;
|
|
1676
|
+
}
|
|
1677
|
+
resolveModel(params) {
|
|
1678
|
+
const model = params.model || this.defaultModel;
|
|
1679
|
+
if (!model) {
|
|
1680
|
+
throw new Error("OpenAIProvider: model is required. Pass `model` in config or on the chat call.");
|
|
1681
|
+
}
|
|
1682
|
+
return model;
|
|
1683
|
+
}
|
|
1684
|
+
reasoningEffortLevelsFor(model) {
|
|
1685
|
+
return openAIReasoningEffortLevels(model);
|
|
1686
|
+
}
|
|
1687
|
+
async *chatStream(params) {
|
|
1688
|
+
const model = this.resolveModel(params);
|
|
1689
|
+
assertThinkingSupported(params);
|
|
1690
|
+
assertOpenAIReasoningEffort(model, params.effort);
|
|
1691
|
+
const firstParty = !this.compatibleHost;
|
|
1692
|
+
if (firstParty && openAIModelNeedsResponses(model, params)) {
|
|
1693
|
+
yield* this.responsesRoute().chatStream({ ...params, model });
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const dropsSampling = firstParty && !takesSamplingFields(model, params.effort);
|
|
1697
|
+
const effort = firstParty && refusesReasoningEffort(model) ? void 0 : params.effort;
|
|
1698
|
+
const reasoningOff = params.effort === "none" || params.thinking?.type === "disabled";
|
|
1699
|
+
const offFields = reasoningOff ? typeof this.thinkingOffFields === "function" ? this.thinkingOffFields(model) : this.thinkingOffFields : void 0;
|
|
1700
|
+
let serviceTier;
|
|
1701
|
+
if (params.speed === "fast" || params.speed === "ultrafast") {
|
|
1702
|
+
const accepted = assertFastModeAccepted({
|
|
1703
|
+
route: "api",
|
|
1704
|
+
model,
|
|
1705
|
+
tier: params.speed,
|
|
1706
|
+
firstPartyEndpoint: !this.compatibleHost,
|
|
1707
|
+
host: hostOf(this.effectiveBaseURL)
|
|
1708
|
+
});
|
|
1709
|
+
serviceTier = accepted.wire === "priority" ? "priority" : void 0;
|
|
1710
|
+
}
|
|
1711
|
+
const requestedSpeed = params.speed === "fast" ? "fast" : void 0;
|
|
1712
|
+
let stream;
|
|
1713
|
+
try {
|
|
1714
|
+
stream = await this.client.chat.completions.create(
|
|
1715
|
+
withReasoningEffort({
|
|
1716
|
+
model,
|
|
1717
|
+
messages: toOpenAIMessages(params.messages),
|
|
1718
|
+
stream: true,
|
|
1719
|
+
stream_options: { include_usage: true },
|
|
1720
|
+
tools: toOpenAITools(params),
|
|
1721
|
+
tool_choice: formatToolChoice(params.toolChoice),
|
|
1722
|
+
parallel_tool_calls: params.parallelToolCalls,
|
|
1723
|
+
...dropsSampling ? {} : {
|
|
1724
|
+
temperature: params.temperature,
|
|
1725
|
+
top_p: params.topP,
|
|
1726
|
+
frequency_penalty: params.frequencyPenalty,
|
|
1727
|
+
presence_penalty: params.presencePenalty
|
|
1728
|
+
},
|
|
1729
|
+
...firstParty ? { max_completion_tokens: params.maxTokens } : { max_tokens: params.maxTokens },
|
|
1730
|
+
stop: params.stop,
|
|
1731
|
+
response_format: params.responseFormat,
|
|
1732
|
+
...serviceTier ? { service_tier: serviceTier } : {},
|
|
1733
|
+
...offFields ?? {}
|
|
1734
|
+
}, effort),
|
|
1735
|
+
// Per-request abort: a Stop tears the in-flight SSE request down.
|
|
1736
|
+
{ signal: params.signal }
|
|
1737
|
+
);
|
|
1738
|
+
} catch (err) {
|
|
1739
|
+
if (isCallerAbortError(err, params.signal))
|
|
1740
|
+
throw params.signal?.reason ?? err;
|
|
1741
|
+
if (isProviderRequestError(err))
|
|
1742
|
+
throw err;
|
|
1743
|
+
if (firstParty && isResponsesOnlyRefusal(err)) {
|
|
1744
|
+
learnedResponsesModels.add(model.toLowerCase().replace(/^ft:/, ""));
|
|
1745
|
+
yield* this.responsesRoute().chatStream({ ...params, model });
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1748
|
+
throw providerVendorError({ providerId: "openai", error: err });
|
|
1749
|
+
}
|
|
1750
|
+
let finished = false;
|
|
1751
|
+
let servedTier;
|
|
1752
|
+
try {
|
|
1753
|
+
for await (const chunk of stream) {
|
|
1754
|
+
const echoed = chunk.service_tier;
|
|
1755
|
+
if (typeof echoed === "string" && echoed.length > 0)
|
|
1756
|
+
servedTier = echoed;
|
|
1757
|
+
params.signal?.throwIfAborted();
|
|
1758
|
+
try {
|
|
1759
|
+
const choice = chunk.choices[0];
|
|
1760
|
+
const delta = choice?.delta;
|
|
1761
|
+
const extra = delta;
|
|
1762
|
+
const emitted = typeof extra?.reasoning_content === "string" ? extra.reasoning_content : typeof extra?.reasoning === "string" ? extra.reasoning : void 0;
|
|
1763
|
+
const reasoning = reasoningOff ? void 0 : emitted;
|
|
1764
|
+
const toolCalls = delta?.tool_calls?.map((tc) => ({
|
|
1765
|
+
index: tc.index,
|
|
1766
|
+
id: tc.id,
|
|
1767
|
+
type: tc.type,
|
|
1768
|
+
function: tc.function ? {
|
|
1769
|
+
name: tc.function.name,
|
|
1770
|
+
arguments: tc.function.arguments
|
|
1771
|
+
} : void 0
|
|
1772
|
+
}));
|
|
1773
|
+
const hasDelta = delta?.content !== void 0 && delta.content !== null || reasoning !== void 0 && reasoning.length > 0 || toolCalls && toolCalls.length > 0;
|
|
1774
|
+
const finishReason = choice?.finish_reason ? mapFinishReason(choice.finish_reason) : void 0;
|
|
1775
|
+
const usage = chunk.usage ? parseUsage(chunk.usage, servedTier, requestedSpeed) : void 0;
|
|
1776
|
+
if (finishReason)
|
|
1627
1777
|
finished = true;
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1778
|
+
if (!hasDelta && !finishReason && !usage)
|
|
1779
|
+
continue;
|
|
1780
|
+
yield {
|
|
1781
|
+
id: chunk.id,
|
|
1782
|
+
delta: {
|
|
1783
|
+
content: delta?.content ?? void 0,
|
|
1784
|
+
...reasoning ? {
|
|
1785
|
+
reasoning: {
|
|
1786
|
+
index: 0,
|
|
1787
|
+
type: "thinking",
|
|
1788
|
+
text: reasoning
|
|
1789
|
+
}
|
|
1790
|
+
} : {},
|
|
1791
|
+
toolCalls
|
|
1792
|
+
},
|
|
1793
|
+
finishReason,
|
|
1794
|
+
// A content filter stopped the reply; the API says nothing more.
|
|
1795
|
+
...finishReason === "content_filter" ? { refusal: {} } : {},
|
|
1796
|
+
usage
|
|
1797
|
+
};
|
|
1798
|
+
} catch (parseErr) {
|
|
1799
|
+
if (isProviderRequestError(parseErr))
|
|
1800
|
+
throw parseErr;
|
|
1801
|
+
throw new ProviderRequestError({
|
|
1802
|
+
kind: "server",
|
|
1803
|
+
providerId: "openai",
|
|
1804
|
+
detail: "the provider stream returned malformed data"
|
|
1805
|
+
});
|
|
1644
1806
|
}
|
|
1645
1807
|
}
|
|
1646
1808
|
if (!finished) {
|
|
1647
1809
|
throw new ProviderRequestError({
|
|
1648
1810
|
kind: "network",
|
|
1649
|
-
providerId:
|
|
1811
|
+
providerId: "openai",
|
|
1650
1812
|
detail: "the connection closed before the response finished"
|
|
1651
1813
|
});
|
|
1652
1814
|
}
|
|
1653
|
-
} catch (
|
|
1654
|
-
if (isCallerAbortError(
|
|
1655
|
-
throw params.signal?.reason ??
|
|
1656
|
-
if (isProviderRequestError(
|
|
1657
|
-
throw
|
|
1658
|
-
throw providerVendorError({ providerId:
|
|
1815
|
+
} catch (err) {
|
|
1816
|
+
if (isCallerAbortError(err, params.signal))
|
|
1817
|
+
throw params.signal?.reason ?? err;
|
|
1818
|
+
if (isProviderRequestError(err))
|
|
1819
|
+
throw err;
|
|
1820
|
+
throw providerVendorError({ providerId: "openai", error: err });
|
|
1659
1821
|
}
|
|
1660
1822
|
}
|
|
1661
|
-
|
|
1823
|
+
/**
|
|
1824
|
+
* Declared even though this driver's listing already fails correctly on a
|
|
1825
|
+
* bad key. The check is a declared capability rather than something inferred
|
|
1826
|
+
* from whether a menu happened to throw, so a driver that answers the
|
|
1827
|
+
* question has to say so — otherwise it is reported unverifiable, which is
|
|
1828
|
+
* the honest default and would be a regression here.
|
|
1829
|
+
*/
|
|
1830
|
+
async probeCredential(signal) {
|
|
1662
1831
|
signal?.throwIfAborted();
|
|
1663
|
-
|
|
1664
|
-
signal
|
|
1665
|
-
});
|
|
1832
|
+
await this.client.models.list(signal ? { signal } : void 0);
|
|
1666
1833
|
signal?.throwIfAborted();
|
|
1667
|
-
const profiles = /* @__PURE__ */ new Map();
|
|
1668
|
-
const tiersBySlug = /* @__PURE__ */ new Map();
|
|
1669
|
-
const windows = /* @__PURE__ */ new Map();
|
|
1670
|
-
const compactLimits = /* @__PURE__ */ new Map();
|
|
1671
|
-
const models = (Array.isArray(response.models) ? response.models : []).flatMap((value) => {
|
|
1672
|
-
const item = record(value);
|
|
1673
|
-
if (typeof item?.slug !== "string" || item.slug.length === 0)
|
|
1674
|
-
return [];
|
|
1675
|
-
if (item.visibility === "hide" || item.visibility === "hidden")
|
|
1676
|
-
return [];
|
|
1677
|
-
const profile = subscriptionReasoningProfile(item);
|
|
1678
|
-
if (profile)
|
|
1679
|
-
profiles.set(item.slug.toLowerCase(), profile);
|
|
1680
|
-
const speedTiers = subscriptionSpeedTiers(item);
|
|
1681
|
-
tiersBySlug.set(item.slug.toLowerCase(), speedTiers);
|
|
1682
|
-
const { contextWindow, autoCompactTokenLimit } = subscriptionLimits(item);
|
|
1683
|
-
if (contextWindow !== void 0)
|
|
1684
|
-
windows.set(item.slug.toLowerCase(), contextWindow);
|
|
1685
|
-
if (autoCompactTokenLimit !== void 0)
|
|
1686
|
-
compactLimits.set(item.slug.toLowerCase(), autoCompactTokenLimit);
|
|
1687
|
-
return [
|
|
1688
|
-
{
|
|
1689
|
-
id: item.slug,
|
|
1690
|
-
name: typeof item.display_name === "string" ? item.display_name : item.slug,
|
|
1691
|
-
supportsToolUse: true,
|
|
1692
|
-
supportsStreaming: true,
|
|
1693
|
-
...profile ? { reasoningEffortLevels: profile.levels } : {},
|
|
1694
|
-
...profile?.default !== void 0 ? { reasoningEffortDefault: profile.default } : {},
|
|
1695
|
-
speedTiers,
|
|
1696
|
-
...contextWindow !== void 0 ? { contextWindow } : {},
|
|
1697
|
-
...autoCompactTokenLimit !== void 0 ? { autoCompactTokenLimit } : {}
|
|
1698
|
-
}
|
|
1699
|
-
];
|
|
1700
|
-
});
|
|
1701
|
-
this.reasoningProfiles = profiles;
|
|
1702
|
-
this.speedTiers = tiersBySlug;
|
|
1703
|
-
this.windows = windows;
|
|
1704
|
-
this.compactLimits = compactLimits;
|
|
1705
|
-
listingByAccount.set(this.listingKey, {
|
|
1706
|
-
speedTiers: tiersBySlug,
|
|
1707
|
-
reasoningProfiles: profiles,
|
|
1708
|
-
windows,
|
|
1709
|
-
compactLimits
|
|
1710
|
-
});
|
|
1711
|
-
return models;
|
|
1712
1834
|
}
|
|
1713
|
-
async
|
|
1714
|
-
|
|
1835
|
+
async listModels(signal) {
|
|
1836
|
+
signal?.throwIfAborted();
|
|
1837
|
+
const page = await this.client.models.list(signal ? { signal } : void 0);
|
|
1838
|
+
signal?.throwIfAborted();
|
|
1839
|
+
const rows = this.compatibleHost ? page.data : chatModelsOnly(page.data);
|
|
1840
|
+
return rows.map((m) => ({
|
|
1841
|
+
id: m.id,
|
|
1842
|
+
name: m.id,
|
|
1843
|
+
supportsToolUse: true,
|
|
1844
|
+
supportsStreaming: true,
|
|
1845
|
+
...compatibleModelMetadata(m)
|
|
1846
|
+
}));
|
|
1715
1847
|
}
|
|
1716
1848
|
async healthCheck() {
|
|
1717
1849
|
try {
|
|
1718
|
-
await this.
|
|
1850
|
+
await this.client.models.list();
|
|
1719
1851
|
return true;
|
|
1720
1852
|
} catch {
|
|
1721
1853
|
return false;
|
|
1722
1854
|
}
|
|
1723
1855
|
}
|
|
1724
1856
|
};
|
|
1725
|
-
function webSearchDetail(item) {
|
|
1726
|
-
const action = item.action;
|
|
1727
|
-
if (!action || typeof action !== "object")
|
|
1728
|
-
return {};
|
|
1729
|
-
const queries = Array.isArray(action.queries) ? action.queries.filter((q) => typeof q === "string" && q.trim().length > 0) : [];
|
|
1730
|
-
const query = typeof action.query === "string" && action.query.trim().length > 0 ? action.query.trim() : queries[0]?.trim();
|
|
1731
|
-
const url = typeof action.url === "string" && action.url.length > 0 ? action.url : void 0;
|
|
1732
|
-
return {
|
|
1733
|
-
...query ? { query } : {},
|
|
1734
|
-
...url && !query ? { url } : {},
|
|
1735
|
-
...Array.isArray(action.sources) ? { results: action.sources.length } : {},
|
|
1736
|
-
// One hosted item may run several queries; the count says so, the label names the first.
|
|
1737
|
-
...queries.length > 1 ? { searches: queries.length } : {}
|
|
1738
|
-
};
|
|
1739
|
-
}
|
|
1740
|
-
__name(webSearchDetail, "webSearchDetail");
|
|
1741
1857
|
|
|
1742
1858
|
// ../providers/openai/dist/index.js
|
|
1743
1859
|
function registerCodex(options) {
|
|
@@ -1756,9 +1872,6 @@ export {
|
|
|
1756
1872
|
supportsFastMode,
|
|
1757
1873
|
isFirstPartyOpenAIEndpoint,
|
|
1758
1874
|
servedSpeed,
|
|
1759
|
-
OPENAI_CAPABILITIES,
|
|
1760
|
-
openAIReasoningEffortLevels,
|
|
1761
|
-
OpenAIProvider,
|
|
1762
1875
|
CODEX_IMAGE_MODEL,
|
|
1763
1876
|
CODEX_DEFAULT_BASE_URL,
|
|
1764
1877
|
CODEX_IMAGE_TIMEOUT_MS,
|
|
@@ -1769,7 +1882,10 @@ export {
|
|
|
1769
1882
|
requestCodexImage,
|
|
1770
1883
|
CODEX_CAPABILITIES,
|
|
1771
1884
|
CodexProvider,
|
|
1885
|
+
OPENAI_CAPABILITIES,
|
|
1886
|
+
openAIReasoningEffortLevels,
|
|
1887
|
+
OpenAIProvider,
|
|
1772
1888
|
registerCodex,
|
|
1773
1889
|
registerOpenAI
|
|
1774
1890
|
};
|
|
1775
|
-
//# sourceMappingURL=chunk-
|
|
1891
|
+
//# sourceMappingURL=chunk-V2DQFFLG.js.map
|