cf 1.0.0-beta.25 → 1.0.0-beta.27
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.
- package/dist/_meta/commands.json +2015 -3426
- package/dist/_meta/hand-written-commands.json +16 -1
- package/dist/_meta/schemas.json +9249 -2339
- package/dist/abuse-reports-RxXqfDEW.mjs +24 -0
- package/dist/{access-__sFDSFL.mjs → access-BxEprr2f.mjs} +1 -1
- package/dist/{accounts-CmggwRjh.mjs → accounts-DU2ZNYqP.mjs} +17 -11
- package/dist/{acm-AAhRZUAU.mjs → acm-CBCIKBJ4.mjs} +1 -1
- package/dist/{addressing-DVeJNPZc.mjs → addressing-BKxiLRHk.mjs} +1 -1
- package/dist/{agent-memory-DQhWO6sc.mjs → agent-memory-DkBpQYUL.mjs} +1 -1
- package/dist/{ai-CULO9sno.mjs → ai-DqEN_hhg.mjs} +2 -2
- package/dist/{ai-audit-udn4HF34.mjs → ai-audit-BmzOgt6x.mjs} +1 -1
- package/dist/{ai-gateway-Bm2MMdec.mjs → ai-gateway-B0uiYVHq.mjs} +3 -3
- package/dist/ai-search-DbZIxdio.mjs +74 -0
- package/dist/{ai-security-DXy9ht-9.mjs → ai-security-CvZfP2JC.mjs} +1 -1
- package/dist/{alerting-CssnaN2i.mjs → alerting-BjGwBxZT.mjs} +1 -1
- package/dist/{analytics-BVo7Ax0w.mjs → analytics-C7kT_H-W.mjs} +4 -4
- package/dist/{analytics-engine-BBd0Bydx.mjs → analytics-engine-BHpcNSdD.mjs} +1 -1
- package/dist/{api-security-C-D9OKtH.mjs → api-security-BbcvDtff.mjs} +2 -2
- package/dist/{argo-DSziwzvA.mjs → argo-D1VONzu-.mjs} +1 -1
- package/dist/{artifacts-nVMgn4dn.mjs → artifacts-2R2sxIKO.mjs} +3 -3
- package/dist/{audit-logs-DIZ5oA_y.mjs → audit-logs-LoBB1OO_.mjs} +1 -1
- package/dist/auth-CspwoBlp.mjs +2 -0
- package/dist/{auth-JsvLULHA.mjs → auth-D499YE2n.mjs} +3 -3
- package/dist/{auth-CB9wjyad.mjs → auth-FK2eLQ02.mjs} +1 -1
- package/dist/{auth-token-BAgw7kYP.mjs → auth-token-BwpERbnG.mjs} +1 -1
- package/dist/{autoconfig-CajkMb3B.mjs → autoconfig-B2w-woU0.mjs} +85 -83
- package/dist/{basin-catalog-BRvGeKm3.mjs → basin-catalog-AgOHGiPI.mjs} +2 -2
- package/dist/billing-DRNww0iC.mjs +24 -0
- package/dist/{blocks-D2tE8dp2.mjs → blocks-C8vyXIAT.mjs} +1 -1
- package/dist/body-unions-CjpNjwSW.mjs +2 -0
- package/dist/bot-management-fwxKIbaB.mjs +9 -0
- package/dist/{botnet-feed-VOL5P4s3.mjs → botnet-feed-DCYB5kYZ.mjs} +1 -1
- package/dist/{brand-protection-CSVHQ9Pt.mjs → brand-protection-BVICLzBc.mjs} +1 -1
- package/dist/browser-run-CEk-NIgP.mjs +40 -0
- package/dist/build-CRm2TQq8.mjs +2 -0
- package/dist/{build-BfkzV5_c.mjs → build-DO_GNhRl.mjs} +1 -1
- package/dist/{builds-y5BQCJ81.mjs → builds-CoazxuN-.mjs} +26 -26
- package/dist/{cache-Bvr988Hj.mjs → cache-jlLJLSu7.mjs} +1 -1
- package/dist/{cf-DgLg6Hop.mjs → cf-hP0SOgC6.mjs} +2 -2
- package/dist/{chunk-2HLTAS5V-B92NbX1j.mjs → chunk-AAQI36FL-e6E5HW1g.mjs} +1 -1
- package/dist/{chunk-DSGVRFIS-Dq2PrGsi.mjs → chunk-DSGVRFIS-DQwKND2c.mjs} +1 -1
- package/dist/chunk-SOBRPAPT-BKzUiNx_.mjs +363 -0
- package/dist/{cli-BTxJfFus.mjs → cli-Nqf58-1c.mjs} +3 -3
- package/dist/{client-side-security-CFmO0uz9.mjs → client-side-security-VmZzMy-m.mjs} +1 -1
- package/dist/{cloud-connector-CtwPdFBa.mjs → cloud-connector-bMlFnqP0.mjs} +1 -1
- package/dist/{cloudflared-DPkNN1Qv.mjs → cloudflared-Ba4KWdTO.mjs} +1 -1
- package/dist/{cloudforce-one-DHrMaxnU.mjs → cloudforce-one-CCaIBOAo.mjs} +121 -119
- package/dist/{command-CDYTsmxe.mjs → command-BASaTmJc.mjs} +1 -1
- package/dist/{command-BWyx7dNO.mjs → command-BiIVclNA.mjs} +1 -1
- package/dist/{command-CXwKBbj9.mjs → command-Bih1HLr3.mjs} +1 -1
- package/dist/{command-Ct3tf-P5.mjs → command-BxZBNPxG.mjs} +1 -1
- package/dist/{command-DPOjEs1B.mjs → command-ByYf12-8.mjs} +1 -1
- package/dist/{command-CmK8-DJ9.mjs → command-C0qCuw03.mjs} +1 -1
- package/dist/{command-DqWBPiew.mjs → command-C2FVMd1b.mjs} +1 -1
- package/dist/{command-ckixJeTm.mjs → command-C4OgtX_x.mjs} +1 -1
- package/dist/{command-CCDzJjIB.mjs → command-C5Kqc5Km.mjs} +1 -1
- package/dist/{command-lJJ7sEZe.mjs → command-CFxyp8Uo.mjs} +1 -1
- package/dist/{command-ClneauMx.mjs → command-CZAR85ba.mjs} +1 -1
- package/dist/{command-BXCk1OsI.mjs → command-CelQVrZL.mjs} +1 -1
- package/dist/{command-YFWLEK8W.mjs → command-CrAlzysj.mjs} +1 -1
- package/dist/{command-6_Ms3TZv.mjs → command-pMoNdd22.mjs} +1 -1
- package/dist/{completions-B1rYgw_a.mjs → completions-DRzBiqpv.mjs} +1 -1
- package/dist/{connector-interrupts-DecTdK6X.mjs → connector-interrupts-CrTeSyaM.mjs} +1 -1
- package/dist/{connector-telemetry-events-wePxPACj.mjs → connector-telemetry-events-BbAOUt9h.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-D8sXR1qx.mjs → connector-telemetry-snapshots-DcpBx7Qx.mjs} +1 -1
- package/dist/{connectors-C-6RQ_Q1.mjs → connectors-D1WFLJoE.mjs} +1 -1
- package/dist/{containers-D65Gpj9Q.mjs → containers-BOBEs1Gk.mjs} +4 -4
- package/dist/containers-DINLx5_i.mjs +380 -0
- package/dist/{content-scan-DbIDQ-Yu.mjs → content-scan-D1GfPSL0.mjs} +1 -1
- package/dist/{context-DCon1tRZ.mjs → context-Dp4CXG22.mjs} +1 -1
- package/dist/{cps-DGLmzCzp.mjs → cps-D4uhzg3k.mjs} +1 -1
- package/dist/{csam-scanner-R7Ih-Dnw.mjs → csam-scanner-DOOUBeBM.mjs} +1 -3
- package/dist/custom-csrs-DtdFo5YZ.mjs +18 -0
- package/dist/{custom-hostnames-BFWR-tR_.mjs → custom-hostnames-ccdlELaD.mjs} +1 -1
- package/dist/custom-nameservers-p3gDjfva.mjs +12 -0
- package/dist/custom-pages-DAkKVzgR.mjs +38 -0
- package/dist/d1-CDIyRdh4.mjs +52 -0
- package/dist/{delegate-CTj0dYET.mjs → delegate-B4bKqF7i.mjs} +1 -1
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-BVTA83rN.mjs → deploy-BaC5Ty7F.mjs} +1 -1
- package/dist/{deploy-context-CO8ZSRwx.mjs → deploy-context-DTTgNGro.mjs} +1 -1
- package/dist/{deploy-input-PhKRxa_2.mjs → deploy-input-mAy06fAI.mjs} +1 -1
- package/dist/{dev-CM5GLHNn.mjs → dev-De-HszNT.mjs} +1 -1
- package/dist/{diagnostics-DPjl0aCm.mjs → diagnostics-D1CUs2o9.mjs} +1 -1
- package/dist/{dist-ataVE8ob.mjs → dist-D5qkmHhC.mjs} +2 -2
- package/dist/{dls-BLTIVlbh.mjs → dls-DWBiYzY1.mjs} +1 -1
- package/dist/{dns-firewall-D1bb1byu.mjs → dns-firewall-DH9xIT5H.mjs} +8 -8
- package/dist/{dns-DkqVq-nB.mjs → dns-wMjf1t6-.mjs} +14 -8
- package/dist/{docs-tOv_OllI.mjs → docs-BA7qslb2.mjs} +1 -1
- package/dist/{dotenv-qsoPELMm.mjs → dotenv-DKRemNCH.mjs} +1 -1
- package/dist/{durable-objects-OJhns_to.mjs → durable-objects-DF0MYpnV.mjs} +1 -1
- package/dist/{email-auth-BbsIBNlu.mjs → email-auth-BShMFXn4.mjs} +1 -1
- package/dist/email-domains-CDSbVclP.mjs +14 -0
- package/dist/{email-routing-DnitWE1A.mjs → email-routing-CBCkbg_F.mjs} +4 -2
- package/dist/{email-security-DiWtb7cx.mjs → email-security-CnNa1YON.mjs} +4 -4
- package/dist/{email-sending-DuDjXykw.mjs → email-sending-CpDSw-Eb.mjs} +16 -16
- package/dist/error-sanitization-B025CygB.mjs +2 -0
- package/dist/{error-sanitization-ahuAGEjT.mjs → error-sanitization-DG8WSzHe.mjs} +1 -1
- package/dist/{errors-CCFmptqJ.mjs → errors-DatLr-iR.mjs} +1 -1
- package/dist/{field-extractors-DNNnkBZH.mjs → field-extractors-BwGdMnTr.mjs} +1 -1
- package/dist/{firewall-C7eZRNVF.mjs → firewall-CY_oem-d.mjs} +25 -9
- package/dist/{flagship-BczjsrJ5.mjs → flagship-Bat5EZCk.mjs} +1 -1
- package/dist/{fraud-wE0UM2SM.mjs → fraud-CSUKLh8X.mjs} +2 -2
- package/dist/global-options-DiKj2cQy.mjs +2 -0
- package/dist/{google-tag-gateway-6mvtxcJK.mjs → google-tag-gateway-C2skt6t-.mjs} +1 -1
- package/dist/{healthchecks-aIB3DebS.mjs → healthchecks-uC43QKQd.mjs} +1 -1
- package/dist/{hyperdrive-DHRP8SJS.mjs → hyperdrive-FcBbpew4.mjs} +3 -3
- package/dist/iam-8T74DNhH.mjs +62 -0
- package/dist/{images-CLgvxd0t.mjs → images-C3JUaf6b.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-B_DBTMXU.mjs → init-BEVVz4_P.mjs} +1 -1
- package/dist/{intel-jnoIVlYG.mjs → intel-DRy4rHrt.mjs} +6 -7
- package/dist/{interactive-1g0dnrA8.mjs → interactive-CKHdGvkh.mjs} +1 -1
- package/dist/{internal-Ba3b-Z8J.mjs → internal-CamuESs0.mjs} +1 -1
- package/dist/{ips-CQ4gFfex.mjs → ips-DinCNnWj.mjs} +1 -1
- package/dist/k2-wsanPL3y.mjs +10 -0
- package/dist/{kv-DQfnNE-w.mjs → kv-BLSPcEnH.mjs} +1 -1
- package/dist/{lazy-command-DjGzxiUT.mjs → lazy-command-WB1FOuew.mjs} +1 -1
- package/dist/{leaked-credential-checks-CaqjG3Oz.mjs → leaked-credential-checks-CSZd9hBQ.mjs} +1 -1
- package/dist/{live-BfobGv8W.mjs → live-B6AsI_E5.mjs} +1 -1
- package/dist/{load-balancers-BzSCp2Uh.mjs → load-balancers-gap5u4b1.mjs} +19 -7
- package/dist/local-CFsO9Tkg.mjs +2 -0
- package/dist/{local-BNmz58v4.mjs → local-CgBhtmON.mjs} +1 -1
- package/dist/{local-runtime-DvH92pV8.mjs → local-runtime-CmlJ20uJ.mjs} +1 -1
- package/dist/{login-B9wYab6S.mjs → login-BJHaTERg.mjs} +1 -1
- package/dist/login-BfuOf-Yi.mjs +2 -0
- package/dist/logpush-qhlxsioM.mjs +68 -0
- package/dist/{logs-Dan7xU-k.mjs → logs-bI54CJ0w.mjs} +23 -7
- package/dist/{magic-network-monitoring-TAjt04vN.mjs → magic-network-monitoring-CX3TaMTu.mjs} +1 -1
- package/dist/{magic-transit-BSuLHnQ5.mjs → magic-transit-BwDyySHJ.mjs} +20 -20
- package/dist/{managed-defense-CTnIZLg4.mjs → managed-defense-CsBBkfeQ.mjs} +2 -2
- package/dist/{managed-transforms-BETvesjp.mjs → managed-transforms-CUC-uAbW.mjs} +1 -1
- package/dist/{mcp-DhjMGaKc.mjs → mcp-CyI0sDmL.mjs} +3 -3
- package/dist/{mesh-jxLLG3t4.mjs → mesh-Czr0UCP4.mjs} +2 -2
- package/dist/{migrate-Bkhk38nJ.mjs → migrate-DKDWYrz2.mjs} +1 -1
- package/dist/{monetization-BqDgHlPv.mjs → monetization-NUgfDtSy.mjs} +7 -3
- package/dist/{network-D6BRpgOv.mjs → network-B42zrBic.mjs} +1 -1
- package/dist/{network-interconnects-tP41GbnL.mjs → network-interconnects-DuIBe8fK.mjs} +4 -4
- package/dist/{o11y-h4cIC_1T.mjs → o11y-oEUpMC3O.mjs} +6 -6
- package/dist/{oauth-CuM12iNb.mjs → oauth-BLQ1-y3R.mjs} +1 -1
- package/dist/{oauth-nDH3nTCa.mjs → oauth-BmSFLp_s.mjs} +1 -1
- package/dist/observability-BxhJQCgZ.mjs +4 -0
- package/dist/organization-CEnlXwrl.mjs +70 -0
- package/dist/{organizations-7Q3d9vcW.mjs → organizations-Dt86ToxE.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-XBMPCdSL.mjs → origin-post-quantum-encryption-lX-uaJSL.mjs} +1 -1
- package/dist/package-CiRJBRHO.mjs +2 -0
- package/dist/{page-rules-BlT5xlhH.mjs → page-rules-J6LhwR-s.mjs} +1 -1
- package/dist/{pages-CIbL62L2.mjs → pages-BksdnChs.mjs} +4 -4
- package/dist/{pay-per-crawl-BzsBqo_m.mjs → pay-per-crawl-BLcbHRoR.mjs} +1 -1
- package/dist/{pay-per-use-DtejLYJ8.mjs → pay-per-use-VatiU-Nt.mjs} +4 -2
- package/dist/{pipelines-LjLb8jq6.mjs → pipelines-B5AoB3f3.mjs} +5 -5
- package/dist/precursor-D3VH2MXT.mjs +4 -0
- package/dist/{previews-zRYO9uO9.mjs → previews-DzJ85fsr.mjs} +1 -1
- package/dist/{progress-_Jux05O5.mjs → progress-DLri-rA7.mjs} +1 -1
- package/dist/{prompt-SNVLBS1b.mjs → prompt-D0dXwuME.mjs} +1 -1
- package/dist/{queues-Ci4rGGC4.mjs → queues-BsAck4To.mjs} +5 -5
- package/dist/{r2-qm2hgS43.mjs → r2-BYjdHDEZ.mjs} +38 -38
- package/dist/{radar-C_ydbJe_.mjs → radar-CvLtu-Vr.mjs} +1 -1
- package/dist/{raw-fetch-D3ydyJYW.mjs → raw-fetch-DQeDx1wT.mjs} +1 -1
- package/dist/{ready-hk-_B8z3.mjs → ready-gsGEaWLL.mjs} +1 -1
- package/dist/{realtime-BAvjYmYw.mjs → realtime-DiCEgFTC.mjs} +81 -79
- package/dist/{registrar-DD7WZaP2.mjs → registrar-D4wdgWpo.mjs} +8 -8
- package/dist/{registrar-sandbox-DbxloH5s.mjs → registrar-sandbox-B6yopzdG.mjs} +2 -2
- package/dist/{reporting-CRVg3J1C.mjs → reporting-BiHgnT8L.mjs} +1 -1
- package/dist/{request-headers-Cn01EsbI.mjs → request-headers-CoxHUNcB.mjs} +1 -1
- package/dist/{request-tracers-BWs0rdFS.mjs → request-tracers-817HTytF.mjs} +1 -1
- package/dist/{resource-sharing-yipIkdbd.mjs → resource-sharing-CW9xxtq5.mjs} +12 -12
- package/dist/{rules-CCtaBLiN.mjs → rules-CRhe_ca9.mjs} +1 -1
- package/dist/rulesets-CKyc-Xlx.mjs +42 -0
- package/dist/{rum-gDOKylu_.mjs → rum-BfnWHW_d.mjs} +1 -1
- package/dist/{run-Br8sYjNF.mjs → run-Ciw_GIrC.mjs} +1 -1
- package/dist/run-DD45EQTm.mjs +2 -0
- package/dist/{schema-cache-Cb64Nqbt.mjs → schema-cache-BIo0Gi2H.mjs} +1 -1
- package/dist/schema-flags-DrqvwQNw.mjs +4 -0
- package/dist/{scim-CM8Xah56.mjs → scim-C4iRWNYB.mjs} +1 -1
- package/dist/{secrets-store-BEnXiYCC.mjs → secrets-store-DgtzZRze.mjs} +1 -1
- package/dist/security-insights-SlUGW3F_.mjs +62 -0
- package/dist/{security-txt-BF0PWAEW.mjs → security-txt-C3YS0REz.mjs} +1 -1
- package/dist/{session-B7vOqdZU.mjs → session-D2yuwO4i.mjs} +1 -1
- package/dist/{shared-CBMFY1VY.mjs → shared--uVkAAd7.mjs} +1 -1
- package/dist/{signed-url-VDDQlllt.mjs → signed-url-ClLk45_J.mjs} +1 -1
- package/dist/{smart-shield-DQku_wYi.mjs → smart-shield-Dn95hqUH.mjs} +1 -1
- package/dist/{snippets-B3FCEMuh.mjs → snippets-BNUKOajz.mjs} +1 -1
- package/dist/{spawn-9sE67p7c.mjs → spawn-DuT4snxu.mjs} +1 -1
- package/dist/{spectrum-nLirlVue.mjs → spectrum-Cj0BMtg2.mjs} +3 -3
- package/dist/{speed-C1hCyMPy.mjs → speed-BrVeZRyX.mjs} +1 -1
- package/dist/{sql-DVQOKThL.mjs → sql-BX1pBqj3.mjs} +2 -2
- package/dist/src-DPnUfK4c.mjs +131 -0
- package/dist/{ssl-CYDRgr24.mjs → ssl-Bx4LCutF.mjs} +3 -3
- package/dist/{startup-profile-BLvw_Wmc.mjs → startup-profile-DqaYNT0b.mjs} +1 -1
- package/dist/startup-profile-tZNb2HGz.mjs +2 -0
- package/dist/{state-B8n0QU04.mjs → state-BmzOLELo.mjs} +1 -1
- package/dist/state-Uwfrmw5I.mjs +2 -0
- package/dist/{stream-DHyejrI6.mjs → stream-BRzr6yh0.mjs} +1 -1
- package/dist/{tags-DOL6dKQE.mjs → tags-xVzjZxdt.mjs} +11 -5
- package/dist/{telemetry-DJ8-Q2pU.mjs → telemetry-CJ9URio3.mjs} +1 -1
- package/dist/telemetry-Pt5GpCKD.mjs +2 -0
- package/dist/tenant-custom-nameservers-M7Fxqh2W.mjs +8 -0
- package/dist/{tunnels-CMAmH4Vh.mjs → tunnels-DQVXKUKA.mjs} +3 -3
- package/dist/{turnstile-DTJjDMFp.mjs → turnstile-B_Ugzgom.mjs} +1 -1
- package/dist/ui-FYultowZ.mjs +2 -0
- package/dist/{update-check-DDGKWkmi.mjs → update-check-DHUo4FOJ.mjs} +1 -1
- package/dist/{update-check-BkCdHK-3.mjs → update-check-DRr0eRhB.mjs} +1 -1
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-normalization-BbWOra1u.mjs → url-normalization-CZRQH_pJ.mjs} +1 -1
- package/dist/{url-scanner-Bj-eS_3C.mjs → url-scanner-BH4PLy16.mjs} +1 -1
- package/dist/{user-CMzTHHVX.mjs → user-Bn82Qw0Y.mjs} +10 -12
- package/dist/{vectorize-D4H7_KPs.mjs → vectorize-DoVVz_sh.mjs} +1 -1
- package/dist/version-Zr2oF8mY.mjs +2 -0
- package/dist/{waiting-rooms-CqMbVu9s.mjs → waiting-rooms-QUW131o3.mjs} +5 -3
- package/dist/{web-assets-BgfzyF8t.mjs → web-assets-CgQXsp8m.mjs} +2 -2
- package/dist/{web3-ByCe47FI.mjs → web3-TY9s6Swn.mjs} +3 -3
- package/dist/workers-B3uJqJKc.mjs +39 -0
- package/dist/{workers-builds-2N71_8MZ.mjs → workers-builds-BgGY0IGk.mjs} +2 -2
- package/dist/{workers-for-platforms-BMN4QXgT.mjs → workers-for-platforms-5RkV9MVp.mjs} +2 -2
- package/dist/workers-vpc-Bt4OQbwM.mjs +12 -0
- package/dist/{workflows-COiyqt-B.mjs → workflows-6m85DdqF.mjs} +7 -7
- package/dist/{wrangler-migration-CqSg8IDj.mjs → wrangler-migration-BbmGOu8l.mjs} +3 -3
- package/dist/{zaraz-DjwhCH8A.mjs → zaraz-8WSJ7l0L.mjs} +2 -2
- package/dist/{zero-trust-BmpuDOmH.mjs → zero-trust-DK0cqDZv.mjs} +483 -405
- package/dist/{zones-XYQiz5kF.mjs → zones-DTAcguf6.mjs} +3 -3
- package/package.json +14 -14
- package/dist/abuse-reports-BIS9MZn7.mjs +0 -24
- package/dist/ai-search-GRN_gXgU.mjs +0 -74
- package/dist/auth-Bls_1yRW.mjs +0 -2
- package/dist/billing-BhPoqyKC.mjs +0 -22
- package/dist/bot-management-BfjX5DuH.mjs +0 -9
- package/dist/browser-run-cxOd2cZE.mjs +0 -40
- package/dist/build-DCdLWwOg.mjs +0 -2
- package/dist/chunk-3PJ54H4K-CbRAWQWI.mjs +0 -363
- package/dist/containers-C_byVTZF.mjs +0 -380
- package/dist/custom-csrs-D0RnVoJ7.mjs +0 -10
- package/dist/custom-nameservers-Dn_9Ssti.mjs +0 -8
- package/dist/custom-pages-HqIQcb77.mjs +0 -20
- package/dist/d1-CopIY9RT.mjs +0 -89
- package/dist/email-domains-pWZi1M4q.mjs +0 -12
- package/dist/error-sanitization-rodO1WCL.mjs +0 -2
- package/dist/iam-6t7-ScrS.mjs +0 -48
- package/dist/k2-Bsm6rzNX.mjs +0 -10
- package/dist/local-ChR3YIMU.mjs +0 -2
- package/dist/login-ierSCYE6.mjs +0 -2
- package/dist/logpush-DgfiSd1b.mjs +0 -44
- package/dist/magic-cloud-networking-DP8fWC4a.mjs +0 -68
- package/dist/oauth-clients-B0voUiXM.mjs +0 -14
- package/dist/oauth-scopes-Bhns1ZHW.mjs +0 -4
- package/dist/organization-Cy55HoRR.mjs +0 -73
- package/dist/package-DK3JX4I3.mjs +0 -2
- package/dist/precursor-BKp5_Ag4.mjs +0 -4
- package/dist/rulesets-DBEvCNDS.mjs +0 -34
- package/dist/run-LOgTLpob.mjs +0 -2
- package/dist/schema-flags-BcbbCWR5.mjs +0 -4
- package/dist/security-insights-Be5GvdBA.mjs +0 -40
- package/dist/src-Bh2gHpI7.mjs +0 -131
- package/dist/startup-profile-ByxSdhEl.mjs +0 -2
- package/dist/state-BTOzaT5L.mjs +0 -2
- package/dist/telemetry-kjElc1zT.mjs +0 -2
- package/dist/tenant-2EdATz2Y.mjs +0 -10
- package/dist/tenant-custom-nameservers-DhEpJNST.mjs +0 -8
- package/dist/ui-7zujR-O7.mjs +0 -2
- package/dist/version-DIIJ2ixL.mjs +0 -2
- package/dist/workers-BiLsPkYD.mjs +0 -39
- package/dist/workers-vpc-3o7dMg7-.mjs +0 -12
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CgBhtmON.mjs";import{i as n,n as r}from"./auth-FK2eLQ02.mjs";import{a as i,t as a}from"./context-Dp4CXG22.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-DLri-rA7.mjs";import{t as l}from"./run-Ciw_GIrC.mjs";import"./telemetry-Pt5GpCKD.mjs";import{a as u,n as d,r as f,s as p,t as m}from"./body-parser-BKcZS9iJ.mjs";import{n as h,t as g}from"./input-validation-D7z60HJH.mjs";import{a as _,i as v,n as y}from"./prompt-D0dXwuME.mjs";import{n as ee,t as te}from"./raw-fetch-DQeDx1wT.mjs";function ne(e){return e.usage(`$0 ai-search chat-completions <instance-id>
|
|
3
|
+
|
|
4
|
+
Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const re={command:`chat-completions <instance-id>`,describe:`Chat Completions`,builder:ne,handler:async e=>l({command:`ai-search chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.model!==void 0&&p(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&p(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};var b={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`,503:`ServiceUnavailableError`}};function x(e){return e.usage(`$0 ai-search create <id>
|
|
5
|
+
|
|
6
|
+
Create a new AI Search instance with the given configuration. If type is omitted or null, a non-blank HTTP(S) source infers web-crawler and any other source infers r2; r2 sources must name an existing bucket. A missing or blank source without a type creates a managed upload-only instance.`).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`,default:172800}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead. Defaults to true for new instances; set false to create a vector-only instance.`}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).coerce(`indexing-options-keyword-tokenizer`,e=>h(e,`indexing-options-keyword-tokenizer`,`text`)).option(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric/datetime fields and 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. Defaults to 0.4.`}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index. When type is omitted, the source determines it.`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` because discover crawls only cover the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-content-selector`,{type:`string`,description:`List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. The crawler stores and indexes only the matched HTML fragment. Omit the field to disable content selection; the API rejects empty arrays. Provide as a JSON array of objects or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h). Defaults to 86400 (24h).`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`Data source type: r2 or web-crawler.`,choices:[`r2`,`web-crawler`]}).coerce(`type`,e=>h(e,`type`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{let t=[`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0);if(!e.body&&t){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index-method-* flag is set`)}return!0}).check(e=>{let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].some(t=>e[t]!==void 0);if(!e.body&&t){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-created-from-emdash-plugin-* flag is set`)}return!0})}const S={command:`create <id>`,describe:`Create an AI Search instance.`,builder:x,handler:async e=>l({command:`ai-search create`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.hybrid-search-enabled.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.type.dry-run`.split(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):d(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(b,{body:t,account_id:l,namespace:e.namespace}));o(r,{successLabel:`Created`});return}let p=m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]),g=await c(`Creating`,async()=>n.send(b,{body:p,account_id:l,namespace:e.namespace}));o(g,{successLabel:`Created`})})};function C(e){return e.usage(`$0 ai-search delete <instance-id>
|
|
7
|
+
|
|
8
|
+
Deletes an AI Search instance and all its indexed data permanently.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`delete <instance-id>`,describe:`Delete an AI Search instance.`,builder:C,handler:async e=>l({command:`ai-search delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Deleted`})})};function T(e){return e.usage(`$0 ai-search get <instance-id>
|
|
9
|
+
|
|
10
|
+
Retrieve the configuration and status of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get <instance-id>`,describe:`Get an AI Search instance.`,builder:T,handler:async e=>l({command:`ai-search get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Loaded`})})};function D(e){return e.usage(`$0 ai-search items chunks <item-id>
|
|
11
|
+
|
|
12
|
+
Lists chunks for a specific item in an AI Search instance, including their text content.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`chunks <item-id>`,describe:`List Item Chunks.`,builder:D,handler:async e=>l({command:`ai-search items chunks`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,offset:e.offset};if(e.dryRun){let t=await i();s({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/chunks`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/chunks`,{query:l}));o(f,{successLabel:`Loaded`})})};function k(e){return e.usage(`$0 ai-search items delete <item-id>
|
|
13
|
+
|
|
14
|
+
Deletes a file from a managed AI Search instance and removes its indexed data.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const A={command:`delete <item-id>`,describe:`Delete Item.`,builder:k,handler:async e=>l({command:`ai-search items delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Deleted`})})};function j(e){return e.usage(`$0 ai-search items download <item-id>
|
|
15
|
+
|
|
16
|
+
Downloads the raw file content for a specific item from the managed AI Search instance storage.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const M={command:`download <item-id>`,describe:`Download Item Content.`,builder:j,handler:async e=>l({command:`ai-search items download`,classification:{safeFlags:[`dry-run`,`text`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/download`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}await r(e);let n=e.local?t:await a();e.accountId=n;let o=await c(`Loading`,async()=>te(`/accounts/${n}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/download`,{method:`GET`,local:e.local===!0,persistTo:e.persistTo}));ee(e.text===!0?o.toString(`utf-8`):o)})};function N(e){return e.usage(`$0 ai-search items get <item-id>
|
|
17
|
+
|
|
18
|
+
Retrieves a specific indexed item from an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <item-id>`,describe:`Get Item.`,builder:N,handler:async e=>l({command:`ai-search items get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Loaded`})})};function F(e){return e.usage(`$0 ai-search items list
|
|
19
|
+
|
|
20
|
+
Lists indexed items in an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts items according to status priority, then last_seen_at. "modified_at" sorts items according to file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Return only items with this source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}.`}).option(`item-id`,{type:`string`,description:`Return only the item with this unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Return only items with this exact key (object key / filename). Each key is unique within a source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`Items List.`,builder:F,handler:async e=>l({command:`ai-search items list`,classification:{safeFlags:[`sort-by`,`status`,`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`],search:e.search,sort_by:e[`sort-by`],status:e.status,source:e.source,metadata_filter:e[`metadata-filter`],item_id:e[`item-id`],key:e.key};if(e.dryRun){let t=await i();s({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{query:l}));o(f,{successLabel:`Loaded`})})};function L(e){return e.usage(`$0 ai-search items logs <item-id>
|
|
21
|
+
|
|
22
|
+
Lists processing logs for a specific item in an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`logs <item-id>`,describe:`Item Logs.`,builder:L,handler:async e=>l({command:`ai-search items logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,cursor:e.cursor};if(e.dryRun){let t=await i();s({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})};function z(e){return e.usage(`$0 ai-search items sync <item-id>
|
|
23
|
+
|
|
24
|
+
Synchronizes an item to an AI Search instance index.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).coerce(`next-action`,e=>h(e,`next-action`,`text`)).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`sync <item-id>`,describe:`Sync Item.`,builder:z,handler:async e=>l({command:`ai-search items sync`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let f={};e[`next-action`]!==void 0&&p(f,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&p(f,[`wait_for_completion`],e[`wait-for-completion`]);let h=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:f}));o(h,{successLabel:`Updated`})})};function V(e){return e.usage(`$0 ai-search items upload <instance-id>
|
|
25
|
+
|
|
26
|
+
Uploads a file to a managed AI Search instance via multipart/form-data.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`})}const H={command:`upload <instance-id>`,describe:`Upload Item.`,builder:V,handler:async e=>l({command:`ai-search items upload`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,metadata:e.metadata,"wait-for-completion":e[`wait-for-completion`]}});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.file!==void 0||e.body!==void 0||e.metadata!==void 0||e[`wait-for-completion`]!==void 0){let t=new FormData;if(e.file){let n=g(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);e.metadata!==void 0&&t.append(`metadata`,String(h(e.metadata,`metadata`,`text`)??``)),e[`wait-for-completion`]!==void 0&&t.append(`wait_for_completion`,String(e[`wait-for-completion`]));let r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Created`})}else if(e.body){let t=h(e.body,`body`,`binary`),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t,headers:{"Content-Type":`multipart/form-data`}}));o(r,{successLabel:`Created`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function U(e){return e.usage(`$0 ai-search items upsert <instance-id>
|
|
27
|
+
|
|
28
|
+
Creates or updates an indexed item in an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).coerce(`next-action`,e=>h(e,`next-action`,`text`)).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`upsert <instance-id>`,describe:`Create or Update Item.`,builder:U,handler:async e=>l({command:`ai-search items upsert`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({key:h(e.key,`key`,`text`),next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Updated`});return}e.key===void 0&&(e.key=await _(`key`,`Item key / filename. Must not exceed 128 characters.`)),e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let f={};e.key!==void 0&&p(f,[`key`],h(e.key,`key`,`text`)),e[`next-action`]!==void 0&&p(f,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&p(f,[`wait_for_completion`],e[`wait-for-completion`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:f}));o(g,{successLabel:`Updated`})})},G={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).command(R).command(B).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.usage(`$0 ai-search jobs cancel <job-id>
|
|
29
|
+
|
|
30
|
+
Cancels an in-progress indexing job for an AI Search instance.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).coerce(`action`,e=>h(e,`action`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`cancel <job-id>`,describe:`Cancel an indexing job.`,builder:K,handler:async e=>l({command:`ai-search jobs cancel`,classification:{safeFlags:[`action`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({action:e.action}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation cancels the running indexing job.`}))return;if(e.body){let t=d(e.body),r=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:t}));o(r,{successLabel:`Deleted`});return}e.action===void 0&&(e.action=await v(`action`,`The action field`,[`cancel`]));let f={};e.action!==void 0&&p(f,[`action`],e.action);let h=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:f}));o(h,{successLabel:`Deleted`})})};function J(e){return e.usage(`$0 ai-search jobs create <instance-id>
|
|
31
|
+
|
|
32
|
+
Creates a new indexing job for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`description`,{type:`string`,description:`Optional description for the indexing job.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`create <instance-id>`,describe:`Create new job`,builder:J,handler:async e=>l({command:`ai-search jobs create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`)}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:t}));o(r,{successLabel:`Created`});return}let f={};e.description!==void 0&&p(f,[`description`],h(e.description,`description`,`text`));let g=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:f}));o(g,{successLabel:`Created`})})};function X(e){return e.usage(`$0 ai-search jobs get <job-id>
|
|
33
|
+
|
|
34
|
+
Retrieves details for a specific AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <job-id>`,describe:`Get a Job Details`,builder:X,handler:async e=>l({command:`ai-search jobs get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`));o(d,{successLabel:`Loaded`})})};function ae(e){return e.usage(`$0 ai-search jobs list
|
|
35
|
+
|
|
36
|
+
Lists indexing jobs for an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`List Jobs`,builder:ae,handler:async e=>l({command:`ai-search jobs list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{query:l}));o(f,{successLabel:`Loaded`})})};function se(e){return e.usage(`$0 ai-search jobs logs <job-id>
|
|
37
|
+
|
|
38
|
+
Lists log entries for an AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`logs <job-id>`,describe:`List Job Logs`,builder:se,handler:async e=>l({command:`ai-search jobs logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})},le={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(q).command(Y).command(ie).command(oe).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var ue={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,query:[`page`,`per_page`,`search`,`hostname`,`order_by`,`order_by_direction`],errors:{400:`BadRequestError`}};function de(e){return e.usage(`$0 ai-search list
|
|
39
|
+
|
|
40
|
+
Lists all AI Search instances in the account.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`hostname`,{type:`string`,description:`Return only instances with this exact Search for Agents hostname (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`list`,describe:`List AI Search instances.`,builder:de,handler:async e=>l({command:`ai-search list`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search,hostname:e.hostname,order_by:e[`order-by`],order_by_direction:e[`order-by-direction`]};if(e.dryRun){let t=await i();s({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(ue,{account_id:u,namespace:e.namespace,...n}));o(d,{successLabel:`Loaded`})})};function pe(e){return e.usage(`$0 ai-search move <instance-id>
|
|
41
|
+
|
|
42
|
+
Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`source-namespace`,{type:`string`,description:`Namespace currently containing the instance.`,default:`default`}).option(`destination-namespace`,{type:`string`,description:`Namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`move <instance-id>`,describe:`Move an instance to a different namespace.`,builder:pe,handler:async e=>l({command:`ai-search move`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e[`source-namespace`]==null?`<source-namespace>`:encodeURIComponent(String(e[`source-namespace`]))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{"source-namespace":String(e[`source-namespace`]??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({new_namespace:h(e[`destination-namespace`],`destination-namespace`,`text`)}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`destination-namespace`]===void 0&&(e[`destination-namespace`]=await _(`destination-namespace`,`Namespace to move the instance into.`));let f={};e[`destination-namespace`]!==void 0&&p(f,[`new_namespace`],h(e[`destination-namespace`],`destination-namespace`,`text`));let g=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:f}));o(g,{successLabel:`Updated`})})};function he(e){return e.usage(`$0 ai-search multi-chat-completions
|
|
43
|
+
|
|
44
|
+
Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at the lower of the first instance's score_threshold and 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the first instance's max_num_results, then 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`multi-chat-completions`,describe:`Multi-Instance Chat Completions`,builder:he,handler:async e=>l({command:`ai-search multi-chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/chat/completions`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&p(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.model!==void 0&&p(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&p(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};function _e(e){return e.usage(`$0 ai-search multi-search [query]
|
|
45
|
+
|
|
46
|
+
Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the sum of the searched instances' max_num_results (each falling back to 10), up to 50.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ve={command:`multi-search [query]`,describe:`Multi-Instance Search`,builder:_e,handler:async e=>l({command:`ai-search multi-search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/search`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&p(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:_}));o(v,{successLabel:`Created`})})};var Z={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`}};function ye(e){return e.usage(`$0 ai-search namespace create <namespace>
|
|
47
|
+
|
|
48
|
+
Create a namespace for organizing AI Search instances.`).positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must reference an existing instance in this namespace, and the list must stay within the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`create <namespace>`,describe:`Create a namespace`,builder:ye,handler:async e=>l({command:`ai-search namespace create`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}):d(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(Z,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}let u=m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}),f=await c(`Creating`,async()=>n.send(Z,{body:u,account_id:l}));o(f,{successLabel:`Created`})})};function xe(e){return e.usage(`$0 ai-search namespace delete <namespace>
|
|
49
|
+
|
|
50
|
+
Deletes a namespace permanently. The namespace must not contain any instances (instances whose deletion is still in progress do not count), and the default namespace cannot be deleted.`).positional(`namespace`,{type:`string`,description:`Namespace to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Se={command:`delete <namespace>`,describe:`Delete a namespace`,builder:xe,handler:async e=>l({command:`ai-search namespace delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the namespace.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Deleted`})})};function Ce(e){return e.usage(`$0 ai-search namespace get <namespace>
|
|
51
|
+
|
|
52
|
+
Retrieve a namespace and its description.`).positional(`namespace`,{type:`string`,description:`Namespace to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get <namespace>`,describe:`Get a namespace`,builder:Ce,handler:async e=>l({command:`ai-search namespace get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Loaded`})})};var Te={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ee(e){return e.usage(`$0 ai-search namespace list
|
|
53
|
+
|
|
54
|
+
Lists namespaces in the account, including their descriptions and creation times.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`List namespaces`,builder:Ee,handler:async e=>l({command:`ai-search namespace list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(Te,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Oe(e){return e.usage(`$0 ai-search namespace update <namespace>
|
|
55
|
+
|
|
56
|
+
Updates the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`).positional(`namespace`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must reference an existing instance in this namespace, and the list must stay within the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ke={command:`update <namespace>`,describe:`Update a namespace`,builder:Oe,handler:async e=>l({command:`ai-search namespace update`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}}}):d(e.body)});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:t}));o(r,{successLabel:`Updated`});return}let f={};e.description!==void 0&&p(f,[`description`],h(e.description,`description`,`text`)),e[`public-endpoint-params-authorized-hosts`]!==void 0&&p(f,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&p(f,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&p(f,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&p(f,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-instances-allowed`]!==void 0&&p(f,[`public_endpoint_params`,`instances_allowed`],e[`public-endpoint-params-instances-allowed`]),e[`public-endpoint-params-mcp-description`]!==void 0&&p(f,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&p(f,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&p(f,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:f}));o(g,{successLabel:`Updated`})})},Ae={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(be).command(Se).command(we).command(De).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.usage(`$0 ai-search purge-cache <instance-id>
|
|
57
|
+
|
|
58
|
+
Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`purge-cache <instance-id>`,describe:`Purge search cache.`,builder:je,handler:async e=>l({command:`ai-search purge-cache`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/purge_cache`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/purge_cache`));o(d,{successLabel:`Created`})})};function Ne(e){return e.usage(`$0 ai-search search <instance-id> [query]
|
|
59
|
+
|
|
60
|
+
Executes a semantic search query against an AI Search instance to find relevant indexed content.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Overrides the instance-level boost_by config. Direction defaults to 'asc' for numeric/datetime fields, 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pe={command:`search <instance-id> [query]`,describe:`Search`,builder:Ne,handler:async e=>l({command:`ai-search search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/search`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{boost_by:u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`),context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:u(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:t}));o(r,{successLabel:`Loaded`});return}let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&p(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&p(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&p(_,[`ai_search_options`,`custom_metadata`],f(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&p(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&p(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-boost-by`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`boost_by`],u(e[`ai-search-options-retrieval-boost-by`],`ai-search-options-retrieval-boost-by`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`filters`],f(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&p(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&p(_,[`messages`],u(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:_}));o(v,{successLabel:`Loaded`})})};function Fe(e){return e.usage(`$0 ai-search stats <instance-id>
|
|
61
|
+
|
|
62
|
+
Retrieve usage and indexing statistics for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`stats <instance-id>`,describe:`Get instance statistics.`,builder:Fe,handler:async e=>l({command:`ai-search stats`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/stats`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/stats`));o(d,{successLabel:`Loaded`})})};var Q={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,body:`json`,errors:{400:`BadRequestError`}};function Le(e){return e.usage(`$0 ai-search tokens create <name>
|
|
63
|
+
|
|
64
|
+
Create a stored Cloudflare credential for an AI Search instance to access its data source.`).positional(`name`,{type:`string`,description:`Human-readable name for the credential.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Re={command:`create <name>`,describe:`Create a token`,builder:Le,handler:async e=>l({command:`ai-search tokens create`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}):d(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),r=await c(`Creating`,async()=>n.send(Q,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`}));let u=m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}),f=await c(`Creating`,async()=>n.send(Q,{body:u,account_id:l}));o(f,{successLabel:`Created`})})};function ze(e){return e.usage(`$0 ai-search tokens delete <token-id>
|
|
65
|
+
|
|
66
|
+
Deletes a stored AI Search credential permanently. Credentials in use by an instance cannot be deleted.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Be={command:`delete <token-id>`,describe:`Delete a token`,builder:ze,handler:async e=>l({command:`ai-search tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the stored credential.`}))return;let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Deleted`})})};function Ve(e){return e.usage(`$0 ai-search tokens get <token-id>
|
|
67
|
+
|
|
68
|
+
Retrieve a stored AI Search credential without exposing its secret.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <token-id>`,describe:`Get a token`,builder:Ve,handler:async e=>l({command:`ai-search tokens get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Loaded`})})};var He={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ue(e){return e.usage(`$0 ai-search tokens list
|
|
69
|
+
|
|
70
|
+
Lists stored AI Search credentials in the account without exposing their secrets.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const We={command:`list`,describe:`List tokens`,builder:Ue,handler:async e=>l({command:`ai-search tokens list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(He,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Ge(e){return e.usage(`$0 ai-search tokens update <token-id>
|
|
71
|
+
|
|
72
|
+
Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`}).option(`name`,{type:`string`,description:`Human-readable name for the credential.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <token-id>`,describe:`Update a token`,builder:Ge,handler:async e=>l({command:`ai-search tokens update`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:h(e.name,`name`,`text`)}):d(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`})),e.name===void 0&&(e.name=await _(`name`,`Human-readable name for the credential.`));let f={};e[`api-token-id`]!==void 0&&p(f,[`cf_api_id`],h(e[`api-token-id`],`api-token-id`,`text`)),e[`api-token`]!==void 0&&p(f,[`cf_api_key`],h(e[`api-token`],`api-token`,`text`)),e.legacy!==void 0&&p(f,[`legacy`],e.legacy),e.name!==void 0&&p(f,[`name`],h(e.name,`name`,`text`));let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:f}));o(g,{successLabel:`Updated`})})},qe={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(Re).command(Be).command($).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.usage(`$0 ai-search update <instance-id>
|
|
73
|
+
|
|
74
|
+
Updates the configuration of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,default:`default`}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`}).option(`chunk`,{type:`boolean`,description:`The chunk field`}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`]}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).coerce(`indexing-options-keyword-tokenizer`,e=>h(e,`indexing-options-keyword-tokenizer`,`text`)).option(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`paused`,{type:`boolean`,description:`The paused field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`reranking`,{type:`boolean`,description:`The reranking field`}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-boost-by`,{type:`string`,description:`Metadata fields to boost search results by. Each entry specifies a metadata field and an optional direction. Direction defaults to 'asc' for numeric/datetime fields and 'exists' for text/boolean fields. Fields must match 'timestamp' or a defined custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`}).option(`score-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. Defaults to 0.4.`}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index.`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` because discover crawls only cover the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-content-selector`,{type:`string`,description:`List of path-to-selector mappings for extracting specific content from crawled pages. Each entry pairs a URL glob pattern with a CSS selector. The first matching path wins. The crawler stores and indexes only the matched HTML fragment. Omit the field to disable content selection; the API rejects empty arrays. Provide as a JSON array of objects or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`}).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h). Defaults to 86400 (24h).`}).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=>{let t=[`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0);if(!e.body&&t){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index-method-* flag is set`)}return!0}).check(e=>{let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].some(t=>e[t]!==void 0);if(!e.body&&t){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-created-from-emdash-plugin-* flag is set`)}return!0})}const Ye={command:`update <instance-id>`,describe:`Update an AI Search instance.`,builder:Je,handler:async e=>l({command:`ai-search update`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.paused.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.summarization.dry-run`.split(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:u(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:e.paused,public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{boost_by:u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`),keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{content_selector:u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`),include_headers:f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},summarization:e.summarization,summarization_model:h(e[`summarization-model`],`summarization-model`,`text`),sync_interval:e[`sync-interval`],system_prompt_ai_search:h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:h(e[`token-id`],`token-id`,`text`)},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):d(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=d(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}let _={};e[`ai-gateway-id`]!==void 0&&p(_,[`ai_gateway_id`],h(e[`ai-gateway-id`],`ai-gateway-id`,`text`)),e[`ai-search-model`]!==void 0&&p(_,[`ai_search_model`],h(e[`ai-search-model`],`ai-search-model`,`text`)),e.cache!==void 0&&p(_,[`cache`],e.cache),e[`cache-threshold`]!==void 0&&p(_,[`cache_threshold`],e[`cache-threshold`]),e[`cache-ttl`]!==void 0&&p(_,[`cache_ttl`],e[`cache-ttl`]),e.chunk!==void 0&&p(_,[`chunk`],e.chunk),e[`chunk-overlap`]!==void 0&&p(_,[`chunk_overlap`],e[`chunk-overlap`]),e[`chunk-size`]!==void 0&&p(_,[`chunk_size`],e[`chunk-size`]),e[`custom-metadata`]!==void 0&&p(_,[`custom_metadata`],u(e[`custom-metadata`],`custom-metadata`)),e[`embedding-model`]!==void 0&&p(_,[`embedding_model`],h(e[`embedding-model`],`embedding-model`,`text`)),e[`fusion-method`]!==void 0&&p(_,[`fusion_method`],e[`fusion-method`]),e[`index-method-keyword`]!==void 0&&p(_,[`index_method`,`keyword`],e[`index-method-keyword`]),e[`index-method-vector`]!==void 0&&p(_,[`index_method`,`vector`],e[`index-method-vector`]),e[`indexing-options-keyword-tokenizer`]!==void 0&&p(_,[`indexing_options`,`keyword_tokenizer`],e[`indexing-options-keyword-tokenizer`]),e[`indexing-options-use-ocr`]!==void 0&&p(_,[`indexing_options`,`use_ocr`],e[`indexing-options-use-ocr`]),e[`max-num-results`]!==void 0&&p(_,[`max_num_results`],e[`max-num-results`]),e[`metadata-created-from-aisearch-wizard`]!==void 0&&p(_,[`metadata`,`created_from_aisearch_wizard`],e[`metadata-created-from-aisearch-wizard`]),e[`metadata-created-from-emdash-plugin-type`]!==void 0&&p(_,[`metadata`,`created_from_emdash_plugin`,`type`],e[`metadata-created-from-emdash-plugin-type`]),e[`metadata-created-from-emdash-plugin-version`]!==void 0&&p(_,[`metadata`,`created_from_emdash_plugin`,`version`],h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)),e[`metadata-worker-domain`]!==void 0&&p(_,[`metadata`,`worker_domain`],h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)),e.paused!==void 0&&p(_,[`paused`],e.paused),e[`public-endpoint-params-authorized-hosts`]!==void 0&&p(_,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&p(_,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&p(_,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&p(_,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-mcp-description`]!==void 0&&p(_,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&p(_,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&p(_,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]),e.reranking!==void 0&&p(_,[`reranking`],e.reranking),e[`reranking-model`]!==void 0&&p(_,[`reranking_model`],h(e[`reranking-model`],`reranking-model`,`text`)),e[`retrieval-options-boost-by`]!==void 0&&p(_,[`retrieval_options`,`boost_by`],u(e[`retrieval-options-boost-by`],`retrieval-options-boost-by`)),e[`retrieval-options-keyword-match-mode`]!==void 0&&p(_,[`retrieval_options`,`keyword_match_mode`],e[`retrieval-options-keyword-match-mode`]),e[`rewrite-model`]!==void 0&&p(_,[`rewrite_model`],h(e[`rewrite-model`],`rewrite-model`,`text`)),e[`rewrite-query`]!==void 0&&p(_,[`rewrite_query`],e[`rewrite-query`]),e[`score-threshold`]!==void 0&&p(_,[`score_threshold`],e[`score-threshold`]),e.source!==void 0&&p(_,[`source`],h(e.source,`source`,`text`)),e[`source-params-exclude-items`]!==void 0&&p(_,[`source_params`,`exclude_items`],e[`source-params-exclude-items`]),e[`source-params-include-items`]!==void 0&&p(_,[`source_params`,`include_items`],e[`source-params-include-items`]),e[`source-params-prefix`]!==void 0&&p(_,[`source_params`,`prefix`],h(e[`source-params-prefix`],`source-params-prefix`,`text`)),e[`source-params-r2-jurisdiction`]!==void 0&&p(_,[`source_params`,`r2_jurisdiction`],h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`)),e[`source-params-web-crawler-discover-options-depth`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`depth`],e[`source-params-web-crawler-discover-options-depth`]),e[`source-params-web-crawler-discover-options-include-external-links`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`include_external_links`],e[`source-params-web-crawler-discover-options-include-external-links`]),e[`source-params-web-crawler-discover-options-include-subdomains`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`include_subdomains`],e[`source-params-web-crawler-discover-options-include-subdomains`]),e[`source-params-web-crawler-discover-options-limit`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`limit`],e[`source-params-web-crawler-discover-options-limit`]),e[`source-params-web-crawler-discover-options-max-age`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`max_age`],e[`source-params-web-crawler-discover-options-max-age`]),e[`source-params-web-crawler-discover-options-source`]!==void 0&&p(_,[`source_params`,`web_crawler`,`discover_options`,`source`],e[`source-params-web-crawler-discover-options-source`]),e[`source-params-web-crawler-parse-options-content-selector`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`content_selector`],u(e[`source-params-web-crawler-parse-options-content-selector`],`source-params-web-crawler-parse-options-content-selector`)),e[`source-params-web-crawler-parse-options-include-headers`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`include_headers`],f(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`)),e[`source-params-web-crawler-parse-options-include-images`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`include_images`],e[`source-params-web-crawler-parse-options-include-images`]),e[`source-params-web-crawler-parse-options-specific-sitemaps`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`specific_sitemaps`],e[`source-params-web-crawler-parse-options-specific-sitemaps`]),e[`source-params-web-crawler-parse-options-use-browser-rendering`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_options`,`use_browser_rendering`],e[`source-params-web-crawler-parse-options-use-browser-rendering`]),e[`source-params-web-crawler-parse-type`]!==void 0&&p(_,[`source_params`,`web_crawler`,`parse_type`],e[`source-params-web-crawler-parse-type`]),e.summarization!==void 0&&p(_,[`summarization`],e.summarization),e[`summarization-model`]!==void 0&&p(_,[`summarization_model`],h(e[`summarization-model`],`summarization-model`,`text`)),e[`sync-interval`]!==void 0&&p(_,[`sync_interval`],e[`sync-interval`]),e[`system-prompt-ai-search`]!==void 0&&p(_,[`system_prompt_ai_search`],h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`)),e[`system-prompt-index-summarization`]!==void 0&&p(_,[`system_prompt_index_summarization`],h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`)),e[`system-prompt-rewrite-query`]!==void 0&&p(_,[`system_prompt_rewrite_query`],h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`)),e[`token-id`]!==void 0&&p(_,[`token_id`],h(e[`token-id`],`token-id`,`text`));let v=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:_}));o(v,{successLabel:`Updated`})})},Xe={command:`ai-search`,describe:`Managed search-as-a-service: crawl, index, and query content with AI-powered relevance and chat completions`,builder:e=>e.command(re).command(S).command(w).command(E).command(fe).command(me).command(ge).command(ve).command(Me).command(Pe).command(Ie).command(Ye).command(G).command(le).command(Ae).command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Xe as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{n as t}from"./auth-
|
|
2
|
+
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{n as t}from"./auth-FK2eLQ02.mjs";import{i as n}from"./context-Dp4CXG22.mjs";import{t as r}from"./output-BJEgbI0G.mjs";import{t as i}from"./dry-run-gy0Hl9xo.mjs";import{t as a}from"./progress-DLri-rA7.mjs";import{t as o}from"./run-Ciw_GIrC.mjs";import"./telemetry-Pt5GpCKD.mjs";import{a as s,n as c,t as l}from"./body-parser-BKcZS9iJ.mjs";import{n as u}from"./prompt-D0dXwuME.mjs";var d={method:`GET`,path:t=>e`/zones/${t.zone_id}/ai-security/custom-topics`};function f(e){return e.usage(`$0 ai-security custom-topics get
|
|
3
3
|
|
|
4
4
|
Get the custom topic categories defined for the zone. While AI Security for Apps is enabled, it scores every incoming prompt against these topics and writes the scores to the \`cf.llm.prompt.custom_topic_categories\` field, keyed by topic label. Topics can be configured while the detection is disabled, but no prompt is scored until you enable it.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const p={command:`get`,describe:`Get the AI Security for Apps custom topics of a zone.`,builder:f,handler:async e=>o({command:`ai-security custom-topics get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){i({command:`cf ai-security custom-topics get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(e),s=await n({zone:e.zone},o,{quiet:e.quiet});e.zoneId=s;let c=await a(`Loading`,async()=>o.send(d,{zone_id:s}));r(c,{successLabel:`Loaded`})})};var m={method:`PUT`,path:t=>e`/zones/${t.zone_id}/ai-security/custom-topics`,body:`json`};function h(e){return e.usage("$0 ai-security custom-topics update\n\nUpdate the custom topic list of the zone, overwriting it entirely with the topics in the request, so include every topic you want to keep. Changes can take up to a minute to propagate. Each entry has a `label`, used to reference the topic in rule expressions and analytics, and a `topic` description, which the classifier scores prompts against while AI Security for Apps is enabled. The following rules apply: - A zone can hold at most 20 topics. - `label` must be 2–20 characters, using only lowercase letters (a–z), digits (0–9), and hyphens. - `topic` must be 2–50 UTF-8 bytes. Text in any language is supported, including spaces, numbers, punctuation, and symbols. Tabs, line breaks, invalid text, and invisible formatting characters are not allowed. - Labels must be unique within the zone, and so must topic descriptions.").option(`topics`,{type:`string`,description:`Custom topic categories for AI Security for Apps content detection. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`update`,describe:`Update the AI Security for Apps custom topics of a zone.`,builder:h,handler:async e=>o({command:`ai-security custom-topics update`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){i({command:`cf ai-security custom-topics update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/ai-security/custom-topics`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?l({topics:s(e.topics,`topics`)}):c(e.body)});return}let o=await t(e),d=await n({zone:e.zone},o,{quiet:e.quiet});if(e.zoneId=d,!await u({force:!!e.force,message:`This operation overwrites the AI Security for Apps custom topics for a zone.`}))return;if(e.body){let t=c(e.body),n=await a(`Deleting`,async()=>o.send(m,{body:t,zone_id:d}));r(n,{successLabel:`Deleted`});return}let f=l({topics:s(e.topics,`topics`)}),p=await a(`Deleting`,async()=>o.send(m,{body:f,zone_id:d}));r(p,{successLabel:`Deleted`})})},_={command:`custom-topics`,describe:`Organization-specific topic categories used by AI Security for Apps content detection`,builder:e=>e.command(p).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var v={method:`GET`,path:t=>e`/zones/${t.zone_id}/ai-security/settings`};function y(e){return e.usage(`$0 ai-security get
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-
|
|
2
|
+
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CgBhtmON.mjs";import{n}from"./auth-FK2eLQ02.mjs";import{a as r,t as i}from"./context-Dp4CXG22.mjs";import{t as a}from"./output-BJEgbI0G.mjs";import{t as o}from"./dry-run-gy0Hl9xo.mjs";import{t as s}from"./progress-DLri-rA7.mjs";import{t as c}from"./run-Ciw_GIrC.mjs";import"./telemetry-Pt5GpCKD.mjs";import{a as l,n as u,t as d}from"./body-parser-BKcZS9iJ.mjs";import{n as f}from"./input-validation-D7z60HJH.mjs";import{a as p,i as m,n as h}from"./prompt-D0dXwuME.mjs";import{n as g,t as _}from"./raw-fetch-DQeDx1wT.mjs";var v={method:`GET`,path:t=>e`/accounts/${t.account_id}/alerting/v3/available_alerts`};function y(e){return e.usage(`$0 alerting available-alerts list
|
|
3
3
|
|
|
4
4
|
Gets a list of all alert types for which an account is eligible.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`list`,describe:`Get Alert Types`,builder:y,handler:async e=>c({command:`alerting available-alerts list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let e=await r();o({command:`cf alerting available-alerts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/alerting/v3/available_alerts`,pathParams:{},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();e.accountId=l;let u=await s(`Loading`,async()=>c.send(v,{account_id:l}));a(u,{successLabel:`Loaded`})})},te={command:`available-alerts`,describe:`Operations for available-alerts`,builder:e=>e.command(ee).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var ne={method:`GET`,path:t=>e`/accounts/${t.account_id}/alerting/v3/destinations/eligible`};function re(e){return e.usage(`$0 alerting destinations eligible get
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-
|
|
2
|
+
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CgBhtmON.mjs";import{n}from"./auth-FK2eLQ02.mjs";import{a as r,i,t as a}from"./context-Dp4CXG22.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-DLri-rA7.mjs";import{t as l}from"./run-Ciw_GIrC.mjs";import"./telemetry-Pt5GpCKD.mjs";import{a as u,n as d,t as f}from"./body-parser-BKcZS9iJ.mjs";import{n as p}from"./input-validation-D7z60HJH.mjs";import{a as m}from"./prompt-D0dXwuME.mjs";var h={method:`GET`,path:t=>e`/zones/${t.zone_id}/analytics/latency/colos`};function g(e){return e.usage(`$0 analytics latency colos get
|
|
3
3
|
|
|
4
4
|
Retrieves Argo Smart Routing analytics broken down by geographic points of presence (PoPs). Shows latency improvements and routing efficiency per location.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Argo Analytics for a zone at different PoPs`,builder:g,handler:async e=>l({command:`analytics latency colos get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){s({command:`cf analytics latency colos get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/analytics/latency/colos`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),r=await i({zone:e.zone},t,{quiet:e.quiet});e.zoneId=r;let a=await c(`Loading`,async()=>t.send(h,{zone_id:r}));o(a,{successLabel:`Loaded`})})},v={command:`colos`,describe:`Operations for latency.colos`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var y={method:`GET`,path:t=>e`/zones/${t.zone_id}/analytics/latency`,query:[`bins`]};function b(e){return e.usage(`$0 analytics latency get
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ Returns aggregate current-period and previous-period totals for CASB findings.`)
|
|
|
11
11
|
|
|
12
12
|
Returns merged time-bucketed CASB findings.`).option(`filters`,{type:`string`,description:`Filters to apply. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:`Start of the query time range (inclusive). RFC3339.`}).option(`to`,{type:`string`,description:`End of the query time range (exclusive). RFC3339.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Query for findings timeseries.`})}const M={command:`timeseries`,describe:`Data security findings timeseries`,builder:j,handler:async e=>l({command:`analytics query data-security findings timeseries`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query data-security findings timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/data-security/findings/timeseries`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(A,{body:t,account_id:l}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);e.from===void 0&&(e.from=await m(`from`,`Start of the query time range (inclusive). RFC3339.`)),e.to===void 0&&(e.to=await m(`to`,`End of the query time range (exclusive). RFC3339.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(A,{body:h,account_id:l}));o(g,{successLabel:`Created`})})},N={command:`findings`,describe:`Operations for query.data-security.findings`,builder:e=>e.command(k).command(M).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},P={command:`data-security`,describe:`Operations for query.data-security`,builder:e=>e.command(E).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var F={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/summary`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function I(e){return e.usage(`$0 analytics query summary <dataset>
|
|
13
13
|
|
|
14
|
-
Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`
|
|
15
|
-
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`
|
|
14
|
+
Returns aggregate summary stats for a dataset. Includes current-period and previous-period totals for trend comparison.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const L={command:`summary <dataset>`,describe:`Query analytics summary`,builder:I,handler:async e=>l({command:`analytics query summary`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/summary`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(F,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`)}),g=await c(`Creating`,async()=>i.send(F,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})};var R={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/timeseries`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function z(e){return e.usage("$0 analytics query timeseries <dataset>\n\nReturns time-bucketed analytics data for a dataset. Includes time slots, each containing the requested stats, group-by dimensions, and resolution-controlled bucket size (e.g. `hour`, `day`).").positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`resolution`,{type:`string`,description:`Time bucket size for grouping results. Controls the granularity of the returned time slots.
|
|
15
|
+
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`timeseries <dataset>`,describe:`Query analytics timeseries`,builder:z,handler:async e=>l({command:`analytics query timeseries`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query timeseries`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/timeseries`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),resolution:p(e.resolution,`resolution`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(R,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),e.resolution===void 0&&(e.resolution=await m(`resolution`,`Time bucket size for grouping results. Controls the granularity of the returned time slots. `));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),resolution:p(e.resolution,`resolution`,`text`)}),g=await c(`Creating`,async()=>i.send(R,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})};var V={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics/query/${t.dataset}/top-n`,body:`json`,errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`}};function H(e){return e.usage(`$0 analytics query top-n <dataset>
|
|
16
16
|
|
|
17
|
-
Returns the top N results for a dataset by a specified stat. Includes an array of result rows, each containing the requested stats and group-by dimensions.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`limit`,{type:`number`,description:`Maximum number of results to return.`}).option(`order-by`,{type:`string`,description:`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`
|
|
17
|
+
Returns the top N results for a dataset by a specified stat. Includes an array of result rows, each containing the requested stats and group-by dimensions.`).positional(`dataset`,{type:`string`,description:"Dataset name to query. Examples: `access-logins`, `gateway-http`, `gateway-dns`, `gateway-http`, `shadow-it`.",demandOption:!0}).option(`filters`,{type:`string`,description:`Filters to apply before aggregating results. Provide as a JSON array of objects or @path/to/file.json.`}).option(`from`,{type:`string`,description:"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`)."}).option(`group-by`,{type:`string`,array:!0,description:`Specifies the column names to group results by. Requires valid columns for the target dataset.`}).option(`stats`,{type:`string`,array:!0,description:"Specifies the stat names to include in results. Requires valid stats for the target dataset (e.g. `attemptsTotal`, `bytesTotal`)."}).option(`to`,{type:`string`,description:`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`}).option(`limit`,{type:`number`,description:`Maximum number of results to return.`}).option(`order-by`,{type:`string`,description:`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`top-n <dataset>`,describe:`Query analytics top-N`,builder:H,handler:async e=>l({command:`analytics query top-n`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();s({command:`cf analytics query top-n`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics/query/${e.dataset==null?`<dataset>`:encodeURIComponent(String(e.dataset))}/top-n`,pathParams:{dataset:String(e.dataset??``)},bodyKind:`json`,body:e.body===void 0?f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),n:e.limit,orderBy:p(e[`order-by`],`order-by`,`text`)}):d(e.body)});return}let i=await n(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=d(e.body),n=await c(`Creating`,async()=>i.send(V,{body:t,account_id:l,dataset:e.dataset}));o(n,{successLabel:`Created`});return}if(e.filters===void 0)throw Error(`--filters is required (or pass --body with this field set).`);if(e.from===void 0&&(e.from=await m(`from`,"The start of the query time range (inclusive). RFC3339 format with timezone is required (e.g. `2024-11-05T00:00:00Z`).")),e[`group-by`]===void 0)throw Error(`--group-by is required (or pass --body with this field set).`);if(e.stats===void 0)throw Error(`--stats is required (or pass --body with this field set).`);if(e.to===void 0&&(e.to=await m(`to`,`Specifies the end of the query time range (exclusive). Requires RFC3339 format with timezone.`)),e.limit===void 0)throw Error(`--limit is required (or pass --body with this field set).`);e[`order-by`]===void 0&&(e[`order-by`]=await m(`order-by`,`Specifies the stat name for sorting results in descending order. Requires a valid stat for the target dataset.`));let h=f({filters:u(e.filters,`filters`),from:p(e.from,`from`,`text`),groupBy:e[`group-by`],stats:e.stats,to:p(e.to,`to`,`text`),n:e.limit,orderBy:p(e[`order-by`],`order-by`,`text`)}),g=await c(`Creating`,async()=>i.send(V,{body:h,account_id:l,dataset:e.dataset}));o(g,{successLabel:`Created`})})},W={command:`query`,describe:`Operations for query`,builder:e=>e.command(L).command(B).command(U).command(P).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},G={command:`analytics`,describe:`Zone-level traffic analytics — dashboard summaries, per-colo breakdowns, and Argo latency metrics`,builder:e=>e.command(S).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{G as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-
|
|
2
|
+
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CgBhtmON.mjs";import{i as n,n as r}from"./auth-FK2eLQ02.mjs";import{a as i,t as a}from"./context-Dp4CXG22.mjs";import{t as o}from"./output-BJEgbI0G.mjs";import{t as s}from"./dry-run-gy0Hl9xo.mjs";import{t as c}from"./progress-DLri-rA7.mjs";import{t as l}from"./run-Ciw_GIrC.mjs";import"./telemetry-Pt5GpCKD.mjs";import{n as u,t as d}from"./input-validation-D7z60HJH.mjs";var f={method:`POST`,path:t=>e`/accounts/${t.account_id}/analytics_engine/sql`,errors:{400:`BadRequestError`,403:`ForbiddenError`,422:`UnprocessableEntityError`,429:`TooManyRequestsError`,500:`InternalServerError`,503:`ServiceUnavailableError`,504:`GatewayTimeoutError`}};function p(e){return e.usage(`$0 analytics-engine sql query
|
|
3
3
|
|
|
4
4
|
Executes a SQL query against Workers Analytics Engine data. Pass the SQL query in the request body as plain text. The response uses newline-delimited JSON (NDJSON) by default, or a single JSON object when the query includes a FORMAT JSON clause. Prefer this method for longer queries that may exceed URL length limits.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const m={command:`query`,describe:`Execute an Analytics Engine SQL query via request body`,builder:p,handler:async e=>l({command:`analytics-engine sql query`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf analytics-engine sql query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/analytics_engine/sql`,pathParams:{},bodyKind:`octet-stream`,body:e.body});return}let l=await r(e),p=e.local?t:await a();if(e.accountId=p,e.file){let t=d(e.file),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${p}/analytics_engine/sql`,{body:t,headers:{"Content-Type":`text/plain`}}));o(r,{successLabel:`Loaded`});return}if(e.body){let t=u(e.body,`body`,`binary`),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${p}/analytics_engine/sql`,{body:t,headers:{"Content-Type":`text/plain`}}));o(r,{successLabel:`Loaded`});return}let m=await c(`Loading`,async()=>l.send(f,{account_id:p}));o(m,{successLabel:`Loaded`})})},h={command:`sql`,describe:`Operations for sql`,builder:e=>e.command(m).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},g={command:`analytics-engine`,describe:`analytics-engine`,builder:e=>e.command(h).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{g as default};
|