cf 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/README.md +5 -0
  2. package/dist/_meta/agent-context.json +34 -35
  3. package/dist/_meta/commands.json +6834 -10044
  4. package/dist/_meta/schemas.json +11228 -12752
  5. package/dist/{abuse-reports-DnNvw2gG.mjs → abuse-reports-CGF4zcKf.mjs} +2 -2
  6. package/dist/{access-RbqBFrSC.mjs → access-lhLJo1v2.mjs} +1 -1
  7. package/dist/{account-D7xvYqDx.mjs → account-CYRm3yoN.mjs} +1 -1
  8. package/dist/account-tags-B88TotoH.mjs +9 -0
  9. package/dist/accounts-BSIAT_iP.mjs +28 -0
  10. package/dist/{acm-Szq4CoQN.mjs → acm-VULm1djv.mjs} +1 -1
  11. package/dist/{addressing-CgTTbuCF.mjs → addressing-BHPBIkRY.mjs} +1 -1
  12. package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-KBy48G1b.mjs} +1 -1
  13. package/dist/{agent-memory-C8pT01pR.mjs → agent-memory-DDv_Gxr7.mjs} +2 -2
  14. package/dist/{ai-audit-CCygMmsh.mjs → ai-audit-BWZGvbca.mjs} +1 -1
  15. package/dist/{ai-gateway-D4tATNRV.mjs → ai-gateway-jeB-sAgP.mjs} +1 -1
  16. package/dist/ai-search-BmdskMjR.mjs +7 -0
  17. package/dist/{ai-security-AUfzagSE.mjs → ai-security-CsmfcaUx.mjs} +1 -1
  18. package/dist/{ai-Cn0BniR4.mjs → ai-viHB1tgI.mjs} +1 -1
  19. package/dist/{alerting-DbXVpGv3.mjs → alerting-Bl8OqViR.mjs} +4 -4
  20. package/dist/analytics-vOxw8Hy0.mjs +3 -0
  21. package/dist/{analytics_engine-B_bMbfxW.mjs → analytics_engine-DO4-C0wD.mjs} +1 -1
  22. package/dist/{api-security-pSJdgmtK.mjs → api-security-4FVrD4n8.mjs} +1 -1
  23. package/dist/argo-CQfCgazW.mjs +2 -0
  24. package/dist/args-DlUhyGU0.mjs +2 -0
  25. package/dist/artifacts-CVDGnr2V.mjs +4 -0
  26. package/dist/{audit-logs-BIHP5-rk.mjs → audit-logs-CzpwvQ6A.mjs} +1 -1
  27. package/dist/{auth-MeSu8lFz.mjs → auth-D0xZxAEa.mjs} +1 -1
  28. package/dist/{auth-C6MhC9EZ.mjs → auth-MQEamPN9.mjs} +2 -2
  29. package/dist/{billing-0RNCYBJM.mjs → billing-aJgapeRm.mjs} +2 -2
  30. package/dist/{bot-management-uhBRnSPl.mjs → bot-management-Y2q5d-pi.mjs} +1 -1
  31. package/dist/{botnet-feed-DEbMknrE.mjs → botnet-feed-DANJqfmE.mjs} +1 -1
  32. package/dist/{brand-protection-DY2qPL8d.mjs → brand-protection-CjpZWBjp.mjs} +1 -1
  33. package/dist/{browser-extension-DBsmLCUj.mjs → browser-extension-BtpCbh-2.mjs} +1 -1
  34. package/dist/browser-run-BFn9h2Tz.mjs +4 -0
  35. package/dist/{build-Nivzj54_.mjs → build-DcflwvqN.mjs} +1 -1
  36. package/dist/{cache-BgRIDcFJ.mjs → cache-VyWK1SjY.mjs} +1 -1
  37. package/dist/{calls-JrRne0U0.mjs → calls-BxoRYxs4.mjs} +1 -1
  38. package/dist/{certificate-authorities-BJ7W8GGQ.mjs → certificate-authorities-D7OAFxF_.mjs} +1 -1
  39. package/dist/{cf-BUKsENG5.mjs → cf-C7DU4819.mjs} +2 -2
  40. package/dist/{chunk-LQW53VED-Xakf_rUn.mjs → chunk-LQW53VED-DLrXV-hE.mjs} +2 -2
  41. package/dist/{client-certificates-6xxvcOgI.mjs → client-certificates-DDUv8K0a.mjs} +1 -1
  42. package/dist/{client-side-security-cU0Z1tql.mjs → client-side-security-D4ysjwWT.mjs} +1 -1
  43. package/dist/{cloud-connector-DFooSAcn.mjs → cloud-connector-Bhec6z2P.mjs} +1 -1
  44. package/dist/cloudforce-one-J_hn9ss9.mjs +36 -0
  45. package/dist/config.mjs +1 -1
  46. package/dist/connector-interrupts-Dycx8zFx.mjs +2 -0
  47. package/dist/{connector-telemetry-events-CTMmX2BA.mjs → connector-telemetry-events-BmxOSNtN.mjs} +1 -1
  48. package/dist/connector-telemetry-events-latest-BY2556uL.mjs +2 -0
  49. package/dist/{connector-telemetry-snapshots-5Y7m8Cw8.mjs → connector-telemetry-snapshots-CdcqfKnH.mjs} +1 -1
  50. package/dist/connector-telemetry-snapshots-latest-BHYdxUEF.mjs +2 -0
  51. package/dist/{connectors-BRCQSsos.mjs → connectors-BqxYMMtQ.mjs} +1 -1
  52. package/dist/{containers-CfKOM_f5.mjs → containers-CKW081JA.mjs} +8 -8
  53. package/dist/{content-scan-CB4xHGv1.mjs → content-scan-Dgd7A8KF.mjs} +1 -1
  54. package/dist/{csamScanner-AQo_QTlq.mjs → csamScanner-DYL37wLc.mjs} +1 -1
  55. package/dist/{ct-alerting-Bai-1Z3k.mjs → ct-alerting-CkhSbfAs.mjs} +1 -1
  56. package/dist/{custom-certificates-D6aQIGu2.mjs → custom-certificates-BzAOnEoT.mjs} +1 -1
  57. package/dist/custom-csrs-CgzG3pd3.mjs +3 -0
  58. package/dist/{custom-hostnames-BiOVGwnR.mjs → custom-hostnames-q_nsnlye.mjs} +4 -4
  59. package/dist/custom-nameservers-BUBmfhUe.mjs +3 -0
  60. package/dist/custom-pages-M7jA2Hit.mjs +3 -0
  61. package/dist/{d1-FmAh7T7l.mjs → d1-BFvMd6-S.mjs} +1 -1
  62. package/dist/{data-security-2fmzF_Me.mjs → data-security-Bji4Or_j.mjs} +2 -2
  63. package/dist/{dcv-delegation-Cmxxgi9V.mjs → dcv-delegation-BuoRQ1Yh.mjs} +1 -1
  64. package/dist/{deploy-BzFbjH6a.mjs → deploy-CZ7bgNDu.mjs} +1 -1
  65. package/dist/{deploy-input-BRMQehgs.mjs → deploy-input-CrvuoDGJ.mjs} +1 -1
  66. package/dist/{dev-CWaf-qW4.mjs → dev-V10MG-Bg.mjs} +1 -1
  67. package/dist/{diagnostics-Ca6r_972.mjs → diagnostics-BTH-8nJH.mjs} +2 -2
  68. package/dist/{directory-CGNWfVQc.mjs → directory-BlH6N6Qy.mjs} +1 -1
  69. package/dist/{dispatch-namespaces-CBo5kuf7.mjs → dispatch-namespaces-BCjH1JzB.mjs} +1 -1
  70. package/dist/{dist-COfwjT96.mjs → dist-CgrMkXFx.mjs} +1 -1
  71. package/dist/{dls-CobKlH4N.mjs → dls-BF5iN78p.mjs} +1 -1
  72. package/dist/{dns-OfJXNYkK.mjs → dns-CeCTNqRk.mjs} +11 -11
  73. package/dist/{dns-firewall-DZ2ij-nX.mjs → dns-firewall-B54MaLGm.mjs} +1 -1
  74. package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wIVDg_fl.mjs} +1 -1
  75. package/dist/{durable-objects-Cw_y37WB.mjs → durable-objects-D8FQORrL.mjs} +1 -1
  76. package/dist/{email-auth-DuJHdiwN.mjs → email-auth-DJK0Eb30.mjs} +1 -1
  77. package/dist/email-routing-NpmiKIrl.mjs +6 -0
  78. package/dist/{email-security-D-P8ln2L.mjs → email-security-BLZ7WZ9Z.mjs} +2 -2
  79. package/dist/email-sending-dn-353Nx.mjs +7 -0
  80. package/dist/fieldExtractors-ahysj57J.mjs +3 -0
  81. package/dist/firewall-CBPGJ43p.mjs +11 -0
  82. package/dist/{flagship-CPkQMist.mjs → flagship-BusjRNIb.mjs} +3 -3
  83. package/dist/{fraud-BhX0QNUl.mjs → fraud-BIhS8pLf.mjs} +1 -1
  84. package/dist/{google-tag-gateway-CDtRxao4.mjs → google-tag-gateway-TZZ3F1tV.mjs} +1 -1
  85. package/dist/{healthchecks-D2WwALvQ.mjs → healthchecks-FiXIk-KP.mjs} +2 -2
  86. package/dist/{hostnames-CGAFkYT1.mjs → hostnames-Bx0mykMR.mjs} +1 -1
  87. package/dist/{hyperdrive-zLFPWFQj.mjs → hyperdrive-C8qCabBF.mjs} +1 -1
  88. package/dist/{iam-Su_hpatD.mjs → iam-Cj63Kjc6.mjs} +1 -1
  89. package/dist/{images-D2ZflvBi.mjs → images-CBWXCDhy.mjs} +1 -1
  90. package/dist/index.mjs +1 -1
  91. package/dist/{intel-DPGzVovJ.mjs → intel-B-9Z_sJs.mjs} +2 -2
  92. package/dist/{interactive-CM2G03lr.mjs → interactive-DtsCYfrK.mjs} +1 -1
  93. package/dist/{ips-C5-NH1b0.mjs → ips-qs9eGJnI.mjs} +1 -1
  94. package/dist/{keyless-certificates-Xx-oAN3Z.mjs → keyless-certificates-THHvoXX3.mjs} +1 -1
  95. package/dist/{keys-B0FBtlOD.mjs → keys-D7N0j4-x.mjs} +1 -1
  96. package/dist/{kv-BbZ9st5o.mjs → kv-BFDUCnft.mjs} +1 -1
  97. package/dist/{leaked-credential-checks-Vonw4inx.mjs → leaked-credential-checks-DUlUCOoJ.mjs} +1 -1
  98. package/dist/load-balancers-D2zbQ8fT.mjs +6 -0
  99. package/dist/{local-eEF0NF51.mjs → local-D-aVNu6A.mjs} +1 -1
  100. package/dist/{local-runtime-BNCCOZ8s.mjs → local-runtime-Dh3keC5v.mjs} +1 -1
  101. package/dist/logexplorer-CUsfZ_bS.mjs +13 -0
  102. package/dist/{logo-matches-oHYc8Xaz.mjs → logo-matches-CJcthPHf.mjs} +1 -1
  103. package/dist/{logos-DS0krPAz.mjs → logos-BS65zN8q.mjs} +1 -1
  104. package/dist/logpush-BK34mMQs.mjs +4 -0
  105. package/dist/{logs-C07M9zn-.mjs → logs-CLAqX9h2.mjs} +1 -1
  106. package/dist/{magic-cloud-networking-ZPEK7O5I.mjs → magic-cloud-networking-h_ozrC5S.mjs} +1 -1
  107. package/dist/magic-network-monitoring-C7tAPNKP.mjs +4 -0
  108. package/dist/{magic-transit-CgPZ8iMn.mjs → magic-transit-BtsFePMx.mjs} +5 -5
  109. package/dist/{managed-transforms-2XyQ14s3.mjs → managed-transforms-Cm_KVCMB.mjs} +1 -1
  110. package/dist/{matches-CIaCrdrs.mjs → matches-InA1hwII.mjs} +1 -1
  111. package/dist/{mcp-D2afM8MD.mjs → mcp-mJ7bekNJ.mjs} +1 -1
  112. package/dist/mesh-BK4S1Ezy.mjs +4 -0
  113. package/dist/{moq-BBQVNGo1.mjs → moq-qmuVPAO0.mjs} +1 -1
  114. package/dist/{mtls-certificates-C5j0Gn65.mjs → mtls-certificates-CU4OAAXY.mjs} +1 -1
  115. package/dist/{network-CmuJqtFJ.mjs → network-D74cSy3t.mjs} +1 -1
  116. package/dist/{network-interconnects-BlajBQqs.mjs → network-interconnects-BJ0Nc48J.mjs} +1 -1
  117. package/dist/{oauth-BjHjJtnn.mjs → oauth-B0ETkNcX.mjs} +2 -2
  118. package/dist/{oauth-clients-BSthfZP-.mjs → oauth-clients-Br-smLxQ.mjs} +1 -1
  119. package/dist/{oauth-scopes-ByUp5bLU.mjs → oauth-scopes-D5bF11ju.mjs} +1 -1
  120. package/dist/observability-BWE0Gg3V.mjs +4 -0
  121. package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-R-qesf18.mjs} +1 -1
  122. package/dist/{organization-DQIfNVCT.mjs → organization-NX7yCZrq.mjs} +1 -1
  123. package/dist/{organizations-L_ycAy6r.mjs → organizations-DLhiRt8g.mjs} +1 -1
  124. package/dist/{origin-ca-certificates-opIcs3_Q.mjs → origin-ca-certificates-Ff4McZRQ.mjs} +1 -1
  125. package/dist/{origin-post-quantum-encryption-TSMXzoEL.mjs → origin-post-quantum-encryption-UuTr4_SW.mjs} +1 -1
  126. package/dist/{origin-tls-client-auth-5CtcPUR6.mjs → origin-tls-client-auth-DOJ1zlH3.mjs} +1 -1
  127. package/dist/{output-DgW1hQGX.mjs → output-DrpYYfnB.mjs} +1 -1
  128. package/dist/{page-rules-DPd1Y3IL.mjs → page-rules-BSz1gO-_.mjs} +1 -1
  129. package/dist/{pages-CskAn5mR.mjs → pages-DVDogxPs.mjs} +4 -4
  130. package/dist/{pay-per-crawl-BMa_V40s.mjs → pay-per-crawl-BrLXK7gT.mjs} +1 -1
  131. package/dist/{pipelines-BbJjj1ZQ.mjs → pipelines-BszRk4sM.mjs} +2 -2
  132. package/dist/{precursor-DgRWBN9_.mjs → precursor-BPNjQr76.mjs} +1 -1
  133. package/dist/progress-CsHIt3Tp.mjs +2 -0
  134. package/dist/{prompt-DM4z101s.mjs → prompt-DdegNPpg.mjs} +1 -1
  135. package/dist/{queries-DrqcK0ZX.mjs → queries-JL1H1Biz.mjs} +1 -1
  136. package/dist/{queues-CutvMZcc.mjs → queues-DpkYdRUE.mjs} +1 -1
  137. package/dist/{r2-sFI62vhq.mjs → r2-CKozthw_.mjs} +4 -4
  138. package/dist/{r2-data-catalog-3vzU6FE1.mjs → r2-data-catalog-Du7hN9jA.mjs} +1 -1
  139. package/dist/radar-C-92vggG.mjs +2 -0
  140. package/dist/{rate-limits-HRZ8zMSl.mjs → rate-limits-yBF3qoYD.mjs} +1 -1
  141. package/dist/{raw-fetch-25gXED6c.mjs → raw-fetch-CteyTOM2.mjs} +1 -1
  142. package/dist/realtimekit-CIP7lP-a.mjs +7 -0
  143. package/dist/{registrar-C0EsXf83.mjs → registrar-DKKN0M29.mjs} +3 -3
  144. package/dist/{registrar-sandbox-CR9Rr7jV.mjs → registrar-sandbox-DiXg8p_1.mjs} +3 -3
  145. package/dist/{registry-CJvn75Bq.mjs → registry-Bck_zFkz.mjs} +1 -1
  146. package/dist/{reporting-BB6sqe6r.mjs → reporting-fg_GKXe1.mjs} +1 -1
  147. package/dist/{request-tracers-BrsM3zXZ.mjs → request-tracers-CkMya96z.mjs} +1 -1
  148. package/dist/{resource-sharing-CusU3kiy.mjs → resource-sharing-D1pSDvtf.mjs} +1 -1
  149. package/dist/{resource-tagging-wXAcblmz.mjs → resource-tagging-z48JGHCq.mjs} +1 -1
  150. package/dist/{rules-C2BxykEe.mjs → rules-BTmNjDN-.mjs} +1 -1
  151. package/dist/rulesets-CsoSM-17.mjs +5 -0
  152. package/dist/{rum-Dyno5zj3.mjs → rum-DB4iO2q5.mjs} +1 -1
  153. package/dist/{schema-BeXPWeK9.mjs → schema-B34Q9tLF.mjs} +1 -1
  154. package/dist/{schema-flags-C1BRprT2.mjs → schema-flags-iGoOriJt.mjs} +1 -1
  155. package/dist/{scim-Bb2xHpIz.mjs → scim-CcSyfKCH.mjs} +1 -1
  156. package/dist/sdk-ZctLa5jW.mjs +3 -0
  157. package/dist/{secrets-store-BMhjbceW.mjs → secrets-store-DFmvtphu.mjs} +1 -1
  158. package/dist/security-center-DFKeHq5c.mjs +2 -0
  159. package/dist/{security-txt-Bh_2gymk.mjs → security-txt-DqnFpjMI.mjs} +1 -1
  160. package/dist/{session-Br-q_UIW.mjs → session-D6KHthHf.mjs} +1 -1
  161. package/dist/{share-DfTpOxhk.mjs → share-BuwYUzOL.mjs} +1 -1
  162. package/dist/{shared-BNjZc02w.mjs → shared-VppSAQf4.mjs} +1 -1
  163. package/dist/{smart-shield-rHn-Lckq.mjs → smart-shield-D6X8L7p8.mjs} +2 -2
  164. package/dist/{snippets-nSLwH8uJ.mjs → snippets-DIpc9pb_.mjs} +1 -1
  165. package/dist/{spawn-Bj8QRFJ5.mjs → spawn-O1RS01vr.mjs} +2 -2
  166. package/dist/{spectrum-DuhSUTZI.mjs → spectrum-b7N1ZRAm.mjs} +1 -1
  167. package/dist/{speed-Dgby_e1J.mjs → speed-cw31yFva.mjs} +1 -1
  168. package/dist/src-D_HETJNy.mjs +108 -0
  169. package/dist/{ssl-BsxTHasY.mjs → ssl-CsEhRVTO.mjs} +1 -1
  170. package/dist/{state-C1m9nwUm.mjs → state-Bb5Cbc_L.mjs} +1 -1
  171. package/dist/{stream-CkEOX5Ko.mjs → stream-DFOao6Gu.mjs} +3 -3
  172. package/dist/{submit-BjdywxTq.mjs → submit--xTzyNPy.mjs} +1 -1
  173. package/dist/{tags-CFAw_Sce.mjs → tags-efICDkah.mjs} +1 -1
  174. package/dist/{tenant-C66iOy5O.mjs → tenant-CerHuToJ.mjs} +1 -1
  175. package/dist/{tenant-custom-nameservers-CyJZ_AB0.mjs → tenant-custom-nameservers-C4otMBm2.mjs} +1 -1
  176. package/dist/{tools-D2Xxfkrc.mjs → tools-BHfBOZOU.mjs} +1 -1
  177. package/dist/{triggers-Dv22ZXM4.mjs → triggers-BEsiiKAf.mjs} +1 -1
  178. package/dist/{tunnel-BatkLdds.mjs → tunnel-DkMiNtVY.mjs} +1 -1
  179. package/dist/{tunnels-CstoXOoq.mjs → tunnels-D0J8lJoI.mjs} +1 -1
  180. package/dist/{turnstile-IoRtama4.mjs → turnstile-CFmtY5bn.mjs} +2 -2
  181. package/dist/{ui-DjQ4AQww.mjs → ui-DE8CNn6c.mjs} +1 -1
  182. package/dist/{url-info-Hjhwr2la.mjs → url-info-DBCeRWwb.mjs} +1 -1
  183. package/dist/{url-normalization-C2BP_Kl0.mjs → url-normalization-ClfFiruK.mjs} +1 -1
  184. package/dist/{url-scanner-DmYVTdAE.mjs → url-scanner-CNyvg65L.mjs} +1 -1
  185. package/dist/{user-CVHm-cnB.mjs → user-bifVEQq5.mjs} +2 -2
  186. package/dist/{values-Cmlw5wGZ.mjs → values-OxkdP1tV.mjs} +1 -1
  187. package/dist/{vectorize-BQtIqiNO.mjs → vectorize-CVKu7lEt.mjs} +1 -1
  188. package/dist/{versions-CU6Av1vh.mjs → versions-BVL-Ludh.mjs} +1 -1
  189. package/dist/waiting-rooms-CmRAl51T.mjs +11 -0
  190. package/dist/{web-assets-DmSKaxzf.mjs → web-assets-C2s9kzWf.mjs} +1 -1
  191. package/dist/{web3-DVv4jNul.mjs → web3-y_cY91V_.mjs} +1 -1
  192. package/dist/{workers-builds-DgrejrUc.mjs → workers-builds-B55-oXOa.mjs} +4 -4
  193. package/dist/{workers-D8czeT64.mjs → workers-jDcq14GH.mjs} +6 -6
  194. package/dist/{workflows-BOi5MTEN.mjs → workflows-B-kGHxFu.mjs} +2 -2
  195. package/dist/{zaraz-CGSSFJng.mjs → zaraz-27zwjLvv.mjs} +1 -1
  196. package/dist/zero-trust-DV3sIOvu.mjs +92 -0
  197. package/dist/{zone-Bx5ElO9U.mjs → zone-BJix2KQ9.mjs} +1 -1
  198. package/dist/{zones-_SnlZMiM.mjs → zones-Bkj5i92c.mjs} +1 -1
  199. package/package.json +2 -2
  200. package/dist/account-tags-CKRh1jra.mjs +0 -9
  201. package/dist/accounts-2pGhN4s8.mjs +0 -28
  202. package/dist/ai-search-2xP8FP_W.mjs +0 -7
  203. package/dist/analytics-UQrIx99t.mjs +0 -3
  204. package/dist/argo-Br60zF3y.mjs +0 -2
  205. package/dist/artifacts-D8HMRQmb.mjs +0 -4
  206. package/dist/browser-run-C5pYOwtf.mjs +0 -4
  207. package/dist/cloudforce-one-Cp4bQmrG.mjs +0 -30
  208. package/dist/connector-interrupts-BR47snkh.mjs +0 -2
  209. package/dist/custom-csrs-D0zBkQT5.mjs +0 -4
  210. package/dist/custom-nameservers-G2MWpRwY.mjs +0 -3
  211. package/dist/custom-pages-BINNZTds.mjs +0 -4
  212. package/dist/email-CGOC_evd.mjs +0 -2
  213. package/dist/email-routing-CRvIUSFm.mjs +0 -6
  214. package/dist/email-sending-BwRN8PMW.mjs +0 -7
  215. package/dist/filters-DczM8qpH.mjs +0 -4
  216. package/dist/firewall-BMiETRmM.mjs +0 -11
  217. package/dist/load-balancers-Ct5cyyF9.mjs +0 -7
  218. package/dist/logexplorer-BhsAWxCr.mjs +0 -24
  219. package/dist/logpush-CFQBi88z.mjs +0 -5
  220. package/dist/magic-network-monitoring-CY3CHSpX.mjs +0 -4
  221. package/dist/media-CnxgOViL.mjs +0 -2
  222. package/dist/mesh-DLNLi3UT.mjs +0 -4
  223. package/dist/observability-B5p3iwrq.mjs +0 -4
  224. package/dist/progress-C-oFUtvC.mjs +0 -2
  225. package/dist/radar-Cu9rsTw_.mjs +0 -2
  226. package/dist/realtimekit-msnGHBbf.mjs +0 -7
  227. package/dist/rulesets-BHvhAeG_.mjs +0 -8
  228. package/dist/sdk-m4xeaua4.mjs +0 -3
  229. package/dist/security-center-DRC4Mf3R.mjs +0 -2
  230. package/dist/src-CgAVPA4I.mjs +0 -108
  231. package/dist/waiting-rooms-ku9UsAr9.mjs +0 -11
  232. package/dist/zero-trust-BmA0VkgF.mjs +0 -102
  233. package/dist/zone-tags-izd3WWmy.mjs +0 -9
  234. /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
  235. /package/dist/{alerts-B85uj2Vx.mjs → alerts-CRmjqOZi.mjs} +0 -0
  236. /package/dist/{autorag-Do9l_LyY.mjs → autorag-BD7cu5NU.mjs} +0 -0
  237. /package/dist/{body-parser-CYD7PKFC.mjs → body-parser-C-c9gfH1.mjs} +0 -0
  238. /package/dist/{brands-DateHCdd.mjs → brands-BhALBkX2.mjs} +0 -0
  239. /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-B7bSMYLe.mjs} +0 -0
  240. /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
  241. /package/dist/{clear-CB2kgcEB.mjs → clear-BgF8No7D.mjs} +0 -0
  242. /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-BsTty22w.mjs} +0 -0
  243. /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C50W5GhA.mjs} +0 -0
  244. /package/dist/{health-buY5f5pp.mjs → health-BFNZqiAm.mjs} +0 -0
  245. /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-Bav2M9F-.mjs} +0 -0
  246. /package/dist/{internal-CwyoJUHh.mjs → internal-BTeSewwB.mjs} +0 -0
  247. /package/dist/{live-wEpA5V_n.mjs → live-Dkiyu30_.mjs} +0 -0
  248. /package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BwQqexwo-CNW_dPly.mjs} +0 -0
  249. /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-Dz-Wv1T0.mjs} +0 -0
  250. /package/dist/{ready-CBSCPiHE.mjs → ready-TKOkKeRg.mjs} +0 -0
  251. /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-3Asm6eIi.mjs} +0 -0
  252. /package/dist/{refute-u7ZPQJZy.mjs → refute-BVz9nMyd.mjs} +0 -0
  253. /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-CeBbH6Pq.mjs} +0 -0
  254. /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-ZteA-PUV.mjs} +0 -0
  255. /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-DWDSyzQ7.mjs} +0 -0
  256. /package/dist/{search-D9WDwnV4.mjs → search-DGNc37HK.mjs} +0 -0
  257. /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-B5Qpn2mn.mjs} +0 -0
  258. /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-FjUolE6A.mjs} +0 -0
  259. /package/dist/{theme-BePJemMn.mjs → theme-CeVf-5qG.mjs} +0 -0
  260. /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-NHJj1HGq.mjs} +0 -0
  261. /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CniKVHIp.mjs} +0 -0
  262. /package/dist/{verify-2yi0H93r.mjs → verify-DS1PWAJe.mjs} +0 -0
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{r as t}from"./auth-C6MhC9EZ.mjs";import{t as n}from"./output-DgW1hQGX.mjs";import{n as r,t as i}from"./progress-C-oFUtvC.mjs";import{n as a,t as o}from"./body-parser-CYD7PKFC.mjs";import{n as s}from"./input-validation-BBKJRoRB.mjs";import{a as c,n as l}from"./prompt-DM4z101s.mjs";function u(e){return e.option(`certificate`,{type:`string`,description:`The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Upload a root CA certificate to the Custom Origin Trust Store for a Zone. Only root CA certificates are accepted.`,builder:u,handler:async l=>{if(l.dryRun){r({command:`cf acm custom-trust-store create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/acm/custom_trust_store`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({certificate:s(l.certificate,`certificate`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Creating`,async()=>u.acm.customTrustStore.create({...e,zone_id:d})),{successLabel:`Created`});return}l.certificate===void 0&&(l.certificate=await c(`certificate`,`The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported.`));let f=o({certificate:s(l.certificate,`certificate`,`text`)});n(await i(`Creating`,async()=>u.acm.customTrustStore.create({...f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`custom-origin-trust-store-id`,{type:`string`,description:`Identifier.`,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 p={command:`delete <custom-origin-trust-store-id>`,describe:`Removes a root CA certificate from the custom origin trust store. Origins using certificates signed by this CA will no longer be trusted.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf acm custom-trust-store delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/acm/custom_trust_store/${a[`custom-origin-trust-store-id`]==null?`<custom-origin-trust-store-id>`:encodeURIComponent(String(a[`custom-origin-trust-store-id`]))}`,pathParams:{"custom-origin-trust-store-id":String(a[`custom-origin-trust-store-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await l({force:!!a.force})){process.stderr.write(`Aborted.
2
+ import{h as e}from"./oauth-B0ETkNcX.mjs";import{r as t}from"./auth-MQEamPN9.mjs";import{t as n}from"./output-DrpYYfnB.mjs";import{n as r,t as i}from"./progress-CsHIt3Tp.mjs";import{n as a,t as o}from"./body-parser-C-c9gfH1.mjs";import{n as s}from"./input-validation-Bav2M9F-.mjs";import{a as c,n as l}from"./prompt-DdegNPpg.mjs";function u(e){return e.option(`certificate`,{type:`string`,description:`The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const d={command:`create`,describe:`Upload a root CA certificate to the Custom Origin Trust Store for a Zone. Only root CA certificates are accepted.`,builder:u,handler:async l=>{if(l.dryRun){r({command:`cf acm custom-trust-store create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${l.zone??l.zoneId??`<zone>`}/acm/custom_trust_store`,pathParams:{"zone-id":String(l.zone??l[`zone-id`]??``)},bodyKind:`json`,body:l.body===void 0?o({certificate:s(l.certificate,`certificate`,`text`)}):a(l.body)});return}let u=await t(l),d=await e({zone:l.zone},u,{quiet:l.quiet});if(l.zoneId=d,l.body){let e=a(l.body);n(await i(`Creating`,async()=>u.acm.customTrustStore.create({...e,zone_id:d})),{successLabel:`Created`});return}l.certificate===void 0&&(l.certificate=await c(`certificate`,`The root CA certificate in PEM format. Only root CA certificates are accepted; intermediate and leaf certificates are not supported.`));let f=o({certificate:s(l.certificate,`certificate`,`text`)});n(await i(`Creating`,async()=>u.acm.customTrustStore.create({...f,zone_id:d})),{successLabel:`Created`})}};function f(e){return e.positional(`custom-origin-trust-store-id`,{type:`string`,description:`Identifier.`,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 p={command:`delete <custom-origin-trust-store-id>`,describe:`Removes a root CA certificate from the custom origin trust store. Origins using certificates signed by this CA will no longer be trusted.`,builder:f,handler:async a=>{if(a.dryRun){r({command:`cf acm custom-trust-store delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/acm/custom_trust_store/${a[`custom-origin-trust-store-id`]==null?`<custom-origin-trust-store-id>`:encodeURIComponent(String(a[`custom-origin-trust-store-id`]))}`,pathParams:{"custom-origin-trust-store-id":String(a[`custom-origin-trust-store-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});if(a.zoneId=s,!await l({force:!!a.force})){process.stderr.write(`Aborted.
3
3
  `);return}n(await i(`Deleting`,async()=>o.acm.customTrustStore.delete({zone_id:s,custom_origin_trust_store_id:a[`custom-origin-trust-store-id`]})),{successLabel:`Deleted`})}};function m(e){return e.positional(`custom-origin-trust-store-id`,{type:`string`,description:`Identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const h={command:`get <custom-origin-trust-store-id>`,describe:`Retrieves details about a specific root CA certificate in the custom origin trust store, including expiration and subject information.`,builder:m,handler:async a=>{if(a.dryRun){r({command:`cf acm custom-trust-store get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/acm/custom_trust_store/${a[`custom-origin-trust-store-id`]==null?`<custom-origin-trust-store-id>`:encodeURIComponent(String(a[`custom-origin-trust-store-id`]))}`,pathParams:{"custom-origin-trust-store-id":String(a[`custom-origin-trust-store-id`]??``),"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.acm.customTrustStore.get({zone_id:s,custom_origin_trust_store_id:a[`custom-origin-trust-store-id`]})),{successLabel:`Loaded`})}};function g(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of records per page.`}).option(`limit`,{type:`number`,description:`Limit to the number of records returned.`}).option(`offset`,{type:`number`,description:`Offset the results.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`list`,describe:`Get Custom Origin Trust Store for a Zone.`,builder:g,handler:async a=>{let o={page:a.page,per_page:a[`per-page`],limit:a.limit,offset:a.offset};if(a.dryRun){r({command:`cf acm custom-trust-store list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/acm/custom_trust_store`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await t(a),c=await e({zone:a.zone},s,{quiet:a.quiet});a.zoneId=c,n(await i(`Loading`,async()=>s.acm.customTrustStore.list({zone_id:c,...o})),{successLabel:`Loaded`})}},v={command:`custom-trust-store`,describe:`Operations for custom-trust-store`,builder:e=>e.command(d).command(p).command(h).command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`certificate-authority`,{type:`string`,description:`The Certificate Authority that Total TLS certificates will be issued through.`,choices:[`google`,`lets_encrypt`,`ssl_com`]}).option(`enabled`,{type:`boolean`,description:`If enabled, Total TLS will order a hostname specific TLS certificate for any proxied A, AAAA, or CNAME record in your zone.`}).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:`edit`,describe:`Set Total TLS Settings or disable the feature for a Zone.`,builder:y,handler:async c=>{if(c.dryRun){r({command:`cf acm total-tls edit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${c.zone??c.zoneId??`<zone>`}/acm/total_tls`,pathParams:{"zone-id":String(c.zone??c[`zone-id`]??``)},bodyKind:`json`,body:c.body===void 0?o({certificate_authority:s(c[`certificate-authority`],`certificate-authority`,`text`),enabled:c.enabled}):a(c.body)});return}let l=await t(c),u=await e({zone:c.zone},l,{quiet:c.quiet});if(c.zoneId=u,c.body){let e=a(c.body);n(await i(`Creating`,async()=>l.acm.totalTls.edit({...e,zone_id:u})),{successLabel:`Created`});return}if(c.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let d=o({certificate_authority:s(c[`certificate-authority`],`certificate-authority`,`text`),enabled:c.enabled});n(await i(`Creating`,async()=>l.acm.totalTls.edit({...d,zone_id:u})),{successLabel:`Created`})}};function x(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get`,describe:`Get Total TLS Settings for a Zone.`,builder:x,handler:async a=>{if(a.dryRun){r({command:`cf acm total-tls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/acm/total_tls`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.acm.totalTls.get({zone_id:s})),{successLabel:`Loaded`})}},C={command:`total-tls`,describe:`Operations for total-tls`,builder:e=>e.command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},w={command:`acm`,describe:`acm`,builder:e=>e.command(v).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{w as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n,h as r}from"./oauth-BjHjJtnn.mjs";import{a as i,r as a}from"./auth-C6MhC9EZ.mjs";import{t as o}from"./output-DgW1hQGX.mjs";import{n as s,t as c}from"./progress-C-oFUtvC.mjs";import{n as l,t as u}from"./body-parser-CYD7PKFC.mjs";import{n as d,t as f}from"./input-validation-BBKJRoRB.mjs";import{a as p,n as m}from"./prompt-DM4z101s.mjs";import{n as ee,t as te}from"./raw-fetch-25gXED6c.mjs";function h(e){return e.positional(`account-id-2`,{type:`string`,description:`Identifier of a Cloudflare account.`,demandOption:!0}).option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,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 g={command:`delete <account-id-2>`,describe:`Remove an account as a member of a particular address map.`,builder:h,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps accounts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}/accounts/${r[`account-id-2`]==null?`<account-id-2>`:encodeURIComponent(String(r[`account-id-2`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``),"account-id-2":String(r[`account-id-2`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
2
+ import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n,h as r}from"./oauth-B0ETkNcX.mjs";import{a as i,r as a}from"./auth-MQEamPN9.mjs";import{t as o}from"./output-DrpYYfnB.mjs";import{n as s,t as c}from"./progress-CsHIt3Tp.mjs";import{n as l,t as u}from"./body-parser-C-c9gfH1.mjs";import{n as d,t as f}from"./input-validation-Bav2M9F-.mjs";import{a as p,n as m}from"./prompt-DdegNPpg.mjs";import{n as ee,t as te}from"./raw-fetch-CteyTOM2.mjs";function h(e){return e.positional(`account-id-2`,{type:`string`,description:`Identifier of a Cloudflare account.`,demandOption:!0}).option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,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 g={command:`delete <account-id-2>`,describe:`Remove an account as a member of a particular address map.`,builder:h,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps accounts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}/accounts/${r[`account-id-2`]==null?`<account-id-2>`:encodeURIComponent(String(r[`account-id-2`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``),"account-id-2":String(r[`account-id-2`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
3
3
  `);return}o(await c(`Deleting`,async()=>i.addressing.addressMaps.accounts.delete({account_id:l,address_map_id:r[`address-map-id`],account_id_2:r[`account-id-2`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`account-id-2`,{type:`string`,description:`Identifier of a Cloudflare account.`,demandOption:!0}).option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`update <account-id-2>`,describe:`Add an account as a member of a particular address map.`,builder:_,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps accounts update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}/accounts/${r[`account-id-2`]==null?`<account-id-2>`:encodeURIComponent(String(r[`account-id-2`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``),"account-id-2":String(r[`account-id-2`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();r.accountId=l,o(await c(`Updating`,async()=>i.addressing.addressMaps.accounts.update({account_id:l,address_map_id:r[`address-map-id`],account_id_2:r[`account-id-2`]})),{successLabel:`Updated`})}},y={command:`accounts`,describe:`Operations for address-maps.accounts`,builder:e=>e.command(g).command(v).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function b(e){return e.option(`description`,{type:`string`,description:`An optional description field which may be used to describe the types of IPs or zones on the map.`}).option(`enabled`,{type:`boolean`,description:`Whether the Address Map is enabled or not. Cloudflare's DNS will not respond with IP addresses on an Address Map until the map is enabled.`,default:!1}).option(`ips`,{type:`string`,array:!0,description:`The ips 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 x={command:`create`,describe:`Create a new address map under the account.`,builder:b,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({description:d(r.description,`description`,`text`),enabled:r.enabled,ips:r.ips}):l(r.body)});return}let i=await a(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=l(r.body);o(await c(`Creating`,async()=>i.addressing.addressMaps.create({...e,account_id:f})),{successLabel:`Created`});return}let p=u({description:d(r.description,`description`,`text`),enabled:r.enabled,ips:r.ips});o(await c(`Creating`,async()=>i.addressing.addressMaps.create({...p,account_id:f})),{successLabel:`Created`})}};function S(e){return e.positional(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <address-map-id>`,describe:`Delete a particular address map owned by the account. An Address Map must be disabled before it can be deleted.`,builder:S,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
4
4
  `);return}o(await c(`Deleting`,async()=>i.addressing.addressMaps.delete({account_id:l,address_map_id:r[`address-map-id`]})),{successLabel:`Deleted`})}};function w(e){return e.positional(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`default-sni`,{type:`string`,description:`If you have legacy TLS clients which do not send the TLS server name indicator, then you can specify one default SNI on the map. If Cloudflare receives a TLS handshake from a client without an SNI, it will respond with the default SNI on those IPs. The default SNI can be any valid zone or subdomain owned by the account.`}).option(`description`,{type:`string`,description:`An optional description field which may be used to describe the types of IPs or zones on the map.`}).option(`enabled`,{type:`boolean`,description:`Whether the Address Map is enabled or not. Cloudflare's DNS will not respond with IP addresses on an Address Map until the map is enabled.`}).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 T={command:`edit <address-map-id>`,describe:`Modify properties of an address map owned by the account.`,builder:w,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({default_sni:d(r[`default-sni`],`default-sni`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled}):l(r.body)});return}let i=await a(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=l(r.body);o(await c(`Updating`,async()=>i.addressing.addressMaps.edit({...e,account_id:f,address_map_id:r[`address-map-id`]})),{successLabel:`Updated`});return}let p=u({default_sni:d(r[`default-sni`],`default-sni`,`text`),description:d(r.description,`description`,`text`),enabled:r.enabled});o(await c(`Updating`,async()=>i.addressing.addressMaps.edit({...p,account_id:f,address_map_id:r[`address-map-id`]})),{successLabel:`Updated`})}};function E(e){return e.positional(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <address-map-id>`,describe:`Show a particular address map owned by the account.`,builder:E,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}`,pathParams:{"address-map-id":String(r[`address-map-id`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();r.accountId=l,o(await c(`Loading`,async()=>i.addressing.addressMaps.get({account_id:l,address_map_id:r[`address-map-id`]})),{successLabel:`Loaded`})}};function O(e){return e.positional(`ip-address`,{type:`string`,description:`An IPv4 or IPv6 address.`,demandOption:!0}).option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const k={command:`delete <ip-address>`,describe:`Remove an IP from a particular address map.`,builder:O,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps ips delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}/ips/${r[`ip-address`]==null?`<ip-address>`:encodeURIComponent(String(r[`ip-address`]))}`,pathParams:{"ip-address":String(r[`ip-address`]??``),"address-map-id":String(r[`address-map-id`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
5
5
  `);return}o(await c(`Deleting`,async()=>i.addressing.addressMaps.ips.delete({account_id:l,address_map_id:r[`address-map-id`],ip_address:r[`ip-address`]})),{successLabel:`Deleted`})}};function A(e){return e.positional(`ip-address`,{type:`string`,description:`An IPv4 or IPv6 address.`,demandOption:!0}).option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`update <ip-address>`,describe:`Add an IP from a prefix owned by the account to a particular address map.`,builder:A,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps ips update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${r[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(r[`address-map-id`]))}/ips/${r[`ip-address`]==null?`<ip-address>`:encodeURIComponent(String(r[`ip-address`]))}`,pathParams:{"ip-address":String(r[`ip-address`]??``),"address-map-id":String(r[`address-map-id`]??``)},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();r.accountId=l,o(await c(`Updating`,async()=>i.addressing.addressMaps.ips.update({account_id:l,address_map_id:r[`address-map-id`],ip_address:r[`ip-address`]})),{successLabel:`Updated`})}},M={command:`ips`,describe:`Operations for address-maps.ips`,builder:e=>e.command(k).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list`,describe:`List all address maps owned by the account.`,builder:N,handler:async r=>{if(r.dryRun){s({command:`cf addressing address-maps list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps`,pathParams:{},bodyKind:`none`});return}let i=await a(r),l=r.local?e:await t();r.accountId=l,o(await c(`Loading`,async()=>i.addressing.addressMaps.list({account_id:l})),{successLabel:`Loaded`})}};function F(e){return e.option(`address-map-id`,{type:`string`,description:`Identifier of an Address Map.`,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 I={command:`delete`,describe:`Remove a zone as a member of a particular address map.`,builder:F,handler:async i=>{if(i.dryRun){s({command:`cf addressing address-maps zones delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/addressing/address_maps/${i[`address-map-id`]==null?`<address-map-id>`:encodeURIComponent(String(i[`address-map-id`]))}/zones/${i.zone??i.zoneId??`<zone>`}`,pathParams:{"zone-id":String(i.zone??i[`zone-id`]??``),"address-map-id":String(i[`address-map-id`]??``)},bodyKind:`none`});return}let l=await a(i),u=i.local?e:await t();i.accountId=u;let d=await r({zone:i.zone},l,{quiet:i.quiet});if(i.zoneId=d,!await m({force:!!i.force})){process.stderr.write(`Aborted.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./output-DgW1hQGX.mjs";import{n as t}from"./metadata-8AkOftcB.mjs";function n(e){return typeof e==`object`&&!!e&&`version`in e&&`products`in e&&`universal`in e&&typeof e.version==`string`&&typeof e.universal==`string`&&typeof e.products==`object`}const r={command:`agent-context [product]`,describe:`Output agent context and skill files`,builder:e=>e.positional(`product`,{describe:`Product name (e.g., d1, dns, zones)`,type:`string`}).option(`list`,{type:`boolean`,describe:`List available products`,default:!1}),handler:async r=>{let i=t(import.meta.url,`agent-context.json`,n);if(i||(console.error("Error: Could not load agent context. Run `pnpm generate` first."),process.exit(1)),r.list){e(Object.keys(i.products));return}if(r.product){let e=i.products[r.product];if(!e){let e=Object.keys(i.products).join(`, `);console.error(`Product "${r.product}" not found. Available: ${e}`),process.exit(1)}console.log(i.universal+`
2
+ import{t as e}from"./output-DrpYYfnB.mjs";import{n as t}from"./metadata-8AkOftcB.mjs";function n(e){return typeof e==`object`&&!!e&&`version`in e&&`products`in e&&`universal`in e&&typeof e.version==`string`&&typeof e.universal==`string`&&typeof e.products==`object`}const r={command:`agent-context [product]`,describe:`Output agent context and skill files`,builder:e=>e.positional(`product`,{describe:`Product name (e.g., d1, dns, zones)`,type:`string`}).option(`list`,{type:`boolean`,describe:`List available products`,default:!1}),handler:async r=>{let i=t(import.meta.url,`agent-context.json`,n);if(i||(console.error("Error: Could not load agent context. Run `pnpm generate` first."),process.exit(1)),r.list){e(Object.keys(i.products));return}if(r.product){let e=i.products[r.product];if(!e){let e=Object.keys(i.products).join(`, `);console.error(`Product "${r.product}" not found. Available: ${e}`),process.exit(1)}console.log(i.universal+`
3
3
 
4
4
  `+e);return}console.log(i.universal+`
5
5
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{r}from"./auth-C6MhC9EZ.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-C-oFUtvC.mjs";import{n as s,t as c}from"./body-parser-CYD7PKFC.mjs";import{n as l}from"./input-validation-BBKJRoRB.mjs";import{a as u,n as d}from"./prompt-DM4z101s.mjs";import{t as f}from"./cli-types-BWdZbsFE.mjs";function p(e){return e.option(`name`,{type:`string`,description:`Namespace name.`}).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 m={command:`create-namespace`,describe:`Creates a new memory namespace owned by the account.`,builder:p,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory create-namespace`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`Namespace name.`));let m=c({name:l(d.name,`name`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,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 g={command:`delete-memory <memory-id>`,describe:`Deletes a memory by ID. Removes the memory and any source messages linked to it. Returns the deleted memory.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-memory`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the memory and any source messages linked to it.`})){process.stderr.write(`Aborted.
2
+ import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{r}from"./auth-MQEamPN9.mjs";import{t as i}from"./output-DrpYYfnB.mjs";import{n as a,t as o}from"./progress-CsHIt3Tp.mjs";import{n as s,t as c}from"./body-parser-C-c9gfH1.mjs";import{n as l}from"./input-validation-Bav2M9F-.mjs";import{a as u,n as d}from"./prompt-DdegNPpg.mjs";import{t as f}from"./cli-types-BsTty22w.mjs";function p(e){return e.option(`name`,{type:`string`,description:`Namespace name.`}).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 m={command:`create-namespace`,describe:`Creates a new memory namespace owned by the account.`,builder:p,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory create-namespace`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`Namespace name.`));let m=c({name:l(d.name,`name`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,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 g={command:`delete-memory <memory-id>`,describe:`Deletes a memory by ID. Removes the memory and any source messages linked to it. Returns the deleted memory.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-memory`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the memory and any source messages linked to it.`})){process.stderr.write(`Aborted.
3
3
  `);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteMemory({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],memory_id:s[`memory-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,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 v={command:`delete-namespace <namespace-name>`,describe:`Deletes a namespace.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-namespace`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the namespace along with all memory profiles, memories, and sessions it contains.`})){process.stderr.write(`Aborted.
4
4
  `);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteNamespace({account_id:l,namespace_name:s[`namespace-name`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,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 b={command:`delete-profile <profile-name>`,describe:`Marks a profile for deletion.`,builder:y,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-profile`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the profile along with all of its memories and messages.`})){process.stderr.write(`Aborted.
5
5
  `);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteProfile({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`session-id`,{type:`string`,description:`Session identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,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 S={command:`delete-session <session-id>`,describe:`Marks all memories and messages in a profile that are tagged with the given session ID for deletion.`,builder:x,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-session`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/sessions/${s[`session-id`]==null?`<session-id>`:encodeURIComponent(String(s[`session-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"session-id":String(s[`session-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes all memories and messages tagged with this session ID.`})){process.stderr.write(`Aborted.
6
- `);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteSession({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],session_id:s[`session-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get-memory <memory-id>`,describe:`Retrieves a memory by ID.`,builder:C,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-memory`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getMemory({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],memory_id:s[`memory-id`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get-namespace <namespace-name>`,describe:`Gets a namespace by name.`,builder:T,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-namespace`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getNamespace({account_id:l,namespace_name:s[`namespace-name`]})),{successLabel:`Loaded`})}};function D(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).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 O={command:`ingest <profile-name>`,describe:`Processes a conversation and extracts structured memories from it. Agent Memory identifies facts, events, instructions, and tasks automatically.`,builder:D,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory ingest`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/ingest`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.ingest({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.ingest({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}};function k(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`cursor`,{type:`string`,description:`Continuation cursor for paginated results.`}).option(`session-id`,{type:`string`,description:`Session identifier for filtering.`}).option(`type`,{type:`string`,description:`Memory type for filtering.`,choices:[`fact`,`event`,`instruction`,`task`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-memories <profile-name>`,describe:`List memories stored in a profile.`,builder:f(k),handler:async s=>{let c={per_page:s[`per-page`],cursor:s.cursor,session_id:s[`session-id`],type:s.type};if(s.dryRun){a({command:`cf agent-memory list-memories`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listMemories({account_id:u,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],...c})),{successLabel:`Loaded`})}};function j(e){return e.option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`order`,{type:`string`,description:`Order`,choices:[`id`,`name`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list-namespaces`,describe:`Lists all namespaces for the given account. Results are paginated.`,builder:f(j),handler:async s=>{let c={per_page:s[`per-page`],order:s.order,direction:s.direction,cursor:s.cursor};if(s.dryRun){a({command:`cf agent-memory list-namespaces`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listNamespaces({account_id:u,...c})),{successLabel:`Loaded`})}};function N(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`query`,{type:`string`,description:`Natural-language query to match against stored memories.`}).option(`reference-date`,{type:`string`,description:`Temporal anchor for relative date references in the query.`}).option(`response-length`,{type:`string`,description:`Verbosity of the synthesized answer. Defaults to 'medium'.`,choices:[`short`,`medium`,`long`]}).option(`thinking-level`,{type:`string`,description:`Recall intensity / search depth. Defaults to 'low'.`,choices:[`low`,`medium`,`high`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`recall <profile-name>`,describe:`Retrieves memories relevant to the query and returns a synthesized answer.`,builder:N,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory recall`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/recall`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.recall({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.query===void 0&&(d.query=await u(`query`,`Natural-language query to match against stored memories.`));let m=c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.recall({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function F(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`content`,{type:`string`,description:`Raw memory content to store.`}).option(`session-id`,{type:`string`,description:`Session identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`remember <profile-name>`,describe:`Stores a single memory explicitly.`,builder:F,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory remember`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/remember`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.remember({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.content===void 0&&(d.content=await u(`content`,`Raw memory content to store.`));let m=c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.remember({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function L(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).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 R={command:`summary <profile-name>`,describe:`Generates a structured Markdown summary of everything stored in a memory profile.`,builder:L,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/summary`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.summary({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.summary({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}},z={command:`agent-memory`,describe:`agent-memory`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
6
+ `);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteSession({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],session_id:s[`session-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get-memory <memory-id>`,describe:`Retrieves a memory by ID.`,builder:C,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-memory`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getMemory({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],memory_id:s[`memory-id`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get-namespace <namespace-name>`,describe:`Gets a namespace by name.`,builder:T,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-namespace`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getNamespace({account_id:l,namespace_name:s[`namespace-name`]})),{successLabel:`Loaded`})}};function D(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).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 O={command:`ingest <profile-name>`,describe:`Processes a conversation and extracts structured memories from it. Agent Memory identifies facts, events, instructions, and tasks automatically.`,builder:D,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory ingest`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/ingest`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.ingest({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.ingest({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}};function k(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`cursor`,{type:`string`,description:`Continuation cursor for paginated results.`}).option(`session-id`,{type:`string`,description:`Session identifier for filtering.`}).option(`type`,{type:`string`,description:`Memory type for filtering.`,choices:[`fact`,`event`,`instruction`,`task`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-memories <profile-name>`,describe:`List memories stored in a profile.`,builder:f(k),handler:async s=>{let c={per_page:s[`per-page`],cursor:s.cursor,session_id:s[`session-id`],type:s.type};if(s.dryRun){a({command:`cf agent-memory list-memories`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listMemories({account_id:u,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],...c})),{successLabel:`Loaded`})}};function j(e){return e.option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`order`,{type:`string`,description:`Field to order the results by.`,choices:[`id`,`name`]}).option(`direction`,{type:`string`,description:`Direction to sort the results in.`,choices:[`asc`,`desc`]}).option(`cursor`,{type:`string`,description:`Pagination cursor returned by a previous list response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list-namespaces`,describe:`Lists all namespaces for the given account. Results are paginated.`,builder:f(j),handler:async s=>{let c={per_page:s[`per-page`],order:s.order,direction:s.direction,cursor:s.cursor};if(s.dryRun){a({command:`cf agent-memory list-namespaces`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listNamespaces({account_id:u,...c})),{successLabel:`Loaded`})}};function N(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`cursor`,{type:`string`,description:`Opaque continuation cursor returned by a previous list response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`list-profiles <namespace-name>`,describe:`Lists the profiles of a namespace, ordered by name. A profile appears once it has been used.`,builder:N,handler:async s=>{let c={per_page:s[`per-page`],cursor:s.cursor};if(s.dryRun){a({command:`cf agent-memory list-profiles`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listProfiles({account_id:u,namespace_name:s[`namespace-name`],...c})),{successLabel:`Loaded`})}};function F(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`query`,{type:`string`,description:`Natural-language query to match against stored memories.`}).option(`reference-date`,{type:`string`,description:`Temporal anchor for relative date references in the query.`}).option(`response-length`,{type:`string`,description:`Verbosity of the synthesized answer. Defaults to 'medium'.`,choices:[`short`,`medium`,`long`]}).option(`thinking-level`,{type:`string`,description:`Recall intensity / search depth. Defaults to 'low'.`,choices:[`low`,`medium`,`high`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`recall <profile-name>`,describe:`Retrieves memories relevant to the query and returns a synthesized answer.`,builder:F,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory recall`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/recall`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.recall({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.query===void 0&&(d.query=await u(`query`,`Natural-language query to match against stored memories.`));let m=c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.recall({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function L(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`content`,{type:`string`,description:`Raw memory content to store.`}).option(`session-id`,{type:`string`,description:`Session identifier.`}).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 R={command:`remember <profile-name>`,describe:`Stores a single memory explicitly.`,builder:L,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory remember`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/remember`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.remember({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.content===void 0&&(d.content=await u(`content`,`Raw memory content to store.`));let m=c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.remember({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function z(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).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:`summary <profile-name>`,describe:`Generates a paste-ready prompt block summarizing everything stored in a memory profile.`,builder:z,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/summary`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.summary({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.summary({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}},V={command:`agent-memory`,describe:`agent-memory`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(I).command(R).command(B).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{V as default};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{h as e}from"./oauth-BjHjJtnn.mjs";import{a as t,r as n}from"./auth-C6MhC9EZ.mjs";import{t as r}from"./output-DgW1hQGX.mjs";import{n as i,t as a}from"./progress-C-oFUtvC.mjs";import{n as o}from"./body-parser-CYD7PKFC.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Array of domain hostnames to fetch robots.txt for. Each domain must end with the zone name. Maximum 25 domains per request.`})}const c={command:`bulk-get`,describe:`Fetches and parses robots.txt files for multiple domains within a zone in a single request. Each domain must belong to the specified zone. Results are keyed by hostname.`,builder:s,handler:async s=>{if(s.dryRun){i({command:`cf ai-audit robots bulk-get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/ai-audit/robots/bulk`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:o(s.body)});return}let c=await n(s);if(s.zoneId=await e({zone:s.zone},c,{quiet:s.quiet}),s.body){let e=o(s.body);if(Array.isArray(e)&&e.length>25){let n=Math.ceil(e.length/25),i=null;for(let r=0;r<e.length;r+=25){let o=e.slice(r,r+25);i=await a(`Loading: batch ${Math.floor(r/25)+1}/${n}`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:o}))}r(i,{successLabel:`Loaded`});return}r(await a(`Loading`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:e})),{successLabel:`Loaded`});return}if(s.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function l(e){return e.option(`subdomain`,{type:`string`,description:`Optional subdomain to fetch robots.txt for. If omitted, fetches robots.txt for the zone apex domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Fetches and parses the robots.txt file for a zone or a specific subdomain within the zone. Returns parsed user-agent rules, content signals, and sitemaps.`,builder:l,handler:async t=>{let o={subdomain:t.subdomain};if(t.dryRun){i({command:`cf ai-audit robots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/ai-audit/robots`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.aiAudit.robots.get({zone_id:c,...o})),{successLabel:`Loaded`})}},d={command:`robots`,describe:`Operations for robots`,builder:e=>e.command(c).command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},f={command:`ai-audit`,describe:`ai-audit`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
2
+ import{h as e}from"./oauth-B0ETkNcX.mjs";import{a as t,r as n}from"./auth-MQEamPN9.mjs";import{t as r}from"./output-DrpYYfnB.mjs";import{n as i,t as a}from"./progress-CsHIt3Tp.mjs";import{n as o}from"./body-parser-C-c9gfH1.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Array of domain hostnames to fetch robots.txt for. Each domain must end with the zone name. Maximum 25 domains per request.`})}const c={command:`bulk-get`,describe:`Fetches and parses robots.txt files for multiple domains within a zone in a single request. Each domain must belong to the specified zone. Results are keyed by hostname.`,builder:s,handler:async s=>{if(s.dryRun){i({command:`cf ai-audit robots bulk-get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/ai-audit/robots/bulk`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:o(s.body)});return}let c=await n(s);if(s.zoneId=await e({zone:s.zone},c,{quiet:s.quiet}),s.body){let e=o(s.body);if(Array.isArray(e)&&e.length>25){let n=Math.ceil(e.length/25),i=null;for(let r=0;r<e.length;r+=25){let o=e.slice(r,r+25);i=await a(`Loading: batch ${Math.floor(r/25)+1}/${n}`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:o}))}r(i,{successLabel:`Loaded`});return}r(await a(`Loading`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:e})),{successLabel:`Loaded`});return}if(s.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function l(e){return e.option(`subdomain`,{type:`string`,description:`Optional subdomain to fetch robots.txt for. If omitted, fetches robots.txt for the zone apex domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Fetches and parses the robots.txt file for a zone or a specific subdomain within the zone. Returns parsed user-agent rules, content signals, and sitemaps.`,builder:l,handler:async t=>{let o={subdomain:t.subdomain};if(t.dryRun){i({command:`cf ai-audit robots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/ai-audit/robots`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.aiAudit.robots.get({zone_id:c,...o})),{successLabel:`Loaded`})}},d={command:`robots`,describe:`Operations for robots`,builder:e=>e.command(c).command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},f={command:`ai-audit`,describe:`ai-audit`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{t as e}from"./local-eEF0NF51.mjs";import{f as t,g as n}from"./oauth-BjHjJtnn.mjs";import{a as r,r as i}from"./auth-C6MhC9EZ.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-C-oFUtvC.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u}from"./input-validation-BBKJRoRB.mjs";import{a as d,i as f,n as p}from"./prompt-DM4z101s.mjs";import{t as m}from"./cli-types-BWdZbsFE.mjs";function ee(e){return e.option(`account-provider-id`,{type:`string`,description:`The account_provider_id field`}).option(`cost-in`,{type:`number`,description:`The cost_in field`}).option(`cost-out`,{type:`number`,description:`The cost_out field`}).option(`cost-type`,{type:`string`,description:`The cost_type field`,default:`tokens`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`model`,{type:`string`,description:`The model field`}).option(`model-rule`,{type:`string`,description:`The model_rule field`,choices:[`equals`,`starts-with`,`contains`],default:`equals`}).option(`token-pricing-input-audio-tokens`,{type:`number`,description:`The token_pricing.input_audio_tokens field`}).option(`token-pricing-input-cache-creation-tokens`,{type:`number`,description:`The token_pricing.input_cache_creation_tokens field`}).option(`token-pricing-input-cached-tokens`,{type:`number`,description:`The token_pricing.input_cached_tokens field`}).option(`token-pricing-input-image-count`,{type:`number`,description:`The token_pricing.input_image_count field`}).option(`token-pricing-input-image-tokens`,{type:`number`,description:`The token_pricing.input_image_tokens field`}).option(`token-pricing-input-text-tokens`,{type:`number`,description:`The token_pricing.input_text_tokens field`}).option(`token-pricing-input-tokens`,{type:`number`,description:`The token_pricing.input_tokens field`}).option(`token-pricing-input-video-tokens`,{type:`number`,description:`The token_pricing.input_video_tokens field`}).option(`token-pricing-output-image-count`,{type:`number`,description:`The token_pricing.output_image_count field`}).option(`token-pricing-output-reasoning-tokens`,{type:`number`,description:`The token_pricing.output_reasoning_tokens field`}).option(`token-pricing-output-tokens`,{type:`number`,description:`The token_pricing.output_tokens field`}).option(`token-pricing-total-tokens`,{type:`number`,description:`The token_pricing.total_tokens 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 te={command:`create`,describe:`Creates a new AI Gateway.`,builder:ee,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...e,account_id:p})),{successLabel:`Created`});return}r[`account-provider-id`]===void 0&&(r[`account-provider-id`]=await d(`account-provider-id`,`The account_provider_id field`)),r.model===void 0&&(r.model=await d(`model`,`The model field`));let m=l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}});a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`id`,{type:`string`,description:`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 g={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
2
+ import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{a as r,r as i}from"./auth-MQEamPN9.mjs";import{t as a}from"./output-DrpYYfnB.mjs";import{n as o,t as s}from"./progress-CsHIt3Tp.mjs";import{n as c,t as l}from"./body-parser-C-c9gfH1.mjs";import{n as u}from"./input-validation-Bav2M9F-.mjs";import{a as d,i as f,n as p}from"./prompt-DdegNPpg.mjs";import{t as m}from"./cli-types-BsTty22w.mjs";function ee(e){return e.option(`account-provider-id`,{type:`string`,description:`The account_provider_id field`}).option(`cost-in`,{type:`number`,description:`The cost_in field`}).option(`cost-out`,{type:`number`,description:`The cost_out field`}).option(`cost-type`,{type:`string`,description:`The cost_type field`,default:`tokens`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`model`,{type:`string`,description:`The model field`}).option(`model-rule`,{type:`string`,description:`The model_rule field`,choices:[`equals`,`starts-with`,`contains`],default:`equals`}).option(`token-pricing-input-audio-tokens`,{type:`number`,description:`The token_pricing.input_audio_tokens field`}).option(`token-pricing-input-cache-creation-tokens`,{type:`number`,description:`The token_pricing.input_cache_creation_tokens field`}).option(`token-pricing-input-cached-tokens`,{type:`number`,description:`The token_pricing.input_cached_tokens field`}).option(`token-pricing-input-image-count`,{type:`number`,description:`The token_pricing.input_image_count field`}).option(`token-pricing-input-image-tokens`,{type:`number`,description:`The token_pricing.input_image_tokens field`}).option(`token-pricing-input-text-tokens`,{type:`number`,description:`The token_pricing.input_text_tokens field`}).option(`token-pricing-input-tokens`,{type:`number`,description:`The token_pricing.input_tokens field`}).option(`token-pricing-input-video-tokens`,{type:`number`,description:`The token_pricing.input_video_tokens field`}).option(`token-pricing-output-image-count`,{type:`number`,description:`The token_pricing.output_image_count field`}).option(`token-pricing-output-reasoning-tokens`,{type:`number`,description:`The token_pricing.output_reasoning_tokens field`}).option(`token-pricing-output-tokens`,{type:`number`,description:`The token_pricing.output_tokens field`}).option(`token-pricing-total-tokens`,{type:`number`,description:`The token_pricing.total_tokens 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 te={command:`create`,describe:`Creates a new AI Gateway.`,builder:ee,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...e,account_id:p})),{successLabel:`Created`});return}r[`account-provider-id`]===void 0&&(r[`account-provider-id`]=await d(`account-provider-id`,`The account_provider_id field`)),r.model===void 0&&(r.model=await d(`model`,`The model field`));let m=l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}});a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`id`,{type:`string`,description:`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 g={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
3
3
  `);return}a(await s(`Deleting`,async()=>c.aiGateway.accountProviders.costs.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function _(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:_,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.accountProviders.costs.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function y(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`account-provider-id`,{type:`string`,description:`Account provider ID`}).option(`model-rule`,{type:`string`,description:`Model rule`,choices:[`equals`,`starts-with`,`contains`]}).option(`cost-type`,{type:`string`,description:`Cost type`}).option(`search`,{type:`string`,description:`Search by model, changed_by`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:m(y),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],enable:r.enable,account_provider_id:r[`account-provider-id`],model_rule:r[`model-rule`],cost_type:r[`cost-type`],search:r.search};if(r.dryRun){o({command:`cf ai-gateway account-providers costs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.accountProviders.costs.list({account_id:u,...c})),{successLabel:`Loaded`})}};function x(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`cost-in`,{type:`number`,description:`The cost_in field`}).option(`cost-out`,{type:`number`,description:`The cost_out field`}).option(`cost-type`,{type:`string`,description:`The cost_type field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`model`,{type:`string`,description:`The model field`}).option(`model-rule`,{type:`string`,description:`The model_rule field`,choices:[`equals`,`starts-with`,`contains`]}).option(`token-pricing-input-audio-tokens`,{type:`number`,description:`The token_pricing.input_audio_tokens field`}).option(`token-pricing-input-cache-creation-tokens`,{type:`number`,description:`The token_pricing.input_cache_creation_tokens field`}).option(`token-pricing-input-cached-tokens`,{type:`number`,description:`The token_pricing.input_cached_tokens field`}).option(`token-pricing-input-image-count`,{type:`number`,description:`The token_pricing.input_image_count field`}).option(`token-pricing-input-image-tokens`,{type:`number`,description:`The token_pricing.input_image_tokens field`}).option(`token-pricing-input-text-tokens`,{type:`number`,description:`The token_pricing.input_text_tokens field`}).option(`token-pricing-input-tokens`,{type:`number`,description:`The token_pricing.input_tokens field`}).option(`token-pricing-input-video-tokens`,{type:`number`,description:`The token_pricing.input_video_tokens field`}).option(`token-pricing-output-image-count`,{type:`number`,description:`The token_pricing.output_image_count field`}).option(`token-pricing-output-reasoning-tokens`,{type:`number`,description:`The token_pricing.output_reasoning_tokens field`}).option(`token-pricing-output-tokens`,{type:`number`,description:`The token_pricing.output_tokens field`}).option(`token-pricing-total-tokens`,{type:`number`,description:`The token_pricing.total_tokens 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 S={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:x,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiGateway.accountProviders.costs.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=l({cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}});a(await s(`Updating`,async()=>d.aiGateway.accountProviders.costs.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}},C={command:`costs`,describe:`Operations for account-providers.costs`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`base-url`,{type:`string`,description:`The base_url field`}).option(`beta`,{type:`boolean`,description:`The beta field`}).option(`curl-example`,{type:`string`,description:`The curl_example field`}).option(`description`,{type:`string`,description:`The description field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`headers`,{type:`string`,description:`The headers field`}).option(`js-example`,{type:`string`,description:`The js_example field`}).option(`link`,{type:`string`,description:`The link field`}).option(`name`,{type:`string`,description:`The name field`}).option(`position`,{type:`number`,description:`The position field`}).option(`slug`,{type:`string`,description:`The slug 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 T={command:`create`,describe:`Creates a new AI Gateway.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.accountProviders.create({...e,account_id:p})),{successLabel:`Created`});return}r[`base-url`]===void 0&&(r[`base-url`]=await d(`base-url`,`The base_url field`)),r.name===void 0&&(r.name=await d(`name`,`The name field`)),r.slug===void 0&&(r.slug=await d(`slug`,`The slug field`));let m=l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.accountProviders.create({...m,account_id:p})),{successLabel:`Created`})}};function E(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
4
4
  `);return}a(await s(`Deleting`,async()=>c.aiGateway.accountProviders.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function O(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.accountProviders.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`beta`,{type:`boolean`,description:`Beta`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`search`,{type:`string`,description:`Search by id, name, slug`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:A,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],beta:r.beta,enable:r.enable,search:r.search};if(r.dryRun){o({command:`cf ai-gateway account-providers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.accountProviders.list({account_id:u,...c})),{successLabel:`Loaded`})}};function M(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`base-url`,{type:`string`,description:`The base_url field`}).option(`beta`,{type:`boolean`,description:`The beta field`}).option(`curl-example`,{type:`string`,description:`The curl_example field`}).option(`description`,{type:`string`,description:`The description field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`headers`,{type:`string`,description:`The headers field`}).option(`js-example`,{type:`string`,description:`The js_example field`}).option(`link`,{type:`string`,description:`The link field`}).option(`logo`,{type:`string`,description:`The logo field`}).option(`name`,{type:`string`,description:`The name field`}).option(`position`,{type:`number`,description:`The position field`}).option(`slug`,{type:`string`,description:`The slug 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 N={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:M,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),logo:u(r.logo,`logo`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiGateway.accountProviders.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),logo:u(r.logo,`logo`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)});a(await s(`Updating`,async()=>d.aiGateway.accountProviders.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}},P={command:`account-providers`,describe:`Operations for account-providers`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`credit-balance`,describe:`Retrieve the current credit balance, payment method info, and top-up configuration.`,builder:F,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing credit-balance`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/credit-balance`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.creditBalance({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get-topup-limits`,describe:`Retrieve the minimum and maximum allowed top-up amounts (in cents) for this account.`,builder:L,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing get-topup-limits`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/limits`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.getTopupLimits({account_id:l})),{successLabel:`Loaded`})}};function z(e){return e.option(`type`,{type:`string`,description:`Filter invoice type: auto, manual, or all.`,choices:[`auto`,`all`,`manual`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`invoice-history`,describe:`Retrieve a list of past invoices with pagination, optionally filtered by type.`,builder:m(z),handler:async r=>{let c={type:r.type};if(r.dryRun){o({command:`cf ai-gateway billing invoice-history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/invoice-history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.billing.invoiceHistory({account_id:u,...c})),{successLabel:`Loaded`})}};function V(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`invoice-preview`,describe:`Retrieve a preview of the upcoming invoice including line items and tax.`,builder:V,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing invoice-preview`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/invoice-preview`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.invoicePreview({account_id:l})),{successLabel:`Loaded`})}};function U(e){return e.option(`amount`,{type:`number`,description:`Spending limit amount in cents (min 100).`}).option(`duration`,{type:`string`,description:`Spending limit duration.`,choices:[`daily`,`weekly`,`monthly`]}).option(`strategy`,{type:`string`,description:`Spending limit strategy.`,choices:[`fixed`,`sliding`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Deprecated: spending limits can no longer be created, enabled, or modified and this endpoint always responds 403. Use the new AI Gateway spend limits instead: https://developers.cloudflare.com/ai-gateway/features/spend-limits/. Existing limits can be removed via DELETE /spending-limit.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({amount:r.amount,duration:u(r.duration,`duration`,`text`),strategy:u(r.strategy,`strategy`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiGateway.billing.spendingLimit.create({...e,account_id:p})),{successLabel:`Created`});return}if(r.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);r.duration===void 0&&(r.duration=await f(`duration`,`Spending limit duration.`,[`daily`,`weekly`,`monthly`])),r.strategy===void 0&&(r.strategy=await f(`strategy`,`Spending limit strategy.`,[`fixed`,`sliding`]));let m=l({amount:r.amount,duration:u(r.duration,`duration`,`text`),strategy:u(r.strategy,`strategy`,`text`)});a(await s(`Creating`,async()=>d.aiGateway.billing.spendingLimit.create({...m,account_id:p})),{successLabel:`Created`})}};function G(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete`,describe:`Remove the spending limit for the account.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
5
5
  `);return}a(await s(`Deleting`,async()=>c.aiGateway.billing.spendingLimit.delete({account_id:l})),{successLabel:`Deleted`})}};function q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get`,describe:`Retrieve the current spending limit configuration for the account.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.spendingLimit.get({account_id:l})),{successLabel:`Loaded`})}},Y={command:`spending-limit`,describe:`Operations for billing.spending-limit`,builder:e=>e.command(W).command(K).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.option(`amount`,{type:`number`,description:`Auto top-up amount in cents (min 1000).`}).option(`threshold`,{type:`number`,description:`Balance threshold in cents that triggers auto top-up (min 500).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Z={command:`create`,describe:`Configure auto top-up with a balance threshold and top-up amount.`,builder:X,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({amount:r.amount,threshold:r.threshold}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...e,account_id:d})),{successLabel:`Created`});return}if(r.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);if(r.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let f=l({amount:r.amount,threshold:r.threshold});a(await s(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...f,account_id:d})),{successLabel:`Created`})}};function Q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ne={command:`delete`,describe:`Remove the auto top-up configuration for the account.`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-D-aVNu6A.mjs";import{f as t,g as n}from"./oauth-B0ETkNcX.mjs";import{a as r,r as i}from"./auth-MQEamPN9.mjs";import{t as a}from"./output-DrpYYfnB.mjs";import{n as o,t as s}from"./progress-CsHIt3Tp.mjs";import{n as c,t as l}from"./body-parser-C-c9gfH1.mjs";import{n as u,t as d}from"./input-validation-Bav2M9F-.mjs";import{a as f,i as p,n as m}from"./prompt-DdegNPpg.mjs";import{t as h}from"./cli-types-BsTty22w.mjs";import{n as ee,t as te}from"./raw-fetch-CteyTOM2.mjs";function g(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`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 _={command:`chat-completions <id>`,describe:`Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/chat/completions`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.chatCompletions({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function v(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead.`,default:!1}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`The type field`,choices:[`r2`,`web-crawler`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const y={command:`create <name> <id>`,describe:`Create a new AI Search instance with the given configuration.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.create({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),hybrid_search_enabled:r[`hybrid-search-enabled`],index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},token_id:u(r[`token-id`],`token-id`,`text`),type:u(r.type,`type`,`text`),id:r.id});a(await s(`Creating`,async()=>d.aiSearch.create({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function b(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const x={command:`delete <id>`,describe:`Permanently delete an AI Search instance and all its indexed data.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>c.aiSearch.delete({account_id:l,name:r.name,id:r.id})),{successLabel:`Deleted`})}};function S(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`get <id>`,describe:`Retrieve the configuration and status of an AI Search instance.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.get({account_id:l,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function w(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`chunks <item-id>`,describe:`Lists chunks for a specific item in an AI Search instance, including their text content.`,builder:w,handler:async r=>{let c={limit:r.limit,offset:r.offset};if(r.dryRun){o({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/chunks`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.chunks({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function E(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <item-id>`,describe:`Deletes a file from a managed AI Search instance and triggers a reindex.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
4
+ `);return}a(await s(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Deleted`})}};function O(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const k={command:`download <item-id>`,describe:`Downloads the raw file content for a specific item from the managed AI Search instance storage.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/download`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}await i(r);let a=r.local?e:await t();r.accountId=a;let c=await s(`Loading`,async()=>te(`/accounts/${a}/ai-search/namespaces/${encodeURIComponent(String(r.name))}/instances/${encodeURIComponent(String(r.id))}/items/${encodeURIComponent(String(r[`item-id`]))}/download`,{method:`GET`,local:r.local===!0,persistTo:r.persistTo}));ee(r.text===!0?c.toString(`utf-8`):c)}};function A(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`get <item-id>`,describe:`Retrieves a specific indexed item from an AI Search instance.`,builder:A,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.items.get({account_id:l,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Loaded`})}};function M(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts by status priority then last_seen_at. "modified_at" sorts by file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Filter items by source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}`}).option(`item-id`,{type:`string`,description:`Filter items by their unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Filter items by their exact key (object key / filename). Keys are unique per source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`list`,describe:`Lists indexed items in an AI Search instance.`,builder:h(M),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,sort_by:r[`sort-by`],status:r.status,source:r.source,metadata_filter:r[`metadata-filter`],item_id:r[`item-id`],key:r.key};if(r.dryRun){o({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function P(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`logs <item-id>`,describe:`Lists processing logs for a specific item in an AI Search instance.`,builder:P,handler:async r=>{let c={limit:r.limit,cursor:r.cursor};if(r.dryRun){o({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}/logs`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.items.logs({account_id:u,name:r.name,id:r.id,item_id:r[`item-id`],...c})),{successLabel:`Loaded`})}};function I(e){return e.positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`sync <item-id>`,describe:`Syncs an item to an AI Search instance index.`,builder:I,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items/${r[`item-id`]==null?`<item-id>`:encodeURIComponent(String(r[`item-id`]))}`,pathParams:{id:String(r.id??``),"item-id":String(r[`item-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.sync({...e,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`});return}r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let m=l({next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.sync({...m,account_id:f,name:r.name,id:r.id,item_id:r[`item-id`]})),{successLabel:`Updated`})}};function R(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."})}const z={command:`upload <id>`,describe:`Uploads a file to a managed AI Search instance via multipart/form-data.`,builder:R,handler:async c=>{if(c.dryRun){o({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${c.name==null?`<name>`:encodeURIComponent(String(c.name))}/instances/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}/items`,pathParams:{id:String(c.id??``),name:String(c.name??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,metadata:c.metadata,"wait-for-completion":c[`wait-for-completion`]}});return}let l=await i(c),f=c.local?e:await t();if(c.accountId=f,c.file!==void 0||c.body!==void 0||c.metadata!==void 0||c[`wait-for-completion`]!==void 0){let e=new FormData;if(c.file){let t=d(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);c.metadata!==void 0&&e.append(`metadata`,String(u(c.metadata,`metadata`,`text`)??``)),c[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(c[`wait-for-completion`])),a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e})),{successLabel:`Created`});return}if(c.body){let e=u(c.body,`body`,`binary`);a(await s(`Creating`,async()=>r(l,`POST`,`/accounts/${f}/ai-search/namespaces/${encodeURIComponent(String(c.name))}/instances/${encodeURIComponent(String(c.id))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function B(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).option(`wait-for-completion`,{type:`boolean`,description:"Wait for indexing to fully complete before responding. On RAGs with vector indexing enabled, this additionally waits for Vectorize ingestion confirmation (up to 40s) so the returned item reflects a queryable state. On timeout the item is returned in `running` state and the background alarm continues polling. Defaults to false."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`upsert <id>`,describe:`Creates or updates an indexed item in an AI Search instance.`,builder:B,handler:async r=>{if(r.dryRun){o({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/items`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]}):c(r.body)});return}let d=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...e,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`});return}r.key===void 0&&(r.key=await f(`key`,`Item key / filename. Must not exceed 128 characters.`)),r[`next-action`]===void 0&&(r[`next-action`]=await p(`next-action`,`The next_action field`,[`INDEX`]));let h=l({key:u(r.key,`key`,`text`),next_action:u(r[`next-action`],`next-action`,`text`),wait_for_completion:r[`wait-for-completion`]});a(await s(`Updating`,async()=>d.aiSearch.items.upsert({...h,account_id:m,name:r.name,id:r.id})),{successLabel:`Updated`})}},H={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`cancel <job-id>`,describe:`Cancel an in-progress indexing job for an AI Search instance.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({action:u(r.action,`action`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,!await m({force:!!r.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
5
+ `);return}if(r.body){let e=c(r.body);a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...e,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`});return}r.action===void 0&&(r.action=await p(`action`,`The action field`,[`cancel`]));let h=l({action:u(r.action,`action`,`text`)});a(await s(`Deleting`,async()=>d.aiSearch.jobs.cancel({...h,account_id:f,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Deleted`})}};function G(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`create <id>`,describe:`Creates a new indexing job for an AI Search instance.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`)});a(await s(`Creating`,async()=>d.aiSearch.jobs.create({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Created`})}};function q(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <job-id>`,describe:`Retrieves details for a specific AI Search indexing job.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,name:r.name,id:r.id,job_id:r[`job-id`]})),{successLabel:`Loaded`})}};function Y(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists indexing jobs for an AI Search instance.`,builder:Y,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs`,pathParams:{id:String(r.id??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.jobs.list({account_id:u,name:r.name,id:r.id,...c})),{successLabel:`Loaded`})}};function Z(e){return e.positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`logs <job-id>`,describe:`Lists log entries for an AI Search indexing job.`,builder:Z,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/jobs/${r[`job-id`]==null?`<job-id>`:encodeURIComponent(String(r[`job-id`]))}/logs`,pathParams:{id:String(r.id??``),"job-id":String(r[`job-id`]??``),name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.jobs.logs({account_id:u,name:r.name,id:r.id,job_id:r[`job-id`],...c})),{successLabel:`Loaded`})}},ne={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function re(e){return e.option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`list`,describe:`List all AI Search instances in the account.`,builder:h(re),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search,order_by:r[`order-by`],order_by_direction:r[`order-by-direction`]};if(r.dryRun){o({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances`,pathParams:{name:String(r.name??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.list({account_id:u,name:r.name,...c})),{successLabel:`Loaded`})}};function ae(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace currently containing the instance.`,demandOption:!0}).option(`destination-namespace`,{type:`string`,description:`Target namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`move <id>`,describe:`Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{name:String(r.name??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.move({...e,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`});return}r[`destination-namespace`]===void 0&&(r[`destination-namespace`]=await f(`destination-namespace`,`Target namespace to move the instance into.`));let m=l({new_namespace:u(r[`destination-namespace`],`destination-namespace`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.move({...m,account_id:p,name:r.name,id:r.id})),{successLabel:`Updated`})}};function se(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`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 ce={command:`multi-chat-completions <name>`,describe:`Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`,builder:se,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/chat/completions`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},model:u(r.model,`model`,`text`),stream:r.stream});a(await s(`Creating`,async()=>d.aiSearch.multiChatCompletions({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function le(e){return e.positional(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`multi-search <name> <query>`,describe:`Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`,builder:le,handler:async r=>{if(r.dryRun){o({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/search`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...e,account_id:f,name:r.name})),{successLabel:`Created`});return}if(r[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},instance_ids:r[`ai-search-options-instance-ids`],query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query});a(await s(`Creating`,async()=>d.aiSearch.multiSearch({...p,account_id:f,name:r.name})),{successLabel:`Created`})}};function de(e){return e.positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create <namespace>`,describe:`Create a namespace for organizing AI Search instances.`,builder:de,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},name:r.namespace});a(await s(`Creating`,async()=>d.aiSearch.namespace.create({...p,account_id:f})),{successLabel:`Created`})}};function pe(e){return e.positional(`name`,{type:`string`,description:`Namespace to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const me={command:`delete <name>`,describe:`Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`,builder:pe,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
6
+ `);return}a(await s(`Deleting`,async()=>c.aiSearch.namespace.delete({account_id:l,name:r.name})),{successLabel:`Deleted`})}};function he(e){return e.positional(`name`,{type:`string`,description:`Namespace to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`get <name>`,describe:`Retrieve a namespace and its description.`,builder:he,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.namespace.get({account_id:l,name:r.name})),{successLabel:`Loaded`})}};function _e(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`list`,describe:`List namespaces in the account, including their descriptions and creation times.`,builder:_e,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search};if(r.dryRun){o({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.namespace.list({account_id:u,...c})),{successLabel:`Loaded`})}};function ye(e){return e.positional(`name`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`update <name>`,describe:`Update the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`,builder:ye,handler:async r=>{if(r.dryRun){o({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}`,pathParams:{name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.namespace.update({...e,account_id:f,name:r.name})),{successLabel:`Updated`});return}let p=l({description:u(r.description,`description`,`text`),public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],instances_allowed:r[`public-endpoint-params-instances-allowed`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}}});a(await s(`Updating`,async()=>d.aiSearch.namespace.update({...p,account_id:f,name:r.name})),{successLabel:`Updated`})}},xe={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(fe).command(me).command(ge).command(ve).command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Se(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`purge-cache <id>`,describe:`Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`,builder:Se,handler:async r=>{if(r.dryRun){o({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/purge_cache`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Creating`,async()=>c.aiSearch.purgeCache({account_id:l,name:r.name,id:r.id})),{successLabel:`Created`})}};function we(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Te={command:`search <id> <query>`,describe:`Executes a semantic search query against an AI Search instance to find relevant indexed content.`,builder:we,handler:async r=>{if(r.dryRun){o({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/search`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Loading`,async()=>d.aiSearch.search({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Loaded`});return}let p=l({ai_search_options:{cache:{cache_threshold:u(r[`ai-search-options-cache-cache-threshold`],`ai-search-options-cache-cache-threshold`,`text`),enabled:r[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:r[`ai-search-options-query-rewrite-enabled`],model:u(r[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:u(r[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:r[`ai-search-options-reranking-enabled`],match_threshold:r[`ai-search-options-reranking-match-threshold`],model:u(r[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:r[`ai-search-options-retrieval-context-expansion`],fusion_method:u(r[`ai-search-options-retrieval-fusion-method`],`ai-search-options-retrieval-fusion-method`,`text`),keyword_match_mode:u(r[`ai-search-options-retrieval-keyword-match-mode`],`ai-search-options-retrieval-keyword-match-mode`,`text`),match_threshold:r[`ai-search-options-retrieval-match-threshold`],max_num_results:r[`ai-search-options-retrieval-max-num-results`],retrieval_type:u(r[`ai-search-options-retrieval-retrieval-type`],`ai-search-options-retrieval-retrieval-type`,`text`),return_on_failure:r[`ai-search-options-retrieval-return-on-failure`]}},query:r.query});a(await s(`Loading`,async()=>d.aiSearch.search({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function Ee(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`stats <id>`,describe:`Retrieve usage and indexing statistics for an AI Search instance.`,builder:Ee,handler:async r=>{if(r.dryRun){o({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/stats`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.stats({account_id:l,name:r.name,id:r.id})),{successLabel:`Loaded`})}};function $(e){return e.positional(`name`,{type:`string`,description:`Human-readable name for the credential.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Oe={command:`create <name>`,describe:`Create a stored Cloudflare credential for an AI Search instance to access its data source.`,builder:$,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:r.name}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiSearch.tokens.create({...e,account_id:p})),{successLabel:`Created`});return}r[`api-token-id`]===void 0&&(r[`api-token-id`]=await f(`api-token-id`,`The cf_api_id field`)),r[`api-token`]===void 0&&(r[`api-token`]=await f(`api-token`,`The cf_api_key field`,{kind:`secret`}));let m=l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:r.name});a(await s(`Creating`,async()=>d.aiSearch.tokens.create({...m,account_id:p})),{successLabel:`Created`})}};function ke(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`delete <id>`,describe:`Permanently delete a stored AI Search credential. Credentials in use by an instance cannot be deleted.`,builder:ke,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
7
+ `);return}a(await s(`Deleting`,async()=>c.aiSearch.tokens.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function je(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`get <id>`,describe:`Retrieve a stored AI Search credential without exposing its secret.`,builder:je,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiSearch.tokens.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function Ne(e){return e.option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Pe={command:`list`,describe:`List stored AI Search credentials in the account without exposing their secrets.`,builder:Ne,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search};if(r.dryRun){o({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiSearch.tokens.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Fe(e){return e.positional(`id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ie={command:`update <id>`,describe:`Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`,builder:Fe,handler:async r=>{if(r.dryRun){o({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/tokens/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:u(r.name,`name`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.tokens.update({...e,account_id:p,id:r.id})),{successLabel:`Updated`});return}r[`api-token-id`]===void 0&&(r[`api-token-id`]=await f(`api-token-id`,`The cf_api_id field`)),r[`api-token`]===void 0&&(r[`api-token`]=await f(`api-token`,`The cf_api_key field`,{kind:`secret`})),r.name===void 0&&(r.name=await f(`name`,`The name field`));let m=l({cf_api_id:u(r[`api-token-id`],`api-token-id`,`text`),cf_api_key:u(r[`api-token`],`api-token`,`text`),legacy:r.legacy,name:u(r.name,`name`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.tokens.update({...m,account_id:p,id:r.id})),{successLabel:`Updated`})}},Le={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(Oe).command(Ae).command(Me).command(Pe).command(Ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Re(e){return e.positional(`id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`name`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).option(`chunk`,{type:`boolean`,description:`The chunk field`}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`]}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`paused`,{type:`boolean`,description:`The paused field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint`}).option(`reranking`,{type:`boolean`,description:`The reranking field`}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`}).option(`system-prompt-ai-search`,{type:`string`,description:`The system_prompt_ai_search field`}).option(`system-prompt-index-summarization`,{type:`string`,description:`The system_prompt_index_summarization field`}).option(`system-prompt-rewrite-query`,{type:`string`,description:`The system_prompt_rewrite_query field`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0})}const ze={command:`update <id>`,describe:`Update the configuration of an AI Search instance.`,builder:Re,handler:async r=>{if(r.dryRun){o({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-search/namespaces/${r.name==null?`<name>`:encodeURIComponent(String(r.name))}/instances/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),name:String(r.name??``)},bodyKind:`json`,body:r.body===void 0?l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:r.paused,public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:r.summarization,summarization_model:u(r[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(r[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(r[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(r[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(r[`token-id`],`token-id`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiSearch.update({...e,account_id:f,name:r.name,id:r.id})),{successLabel:`Updated`});return}let p=l({ai_gateway_id:u(r[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:u(r[`ai-search-model`],`ai-search-model`,`text`),cache:r.cache,cache_threshold:u(r[`cache-threshold`],`cache-threshold`,`text`),chunk:r.chunk,chunk_overlap:r[`chunk-overlap`],chunk_size:r[`chunk-size`],embedding_model:u(r[`embedding-model`],`embedding-model`,`text`),fusion_method:u(r[`fusion-method`],`fusion-method`,`text`),index_method:{keyword:r[`index-method-keyword`],vector:r[`index-method-vector`]},indexing_options:{keyword_tokenizer:u(r[`indexing-options-keyword-tokenizer`],`indexing-options-keyword-tokenizer`,`text`)},max_num_results:r[`max-num-results`],metadata:{created_from_aisearch_wizard:r[`metadata-created-from-aisearch-wizard`],worker_domain:u(r[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:r.paused,public_endpoint_params:{authorized_hosts:r[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:r[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:r[`public-endpoint-params-custom-domains`],default_domain_enabled:r[`public-endpoint-params-default-domain-enabled`],enabled:r[`public-endpoint-params-enabled`],mcp:{description:u(r[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:r[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:r[`public-endpoint-params-rate-limit-period-ms`],requests:r[`public-endpoint-params-rate-limit-requests`],technique:u(r[`public-endpoint-params-rate-limit-technique`],`public-endpoint-params-rate-limit-technique`,`text`)},search_endpoint:{disabled:r[`public-endpoint-params-search-endpoint-disabled`]}},reranking:r.reranking,reranking_model:u(r[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:u(r[`retrieval-options-keyword-match-mode`],`retrieval-options-keyword-match-mode`,`text`)},rewrite_model:u(r[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:r[`rewrite-query`],score_threshold:r[`score-threshold`],source:u(r.source,`source`,`text`),source_params:{exclude_items:r[`source-params-exclude-items`],include_items:r[`source-params-include-items`],prefix:u(r[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:u(r[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:r[`source-params-web-crawler-discover-options-depth`],include_external_links:r[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:r[`source-params-web-crawler-discover-options-include-subdomains`],limit:r[`source-params-web-crawler-discover-options-limit`],max_age:r[`source-params-web-crawler-discover-options-max-age`],source:u(r[`source-params-web-crawler-discover-options-source`],`source-params-web-crawler-discover-options-source`,`text`)},parse_options:{include_images:r[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:r[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:r[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:u(r[`source-params-web-crawler-parse-type`],`source-params-web-crawler-parse-type`,`text`)}},summarization:r.summarization,summarization_model:u(r[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:u(r[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:u(r[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:u(r[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:u(r[`token-id`],`token-id`,`text`)});a(await s(`Updating`,async()=>d.aiSearch.update({...p,account_id:f,name:r.name,id:r.id})),{successLabel:`Updated`})}},Be={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(_).command(y).command(x).command(C).command(ie).command(oe).command(ce).command(ue).command(Ce).command(Te).command(De).command(ze).command(H).command(ne).command(xe).command(Le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Be as default};