cf 1.0.0-beta.26 → 1.0.0-beta.28

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 (294) hide show
  1. package/dist/_meta/commands.json +7373 -4926
  2. package/dist/_meta/hand-written-commands.json +2 -2
  3. package/dist/_meta/schemas.json +11614 -4465
  4. package/dist/abuse-reports-D9edOyag.mjs +24 -0
  5. package/dist/{access-DCOOmDC5.mjs → access-CKCCSrrU.mjs} +1 -1
  6. package/dist/{accounts-HC6XuIwP.mjs → accounts-CNb9U9bK.mjs} +33 -27
  7. package/dist/{acm-DYgr6SAR.mjs → acm-CdKTAToZ.mjs} +3 -3
  8. package/dist/{addressing-BS66pJ_a.mjs → addressing-eZI_C-b0.mjs} +18 -18
  9. package/dist/{agent-memory-BbXdueL0.mjs → agent-memory-BBHCEE7h.mjs} +7 -7
  10. package/dist/{ai-BiIKznNv.mjs → ai-Csl_QNwv.mjs} +7 -7
  11. package/dist/ai-audit-DlqWsQi-.mjs +6 -0
  12. package/dist/{ai-gateway-rlYCbts5.mjs → ai-gateway-Lj4On37s.mjs} +13 -13
  13. package/dist/ai-search-BxyhS3X7.mjs +74 -0
  14. package/dist/{ai-security-BUwS6kVh.mjs → ai-security-DvU2iYkY.mjs} +3 -3
  15. package/dist/{alerting-BSzuvFk1.mjs → alerting-r0G2X9y9.mjs} +10 -10
  16. package/dist/analytics-C6bfqm-W.mjs +17 -0
  17. package/dist/analytics-engine-BlIecoOe.mjs +4 -0
  18. package/dist/api-Dnt6lRJG.mjs +3 -0
  19. package/dist/{api-security-BBxEJjGv.mjs → api-security-DZ7GWOqD.mjs} +26 -26
  20. package/dist/argo-Bh0_cj49.mjs +14 -0
  21. package/dist/{artifacts-B9g9aPrk.mjs → artifacts-VZJWVq_6.mjs} +16 -16
  22. package/dist/{audit-logs-BhJs-OS2.mjs → audit-logs-B8cGL4B9.mjs} +1 -1
  23. package/dist/auth-B-h0BHg7.mjs +2 -0
  24. package/dist/auth-B6tswVxH.mjs +2 -0
  25. package/dist/{auth-C50SqX9F.mjs → auth-clmqFEWU.mjs} +3 -3
  26. package/dist/{auth-token-DvNoIhRL.mjs → auth-token-DW4dJVdj.mjs} +1 -1
  27. package/dist/{autoconfig-ldsgXxa6.mjs → autoconfig-C0ynlGHf.mjs} +23 -23
  28. package/dist/{basin-catalog-CtKFiH-n.mjs → basin-catalog-TehR1sKZ.mjs} +11 -11
  29. package/dist/billing-B2KusU6g.mjs +22 -0
  30. package/dist/{blocks-DnNrvi8s.mjs → blocks-BFulF68V.mjs} +1 -1
  31. package/dist/body-parser-DoewLePl.mjs +2 -0
  32. package/dist/body-unions-DNs981Ia.mjs +2 -0
  33. package/dist/bot-management-CXHXgrQC.mjs +9 -0
  34. package/dist/{botnet-feed-lD9s2oLA.mjs → botnet-feed-UyK7Rfp6.mjs} +1 -1
  35. package/dist/brand-protection-kv1ba80i.mjs +14 -0
  36. package/dist/browser-run-D-vRoZmf.mjs +40 -0
  37. package/dist/build-BzJGqb2o.mjs +2 -0
  38. package/dist/build-FFxzigo4.mjs +2 -0
  39. package/dist/{builds-D3mAH87h.mjs → builds-BbxINHRP.mjs} +27 -27
  40. package/dist/cache-BacNNtLu.mjs +36 -0
  41. package/dist/{cf-CpC4giTf.mjs → cf-BQ_LRiut.mjs} +2 -2
  42. package/dist/{chunk-DSGVRFIS-vdfri8fR.mjs → chunk-DSGVRFIS-BaNZNW-M.mjs} +1 -1
  43. package/dist/chunk-SOBRPAPT-QTjnHSNs.mjs +363 -0
  44. package/dist/{cli-Cm4Twas4.mjs → cli-B7vslRfu.mjs} +1 -1
  45. package/dist/{client-side-security-BRn7KBpu.mjs → client-side-security-bzB9JosR.mjs} +6 -6
  46. package/dist/{cloud-connector-DqkOIRDr.mjs → cloud-connector-BHtf37R5.mjs} +2 -2
  47. package/dist/{cloudflared-DDp_8PTK.mjs → cloudflared-QDdHMUEY.mjs} +1 -1
  48. package/dist/{cloudforce-one-B9k8vhso.mjs → cloudforce-one-DWBPQDA3.mjs} +126 -124
  49. package/dist/{command--Y_QAiU2.mjs → command-AVwd7XjE.mjs} +1 -1
  50. package/dist/{command-DlI7Z_7j.mjs → command-B87T_f2f.mjs} +1 -1
  51. package/dist/{command-QHmV62Fv.mjs → command-CEHhi3t0.mjs} +1 -1
  52. package/dist/{command-B-_ba4rQ.mjs → command-CYmQE79n.mjs} +1 -1
  53. package/dist/{command-DsOv6z9q.mjs → command-CbxXc5IW.mjs} +1 -1
  54. package/dist/{command-BKNQsGqu.mjs → command-Ce8CVLth.mjs} +1 -1
  55. package/dist/{command-MxFFWqMg.mjs → command-CqDudQZs.mjs} +1 -1
  56. package/dist/{command-BV8-laJK.mjs → command-D4YcwpVp.mjs} +1 -1
  57. package/dist/{command-BVz2aES3.mjs → command-D895kdlh.mjs} +1 -1
  58. package/dist/{command-yOG9VUtq.mjs → command-D9Qyi1B0.mjs} +1 -1
  59. package/dist/{command-CfOqnqlN.mjs → command-DeutqL1n.mjs} +1 -1
  60. package/dist/{command-Dn39o5xQ.mjs → command-Dl9ICrRK.mjs} +1 -1
  61. package/dist/{command-CN8NFLs2.mjs → command-DtCSe8Hy.mjs} +1 -1
  62. package/dist/{command-BsCFkho-.mjs → command-DwzVtmb3.mjs} +1 -1
  63. package/dist/{command-CQMRxiDz.mjs → command-wtBubtZ4.mjs} +1 -1
  64. package/dist/{completions-BA52jTea.mjs → completions-BvdKtzsX.mjs} +1 -1
  65. package/dist/{connector-interrupts-zL7pxPn6.mjs → connector-interrupts-dUPW6Ya_.mjs} +2 -2
  66. package/dist/{connector-telemetry-events-PL4Fqqvu.mjs → connector-telemetry-events-DWVCqnhn.mjs} +1 -1
  67. package/dist/{connector-telemetry-snapshots-DyBSuEFB.mjs → connector-telemetry-snapshots-CeMP3qeI.mjs} +1 -1
  68. package/dist/{connectors-D8H6rQz9.mjs → connectors-DZFGNw3i.mjs} +4 -4
  69. package/dist/{containers-D4sa-Eoy.mjs → containers-B06OGOEB.mjs} +212 -212
  70. package/dist/{containers-Db-eWudu.mjs → containers-DCzQCo79.mjs} +8 -8
  71. package/dist/{content-scan-DUVq09i8.mjs → content-scan-XhnNJqXf.mjs} +4 -4
  72. package/dist/{context-BvLXzoMs.mjs → context-BY1Eh_Qe.mjs} +1 -1
  73. package/dist/{cps-CqaRliZZ.mjs → cps-CohlxvuN.mjs} +2 -2
  74. package/dist/create-DmLDMvrj.mjs +2 -0
  75. package/dist/{csam-scanner-DsXvOOsZ.mjs → csam-scanner-BV4bHq8v.mjs} +2 -4
  76. package/dist/custom-csrs-BVdMQjYq.mjs +18 -0
  77. package/dist/{custom-hostnames-Cj_csfo_.mjs → custom-hostnames-r-CxhSa1.mjs} +5 -5
  78. package/dist/custom-nameservers-CapMDyly.mjs +12 -0
  79. package/dist/custom-pages-BVIniWfq.mjs +38 -0
  80. package/dist/d1-nJCOJZb8.mjs +50 -0
  81. package/dist/{delegate-CMfEjvHn.mjs → delegate-CcL6RoGw.mjs} +1 -1
  82. package/dist/delegate.mjs +1 -1
  83. package/dist/{deploy-DDbmxkiX.mjs → deploy-DJMnWFNk.mjs} +1 -1
  84. package/dist/{deploy-context-DsEVu7bf.mjs → deploy-context-YCW3eqP1.mjs} +15 -15
  85. package/dist/{deploy-input-BA_3Q2Xu.mjs → deploy-input-CQLBXFEB.mjs} +1 -1
  86. package/dist/{dev-BS156bim.mjs → dev-GsYHvMah.mjs} +1 -1
  87. package/dist/{diagnostics-BmkQnSEb.mjs → diagnostics-C3nqxsAO.mjs} +4 -4
  88. package/dist/{dist-DehXZozc.mjs → dist-D-ihn_mV.mjs} +42 -33
  89. package/dist/{dls-DciZC_gQ.mjs → dls-N1x8sAK3.mjs} +3 -3
  90. package/dist/{dns-C2YPspGN.mjs → dns-DATWP-PF.mjs} +36 -30
  91. package/dist/{dns-firewall-CRfde07f.mjs → dns-firewall-n3Y2ui6W.mjs} +8 -8
  92. package/dist/{docs-CYjyBA8q.mjs → docs-CRc_WOXh.mjs} +1 -1
  93. package/dist/{dry-run-gy0Hl9xo.mjs → dry-run-kJbjn4kG.mjs} +1 -1
  94. package/dist/{durable-objects-DcI97y4p.mjs → durable-objects-DHK9w-vO.mjs} +2 -2
  95. package/dist/{email-auth-CMCQAu99.mjs → email-auth-ptdqNSTZ.mjs} +1 -1
  96. package/dist/email-domains-uL22-zRY.mjs +14 -0
  97. package/dist/{email-routing-7p9dr5Ue.mjs → email-routing-CV43rMJC.mjs} +15 -13
  98. package/dist/{email-security-Bu0fAYh-.mjs → email-security-DK_SJ0yi.mjs} +38 -38
  99. package/dist/{email-sending-OpMZNaHZ.mjs → email-sending-CTQafGec.mjs} +17 -17
  100. package/dist/{error-sanitization-DG8WSzHe.mjs → error-sanitization-BkgtZ0Vx.mjs} +1 -1
  101. package/dist/error-sanitization-D069tpKk.mjs +2 -0
  102. package/dist/{errors-C5RGao2J.mjs → errors-VG1mgwJl.mjs} +1 -1
  103. package/dist/{field-extractors-BfsNjd0e.mjs → field-extractors-jcZ_bAGc.mjs} +2 -2
  104. package/dist/{firewall-CJ-VIOk1.mjs → firewall-CW-fAI9m.mjs} +30 -14
  105. package/dist/{flagship-C5PTR1ND.mjs → flagship-RiLnDwfJ.mjs} +8 -8
  106. package/dist/{fraud-B7hwBheX.mjs → fraud-DvfBBTe8.mjs} +2 -2
  107. package/dist/get-3XNn0upb.mjs +2 -0
  108. package/dist/global-options-DiKj2cQy.mjs +2 -0
  109. package/dist/{google-tag-gateway-D7iFDVEa.mjs → google-tag-gateway-C5WYsSXv.mjs} +2 -2
  110. package/dist/{healthchecks-B4jTcKV7.mjs → healthchecks-BA1fmzTm.mjs} +5 -5
  111. package/dist/{hyperdrive-1432DM-p.mjs → hyperdrive-Ch6klUp3.mjs} +4 -4
  112. package/dist/iam-LlGEzRCq.mjs +62 -0
  113. package/dist/{images-Ttea4khD.mjs → images-C5WqUXkK.mjs} +11 -11
  114. package/dist/index.mjs +1 -1
  115. package/dist/{init-BeYrAg7Q.mjs → init-EVsjBrOz.mjs} +2 -2
  116. package/dist/{intel-CJznBf5n.mjs → intel-vcWyslaX.mjs} +18 -19
  117. package/dist/{interactive-DsU8VDvK.mjs → interactive-BCDFSPtq.mjs} +1 -1
  118. package/dist/{internal-DOho_iA0.mjs → internal-BhV9WjLp.mjs} +1 -1
  119. package/dist/{ips-BgNoRwFN.mjs → ips-CqHjVsqd.mjs} +1 -1
  120. package/dist/{k2-Cj1ORHul.mjs → k2-CZT2Pd5J.mjs} +2 -2
  121. package/dist/kv-Ipa7dnvF.mjs +12 -0
  122. package/dist/{lazy-command-DeTzOWvU.mjs → lazy-command-DbKVgdGT.mjs} +1 -1
  123. package/dist/{leaked-credential-checks-21Wc7OqL.mjs → leaked-credential-checks-EzT4TTjO.mjs} +4 -4
  124. package/dist/{live-BfrWKfq8.mjs → live-C9L1bNuE.mjs} +1 -1
  125. package/dist/load-balancers-Cb3VkSfc.mjs +84 -0
  126. package/dist/local-D5Vq6ooZ.mjs +2 -0
  127. package/dist/{local-CvzO-cQH.mjs → local-DIJ7SIKC.mjs} +1 -1
  128. package/dist/{local-runtime-DOpR_Tnc.mjs → local-runtime-BZjgkacr.mjs} +1 -1
  129. package/dist/{login-CVWkMh1L.mjs → login-DG5ebyab.mjs} +1 -1
  130. package/dist/login-DRJugxya.mjs +2 -0
  131. package/dist/logpush-C5Gw7F_9.mjs +68 -0
  132. package/dist/logs-y3REfHbb.mjs +51 -0
  133. package/dist/magic-network-monitoring-BZBGZB6M.mjs +34 -0
  134. package/dist/{magic-transit-BhP424T-.mjs → magic-transit-BPV_POf5.mjs} +129 -129
  135. package/dist/{managed-defense-6l_B3hn_.mjs → managed-defense-BaUBSUcz.mjs} +3 -3
  136. package/dist/{managed-transforms-D7FMBsnq.mjs → managed-transforms-CjkjLzMC.mjs} +2 -2
  137. package/dist/{mcp-BUOfMkBP.mjs → mcp-RPtrISTy.mjs} +6 -6
  138. package/dist/{mesh-B1RrhAT1.mjs → mesh-DZ4QHBPE.mjs} +5 -5
  139. package/dist/{migrate-BTU8AvlP.mjs → migrate-CRIUqGi2.mjs} +1 -1
  140. package/dist/{monetization-Da3ooFLC.mjs → monetization-CVZqM8Xo.mjs} +9 -5
  141. package/dist/{network-CjhSzhMm.mjs → network-DLt2JUo1.mjs} +15 -15
  142. package/dist/{network-interconnects-DEQD6GM8.mjs → network-interconnects-9nS5jL__.mjs} +10 -10
  143. package/dist/o11y-ySxrnP1Z.mjs +88 -0
  144. package/dist/{oauth-Dnog5v-Q.mjs → oauth-CFVUl-Wv.mjs} +1 -1
  145. package/dist/{oauth-DdXkpU44.mjs → oauth-Cidoyxfp.mjs} +1 -1
  146. package/dist/observability-C-KNh__y.mjs +4 -0
  147. package/dist/ohttp-gateway-B5nCl4s3.mjs +8 -0
  148. package/dist/organizations-DbeeWUL4.mjs +71 -0
  149. package/dist/output-BZQEl3mK.mjs +2 -0
  150. package/dist/package-B7RgwuFR.mjs +2 -0
  151. package/dist/{page-rules-D2eFbKWb.mjs → page-rules-DRw763O1.mjs} +4 -4
  152. package/dist/{pages-DYZDvWK6.mjs → pages-DfQnxiTk.mjs} +12 -12
  153. package/dist/{pay-per-crawl-CgPFv5HT.mjs → pay-per-crawl-EHYtSKxX.mjs} +13 -13
  154. package/dist/{pay-per-use-BIQrsrTy.mjs → pay-per-use-wdEhl8k4.mjs} +14 -12
  155. package/dist/{pipelines-D6pkhlpm.mjs → pipelines-DbyrI6F4.mjs} +11 -11
  156. package/dist/precursor-Dx8lN4UJ.mjs +4 -0
  157. package/dist/previews-DEVNSip2.mjs +6 -0
  158. package/dist/{progress-B-CVX0kn.mjs → progress-yvPscjYg.mjs} +1 -1
  159. package/dist/{prompt-DJF_Rs5S.mjs → prompt-CEpZ-lQZ.mjs} +1 -1
  160. package/dist/{queues-DaqLO-UO.mjs → queues-DgMc7Z6A.mjs} +18 -18
  161. package/dist/{r2-DDIU9JN3.mjs → r2-BpTVicIq.mjs} +43 -43
  162. package/dist/{radar-D59qCgld.mjs → radar-DW-S1VUh.mjs} +11 -11
  163. package/dist/{raw-fetch-BrOxDN9k.mjs → raw-fetch-Cl5spWC3.mjs} +1 -1
  164. package/dist/{ready-DgE08svD.mjs → ready-d0li0X6r.mjs} +1 -1
  165. package/dist/realtime-DMKHLYF4.mjs +170 -0
  166. package/dist/registrar-D23gfKBi.mjs +43 -0
  167. package/dist/{registrar-sandbox-uzs3eOKk.mjs → registrar-sandbox-lVLB1-mC.mjs} +4 -4
  168. package/dist/{reporting-Dx2YTick.mjs → reporting-WX8P3Y0k.mjs} +2 -2
  169. package/dist/{request-headers-DHzBX7dQ.mjs → request-headers-C0FpeBhz.mjs} +1 -1
  170. package/dist/{request-tracers-B49cBKkj.mjs → request-tracers-qd7XOAka.mjs} +2 -2
  171. package/dist/resource-sharing-B2ZSt_cA.mjs +36 -0
  172. package/dist/{rules-CjgLSlUC.mjs → rules-CB0QQTB3.mjs} +5 -5
  173. package/dist/rulesets-DmqwixUC.mjs +42 -0
  174. package/dist/{rum-vPEpMS_h.mjs → rum-BZ_24qZU.mjs} +9 -9
  175. package/dist/{run-BZ6Fj3jQ.mjs → run-BOKI1uWa.mjs} +1 -1
  176. package/dist/run-DBqOjD1P.mjs +2 -0
  177. package/dist/{schema-DuLIZRhA.mjs → schema-Dj9STsWI.mjs} +1 -1
  178. package/dist/{schema-cache-C_rvto6Y.mjs → schema-cache-5NkOj7Y3.mjs} +1 -1
  179. package/dist/schema-flags-CXm9iIv6.mjs +4 -0
  180. package/dist/{scim-BA7XbsSu.mjs → scim-DchxaJfE.mjs} +8 -8
  181. package/dist/{secrets-store-MEUNt1Ph.mjs → secrets-store-oAft1cFE.mjs} +5 -5
  182. package/dist/security-insights-DMm0qg_m.mjs +62 -0
  183. package/dist/{security-txt-DikhnR2L.mjs → security-txt-CIt0494b.mjs} +2 -2
  184. package/dist/{session-BOnam-Wv.mjs → session-vzNfUhPl.mjs} +1 -1
  185. package/dist/{shared-DmmWSObC.mjs → shared-MK-_lkbn.mjs} +1 -1
  186. package/dist/{signed-url-C-24KbWB.mjs → signed-url-gNangfwc.mjs} +1 -1
  187. package/dist/{smart-shield-DPqLMz7M.mjs → smart-shield-Boy_qbqd.mjs} +6 -6
  188. package/dist/{snippets-Bi3Uq1DF.mjs → snippets-DdoDYXW-.mjs} +3 -3
  189. package/dist/{spawn-C3hzWVrJ.mjs → spawn-B5F4OIHG.mjs} +1 -1
  190. package/dist/{spectrum-BaWKMoAl.mjs → spectrum-DLYIHelC.mjs} +3 -3
  191. package/dist/{speed-DShjlpAs.mjs → speed-DugG9Tm9.mjs} +2 -2
  192. package/dist/{sql-DCoFf15T.mjs → sql-Bb56llsb.mjs} +2 -2
  193. package/dist/src-BoSDeQ9m.mjs +133 -0
  194. package/dist/{ssl-C4nt4pJK.mjs → ssl-Bg4X3WGk.mjs} +24 -24
  195. package/dist/startup-profile-DQVkZZpb.mjs +2 -0
  196. package/dist/{startup-profile-CFJ_Lu1c.mjs → startup-profile-DZL2DC44.mjs} +1 -1
  197. package/dist/state-DW3QZtfh.mjs +2 -0
  198. package/dist/{state-DmjHXZat.mjs → state-mr5ux1Nb.mjs} +1 -1
  199. package/dist/{stream-CpZbnSpH.mjs → stream-BuZYDbNR.mjs} +21 -21
  200. package/dist/{tags-BIjQ3Kjh.mjs → tags-SKz2odE_.mjs} +12 -6
  201. package/dist/{telemetry-BDhqOpUw.mjs → telemetry-B4zmCpT0.mjs} +1 -1
  202. package/dist/telemetry-DkDUr4KK.mjs +2 -0
  203. package/dist/tenant-custom-nameservers-BhkhBerL.mjs +8 -0
  204. package/dist/tenants-DD-GMq0K.mjs +13 -0
  205. package/dist/{tools-C-vmgYSv.mjs → tools-KW_4hvzY.mjs} +1 -1
  206. package/dist/{tunnels-CXAO2CeL.mjs → tunnels-D90ztENM.mjs} +6 -6
  207. package/dist/{turnstile-Ctm0rs0q.mjs → turnstile-DhSU_Xar.mjs} +4 -4
  208. package/dist/ui-xjCox-gU.mjs +2 -0
  209. package/dist/{update-check-D_Wtw0_D.mjs → update-check-CRttabfu.mjs} +1 -1
  210. package/dist/{update-check-Dc7cRFlx.mjs → update-check-HltjTMDE.mjs} +1 -1
  211. package/dist/update-check-worker.mjs +1 -1
  212. package/dist/{url-normalization-DOfc2Q7a.mjs → url-normalization-K7gkmPvG.mjs} +2 -2
  213. package/dist/{url-scanner-J8M3X2tR.mjs → url-scanner-BRdWwka4.mjs} +3 -3
  214. package/dist/{user-BaF0qvvO.mjs → user-Cmb1_Wu5.mjs} +50 -52
  215. package/dist/{vectorize-D5qiggZU.mjs → vectorize-BTBerJME.mjs} +11 -11
  216. package/dist/verify-B9ILCohg.mjs +2 -0
  217. package/dist/verify-BCuWaO-L.mjs +2 -0
  218. package/dist/version-6Bpy6Bgt.mjs +2 -0
  219. package/dist/{waiting-rooms-BdmAq7ul.mjs → waiting-rooms-LymmKIGr.mjs} +16 -14
  220. package/dist/{web-assets-BySw_Tme.mjs → web-assets-LHPQsrnY.mjs} +21 -21
  221. package/dist/{web3-BKkKf1RF.mjs → web3-BsOio0Ae.mjs} +12 -12
  222. package/dist/workers-BnLiOjZf.mjs +39 -0
  223. package/dist/{workers-builds-CVJ4FqzB.mjs → workers-builds-sKpITeRk.mjs} +4 -4
  224. package/dist/{workers-for-platforms-mzdtmr6r.mjs → workers-for-platforms-BGp6yr6P.mjs} +9 -9
  225. package/dist/workers-vpc-D8lefWDo.mjs +12 -0
  226. package/dist/{workflows-Cr957c4U.mjs → workflows-B-ZIG3y7.mjs} +22 -22
  227. package/dist/{wrangler-migration-DZV7-4Fp.mjs → wrangler-migration-6E6wT_LZ.mjs} +67 -58
  228. package/dist/zaraz-BBKki5WS.mjs +22 -0
  229. package/dist/{zero-trust-BVCvQJ4e.mjs → zero-trust-BZDXM5r6.mjs} +487 -409
  230. package/dist/{zones-BzyjOT10.mjs → zones-B-UV_DGE.mjs} +24 -24
  231. package/package.json +16 -16
  232. package/dist/abuse-reports-zPrsxbRz.mjs +0 -24
  233. package/dist/ai-audit-DI4Rw2wl.mjs +0 -6
  234. package/dist/ai-search-QOenIzDL.mjs +0 -74
  235. package/dist/analytics-CQ-Yt1mm.mjs +0 -17
  236. package/dist/analytics-engine-CdrY5-95.mjs +0 -4
  237. package/dist/api-X3wKppsT.mjs +0 -3
  238. package/dist/argo-BiefH8wc.mjs +0 -14
  239. package/dist/auth-Czzy5Rs_.mjs +0 -2
  240. package/dist/auth-D5Yj9eYU.mjs +0 -2
  241. package/dist/billing-BrLJqlOf.mjs +0 -22
  242. package/dist/body-parser-BKcZS9iJ.mjs +0 -2
  243. package/dist/bot-management-BSBVuKc0.mjs +0 -9
  244. package/dist/brand-protection-Byoa1hvj.mjs +0 -26
  245. package/dist/browser-run-BSVANGzU.mjs +0 -40
  246. package/dist/build-CPKxZ3kL.mjs +0 -2
  247. package/dist/build-Dwd1_7o0.mjs +0 -2
  248. package/dist/cache-0xCdyNg9.mjs +0 -36
  249. package/dist/chunk-3PJ54H4K-CY8EY_n2.mjs +0 -363
  250. package/dist/create-BtmuVqVL.mjs +0 -2
  251. package/dist/custom-csrs-Dl_daAbX.mjs +0 -10
  252. package/dist/custom-nameservers-Bw2P7F_W.mjs +0 -8
  253. package/dist/custom-pages-CJ7ecSX6.mjs +0 -20
  254. package/dist/d1-BsWI546w.mjs +0 -89
  255. package/dist/email-domains-1Nx60ETD.mjs +0 -12
  256. package/dist/error-sanitization-B025CygB.mjs +0 -2
  257. package/dist/get-Be821dio.mjs +0 -2
  258. package/dist/iam-DuZenYtc.mjs +0 -48
  259. package/dist/kv-CTyuvcAz.mjs +0 -12
  260. package/dist/load-balancers-DMTsh-9q.mjs +0 -72
  261. package/dist/local-CWTti4ot.mjs +0 -2
  262. package/dist/login-Djz5mvHJ.mjs +0 -2
  263. package/dist/logpush-OMhp7VgE.mjs +0 -44
  264. package/dist/logs-BSyyNwso.mjs +0 -35
  265. package/dist/magic-cloud-networking-DD29yMnE.mjs +0 -68
  266. package/dist/magic-network-monitoring-DRRvSrDP.mjs +0 -34
  267. package/dist/o11y-DeNxXxcp.mjs +0 -86
  268. package/dist/oauth-clients-UnbMcHkx.mjs +0 -14
  269. package/dist/oauth-scopes-DbtnZVO4.mjs +0 -4
  270. package/dist/organization-IsxVyWol.mjs +0 -73
  271. package/dist/organizations-p8Mgo8A7.mjs +0 -4
  272. package/dist/origin-post-quantum-encryption-Bwysyttf.mjs +0 -6
  273. package/dist/output-BJEgbI0G.mjs +0 -2
  274. package/dist/package-BOE_De2L.mjs +0 -2
  275. package/dist/precursor-B35P8h6h.mjs +0 -4
  276. package/dist/previews-B1mqjXaJ.mjs +0 -6
  277. package/dist/realtime-DWjdrDzv.mjs +0 -168
  278. package/dist/registrar-uYOU1U27.mjs +0 -43
  279. package/dist/resource-sharing-CIsLVAcK.mjs +0 -36
  280. package/dist/rulesets-C7_aZA7m.mjs +0 -34
  281. package/dist/run-D4-K_cbQ.mjs +0 -2
  282. package/dist/schema-flags-Cr6kleor.mjs +0 -4
  283. package/dist/security-insights-ZKtey62s.mjs +0 -40
  284. package/dist/src-jyCTFHcS.mjs +0 -131
  285. package/dist/startup-profile-D_Qjgca1.mjs +0 -2
  286. package/dist/state-C7lNNN31.mjs +0 -2
  287. package/dist/telemetry-BZdRnr26.mjs +0 -2
  288. package/dist/tenant-CqYoylyU.mjs +0 -10
  289. package/dist/tenant-custom-nameservers-DDzzdyY3.mjs +0 -8
  290. package/dist/ui-BUCBQ3Sq.mjs +0 -2
  291. package/dist/version-DNcdABcr.mjs +0 -2
  292. package/dist/workers-TS0oQ-XH.mjs +0 -39
  293. package/dist/workers-vpc-xB1hHFPd.mjs +0 -12
  294. package/dist/zaraz-C8__FhOh.mjs +0 -22
