cf 0.5.0 → 0.7.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 (317) hide show
  1. package/dist/_meta/agent-context.json +78 -41
  2. package/dist/_meta/commands.json +19888 -21071
  3. package/dist/_meta/schemas.json +14305 -15328
  4. package/dist/abuse-reports-BsF9JZPW.mjs +8 -0
  5. package/dist/account-D8mYiWxQ.mjs +2 -0
  6. package/dist/accounts-CJci1Oez.mjs +23 -0
  7. package/dist/acm-CmCd985Q.mjs +3 -0
  8. package/dist/addressing-R7p6TRBe.mjs +12 -0
  9. package/dist/{agent-context-DMPfi54f.mjs → agent-context-Bzl5PGW-.mjs} +1 -1
  10. package/dist/ai-BzJg0RIX.mjs +3 -0
  11. package/dist/ai-audit-B0vJNOZG.mjs +2 -0
  12. package/dist/ai-gateway-D3vJR3My.mjs +10 -0
  13. package/dist/ai-search-CNg7W7U4.mjs +7 -0
  14. package/dist/alerting-_sdM0B0S.mjs +6 -0
  15. package/dist/alerts-dpT6Qsdu.mjs +2 -0
  16. package/dist/{analytics-DSSRDZz8.mjs → analytics-BFBJhDrP.mjs} +1 -1
  17. package/dist/analytics_engine-CWhFvyeK.mjs +2 -0
  18. package/dist/api-gateway-D4AIEtUq.mjs +33 -0
  19. package/dist/argo-Bjk6nFfs.mjs +2 -0
  20. package/dist/artifacts-Ba4b3iOa.mjs +4 -0
  21. package/dist/{audit-logs-BuExU_nz.mjs → audit-logs-BE0T5All.mjs} +1 -1
  22. package/dist/{auth-CSC4yhEJ.mjs → auth-CZ0E51rF.mjs} +3 -3
  23. package/dist/auth-D_zyQbDR.mjs +5 -0
  24. package/dist/autorag-Cnpp8PAG.mjs +2 -0
  25. package/dist/billing-Dz6Zj8Eq.mjs +2 -0
  26. package/dist/bot-management-pFwIbFi-.mjs +5 -0
  27. package/dist/botnet-feed-BY9uGChY.mjs +3 -0
  28. package/dist/brand-protection-DkPAk2Cz.mjs +3 -0
  29. package/dist/brands-CGpk9nZB.mjs +2 -0
  30. package/dist/browser-extension-D9P6Yv8i.mjs +3 -0
  31. package/dist/browser-run-DhHtz4y3.mjs +4 -0
  32. package/dist/build-CWuStmDi.mjs +2 -0
  33. package/dist/cache-DVhkiIGK.mjs +5 -0
  34. package/dist/calls-95zjvIcO.mjs +4 -0
  35. package/dist/certificate-authorities-BowBqbVq.mjs +2 -0
  36. package/dist/cf-BLT7uKJF.mjs +18 -0
  37. package/dist/chunk-2SIGYDH3-qXx_zE6v.mjs +397 -0
  38. package/dist/clear-DXx8WBAN.mjs +2 -0
  39. package/dist/client-certificates-D6mE4vJu.mjs +3 -0
  40. package/dist/cloud-connector-DmwsjeFN.mjs +2 -0
  41. package/dist/cloudforce-one-CG3TT7IN.mjs +23 -0
  42. package/dist/{completions-DOeHPdCG.mjs → completions-DMc_PlIw.mjs} +2 -2
  43. package/dist/connectivity-DJkE3crz.mjs +3 -0
  44. package/dist/connector-interrupts-DTgQ7onV.mjs +2 -0
  45. package/dist/connector-telemetry-events-D0rTHDou.mjs +2 -0
  46. package/dist/connector-telemetry-snapshots--0QmD3z6.mjs +2 -0
  47. package/dist/connectors-zWaZTi2A.mjs +3 -0
  48. package/dist/content-scanning-CGvGf04y.mjs +4 -0
  49. package/dist/ct-alerting-ebSPSWNC.mjs +3 -0
  50. package/dist/custom-certificates-CWUrPYLP.mjs +5 -0
  51. package/dist/custom-csrs-CRtdrF9R.mjs +4 -0
  52. package/dist/custom-hostnames-CVQSksqq.mjs +5 -0
  53. package/dist/custom-nameservers-BRwbIdsX.mjs +3 -0
  54. package/dist/custom-pages-Ci8sTQX7.mjs +4 -0
  55. package/dist/d1-78Ym1P6D.mjs +4 -0
  56. package/dist/data-security-zmFoMwRU.mjs +6 -0
  57. package/dist/{dcv-delegation-Bgf86J-r.mjs → dcv-delegation-Dd4FZ2IG.mjs} +1 -1
  58. package/dist/{deploy-dVrgDUOp.mjs → deploy-CVvkZFjR.mjs} +1 -1
  59. package/dist/{dev-C01_Lby6.mjs → dev-DSslyDXx.mjs} +1 -1
  60. package/dist/diagnostics-B8Ev5m_o.mjs +3 -0
  61. package/dist/dispatch-namespaces-Dm5vGeEP.mjs +7 -0
  62. package/dist/dist-B7hsuvbF.mjs +57 -0
  63. package/dist/dist-BH-4NQOV.mjs +134 -0
  64. package/dist/dns-D7VAaCyO.mjs +29 -0
  65. package/dist/dns-firewall-ByLCsf0q.mjs +57 -0
  66. package/dist/domain-info-CRvKc2Lg.mjs +2 -0
  67. package/dist/durable-objects-BIpvyu9m.mjs +2 -0
  68. package/dist/email-auth-Cx--s8W4.mjs +2 -0
  69. package/dist/email-routing-CiDbivcN.mjs +10 -0
  70. package/dist/email-security-BYeAuSc6.mjs +12 -0
  71. package/dist/email-sending-Dg2rSmHH.mjs +4 -0
  72. package/dist/filters-DZ8YnQ90.mjs +4 -0
  73. package/dist/firewall-DEd1hs_I.mjs +11 -0
  74. package/dist/flagship-DVw7xGoP.mjs +4 -0
  75. package/dist/{fraud-C03MtdZb.mjs → fraud-BbGS3FZs.mjs} +2 -2
  76. package/dist/google-tag-gateway-CBnRGYQR.mjs +2 -0
  77. package/dist/healthchecks-Da9N3ix4.mjs +4 -0
  78. package/dist/hostnames-mimZu2tB.mjs +3 -0
  79. package/dist/hyperdrive-BNdvxOos.mjs +21 -0
  80. package/dist/iam-DGQ-OgRl.mjs +6 -0
  81. package/dist/images-CI6Iy9ho.mjs +7 -0
  82. package/dist/index.mjs +1 -1
  83. package/dist/intel-BDB-aRtU.mjs +3 -0
  84. package/dist/internal-Czlp5Ekb.mjs +2 -0
  85. package/dist/{ips-nv9INuWZ.mjs → ips-B9UuPvsY.mjs} +1 -1
  86. package/dist/keyless-certificates-Ua9uJgPt.mjs +3 -0
  87. package/dist/kv-BHerx4dZ.mjs +5 -0
  88. package/dist/leaked-credential-checks-B8Vunj9h.mjs +3 -0
  89. package/dist/live-Ce7dZW7p.mjs +2 -0
  90. package/dist/load-balancers-DSjS5WKw.mjs +6 -0
  91. package/dist/logexplorer-DBIfTlRP.mjs +24 -0
  92. package/dist/logo-matches-C00iGpzW.mjs +2 -0
  93. package/dist/logos-CJLhx1go.mjs +3 -0
  94. package/dist/logpush-Cr1U-eK-.mjs +5 -0
  95. package/dist/logs-DMvtchc6.mjs +3 -0
  96. package/dist/magic-cloud-networking-FQfO8QWH.mjs +5 -0
  97. package/dist/magic-network-monitoring-CDd70fJQ.mjs +4 -0
  98. package/dist/magic-transit-DiKiPUax.mjs +110 -0
  99. package/dist/managed-transforms-fPVUTrAv.mjs +3 -0
  100. package/dist/matches-B0yHbQ2I.mjs +2 -0
  101. package/dist/moq-UgBawOXe.mjs +13 -0
  102. package/dist/mtls-certificates-xKUbC5EL.mjs +3 -0
  103. package/dist/network-interconnects-BJzOE2ny.mjs +41 -0
  104. package/dist/oauth-DBJ5GSFk.mjs +40 -0
  105. package/dist/observability-B-1y36QS.mjs +4 -0
  106. package/dist/organization-Dq3PClZ7.mjs +41 -0
  107. package/dist/organizations-AhsQkHyX.mjs +2 -0
  108. package/dist/origin-ca-certificates-CRgF0UyU.mjs +3 -0
  109. package/dist/origin-post-quantum-encryption-BXTx7DPa.mjs +2 -0
  110. package/dist/origin-tls-client-auth-BDw5q-6G.mjs +4 -0
  111. package/dist/{page-rules-EZHJePmn.mjs → page-rules-DqYQ23eg.mjs} +5 -5
  112. package/dist/{page-shield-CXJioWPs.mjs → page-shield-DKdlZOLO.mjs} +5 -5
  113. package/dist/pages-BsXF11Kv.mjs +11 -0
  114. package/dist/pay-per-crawl-BGAwuAP3.mjs +2 -0
  115. package/dist/pipelines-D_QhSnGW.mjs +6 -0
  116. package/dist/progress-O88q63Bk.mjs +2 -0
  117. package/dist/prompt-DTAWiEm2.mjs +3 -0
  118. package/dist/queries-CAE95-OH.mjs +3 -0
  119. package/dist/queues-BBz35Mqd.mjs +6 -0
  120. package/dist/r2-Zp99S5xF.mjs +21 -0
  121. package/dist/r2-data-catalog-BeVLZwrE.mjs +16 -0
  122. package/dist/radar-Cij-XVQJ.mjs +2 -0
  123. package/dist/rate-limit-analytics-CGviSPnJ.mjs +2 -0
  124. package/dist/rate-limits-DSdToIWv.mjs +5 -0
  125. package/dist/raw-fetch-DgezeshQ.mjs +2 -0
  126. package/dist/ready-DMpJvyaz.mjs +2 -0
  127. package/dist/realtime-kit-9rJcapfM.mjs +18 -0
  128. package/dist/recent-submissions-LS5IM-bm.mjs +2 -0
  129. package/dist/refute-BGTpr5sy.mjs +2 -0
  130. package/dist/registrar-CXViZlah.mjs +83 -0
  131. package/dist/registrar-sandbox-CvQyjXLJ.mjs +83 -0
  132. package/dist/request-tracers-DATfBnE9.mjs +2 -0
  133. package/dist/{resolve-C3h-mwp7.mjs → resolve-Bs2sMRYS.mjs} +1 -1
  134. package/dist/resource-sharing-Cmhn6ghR.mjs +3 -0
  135. package/dist/resource-tagging-BTn05AOj.mjs +16 -0
  136. package/dist/rules-ens3OHme.mjs +4 -0
  137. package/dist/rulesets-bkreZRao.mjs +8 -0
  138. package/dist/rum-CpgXFcwl.mjs +4 -0
  139. package/dist/scan-logo-DUDIZJ2A.mjs +2 -0
  140. package/dist/scan-page-BqoQTk3R.mjs +2 -0
  141. package/dist/{schema-BR31o4P6.mjs → schema-DCF4yEp_.mjs} +1 -1
  142. package/dist/schema-validation-Ca6o94ts.mjs +24 -0
  143. package/dist/scim-C4oT8TMc.mjs +4 -0
  144. package/dist/sdk-pQ5kaGUX.mjs +3 -0
  145. package/dist/search-C4T5riPh.mjs +2 -0
  146. package/dist/secrets-store-CWEuiDNo.mjs +7 -0
  147. package/dist/security-center-BOvm7xy6.mjs +2 -0
  148. package/dist/security-txt-BCAUBctN.mjs +3 -0
  149. package/dist/session-B1ARgLG7.mjs +2 -0
  150. package/dist/share-DhmVspmL.mjs +5 -0
  151. package/dist/shared-Bod3-Exx.mjs +990 -0
  152. package/dist/signed-url-DA509wgp.mjs +2 -0
  153. package/dist/smart-shield-DZm4fn6z.mjs +3 -0
  154. package/dist/snippets-oQ0u26-z.mjs +4 -0
  155. package/dist/{spawn-CCGzKlC4.mjs → spawn-ChG5Xi9Z.mjs} +1 -1
  156. package/dist/{spectrum-pVGxb7u5.mjs → spectrum-Cnkee5Ww.mjs} +6 -6
  157. package/dist/speed-DqNnvLBD.mjs +4 -0
  158. package/dist/{src-DU7FBCOX.mjs → src-By-zTCHz.mjs} +9 -9
  159. package/dist/ssl-tS3CYZsZ.mjs +15 -0
  160. package/dist/state-OsdDJvdj.mjs +2 -0
  161. package/dist/stream-Bud9Os5V.mjs +14 -0
  162. package/dist/submission-info-DfIXmu-M.mjs +2 -0
  163. package/dist/submit-BtP8she2.mjs +2 -0
  164. package/dist/tenant-CMwHa-tU.mjs +2 -0
  165. package/dist/token-validation-BYC7HTok.mjs +10 -0
  166. package/dist/{tools-D_hfUU_Z.mjs → tools-Dru4l8yh.mjs} +1 -1
  167. package/dist/total-queries-DdLBNJzd.mjs +2 -0
  168. package/dist/tracked-domains-BbaY-IuY.mjs +2 -0
  169. package/dist/turnstile-CP4nScaL.mjs +23 -0
  170. package/dist/{ui-erjBdVKL.mjs → ui-BNoF0KpD.mjs} +2 -2
  171. package/dist/url-info-Chs9h7Y-.mjs +2 -0
  172. package/dist/url-normalization-XYxW5Gj0.mjs +3 -0
  173. package/dist/url-scanner-D4pYNlO-.mjs +2 -0
  174. package/dist/user-DtefniLc.mjs +11 -0
  175. package/dist/vectorize-BeAY2g-7.mjs +4 -0
  176. package/dist/verify-D7J3F_NZ.mjs +2 -0
  177. package/dist/{versions-CBHwWPAM.mjs → versions-dMW3bLVv.mjs} +1 -1
  178. package/dist/waiting-rooms-K78HeeTg.mjs +11 -0
  179. package/dist/web3-Dhw79l4S.mjs +4 -0
  180. package/dist/workers-builds-CuOAB3u4.mjs +7 -0
  181. package/dist/workers-l3zMNOU6.mjs +20 -0
  182. package/dist/workflows-rb7RYBKP.mjs +6 -0
  183. package/dist/zaraz-CHecMYuo.mjs +2 -0
  184. package/dist/zero-trust-DAZoa-Aj.mjs +117 -0
  185. package/dist/zone-BnnqJwW-.mjs +2 -0
  186. package/dist/zones-DpI2YikF.mjs +21 -0
  187. package/package.json +3 -1
  188. package/dist/abuse-reports-Ina5TlsU.mjs +0 -8
  189. package/dist/accounts-B_joQcMi.mjs +0 -22
  190. package/dist/acm-_kIHqYME.mjs +0 -3
  191. package/dist/addressing-CaFlw8y1.mjs +0 -12
  192. package/dist/ai-CqnhNb_c.mjs +0 -2
  193. package/dist/ai-gateway-pgYGI519.mjs +0 -8
  194. package/dist/ai-search-eqQMPQol.mjs +0 -7
  195. package/dist/ai_gateway--vuVLnOm.mjs +0 -4
  196. package/dist/alerting-CPxHiYHb.mjs +0 -6
  197. package/dist/analytics_engine-gWyfnsCs.mjs +0 -2
  198. package/dist/api-gateway-BXXGFCVR.mjs +0 -33
  199. package/dist/argo-aC6A3JyX.mjs +0 -2
  200. package/dist/artifacts-HD4V2xpK.mjs +0 -4
  201. package/dist/auth-D5hNsOFq.mjs +0 -5
  202. package/dist/billing-COaghyxl.mjs +0 -2
  203. package/dist/bot-management-DmEzeV1Y.mjs +0 -5
  204. package/dist/botnet-feed-ByEAXAkw.mjs +0 -3
  205. package/dist/brand-protection-dPrGe8sL.mjs +0 -3
  206. package/dist/browser-rendering-BiSGnpBf.mjs +0 -4
  207. package/dist/build-HuS9-R0V.mjs +0 -1054
  208. package/dist/cache-CY-7Lt71.mjs +0 -5
  209. package/dist/calls-wOQGDWPl.mjs +0 -4
  210. package/dist/certificate-authorities-CtqzAtxQ.mjs +0 -2
  211. package/dist/client-certificates-CRf41xLe.mjs +0 -3
  212. package/dist/cloud-connector-BA5IRZUP.mjs +0 -2
  213. package/dist/cloudforce-one-Bq_qPAWs.mjs +0 -21
  214. package/dist/config-B5k-XbwS.mjs +0 -2
  215. package/dist/connectivity-Bx3MgTHX.mjs +0 -3
  216. package/dist/connector-interrupts-D7ylweJZ.mjs +0 -2
  217. package/dist/connector-telemetry-events-6izV1kbP.mjs +0 -2
  218. package/dist/connector-telemetry-snapshots-BnjKbyxX.mjs +0 -2
  219. package/dist/connectors-DRt4e6d_.mjs +0 -3
  220. package/dist/content-scanning-Cd2vy5Sz.mjs +0 -4
  221. package/dist/context-jpewmual.mjs +0 -2
  222. package/dist/custom-certificates-DYE-9epx.mjs +0 -5
  223. package/dist/custom-hostnames-CtuTdFcX.mjs +0 -5
  224. package/dist/custom-nameservers-CWqA51in.mjs +0 -3
  225. package/dist/custom-pages-DeUKEFGe.mjs +0 -4
  226. package/dist/d1-DvWY9Gp4.mjs +0 -4
  227. package/dist/data-security-BPo6dIWu.mjs +0 -6
  228. package/dist/diagnostics-6nKPmVgz.mjs +0 -3
  229. package/dist/dispatch-namespaces-64lXx2WJ.mjs +0 -7
  230. package/dist/dist-C6zxsVdY.mjs +0 -306
  231. package/dist/dist-t_YrL25p.mjs +0 -82
  232. package/dist/dns-ClciFGxx.mjs +0 -29
  233. package/dist/dns-firewall-DfUmXDCe.mjs +0 -57
  234. package/dist/durable-objects-CMaYZ-YU.mjs +0 -2
  235. package/dist/email-routing-CGXhFqF5.mjs +0 -10
  236. package/dist/email-security-D5viPq8S.mjs +0 -8
  237. package/dist/email-sending-C2jpc3gh.mjs +0 -3
  238. package/dist/filters-bzsFcWt0.mjs +0 -4
  239. package/dist/firewall-DYZcTtIC.mjs +0 -11
  240. package/dist/google-tag-gateway-Dfy887yA.mjs +0 -2
  241. package/dist/healthchecks-DRoAlWgr.mjs +0 -4
  242. package/dist/hostnames-CFgIVI3s.mjs +0 -3
  243. package/dist/hyperdrive-C7-gwTSV.mjs +0 -18
  244. package/dist/iam-DqVPzGrb.mjs +0 -6
  245. package/dist/images-BYfl4YgR.mjs +0 -7
  246. package/dist/intel-duTEPIHc.mjs +0 -3
  247. package/dist/keyless-certificates-CRCDVd3g.mjs +0 -3
  248. package/dist/kv-CZoV4tiv.mjs +0 -5
  249. package/dist/leaked-credential-checks-DNIBg7Pe.mjs +0 -3
  250. package/dist/load-balancers--OMg0HNt.mjs +0 -6
  251. package/dist/logpush-C0_lZTyY.mjs +0 -4
  252. package/dist/logs-BtpWZQfV.mjs +0 -3
  253. package/dist/magic-cloud-networking-u6rwYbGg.mjs +0 -5
  254. package/dist/magic-network-monitoring-CKgQyRj4.mjs +0 -4
  255. package/dist/magic-transit-CLhMcJ_-.mjs +0 -89
  256. package/dist/managed-transforms-D0Z2mlth.mjs +0 -3
  257. package/dist/mtls-certificates-BL65NK5T.mjs +0 -3
  258. package/dist/network-interconnects-Bgu9gmaG.mjs +0 -36
  259. package/dist/oauth-Bk-F-tIO.mjs +0 -52
  260. package/dist/observability-BynRbTF4.mjs +0 -4
  261. package/dist/organizations-BqJHyvMK.mjs +0 -41
  262. package/dist/origin-ca-certificates-BGvYwm3C.mjs +0 -3
  263. package/dist/origin-post-quantum-encryption-9KOE8YPI.mjs +0 -2
  264. package/dist/origin-tls-client-auth-d3snC3vr.mjs +0 -4
  265. package/dist/pages-D4aYteKk.mjs +0 -11
  266. package/dist/pipelines-G8Iusxq-.mjs +0 -6
  267. package/dist/progress-DrDErV9w.mjs +0 -2
  268. package/dist/queues-DEkbKqZX.mjs +0 -6
  269. package/dist/r2-CV0IkCAW.mjs +0 -21
  270. package/dist/r2-data-catalog-NtqGC_a_.mjs +0 -14
  271. package/dist/radar-D986zPJr.mjs +0 -2
  272. package/dist/rate-limits-B2wRsUX1.mjs +0 -5
  273. package/dist/raw-fetch-_n0lMAnD.mjs +0 -2
  274. package/dist/realtime-kit-Ld3c5eU6.mjs +0 -18
  275. package/dist/registrar-CDIwTz3G.mjs +0 -46
  276. package/dist/request-tracers-D7SFMDik.mjs +0 -2
  277. package/dist/resource-sharing-YIQ04jXE.mjs +0 -5
  278. package/dist/resource-tagging-Bd6Y03sg.mjs +0 -16
  279. package/dist/rules-DHjLP5Kx.mjs +0 -4
  280. package/dist/rulesets-q4QABpKs.mjs +0 -8
  281. package/dist/rum-SmT4HZmM.mjs +0 -4
  282. package/dist/schema-validation-vVetgC_P.mjs +0 -24
  283. package/dist/scim-ChOkZpNx.mjs +0 -3
  284. package/dist/sdk-DhIhH6GB.mjs +0 -5
  285. package/dist/secrets-store-BAK9G12O.mjs +0 -25
  286. package/dist/security-center-eScuYDKP.mjs +0 -2
  287. package/dist/security-txt-x7R4gmQu.mjs +0 -3
  288. package/dist/session-DHYCE-PM.mjs +0 -93
  289. package/dist/shared-BAjo72Lz.mjs +0 -2
  290. package/dist/smart-shield-CWlSsNi8.mjs +0 -3
  291. package/dist/snippets-DrlgYJYp.mjs +0 -4
  292. package/dist/speed-ZFrMWDgd.mjs +0 -4
  293. package/dist/ssl-9JY05sYt.mjs +0 -15
  294. package/dist/stream-tRU39b8K.mjs +0 -14
  295. package/dist/tenants-HLGUazms.mjs +0 -2
  296. package/dist/token-validation-_VdamKpz.mjs +0 -10
  297. package/dist/turnstile-BRzXd28B.mjs +0 -23
  298. package/dist/url-normalization-D-NxuLtN.mjs +0 -3
  299. package/dist/url-scanner-BzzR6iDx.mjs +0 -2
  300. package/dist/user-C4omq__w.mjs +0 -10
  301. package/dist/vectorize-By6EqcNR.mjs +0 -4
  302. package/dist/waiting-rooms-u6KwrzWd.mjs +0 -11
  303. package/dist/web3-DQ5dmE9W.mjs +0 -4
  304. package/dist/workers-D8Be7_as.mjs +0 -18
  305. package/dist/workers-builds-BE3W3qNk.mjs +0 -7
  306. package/dist/workflows-BWWufqFA.mjs +0 -4
  307. package/dist/zaraz-Bsa9AvVL.mjs +0 -2
  308. package/dist/zero-trust-UNVZFnKu.mjs +0 -118
  309. package/dist/zero_trust-B0_Rk4p2.mjs +0 -3
  310. package/dist/zones-BXtdwt6E.mjs +0 -21
  311. /package/dist/{body-parser-DWSy7uZ8.mjs → body-parser-BO6mfo_W.mjs} +0 -0
  312. /package/dist/{cli-types-BeyOc81z.mjs → cli-types-CFw6Xygp.mjs} +0 -0
  313. /package/dist/{input-validation-_fMCApaH.mjs → input-validation-BwUR9z8e.mjs} +0 -0
  314. /package/dist/{lib-4PQI6yRW.mjs → lib-Og5sB51C.mjs} +0 -0
  315. /package/dist/{local-CYc9q7l2.mjs → local-C6TLPAT6.mjs} +0 -0
  316. /package/dist/{metadata-OOwvpR8m.mjs → metadata-Cnyws6iO.mjs} +0 -0
  317. /package/dist/{open-YWOUIZ5Y-3jqSKAB1.mjs → open-YWOUIZ5Y-CFRcYALi.mjs} +0 -0
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{i as n,n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./body-parser-BO6mfo_W.mjs";import{n as u}from"./input-validation-BwUR9z8e.mjs";import{n as d,r as f,t as p}from"./prompt-DTAWiEm2.mjs";import{t as m}from"./cli-types-CFw6Xygp.mjs";function ee(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`credit_balance`,describe:`Retrieve the current credit balance, payment method info, and top-up configuration.`,builder:ee,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing credit_balance`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/credit-balance`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.billing.creditBalance({account_id:l})),{successLabel:`Loaded`})}};function h(e){return e.option(`type`,{type:`string`,description:`Filter invoice type: auto, manual, or all.`,choices:[`auto`,`all`,`manual`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`invoice_history`,describe:`Retrieve a list of past invoices with pagination, optionally filtered by type.`,builder:m(h),handler:async n=>{let c={type:n.type};if(n.dryRun){a({command:`cf ai-gateway billing invoice_history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/invoice-history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.billing.invoiceHistory({account_id:u,...c})),{successLabel:`Loaded`})}};function _(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`invoice_preview`,describe:`Retrieve a preview of the upcoming invoice including line items and tax.`,builder:_,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing invoice_preview`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/invoice-preview`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.billing.invoicePreview({account_id:l})),{successLabel:`Loaded`})}};function y(e){return e.option(`amount`,{type:`number`,description:`Spending limit amount in cents (min 100).`}).option(`duration`,{type:`string`,description:`Spending limit duration.`,choices:[`daily`,`weekly`,`monthly`]}).option(`strategy`,{type:`string`,description:`Spending limit strategy.`,choices:[`fixed`,`sliding`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`Deprecated: spending limits can no longer be created, enabled, or modified and this endpoint always responds 403. Use the new AI Gateway spend limits instead: https://developers.cloudflare.com/ai-gateway/features/spend-limits/. Existing limits can be removed via DELETE /spending-limit.`,builder:y,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing spending_limit create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({amount:n.amount,duration:u(n.duration,`duration`,`text`),strategy:u(n.strategy,`strategy`,`text`)}):c(n.body)});return}let f=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>f.aiGateway.billing.spendingLimit.create({...e,account_id:p})),{successLabel:`Created`});return}if(n.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);n.duration===void 0&&(n.duration=await d(`duration`,`Spending limit duration.`,[`daily`,`weekly`,`monthly`])),n.strategy===void 0&&(n.strategy=await d(`strategy`,`Spending limit strategy.`,[`fixed`,`sliding`]));let m=l({amount:n.amount,duration:u(n.duration,`duration`,`text`),strategy:u(n.strategy,`strategy`,`text`)});i(await o(`Creating`,async()=>f.aiGateway.billing.spendingLimit.create({...m,account_id:p})),{successLabel:`Created`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete`,describe:`Remove the spending limit for the account.`,builder:x,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing spending_limit delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.billing.spendingLimit.delete({account_id:l})),{successLabel:`Deleted`})}};function C(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get`,describe:`Retrieve the current spending limit configuration for the account.`,builder:C,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing spending_limit get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.billing.spendingLimit.get({account_id:l})),{successLabel:`Loaded`})}},T={command:`spending_limit`,describe:`Operations for billing.spending_limit`,builder:e=>e.command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`amount`,{type:`number`,description:`Auto top-up amount in cents (min 1000).`}).option(`threshold`,{type:`number`,description:`Balance threshold in cents that triggers auto top-up (min 500).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`create`,describe:`Configure auto top-up with a balance threshold and top-up amount.`,builder:E,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing topup config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({amount:n.amount,threshold:n.threshold}):c(n.body)});return}let u=await r(n),d=n.local?s:await t();if(n.accountId=d,n.body){let e=c(n.body);i(await o(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...e,account_id:d})),{successLabel:`Created`});return}if(n.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);if(n.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let f=l({amount:n.amount,threshold:n.threshold});i(await o(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...f,account_id:d})),{successLabel:`Created`})}};function O(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const k={command:`delete`,describe:`Remove the auto top-up configuration for the account.`,builder:O,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing topup config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.billing.topup.config.delete({account_id:l})),{successLabel:`Deleted`})}};function A(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get`,describe:`Retrieve the current auto top-up threshold, amount, and any error state.`,builder:A,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing topup config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.billing.topup.config.get({account_id:l})),{successLabel:`Loaded`})}},M={command:`config`,describe:`Operations for billing.topup.config`,builder:e=>e.command(D).command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`amount`,{type:`number`,description:`Top-up amount in cents (min 1000).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`create`,describe:`Create a credit top-up for the given account, charged to the account's default payment method.`,builder:N,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing topup create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/topup`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({amount:n.amount}):c(n.body)});return}let u=await r(n),d=n.local?s:await t();if(n.accountId=d,n.body){let e=c(n.body);i(await o(`Creating`,async()=>u.aiGateway.billing.topup.create({...e,account_id:d})),{successLabel:`Created`});return}if(n.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);let f=l({amount:n.amount});i(await o(`Creating`,async()=>u.aiGateway.billing.topup.create({...f,account_id:d})),{successLabel:`Created`})}};function F(e){return e.option(`payment-intent-id`,{type:`string`,description:`Stripe invoice ID to check status for.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`status`,describe:`Get the payment processing status of a top-up by its invoice ID.`,builder:F,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway billing topup status`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/topup/status`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({payment_intent_id:u(n[`payment-intent-id`],`payment-intent-id`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.billing.topup.status({...e,account_id:p})),{successLabel:`Created`});return}n[`payment-intent-id`]===void 0&&(n[`payment-intent-id`]=await f(`payment-intent-id`,`Stripe invoice ID to check status for.`));let m=l({payment_intent_id:u(n[`payment-intent-id`],`payment-intent-id`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.billing.topup.status({...m,account_id:p})),{successLabel:`Created`})}},L={command:`topup`,describe:`Operations for billing.topup`,builder:e=>e.command(P).command(I).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function R(e){return e.option(`value-grouping-window`,{type:`string`,description:`Grouping window for usage data.`,choices:[`day`,`hour`],demandOption:!0}).option(`start-time`,{type:`number`,description:`Start time as Unix timestamp in milliseconds.`}).option(`end-time`,{type:`number`,description:`End time as Unix timestamp in milliseconds.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`usage_history`,describe:`Retrieve aggregated usage meter event summaries for the given time range.`,builder:m(R),handler:async n=>{let c={value_grouping_window:n[`value-grouping-window`],start_time:n[`start-time`],end_time:n[`end-time`]};if(n.dryRun){a({command:`cf ai-gateway billing usage_history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/billing/usage-history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.billing.usageHistory({account_id:u,...c})),{successLabel:`Loaded`})}},B={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(te).command(g).command(v).command(z).command(T).command(L).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`id`,{type:`string`,description:`gateway id`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`],default:`postpaid`}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const H={command:`create`,describe:`Creates a new AI Gateway.`,builder:V,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({authentication:n.authentication,cache_invalidate_on_update:n[`cache-invalidate-on-update`],cache_ttl:n[`cache-ttl`],collect_logs:n[`collect-logs`],id:u(n.id,`id`,`text`),log_management:n[`log-management`],log_management_strategy:u(n[`log-management-strategy`],`log-management-strategy`,`text`),logpush:n.logpush,logpush_public_key:u(n[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:n[`rate-limiting-interval`],rate_limiting_limit:n[`rate-limiting-limit`],rate_limiting_technique:u(n[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(n[`retry-backoff`],`retry-backoff`,`text`),retry_delay:n[`retry-delay`],retry_max_attempts:n[`retry-max-attempts`],store_id:u(n[`store-id`],`store-id`,`text`),workers_ai_billing_mode:u(n[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:n.zdr}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.create({...e,account_id:p})),{successLabel:`Created`});return}if(n[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(n[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(n[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(n.id===void 0&&(n.id=await f(`id`,`gateway id`)),n[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(n[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let m=l({authentication:n.authentication,cache_invalidate_on_update:n[`cache-invalidate-on-update`],cache_ttl:n[`cache-ttl`],collect_logs:n[`collect-logs`],id:u(n.id,`id`,`text`),log_management:n[`log-management`],log_management_strategy:u(n[`log-management-strategy`],`log-management-strategy`,`text`),logpush:n.logpush,logpush_public_key:u(n[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:n[`rate-limiting-interval`],rate_limiting_limit:n[`rate-limiting-limit`],rate_limiting_technique:u(n[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(n[`retry-backoff`],`retry-backoff`,`text`),retry_delay:n[`retry-delay`],retry_max_attempts:n[`retry-max-attempts`],store_id:u(n[`store-id`],`store-id`,`text`),workers_ai_billing_mode:u(n[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:n.zdr});i(await o(`Creating`,async()=>d.aiGateway.create({...m,account_id:p})),{successLabel:`Created`})}};function U(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:U,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({enable:n.enable,name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.datasets.create({...e,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`});return}if(n.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await f(`name`,`The name field`));let m=l({enable:n.enable,name:u(n.name,`name`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.datasets.create({...m,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`})}};function G(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:G,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway datasets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/datasets/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
5
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.datasets.delete({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Deleted`})}};function q(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:q,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/datasets/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.datasets.get({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function Y(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`search`,{type:`string`,description:`Search by id, name, filters`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:Y,handler:async n=>{let c={page:n.page,per_page:n[`per-page`],name:n.name,enable:n.enable,search:n.search};if(n.dryRun){a({command:`cf ai-gateway datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.datasets.list({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Q={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:Z,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway datasets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/datasets/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({enable:n.enable,name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiGateway.datasets.update({...e,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`});return}if(n.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await f(`name`,`The name field`));let m=l({enable:n.enable,name:u(n.name,`name`,`text`)});i(await o(`Updating`,async()=>d.aiGateway.datasets.update({...m,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`})}},ne={command:`datasets`,describe:`Curated collections of gateway logs used as inputs for evaluations and fine-tuning`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ie={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:re,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
6
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.delete({account_id:l,id:n.id})),{successLabel:`Deleted`})}};function ae(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`version-id`,{type:`string`,description:`The version_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`create-deployment <id>`,describe:`Create a new AI Gateway Dynamic Route Deployment.`,builder:ae,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing create-deployment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/deployments`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({version_id:u(n[`version-id`],`version-id`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.dynamicRouting.createDeployment({...e,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Created`});return}n[`version-id`]===void 0&&(n[`version-id`]=await f(`version-id`,`The version_id field`));let m=l({version_id:u(n[`version-id`],`version-id`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.dynamicRouting.createDeployment({...m,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Created`})}};function se(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`create-version <id>`,describe:`Create a new AI Gateway Dynamic Route Version.`,builder:se,handler:async l=>{if(l.dryRun){a({command:`cf ai-gateway dynamic-routing create-version`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${l[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(l[`gateway-id`]))}/routes/${l.id==null?`<id>`:encodeURIComponent(String(l.id))}/versions`,pathParams:{"gateway-id":String(l[`gateway-id`]??``),id:String(l.id??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await r(l),d=l.local?s:await t();if(l.accountId=d,l.body){let e=c(l.body);i(await o(`Creating`,async()=>u.aiGateway.dynamicRouting.createVersion({...e,account_id:d,gateway_id:l[`gateway-id`],id:l.id})),{successLabel:`Created`});return}i(await o(`Creating`,async()=>n(u,`POST`,`/accounts/${d}/ai-gateway/gateways/${encodeURIComponent(String(l[`gateway-id`]))}/routes/${encodeURIComponent(String(l.id))}/versions`)),{successLabel:`Created`})}};function le(e){return e.positional(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`create <gateway-id>`,describe:`Create a new AI Gateway Dynamic Route.`,builder:le,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.dynamicRouting.create({...e,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`});return}n.name===void 0&&(n.name=await f(`name`,`The name field`));let m=l({name:u(n.name,`name`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.dynamicRouting.create({...m,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`})}};function de(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const fe={command:`delete <id>`,describe:`Delete an AI Gateway Dynamic Route.`,builder:de,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
7
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.dynamicRouting.delete({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Deleted`})}};function pe(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`get-version <version-id>`,describe:`Get an AI Gateway Dynamic Route Version.`,builder:pe,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing get-version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/versions/${n[`version-id`]==null?`<version-id>`:encodeURIComponent(String(n[`version-id`]))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``),"version-id":String(n[`version-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.dynamicRouting.getVersion({account_id:l,gateway_id:n[`gateway-id`],id:n.id,version_id:n[`version-id`]})),{successLabel:`Loaded`})}};function he(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <id>`,describe:`Get an AI Gateway Dynamic Route.`,builder:he,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.dynamicRouting.get({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function _e(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list-deployments <id>`,describe:`List all AI Gateway Dynamic Route Deployments.`,builder:_e,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing list-deployments`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/deployments`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.dynamicRouting.listDeployments({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function ye(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`list-versions <id>`,describe:`List all AI Gateway Dynamic Route Versions.`,builder:ye,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing list-versions`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/versions`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.dynamicRouting.listVersions({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function xe(e){return e.option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of routes per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Se={command:`list`,describe:`List all AI Gateway Dynamic Routes.`,builder:xe,handler:async n=>{let c={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf ai-gateway dynamic-routing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.dynamicRouting.list({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Loaded`})}};function Ce(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const we={command:`update <id>`,describe:`Update an AI Gateway Dynamic Route.`,builder:Ce,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway dynamic-routing update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/routes/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiGateway.dynamicRouting.update({...e,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`});return}n.name===void 0&&(n.name=await f(`name`,`The name field`));let m=l({name:u(n.name,`name`,`text`)});i(await o(`Updating`,async()=>d.aiGateway.dynamicRouting.update({...m,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`})}},Te={command:`dynamic-routing`,describe:`Operations for dynamic-routing`,builder:e=>e.command(ue).command(oe).command(ce).command(fe).command(ge).command(me).command(Se).command(ve).command(be).command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`Lists all available evaluator types for scoring AI gateway responses.`,builder:m(Ee),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],order_by:n[`order-by`],order_by_direction:n[`order-by-direction`]};if(n.dryRun){a({command:`cf ai-gateway evaluation-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/evaluation-types`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.evaluationTypes.list({account_id:u,...c})),{successLabel:`Loaded`})}},Oe={command:`evaluation-types`,describe:`Operations for evaluation-types`,builder:e=>e.command(De).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dataset-ids`,{type:`string`,array:!0,description:`The dataset_ids field`}).option(`evaluation-type-ids`,{type:`string`,array:!0,description:`The evaluation_type_ids field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ae={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:ke,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway evaluations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({dataset_ids:n[`dataset-ids`],evaluation_type_ids:n[`evaluation-type-ids`],name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.evaluations.create({...e,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`});return}if(n[`dataset-ids`]===void 0)throw Error(`--dataset-ids is required (or pass --body with this field set).`);if(n[`evaluation-type-ids`]===void 0)throw Error(`--evaluation-type-ids is required (or pass --body with this field set).`);n.name===void 0&&(n.name=await f(`name`,`The name field`));let m=l({dataset_ids:n[`dataset-ids`],evaluation_type_ids:n[`evaluation-type-ids`],name:u(n.name,`name`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.evaluations.create({...m,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`})}};function je(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Me={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:je,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway evaluations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/evaluations/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
8
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.evaluations.delete({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Deleted`})}};function Ne(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:Ne,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway evaluations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/evaluations/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.evaluations.get({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function Fe(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`processed`,{type:`boolean`,description:`Processed`}).option(`search`,{type:`string`,description:`Search by id, name`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:Fe,handler:async n=>{let c={page:n.page,per_page:n[`per-page`],name:n.name,processed:n.processed,search:n.search};if(n.dryRun){a({command:`cf ai-gateway evaluations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.evaluations.list({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Loaded`})}},Le={command:`evaluations`,describe:`Run quality evaluations against gateway logs or datasets to score model outputs`,builder:e=>e.command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ze={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:Re,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.get({account_id:l,id:n.id})),{successLabel:`Loaded`})}};function Be(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search by id`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ve={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:Be,handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search};if(n.dryRun){a({command:`cf ai-gateway list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.list({account_id:u,...c})),{successLabel:`Loaded`})}};function He(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`,`cost`,`tokens_in`,`tokens_out`,`duration`,`feedback`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ue={command:`delete <gateway-id>`,describe:`Deletes gateway log entries matching the specified criteria.`,builder:m(He),handler:async n=>{let c={order_by:n[`order-by`],order_by_direction:n[`order-by-direction`],filters:n.filters,limit:n.limit};if(n.dryRun){a({command:`cf ai-gateway logs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();if(n.accountId=u,!await p({force:!!n.force})){process.stderr.write(`Aborted.
9
+ `);return}i(await o(`Deleting`,async()=>l.aiGateway.logs.delete({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Deleted`})}};function We(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`feedback`,{type:`number`,description:`The feedback field`}).option(`score`,{type:`number`,description:`The score field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ge={command:`edit <id>`,describe:`Updates metadata for an AI Gateway log entry.`,builder:We,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway logs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``),"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({feedback:n.feedback,score:n.score}):c(n.body)});return}let u=await r(n),d=n.local?s:await t();if(n.accountId=d,n.body){let e=c(n.body);i(await o(`Updating`,async()=>u.aiGateway.logs.edit({...e,account_id:d,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`});return}let f=l({feedback:n.feedback,score:n.score});i(await o(`Updating`,async()=>u.aiGateway.logs.edit({...f,account_id:d,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`})}};function Ke(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qe={command:`get <id>`,describe:`Retrieves detailed information for a specific AI Gateway log entry.`,builder:Ke,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``),"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.logs.get({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function Je(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`meta-info`,{type:`boolean`,description:`Meta info`}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`start-date`,{type:`string`,description:`Start date`}).option(`end-date`,{type:`string`,description:`End date`}).option(`min-cost`,{type:`number`,description:`Min cost`}).option(`max-cost`,{type:`number`,description:`Max cost`}).option(`min-tokens-in`,{type:`number`,description:`Min tokens in`}).option(`max-tokens-in`,{type:`number`,description:`Max tokens in`}).option(`min-tokens-out`,{type:`number`,description:`Min tokens out`}).option(`max-tokens-out`,{type:`number`,description:`Max tokens out`}).option(`min-total-tokens`,{type:`number`,description:`Min total tokens`}).option(`max-total-tokens`,{type:`number`,description:`Max total tokens`}).option(`min-duration`,{type:`number`,description:`Min duration`}).option(`max-duration`,{type:`number`,description:`Max duration`}).option(`feedback`,{type:`string`,description:`Feedback`,choices:[`-1`]}).option(`success`,{type:`boolean`,description:`Success`}).option(`cached`,{type:`boolean`,description:`Cached`}).option(`model`,{type:`string`,description:`Model`}).option(`model-type`,{type:`string`,description:`Model type`}).option(`provider`,{type:`string`,description:`Provider`}).option(`request-content-type`,{type:`string`,description:`Request content type`}).option(`response-content-type`,{type:`string`,description:`Response content type`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`list`,describe:`Lists request/response log entries for the AI gateway with filtering and pagination.`,builder:m(Je),handler:async n=>{let c={search:n.search,page:n.page,per_page:n[`per-page`],order_by:n[`order-by`],order_by_direction:n[`order-by-direction`],filters:n.filters,meta_info:n[`meta-info`],direction:n.direction,start_date:n[`start-date`],end_date:n[`end-date`],min_cost:n[`min-cost`],max_cost:n[`max-cost`],min_tokens_in:n[`min-tokens-in`],max_tokens_in:n[`max-tokens-in`],min_tokens_out:n[`min-tokens-out`],max_tokens_out:n[`max-tokens-out`],min_total_tokens:n[`min-total-tokens`],max_total_tokens:n[`max-total-tokens`],min_duration:n[`min-duration`],max_duration:n[`max-duration`],feedback:n.feedback,success:n.success,cached:n.cached,model:n.model,model_type:n[`model-type`],provider:n.provider,request_content_type:n[`request-content-type`],response_content_type:n[`response-content-type`]};if(n.dryRun){a({command:`cf ai-gateway logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.logs.list({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Loaded`})}};function Xe(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`request <id>`,describe:`Retrieves the original request payload for an AI Gateway log entry.`,builder:Xe,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway logs request`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/request`,pathParams:{id:String(n.id??``),"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.logs.request({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}};function Qe(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $e={command:`response <id>`,describe:`Retrieves the response payload for an AI Gateway log entry.`,builder:Qe,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway logs response`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/logs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/response`,pathParams:{id:String(n.id??``),"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.logs.response({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Loaded`})}},et={command:`logs`,describe:`Operations for logs`,builder:e=>e.command(Ue).command(Ge).command(qe).command(Ye).command(Ze).command($e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tt(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`alias`,{type:`string`,description:`The alias field`}).option(`default-config`,{type:`boolean`,description:`The default_config field`}).option(`provider-slug`,{type:`string`,description:`The provider_slug field`}).option(`rate-limit`,{type:`number`,description:`The rate_limit field`}).option(`rate-limit-period`,{type:`number`,description:`The rate_limit_period field`,default:60}).option(`secret`,{type:`string`,description:`The secret field`}).option(`secret-id`,{type:`string`,description:`The secret_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:tt,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway provider-configs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},bodyKind:`json`,body:n.body===void 0?l({alias:u(n.alias,`alias`,`text`),default_config:n[`default-config`],provider_slug:u(n[`provider-slug`],`provider-slug`,`text`),rate_limit:n[`rate-limit`],rate_limit_period:n[`rate-limit-period`],secret:u(n.secret,`secret`,`text`),secret_id:u(n[`secret-id`],`secret-id`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiGateway.providerConfigs.create({...e,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`});return}if(n.alias===void 0&&(n.alias=await f(`alias`,`The alias field`)),n[`default-config`]===void 0)throw Error(`--default-config is required (or pass --body with this field set).`);n[`provider-slug`]===void 0&&(n[`provider-slug`]=await f(`provider-slug`,`The provider_slug field`));let m=l({alias:u(n.alias,`alias`,`text`),default_config:n[`default-config`],provider_slug:u(n[`provider-slug`],`provider-slug`,`text`),rate_limit:n[`rate-limit`],rate_limit_period:n[`rate-limit-period`],secret:u(n.secret,`secret`,`text`),secret_id:u(n[`secret-id`],`secret-id`,`text`)});i(await o(`Creating`,async()=>d.aiGateway.providerConfigs.create({...m,account_id:p,gateway_id:n[`gateway-id`]})),{successLabel:`Created`})}};function nt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const rt={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:nt,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway provider-configs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/provider_configs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await p({force:!!n.force})){process.stderr.write(`Aborted.
10
+ `);return}i(await o(`Deleting`,async()=>c.aiGateway.providerConfigs.delete({account_id:l,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Deleted`})}};function it(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const at={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:it,handler:async n=>{let c={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf ai-gateway provider-configs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(n[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiGateway.providerConfigs.list({account_id:u,gateway_id:n[`gateway-id`],...c})),{successLabel:`Loaded`})}};function ot(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`secret`,{type:`string`,description:`The secret field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const st={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:ot,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway provider-configs update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/provider_configs/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({secret:u(n.secret,`secret`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiGateway.providerConfigs.update({...e,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`});return}n.secret===void 0&&(n.secret=await f(`secret`,`The secret field`));let m=l({secret:u(n.secret,`secret`,`text`)});i(await o(`Updating`,async()=>d.aiGateway.providerConfigs.update({...m,account_id:p,gateway_id:n[`gateway-id`],id:n.id})),{successLabel:`Updated`})}},ct={command:`provider-configs`,describe:`Store API keys and endpoint settings for each upstream AI provider`,builder:e=>e.command($).command(rt).command(at).command(st).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function lt(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`]}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const ut={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:lt,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({authentication:n.authentication,cache_invalidate_on_update:n[`cache-invalidate-on-update`],cache_ttl:n[`cache-ttl`],collect_logs:n[`collect-logs`],guardrails:{prompt:{P1:u(n[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:u(n[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:u(n[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:u(n[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:u(n[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:u(n[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:u(n[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:u(n[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:u(n[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:u(n[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:u(n[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:u(n[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:u(n[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:u(n[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:u(n[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:u(n[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:u(n[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:u(n[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:u(n[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:u(n[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:u(n[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:u(n[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:u(n[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:u(n[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:u(n[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:u(n[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:u(n[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:u(n[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:n[`log-classification`],log_management:n[`log-management`],log_management_strategy:u(n[`log-management-strategy`],`log-management-strategy`,`text`),logpush:n.logpush,logpush_public_key:u(n[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:n[`rate-limiting-interval`],rate_limiting_limit:n[`rate-limiting-limit`],rate_limiting_technique:u(n[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(n[`retry-backoff`],`retry-backoff`,`text`),retry_delay:n[`retry-delay`],retry_max_attempts:n[`retry-max-attempts`],spend_limits:{enabled:n[`spend-limits-enabled`]},store_id:u(n[`store-id`],`store-id`,`text`),stripe:{authorization:u(n[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:u(n[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:n.zdr}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiGateway.update({...e,account_id:f,id:n.id})),{successLabel:`Updated`});return}if(n[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(n[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(n[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(n[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(n[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let p=l({authentication:n.authentication,cache_invalidate_on_update:n[`cache-invalidate-on-update`],cache_ttl:n[`cache-ttl`],collect_logs:n[`collect-logs`],guardrails:{prompt:{P1:u(n[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:u(n[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:u(n[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:u(n[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:u(n[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:u(n[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:u(n[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:u(n[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:u(n[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:u(n[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:u(n[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:u(n[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:u(n[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:u(n[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:u(n[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:u(n[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:u(n[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:u(n[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:u(n[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:u(n[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:u(n[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:u(n[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:u(n[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:u(n[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:u(n[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:u(n[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:u(n[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:u(n[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:n[`log-classification`],log_management:n[`log-management`],log_management_strategy:u(n[`log-management-strategy`],`log-management-strategy`,`text`),logpush:n.logpush,logpush_public_key:u(n[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:n[`rate-limiting-interval`],rate_limiting_limit:n[`rate-limiting-limit`],rate_limiting_technique:u(n[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(n[`retry-backoff`],`retry-backoff`,`text`),retry_delay:n[`retry-delay`],retry_max_attempts:n[`retry-max-attempts`],spend_limits:{enabled:n[`spend-limits-enabled`]},store_id:u(n[`store-id`],`store-id`,`text`),stripe:{authorization:u(n[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:u(n[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:n.zdr});i(await o(`Updating`,async()=>d.aiGateway.update({...p,account_id:f,id:n.id})),{successLabel:`Updated`})}};function dt(e){return e.positional(`provider`,{type:`string`,description:`Provider`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ft={command:`get <provider>`,describe:`Retrieves the endpoint URL for an AI Gateway.`,builder:dt,handler:async n=>{if(n.dryRun){a({command:`cf ai-gateway urls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-gateway/gateways/${n[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(n[`gateway-id`]))}/url/${n.provider==null?`<provider>`:encodeURIComponent(String(n.provider))}`,pathParams:{"gateway-id":String(n[`gateway-id`]??``),provider:String(n.provider??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiGateway.urls.get({account_id:l,gateway_id:n[`gateway-id`],provider:n.provider})),{successLabel:`Loaded`})}},pt={command:`urls`,describe:`Operations for urls`,builder:e=>e.command(ft).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},mt={command:`ai-gateway`,describe:`Proxy, cache, rate-limit, and observe requests to AI providers — OpenAI, Anthropic, Workers AI, and more`,builder:e=>e.command(H).command(ie).command(ze).command(Ve).command(ut).command(B).command(ne).command(Te).command(Oe).command(Le).command(et).command(ct).command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{mt as default};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,w as t}from"./oauth-DBJ5GSFk.mjs";import{i as n,n as r}from"./auth-CZ0E51rF.mjs";import{t as i}from"./output-B6fBFRqe.mjs";import{n as a,t as o}from"./progress-O88q63Bk.mjs";import{t as s}from"./local-C6TLPAT6.mjs";import{n as c,t as l}from"./body-parser-BO6mfo_W.mjs";import{n as u,t as d}from"./input-validation-BwUR9z8e.mjs";import{n as f,r as p,t as m}from"./prompt-DTAWiEm2.mjs";import{t as h}from"./cli-types-CFw6Xygp.mjs";import{n as ee,t as te}from"./raw-fetch-DgezeshQ.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _={command:`chat-completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:g,handler:async n=>{if(n.dryRun){a({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/chat/completions`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},stream:n.stream}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.chatCompletions({...e,account_id:f,name:n.name,id:n.id})),{successLabel:`Created`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},stream:n.stream});i(await o(`Creating`,async()=>d.aiSearch.chatCompletions({...p,account_id:f,name:n.name,id:n.id})),{successLabel:`Created`})}};function v(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`,choices:[`@cf/qwen/qwen3-embedding-0.6b`,`@cf/qwen/qwen3-vl-embedding-2b`,`@cf/baai/bge-m3`,`@cf/baai/bge-large-en-v1.5`,`@cf/google/embeddinggemma-300m`,`google-ai-studio/gemini-embedding-001`,`google-ai-studio/gemini-embedding-2-preview`,`google-ai-studio/gemini-embedding-2`,`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead.`,default:!1}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`],default:`porter`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`,choices:[`@cf/baai/bge-reranker-base`]}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`,default:`default`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`,default:5}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own.",default:!1}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`,default:!1}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`,default:1e5}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`,default:86400}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`],default:`all`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`,default:!1}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`,default:!0}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`],default:`sitemap`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`r2`,`web-crawler`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const y={command:`create <name> <id>`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async n=>{if(n.dryRun){a({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances`,pathParams:{name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_gateway_id:u(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:u(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:u(n[`embedding-model`],`embedding-model`,`text`),fusion_method:u(n[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:n[`hybrid-search-enabled`],index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:u(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:u(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:u(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:u(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:n[`source-params-web-crawler-discover-options-depth`],include_external_links:n[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:n[`source-params-web-crawler-discover-options-include-subdomains`],limit:n[`source-params-web-crawler-discover-options-limit`],max_age:n[`source-params-web-crawler-discover-options-max-age`],source:u(n[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(n[`token-id`],`token-id`,`text`),type:u(n.type,`type`,`text`),id:n.id}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.create({...e,account_id:f,name:n.name})),{successLabel:`Created`});return}let p=l({ai_gateway_id:u(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:u(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:u(n[`embedding-model`],`embedding-model`,`text`),fusion_method:u(n[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:n[`hybrid-search-enabled`],index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:u(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:u(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:u(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:u(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:n[`source-params-web-crawler-discover-options-depth`],include_external_links:n[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:n[`source-params-web-crawler-discover-options-include-subdomains`],limit:n[`source-params-web-crawler-discover-options-limit`],max_age:n[`source-params-web-crawler-discover-options-max-age`],source:u(n[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(n[`token-id`],`token-id`,`text`),type:u(n.type,`type`,`text`),id:n.id});i(await o(`Creating`,async()=>d.aiSearch.create({...p,account_id:f,name:n.name})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async n=>{if(n.dryRun){a({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await m({force:!!n.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>c.aiSearch.delete({account_id:l,name:n.name,id:n.id})),{successLabel:`Deleted`})}};function S(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <id>`,describe:`Retrieve the configuration and status of an AI Search instance.`,builder:S,handler:async n=>{if(n.dryRun){a({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.get({account_id:l,name:n.name,id:n.id})),{successLabel:`Loaded`})}};function w(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`chunks <item-id>`,describe:`Lists chunks for a specific item in an AI Search instance, including their text content.`,builder:w,handler:async n=>{let c={limit:n.limit,offset:n.offset};if(n.dryRun){a({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}/chunks`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.items.chunks({account_id:u,name:n.name,id:n.id,item_id:n[`item-id`],...c})),{successLabel:`Loaded`})}};function E(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <item-id>`,describe:`Deletes a file from a managed AI Search instance and triggers a reindex.`,builder:E,handler:async n=>{if(n.dryRun){a({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await m({force:!!n.force})){process.stderr.write(`Aborted.
4
+ `);return}i(await o(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,name:n.name,id:n.id,item_id:n[`item-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`download <item-id>`,describe:`Downloads the raw file content for a specific item from the managed AI Search instance storage.`,builder:O,handler:async n=>{if(n.dryRun){a({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}/download`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},bodyKind:`none`});return}await r(n);let i=n.local?s:await t();n.accountId=i;let c=await o(`Loading`,async()=>te(`/accounts/${i}/ai-search/namespaces/${encodeURIComponent(String(n.name))}/instances/${encodeURIComponent(String(n.id))}/items/${encodeURIComponent(String(n[`item-id`]))}/download`,{method:`GET`,localEndpoint:n.local?n.localEndpoint:void 0}));ee(n.text===!0?c.toString(`utf-8`):c)}};function A(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <item-id>`,describe:`Retrieves a specific indexed item from an AI Search instance.`,builder:A,handler:async n=>{if(n.dryRun){a({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.items.get({account_id:l,name:n.name,id:n.id,item_id:n[`item-id`]})),{successLabel:`Loaded`})}};function M(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts by status priority then last_seen_at. "modified_at" sorts by file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Filter items by source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}`}).option(`item-id`,{type:`string`,description:`Filter items by their unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Filter items by their exact key (object key / filename). Keys are unique per source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Lists indexed items in an AI Search instance.`,builder:h(M),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,sort_by:n[`sort-by`],status:n.status,source:n.source,metadata_filter:n[`metadata-filter`],item_id:n[`item-id`],key:n.key};if(n.dryRun){a({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items`,pathParams:{id:String(n.id??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.items.list({account_id:u,name:n.name,id:n.id,...c})),{successLabel:`Loaded`})}};function P(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`logs <item-id>`,describe:`Lists processing logs for a specific item in an AI Search instance.`,builder:P,handler:async n=>{let c={limit:n.limit,cursor:n.cursor};if(n.dryRun){a({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}/logs`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.items.logs({account_id:u,name:n.name,id:n.id,item_id:n[`item-id`],...c})),{successLabel:`Loaded`})}};function I(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`sync <item-id>`,describe:`Syncs an item to an AI Search instance index.`,builder:I,handler:async n=>{if(n.dryRun){a({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items/${n[`item-id`]==null?`<item-id>`:encodeURIComponent(String(n[`item-id`]))}`,pathParams:{id:String(n.id??``),"item-id":String(n[`item-id`]??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({next_action:u(n[`next-action`],`next-action`,`text`),wait_for_completion:n[`wait-for-completion`]}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.items.sync({...e,account_id:p,name:n.name,id:n.id,item_id:n[`item-id`]})),{successLabel:`Updated`});return}n[`next-action`]===void 0&&(n[`next-action`]=await f(`next-action`,`The next_action field`,[`INDEX`]));let m=l({next_action:u(n[`next-action`],`next-action`,`text`),wait_for_completion:n[`wait-for-completion`]});i(await o(`Updating`,async()=>d.aiSearch.items.sync({...m,account_id:p,name:n.name,id:n.id,item_id:n[`item-id`]})),{successLabel:`Updated`})}};function R(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."})}const z={command:`upload <id>`,describe:`Uploads a file to a managed AI Search instance via multipart/form-data.`,builder:R,handler:async c=>{if(c.dryRun){a({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}/instances/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}/items`,pathParams:{id:String(c.id??``),name:String(c.name??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,metadata:c.metadata,"wait-for-completion":c[`wait-for-completion`]}});return}let l=await r(c),f=c.local?s:await t();if(c.accountId=f,c.file!==void 0||c.body!==void 0||c.metadata!==void 0||c[`wait-for-completion`]!==void 0){let e=new FormData;if(c.file){let t=d(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);c.metadata!==void 0&&e.append(`metadata`,String(u(c.metadata,`metadata`,`text`)??``)),c[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(c[`wait-for-completion`])),i(await o(`Creating`,async()=>n(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=u(c.body,`body`,`binary`);i(await o(`Creating`,async()=>n(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function B(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`upsert <id>`,describe:`Creates or updates an indexed item in an AI Search instance.`,builder:B,handler:async n=>{if(n.dryRun){a({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/items`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({key:u(n.key,`key`,`text`),next_action:u(n[`next-action`],`next-action`,`text`),wait_for_completion:n[`wait-for-completion`]}):c(n.body)});return}let d=await r(n),m=n.local?s:await t();if(n.accountId=m,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.items.upsert({...e,account_id:m,name:n.name,id:n.id})),{successLabel:`Updated`});return}n.key===void 0&&(n.key=await p(`key`,`Item key / filename. Must not exceed 128 characters.`)),n[`next-action`]===void 0&&(n[`next-action`]=await f(`next-action`,`The next_action field`,[`INDEX`]));let h=l({key:u(n.key,`key`,`text`),next_action:u(n[`next-action`],`next-action`,`text`),wait_for_completion:n[`wait-for-completion`]});i(await o(`Updating`,async()=>d.aiSearch.items.upsert({...h,account_id:m,name:n.name,id:n.id})),{successLabel:`Updated`})}},H={command:`items`,describe:`Operations for items`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`cancel <job-id>`,describe:`Cancel an in-progress indexing job for an AI Search instance.`,builder:U,handler:async n=>{if(n.dryRun){a({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{id:String(n.id??``),"job-id":String(n[`job-id`]??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({action:u(n.action,`action`,`text`)}):c(n.body)});return}let d=await r(n),p=n.local?s:await t();if(n.accountId=p,!await m({force:!!n.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
5
+ `);return}if(n.body){let e=c(n.body);i(await o(`Deleting`,async()=>d.aiSearch.jobs.cancel({...e,account_id:p,name:n.name,id:n.id,job_id:n[`job-id`]})),{successLabel:`Deleted`});return}n.action===void 0&&(n.action=await f(`action`,`The action field`,[`cancel`]));let h=l({action:u(n.action,`action`,`text`)});i(await o(`Deleting`,async()=>d.aiSearch.jobs.cancel({...h,account_id:p,name:n.name,id:n.id,job_id:n[`job-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`create <id>`,describe:`Creates a new indexing job for an AI Search instance.`,builder:G,handler:async n=>{if(n.dryRun){a({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/jobs`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({description:u(n.description,`description`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.jobs.create({...e,account_id:f,name:n.name,id:n.id})),{successLabel:`Created`});return}let p=l({description:u(n.description,`description`,`text`)});i(await o(`Creating`,async()=>d.aiSearch.jobs.create({...p,account_id:f,name:n.name,id:n.id})),{successLabel:`Created`})}};function q(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <job-id>`,describe:`Retrieves details for a specific AI Search indexing job.`,builder:q,handler:async n=>{if(n.dryRun){a({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}`,pathParams:{id:String(n.id??``),"job-id":String(n[`job-id`]??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,name:n.name,id:n.id,job_id:n[`job-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists indexing jobs for an AI Search instance.`,builder:Y,handler:async n=>{let c={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/jobs`,pathParams:{id:String(n.id??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.jobs.list({account_id:u,name:n.name,id:n.id,...c})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`logs <job-id>`,describe:`Lists log entries for an AI Search indexing job.`,builder:Z,handler:async n=>{let c={page:n.page,per_page:n[`per-page`]};if(n.dryRun){a({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/jobs/${n[`job-id`]==null?`<job-id>`:encodeURIComponent(String(n[`job-id`]))}/logs`,pathParams:{id:String(n.id??``),"job-id":String(n[`job-id`]??``),name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.jobs.logs({account_id:u,name:n.name,id:n.id,job_id:n[`job-id`],...c})),{successLabel:`Loaded`})}},ne={command:`jobs`,describe:`Operations for jobs`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`List all AI Search instances in the account.`,builder:h(re),handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search,order_by:n[`order-by`],order_by_direction:n[`order-by-direction`]};if(n.dryRun){a({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances`,pathParams:{name:String(n.name??``)},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.list({account_id:u,name:n.name,...c})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace currently containing the instance.`,demandOption:!0}).option(`destination-namespace`,{type:`string`,description:`Target namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`move <id>`,describe:`Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`,builder:ae,handler:async n=>{if(n.dryRun){a({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{name:String(n.name??``),id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({new_namespace:u(n[`destination-namespace`],`destination-namespace`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.move({...e,account_id:f,name:n.name,id:n.id})),{successLabel:`Updated`});return}n[`destination-namespace`]===void 0&&(n[`destination-namespace`]=await p(`destination-namespace`,`Target namespace to move the instance into.`));let m=l({new_namespace:u(n[`destination-namespace`],`destination-namespace`,`text`)});i(await o(`Updating`,async()=>d.aiSearch.move({...m,account_id:f,name:n.name,id:n.id})),{successLabel:`Updated`})}};function se(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`multi-chat-completions <name>`,describe:`Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`,builder:se,handler:async n=>{if(n.dryRun){a({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/chat/completions`,pathParams:{name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},instance_ids:n[`ai-search-options-instance-ids`],query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},stream:n.stream}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.multiChatCompletions({...e,account_id:f,name:n.name})),{successLabel:`Created`});return}if(n[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},instance_ids:n[`ai-search-options-instance-ids`],query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},stream:n.stream});i(await o(`Creating`,async()=>d.aiSearch.multiChatCompletions({...p,account_id:f,name:n.name})),{successLabel:`Created`})}};function le(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`multi-search <name> <query>`,describe:`Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`,builder:le,handler:async n=>{if(n.dryRun){a({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/search`,pathParams:{name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},instance_ids:n[`ai-search-options-instance-ids`],query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},query:n.query}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.multiSearch({...e,account_id:f,name:n.name})),{successLabel:`Created`});return}if(n[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},instance_ids:n[`ai-search-options-instance-ids`],query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},query:n.query});i(await o(`Creating`,async()=>d.aiSearch.multiSearch({...p,account_id:f,name:n.name})),{successLabel:`Created`})}};function de(e){return e.positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`,default:!0}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`,default:!1}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`,default:`Finds exactly what you're looking for`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`,default:!1}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create <namespace>`,describe:`Create a namespace for organizing AI Search instances.`,builder:de,handler:async n=>{if(n.dryRun){a({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({description:u(n.description,`description`,`text`),public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],instances_allowed:n[`public-endpoint-params-instances-allowed`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},name:n.namespace}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.namespace.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({description:u(n.description,`description`,`text`),public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],instances_allowed:n[`public-endpoint-params-instances-allowed`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},name:n.namespace});i(await o(`Creating`,async()=>d.aiSearch.namespace.create({...p,account_id:f})),{successLabel:`Created`})}};function pe(e){return e.positional(`name`,{type:`string`,description:`Namespace to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const me={command:`delete <name>`,describe:`Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`,builder:pe,handler:async n=>{if(n.dryRun){a({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}`,pathParams:{name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await m({force:!!n.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
6
+ `);return}i(await o(`Deleting`,async()=>c.aiSearch.namespace.delete({account_id:l,name:n.name})),{successLabel:`Deleted`})}};function he(e){return e.positional(`name`,{type:`string`,description:`Namespace to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <name>`,describe:`Retrieve a namespace and its description.`,builder:he,handler:async n=>{if(n.dryRun){a({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}`,pathParams:{name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.namespace.get({account_id:l,name:n.name})),{successLabel:`Loaded`})}};function _e(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list`,describe:`List namespaces in the account, including their descriptions and creation times.`,builder:_e,handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search};if(n.dryRun){a({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.namespace.list({account_id:u,...c})),{successLabel:`Loaded`})}};function ye(e){return e.positional(`name`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`update <name>`,describe:`Update the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`,builder:ye,handler:async n=>{if(n.dryRun){a({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}`,pathParams:{name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({description:u(n.description,`description`,`text`),public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],instances_allowed:n[`public-endpoint-params-instances-allowed`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}}}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.namespace.update({...e,account_id:f,name:n.name})),{successLabel:`Updated`});return}let p=l({description:u(n.description,`description`,`text`),public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],instances_allowed:n[`public-endpoint-params-instances-allowed`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}}});i(await o(`Updating`,async()=>d.aiSearch.namespace.update({...p,account_id:f,name:n.name})),{successLabel:`Updated`})}},xe={command:`namespace`,describe:`Operations for namespace`,builder:e=>e.command(fe).command(me).command(ge).command(ve).command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`purge-cache <id>`,describe:`Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`,builder:Se,handler:async n=>{if(n.dryRun){a({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/purge_cache`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Creating`,async()=>c.aiSearch.purgeCache({account_id:l,name:n.name,id:n.id})),{successLabel:`Created`})}};function we(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Te={command:`search <id> <query>`,describe:`Executes a semantic search query against an AI Search instance to find relevant indexed content.`,builder:we,handler:async n=>{if(n.dryRun){a({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/search`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},query:n.query}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Loading`,async()=>d.aiSearch.search({...e,account_id:f,name:n.name,id:n.id})),{successLabel:`Loaded`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(n[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:n[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:n[`ai-search-options-query-rewrite-enabled`],rewrite_prompt:u(n[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:n[`ai-search-options-reranking-enabled`],match_threshold:n[`ai-search-options-reranking-match-threshold`]},retrieval:{context_expansion:n[`ai-search-options-retrieval-context-expansion`],fusion_method:u(n[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(n[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:n[`ai-search-options-retrieval-match-threshold`],max_num_results:n[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(n[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:n[`ai-search-options-retrieval-return-on-failure`]}},query:n.query});i(await o(`Loading`,async()=>d.aiSearch.search({...p,account_id:f,name:n.name,id:n.id})),{successLabel:`Loaded`})}};function Ee(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`stats <id>`,describe:`Retrieve usage and indexing statistics for an AI Search instance.`,builder:Ee,handler:async n=>{if(n.dryRun){a({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}/stats`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.stats({account_id:l,name:n.name,id:n.id})),{successLabel:`Loaded`})}};function $(e){return e.positional(`name`,{type:`string`,description:`Human-readable name for the credential.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`create <name>`,describe:`Create a stored Cloudflare credential for an AI Search instance to access its data source.`,builder:$,handler:async n=>{if(n.dryRun){a({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:n.body===void 0?l({cf_api_id:u(n[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(n[`api-token`],`api-token`,`text`),legacy:n.legacy,name:n.name}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Creating`,async()=>d.aiSearch.tokens.create({...e,account_id:f})),{successLabel:`Created`});return}n[`api-token-id`]===void 0&&(n[`api-token-id`]=await p(`api-token-id`,`The cf_api_id field`)),n[`api-token`]===void 0&&(n[`api-token`]=await p(`api-token`,`The cf_api_key field`,{kind:`secret`}));let m=l({cf_api_id:u(n[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(n[`api-token`],`api-token`,`text`),legacy:n.legacy,name:n.name});i(await o(`Creating`,async()=>d.aiSearch.tokens.create({...m,account_id:f})),{successLabel:`Created`})}};function ke(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`delete <id>`,describe:`Permanently delete a stored AI Search credential. Credentials in use by an instance cannot be deleted.`,builder:ke,handler:async n=>{if(n.dryRun){a({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/tokens/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();if(n.accountId=l,!await m({force:!!n.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
7
+ `);return}i(await o(`Deleting`,async()=>c.aiSearch.tokens.delete({account_id:l,id:n.id})),{successLabel:`Deleted`})}};function je(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <id>`,describe:`Retrieve a stored AI Search credential without exposing its secret.`,builder:je,handler:async n=>{if(n.dryRun){a({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/tokens/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`none`});return}let c=await r(n),l=n.local?s:await t();n.accountId=l,i(await o(`Loading`,async()=>c.aiSearch.tokens.get({account_id:l,id:n.id})),{successLabel:`Loaded`})}};function Ne(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`List stored AI Search credentials in the account without exposing their secrets.`,builder:Ne,handler:async n=>{let c={page:n.page,per_page:n[`per-page`],search:n.search};if(n.dryRun){a({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(n),u=n.local?s:await t();n.accountId=u,i(await o(`Loading`,async()=>l.aiSearch.tokens.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Fe(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ie={command:`update <id>`,describe:`Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`,builder:Fe,handler:async n=>{if(n.dryRun){a({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/tokens/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``)},bodyKind:`json`,body:n.body===void 0?l({cf_api_id:u(n[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(n[`api-token`],`api-token`,`text`),legacy:n.legacy,name:u(n.name,`name`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.tokens.update({...e,account_id:f,id:n.id})),{successLabel:`Updated`});return}n[`api-token-id`]===void 0&&(n[`api-token-id`]=await p(`api-token-id`,`The cf_api_id field`)),n[`api-token`]===void 0&&(n[`api-token`]=await p(`api-token`,`The cf_api_key field`,{kind:`secret`})),n.name===void 0&&(n.name=await p(`name`,`The name field`));let m=l({cf_api_id:u(n[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(n[`api-token`],`api-token`,`text`),legacy:n.legacy,name:u(n.name,`name`,`text`)});i(await o(`Updating`,async()=>d.aiSearch.tokens.update({...m,account_id:f,id:n.id})),{successLabel:`Updated`})}},Le={command:`tokens`,describe:`Operations for tokens`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`The ai_search_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`chunk`,{type:`boolean`,description:`The chunk field`}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`,choices:[`@cf/qwen/qwen3-embedding-0.6b`,`@cf/qwen/qwen3-vl-embedding-2b`,`@cf/baai/bge-m3`,`@cf/baai/bge-large-en-v1.5`,`@cf/google/embeddinggemma-300m`,`google-ai-studio/gemini-embedding-001`,`google-ai-studio/gemini-embedding-2-preview`,`google-ai-studio/gemini-embedding-2`,`openai/text-embedding-3-small`,`openai/text-embedding-3-large`]}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`]}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`paused`,{type:`boolean`,description:`The paused field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`reranking`,{type:`boolean`,description:`The reranking field`}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`,choices:[`@cf/baai/bge-reranker-base`]}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`The rewrite_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`,choices:`@cf/meta/llama-3.3-70b-instruct-fp8-fast,@cf/zai-org/glm-4.7-flash,@cf/meta/llama-3.1-8b-instruct-fast,@cf/meta/llama-3.1-8b-instruct-fp8,@cf/meta/llama-4-scout-17b-16e-instruct,@cf/qwen/qwen3-30b-a3b-fp8,@cf/deepseek-ai/deepseek-r1-distill-qwen-32b,@cf/moonshotai/kimi-k2-instruct,@cf/google/gemma-3-12b-it,@cf/google/gemma-4-26b-a4b-it,@cf/moonshotai/kimi-k2.5,anthropic/claude-3-7-sonnet,anthropic/claude-sonnet-4,anthropic/claude-opus-4,anthropic/claude-3-5-haiku,cerebras/qwen-3-235b-a22b-instruct,cerebras/qwen-3-235b-a22b-thinking,cerebras/llama-3.3-70b,cerebras/llama-4-maverick-17b-128e-instruct,cerebras/llama-4-scout-17b-16e-instruct,cerebras/gpt-oss-120b,google-ai-studio/gemini-2.5-flash,google-ai-studio/gemini-2.5-pro,grok/grok-4,groq/llama-3.3-70b-versatile,groq/llama-3.1-8b-instant,openai/gpt-5,openai/gpt-5-mini,openai/gpt-5-nano`.split(`,`)}).option(`system-prompt-ai-search`,{type:`string`,description:`The system_prompt_ai_search field`}).option(`system-prompt-index-summarization`,{type:`string`,description:`The system_prompt_index_summarization field`}).option(`system-prompt-rewrite-query`,{type:`string`,description:`The system_prompt_rewrite_query field`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const ze={command:`update <id>`,describe:`Update the configuration of an AI Search instance.`,builder:Re,handler:async n=>{if(n.dryRun){a({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await e()??`<account-id>`}/ai-search/namespaces/${n.name==null?`<name>`:encodeURIComponent(String(n.name))}/instances/${n.id==null?`<id>`:encodeURIComponent(String(n.id))}`,pathParams:{id:String(n.id??``),name:String(n.name??``)},bodyKind:`json`,body:n.body===void 0?l({ai_gateway_id:u(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:u(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:u(n[`embedding-model`],`embedding-model`,`text`),fusion_method:u(n[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:u(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:n.paused,public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:u(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:u(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:u(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:n[`source-params-web-crawler-discover-options-depth`],include_external_links:n[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:n[`source-params-web-crawler-discover-options-include-subdomains`],limit:n[`source-params-web-crawler-discover-options-limit`],max_age:n[`source-params-web-crawler-discover-options-max-age`],source:u(n[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:n.summarization,summarization_model:u(n[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(n[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(n[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(n[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(n[`token-id`],`token-id`,`text`)}):c(n.body)});return}let d=await r(n),f=n.local?s:await t();if(n.accountId=f,n.body){let e=c(n.body);i(await o(`Updating`,async()=>d.aiSearch.update({...e,account_id:f,name:n.name,id:n.id})),{successLabel:`Updated`});return}let p=l({ai_gateway_id:u(n[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(n[`ai-search-model`],`ai-search-model`,`text`),cache:n.cache,cache_threshold:u(n[`cache-threshold`],`cache-threshold`,`text`),chunk:n.chunk,chunk_overlap:n[`chunk-overlap`],chunk_size:n[`chunk-size`],embedding_model:u(n[`embedding-model`],`embedding-model`,`text`),fusion_method:u(n[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:n[`index-method-keyword`],vector:n[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(n[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:n[`max-num-results`],metadata:{created_from_aisearch_wizard:n[`metadata-created-from-aisearch-wizard`],worker_domain:u(n[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:n.paused,public_endpoint_params:{authorized_hosts:n[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:n[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:n[`public-endpoint-params-custom-domains`],default_domain_enabled:n[`public-endpoint-params-default-domain-enabled`],enabled:n[`public-endpoint-params-enabled`],mcp:{description:u(n[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:n[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:n[`public-endpoint-params-rate-limit-period-ms`],requests:n[`public-endpoint-params-rate-limit-requests`],technique:u(n[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:n[`public-endpoint-params-search-endpoint-disabled`]}},reranking:n.reranking,reranking_model:u(n[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(n[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(n[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:n[`rewrite-query`],score_threshold:n[`score-threshold`],source:u(n.source,`source`,`text`),source_params:{exclude_items:n[`source-params-exclude-items`],include_items:n[`source-params-include-items`],prefix:u(n[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(n[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:n[`source-params-web-crawler-discover-options-depth`],include_external_links:n[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:n[`source-params-web-crawler-discover-options-include-subdomains`],limit:n[`source-params-web-crawler-discover-options-limit`],max_age:n[`source-params-web-crawler-discover-options-max-age`],source:u(n[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:n[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:n[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:n[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(n[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:n.summarization,summarization_model:u(n[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(n[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(n[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(n[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(n[`token-id`],`token-id`,`text`)});i(await o(`Updating`,async()=>d.aiSearch.update({...p,account_id:f,name:n.name,id:n.id})),{successLabel:`Updated`})}},Be={command:`ai-search`,describe:`ai-search`,builder:e=>e.command(_).command(y).command(x).command(C).command(ie).command(oe).command(ce).command(ue).command(Ce).command(Te).command(De).command(ze).command(H).command(ne).command(xe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Be as default};