cf 1.0.0-beta.18 → 1.0.0-beta.19
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/README.md +7 -0
- package/dist/_meta/commands.json +3003 -1544
- package/dist/_meta/hand-written-commands.json +6 -0
- package/dist/_meta/schemas.json +2127 -1070
- package/dist/{abuse-reports-Ce-g5uZP.mjs → abuse-reports-DhgunVFo.mjs} +3 -3
- package/dist/{access-BtsMwesh.mjs → access-BDoDq_WZ.mjs} +1 -1
- package/dist/{accounts-X5QVzEUW.mjs → accounts-DLTCzZJg.mjs} +24 -26
- package/dist/{acm-C_NepMi6.mjs → acm-DS1CosYq.mjs} +1 -1
- package/dist/{addressing-BkQY1hoA.mjs → addressing-DFeYj8TY.mjs} +2 -2
- package/dist/{agent-memory-1OPgC3lK.mjs → agent-memory-DXjQ8N0g.mjs} +1 -1
- package/dist/{ai-Bb0_Zknm.mjs → ai-V5YopMkS.mjs} +4 -4
- package/dist/{ai-audit-DuEjVdML.mjs → ai-audit-yg8D0azz.mjs} +2 -2
- package/dist/{ai-gateway-Cm2vWMSI.mjs → ai-gateway--dkH9qGz.mjs} +13 -13
- package/dist/ai-search-BRtsUaUI.mjs +79 -0
- package/dist/{ai-security-A2STvE1b.mjs → ai-security-DRJCcLpF.mjs} +1 -1
- package/dist/{alerting-CIwSk-Ks.mjs → alerting-8DsyMKGG.mjs} +30 -30
- package/dist/{analytics-H--uM3DA.mjs → analytics-BpYUZTtQ.mjs} +1 -1
- package/dist/{analytics-engine-Alu7cllT.mjs → analytics-engine-CT2E0Dkw.mjs} +1 -1
- package/dist/{api-security-D-pcnhUL.mjs → api-security-CBhWZE8z.mjs} +6 -6
- package/dist/{argo-Lvmcx3am.mjs → argo-B0u2N3Dh.mjs} +1 -1
- package/dist/{artifacts-xT5S-mVa.mjs → artifacts-B6XzjMiM.mjs} +1 -1
- package/dist/{audit-logs-DEoRBLkU.mjs → audit-logs-59fCc1aw.mjs} +1 -1
- package/dist/auth-5cgi8ePZ.mjs +2 -0
- package/dist/auth-BaUNb1Ed.mjs +2 -0
- package/dist/auth-ChYOc_rS.mjs +2 -0
- package/dist/{auth-token-D9XIPlwf.mjs → auth-token-B1pP2jaK.mjs} +1 -1
- package/dist/{autoconfig-9po_tqsS.mjs → autoconfig-Cdm2IFLM.mjs} +20 -20
- package/dist/{basin-catalog-DFHt3cWi.mjs → basin-catalog-CV05WlA4.mjs} +1 -1
- package/dist/{billing-Bm2JNSGa.mjs → billing-Ad-rK-JH.mjs} +3 -3
- package/dist/{blocks-Bat9A8V_.mjs → blocks-CKb_aLWN.mjs} +1 -1
- package/dist/body-parser-ChnyBsfm.mjs +2 -0
- package/dist/{bot-management-CSr38g-O.mjs → bot-management-CGpfjQ4w.mjs} +1 -1
- package/dist/{botnet-feed-ebeWWSJj.mjs → botnet-feed-CMrF6ZGq.mjs} +1 -1
- package/dist/{brand-protection-BCn9Mv-d.mjs → brand-protection-CP73_yX8.mjs} +1 -1
- package/dist/{browser-run-BcWxzhAn.mjs → browser-run-OpUfawh_.mjs} +21 -21
- package/dist/{build-i8l2qGVZ.mjs → build-CMPlf8mh.mjs} +1 -1
- package/dist/build-DQZ2w_dQ.mjs +2 -0
- package/dist/{builds-BMwDzi7G.mjs → builds-DsRNlILV.mjs} +39 -39
- package/dist/{cache-_VaTLC5T.mjs → cache-RppXjxXA.mjs} +3 -3
- package/dist/{cf-Bq4pA4n6.mjs → cf-PISMdEje.mjs} +11 -11
- package/dist/{chunk-2HLTAS5V-D7COzUOd.mjs → chunk-2HLTAS5V-B92NbX1j.mjs} +1 -1
- package/dist/{chunk-2K52M2W5-CYxfQXUq.mjs → chunk-2K52M2W5-c__08AOB.mjs} +7 -7
- package/dist/chunk-DSGVRFIS-DfQO1boa.mjs +2 -0
- package/dist/{cli-P3q5DG3W.mjs → cli-Dd1n2YAJ.mjs} +1 -1
- package/dist/{client-side-security-CjSXrpa9.mjs → client-side-security-BYfwOkUo.mjs} +1 -1
- package/dist/{cloud-connector-BPJBeP06.mjs → cloud-connector-CQZUqAMQ.mjs} +2 -2
- package/dist/{cloudflared-By8BzYXc.mjs → cloudflared-C1SdXpYv.mjs} +1 -1
- package/dist/{cloudforce-one-DXX31GMi.mjs → cloudforce-one-C1xdpspb.mjs} +200 -210
- package/dist/{command-Bkc04OyY.mjs → command-BioiZMm9.mjs} +1 -1
- package/dist/{command-BbsPxJBT.mjs → command-C0nJ2LRd.mjs} +1 -1
- package/dist/{command-DDcBC4px.mjs → command-C5ARgURy.mjs} +1 -1
- package/dist/{command-CL7LLXM7.mjs → command-C7NIRU-u.mjs} +1 -1
- package/dist/{command-BXiA79DP.mjs → command-C8DV-x_C.mjs} +1 -1
- package/dist/{command-BtTc28ql.mjs → command-CFV1cqfR.mjs} +1 -1
- package/dist/{command-NoxvOARP.mjs → command-ChQXv0jP.mjs} +1 -1
- package/dist/{command-DCQgsd2U.mjs → command-D203VrTG.mjs} +1 -1
- package/dist/{command-DZfKHiru.mjs → command-D5BUzDX8.mjs} +1 -1
- package/dist/{command-CBZhxmKD.mjs → command-DWE7YdeC.mjs} +1 -1
- package/dist/{command-C6w1OdoC.mjs → command-DlB10kIb.mjs} +1 -1
- package/dist/{command-CxWLFv5Y.mjs → command-DmPQXNRg.mjs} +1 -1
- package/dist/{command-Bgb-3yPg.mjs → command-F0jlqvKr.mjs} +1 -1
- package/dist/{command-DppVezAB.mjs → command-FOQNhNqP.mjs} +1 -1
- package/dist/{command-CYyfigfC.mjs → command-yAXk5NXh.mjs} +1 -1
- package/dist/{completions-CrDmwKnK.mjs → completions-Bh0Hz-hA.mjs} +3 -3
- package/dist/{connector-interrupts-V4HGULCM.mjs → connector-interrupts-Bd949WX0.mjs} +1 -1
- package/dist/{connector-telemetry-events-D9mTcfbJ.mjs → connector-telemetry-events-Dw8iIg5Q.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-COrPVKol.mjs → connector-telemetry-snapshots-DqEIaz99.mjs} +1 -1
- package/dist/{connectors-DvVlxGDx.mjs → connectors-RUEU1QDB.mjs} +1 -1
- package/dist/containers-xU-0EhLO.mjs +78 -0
- package/dist/{containers-BtcOgwm5.mjs → containers-yUOvm-4V.mjs} +211 -211
- package/dist/{content-scan-DldLmTjy.mjs → content-scan-Cm2-Xhqo.mjs} +2 -2
- package/dist/{context-C_a8oSY9.mjs → context-BQ6KeMgq.mjs} +2 -2
- package/dist/{cps-REo1OWP1.mjs → cps-CgPduy0H.mjs} +1 -1
- package/dist/{csam-scanner-CIbbdoJK.mjs → csam-scanner-B0Ra6fXL.mjs} +1 -1
- package/dist/{custom-csrs-iGNc3rSZ.mjs → custom-csrs-6lfu1-RR.mjs} +1 -1
- package/dist/{custom-hostnames-BNxYbTyu.mjs → custom-hostnames-Dzov_CPw.mjs} +15 -15
- package/dist/{custom-nameservers-BMJoTSlQ.mjs → custom-nameservers-Bfhv_9_k.mjs} +1 -1
- package/dist/{custom-pages-Qdemt1Fm.mjs → custom-pages-DxVD_f10.mjs} +1 -1
- package/dist/{d1-DvCiQibO.mjs → d1-D7p4uJ-e.mjs} +10 -12
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-K664XPOb.mjs → deploy-BjWvVZol.mjs} +1 -1
- package/dist/deploy-context-C-ZdGP0Z.mjs +56 -0
- package/dist/{deploy-input-KK6yyBN_.mjs → deploy-input-B8Nq6Eh6.mjs} +1 -1
- package/dist/{dev-CnoMHxf4.mjs → dev-D20UkcYT.mjs} +1 -1
- package/dist/{diagnostics-Cw0mtcep.mjs → diagnostics-DdhTemYB.mjs} +1 -1
- package/dist/{dialog-D4Y9ocuF.mjs → dialog-BnIgdgWi.mjs} +1 -1
- package/dist/discover-DEjUARkU.mjs +2 -0
- package/dist/{dist-DZRTPMMA.mjs → dist-CnKd5XoR.mjs} +19 -19
- package/dist/{dist-uRuGmkMB.mjs → dist-DAeCUX-u.mjs} +3 -3
- package/dist/{dls-DoqfqutH.mjs → dls-BBODA9Rk.mjs} +1 -1
- package/dist/{dns-DC6WcO3m.mjs → dns-CK_hyn5q.mjs} +5 -5
- package/dist/{dns-firewall-DpQH9BCE.mjs → dns-firewall-DbvX9R-7.mjs} +1 -1
- package/dist/{docs-CqNRBHab.mjs → docs-BDTijwM3.mjs} +1 -1
- package/dist/{dot-prop-IITUZ2XW-BnPfnQkb.mjs → dot-prop-IITUZ2XW-C4pkmT-K.mjs} +1 -1
- package/dist/{dotenv-usOKkeW7.mjs → dotenv-Ck-6V1hm.mjs} +1 -1
- package/dist/{dry-run-C2KjGX10.mjs → dry-run-DQmFkNK_.mjs} +1 -1
- package/dist/{durable-objects-CJDDy3CC.mjs → durable-objects-DcFbd1Ka.mjs} +1 -1
- package/dist/{email-auth--NHg1TjG.mjs → email-auth-BEgDxU-g.mjs} +1 -1
- package/dist/{email-routing-COjENK55.mjs → email-routing-DKWmPOVo.mjs} +1 -1
- package/dist/{email-security-rdjH95T2.mjs → email-security-RWbAp8qa.mjs} +15 -15
- package/dist/{email-sending-26VJhR6Q.mjs → email-sending-BbJy_vl8.mjs} +1 -1
- package/dist/error-sanitization-Byb-_IS9.mjs +2 -0
- package/dist/{error-sanitization-pOyzm2F1.mjs → error-sanitization-DWJ5ka7h.mjs} +1 -1
- package/dist/{field-extractors-DBOvGOwz.mjs → field-extractors-Bob6udAc.mjs} +1 -1
- package/dist/{firewall-D8K93ffF.mjs → firewall-DziiEsR8.mjs} +1 -1
- package/dist/{flagship-CHdmCmvQ.mjs → flagship-xOtgddUK.mjs} +1 -1
- package/dist/{fraud-CY4TV5Vc.mjs → fraud-BUS7i5Yh.mjs} +1 -1
- package/dist/generate-D6V4Q58z.mjs +2 -0
- package/dist/get-BTisquA3.mjs +2 -0
- package/dist/{google-tag-gateway-DzSt4wlz.mjs → google-tag-gateway-DgSzyeK-.mjs} +1 -1
- package/dist/{gt-3bcLGJ7V.mjs → gt-D6YemCLh.mjs} +1 -1
- package/dist/{healthchecks-B52Mf3uL.mjs → healthchecks-CbD2PsnM.mjs} +1 -1
- package/dist/{hyperdrive-CHsW0r6Z.mjs → hyperdrive-Cs_cfSXU.mjs} +1 -1
- package/dist/{iam-o1n9eUXf.mjs → iam-DvsCztqU.mjs} +5 -5
- package/dist/{images-CJHAGxX6.mjs → images-BipVjHNw.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init-LvFgCsNX.mjs +43 -0
- package/dist/{intel-B3S1gxUg.mjs → intel-D1LPkkBM.mjs} +31 -41
- package/dist/{interactive-BW9T1D1q.mjs → interactive-d_lFnSev.mjs} +3 -3
- package/dist/interactive-pjVqirHx.mjs +2 -0
- package/dist/{ips-q_UJMiy8.mjs → ips-2iUGs8ws.mjs} +1 -1
- package/dist/{k2-BNqVZnDN.mjs → k2-DGzRm3NJ.mjs} +1 -1
- package/dist/{kv-B0nXSOcW.mjs → kv-BW-s9MJY.mjs} +4 -4
- package/dist/{lazy-command-4ccdBqrc.mjs → lazy-command-Bq-rWPQe.mjs} +1 -1
- package/dist/{leaked-credential-checks-BXwIjlTs.mjs → leaked-credential-checks-CnY6ih6p.mjs} +1 -1
- package/dist/{load-balancers-DJtMztJ0.mjs → load-balancers-CtnusAzP.mjs} +1 -1
- package/dist/{local-Dil4fTWX.mjs → local-B4sZZTRA.mjs} +1 -1
- package/dist/local-DCnFIgLJ.mjs +2 -0
- package/dist/{local-runtime-B7TKFu6E.mjs → local-runtime-DoBuyriC.mjs} +1 -1
- package/dist/login-CqZJgUF1.mjs +5 -0
- package/dist/{login-D-1FiBNv.mjs → login-DR60WiAY.mjs} +1 -1
- package/dist/{logo-matches-qVYq8tWL.mjs → logo-matches-C1-6KOkZ.mjs} +1 -1
- package/dist/{logos-tnIahhcu.mjs → logos-Yzhd-VKb.mjs} +2 -2
- package/dist/{logpush-D4s3pJRw.mjs → logpush-JYG4gXZ-.mjs} +3 -3
- package/dist/{logs-cw7UL5V2.mjs → logs-DLblEjK0.mjs} +1 -1
- package/dist/{magic-cloud-networking-CLEHztNY.mjs → magic-cloud-networking-CblQwsQr.mjs} +13 -13
- package/dist/{magic-network-monitoring-DRwygeVq.mjs → magic-network-monitoring-D2px4Ep4.mjs} +3 -3
- package/dist/{magic-transit-BFopRdPs.mjs → magic-transit-Bnwsi0UQ.mjs} +61 -61
- package/dist/{managed-defense-D5kpmq0T.mjs → managed-defense-CTtNoxzW.mjs} +3 -3
- package/dist/{managed-transforms-CT4jjnzJ.mjs → managed-transforms-B92mJi5i.mjs} +1 -1
- package/dist/{matches-ClJ_24EY.mjs → matches-CzbL1XD-.mjs} +1 -1
- package/dist/{mcp-50os3IRG.mjs → mcp-Cic_aMer.mjs} +1 -1
- package/dist/{mesh-jxtQP8sS.mjs → mesh-DZTgD16C.mjs} +14 -14
- package/dist/{migrate-DerOyuv2.mjs → migrate-DtNDRcAI.mjs} +1 -1
- package/dist/{monetization-D6cCDi-h.mjs → monetization-DCQ2_niU.mjs} +1 -1
- package/dist/{network-dnWHB2uY.mjs → network-BqMqD2qn.mjs} +1 -1
- package/dist/{network-interconnects-Cf8qSVdt.mjs → network-interconnects-BFQ1yARl.mjs} +2 -2
- package/dist/{o11y-oMSg1pG4.mjs → o11y-CS5q1vSh.mjs} +5 -5
- package/dist/oauth-DPLYUvRl.mjs +2 -0
- package/dist/oauth-DdYSPYoE.mjs +4 -0
- package/dist/{oauth-clients-XDmoe-b4.mjs → oauth-clients-9BPswYm_.mjs} +1 -1
- package/dist/{oauth-scopes-D9VYGuTs.mjs → oauth-scopes-CLOKfQi2.mjs} +1 -1
- package/dist/{open-PCXX3ZDZ-5J5IU2MX-CKla-jDt.mjs → open-PCXX3ZDZ-5J5IU2MX-DFe2CQkm.mjs} +1 -1
- package/dist/{open-PCXX3ZDZ-D55O2jpQ.mjs → open-PCXX3ZDZ-BD2iNJqn.mjs} +1 -1
- package/dist/{organization-94lHeeOs.mjs → organization-DFRN2g6z.mjs} +1 -1
- package/dist/{organizations-BJf3UTFi.mjs → organizations-yiGopnKf.mjs} +1 -1
- package/dist/{origin-post-quantum-encryption-DMytVSUZ.mjs → origin-post-quantum-encryption-n9gsxikn.mjs} +1 -1
- package/dist/output-O6b9MR9R.mjs +2 -0
- package/dist/{page-rules-BUI-50oz.mjs → page-rules-F1Jdxx6A.mjs} +1 -1
- package/dist/{pages-CcdpCzHs.mjs → pages-CezC0YrR.mjs} +2 -2
- package/dist/{pay-per-crawl-B1uHZn9j.mjs → pay-per-crawl-fZ-kTBbN.mjs} +2 -2
- package/dist/{pay-per-use-t066I5wm.mjs → pay-per-use-B14BTKVI.mjs} +2 -2
- package/dist/{pipelines-Co6S044l.mjs → pipelines-BN7ydBHl.mjs} +5 -5
- package/dist/{precursor-BftyvS86.mjs → precursor-B88RDDZT.mjs} +2 -2
- package/dist/previews-CiqRIq_k.mjs +7 -0
- package/dist/process-DiXf4VPi.mjs +2 -0
- package/dist/{progress-Q5w9PNTT.mjs → progress-CdlDthXA.mjs} +1 -1
- package/dist/{prompt-C0hKSr-R.mjs → prompt-1AC-qwxS.mjs} +1 -1
- package/dist/{queries-4MubO6Sz.mjs → queries-C2sgUI9j.mjs} +1 -1
- package/dist/{queues-CteS5M92.mjs → queues-DCP5x-PZ.mjs} +1 -1
- package/dist/{r2-2QpT_Gso.mjs → r2-D7UhzWR7.mjs} +26 -26
- package/dist/{radar-ODKaK4FJ.mjs → radar-osOiFeY_.mjs} +1 -1
- package/dist/{raw-fetch-CEOuoKl9.mjs → raw-fetch-1VlXDwwX.mjs} +1 -1
- package/dist/{realtime-DkfU8uEX.mjs → realtime-DCnqxiWo.mjs} +90 -87
- package/dist/{registrar-DM6JTVPS.mjs → registrar-DAFYjjRa.mjs} +8 -8
- package/dist/{registrar-sandbox-BPNGf65G.mjs → registrar-sandbox-zeNHABZ0.mjs} +4 -4
- package/dist/{registry-CRnk93ur.mjs → registry-DG4ZiuN9.mjs} +1 -1
- package/dist/{reporting-5yFNXbJg.mjs → reporting-KehV_PXm.mjs} +1 -1
- package/dist/{request-headers-DXvswze2.mjs → request-headers-ojAw3pQO.mjs} +1 -1
- package/dist/{request-tracers-BarLZY95.mjs → request-tracers-BStCgh6m.mjs} +1 -1
- package/dist/resolve-BGNMAcGR.mjs +2 -0
- package/dist/{resource-sharing-BVEwBPs8.mjs → resource-sharing-3xtSgWG7.mjs} +3 -3
- package/dist/{rules-_C31X4Jz.mjs → rules-7F-G2Bg_.mjs} +3 -3
- package/dist/{rulesets-8RwxoFhG.mjs → rulesets-B0YtS2br.mjs} +20 -20
- package/dist/{rum-CAUcpXpM.mjs → rum-B3V6tqS-.mjs} +1 -1
- package/dist/{run-DtFLvOHB.mjs → run-B_07PrkW.mjs} +1 -1
- package/dist/run-D6AJfZT-.mjs +2 -0
- package/dist/{schema-S3pUZwpI.mjs → schema-C-tyhSnb.mjs} +1 -1
- package/dist/{schema-flags-DibfxEF6.mjs → schema-flags-DY3OKCvr.mjs} +4 -4
- package/dist/{scim-DX5XrQ4w.mjs → scim-CQ9TdajH.mjs} +6 -6
- package/dist/{secrets-store-DSqqrr25.mjs → secrets-store-Dl2hDxXu.mjs} +2 -2
- package/dist/{security-insights-FSktO04S.mjs → security-insights-BsLMdo1r.mjs} +2 -2
- package/dist/{security-txt-D2g3lQdg.mjs → security-txt-pCAiHvys.mjs} +1 -1
- package/dist/session-BsNzFtPi.mjs +2 -0
- package/dist/shared-CWBjMZDR.mjs +2 -0
- package/dist/{smart-shield-IVb2sR0C.mjs → smart-shield-BTXQsVxz.mjs} +1 -1
- package/dist/{snippets-cWwWficN.mjs → snippets-CYVieyc3.mjs} +2 -2
- package/dist/source-AlTrHNem.mjs +6 -0
- package/dist/{spawn-BW2bJmKO.mjs → spawn-Bdznd0EB.mjs} +2 -2
- package/dist/{spectrum-DYiIBYRB.mjs → spectrum-DLRr4Q03.mjs} +14 -14
- package/dist/{speed-C7uiW2Wf.mjs → speed-BJfaDYxz.mjs} +13 -13
- package/dist/sql-DQ4xrdc2.mjs +4 -0
- package/dist/src-BnMvFE3q.mjs +125 -0
- package/dist/{ssl-xQP_HbWN.mjs → ssl-CL1B69Pw.mjs} +1 -1
- package/dist/startup-profile-DuaJFX1y.mjs +2 -0
- package/dist/startup-profile-HMblAiBi.mjs +29 -0
- package/dist/{state-Boubf1X6.mjs → state-DN9yfd2C.mjs} +1 -1
- package/dist/state-DePlO0Kv.mjs +2 -0
- package/dist/{stream-CfWgj8Cr.mjs → stream-DrMZOO5u.mjs} +17 -17
- package/dist/{submit-DxGr1T40.mjs → submit-DjlLoVk2.mjs} +1 -1
- package/dist/{tags-LEJ2VYhQ.mjs → tags-DY7Ur1k-.mjs} +4 -4
- package/dist/{telemetry-BHne10Yy.mjs → telemetry-BG3kcYsV.mjs} +1 -1
- package/dist/telemetry-Dpm6GfZD.mjs +2 -0
- package/dist/{tenant-7d5vwc6K.mjs → tenant-BEMfNMjO.mjs} +1 -1
- package/dist/{tenant-custom-nameservers-BkxlPr5O.mjs → tenant-custom-nameservers-CCRbb0ch.mjs} +1 -1
- package/dist/{tools-BCCRUENY.mjs → tools-ZffhHUDd.mjs} +1 -1
- package/dist/tunnels-_JXe-UgM.mjs +29 -0
- package/dist/{turnstile-DhLkdhij.mjs → turnstile-DXEfneQq.mjs} +1 -1
- package/dist/ui-CY79jlGZ.mjs +2 -0
- package/dist/update-check-DfbYVefm.mjs +2 -0
- package/dist/{update-check-wvjOsnGK.mjs → update-check-atcehhBC.mjs} +1 -1
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-info-CeoV5dBc.mjs → url-info-B1kL9asc.mjs} +1 -1
- package/dist/{url-normalization-9NoaoRNh.mjs → url-normalization-CUHKRKJh.mjs} +1 -1
- package/dist/{url-scanner-w_-Sumz-.mjs → url-scanner-OnZP_-jm.mjs} +2 -2
- package/dist/{user-D33B3alX.mjs → user-BBBuFNj4.mjs} +1 -1
- package/dist/{vectorize-Wp9De13y.mjs → vectorize-DcctB8bw.mjs} +3 -3
- package/dist/version-CLgSHoNm.mjs +2 -0
- package/dist/{waiting-rooms-BE8FloRd.mjs → waiting-rooms-JaFE5wP1.mjs} +2 -2
- package/dist/{web-assets-ew0iaP7c.mjs → web-assets-Cu0swUPe.mjs} +10 -10
- package/dist/{web3-BUyXBaqq.mjs → web3-C67z4OtQ.mjs} +1 -1
- package/dist/{workers-pP5tsDbD.mjs → workers-ClTP0Ysl.mjs} +5 -5
- package/dist/{workers-builds-DzU9NGno.mjs → workers-builds-C5wKhvKe.mjs} +7 -7
- package/dist/{workers-for-platforms-B4xzFNxJ.mjs → workers-for-platforms-rxwkYyb3.mjs} +5 -5
- package/dist/{workers-vpc-Bre_t9Al.mjs → workers-vpc-B4vyvr1W.mjs} +1 -1
- package/dist/{workflows-DXYGKtqq.mjs → workflows-COJ5jwvk.mjs} +24 -24
- package/dist/wrangler-migration-Cp546RDG.mjs +946 -0
- package/dist/{zaraz-DoH4QD0u.mjs → zaraz-BkZ7yW05.mjs} +2 -2
- package/dist/{zero-trust-DKt20rzE.mjs → zero-trust-lUFLYuL1.mjs} +496 -444
- package/dist/{zone-BXM3p0JR.mjs → zone-CC1_qxt-.mjs} +1 -1
- package/dist/{zones-CJdtqEBx.mjs → zones-BRiLlTmW.mjs} +37 -28
- package/package.json +11 -11
- package/dist/ai-search-DDRpxyOM.mjs +0 -79
- package/dist/auth-B73lQS2h.mjs +0 -2
- package/dist/auth-DMzEmOhG.mjs +0 -2
- package/dist/auth-Db1KT0vm.mjs +0 -2
- package/dist/body-parser-DnBfDdx3.mjs +0 -2
- package/dist/build-BRJnyeu8.mjs +0 -2
- package/dist/chunk-DSGVRFIS-C5SqiTOz.mjs +0 -2
- package/dist/containers-Bt2zFsFd.mjs +0 -78
- package/dist/deploy-context-ClNVJYlR.mjs +0 -56
- package/dist/discover-DIDEGKo3.mjs +0 -2
- package/dist/error-sanitization-CIQOep3I.mjs +0 -2
- package/dist/generate-D80-1GnZ.mjs +0 -2
- package/dist/get-By1q8YlI.mjs +0 -2
- package/dist/hostnames-BMITIM8P.mjs +0 -11
- package/dist/init-CqQDL6i3.mjs +0 -43
- package/dist/interactive-DGUWZ2Gk.mjs +0 -2
- package/dist/local-DxWDQDnG.mjs +0 -2
- package/dist/login-chQP8825.mjs +0 -5
- package/dist/oauth-BfBdHhPS.mjs +0 -4
- package/dist/oauth-DDOiiH7h.mjs +0 -2
- package/dist/output-Co4xdFf6.mjs +0 -2
- package/dist/previews-BLhnhElx.mjs +0 -7
- package/dist/process-2wmDCy17.mjs +0 -2
- package/dist/resolve-BpgXeklt.mjs +0 -2
- package/dist/run-LcOb9rhI.mjs +0 -2
- package/dist/session-Cq3YNLoI.mjs +0 -2
- package/dist/shared-eefMO8R4.mjs +0 -2
- package/dist/source-mXUcrTVw.mjs +0 -6
- package/dist/sql-TGV8qQMj.mjs +0 -4
- package/dist/src-BUH-P_zd.mjs +0 -125
- package/dist/startup-profile-BOaseXnO.mjs +0 -29
- package/dist/startup-profile-BwEZFVGS.mjs +0 -2
- package/dist/state-CODDG9Nx.mjs +0 -2
- package/dist/telemetry-BavSU4ku.mjs +0 -2
- package/dist/tunnels-DlGODvwT.mjs +0 -29
- package/dist/ui-BtIBQeaG.mjs +0 -2
- package/dist/update-check-nLfkSfdz.mjs +0 -2
- package/dist/version-B2RUUqGT.mjs +0 -2
- package/dist/wrangler-migration-R9TQ_4Qd.mjs +0 -946
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./api-eMuS5GI1.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-Dil4fTWX.mjs";import{i as n,n as r}from"./auth-Db1KT0vm.mjs";import{a as i,t as a}from"./context-C_a8oSY9.mjs";import{t as o}from"./output-Co4xdFf6.mjs";import{t as s}from"./dry-run-C2KjGX10.mjs";import{t as c}from"./progress-Q5w9PNTT.mjs";import{t as l}from"./run-DtFLvOHB.mjs";import"./telemetry-BavSU4ku.mjs";import{a as u,i as d,n as f,r as p,t as m}from"./body-parser-DnBfDdx3.mjs";import{n as h,t as g}from"./input-validation-D7z60HJH.mjs";import{a as _,i as v,n as y}from"./prompt-C0hKSr-R.mjs";import{n as ee,t as te}from"./raw-fetch-CEOuoKl9.mjs";function ne(e){return e.usage(`$0 ai-search chat-completions <instance-id>
|
|
3
|
-
|
|
4
|
-
Performs a chat completion request against an AI Search instance, using indexed content as context for generating responses.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-search-options-cache-cache-threshold`,{type:`string`,description:`The ai_search_options.cache.cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`ai-search-options-cache-cache-threshold`,e=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const re={command:`chat-completions <instance-id>`,describe:`Chat Completions`,builder:ne,handler:async e=>l({command:`ai-search chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:d(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):f(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&u(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&u(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&u(_,[`ai_search_options`,`custom_metadata`],p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`filters`],p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&u(_,[`messages`],d(e.messages,`messages`)),e.model!==void 0&&u(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&u(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};var b={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`}};function x(e){return e.usage(`$0 ai-search create <namespace> <id>
|
|
5
|
-
|
|
6
|
-
Create a new AI Search instance with the given configuration. If type is omitted or null, a non-blank HTTP(S) source infers web-crawler and any other source infers r2; r2 sources must name an existing bucket. A missing or blank source without a type creates a managed upload-only instance.`).positional(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).positional(`id`,{type:`string`,description:`Unique ID for the new AI Search instance.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`,default:!0}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`],default:`close_enough`}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`,default:172800}).option(`chunk`,{type:`boolean`,description:`The chunk field`,default:!0}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`,default:10}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`],default:`rrf`}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).option(`hybrid-search-enabled`,{type:`boolean`,description:`Deprecated — use index_method instead. Defaults to true for new instances; set false to create a vector-only instance.`,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=>h(e,`indexing-options-keyword-tokenizer`,`text`)).option(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`,default:10}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`reranking`,{type:`boolean`,description:`The reranking field`,default:!1}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`,default:!1}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`,default:.4}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index. When type is omitted, the source determines it.`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` because discover crawls only cover the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h).`,default:21600}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`type`,{type:`string`,description:`Data source type: r2 or web-crawler.`,choices:[`r2`,`web-crawler`]}).coerce(`type`,e=>h(e,`type`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-* flag is set`)}return!0})}const S={command:`create <namespace> <id>`,describe:`Create an AI Search instance.`,builder:x,handler:async e=>l({command:`ai-search create`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.hybrid-search-enabled.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.type.dry-run`.split(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:d(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{include_headers:p(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):f(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n.send(b,{body:t,account_id:l,namespace:e.namespace}));o(r,{successLabel:`Created`});return}let u=m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:d(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],hybrid_search_enabled:e[`hybrid-search-enabled`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{include_headers:p(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},sync_interval:e[`sync-interval`],token_id:h(e[`token-id`],`token-id`,`text`),type:e.type,id:e.id},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]),g=await c(`Creating`,async()=>n.send(b,{body:u,account_id:l,namespace:e.namespace}));o(g,{successLabel:`Created`})})};function C(e){return e.usage(`$0 ai-search delete <instance-id>
|
|
7
|
-
|
|
8
|
-
Deletes an AI Search instance and all its indexed data permanently.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`delete <instance-id>`,describe:`Delete an AI Search instance.`,builder:C,handler:async e=>l({command:`ai-search delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the AI Search instance and all its indexed data.`})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Deleted`})})};function T(e){return e.usage(`$0 ai-search get <instance-id>
|
|
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 E={command:`get <instance-id>`,describe:`Get an AI Search instance.`,builder:T,handler:async e=>l({command:`ai-search get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`));o(d,{successLabel:`Loaded`})})};function D(e){return e.usage(`$0 ai-search items chunks <item-id>
|
|
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 O={command:`chunks <item-id>`,describe:`List Item Chunks.`,builder:D,handler:async e=>l({command:`ai-search items chunks`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,offset:e.offset};if(e.dryRun){let t=await i();s({command:`cf ai-search items chunks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/chunks`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/chunks`,{query:l}));o(f,{successLabel:`Loaded`})})};function k(e){return e.usage(`$0 ai-search items delete <item-id>
|
|
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 A={command:`delete <item-id>`,describe:`Delete Item.`,builder:k,handler:async e=>l({command:`ai-search items delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force})){process.stderr.write(`Aborted.
|
|
16
|
-
`);return}let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Deleted`})})};function j(e){return e.usage(`$0 ai-search items download <item-id>
|
|
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 M={command:`download <item-id>`,describe:`Download Item Content.`,builder:j,handler:async e=>l({command:`ai-search items download`,classification:{safeFlags:[`dry-run`,`text`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/download`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}await r(e);let n=e.local?t:await a();e.accountId=n;let o=await c(`Loading`,async()=>te(`/accounts/${n}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/download`,{method:`GET`,local:e.local===!0,persistTo:e.persistTo}));ee(e.text===!0?o.toString(`utf-8`):o)})};function N(e){return e.usage(`$0 ai-search items get <item-id>
|
|
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 P={command:`get <item-id>`,describe:`Get Item.`,builder:N,handler:async e=>l({command:`ai-search items get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`));o(d,{successLabel:`Loaded`})})};function F(e){return e.usage(`$0 ai-search items list
|
|
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 items according to status priority, then last_seen_at. "modified_at" sorts items according to file modification time (most recent first), falling back to created_at.`,choices:[`status`,`modified_at`]}).option(`status`,{type:`string`,description:`Status`,choices:[`queued`,`running`,`completed`,`error`,`skipped`,`outdated`]}).option(`source`,{type:`string`,description:`Return only items with this source_id. Use "builtin" for uploaded files, or a source identifier like "web-crawler:https://example.com".`}).option(`metadata-filter`,{type:`string`,description:`JSON-encoded metadata filter using Vectorize filter syntax. Examples: {"folder":"reports/"}, {"timestamp":{"$gte":1700000000000}}, {"folder":{"$in":["docs/","reports/"]}}.`}).option(`item-id`,{type:`string`,description:`Return only the item with this unique ID. Returns at most one item.`}).option(`key`,{type:`string`,description:"Return only items with this exact key (object key / filename). Each key is unique within a source, so combine with `source` to disambiguate across data sources."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`list`,describe:`Items List.`,builder:F,handler:async e=>l({command:`ai-search items list`,classification:{safeFlags:[`sort-by`,`status`,`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`],search:e.search,sort_by:e[`sort-by`],status:e.status,source:e.source,metadata_filter:e[`metadata-filter`],item_id:e[`item-id`],key:e.key};if(e.dryRun){let t=await i();s({command:`cf ai-search items list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{query:l}));o(f,{successLabel:`Loaded`})})};function L(e){return e.usage(`$0 ai-search items logs <item-id>
|
|
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 R={command:`logs <item-id>`,describe:`Item Logs.`,builder:L,handler:async e=>l({command:`ai-search items logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={limit:e.limit,cursor:e.cursor};if(e.dryRun){let t=await i();s({command:`cf ai-search items logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})};function z(e){return e.usage(`$0 ai-search items sync <item-id>
|
|
25
|
-
|
|
26
|
-
Synchronizes an item to an AI Search instance index.`).positional(`item-id`,{type:`string`,description:`Indexed item ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`next-action`,{type:`string`,description:`The next_action field`,choices:[`INDEX`]}).coerce(`next-action`,e=>h(e,`next-action`,`text`)).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const B={command:`sync <item-id>`,describe:`Sync Item.`,builder:z,handler:async e=>l({command:`ai-search items sync`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items sync`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items/${e[`item-id`]==null?`<item-id>`:encodeURIComponent(String(e[`item-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"item-id":String(e[`item-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let p={};e[`next-action`]!==void 0&&u(p,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&u(p,[`wait_for_completion`],e[`wait-for-completion`]);let h=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items/${encodeURIComponent(String(e[`item-id`]))}`,{body:p}));o(h,{successLabel:`Updated`})})};function V(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 continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`})}const H={command:`upload <instance-id>`,describe:`Upload Item.`,builder:V,handler:async e=>l({command:`ai-search items upload`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upload`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,metadata:e.metadata,"wait-for-completion":e[`wait-for-completion`]}});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,e.file!==void 0||e.body!==void 0||e.metadata!==void 0||e[`wait-for-completion`]!==void 0){let t=new FormData;if(e.file){let n=g(e.file);t.append(`file`,new Blob([n]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&t.append(`file`,e.body);e.metadata!==void 0&&t.append(`metadata`,String(h(e.metadata,`metadata`,`text`)??``)),e[`wait-for-completion`]!==void 0&&t.append(`wait_for_completion`,String(e[`wait-for-completion`]));let r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Created`});return}if(e.body){let t=h(e.body,`body`,`binary`),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t,headers:{"Content-Type":`multipart/form-data`}}));o(r,{successLabel:`Created`});return}if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})};function U(e){return e.usage(`$0 ai-search items upsert <instance-id>
|
|
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=>h(e,`next-action`,`text`)).option(`wait-for-completion`,{type:`boolean`,description:`Wait for indexing before responding. After processing, vector-indexed instances use any time remaining in a 25s wait budget to confirm Vectorize ingestion. Processing itself continues uninterrupted and can exceed that budget. If confirmation times out, the response returns the current item state and background indexing continues. Defaults to false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`upsert <instance-id>`,describe:`Create or Update Item.`,builder:U,handler:async e=>l({command:`ai-search items upsert`,classification:{safeFlags:[`next-action`,`wait-for-completion`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search items upsert`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/items`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({key:h(e.key,`key`,`text`),next_action:e[`next-action`],wait_for_completion:e[`wait-for-completion`]}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:t}));o(r,{successLabel:`Updated`});return}e.key===void 0&&(e.key=await _(`key`,`Item key / filename. Must not exceed 128 characters.`)),e[`next-action`]===void 0&&(e[`next-action`]=await v(`next-action`,`The next_action field`,[`INDEX`]));let p={};e.key!==void 0&&u(p,[`key`],h(e.key,`key`,`text`)),e[`next-action`]!==void 0&&u(p,[`next_action`],e[`next-action`]),e[`wait-for-completion`]!==void 0&&u(p,[`wait_for_completion`],e[`wait-for-completion`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/items`,{body:p}));o(g,{successLabel:`Updated`})})},G={command:`items`,describe:`Content indexed by AI Search instances`,builder:e=>e.command(O).command(A).command(M).command(P).command(I).command(R).command(B).command(H).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.usage(`$0 ai-search jobs cancel <job-id>
|
|
31
|
-
|
|
32
|
-
Cancels an in-progress indexing job for an AI Search instance.`).positional(`job-id`,{type:`string`,description:`Indexing job ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`cancel`]}).coerce(`action`,e=>h(e,`action`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const q={command:`cancel <job-id>`,describe:`Cancel an indexing job.`,builder:K,handler:async e=>l({command:`ai-search jobs cancel`,classification:{safeFlags:[`action`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs cancel`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({action:e.action}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,!await y({force:!!e.force,message:`This operation cancels the running indexing job.`})){process.stderr.write(`Aborted.
|
|
33
|
-
`);return}if(e.body){let t=f(e.body),r=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:t}));o(r,{successLabel:`Deleted`});return}e.action===void 0&&(e.action=await v(`action`,`The action field`,[`cancel`]));let p={};e.action!==void 0&&u(p,[`action`],e.action);let h=await c(`Deleting`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`,{body:p}));o(h,{successLabel:`Deleted`})})};function J(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:`Optional description for the indexing job.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`create <instance-id>`,describe:`Create new job`,builder:J,handler:async e=>l({command:`ai-search jobs create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`)}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:t}));o(r,{successLabel:`Created`});return}let p={};e.description!==void 0&&u(p,[`description`],h(e.description,`description`,`text`));let g=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{body:p}));o(g,{successLabel:`Created`})})};function X(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 ie={command:`get <job-id>`,describe:`Get a Job Details`,builder:X,handler:async e=>l({command:`ai-search jobs get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search jobs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}`));o(d,{successLabel:`Loaded`})})};function ae(e){return e.usage(`$0 ai-search jobs list
|
|
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 oe={command:`list`,describe:`List Jobs`,builder:ae,handler:async e=>l({command:`ai-search jobs list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs`,{query:l}));o(f,{successLabel:`Loaded`})})};function se(e){return e.usage(`$0 ai-search jobs logs <job-id>
|
|
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 ce={command:`logs <job-id>`,describe:`List Job Logs`,builder:se,handler:async e=>l({command:`ai-search jobs logs`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let l={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await i();s({command:`cf ai-search jobs logs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/jobs/${e[`job-id`]==null?`<job-id>`:encodeURIComponent(String(e[`job-id`]))}/logs`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``),"job-id":String(e[`job-id`]??``)},query:l,bodyKind:`none`});return}let u=await r(e),d=e.local?t:await a();e.accountId=d;let f=await c(`Loading`,async()=>n(u,`GET`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/jobs/${encodeURIComponent(String(e[`job-id`]))}/logs`,{query:l}));o(f,{successLabel:`Loaded`})})},le={command:`jobs`,describe:`Indexing job lifecycle for AI Search instances`,builder:e=>e.command(q).command(Y).command(ie).command(oe).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var ue={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces/${t.namespace}/instances`,query:[`page`,`per_page`,`search`,`hostname`,`order_by`,`order_by_direction`],errors:{400:`BadRequestError`}};function de(e){return e.usage(`$0 ai-search list
|
|
42
|
-
|
|
43
|
-
Lists all AI Search instances in the account.`).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter instances whose id contains this string (case-insensitive).`}).option(`hostname`,{type:`string`,description:`Return only instances with this exact Search for Agents hostname (case-insensitive).`}).option(`order-by`,{type:`string`,description:`Field to order results by.`,choices:[`created_at`]}).option(`order-by-direction`,{type:`string`,description:`Order direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`list`,describe:`List AI Search instances.`,builder:de,handler:async e=>l({command:`ai-search list`,classification:{safeFlags:[`order-by`,`order-by-direction`,`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search,hostname:e.hostname,order_by:e[`order-by`],order_by_direction:e[`order-by-direction`]};if(e.dryRun){let t=await i();s({command:`cf ai-search list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances`,pathParams:{namespace:String(e.namespace??``)},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(ue,{account_id:u,namespace:e.namespace,...n}));o(d,{successLabel:`Loaded`})})};function pe(e){return e.usage(`$0 ai-search move <instance-id>
|
|
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:`Namespace to move the instance into.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const me={command:`move <instance-id>`,describe:`Move an instance to a different namespace.`,builder:pe,handler:async e=>l({command:`ai-search move`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search move`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e[`source-namespace`]==null?`<source-namespace>`:encodeURIComponent(String(e[`source-namespace`]))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{"source-namespace":String(e[`source-namespace`]??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({new_namespace:h(e[`destination-namespace`],`destination-namespace`,`text`)}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`destination-namespace`]===void 0&&(e[`destination-namespace`]=await _(`destination-namespace`,`Namespace to move the instance into.`));let p={};e[`destination-namespace`]!==void 0&&u(p,[`new_namespace`],h(e[`destination-namespace`],`destination-namespace`,`text`));let g=await c(`Updating`,async()=>n(l,`PATCH`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e[`source-namespace`]))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:p}));o(g,{successLabel:`Updated`})})};function he(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=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at the lower of the first instance's score_threshold and 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the first instance's max_num_results, then 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`messages`,{type:`string`,description:`The messages field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`stream`,{type:`boolean`,description:`The stream field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ge={command:`multi-chat-completions <namespace>`,describe:`Multi-Instance Chat Completions`,builder:he,handler:async e=>l({command:`ai-search multi-chat-completions`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`stream`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-chat-completions`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/chat/completions`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:d(e.messages,`messages`),model:h(e.model,`model`,`text`),stream:e.stream},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):f(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);if(e.messages===void 0)throw Error(`--messages is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&u(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&u(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&u(_,[`ai_search_options`,`custom_metadata`],p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&u(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`filters`],p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&u(_,[`messages`],d(e.messages,`messages`)),e.model!==void 0&&u(_,[`model`],h(e.model,`model`,`text`)),e.stream!==void 0&&u(_,[`stream`],e.stream);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/chat/completions`,{body:_}));o(v,{successLabel:`Created`})})};function _e(e){return e.usage(`$0 ai-search multi-search <namespace> [query]
|
|
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=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-instance-ids`,{type:`string`,array:!0,description:`The ai_search_options.instance_ids field`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`,default:.4}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`,default:0}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum score a chunk must reach to be returned. When omitted, each instance's chunks are filtered by that instance's score_threshold, capped at 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of merged results to return. When omitted, defaults to the sum of the searched instances' max_num_results (each falling back to 10), up to 50.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`,default:!0}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ve={command:`multi-search <namespace> [query]`,describe:`Multi-Instance Search`,builder:_e,handler:async e=>l({command:`ai-search multi-search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search multi-search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/search`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),instance_ids:e[`ai-search-options-instance-ids`],query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:d(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):f(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:t}));o(r,{successLabel:`Created`});return}if(e[`ai-search-options-instance-ids`]===void 0)throw Error(`--ai-search-options-instance-ids is required (or pass --body with this field set).`);let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&u(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&u(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&u(_,[`ai_search_options`,`custom_metadata`],p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-instance-ids`]!==void 0&&u(_,[`ai_search_options`,`instance_ids`],e[`ai-search-options-instance-ids`]),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`filters`],p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&u(_,[`messages`],d(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/search`,{body:_}));o(v,{successLabel:`Created`})})};var Z={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`}};function ye(e){return e.usage(`$0 ai-search namespace create <namespace>
|
|
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 reference an existing instance in this namespace, and the list must stay within the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const be={command:`create <namespace>`,describe:`Create a namespace`,builder:ye,handler:async e=>l({command:`ai-search namespace create`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}):f(e.body)});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n.send(Z,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}let u=m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},name:e.namespace}),d=await c(`Creating`,async()=>n.send(Z,{body:u,account_id:l}));o(d,{successLabel:`Created`})})};function xe(e){return e.usage(`$0 ai-search namespace delete <namespace>
|
|
52
|
-
|
|
53
|
-
Deletes a namespace permanently. The namespace must not contain any instances (instances whose deletion is still in progress do not count), and the default namespace cannot be deleted.`).positional(`namespace`,{type:`string`,description:`Namespace to delete.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Se={command:`delete <namespace>`,describe:`Delete a namespace`,builder:xe,handler:async e=>l({command:`ai-search namespace delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the namespace.`})){process.stderr.write(`Aborted.
|
|
54
|
-
`);return}let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Deleted`})})};function Ce(e){return e.usage(`$0 ai-search namespace get <namespace>
|
|
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 we={command:`get <namespace>`,describe:`Get a namespace`,builder:Ce,handler:async e=>l({command:`ai-search namespace get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`));o(d,{successLabel:`Loaded`})})};var Te={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/namespaces`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ee(e){return e.usage(`$0 ai-search namespace list
|
|
57
|
-
|
|
58
|
-
Lists namespaces in the account, including their descriptions and creation times.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter namespaces whose name or description contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`list`,describe:`List namespaces`,builder:Ee,handler:async e=>l({command:`ai-search namespace list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search namespace list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/namespaces`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(Te,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Oe(e){return e.usage(`$0 ai-search namespace update <namespace>
|
|
59
|
-
|
|
60
|
-
Updates the description and/or the public endpoint configuration of an existing namespace. The default namespace's description cannot be modified, but its public endpoint can.`).positional(`namespace`,{type:`string`,description:`Namespace to update.`,demandOption:!0}).option(`description`,{type:`string`,description:`Optional description for the namespace. Max 256 characters.`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-instances-allowed`,{type:`string`,array:!0,description:`Instance IDs exposed through the namespace public endpoint. Empty means nothing is searchable. Every ID must reference an existing instance in this namespace, and the list must stay within the account's multi-instance search limit.`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ke={command:`update <namespace>`,describe:`Update a namespace`,builder:Oe,handler:async e=>l({command:`ai-search namespace update`,classification:{safeFlags:[`public-endpoint-params-chat-completions-endpoint-disabled`,`public-endpoint-params-default-domain-enabled`,`public-endpoint-params-enabled`,`public-endpoint-params-mcp-disabled`,`public-endpoint-params-rate-limit-technique`,`public-endpoint-params-search-endpoint-disabled`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search namespace update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}`,pathParams:{namespace:String(e.namespace??``)},bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],instances_allowed:e[`public-endpoint-params-instances-allowed`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}}}):f(e.body)});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:t}));o(r,{successLabel:`Updated`});return}let p={};e.description!==void 0&&u(p,[`description`],h(e.description,`description`,`text`)),e[`public-endpoint-params-authorized-hosts`]!==void 0&&u(p,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&u(p,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&u(p,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&u(p,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&u(p,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-instances-allowed`]!==void 0&&u(p,[`public_endpoint_params`,`instances_allowed`],e[`public-endpoint-params-instances-allowed`]),e[`public-endpoint-params-mcp-description`]!==void 0&&u(p,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&u(p,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&u(p,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&u(p,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&u(p,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&u(p,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]);let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}`,{body:p}));o(g,{successLabel:`Updated`})})},Ae={command:`namespace`,describe:`Logical groupings for organizing AI Search instances`,builder:e=>e.command(be).command(Se).command(we).command(De).command(ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function je(e){return e.usage(`$0 ai-search purge-cache <instance-id>
|
|
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 Me={command:`purge-cache <instance-id>`,describe:`Purge search cache.`,builder:je,handler:async e=>l({command:`ai-search purge-cache`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search purge-cache`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/purge_cache`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Creating`,async()=>n(l,`POST`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/purge_cache`));o(d,{successLabel:`Created`})})};function Ne(e){return e.usage(`$0 ai-search search <instance-id> [query]
|
|
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=>h(e,`ai-search-options-cache-cache-threshold`,`text`)).option(`ai-search-options-cache-enabled`,{type:`boolean`,description:`The ai_search_options.cache.enabled field`}).option(`ai-search-options-custom-metadata`,{type:`string`,description:`Metadata added to AI Gateway logs for requests this operation triggers. Accepts up to 2 string, number, or boolean entries. Reserved keys: 'ai-search', 'task', 'origin', and any key beginning with 'cf.'. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-query-rewrite-enabled`,{type:`boolean`,description:`The ai_search_options.query_rewrite.enabled field`}).option(`ai-search-options-query-rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`ai-search-options-query-rewrite-rewrite-prompt`,{type:`string`,description:`The ai_search_options.query_rewrite.rewrite_prompt field`}).option(`ai-search-options-reranking-enabled`,{type:`boolean`,description:`The ai_search_options.reranking.enabled field`}).option(`ai-search-options-reranking-match-threshold`,{type:`number`,description:`The ai_search_options.reranking.match_threshold field`}).option(`ai-search-options-reranking-model`,{type:`string`,description:`The ai_search_options.reranking.model field`}).option(`ai-search-options-retrieval-context-expansion`,{type:`number`,description:`The ai_search_options.retrieval.context_expansion field`}).option(`ai-search-options-retrieval-filters`,{type:`string`,description:`The ai_search_options.retrieval.filters field. Provide as a JSON object or @path/to/file.json.`}).option(`ai-search-options-retrieval-fusion-method`,{type:`string`,description:`The ai_search_options.retrieval.fusion_method field`,choices:[`max`,`rrf`]}).coerce(`ai-search-options-retrieval-fusion-method`,e=>h(e,`ai-search-options-retrieval-fusion-method`,`text`)).option(`ai-search-options-retrieval-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted, falls back to the instance-level retrieval_options.keyword_match_mode, then to 'and'.`,choices:[`and`,`or`]}).coerce(`ai-search-options-retrieval-keyword-match-mode`,e=>h(e,`ai-search-options-retrieval-keyword-match-mode`,`text`)).option(`ai-search-options-retrieval-match-threshold`,{type:`number`,description:`Minimum similarity score a chunk must reach to be returned. When omitted, falls back to the instance-level score_threshold, then to 0.4.`}).option(`ai-search-options-retrieval-max-num-results`,{type:`number`,description:`Maximum number of results to return. When omitted, falls back to the instance-level max_num_results, then to 10.`}).option(`ai-search-options-retrieval-retrieval-type`,{type:`string`,description:`The ai_search_options.retrieval.retrieval_type field`,choices:[`vector`,`keyword`,`hybrid`]}).coerce(`ai-search-options-retrieval-retrieval-type`,e=>h(e,`ai-search-options-retrieval-retrieval-type`,`text`)).option(`ai-search-options-retrieval-return-on-failure`,{type:`boolean`,description:`The ai_search_options.retrieval.return_on_failure field`}).option(`messages`,{type:`string`,description:"OpenAI-compatible message array. For multimodal queries, set the last user message's `content` to an array of typed parts: `[{type:'text', text:'…'}, {type:'image_url', image_url:{url:'…'}}]`. Image inputs require the RAG's embedding_model to declare 'image' in supported_modalities. Provide as a JSON array of objects or @path/to/file.json."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pe={command:`search <instance-id> [query]`,describe:`Search`,builder:Ne,handler:async e=>l({command:`ai-search search`,classification:{safeFlags:[`ai-search-options-cache-cache-threshold`,`ai-search-options-cache-enabled`,`ai-search-options-query-rewrite-enabled`,`ai-search-options-reranking-enabled`,`ai-search-options-retrieval-fusion-method`,`ai-search-options-retrieval-keyword-match-mode`,`ai-search-options-retrieval-retrieval-type`,`ai-search-options-retrieval-return-on-failure`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search search`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/search`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_search_options:{cache:{cache_threshold:e[`ai-search-options-cache-cache-threshold`],enabled:e[`ai-search-options-cache-enabled`]},custom_metadata:p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`),query_rewrite:{enabled:e[`ai-search-options-query-rewrite-enabled`],model:h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`),rewrite_prompt:h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)},reranking:{enabled:e[`ai-search-options-reranking-enabled`],match_threshold:e[`ai-search-options-reranking-match-threshold`],model:h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)},retrieval:{context_expansion:e[`ai-search-options-retrieval-context-expansion`],filters:p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`),fusion_method:e[`ai-search-options-retrieval-fusion-method`],keyword_match_mode:e[`ai-search-options-retrieval-keyword-match-mode`],match_threshold:e[`ai-search-options-retrieval-match-threshold`],max_num_results:e[`ai-search-options-retrieval-max-num-results`],retrieval_type:e[`ai-search-options-retrieval-retrieval-type`],return_on_failure:e[`ai-search-options-retrieval-return-on-failure`]}},messages:d(e.messages,`messages`),query:e.query},[[`ai_search_options`,`custom_metadata`],[`ai_search_options`,`retrieval`,`filters`]]):f(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=f(e.body),r=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:t}));o(r,{successLabel:`Loaded`});return}let _={};e[`ai-search-options-cache-cache-threshold`]!==void 0&&u(_,[`ai_search_options`,`cache`,`cache_threshold`],e[`ai-search-options-cache-cache-threshold`]),e[`ai-search-options-cache-enabled`]!==void 0&&u(_,[`ai_search_options`,`cache`,`enabled`],e[`ai-search-options-cache-enabled`]),e[`ai-search-options-custom-metadata`]!==void 0&&u(_,[`ai_search_options`,`custom_metadata`],p(e[`ai-search-options-custom-metadata`],`ai-search-options-custom-metadata`)),e[`ai-search-options-query-rewrite-enabled`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`enabled`],e[`ai-search-options-query-rewrite-enabled`]),e[`ai-search-options-query-rewrite-model`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`model`],h(e[`ai-search-options-query-rewrite-model`],`ai-search-options-query-rewrite-model`,`text`)),e[`ai-search-options-query-rewrite-rewrite-prompt`]!==void 0&&u(_,[`ai_search_options`,`query_rewrite`,`rewrite_prompt`],h(e[`ai-search-options-query-rewrite-rewrite-prompt`],`ai-search-options-query-rewrite-rewrite-prompt`,`text`)),e[`ai-search-options-reranking-enabled`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`enabled`],e[`ai-search-options-reranking-enabled`]),e[`ai-search-options-reranking-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`match_threshold`],e[`ai-search-options-reranking-match-threshold`]),e[`ai-search-options-reranking-model`]!==void 0&&u(_,[`ai_search_options`,`reranking`,`model`],h(e[`ai-search-options-reranking-model`],`ai-search-options-reranking-model`,`text`)),e[`ai-search-options-retrieval-context-expansion`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`context_expansion`],e[`ai-search-options-retrieval-context-expansion`]),e[`ai-search-options-retrieval-filters`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`filters`],p(e[`ai-search-options-retrieval-filters`],`ai-search-options-retrieval-filters`)),e[`ai-search-options-retrieval-fusion-method`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`fusion_method`],e[`ai-search-options-retrieval-fusion-method`]),e[`ai-search-options-retrieval-keyword-match-mode`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`keyword_match_mode`],e[`ai-search-options-retrieval-keyword-match-mode`]),e[`ai-search-options-retrieval-match-threshold`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`match_threshold`],e[`ai-search-options-retrieval-match-threshold`]),e[`ai-search-options-retrieval-max-num-results`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`max_num_results`],e[`ai-search-options-retrieval-max-num-results`]),e[`ai-search-options-retrieval-retrieval-type`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`retrieval_type`],e[`ai-search-options-retrieval-retrieval-type`]),e[`ai-search-options-retrieval-return-on-failure`]!==void 0&&u(_,[`ai_search_options`,`retrieval`,`return_on_failure`],e[`ai-search-options-retrieval-return-on-failure`]),e.messages!==void 0&&u(_,[`messages`],d(e.messages,`messages`)),e.query!==void 0&&(_.query=e.query);let v=await c(`Loading`,async()=>n(l,`POST`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/search`,{body:_}));o(v,{successLabel:`Loaded`})})};function Fe(e){return e.usage(`$0 ai-search stats <instance-id>
|
|
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 Ie={command:`stats <instance-id>`,describe:`Get instance statistics.`,builder:Fe,handler:async e=>l({command:`ai-search stats`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search stats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}/stats`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}/stats`));o(d,{successLabel:`Loaded`})})};var Q={method:`POST`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,body:`json`,errors:{400:`BadRequestError`}};function Le(e){return e.usage(`$0 ai-search tokens create <name>
|
|
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:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`,default:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Re={command:`create <name>`,describe:`Create a token`,builder:Le,handler:async e=>l({command:`ai-search tokens create`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens`,pathParams:{},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}):f(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let n=await r(e),l=e.local?t:await a();if(e.accountId=l,e.body){let t=f(e.body),r=await c(`Creating`,async()=>n.send(Q,{body:t,account_id:l}));o(r,{successLabel:`Created`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`}));let u=m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:e.name}),d=await c(`Creating`,async()=>n.send(Q,{body:u,account_id:l}));o(d,{successLabel:`Created`})})};function ze(e){return e.usage(`$0 ai-search tokens delete <token-id>
|
|
69
|
-
|
|
70
|
-
Deletes a stored AI Search credential permanently. Credentials in use by an instance cannot be deleted.`).positional(`token-id`,{type:`string`,description:`Stored credential record ID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Be={command:`delete <token-id>`,describe:`Delete a token`,builder:ze,handler:async e=>l({command:`ai-search tokens delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();if(e.accountId=u,!await y({force:!!e.force,message:`This operation permanently deletes the stored credential.`})){process.stderr.write(`Aborted.
|
|
71
|
-
`);return}let d=await c(`Deleting`,async()=>n(l,`DELETE`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Deleted`})})};function Ve(e){return e.usage(`$0 ai-search tokens get <token-id>
|
|
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:Ve,handler:async e=>l({command:`ai-search tokens get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>n(l,`GET`,`/accounts/${u}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`));o(d,{successLabel:`Loaded`})})};var He={method:`GET`,path:t=>e`/accounts/${t.account_id}/ai-search/tokens`,query:[`page`,`per_page`,`search`],errors:{400:`BadRequestError`}};function Ue(e){return e.usage(`$0 ai-search tokens list
|
|
74
|
-
|
|
75
|
-
Lists stored AI Search credentials in the account without exposing their secrets.`).option(`page`,{type:`number`,description:`Page number (1-indexed).`}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`search`,{type:`string`,description:`Filter tokens whose name contains this string (case-insensitive).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const We={command:`list`,describe:`List tokens`,builder:Ue,handler:async e=>l({command:`ai-search tokens list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={page:e.page,per_page:e[`per-page`],search:e.search};if(e.dryRun){let e=await i();s({command:`cf ai-search tokens list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/ai-search/tokens`,pathParams:{},query:n,bodyKind:`none`});return}let l=await r(e),u=e.local?t:await a();e.accountId=u;let d=await c(`Loading`,async()=>l.send(He,{account_id:u,...n}));o(d,{successLabel:`Loaded`})})};function Ge(e){return e.usage(`$0 ai-search tokens update <token-id>
|
|
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:`Cloudflare API token ID.`}).option(`api-token`,{type:`string`,description:`Cloudflare API token value.`}).option(`legacy`,{type:`boolean`,description:`Whether the credential uses the legacy API key format.`}).option(`name`,{type:`string`,description:`Human-readable name for the credential.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ke={command:`update <token-id>`,describe:`Update a token`,builder:Ge,handler:async e=>l({command:`ai-search tokens update`,classification:{safeFlags:[`legacy`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search tokens update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/tokens/${e[`token-id`]==null?`<token-id>`:encodeURIComponent(String(e[`token-id`]))}`,pathParams:{"token-id":String(e[`token-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({cf_api_id:h(e[`api-token-id`],`api-token-id`,`text`),cf_api_key:h(e[`api-token`],`api-token`,`text`),legacy:e.legacy,name:h(e.name,`name`,`text`)}):f(e.body),sensitiveBodyPaths:[[`cf_api_key`]]});return}let l=await r(e),d=e.local?t:await a();if(e.accountId=d,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}e[`api-token-id`]===void 0&&(e[`api-token-id`]=await _(`api-token-id`,`Cloudflare API token ID.`)),e[`api-token`]===void 0&&(e[`api-token`]=await _(`api-token`,`Cloudflare API token value.`,{kind:`secret`})),e.name===void 0&&(e.name=await _(`name`,`Human-readable name for the credential.`));let p={};e[`api-token-id`]!==void 0&&u(p,[`cf_api_id`],h(e[`api-token-id`],`api-token-id`,`text`)),e[`api-token`]!==void 0&&u(p,[`cf_api_key`],h(e[`api-token`],`api-token`,`text`)),e.legacy!==void 0&&u(p,[`legacy`],e.legacy),e.name!==void 0&&u(p,[`name`],h(e.name,`name`,`text`));let g=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${d}/ai-search/tokens/${encodeURIComponent(String(e[`token-id`]))}`,{body:p}));o(g,{successLabel:`Updated`})})},qe={command:`tokens`,describe:`Credentials used by AI Search instances`,builder:e=>e.command(Re).command(Be).command($).command(We).command(Ke).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Je(e){return e.usage(`$0 ai-search update <instance-id>
|
|
78
|
-
|
|
79
|
-
Updates the configuration of an AI Search instance.`).positional(`instance-id`,{type:`string`,description:`AI Search instance ID.`,demandOption:!0}).option(`namespace`,{type:`string`,description:`Namespace to use for this operation.`,demandOption:!0}).option(`ai-gateway-id`,{type:`string`,description:`The ai_gateway_id field`}).option(`ai-search-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`cache`,{type:`boolean`,description:`The cache field`}).option(`cache-threshold`,{type:`string`,description:`The cache_threshold field`,choices:[`super_strict_match`,`close_enough`,`flexible_friend`,`anything_goes`]}).coerce(`cache-threshold`,e=>h(e,`cache-threshold`,`text`)).option(`cache-ttl`,{type:`number`,description:`Cache entry TTL in seconds. Allowed values: 600 (10min), 1800 (30min), 3600 (1h), 7200 (2h), 21600 (6h), 43200 (12h), 86400 (24h), 172800 (48h), 259200 (72h), 518400 (6d).`}).option(`chunk`,{type:`boolean`,description:`The chunk field`}).option(`chunk-overlap`,{type:`number`,description:`The chunk_overlap field`}).option(`chunk-size`,{type:`number`,description:`The chunk_size field`}).option(`custom-metadata`,{type:`string`,description:`The custom_metadata field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`embedding-model`,{type:`string`,description:`The embedding_model field`}).option(`fusion-method`,{type:`string`,description:`The fusion_method field`,choices:[`max`,`rrf`]}).coerce(`fusion-method`,e=>h(e,`fusion-method`,`text`)).option(`index-method-keyword`,{type:`boolean`,description:`Enable keyword (BM25) storage backend.`}).option(`index-method-vector`,{type:`boolean`,description:`Enable vector (embedding) storage backend.`}).option(`indexing-options-keyword-tokenizer`,{type:`string`,description:`Tokenizer used for keyword search indexing. porter provides word-level tokenization with Porter stemming (good for natural language queries). trigram enables character-level substring matching (good for partial matches, code, identifiers). Changing this triggers a full re-index. Defaults to porter.`,choices:[`porter`,`trigram`]}).coerce(`indexing-options-keyword-tokenizer`,e=>h(e,`indexing-options-keyword-tokenizer`,`text`)).option(`indexing-options-use-ocr`,{type:`boolean`,description:`Enables OCR ingestion for PDFs and images. Changing this triggers a full re-index. Defaults to false.`}).option(`max-num-results`,{type:`number`,description:`The max_num_results field`}).option(`metadata-created-from-aisearch-wizard`,{type:`boolean`,description:`The metadata.created_from_aisearch_wizard field`}).option(`metadata-created-from-emdash-plugin-type`,{type:`string`,description:`The metadata.created_from_emdash_plugin.type field`,choices:[`native`,`rest`]}).coerce(`metadata-created-from-emdash-plugin-type`,e=>h(e,`metadata-created-from-emdash-plugin-type`,`text`)).option(`metadata-created-from-emdash-plugin-version`,{type:`string`,description:`The metadata.created_from_emdash_plugin.version field`}).option(`metadata-worker-domain`,{type:`string`,description:`The metadata.worker_domain field`}).option(`paused`,{type:`boolean`,description:`The paused field`}).option(`public-endpoint-params-authorized-hosts`,{type:`string`,array:!0,description:`The public_endpoint_params.authorized_hosts field`}).option(`public-endpoint-params-chat-completions-endpoint-disabled`,{type:`boolean`,description:`Disable chat completions endpoint for this public endpoint.`}).option(`public-endpoint-params-custom-domains`,{type:`string`,array:!0,description:`Custom domain hostnames that alias this public endpoint. GET and create responses return the current set; on update (PUT) this field is only echoed back when supplied in the request body, otherwise it is null (omit it to leave domains unchanged).`}).option(`public-endpoint-params-default-domain-enabled`,{type:`boolean`,description:`When false, the instance is reachable only via a registered custom domain and the default <public_endpoint_id>.search.ai.cloudflare.com host returns 404. Requires at least one custom domain. Defaults to true. public_endpoint_params is replaced wholesale on update, so resend default_domain_enabled on every update to keep the default host off — omitting it resets to true.`}).option(`public-endpoint-params-enabled`,{type:`boolean`,description:`The public_endpoint_params.enabled field`}).option(`public-endpoint-params-mcp-description`,{type:`string`,description:`The public_endpoint_params.mcp.description field`}).option(`public-endpoint-params-mcp-disabled`,{type:`boolean`,description:`Disable MCP endpoint for this public endpoint.`}).option(`public-endpoint-params-rate-limit-period-ms`,{type:`number`,description:`The public_endpoint_params.rate_limit.period_ms field`}).option(`public-endpoint-params-rate-limit-requests`,{type:`number`,description:`The public_endpoint_params.rate_limit.requests field`}).option(`public-endpoint-params-rate-limit-technique`,{type:`string`,description:`The public_endpoint_params.rate_limit.technique field`,choices:[`fixed`,`sliding`]}).coerce(`public-endpoint-params-rate-limit-technique`,e=>h(e,`public-endpoint-params-rate-limit-technique`,`text`)).option(`public-endpoint-params-search-endpoint-disabled`,{type:`boolean`,description:`Disable search endpoint for this public endpoint.`}).option(`reranking`,{type:`boolean`,description:`The reranking field`}).option(`reranking-model`,{type:`string`,description:`The reranking_model field`}).option(`retrieval-options-keyword-match-mode`,{type:`string`,description:`Controls which documents become candidates for BM25 scoring. 'and' restricts candidates to documents containing all query terms; 'or' includes any document containing at least one term and ranks results according to BM25 relevance. When omitted on an update, the existing stored value stays unchanged; when never set, search falls back to 'and'.`,choices:[`and`,`or`]}).coerce(`retrieval-options-keyword-match-mode`,e=>h(e,`retrieval-options-keyword-match-mode`,`text`)).option(`rewrite-model`,{type:`string`,description:`A Workers AI model ID or an AI Gateway model ID compatible with the OpenAI Chat Completions API. An empty string uses the configured or default model.`}).option(`rewrite-query`,{type:`boolean`,description:`The rewrite_query field`}).option(`score-threshold`,{type:`number`,description:`The score_threshold field`}).option(`source`,{type:`string`,description:`R2 bucket name or HTTP(S) root website URL to index.`}).option(`source-params-exclude-items`,{type:`string`,array:!0,description:`List of path patterns to exclude. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /admin/** matches /admin/users and /admin/settings/advanced). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-include-items`,{type:`string`,array:!0,description:`List of path patterns to include. Uses micromatch glob syntax: * matches within a path segment, ** matches across path segments (e.g., /blog/** matches /blog/post and /blog/2024/post). Most accounts have a limit of 10 rules; contact support to raise it.`}).option(`source-params-prefix`,{type:`string`,description:`The source_params.prefix field`}).option(`source-params-r2-jurisdiction`,{type:`string`,description:`The source_params.r2_jurisdiction field`}).option(`source-params-web-crawler-discover-options-depth`,{type:`number`,description:`Maximum link-follow depth from the seed URL.`}).option(`source-params-web-crawler-discover-options-include-external-links`,{type:`boolean`,description:"Follow links that point outside the source domain. Must stay `false` because discover crawls only cover the zone you own."}).option(`source-params-web-crawler-discover-options-include-subdomains`,{type:`boolean`,description:`Follow links to subdomains of the source host.`}).option(`source-params-web-crawler-discover-options-limit`,{type:`number`,description:`Maximum number of pages to crawl (1-100000).`}).option(`source-params-web-crawler-discover-options-max-age`,{type:`number`,description:`Maximum content age in seconds to accept (0–604800).`}).option(`source-params-web-crawler-discover-options-source`,{type:`string`,description:`Where the crawler looks for URLs: 'sitemaps' reads sitemap XML only, 'links' follows page links only, 'all' does both.`,choices:[`all`,`sitemaps`,`links`]}).coerce(`source-params-web-crawler-discover-options-source`,e=>h(e,`source-params-web-crawler-discover-options-source`,`text`)).option(`source-params-web-crawler-parse-options-include-headers`,{type:`string`,description:`Up to 5 custom HTTP headers sent with each crawl request. Names must use RFC-7230 token characters, excluding spaces, colons, and control characters. Values must use HTAB and printable ASCII only, excluding CR and LF. Provide as a JSON object or @path/to/file.json.`}).option(`source-params-web-crawler-parse-options-include-images`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.include_images field`}).option(`source-params-web-crawler-parse-options-specific-sitemaps`,{type:`string`,array:!0,description:`List of specific sitemap URLs to use for crawling. Only valid when parse_type is 'sitemap'.`}).option(`source-params-web-crawler-parse-options-use-browser-rendering`,{type:`boolean`,description:`The source_params.web_crawler.parse_options.use_browser_rendering field`}).option(`source-params-web-crawler-parse-type`,{type:`string`,description:`How the crawler finds URLs. 'sitemap' reads XML sitemaps; 'discover' follows links recursively and requires the source to belong to a Verified zone on this account.`,choices:[`sitemap`,`discover`]}).coerce(`source-params-web-crawler-parse-type`,e=>h(e,`source-params-web-crawler-parse-type`,`text`)).option(`summarization`,{type:`boolean`,description:`The summarization field`}).option(`summarization-model`,{type:`string`,description:`The summarization_model field`}).option(`sync-interval`,{type:`number`,description:`Interval between automatic syncs, in seconds. Allowed values: 900 (15min), 1800 (30min), 3600 (1h), 7200 (2h), 14400 (4h), 21600 (6h), 43200 (12h), 86400 (24h).`}).option(`system-prompt-ai-search`,{type:`string`,description:`The system_prompt_ai_search field`}).option(`system-prompt-index-summarization`,{type:`string`,description:`The system_prompt_index_summarization field`}).option(`system-prompt-rewrite-query`,{type:`string`,description:`The system_prompt_rewrite_query field`}).option(`token-id`,{type:`string`,description:`The token_id field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`index-method-keyword`,`index-method-vector`].some(t=>e[t]!==void 0)){let t=[`index-method-keyword`,`index-method-vector`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --index_method-* flag is set`)}return!0}).check(e=>{if([`metadata-created-from-aisearch-wizard`,`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`,`metadata-worker-domain`].some(t=>e[t]!==void 0)){let t=[`metadata-created-from-emdash-plugin-type`,`metadata-created-from-emdash-plugin-version`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --metadata-* flag is set`)}return!0})}const Ye={command:`update <instance-id>`,describe:`Update an AI Search instance.`,builder:Je,handler:async e=>l({command:`ai-search update`,classification:{safeFlags:/* @__PURE__ */ `cache.cache-threshold.chunk.fusion-method.index-method-keyword.index-method-vector.indexing-options-keyword-tokenizer.indexing-options-use-ocr.metadata-created-from-aisearch-wizard.metadata-created-from-emdash-plugin-type.paused.public-endpoint-params-chat-completions-endpoint-disabled.public-endpoint-params-default-domain-enabled.public-endpoint-params-enabled.public-endpoint-params-mcp-disabled.public-endpoint-params-rate-limit-technique.public-endpoint-params-search-endpoint-disabled.reranking.retrieval-options-keyword-match-mode.rewrite-query.source-params-web-crawler-discover-options-include-external-links.source-params-web-crawler-discover-options-include-subdomains.source-params-web-crawler-discover-options-source.source-params-web-crawler-parse-options-include-images.source-params-web-crawler-parse-options-use-browser-rendering.source-params-web-crawler-parse-type.summarization.dry-run`.split(`.`)}},e,async()=>{if(e.dryRun){let t=await i();s({command:`cf ai-search update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/ai-search/namespaces/${e.namespace==null?`<namespace>`:encodeURIComponent(String(e.namespace))}/instances/${e[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(e[`instance-id`]))}`,pathParams:{namespace:String(e.namespace??``),"instance-id":String(e[`instance-id`]??``)},bodyKind:`json`,body:e.body===void 0?m({ai_gateway_id:h(e[`ai-gateway-id`],`ai-gateway-id`,`text`),ai_search_model:h(e[`ai-search-model`],`ai-search-model`,`text`),cache:e.cache,cache_threshold:e[`cache-threshold`],cache_ttl:e[`cache-ttl`],chunk:e.chunk,chunk_overlap:e[`chunk-overlap`],chunk_size:e[`chunk-size`],custom_metadata:d(e[`custom-metadata`],`custom-metadata`),embedding_model:h(e[`embedding-model`],`embedding-model`,`text`),fusion_method:e[`fusion-method`],index_method:{keyword:e[`index-method-keyword`],vector:e[`index-method-vector`]},indexing_options:{keyword_tokenizer:e[`indexing-options-keyword-tokenizer`],use_ocr:e[`indexing-options-use-ocr`]},max_num_results:e[`max-num-results`],metadata:{created_from_aisearch_wizard:e[`metadata-created-from-aisearch-wizard`],created_from_emdash_plugin:{type:e[`metadata-created-from-emdash-plugin-type`],version:h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)},worker_domain:h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)},paused:e.paused,public_endpoint_params:{authorized_hosts:e[`public-endpoint-params-authorized-hosts`],chat_completions_endpoint:{disabled:e[`public-endpoint-params-chat-completions-endpoint-disabled`]},custom_domains:e[`public-endpoint-params-custom-domains`],default_domain_enabled:e[`public-endpoint-params-default-domain-enabled`],enabled:e[`public-endpoint-params-enabled`],mcp:{description:h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`),disabled:e[`public-endpoint-params-mcp-disabled`]},rate_limit:{period_ms:e[`public-endpoint-params-rate-limit-period-ms`],requests:e[`public-endpoint-params-rate-limit-requests`],technique:e[`public-endpoint-params-rate-limit-technique`]},search_endpoint:{disabled:e[`public-endpoint-params-search-endpoint-disabled`]}},reranking:e.reranking,reranking_model:h(e[`reranking-model`],`reranking-model`,`text`),retrieval_options:{keyword_match_mode:e[`retrieval-options-keyword-match-mode`]},rewrite_model:h(e[`rewrite-model`],`rewrite-model`,`text`),rewrite_query:e[`rewrite-query`],score_threshold:e[`score-threshold`],source:h(e.source,`source`,`text`),source_params:{exclude_items:e[`source-params-exclude-items`],include_items:e[`source-params-include-items`],prefix:h(e[`source-params-prefix`],`source-params-prefix`,`text`),r2_jurisdiction:h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`),web_crawler:{discover_options:{depth:e[`source-params-web-crawler-discover-options-depth`],include_external_links:e[`source-params-web-crawler-discover-options-include-external-links`],include_subdomains:e[`source-params-web-crawler-discover-options-include-subdomains`],limit:e[`source-params-web-crawler-discover-options-limit`],max_age:e[`source-params-web-crawler-discover-options-max-age`],source:e[`source-params-web-crawler-discover-options-source`]},parse_options:{include_headers:p(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`),include_images:e[`source-params-web-crawler-parse-options-include-images`],specific_sitemaps:e[`source-params-web-crawler-parse-options-specific-sitemaps`],use_browser_rendering:e[`source-params-web-crawler-parse-options-use-browser-rendering`]},parse_type:e[`source-params-web-crawler-parse-type`]}},summarization:e.summarization,summarization_model:h(e[`summarization-model`],`summarization-model`,`text`),sync_interval:e[`sync-interval`],system_prompt_ai_search:h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`),system_prompt_index_summarization:h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`),system_prompt_rewrite_query:h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`),token_id:h(e[`token-id`],`token-id`,`text`)},[[`source_params`,`web_crawler`,`parse_options`,`include_headers`]]):f(e.body)});return}let l=await r(e),g=e.local?t:await a();if(e.accountId=g,e.body){let t=f(e.body),r=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:t}));o(r,{successLabel:`Updated`});return}let _={};e[`ai-gateway-id`]!==void 0&&u(_,[`ai_gateway_id`],h(e[`ai-gateway-id`],`ai-gateway-id`,`text`)),e[`ai-search-model`]!==void 0&&u(_,[`ai_search_model`],h(e[`ai-search-model`],`ai-search-model`,`text`)),e.cache!==void 0&&u(_,[`cache`],e.cache),e[`cache-threshold`]!==void 0&&u(_,[`cache_threshold`],e[`cache-threshold`]),e[`cache-ttl`]!==void 0&&u(_,[`cache_ttl`],e[`cache-ttl`]),e.chunk!==void 0&&u(_,[`chunk`],e.chunk),e[`chunk-overlap`]!==void 0&&u(_,[`chunk_overlap`],e[`chunk-overlap`]),e[`chunk-size`]!==void 0&&u(_,[`chunk_size`],e[`chunk-size`]),e[`custom-metadata`]!==void 0&&u(_,[`custom_metadata`],d(e[`custom-metadata`],`custom-metadata`)),e[`embedding-model`]!==void 0&&u(_,[`embedding_model`],h(e[`embedding-model`],`embedding-model`,`text`)),e[`fusion-method`]!==void 0&&u(_,[`fusion_method`],e[`fusion-method`]),e[`index-method-keyword`]!==void 0&&u(_,[`index_method`,`keyword`],e[`index-method-keyword`]),e[`index-method-vector`]!==void 0&&u(_,[`index_method`,`vector`],e[`index-method-vector`]),e[`indexing-options-keyword-tokenizer`]!==void 0&&u(_,[`indexing_options`,`keyword_tokenizer`],e[`indexing-options-keyword-tokenizer`]),e[`indexing-options-use-ocr`]!==void 0&&u(_,[`indexing_options`,`use_ocr`],e[`indexing-options-use-ocr`]),e[`max-num-results`]!==void 0&&u(_,[`max_num_results`],e[`max-num-results`]),e[`metadata-created-from-aisearch-wizard`]!==void 0&&u(_,[`metadata`,`created_from_aisearch_wizard`],e[`metadata-created-from-aisearch-wizard`]),e[`metadata-created-from-emdash-plugin-type`]!==void 0&&u(_,[`metadata`,`created_from_emdash_plugin`,`type`],e[`metadata-created-from-emdash-plugin-type`]),e[`metadata-created-from-emdash-plugin-version`]!==void 0&&u(_,[`metadata`,`created_from_emdash_plugin`,`version`],h(e[`metadata-created-from-emdash-plugin-version`],`metadata-created-from-emdash-plugin-version`,`text`)),e[`metadata-worker-domain`]!==void 0&&u(_,[`metadata`,`worker_domain`],h(e[`metadata-worker-domain`],`metadata-worker-domain`,`text`)),e.paused!==void 0&&u(_,[`paused`],e.paused),e[`public-endpoint-params-authorized-hosts`]!==void 0&&u(_,[`public_endpoint_params`,`authorized_hosts`],e[`public-endpoint-params-authorized-hosts`]),e[`public-endpoint-params-chat-completions-endpoint-disabled`]!==void 0&&u(_,[`public_endpoint_params`,`chat_completions_endpoint`,`disabled`],e[`public-endpoint-params-chat-completions-endpoint-disabled`]),e[`public-endpoint-params-custom-domains`]!==void 0&&u(_,[`public_endpoint_params`,`custom_domains`],e[`public-endpoint-params-custom-domains`]),e[`public-endpoint-params-default-domain-enabled`]!==void 0&&u(_,[`public_endpoint_params`,`default_domain_enabled`],e[`public-endpoint-params-default-domain-enabled`]),e[`public-endpoint-params-enabled`]!==void 0&&u(_,[`public_endpoint_params`,`enabled`],e[`public-endpoint-params-enabled`]),e[`public-endpoint-params-mcp-description`]!==void 0&&u(_,[`public_endpoint_params`,`mcp`,`description`],h(e[`public-endpoint-params-mcp-description`],`public-endpoint-params-mcp-description`,`text`)),e[`public-endpoint-params-mcp-disabled`]!==void 0&&u(_,[`public_endpoint_params`,`mcp`,`disabled`],e[`public-endpoint-params-mcp-disabled`]),e[`public-endpoint-params-rate-limit-period-ms`]!==void 0&&u(_,[`public_endpoint_params`,`rate_limit`,`period_ms`],e[`public-endpoint-params-rate-limit-period-ms`]),e[`public-endpoint-params-rate-limit-requests`]!==void 0&&u(_,[`public_endpoint_params`,`rate_limit`,`requests`],e[`public-endpoint-params-rate-limit-requests`]),e[`public-endpoint-params-rate-limit-technique`]!==void 0&&u(_,[`public_endpoint_params`,`rate_limit`,`technique`],e[`public-endpoint-params-rate-limit-technique`]),e[`public-endpoint-params-search-endpoint-disabled`]!==void 0&&u(_,[`public_endpoint_params`,`search_endpoint`,`disabled`],e[`public-endpoint-params-search-endpoint-disabled`]),e.reranking!==void 0&&u(_,[`reranking`],e.reranking),e[`reranking-model`]!==void 0&&u(_,[`reranking_model`],h(e[`reranking-model`],`reranking-model`,`text`)),e[`retrieval-options-keyword-match-mode`]!==void 0&&u(_,[`retrieval_options`,`keyword_match_mode`],e[`retrieval-options-keyword-match-mode`]),e[`rewrite-model`]!==void 0&&u(_,[`rewrite_model`],h(e[`rewrite-model`],`rewrite-model`,`text`)),e[`rewrite-query`]!==void 0&&u(_,[`rewrite_query`],e[`rewrite-query`]),e[`score-threshold`]!==void 0&&u(_,[`score_threshold`],e[`score-threshold`]),e.source!==void 0&&u(_,[`source`],h(e.source,`source`,`text`)),e[`source-params-exclude-items`]!==void 0&&u(_,[`source_params`,`exclude_items`],e[`source-params-exclude-items`]),e[`source-params-include-items`]!==void 0&&u(_,[`source_params`,`include_items`],e[`source-params-include-items`]),e[`source-params-prefix`]!==void 0&&u(_,[`source_params`,`prefix`],h(e[`source-params-prefix`],`source-params-prefix`,`text`)),e[`source-params-r2-jurisdiction`]!==void 0&&u(_,[`source_params`,`r2_jurisdiction`],h(e[`source-params-r2-jurisdiction`],`source-params-r2-jurisdiction`,`text`)),e[`source-params-web-crawler-discover-options-depth`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`depth`],e[`source-params-web-crawler-discover-options-depth`]),e[`source-params-web-crawler-discover-options-include-external-links`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`include_external_links`],e[`source-params-web-crawler-discover-options-include-external-links`]),e[`source-params-web-crawler-discover-options-include-subdomains`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`include_subdomains`],e[`source-params-web-crawler-discover-options-include-subdomains`]),e[`source-params-web-crawler-discover-options-limit`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`limit`],e[`source-params-web-crawler-discover-options-limit`]),e[`source-params-web-crawler-discover-options-max-age`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`max_age`],e[`source-params-web-crawler-discover-options-max-age`]),e[`source-params-web-crawler-discover-options-source`]!==void 0&&u(_,[`source_params`,`web_crawler`,`discover_options`,`source`],e[`source-params-web-crawler-discover-options-source`]),e[`source-params-web-crawler-parse-options-include-headers`]!==void 0&&u(_,[`source_params`,`web_crawler`,`parse_options`,`include_headers`],p(e[`source-params-web-crawler-parse-options-include-headers`],`source-params-web-crawler-parse-options-include-headers`)),e[`source-params-web-crawler-parse-options-include-images`]!==void 0&&u(_,[`source_params`,`web_crawler`,`parse_options`,`include_images`],e[`source-params-web-crawler-parse-options-include-images`]),e[`source-params-web-crawler-parse-options-specific-sitemaps`]!==void 0&&u(_,[`source_params`,`web_crawler`,`parse_options`,`specific_sitemaps`],e[`source-params-web-crawler-parse-options-specific-sitemaps`]),e[`source-params-web-crawler-parse-options-use-browser-rendering`]!==void 0&&u(_,[`source_params`,`web_crawler`,`parse_options`,`use_browser_rendering`],e[`source-params-web-crawler-parse-options-use-browser-rendering`]),e[`source-params-web-crawler-parse-type`]!==void 0&&u(_,[`source_params`,`web_crawler`,`parse_type`],e[`source-params-web-crawler-parse-type`]),e.summarization!==void 0&&u(_,[`summarization`],e.summarization),e[`summarization-model`]!==void 0&&u(_,[`summarization_model`],h(e[`summarization-model`],`summarization-model`,`text`)),e[`sync-interval`]!==void 0&&u(_,[`sync_interval`],e[`sync-interval`]),e[`system-prompt-ai-search`]!==void 0&&u(_,[`system_prompt_ai_search`],h(e[`system-prompt-ai-search`],`system-prompt-ai-search`,`text`)),e[`system-prompt-index-summarization`]!==void 0&&u(_,[`system_prompt_index_summarization`],h(e[`system-prompt-index-summarization`],`system-prompt-index-summarization`,`text`)),e[`system-prompt-rewrite-query`]!==void 0&&u(_,[`system_prompt_rewrite_query`],h(e[`system-prompt-rewrite-query`],`system-prompt-rewrite-query`,`text`)),e[`token-id`]!==void 0&&u(_,[`token_id`],h(e[`token-id`],`token-id`,`text`));let v=await c(`Updating`,async()=>n(l,`PUT`,`/accounts/${g}/ai-search/namespaces/${encodeURIComponent(String(e.namespace))}/instances/${encodeURIComponent(String(e[`instance-id`]))}`,{body:_}));o(v,{successLabel:`Updated`})})},Xe={command:`ai-search`,describe:`Managed search-as-a-service: crawl, index, and query content with AI-powered relevance and chat completions`,builder:e=>e.command(re).command(S).command(w).command(E).command(fe).command(me).command(ge).command(ve).command(Me).command(Pe).command(Ie).command(Ye).command(G).command(le).command(Ae).command(qe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Xe as default};
|
package/dist/auth-B73lQS2h.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./theme-BGHWSKCw.mjs";import{a as t,i as n,s as r}from"./blocks-Bat9A8V_.mjs";import"./ui-BtIBQeaG.mjs";import{c as i,d as a,i as o,p as s,r as c,t as l,u}from"./oauth-BfBdHhPS.mjs";import{t as d}from"./auth-token-D9XIPlwf.mjs";import{t as f}from"./output-Co4xdFf6.mjs";import{n as p}from"./run-DtFLvOHB.mjs";import"./telemetry-BavSU4ku.mjs";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./login-chQP8825.mjs";const S={command:`logout`,describe:`Log out and remove stored credentials`,handler:async a=>{g(a,`logout`,"Run `cf auth delete <name>` to remove a named profile.");let l=c();l!=="default"&&console.log(r(`This directory has profile "${l}" active. \`cf auth logout\` removes the default profile's token, not "${l}".\nTo delete "${l}", run \`cf auth delete ${l}\`.`)),s(`default`);let d=i(),f=!!process.env.CLOUDFLARE_API_TOKEN;if(!d){f?(console.log(t(`No cf OAuth credentials found, but CLOUDFLARE_API_TOKEN environment variable is set.`)),console.log(t(`Unset it with: unset CLOUDFLARE_API_TOKEN`))):(console.log(t(`You are not currently logged in.`)),console.log(n(`Run ${e.code(`cf auth login`)} to authenticate.`)));return}console.log(t(`Logging out...`)),await u(`default`),console.log(`${e.info(`Removed:`)} OAuth tokens from ${e.muted(o())}`),f&&(console.log(``),console.log(r(`CLOUDFLARE_API_TOKEN environment variable is still set.`)),console.log(t(`You will remain authenticated via the env var. Unset it with: unset CLOUDFLARE_API_TOKEN`)))}},C={command:`whoami`,describe:`Show current user and authentication status`,builder:e=>e,handler:async e=>{let t=process.env.CLOUDFLARE_API_TOKEN,n=a(),r;r=t?`CLOUDFLARE_API_TOKEN environment variable`:n?.oauth_token?`OAuth token from ${o()}`:`none`;let i;try{i=await d()}catch{f({authenticated:!1,error:`Not logged in`});return}let{createCloudflareClientWithToken:s}=await import(`./auth-DMzEmOhG.mjs`),{default:c}=await import(`./get-By1q8YlI.mjs`),u=s({apiToken:i}),p,m=[],[h,g]=await Promise.allSettled([u.send(c),l()]);if(h.status===`fulfilled`){let e=h.value;e&&`email`in e&&typeof e.email==`string`&&(p=e.email)}else process.env.DEBUG&&console.error(`User lookup error:`,h.reason);g.status===`fulfilled`?m=g.value:process.env.DEBUG&&console.error(`Account lookup error:`,g.reason);let _=h.status===`fulfilled`||g.status===`fulfilled`,v={authenticated:!0,authSource:r,tokenValid:_,...p&&{email:p},accounts:m};n?.oauth_token&&(v.scopes=n.scopes,v.expiresAt=n.expiration_time),f(v)}},w={command:`auth`,describe:`Manage authentication and profiles`,builder:e=>e.command(p(x,{command:`auth login`,classification:_})).command(T(S,`auth logout`)).command(T(C,`auth whoami`)).command(T(m,`auth create`,[`browser`,`device`])).command(T(b,`auth delete`)).command(T(y,`auth activate`)).command(T(v,`auth deactivate`)).command(T(h,`auth list`)).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function T(e,t,n=[],r){return p(e,{command:t,classification:{safeFlags:n,shortFlagAliases:r}})}export{w as default};
|
package/dist/auth-DMzEmOhG.mjs
DELETED
package/dist/auth-Db1KT0vm.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{K as e}from"./dist-DZRTPMMA.mjs";import{n as t,t as n}from"./api-eMuS5GI1.mjs";import{a as r,n as i}from"./context-C_a8oSY9.mjs";import"./oauth-BfBdHhPS.mjs";import{t as a}from"./auth-token-D9XIPlwf.mjs";import{n as o}from"./request-headers-DXvswze2.mjs";const s=6e4;function c(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream}var l={method:`GET`,path:()=>`/accounts`,query:[`name`,`page`,`per_page`,`direction`]},u={method:`GET`,path:()=>`/memberships`,query:[`account.name`,`page`,`per_page`,`order`,`direction`,`name`,`status`]};function d(e){return e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof ReadableStream||e instanceof URLSearchParams}function f(e){return Object.keys(e).some(e=>e.toLowerCase()===`content-type`)}async function p(e){let t=e.headers.get(`content-type`)??``;try{return t.includes(`application/json`)?await e.json():await e.text()}catch{return null}}function m(e,t,n){if(n!=null&&n!==``){if(Array.isArray(n)){for(let r of n)m(e,t,r);return}e.append(t,String(n))}}function h(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))m(t,n,r);return t.toString()}function g(e,t,n){let r=new URL(t.endsWith(`/`)?t:`${t}/`),i=new URL(e.startsWith(`/`)?e.slice(1):e,r);if(i.origin!==r.origin)throw Error(`Refusing to send an authenticated request to ${i.origin} (expected ${r.origin})`);let a=h(n??{});return a&&(i.search=a),i.toString()}const _=/* @__PURE__ */ new WeakMap,v=/* @__PURE__ */ new WeakMap;async function y(e,n,r,i={}){let a=e.baseUrl,o=g(r,a,i.query),s={...i.headers},l;i.body!==void 0&&(d(i.body)||typeof i.body==`string`&&f(s)?l=i.body:(s[`Content-Type`]??=`application/json`,l=JSON.stringify(i.body)));let u=i.timeout===void 0&&c(l)?v.get(e):void 0,m=i.timeout??_.get(e)??6e4,h;try{h=await(u??e).fetch(o,{method:n,headers:s,body:l,signal:i.signal},{timeoutInSeconds:i.timeout===void 0?void 0:i.timeout/1e3,abortSignal:i.signal})}catch(e){throw i.signal?.aborted?Error(`Request aborted`):e===`timeout`||e instanceof Error&&e.name===`AbortError`?Error(u?`Request timed out`:`Request timed out after ${m}ms`):e instanceof Error?Error(`Request failed: ${e.message}`):e}if(!h.ok)throw new t({statusCode:h.status,body:await p(h),rawResponse:{status:h.status,statusText:h.statusText,url:h.url||o,headers:h.headers,redirected:h.redirected,type:h.type}});if(h.status===204)return null;let y=h.headers.get(`content-type`)??``;if(!y.includes(`application/json`)&&i.preserveNonJsonBytes)return Buffer.from(await h.arrayBuffer());let b=await h.text();if(b===``)return null;if(!y.includes(`application/json`))return b;let x=JSON.parse(b);if(x.success===!1){let e=x.errors?.map(e=>e.message).filter(Boolean).join(`, `)||`unknown error`;throw new t({message:`API error: ${e}`,statusCode:h.status,body:x})}return`result`in x?x.result:x}function b(e){let t={baseUrl:e.baseURL??`https://api.cloudflare.com/client/v4`,auth:async()=>({headers:{Authorization:`Bearer ${e.apiToken}`}}),headers:e.defaultHeaders,timeoutInSeconds:(e.timeout??6e4)/1e3,maxRetries:0,fetch:e.fetch??globalThis.fetch},r=new n(t);return _.set(r,e.timeout??6e4),e.timeout===void 0&&v.set(r,new n({...t,timeoutInSeconds:void 0})),r}async function x(t){let n=await r();if(n)return n;try{let n=await a(),r=e({compliance_region:await i()}),s=t-Date.now();if(s<=0)return;let c=b({apiToken:n,baseURL:r,defaultHeaders:o()}),d={timeoutInSeconds:s/1e3,maxRetries:0},[f,p]=await Promise.allSettled([c.send(l,{per_page:50},d),c.send(u,{per_page:50},d)]);if(f.status===`rejected`)return;let m=f.value;if((m.result_info?.total_count??m.result.length)>m.result.length)return;let h=m.result;if(p.status===`fulfilled`){let e=p.value.result??[];if((p.value.result_info?.total_count??e.length)>e.length)return;let t=new Set(e.map(e=>e.account?.id).filter(e=>e!==void 0));h=h.filter(e=>t.has(e.id))}return h.length===1?h[0]?.id:void 0}catch{return}}async function S(t){let n=e({compliance_region:await i()});if(t.local){let{createLocalFetch:e}=await import(`./local-DxWDQDnG.mjs`);return b({apiToken:`cf-local-mode-no-auth`,baseURL:n,defaultHeaders:o(),fetch:e({persistTo:t.persistTo,apiBaseUrl:n})})}return b({apiToken:await a(),baseURL:n,defaultHeaders:o()})}export{x as a,c,y as i,s as l,S as n,u as o,h as r,l as s,b as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{readFileSync as e}from"node:fs";import{resolve as t}from"node:path";function n(e,t,n){if(t.length===0)return;let r=e;for(let e=0;e<t.length-1;e++){let n=t[e]??``;(!r[n]||typeof r[n]!=`object`)&&(r[n]={}),r=r[n]}let i=t[t.length-1]??``;r[i]=n}function r(e,t=[]){let n=(e,r)=>{if(Array.isArray(e)||typeof e!=`object`||!e)return e;let i=Object.entries(e).flatMap(([e,i])=>{let a=[...r,e],o=t.some(e=>e.length===a.length&&e.every((e,t)=>e===a[t])),s=o?i:n(i,a);return s===void 0||!o&&typeof s==`object`&&s&&!Array.isArray(s)&&Object.keys(s).length===0?[]:[[e,s]]});return Object.fromEntries(i)};return n(e,[])}function i(n,r){let i=r.startsWith(`--`)?r:`--${r}`,a=n;if(n.startsWith(`@`)){let r=n.slice(1);if(r.length===0)throw Error(`${i} '@' must be followed by a file path (got empty path)`);let o=t(r);try{a=e(o,`utf-8`)}catch(e){let t=e instanceof Error?e.message:`unknown read error`;throw Error(`${i}: cannot read file at '${r}': ${t}`)}}try{return JSON.parse(a)}catch{throw Error(`Invalid JSON in ${i}. Expected valid JSON.`)}}function a(e,t=[]){let n=i(e,`body`);for(let{path:e,flag:r}of t){let t=n;for(let n of e)t=o(t)&&Object.hasOwn(t,n)?t[n]:void 0;if(!o(t))throw Error(`--body must include a JSON object at ${e.join(`.`)} (for --${r}).`)}return n}function o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s(e,t,n=!1){let r=t.startsWith(`--`)?t:`--${t}`;if(e===void 0){if(n)throw Error(`${r} is required (or pass --body with this field set).`);return}if(typeof e!=`string`)throw Error(`${r} must be provided once as a JSON object.`);let a=i(e,t);if(!o(a))throw Error(`${r} must be a JSON object.`);return a}function c(e,t){if(e===void 0)return;let n=t.startsWith(`--`)?t:`--${t}`;if(typeof e!=`string`)throw Error(`${n} must be provided once as a JSON array of objects.`);let r=i(e,t);if(!Array.isArray(r)||r.some(e=>typeof e!=`object`||!e||Array.isArray(e)))throw Error(`${n} must be a JSON array of objects.`);return r}export{n as a,c as i,a as n,s as r,r as t};
|
package/dist/build-BRJnyeu8.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{n as e,r as t}from"./source-mXUcrTVw.mjs";import{V as n,j as r,m as i}from"./dist-DZRTPMMA.mjs";import{N as a,r as o}from"./chunk-2HLTAS5V-D7COzUOd.mjs";import{createRequire as s}from"node:module";import{readFileSync as c}from"node:fs";import l,{resolve as u}from"node:path";import d from"node:assert";import{spawnSync as f}from"node:child_process";const p=s(import.meta.url||(typeof __filename==`string`?__filename:`/`));var m=Object.create,h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,v=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,b=(e,t)=>h(e,`name`,{value:t,configurable:!0}),x=/* @__PURE__ */ (e=>p===void 0?typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(p===void 0?e:p)[t]}):e:p)(function(e){if(p!==void 0)return p.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),S=(e,t)=>function(){return t||(0,e[_(e)[0]])((t={exports:{}}).exports,t),t.exports},C=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of _(t))!y.call(e,i)&&i!==n&&h(e,i,{get:()=>t[i],enumerable:!(r=g(t,i))||r.enumerable});return e},T=(e,t,n)=>(n=e==null?{}:m(v(e)),w(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),E=/* @__PURE__ */ e(((e,n)=>{var r=t(`child_process`).exec,i=t(`child_process`).execSync,a=t(`fs`),o=t(`path`),s=a.access,c=a.accessSync,l=a.constants||a,u=process.platform==`win32`,d=function(e,t){s(e,l.F_OK,function(e){t(!e)})},f=function(e){try{return c(e,l.F_OK),!1}catch{return!0}},p=function(e,t){s(e,l.F_OK|l.X_OK,function(e){t(null,!e)})},m=function(e){try{return c(e,l.F_OK|l.X_OK),!0}catch{return!1}},h=function(e,t,n){d(e,function(i){if(!i){r(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`,function(e,t,r){n(null,!!t)});return}p(e,n)})},g=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e)){n(null,!1);return}r(`where `+t,function(e){e===null?n(null,!0):n(null,!1)})},_=function(e,t){if(f(e))try{return!!i(`command -v `+t+` 2>/dev/null && { echo >&1 `+t+`; exit 0; }`)}catch{return!1}return m(e)},v=function(e,t,n){if(!/^(?!(?:.*\s|.*\.|\W+)$)(?:[a-zA-Z]:)?(?:(?:[^<>:"\|\?\*\n])+(?:\/\/|\/|\\\\|\\)?)+$/m.test(e))return!1;try{return!!i(`where `+t,{stdio:[]})}catch{return!1}},y=function(e){return/[^A-Za-z0-9_\/:=-]/.test(e)&&(e=`'`+e.replace(/'/g,`'\\''`)+`'`,e=e.replace(/^(?:'')+/g,``).replace(/\\'''/g,`\\'`)),e};u&&(y=function(e){if(/[\\]/.test(e)){var t=`"`+o.dirname(e)+`"`,n=`"`+o.basename(e)+`"`;return t+`:`+n}return`"`+e+`"`}),n.exports=function e(t,n){var r=y(t);if(!n&&typeof Promise<`u`)return new Promise(function(n,r){e(t,function(e,i){i?n(t):r(e)})});u?g(t,r,n):h(t,r,n)},n.exports.sync=function(e){var t=y(e);return u?v(e,t):_(e,t)}})),D=/* @__PURE__ */ e(((e,t)=>{t.exports=E()})),ee=n(),O=D();s(import.meta.url||(typeof __filename==`string`?__filename:`/`));function k(e){if(e.compiled_schema)return c(u(e.compiled_schema));let{base_path:t,source_schemas:n}=e,r=(n??[]).map(e=>u(t,e));if(!(0,O.sync)(`capnp`))throw new a(`The capnp compiler is required to upload capnp schemas, but is not present.`,{telemetryMessage:`capnp compiler missing`});let i=u(t??`.`),o=f(`capnp`,[`compile`,`-o-`,`--src-prefix=${i}`,...r],{maxBuffer:3145728});if(o.error)throw o.error;if(o.stderr.length)throw Error(o.stderr.toString());return o.stdout}b(k,`handleUnsafeCapnp`);var A={esm:`application/javascript+module`,commonjs:`application/javascript`,"compiled-wasm":`application/wasm`,buffer:`application/octet-stream`,text:`text/plain`,python:`text/x-python`,"python-requirement":`text/x-python-requirement`};function j(e){let t=A[e];if(t===void 0)throw TypeError(`Unsupported module: `+e);return t}b(j,`toMimeType`);function M(e){let t=Object.keys(A).find(t=>A[t]===e);if(t===void 0)throw TypeError(`Unsupported mime type: `+e);return t}b(M,`fromMimeType`);function N(e,t,n){let s=new ee.FormData,{main:u,sourceMaps:f,migrations:p,code_update_strategy:m,exports:h,compatibility_date:g,compatibility_flags:_,keepVars:v,keepSecrets:y,keepBindings:b,logpush:x,placement:S,tail_consumers:C,streaming_tail_consumers:w,limits:T,annotations:E,keep_assets:D,assets:O,observability:A,cache:M,package_dependencies:N}=e,P={html_handling:O?.assetConfig?.html_handling,not_found_handling:O?.assetConfig?.not_found_handling,base_path:O?.assetConfig?.base_path,run_worker_first:O?.run_worker_first,_redirects:O?._redirects,_headers:O?._headers};if(O&&!O.routerConfig.has_user_worker)return s.set(`metadata`,JSON.stringify({assets:{jwt:O.jwt,config:P},...E&&{annotations:E},...g&&{compatibility_date:g},..._&&{compatibility_flags:_}})),s;let{modules:F}=e,I=[],te=i(`plain_text`,t),ne=i(`json`,t),re=i(`secret_text`,t),ie=i(`kv_namespace`,t),ae=i(`send_email`,t),oe=i(`durable_object_namespace`,t),se=i(`workflow`,t),ce=i(`queue`,t),le=i(`r2_bucket`,t),ue=i(`d1`,t),de=i(`vectorize`,t),fe=i(`ai_search_namespace`,t),pe=i(`ai_search`,t),L=i(`agent_memory`,t),R=i(`hyperdrive`,t),z=i(`secrets_store_secret`,t),B=i(`artifacts`,t),me=i(`unsafe_hello_world`,t),he=i(`flagship`,t),ge=i(`ratelimit`,t),_e=i(`vpc_service`,t),ve=i(`vpc_network`,t),V=i(`service`,t),ye=i(`analytics_engine`,t),be=i(`dispatch_namespace`,t),xe=i(`mtls_certificate`,t),Se=i(`pipeline`,t),Ce=i(`k2`,t),we=i(`worker_loader`,t),Te=i(`logfwdr`,t),Ee=i(`wasm_module`,t),H=i(`browser`,t)[0],U=i(`analytics`,t)[0],W=i(`ai`,t)[0],G=i(`images`,t)[0],K=i(`stream`,t)[0],q=i(`media`,t)[0],J=i(`version_metadata`,t)[0],Y=i(`assets`,t)[0],De=i(`text_blob`,t),Oe=i(`data_blob`,t);i(`inherit`,t).forEach(({binding:e})=>{I.push({name:e,type:`inherit`})}),te.forEach(({binding:e,value:t})=>{I.push({name:e,type:`plain_text`,text:t})}),ne.forEach(({binding:e,value:t})=>{I.push({name:e,type:`json`,json:t})}),re.forEach(({binding:e,value:t})=>{I.push({name:e,type:`secret_text`,text:t})}),ie.forEach(({id:e,binding:t,raw:r})=>{if(n?.dryRun&&(e??=o),e===void 0)throw new a(`${t} bindings must have an "id" field`,{telemetryMessage:`kv namespace binding missing id`});e===o?I.push({name:t,type:`inherit`}):I.push({name:t,type:`kv_namespace`,namespace_id:e,raw:r})}),ae.forEach(e=>{let t={name:e.name,type:`send_email`,allowed_sender_addresses:e.allowed_sender_addresses};e.destination_address===void 0?e.allowed_destination_addresses===void 0?I.push(t):I.push({...t,allowed_destination_addresses:e.allowed_destination_addresses}):I.push({...t,destination_address:e.destination_address})}),oe.forEach(({name:e,class_name:t,script_name:n,environment:r})=>{I.push({name:e,type:`durable_object_namespace`,class_name:t,...n&&{script_name:n},...r&&{environment:r}})}),se.forEach(({binding:e,name:t,class_name:n,script_name:r,raw:i})=>{I.push({type:`workflow`,name:e,workflow_name:t,class_name:n,script_name:r,raw:i})}),ce.forEach(({binding:e,queue_name:t,delivery_delay:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "queue" field. Add a "queue" field to the producer in your Worker configuration specifying the name of the Queue to bind to.`,{telemetryMessage:`queue binding missing name`});t===o?I.push({name:e,type:`inherit`}):I.push({type:`queue`,name:e,queue_name:t,delivery_delay:r,raw:i})}),le.forEach(({binding:e,bucket_name:t,jurisdiction:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "bucket_name" field. Add a "bucket_name" field to the binding in your Worker configuration specifying the name of the R2 bucket to bind to.`,{telemetryMessage:`r2 bucket binding missing bucket_name`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`r2_bucket`,bucket_name:t,jurisdiction:r,raw:i})}),ue.forEach(({binding:e,database_id:t,database_internal_env:r,raw:i})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "database_id" field. Add a "database_id" field to the binding in your Worker configuration specifying the ID of the D1 database to bind to.`,{telemetryMessage:`d1 database binding missing database_id`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`d1`,id:t,internalEnv:r,raw:i})}),de.forEach(({binding:e,index_name:t,raw:n})=>{I.push({name:e,type:`vectorize`,index_name:t,raw:n})}),fe.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the AI Search namespace to bind to.`,{telemetryMessage:`ai search namespace binding missing namespace`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`ai_search_namespace`,namespace:t})}),pe.forEach(({binding:e,instance_name:t})=>{I.push({name:e,type:`ai_search`,instance_name:t})}),L.forEach(({binding:e,namespace:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the namespace to bind to.`,{telemetryMessage:!1});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`agent_memory`,namespace:t})}),R.forEach(({binding:e,id:t})=>{I.push({name:e,type:`hyperdrive`,id:t})}),z.forEach(({binding:e,store_id:t,secret_name:n})=>{I.push({name:e,type:`secrets_store_secret`,store_id:t,secret_name:n})}),B.forEach(({binding:e,namespace:t})=>{I.push({name:e,type:`artifacts`,namespace:t})}),me.forEach(({binding:e,enable_timer:t})=>{I.push({name:e,type:`unsafe_hello_world`,enable_timer:t})}),he.forEach(({binding:e,app_id:t})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have an "app_id" field. Add an "app_id" field to the binding in your Worker configuration specifying the Flagship app to bind to.`,{telemetryMessage:`flagship binding missing app id`});I.push(t===o?{name:e,type:`inherit`}:{name:e,type:`flagship`,app_id:t})}),ge.forEach(({name:e,namespace_id:t,simple:n})=>{I.push({name:e,type:`ratelimit`,namespace_id:t,simple:n})}),_e.forEach(({binding:e,service_id:t})=>{I.push({name:e,type:`vpc_service`,service_id:t})}),ve.forEach(({binding:e,tunnel_id:t,network_id:n})=>{I.push({name:e,type:`vpc_network`,...t===void 0?{network_id:n}:{tunnel_id:t}})}),V.forEach(({binding:e,service:t,environment:n,entrypoint:r,props:i,cross_account_grant:a})=>{I.push({name:e,type:`service`,service:t,cross_account_grant:a,...n&&{environment:n},...r&&{entrypoint:r},...i&&{props:i}})}),ye.forEach(({binding:e,dataset:t})=>{I.push({name:e,type:`analytics_engine`,dataset:t})}),be.forEach(({binding:e,namespace:t,outbound:r})=>{if(n?.dryRun&&(t??=o),t===void 0)throw new a(`${e} bindings must have a "namespace" field. Add a "namespace" field to the binding in your Worker configuration specifying the dispatch namespace to bind to.`,{telemetryMessage:`dispatch namespace binding missing namespace`});t===o?I.push({name:e,type:`inherit`}):I.push({name:e,type:`dispatch_namespace`,namespace:t,...r&&{outbound:{worker:{service:r.service,environment:r.environment},params:r.parameters?.map(e=>({name:e}))}}})}),xe.forEach(({binding:e,certificate_id:t})=>{I.push({name:e,type:`mtls_certificate`,certificate_id:t})}),Se.forEach(({binding:e,stream:t,pipeline:n})=>{if(t)I.push({name:e,type:`pipelines`,stream:t});else if(n)I.push({name:e,type:`pipelines`,pipeline:n});else throw Error(`Pipeline binding must specify a stream or pipeline`)}),Ce.forEach(({binding:e,stream:t})=>{I.push({name:e,type:`k2`,stream:t})}),we.forEach(({binding:e})=>{I.push({name:e,type:`worker_loader`})}),Te.forEach(({name:e,destination:t})=>{I.push({name:e,type:`logfwdr`,destination:t})}),Ee.forEach(({binding:e,source:t})=>{I.push({name:e,type:`wasm_module`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/wasm`}))}),H!==void 0&&I.push({name:H.binding,type:`browser`,raw:H.raw}),U!==void 0&&I.push({name:U.binding,type:`analytics`}),W!==void 0&&I.push({name:W.binding,staging:W.staging,type:`ai`,raw:W.raw}),G!==void 0&&I.push({name:G.binding,type:`images`,raw:G.raw}),K!==void 0&&I.push({name:K.binding,type:`stream`}),q!==void 0&&I.push({name:q.binding,type:`media`}),J!==void 0&&I.push({name:J.binding,type:`version_metadata`}),Y!==void 0&&I.push({name:Y.binding,type:`assets`}),De.forEach(({binding:e,source:t})=>{I.push({name:e,type:`text_blob`,part:e}),e!==`__STATIC_CONTENT_MANIFEST`&&(`contents`in t?s.set(e,new File([t.contents],t.path??e,{type:`text/plain`})):s.set(e,new File([c(t.path)],t.path,{type:`text/plain`})))}),Oe.forEach(({binding:e,source:t})=>{I.push({name:e,type:`data_blob`,part:e}),s.set(e,new File([`contents`in t?t.contents:c(t.path)],`path`in t?t.path??e:e,{type:`application/octet-stream`}))});for(let[e,n]of Object.entries(t??{}))if(r(n.type)&&n.type!==`unsafe_hello_world`){let{type:t,...r}=n;I.push({name:e,type:t.slice(7),...r})}let X=`__STATIC_CONTENT_MANIFEST`;if(F?.some(({name:e})=>e===X)&&u.type===`esm`){d(F!==void 0);let e=new Set(F.map(e=>l.posix.dirname(e.name)));for(let t of e){if(t===`.`)continue;let e=l.posix.relative(t,X),n=l.posix.join(t,X);F.push({name:n,filePath:n,content:`export { default } from ${JSON.stringify(e)};`,type:`esm`})}}if(u.type===`commonjs`){for(let e of Object.values([...F||[]]))if(e.name===`__STATIC_CONTENT_MANIFEST`)s.set(e.name,new File([e.content],e.name,{type:`text/plain`})),F=F?.filter(t=>t!==e);else if(e.type===`compiled-wasm`||e.type===`text`||e.type===`buffer`){let t=e.name.replace(/[^a-zA-Z0-9_$]/g,`_`);I.push({name:t,type:e.type===`compiled-wasm`?`wasm_module`:e.type===`text`?`text_blob`:`data_blob`,part:t}),s.set(t,new File([e.content],e.name,{type:e.type===`compiled-wasm`?`application/wasm`:e.type===`text`?`text/plain`:`application/octet-stream`})),F=F?.filter(t=>t!==e)}}let Z;if(n?.unsafe?.capnp){let e=k(n.unsafe.capnp);Z=`./capnp-${Date.now()}.compiled`,s.set(Z,new File([e],Z,{type:`application/octet-stream`}))}let Q;v&&(Q??=[],Q.push(`plain_text`,`json`)),y&&(Q??=[],Q.push(`secret_text`,`secret_key`)),b&&(Q??=[],Q.push(...b));let $={...u.type===`commonjs`?{body_part:u.name}:{main_module:u.name},bindings:I,containers:e.containers===void 0?void 0:e.containers.map(e=>({...e.name!==void 0&&{name:e.name},...e.class_name!==void 0&&{class_name:e.class_name},...e.images!==void 0&&{images:e.images}})),...g&&{compatibility_date:g},..._&&{compatibility_flags:_},...p&&{migrations:p},...m&&{code_update_strategy:m},...h&&Object.keys(h).length>0&&{exports:h},capnp_schema:Z,...Q&&{keep_bindings:Q},...x!==void 0&&{logpush:x},...S&&{placement:S},...C&&{tail_consumers:C},...w&&{streaming_tail_consumers:w},...T&&{limits:T},...E&&{annotations:E},...D!==void 0&&{keep_assets:D},...O&&{assets:{jwt:O.jwt,config:P}},...A&&{observability:A},...M&&{cache_options:M},...N?.length&&{package_dependencies:N}};if(n?.unsafe?.metadata!==void 0)for(let e of Object.keys(n.unsafe.metadata))$[e]=n.unsafe.metadata[e];if(s.set(`metadata`,JSON.stringify($)),u.type===`commonjs`&&F&&F.length>0)throw TypeError(`More than one module can only be specified when type = 'esm'`);for(let e of[u].concat(F||[]))s.set(e.name,new File([e.content],e.name,{type:j(e.type??u.type??`esm`)}));for(let e of f||[])s.set(e.name,new File([e.content],e.name,{type:`application/source-map`}));return s}b(N,`createWorkerUploadForm`);export{C as a,T as c,S as i,M as n,b as o,A as r,x as s,N as t};
|