@@ -1,74 +0,0 @@
1
- #!/usr/bin/env node
2
- import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{i as n,n as r}from"./auth-D5Yj9eYU.mjs";import{a as i,t as a}from"./context-BvLXzoMs.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-B-CVX0kn.mjs";import{t as l}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{a as u,n as d,r as f,s as p,t as m}from"./body-parser-BKcZS9iJ.mjs";import{n as h,t as g}from"./input-validation-D7z60HJH.mjs";import{a as _,i as v,n as y}from"./prompt-DJF_Rs5S.mjs";import{n as ee,t as te}from"./raw-fetch-BrOxDN9k.mjs";function ne(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`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).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 re={command:`chat-completions <instance-id>`,describe:`Chat Completions`,builder:ne,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.model!==void 0&&p(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&p(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};var b={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`,503:`ServiceUnavailableError`}};function x(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`}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`,default:172800}).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`}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).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.`}).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`]}).coerce(`indexing-options-keyword-tokenizer`,e=>h(e,`indexing-options-keyword-tokenizer`,`text`)).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`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).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`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric/datetime fields and 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).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:`Minimum similarity score a chunk must reach to be returned. Defaults to 0.4.`}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index. When type is omitted, the source determines it.`}).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 have a limit of 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 have a limit of 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` because discover crawls only cover 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`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-content-selector`,{type:`string`,description:`List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. The crawler stores and indexes only the matched HTML fragment. Omit the field to disable content selection; the API rejects empty arrays. Provide as a JSON array of objects or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).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 the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h). Defaults to 21600 (6h); instances crawling a domain outside the account may be set to 86400.`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`Data source type: r2 or web-crawler.`,choices:[`r2`,`web-crawler`]}).coerce(`type`,e=>h(e,`type`,`text`)).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 S={command:`create <namespace> <id>`,describe:`Create an AI Search instance.`,builder:x,handler:async e=>l({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(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):d(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(b,{body:t,account_id:l,namespace:e.namespace}));o(r,{successLabel:`Created`});return}let p=m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]),g=await c(`Creating`,async()=>n.send(b,{body:p,account_id:l,namespace:e.namespace}));o(g,{successLabel:`Created`})})};function C(e){return e.usage(`$0 ai-search delete <instance-id>
7
-
8
- Deletes an AI Search instance and all its indexed data permanently.`).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 w={command:`delete <instance-id>`,describe:`Delete an AI Search instance.`,builder:C,handler:async e=>l({command:`ai-search delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Deleted`})})};function T(e){return e.usage(`$0 ai-search get <instance-id>
9
-
10
- 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 E={command:`get <instance-id>`,describe:`Get an AI Search instance.`,builder:T,handler:async e=>l({command:`ai-search get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Loaded`})})};function D(e){return e.usage(`$0 ai-search items chunks <item-id>
11
-
12
- 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 O={command:`chunks <item-id>`,describe:`List Item Chunks.`,builder:D,handler:async e=>l({command:`ai-search items chunks`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,offset:e.offset};if(e.dryRun){let t=await i();s({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/chunks`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/chunks`,{query:l}));o(f,{successLabel:`Loaded`})})};function k(e){return e.usage(`$0 ai-search items delete <item-id>
13
-
14
- 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 A={command:`delete <item-id>`,describe:`Delete Item.`,builder:k,handler:async e=>l({command:`ai-search items delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Deleted`})})};function j(e){return e.usage(`$0 ai-search items download <item-id>
15
-
16
- 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 M={command:`download <item-id>`,describe:`Download Item Content.`,builder:j,handler:async e=>l({command:`ai-search items download`,classification:{safeFlags:[`dry-run`,`text`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/download`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}await r(e);let n=e.local?t:await a();e.accountId=n;let o=await c(`Loading`,async()=>te(`/accounts/${n}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/download`,{method:`GET`,local:e.local===!0,persistTo:e.persistTo}));ee(e.text===!0?o.toString(`utf-8`):o)})};function N(e){return e.usage(`$0 ai-search items get <item-id>
17
-
18
- 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 P={command:`get <item-id>`,describe:`Get Item.`,builder:N,handler:async e=>l({command:`ai-search items get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Loaded`})})};function F(e){return e.usage(`$0 ai-search items list
19
-
20
- 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 items according to status priority, then last_seen_at. "modified_at" sorts items according to 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:`Return only items with this 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:`Return only the item with this unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Return only items with this exact key (object key / filename). Each key is unique within a 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 I={command:`list`,describe:`Items List.`,builder:F,handler:async e=>l({command:`ai-search items list`,classification:{safeFlags:[`sort-by`,`status`,`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`],search:e.search,sort_by:e[`sort-by`],status:e.status,source:e.source,metadata_filter:e[`metadata-filter`],item_id:e[`item-id`],key:e.key};if(e.dryRun){let t=await i();s({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{query:l}));o(f,{successLabel:`Loaded`})})};function L(e){return e.usage(`$0 ai-search items logs <item-id>
21
-
22
- 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 R={command:`logs <item-id>`,describe:`Item Logs.`,builder:L,handler:async e=>l({command:`ai-search items logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,cursor:e.cursor};if(e.dryRun){let t=await i();s({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})};function z(e){return e.usage(`$0 ai-search items sync <item-id>
23
-
24
- Synchronizes 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`]}).coerce(`next-action`,e=>h(e,`next-action`,`text`)).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 continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state 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 B={command:`sync <item-id>`,describe:`Sync Item.`,builder:z,handler:async e=>l({command:`ai-search items sync`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let f={};e[`next-action`]!==void 0&&p(f,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&p(f,[`wait_for_completion`],e[`wait-for-completion`]);let h=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:f}));o(h,{successLabel:`Updated`})})};function V(e){return e.usage(`$0 ai-search items upload <instance-id>
25
-
26
- 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 continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`})}const H={command:`upload <instance-id>`,describe:`Upload Item.`,builder:V,handler:async e=>l({command:`ai-search items upload`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,metadata:e.metadata,"wait-for-completion":e[`wait-for-completion`]}});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.file!==void 0||e.body!==void 0||e.metadata!==void 0||e[`wait-for-completion`]!==void 0){let t=new FormData;if(e.file){let n=g(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);e.metadata!==void 0&&t.append(`metadata`,String(h(e.metadata,`metadata`,`text`)??``)),e[`wait-for-completion`]!==void 0&&t.append(`wait_for_completion`,String(e[`wait-for-completion`]));let r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Created`})}else if(e.body){let t=h(e.body,`body`,`binary`),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t,headers:{"Content-Type":`multipart/form-data`}}));o(r,{successLabel:`Created`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function U(e){return e.usage(`$0 ai-search items upsert <instance-id>
27
-
28
- 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`]}).coerce(`next-action`,e=>h(e,`next-action`,`text`)).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 continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state 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 W={command:`upsert <instance-id>`,describe:`Create or Update Item.`,builder:U,handler:async e=>l({command:`ai-search items upsert`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({key:h(e.key,`key`,`text`),next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Updated`});return}e.key===void 0&&(e.key=await _(`key`,`Item key / filename. Must not exceed 128 characters.`)),e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let f={};e.key!==void 0&&p(f,[`key`],h(e.key,`key`,`text`)),e[`next-action`]!==void 0&&p(f,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&p(f,[`wait_for_completion`],e[`wait-for-completion`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:f}));o(g,{successLabel:`Updated`})})},G={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).command(R).command(B).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.usage(`$0 ai-search jobs cancel <job-id>
29
-
30
- Cancels 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`]}).coerce(`action`,e=>h(e,`action`,`text`)).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 q={command:`cancel <job-id>`,describe:`Cancel an indexing job.`,builder:K,handler:async e=>l({command:`ai-search jobs cancel`,classification:{safeFlags:[`action`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({action:e.action}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation cancels the running indexing job.`}))return;if(e.body){let t=d(e.body),r=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:t}));o(r,{successLabel:`Deleted`});return}e.action===void 0&&(e.action=await v(`action`,`The action field`,[`cancel`]));let f={};e.action!==void 0&&p(f,[`action`],e.action);let h=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:f}));o(h,{successLabel:`Deleted`})})};function J(e){return e.usage(`$0 ai-search jobs create <instance-id>
31
-
32
- 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:`Optional description for the indexing job.`}).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:`create <instance-id>`,describe:`Create new job`,builder:J,handler:async e=>l({command:`ai-search jobs create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`)}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:t}));o(r,{successLabel:`Created`});return}let f={};e.description!==void 0&&p(f,[`description`],h(e.description,`description`,`text`));let g=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:f}));o(g,{successLabel:`Created`})})};function X(e){return e.usage(`$0 ai-search jobs get <job-id>
33
-
34
- 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 ie={command:`get <job-id>`,describe:`Get a Job Details`,builder:X,handler:async e=>l({command:`ai-search jobs get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`));o(d,{successLabel:`Loaded`})})};function ae(e){return e.usage(`$0 ai-search jobs list
35
-
36
- 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 oe={command:`list`,describe:`List Jobs`,builder:ae,handler:async e=>l({command:`ai-search jobs list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{query:l}));o(f,{successLabel:`Loaded`})})};function se(e){return e.usage(`$0 ai-search jobs logs <job-id>
37
-
38
- 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 ce={command:`logs <job-id>`,describe:`List Job Logs`,builder:se,handler:async e=>l({command:`ai-search jobs logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})},le={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(q).command(Y).command(ie).command(oe).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var ue={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,query:[`page`,`per_page`,`search`,`hostname`,`order_by`,`order_by_direction`],errors:{400:`BadRequestError`}};function de(e){return e.usage(`$0 ai-search list
39
-
40
- Lists 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:`Return only instances with this 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 fe={command:`list`,describe:`List AI Search instances.`,builder:de,handler:async e=>l({command:`ai-search list`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search,hostname:e.hostname,order_by:e[`order-by`],order_by_direction:e[`order-by-direction`]};if(e.dryRun){let t=await i();s({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(ue,{account_id:u,namespace:e.namespace,...n}));o(d,{successLabel:`Loaded`})})};function pe(e){return e.usage(`$0 ai-search move <instance-id>
41
-
42
- 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:`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 me={command:`move <instance-id>`,describe:`Move an instance to a different namespace.`,builder:pe,handler:async e=>l({command:`ai-search move`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e[`source-namespace`]==null?`<source-namespace>`:encodeURIComponent(String(e[`source-namespace`]))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{"source-namespace":String(e[`source-namespace`]??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({new_namespace:h(e[`destination-namespace`],`destination-namespace`,`text`)}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`destination-namespace`]===void 0&&(e[`destination-namespace`]=await _(`destination-namespace`,`Namespace to move the instance into.`));let f={};e[`destination-namespace`]!==void 0&&p(f,[`new_namespace`],h(e[`destination-namespace`],`destination-namespace`,`text`));let g=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:f}));o(g,{successLabel:`Updated`})})};function he(e){return e.usage(`$0 ai-search multi-chat-completions <namespace>
43
-
44
- 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`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).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-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at the lower of the first instance's score_threshold and 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the first instance's max_num_results, then 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).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 ge={command:`multi-chat-completions <namespace>`,describe:`Multi-Instance Chat Completions`,builder:he,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/chat/completions`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&p(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.model!==void 0&&p(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&p(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};function _e(e){return e.usage(`$0 ai-search multi-search <namespace> [query]
45
-
46
- 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`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).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-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the sum of the searched instances' max_num_results (each falling back to 10), up to 50.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).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 ve={command:`multi-search <namespace> [query]`,describe:`Multi-Instance Search`,builder:_e,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/search`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&p(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:_}));o(v,{successLabel:`Created`})})};var Z={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`}};function ye(e){return e.usage(`$0 ai-search namespace create <namespace>
47
-
48
- 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 reference an existing instance in this namespace, and the list must stay within 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`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`create <namespace>`,describe:`Create a namespace`,builder:ye,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}):d(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(Z,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}let u=m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}),f=await c(`Creating`,async()=>n.send(Z,{body:u,account_id:l}));o(f,{successLabel:`Created`})})};function xe(e){return e.usage(`$0 ai-search namespace delete <namespace>
49
-
50
- Deletes a namespace permanently. The namespace must not contain any instances (instances whose deletion is still in progress do not count), 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 Se={command:`delete <namespace>`,describe:`Delete a namespace`,builder:xe,handler:async e=>l({command:`ai-search namespace delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the namespace.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Deleted`})})};function Ce(e){return e.usage(`$0 ai-search namespace get <namespace>
51
-
52
- 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 we={command:`get <namespace>`,describe:`Get a namespace`,builder:Ce,handler:async e=>l({command:`ai-search namespace get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Loaded`})})};var Te={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ee(e){return e.usage(`$0 ai-search namespace list
53
-
54
- Lists 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 De={command:`list`,describe:`List namespaces`,builder:Ee,handler:async e=>l({command:`ai-search namespace list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(Te,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Oe(e){return e.usage(`$0 ai-search namespace update <namespace>
55
-
56
- Updates 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 reference an existing instance in this namespace, and the list must stay within 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`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).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 ke={command:`update <namespace>`,describe:`Update a namespace`,builder:Oe,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}}}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:t}));o(r,{successLabel:`Updated`});return}let f={};e.description!==void 0&&p(f,[`description`],h(e.description,`description`,`text`)),e[`public-endpoint-params-authorized-hosts`]!==void 0&&p(f,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&p(f,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&p(f,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&p(f,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-instances-allowed`]!==void 0&&p(f,[`public_endpoint_params`,`instances_allowed`],e[`public-endpoint-params-instances-allowed`]),e[`public-endpoint-params-mcp-description`]!==void 0&&p(f,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:f}));o(g,{successLabel:`Updated`})})},Ae={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(be).command(Se).command(we).command(De).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.usage(`$0 ai-search purge-cache <instance-id>
57
-
58
- 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 Me={command:`purge-cache <instance-id>`,describe:`Purge search cache.`,builder:je,handler:async e=>l({command:`ai-search purge-cache`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/purge_cache`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/purge_cache`));o(d,{successLabel:`Created`})})};function Ne(e){return e.usage(`$0 ai-search search <instance-id> [query]
59
-
60
- 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`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).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 Pe={command:`search <instance-id> [query]`,describe:`Search`,builder:Ne,handler:async e=>l({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`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/search`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:t}));o(r,{successLabel:`Loaded`});return}let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:_}));o(v,{successLabel:`Loaded`})})};function Fe(e){return e.usage(`$0 ai-search stats <instance-id>
61
-
62
- 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 Ie={command:`stats <instance-id>`,describe:`Get instance statistics.`,builder:Fe,handler:async e=>l({command:`ai-search stats`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/stats`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/stats`));o(d,{successLabel:`Loaded`})})};var Q={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,body:`json`,errors:{400:`BadRequestError`}};function Le(e){return e.usage(`$0 ai-search tokens create <name>
63
-
64
- 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:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`,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 Re={command:`create <name>`,describe:`Create a token`,builder:Le,handler:async e=>l({command:`ai-search tokens create`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}):d(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(Q,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`}));let u=m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}),f=await c(`Creating`,async()=>n.send(Q,{body:u,account_id:l}));o(f,{successLabel:`Created`})})};function ze(e){return e.usage(`$0 ai-search tokens delete <token-id>
65
-
66
- Deletes a stored AI Search credential permanently. 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 Be={command:`delete <token-id>`,describe:`Delete a token`,builder:ze,handler:async e=>l({command:`ai-search tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the stored credential.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Deleted`})})};function Ve(e){return e.usage(`$0 ai-search tokens get <token-id>
67
-
68
- 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:Ve,handler:async e=>l({command:`ai-search tokens get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Loaded`})})};var He={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ue(e){return e.usage(`$0 ai-search tokens list
69
-
70
- Lists 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 We={command:`list`,describe:`List tokens`,builder:Ue,handler:async e=>l({command:`ai-search tokens list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(He,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Ge(e){return e.usage(`$0 ai-search tokens update <token-id>
71
-
72
- 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:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`}).option(`name`,{type:`string`,description:`Human-readable name for the credential.`}).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 Ke={command:`update <token-id>`,describe:`Update a token`,builder:Ge,handler:async e=>l({command:`ai-search tokens update`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:h(e.name,`name`,`text`)}):d(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`})),e.name===void 0&&(e.name=await _(`name`,`Human-readable name for the credential.`));let f={};e[`api-token-id`]!==void 0&&p(f,[`cf_api_id`],h(e[`api-token-id`],`api-token-id`,`text`)),e[`api-token`]!==void 0&&p(f,[`cf_api_key`],h(e[`api-token`],`api-token`,`text`)),e.legacy!==void 0&&p(f,[`legacy`],e.legacy),e.name!==void 0&&p(f,[`name`],h(e.name,`name`,`text`));let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:f}));o(g,{successLabel:`Updated`})})},qe={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(Re).command(Be).command($).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.usage(`$0 ai-search update <instance-id>
73
-
74
- Updates 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`]}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`}).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`]}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).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`]}).coerce(`indexing-options-keyword-tokenizer`,e=>h(e,`indexing-options-keyword-tokenizer`,`text`)).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`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).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`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).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-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric/datetime fields and 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).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:`Minimum similarity score a chunk must reach to be returned. Defaults to 0.4.`}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index.`}).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 have a limit of 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 have a limit of 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` because discover crawls only cover 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`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-content-selector`,{type:`string`,description:`List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. The crawler stores and indexes only the matched HTML fragment. Omit the field to disable content selection; the API rejects empty arrays. Provide as a JSON array of objects or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).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 the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`}).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h). Defaults to 21600 (6h); instances crawling a domain outside the account may be set to 86400.`}).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 Ye={command:`update <instance-id>`,describe:`Update an AI Search instance.`,builder:Je,handler:async e=>l({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(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:e.paused,public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},summarization:e.summarization,summarization_model:h(e[`summarization-model`],`summarization-model`,`text`),sync_interval:e[`sync-interval`],system_prompt_ai_search:h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:h(e[`token-id`],`token-id`,`text`)},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}let _={};e[`ai-gateway-id`]!==void 0&&p(_,[`ai_gateway_id`],h(e[`ai-gateway-id`],`ai-gateway-id`,`text`)),e[`ai-search-model`]!==void 0&&p(_,[`ai_search_model`],h(e[`ai-search-model`],`ai-search-model`,`text`)),e.cache!==void 0&&p(_,[`cache`],e.cache),e[`cache-threshold`]!==void 0&&p(_,[`cache_threshold`],e[`cache-threshold`]),e[`cache-ttl`]!==void 0&&p(_,[`cache_ttl`],e[`cache-ttl`]),e.chunk!==void 0&&p(_,[`chunk`],e.chunk),e[`chunk-overlap`]!==void 0&&p(_,[`chunk_overlap`],e[`chunk-overlap`]),e[`chunk-size`]!==void 0&&p(_,[`chunk_size`],e[`chunk-size`]),e[`custom-metadata`]!==void 0&&p(_,[`custom_metadata`],u(e[`custom-metadata`],`custom-metadata`)),e[`embedding-model`]!==void 0&&p(_,[`embedding_model`],h(e[`embedding-model`],`embedding-model`,`text`)),e[`fusion-method`]!==void 0&&p(_,[`fusion_method`],e[`fusion-method`]),e[`index-method-keyword`]!==void 0&&p(_,[`index_method`,`keyword`],e[`index-method-keyword`]),e[`index-method-vector`]!==void 0&&p(_,[`index_method`,`vector`],e[`index-method-vector`]),e[`indexing-options-keyword-tokenizer`]!==void 0&&p(_,[`indexing_options`,`keyword_tokenizer`],e[`indexing-options-keyword-tokenizer`]),e[`indexing-options-use-ocr`]!==void 0&&p(_,[`indexing_options`,`use_ocr`],e[`indexing-options-use-ocr`]),e[`max-num-results`]!==void 0&&p(_,[`max_num_results`],e[`max-num-results`]),e[`metadata-created-from-aisearch-wizard`]!==void 0&&p(_,[`metadata`,`created_from_aisearch_wizard`],e[`metadata-created-from-aisearch-wizard`]),e[`metadata-created-from-emdash-plugin-type`]!==void 0&&p(_,[`metadata`,`created_from_emdash_plugin`,`type`],e[`metadata-created-from-emdash-plugin-type`]),e[`metadata-created-from-emdash-plugin-version`]!==void 0&&p(_,[`metadata`,`created_from_emdash_plugin`,`version`],h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)),e[`metadata-worker-domain`]!==void 0&&p(_,[`metadata`,`worker_domain`],h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)),e.paused!==void 0&&p(_,[`paused`],e.paused),e[`public-endpoint-params-authorized-hosts`]!==void 0&&p(_,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&p(_,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&p(_,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&p(_,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-mcp-description`]!==void 0&&p(_,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]),e.reranking!==void 0&&p(_,[`reranking`],e.reranking),e[`reranking-model`]!==void 0&&p(_,[`reranking_model`],h(e[`reranking-model`],`reranking-model`,`text`)),e[`retrieval-options-boost-by`]!==void 0&&p(_,[`retrieval_options`,`boost_by`],u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`)),e[`retrieval-options-keyword-match-mode`]!==void 0&&p(_,[`retrieval_options`,`keyword_match_mode`],e[`retrieval-options-keyword-match-mode`]),e[`rewrite-model`]!==void 0&&p(_,[`rewrite_model`],h(e[`rewrite-model`],`rewrite-model`,`text`)),e[`rewrite-query`]!==void 0&&p(_,[`rewrite_query`],e[`rewrite-query`]),e[`score-threshold`]!==void 0&&p(_,[`score_threshold`],e[`score-threshold`]),e.source!==void 0&&p(_,[`source`],h(e.source,`source`,`text`)),e[`source-params-exclude-items`]!==void 0&&p(_,[`source_params`,`exclude_items`],e[`source-params-exclude-items`]),e[`source-params-include-items`]!==void 0&&p(_,[`source_params`,`include_items`],e[`source-params-include-items`]),e[`source-params-prefix`]!==void 0&&p(_,[`source_params`,`prefix`],h(e[`source-params-prefix`],`source-params-prefix`,`text`)),e[`source-params-r2-jurisdiction`]!==void 0&&p(_,[`source_params`,`r2_jurisdiction`],h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`)),e[`source-params-web-crawler-discover-options-depth`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`depth`],e[`source-params-web-crawler-discover-options-depth`]),e[`source-params-web-crawler-discover-options-include-external-links`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`include_external_links`],e[`source-params-web-crawler-discover-options-include-external-links`]),e[`source-params-web-crawler-discover-options-include-subdomains`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`include_subdomains`],e[`source-params-web-crawler-discover-options-include-subdomains`]),e[`source-params-web-crawler-discover-options-limit`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`limit`],e[`source-params-web-crawler-discover-options-limit`]),e[`source-params-web-crawler-discover-options-max-age`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`max_age`],e[`source-params-web-crawler-discover-options-max-age`]),e[`source-params-web-crawler-discover-options-source`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`source`],e[`source-params-web-crawler-discover-options-source`]),e[`source-params-web-crawler-parse-options-content-selector`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`content_selector`],u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`)),e[`source-params-web-crawler-parse-options-include-headers`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`include_headers`],f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`)),e[`source-params-web-crawler-parse-options-include-images`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`include_images`],e[`source-params-web-crawler-parse-options-include-images`]),e[`source-params-web-crawler-parse-options-specific-sitemaps`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`specific_sitemaps`],e[`source-params-web-crawler-parse-options-specific-sitemaps`]),e[`source-params-web-crawler-parse-options-use-browser-rendering`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`use_browser_rendering`],e[`source-params-web-crawler-parse-options-use-browser-rendering`]),e[`source-params-web-crawler-parse-type`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_type`],e[`source-params-web-crawler-parse-type`]),e.summarization!==void 0&&p(_,[`summarization`],e.summarization),e[`summarization-model`]!==void 0&&p(_,[`summarization_model`],h(e[`summarization-model`],`summarization-model`,`text`)),e[`sync-interval`]!==void 0&&p(_,[`sync_interval`],e[`sync-interval`]),e[`system-prompt-ai-search`]!==void 0&&p(_,[`system_prompt_ai_search`],h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`)),e[`system-prompt-index-summarization`]!==void 0&&p(_,[`system_prompt_index_summarization`],h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`)),e[`system-prompt-rewrite-query`]!==void 0&&p(_,[`system_prompt_rewrite_query`],h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`)),e[`token-id`]!==void 0&&p(_,[`token_id`],h(e[`token-id`],`token-id`,`text`));let v=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:_}));o(v,{successLabel:`Updated`})})},Xe={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(re).command(S).command(w).command(E).command(fe).command(me).command(ge).command(ve).command(Me).command(Pe).command(Ie).command(Ye).command(G).command(le).command(Ae).command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Xe as default};
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{n}from"./auth-D5Yj9eYU.mjs";import{a as r,i,t as a}from"./context-BvLXzoMs.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-B-CVX0kn.mjs";import{t as l}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{a as u,n as d,t as f}from"./body-parser-BKcZS9iJ.mjs";import{n as p}from"./input-validation-D7z60HJH.mjs";import{a as m}from"./prompt-DJF_Rs5S.mjs";var h={method:`GET`,path:t=>e`/zones/${t.zone_id}/analytics/latency/colos`};function g(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 _={command:`get`,describe:`Argo Analytics for a zone at different PoPs`,builder:g,handler:async e=>l({command:`analytics latency colos get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){s({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 t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r;let a=await c(`Loading`,async()=>t.send(h,{zone_id:r}));o(a,{successLabel:`Loaded`})})},v={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var y={method:`GET`,path:t=>e`/zones/${t.zone_id}/analytics/latency`,query:[`bins`]};function b(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 x={command:`get`,describe:`Argo Analytics for a zone`,builder:b,handler:async e=>l({command:`analytics latency get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={bins:e.bins};if(e.dryRun){s({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:t,bodyKind:`none`});return}let r=await n(e),a=await i({zone:e.zone},r,{quiet:e.quiet});e.zoneId=a;let l=await c(`Loading`,async()=>r.send(y,{zone_id:a,...t}));o(l,{successLabel:`Loaded`})})},S={command:`latency`,describe:`Argo Smart Routing latency analytics showing time-to-first-byte improvements`,builder:e=>e.command(x).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var C={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/data-security/content-findings/top-n`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function w(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(`limit`,{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 T={command:`top-n`,describe:`Top integrations by content findings`,builder:w,handler:async e=>l({command:`analytics query data-security content-findings top-n`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query data-security content-findings top-n`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/data-security/content-findings/top-n`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),n:e.limit,to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(C,{body:t,account_id:l}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,`Start of the query time range (inclusive). RFC3339.`)),e.limit===void 0)throw Error(`--limit is required (or pass --body with this field set).`);e.to===void 0&&(e.to=await m(`to`,`End of the query time range (exclusive). RFC3339.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),n:e.limit,to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(C,{body:h,account_id:l}));o(g,{successLabel:`Created`})})},E={command:`content-findings`,describe:`Operations for query.data-security.content-findings`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var D={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/data-security/findings/summary`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function O(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 k={command:`summary`,describe:`Data security findings summary`,builder:O,handler:async e=>l({command:`analytics query data-security findings summary`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query data-security findings summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/data-security/findings/summary`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(D,{body:t,account_id:l}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);e.from===void 0&&(e.from=await m(`from`,`Start of the query time range (inclusive). RFC3339.`)),e.to===void 0&&(e.to=await m(`to`,`End of the query time range (exclusive). RFC3339.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(D,{body:h,account_id:l}));o(g,{successLabel:`Created`})})};var A={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/data-security/findings/timeseries`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function j(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 M={command:`timeseries`,describe:`Data security findings timeseries`,builder:j,handler:async e=>l({command:`analytics query data-security findings timeseries`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query data-security findings timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/data-security/findings/timeseries`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(A,{body:t,account_id:l}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);e.from===void 0&&(e.from=await m(`from`,`Start of the query time range (inclusive). RFC3339.`)),e.to===void 0&&(e.to=await m(`to`,`End of the query time range (exclusive). RFC3339.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(A,{body:h,account_id:l}));o(g,{successLabel:`Created`})})},N={command:`findings`,describe:`Operations for query.data-security.findings`,builder:e=>e.command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`data-security`,describe:`Operations for query.data-security`,builder:e=>e.command(E).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var F={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/summary`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function I(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 L={command:`summary <dataset>`,describe:`Query analytics summary`,builder:I,handler:async e=>l({command:`analytics query summary`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/summary`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(F,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(F,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})};var R={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/timeseries`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function z(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 B={command:`timeseries <dataset>`,describe:`Query analytics timeseries`,builder:z,handler:async e=>l({command:`analytics query timeseries`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/timeseries`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),resolution:p(e.resolution,`resolution`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(R,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),e.resolution===void 0&&(e.resolution=await m(`resolution`,`Time bucket size for grouping results. Controls the granularity of the returned time slots. `));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),resolution:p(e.resolution,`resolution`,`text`)}),g=await c(`Creating`,async()=>i.send(R,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})};var V={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/top-n`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function H(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(`limit`,{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 U={command:`top-n <dataset>`,describe:`Query analytics top-N`,builder:H,handler:async e=>l({command:`analytics query top-n`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query top-n`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/top-n`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),n:e.limit,orderBy:p(e[`order-by`],`order-by`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(V,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);if(e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),e.limit===void 0)throw Error(`--limit is required (or pass --body with this field set).`);e[`order-by`]===void 0&&(e[`order-by`]=await m(`order-by`,`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),n:e.limit,orderBy:p(e[`order-by`],`order-by`,`text`)}),g=await c(`Creating`,async()=>i.send(V,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})},W={command:`query`,describe:`Operations for query`,builder:e=>e.command(L).command(B).command(U).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},G={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(S).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{G as default};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{i as n,n as r}from"./auth-D5Yj9eYU.mjs";import{a as i,t as a}from"./context-BvLXzoMs.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-B-CVX0kn.mjs";import{t as l}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{n as u,t as d}from"./input-validation-D7z60HJH.mjs";var f={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics_engine/sql`,errors:{400:`BadRequestError`,403:`ForbiddenError`,422:`UnprocessableEntityError`,429:`TooManyRequestsError`,500:`InternalServerError`,503:`ServiceUnavailableError`,504:`GatewayTimeoutError`}};function p(e){return e.usage(`$0 analytics-engine sql query
3
-
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 m={command:`query`,describe:`Execute an Analytics Engine SQL query via request body`,builder:p,handler:async e=>l({command:`analytics-engine sql query`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf analytics-engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:e.body});return}let l=await r(e),p=e.local?t:await a();if(e.accountId=p,e.file){let t=d(e.file),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${p}/analytics_engine/sql`,{body:t,headers:{"Content-Type":`text/plain`}}));o(r,{successLabel:`Loaded`});return}if(e.body){let t=u(e.body,`body`,`binary`),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${p}/analytics_engine/sql`,{body:t,headers:{"Content-Type":`text/plain`}}));o(r,{successLabel:`Loaded`});return}let m=await c(`Loading`,async()=>l.send(f,{account_id:p}));o(m,{successLabel:`Loaded`})})},h={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},g={command:`analytics-engine`,describe:`analytics-engine`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- function e(e){return{headers:e.headers,redirected:e.redirected,status:e.status,statusText:e.statusText,type:e.type,url:e.url}}const t={headers:new Headers,redirected:!1,status:499,statusText:`Client Closed Request`,type:`error`,url:``},n={headers:new Headers,redirected:!1,status:0,statusText:`Unknown Error`,type:`error`,url:``};function r({message:e,statusCode:t,body:n}){let r=[];return e!=null&&r.push(e),t!=null&&r.push(`Status code: ${t.toString()}`),n!=null&&r.push(`Body: ${JSON.stringify(n,void 0,2)}`),r.join(`
3
- `)}var i=class extends Error{statusCode;body;rawResponse;constructor(e){super(r(e)),Object.setPrototypeOf(this,new.target.prototype),this.name=`ApiError`,this.statusCode=e.statusCode,this.body=e.body,this.rawResponse=e.rawResponse,e.cause!==void 0&&e.cause!==null&&Object.defineProperty(this,"cause",{value:e.cause,writable:!0,configurable:!0})}get requestId(){return this.rawResponse?.headers?.get(`x-request-id`)??void 0}},a=class extends i{constructor(e,t){super({message:e,cause:t?.cause}),Object.setPrototypeOf(this,new.target.prototype),this.name=`ApiTimeoutError`}};function o(e,t,n,r){let a=new i({message:e,statusCode:t,body:n,rawResponse:r});return a.name=e,a}function s(e){if(!e)return e;let t=+!!e.startsWith(`/`),n=e.endsWith(`/`)?e.length-1:e.length;return t===0&&n===e.length?e:e.slice(t,n)}function c(e,t){return e.endsWith(`/`)?e+t:`${e}/${t}`}function l(e,t){let n=e;for(let e of t){let t=s(e);t&&(n=c(n,t))}return t.at(-1)?.endsWith(`/`)&&!n.endsWith(`/`)&&(n+=`/`),n}function u(e,...t){if(!e)return``;if(t.length===0)return e;if(!e.includes(`://`))return l(e,t);let n;try{n=new URL(e)}catch{return l(e,t)}for(let e of t){let t=s(e);t&&(n.pathname=c(n.pathname,t))}return t.at(-1)?.endsWith(`/`)&&!n.pathname.endsWith(`/`)&&(n.pathname+=`/`),n.toString()}function d(e){return e==null?``:encodeURIComponent(String(e))}function f(e,t,n){let r=[];for(let[i,a]of Object.entries(e)){let e=t?`${t}[${i}]`:i;if(a!=null){if(Array.isArray(a)){if(a.length===0)continue;if(n){let t=a.filter(e=>e!=null).map(d);t.length>0&&r.push(`${encodeURIComponent(e)}=${t.join(`,`)}`);continue}for(let t of a)t!=null&&(typeof t==`object`&&!Array.isArray(t)?r.push(...f(t,e,n)):r.push(`${encodeURIComponent(e)}=${d(t)}`))}else if(typeof a==`object`){if(Object.keys(a).length===0)continue;r.push(...f(a,e,n))}else r.push(`${encodeURIComponent(e)}=${d(a)}`)}}return r}function p(e,t=[]){let n=/* @__PURE__ */ new Map;for(let[t,r]of e){if(r==null)continue;let e=f({[t]:r},``,!1).join(`&`);e.length>0&&n.set(t,e)}for(let[r,i]of e){if(!t.includes(r)||i==null)continue;let e=f({[r]:i},``,!0).join(`&`);e.length>0&&n.set(r,e)}return[...n.values()].join(`&`)}function m(t,n){if(typeof t!=`object`||!t||Array.isArray(t)||!(`success`in t))return t;let r=e=>Reflect.get(t,e);if(r(`success`)===!1){let a=r(`errors`),o=(Array.isArray(a)?a:[]).map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`message`in e){let t=Reflect.get(e,`message`);return typeof t==`string`?t:void 0}}).filter(e=>typeof e==`string`&&e.length>0).join(`, `)||`Cloudflare API request failed`,s=new i({message:o,statusCode:n?.ok===!1?n.status:void 0,body:t,rawResponse:n?e(n):void 0});throw s.name=`ApiEnvelopeError`,s.message=o,s}if(!(`result`in t))return t;let a=r(`result`);return Array.isArray(a)?{result:a,result_info:r(`result_info`)}:a}function h(e){let t={get bodyUsed(){return e.bodyUsed},stream:()=>e.body,arrayBuffer:e.arrayBuffer.bind(e),blob:e.blob.bind(e)};return`bytes`in e&&typeof e.bytes==`function`&&(t.bytes=e.bytes.bind(e)),t}async function g(e,t){if(t===`binary-response`)return h(e);if(t===`text`)return await e.text();let n=await e.text();if(n.length===0)return;let r;try{r=JSON.parse(n)}catch{return{ok:!1,error:{reason:`non-json`,statusCode:e.status,rawBody:n}}}return m(r,e)}const _=/* @__PURE__ */ new Set([`application/hal+json`,`application/json`,`application/ld+json`,`application/problem+json`,`application/vnd.api+json`,`text/json`]);async function v(e){let t=e.headers.get(`Content-Type`)?.toLowerCase();if(t==null||t.length===0)return g(e);if(t.includes(`;`)&&(t=t.split(`;`)[0]?.trim()??``),_.has(t)||t.startsWith(`application/vnd.`)&&t.endsWith(`+json`)){let t=await e.text();return t.length>0?JSON.parse(t):void 0}return await e.text()}function y(e){let t=new AbortController;for(let n of e)if(n.aborted||(n.addEventListener(`abort`,()=>t.abort(n.reason),{signal:t.signal}),n.aborted))return t.abort(n.reason),t.signal;return t.signal}async function b(e,t,n,r,i){let a=[],o;if(r!==void 0){let e=new AbortController;o=setTimeout(()=>e.abort(`timeout`),r),a.push(e.signal)}i!==void 0&&a.push(i);try{return await e(t,{...n,signal:y(a)})}finally{o!==void 0&&clearTimeout(o)}}const x=[408,429,502,503,504];function S(e,t){let n=e.headers.get(`Retry-After`);if(n){let e=parseInt(n,10);if(!Number.isNaN(e)&&e>0)return Math.min(e*1e3,6e4);let t=new Date(n);if(!Number.isNaN(t.getTime())){let e=t.getTime()-Date.now();if(e>0)return Math.min(e,6e4)}}let r=e.headers.get(`X-RateLimit-Reset`);if(r){let e=parseInt(r,10);if(!Number.isNaN(e)){let t=e*1e3-Date.now();if(t>0)return Math.min(t,6e4)*(1+Math.random()*.2)}}return Math.min(1e3*2**t,6e4)*(1+(Math.random()-.5)*.2)}async function C(e,t,n,r){let i=await b(e,t,n,r.timeoutMs,r.signal);for(let a=0;a<(r.maxRetries??2)&&x.includes(i.status);a++)await new Promise(e=>setTimeout(e,S(i,a))),i=await b(e,t,n,r.timeoutMs,r.signal);return i}function w(...e){let t={};for(let n of e)if(n!=null)for(let[e,r]of Object.entries(n)){let n=e.toLowerCase();r==null?n in t&&delete t[n]:t[n]=r}return t}var T=class{#e;constructor(e){this.#e=e}get baseUrl(){return this.#e.baseUrl}async#t(){return(await this.#e.auth?.())?.headers??{}}async send(r,s={},c){let l=new Set(r.pathParams),d=r.path(s),f=d.replace(/^\//,``),m=[];for(let e of r.query??[])l.add(e),m.push([e,s[e]]);let h={};for(let e of r.headers??[])l.add(e),h[e]=s[e];let _,y;if(r.body===`json`){_=s.body;let e=typeof _==`object`&&!!_&&!Array.isArray(_);r.constants!==void 0&&(_===void 0||e)&&(_={..._,...r.constants})}else if(r.body===`form`){y=new FormData;for(let[e,t]of Object.entries(s))!l.has(e)&&t!=null&&y.append(e,typeof t==`object`?JSON.stringify(t):String(t))}let b=u(this.#e.baseUrl,f),x=p(m,r.joined),S=new Headers;S.set(`Accept`,r.response===`text`?`text/plain`:`*/*`),_!==void 0&&r.body!==`form`&&S.set(`Content-Type`,r.contentType??`application/json`);let T=w(await this.#t(),this.#e.headers,Object.fromEntries(Object.entries(h).filter(([,e])=>e!=null)),c?.headers);for(let[e,t]of Object.entries(T))S.set(e,typeof t==`string`?t:`${t}`);let E={method:r.method,headers:S};y===void 0?_!==void 0&&(E.body=JSON.stringify(_)):(E.body=y,E.duplex=`half`);let D=c?.timeoutInSeconds??this.#e.timeoutInSeconds??60,O=c?.abortSignal,k;try{let t=await C(this.#e.fetch??fetch,x?`${b}?${x}`:b,E,{timeoutMs:D*1e3,signal:O,maxRetries:c?.maxRetries??this.#e.maxRetries}),n=e(t);if(t.status<200||t.status>=400){let e=await v(t),a=r.errors?.[String(t.status)];throw a===void 0?new i({statusCode:t.status,body:e,rawResponse:n}):o(a,t.status,e,n)}k=await g(t,r.response===!1?void 0:r.response)}catch(e){throw e instanceof i?e:O?.aborted?new i({message:`The user aborted a request`,rawResponse:t,cause:e}):e instanceof Error&&e.name===`AbortError`?new a(`Timeout exceeded when calling ${r.method} ${d}.`,{cause:e}):new i({message:e instanceof Error?e.message:JSON.stringify(e),rawResponse:n,cause:e})}if(r.response!==!1)return k}async fetch(e,t,n){let r=e instanceof URL?e.toString():e,i=r.startsWith(`http://`)||r.startsWith(`https://`)?r:u(this.#e.baseUrl,r),a={};for(let[e,t]of Object.entries(this.#e.headers??{}))t!=null&&(a[e.toLowerCase()]=`${t}`);for(let[e,t]of Object.entries(await this.#t()))a[e.toLowerCase()]=t;if(t?.headers!==void 0&&t.headers!==null){let e=t.headers instanceof Headers?Object.fromEntries(t.headers.entries()):Array.isArray(t.headers)?Object.fromEntries(t.headers):t.headers;for(let[t,n]of Object.entries(e))n!=null&&(a[t.toLowerCase()]=n)}for(let[e,t]of Object.entries(n?.headers??{}))a[e.toLowerCase()]=t;let o=n?.timeoutInSeconds??this.#e.timeoutInSeconds,s={method:t?.method??`GET`,headers:a};return t?.body!==void 0&&t.body!==null&&(s.body=t.body),C(this.#e.fetch??fetch,i,s,{timeoutMs:o===void 0?void 0:o*1e3,signal:n?.abortSignal??t?.signal??void 0,maxRetries:n?.maxRetries??this.#e.maxRetries})}};export{i as n,T as t};
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{n}from"./auth-D5Yj9eYU.mjs";import{a as r,i,t as a}from"./context-BvLXzoMs.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-B-CVX0kn.mjs";import{t as l}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{n as u,t as d}from"./body-parser-BKcZS9iJ.mjs";import{n as f}from"./input-validation-D7z60HJH.mjs";import{i as p}from"./prompt-DJF_Rs5S.mjs";var m={method:`GET`,path:t=>e`/accounts/${t.account_id}/argo/count_zones_enabled`};function h(e){return e.usage(`$0 argo smart-routing count-zones-enabled-for-account
3
-
4
- Returns the number of zones that have Argo Smart Routing enabled for the specified account.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const g={command:`count-zones-enabled-for-account`,describe:`Get count of zones with Argo Smart Routing enabled for account`,builder:h,handler:async e=>l({command:`argo smart-routing count-zones-enabled-for-account`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let e=await r();s({command:`cf argo smart-routing count-zones-enabled-for-account`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/argo/count_zones_enabled`,pathParams:{},bodyKind:`none`});return}let i=await n(e),l=e.local?t:await a();e.accountId=l;let u=await c(`Loading`,async()=>i.send(m,{account_id:l}));o(u,{successLabel:`Loaded`})})};var _={method:`GET`,path:()=>`/user/argo/count_zones_enabled`};function v(e){return e.usage(`$0 argo smart-routing count-zones-enabled-for-user
5
-
6
- Returns the number of zones that have Argo Smart Routing enabled for the authenticated user.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`count-zones-enabled-for-user`,describe:`Get count of zones with Argo Smart Routing enabled for user`,builder:v,handler:async e=>l({command:`argo smart-routing count-zones-enabled-for-user`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf argo smart-routing count-zones-enabled-for-user`,method:`GET`,url:`https://api.cloudflare.com/client/v4/user/argo/count_zones_enabled`,pathParams:{},bodyKind:`none`});return}let t=await n(e),r=await c(`Loading`,async()=>t.send(_));o(r,{successLabel:`Loaded`})})};var b={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/argo/smart_routing`,body:`json`};function x(e){return e.usage(`$0 argo smart-routing edit
7
-
8
- Configures the value of the Argo Smart Routing enablement setting.`).option(`value`,{type:`string`,description:`Specifies the enablement value of Argo Smart Routing.`,choices:[`on`,`off`]}).coerce(`value`,e=>f(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Configures the enablement of Argo Smart Routing.`})}const S={command:`edit`,describe:`Patch Argo Smart Routing setting`,builder:x,handler:async e=>l({command:`argo smart-routing edit`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf argo smart-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({value:e.value}):u(e.body)});return}let t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=u(e.body),i=await c(`Updating`,async()=>t.send(b,{body:n,zone_id:r}));o(i,{successLabel:`Updated`});return}e.value===void 0&&(e.value=await p(`value`,`Specifies the enablement value of Argo Smart Routing.`,[`on`,`off`]));let a=d({value:e.value}),l=await c(`Updating`,async()=>t.send(b,{body:a,zone_id:r}));o(l,{successLabel:`Updated`})})};var C={method:`GET`,path:t=>e`/zones/${t.zone_id}/argo/smart_routing`};function w(e){return e.usage(`$0 argo smart-routing get
9
-
10
- Retrieves the value of Argo Smart Routing enablement setting.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get`,describe:`Get Argo Smart Routing setting`,builder:w,handler:async e=>l({command:`argo smart-routing get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf argo smart-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/smart_routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r;let a=await c(`Loading`,async()=>t.send(C,{zone_id:r}));o(a,{successLabel:`Loaded`})})},E={command:`smart-routing`,describe:`Route traffic through the fastest network paths to your origin using real-time latency data`,builder:e=>e.command(g).command(y).command(S).command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var D={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/argo/tiered_caching`,body:`json`};function O(e){return e.usage(`$0 argo tiered-caching edit
11
-
12
- Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`).option(`value`,{type:`string`,description:`Enables Tiered Caching.`,choices:[`on`,`off`]}).coerce(`value`,e=>f(e,`value`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update enablement of Tiered Caching.`})}const k={command:`edit`,describe:`Patch Tiered Caching setting`,builder:O,handler:async e=>l({command:`argo tiered-caching edit`,classification:{safeFlags:[`value`,`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf argo tiered-caching edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?d({value:e.value}):u(e.body)});return}let t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=r,e.body){let n=u(e.body),i=await c(`Updating`,async()=>t.send(D,{body:n,zone_id:r}));o(i,{successLabel:`Updated`});return}e.value===void 0&&(e.value=await p(`value`,`Enables Tiered Caching.`,[`on`,`off`]));let a=d({value:e.value}),l=await c(`Updating`,async()=>t.send(D,{body:a,zone_id:r}));o(l,{successLabel:`Updated`})})};var A={method:`GET`,path:t=>e`/zones/${t.zone_id}/argo/tiered_caching`};function j(e){return e.usage(`$0 argo tiered-caching get
13
-
14
- Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of lower-tiers and upper-tiers. If content is not cached in lower-tier data centers (generally the ones closest to a visitor), the lower-tier must ask an upper-tier to see if it has the content. If the upper-tier does not have the content, only the upper-tier can ask the origin for content. This practice improves bandwidth efficiency by limiting the number of data centers that can ask the origin for content, which reduces origin load and makes websites more cost-effective to operate. Additionally, Tiered Cache concentrates connections to origin servers so they come from a small number of data centers rather than the full set of network locations. This results in fewer open connections using server resources.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`get`,describe:`Get Tiered Caching setting`,builder:j,handler:async e=>l({command:`argo tiered-caching get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf argo tiered-caching get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/argo/tiered_caching`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r;let a=await c(`Loading`,async()=>t.send(A,{zone_id:r}));o(a,{successLabel:`Loaded`})})},N={command:`tiered-caching`,describe:`Reduce origin load by having upper-tier data centers serve cache misses before reaching your origin`,builder:e=>e.command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`argo`,describe:`Network optimization features that speed up and improve reliability of traffic to your origins`,builder:e=>e.command(E).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{P as default};