0sec-cli 0.24.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/0.js +67 -62
  2. package/README.md +121 -82
  3. package/chunks/{adapt-loop-L77BWMNE.js → adapt-loop-P4HKONB5.js} +6 -5
  4. package/chunks/{artifact-scraper-BV67RAP5.js → artifact-scraper-IIRJNYKT.js} +4 -3
  5. package/chunks/{assumption-mining-RPVR77A3.js → assumption-mining-YA6VJ2V6.js} +22 -20
  6. package/chunks/{backend-connections-ACIXNYZN.js → backend-connections-64PKYKL7.js} +5 -4
  7. package/chunks/chunk-36J5ZLFE.js +18729 -0
  8. package/chunks/{chunk-ZM6ANQZJ.js → chunk-3MWQNNJU.js} +16180 -34467
  9. package/chunks/{chunk-GV5WXDHY.js → chunk-3VQ5EZKG.js} +11 -9
  10. package/chunks/chunk-5XOYTAOK.js +1546 -0
  11. package/chunks/{chunk-UJE4WOQS.js → chunk-6GV5G6U3.js} +1 -1
  12. package/chunks/{chunk-X2ZMSRTP.js → chunk-6SNOKNCS.js} +333 -3
  13. package/chunks/{chunk-BMDG6T7D.js → chunk-72PU46MS.js} +178 -133
  14. package/chunks/{chunk-KCA35IL3.js → chunk-7PUJI64A.js} +11 -9
  15. package/chunks/chunk-A7G6S5RA.js +90 -0
  16. package/chunks/chunk-ABKUI3QB.js +196 -0
  17. package/chunks/{chunk-5ETI27Q3.js → chunk-AFJ2UMPR.js} +3 -3
  18. package/chunks/{chunk-XA2IBHPB.js → chunk-B7XL6RON.js} +1 -1
  19. package/chunks/{chunk-TVS6WVSK.js → chunk-BM6EYP2D.js} +3 -3
  20. package/chunks/{chunk-7UHAXEOV.js → chunk-D4M5WURF.js} +226 -4
  21. package/chunks/{chunk-K74DRDC5.js → chunk-EHNVP6QB.js} +1 -1
  22. package/chunks/{chunk-I43YYHDU.js → chunk-FBZBJYZS.js} +5 -50
  23. package/chunks/{chunk-GXXX7AGH.js → chunk-GYEYTNHK.js} +144 -14
  24. package/chunks/{chunk-IJ6UPW3H.js → chunk-HS2NQ7K6.js} +393 -58
  25. package/chunks/chunk-HUZ2EC2R.js +196 -0
  26. package/chunks/{chunk-SU4IHQQI.js → chunk-IUUNIJPM.js} +1 -1
  27. package/chunks/chunk-JGDA6EIJ.js +49 -0
  28. package/chunks/{chunk-CJRZSWII.js → chunk-K3PTYN43.js} +3 -3
  29. package/chunks/{chunk-2NBZZFRG.js → chunk-KCABBZHN.js} +8 -10
  30. package/chunks/{chunk-3LPBJMHB.js → chunk-LRD5N2TQ.js} +1 -1
  31. package/chunks/{chunk-SQCBHFWN.js → chunk-LWMEJYCP.js} +2 -2
  32. package/chunks/chunk-MNK373HF.js +57 -0
  33. package/chunks/{chunk-R2XBH476.js → chunk-MOEVVXML.js} +2 -2
  34. package/chunks/{chunk-F2P25DJY.js → chunk-MOGWEHSC.js} +1448 -1050
  35. package/chunks/{chunk-6XMFCVJS.js → chunk-N7YCONYR.js} +1 -1
  36. package/chunks/{chunk-3WUPCZGF.js → chunk-NA3FKCI2.js} +1 -1
  37. package/chunks/{chunk-S2GITRD5.js → chunk-NABVDAAO.js} +2 -2
  38. package/chunks/{chunk-SZDD77KX.js → chunk-NNMOTHKC.js} +6 -10
  39. package/chunks/{chunk-LMP2T4G2.js → chunk-OILVEROI.js} +22 -172
  40. package/chunks/{chunk-YERUDEXT.js → chunk-PAE7ZAV6.js} +2780 -1255
  41. package/chunks/{chunk-NBV4I237.js → chunk-PAMJEXE2.js} +1 -1
  42. package/chunks/{chunk-PJU24AKR.js → chunk-R7VWEY45.js} +337 -257
  43. package/chunks/{chunk-QNRYOJEB.js → chunk-RZZ6VPRY.js} +1 -1
  44. package/chunks/{chunk-WUPN3D37.js → chunk-S4DFH2FJ.js} +26 -1
  45. package/chunks/{chunk-5WAHHZBF.js → chunk-SIR7XW2S.js} +61910 -30777
  46. package/chunks/{chunk-BD7WULFS.js → chunk-SSPP64FF.js} +3 -2
  47. package/chunks/{chunk-BOBIAHKA.js → chunk-STPHTPSD.js} +3 -333
  48. package/chunks/{chunk-Q7JKIKKF.js → chunk-UGCTPKJG.js} +89 -17
  49. package/chunks/{chunk-5PFRE522.js → chunk-ULRLUXSS.js} +1 -1
  50. package/chunks/{chunk-GZA7RGK7.js → chunk-UQS7XCBV.js} +2085 -1093
  51. package/chunks/{chunk-X2IPO5JO.js → chunk-V2KJQVYE.js} +2676 -2959
  52. package/chunks/{chunk-CGBDEST2.js → chunk-VJBEB2K6.js} +1 -1
  53. package/chunks/{chunk-ILRMLA6J.js → chunk-VWE36MUN.js} +1 -1
  54. package/chunks/{chunk-RURJYCWY.js → chunk-WNWDQ2TO.js} +1 -1
  55. package/chunks/{chunk-GTED3FSZ.js → chunk-WPJMA5AK.js} +4 -99
  56. package/chunks/{chunk-5NFIY2SJ.js → chunk-XJ2TBEV7.js} +3 -3
  57. package/chunks/{chunk-PVJUPIQG.js → chunk-XOVYV7TT.js} +6 -6
  58. package/chunks/{chunk-IXT64DV5.js → chunk-XPDJE537.js} +97 -1
  59. package/chunks/{chunk-YKWARO3T.js → chunk-YGYJ2FTH.js} +95 -21
  60. package/chunks/{chunk-JWSOUKFF.js → chunk-YJGPPPUB.js} +66 -21
  61. package/chunks/chunk-YP2DHYNI.js +650 -0
  62. package/chunks/{chunk-RVJVM5L4.js → chunk-Z2VLJEQJ.js} +5 -5
  63. package/chunks/chunk-ZPVSDB63.js +3839 -0
  64. package/chunks/{codex-models-6XVNFRXZ.js → codex-models-CI22KIHY.js} +9 -8
  65. package/chunks/{commands-FRPOFIO4.js → commands-C2WRSCNB.js} +909 -610
  66. package/chunks/dashboard-XO2X2SPD.js +75 -0
  67. package/chunks/{db-BXJNWUYJ.js → db-FU3OIGQK.js} +5 -4
  68. package/chunks/{deep-review-GSJEBLCG.js → deep-review-5AL6QYTK.js} +37 -38
  69. package/chunks/{disclose-OU6Z6GVT.js → disclose-YPV5KIUU.js} +6 -5
  70. package/chunks/{dist-M2X367VW.js → dist-JAZWL3SC.js} +3 -2
  71. package/chunks/{dist-TQMHMSBZ.js → dist-ONIRKDH6.js} +376 -333
  72. package/chunks/{dist-RKLQIXDT.js → dist-QLMPTFT7.js} +4 -3
  73. package/chunks/{dist-7KSYDDSG.js → dist-QXJKD743.js} +5 -2
  74. package/chunks/{dist-LNXGATR2.js → dist-WNAOCQGA.js} +5 -4
  75. package/chunks/eval-runner-D3RUCU3R.js +38 -0
  76. package/chunks/{exploit-agent-Y2P4GFIY.js → exploit-agent-4E4HXKUA.js} +1 -1
  77. package/chunks/{exploit-autoclimb-YRZ3TMS2.js → exploit-autoclimb-5GRXI6VQ.js} +1 -1
  78. package/chunks/{exploit-climb-4LEY4SDW.js → exploit-climb-AHQEJ2I2.js} +4 -3
  79. package/chunks/{fix-RQSIG75B.js → fix-CHD7LXDS.js} +9 -8
  80. package/chunks/{harness-3NVC3DDY.js → harness-E63KDHPG.js} +5 -4
  81. package/chunks/{http-conformance-U5F6GKYG.js → http-conformance-AXMUOE6C.js} +3 -2
  82. package/chunks/hunt-scan-ME2Z4CTC.js +43 -0
  83. package/chunks/{kernel-primitive-T47V3RD3.js → kernel-primitive-S566GXWP.js} +4 -3
  84. package/chunks/{kernel-vm-runner-AEL5E3SV.js → kernel-vm-runner-KREBY4DC.js} +4 -3
  85. package/chunks/{local-engine-ZCW4YC6E.js → local-engine-ZRTZVSSX.js} +7 -6
  86. package/chunks/managed-operation-ZMLLRCCQ.js +59 -0
  87. package/chunks/{memsafety-scan-L2Z7E7TE.js → memsafety-scan-Q2MBZEGJ.js} +1 -2
  88. package/chunks/{native-loop-26X2CHBV.js → native-loop-UV3Z4Z2F.js} +31 -16
  89. package/chunks/operator-services-JOCREEBA.js +79 -0
  90. package/chunks/orchestrate-ZF6ZTSIQ.js +62 -0
  91. package/chunks/{prepare-C3KGMBXT.js → prepare-PLDVGLDX.js} +7 -6
  92. package/chunks/{provider-model-discovery-QGUGL3XW.js → provider-model-discovery-3X6DON3Y.js} +7 -2
  93. package/chunks/{remote-workflow-runtime-DB52SINR.js → remote-workflow-runtime-GOI4TYP5.js} +4 -3
  94. package/chunks/routing-WCQLO5SP.js +61 -0
  95. package/chunks/{runtime-AUBLQUOH.js → runtime-6ZIXFTW5.js} +4 -3
  96. package/chunks/{runtime-U66JNSAY.js → runtime-TVH5ORUK.js} +13 -8
  97. package/chunks/{scan-stream-34F3LTPV.js → scan-stream-HJVTWZ44.js} +6 -4
  98. package/chunks/{scope-HSTG63TQ.js → scope-RCYXVGJR.js} +4 -3
  99. package/chunks/service-plugins-TN6KDX4L.js +63 -0
  100. package/chunks/{session-store-MKAAP3WL.js → session-store-6QR3CVUA.js} +8 -5
  101. package/chunks/{variant-candidates-LG767HWH.js → variant-candidates-SGLKPPHI.js} +9 -8
  102. package/chunks/{web-recon-prepass-NJP6J3E4.js → web-recon-prepass-GO7CTMVQ.js} +7 -6
  103. package/chunks/{workflow-runtime-AR627I26.js → workflow-runtime-CQTDASFA.js} +50 -49
  104. package/dashboard/assets/{abnfDiagram-VCTEODGH-Cq149Jpk.js → abnfDiagram-VCTEODGH-DDZsU70-.js} +1 -1
  105. package/dashboard/assets/{arc-CpP-3TRW.js → arc-iDXNTSL6.js} +1 -1
  106. package/dashboard/assets/architecture-7GRP2DOG-DJcY9RFg.js +1 -0
  107. package/dashboard/assets/architectureDiagram-5GKGNRK7-d0ZuOniQ.js +36 -0
  108. package/dashboard/assets/{blockDiagram-I7D4REHJ-CZYkRRDi.js → blockDiagram-I7D4REHJ-B-EWfMy1.js} +2 -2
  109. package/dashboard/assets/{c4Diagram-7LVT6UL2-CV7Iu3_Z.js → c4Diagram-7LVT6UL2-KcZRuXZC.js} +1 -1
  110. package/dashboard/assets/channel-CeWMIm0w.js +1 -0
  111. package/dashboard/assets/{chunk-4HAMMTFA-PKCyW4m-.js → chunk-4HAMMTFA-DXWulBlo.js} +1 -1
  112. package/dashboard/assets/{chunk-75Z2AOVW-C5MlFTc_.js → chunk-75Z2AOVW-RiLZItrz.js} +1 -1
  113. package/dashboard/assets/chunk-DU6HZSFF-MBcaIyTX.js +127 -0
  114. package/dashboard/assets/{chunk-F27PBJKO-DTAok0qM.js → chunk-F27PBJKO-kLWCBX_W.js} +1 -1
  115. package/dashboard/assets/{chunk-FOHPRMQF-DHwB1DNv.js → chunk-FOHPRMQF-COOliuUh.js} +14 -14
  116. package/dashboard/assets/{chunk-GMAD6QVW-CPsr2F33.js → chunk-GMAD6QVW-BeQeSjpW.js} +7 -7
  117. package/dashboard/assets/{chunk-GVQU2GXP-C2AXGf9A.js → chunk-GVQU2GXP-CjCMlOIB.js} +1 -1
  118. package/dashboard/assets/{chunk-IMKFNOWR-DMG6yD_O.js → chunk-IMKFNOWR-BwNst53D.js} +1 -1
  119. package/dashboard/assets/{chunk-L3NEJ4N5-BSvwdbXx.js → chunk-L3NEJ4N5-CHXWQrkL.js} +1 -1
  120. package/dashboard/assets/{chunk-OSK3NFVY-CfB8V7FU.js → chunk-OSK3NFVY-B2vd19Ed.js} +1 -1
  121. package/dashboard/assets/{chunk-P2QGCYS3-CvmZvq6n.js → chunk-P2QGCYS3-Dk7Fyh6n.js} +1 -1
  122. package/dashboard/assets/{chunk-POPQ4Y6H-D_TvwDxL.js → chunk-POPQ4Y6H-CPAgOvYe.js} +1 -1
  123. package/dashboard/assets/{chunk-PWAF6VOD-Da5GnuOY.js → chunk-PWAF6VOD-BotyfMha.js} +1 -1
  124. package/dashboard/assets/{chunk-SHT3W25Y-CcsMJpR-.js → chunk-SHT3W25Y-Buz5gLRP.js} +1 -1
  125. package/dashboard/assets/{chunk-SVP7TREG-COojjieJ.js → chunk-SVP7TREG-_rpYEZcs.js} +1 -1
  126. package/dashboard/assets/{chunk-TICWLB2K-nBAmJwx6.js → chunk-TICWLB2K-DOJxPoec.js} +2 -2
  127. package/dashboard/assets/{chunk-XXDRQBXY-r5HyhWDv.js → chunk-XXDRQBXY-EXxKJbAs.js} +1 -1
  128. package/dashboard/assets/classDiagram-ZZMXUADV-DV_h1NoS.js +1 -0
  129. package/dashboard/assets/classDiagram-v2-VYDZK3BY-DV_h1NoS.js +1 -0
  130. package/dashboard/assets/common-VLJRx-Jq.js +5 -0
  131. package/dashboard/assets/cose-bilkent-JH36ORCC-B1SVC57o.js +1 -0
  132. package/dashboard/assets/cynefin-OW5HDTMX-BzhRorj4.js +1 -0
  133. package/dashboard/assets/{cynefinDiagram-5FMLGOSQ-xodkuQtW.js → cynefinDiagram-5FMLGOSQ-JXzRmldX.js} +1 -1
  134. package/dashboard/assets/cytoscape.esm-BbBREfsg.js +321 -0
  135. package/dashboard/assets/dagre-D7JM2Yhv.js +1 -0
  136. package/dashboard/assets/dagre-GXQ25YYZ-1LZ-X0-Z.js +4 -0
  137. package/dashboard/assets/{diagram-S7CK7UJ4-DNoTMlCO.js → diagram-S7CK7UJ4-C_-J_LQ4.js} +2 -2
  138. package/dashboard/assets/{diagram-UQ7AKVKN-COccuyew.js → diagram-UQ7AKVKN-CnxL1k8g.js} +1 -1
  139. package/dashboard/assets/{diagram-VSXAHHWV-g6D1tWRb.js → diagram-VSXAHHWV-WzSb3aby.js} +1 -1
  140. package/dashboard/assets/{diagram-VX7I27RA-DhO4eVIC.js → diagram-VX7I27RA-DKhrMInE.js} +1 -1
  141. package/dashboard/assets/{diagram-Z3DM3KII-DeOQFexd.js → diagram-Z3DM3KII-CDhI2WGP.js} +1 -1
  142. package/dashboard/assets/{dist-BQYeOQg3.js → dist-B0bfBMeP.js} +1 -1
  143. package/dashboard/assets/{ebnfDiagram-PWID7BFC-MtkX2feM.js → ebnfDiagram-PWID7BFC-iL5NQ1PE.js} +1 -1
  144. package/dashboard/assets/{erDiagram-RLTQ6QDP-DIWSsoYZ.js → erDiagram-RLTQ6QDP-RK2Voa5O.js} +1 -1
  145. package/dashboard/assets/eventmodeling-NTZA5JFV-WgE7OJBb.js +1 -0
  146. package/dashboard/assets/flowDiagram-HODETNUW-B9YcQ0Aq.js +1 -0
  147. package/dashboard/assets/{ganttDiagram-EL5Y4UJY-DKggkJe0.js → ganttDiagram-EL5Y4UJY-D8CJXHRF.js} +1 -1
  148. package/dashboard/assets/gitGraph-4MIJSDKK-BuZ9Lg04.js +1 -0
  149. package/dashboard/assets/{gitGraphDiagram-WWUBYQGX-r_iR8Qzo.js → gitGraphDiagram-WWUBYQGX-LEJMh54j.js} +1 -1
  150. package/dashboard/assets/info-A6RAGUB7-BL5k3pev.js +1 -0
  151. package/dashboard/assets/{infoDiagram-27XIBGKW-ClQk7UyQ.js → infoDiagram-27XIBGKW-LJvntUnZ.js} +1 -1
  152. package/dashboard/assets/{ishikawaDiagram-5VMMS53U-tR7Vziog.js → ishikawaDiagram-5VMMS53U-BYTYgKCG.js} +2 -2
  153. package/dashboard/assets/{journeyDiagram-3NMN7TZE-Cpb9IqKL.js → journeyDiagram-3NMN7TZE-G25qgQgO.js} +1 -1
  154. package/dashboard/assets/{kanban-definition-UXKFOSKX-BzUuKbA9.js → kanban-definition-UXKFOSKX-Bk3uLl1i.js} +1 -1
  155. package/dashboard/assets/{katex-BdBmVSus.js → katex-nLxf_RlZ.js} +2 -2
  156. package/dashboard/assets/{line-BHY_tSHu.js → line-i4qHBaWO.js} +1 -1
  157. package/dashboard/assets/linear-DmrqRsKG.js +1 -0
  158. package/dashboard/assets/mermaid-parser.core-BxbKr4QF.js +7 -0
  159. package/dashboard/assets/{mermaid.core-D_QsUPU8.js → mermaid.core-Cltee6FS.js} +9 -9
  160. package/dashboard/assets/{mindmap-definition-YA3MSWOX-CtfLTPPJ.js → mindmap-definition-YA3MSWOX-DkzO2JgS.js} +1 -1
  161. package/dashboard/assets/operations-B4_timQX.css +1 -0
  162. package/dashboard/assets/operations-DwppJviL.js +199 -0
  163. package/dashboard/assets/packet-AYTQ26CC-uZQUKnrE.js +1 -0
  164. package/dashboard/assets/{pegDiagram-XKGWAZYB-C1Dclbzj.js → pegDiagram-XKGWAZYB-CrOEi00T.js} +1 -1
  165. package/dashboard/assets/pie-WAS4IAKB-Dn9_tpQT.js +1 -0
  166. package/dashboard/assets/{pieDiagram-E7YTZNPT-Cd7XwYo5.js → pieDiagram-E7YTZNPT-D-niUkzc.js} +1 -1
  167. package/dashboard/assets/{quadrantDiagram-AXDQQJYC-CaS-GQ4X.js → quadrantDiagram-AXDQQJYC-CJOTiG5V.js} +1 -1
  168. package/dashboard/assets/radar-RG4KPBEZ-DIIVz4e8.js +1 -0
  169. package/dashboard/assets/railroad-74A4TZTK-1kiqDEID.js +1 -0
  170. package/dashboard/assets/railroad-abnf-HS5TGJTU-DK6rQPZR.js +1 -0
  171. package/dashboard/assets/railroad-ebnf-LZEXJU2U-C6cOgYW4.js +1 -0
  172. package/dashboard/assets/railroad-peg-WCYAUIDC-CQ3ptKef.js +1 -0
  173. package/dashboard/assets/{railroadDiagram-O6MQD6OU-BeesTrqn.js → railroadDiagram-O6MQD6OU-nEfkpa-m.js} +1 -1
  174. package/dashboard/assets/{requirementDiagram-BXWQKSXE-IjyK0DhW.js → requirementDiagram-BXWQKSXE-CdFMY8tG.js} +1 -1
  175. package/dashboard/assets/{sankeyDiagram-P5KCCOFB-DmIluQqo.js → sankeyDiagram-P5KCCOFB-C0KxrFYv.js} +1 -1
  176. package/dashboard/assets/{sequenceDiagram-WJ2MYXX4-CUp8ZjTc.js → sequenceDiagram-WJ2MYXX4-DeZ5ATiu.js} +2 -2
  177. package/dashboard/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
  178. package/dashboard/assets/src-Cg-chcoE.js +1 -0
  179. package/dashboard/assets/{stateDiagram-D77RDMKH-Dy9TQb8P.js → stateDiagram-D77RDMKH-B9MwWL5B.js} +1 -1
  180. package/dashboard/assets/stateDiagram-v2-MP3YSRHH-SucFndhx.js +1 -0
  181. package/dashboard/assets/swimlanes-42K2YHIH-DB--fwQE.js +1 -0
  182. package/dashboard/assets/swimlanesDiagram-VR7AAH4N-BzH-rIaK.js +8 -0
  183. package/dashboard/assets/{timeline-definition-24CTP7MA-BGdXW-iY.js → timeline-definition-24CTP7MA-DLkkTbWb.js} +1 -1
  184. package/dashboard/assets/treeView-Q6P3EWNA-XkZ9rl9H.js +1 -0
  185. package/dashboard/assets/treemap-WGGIJYW6-JCtVKxCE.js +1 -0
  186. package/dashboard/assets/{vennDiagram-4TSXK5OY-DzKWHJsl.js → vennDiagram-4TSXK5OY-DEb-x29Z.js} +1 -1
  187. package/dashboard/assets/wardley-WFR3VGLG-DhI7ROY3.js +1 -0
  188. package/dashboard/assets/{wardleyDiagram-VM6X3IG4-DGsjYmNJ.js → wardleyDiagram-VM6X3IG4-KNckudc5.js} +1 -1
  189. package/dashboard/assets/{xychartDiagram-S5SC5T6Z-C7_T_tWt.js → xychartDiagram-S5SC5T6Z-D4c0ynCk.js} +1 -1
  190. package/dashboard/index.html +13 -2
  191. package/package.json +2 -5
  192. package/worker-assets/demo-target/README.md +7 -3
  193. package/chunks/chunk-2XGBEH53.js +0 -4304
  194. package/chunks/chunk-4ROZFLSR.js +0 -279
  195. package/chunks/chunk-56UTQKXO.js +0 -56
  196. package/chunks/chunk-BPU6M42R.js +0 -77
  197. package/chunks/chunk-H5QURBBK.js +0 -1123
  198. package/chunks/chunk-IIBNQTOK.js +0 -1532
  199. package/chunks/chunk-NJLKFC66.js +0 -4790
  200. package/chunks/chunk-OOMBOLAF.js +0 -295
  201. package/chunks/chunk-VIT5ALXF.js +0 -4054
  202. package/chunks/chunk-VU7V2SDW.js +0 -284
  203. package/chunks/chunk-W624J7NF.js +0 -117
  204. package/chunks/chunk-YSQWZ67M.js +0 -6027
  205. package/chunks/dashboard-5HDSNBAU.js +0 -76
  206. package/chunks/eval-runner-A2DIGVP7.js +0 -31
  207. package/chunks/hunt-scan-W246VWJC.js +0 -40
  208. package/chunks/managed-operation-6R2QPPW5.js +0 -60
  209. package/chunks/orchestrate-OBS37FWQ.js +0 -63
  210. package/chunks/run-MU3MFL2Z.js +0 -28242
  211. package/chunks/service-plugins-5B23PWXC.js +0 -64
  212. package/dashboard/assets/architecture-7GRP2DOG-z5EHYkyH.js +0 -1
  213. package/dashboard/assets/architectureDiagram-5GKGNRK7-ewtXpjR_.js +0 -36
  214. package/dashboard/assets/channel-CuYjfiC5.js +0 -1
  215. package/dashboard/assets/chunk-DU6HZSFF-3M37ulcO.js +0 -127
  216. package/dashboard/assets/classDiagram-ZZMXUADV-DCuOrWUV.js +0 -1
  217. package/dashboard/assets/classDiagram-v2-VYDZK3BY-DCuOrWUV.js +0 -1
  218. package/dashboard/assets/common-C6snVPsk.js +0 -5
  219. package/dashboard/assets/cose-bilkent-JH36ORCC-BLGcaZHk.js +0 -1
  220. package/dashboard/assets/cynefin-OW5HDTMX-DbZMK00I.js +0 -1
  221. package/dashboard/assets/cytoscape.esm-CGd-uY3x.js +0 -321
  222. package/dashboard/assets/dagre-GXQ25YYZ-CRk9qfSG.js +0 -4
  223. package/dashboard/assets/dagre-PrKaheQc.js +0 -1
  224. package/dashboard/assets/eventmodeling-NTZA5JFV-D_3ez4Gv.js +0 -1
  225. package/dashboard/assets/flowDiagram-HODETNUW-D2boyYEd.js +0 -1
  226. package/dashboard/assets/gitGraph-4MIJSDKK-DFOQYwXc.js +0 -1
  227. package/dashboard/assets/info-A6RAGUB7-DeednLoB.js +0 -1
  228. package/dashboard/assets/linear-naZZ1pHk.js +0 -1
  229. package/dashboard/assets/mermaid-parser.core-CPvd4cEx.js +0 -7
  230. package/dashboard/assets/operations-BwCzhVnT.js +0 -130
  231. package/dashboard/assets/operations-QjKT0Hwi.css +0 -1
  232. package/dashboard/assets/packet-AYTQ26CC-DDQbkT9I.js +0 -1
  233. package/dashboard/assets/pie-WAS4IAKB-LpU4ULAs.js +0 -1
  234. package/dashboard/assets/radar-RG4KPBEZ-CcxW3NJm.js +0 -1
  235. package/dashboard/assets/railroad-74A4TZTK-9P5Rl8fP.js +0 -1
  236. package/dashboard/assets/railroad-abnf-HS5TGJTU-CSfpwjna.js +0 -1
  237. package/dashboard/assets/railroad-ebnf-LZEXJU2U-D6R5qzr-.js +0 -1
  238. package/dashboard/assets/railroad-peg-WCYAUIDC-DKEX7ITG.js +0 -1
  239. package/dashboard/assets/sizeCapture-INFHLROL-B0uUizjq.js +0 -1
  240. package/dashboard/assets/src-r61wDjcA.js +0 -1
  241. package/dashboard/assets/stateDiagram-v2-MP3YSRHH-CQb0ZtPr.js +0 -1
  242. package/dashboard/assets/swimlanes-42K2YHIH-CZuDV7V5.js +0 -1
  243. package/dashboard/assets/swimlanesDiagram-VR7AAH4N-BxgWMq8X.js +0 -8
  244. package/dashboard/assets/treeView-Q6P3EWNA-DlRrayjM.js +0 -1
  245. package/dashboard/assets/treemap-WGGIJYW6-C6UqLKfI.js +0 -1
  246. package/dashboard/assets/wardley-WFR3VGLG-thmyHKb0.js +0 -1
