cf 1.0.0-beta.12 → 1.0.0-beta.13

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 (283) hide show
  1. package/dist/_meta/commands.json +3119 -2067
  2. package/dist/_meta/hand-written-commands.json +14 -1
  3. package/dist/_meta/schemas.json +1856 -1132
  4. package/dist/{abuse-reports-Cy9RcWPu.mjs → abuse-reports-BjU1s8cf.mjs} +10 -10
  5. package/dist/{access-DwJm1qet.mjs → access-C_G2MZnA.mjs} +1 -1
  6. package/dist/account-tags-CaXDDeZ4.mjs +15 -0
  7. package/dist/{accounts-BSd4b-1j.mjs → accounts-BALwxDQY.mjs} +70 -77
  8. package/dist/{acm-BfI0p2sX.mjs → acm-CP9EaXQN.mjs} +1 -1
  9. package/dist/{addressing-lfeJf7YB.mjs → addressing-DRlaxqrI.mjs} +1 -1
  10. package/dist/{agent-memory-CP1qpn-y.mjs → agent-memory-vGhlfZBx.mjs} +1 -1
  11. package/dist/{ai-jFzFBANM.mjs → ai-CJtbWfB9.mjs} +18 -16
  12. package/dist/{ai-audit-B_tSl78A.mjs → ai-audit-C0BJNqZZ.mjs} +1 -1
  13. package/dist/ai-gateway-BQtv3U3x.mjs +80 -0
  14. package/dist/ai-search-DGU1Y5By.mjs +79 -0
  15. package/dist/{ai-security-CKGE547U.mjs → ai-security-CFTaYk_X.mjs} +1 -1
  16. package/dist/{alerting-CuxoqG3S.mjs → alerting-1hun27JC.mjs} +3 -3
  17. package/dist/analytics-DXUSjvzT.mjs +17 -0
  18. package/dist/{analytics_engine-BoapM9wd.mjs → analytics_engine-CQsnL09C.mjs} +1 -1
  19. package/dist/{api-security-Nk_bg-Kg.mjs → api-security-BXhrfR6-.mjs} +4 -4
  20. package/dist/argo-LPUCTnee.mjs +14 -0
  21. package/dist/{artifacts-BS6cEqCB.mjs → artifacts-Dt6easua.mjs} +1 -1
  22. package/dist/{audit-logs-x5tLqeX2.mjs → audit-logs-CVznAM2Z.mjs} +1 -1
  23. package/dist/{auth-AobvBmz4.mjs → auth-CGLsxbc6.mjs} +1 -1
  24. package/dist/auth-CrmVwfpJ.mjs +2 -0
  25. package/dist/{auth-CKotxfap.mjs → auth-eQr-kQCH.mjs} +1 -1
  26. package/dist/{auth-token-CtguMdmF.mjs → auth-token-pNQrX_9O.mjs} +1 -1
  27. package/dist/{autoconfig-PfnbLuEO.mjs → autoconfig-sD7Frryg.mjs} +151 -151
  28. package/dist/{basin-catalog-Ddi-t3q9.mjs → basin-catalog-ZQICw-zF.mjs} +1 -1
  29. package/dist/{billing-CDMc4tvX.mjs → billing-Dy1-dV_B.mjs} +2 -2
  30. package/dist/{bot-management-UrCM3P8K.mjs → bot-management-DTgPwL7O.mjs} +1 -1
  31. package/dist/{botnet-feed-CVwRm42k.mjs → botnet-feed-xb98Cj3Y.mjs} +1 -1
  32. package/dist/{brand-protection-DfNf5REj.mjs → brand-protection-Ck3okE2k.mjs} +1 -1
  33. package/dist/browser-run-DJGJSzFX.mjs +42 -0
  34. package/dist/build-B1L6xrgC.mjs +2 -0
  35. package/dist/{build-BKPVP5ip.mjs → build-HmSXqjGn.mjs} +1 -1
  36. package/dist/{builds-BG5DHqU3.mjs → builds-CYxcZtkG.mjs} +3 -3
  37. package/dist/{cache-C05hHXUp.mjs → cache-D9tSfovH.mjs} +1 -1
  38. package/dist/{certificate-authorities-DyCFmZwR.mjs → certificate-authorities-CpiveTFC.mjs} +1 -1
  39. package/dist/cf-BxsXrVeh.mjs +18 -0
  40. package/dist/chunk-DSGVRFIS-C1_SEtRK.mjs +2 -0
  41. package/dist/{chunk-FT2NMTJB-DQ7s3x7Q.mjs → chunk-NDZDTP46-Bjx_wtJe.mjs} +3 -3
  42. package/dist/{chunk-AUSY7DKT-BJX6Fdc4.mjs → chunk-TAK63GWY-DdMktrgc.mjs} +9 -2
  43. package/dist/{cli-D9qlPB-6.mjs → cli-DeJc9U8z.mjs} +1 -1
  44. package/dist/{client-certificates-B-m8rfM9.mjs → client-certificates-CF6YZyvP.mjs} +1 -1
  45. package/dist/{client-side-security-M4oIUqID.mjs → client-side-security-BLoe9kS5.mjs} +1 -1
  46. package/dist/{cloud-connector-B63Dwn6n.mjs → cloud-connector-DXRUHsjt.mjs} +1 -1
  47. package/dist/cloudflared--1Ws1RJy.mjs +2 -0
  48. package/dist/{cloudforce-one-Dlc1GNFy.mjs → cloudforce-one-CBLxXi6v.mjs} +162 -162
  49. package/dist/{command-BQpXcGKV.mjs → command-83uVfXh9.mjs} +1 -1
  50. package/dist/{command-BWlpCtHe.mjs → command-BDe67N_n.mjs} +1 -1
  51. package/dist/{command-CXxh5Hce.mjs → command-BlIb6RR2.mjs} +1 -1
  52. package/dist/{command-ZBQ1WITj.mjs → command-Bpzp8Mz2.mjs} +1 -1
  53. package/dist/{command-CKQlxypn.mjs → command-BvfKhMl7.mjs} +1 -1
  54. package/dist/command-CG6RvZs0.mjs +2 -0
  55. package/dist/{command-CRl00uA2.mjs → command-CcuLC6CJ.mjs} +1 -1
  56. package/dist/{command-CUkXxZsc.mjs → command-Cu7dcaHT.mjs} +1 -1
  57. package/dist/{command-SS1z_t68.mjs → command-D3fyhdy-.mjs} +1 -1
  58. package/dist/{command-DyE8v4sd.mjs → command-DUhX8Dcr.mjs} +1 -1
  59. package/dist/{command-VuxpEvmH.mjs → command-Dh7RmjFu.mjs} +1 -1
  60. package/dist/{command-DEQSv-S1.mjs → command-DwXiDOeH.mjs} +1 -1
  61. package/dist/{command-BlGILcTA.mjs → command-UiHLJ8Ji.mjs} +1 -1
  62. package/dist/{command-Rv2MR-eh.mjs → command-_rqD0hXF.mjs} +1 -1
  63. package/dist/{command-DBaNgfA4.mjs → command-oNVwyjGB.mjs} +1 -1
  64. package/dist/{completions-lf50FBGm.mjs → completions-D06AO7A8.mjs} +11 -11
  65. package/dist/{connector-interrupts-DHN1KtUE.mjs → connector-interrupts-DelTmNyw.mjs} +1 -1
  66. package/dist/{connector-telemetry-events-CHg7FmXh.mjs → connector-telemetry-events-BwxR3G8d.mjs} +1 -1
  67. package/dist/{connector-telemetry-snapshots-CSifYi9r.mjs → connector-telemetry-snapshots-Bqq-hrpJ.mjs} +1 -1
  68. package/dist/{connectors-0UwPUav-.mjs → connectors-D-m3rEpk.mjs} +1 -1
  69. package/dist/{containers-DuIsM7lM.mjs → containers-CVNfEjJs.mjs} +3 -3
  70. package/dist/{containers-DRzgE46U.mjs → containers-DeoZyeQe.mjs} +25 -25
  71. package/dist/{content-scan-COyTz0Wb.mjs → content-scan-W0BNzbQp.mjs} +1 -1
  72. package/dist/{context-Bwkz4Lm_.mjs → context-q7UaYK69.mjs} +2 -2
  73. package/dist/{cps-B7_BJaAU.mjs → cps-BZ6hqRb5.mjs} +1 -1
  74. package/dist/{csamScanner-jez2EYXC.mjs → csamScanner-Bo1t3CLh.mjs} +1 -1
  75. package/dist/{ct-alerting-CACDrY0E.mjs → ct-alerting-E03faC7p.mjs} +1 -1
  76. package/dist/{custom-certificates-BBd92YlF.mjs → custom-certificates-CUySSPzi.mjs} +3 -3
  77. package/dist/{custom-csrs-DTwBiNMX.mjs → custom-csrs-gNpWkJPQ.mjs} +1 -1
  78. package/dist/{custom-hostnames-DIWlqvN9.mjs → custom-hostnames-abGBAbx7.mjs} +4 -4
  79. package/dist/{custom-nameservers-DISy8v8u.mjs → custom-nameservers-BgNXol1P.mjs} +1 -1
  80. package/dist/{custom-pages-BHXO_NFv.mjs → custom-pages-DMKX3aoD.mjs} +1 -1
  81. package/dist/{d1-MvAQMvvo.mjs → d1-CE08YqYk.mjs} +26 -22
  82. package/dist/{dcv-delegation-Buq0hcm_.mjs → dcv-delegation-B5YUEWu0.mjs} +1 -1
  83. package/dist/deploy-CWNm1-5v.mjs +2 -0
  84. package/dist/deploy-context-Dr6bxNcB.mjs +56 -0
  85. package/dist/deploy-input-Cc0_2QlW.mjs +2 -0
  86. package/dist/{dev-D8FGPKRt.mjs → dev-ZA8itQE7.mjs} +1 -1
  87. package/dist/{diagnostics-ChDfJ-Gv.mjs → diagnostics-UMbG6m4n.mjs} +1 -1
  88. package/dist/dialog-D4Y9ocuF.mjs +2 -0
  89. package/dist/{dist-CYFkGHYv.mjs → dist-BHEmAAHr.mjs} +4 -4
  90. package/dist/dist-uRuGmkMB.mjs +60 -0
  91. package/dist/{dls-8D00tqvC.mjs → dls-DIl16mLp.mjs} +1 -1
  92. package/dist/{dns-C-A5pwf3.mjs → dns-QUpgljRG.mjs} +5 -5
  93. package/dist/{dns-firewall-DIiF4pro.mjs → dns-firewall-BZwJXHLj.mjs} +1 -1
  94. package/dist/dry-run-DRj2_uV3.mjs +2 -0
  95. package/dist/{durable-objects-CnIqbj84.mjs → durable-objects-BCj4ykpU.mjs} +1 -1
  96. package/dist/{email-auth-v97Md32E.mjs → email-auth-DlHIYhCk.mjs} +1 -1
  97. package/dist/{email-routing-I29RG4hb.mjs → email-routing-UKVS4DYy.mjs} +1 -1
  98. package/dist/{email-security-BCarmbky.mjs → email-security-CZjfRIg0.mjs} +8 -8
  99. package/dist/{email-sending-CsHk2HAJ.mjs → email-sending-Dquc880C.mjs} +1 -1
  100. package/dist/{error-sanitization-BWnGnB73.mjs → error-sanitization-DE_zSrXw.mjs} +1 -1
  101. package/dist/error-sanitization-DOCQ9Ykh.mjs +2 -0
  102. package/dist/{fieldExtractors-GIVe9jZa.mjs → fieldExtractors-BbwDRquU.mjs} +1 -1
  103. package/dist/{firewall-DpgFqJr3.mjs → firewall--mTfDnCJ.mjs} +3 -3
  104. package/dist/{flagship-BVaXXlsX.mjs → flagship-cfoSwwM9.mjs} +1 -1
  105. package/dist/{fraud-B5GQdEF2.mjs → fraud-Dcsq3EYK.mjs} +1 -1
  106. package/dist/{google-tag-gateway-C4O61lp-.mjs → google-tag-gateway-DPKSkZQi.mjs} +1 -1
  107. package/dist/{healthchecks-BwYMnKSF.mjs → healthchecks-D78hIIBC.mjs} +1 -1
  108. package/dist/{hostnames-DhrGRFeI.mjs → hostnames-sF999-6H.mjs} +1 -1
  109. package/dist/{hyperdrive-DAA8Fazg.mjs → hyperdrive-qWACKfA4.mjs} +2 -2
  110. package/dist/{iam-sRKDU2Z3.mjs → iam-Bvg_PayW.mjs} +1 -1
  111. package/dist/{images-DXdekLVs.mjs → images-DI_lEZ4L.mjs} +1 -1
  112. package/dist/index.mjs +1 -1
  113. package/dist/init-1w_mcgk3.mjs +43 -0
  114. package/dist/{intel-CnVeSjIS.mjs → intel-BxElBUMP.mjs} +1 -1
  115. package/dist/interactive-BW9T1D1q.mjs +48 -0
  116. package/dist/interactive-DGUWZ2Gk.mjs +2 -0
  117. package/dist/{ips-COCUG8mk.mjs → ips-DWoaKxi7.mjs} +1 -1
  118. package/dist/k2-tFjaftl-.mjs +11 -0
  119. package/dist/{keyless-certificates-l2_S__h3.mjs → keyless-certificates-BrvxHU4J.mjs} +1 -1
  120. package/dist/{keys-CDZreums.mjs → keys-DcwTYKRf.mjs} +1 -1
  121. package/dist/{kv-DkpKVimq.mjs → kv-htXS-7uP.mjs} +2 -2
  122. package/dist/{lazy-command-_vZGz6mv.mjs → lazy-command-BDiIwpss.mjs} +1 -1
  123. package/dist/{leaked-credential-checks-edbapECI.mjs → leaked-credential-checks-bvGrLOmQ.mjs} +1 -1
  124. package/dist/{load-balancers-C5YMvhXD.mjs → load-balancers-BNTUt4yG.mjs} +1 -1
  125. package/dist/local-DlDumOSC.mjs +2 -0
  126. package/dist/{local-C0lQ9sTg.mjs → local-DlT72Xpn.mjs} +1 -1
  127. package/dist/{local-runtime-DtnWXN0a.mjs → local-runtime-CokO6qaX.mjs} +1 -1
  128. package/dist/{login-BrjOuHKu.mjs → login-BGF_I_LT.mjs} +1 -1
  129. package/dist/{login-DeOM4v0L.mjs → login-Ccw-mYwT.mjs} +1 -1
  130. package/dist/{logo-matches-CF8321pb.mjs → logo-matches-tE8LTKgg.mjs} +1 -1
  131. package/dist/{logos-Bd8xNRKW.mjs → logos-Bj845Mcw.mjs} +1 -1
  132. package/dist/{logpush-BYk3qqwY.mjs → logpush-Cs8JdvKi.mjs} +7 -7
  133. package/dist/{logs-Jcj2NN8H.mjs → logs-C92XZvNu.mjs} +1 -1
  134. package/dist/{magic-cloud-networking-Dgdb9H0f.mjs → magic-cloud-networking-hNp5MMw-.mjs} +1 -1
  135. package/dist/{magic-network-monitoring-CxVU4MZB.mjs → magic-network-monitoring-68GuWAnv.mjs} +1 -1
  136. package/dist/{magic-transit-KDyfUgTv.mjs → magic-transit-DNd7gu4j.mjs} +6 -6
  137. package/dist/{managed-defense-CxaDeNUd.mjs → managed-defense-B_wCAuFD.mjs} +1 -1
  138. package/dist/{managed-transforms-C7rT5E-x.mjs → managed-transforms-DZdxHPOh.mjs} +1 -1
  139. package/dist/{matches-BtKqG8T9.mjs → matches-B65CkflD.mjs} +1 -1
  140. package/dist/{mcp-QDd1Iyc0.mjs → mcp-DrJW5ayK.mjs} +4 -4
  141. package/dist/mesh-DfVzYTn1.mjs +26 -0
  142. package/dist/{migrate-DHlfR_gZ.mjs → migrate-CZNq63Uj.mjs} +1 -1
  143. package/dist/{monetization-pLalYYMI.mjs → monetization-BGaI8CMO.mjs} +1 -1
  144. package/dist/{mtls-certificates-DYA9Wu-c.mjs → mtls-certificates-BsU2emDD.mjs} +2 -2
  145. package/dist/{network-DrJxPWXQ.mjs → network-BEMD8P0U.mjs} +1 -1
  146. package/dist/{network-interconnects-D73MlYG8.mjs → network-interconnects-DMu_fcbo.mjs} +2 -7
  147. package/dist/o11y-C1a4gDGF.mjs +93 -0
  148. package/dist/{oauth-B08YQ4xq.mjs → oauth-Bj5Ne1o8.mjs} +1 -1
  149. package/dist/{oauth-clients-CkPDLFd-.mjs → oauth-clients-p4Etdqy_.mjs} +1 -1
  150. package/dist/{oauth-TGbM1Q0V.mjs → oauth-mspHHU5U.mjs} +1 -1
  151. package/dist/{oauth-scopes-VgliqcQe.mjs → oauth-scopes-B2IabFza.mjs} +1 -1
  152. package/dist/{organization-DIwqRBBV.mjs → organization-CdXt7AVZ.mjs} +1 -1
  153. package/dist/{organizations-Dk0D9ukm.mjs → organizations-5S6xEp7T.mjs} +1 -1
  154. package/dist/{origin-ca-certificates-BSFqMTn-.mjs → origin-ca-certificates-_VJAoK1D.mjs} +1 -1
  155. package/dist/{origin-post-quantum-encryption-BOKWKDTY.mjs → origin-post-quantum-encryption-GcldDsT2.mjs} +1 -1
  156. package/dist/{origin-tls-client-auth-BzE3WpcN.mjs → origin-tls-client-auth-DZHld9fA.mjs} +3 -3
  157. package/dist/{output-BGqhvqe2.mjs → output-BOe-3AQG.mjs} +1 -1
  158. package/dist/{page-rules-BKaU37cM.mjs → page-rules-o1tAMMsD.mjs} +1 -1
  159. package/dist/{pages-2Xg-lrMf.mjs → pages-CmiOhjSl.mjs} +4 -4
  160. package/dist/pay-per-crawl-BsnOxGYU.mjs +38 -0
  161. package/dist/pay-per-use-BXWMCSyE.mjs +33 -0
  162. package/dist/{pipelines-BM-T7mMK.mjs → pipelines-DWLQC0F6.mjs} +2 -2
  163. package/dist/{precursor-DmQ32-Sp.mjs → precursor-B6DjBib6.mjs} +1 -1
  164. package/dist/{previews-DDQ9ACDJ.mjs → previews-dUKEBGSM.mjs} +1 -1
  165. package/dist/process-2wmDCy17.mjs +2 -0
  166. package/dist/{progress-BYVZuEcG.mjs → progress-BtkTVcHI.mjs} +1 -1
  167. package/dist/prompt-RlgRrmbm.mjs +3 -0
  168. package/dist/{queries-DPBkVynK.mjs → queries-yLwoJRHV.mjs} +1 -1
  169. package/dist/{queues-CCXRs98q.mjs → queues-CnJRaE1o.mjs} +1 -1
  170. package/dist/{r2-BKuBSW8h.mjs → r2-CuC6-zQX.mjs} +48 -45
  171. package/dist/{radar-Gv1yFoRX.mjs → radar-DrQLcbkq.mjs} +1 -1
  172. package/dist/{raw-fetch-DyYWa923.mjs → raw-fetch-B4NvWuZD.mjs} +1 -1
  173. package/dist/{realtime-CVl-rvgx.mjs → realtime-CjsnzHxD.mjs} +1 -1
  174. package/dist/{registrar-swlnh22i.mjs → registrar-BgOsxTnX.mjs} +1 -1
  175. package/dist/{registrar-sandbox-cmOYDnkp.mjs → registrar-sandbox-3ikBD9fB.mjs} +1 -1
  176. package/dist/{registry-C20J1MW0.mjs → registry-CHowrQsZ.mjs} +1 -1
  177. package/dist/{reporting-Bgwsvol1.mjs → reporting-hE127s5r.mjs} +1 -1
  178. package/dist/{request-headers-CUee83pa.mjs → request-headers-DiJeDAn1.mjs} +1 -1
  179. package/dist/{request-tracers-BBiJvVDz.mjs → request-tracers-BCwLxmPN.mjs} +1 -1
  180. package/dist/{resolve-DvxgnWjL.mjs → resolve-CaTBV-c6.mjs} +1 -1
  181. package/dist/resolve-DCGSzUDQ.mjs +2 -0
  182. package/dist/{resource-sharing-C1JiYLbl.mjs → resource-sharing-2qvWUuMa.mjs} +11 -11
  183. package/dist/{resource-tagging-C9VOSlDR.mjs → resource-tagging-Dwx7iL3v.mjs} +1 -1
  184. package/dist/{rules-BDunCGMj.mjs → rules-DxVQ6jIg.mjs} +1 -1
  185. package/dist/rulesets-Cdh8YjI9.mjs +37 -0
  186. package/dist/{rum-B7XiECe9.mjs → rum-a4CMq4Qu.mjs} +1 -1
  187. package/dist/{run-CrZgB8L_.mjs → run-BvHwWWUX.mjs} +1 -1
  188. package/dist/run-CkbrPJPx.mjs +2 -0
  189. package/dist/{schema-DC0kdqgV.mjs → schema-elj12WOx.mjs} +1 -1
  190. package/dist/{schema-flags-BUZR9SLd.mjs → schema-flags-BzoBGPWk.mjs} +1 -1
  191. package/dist/{scim-CORcs2wK.mjs → scim-B8XlXl8v.mjs} +1 -1
  192. package/dist/{secrets-store-BoZQaFey.mjs → secrets-store-Cqhedh_i.mjs} +2 -2
  193. package/dist/{security-insights-DblK_6sg.mjs → security-insights-le2-DteL.mjs} +1 -1
  194. package/dist/{security-txt-Dl7RPnRb.mjs → security-txt-cCArWXur.mjs} +1 -1
  195. package/dist/{session-BWe9et4K.mjs → session-C1BhT1ZJ.mjs} +1 -1
  196. package/dist/shared-BPjcpXuA.mjs +2 -0
  197. package/dist/{smart-shield-DX0-8ruu.mjs → smart-shield-Csyh8hwB.mjs} +1 -1
  198. package/dist/{snippets-BFN-Lg3K.mjs → snippets-DUWx25q6.mjs} +1 -1
  199. package/dist/spawn-IysxuTNW.mjs +10 -0
  200. package/dist/{spectrum-HYWLWB0X.mjs → spectrum-Da3UYSOR.mjs} +1 -1
  201. package/dist/{speed-Dj0YhfRe.mjs → speed-NxlMnB2e.mjs} +1 -1
  202. package/dist/sql-CNdHAlQ8.mjs +4 -0
  203. package/dist/src-JfLDUxFr.mjs +125 -0
  204. package/dist/{ssl-BQL1fNtD.mjs → ssl-BtaX2WEJ.mjs} +1 -1
  205. package/dist/startup-profile-B2l0ChVu.mjs +2 -0
  206. package/dist/{startup-profile-0X5ebbng.mjs → startup-profile-CdJWgNjd.mjs} +1 -1
  207. package/dist/{state-Dy6-rKNd.mjs → state-BDSvdSdP.mjs} +1 -1
  208. package/dist/state-JB4_BU1o.mjs +2 -0
  209. package/dist/{stream-DKv2TtZN.mjs → stream-C1Ijjzn4.mjs} +3 -3
  210. package/dist/{submit-Byt2KBGI.mjs → submit-MdkuU_Pt.mjs} +1 -1
  211. package/dist/{tags-BIBsdG68.mjs → tags-CA1xMM96.mjs} +1 -1
  212. package/dist/telemetry-BsYO3nxG.mjs +2 -0
  213. package/dist/{telemetry-bu3txnIR.mjs → telemetry-Cm39QJ-M.mjs} +1 -1
  214. package/dist/{tenant-Bs4Ac4n3.mjs → tenant-BB6Oszcl.mjs} +1 -1
  215. package/dist/{tenant-custom-nameservers-DcaELeCE.mjs → tenant-custom-nameservers-BsbgYAEo.mjs} +1 -1
  216. package/dist/{tools-BbTX7rlM.mjs → tools-CSc5DmFi.mjs} +1 -1
  217. package/dist/{tunnels-DWcrz9Sf.mjs → tunnels-CRFtyHWz.mjs} +4 -4
  218. package/dist/{turnstile-2MIGp2ce.mjs → turnstile-DBXWo_Xe.mjs} +1 -1
  219. package/dist/update-check-C2oVEbXx.mjs +2 -0
  220. package/dist/{update-check-CfB0PNTY.mjs → update-check-CMXSdres.mjs} +1 -1
  221. package/dist/update-check-worker.mjs +1 -1
  222. package/dist/{url-info-B8udoxlx.mjs → url-info-t-XAs0Mk.mjs} +1 -1
  223. package/dist/{url-normalization-C6AdWtaE.mjs → url-normalization-Cs4F8e0a.mjs} +1 -1
  224. package/dist/{url-scanner-Dg0c_yVb.mjs → url-scanner-CBIoDbTx.mjs} +1 -1
  225. package/dist/{user-BLZ-0Bgv.mjs → user-CevdOMoa.mjs} +3 -3
  226. package/dist/values-CjNlkbIh.mjs +4 -0
  227. package/dist/{vectorize-DEUSEQXY.mjs → vectorize-9d9tPmg5.mjs} +1 -1
  228. package/dist/version-BdVUXLnK.mjs +2 -0
  229. package/dist/{waiting-rooms-BycGk2Y0.mjs → waiting-rooms--5WmrWb3.mjs} +1 -1
  230. package/dist/{web-assets-CLZdWOmN.mjs → web-assets-BHot_MU8.mjs} +1 -1
  231. package/dist/{web3-DjeavuLg.mjs → web3-CYfWAF6b.mjs} +1 -1
  232. package/dist/{workers-C_SfyU-v.mjs → workers-S17M0n3h.mjs} +23 -21
  233. package/dist/{workers-builds-COn5Ne5G.mjs → workers-builds-Dw7ho3So.mjs} +2 -2
  234. package/dist/{workers-for-platforms-tchCXwNF.mjs → workers-for-platforms-A3yjyLh3.mjs} +4 -6
  235. package/dist/{workers-vpc-CKts8Av0.mjs → workers-vpc-BZ2xXtC3.mjs} +1 -1
  236. package/dist/{workflows-BibtWuOx.mjs → workflows-BgGrVpSR.mjs} +1 -1
  237. package/dist/{wrangler-migration-BpJqCFAa.mjs → wrangler-migration-C6FKHER1.mjs} +1 -1
  238. package/dist/{zaraz-BvQZB0YY.mjs → zaraz-BsD2dMI3.mjs} +1 -1
  239. package/dist/{zero-trust-FStq4uhn.mjs → zero-trust-CA3iGQbG.mjs} +413 -397
  240. package/dist/{zone-tymlghWb.mjs → zone-D2M4EZD0.mjs} +1 -1
  241. package/dist/{zones-Bz6dgT9_.mjs → zones-BoOC_JzC.mjs} +1 -1
  242. package/package.json +25 -26
  243. package/dist/account-tags-d0RkEw6s.mjs +0 -15
  244. package/dist/ai-gateway-CJaUlfGc.mjs +0 -82
  245. package/dist/ai-search-PTlpY1T9.mjs +0 -79
  246. package/dist/analytics-NPND7aHB.mjs +0 -20
  247. package/dist/argo-DYfLQhd2.mjs +0 -10
  248. package/dist/auth-CBtzZ3Sw.mjs +0 -2
  249. package/dist/browser-run-DVaiBLYX.mjs +0 -46
  250. package/dist/build-C4giET85.mjs +0 -2
  251. package/dist/cf-B9aqZZKD.mjs +0 -18
  252. package/dist/chunk-KKDV4JPS-D3kwd1Nq.mjs +0 -2
  253. package/dist/cloudflared-B48cfu95.mjs +0 -2
  254. package/dist/command-CzvlHvov.mjs +0 -2
  255. package/dist/deploy-BS47vZvJ.mjs +0 -2
  256. package/dist/deploy-context-Cfushp8j.mjs +0 -56
  257. package/dist/deploy-input-BAhS5LYx.mjs +0 -2
  258. package/dist/dialog-CL1Zy4pn.mjs +0 -2
  259. package/dist/dist-8rP3V95o.mjs +0 -57
  260. package/dist/dry-run-DmsbOMF1.mjs +0 -2
  261. package/dist/error-sanitization-C_a2LxOK.mjs +0 -2
  262. package/dist/init-j47MT4Qe.mjs +0 -39
  263. package/dist/interactive-Dqv0RWVU.mjs +0 -42
  264. package/dist/interactive-Wpd3FcDc.mjs +0 -2
  265. package/dist/k2-CmHkArHL.mjs +0 -13
  266. package/dist/local-D5L5Bwju.mjs +0 -2
  267. package/dist/mesh-DtrIzl5z.mjs +0 -26
  268. package/dist/observability-CvN9oxAo.mjs +0 -80
  269. package/dist/pay-per-crawl-5-KTQXRr.mjs +0 -65
  270. package/dist/pay-per-use-sGebKzNK.mjs +0 -6
  271. package/dist/prompt-F5wxc8zq.mjs +0 -3
  272. package/dist/resolve-qwL1LmKN.mjs +0 -2
  273. package/dist/rulesets-BMGxrnv9.mjs +0 -37
  274. package/dist/run-nNxXb_Cv.mjs +0 -2
  275. package/dist/shared-0N31BXkY.mjs +0 -2
  276. package/dist/spawn-DZ9A-xXb.mjs +0 -10
  277. package/dist/src-CAiZlihY.mjs +0 -117
  278. package/dist/startup-profile-CXnsF4c7.mjs +0 -2
  279. package/dist/state-BA2CanJ_.mjs +0 -2
  280. package/dist/telemetry-DBXOMuLh.mjs +0 -2
  281. package/dist/update-check-B-CvDAUz.mjs +0 -2
  282. package/dist/values-BUK-m0Jg.mjs +0 -4
  283. package/dist/version-BZNc7Y3t.mjs +0 -2
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-DlT72Xpn.mjs";import{i as t,n}from"./auth-CGLsxbc6.mjs";import{a as r,t as i}from"./context-q7UaYK69.mjs";import{t as a}from"./output-BOe-3AQG.mjs";import{t as o}from"./dry-run-DRj2_uV3.mjs";import{t as s}from"./progress-BtkTVcHI.mjs";import{t as c}from"./run-BvHwWWUX.mjs";import"./telemetry-BsYO3nxG.mjs";import{n as l,r as u,t as d}from"./body-parser-DkHKPkJ7.mjs";import{n as f,t as p}from"./input-validation-D7z60HJH.mjs";import{a as m,i as h,n as g}from"./prompt-RlgRrmbm.mjs";import{t as _}from"./cli-types-9oYmRTHJ.mjs";import{n as ee,t as te}from"./raw-fetch-B4NvWuZD.mjs";function v(e){return e.usage(`$0 ai-search chat-completions <instance-id>
3
+
4
+ Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).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`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).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`}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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 y={command:`chat-completions <instance-id>`,describe:`Chat Completions`,builder:v,handler:async t=>c({command:`ai-search chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/chat/completions`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.chatCompletions({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Created`});return}if(t.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}),h=await s(`Creating`,async()=>c.aiSearch.chatCompletions({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Created`})})};function b(e){return e.usage(`$0 ai-search create <namespace> <id>
5
+
6
+ Create a new AI Search instance with the given configuration. If type is omitted or null, a non-blank HTTP(S) source infers web-crawler and any other source infers r2; r2 sources must name an existing bucket. A missing or blank source without a type creates a managed upload-only instance.`).positional(`namespace`,{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:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).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. Defaults to true for new instances; set false to create a vector-only instance.`,default:!0}).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(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).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-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version 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`}).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`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).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:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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`}).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(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`Source type. When omitted or null with a non-blank source, HTTP(S) URLs infer web-crawler and existing R2 bucket names infer r2. A missing or blank source without a type uses managed upload-only storage.`,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}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].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 --metadata-* flag is set`)}return!0})}const x={command:`create <namespace> <id>`,describe:`Create an AI Search instance.`,builder:b,handler:async t=>c({command:`ai-search create`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.hybrid-search-enabled.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.type.dry-run`.split(`.`)}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:t[`hybrid-search-enabled`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`),use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:f(t[`metadata-created-from-emdash-plugin-type`],`metadata-created-from-emdash-plugin-type`,`text`),version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:f(t[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:f(t[`token-id`],`token-id`,`text`),type:f(t.type,`type`,`text`),id:t.id}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.create({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}let m=d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:t[`hybrid-search-enabled`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`),use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:f(t[`metadata-created-from-emdash-plugin-type`],`metadata-created-from-emdash-plugin-type`,`text`),version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:f(t[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:f(t[`token-id`],`token-id`,`text`),type:f(t.type,`type`,`text`),id:t.id}),h=await s(`Creating`,async()=>c.aiSearch.create({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function S(e){return e.usage(`$0 ai-search delete <instance-id>
7
+
8
+ Permanently delete an AI Search instance and all its indexed data.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 C={command:`delete <instance-id>`,describe:`Delete an AI Search instance.`,builder:S,handler:async t=>c({command:`ai-search delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
9
+ `);return}let u=await s(`Deleting`,async()=>c.aiSearch.delete({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Deleted`})})};function w(e){return e.usage(`$0 ai-search get <instance-id>
10
+
11
+ Retrieve the configuration and status of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 T={command:`get <instance-id>`,describe:`Get an AI Search instance.`,builder:w,handler:async t=>c({command:`ai-search get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Loaded`})})};function E(e){return e.usage(`$0 ai-search items chunks <item-id>
12
+
13
+ Lists chunks for a specific item in an AI Search instance, including their text content.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 D={command:`chunks <item-id>`,describe:`List Item Chunks.`,builder:E,handler:async t=>c({command:`ai-search items chunks`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={limit:t.limit,offset:t.offset};if(t.dryRun){let e=await r();o({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/chunks`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.chunks({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`],...c}));a(d,{successLabel:`Loaded`})})};function O(e){return e.usage(`$0 ai-search items delete <item-id>
14
+
15
+ Deletes a file from a managed AI Search instance and removes its indexed data.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 k={command:`delete <item-id>`,describe:`Delete Item.`,builder:O,handler:async t=>c({command:`ai-search items delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force})){process.stderr.write(`Aborted.
16
+ `);return}let u=await s(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(u,{successLabel:`Deleted`})})};function A(e){return e.usage(`$0 ai-search items download <item-id>
17
+
18
+ Downloads the raw file content for a specific item from the managed AI Search instance storage.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 j={command:`download <item-id>`,describe:`Download Item Content.`,builder:A,handler:async t=>c({command:`ai-search items download`,classification:{safeFlags:[`dry-run`,`text`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/download`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}await n(t);let a=t.local?e:await i();t.accountId=a;let c=await s(`Loading`,async()=>te(`/accounts/${a}/ai-search/namespaces/${encodeURIComponent(String(t.namespace))}/instances/${encodeURIComponent(String(t[`instance-id`]))}/items/${encodeURIComponent(String(t[`item-id`]))}/download`,{method:`GET`,local:t.local===!0,persistTo:t.persistTo}));ee(t.text===!0?c.toString(`utf-8`):c)})};function M(e){return e.usage(`$0 ai-search items get <item-id>
19
+
20
+ Retrieves a specific indexed item from an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 N={command:`get <item-id>`,describe:`Get Item.`,builder:M,handler:async t=>c({command:`ai-search items get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.items.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(u,{successLabel:`Loaded`})})};function P(e){return e.usage(`$0 ai-search items list
21
+
22
+ Lists indexed items in an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 F={command:`list`,describe:`Items List.`,builder:_(P),handler:async t=>c({command:`ai-search items list`,classification:{safeFlags:[`sort-by`,`status`,`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search,sort_by:t[`sort-by`],status:t.status,source:t.source,metadata_filter:t[`metadata-filter`],item_id:t[`item-id`],key:t.key};if(t.dryRun){let e=await r();o({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.list({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],...c}));a(d,{successLabel:`Loaded`})})};function I(e){return e.usage(`$0 ai-search items logs <item-id>
23
+
24
+ Lists processing logs for a specific item in an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 L={command:`logs <item-id>`,describe:`Item Logs.`,builder:I,handler:async t=>c({command:`ai-search items logs`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={limit:t.limit,cursor:t.cursor};if(t.dryRun){let e=await r();o({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/logs`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.logs({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`],...c}));a(d,{successLabel:`Loaded`})})};function R(e){return e.usage(`$0 ai-search items sync <item-id>
25
+
26
+ Syncs an item to an AI Search instance index.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. 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 z={command:`sync <item-id>`,describe:`Sync Item.`,builder:R,handler:async t=>c({command:`ai-search items sync`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.items.sync({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(n,{successLabel:`Updated`});return}t[`next-action`]===void 0&&(t[`next-action`]=await h(`next-action`,`The next_action field`,[`INDEX`]));let p=d({next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]}),m=await s(`Updating`,async()=>c.aiSearch.items.sync({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(m,{successLabel:`Updated`})})};function B(e){return e.usage(`$0 ai-search items upload <instance-id>
27
+
28
+ Uploads a file to a managed AI Search instance via multipart/form-data.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. Defaults to false.`})}const V={command:`upload <instance-id>`,describe:`Upload Item.`,builder:B,handler:async l=>c({command:`ai-search items upload`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){let e=await r();o({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${l.namespace==null?`<namespace>`:encodeURIComponent(String(l.namespace))}/instances/${l[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(l[`instance-id`]))}/items`,pathParams:{"instance-id":String(l[`instance-id`]??``),namespace:String(l.namespace??``)},bodyKind:`multipart`,body:{body:l.body,file:l.file,metadata:l.metadata,"wait-for-completion":l[`wait-for-completion`]}});return}let c=await n(l),u=l.local?e:await i();if(l.accountId=u,l.file!==void 0||l.body!==void 0||l.metadata!==void 0||l[`wait-for-completion`]!==void 0){let e=new FormData;if(l.file){let t=p(l.file);e.append(`file`,new Blob([t]),l.file.split(/[\\/]/).filter(Boolean).pop())}else l.body!==void 0&&e.append(`file`,l.body);l.metadata!==void 0&&e.append(`metadata`,String(f(l.metadata,`metadata`,`text`)??``)),l[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(l[`wait-for-completion`]));let n=await s(`Creating`,async()=>t(c,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(l.namespace))}/instances/${encodeURIComponent(String(l[`instance-id`]))}/items`,{body:e}));a(n,{successLabel:`Created`});return}if(l.body){let e=f(l.body,`body`,`binary`),n=await s(`Creating`,async()=>t(c,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(l.namespace))}/instances/${encodeURIComponent(String(l[`instance-id`]))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}}));a(n,{successLabel:`Created`});return}if(l.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function H(e){return e.usage(`$0 ai-search items upsert <instance-id>
29
+
30
+ Creates or updates an indexed item in an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. 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 U={command:`upsert <instance-id>`,describe:`Create or Update Item.`,builder:H,handler:async t=>c({command:`ai-search items upsert`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({key:f(t.key,`key`,`text`),next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.items.upsert({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}t.key===void 0&&(t.key=await m(`key`,`Item key / filename. Must not exceed 128 characters.`)),t[`next-action`]===void 0&&(t[`next-action`]=await h(`next-action`,`The next_action field`,[`INDEX`]));let p=d({key:f(t.key,`key`,`text`),next_action:f(t[`next-action`],`next-action`,`text`),wait_for_completion:t[`wait-for-completion`]}),g=await s(`Updating`,async()=>c.aiSearch.items.upsert({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(g,{successLabel:`Updated`})})},W={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.usage(`$0 ai-search jobs cancel <job-id>
31
+
32
+ Cancel an in-progress indexing job for an AI Search instance.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 K={command:`cancel <job-id>`,describe:`Cancel an indexing job.`,builder:G,handler:async t=>c({command:`ai-search jobs cancel`,classification:{safeFlags:[`action`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({action:f(t.action,`action`,`text`)}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,!await g({force:!!t.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
33
+ `);return}if(t.body){let e=l(t.body),n=await s(`Deleting`,async()=>c.aiSearch.jobs.cancel({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(n,{successLabel:`Deleted`});return}t.action===void 0&&(t.action=await h(`action`,`The action field`,[`cancel`]));let p=d({action:f(t.action,`action`,`text`)}),m=await s(`Deleting`,async()=>c.aiSearch.jobs.cancel({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(m,{successLabel:`Deleted`})})};function q(e){return e.usage(`$0 ai-search jobs create <instance-id>
34
+
35
+ Creates a new indexing job for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 J={command:`create <instance-id>`,describe:`Create new job`,builder:q,handler:async t=>c({command:`ai-search jobs create`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`)}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.jobs.create({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Created`});return}let p=d({description:f(t.description,`description`,`text`)}),m=await s(`Creating`,async()=>c.aiSearch.jobs.create({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(m,{successLabel:`Created`})})};function Y(e){return e.usage(`$0 ai-search jobs get <job-id>
36
+
37
+ Retrieves details for a specific AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 X={command:`get <job-id>`,describe:`Get a Job Details`,builder:Y,handler:async t=>c({command:`ai-search jobs get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(u,{successLabel:`Loaded`})})};function Z(e){return e.usage(`$0 ai-search jobs list
38
+
39
+ Lists indexing jobs for an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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:`list`,describe:`List Jobs`,builder:Z,handler:async t=>c({command:`ai-search jobs list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`]};if(t.dryRun){let e=await r();o({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.jobs.list({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],...c}));a(d,{successLabel:`Loaded`})})};function ne(e){return e.usage(`$0 ai-search jobs logs <job-id>
40
+
41
+ Lists log entries for an AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-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 re={command:`logs <job-id>`,describe:`List Job Logs`,builder:ne,handler:async t=>c({command:`ai-search jobs logs`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`]};if(t.dryRun){let e=await r();o({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}/logs`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.jobs.logs({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`],...c}));a(d,{successLabel:`Loaded`})})},ie={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(K).command(J).command(X).command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.usage(`$0 ai-search list
42
+
43
+ List all AI Search instances in the account.`).option(`namespace`,{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(`hostname`,{type:`string`,description:`Filter by exact Search for Agents hostname (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 oe={command:`list`,describe:`List AI Search instances.`,builder:_(ae),handler:async t=>c({command:`ai-search list`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search,hostname:t.hostname,order_by:t[`order-by`],order_by_direction:t[`order-by-direction`]};if(t.dryRun){let e=await r();o({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances`,pathParams:{namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.list({account_id:u,namespace:t.namespace,...c}));a(d,{successLabel:`Loaded`})})};function se(e){return e.usage(`$0 ai-search move <instance-id>
44
+
45
+ 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).`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`source-namespace`,{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 ce={command:`move <instance-id>`,describe:`Move an instance to a different namespace.`,builder:se,handler:async t=>c({command:`ai-search move`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t[`source-namespace`]==null?`<source-namespace>`:encodeURIComponent(String(t[`source-namespace`]))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"source-namespace":String(t[`source-namespace`]??``),"instance-id":String(t[`instance-id`]??``)},bodyKind:`json`,body:t.body===void 0?d({new_namespace:f(t[`destination-namespace`],`destination-namespace`,`text`)}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.move({...e,account_id:u,"source-namespace":t[`source-namespace`],"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}t[`destination-namespace`]===void 0&&(t[`destination-namespace`]=await m(`destination-namespace`,`Target namespace to move the instance into.`));let p=d({new_namespace:f(t[`destination-namespace`],`destination-namespace`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.move({...p,account_id:u,"source-namespace":t[`source-namespace`],"instance-id":t[`instance-id`]}));a(h,{successLabel:`Updated`})})};function le(e){return e.usage(`$0 ai-search multi-chat-completions <namespace>
46
+
47
+ Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`).positional(`namespace`,{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-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).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(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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 ue={command:`multi-chat-completions <namespace>`,describe:`Multi-Instance Chat Completions`,builder:le,handler:async t=>c({command:`ai-search multi-chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/chat/completions`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.multiChatCompletions({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);if(t.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}),h=await s(`Creating`,async()=>c.aiSearch.multiChatCompletions({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function de(e){return e.usage(`$0 ai-search multi-search <namespace> <query>
48
+
49
+ Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`).positional(`namespace`,{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-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).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(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).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:`multi-search <namespace> <query>`,describe:`Multi-Instance Search`,builder:de,handler:async t=>c({command:`ai-search multi-search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/search`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.multiSearch({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}),h=await s(`Creating`,async()=>c.aiSearch.multiSearch({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function pe(e){return e.usage(`$0 ai-search namespace create <namespace>
50
+
51
+ Create a namespace for organizing AI Search instances.`).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`}).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 me={command:`create <namespace>`,describe:`Create a namespace`,builder:pe,handler:async t=>c({command:`ai-search namespace create`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},name:t.namespace}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.namespace.create({...e,account_id:u}));a(n,{successLabel:`Created`});return}let p=d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},name:t.namespace}),m=await s(`Creating`,async()=>c.aiSearch.namespace.create({...p,account_id:u}));a(m,{successLabel:`Created`})})};function he(e){return e.usage(`$0 ai-search namespace delete <namespace>
52
+
53
+ Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`).positional(`namespace`,{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 ge={command:`delete <namespace>`,describe:`Delete a namespace`,builder:he,handler:async t=>c({command:`ai-search namespace delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
54
+ `);return}let u=await s(`Deleting`,async()=>c.aiSearch.namespace.delete({account_id:l,namespace:t.namespace}));a(u,{successLabel:`Deleted`})})};function _e(e){return e.usage(`$0 ai-search namespace get <namespace>
55
+
56
+ Retrieve a namespace and its description.`).positional(`namespace`,{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 ve={command:`get <namespace>`,describe:`Get a namespace`,builder:_e,handler:async t=>c({command:`ai-search namespace get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.namespace.get({account_id:l,namespace:t.namespace}));a(u,{successLabel:`Loaded`})})};function ye(e){return e.usage(`$0 ai-search namespace list
57
+
58
+ List namespaces in the account, including their descriptions and creation times.`).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 be={command:`list`,describe:`List namespaces`,builder:ye,handler:async t=>c({command:`ai-search namespace list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){let e=await r();o({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.namespace.list({account_id:u,...c}));a(d,{successLabel:`Loaded`})})};function xe(e){return e.usage(`$0 ai-search namespace update <namespace>
59
+
60
+ 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.`).positional(`namespace`,{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 Se={command:`update <namespace>`,describe:`Update a namespace`,builder:xe,handler:async t=>c({command:`ai-search namespace update`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}}}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.namespace.update({...e,account_id:u,namespace:t.namespace}));a(n,{successLabel:`Updated`});return}let p=d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}}}),m=await s(`Updating`,async()=>c.aiSearch.namespace.update({...p,account_id:u,namespace:t.namespace}));a(m,{successLabel:`Updated`})})},Ce={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(me).command(ge).command(ve).command(be).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.usage(`$0 ai-search purge-cache <instance-id>
61
+
62
+ Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 Te={command:`purge-cache <instance-id>`,describe:`Purge search cache.`,builder:we,handler:async t=>c({command:`ai-search purge-cache`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/purge_cache`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Creating`,async()=>c.aiSearch.purgeCache({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Created`})})};function Ee(e){return e.usage(`$0 ai-search search <instance-id> <query>
63
+
64
+ Executes a semantic search query against an AI Search instance to find relevant indexed content.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`namespace`,{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-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).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`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).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`}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).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 De={command:`search <instance-id> <query>`,describe:`Search`,builder:Ee,handler:async t=>c({command:`ai-search search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/search`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Loading`,async()=>c.aiSearch.search({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Loaded`});return}let m=d({ai_search_options:{cache:{cache_threshold:f(t[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:f(t[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:f(t[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:f(t[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}),h=await s(`Loading`,async()=>c.aiSearch.search({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Loaded`})})};function Oe(e){return e.usage(`$0 ai-search stats <instance-id>
65
+
66
+ Retrieve usage and indexing statistics for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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 ke={command:`stats <instance-id>`,describe:`Get instance statistics.`,builder:Oe,handler:async t=>c({command:`ai-search stats`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/stats`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.stats({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Loaded`})})};function Ae(e){return e.usage(`$0 ai-search tokens create <name>
67
+
68
+ Create a stored Cloudflare credential for an AI Search instance to access its data source.`).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 je={command:`create <name>`,describe:`Create a token`,builder:Ae,handler:async t=>c({command:`ai-search tokens create`,classification:{safeFlags:[`legacy`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:t.body===void 0?d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:t.name}):l(t.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.tokens.create({...e,account_id:u}));a(n,{successLabel:`Created`});return}t[`api-token-id`]===void 0&&(t[`api-token-id`]=await m(`api-token-id`,`The cf_api_id field`)),t[`api-token`]===void 0&&(t[`api-token`]=await m(`api-token`,`The cf_api_key field`,{kind:`secret`}));let p=d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:t.name}),h=await s(`Creating`,async()=>c.aiSearch.tokens.create({...p,account_id:u}));a(h,{successLabel:`Created`})})};function Me(e){return e.usage(`$0 ai-search tokens delete <token-id>
69
+
70
+ Permanently delete a stored AI Search credential. Credentials in use by an instance cannot be deleted.`).positional(`token-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 Ne={command:`delete <token-id>`,describe:`Delete a token`,builder:Me,handler:async t=>c({command:`ai-search tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
71
+ `);return}let u=await s(`Deleting`,async()=>c.aiSearch.tokens.delete({account_id:l,"token-id":t[`token-id`]}));a(u,{successLabel:`Deleted`})})};function Pe(e){return e.usage(`$0 ai-search tokens get <token-id>
72
+
73
+ Retrieve a stored AI Search credential without exposing its secret.`).positional(`token-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 $={command:`get <token-id>`,describe:`Get a token`,builder:Pe,handler:async t=>c({command:`ai-search tokens get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.tokens.get({account_id:l,"token-id":t[`token-id`]}));a(u,{successLabel:`Loaded`})})};function Fe(e){return e.usage(`$0 ai-search tokens list
74
+
75
+ List stored AI Search credentials in the account without exposing their secrets.`).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 Ie={command:`list`,describe:`List tokens`,builder:Fe,handler:async t=>c({command:`ai-search tokens list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){let e=await r();o({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.tokens.list({account_id:u,...c}));a(d,{successLabel:`Loaded`})})};function Le(e){return e.usage(`$0 ai-search tokens update <token-id>
76
+
77
+ Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`).positional(`token-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 Re={command:`update <token-id>`,describe:`Update a token`,builder:Le,handler:async t=>c({command:`ai-search tokens update`,classification:{safeFlags:[`legacy`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`json`,body:t.body===void 0?d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:f(t.name,`name`,`text`)}):l(t.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.tokens.update({...e,account_id:u,"token-id":t[`token-id`]}));a(n,{successLabel:`Updated`});return}t[`api-token-id`]===void 0&&(t[`api-token-id`]=await m(`api-token-id`,`The cf_api_id field`)),t[`api-token`]===void 0&&(t[`api-token`]=await m(`api-token`,`The cf_api_key field`,{kind:`secret`})),t.name===void 0&&(t.name=await m(`name`,`The name field`));let p=d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:f(t.name,`name`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.tokens.update({...p,account_id:u,"token-id":t[`token-id`]}));a(h,{successLabel:`Updated`})})},ze={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(je).command(Ne).command($).command(Ie).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.usage(`$0 ai-search update <instance-id>
78
+
79
+ Update the configuration of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{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:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).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(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).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-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version 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`}).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:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).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`}).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}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].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 --metadata-* flag is set`)}return!0})}const Ve={command:`update <instance-id>`,describe:`Update an AI Search instance.`,builder:Be,handler:async t=>c({command:`ai-search update`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.paused.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.summarization.dry-run`.split(`.`)}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`),use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:f(t[`metadata-created-from-emdash-plugin-type`],`metadata-created-from-emdash-plugin-type`,`text`),version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:f(t[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.update({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}let m=d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:f(t[`cache-threshold`],`cache-threshold`,`text`),chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:f(t[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:f(t[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`),use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:f(t[`metadata-created-from-emdash-plugin-type`],`metadata-created-from-emdash-plugin-type`,`text`),version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:f(t[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:f(t[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:f(t[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:f(t[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.update({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Updated`})})},He={command:`ai-search`,describe:`Managed search-as-a-service: crawl, index, and query content with AI-powered relevance and chat completions`,builder:e=>e.command(y).command(x).command(C).command(T).command(oe).command(ce).command(ue).command(fe).command(Te).command(De).command(ke).command(Ve).command(W).command(ie).command(Ce).command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{He as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{n as e}from"./auth-AobvBmz4.mjs";import{i as t}from"./context-Bwkz4Lm_.mjs";import{t as n}from"./output-BGqhvqe2.mjs";import{t as r}from"./dry-run-DmsbOMF1.mjs";import{t as i}from"./progress-BYVZuEcG.mjs";import{t as a}from"./run-CrZgB8L_.mjs";import"./telemetry-DBXOMuLh.mjs";import{n as o,r as s,t as c}from"./body-parser-DkHKPkJ7.mjs";import{n as l}from"./prompt-F5wxc8zq.mjs";function u(e){return e.usage(`$0 ai-security custom-topics get
2
+ import{n as e}from"./auth-CGLsxbc6.mjs";import{i as t}from"./context-q7UaYK69.mjs";import{t as n}from"./output-BOe-3AQG.mjs";import{t as r}from"./dry-run-DRj2_uV3.mjs";import{t as i}from"./progress-BtkTVcHI.mjs";import{t as a}from"./run-BvHwWWUX.mjs";import"./telemetry-BsYO3nxG.mjs";import{n as o,r as s,t as c}from"./body-parser-DkHKPkJ7.mjs";import{n as l}from"./prompt-RlgRrmbm.mjs";function u(e){return e.usage(`$0 ai-security custom-topics get
3
3
 
4
4
  Get the custom topic categories defined for the zone. While AI Security for Apps is enabled, it scores every incoming prompt against these topics and writes the scores to the \`cf.llm.prompt.custom_topic_categories\` field, keyed by topic label. Topics can be configured while the detection is disabled, but no prompt is scored until you enable it.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const d={command:`get`,describe:`Get the AI Security for Apps custom topics of a zone.`,builder:u,handler:async o=>a({command:`ai-security custom-topics get`,classification:{safeFlags:[`dry-run`]}},o,async()=>{if(o.dryRun){r({command:`cf ai-security custom-topics get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${o.zone??o.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(o.zone??o[`zone-id`]??``)},bodyKind:`none`});return}let a=await e(o),s=await t({zone:o.zone},a,{quiet:o.quiet});o.zoneId=s;let c=await i(`Loading`,async()=>a.aiSecurity.customTopics.get({zone_id:s}));n(c,{successLabel:`Loaded`})})};function f(e){return e.usage("$0 ai-security custom-topics update\n\nUpdate the custom topic list of the zone, overwriting it entirely with the topics in the request, so include every topic you want to keep. Changes can take up to a minute to propagate. Each entry has a `label`, used to reference the topic in rule expressions and analytics, and a `topic` description, which the classifier scores prompts against while AI Security for Apps is enabled. The following rules apply: - A zone can hold at most 20 topics. - `label` must be 2–20 characters, using only lowercase letters (a–z), digits (0–9), and hyphens. - `topic` must be 2–50 printable ASCII characters. - Labels must be unique within the zone, and so must topic descriptions.").option(`topics`,{type:`string`,description:`Custom topic categories for AI Security for Apps content detection. Provide as a JSON array of objects or @path/to/file.json.`}).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 p={command:`update`,describe:`Update the AI Security for Apps custom topics of a zone.`,builder:f,handler:async u=>a({command:`ai-security custom-topics update`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},u,async()=>{if(u.dryRun){r({command:`cf ai-security custom-topics update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${u.zone??u.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(u.zone??u[`zone-id`]??``)},bodyKind:`json`,body:u.body===void 0?c({topics:s(u.topics,`topics`)}):o(u.body)});return}let a=await e(u),d=await t({zone:u.zone},a,{quiet:u.quiet});if(u.zoneId=d,!await l({force:!!u.force,message:`This operation overwrites the AI Security for Apps custom topics for a zone.`})){process.stderr.write(`Aborted.
5
5
  `);return}if(u.body){let e=o(u.body),t=await i(`Deleting`,async()=>a.aiSecurity.customTopics.update({body:e,zone_id:d}));n(t,{successLabel:`Deleted`});return}let f=c({topics:s(u.topics,`topics`)}),p=await i(`Deleting`,async()=>a.aiSecurity.customTopics.update({body:f,zone_id:d}));n(p,{successLabel:`Deleted`})})},m={command:`custom-topics`,describe:`Organization-specific topic categories used by AI Security for Apps content detection`,builder:e=>e.command(d).command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function h(e){return e.usage(`$0 ai-security get
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-C0lQ9sTg.mjs";import{n as t}from"./auth-AobvBmz4.mjs";import{a as n,t as r}from"./context-Bwkz4Lm_.mjs";import{t as i}from"./output-BGqhvqe2.mjs";import{t as a}from"./dry-run-DmsbOMF1.mjs";import{t as o}from"./progress-BYVZuEcG.mjs";import{t as s}from"./run-CrZgB8L_.mjs";import"./telemetry-DBXOMuLh.mjs";import{n as c,t as l}from"./body-parser-DkHKPkJ7.mjs";import{n as u}from"./input-validation-D7z60HJH.mjs";import{a as d,i as f,n as p}from"./prompt-F5wxc8zq.mjs";import{n as m,t as h}from"./raw-fetch-DyYWa923.mjs";function g(e){return e.usage(`$0 alerting available-alerts list
2
+ import{t as e}from"./local-DlT72Xpn.mjs";import{n as t}from"./auth-CGLsxbc6.mjs";import{a as n,t as r}from"./context-q7UaYK69.mjs";import{t as i}from"./output-BOe-3AQG.mjs";import{t as a}from"./dry-run-DRj2_uV3.mjs";import{t as o}from"./progress-BtkTVcHI.mjs";import{t as s}from"./run-BvHwWWUX.mjs";import"./telemetry-BsYO3nxG.mjs";import{n as c,t as l}from"./body-parser-DkHKPkJ7.mjs";import{n as u}from"./input-validation-D7z60HJH.mjs";import{a as d,i as f,n as p}from"./prompt-RlgRrmbm.mjs";import{n as m,t as h}from"./raw-fetch-B4NvWuZD.mjs";function g(e){return e.usage(`$0 alerting available-alerts list
3
3
 
4
4
  Gets a list of all alert types for which an account is eligible.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Get Alert Types`,builder:g,handler:async c=>s({command:`alerting available-alerts list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();c.accountId=l;let u=await o(`Loading`,async()=>s.alerting.availableAlerts.list({account_id:l}));i(u,{successLabel:`Loaded`})})},_={command:`available-alerts`,describe:`Operations for available-alerts`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function v(e){return e.usage(`$0 alerting destinations eligible get
5
5
 
@@ -14,7 +14,7 @@ Get a list of all configured PagerDuty services.`).option(`dry-run`,{type:`boole
14
14
 
15
15
  Links PagerDuty with the account using the integration token.`).positional(`token-id`,{type:`string`,description:`The token integration key`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`link <token-id>`,describe:`Connect PagerDuty`,builder:D,handler:async c=>s({command:`alerting destinations pagerduty link`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf alerting destinations pagerduty link`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/pagerduty/connect/${c[`token-id`]==null?`<token-id>`:encodeURIComponent(String(c[`token-id`]))}`,pathParams:{"token-id":String(c[`token-id`]??``)},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();c.accountId=l;let u=await o(`Loading`,async()=>s.alerting.destinations.pagerduty.link({account_id:l,token_id:c[`token-id`]}));i(u,{successLabel:`Loaded`})})},k={command:`pagerduty`,describe:`Operations for destinations.pagerduty`,builder:e=>e.command(S).command(w).command(E).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.usage(`$0 alerting destinations webhooks create
16
16
 
17
- Creates a new webhook destination.`).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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 j={command:`create`,describe:`Create a webhook`,builder:A,handler:async f=>s({command:`alerting destinations webhooks create`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:f.body===void 0?l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}):c(f.body)});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Creating`,async()=>s.alerting.destinations.webhooks.create({...e,account_id:p}));i(t,{successLabel:`Created`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),f.url===void 0&&(f.url=await d(`url`,`The POST endpoint to call when dispatching a notification.`));let m=l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}),h=await o(`Creating`,async()=>s.alerting.destinations.webhooks.create({...m,account_id:p}));i(h,{successLabel:`Created`})})};function M(e){return e.usage(`$0 alerting destinations webhooks delete <webhook-id>
17
+ Creates a new webhook destination.`).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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 j={command:`create`,describe:`Create a webhook`,builder:A,handler:async f=>s({command:`alerting destinations webhooks create`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf alerting destinations webhooks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`json`,body:f.body===void 0?l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}):c(f.body),sensitiveBodyPaths:[[`secret`]]});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Creating`,async()=>s.alerting.destinations.webhooks.create({...e,account_id:p}));i(t,{successLabel:`Created`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),f.url===void 0&&(f.url=await d(`url`,`The POST endpoint to call when dispatching a notification.`));let m=l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}),h=await o(`Creating`,async()=>s.alerting.destinations.webhooks.create({...m,account_id:p}));i(h,{successLabel:`Created`})})};function M(e){return e.usage(`$0 alerting destinations webhooks delete <webhook-id>
18
18
 
19
19
  Delete a configured webhook destination.`).positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,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 N={command:`delete <webhook-id>`,describe:`Delete a webhook`,builder:M,handler:async c=>s({command:`alerting destinations webhooks delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf alerting destinations webhooks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks/${c[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(c[`webhook-id`]))}`,pathParams:{"webhook-id":String(c[`webhook-id`]??``)},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();if(c.accountId=l,!await p({force:!!c.force,message:`This operation deletes the webhook destination.`})){process.stderr.write(`Aborted.
20
20
  `);return}let u=await o(`Deleting`,async()=>s.alerting.destinations.webhooks.delete({account_id:l,webhook_id:c[`webhook-id`]}));i(u,{successLabel:`Deleted`})})};function P(e){return e.usage(`$0 alerting destinations webhooks get <webhook-id>
@@ -23,7 +23,7 @@ Get details for a single webhooks destination.`).positional(`webhook-id`,{type:`
23
23
 
24
24
  Gets a list of all configured webhook destinations.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`List webhooks`,builder:I,handler:async c=>s({command:`alerting destinations webhooks list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf alerting destinations webhooks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks`,pathParams:{},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();c.accountId=l;let u=await o(`Loading`,async()=>s.alerting.destinations.webhooks.list({account_id:l}));i(u,{successLabel:`Loaded`})})};function R(e){return e.usage(`$0 alerting destinations webhooks update <webhook-id>
25
25
 
26
- Update a webhook destination.`).positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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 z={command:`update <webhook-id>`,describe:`Update a webhook`,builder:R,handler:async f=>s({command:`alerting destinations webhooks update`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks/${f[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(f[`webhook-id`]))}`,pathParams:{"webhook-id":String(f[`webhook-id`]??``)},bodyKind:`json`,body:f.body===void 0?l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}):c(f.body)});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Updating`,async()=>s.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:f[`webhook-id`]}));i(t,{successLabel:`Updated`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),f.url===void 0&&(f.url=await d(`url`,`The POST endpoint to call when dispatching a notification.`));let m=l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}),h=await o(`Updating`,async()=>s.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:f[`webhook-id`]}));i(h,{successLabel:`Updated`})})},B={command:`webhooks`,describe:`Operations for destinations.webhooks`,builder:e=>e.command(j).command(N).command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(b).command(k).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.usage(`$0 alerting history list
26
+ Update a webhook destination.`).positional(`webhook-id`,{type:`string`,description:`The unique identifier of a webhook`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`}).option(`secret`,{type:`string`,description:"Optional secret that will be passed in the `cf-webhook-auth` header when dispatching generic webhook notifications or formatted for supported destinations. Secrets are not returned in any API response body."}).option(`url`,{type:`string`,description:`The POST endpoint to call when dispatching a notification.`}).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 z={command:`update <webhook-id>`,describe:`Update a webhook`,builder:R,handler:async f=>s({command:`alerting destinations webhooks update`,classification:{safeFlags:[`dry-run`]}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf alerting destinations webhooks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/destinations/webhooks/${f[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(f[`webhook-id`]))}`,pathParams:{"webhook-id":String(f[`webhook-id`]??``)},bodyKind:`json`,body:f.body===void 0?l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}):c(f.body),sensitiveBodyPaths:[[`secret`]]});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Updating`,async()=>s.alerting.destinations.webhooks.update({...e,account_id:p,webhook_id:f[`webhook-id`]}));i(t,{successLabel:`Updated`});return}f.name===void 0&&(f.name=await d(`name`,`The name of the webhook destination. This will be included in the request body when you receive a webhook notification.`)),f.url===void 0&&(f.url=await d(`url`,`The POST endpoint to call when dispatching a notification.`));let m=l({name:u(f.name,`name`,`text`),secret:u(f.secret,`secret`,`text`),url:u(f.url,`url`,`text`)}),h=await o(`Updating`,async()=>s.alerting.destinations.webhooks.update({...m,account_id:p,webhook_id:f[`webhook-id`]}));i(h,{successLabel:`Updated`})})},B={command:`webhooks`,describe:`Operations for destinations.webhooks`,builder:e=>e.command(j).command(N).command(F).command(L).command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},V={command:`destinations`,describe:`Operations for destinations`,builder:e=>e.command(b).command(k).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function H(e){return e.usage(`$0 alerting history list
27
27
 
28
28
  Gets a list of history records for notifications sent to an account. The records are displayed for last \`x\` number of days based on the zone plan (free = 30, pro = 30, biz = 30, ent = 90).`).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`before`,{type:`string`,description:`Limit the returned results to history records older than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`since`,{type:`string`,description:`Limit the returned results to history records newer than the specified date. This must be a timestamp that conforms to RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`list`,describe:`List History`,builder:H,handler:async c=>s({command:`alerting history list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{let s={per_page:c[`per-page`],before:c.before,page:c.page,since:c.since};if(c.dryRun){let e=await n();a({command:`cf alerting history list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/history`,pathParams:{},query:s,bodyKind:`none`});return}let l=await t(c),u=c.local?e:await r();c.accountId=u;let d=await o(`Loading`,async()=>l.alerting.history.list({account_id:u,...s}));i(d,{successLabel:`Loaded`})})},W={command:`history`,describe:`Operations for history`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function te(e){return e.usage(`$0 alerting policies create
29
29
 
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-DlT72Xpn.mjs";import{n as t}from"./auth-CGLsxbc6.mjs";import{a as n,i as r,t as i}from"./context-q7UaYK69.mjs";import{t as a}from"./output-BOe-3AQG.mjs";import{t as o}from"./dry-run-DRj2_uV3.mjs";import{t as s}from"./progress-BtkTVcHI.mjs";import{t as c}from"./run-BvHwWWUX.mjs";import"./telemetry-BsYO3nxG.mjs";import{n as l,r as u,t as d}from"./body-parser-DkHKPkJ7.mjs";import{n as f}from"./input-validation-D7z60HJH.mjs";import{a as p}from"./prompt-RlgRrmbm.mjs";function m(e){return e.usage(`$0 analytics latency colos get
3
+
4
+ Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get`,describe:`Argo Analytics for a zone at different PoPs`,builder:m,handler:async e=>c({command:`analytics latency colos get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){o({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let n=await t(e),i=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=i;let c=await s(`Loading`,async()=>n.analytics.latency.colos.get({zone_id:i}));a(c,{successLabel:`Loaded`})})},g={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function _(e){return e.usage(`$0 analytics latency get
5
+
6
+ Retrieves aggregate Argo Smart Routing analytics for a zone, including latency improvements, bandwidth savings, and routing statistics.`).option(`bins`,{type:`string`,description:`Bins`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get`,describe:`Argo Analytics for a zone`,builder:_,handler:async e=>c({command:`analytics latency get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={bins:e.bins};if(e.dryRun){o({command:`cf analytics latency get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:n,bodyKind:`none`});return}let i=await t(e),c=await r({zone:e.zone},i,{quiet:e.quiet});e.zoneId=c;let l=await s(`Loading`,async()=>i.analytics.latency.get({zone_id:c,...n}));a(l,{successLabel:`Loaded`})})},y={command:`latency`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(v).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.usage(`$0 analytics query data-security content-findings top-n
7
+
8
+ Returns the top N integrations ranked by total content findings.`).option(`filters`,{type:`string`,description:"Filters to apply. `findingType = content` is applied automatically for CASB data. Provide as a JSON array of objects or @path/to/file.json."}).option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`n`,{type:`number`,description:`Maximum number of integrations to return.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Returns the top N integrations for content findings.`})}const x={command:`top-n`,describe:`Top integrations by content findings`,builder:b,handler:async r=>c({command:`analytics query data-security content-findings top-n`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query data-security content-findings top-n`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/data-security/content-findings/top-n`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),n:r.n,to:f(r.to,`to`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.dataSecurity.contentFindings.topN({...e,account_id:m}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(r.from===void 0&&(r.from=await p(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await p(`to`,`End of the query time range (exclusive). RFC3339.`));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),n:r.n,to:f(r.to,`to`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.dataSecurity.contentFindings.topN({...h,account_id:m}));a(g,{successLabel:`Created`})})},S={command:`content-findings`,describe:`Operations for query.data-security.content-findings`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function C(e){return e.usage(`$0 analytics query data-security findings summary
9
+
10
+ Returns aggregate current-period and previous-period totals for CASB findings.`).option(`filters`,{type:`string`,description:`Filters to apply. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for aggregate findings summary.`})}const w={command:`summary`,describe:`Data security findings summary`,builder:C,handler:async r=>c({command:`analytics query data-security findings summary`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query data-security findings summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/data-security/findings/summary`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),to:f(r.to,`to`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.dataSecurity.findings.summary({...e,account_id:m}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);r.from===void 0&&(r.from=await p(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await p(`to`,`End of the query time range (exclusive). RFC3339.`));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),to:f(r.to,`to`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.dataSecurity.findings.summary({...h,account_id:m}));a(g,{successLabel:`Created`})})};function T(e){return e.usage(`$0 analytics query data-security findings timeseries
11
+
12
+ Returns merged time-bucketed CASB findings.`).option(`filters`,{type:`string`,description:`Filters to apply. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for findings timeseries.`})}const E={command:`timeseries`,describe:`Data security findings timeseries`,builder:T,handler:async r=>c({command:`analytics query data-security findings timeseries`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query data-security findings timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/data-security/findings/timeseries`,pathParams:{},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),to:f(r.to,`to`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.dataSecurity.findings.timeseries({...e,account_id:m}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);r.from===void 0&&(r.from=await p(`from`,`Start of the query time range (inclusive). RFC3339.`)),r.to===void 0&&(r.to=await p(`to`,`End of the query time range (exclusive). RFC3339.`));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),to:f(r.to,`to`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.dataSecurity.findings.timeseries({...h,account_id:m}));a(g,{successLabel:`Created`})})},D={command:`findings`,describe:`Operations for query.data-security.findings`,builder:e=>e.command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},O={command:`data-security`,describe:`Operations for query.data-security`,builder:e=>e.command(S).command(D).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function k(e){return e.usage(`$0 analytics query summary <dataset>
13
+
14
+ Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const A={command:`summary <dataset>`,describe:`Query analytics summary`,builder:k,handler:async r=>c({command:`analytics query summary`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/summary`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.summary({...e,account_id:m,dataset:r.dataset}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(r.from===void 0&&(r.from=await p(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await p(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.summary({...h,account_id:m,dataset:r.dataset}));a(g,{successLabel:`Created`})})};function j(e){return e.usage("$0 analytics query timeseries <dataset>\n\nReturns time-bucketed analytics data for a dataset. Includes time slots, each containing the requested stats, group-by dimensions, and resolution-controlled bucket size (e.g. `hour`, `day`).").positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`resolution`,{type:`string`,description:`Time bucket size for grouping results. Controls the granularity of the returned time slots.
15
+ `}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const M={command:`timeseries <dataset>`,describe:`Query analytics timeseries`,builder:j,handler:async r=>c({command:`analytics query timeseries`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/timeseries`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`),resolution:f(r.resolution,`resolution`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.timeseries({...e,account_id:m,dataset:r.dataset}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(r.from===void 0&&(r.from=await p(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);r.to===void 0&&(r.to=await p(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.resolution===void 0&&(r.resolution=await p(`resolution`,`Time bucket size for grouping results. Controls the granularity of the returned time slots. `));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`),resolution:f(r.resolution,`resolution`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.timeseries({...h,account_id:m,dataset:r.dataset}));a(g,{successLabel:`Created`})})};function N(e){return e.usage(`$0 analytics query top-n <dataset>
16
+
17
+ Returns the top N results for a dataset by a specified stat. Includes an array of result rows, each containing the requested stats and group-by dimensions.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`n`,{type:`number`,description:`Maximum number of results to return.`}).option(`order-by`,{type:`string`,description:`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Defines fields that all query types share.`})}const P={command:`top-n <dataset>`,describe:`Query analytics top-N`,builder:N,handler:async r=>c({command:`analytics query top-n`,classification:{safeFlags:[`dry-run`]}},r,async()=>{if(r.dryRun){let e=await n();o({command:`cf analytics query top-n`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics/query/${r.dataset==null?`<dataset>`:encodeURIComponent(String(r.dataset))}/top-n`,pathParams:{dataset:String(r.dataset??``)},bodyKind:`json`,body:r.body===void 0?d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`),n:r.n,orderBy:f(r[`order-by`],`order-by`,`text`)}):l(r.body)});return}let c=await t(r),m=r.local?e:await i();if(r.accountId=m,r.body){let e=l(r.body),t=await s(`Creating`,async()=>c.analytics.query.topN({...e,account_id:m,dataset:r.dataset}));a(t,{successLabel:`Created`});return}if(r.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(r.from===void 0&&(r.from=await p(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),r[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(r.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);if(r.to===void 0&&(r.to=await p(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),r.n===void 0)throw Error(`--n is required (or pass --body with this field set).`);r[`order-by`]===void 0&&(r[`order-by`]=await p(`order-by`,`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`));let h=d({filters:u(r.filters,`filters`),from:f(r.from,`from`,`text`),groupBy:r[`group-by`],stats:r.stats,to:f(r.to,`to`,`text`),n:r.n,orderBy:f(r[`order-by`],`order-by`,`text`)}),g=await s(`Creating`,async()=>c.analytics.query.topN({...h,account_id:m,dataset:r.dataset}));a(g,{successLabel:`Created`})})},F={command:`query`,describe:`Operations for query`,builder:e=>e.command(A).command(M).command(P).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},I={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(y).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{I as default};
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-C0lQ9sTg.mjs";import{i as t,n}from"./auth-AobvBmz4.mjs";import{a as r,t as i}from"./context-Bwkz4Lm_.mjs";import{t as a}from"./output-BGqhvqe2.mjs";import{t as o}from"./dry-run-DmsbOMF1.mjs";import{t as s}from"./progress-BYVZuEcG.mjs";import{t as c}from"./run-CrZgB8L_.mjs";import"./telemetry-DBXOMuLh.mjs";import{n as l,t as u}from"./input-validation-D7z60HJH.mjs";function d(e){return e.usage(`$0 analytics_engine sql query
2
+ import{t as e}from"./local-DlT72Xpn.mjs";import{i as t,n}from"./auth-CGLsxbc6.mjs";import{a as r,t as i}from"./context-q7UaYK69.mjs";import{t as a}from"./output-BOe-3AQG.mjs";import{t as o}from"./dry-run-DRj2_uV3.mjs";import{t as s}from"./progress-BtkTVcHI.mjs";import{t as c}from"./run-BvHwWWUX.mjs";import"./telemetry-BsYO3nxG.mjs";import{n as l,t as u}from"./input-validation-D7z60HJH.mjs";function d(e){return e.usage(`$0 analytics_engine sql query
3
3
 
4
4
  Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`).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`})}const f={command:`query`,describe:`Execute an Analytics Engine SQL query via request body`,builder:d,handler:async d=>c({command:`analytics_engine sql query`,classification:{safeFlags:[`dry-run`]}},d,async()=>{if(d.dryRun){let e=await r();o({command:`cf analytics_engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:d.body});return}let c=await n(d),f=d.local?e:await i();if(d.accountId=f,d.file){let e=u(d.file),n=await s(`Loading`,async()=>t(c,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}}));a(n,{successLabel:`Loaded`});return}if(d.body){let e=l(d.body,`body`,`binary`),n=await s(`Loading`,async()=>t(c,`POST`,`/accounts/${f}/analytics_engine/sql`,{body:e,headers:{"Content-Type":`text/plain`}}));a(n,{successLabel:`Loaded`});return}let p=await s(`Loading`,async()=>c.analyticsEngine.sql.query({account_id:f}));a(p,{successLabel:`Loaded`})})},p={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(f).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},m={command:`analytics_engine`,describe:`analytics_engine`,builder:e=>e.command(p).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{m as default};