cf 1.0.0-beta.13 → 1.0.0-beta.14
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 +1562 -1776
- package/dist/_meta/hand-written-commands.json +342 -22
- package/dist/_meta/schemas.json +611 -956
- package/dist/abuse-reports-CVv52Q2w.mjs +24 -0
- package/dist/access-k1QjF5rE.mjs +2 -0
- package/dist/{account-tags-CaXDDeZ4.mjs → account-tags-RhvWOkOf.mjs} +4 -4
- package/dist/{accounts-BALwxDQY.mjs → accounts--3lrEkmu.mjs} +9 -15
- package/dist/{acm-CP9EaXQN.mjs → acm-BJxINEcu.mjs} +2 -2
- package/dist/{addressing-DRlaxqrI.mjs → addressing-BqByG9JW.mjs} +55 -43
- package/dist/{agent-memory-vGhlfZBx.mjs → agent-memory-D4dQMGbh.mjs} +2 -2
- package/dist/{ai-CJtbWfB9.mjs → ai-CRkQ4pjC.mjs} +1 -1
- package/dist/{ai-audit-C0BJNqZZ.mjs → ai-audit-fMSn4c5L.mjs} +1 -1
- package/dist/{ai-gateway-BQtv3U3x.mjs → ai-gateway-CbhvQK4L.mjs} +4 -4
- package/dist/ai-search-CvVSnOA0.mjs +79 -0
- package/dist/{ai-security-CFTaYk_X.mjs → ai-security-Z_qpI92I.mjs} +1 -1
- package/dist/{alerting-1hun27JC.mjs → alerting-CpbCB8br.mjs} +3 -3
- package/dist/{analytics-DXUSjvzT.mjs → analytics-DkY9dOP1.mjs} +3 -3
- package/dist/{analytics_engine-CQsnL09C.mjs → analytics_engine-DE_jvlx_.mjs} +1 -1
- package/dist/{api-security-BXhrfR6-.mjs → api-security-BHnOU5MM.mjs} +25 -25
- package/dist/{argo-LPUCTnee.mjs → argo-DhC5L_aN.mjs} +3 -3
- package/dist/{artifacts-Dt6easua.mjs → artifacts-CrIupY7P.mjs} +3 -3
- package/dist/{audit-logs-CVznAM2Z.mjs → audit-logs-BjeBxTox.mjs} +1 -1
- package/dist/{auth-eQr-kQCH.mjs → auth-BNYfOMl0.mjs} +1 -1
- package/dist/{auth-CGLsxbc6.mjs → auth-CAWalgW0.mjs} +1 -1
- package/dist/auth-DOwC01PW.mjs +2 -0
- package/dist/{auth-token-pNQrX_9O.mjs → auth-token-Dop0wLCw.mjs} +1 -1
- package/dist/{autoconfig-sD7Frryg.mjs → autoconfig-RQ3HS4m1.mjs} +1 -1
- package/dist/{basin-catalog-ZQICw-zF.mjs → basin-catalog-DZ7QV-_N.mjs} +3 -3
- package/dist/{billing-Dy1-dV_B.mjs → billing-BFyte9fL.mjs} +3 -3
- package/dist/bot-management-DXcbV3am.mjs +9 -0
- package/dist/{botnet-feed-xb98Cj3Y.mjs → botnet-feed-bGGp_cwX.mjs} +1 -1
- package/dist/{brand-protection-Ck3okE2k.mjs → brand-protection-DN36XkxH.mjs} +2 -2
- package/dist/{browser-run-DJGJSzFX.mjs → browser-run-hHD1RT43.mjs} +3 -3
- package/dist/build-BhpWYgNm.mjs +2 -0
- package/dist/{build-HmSXqjGn.mjs → build-CCe7IrWT.mjs} +1 -1
- package/dist/{builds-CYxcZtkG.mjs → builds-6aO61R9R.mjs} +4 -4
- package/dist/{cache-D9tSfovH.mjs → cache-C5YJpMqi.mjs} +6 -6
- package/dist/{certificate-authorities-CpiveTFC.mjs → certificate-authorities-CbqDAktQ.mjs} +1 -1
- package/dist/{cf-BxsXrVeh.mjs → cf-oRSQKirD.mjs} +1 -1
- package/dist/{chunk-DSGVRFIS-C1_SEtRK.mjs → chunk-DSGVRFIS-CPI5cYtB.mjs} +1 -1
- package/dist/{chunk-NDZDTP46-Bjx_wtJe.mjs → chunk-NDZDTP46-Civns3WA.mjs} +1 -1
- package/dist/{cli-DeJc9U8z.mjs → cli-ht4q6i2y.mjs} +1 -1
- package/dist/{client-certificates-CF6YZyvP.mjs → client-certificates-balaN_my.mjs} +1 -1
- package/dist/{client-side-security-BLoe9kS5.mjs → client-side-security-3_4Ermmg.mjs} +3 -3
- package/dist/{cloud-connector-DXRUHsjt.mjs → cloud-connector-avx27sLw.mjs} +1 -1
- package/dist/{cloudflared--1Ws1RJy.mjs → cloudflared-D83U8Yn3.mjs} +1 -1
- package/dist/{cloudforce-one-CBLxXi6v.mjs → cloudforce-one-CXdeqJ9l.mjs} +126 -168
- package/dist/{command-Dh7RmjFu.mjs → command-9VAc7b30.mjs} +1 -1
- package/dist/{command-Cu7dcaHT.mjs → command-B_Ixlz8Q.mjs} +1 -1
- package/dist/{command-oNVwyjGB.mjs → command-BtDY_MKv.mjs} +1 -1
- package/dist/{command-CG6RvZs0.mjs → command-CUNMrMou.mjs} +1 -1
- package/dist/{command-D3fyhdy-.mjs → command-Ckb9FufU.mjs} +1 -1
- package/dist/{command-BDe67N_n.mjs → command-CtVUNm__.mjs} +1 -1
- package/dist/{command-DUhX8Dcr.mjs → command-CyJQ40fc.mjs} +1 -1
- package/dist/{command-UiHLJ8Ji.mjs → command-DPX9sJVi.mjs} +1 -1
- package/dist/{command-BlIb6RR2.mjs → command-DXaRn1ls.mjs} +1 -1
- package/dist/{command-CcuLC6CJ.mjs → command-DjEJaOwV.mjs} +1 -1
- package/dist/{command-_rqD0hXF.mjs → command-DtgJilOK.mjs} +1 -1
- package/dist/{command-BvfKhMl7.mjs → command-OHov3PEc.mjs} +1 -1
- package/dist/{command-DwXiDOeH.mjs → command-OWe3v69l.mjs} +1 -1
- package/dist/{command-83uVfXh9.mjs → command-SmWD-MeI.mjs} +1 -1
- package/dist/{completions-D06AO7A8.mjs → completions-CuqAO3N_.mjs} +1 -1
- package/dist/{connector-interrupts-DelTmNyw.mjs → connector-interrupts-ftd10Du-.mjs} +1 -1
- package/dist/{connector-telemetry-events-BwxR3G8d.mjs → connector-telemetry-events-TwDZYdEM.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-Bqq-hrpJ.mjs → connector-telemetry-snapshots-CZxkOuC3.mjs} +1 -1
- package/dist/{connectors-D-m3rEpk.mjs → connectors-6lVSr-fd.mjs} +1 -1
- package/dist/containers-Dqs_ZnO2.mjs +78 -0
- package/dist/containers-ncw3bd3a.mjs +376 -0
- package/dist/{content-scan-W0BNzbQp.mjs → content-scan-BWFbqfQ0.mjs} +3 -3
- package/dist/{context-q7UaYK69.mjs → context-BBLtgdR1.mjs} +1 -1
- package/dist/{cps-BZ6hqRb5.mjs → cps-C5phNoVU.mjs} +2 -2
- package/dist/{csamScanner-Bo1t3CLh.mjs → csamScanner-BwZNZu0A.mjs} +3 -3
- package/dist/{ct-alerting-E03faC7p.mjs → ct-alerting-DPp3qLqO.mjs} +1 -1
- package/dist/{custom-certificates-CUySSPzi.mjs → custom-certificates-pfpZcr06.mjs} +5 -5
- package/dist/{custom-csrs-gNpWkJPQ.mjs → custom-csrs-DrvGRAkl.mjs} +2 -2
- package/dist/{custom-hostnames-abGBAbx7.mjs → custom-hostnames-wGtmFbz1.mjs} +3 -3
- package/dist/{custom-nameservers-BgNXol1P.mjs → custom-nameservers-HTG6MPKv.mjs} +1 -1
- package/dist/{custom-pages-DMKX3aoD.mjs → custom-pages-DqEHBSVt.mjs} +2 -2
- package/dist/d1-EQMUlHTJ.mjs +94 -0
- package/dist/{dcv-delegation-B5YUEWu0.mjs → dcv-delegation-D6nj0Z5N.mjs} +1 -1
- package/dist/{deploy-CWNm1-5v.mjs → deploy-B22sEVHd.mjs} +1 -1
- package/dist/{deploy-context-Dr6bxNcB.mjs → deploy-context-DmG9rgPO.mjs} +1 -1
- package/dist/{deploy-input-Cc0_2QlW.mjs → deploy-input-BCjcuP6u.mjs} +1 -1
- package/dist/{dev-ZA8itQE7.mjs → dev-ClhhXuNU.mjs} +1 -1
- package/dist/diagnostics-tqHjq-Pl.mjs +15 -0
- package/dist/dist-DmRM6WSZ.mjs +449 -0
- package/dist/{dls-DIl16mLp.mjs → dls-BEHj4X9T.mjs} +1 -1
- package/dist/{dns-firewall-BZwJXHLj.mjs → dns-firewall-zwbkutyf.mjs} +1 -1
- package/dist/{dns-QUpgljRG.mjs → dns-n4mfYBZg.mjs} +3 -3
- package/dist/{durable-objects-BCj4ykpU.mjs → durable-objects-CQ2dHhho.mjs} +1 -1
- package/dist/{email-auth-DlHIYhCk.mjs → email-auth-DOi6yOt3.mjs} +1 -1
- package/dist/{email-routing-UKVS4DYy.mjs → email-routing-WcSPt22u.mjs} +5 -5
- package/dist/{email-security-CZjfRIg0.mjs → email-security-BXu3OGay.mjs} +15 -15
- package/dist/{email-sending-Dquc880C.mjs → email-sending-B9zTlIjt.mjs} +2 -2
- package/dist/{fieldExtractors-BbwDRquU.mjs → fieldExtractors-B37m2lKW.mjs} +1 -1
- package/dist/{firewall--mTfDnCJ.mjs → firewall-CRtYO0Ha.mjs} +5 -5
- package/dist/{flagship-cfoSwwM9.mjs → flagship-DvTFZSay.mjs} +3 -3
- package/dist/{fraud-Dcsq3EYK.mjs → fraud-uSyibsit.mjs} +5 -5
- package/dist/{google-tag-gateway-DPKSkZQi.mjs → google-tag-gateway-BFXiiokq.mjs} +1 -1
- package/dist/hand-written-dry-run-B82fRl2N.mjs +2 -0
- package/dist/{healthchecks-D78hIIBC.mjs → healthchecks-27u7b7Jb.mjs} +5 -5
- package/dist/{hostnames-sF999-6H.mjs → hostnames-DvaUSzsj.mjs} +1 -1
- package/dist/hyperdrive-BzJvPdu6.mjs +37 -0
- package/dist/{iam-Bvg_PayW.mjs → iam-Dl3cU9GI.mjs} +1 -1
- package/dist/{images-DI_lEZ4L.mjs → images-C2OkI1j7.mjs} +6 -6
- package/dist/index.mjs +1 -1
- package/dist/{init-1w_mcgk3.mjs → init-Da8pe296.mjs} +1 -1
- package/dist/{intel-BxElBUMP.mjs → intel-DoB1g_K7.mjs} +2 -2
- package/dist/{ips-DWoaKxi7.mjs → ips-BRt68epr.mjs} +1 -1
- package/dist/{k2-tFjaftl-.mjs → k2-_eq5ZY2t.mjs} +1 -1
- package/dist/{keyless-certificates-BrvxHU4J.mjs → keyless-certificates-DaO2yqYu.mjs} +2 -2
- package/dist/{keys-DcwTYKRf.mjs → keys-7BQ3Zq6Y.mjs} +1 -1
- package/dist/{kv-htXS-7uP.mjs → kv-BTYCXKML.mjs} +4 -4
- package/dist/{lazy-command-BDiIwpss.mjs → lazy-command-CDWwCsD2.mjs} +1 -1
- package/dist/{leaked-credential-checks-bvGrLOmQ.mjs → leaked-credential-checks-CPHOK_dE.mjs} +1 -1
- package/dist/load-balancers-Bu9pd2SV.mjs +76 -0
- package/dist/{local-DlT72Xpn.mjs → local-BcPM4I0s.mjs} +1 -1
- package/dist/local-BundUuDT.mjs +2 -0
- package/dist/{local-runtime-CokO6qaX.mjs → local-runtime-BHKyRlCP.mjs} +1 -1
- package/dist/{login-Ccw-mYwT.mjs → login-BBYC_BtH.mjs} +1 -1
- package/dist/{login-BGF_I_LT.mjs → login-D2uoWhWh.mjs} +1 -1
- package/dist/{logo-matches-tE8LTKgg.mjs → logo-matches-Bc1DQ4-g.mjs} +1 -1
- package/dist/{logos-Bj845Mcw.mjs → logos-X5B8z7Iv.mjs} +1 -1
- package/dist/{logpush-Cs8JdvKi.mjs → logpush-C2ENi1et.mjs} +3 -3
- package/dist/{logs-C92XZvNu.mjs → logs-BKDz7kBW.mjs} +1 -1
- package/dist/{magic-cloud-networking-hNp5MMw-.mjs → magic-cloud-networking-B60Gld8A.mjs} +6 -6
- package/dist/{magic-network-monitoring-68GuWAnv.mjs → magic-network-monitoring-CxXI3Y-H.mjs} +4 -4
- package/dist/{magic-transit-DNd7gu4j.mjs → magic-transit-ZCSaCbl8.mjs} +171 -168
- package/dist/{managed-defense-B_wCAuFD.mjs → managed-defense-DrxMb7xi.mjs} +1 -1
- package/dist/{managed-transforms-DZdxHPOh.mjs → managed-transforms-AI7KrRU1.mjs} +1 -1
- package/dist/{matches-B65CkflD.mjs → matches-rPMLS3Ip.mjs} +1 -1
- package/dist/{mcp-DrJW5ayK.mjs → mcp-DXUMvEWt.mjs} +4 -4
- package/dist/{mesh-DfVzYTn1.mjs → mesh-MmBCQ37q.mjs} +2 -2
- package/dist/{monetization-BGaI8CMO.mjs → monetization-DQE5VtUO.mjs} +2 -2
- package/dist/{mtls-certificates-BsU2emDD.mjs → mtls-certificates-DwkEb-Hy.mjs} +1 -1
- package/dist/{network-BEMD8P0U.mjs → network-BcfobxQY.mjs} +1 -1
- package/dist/{network-interconnects-DMu_fcbo.mjs → network-interconnects-BU3tN_Ab.mjs} +10 -6
- package/dist/{o11y-C1a4gDGF.mjs → o11y-BBv7nedp.mjs} +13 -13
- package/dist/{oauth-Bj5Ne1o8.mjs → oauth-BUr8bPwo.mjs} +1 -1
- package/dist/{oauth-clients-p4Etdqy_.mjs → oauth-clients-qWVImhHE.mjs} +3 -3
- package/dist/{oauth-mspHHU5U.mjs → oauth-n8um6MFk.mjs} +1 -1
- package/dist/{oauth-scopes-B2IabFza.mjs → oauth-scopes-CdeIgJIx.mjs} +1 -1
- package/dist/organization-CJeOVWH7.mjs +71 -0
- package/dist/{organizations-5S6xEp7T.mjs → organizations-BpfoqZcG.mjs} +1 -1
- package/dist/{origin-ca-certificates-_VJAoK1D.mjs → origin-ca-certificates-Bimf07RF.mjs} +2 -2
- package/dist/{origin-post-quantum-encryption-GcldDsT2.mjs → origin-post-quantum-encryption-CM-If38w.mjs} +2 -2
- package/dist/{origin-tls-client-auth-DZHld9fA.mjs → origin-tls-client-auth-BPwYPhc9.mjs} +1 -1
- package/dist/{page-rules-o1tAMMsD.mjs → page-rules-DOeekMrj.mjs} +4 -4
- package/dist/pages-Bn0Sg1ay.mjs +54 -0
- package/dist/{pay-per-crawl-BsnOxGYU.mjs → pay-per-crawl-qJpseNNx.mjs} +1 -1
- package/dist/{pay-per-use-BXWMCSyE.mjs → pay-per-use-C1MWKJ4O.mjs} +3 -3
- package/dist/pipelines-rCwXQw6S.mjs +44 -0
- package/dist/{precursor-B6DjBib6.mjs → precursor-Bk8Pp6jT.mjs} +2 -2
- package/dist/previews-BEheHO3T.mjs +4 -0
- package/dist/{progress-BtkTVcHI.mjs → progress-CQqDtgmF.mjs} +1 -1
- package/dist/{prompt-RlgRrmbm.mjs → prompt-C8FyienX.mjs} +1 -1
- package/dist/{queries-yLwoJRHV.mjs → queries-DJ8looyq.mjs} +1 -1
- package/dist/{queues-CnJRaE1o.mjs → queues-BBH9Q-Tt.mjs} +7 -7
- package/dist/{r2-CuC6-zQX.mjs → r2-CdJKpP2w.mjs} +13 -13
- package/dist/{radar-DrQLcbkq.mjs → radar-CdvQL4xm.mjs} +1 -1
- package/dist/raw-fetch-DbXN3SlE.mjs +2 -0
- package/dist/{realtime-CjsnzHxD.mjs → realtime-onrXppzh.mjs} +9 -9
- package/dist/{registrar-BgOsxTnX.mjs → registrar-CbEBc5IE.mjs} +2 -2
- package/dist/{registrar-sandbox-3ikBD9fB.mjs → registrar-sandbox-BJhn1HFT.mjs} +3 -3
- package/dist/{registry-CHowrQsZ.mjs → registry-PI6sO95I.mjs} +1 -1
- package/dist/{reporting-hE127s5r.mjs → reporting-bXZY6obP.mjs} +1 -1
- package/dist/{request-headers-DiJeDAn1.mjs → request-headers-D8L95bEQ.mjs} +1 -1
- package/dist/{request-tracers-BCwLxmPN.mjs → request-tracers-CihskC2A.mjs} +1 -1
- package/dist/{resource-sharing-2qvWUuMa.mjs → resource-sharing-DDqcCHVs.mjs} +2 -2
- package/dist/{resource-tagging-Dwx7iL3v.mjs → resource-tagging-D63RpBce.mjs} +1 -1
- package/dist/{rules-DxVQ6jIg.mjs → rules-CAW0-Wde.mjs} +1 -1
- package/dist/{rulesets-Cdh8YjI9.mjs → rulesets-CPir63Qc.mjs} +3 -3
- package/dist/{rum-a4CMq4Qu.mjs → rum-BfwTcuup.mjs} +1 -1
- package/dist/{run-BvHwWWUX.mjs → run-CW2Cgi0S.mjs} +1 -1
- package/dist/run-DEynXvCc.mjs +2 -0
- package/dist/{schema-flags-BzoBGPWk.mjs → schema-flags-BTItUu1K.mjs} +1 -1
- package/dist/{scim-B8XlXl8v.mjs → scim-CtZ1FeQE.mjs} +1 -1
- package/dist/{secrets-store-Cqhedh_i.mjs → secrets-store-BIuBYUJT.mjs} +1 -1
- package/dist/{security-insights-le2-DteL.mjs → security-insights-DfUus0bs.mjs} +3 -3
- package/dist/{security-txt-cCArWXur.mjs → security-txt-CgZOsAIZ.mjs} +1 -1
- package/dist/{session-C1BhT1ZJ.mjs → session-BcM8Vyyx.mjs} +1 -1
- package/dist/{shared-BPjcpXuA.mjs → shared-CpS23WwR.mjs} +1 -1
- package/dist/{smart-shield-Csyh8hwB.mjs → smart-shield-ClgB7r-9.mjs} +5 -5
- package/dist/{snippets-DUWx25q6.mjs → snippets-DLO3iFAg.mjs} +1 -1
- package/dist/{spawn-IysxuTNW.mjs → spawn-D07wH-MH.mjs} +1 -1
- package/dist/{spectrum-Da3UYSOR.mjs → spectrum-B6qkjR_Z.mjs} +5 -5
- package/dist/{speed-NxlMnB2e.mjs → speed-DX5X2EIR.mjs} +1 -1
- package/dist/sql-CF044HDW.mjs +4 -0
- package/dist/src-BMATTZU_.mjs +125 -0
- package/dist/{ssl-BtaX2WEJ.mjs → ssl-CM-rChEC.mjs} +5 -5
- package/dist/{startup-profile-CdJWgNjd.mjs → startup-profile-CrtCP-6-.mjs} +1 -1
- package/dist/startup-profile-D662WI9s.mjs +2 -0
- package/dist/state-D7uNYnoi.mjs +2 -0
- package/dist/{state-BDSvdSdP.mjs → state-DIiIGEtR.mjs} +1 -1
- package/dist/{stream-C1Ijjzn4.mjs → stream-5EmUOQvy.mjs} +3 -3
- package/dist/{submit-MdkuU_Pt.mjs → submit-lEAaRSMR.mjs} +1 -1
- package/dist/{tags-CA1xMM96.mjs → tags-CX23P4jg.mjs} +1 -1
- package/dist/telemetry-0Y5hAtCX.mjs +2 -0
- package/dist/{telemetry-Cm39QJ-M.mjs → telemetry-ZlCi5Xhc.mjs} +1 -1
- package/dist/{tenant-BB6Oszcl.mjs → tenant-DnI7QziH.mjs} +1 -1
- package/dist/{tenant-custom-nameservers-BsbgYAEo.mjs → tenant-custom-nameservers-MR0dlcGm.mjs} +1 -1
- package/dist/{tunnels-CRFtyHWz.mjs → tunnels-NzYpsfi_.mjs} +15 -15
- package/dist/{turnstile-DBXWo_Xe.mjs → turnstile-M7sKCEz3.mjs} +11 -11
- package/dist/{update-check-CMXSdres.mjs → update-check-HFkPml6x.mjs} +1 -1
- package/dist/update-check-aTutXNRd.mjs +2 -0
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-info-t-XAs0Mk.mjs → url-info-Dos9VOXV.mjs} +1 -1
- package/dist/{url-normalization-Cs4F8e0a.mjs → url-normalization-CZbFOq_v.mjs} +2 -2
- package/dist/{url-scanner-CBIoDbTx.mjs → url-scanner-B7quLPGW.mjs} +2 -2
- package/dist/{user-CevdOMoa.mjs → user-rXca0J9M.mjs} +12 -12
- package/dist/{values-CjNlkbIh.mjs → values-D-rrZrDa.mjs} +1 -1
- package/dist/{vectorize-9d9tPmg5.mjs → vectorize-D2tf_oA8.mjs} +4 -4
- package/dist/version-BGnqDvNR.mjs +2 -0
- package/dist/waiting-rooms-DrA3-0bw.mjs +53 -0
- package/dist/{web-assets-BHot_MU8.mjs → web-assets-DQAfvPT9.mjs} +3 -3
- package/dist/{web3-CYfWAF6b.mjs → web3-MI0GQDnu.mjs} +5 -5
- package/dist/workers-By6Pf8fv.mjs +40 -0
- package/dist/{workers-builds-Dw7ho3So.mjs → workers-builds-6YsWsCmC.mjs} +2 -2
- package/dist/{workers-for-platforms-A3yjyLh3.mjs → workers-for-platforms-DL8fC1qR.mjs} +2 -2
- package/dist/workers-vpc-BYx6sbgd.mjs +13 -0
- package/dist/workflows-ByQLnV0E.mjs +52 -0
- package/dist/{zaraz-BsD2dMI3.mjs → zaraz-CgbpmA85.mjs} +1 -1
- package/dist/{zero-trust-CA3iGQbG.mjs → zero-trust-CpjTkkWt.mjs} +42 -42
- package/dist/{zone-D2M4EZD0.mjs → zone-DnKIe6po.mjs} +1 -1
- package/dist/{zones-BoOC_JzC.mjs → zones--5ZzsDmQ.mjs} +15 -15
- package/package.json +12 -12
- package/dist/abuse-reports-BjU1s8cf.mjs +0 -24
- package/dist/access-C_G2MZnA.mjs +0 -2
- package/dist/ai-search-DGU1Y5By.mjs +0 -79
- package/dist/auth-CrmVwfpJ.mjs +0 -2
- package/dist/bot-management-DTgPwL7O.mjs +0 -9
- package/dist/build-B1L6xrgC.mjs +0 -2
- package/dist/containers-CVNfEjJs.mjs +0 -78
- package/dist/containers-DeoZyeQe.mjs +0 -375
- package/dist/d1-CE08YqYk.mjs +0 -93
- package/dist/diagnostics-UMbG6m4n.mjs +0 -15
- package/dist/dist-BHEmAAHr.mjs +0 -487
- package/dist/hyperdrive-qWACKfA4.mjs +0 -37
- package/dist/load-balancers-BNTUt4yG.mjs +0 -76
- package/dist/local-DlDumOSC.mjs +0 -2
- package/dist/organization-CdXt7AVZ.mjs +0 -75
- package/dist/pages-CmiOhjSl.mjs +0 -54
- package/dist/pipelines-DWLQC0F6.mjs +0 -44
- package/dist/previews-dUKEBGSM.mjs +0 -4
- package/dist/raw-fetch-B4NvWuZD.mjs +0 -2
- package/dist/run-CkbrPJPx.mjs +0 -2
- package/dist/sql-CNdHAlQ8.mjs +0 -4
- package/dist/src-JfLDUxFr.mjs +0 -125
- package/dist/startup-profile-B2l0ChVu.mjs +0 -2
- package/dist/state-JB4_BU1o.mjs +0 -2
- package/dist/telemetry-BsYO3nxG.mjs +0 -2
- package/dist/update-check-C2oVEbXx.mjs +0 -2
- package/dist/version-BdVUXLnK.mjs +0 -2
- package/dist/waiting-rooms--5WmrWb3.mjs +0 -53
- package/dist/workers-S17M0n3h.mjs +0 -40
- package/dist/workers-vpc-BZ2xXtC3.mjs +0 -13
- package/dist/workflows-BgGrVpSR.mjs +0 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-BcPM4I0s.mjs";import{n as t}from"./auth-CAWalgW0.mjs";import{a as n,t as r}from"./context-BBLtgdR1.mjs";import{t as i}from"./output-BOe-3AQG.mjs";import{t as a}from"./dry-run-DRj2_uV3.mjs";import{t as o}from"./progress-CQqDtgmF.mjs";import{t as s}from"./run-CW2Cgi0S.mjs";import"./telemetry-0Y5hAtCX.mjs";import{n as c,r as l,t as u}from"./body-parser-DkHKPkJ7.mjs";import{n as d}from"./input-validation-D7z60HJH.mjs";import{a as f,n as p}from"./prompt-C8FyienX.mjs";import{t as m}from"./cli-types-9oYmRTHJ.mjs";function h(e){return e.usage(`$0 ai-gateway custom-domains create <gateway-id>
|
|
3
3
|
|
|
4
|
-
Provisions a Cloudflare-for-SaaS custom hostname and returns the CNAME target to point DNS at.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`domain`,{type:`string`,description:"Custom hostname that you own, such as `ai.example.com`."}).option(`min-tls`,{type:`string`,description:`The minTLS field`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`zone-id`,{type:`string`,description:`ID of the Cloudflare zone that contains the custom hostname.`}).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 g={command:`create <gateway-id>`,describe:`Create a custom domain for a gateway`,builder:h,handler:async l=>s({command:`ai-gateway custom-domains create`,classification:{safeFlags:[`min-tls`,`dry-run`]}},l,async()=>{if(l.dryRun){let e=await n();a({command:`cf ai-gateway custom-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${l[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(l[`gateway-id`]))}/custom-domains`,pathParams:{"gateway-id":String(l[`gateway-id`]??``)},bodyKind:`json`,body:l.body===void 0?u({domain:d(l.domain,`domain`,`text`),minTLS:
|
|
4
|
+
Provisions a Cloudflare-for-SaaS custom hostname and returns the CNAME target to point DNS at.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`domain`,{type:`string`,description:"Custom hostname that you own, such as `ai.example.com`."}).option(`min-tls`,{type:`string`,description:`The minTLS field`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).coerce(`min-tls`,e=>d(e,`min-tls`,`text`)).option(`zone-id`,{type:`string`,description:`ID of the Cloudflare zone that contains the custom hostname.`}).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 g={command:`create <gateway-id>`,describe:`Create a custom domain for a gateway`,builder:h,handler:async l=>s({command:`ai-gateway custom-domains create`,classification:{safeFlags:[`min-tls`,`dry-run`]}},l,async()=>{if(l.dryRun){let e=await n();a({command:`cf ai-gateway custom-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${l[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(l[`gateway-id`]))}/custom-domains`,pathParams:{"gateway-id":String(l[`gateway-id`]??``)},bodyKind:`json`,body:l.body===void 0?u({domain:d(l.domain,`domain`,`text`),minTLS:l[`min-tls`],zone_id:d(l[`zone-id`],`zone-id`,`text`)}):c(l.body)});return}let s=await t(l),p=l.local?e:await r();if(l.accountId=p,l.body){let e=c(l.body),t=await o(`Creating`,async()=>s.aiGateway.customDomains.create({...e,account_id:p,gateway_id:l[`gateway-id`]}));i(t,{successLabel:`Created`});return}l.domain===void 0&&(l.domain=await f(`domain`,"Custom hostname that you own, such as `ai.example.com`.")),l[`zone-id`]===void 0&&(l[`zone-id`]=await f(`zone-id`,`ID of the Cloudflare zone that contains the custom hostname.`));let m=u({domain:d(l.domain,`domain`,`text`),minTLS:l[`min-tls`],zone_id:d(l[`zone-id`],`zone-id`,`text`)}),h=await o(`Creating`,async()=>s.aiGateway.customDomains.create({...m,account_id:p,gateway_id:l[`gateway-id`]}));i(h,{successLabel:`Created`})})};function ee(e){return e.usage(`$0 ai-gateway custom-domains delete <hostname>
|
|
5
5
|
|
|
6
6
|
Deletes a custom domain from an AI Gateway and removes its Cloudflare for SaaS custom hostname.`).positional(`hostname`,{type:`string`,description:"Custom hostname that you own, such as `ai.example.com`.",demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,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 te={command:`delete <hostname>`,describe:`Delete a custom domain`,builder:ee,handler:async c=>s({command:`ai-gateway custom-domains delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf ai-gateway custom-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${c[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(c[`gateway-id`]))}/custom-domains/${c.hostname==null?`<hostname>`:encodeURIComponent(String(c.hostname))}`,pathParams:{"gateway-id":String(c[`gateway-id`]??``),hostname:String(c.hostname??``)},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();if(c.accountId=l,!await p({force:!!c.force,message:`This deletes the custom domain and its custom hostname. Requests to this hostname will stop reaching the gateway.`})){process.stderr.write(`Aborted.
|
|
7
7
|
`);return}let u=await o(`Deleting`,async()=>s.aiGateway.customDomains.delete({account_id:l,gateway_id:c[`gateway-id`],hostname:c.hostname}));i(u,{successLabel:`Deleted`})})};function _(e){return e.usage(`$0 ai-gateway custom-domains get <hostname>
|
|
@@ -42,7 +42,7 @@ Retrieves a saved version of a dynamic route, including its routing elements.`).
|
|
|
42
42
|
|
|
43
43
|
Lists the saved versions of a dynamic route.`).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ne={command:`list`,describe:`List dynamic route versions`,builder:Q,handler:async c=>s({command:`ai-gateway dynamic-routing versions list`,classification:{safeFlags:[`dry-run`]}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf ai-gateway dynamic-routing versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${c[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(c[`gateway-id`]))}/routes/${c.id==null?`<id>`:encodeURIComponent(String(c.id))}/versions`,pathParams:{"gateway-id":String(c[`gateway-id`]??``),id:String(c.id??``)},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();c.accountId=l;let u=await o(`Loading`,async()=>s.aiGateway.dynamicRouting.versions.list({account_id:l,gateway_id:c[`gateway-id`],id:c.id}));i(u,{successLabel:`Loaded`})})},re={command:`versions`,describe:`Create and inspect saved versions of a dynamic route`,builder:e=>e.command(Y).command(Z).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ie={command:`dynamic-routing`,describe:`Route requests across multiple AI providers with fallback, load-balancing, and versioned deployments`,builder:e=>e.command(P).command(I).command(U).command(G).command(q).command(V).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.usage(`$0 ai-gateway gateways create
|
|
44
44
|
|
|
45
|
-
Creates an AI Gateway in the account with the specified caching, rate limiting, logging, and authentication settings. The gateway ID appears in request URLs and must be unique within the account.`).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`byok-only`,{type:`boolean`,description:`Requires customer-provided provider credentials and prevents fallback to Unified Billing.`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`}).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`otel`,{type:`string`,description:`The otel field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-60000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`],default:`postpaid`}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const oe={command:`create`,describe:`Create a gateway`,builder:ae,handler:async p=>s({command:`ai-gateway gateways create`,classification:{safeFlags:/* @__PURE__ */ `authentication.byok-only.cache-invalidate-on-update.collect-logs.guardrails-prompt-p1.guardrails-prompt-s1.guardrails-prompt-s10.guardrails-prompt-s11.guardrails-prompt-s12.guardrails-prompt-s13.guardrails-prompt-s2.guardrails-prompt-s3.guardrails-prompt-s4.guardrails-prompt-s5.guardrails-prompt-s6.guardrails-prompt-s7.guardrails-prompt-s8.guardrails-prompt-s9.guardrails-response-p1.guardrails-response-s1.guardrails-response-s10.guardrails-response-s11.guardrails-response-s12.guardrails-response-s13.guardrails-response-s2.guardrails-response-s3.guardrails-response-s4.guardrails-response-s5.guardrails-response-s6.guardrails-response-s7.guardrails-response-s8.guardrails-response-s9.log-classification.log-management-strategy.logpush.rate-limiting-technique.retry-backoff.spend-limits-enabled.workers-ai-billing-mode.zdr.dry-run`.split(`.`)}},p,async()=>{if(p.dryRun){let e=await n();a({command:`cf ai-gateway gateways create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways`,pathParams:{},bodyKind:`json`,body:p.body===void 0?u({authentication:p.authentication,byok_only:p[`byok-only`],cache_invalidate_on_update:p[`cache-invalidate-on-update`],cache_ttl:p[`cache-ttl`],collect_logs:p[`collect-logs`],guardrails:{prompt:{P1:d(p[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:d(p[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:d(p[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:d(p[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:d(p[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:d(p[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:d(p[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:d(p[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:d(p[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:d(p[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:d(p[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:d(p[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:d(p[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:d(p[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:d(p[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:d(p[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:d(p[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:d(p[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:d(p[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:d(p[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:d(p[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:d(p[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:d(p[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:d(p[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:d(p[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:d(p[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:d(p[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:d(p[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},id:d(p.id,`id`,`text`),log_classification:p[`log-classification`],log_management:p[`log-management`],log_management_strategy:d(p[`log-management-strategy`],`log-management-strategy`,`text`),logpush:p.logpush,logpush_public_key:d(p[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(p.otel,`otel`),rate_limiting_interval:p[`rate-limiting-interval`],rate_limiting_limit:p[`rate-limiting-limit`],rate_limiting_technique:d(p[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:d(p[`retry-backoff`],`retry-backoff`,`text`),retry_delay:p[`retry-delay`],retry_max_attempts:p[`retry-max-attempts`],spend_limits:{enabled:p[`spend-limits-enabled`]},store_id:d(p[`store-id`],`store-id`,`text`),stripe:{authorization:d(p[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:d(p[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:p.zdr}):c(p.body)});return}let s=await t(p),m=p.local?e:await r();if(p.accountId=m,p.body){let e=c(p.body),t=await o(`Creating`,async()=>s.aiGateway.gateways.create({...e,account_id:m}));i(t,{successLabel:`Created`});return}if(p[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(p[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(p[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(p.id===void 0&&(p.id=await f(`id`,`Unique identifier of the AI Gateway within the account.`)),p[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(p[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let h=u({authentication:p.authentication,byok_only:p[`byok-only`],cache_invalidate_on_update:p[`cache-invalidate-on-update`],cache_ttl:p[`cache-ttl`],collect_logs:p[`collect-logs`],guardrails:{prompt:{P1:d(p[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:d(p[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:d(p[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:d(p[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:d(p[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:d(p[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:d(p[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:d(p[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:d(p[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:d(p[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:d(p[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:d(p[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:d(p[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:d(p[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:d(p[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:d(p[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:d(p[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:d(p[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:d(p[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:d(p[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:d(p[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:d(p[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:d(p[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:d(p[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:d(p[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:d(p[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:d(p[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:d(p[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},id:d(p.id,`id`,`text`),log_classification:p[`log-classification`],log_management:p[`log-management`],log_management_strategy:d(p[`log-management-strategy`],`log-management-strategy`,`text`),logpush:p.logpush,logpush_public_key:d(p[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(p.otel,`otel`),rate_limiting_interval:p[`rate-limiting-interval`],rate_limiting_limit:p[`rate-limiting-limit`],rate_limiting_technique:d(p[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:d(p[`retry-backoff`],`retry-backoff`,`text`),retry_delay:p[`retry-delay`],retry_max_attempts:p[`retry-max-attempts`],spend_limits:{enabled:p[`spend-limits-enabled`]},store_id:d(p[`store-id`],`store-id`,`text`),stripe:{authorization:d(p[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:d(p[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:p.zdr}),g=await o(`Creating`,async()=>s.aiGateway.gateways.create({...h,account_id:m}));i(g,{successLabel:`Created`})})};function se(e){return e.usage(`$0 ai-gateway gateways delete <gateway-id>
|
|
45
|
+
Creates an AI Gateway in the account with the specified caching, rate limiting, logging, and authentication settings. The gateway ID appears in request URLs and must be unique within the account.`).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`byok-only`,{type:`boolean`,description:`Requires customer-provided provider credentials and prevents fallback to Unified Billing.`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-p1`,e=>d(e,`guardrails-prompt-p1`,`text`)).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s1`,e=>d(e,`guardrails-prompt-s1`,`text`)).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s10`,e=>d(e,`guardrails-prompt-s10`,`text`)).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s11`,e=>d(e,`guardrails-prompt-s11`,`text`)).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s12`,e=>d(e,`guardrails-prompt-s12`,`text`)).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s13`,e=>d(e,`guardrails-prompt-s13`,`text`)).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s2`,e=>d(e,`guardrails-prompt-s2`,`text`)).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s3`,e=>d(e,`guardrails-prompt-s3`,`text`)).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s4`,e=>d(e,`guardrails-prompt-s4`,`text`)).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s5`,e=>d(e,`guardrails-prompt-s5`,`text`)).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s6`,e=>d(e,`guardrails-prompt-s6`,`text`)).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s7`,e=>d(e,`guardrails-prompt-s7`,`text`)).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s8`,e=>d(e,`guardrails-prompt-s8`,`text`)).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s9`,e=>d(e,`guardrails-prompt-s9`,`text`)).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-p1`,e=>d(e,`guardrails-response-p1`,`text`)).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s1`,e=>d(e,`guardrails-response-s1`,`text`)).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s10`,e=>d(e,`guardrails-response-s10`,`text`)).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s11`,e=>d(e,`guardrails-response-s11`,`text`)).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s12`,e=>d(e,`guardrails-response-s12`,`text`)).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s13`,e=>d(e,`guardrails-response-s13`,`text`)).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s2`,e=>d(e,`guardrails-response-s2`,`text`)).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s3`,e=>d(e,`guardrails-response-s3`,`text`)).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s4`,e=>d(e,`guardrails-response-s4`,`text`)).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s5`,e=>d(e,`guardrails-response-s5`,`text`)).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s6`,e=>d(e,`guardrails-response-s6`,`text`)).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s7`,e=>d(e,`guardrails-response-s7`,`text`)).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s8`,e=>d(e,`guardrails-response-s8`,`text`)).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s9`,e=>d(e,`guardrails-response-s9`,`text`)).option(`id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`}).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).coerce(`log-management-strategy`,e=>d(e,`log-management-strategy`,`text`)).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`otel`,{type:`string`,description:`The otel field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).coerce(`rate-limiting-technique`,e=>d(e,`rate-limiting-technique`,`text`)).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).coerce(`retry-backoff`,e=>d(e,`retry-backoff`,`text`)).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-60000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`],default:`postpaid`}).coerce(`workers-ai-billing-mode`,e=>d(e,`workers-ai-billing-mode`,`text`)).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const oe={command:`create`,describe:`Create a gateway`,builder:ae,handler:async p=>s({command:`ai-gateway gateways create`,classification:{safeFlags:/* @__PURE__ */ `authentication.byok-only.cache-invalidate-on-update.collect-logs.guardrails-prompt-p1.guardrails-prompt-s1.guardrails-prompt-s10.guardrails-prompt-s11.guardrails-prompt-s12.guardrails-prompt-s13.guardrails-prompt-s2.guardrails-prompt-s3.guardrails-prompt-s4.guardrails-prompt-s5.guardrails-prompt-s6.guardrails-prompt-s7.guardrails-prompt-s8.guardrails-prompt-s9.guardrails-response-p1.guardrails-response-s1.guardrails-response-s10.guardrails-response-s11.guardrails-response-s12.guardrails-response-s13.guardrails-response-s2.guardrails-response-s3.guardrails-response-s4.guardrails-response-s5.guardrails-response-s6.guardrails-response-s7.guardrails-response-s8.guardrails-response-s9.log-classification.log-management-strategy.logpush.rate-limiting-technique.retry-backoff.spend-limits-enabled.workers-ai-billing-mode.zdr.dry-run`.split(`.`)}},p,async()=>{if(p.dryRun){let e=await n();a({command:`cf ai-gateway gateways create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways`,pathParams:{},bodyKind:`json`,body:p.body===void 0?u({authentication:p.authentication,byok_only:p[`byok-only`],cache_invalidate_on_update:p[`cache-invalidate-on-update`],cache_ttl:p[`cache-ttl`],collect_logs:p[`collect-logs`],guardrails:{prompt:{P1:p[`guardrails-prompt-p1`],S1:p[`guardrails-prompt-s1`],S10:p[`guardrails-prompt-s10`],S11:p[`guardrails-prompt-s11`],S12:p[`guardrails-prompt-s12`],S13:p[`guardrails-prompt-s13`],S2:p[`guardrails-prompt-s2`],S3:p[`guardrails-prompt-s3`],S4:p[`guardrails-prompt-s4`],S5:p[`guardrails-prompt-s5`],S6:p[`guardrails-prompt-s6`],S7:p[`guardrails-prompt-s7`],S8:p[`guardrails-prompt-s8`],S9:p[`guardrails-prompt-s9`]},response:{P1:p[`guardrails-response-p1`],S1:p[`guardrails-response-s1`],S10:p[`guardrails-response-s10`],S11:p[`guardrails-response-s11`],S12:p[`guardrails-response-s12`],S13:p[`guardrails-response-s13`],S2:p[`guardrails-response-s2`],S3:p[`guardrails-response-s3`],S4:p[`guardrails-response-s4`],S5:p[`guardrails-response-s5`],S6:p[`guardrails-response-s6`],S7:p[`guardrails-response-s7`],S8:p[`guardrails-response-s8`],S9:p[`guardrails-response-s9`]}},id:d(p.id,`id`,`text`),log_classification:p[`log-classification`],log_management:p[`log-management`],log_management_strategy:p[`log-management-strategy`],logpush:p.logpush,logpush_public_key:d(p[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(p.otel,`otel`),rate_limiting_interval:p[`rate-limiting-interval`],rate_limiting_limit:p[`rate-limiting-limit`],rate_limiting_technique:p[`rate-limiting-technique`],retry_backoff:p[`retry-backoff`],retry_delay:p[`retry-delay`],retry_max_attempts:p[`retry-max-attempts`],spend_limits:{enabled:p[`spend-limits-enabled`]},store_id:d(p[`store-id`],`store-id`,`text`),stripe:{authorization:d(p[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:p[`workers-ai-billing-mode`],zdr:p.zdr}):c(p.body)});return}let s=await t(p),m=p.local?e:await r();if(p.accountId=m,p.body){let e=c(p.body),t=await o(`Creating`,async()=>s.aiGateway.gateways.create({...e,account_id:m}));i(t,{successLabel:`Created`});return}if(p[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(p[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(p[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(p.id===void 0&&(p.id=await f(`id`,`Unique identifier of the AI Gateway within the account.`)),p[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(p[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let h=u({authentication:p.authentication,byok_only:p[`byok-only`],cache_invalidate_on_update:p[`cache-invalidate-on-update`],cache_ttl:p[`cache-ttl`],collect_logs:p[`collect-logs`],guardrails:{prompt:{P1:p[`guardrails-prompt-p1`],S1:p[`guardrails-prompt-s1`],S10:p[`guardrails-prompt-s10`],S11:p[`guardrails-prompt-s11`],S12:p[`guardrails-prompt-s12`],S13:p[`guardrails-prompt-s13`],S2:p[`guardrails-prompt-s2`],S3:p[`guardrails-prompt-s3`],S4:p[`guardrails-prompt-s4`],S5:p[`guardrails-prompt-s5`],S6:p[`guardrails-prompt-s6`],S7:p[`guardrails-prompt-s7`],S8:p[`guardrails-prompt-s8`],S9:p[`guardrails-prompt-s9`]},response:{P1:p[`guardrails-response-p1`],S1:p[`guardrails-response-s1`],S10:p[`guardrails-response-s10`],S11:p[`guardrails-response-s11`],S12:p[`guardrails-response-s12`],S13:p[`guardrails-response-s13`],S2:p[`guardrails-response-s2`],S3:p[`guardrails-response-s3`],S4:p[`guardrails-response-s4`],S5:p[`guardrails-response-s5`],S6:p[`guardrails-response-s6`],S7:p[`guardrails-response-s7`],S8:p[`guardrails-response-s8`],S9:p[`guardrails-response-s9`]}},id:d(p.id,`id`,`text`),log_classification:p[`log-classification`],log_management:p[`log-management`],log_management_strategy:p[`log-management-strategy`],logpush:p.logpush,logpush_public_key:d(p[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(p.otel,`otel`),rate_limiting_interval:p[`rate-limiting-interval`],rate_limiting_limit:p[`rate-limiting-limit`],rate_limiting_technique:p[`rate-limiting-technique`],retry_backoff:p[`retry-backoff`],retry_delay:p[`retry-delay`],retry_max_attempts:p[`retry-max-attempts`],spend_limits:{enabled:p[`spend-limits-enabled`]},store_id:d(p[`store-id`],`store-id`,`text`),stripe:{authorization:d(p[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:p[`workers-ai-billing-mode`],zdr:p.zdr}),g=await o(`Creating`,async()=>s.aiGateway.gateways.create({...h,account_id:m}));i(g,{successLabel:`Created`})})};function se(e){return e.usage(`$0 ai-gateway gateways delete <gateway-id>
|
|
46
46
|
|
|
47
47
|
Permanently deletes an AI Gateway, its configuration, and its stored logs.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,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 ce={command:`delete <gateway-id>`,describe:`Delete a gateway`,builder:se,handler:async c=>s({command:`ai-gateway gateways delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{if(c.dryRun){let e=await n();a({command:`cf ai-gateway gateways delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${c[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(c[`gateway-id`]))}`,pathParams:{"gateway-id":String(c[`gateway-id`]??``)},bodyKind:`none`});return}let s=await t(c),l=c.local?e:await r();if(c.accountId=l,!await p({force:!!c.force,message:`This permanently deletes the gateway, its configuration, and its stored logs. Requests sent to this gateway will fail. This action cannot be undone.`})){process.stderr.write(`Aborted.
|
|
48
48
|
`);return}let u=await o(`Deleting`,async()=>s.aiGateway.gateways.delete({account_id:l,"gateway-id":c[`gateway-id`]}));i(u,{successLabel:`Deleted`})})};function le(e){return e.usage(`$0 ai-gateway gateways get-url <provider>
|
|
@@ -64,7 +64,7 @@ Lists the provider keys stored for an AI Gateway. Responses show a masked previe
|
|
|
64
64
|
|
|
65
65
|
Replaces the stored API key of a provider key configuration. Only the key can change.`).positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`secret`,{type:`string`,description:`Provider API key to store in the Secrets Store configured on the gateway.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const we={command:`update <id>`,describe:`Rotate a provider key`,builder:Ce,handler:async l=>s({command:`ai-gateway gateways providers update`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){let e=await n();a({command:`cf ai-gateway gateways providers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${l[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(l[`gateway-id`]))}/provider_configs/${l.id==null?`<id>`:encodeURIComponent(String(l.id))}`,pathParams:{"gateway-id":String(l[`gateway-id`]??``),id:String(l.id??``)},bodyKind:`json`,body:l.body===void 0?u({secret:d(l.secret,`secret`,`text`)}):c(l.body),sensitiveBodyPaths:[[`secret`]]});return}let s=await t(l),p=l.local?e:await r();if(l.accountId=p,l.body){let e=c(l.body),t=await o(`Updating`,async()=>s.aiGateway.gateways.providers.update({...e,account_id:p,gateway_id:l[`gateway-id`],id:l.id}));i(t,{successLabel:`Updated`});return}l.secret===void 0&&(l.secret=await f(`secret`,`Provider API key to store in the Secrets Store configured on the gateway.`,{kind:`secret`}));let m=u({secret:d(l.secret,`secret`,`text`)}),h=await o(`Updating`,async()=>s.aiGateway.gateways.providers.update({...m,account_id:p,gateway_id:l[`gateway-id`],id:l.id}));i(h,{successLabel:`Updated`})})},Te={command:`providers`,describe:`Store and rotate upstream AI provider keys for a gateway`,builder:e=>e.command(ge).command(ve).command(be).command(Se).command(we).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ee(e){return e.usage(`$0 ai-gateway gateways update <gateway-id>
|
|
66
66
|
|
|
67
|
-
Updates the configuration of an AI Gateway, such as its caching, rate limiting, logging, and authentication settings.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`byok-only`,{type:`boolean`,description:`Requires customer-provided provider credentials and prevents fallback to Unified Billing.`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`otel`,{type:`string`,description:`The otel field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-60000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`]}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const De={command:`update <gateway-id>`,describe:`Update a gateway`,builder:Ee,handler:async f=>s({command:`ai-gateway gateways update`,classification:{safeFlags:/* @__PURE__ */ `authentication.byok-only.cache-invalidate-on-update.collect-logs.guardrails-prompt-p1.guardrails-prompt-s1.guardrails-prompt-s10.guardrails-prompt-s11.guardrails-prompt-s12.guardrails-prompt-s13.guardrails-prompt-s2.guardrails-prompt-s3.guardrails-prompt-s4.guardrails-prompt-s5.guardrails-prompt-s6.guardrails-prompt-s7.guardrails-prompt-s8.guardrails-prompt-s9.guardrails-response-p1.guardrails-response-s1.guardrails-response-s10.guardrails-response-s11.guardrails-response-s12.guardrails-response-s13.guardrails-response-s2.guardrails-response-s3.guardrails-response-s4.guardrails-response-s5.guardrails-response-s6.guardrails-response-s7.guardrails-response-s8.guardrails-response-s9.log-classification.log-management-strategy.logpush.rate-limiting-technique.retry-backoff.spend-limits-enabled.workers-ai-billing-mode.zdr.dry-run`.split(`.`)}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf ai-gateway gateways update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${f[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(f[`gateway-id`]))}`,pathParams:{"gateway-id":String(f[`gateway-id`]??``)},bodyKind:`json`,body:f.body===void 0?u({authentication:f.authentication,byok_only:f[`byok-only`],cache_invalidate_on_update:f[`cache-invalidate-on-update`],cache_ttl:f[`cache-ttl`],collect_logs:f[`collect-logs`],guardrails:{prompt:{P1:d(f[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:d(f[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:d(f[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:d(f[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:d(f[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:d(f[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:d(f[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:d(f[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:d(f[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:d(f[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:d(f[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:d(f[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:d(f[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:d(f[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:d(f[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:d(f[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:d(f[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:d(f[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:d(f[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:d(f[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:d(f[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:d(f[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:d(f[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:d(f[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:d(f[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:d(f[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:d(f[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:d(f[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:f[`log-classification`],log_management:f[`log-management`],log_management_strategy:d(f[`log-management-strategy`],`log-management-strategy`,`text`),logpush:f.logpush,logpush_public_key:d(f[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(f.otel,`otel`),rate_limiting_interval:f[`rate-limiting-interval`],rate_limiting_limit:f[`rate-limiting-limit`],rate_limiting_technique:d(f[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:d(f[`retry-backoff`],`retry-backoff`,`text`),retry_delay:f[`retry-delay`],retry_max_attempts:f[`retry-max-attempts`],spend_limits:{enabled:f[`spend-limits-enabled`]},store_id:d(f[`store-id`],`store-id`,`text`),stripe:{authorization:d(f[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:d(f[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:f.zdr}):c(f.body)});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Updating`,async()=>s.aiGateway.gateways.update({...e,account_id:p,"gateway-id":f[`gateway-id`]}));i(t,{successLabel:`Updated`});return}if(f[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(f[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(f[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(f[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(f[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let m=u({authentication:f.authentication,byok_only:f[`byok-only`],cache_invalidate_on_update:f[`cache-invalidate-on-update`],cache_ttl:f[`cache-ttl`],collect_logs:f[`collect-logs`],guardrails:{prompt:{P1:d(f[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:d(f[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:d(f[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:d(f[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:d(f[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:d(f[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:d(f[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:d(f[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:d(f[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:d(f[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:d(f[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:d(f[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:d(f[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:d(f[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:d(f[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:d(f[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:d(f[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:d(f[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:d(f[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:d(f[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:d(f[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:d(f[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:d(f[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:d(f[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:d(f[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:d(f[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:d(f[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:d(f[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:f[`log-classification`],log_management:f[`log-management`],log_management_strategy:d(f[`log-management-strategy`],`log-management-strategy`,`text`),logpush:f.logpush,logpush_public_key:d(f[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(f.otel,`otel`),rate_limiting_interval:f[`rate-limiting-interval`],rate_limiting_limit:f[`rate-limiting-limit`],rate_limiting_technique:d(f[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:d(f[`retry-backoff`],`retry-backoff`,`text`),retry_delay:f[`retry-delay`],retry_max_attempts:f[`retry-max-attempts`],spend_limits:{enabled:f[`spend-limits-enabled`]},store_id:d(f[`store-id`],`store-id`,`text`),stripe:{authorization:d(f[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:d(f[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:f.zdr}),h=await o(`Updating`,async()=>s.aiGateway.gateways.update({...m,account_id:p,"gateway-id":f[`gateway-id`]}));i(h,{successLabel:`Updated`})})},Oe={command:`gateways`,describe:`Create and configure AI Gateways for an account`,builder:e=>e.command(oe).command(ce).command(fe).command(ue).command(me).command(De).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.usage(`$0 ai-gateway logs delete <gateway-id>
|
|
67
|
+
Updates the configuration of an AI Gateway, such as its caching, rate limiting, logging, and authentication settings.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`byok-only`,{type:`boolean`,description:`Requires customer-provided provider credentials and prevents fallback to Unified Billing.`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-p1`,e=>d(e,`guardrails-prompt-p1`,`text`)).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s1`,e=>d(e,`guardrails-prompt-s1`,`text`)).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s10`,e=>d(e,`guardrails-prompt-s10`,`text`)).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s11`,e=>d(e,`guardrails-prompt-s11`,`text`)).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s12`,e=>d(e,`guardrails-prompt-s12`,`text`)).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s13`,e=>d(e,`guardrails-prompt-s13`,`text`)).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s2`,e=>d(e,`guardrails-prompt-s2`,`text`)).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s3`,e=>d(e,`guardrails-prompt-s3`,`text`)).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s4`,e=>d(e,`guardrails-prompt-s4`,`text`)).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s5`,e=>d(e,`guardrails-prompt-s5`,`text`)).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s6`,e=>d(e,`guardrails-prompt-s6`,`text`)).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s7`,e=>d(e,`guardrails-prompt-s7`,`text`)).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s8`,e=>d(e,`guardrails-prompt-s8`,`text`)).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-prompt-s9`,e=>d(e,`guardrails-prompt-s9`,`text`)).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-p1`,e=>d(e,`guardrails-response-p1`,`text`)).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s1`,e=>d(e,`guardrails-response-s1`,`text`)).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s10`,e=>d(e,`guardrails-response-s10`,`text`)).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s11`,e=>d(e,`guardrails-response-s11`,`text`)).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s12`,e=>d(e,`guardrails-response-s12`,`text`)).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s13`,e=>d(e,`guardrails-response-s13`,`text`)).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s2`,e=>d(e,`guardrails-response-s2`,`text`)).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s3`,e=>d(e,`guardrails-response-s3`,`text`)).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s4`,e=>d(e,`guardrails-response-s4`,`text`)).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s5`,e=>d(e,`guardrails-response-s5`,`text`)).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s6`,e=>d(e,`guardrails-response-s6`,`text`)).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s7`,e=>d(e,`guardrails-response-s7`,`text`)).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s8`,e=>d(e,`guardrails-response-s8`,`text`)).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).coerce(`guardrails-response-s9`,e=>d(e,`guardrails-response-s9`,`text`)).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).coerce(`log-management-strategy`,e=>d(e,`log-management-strategy`,`text`)).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`otel`,{type:`string`,description:`The otel field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).coerce(`rate-limiting-technique`,e=>d(e,`rate-limiting-technique`,`text`)).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).coerce(`retry-backoff`,e=>d(e,`retry-backoff`,`text`)).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-60000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`]}).coerce(`workers-ai-billing-mode`,e=>d(e,`workers-ai-billing-mode`,`text`)).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const De={command:`update <gateway-id>`,describe:`Update a gateway`,builder:Ee,handler:async f=>s({command:`ai-gateway gateways update`,classification:{safeFlags:/* @__PURE__ */ `authentication.byok-only.cache-invalidate-on-update.collect-logs.guardrails-prompt-p1.guardrails-prompt-s1.guardrails-prompt-s10.guardrails-prompt-s11.guardrails-prompt-s12.guardrails-prompt-s13.guardrails-prompt-s2.guardrails-prompt-s3.guardrails-prompt-s4.guardrails-prompt-s5.guardrails-prompt-s6.guardrails-prompt-s7.guardrails-prompt-s8.guardrails-prompt-s9.guardrails-response-p1.guardrails-response-s1.guardrails-response-s10.guardrails-response-s11.guardrails-response-s12.guardrails-response-s13.guardrails-response-s2.guardrails-response-s3.guardrails-response-s4.guardrails-response-s5.guardrails-response-s6.guardrails-response-s7.guardrails-response-s8.guardrails-response-s9.log-classification.log-management-strategy.logpush.rate-limiting-technique.retry-backoff.spend-limits-enabled.workers-ai-billing-mode.zdr.dry-run`.split(`.`)}},f,async()=>{if(f.dryRun){let e=await n();a({command:`cf ai-gateway gateways update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${f[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(f[`gateway-id`]))}`,pathParams:{"gateway-id":String(f[`gateway-id`]??``)},bodyKind:`json`,body:f.body===void 0?u({authentication:f.authentication,byok_only:f[`byok-only`],cache_invalidate_on_update:f[`cache-invalidate-on-update`],cache_ttl:f[`cache-ttl`],collect_logs:f[`collect-logs`],guardrails:{prompt:{P1:f[`guardrails-prompt-p1`],S1:f[`guardrails-prompt-s1`],S10:f[`guardrails-prompt-s10`],S11:f[`guardrails-prompt-s11`],S12:f[`guardrails-prompt-s12`],S13:f[`guardrails-prompt-s13`],S2:f[`guardrails-prompt-s2`],S3:f[`guardrails-prompt-s3`],S4:f[`guardrails-prompt-s4`],S5:f[`guardrails-prompt-s5`],S6:f[`guardrails-prompt-s6`],S7:f[`guardrails-prompt-s7`],S8:f[`guardrails-prompt-s8`],S9:f[`guardrails-prompt-s9`]},response:{P1:f[`guardrails-response-p1`],S1:f[`guardrails-response-s1`],S10:f[`guardrails-response-s10`],S11:f[`guardrails-response-s11`],S12:f[`guardrails-response-s12`],S13:f[`guardrails-response-s13`],S2:f[`guardrails-response-s2`],S3:f[`guardrails-response-s3`],S4:f[`guardrails-response-s4`],S5:f[`guardrails-response-s5`],S6:f[`guardrails-response-s6`],S7:f[`guardrails-response-s7`],S8:f[`guardrails-response-s8`],S9:f[`guardrails-response-s9`]}},log_classification:f[`log-classification`],log_management:f[`log-management`],log_management_strategy:f[`log-management-strategy`],logpush:f.logpush,logpush_public_key:d(f[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(f.otel,`otel`),rate_limiting_interval:f[`rate-limiting-interval`],rate_limiting_limit:f[`rate-limiting-limit`],rate_limiting_technique:f[`rate-limiting-technique`],retry_backoff:f[`retry-backoff`],retry_delay:f[`retry-delay`],retry_max_attempts:f[`retry-max-attempts`],spend_limits:{enabled:f[`spend-limits-enabled`]},store_id:d(f[`store-id`],`store-id`,`text`),stripe:{authorization:d(f[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:f[`workers-ai-billing-mode`],zdr:f.zdr}):c(f.body)});return}let s=await t(f),p=f.local?e:await r();if(f.accountId=p,f.body){let e=c(f.body),t=await o(`Updating`,async()=>s.aiGateway.gateways.update({...e,account_id:p,"gateway-id":f[`gateway-id`]}));i(t,{successLabel:`Updated`});return}if(f[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(f[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(f[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(f[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(f[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let m=u({authentication:f.authentication,byok_only:f[`byok-only`],cache_invalidate_on_update:f[`cache-invalidate-on-update`],cache_ttl:f[`cache-ttl`],collect_logs:f[`collect-logs`],guardrails:{prompt:{P1:f[`guardrails-prompt-p1`],S1:f[`guardrails-prompt-s1`],S10:f[`guardrails-prompt-s10`],S11:f[`guardrails-prompt-s11`],S12:f[`guardrails-prompt-s12`],S13:f[`guardrails-prompt-s13`],S2:f[`guardrails-prompt-s2`],S3:f[`guardrails-prompt-s3`],S4:f[`guardrails-prompt-s4`],S5:f[`guardrails-prompt-s5`],S6:f[`guardrails-prompt-s6`],S7:f[`guardrails-prompt-s7`],S8:f[`guardrails-prompt-s8`],S9:f[`guardrails-prompt-s9`]},response:{P1:f[`guardrails-response-p1`],S1:f[`guardrails-response-s1`],S10:f[`guardrails-response-s10`],S11:f[`guardrails-response-s11`],S12:f[`guardrails-response-s12`],S13:f[`guardrails-response-s13`],S2:f[`guardrails-response-s2`],S3:f[`guardrails-response-s3`],S4:f[`guardrails-response-s4`],S5:f[`guardrails-response-s5`],S6:f[`guardrails-response-s6`],S7:f[`guardrails-response-s7`],S8:f[`guardrails-response-s8`],S9:f[`guardrails-response-s9`]}},log_classification:f[`log-classification`],log_management:f[`log-management`],log_management_strategy:f[`log-management-strategy`],logpush:f.logpush,logpush_public_key:d(f[`logpush-public-key`],`logpush-public-key`,`text`),otel:l(f.otel,`otel`),rate_limiting_interval:f[`rate-limiting-interval`],rate_limiting_limit:f[`rate-limiting-limit`],rate_limiting_technique:f[`rate-limiting-technique`],retry_backoff:f[`retry-backoff`],retry_delay:f[`retry-delay`],retry_max_attempts:f[`retry-max-attempts`],spend_limits:{enabled:f[`spend-limits-enabled`]},store_id:d(f[`store-id`],`store-id`,`text`),stripe:{authorization:d(f[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:f[`workers-ai-billing-mode`],zdr:f.zdr}),h=await o(`Updating`,async()=>s.aiGateway.gateways.update({...m,account_id:p,"gateway-id":f[`gateway-id`]}));i(h,{successLabel:`Updated`})})},Oe={command:`gateways`,describe:`Create and configure AI Gateways for an account`,builder:e=>e.command(oe).command(ce).command(fe).command(ue).command(me).command(De).command(Te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ke(e){return e.usage(`$0 ai-gateway logs delete <gateway-id>
|
|
68
68
|
|
|
69
69
|
Deletes gateway log entries matching the specified criteria.`).positional(`gateway-id`,{type:`string`,description:`Unique identifier of the AI Gateway within the account.`,demandOption:!0}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`,`cost`,`tokens_in`,`tokens_out`,`duration`,`feedback`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ae={command:`delete <gateway-id>`,describe:`Delete Gateway Logs`,builder:m(ke),handler:async c=>s({command:`ai-gateway logs delete`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},c,async()=>{let s={order_by:c[`order-by`],order_by_direction:c[`order-by-direction`],filters:c.filters,limit:c.limit};if(c.dryRun){let e=await n();a({command:`cf ai-gateway logs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-gateway/gateways/${c[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(c[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(c[`gateway-id`]??``)},query:s,bodyKind:`none`});return}let l=await t(c),u=c.local?e:await r();if(c.accountId=u,!await p({force:!!c.force,message:`This permanently deletes every stored log entry on the gateway that matches the filters. Deleted logs cannot be recovered.`})){process.stderr.write(`Aborted.
|
|
70
70
|
`);return}let d=await o(`Deleting`,async()=>l.aiGateway.logs.delete({account_id:u,gateway_id:c[`gateway-id`],...s}));i(d,{successLabel:`Deleted`})})};function je(e){return e.usage(`$0 ai-gateway logs get-request <id>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-BcPM4I0s.mjs";import{i as t,n}from"./auth-CAWalgW0.mjs";import{a as r,t as i}from"./context-BBLtgdR1.mjs";import{t as a}from"./output-BOe-3AQG.mjs";import{t as o}from"./dry-run-DRj2_uV3.mjs";import{t as s}from"./progress-CQqDtgmF.mjs";import{t as c}from"./run-CW2Cgi0S.mjs";import"./telemetry-0Y5hAtCX.mjs";import{n as l,r as u,t as d}from"./body-parser-DkHKPkJ7.mjs";import{n as f,t as p}from"./input-validation-D7z60HJH.mjs";import{a as m,i as h,n as g}from"./prompt-C8FyienX.mjs";import{t as _}from"./cli-types-9oYmRTHJ.mjs";import{n as ee,t as te}from"./raw-fetch-DbXN3SlE.mjs";function v(e){return e.usage(`$0 ai-search chat-completions <instance-id>
|
|
3
|
+
|
|
4
|
+
Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>f(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-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>f(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>f(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>f(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 y={command:`chat-completions <instance-id>`,describe:`Chat Completions`,builder:v,handler:async t=>c({command:`ai-search chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/chat/completions`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.chatCompletions({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Created`});return}if(t.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}),h=await s(`Creating`,async()=>c.aiSearch.chatCompletions({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Created`})})};function b(e){return e.usage(`$0 ai-search create <namespace> <id>
|
|
5
|
+
|
|
6
|
+
Create a new AI Search instance with the given configuration. If type is omitted or null, a non-blank HTTP(S) source infers web-crawler and any other source infers r2; r2 sources must name an existing bucket. A missing or blank source without a type creates a managed upload-only instance.`).positional(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).coerce(`cache-threshold`,e=>f(e,`cache-threshold`,`text`)).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=>f(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.`,default:!0}).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).coerce(`indexing-options-keyword-tokenizer`,e=>f(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=>f(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=>f(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-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>f(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:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>f(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>f(e,`source-params-web-crawler-parse-type`,`text`)).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`Source type. When omitted or null with a non-blank source, HTTP(S) URLs infer web-crawler and existing R2 bucket names infer r2. A missing or blank source without a type uses managed upload-only storage.`,choices:[`r2`,`web-crawler`]}).coerce(`type`,e=>f(e,`type`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-* flag is set`)}return!0})}const x={command:`create <namespace> <id>`,describe:`Create an AI Search instance.`,builder:b,handler:async t=>c({command:`ai-search create`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.hybrid-search-enabled.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.type.dry-run`.split(`.`)}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:t[`cache-threshold`],chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:t[`fusion-method`],hybrid_search_enabled:t[`hybrid-search-enabled`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:t[`indexing-options-keyword-tokenizer`],use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:t[`metadata-created-from-emdash-plugin-type`],version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:t[`retrieval-options-keyword-match-mode`]},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:t[`source-params-web-crawler-discover-options-source`]},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:t[`source-params-web-crawler-parse-type`]}},token_id:f(t[`token-id`],`token-id`,`text`),type:t.type,id:t.id}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.create({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}let m=d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:t[`cache-threshold`],chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:t[`fusion-method`],hybrid_search_enabled:t[`hybrid-search-enabled`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:t[`indexing-options-keyword-tokenizer`],use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:t[`metadata-created-from-emdash-plugin-type`],version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:t[`retrieval-options-keyword-match-mode`]},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:t[`source-params-web-crawler-discover-options-source`]},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:t[`source-params-web-crawler-parse-type`]}},token_id:f(t[`token-id`],`token-id`,`text`),type:t.type,id:t.id}),h=await s(`Creating`,async()=>c.aiSearch.create({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function S(e){return e.usage(`$0 ai-search delete <instance-id>
|
|
7
|
+
|
|
8
|
+
Permanently delete an AI Search instance and all its indexed data.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const C={command:`delete <instance-id>`,describe:`Delete an AI Search instance.`,builder:S,handler:async t=>c({command:`ai-search delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
|
|
9
|
+
`);return}let u=await s(`Deleting`,async()=>c.aiSearch.delete({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Deleted`})})};function w(e){return e.usage(`$0 ai-search get <instance-id>
|
|
10
|
+
|
|
11
|
+
Retrieve the configuration and status of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const T={command:`get <instance-id>`,describe:`Get an AI Search instance.`,builder:w,handler:async t=>c({command:`ai-search get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Loaded`})})};function E(e){return e.usage(`$0 ai-search items chunks <item-id>
|
|
12
|
+
|
|
13
|
+
Lists chunks for a specific item in an AI Search instance, including their text content.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`offset`,{type:`number`,description:`Offset`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`chunks <item-id>`,describe:`List Item Chunks.`,builder:E,handler:async t=>c({command:`ai-search items chunks`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={limit:t.limit,offset:t.offset};if(t.dryRun){let e=await r();o({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/chunks`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.chunks({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`],...c}));a(d,{successLabel:`Loaded`})})};function O(e){return e.usage(`$0 ai-search items delete <item-id>
|
|
14
|
+
|
|
15
|
+
Deletes a file from a managed AI Search instance and removes its indexed data.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const k={command:`delete <item-id>`,describe:`Delete Item.`,builder:O,handler:async t=>c({command:`ai-search items delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force})){process.stderr.write(`Aborted.
|
|
16
|
+
`);return}let u=await s(`Deleting`,async()=>c.aiSearch.items.delete({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(u,{successLabel:`Deleted`})})};function A(e){return e.usage(`$0 ai-search items download <item-id>
|
|
17
|
+
|
|
18
|
+
Downloads the raw file content for a specific item from the managed AI Search instance storage.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`text`,{type:`boolean`,description:`Decode the response body as UTF-8 text instead of writing raw bytes`,default:!1})}const j={command:`download <item-id>`,describe:`Download Item Content.`,builder:A,handler:async t=>c({command:`ai-search items download`,classification:{safeFlags:[`dry-run`,`text`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/download`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}await n(t);let a=t.local?e:await i();t.accountId=a;let c=await s(`Loading`,async()=>te(`/accounts/${a}/ai-search/namespaces/${encodeURIComponent(String(t.namespace))}/instances/${encodeURIComponent(String(t[`instance-id`]))}/items/${encodeURIComponent(String(t[`item-id`]))}/download`,{method:`GET`,local:t.local===!0,persistTo:t.persistTo}));ee(t.text===!0?c.toString(`utf-8`):c)})};function M(e){return e.usage(`$0 ai-search items get <item-id>
|
|
19
|
+
|
|
20
|
+
Retrieves a specific indexed item from an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <item-id>`,describe:`Get Item.`,builder:M,handler:async t=>c({command:`ai-search items get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.items.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(u,{successLabel:`Loaded`})})};function P(e){return e.usage(`$0 ai-search items list
|
|
21
|
+
|
|
22
|
+
Lists indexed items in an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search`}).option(`sort-by`,{type:`string`,description:`Sort order for items. "status" (default) sorts by status priority then last_seen_at. "modified_at" sorts by file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Filter items by source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}`}).option(`item-id`,{type:`string`,description:`Filter items by their unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Filter items by their exact key (object key / filename). Keys are unique per source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`list`,describe:`Items List.`,builder:_(P),handler:async t=>c({command:`ai-search items list`,classification:{safeFlags:[`sort-by`,`status`,`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search,sort_by:t[`sort-by`],status:t.status,source:t.source,metadata_filter:t[`metadata-filter`],item_id:t[`item-id`],key:t.key};if(t.dryRun){let e=await r();o({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.list({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],...c}));a(d,{successLabel:`Loaded`})})};function I(e){return e.usage(`$0 ai-search items logs <item-id>
|
|
23
|
+
|
|
24
|
+
Lists processing logs for a specific item in an AI Search instance.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`limit`,{type:`number`,description:`Limit`}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`logs <item-id>`,describe:`Item Logs.`,builder:I,handler:async t=>c({command:`ai-search items logs`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={limit:t.limit,cursor:t.cursor};if(t.dryRun){let e=await r();o({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}/logs`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.items.logs({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`],...c}));a(d,{successLabel:`Loaded`})})};function R(e){return e.usage(`$0 ai-search items sync <item-id>
|
|
25
|
+
|
|
26
|
+
Syncs an item to an AI Search instance index.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).coerce(`next-action`,e=>f(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 is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const z={command:`sync <item-id>`,describe:`Sync Item.`,builder:R,handler:async t=>c({command:`ai-search items sync`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items/${t[`item-id`]==null?`<item-id>`:encodeURIComponent(String(t[`item-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"item-id":String(t[`item-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({next_action:t[`next-action`],wait_for_completion:t[`wait-for-completion`]}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.items.sync({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(n,{successLabel:`Updated`});return}t[`next-action`]===void 0&&(t[`next-action`]=await h(`next-action`,`The next_action field`,[`INDEX`]));let f=d({next_action:t[`next-action`],wait_for_completion:t[`wait-for-completion`]}),p=await s(`Updating`,async()=>c.aiSearch.items.sync({...f,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],item_id:t[`item-id`]}));a(p,{successLabel:`Updated`})})};function B(e){return e.usage(`$0 ai-search items upload <instance-id>
|
|
27
|
+
|
|
28
|
+
Uploads a file to a managed AI Search instance via multipart/form-data.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`metadata`,{type:`string`,description:`JSON string of custom metadata key-value pairs.`}).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. Defaults to false.`})}const V={command:`upload <instance-id>`,describe:`Upload Item.`,builder:B,handler:async l=>c({command:`ai-search items upload`,classification:{safeFlags:[`dry-run`]}},l,async()=>{if(l.dryRun){let e=await r();o({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${l.namespace==null?`<namespace>`:encodeURIComponent(String(l.namespace))}/instances/${l[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(l[`instance-id`]))}/items`,pathParams:{"instance-id":String(l[`instance-id`]??``),namespace:String(l.namespace??``)},bodyKind:`multipart`,body:{body:l.body,file:l.file,metadata:l.metadata,"wait-for-completion":l[`wait-for-completion`]}});return}let c=await n(l),u=l.local?e:await i();if(l.accountId=u,l.file!==void 0||l.body!==void 0||l.metadata!==void 0||l[`wait-for-completion`]!==void 0){let e=new FormData;if(l.file){let t=p(l.file);e.append(`file`,new Blob([t]),l.file.split(/[\\/]/).filter(Boolean).pop())}else l.body!==void 0&&e.append(`file`,l.body);l.metadata!==void 0&&e.append(`metadata`,String(f(l.metadata,`metadata`,`text`)??``)),l[`wait-for-completion`]!==void 0&&e.append(`wait_for_completion`,String(l[`wait-for-completion`]));let n=await s(`Creating`,async()=>t(c,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(l.namespace))}/instances/${encodeURIComponent(String(l[`instance-id`]))}/items`,{body:e}));a(n,{successLabel:`Created`});return}if(l.body){let e=f(l.body,`body`,`binary`),n=await s(`Creating`,async()=>t(c,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(l.namespace))}/instances/${encodeURIComponent(String(l[`instance-id`]))}/items`,{body:e,headers:{"Content-Type":`multipart/form-data`}}));a(n,{successLabel:`Created`});return}if(l.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function H(e){return e.usage(`$0 ai-search items upsert <instance-id>
|
|
29
|
+
|
|
30
|
+
Creates or updates an indexed item in an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`key`,{type:`string`,description:`Item key / filename. Must not exceed 128 characters.`}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).coerce(`next-action`,e=>f(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 is not interrupted and can exceed that budget. If confirmation times out, the current item state is returned and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const U={command:`upsert <instance-id>`,describe:`Create or Update Item.`,builder:H,handler:async t=>c({command:`ai-search items upsert`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/items`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({key:f(t.key,`key`,`text`),next_action:t[`next-action`],wait_for_completion:t[`wait-for-completion`]}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.items.upsert({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}t.key===void 0&&(t.key=await m(`key`,`Item key / filename. Must not exceed 128 characters.`)),t[`next-action`]===void 0&&(t[`next-action`]=await h(`next-action`,`The next_action field`,[`INDEX`]));let p=d({key:f(t.key,`key`,`text`),next_action:t[`next-action`],wait_for_completion:t[`wait-for-completion`]}),g=await s(`Updating`,async()=>c.aiSearch.items.upsert({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(g,{successLabel:`Updated`})})},W={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.usage(`$0 ai-search jobs cancel <job-id>
|
|
31
|
+
|
|
32
|
+
Cancel an in-progress indexing job for an AI Search instance.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).coerce(`action`,e=>f(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 K={command:`cancel <job-id>`,describe:`Cancel an indexing job.`,builder:G,handler:async t=>c({command:`ai-search jobs cancel`,classification:{safeFlags:[`action`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({action:t.action}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,!await g({force:!!t.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
|
|
33
|
+
`);return}if(t.body){let e=l(t.body),n=await s(`Deleting`,async()=>c.aiSearch.jobs.cancel({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(n,{successLabel:`Deleted`});return}t.action===void 0&&(t.action=await h(`action`,`The action field`,[`cancel`]));let f=d({action:t.action}),p=await s(`Deleting`,async()=>c.aiSearch.jobs.cancel({...f,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(p,{successLabel:`Deleted`})})};function q(e){return e.usage(`$0 ai-search jobs create <instance-id>
|
|
34
|
+
|
|
35
|
+
Creates a new indexing job for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`description`,{type:`string`,description:`The description field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const J={command:`create <instance-id>`,describe:`Create new job`,builder:q,handler:async t=>c({command:`ai-search jobs create`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`)}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.jobs.create({...e,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Created`});return}let p=d({description:f(t.description,`description`,`text`)}),m=await s(`Creating`,async()=>c.aiSearch.jobs.create({...p,account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(m,{successLabel:`Created`})})};function Y(e){return e.usage(`$0 ai-search jobs get <job-id>
|
|
36
|
+
|
|
37
|
+
Retrieves details for a specific AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`get <job-id>`,describe:`Get a Job Details`,builder:Y,handler:async t=>c({command:`ai-search jobs get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.jobs.get({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`]}));a(u,{successLabel:`Loaded`})})};function Z(e){return e.usage(`$0 ai-search jobs list
|
|
38
|
+
|
|
39
|
+
Lists indexing jobs for an AI Search instance.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`list`,describe:`List Jobs`,builder:Z,handler:async t=>c({command:`ai-search jobs list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`]};if(t.dryRun){let e=await r();o({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.jobs.list({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],...c}));a(d,{successLabel:`Loaded`})})};function ne(e){return e.usage(`$0 ai-search jobs logs <job-id>
|
|
40
|
+
|
|
41
|
+
Lists log entries for an AI Search indexing job.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`logs <job-id>`,describe:`List Job Logs`,builder:ne,handler:async t=>c({command:`ai-search jobs logs`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`]};if(t.dryRun){let e=await r();o({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/jobs/${t[`job-id`]==null?`<job-id>`:encodeURIComponent(String(t[`job-id`]))}/logs`,pathParams:{"instance-id":String(t[`instance-id`]??``),"job-id":String(t[`job-id`]??``),namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.jobs.logs({account_id:u,namespace:t.namespace,"instance-id":t[`instance-id`],job_id:t[`job-id`],...c}));a(d,{successLabel:`Loaded`})})},ie={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(K).command(J).command(X).command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.usage(`$0 ai-search list
|
|
42
|
+
|
|
43
|
+
List all AI Search instances in the account.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`hostname`,{type:`string`,description:`Filter by exact Search for Agents hostname (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`List AI Search instances.`,builder:_(ae),handler:async t=>c({command:`ai-search list`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search,hostname:t.hostname,order_by:t[`order-by`],order_by_direction:t[`order-by-direction`]};if(t.dryRun){let e=await r();o({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances`,pathParams:{namespace:String(t.namespace??``)},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.list({account_id:u,namespace:t.namespace,...c}));a(d,{successLabel:`Loaded`})})};function se(e){return e.usage(`$0 ai-search move <instance-id>
|
|
44
|
+
|
|
45
|
+
Moves an instance from its current namespace to the specified target namespace. Use 'default' with --destination-namespace to move the instance back to the default namespace. Fails with 400 if the target namespace already has an instance with the same id (ids must be unique within a namespace — the same id can exist in different namespaces).`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`source-namespace`,{type:`string`,description:`Namespace currently containing the instance.`,demandOption:!0}).option(`destination-namespace`,{type:`string`,description:`Target namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`move <instance-id>`,describe:`Move an instance to a different namespace.`,builder:se,handler:async t=>c({command:`ai-search move`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t[`source-namespace`]==null?`<source-namespace>`:encodeURIComponent(String(t[`source-namespace`]))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"source-namespace":String(t[`source-namespace`]??``),"instance-id":String(t[`instance-id`]??``)},bodyKind:`json`,body:t.body===void 0?d({new_namespace:f(t[`destination-namespace`],`destination-namespace`,`text`)}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.move({...e,account_id:u,"source-namespace":t[`source-namespace`],"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}t[`destination-namespace`]===void 0&&(t[`destination-namespace`]=await m(`destination-namespace`,`Target namespace to move the instance into.`));let p=d({new_namespace:f(t[`destination-namespace`],`destination-namespace`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.move({...p,account_id:u,"source-namespace":t[`source-namespace`],"instance-id":t[`instance-id`]}));a(h,{successLabel:`Updated`})})};function le(e){return e.usage(`$0 ai-search multi-chat-completions <namespace>
|
|
46
|
+
|
|
47
|
+
Performs a chat completion request against multiple AI Search instances in parallel, merging retrieved content as context for generating a response.`).positional(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>f(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-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>f(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>f(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>f(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ue={command:`multi-chat-completions <namespace>`,describe:`Multi-Instance Chat Completions`,builder:le,handler:async t=>c({command:`ai-search multi-chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/chat/completions`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.multiChatCompletions({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);if(t.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),model:f(t.model,`model`,`text`),stream:t.stream}),h=await s(`Creating`,async()=>c.aiSearch.multiChatCompletions({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function de(e){return e.usage(`$0 ai-search multi-search <namespace> <query>
|
|
48
|
+
|
|
49
|
+
Performs a semantic search query against multiple AI Search instances in parallel, merging the retrieved results into a single ranked response.`).positional(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>f(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-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>f(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>f(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`,default:.4}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`,default:10}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>f(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`multi-search <namespace> <query>`,describe:`Multi-Instance Search`,builder:de,handler:async t=>c({command:`ai-search multi-search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/search`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.multiSearch({...e,account_id:p,namespace:t.namespace}));a(n,{successLabel:`Created`});return}if(t[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let m=d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},instance_ids:t[`ai-search-options-instance-ids`],query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}),h=await s(`Creating`,async()=>c.aiSearch.multiSearch({...m,account_id:p,namespace:t.namespace}));a(h,{successLabel:`Created`})})};function pe(e){return e.usage(`$0 ai-search namespace create <namespace>
|
|
50
|
+
|
|
51
|
+
Create a namespace for organizing AI Search instances.`).positional(`namespace`,{type:`string`,description:`Name for the new namespace.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>f(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 me={command:`create <namespace>`,describe:`Create a namespace`,builder:pe,handler:async t=>c({command:`ai-search namespace create`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},name:t.namespace}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.namespace.create({...e,account_id:u}));a(n,{successLabel:`Created`});return}let p=d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},name:t.namespace}),m=await s(`Creating`,async()=>c.aiSearch.namespace.create({...p,account_id:u}));a(m,{successLabel:`Created`})})};function he(e){return e.usage(`$0 ai-search namespace delete <namespace>
|
|
52
|
+
|
|
53
|
+
Permanently delete a namespace. The namespace must be empty (no instances), and the default namespace cannot be deleted.`).positional(`namespace`,{type:`string`,description:`Namespace to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ge={command:`delete <namespace>`,describe:`Delete a namespace`,builder:he,handler:async t=>c({command:`ai-search namespace delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
|
|
54
|
+
`);return}let u=await s(`Deleting`,async()=>c.aiSearch.namespace.delete({account_id:l,namespace:t.namespace}));a(u,{successLabel:`Deleted`})})};function _e(e){return e.usage(`$0 ai-search namespace get <namespace>
|
|
55
|
+
|
|
56
|
+
Retrieve a namespace and its description.`).positional(`namespace`,{type:`string`,description:`Namespace to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`get <namespace>`,describe:`Get a namespace`,builder:_e,handler:async t=>c({command:`ai-search namespace get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.namespace.get({account_id:l,namespace:t.namespace}));a(u,{successLabel:`Loaded`})})};function ye(e){return e.usage(`$0 ai-search namespace list
|
|
57
|
+
|
|
58
|
+
List namespaces in the account, including their descriptions and creation times.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`list`,describe:`List namespaces`,builder:ye,handler:async t=>c({command:`ai-search namespace list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){let e=await r();o({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.namespace.list({account_id:u,...c}));a(d,{successLabel:`Loaded`})})};function xe(e){return e.usage(`$0 ai-search namespace update <namespace>
|
|
59
|
+
|
|
60
|
+
Update the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`).positional(`namespace`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must be an existing instance in this namespace, and the list cannot exceed the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>f(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 Se={command:`update <namespace>`,describe:`Update a namespace`,builder:xe,handler:async t=>c({command:`ai-search namespace update`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}`,pathParams:{namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}}}):l(t.body)});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.namespace.update({...e,account_id:u,namespace:t.namespace}));a(n,{successLabel:`Updated`});return}let p=d({description:f(t.description,`description`,`text`),public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],instances_allowed:t[`public-endpoint-params-instances-allowed`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}}}),m=await s(`Updating`,async()=>c.aiSearch.namespace.update({...p,account_id:u,namespace:t.namespace}));a(m,{successLabel:`Updated`})})},Ce={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(me).command(ge).command(ve).command(be).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function we(e){return e.usage(`$0 ai-search purge-cache <instance-id>
|
|
61
|
+
|
|
62
|
+
Purges all cached search results for an AI Search instance. A new internal cache key is generated, immediately orphaning all prior cached entries.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`purge-cache <instance-id>`,describe:`Purge search cache.`,builder:we,handler:async t=>c({command:`ai-search purge-cache`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/purge_cache`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Creating`,async()=>c.aiSearch.purgeCache({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Created`})})};function Ee(e){return e.usage(`$0 ai-search search <instance-id> <query>
|
|
63
|
+
|
|
64
|
+
Executes a semantic search query against an AI Search instance to find relevant indexed content.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).positional(`query`,{type:`string`,description:`Text to search for.`}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>f(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-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>f(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>f(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`The ai_search_options.retrieval.match_threshold field`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`The ai_search_options.retrieval.max_num_results field`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>f(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 De={command:`search <instance-id> <query>`,describe:`Search`,builder:Ee,handler:async t=>c({command:`ai-search search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/search`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Loading`,async()=>c.aiSearch.search({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Loaded`});return}let m=d({ai_search_options:{cache:{cache_threshold:t[`ai-search-options-cache-cache-threshold`],enabled:t[`ai-search-options-cache-enabled`]},query_rewrite:{enabled:t[`ai-search-options-query-rewrite-enabled`],model:f(t[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:f(t[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:t[`ai-search-options-reranking-enabled`],match_threshold:t[`ai-search-options-reranking-match-threshold`],model:f(t[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:t[`ai-search-options-retrieval-context-expansion`],fusion_method:t[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:t[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:t[`ai-search-options-retrieval-match-threshold`],max_num_results:t[`ai-search-options-retrieval-max-num-results`],retrieval_type:t[`ai-search-options-retrieval-retrieval-type`],return_on_failure:t[`ai-search-options-retrieval-return-on-failure`]}},messages:u(t.messages,`messages`),query:t.query}),h=await s(`Loading`,async()=>c.aiSearch.search({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Loaded`})})};function Oe(e){return e.usage(`$0 ai-search stats <instance-id>
|
|
65
|
+
|
|
66
|
+
Retrieve usage and indexing statistics for an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ke={command:`stats <instance-id>`,describe:`Get instance statistics.`,builder:Oe,handler:async t=>c({command:`ai-search stats`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}/stats`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.stats({account_id:l,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(u,{successLabel:`Loaded`})})};function Ae(e){return e.usage(`$0 ai-search tokens create <name>
|
|
67
|
+
|
|
68
|
+
Create a stored Cloudflare credential for an AI Search instance to access its data source.`).positional(`name`,{type:`string`,description:`Human-readable name for the credential.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const je={command:`create <name>`,describe:`Create a token`,builder:Ae,handler:async t=>c({command:`ai-search tokens create`,classification:{safeFlags:[`legacy`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:t.body===void 0?d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:t.name}):l(t.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Creating`,async()=>c.aiSearch.tokens.create({...e,account_id:u}));a(n,{successLabel:`Created`});return}t[`api-token-id`]===void 0&&(t[`api-token-id`]=await m(`api-token-id`,`The cf_api_id field`)),t[`api-token`]===void 0&&(t[`api-token`]=await m(`api-token`,`The cf_api_key field`,{kind:`secret`}));let p=d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:t.name}),h=await s(`Creating`,async()=>c.aiSearch.tokens.create({...p,account_id:u}));a(h,{successLabel:`Created`})})};function Me(e){return e.usage(`$0 ai-search tokens delete <token-id>
|
|
69
|
+
|
|
70
|
+
Permanently delete a stored AI Search credential. Credentials in use by an instance cannot be deleted.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ne={command:`delete <token-id>`,describe:`Delete a token`,builder:Me,handler:async t=>c({command:`ai-search tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();if(t.accountId=l,!await g({force:!!t.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
|
|
71
|
+
`);return}let u=await s(`Deleting`,async()=>c.aiSearch.tokens.delete({account_id:l,"token-id":t[`token-id`]}));a(u,{successLabel:`Deleted`})})};function Pe(e){return e.usage(`$0 ai-search tokens get <token-id>
|
|
72
|
+
|
|
73
|
+
Retrieve a stored AI Search credential without exposing its secret.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <token-id>`,describe:`Get a token`,builder:Pe,handler:async t=>c({command:`ai-search tokens get`,classification:{safeFlags:[`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`none`});return}let c=await n(t),l=t.local?e:await i();t.accountId=l;let u=await s(`Loading`,async()=>c.aiSearch.tokens.get({account_id:l,"token-id":t[`token-id`]}));a(u,{successLabel:`Loaded`})})};function Fe(e){return e.usage(`$0 ai-search tokens list
|
|
74
|
+
|
|
75
|
+
List stored AI Search credentials in the account without exposing their secrets.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ie={command:`list`,describe:`List tokens`,builder:Fe,handler:async t=>c({command:`ai-search tokens list`,classification:{safeFlags:[`dry-run`]}},t,async()=>{let c={page:t.page,per_page:t[`per-page`],search:t.search};if(t.dryRun){let e=await r();o({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(t),u=t.local?e:await i();t.accountId=u;let d=await s(`Loading`,async()=>l.aiSearch.tokens.list({account_id:u,...c}));a(d,{successLabel:`Loaded`})})};function Le(e){return e.usage(`$0 ai-search tokens update <token-id>
|
|
76
|
+
|
|
77
|
+
Replace a stored AI Search credential and invalidate cached credentials for instances that use it.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`api-token-id`,{type:`string`,description:`The cf_api_id field`}).option(`api-token`,{type:`string`,description:`The cf_api_key field`}).option(`legacy`,{type:`boolean`,description:`The legacy field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Re={command:`update <token-id>`,describe:`Update a token`,builder:Le,handler:async t=>c({command:`ai-search tokens update`,classification:{safeFlags:[`legacy`,`dry-run`]}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens/${t[`token-id`]==null?`<token-id>`:encodeURIComponent(String(t[`token-id`]))}`,pathParams:{"token-id":String(t[`token-id`]??``)},bodyKind:`json`,body:t.body===void 0?d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:f(t.name,`name`,`text`)}):l(t.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let c=await n(t),u=t.local?e:await i();if(t.accountId=u,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.tokens.update({...e,account_id:u,"token-id":t[`token-id`]}));a(n,{successLabel:`Updated`});return}t[`api-token-id`]===void 0&&(t[`api-token-id`]=await m(`api-token-id`,`The cf_api_id field`)),t[`api-token`]===void 0&&(t[`api-token`]=await m(`api-token`,`The cf_api_key field`,{kind:`secret`})),t.name===void 0&&(t.name=await m(`name`,`The name field`));let p=d({cf_api_id:f(t[`api-token-id`],`api-token-id`,`text`),cf_api_key:f(t[`api-token`],`api-token`,`text`),legacy:t.legacy,name:f(t.name,`name`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.tokens.update({...p,account_id:u,"token-id":t[`token-id`]}));a(h,{successLabel:`Updated`})})},ze={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(je).command(Ne).command($).command(Ie).command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.usage(`$0 ai-search update <instance-id>
|
|
78
|
+
|
|
79
|
+
Update the configuration of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`cache-threshold`,e=>f(e,`cache-threshold`,`text`)).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=>f(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=>f(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=>f(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=>f(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-keyword-match-mode`,{type:`string`,description:`Controls which documents are candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term, ranked by BM25 relevance. When omitted on an update, the existing stored value is preserved; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>f(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:`The score_threshold field`}).option(`source`,{type:`string`,description:`The source field`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts are limited to 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` — discover crawls are restricted to the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>f(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How URLs are discovered. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to be a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>f(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(`system-prompt-ai-search`,{type:`string`,description:`The system_prompt_ai_search field`}).option(`system-prompt-index-summarization`,{type:`string`,description:`The system_prompt_index_summarization field`}).option(`system-prompt-rewrite-query`,{type:`string`,description:`The system_prompt_rewrite_query field`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-* flag is set`)}return!0})}const Ve={command:`update <instance-id>`,describe:`Update an AI Search instance.`,builder:Be,handler:async t=>c({command:`ai-search update`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.paused.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.summarization.dry-run`.split(`.`)}},t,async()=>{if(t.dryRun){let e=await r();o({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces/${t.namespace==null?`<namespace>`:encodeURIComponent(String(t.namespace))}/instances/${t[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(t[`instance-id`]))}`,pathParams:{"instance-id":String(t[`instance-id`]??``),namespace:String(t.namespace??``)},bodyKind:`json`,body:t.body===void 0?d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:t[`cache-threshold`],chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:t[`fusion-method`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:t[`indexing-options-keyword-tokenizer`],use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:t[`metadata-created-from-emdash-plugin-type`],version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:t[`retrieval-options-keyword-match-mode`]},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:t[`source-params-web-crawler-discover-options-source`]},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:t[`source-params-web-crawler-parse-type`]}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)}):l(t.body)});return}let c=await n(t),p=t.local?e:await i();if(t.accountId=p,t.body){let e=l(t.body),n=await s(`Updating`,async()=>c.aiSearch.update({...e,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(n,{successLabel:`Updated`});return}let m=d({ai_gateway_id:f(t[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:f(t[`ai-search-model`],`ai-search-model`,`text`),cache:t.cache,cache_threshold:t[`cache-threshold`],chunk:t.chunk,chunk_overlap:t[`chunk-overlap`],chunk_size:t[`chunk-size`],custom_metadata:u(t[`custom-metadata`],`custom-metadata`),embedding_model:f(t[`embedding-model`],`embedding-model`,`text`),fusion_method:t[`fusion-method`],index_method:{keyword:t[`index-method-keyword`],vector:t[`index-method-vector`]},indexing_options:{keyword_tokenizer:t[`indexing-options-keyword-tokenizer`],use_ocr:t[`indexing-options-use-ocr`]},max_num_results:t[`max-num-results`],metadata:{created_from_aisearch_wizard:t[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:t[`metadata-created-from-emdash-plugin-type`],version:f(t[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:f(t[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:t.paused,public_endpoint_params:{authorized_hosts:t[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:t[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:t[`public-endpoint-params-custom-domains`],default_domain_enabled:t[`public-endpoint-params-default-domain-enabled`],enabled:t[`public-endpoint-params-enabled`],mcp:{description:f(t[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:t[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:t[`public-endpoint-params-rate-limit-period-ms`],requests:t[`public-endpoint-params-rate-limit-requests`],technique:t[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:t[`public-endpoint-params-search-endpoint-disabled`]}},reranking:t.reranking,reranking_model:f(t[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:t[`retrieval-options-keyword-match-mode`]},rewrite_model:f(t[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:t[`rewrite-query`],score_threshold:t[`score-threshold`],source:f(t.source,`source`,`text`),source_params:{exclude_items:t[`source-params-exclude-items`],include_items:t[`source-params-include-items`],prefix:f(t[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:f(t[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:t[`source-params-web-crawler-discover-options-depth`],include_external_links:t[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:t[`source-params-web-crawler-discover-options-include-subdomains`],limit:t[`source-params-web-crawler-discover-options-limit`],max_age:t[`source-params-web-crawler-discover-options-max-age`],source:t[`source-params-web-crawler-discover-options-source`]},parse_options:{include_images:t[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:t[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:t[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:t[`source-params-web-crawler-parse-type`]}},summarization:t.summarization,summarization_model:f(t[`summarization-model`],`summarization-model`,`text`),system_prompt_ai_search:f(t[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:f(t[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:f(t[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:f(t[`token-id`],`token-id`,`text`)}),h=await s(`Updating`,async()=>c.aiSearch.update({...m,account_id:p,namespace:t.namespace,"instance-id":t[`instance-id`]}));a(h,{successLabel:`Updated`})})},He={command:`ai-search`,describe:`Managed search-as-a-service: crawl, index, and query content with AI-powered relevance and chat completions`,builder:e=>e.command(y).command(x).command(C).command(T).command(oe).command(ce).command(ue).command(fe).command(Te).command(De).command(ke).command(Ve).command(W).command(ie).command(Ce).command(ze).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{He as default};
|