@@ -3,7 +3,7 @@ import { createRequire as __0CreateRequire } from "node:module";
3
3
  const require = __0CreateRequire(import.meta.url);
4
4
  import {
5
5
  isAdmittedSmolvmWorkbench
6
- } from "./chunk-PVJUPIQG.js";
6
+ } from "./chunk-XOVYV7TT.js";
7
7
  import {
8
8
  MESSAGE_CACHE_BREAKPOINTS,
9
9
  planMessageBreakpoints,
@@ -13,7 +13,80 @@ import {
13
13
  } from "./chunk-RS4MAN3Q.js";
14
14
  import {
15
15
  VERSION
16
- } from "./chunk-GXXX7AGH.js";
16
+ } from "./chunk-GYEYTNHK.js";
17
+
18
+ // packages/core/dist/runtime/siwc-connection.js
19
+ function captureSiwcConnection(connection) {
20
+ if (!connection.accountId || !connection.clientId || connection.clientId === "dynamic_agent_client" || !connection.hostId || typeof connection.resolveCredentials !== "function") {
21
+ throw new Error("ChatGPT plan requires a verified account, issued client ID and stable host ID");
22
+ }
23
+ return Object.freeze({ accountId: connection.accountId, clientId: connection.clientId, hostId: connection.hostId, resolveCredentials: connection.resolveCredentials });
24
+ }
25
+ async function abortable(pending, signal) {
26
+ if (!signal)
27
+ return pending;
28
+ signal.throwIfAborted();
29
+ return new Promise((resolve, reject) => {
30
+ const abort = () => reject(signal.reason ?? new Error("ChatGPT plan request cancelled"));
31
+ signal.addEventListener("abort", abort, { once: true });
32
+ pending.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
33
+ if (signal.aborted)
34
+ abort();
35
+ });
36
+ }
37
+ async function siwcHeaders(connection, signal) {
38
+ signal?.throwIfAborted();
39
+ const credentials = await abortable(connection.resolveCredentials(signal), signal);
40
+ signal?.throwIfAborted();
41
+ if (typeof credentials.accessToken !== "string" || !credentials.accessToken || credentials.accessToken.length > 65536 || /[\s\x00-\x1f\x7f]/.test(credentials.accessToken) || !Array.isArray(credentials.scopes) || !["resource.invoke", "chatgpt.tokens.use.direct"].every((scope) => credentials.scopes.includes(scope))) {
42
+ throw new Error("ChatGPT plan permission is not enabled; authorize plan usage for this account");
43
+ }
44
+ return { Authorization: `Bearer ${credentials.accessToken}`, "Content-Type": "application/json" };
45
+ }
46
+ async function listSiwcModels(connection, fetchImpl = fetch, signal) {
47
+ const response = await fetchImpl("https://api.openai.com/v1/models", { headers: await siwcHeaders(captureSiwcConnection(connection), signal), signal, redirect: "error" });
48
+ if (!response.ok)
49
+ throw new Error(`ChatGPT plan model discovery failed (HTTP ${response.status})`);
50
+ const data = await response.json();
51
+ if (!data || typeof data !== "object" || !("models" in data) || !Array.isArray(data.models))
52
+ throw new Error("Invalid ChatGPT plan model catalog");
53
+ return data.models.filter((model) => !!model && typeof model === "object" && model.visibility === "list" && typeof model.slug === "string" && !!model.slug && typeof model.display_name === "string").map(({ slug, display_name }) => ({ slug, display_name }));
54
+ }
55
+
56
+ // packages/core/dist/runtime/request-admission.js
57
+ var LOCAL_ADMISSION_LIMIT = "LOCAL_REQUEST_ADMISSION_LIMIT:";
58
+ var LOCAL_ADMISSION_UNAVAILABLE = "LOCAL_REQUEST_ADMISSION_UNAVAILABLE:";
59
+ function parseRequestAdmission(catalog, model) {
60
+ const data = catalog?.data;
61
+ const row = Array.isArray(data) ? data.find((r) => r?.id === model) : void 0;
62
+ const c = row?.request_admission;
63
+ const integer = (n) => Number.isSafeInteger(n) && Number(n) >= 0;
64
+ if (!c || c.schema !== "0-inference-request-admission-v1" || c.counting !== "utf8_json_body_plus_framing" || !integer(c.max_body_bytes) || c.max_body_bytes < 1 || !(c.max_serialized_input_bytes === null || integer(c.max_serialized_input_bytes) && c.max_serialized_input_bytes > 0) || !integer(c.framing?.base_bytes) || !integer(c.framing?.per_message_bytes) || !integer(c.framing?.per_tool_bytes)) {
65
+ throw new Error("Gateway request admission contract is missing or invalid; no inference request sent");
66
+ }
67
+ return {
68
+ maxBodyBytes: c.max_body_bytes,
69
+ maxSerializedInputBytes: c.max_serialized_input_bytes,
70
+ baseBytes: c.framing.base_bytes,
71
+ perMessageBytes: c.framing.per_message_bytes,
72
+ perToolBytes: c.framing.per_tool_bytes
73
+ };
74
+ }
75
+ function assertRequestAdmission(body, contract) {
76
+ const value = JSON.parse(body);
77
+ const messages = value.messages ?? value.input;
78
+ const bytes = Buffer.byteLength(body, "utf8");
79
+ const inputBytes = bytes + contract.baseBytes + contract.perMessageBytes * (Array.isArray(messages) ? messages.length : 1) + contract.perToolBytes * (Array.isArray(value.tools) ? value.tools.length : 0);
80
+ if (bytes > contract.maxBodyBytes || contract.maxSerializedInputBytes !== null && inputBytes > contract.maxSerializedInputBytes) {
81
+ throw new Error(`${LOCAL_ADMISSION_LIMIT} body=${bytes}, input=${inputBytes}; exceeds gateway byte limit before dispatch`);
82
+ }
83
+ }
84
+ function isLocalAdmissionLimit(error) {
85
+ return error?.startsWith(LOCAL_ADMISSION_LIMIT) === true;
86
+ }
87
+ function isLocalAdmissionFailure(error) {
88
+ return isLocalAdmissionLimit(error) || error?.startsWith(LOCAL_ADMISSION_UNAVAILABLE) === true;
89
+ }
17
90
 
18
91
  // packages/core/dist/agent/feature-presets.js
19
92
  var FP_MOAT_FLAGS = [
@@ -115,7 +188,7 @@ var features = {
115
188
  },
116
189
  /** Allow the agent to search the web for CVE details, docs, and technique references */
117
190
  get webSearch() {
118
- return env("ZERO_FEATURE_WEB_SEARCH", false);
191
+ return env("ZERO_FEATURE_WEB_SEARCH", true);
119
192
  },
120
193
  /** Interactive PTY sessions for exploits requiring interactivity (reverse shells, DB clients, SSH) */
121
194
  get ptySession() {
@@ -1238,6 +1311,31 @@ function shouldRetryNativeStream(result) {
1238
1311
  return false;
1239
1312
  return true;
1240
1313
  }
1314
+ var RESPONSES_TERMINAL_FAILURE_MARKER = "Responses terminal failure ";
1315
+ function isPolicyRefusalResult(result) {
1316
+ if (result.stopReason !== "error" || result.cancelled)
1317
+ return false;
1318
+ const error = result.error ?? "";
1319
+ const at = error.indexOf(RESPONSES_TERMINAL_FAILURE_MARKER);
1320
+ if (at < 0)
1321
+ return false;
1322
+ try {
1323
+ const failure = JSON.parse(error.slice(at + RESPONSES_TERMINAL_FAILURE_MARKER.length));
1324
+ return typeof failure.code === "string" && failure.code.length > 0 && /_policy$/.test(failure.code);
1325
+ } catch {
1326
+ return false;
1327
+ }
1328
+ }
1329
+ function mergeRuntimeUsage(a, b) {
1330
+ const cached = (a?.cachedInputTokens ?? 0) + (b?.cachedInputTokens ?? 0);
1331
+ const cacheWrites = (a?.cacheWriteTokens ?? 0) + (b?.cacheWriteTokens ?? 0);
1332
+ return {
1333
+ inputTokens: (a?.inputTokens ?? 0) + (b?.inputTokens ?? 0),
1334
+ outputTokens: (a?.outputTokens ?? 0) + (b?.outputTokens ?? 0),
1335
+ ...cached > 0 ? { cachedInputTokens: cached } : {},
1336
+ ...cacheWrites > 0 ? { cacheWriteTokens: cacheWrites } : {}
1337
+ };
1338
+ }
1241
1339
  function isRetryableTransportCode(code) {
1242
1340
  return [
1243
1341
  "EAI_AGAIN",
@@ -1474,6 +1572,9 @@ async function logProviderStartup(provider, providerLabel, baseUrl, model, wireA
1474
1572
  var DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-6";
1475
1573
  var DEFAULT_OPENROUTER_MODEL = "anthropic/claude-sonnet-4.6";
1476
1574
  var FREE_OPENROUTER_MODEL = "nvidia/nemotron-3-super-120b-a12b:free";
1575
+ function openrouterModelId(model) {
1576
+ return model.replace(/^openrouter\//i, "");
1577
+ }
1477
1578
  var DEFAULT_OPENAI_MODEL = "gpt-4o";
1478
1579
  var DEEPSEEK_DEFAULT_BASE_URL = "https://api.deepseek.com";
1479
1580
  var DEEPSEEK_DEFAULT_MODEL = "deepseek-flash";
@@ -1924,15 +2025,20 @@ async function refreshChatGptCodexAuthState(state) {
1924
2025
  return { accessToken: state.accessToken, accountId: state.accountId };
1925
2026
  }
1926
2027
  var geminiCodeAssistAuthStates = /* @__PURE__ */ new Map();
1927
- function geminiAuthStateKey(refreshToken, accessToken) {
1928
- return JSON.stringify([refreshToken, refreshToken ? void 0 : accessToken]);
2028
+ function geminiAuthStateKey(refreshToken, accessToken, oauthClient) {
2029
+ return JSON.stringify([refreshToken, refreshToken ? void 0 : accessToken, oauthClient]);
1929
2030
  }
1930
2031
  function readGeminiCodeAssistEnv(env2 = process.env) {
1931
2032
  const access = env2["ZERO_GEMINI_ACCESS_TOKEN"];
1932
2033
  const refresh = env2["ZERO_GEMINI_OAUTH_REFRESH_TOKEN"];
1933
2034
  if ((!access || access.length === 0) && (!refresh || refresh.length === 0))
1934
2035
  return void 0;
2036
+ const clientId = env2["ZERO_GEMINI_OAUTH_CLIENT_ID"]?.trim();
2037
+ const clientSecret = env2["ZERO_GEMINI_OAUTH_CLIENT_SECRET"]?.trim();
2038
+ if (!clientId && clientSecret)
2039
+ throw new Error("Google OAuth client secret requires its matching client ID");
1935
2040
  return {
2041
+ ...clientId ? { oauthClient: { clientId, ...clientSecret ? { clientSecret } : {} } } : {},
1936
2042
  accessToken: access && access.length > 0 ? access : void 0,
1937
2043
  refreshToken: refresh && refresh.length > 0 ? refresh : void 0
1938
2044
  };
@@ -1942,11 +2048,12 @@ function resolveGeminiCodeAssistAuthState(env2) {
1942
2048
  if (!tokens) {
1943
2049
  throw new Error("Google Gemini Code Assist auth: neither ZERO_GEMINI_ACCESS_TOKEN nor ZERO_GEMINI_OAUTH_REFRESH_TOKEN is set. Sign in with your Google account (0 connect) or forward a fresh access token.");
1944
2050
  }
1945
- const key = geminiAuthStateKey(tokens.refreshToken ?? "", tokens.accessToken);
2051
+ const key = geminiAuthStateKey(tokens.refreshToken ?? "", tokens.accessToken, tokens.oauthClient);
1946
2052
  const existing = geminiCodeAssistAuthStates.get(key);
1947
2053
  if (existing)
1948
2054
  return existing;
1949
2055
  const state = {
2056
+ oauthClient: tokens.oauthClient,
1950
2057
  refreshToken: tokens.refreshToken ?? "",
1951
2058
  accessToken: tokens.accessToken,
1952
2059
  // A forwarded access token with no `exp` we can read: treat as immediately
@@ -1956,15 +2063,15 @@ function resolveGeminiCodeAssistAuthState(env2) {
1956
2063
  geminiCodeAssistAuthStates.set(key, state);
1957
2064
  return state;
1958
2065
  }
1959
- async function refreshGoogleAccessToken(refreshToken) {
2066
+ async function refreshGoogleAccessToken(refreshToken, oauthClient) {
1960
2067
  const res = await fetch(GEMINI_OAUTH_TOKEN_URL, {
1961
2068
  method: "POST",
1962
2069
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
1963
2070
  body: new URLSearchParams({
1964
2071
  grant_type: "refresh_token",
1965
2072
  refresh_token: refreshToken,
1966
- client_id: GEMINI_OAUTH_CLIENT_ID,
1967
- client_secret: GEMINI_OAUTH_CLIENT_SECRET
2073
+ client_id: oauthClient?.clientId ?? GEMINI_OAUTH_CLIENT_ID,
2074
+ ...(oauthClient ? oauthClient.clientSecret : GEMINI_OAUTH_CLIENT_SECRET) ? { client_secret: oauthClient ? oauthClient.clientSecret : GEMINI_OAUTH_CLIENT_SECRET } : {}
1968
2075
  }).toString()
1969
2076
  });
1970
2077
  const bodyText = await res.text().catch(() => "");
@@ -1975,7 +2082,7 @@ async function refreshGoogleAccessToken(refreshToken) {
1975
2082
  parsed = {};
1976
2083
  }
1977
2084
  if (!res.ok) {
1978
- const err = new Error(`Google token refresh failed: ${res.status} ${bodyText.slice(0, 200)}`);
2085
+ const err = new Error(`Google token refresh failed (HTTP ${res.status}${parsed.error === "invalid_grant" ? ": invalid_grant; reconnect this account" : ""})`);
1979
2086
  err.invalidGrant = parsed.error === "invalid_grant";
1980
2087
  throw err;
1981
2088
  }
@@ -1994,7 +2101,7 @@ async function refreshGeminiCodeAssistAuthState(state) {
1994
2101
  const usedRefresh = state.refreshToken;
1995
2102
  state.inflightRefresh = (async () => {
1996
2103
  try {
1997
- const tokens = await refreshGoogleAccessToken(usedRefresh);
2104
+ const tokens = await refreshGoogleAccessToken(usedRefresh, state.oauthClient);
1998
2105
  if (!tokens.access_token)
1999
2106
  throw new Error("Google token refresh returned no access_token.");
2000
2107
  state.accessToken = tokens.access_token;
@@ -2005,7 +2112,7 @@ async function refreshGeminiCodeAssistAuthState(state) {
2005
2112
  if (err.invalidGrant) {
2006
2113
  state.accessToken = void 0;
2007
2114
  state.accessTokenExpiresAt = 0;
2008
- geminiCodeAssistAuthStates.delete(geminiAuthStateKey(state.refreshToken, state.accessToken));
2115
+ geminiCodeAssistAuthStates.delete(geminiAuthStateKey(state.refreshToken, state.accessToken, state.oauthClient));
2009
2116
  }
2010
2117
  throw err;
2011
2118
  } finally {
@@ -2206,6 +2313,7 @@ var DEFAULT_PROVIDER_MODELS = {
2206
2313
  openai: DEFAULT_OPENAI_MODEL,
2207
2314
  azure: void 0,
2208
2315
  deepseek: DEEPSEEK_DEFAULT_MODEL,
2316
+ "chatgpt-plan": void 0,
2209
2317
  "chatgpt-codex": CODEX_DEFAULT_MODEL,
2210
2318
  "z-ai": ZAI_DEFAULT_MODEL,
2211
2319
  kimi: KIMI_DEFAULT_MODEL,
@@ -2253,7 +2361,7 @@ function detectProvider(configApiKey, preferredModel, env2, configProvider) {
2253
2361
  throw new Error(`${source} is unsupported: ${pinnedProviderRaw}`);
2254
2362
  }
2255
2363
  const provider = pinnedProviderRaw;
2256
- const model = preferredModel ?? env2["ZERO_MODEL"] ?? (provider === "azure" ? env2.AZURE_OPENAI_MODEL ?? parseCodexAzureConfig(env2).model : void 0) ?? (configProvider !== void 0 ? DEFAULT_PROVIDER_MODELS[provider] : void 0);
2364
+ const model = preferredModel ?? env2["ZERO_MODEL"] ?? (provider === "azure" ? env2.AZURE_OPENAI_MODEL ?? parseCodexAzureConfig(env2).model : provider === "openai" ? env2.OPENAI_MODEL : void 0) ?? (configProvider !== void 0 ? DEFAULT_PROVIDER_MODELS[provider] : void 0);
2257
2365
  if (model === void 0 || model === "") {
2258
2366
  if (provider === "azure")
2259
2367
  throw new Error("Choose an Azure deployment model in Connections to finish setup.");
@@ -2291,7 +2399,7 @@ function detectProvider(configApiKey, preferredModel, env2, configProvider) {
2291
2399
  provider: "openai",
2292
2400
  apiKey: configApiKey,
2293
2401
  baseUrl: "https://api.openai.com/v1",
2294
- defaultModel: DEFAULT_OPENAI_MODEL,
2402
+ defaultModel: env2.OPENAI_MODEL ?? DEFAULT_OPENAI_MODEL,
2295
2403
  wireApi: openAICompatibleWireApi(env2, "OPENAI_WIRE_API")
2296
2404
  };
2297
2405
  }
@@ -2415,7 +2523,7 @@ function detectProvider(configApiKey, preferredModel, env2, configProvider) {
2415
2523
  provider: "openai",
2416
2524
  apiKey: env2.OPENAI_API_KEY,
2417
2525
  baseUrl: env2.OPENAI_BASE_URL ?? "https://api.openai.com/v1",
2418
- defaultModel: DEFAULT_OPENAI_MODEL,
2526
+ defaultModel: env2.OPENAI_MODEL ?? DEFAULT_OPENAI_MODEL,
2419
2527
  wireApi: openAICompatibleWireApi(env2, "OPENAI_WIRE_API")
2420
2528
  };
2421
2529
  default:
@@ -2477,7 +2585,7 @@ function detectProvider(configApiKey, preferredModel, env2, configProvider) {
2477
2585
  provider: "openai",
2478
2586
  apiKey: openaiKey,
2479
2587
  baseUrl: env2.OPENAI_BASE_URL ?? "https://api.openai.com/v1",
2480
- defaultModel: DEFAULT_OPENAI_MODEL,
2588
+ defaultModel: env2.OPENAI_MODEL ?? DEFAULT_OPENAI_MODEL,
2481
2589
  wireApi: openAICompatibleWireApi(env2, "OPENAI_WIRE_API")
2482
2590
  };
2483
2591
  }
@@ -2587,9 +2695,14 @@ var LlmApiRuntime = class _LlmApiRuntime {
2587
2695
  config;
2588
2696
  // Not readonly: a live provider switch re-freezes env from the new account.
2589
2697
  env;
2698
+ requestAdmission;
2699
+ requestAdmissionIdentity;
2590
2700
  codexAuthState;
2701
+ grantedProviderTransport;
2591
2702
  workbenchProviderProxy;
2592
2703
  geminiAuthState;
2704
+ siwcConnection;
2705
+ siwcModels;
2593
2706
  provider;
2594
2707
  apiKey;
2595
2708
  baseUrl;
@@ -2616,12 +2729,16 @@ var LlmApiRuntime = class _LlmApiRuntime {
2616
2729
  this.config = {
2617
2730
  type: "api",
2618
2731
  model,
2732
+ siwcConnection: inherited.siwcConnection,
2619
2733
  agentModels: inherited.config.agentModels,
2620
2734
  singleModel: inherited.config.singleModel,
2621
2735
  timeout: Math.min(timeout, inherited.config.timeout || 12e4)
2622
2736
  };
2623
2737
  this.env = inherited.env;
2624
2738
  this.workbenchProviderProxy = inherited.workbenchProviderProxy;
2739
+ this.grantedProviderTransport = inherited.grantedProviderTransport;
2740
+ this.siwcConnection = inherited.siwcConnection;
2741
+ this.siwcModels = inherited.siwcModels;
2625
2742
  this.provider = inherited.provider;
2626
2743
  this.apiKey = inherited.apiKey;
2627
2744
  this.baseUrl = inherited.baseUrl;
@@ -2660,7 +2777,59 @@ var LlmApiRuntime = class _LlmApiRuntime {
2660
2777
  ...config,
2661
2778
  ...config.agentModels ? { agentModels: Object.freeze({ ...config.agentModels }) } : {}
2662
2779
  };
2780
+ this.siwcConnection = void 0;
2781
+ this.siwcModels = void 0;
2782
+ if (config.provider === "chatgpt-plan") {
2783
+ if (!config.siwcConnection || !config.model)
2784
+ throw new Error("ChatGPT plan requires a verified connection and a model selected from its catalog");
2785
+ if (config.providerTransport || config.apiKey)
2786
+ throw new Error("ChatGPT plan cannot use API keys or Codex transport");
2787
+ this.siwcConnection = captureSiwcConnection(config.siwcConnection);
2788
+ this.config = { ...this.config, siwcConnection: this.siwcConnection };
2789
+ this.env = Object.freeze({ ZERO_SKIP_PROVIDER_BANNER: "1" });
2790
+ this.grantedProviderTransport = void 0;
2791
+ this.workbenchProviderProxy = void 0;
2792
+ this.azureConfig = parseCodexAzureConfig({});
2793
+ this.fallbackChain = [];
2794
+ this.fallbackIndex = 0;
2795
+ this.provider = "chatgpt-plan";
2796
+ this.apiKey = "";
2797
+ this.baseUrl = "https://api.openai.com/v1";
2798
+ this.wireApi = "responses";
2799
+ this.model = config.model;
2800
+ this.codexAuthState = void 0;
2801
+ this.geminiAuthState = void 0;
2802
+ this.reasoningEffort = config.env?.["ZERO_REASONING_EFFORT"];
2803
+ this.serverCompactionTokens = void 0;
2804
+ return;
2805
+ }
2806
+ this.grantedProviderTransport = config.providerTransport;
2807
+ if (config.providerTransport) {
2808
+ const grant = config.providerTransport;
2809
+ if (grant.provider !== "chatgpt-codex" || config.provider && config.provider !== grant.provider || !config.model || !grant.models.includes(config.model))
2810
+ throw new Error("Model is outside the explicit provider transport grant");
2811
+ for (const model of Object.values(config.agentModels ?? {}))
2812
+ if (model !== "auto" && !grant.models.includes(model))
2813
+ throw new Error("Worker model is outside the explicit provider transport grant");
2814
+ this.env = Object.freeze({ ZERO_SKIP_PROVIDER_BANNER: "1" });
2815
+ this.workbenchProviderProxy = void 0;
2816
+ this.azureConfig = parseCodexAzureConfig({});
2817
+ this.fallbackChain = [];
2818
+ this.fallbackIndex = 0;
2819
+ this.provider = grant.provider;
2820
+ this.apiKey = "";
2821
+ this.baseUrl = "https://provider-relay.invalid";
2822
+ this.wireApi = "responses";
2823
+ this.model = config.model;
2824
+ this.codexAuthState = void 0;
2825
+ this.geminiAuthState = void 0;
2826
+ this.reasoningEffort = void 0;
2827
+ this.serverCompactionTokens = config.serverCompactionTokens === void 0 ? void 0 : Math.max(1e3, config.serverCompactionTokens);
2828
+ return;
2829
+ }
2663
2830
  this.env = Object.freeze({ ...process.env, ...config.env });
2831
+ this.requestAdmission = void 0;
2832
+ this.requestAdmissionIdentity = void 0;
2664
2833
  this.workbenchProviderProxy = resolveWorkbenchProviderProxy(this.env);
2665
2834
  this.azureConfig = parseCodexAzureConfig(this.env);
2666
2835
  this.fallbackChain = (this.workbenchProviderProxy ? [] : getFallbackChain(this.env)).map((entry) => ({
@@ -2701,6 +2870,8 @@ var LlmApiRuntime = class _LlmApiRuntime {
2701
2870
  }
2702
2871
  if (this.provider === "cline")
2703
2872
  this.model = clineModelId(this.model);
2873
+ if (this.provider === "openrouter")
2874
+ this.model = openrouterModelId(this.model);
2704
2875
  this.applyModelWireApi();
2705
2876
  if (this.apiKey && !this.env["ZERO_SKIP_PROVIDER_BANNER"]) {
2706
2877
  void logProviderStartup(this.provider, this.providerLabel, this.baseUrl, this.model, this.wireApi, this.apiKey).catch(() => {
@@ -2709,6 +2880,10 @@ var LlmApiRuntime = class _LlmApiRuntime {
2709
2880
  }
2710
2881
  /** Non-secret identity for preferences scoped to the captured connection. */
2711
2882
  connectionIdentity() {
2883
+ if (this.siwcConnection)
2884
+ return createHash("sha256").update(JSON.stringify(["chatgpt-plan", this.siwcConnection.accountId, this.siwcConnection.clientId, this.siwcConnection.hostId])).digest("hex");
2885
+ if (this.grantedProviderTransport)
2886
+ return this.grantedProviderTransport.identity;
2712
2887
  let identity;
2713
2888
  if (this.provider === "chatgpt-codex") {
2714
2889
  const state = this.codexAuthState;
@@ -2726,7 +2901,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2726
2901
  const credential = this.geminiAuthState?.refreshToken || this.geminiAuthState?.accessToken;
2727
2902
  if (!credential)
2728
2903
  return void 0;
2729
- identity = [this.provider, this.baseUrl, credential, firstNonEmptyEnv(this.env, "GOOGLE_CLOUD_PROJECT", "ZERO_GEMINI_PROJECT") ?? ""];
2904
+ identity = [this.provider, this.baseUrl, credential, firstNonEmptyEnv(this.env, "GOOGLE_CLOUD_PROJECT", "ZERO_GEMINI_PROJECT") ?? "", this.geminiAuthState?.oauthClient?.clientId ?? "legacy"];
2730
2905
  } else {
2731
2906
  if (!this.apiKey)
2732
2907
  return void 0;
@@ -2736,7 +2911,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2736
2911
  }
2737
2912
  /** Documented effort controls only on routes which send Responses reasoning. */
2738
2913
  reasoningConfiguration() {
2739
- if (this.wireApi !== "responses" || !["openai", "azure", "chatgpt-codex"].includes(this.provider))
2914
+ if (this.wireApi !== "responses" || !["openai", "azure", "chatgpt-codex", "chatgpt-plan"].includes(this.provider))
2740
2915
  return null;
2741
2916
  const model = this.model.replace(/^openai\//, "");
2742
2917
  let options;
@@ -2765,14 +2940,19 @@ var LlmApiRuntime = class _LlmApiRuntime {
2765
2940
  const state = this.codexAuthState;
2766
2941
  if (this.provider !== "chatgpt-codex" || !state)
2767
2942
  throw new Error("No active Codex subscription");
2768
- const { loadCodexModelCatalog } = await import("./codex-models-6XVNFRXZ.js");
2943
+ const { loadCodexModelCatalog } = await import("./codex-models-CI22KIHY.js");
2769
2944
  return loadCodexModelCatalog({ signal, resolveCredentials: () => refreshChatGptCodexAuthState(state) });
2770
2945
  }
2771
2946
  /** Discover endpoint inventory; Cline explicitly marks its public catalog provenance. */
2772
2947
  async availableModelCatalog(signal) {
2948
+ if (this.provider === "chatgpt-plan") {
2949
+ if (!this.siwcConnection)
2950
+ throw new Error("ChatGPT plan connection is unavailable");
2951
+ return (await listSiwcModels(this.siwcConnection, fetch, signal)).map((model) => ({ id: model.slug, source: "catalog" }));
2952
+ }
2773
2953
  if (this.provider === "chatgpt-codex")
2774
2954
  return this.codexModelCatalog(signal);
2775
- const { discoverProviderModels } = await import("./provider-model-discovery-QGUGL3XW.js");
2955
+ const { discoverProviderModels } = await import("./provider-model-discovery-3X6DON3Y.js");
2776
2956
  return discoverProviderModels({
2777
2957
  provider: this.provider,
2778
2958
  baseUrl: this.baseUrl,
@@ -2796,12 +2976,21 @@ var LlmApiRuntime = class _LlmApiRuntime {
2796
2976
  * model / provider / role map with zero session teardown. Undefined fields
2797
2977
  * preserve the current state, except a provider change resets an omitted model.
2798
2978
  */
2979
+ useGrantedProviderTransport(transport, selection = {}) {
2980
+ this.applyConfiguration({ ...this.config, apiKey: void 0, env: {}, providerTransport: transport, provider: transport.provider, model: selection.model ?? this.model, ...selection });
2981
+ }
2799
2982
  reconfigure(sel) {
2983
+ if (this.grantedProviderTransport && (sel.provider && sel.provider !== this.grantedProviderTransport.provider || sel.model && !this.grantedProviderTransport.models.includes(sel.model) || Object.values(sel.agentModels ?? {}).some((model) => model !== "auto" && !this.grantedProviderTransport.models.includes(model))))
2984
+ throw new Error("Selection is outside the explicit provider transport grant");
2985
+ if (this.siwcConnection && sel.siwcConnection && (sel.siwcConnection.accountId !== this.siwcConnection.accountId || sel.siwcConnection.clientId !== this.siwcConnection.clientId || sel.siwcConnection.hostId !== this.siwcConnection.hostId)) {
2986
+ throw new Error("Changing the ChatGPT plan account requires a new chat runtime");
2987
+ }
2800
2988
  const providerChanged = sel.provider !== void 0 && sel.provider !== this.provider;
2801
2989
  if (providerChanged) {
2802
2990
  const merged = {
2803
2991
  ...this.config,
2804
2992
  apiKey: void 0,
2993
+ siwcConnection: sel.provider === "chatgpt-plan" ? sel.siwcConnection : void 0,
2805
2994
  provider: sel.provider ?? this.provider,
2806
2995
  model: sel.model,
2807
2996
  ...sel.agentModels !== void 0 ? { agentModels: sel.agentModels } : {},
@@ -2822,7 +3011,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2822
3011
  this.config = { ...this.config, autoRoute: sel.autoRoute };
2823
3012
  }
2824
3013
  if (sel.model !== void 0) {
2825
- const model = this.provider === "opencode" ? opencodeModelId(sel.model) : this.provider === "copilot" ? copilotModelId(sel.model) : this.provider === "cline" ? clineModelId(sel.model) : sel.model;
3014
+ const model = this.provider === "opencode" ? opencodeModelId(sel.model) : this.provider === "copilot" ? copilotModelId(sel.model) : this.provider === "openrouter" ? openrouterModelId(sel.model) : this.provider === "cline" ? clineModelId(sel.model) : sel.model;
2826
3015
  if (model !== this.model) {
2827
3016
  this.model = model;
2828
3017
  this.config = { ...this.config, model };
@@ -2864,6 +3053,10 @@ var LlmApiRuntime = class _LlmApiRuntime {
2864
3053
  * failover chain uses — including auth-only providers (chatgpt-codex OAuth).
2865
3054
  */
2866
3055
  accessibleProviders() {
3056
+ if (this.siwcConnection)
3057
+ return ["chatgpt-plan"];
3058
+ if (this.grantedProviderTransport)
3059
+ return [this.grantedProviderTransport.provider];
2867
3060
  if (this.workbenchProviderProxy)
2868
3061
  return ["chatgpt-codex"];
2869
3062
  const out = [];
@@ -2882,6 +3075,8 @@ var LlmApiRuntime = class _LlmApiRuntime {
2882
3075
  * provider has creds, so this is a helpful starting set, not the whole bound.
2883
3076
  */
2884
3077
  accessibleModels() {
3078
+ if (this.grantedProviderTransport)
3079
+ return [...this.grantedProviderTransport.models];
2885
3080
  if (this.workbenchProviderProxy)
2886
3081
  return [this.workbenchProviderProxy.model];
2887
3082
  const models = /* @__PURE__ */ new Set();
@@ -2901,6 +3096,8 @@ var LlmApiRuntime = class _LlmApiRuntime {
2901
3096
  * accessible defaults as a fallback for ids the router does not pattern-match.
2902
3097
  */
2903
3098
  isModelAccessible(model) {
3099
+ if (this.grantedProviderTransport)
3100
+ return this.grantedProviderTransport.models.includes(model);
2904
3101
  if (this.workbenchProviderProxy)
2905
3102
  return this.accessibleModels().includes(model);
2906
3103
  if (providerForModel(model, this.env) !== void 0)
@@ -2918,7 +3115,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2918
3115
  if (typeof selectedModel !== "string" || !selectedModel.trim()) {
2919
3116
  throw new Error("Subagent model must be a non-empty model ID");
2920
3117
  }
2921
- const stripProviderPrefix = (id) => this.provider === "opencode" ? opencodeModelId(id) : this.provider === "copilot" ? copilotModelId(id) : this.provider === "cline" ? clineModelId(id) : id;
3118
+ const stripProviderPrefix = (id) => this.provider === "opencode" ? opencodeModelId(id) : this.provider === "copilot" ? copilotModelId(id) : this.provider === "openrouter" ? openrouterModelId(id) : this.provider === "cline" ? clineModelId(id) : id;
2922
3119
  const model = stripProviderPrefix(selectedModel);
2923
3120
  const approvedByAllowlist = model === this.model || Object.values(this.config.agentModels ?? {}).some((id) => id !== AUTO_MODEL_SENTINEL && stripProviderPrefix(id) === model);
2924
3121
  const approved = approvedByAllowlist || autoInEffect && this.isModelAccessible(selectedModel);
@@ -2934,7 +3131,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2934
3131
  * contract; callers must fail closed before making a metered comparison call.
2935
3132
  */
2936
3133
  get outputTokenLimit() {
2937
- return this.provider === "chatgpt-codex" ? void 0 : NATIVE_COMPLETION_TOKEN_LIMIT;
3134
+ return this.provider === "chatgpt-codex" || this.provider === "chatgpt-plan" ? void 0 : NATIVE_COMPLETION_TOKEN_LIMIT;
2938
3135
  }
2939
3136
  /**
2940
3137
  * Whether this provider uses OpenAI-compatible chat/completions format.
@@ -2946,7 +3143,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
2946
3143
  * inert default — it is intentionally unused for these two providers.
2947
3144
  */
2948
3145
  get isOpenAICompat() {
2949
- return this.provider === "openrouter" || this.provider === "openai" || this.provider === "azure" || this.provider === "deepseek" || this.provider === "qwen" || this.provider === "xai" || this.provider === "copilot" || this.provider === "cline" || this.provider === "opencode" && (this.wireApi === "chat_completions" || this.wireApi === "responses") || // chatgpt-codex always speaks Responses API; treat it as
3146
+ return this.provider === "openrouter" || this.provider === "openai" || this.provider === "chatgpt-plan" || this.provider === "azure" || this.provider === "deepseek" || this.provider === "qwen" || this.provider === "xai" || this.provider === "copilot" || this.provider === "cline" || this.provider === "opencode" && (this.wireApi === "chat_completions" || this.wireApi === "responses") || // chatgpt-codex always speaks Responses API; treat it as
2950
3147
  // OpenAI-compat for body-shape branching purposes (the Responses
2951
3148
  // wire-API code paths below already key on `wireApi === "responses"`
2952
3149
  // and produce a body codex's backend accepts as-is).
@@ -3027,7 +3224,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
3027
3224
  if (this.isGeminiCodeAssist) {
3028
3225
  return {
3029
3226
  "Content-Type": "application/json",
3030
- "User-Agent": geminiUserAgent(this.model)
3227
+ "User-Agent": this.geminiAuthState?.oauthClient ? `0/${VERSION} (${process.platform}; ${process.arch}) ${this.model}` : geminiUserAgent(this.model)
3031
3228
  };
3032
3229
  }
3033
3230
  if (this.isGoogleWire) {
@@ -3084,8 +3281,13 @@ var LlmApiRuntime = class _LlmApiRuntime {
3084
3281
  * controller process, add a setter on the runtime; for now this
3085
3282
  * matches how the CLI is actually invoked.
3086
3283
  */
3087
- async ensureFreshHeaders() {
3284
+ async ensureFreshHeaders(signal) {
3088
3285
  const base = this.buildHeaders();
3286
+ if (this.provider === "chatgpt-plan") {
3287
+ if (!this.siwcConnection)
3288
+ throw new Error("ChatGPT plan connection is unavailable");
3289
+ return siwcHeaders(this.siwcConnection, signal);
3290
+ }
3089
3291
  if (this.provider === "google") {
3090
3292
  if (!this.geminiAuthState)
3091
3293
  throw new Error("Google Gemini Code Assist auth: no credential captured for this runtime");
@@ -3183,6 +3385,8 @@ var LlmApiRuntime = class _LlmApiRuntime {
3183
3385
  for (const block of message.content) {
3184
3386
  if (block.type === "text") {
3185
3387
  parts.push({ text: block.text });
3388
+ } else if (block.type === "image") {
3389
+ parts.push({ inlineData: { mimeType: block.mediaType, data: block.data } });
3186
3390
  } else if (block.type === "tool_use") {
3187
3391
  toolNames.set(block.id, block.name);
3188
3392
  upstreamCallIds.set(block.id, block.id);
@@ -3267,6 +3471,8 @@ var LlmApiRuntime = class _LlmApiRuntime {
3267
3471
  return "Azure OpenAI";
3268
3472
  case "deepseek":
3269
3473
  return "DeepSeek";
3474
+ case "chatgpt-plan":
3475
+ return "ChatGPT plan";
3270
3476
  case "chatgpt-codex":
3271
3477
  return "ChatGPT (Codex backend)";
3272
3478
  case "z-ai":
@@ -3291,7 +3497,7 @@ var LlmApiRuntime = class _LlmApiRuntime {
3291
3497
  return "No provider credential found. Set one of:\n env ZERO_CHATGPT_OAUTH_REFRESH_TOKEN=... 0 <command> (ChatGPT Codex subscription auth)\n export OPENROUTER_API_KEY=sk-or-... (OpenRouter \u2014 many models, one key)\n export DEEPSEEK_API_KEY=... (DeepSeek \u2014 direct Flash 0731 inference)\n export ANTHROPIC_API_KEY=sk-ant-... (Anthropic \u2014 direct Claude access)\n export AZURE_OPENAI_API_KEY=... (Azure OpenAI \u2014 reuse your Codex Azure provider)\n export OPENAI_API_KEY=sk-... (OpenAI \u2014 direct GPT access)\n export Z_AI_API_KEY=... (Z.ai GLM \u2014 flat-rate Coding Plan, Anthropic-compatible)\n export KIMI_API_KEY=... (Moonshot Kimi K3 \u2014 flat-rate coding, Anthropic-compatible)\n export QWEN_API_KEY=... (Alibaba Qwen \u2014 Token Plan sub, OpenAI-compatible)\n export XAI_API_KEY=... (xAI Grok \u2014 OpenAI-compatible)\n export CLINE_API_KEY=... (Cline \u2014 API key; cline-pass/* needs ClinePass)\n export OPENCODE_API_KEY=... (OpenCode Zen \u2014 multi-wire gateway)\n export ZERO_COPILOT_GITHUB_TOKEN=... (GitHub Copilot \u2014 device-code OAuth token)";
3292
3498
  }
3293
3499
  getConfigurationDiagnostics() {
3294
- if (!this.apiKey && this.provider !== "chatgpt-codex") {
3500
+ if (!this.apiKey && this.provider !== "chatgpt-codex" && this.provider !== "chatgpt-plan") {
3295
3501
  return {
3296
3502
  valid: false,
3297
3503
  provider: this.provider,
@@ -3401,27 +3607,79 @@ Missing: ${missing.join("; ")}
3401
3607
  * Headers are re-resolved per attempt (via ensureFreshHeaders → OAuth
3402
3608
  * refresh) so a token that rotated during the wait is picked up.
3403
3609
  */
3610
+ async gatewayRequestAdmission(signal) {
3611
+ if (this.workbenchProviderProxy)
3612
+ throw new Error(`${LOCAL_ADMISSION_UNAVAILABLE} gateway admission cannot use a workbench proxy; no inference request sent`);
3613
+ const model = this.model;
3614
+ const baseUrl = this.baseUrl;
3615
+ const identity = JSON.stringify([this.provider, baseUrl, model, this.wireApi]);
3616
+ if (!this.requestAdmission || this.requestAdmissionIdentity !== identity) {
3617
+ this.requestAdmissionIdentity = identity;
3618
+ const pending = (async () => {
3619
+ try {
3620
+ const response = await fetch(`${baseUrl.replace(/\/+$/, "")}/models`, {
3621
+ headers: await this.ensureFreshHeaders(signal),
3622
+ signal,
3623
+ redirect: "error"
3624
+ });
3625
+ if (!response.ok)
3626
+ throw new Error(`${LOCAL_ADMISSION_UNAVAILABLE} catalog HTTP ${response.status}; no inference request sent`);
3627
+ return parseRequestAdmission(await response.json(), model);
3628
+ } catch (error) {
3629
+ if (error instanceof Error && error.message.startsWith(LOCAL_ADMISSION_UNAVAILABLE))
3630
+ throw error;
3631
+ throw new Error(`${LOCAL_ADMISSION_UNAVAILABLE} catalog unavailable or invalid; no inference request sent`);
3632
+ }
3633
+ })();
3634
+ this.requestAdmission = pending;
3635
+ void pending.catch(() => {
3636
+ if (this.requestAdmission === pending && this.requestAdmissionIdentity === identity) {
3637
+ this.requestAdmission = void 0;
3638
+ this.requestAdmissionIdentity = void 0;
3639
+ }
3640
+ });
3641
+ }
3642
+ return this.requestAdmission;
3643
+ }
3404
3644
  async postWithRetry(bodyFactory, signal, abort) {
3405
3645
  let waited429Ms = 0;
3406
3646
  let waitedOtherMs = 0;
3407
3647
  for (let attempt = 0; ; attempt++) {
3408
3648
  abort?.throwIfCancelled();
3649
+ if (this.siwcConnection) {
3650
+ this.siwcModels ??= listSiwcModels(this.siwcConnection, fetch, signal).then((models) => new Set(models.map((model) => model.slug)));
3651
+ try {
3652
+ if (!(await this.siwcModels).has(this.model))
3653
+ throw new Error("Selected model is not in this ChatGPT account's available catalog");
3654
+ } catch (error) {
3655
+ this.siwcModels = void 0;
3656
+ throw error;
3657
+ }
3658
+ }
3659
+ const body = bodyFactory();
3660
+ if (this.env["ZERO_REQUIRE_REQUEST_ADMISSION"] === "1") {
3661
+ assertRequestAdmission(body, await this.gatewayRequestAdmission(signal));
3662
+ }
3409
3663
  let res;
3410
3664
  try {
3411
- res = this.workbenchProviderProxy ? await fetch(this.workbenchProviderProxy.url, {
3665
+ res = this.grantedProviderTransport ? await this.grantedProviderTransport.request({ provider: "chatgpt-codex", model: this.model, body }, signal) : this.workbenchProviderProxy ? await fetch(this.workbenchProviderProxy.url, {
3412
3666
  method: "POST",
3413
3667
  redirect: "error",
3414
3668
  headers: { "Content-Type": "application/json" },
3415
- body: JSON.stringify({ provider: this.provider, model: this.model, body: bodyFactory() }),
3669
+ body: JSON.stringify({ provider: this.provider, model: this.model, body }),
3416
3670
  signal
3417
3671
  }) : await fetch(this.buildUrl(), {
3418
3672
  method: "POST",
3419
- headers: await this.ensureFreshHeaders(),
3420
- body: bodyFactory(),
3673
+ redirect: "error",
3674
+ headers: await this.ensureFreshHeaders(signal),
3675
+ body,
3421
3676
  signal
3422
3677
  });
3423
3678
  } catch (error) {
3424
3679
  abort?.throwIfCancelled();
3680
+ if (this.env["ZERO_REQUIRE_RETRY_SAFE_RECEIPT"] === "1") {
3681
+ throw new Error(`${this.providerLabel} request outcome may be unknown. Automatic replay is disabled`, { cause: error });
3682
+ }
3425
3683
  const cause = error instanceof Error ? error.cause : void 0;
3426
3684
  const causeCode = cause && typeof cause === "object" && "code" in cause && typeof cause.code === "string" ? cause.code : "unknown";
3427
3685
  const causeHost = cause && typeof cause === "object" && "hostname" in cause && typeof cause.hostname === "string" ? `@${cause.hostname}` : "";
@@ -3445,6 +3703,10 @@ Missing: ${missing.join("; ")}
3445
3703
  cause: error
3446
3704
  });
3447
3705
  }
3706
+ if (!res.ok && this.env["ZERO_REQUIRE_RETRY_SAFE_RECEIPT"] === "1" && res.headers.get("x-0-retry-safe") !== "1") {
3707
+ await res.body?.cancel();
3708
+ throw new Error(`${this.providerLabel} gateway HTTP ${res.status}; request outcome may be unknown. Automatic replay is disabled`);
3709
+ }
3448
3710
  if (res.ok || !isRetryableHttpStatus(res.status)) {
3449
3711
  return res;
3450
3712
  }
@@ -3542,20 +3804,20 @@ Missing: ${missing.join("; ")}
3542
3804
  if (context?.signal?.aborted) {
3543
3805
  return { output: "", exitCode: null, timedOut: false, durationMs: 0, error: "API execution cancelled." };
3544
3806
  }
3545
- if (this.workbenchProviderProxy) {
3807
+ if (this.siwcConnection || this.grantedProviderTransport || this.workbenchProviderProxy) {
3546
3808
  const result = await this.executeNative(context?.systemPrompt ?? "", [
3547
3809
  { role: "user", content: [{ type: "text", text: prompt }] }
3548
3810
  ], [], void 0, context?.signal);
3549
3811
  return {
3550
3812
  output: result.content.filter((block) => block.type === "text").map((block) => block.text).join("\n"),
3551
3813
  exitCode: result.cancelled ? null : result.stopReason === "error" ? 1 : 0,
3552
- timedOut: false,
3814
+ timedOut: result.timedOut === true,
3553
3815
  durationMs: Date.now() - start,
3554
3816
  usage: result.usage,
3555
3817
  error: result.error
3556
3818
  };
3557
3819
  }
3558
- if (!this.apiKey && this.provider !== "chatgpt-codex" && this.provider !== "google") {
3820
+ if (!this.apiKey && this.provider !== "chatgpt-codex" && this.provider !== "chatgpt-plan" && this.provider !== "google") {
3559
3821
  return {
3560
3822
  output: "",
3561
3823
  exitCode: 1,
@@ -3602,7 +3864,8 @@ Missing: ${missing.join("; ")}
3602
3864
  res = await this.postWithRetry(() => JSON.stringify({
3603
3865
  model: this.model,
3604
3866
  input,
3605
- ...isCodex ? { store: false } : { max_output_tokens: NATIVE_COMPLETION_TOKEN_LIMIT }
3867
+ ...isCodex ? { store: false } : { max_output_tokens: NATIVE_COMPLETION_TOKEN_LIMIT },
3868
+ ...this.provider === "chatgpt-plan" ? { store: false, stream: true } : {}
3606
3869
  }), abort.signal, abort);
3607
3870
  } else if (this.isGeminiCodeAssist) {
3608
3871
  const request = {
@@ -3689,7 +3952,7 @@ Missing: ${missing.join("; ")}
3689
3952
  };
3690
3953
  }
3691
3954
  const msg = err instanceof Error ? err.message : String(err);
3692
- const timedOut = msg.includes("abort") || msg.includes("timeout");
3955
+ const timedOut = controller.signal.aborted || msg.includes("abort") || msg.includes("timeout");
3693
3956
  return {
3694
3957
  output: "",
3695
3958
  exitCode: 1,
@@ -3718,8 +3981,23 @@ Missing: ${missing.join("; ")}
3718
3981
  const maxAttempts = llmStreamMaxAttempts();
3719
3982
  let result;
3720
3983
  let attempt = 0;
3721
- for (attempt = 1; attempt <= maxAttempts; attempt++) {
3984
+ let refusedUsage;
3985
+ const withRefusedUsage = (outcome) => refusedUsage ? { ...outcome, usage: mergeRuntimeUsage(outcome.usage, refusedUsage) } : outcome;
3986
+ for (; ; ) {
3722
3987
  result = await this.executeNativeAttempt(system, messages, tools, callbacks, signal);
3988
+ if (isLocalAdmissionFailure(result.error))
3989
+ return withRefusedUsage(result);
3990
+ if (this.env["ZERO_REQUIRE_RETRY_SAFE_RECEIPT"] === "1" && (result.stopReason === "error" || result.error)) {
3991
+ return withRefusedUsage({ ...result, error: `${result.error ?? "Incomplete gateway response"}. Request outcome may be unknown. Automatic replay is disabled` });
3992
+ }
3993
+ if (isPolicyRefusalResult(result) && !signal?.aborted) {
3994
+ if (result.usage)
3995
+ refusedUsage = mergeRuntimeUsage(refusedUsage, result.usage);
3996
+ if (this._tryFailover("provider policy refusal"))
3997
+ continue;
3998
+ return refusedUsage ? { ...result, usage: refusedUsage } : result;
3999
+ }
4000
+ attempt++;
3723
4001
  if (attempt >= maxAttempts || !shouldRetryNativeStream(result) || signal?.aborted)
3724
4002
  break;
3725
4003
  const backoff = streamRetryBackoffMs(attempt);
@@ -3729,13 +4007,13 @@ Missing: ${missing.join("; ")}
3729
4007
  break;
3730
4008
  }
3731
4009
  if (attempt >= maxAttempts && maxAttempts > 1 && shouldRetryNativeStream(result)) {
3732
- return { ...result, error: `${result.error} (retried ${maxAttempts} times)` };
4010
+ return withRefusedUsage({ ...result, error: `${result.error} (retried ${maxAttempts} times)` });
3733
4011
  }
3734
- return result;
4012
+ return withRefusedUsage(result);
3735
4013
  }
3736
4014
  async executeNativeAttempt(system, messages, tools, callbacks, signal) {
3737
4015
  const start = Date.now();
3738
- if (!this.apiKey && this.provider !== "chatgpt-codex" && this.provider !== "google") {
4016
+ if (!this.apiKey && this.provider !== "chatgpt-codex" && this.provider !== "chatgpt-plan" && this.provider !== "google") {
3739
4017
  return {
3740
4018
  content: [{ type: "text", text: "" }],
3741
4019
  stopReason: "error",
@@ -3755,6 +4033,10 @@ Missing: ${missing.join("; ")}
3755
4033
  const chatMessages = [];
3756
4034
  chatMessages.push({ role: "system", content: system });
3757
4035
  for (const m of messages) {
4036
+ if (m.role === "user" && m.content.some((block) => block.type === "image") && m.content.every((block) => block.type === "text" || block.type === "image")) {
4037
+ chatMessages.push({ role: "user", content: m.content.map((block) => block.type === "image" ? { type: "image_url", image_url: { url: `data:${block.mediaType};base64,${block.data}` } } : { type: "text", text: block.type === "text" ? block.text : "" }) });
4038
+ continue;
4039
+ }
3758
4040
  const pendingToolCalls = [];
3759
4041
  let pendingAssistantText = null;
3760
4042
  const flushAssistant = () => {
@@ -3779,6 +4061,9 @@ Missing: ${missing.join("; ")}
3779
4061
  flushAssistant();
3780
4062
  chatMessages.push({ role: m.role, content: block.text });
3781
4063
  }
4064
+ } else if (block.type === "image") {
4065
+ flushAssistant();
4066
+ chatMessages.push({ role: m.role, content: [{ type: "image_url", image_url: { url: `data:${block.mediaType};base64,${block.data}` } }] });
3782
4067
  } else if (block.type === "tool_use") {
3783
4068
  pendingToolCalls.push({
3784
4069
  id: block.id,
@@ -3818,7 +4103,7 @@ Missing: ${missing.join("; ")}
3818
4103
  }
3819
4104
  res = await this.postWithRetry(() => JSON.stringify({ ...body, model: this.model }), call.signal, call);
3820
4105
  } else if (this.isOpenAICompat && this.wireApi === "responses") {
3821
- const isCodexProvider = this.provider === "chatgpt-codex";
4106
+ const isCodexProvider = this.provider === "chatgpt-codex" || this.provider === "chatgpt-plan";
3822
4107
  const input = isCodexProvider ? [] : [
3823
4108
  {
3824
4109
  role: "system",
@@ -3836,6 +4121,8 @@ Missing: ${missing.join("; ")}
3836
4121
  for (const block of m.content) {
3837
4122
  if (block.type === "text") {
3838
4123
  textBlocks.push({ type: textType, text: block.text });
4124
+ } else if (block.type === "image") {
4125
+ textBlocks.push({ type: "input_image", image_url: `data:${block.mediaType};base64,${block.data}` });
3839
4126
  } else if (block.type === "tool_use") {
3840
4127
  if (textBlocks.length > 0) {
3841
4128
  input.push({ role: m.role, content: [...textBlocks] });
@@ -3844,6 +4131,7 @@ Missing: ${missing.join("; ")}
3844
4131
  input.push({
3845
4132
  type: "function_call",
3846
4133
  call_id: block.id,
4134
+ ...this.provider === "chatgpt-plan" ? { namespace: "zero" } : {},
3847
4135
  name: block.name,
3848
4136
  arguments: JSON.stringify(block.input)
3849
4137
  });
@@ -3867,8 +4155,9 @@ Missing: ${missing.join("; ")}
3867
4155
  const isCodex = this.provider === "chatgpt-codex";
3868
4156
  const body = {
3869
4157
  model: this.model,
4158
+ ...this.provider === "chatgpt-plan" ? { store: false, stream: true } : {},
3870
4159
  input,
3871
- ...isCodex ? { store: false, instructions: system } : { max_output_tokens: NATIVE_COMPLETION_TOKEN_LIMIT },
4160
+ ...isCodex || this.provider === "chatgpt-plan" ? { store: false, instructions: system } : { max_output_tokens: NATIVE_COMPLETION_TOKEN_LIMIT },
3872
4161
  ...reasoningEffort ? {
3873
4162
  reasoning: {
3874
4163
  effort: reasoningEffort,
@@ -3921,6 +4210,8 @@ Missing: ${missing.join("; ")}
3921
4210
  strict: false,
3922
4211
  parameters: t.input_schema
3923
4212
  }));
4213
+ if (this.provider === "chatgpt-plan")
4214
+ body.tools = [{ type: "namespace", name: "zero", description: "0 local investigation tools", tools: body.tools }];
3924
4215
  if (isCodex) {
3925
4216
  body.tool_choice = "auto";
3926
4217
  body.parallel_tool_calls = true;
@@ -3991,6 +4282,8 @@ Missing: ${missing.join("; ")}
3991
4282
  content: m.content.map((block) => {
3992
4283
  if (block.type === "text")
3993
4284
  return { type: "text", text: block.text };
4285
+ if (block.type === "image")
4286
+ return { type: "image", source: { type: "base64", media_type: block.mediaType, data: block.data } };
3994
4287
  if (block.type === "tool_use") {
3995
4288
  return { type: "tool_use", id: block.id, name: block.name, input: block.input };
3996
4289
  }
@@ -4169,6 +4462,14 @@ Missing: ${missing.join("; ")}
4169
4462
  };
4170
4463
  } catch (err) {
4171
4464
  clearTimeout(timer);
4465
+ if (err instanceof Error && isLocalAdmissionFailure(err.message))
4466
+ return {
4467
+ content: [],
4468
+ stopReason: "error",
4469
+ durationMs: Date.now() - start,
4470
+ error: err.message,
4471
+ ...call.operatorAborted() ? { cancelled: true } : {}
4472
+ };
4172
4473
  if (err instanceof OperatorAbortError || call.operatorAborted()) {
4173
4474
  return this.cancelledResult(start);
4174
4475
  }
@@ -4181,11 +4482,12 @@ Missing: ${missing.join("; ")}
4181
4482
  };
4182
4483
  }
4183
4484
  const msg = err instanceof Error ? err.message : String(err);
4184
- const timedOut = msg.includes("abort") || msg.includes("timeout");
4485
+ const timedOut = controller.signal.aborted || msg.includes("abort") || msg.includes("timeout");
4185
4486
  return {
4186
4487
  content: [{ type: "text", text: "" }],
4187
4488
  stopReason: "error",
4188
4489
  durationMs: Date.now() - start,
4490
+ ...timedOut ? { timedOut: true } : {},
4189
4491
  error: timedOut ? `${this.providerLabel} API request timed out` : `${this.providerLabel} API error: ${msg}`
4190
4492
  };
4191
4493
  } finally {
@@ -4202,6 +4504,17 @@ Missing: ${missing.join("; ")}
4202
4504
  error: `${this.providerLabel} API error: missing response body`
4203
4505
  };
4204
4506
  }
4507
+ let cancellationRequested = false;
4508
+ const cancelReader = () => {
4509
+ if (cancellationRequested)
4510
+ return;
4511
+ cancellationRequested = true;
4512
+ try {
4513
+ void reader.cancel().catch(() => {
4514
+ });
4515
+ } catch {
4516
+ }
4517
+ };
4205
4518
  const idleTimeoutMs = opts?.idleTimeoutMs ?? llmStreamIdleTimeoutMs();
4206
4519
  const eventIdleTimeoutMs = opts?.eventIdleTimeoutMs ?? llmStreamEventIdleTimeoutMs();
4207
4520
  let lastEventAt = Date.now();
@@ -4240,11 +4553,12 @@ Missing: ${missing.join("; ")}
4240
4553
  // for a body that is buffered, mocked, or already fully delivered.
4241
4554
  ...operatorSignal && detach ? [
4242
4555
  new Promise((_resolve, reject) => {
4556
+ const abortError = () => opts?.abort?.operatorAborted() ? new OperatorAbortError() : new DOMException("Request deadline aborted the stream", "AbortError");
4243
4557
  if (operatorSignal.aborted) {
4244
- reject(new OperatorAbortError());
4558
+ reject(abortError());
4245
4559
  return;
4246
4560
  }
4247
- operatorSignal.addEventListener("abort", () => reject(new OperatorAbortError()), { once: true, signal: detach.signal });
4561
+ operatorSignal.addEventListener("abort", () => reject(abortError()), { once: true, signal: detach.signal });
4248
4562
  })
4249
4563
  ] : []
4250
4564
  ]);
@@ -4295,17 +4609,11 @@ Missing: ${missing.join("; ")}
4295
4609
  chunk = await readBounded();
4296
4610
  } catch (err) {
4297
4611
  if (err instanceof OperatorAbortError || opts?.abort?.operatorAborted()) {
4298
- try {
4299
- await reader.cancel();
4300
- } catch {
4301
- }
4612
+ cancelReader();
4302
4613
  throw err instanceof OperatorAbortError ? err : new OperatorAbortError();
4303
4614
  }
4304
4615
  if (stalled) {
4305
- try {
4306
- await reader.cancel();
4307
- } catch {
4308
- }
4616
+ cancelReader();
4309
4617
  const secs = Math.round(stallIdleMs / 1e3);
4310
4618
  diag.warn("stream_stalled", `${this.providerLabel} stream stalled \u2014 no SSE events for ${secs}s (server hold; aborting call)`, {
4311
4619
  provider: this.providerLabel,
@@ -4319,6 +4627,7 @@ Missing: ${missing.join("; ")}
4319
4627
  error: `${this.providerLabel} stream stalled \u2014 no SSE events for ${secs}s (server accepted but held the stream; transient)`
4320
4628
  };
4321
4629
  }
4630
+ cancelReader();
4322
4631
  throw err;
4323
4632
  }
4324
4633
  const { done, value } = chunk;
@@ -4358,6 +4667,10 @@ Missing: ${missing.join("; ")}
4358
4667
  if (eventTypes.size < 32)
4359
4668
  eventTypes.add(identifier(type) ?? "unrecognized");
4360
4669
  const terminal = type === "response.completed" || this.provider === "openrouter" && type === "response.done";
4670
+ if (completedResponse && (type === "response.output_text.delta" || type === "response.content_part.delta" || type === "response.output_item.added" || type === "response.output_item.done" || type === "response.reasoning_summary_text.delta" || type === "response.reasoning_summary_text.done")) {
4671
+ streamFailure = { event: type, status: null, code: "output_after_completion", errorType: null, reason: null };
4672
+ break responses;
4673
+ }
4361
4674
  if (terminal || type === "response.failed" || type === "response.incomplete" || type === "error") {
4362
4675
  const response = event.response && typeof event.response === "object" && !Array.isArray(event.response) ? event.response : void 0;
4363
4676
  const usage = response?.usage;
@@ -4430,11 +4743,22 @@ Missing: ${missing.join("; ")}
4430
4743
  continue;
4431
4744
  }
4432
4745
  }
4746
+ if (completedResponse)
4747
+ break;
4433
4748
  }
4749
+ if (completedResponse || outputCapResponse || streamFailure)
4750
+ cancelReader();
4434
4751
  emitThinking(true);
4752
+ if (!outputCapResponse && opts?.abort?.operatorAborted()) {
4753
+ cancelReader();
4754
+ return { ...this.cancelledResult(start), ...responseUsage ? { usage: responseUsage } : {} };
4755
+ }
4756
+ if (opts?.abort?.signal.aborted && !opts.abort.operatorAborted()) {
4757
+ cancelReader();
4758
+ throw new DOMException("Request deadline aborted the stream", "AbortError");
4759
+ }
4435
4760
  if (outputCapResponse) {
4436
- void reader.cancel().catch(() => {
4437
- });
4761
+ cancelReader();
4438
4762
  const finalOutput = Array.isArray(outputCapResponse.output) ? outputCapResponse.output : [];
4439
4763
  const output = finalOutput.length > 0 ? finalOutput : streamedOutputItems;
4440
4764
  let finalText = "";
@@ -4474,8 +4798,7 @@ Missing: ${missing.join("; ")}
4474
4798
  }
4475
4799
  if (!completedResponse || streamFailure) {
4476
4800
  if (streamFailure) {
4477
- void reader.cancel().catch(() => {
4478
- });
4801
+ cancelReader();
4479
4802
  }
4480
4803
  appendNativeTrace({
4481
4804
  kind: "native-response-stream-error",
@@ -4558,6 +4881,12 @@ Missing: ${missing.join("; ")}
4558
4881
  thinkingText = reasoningSummaries.join("\n");
4559
4882
  emitThinking(true);
4560
4883
  }
4884
+ if (opts?.abort?.operatorAborted()) {
4885
+ return { ...this.cancelledResult(start), ...responseUsage ? { usage: responseUsage } : {} };
4886
+ }
4887
+ if (opts?.abort?.signal.aborted) {
4888
+ throw new DOMException("Request deadline aborted the stream", "AbortError");
4889
+ }
4561
4890
  return {
4562
4891
  content,
4563
4892
  stopReason: content.some((item) => item.type === "tool_use") ? "tool_use" : "end_turn",
@@ -4578,7 +4907,9 @@ Missing: ${missing.join("; ")}
4578
4907
  };
4579
4908
  }
4580
4909
  async isAvailable() {
4581
- if (this.workbenchProviderProxy)
4910
+ if (this.provider === "chatgpt-plan")
4911
+ return this.siwcConnection !== void 0;
4912
+ if (this.grantedProviderTransport || this.workbenchProviderProxy)
4582
4913
  return true;
4583
4914
  if (this.provider === "chatgpt-codex") {
4584
4915
  return this.codexAuthState !== void 0;
@@ -4588,6 +4919,10 @@ Missing: ${missing.join("; ")}
4588
4919
  };
4589
4920
 
4590
4921
  export {
4922
+ captureSiwcConnection,
4923
+ listSiwcModels,
4924
+ isLocalAdmissionLimit,
4925
+ isLocalAdmissionFailure,
4591
4926
  FEATURE_PRESETS,
4592
4927
  resolveFeaturePreset,
4593
4928
  applyFeaturePreset,