cf 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/dist/_meta/agent-context.json +46 -39
- package/dist/_meta/commands.json +9358 -10581
- package/dist/_meta/hand-written-commands.json +784 -0
- package/dist/_meta/schemas.json +14870 -14667
- package/dist/abuse-reports-sDBTV0qZ.mjs +8 -0
- package/dist/{access-CxyW_sIW.mjs → access-DcNzuCue.mjs} +1 -1
- package/dist/account-BX90zXn5.mjs +2 -0
- package/dist/account-tags-Bz3JG5hI.mjs +9 -0
- package/dist/accounts-DCuW3xyZ.mjs +28 -0
- package/dist/{acm-CHacxa3s.mjs → acm-zjfShZLS.mjs} +1 -1
- package/dist/{addressing-BnqNmmYN.mjs → addressing-DORQ64Ux.mjs} +11 -11
- package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-BgPR_aQr.mjs} +1 -1
- package/dist/agent-memory-C0hAUMeC.mjs +6 -0
- package/dist/ai-BpEBGMT2.mjs +5 -0
- package/dist/ai-audit-DnU3vn3E.mjs +2 -0
- package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
- package/dist/ai-search-DKbN9Tyd.mjs +7 -0
- package/dist/ai-security-C_I5lo58.mjs +4 -0
- package/dist/{alerting-qa8SkXlD.mjs → alerting-4T8gmZs-.mjs} +4 -4
- package/dist/analytics-Bxh4TCP7.mjs +3 -0
- package/dist/analytics_engine-fV56bjVN.mjs +2 -0
- package/dist/{api-security-MfHbfZyf.mjs → api-security-COk_i184.mjs} +20 -20
- package/dist/argo-DIRfvxvv.mjs +2 -0
- package/dist/args-DlUhyGU0.mjs +2 -0
- package/dist/artifacts-BBfXNfUg.mjs +4 -0
- package/dist/audit-logs-BlOrlAWe.mjs +2 -0
- package/dist/{auth-DuLchM18.mjs → auth-D3X9HYhD.mjs} +3 -3
- package/dist/auth-DPhNN3Ly.mjs +5 -0
- package/dist/billing-B9e4PnvN.mjs +3 -0
- package/dist/body-parser-BshbixEq.mjs +2 -0
- package/dist/bot-management-D2JVeS-V.mjs +5 -0
- package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
- package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
- package/dist/{browser-extension-q79xHrVW.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
- package/dist/browser-run-CHGOCTdG.mjs +4 -0
- package/dist/build-D0FhOj40.mjs +8 -0
- package/dist/{cache-Cl7vKJwH.mjs → cache-C6V7PbQM.mjs} +1 -1
- package/dist/{calls-DtK_ANxq.mjs → calls-Bye8Tyy-.mjs} +1 -1
- package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
- package/dist/cf-Ds4JFovl.mjs +18 -0
- package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
- package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
- package/dist/{client-certificates-BtPU9GsQ.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
- package/dist/{client-side-security-DAn-3jwp.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
- package/dist/cloud-connector-CL1jPQud.mjs +2 -0
- package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
- package/dist/command-C9VP3xaA.mjs +2 -0
- package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
- package/dist/config.d.mts +1460 -1348
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
- package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
- package/dist/connector-telemetry-events-latest-BbpcII3_.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
- package/dist/connector-telemetry-snapshots-latest-DuCiimXl.mjs +2 -0
- package/dist/{connectors-Bo6ZT8PT.mjs → connectors-BQwyBJ4_.mjs} +1 -1
- package/dist/containers-BrQtGiNp.mjs +58 -0
- package/dist/{content-scan-D03UfK2X.mjs → content-scan-DNzhXYkY.mjs} +1 -1
- package/dist/{csamScanner-DgS-7ADh.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
- package/dist/{ct-alerting-8AKtNnUg.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
- package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
- package/dist/custom-csrs-bhClr2SU.mjs +3 -0
- package/dist/custom-hostnames-C0eiGvG9.mjs +5 -0
- package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
- package/dist/custom-pages-DTINMR30.mjs +3 -0
- package/dist/d1-sKdExJYF.mjs +20 -0
- package/dist/data-security-mV3a6UfW.mjs +7 -0
- package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-DGlmjPTS.mjs → deploy-BL59O1O1.mjs} +1 -1
- package/dist/deploy-input-Dz6q-__n.mjs +2 -0
- package/dist/{dev-BbLV0Ti-.mjs → dev-BDaavgH1.mjs} +2 -2
- package/dist/diagnostics-CJV6qWUA.mjs +3 -0
- package/dist/{directory-CCndFkbQ.mjs → directory-B5zCMusW.mjs} +1 -1
- package/dist/{dispatch-namespaces-C48JQ9EA.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
- package/dist/dist-BHi7UhXO.mjs +72 -0
- package/dist/dist-BWpErtDM.mjs +384 -0
- package/dist/{dls-BBq99pjI.mjs → dls-t0hnIe_P.mjs} +1 -1
- package/dist/dns-C8FC2hbh.mjs +29 -0
- package/dist/{dns-firewall-DdwVtm12.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
- package/dist/dry-run-DL2V6yFm.mjs +2 -0
- package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
- package/dist/email-auth-BmYrl0pO.mjs +2 -0
- package/dist/email-routing-CF3_Z957.mjs +6 -0
- package/dist/email-security-F7OYcMkZ.mjs +18 -0
- package/dist/email-sending-EyU3WvGQ.mjs +7 -0
- package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
- package/dist/firewall-8YWWy4iB.mjs +11 -0
- package/dist/flagship-C4x0l-8J.mjs +4 -0
- package/dist/{fraud-AH47n-wL.mjs → fraud-HR_SdUx3.mjs} +1 -1
- package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
- package/dist/{healthchecks-DfEUG007.mjs → healthchecks-4qOvjrTN.mjs} +2 -2
- package/dist/{hostnames-DQUiD3Vr.mjs → hostnames-DehdYOMz.mjs} +1 -1
- package/dist/{hyperdrive-RyQboMWI.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
- package/dist/iam-DR72hmii.mjs +6 -0
- package/dist/images-CeKc5JPh.mjs +8 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-DtFix9WL.mjs +8 -0
- package/dist/{interactive-mV8PABm6.mjs → interactive-C7M55Wxx.mjs} +1 -1
- package/dist/ips-CtWCjXAN.mjs +2 -0
- package/dist/{keyless-certificates-oNu5jWKF.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
- package/dist/keys-BmhG6Kn1.mjs +2 -0
- package/dist/{kv-Bi9B4E0A.mjs → kv-BuVPAuZP.mjs} +1 -1
- package/dist/{leaked-credential-checks-DKRjBLcr.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
- package/dist/load-balancers-CylN-l7n.mjs +6 -0
- package/dist/{local-DTyuGwTw.mjs → local-Be3lg_9E.mjs} +1 -1
- package/dist/{local-runtime-IAXhEugU.mjs → local-runtime-Ce7k598H.mjs} +1 -1
- package/dist/logexplorer-CvRPoKbj.mjs +17 -0
- package/dist/logo-matches-Heuft3yF.mjs +2 -0
- package/dist/logos-DRYjGBDq.mjs +3 -0
- package/dist/logpush-Dve9jOMp.mjs +4 -0
- package/dist/{logs-DmWWL5f9.mjs → logs-SC86FE89.mjs} +1 -1
- package/dist/{magic-cloud-networking-XbTa6P52.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
- package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
- package/dist/magic-transit-BK_3asH2.mjs +111 -0
- package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
- package/dist/matches-Iss9Fo4R.mjs +2 -0
- package/dist/mcp-8wxXT6JU.mjs +4 -0
- package/dist/mesh-Bf9UAS4J.mjs +4 -0
- package/dist/{moq-CJpE-eNj.mjs → moq-ZKMFOeVz.mjs} +1 -1
- package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
- package/dist/{network-D2WRXCDe.mjs → network-B1lBARU9.mjs} +1 -1
- package/dist/{network-interconnects-Clq4X1U8.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
- package/dist/oauth-DuEONNgC.mjs +14 -0
- package/dist/{oauth-clients-hilWfAlm.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
- package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
- package/dist/observability-Jya7-zkl.mjs +4 -0
- package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
- package/dist/{organization-D41rIvJa.mjs → organization-CYxYV4e0.mjs} +6 -6
- package/dist/organizations-SacGUW44.mjs +2 -0
- package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
- package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
- package/dist/{output-DgW1hQGX.mjs → output-Ccqw2WOb.mjs} +1 -1
- package/dist/page-rules-BqEyFR2c.mjs +27 -0
- package/dist/pages-CQ7ZVWk1.mjs +14 -0
- package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
- package/dist/pipelines-6De2Pe2C.mjs +6 -0
- package/dist/precursor-iwK-1P_d.mjs +4 -0
- package/dist/progress-BqQcF5QH.mjs +2 -0
- package/dist/project-settings-C_1-JI6Y.mjs +3 -0
- package/dist/prompt-B0sWIs9c.mjs +3 -0
- package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
- package/dist/queries-c7zvnfEQ.mjs +3 -0
- package/dist/queues-BU6y16qS.mjs +6 -0
- package/dist/r2-Jo3QMahK.mjs +24 -0
- package/dist/{r2-data-catalog-DLtf9d6o.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
- package/dist/radar-DIYAMEof.mjs +2 -0
- package/dist/{rate-limits-B1YjnGue.mjs → rate-limits-DewOcznT.mjs} +1 -1
- package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
- package/dist/realtimekit-cnZEVNDn.mjs +7 -0
- package/dist/registrar-BsWr_aPM.mjs +23 -0
- package/dist/{registrar-sandbox-0i1T3zne.mjs → registrar-sandbox-BlcpUyIH.mjs} +6 -6
- package/dist/{registry-DDcSvd8H.mjs → registry-jifR3_Y6.mjs} +1 -1
- package/dist/reporting--1AyTV7k.mjs +2 -0
- package/dist/request-tracers-C_VX7X6-.mjs +2 -0
- package/dist/{resource-sharing-Ctdi9D-j.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
- package/dist/resource-tagging-C33U6T74.mjs +2 -0
- package/dist/rules-BfjzALMi.mjs +4 -0
- package/dist/rulesets-3i_1Vwt-.mjs +5 -0
- package/dist/rum-CjmIckiR.mjs +4 -0
- package/dist/{schema-BeXPWeK9.mjs → schema-1mwmslUV.mjs} +1 -1
- package/dist/schema-flags-llLJuFFw.mjs +5 -0
- package/dist/{scim-BgGsmHrL.mjs → scim-pApmzA5B.mjs} +1 -1
- package/dist/sdk-ZctLa5jW.mjs +3 -0
- package/dist/{secrets-store-BCpFhYFv.mjs → secrets-store-DBC9WJau.mjs} +1 -1
- package/dist/security-center-Djm06dq-.mjs +2 -0
- package/dist/{security-txt-Be2Bif0z.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
- package/dist/{share-Bz2tFTUP.mjs → share-Dj-MNXrw.mjs} +4 -4
- package/dist/shared-BJvq4DkR.mjs +290 -0
- package/dist/smart-shield--8EpJjrF.mjs +4 -0
- package/dist/snippets-Dyz0PH60.mjs +4 -0
- package/dist/{spawn-CHkoow5W.mjs → spawn-C5Z7oWdp.mjs} +108 -112
- package/dist/{spectrum-BA0a42eM.mjs → spectrum-rAHWz8rH.mjs} +1 -1
- package/dist/{speed-mmOjxOzo.mjs → speed-BKepWBXj.mjs} +1 -1
- package/dist/src-gJma71Ec.mjs +108 -0
- package/dist/{ssl-Yr6kELqg.mjs → ssl-KdFiY3ev.mjs} +1 -1
- package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
- package/dist/{state-DZC531l2.mjs → state-Cu3cItUg.mjs} +1 -1
- package/dist/{stream-Cu0kYWbc.mjs → stream-CKJ6Tb0M.mjs} +13 -13
- package/dist/submit-BxbKKhBn.mjs +2 -0
- package/dist/tags-DA8dq9fx.mjs +2 -0
- package/dist/tenant-DLXw48hS.mjs +2 -0
- package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
- package/dist/{tools-D2Xxfkrc.mjs → tools-x8bj9E6b.mjs} +1 -1
- package/dist/{tunnel-CDYkWjnt.mjs → tunnel-CNQA5Flp.mjs} +1 -1
- package/dist/tunnels-CC10EOsU.mjs +2 -0
- package/dist/turnstile-CH58hnf4.mjs +23 -0
- package/dist/{ui-DIpjthrV.mjs → ui-CmnnBm_O.mjs} +1 -1
- package/dist/url-info-BpCgdUtL.mjs +2 -0
- package/dist/{url-normalization-BeKkOZz7.mjs → url-normalization-BzuynEy1.mjs} +1 -1
- package/dist/url-scanner-APIZbhB7.mjs +2 -0
- package/dist/user-2-NGebfI.mjs +12 -0
- package/dist/values-S_bNv819.mjs +2 -0
- package/dist/{vectorize-CjXfiFH4.mjs → vectorize-Bv7feLBC.mjs} +1 -1
- package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
- package/dist/{web-assets-BzM5vVzy.mjs → web-assets-C1UmOyzD.mjs} +1 -1
- package/dist/web3-GnUocVYH.mjs +4 -0
- package/dist/workers-J1-PLwdl.mjs +28 -0
- package/dist/{workers-builds-B44wc67O.mjs → workers-builds-DCHmWOMS.mjs} +4 -4
- package/dist/{workflows-rFuQWClt.mjs → workflows-CArfEI2c.mjs} +2 -2
- package/dist/zaraz-mg2YlR3_.mjs +2 -0
- package/dist/zero-trust-DVdUPtj1.mjs +93 -0
- package/dist/zone-DMAfrDJX.mjs +2 -0
- package/dist/zones-CNwxUi7I.mjs +21 -0
- package/package.json +10 -7
- package/dist/abuse-reports-CzDAjFpo.mjs +0 -8
- package/dist/account-Dd4-tDYJ.mjs +0 -2
- package/dist/account-tags-65fAlHrf.mjs +0 -9
- package/dist/accounts-Bp5KGc6r.mjs +0 -28
- package/dist/agent-memory-D--BQS0W.mjs +0 -6
- package/dist/ai-BnVlQDiI.mjs +0 -5
- package/dist/ai-audit-CfpDKXkD.mjs +0 -2
- package/dist/ai-gateway-oG4j_oYN.mjs +0 -13
- package/dist/ai-search-B2l3B_jn.mjs +0 -7
- package/dist/ai-security-byjIIrfl.mjs +0 -4
- package/dist/analytics-DeIKjC9n.mjs +0 -3
- package/dist/analytics_engine-BnECMIWJ.mjs +0 -2
- package/dist/argo-DFerMyXF.mjs +0 -2
- package/dist/artifacts-CtyEYYDa.mjs +0 -4
- package/dist/audit-logs-retFtvow.mjs +0 -2
- package/dist/auth-aazs91XL.mjs +0 -5
- package/dist/billing-CxQVqpGZ.mjs +0 -3
- package/dist/body-parser-CYD7PKFC.mjs +0 -2
- package/dist/bot-management-Rli7v7tg.mjs +0 -5
- package/dist/botnet-feed-Cw6XSEf8.mjs +0 -3
- package/dist/brand-protection-CTvnHGfV.mjs +0 -3
- package/dist/browser-run-FwtwnBzA.mjs +0 -4
- package/dist/build-Dji9BYmV.mjs +0 -2
- package/dist/certificate-authorities-DZP1RzAs.mjs +0 -2
- package/dist/cf-oSz9pud_.mjs +0 -18
- package/dist/chunk-LQW53VED-Xakf_rUn.mjs +0 -499
- package/dist/cloud-connector-BpVcvhjZ.mjs +0 -2
- package/dist/cloudforce-one-2PecncfX.mjs +0 -30
- package/dist/connector-interrupts-ollUcksZ.mjs +0 -2
- package/dist/connector-telemetry-events-D5_3X7XW.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CJ9gLRFR.mjs +0 -2
- package/dist/containers-Bog7j0Hw.mjs +0 -54
- package/dist/custom-certificates-4y35UC1X.mjs +0 -5
- package/dist/custom-csrs-DwBrLh-H.mjs +0 -4
- package/dist/custom-hostnames-CDIAnsRa.mjs +0 -5
- package/dist/custom-nameservers-stk7ymnP.mjs +0 -3
- package/dist/custom-pages-vfDxrXbt.mjs +0 -4
- package/dist/d1-Cllm-iTT.mjs +0 -20
- package/dist/data-security-rnoSCEdL.mjs +0 -7
- package/dist/dcv-delegation-DCRCOL6l.mjs +0 -2
- package/dist/deploy-input-DhCo1I0I.mjs +0 -242
- package/dist/diagnostics-D5Yo2xqx.mjs +0 -3
- package/dist/dist-COfwjT96.mjs +0 -72
- package/dist/dns-DdQYtenF.mjs +0 -29
- package/dist/durable-objects-BvxXBht_.mjs +0 -2
- package/dist/email-CGOC_evd.mjs +0 -2
- package/dist/email-auth-DFvXKSkg.mjs +0 -2
- package/dist/email-routing-QBRPBlyl.mjs +0 -6
- package/dist/email-security-BFagcRPP.mjs +0 -18
- package/dist/email-sending-Ddhe7xjN.mjs +0 -7
- package/dist/filters-CGisPGD1.mjs +0 -4
- package/dist/firewall-DD8U-Brd.mjs +0 -11
- package/dist/flagship-FJHc4mFi.mjs +0 -4
- package/dist/google-tag-gateway-149kbuG_.mjs +0 -2
- package/dist/iam-BhHYhMXO.mjs +0 -6
- package/dist/images-CDViyKtZ.mjs +0 -8
- package/dist/intel-YHZbPlS3.mjs +0 -8
- package/dist/ips-BpCdldFx.mjs +0 -2
- package/dist/keys-yYtv7Ztr.mjs +0 -2
- package/dist/load-balancers-jRCN75mX.mjs +0 -7
- package/dist/logexplorer-kO8CULiK.mjs +0 -24
- package/dist/logo-matches-LyDAYPbI.mjs +0 -2
- package/dist/logos-O9f5bGSB.mjs +0 -3
- package/dist/logpush-dtXLu3Ck.mjs +0 -5
- package/dist/magic-network-monitoring-CpfkgZMp.mjs +0 -4
- package/dist/magic-transit-DwgZeIj-.mjs +0 -111
- package/dist/managed-transforms-DCmogkxv.mjs +0 -3
- package/dist/matches-BAeN8VM1.mjs +0 -2
- package/dist/mcp-DKZ2D050.mjs +0 -4
- package/dist/media-CnxgOViL.mjs +0 -2
- package/dist/mesh-CzIPtuaM.mjs +0 -4
- package/dist/mtls-certificates-Bbm_1lQI.mjs +0 -3
- package/dist/oauth-BPizUUqP.mjs +0 -15
- package/dist/oauth-scopes-CmbgsPYd.mjs +0 -2
- package/dist/observability-DXYgDdU5.mjs +0 -4
- package/dist/organizations-eNzfOwlP.mjs +0 -2
- package/dist/origin-ca-certificates-DaiAmw45.mjs +0 -3
- package/dist/origin-post-quantum-encryption-7YztBged.mjs +0 -2
- package/dist/origin-tls-client-auth-DRwURM8s.mjs +0 -4
- package/dist/page-rules-B2Csdc4h.mjs +0 -18
- package/dist/pages-BAL6Q7OY.mjs +0 -14
- package/dist/pay-per-crawl-C-1-ZAtn.mjs +0 -4
- package/dist/pipelines-cyQOuFLb.mjs +0 -6
- package/dist/precursor-BrweY39h.mjs +0 -4
- package/dist/progress-B84wYh91.mjs +0 -2
- package/dist/prompt-CDtLWxNv.mjs +0 -3
- package/dist/queries-oM8uGZy5.mjs +0 -3
- package/dist/queues-CTx04ZNw.mjs +0 -6
- package/dist/r2-CnlIUn7R.mjs +0 -24
- package/dist/radar-CGNgGh8v.mjs +0 -2
- package/dist/raw-fetch-Dz-QBoP_.mjs +0 -2
- package/dist/realtimekit-BPwzhNS9.mjs +0 -7
- package/dist/registrar-BEcb90RX.mjs +0 -21
- package/dist/reporting-CLbjHlnw.mjs +0 -2
- package/dist/request-tracers-BcKpofP1.mjs +0 -2
- package/dist/resource-tagging-DGEyVTDN.mjs +0 -2
- package/dist/rules-CmuB5rIN.mjs +0 -4
- package/dist/rulesets-CGaMq8vG.mjs +0 -8
- package/dist/rum-QT6EP4JK.mjs +0 -4
- package/dist/schema-flags-DHryz6SF.mjs +0 -5
- package/dist/sdk-m4xeaua4.mjs +0 -3
- package/dist/security-center-BNm4uPVB.mjs +0 -2
- package/dist/session-Ckt20hHa.mjs +0 -2
- package/dist/shared-BzPQog8H.mjs +0 -2
- package/dist/smart-shield-SODkOUyO.mjs +0 -4
- package/dist/snippets-B5jY8v_7.mjs +0 -4
- package/dist/src-CHW7s5IS.mjs +0 -108
- package/dist/submit-Dl_27e0n.mjs +0 -2
- package/dist/tags-Cdo_Pwtr.mjs +0 -2
- package/dist/tenant-EX-ANl6X.mjs +0 -2
- package/dist/tenant-custom-nameservers-BPHUeckw.mjs +0 -3
- package/dist/triggers-Bf9hbP3h.mjs +0 -2
- package/dist/tunnels-CgyX8R2J.mjs +0 -2
- package/dist/turnstile-BUtzlW-0.mjs +0 -23
- package/dist/url-info-CJsa1Oc9.mjs +0 -2
- package/dist/url-scanner-Cz-yl0_3.mjs +0 -2
- package/dist/user-BxHjEqpd.mjs +0 -12
- package/dist/values-C43NurfT.mjs +0 -2
- package/dist/versions-BFbc90Wu.mjs +0 -2
- package/dist/waiting-rooms-C5jSQv_r.mjs +0 -11
- package/dist/web3-Ctv9HGiR.mjs +0 -4
- package/dist/workers-D-YbIedB.mjs +0 -24
- package/dist/zaraz-BA6kY-b6.mjs +0 -2
- package/dist/zero-trust-DOFLlUz1.mjs +0 -102
- package/dist/zone-B_rgejLV.mjs +0 -2
- package/dist/zone-tags-BWdza4rH.mjs +0 -9
- package/dist/zones-DTWO7Vvn.mjs +0 -21
- /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
- /package/dist/{alerts-B85uj2Vx.mjs → alerts-15-IW4jE.mjs} +0 -0
- /package/dist/{autorag-Do9l_LyY.mjs → autorag-CFwRkEKw.mjs} +0 -0
- /package/dist/{brands-DateHCdd.mjs → brands-BgT1vu9B.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
- /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
- /package/dist/{clear-CB2kgcEB.mjs → clear-BlCK85Me.mjs} +0 -0
- /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
- /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C7LBxPBt.mjs} +0 -0
- /package/dist/{health-buY5f5pp.mjs → health-DZFfafkX.mjs} +0 -0
- /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
- /package/dist/{internal-CwyoJUHh.mjs → internal-BKHC2D1Y.mjs} +0 -0
- /package/dist/{live-wEpA5V_n.mjs → live-DwCvDmaH.mjs} +0 -0
- /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
- /package/dist/{ready-CBSCPiHE.mjs → ready-D9H2zHHI.mjs} +0 -0
- /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
- /package/dist/{refute-u7ZPQJZy.mjs → refute-2W8NLCN4.mjs} +0 -0
- /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-B8CyM1mi.mjs} +0 -0
- /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
- /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-CWhta3x7.mjs} +0 -0
- /package/dist/{search-D9WDwnV4.mjs → search-DZmBQJL9.mjs} +0 -0
- /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-CQrmWgz5.mjs} +0 -0
- /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-C98A0bqq.mjs} +0 -0
- /package/dist/{theme-BePJemMn.mjs → theme-CrIBazAF.mjs} +0 -0
- /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-BZoaFoDE.mjs} +0 -0
- /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
- /package/dist/{verify-2yi0H93r.mjs → verify-4e4L9IRk.mjs} +0 -0
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{r}from"./auth-DuLchM18.mjs";import{t as i}from"./output-DgW1hQGX.mjs";import{n as a,t as o}from"./progress-B84wYh91.mjs";import{n as s,t as c}from"./body-parser-CYD7PKFC.mjs";import{n as l}from"./input-validation-BBKJRoRB.mjs";import{a as u,n as d}from"./prompt-CDtLWxNv.mjs";import{t as f}from"./cli-types-BWdZbsFE.mjs";function p(e){return e.option(`name`,{type:`string`,description:`Namespace name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`create-namespace`,describe:`Creates a new memory namespace owned by the account.`,builder:p,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory create-namespace`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},bodyKind:`json`,body:d.body===void 0?c({name:l(d.name,`name`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...e,account_id:p})),{successLabel:`Created`});return}d.name===void 0&&(d.name=await u(`name`,`Namespace name.`));let m=c({name:l(d.name,`name`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.createNamespace({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete-memory <memory-id>`,describe:`Deletes a memory by ID. Removes the memory and any source messages linked to it. Returns the deleted memory.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-memory`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the memory and any source messages linked to it.`})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteMemory({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],memory_id:s[`memory-id`]})),{successLabel:`Deleted`})}};function _(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete-namespace <namespace-name>`,describe:`Deletes a namespace.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-namespace`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the namespace along with all memory profiles, memories, and sessions it contains.`})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteNamespace({account_id:l,namespace_name:s[`namespace-name`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const b={command:`delete-profile <profile-name>`,describe:`Marks a profile for deletion.`,builder:y,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-profile`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes the profile along with all of its memories and messages.`})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteProfile({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`]})),{successLabel:`Deleted`})}};function x(e){return e.positional(`session-id`,{type:`string`,description:`Session identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const S={command:`delete-session <session-id>`,describe:`Marks all memories and messages in a profile that are tagged with the given session ID for deletion.`,builder:x,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory delete-session`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/sessions/${s[`session-id`]==null?`<session-id>`:encodeURIComponent(String(s[`session-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"session-id":String(s[`session-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await d({force:!!s.force,message:`This operation deletes all memories and messages tagged with this session ID.`})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}i(await o(`Deleting`,async()=>c.agentMemory.deleteSession({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],session_id:s[`session-id`]})),{successLabel:`Deleted`})}};function C(e){return e.positional(`memory-id`,{type:`string`,description:`Memory Identifier.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get-memory <memory-id>`,describe:`Retrieves a memory by ID.`,builder:C,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-memory`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories/${s[`memory-id`]==null?`<memory-id>`:encodeURIComponent(String(s[`memory-id`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``),"memory-id":String(s[`memory-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getMemory({account_id:l,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],memory_id:s[`memory-id`]})),{successLabel:`Loaded`})}};function T(e){return e.positional(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const E={command:`get-namespace <namespace-name>`,describe:`Gets a namespace by name.`,builder:T,handler:async s=>{if(s.dryRun){a({command:`cf agent-memory get-namespace`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}`,pathParams:{"namespace-name":String(s[`namespace-name`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.agentMemory.getNamespace({account_id:l,namespace_name:s[`namespace-name`]})),{successLabel:`Loaded`})}};function D(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const O={command:`ingest <profile-name>`,describe:`Processes a conversation and extracts structured memories from it. Agent Memory identifies facts, events, instructions, and tasks automatically.`,builder:D,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory ingest`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/ingest`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.ingest({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.ingest({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}};function k(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`cursor`,{type:`string`,description:`Continuation cursor for paginated results.`}).option(`session-id`,{type:`string`,description:`Session identifier for filtering.`}).option(`type`,{type:`string`,description:`Memory type for filtering.`,choices:[`fact`,`event`,`instruction`,`task`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list-memories <profile-name>`,describe:`List memories stored in a profile.`,builder:f(k),handler:async s=>{let c={per_page:s[`per-page`],cursor:s.cursor,session_id:s[`session-id`],type:s.type};if(s.dryRun){a({command:`cf agent-memory list-memories`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${s[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(s[`namespace-name`]))}/profiles/${s[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(s[`profile-name`]))}/memories`,pathParams:{"namespace-name":String(s[`namespace-name`]??``),"profile-name":String(s[`profile-name`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listMemories({account_id:u,namespace_name:s[`namespace-name`],profile_name:s[`profile-name`],...c})),{successLabel:`Loaded`})}};function j(e){return e.option(`per-page`,{type:`number`,description:`Number of results per page.`}).option(`order`,{type:`string`,description:`Order`,choices:[`id`,`name`]}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list-namespaces`,describe:`Lists all namespaces for the given account. Results are paginated.`,builder:f(j),handler:async s=>{let c={per_page:s[`per-page`],order:s.order,direction:s.direction,cursor:s.cursor};if(s.dryRun){a({command:`cf agent-memory list-namespaces`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.agentMemory.listNamespaces({account_id:u,...c})),{successLabel:`Loaded`})}};function N(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`query`,{type:`string`,description:`Natural-language query to match against stored memories.`}).option(`reference-date`,{type:`string`,description:`Temporal anchor for relative date references in the query.`}).option(`response-length`,{type:`string`,description:`Verbosity of the synthesized answer. Defaults to 'medium'.`,choices:[`short`,`medium`,`long`]}).option(`thinking-level`,{type:`string`,description:`Recall intensity / search depth. Defaults to 'low'.`,choices:[`low`,`medium`,`high`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const P={command:`recall <profile-name>`,describe:`Retrieves memories relevant to the query and returns a synthesized answer.`,builder:N,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory recall`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/recall`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.recall({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.query===void 0&&(d.query=await u(`query`,`Natural-language query to match against stored memories.`));let m=c({query:l(d.query,`query`,`text`),referenceDate:l(d[`reference-date`],`reference-date`,`text`),responseLength:l(d[`response-length`],`response-length`,`text`),thinkingLevel:l(d[`thinking-level`],`thinking-level`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.recall({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function F(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`content`,{type:`string`,description:`Raw memory content to store.`}).option(`session-id`,{type:`string`,description:`Session identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const I={command:`remember <profile-name>`,describe:`Stores a single memory explicitly.`,builder:F,handler:async d=>{if(d.dryRun){a({command:`cf agent-memory remember`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${d[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(d[`namespace-name`]))}/profiles/${d[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(d[`profile-name`]))}/remember`,pathParams:{"namespace-name":String(d[`namespace-name`]??``),"profile-name":String(d[`profile-name`]??``)},bodyKind:`json`,body:d.body===void 0?c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.agentMemory.remember({...e,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`});return}d.content===void 0&&(d.content=await u(`content`,`Raw memory content to store.`));let m=c({content:l(d.content,`content`,`text`),sessionId:l(d[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>f.agentMemory.remember({...m,account_id:p,namespace_name:d[`namespace-name`],profile_name:d[`profile-name`]})),{successLabel:`Created`})}};function L(e){return e.positional(`profile-name`,{type:`string`,description:`Profile name.`,demandOption:!0}).option(`namespace-name`,{type:`string`,description:`Namespace name.`,demandOption:!0}).option(`session-id`,{type:`string`,description:`Session identifier.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`summary <profile-name>`,describe:`Generates a structured Markdown summary of everything stored in a memory profile.`,builder:L,handler:async u=>{if(u.dryRun){a({command:`cf agent-memory summary`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/agent-memory/namespaces/${u[`namespace-name`]==null?`<namespace-name>`:encodeURIComponent(String(u[`namespace-name`]))}/profiles/${u[`profile-name`]==null?`<profile-name>`:encodeURIComponent(String(u[`profile-name`]))}/summary`,pathParams:{"namespace-name":String(u[`namespace-name`]??``),"profile-name":String(u[`profile-name`]??``)},bodyKind:`json`,body:u.body===void 0?c({sessionId:l(u[`session-id`],`session-id`,`text`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Creating`,async()=>d.agentMemory.summary({...e,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`});return}let p=c({sessionId:l(u[`session-id`],`session-id`,`text`)});i(await o(`Creating`,async()=>d.agentMemory.summary({...p,account_id:f,namespace_name:u[`namespace-name`],profile_name:u[`profile-name`]})),{successLabel:`Created`})}},z={command:`agent-memory`,describe:`agent-memory`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).command(w).command(E).command(O).command(A).command(M).command(P).command(I).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{z as default};
|
package/dist/ai-BnVlQDiI.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a as e}from"./theme-BePJemMn.mjs";import{n as t,t as n}from"./local-DTyuGwTw.mjs";import{f as r,g as i}from"./oauth-BPizUUqP.mjs";import{a,o,r as s}from"./auth-DuLchM18.mjs";import{t as c}from"./output-DgW1hQGX.mjs";import{n as l,t as u}from"./progress-B84wYh91.mjs";import{n as d,t as f}from"./body-parser-CYD7PKFC.mjs";import{n as p,t as m}from"./input-validation-BBKJRoRB.mjs";import{a as h,i as g,n as _}from"./prompt-CDtLWxNv.mjs";import{t as v}from"./cli-types-BWdZbsFE.mjs";import{n as y}from"./raw-fetch-Dz-QBoP_.mjs";import{a as b,c as x,d as S,i as C,l as ee,n as w,o as T,r as E,s as D,t as O,u as k}from"./schema-flags-DHryz6SF.mjs";const A=`ai-model-schema`;async function j(e,t,n,r){let i=k(A,[t,e]);if(i)return{ok:!0,schema:i};let a;try{let i=await n();if(r===void 0)a=await i.ai.getModelSchema({account_id:t,model:e});else{let n=r-Date.now();if(n<=0)return{ok:!1,reason:`the request timed out`};a=await i.ai.getModelSchema({account_id:t,model:e},{timeoutInSeconds:n/1e3,maxRetries:0})}}catch(e){return{ok:!1,reason:x(e)}}let o=ee(a,`input`);return o?(S(A,[t,e],o),{ok:!0,schema:o}):{ok:!1,reason:`the API returned no input schema`}}const M="Run `cf ai models list` to see the models you can run.",N=[`model-name`,`modelName`];let P;function F(e){return P=e,e.positional(`model-name`,{type:`string`,description:`Model ID, e.g. @cf/meta/llama-3.1-8b-instruct`}).option(`body`,{type:`string`,description:`Raw JSON request body, or @path to a JSON file`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).strictOptions(!1).help(!1).option(`help`,{type:`boolean`,alias:`h`,description:`Show help, including this model's input flags`}).epilogue(`Input flags depend on the model: run \`cf ai run <model> --help\`.\n${M}`)}async function I(n){n.local&&console.log(`${t}\n`),P?.showHelp(`log`);let r=n[`model-name`];if(!r||n.local)return;let i=Date.now()+D,a=await o(i);if(!a){console.log(`\n${e.muted(`Set \`CLOUDFLARE_ACCOUNT_ID\` or sign in with \`cf auth login\` to see the input flags for ${r}.`)}`);return}let c=await j(r,a,()=>s(n),i);console.log(c.ok?`\n${C(b(c.schema),`Input flags for ${r}`)}`:`\n${e.muted(`Could not load the input flags for ${r}: ${c.reason}.`)}`)}const L={command:`run [model-name]`,describe:"Run inference on a Workers AI model. Input flags are model-specific — see `cf ai run <model> --help`",builder:F,handler:async e=>{if(e.help){await I(e);return}if(e.local)throw Error(t);let n=e[`model-name`];if(!n)throw Error(`A model is required: cf ai run <model>. ${M}`);let o=e.dryRun?await i()??`<account-id>`:await r(),f=n.split(`/`).map(encodeURIComponent).join(`/`),p;if(e.body!==void 0){if(T(e,N).length>0)throw Error(`--body cannot be combined with model input flags. Pass one or the other.`);p=d(e.body)}else{let t=await j(n,o,()=>s(e));if(!t.ok)throw Error(`Could not load the input schema for ${n}: ${t.reason}.\nPass the request body directly instead: cf ai run ${n} --body '{…}'`);let r=b(t.schema),i=T(e,[...N,...w(r)]);if(i.length>0)throw Error(`${i.map(e=>`Unknown flag --${e}`).join(`
|
|
3
|
-
`)}\n\nRun \`cf ai run ${n} --help\` for this model's input flags.`);for(let t of E(r,e))t.choices?e[t.name]=await g(t.name,t.description??``,t.choices):t.type===`string`&&(e[t.name]=await h(t.name,t.description??``));let a=O(r,e,{reserved:N});if(a.errors.length>0)throw Error(`${a.errors.join(`
|
|
4
|
-
`)}\n\nRun \`cf ai run ${n} --help\` for this model's input flags.`);p=a.body}if(e.dryRun){l({command:`cf ai run`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${o}/ai/run/${f}`,pathParams:{"model-name":n},bodyKind:`json`,body:p});return}let m=await s(e);e.accountId=o;let _=await u(`Running`,async()=>a(m,`POST`,`/accounts/${o}/ai/run/${f}`,{body:p,preserveNonJsonBytes:!0}));if(Buffer.isBuffer(_)){y(_);return}c(_,{successLabel:`Ran`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Searches Workers AI models by author or organization name.`,builder:R,handler:async e=>{if(e.dryRun){l({command:`cf ai authors list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/authors/search`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.authors.list({account_id:a})),{successLabel:`Loaded`})}},B={command:`authors`,describe:`Operations for authors`,builder:e=>e.command(z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function V(e){return e.positional(`finetune-id`,{type:`string`,description:`Finetune ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Finetune asset file upload.`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`file-name`,{type:`string`,description:`Name of the file (adapter_config.json or adapter_model.safetensors).`})}const H={command:`create <finetune-id>`,describe:`Uploads training data assets for a Workers AI fine-tuning job.`,builder:V,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes assets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,pathParams:{"finetune-id":String(e[`finetune-id`]??``)},bodyKind:`multipart`,body:{body:e.body,file:e.file,"file-name":e[`file-name`]}});return}let t=await s(e),o=e.local?n:await r();if(e.accountId=o,e.file!==void 0||e.body!==void 0||e[`file-name`]!==void 0){let n=new FormData;if(e.file){let t=m(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);e[`file-name`]!==void 0&&n.append(`file_name`,String(p(e[`file-name`],`file-name`,`text`)??``)),c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/finetunes/${encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=p(e.body,`body`,`binary`);c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/finetunes/${encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{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.positional(`file-name`,{type:`string`,description:`File name`,demandOption:!0}).option(`finetune-id`,{type:`string`,description:`Finetune ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`download <file-name>`,describe:`Returns a pre-signed R2 URL for downloading a finetune asset file.`,builder:U,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes assets download`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}/finetune-assets/${e[`file-name`]==null?`<file-name>`:encodeURIComponent(String(e[`file-name`]))}`,pathParams:{"finetune-id":String(e[`finetune-id`]??``),"file-name":String(e[`file-name`]??``)},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.finetunes.assets.download({account_id:a,finetune_id:e[`finetune-id`],file_name:e[`file-name`]})),{successLabel:`Loaded`})}},W={command:`assets`,describe:`Operations for finetunes.assets`,builder:e=>e.command(H).command(te).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.option(`description`,{type:`string`,description:`The description field`}).option(`model`,{type:`string`,description:`The model field`}).option(`name`,{type:`string`,description:`The name field`}).option(`public`,{type:`boolean`,description:`The public field`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const K={command:`create`,describe:`Creates a new fine-tuning job for a Workers AI model using custom training data.`,builder:G,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({description:p(e.description,`description`,`text`),model:p(e.model,`model`,`text`),name:p(e.name,`name`,`text`),public:e.public}):d(e.body)});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,e.body){let n=d(e.body);c(await u(`Creating`,async()=>t.ai.finetunes.create({...n,account_id:a})),{successLabel:`Created`});return}e.model===void 0&&(e.model=await h(`model`,`The model field`)),e.name===void 0&&(e.name=await h(`name`,`The name field`));let o=f({description:p(e.description,`description`,`text`),model:p(e.model,`model`,`text`),name:p(e.name,`name`,`text`),public:e.public});c(await u(`Creating`,async()=>t.ai.finetunes.create({...o,account_id:a})),{successLabel:`Created`})}};function q(e){return e.positional(`finetune-id`,{type:`string`,description:`Finetune 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 J={command:`delete <finetune-id>`,describe:`Delete a finetune. Any in-flight requests referencing the lora will fail after the files are deleted.`,builder:q,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/${e[`finetune-id`]==null?`<finetune-id>`:encodeURIComponent(String(e[`finetune-id`]))}`,pathParams:{"finetune-id":String(e[`finetune-id`]??``)},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,!await _({force:!!e.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}c(await u(`Deleting`,async()=>t.ai.finetunes.delete({account_id:a,finetune_id:e[`finetune-id`]})),{successLabel:`Deleted`})}};function Y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const X={command:`list`,describe:`Lists all fine-tuning jobs created by the account, including status and metrics.`,builder:Y,handler:async e=>{if(e.dryRun){l({command:`cf ai finetunes list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.finetunes.list({account_id:a})),{successLabel:`Loaded`})}};function Z(e){return e.option(`limit`,{type:`number`,description:`Pagination Limit.`}).option(`offset`,{type:`number`,description:`Pagination Offset.`}).option(`order-by`,{type:`string`,description:`Order By Column Name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`list`,describe:`Lists publicly available fine-tuned models that can be used with Workers AI.`,builder:Z,handler:async e=>{let t={limit:e.limit,offset:e.offset,orderBy:e[`order-by`]};if(e.dryRun){l({command:`cf ai finetunes public list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/finetunes/public`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.finetunes.public.list({account_id:o,...t})),{successLabel:`Loaded`})}},ne={command:`public`,describe:`Operations for finetunes.public`,builder:e=>e.command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},re={command:`finetunes`,describe:`Operations for finetunes`,builder:e=>e.command(K).command(J).command(X).command(W).command(ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ie(e){return e.option(`model`,{type:`string`,description:`Model Name`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`getModelSchema`,describe:`Retrieves the input and output JSON schema definition for a Workers AI model.`,builder:ie,handler:async e=>{let t={model:e.model};if(e.dryRun){l({command:`cf ai getModelSchema`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/models/schema`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.getModelSchema({account_id:o,...t})),{successLabel:`Loaded`})}};function oe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`listMarkdownSupportedFormats`,describe:`Lists all file formats supported for conversion to Markdown.`,builder:oe,handler:async e=>{if(e.dryRun){l({command:`cf ai listMarkdownSupportedFormats`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tomarkdown/supported`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.listMarkdownSupportedFormats({account_id:a})),{successLabel:`Loaded`})}};function ce(e){return e.option(`per-page`,{type:`number`,description:`Per page`}).option(`page`,{type:`number`,description:`Page`}).option(`task`,{type:`string`,description:`Filter by Task Name.`}).option(`author`,{type:`string`,description:`Filter by Author.`}).option(`source`,{type:`number`,description:`Filter by Source Id.`}).option(`hide-experimental`,{type:`boolean`,description:`Filter to hide experimental models.`}).option(`search`,{type:`string`,description:`Search.`}).option(`include-deprecated`,{type:`boolean`,description:`If true, include models for up to three months after their deprecation date. Defaults to false.`}).option(`format`,{type:`string`,description:`If set, return models in the requested marketplace format instead of the default response.`,choices:[`openrouter`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`list`,describe:`Searches Workers AI models by name or description.`,builder:v(ce),handler:async e=>{let t={per_page:e[`per-page`],page:e.page,task:e.task,author:e.author,source:e.source,hide_experimental:e[`hide-experimental`],search:e.search,include_deprecated:e[`include-deprecated`],format:e.format};if(e.dryRun){l({command:`cf ai models list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/models/search`,pathParams:{},query:t,bodyKind:`none`});return}let a=await s(e),o=e.local?n:await r();e.accountId=o,c(await u(`Loading`,async()=>a.ai.models.list({account_id:o,...t})),{successLabel:`Loaded`})}},ue={command:`models`,describe:`Operations for models`,builder:e=>e.command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function de(e){return e.positional(`model-name`,{type:`string`,description:`Model name`,demandOption:!0}).option(`text`,{type:`string`,description:`The text that you want to classify`}).option(`guidance`,{type:`number`,description:`Controls how closely the generated image should adhere to the prompt; higher values make the image more aligned with the prompt`}).option(`height`,{type:`number`,description:`The height of the generated image in pixels`}).option(`image`,{type:`string`,array:!0,description:`For use with img2img tasks. An array of integers that represent the image data constrained to 8-bit unsigned integer values`}).option(`image-b64`,{type:`string`,description:`For use with img2img tasks. A base64-encoded string of the input image`}).option(`mask`,{type:`string`,array:!0,description:`An array representing An array of integers that represent mask image data for inpainting constrained to 8-bit unsigned integer values`}).option(`negative-prompt`,{type:`string`,description:`Text describing elements to avoid in the generated image`}).option(`num-steps`,{type:`number`,description:`The number of diffusion steps; higher values can improve quality but take longer`}).option(`prompt`,{type:`string`,description:`A text description of the image you want to generate`}).option(`seed`,{type:`number`,description:`Random seed for reproducibility of the image generation`}).option(`strength`,{type:`number`,description:`A value between 0 and 1 indicating how strongly to apply the transformation during img2img tasks; lower values make the output closer to the input image`}).option(`width`,{type:`number`,description:`The width of the generated image in pixels`}).option(`lang`,{type:`string`,description:`The speech language (e.g., 'en' for English, 'fr' for French). Defaults to 'en' if not specified`}).option(`source-lang`,{type:`string`,description:`The language code of the source text (e.g., 'en' for English). Defaults to 'en' if not specified`}).option(`target-lang`,{type:`string`,description:`The language code to translate the text into (e.g., 'es' for Spanish)`}).option(`input-text`,{type:`string`,description:`The text that you want the model to summarize`}).option(`max-length`,{type:`number`,description:`The maximum length of the generated summary in tokens`}).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)`}).conflicts(`text`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).conflicts(`guidance`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`height`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`image`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`,`prompt`]).conflicts(`image-b64`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`mask`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`negative-prompt`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`num-steps`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`prompt`,[`text`,`source-lang`,`target-lang`,`input-text`,`max-length`,`image`]).conflicts(`seed`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`strength`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`width`,[`text`,`lang`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`lang`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`seed`,`strength`,`width`,`source-lang`,`target-lang`,`input-text`,`max-length`]).conflicts(`source-lang`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).conflicts(`target-lang`,[`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`input-text`,`max-length`]).implies(`target-lang`,[`text`]).conflicts(`input-text`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`source-lang`,`target-lang`]).conflicts(`max-length`,[`text`,`guidance`,`height`,`image`,`image-b64`,`mask`,`negative-prompt`,`num-steps`,`prompt`,`seed`,`strength`,`width`,`lang`,`source-lang`,`target-lang`])}const fe={command:`runModel <model-name>`,describe:`This endpoint provides users with the capability to run specific AI models on-demand. By submitting the required input data, users can receive real-time predictions or results generated by the chosen AI model. The endpoint supports various AI model types, ensuring flexibility and adaptability for diverse use cases. Model specific inputs available in [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).`,builder:de,handler:async e=>{if(e.dryRun){l({command:`cf ai runModel`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/run/${e[`model-name`]==null?`<model-name>`:encodeURIComponent(String(e[`model-name`]))}`,pathParams:{"model-name":String(e[`model-name`]??``)},bodyKind:`json`,body:e.body===void 0?f({text:p(e.text,`text`,`text`),guidance:e.guidance,height:e.height,image:e.image,image_b64:p(e[`image-b64`],`image-b64`,`text`),mask:e.mask,negative_prompt:p(e[`negative-prompt`],`negative-prompt`,`text`),num_steps:e[`num-steps`],prompt:p(e.prompt,`prompt`,`text`),seed:e.seed,strength:e.strength,width:e.width,lang:p(e.lang,`lang`,`text`),source_lang:p(e[`source-lang`],`source-lang`,`text`),target_lang:p(e[`target-lang`],`target-lang`,`text`),input_text:p(e[`input-text`],`input-text`,`text`),max_length:e[`max-length`]}):d(e.body)});return}let t=await s(e),a=e.local?n:await r();if(e.accountId=a,e.body){let n=d(e.body);c(await u(`Creating`,async()=>t.ai.runModel({body:n,account_id:a,model_name:e[`model-name`]})),{successLabel:`Created`});return}let o=f({text:p(e.text,`text`,`text`),guidance:e.guidance,height:e.height,image:e.image,image_b64:p(e[`image-b64`],`image-b64`,`text`),mask:e.mask,negative_prompt:p(e[`negative-prompt`],`negative-prompt`,`text`),num_steps:e[`num-steps`],prompt:p(e.prompt,`prompt`,`text`),seed:e.seed,strength:e.strength,width:e.width,lang:p(e.lang,`lang`,`text`),source_lang:p(e[`source-lang`],`source-lang`,`text`),target_lang:p(e[`target-lang`],`target-lang`,`text`),input_text:p(e[`input-text`],`input-text`,`text`),max_length:e[`max-length`]});c(await u(`Creating`,async()=>t.ai.runModel({body:o,account_id:a,model_name:e[`model-name`]})),{successLabel:`Created`})}};function pe(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`list`,describe:`Searches Workers AI models by task type (e.g., text-generation, embeddings).`,builder:pe,handler:async e=>{if(e.dryRun){l({command:`cf ai tasks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tasks/search`,pathParams:{},bodyKind:`none`});return}let t=await s(e),a=e.local?n:await r();e.accountId=a,c(await u(`Loading`,async()=>t.ai.tasks.list({account_id:a})),{successLabel:`Loaded`})}},me={command:`tasks`,describe:`Operations for tasks`,builder:e=>e.command($).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function he(e){return e.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(`files`,{type:`string`,description:`The files`})}const ge={command:`toMarkdown`,describe:`Converts uploaded files into Markdown format using Workers AI.`,builder:he,handler:async e=>{if(e.dryRun){l({command:`cf ai toMarkdown`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await i()??`<account-id>`}/ai/tomarkdown`,pathParams:{},bodyKind:`multipart`,body:{body:e.body,file:e.file,files:e.files}});return}let t=await s(e),o=e.local?n:await r();if(e.accountId=o,e.file!==void 0||e.body!==void 0||e.files!==void 0){let n=new FormData;if(e.file){let t=m(e.file);n.append(`file`,new Blob([t]),e.file.split(/[\\/]/).filter(Boolean).pop())}else e.body!==void 0&&n.append(`file`,e.body);if(e.files!==void 0){let t=typeof e.files==`string`?p(e.files,`files`,`text`):e.files;n.append(`files`,typeof t==`string`?t:JSON.stringify(t))}c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/tomarkdown`,{body:n})),{successLabel:`Created`});return}if(e.body){let n=p(e.body,`body`,`binary`);c(await u(`Creating`,async()=>a(t,`POST`,`/accounts/${o}/ai/tomarkdown`,{body:n,headers:{"Content-Type":`multipart/form-data`}})),{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.`)}},_e={command:`ai`,describe:`ai`,builder:e=>e.command(ae).command(se).command(L).command(fe).command(ge).command(B).command(re).command(ue).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_e as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as e}from"./oauth-BPizUUqP.mjs";import{a as t,r as n}from"./auth-DuLchM18.mjs";import{t as r}from"./output-DgW1hQGX.mjs";import{n as i,t as a}from"./progress-B84wYh91.mjs";import{n as o}from"./body-parser-CYD7PKFC.mjs";function s(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Array of domain hostnames to fetch robots.txt for. Each domain must end with the zone name. Maximum 25 domains per request.`})}const c={command:`bulk-get`,describe:`Fetches and parses robots.txt files for multiple domains within a zone in a single request. Each domain must belong to the specified zone. Results are keyed by hostname.`,builder:s,handler:async s=>{if(s.dryRun){i({command:`cf ai-audit robots bulk-get`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${s.zone??s.zoneId??`<zone>`}/ai-audit/robots/bulk`,pathParams:{"zone-id":String(s.zone??s[`zone-id`]??``)},bodyKind:`json`,body:s.body===void 0?void 0:o(s.body)});return}let c=await n(s);if(s.zoneId=await e({zone:s.zone},c,{quiet:s.quiet}),s.body){let e=o(s.body);if(Array.isArray(e)&&e.length>25){let n=Math.ceil(e.length/25),i=null;for(let r=0;r<e.length;r+=25){let o=e.slice(r,r+25);i=await a(`Loading: batch ${Math.floor(r/25)+1}/${n}`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:o}))}r(i,{successLabel:`Loaded`});return}r(await a(`Loading`,async()=>t(c,`POST`,`/zones/${s.zoneId}/ai-audit/robots/bulk`,{body:e})),{successLabel:`Loaded`});return}if(s.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function l(e){return e.option(`subdomain`,{type:`string`,description:`Optional subdomain to fetch robots.txt for. If omitted, fetches robots.txt for the zone apex domain.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const u={command:`get`,describe:`Fetches and parses the robots.txt file for a zone or a specific subdomain within the zone. Returns parsed user-agent rules, content signals, and sitemaps.`,builder:l,handler:async t=>{let o={subdomain:t.subdomain};if(t.dryRun){i({command:`cf ai-audit robots get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${t.zone??t.zoneId??`<zone>`}/ai-audit/robots`,pathParams:{"zone-id":String(t.zone??t[`zone-id`]??``)},query:o,bodyKind:`none`});return}let s=await n(t),c=await e({zone:t.zone},s,{quiet:t.quiet});t.zoneId=c,r(await a(`Loading`,async()=>s.aiAudit.robots.get({zone_id:c,...o})),{successLabel:`Loaded`})}},d={command:`robots`,describe:`Operations for robots`,builder:e=>e.command(c).command(u).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},f={command:`ai-audit`,describe:`ai-audit`,builder:e=>e.command(d).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{f as default};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-DTyuGwTw.mjs";import{f as t,g as n}from"./oauth-BPizUUqP.mjs";import{a as r,r as i}from"./auth-DuLchM18.mjs";import{t as a}from"./output-DgW1hQGX.mjs";import{n as o,t as s}from"./progress-B84wYh91.mjs";import{n as c,t as l}from"./body-parser-CYD7PKFC.mjs";import{n as u}from"./input-validation-BBKJRoRB.mjs";import{a as d,i as f,n as p}from"./prompt-CDtLWxNv.mjs";import{t as m}from"./cli-types-BWdZbsFE.mjs";function ee(e){return e.option(`account-provider-id`,{type:`string`,description:`The account_provider_id field`}).option(`cost-in`,{type:`number`,description:`The cost_in field`}).option(`cost-out`,{type:`number`,description:`The cost_out field`}).option(`cost-type`,{type:`string`,description:`The cost_type field`,default:`tokens`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`model`,{type:`string`,description:`The model field`}).option(`model-rule`,{type:`string`,description:`The model_rule field`,choices:[`equals`,`starts-with`,`contains`],default:`equals`}).option(`token-pricing-input-audio-tokens`,{type:`number`,description:`The token_pricing.input_audio_tokens field`}).option(`token-pricing-input-cache-creation-tokens`,{type:`number`,description:`The token_pricing.input_cache_creation_tokens field`}).option(`token-pricing-input-cached-tokens`,{type:`number`,description:`The token_pricing.input_cached_tokens field`}).option(`token-pricing-input-image-count`,{type:`number`,description:`The token_pricing.input_image_count field`}).option(`token-pricing-input-image-tokens`,{type:`number`,description:`The token_pricing.input_image_tokens field`}).option(`token-pricing-input-text-tokens`,{type:`number`,description:`The token_pricing.input_text_tokens field`}).option(`token-pricing-input-tokens`,{type:`number`,description:`The token_pricing.input_tokens field`}).option(`token-pricing-input-video-tokens`,{type:`number`,description:`The token_pricing.input_video_tokens field`}).option(`token-pricing-output-image-count`,{type:`number`,description:`The token_pricing.output_image_count field`}).option(`token-pricing-output-reasoning-tokens`,{type:`number`,description:`The token_pricing.output_reasoning_tokens field`}).option(`token-pricing-output-tokens`,{type:`number`,description:`The token_pricing.output_tokens field`}).option(`token-pricing-total-tokens`,{type:`number`,description:`The token_pricing.total_tokens field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const te={command:`create`,describe:`Creates a new AI Gateway.`,builder:ee,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...e,account_id:p})),{successLabel:`Created`});return}r[`account-provider-id`]===void 0&&(r[`account-provider-id`]=await d(`account-provider-id`,`The account_provider_id field`)),r.model===void 0&&(r.model=await d(`model`,`The model field`));let m=l({account_provider_id:u(r[`account-provider-id`],`account-provider-id`,`text`),cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}});a(await s(`Creating`,async()=>f.aiGateway.accountProviders.costs.create({...m,account_id:p})),{successLabel:`Created`})}};function h(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
3
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.accountProviders.costs.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function _(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:_,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.accountProviders.costs.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function y(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`account-provider-id`,{type:`string`,description:`Account provider ID`}).option(`model-rule`,{type:`string`,description:`Model rule`,choices:[`equals`,`starts-with`,`contains`]}).option(`cost-type`,{type:`string`,description:`Cost type`}).option(`search`,{type:`string`,description:`Search by model, changed_by`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:m(y),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],enable:r.enable,account_provider_id:r[`account-provider-id`],model_rule:r[`model-rule`],cost_type:r[`cost-type`],search:r.search};if(r.dryRun){o({command:`cf ai-gateway account-providers costs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.accountProviders.costs.list({account_id:u,...c})),{successLabel:`Loaded`})}};function x(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`cost-in`,{type:`number`,description:`The cost_in field`}).option(`cost-out`,{type:`number`,description:`The cost_out field`}).option(`cost-type`,{type:`string`,description:`The cost_type field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`model`,{type:`string`,description:`The model field`}).option(`model-rule`,{type:`string`,description:`The model_rule field`,choices:[`equals`,`starts-with`,`contains`]}).option(`token-pricing-input-audio-tokens`,{type:`number`,description:`The token_pricing.input_audio_tokens field`}).option(`token-pricing-input-cache-creation-tokens`,{type:`number`,description:`The token_pricing.input_cache_creation_tokens field`}).option(`token-pricing-input-cached-tokens`,{type:`number`,description:`The token_pricing.input_cached_tokens field`}).option(`token-pricing-input-image-count`,{type:`number`,description:`The token_pricing.input_image_count field`}).option(`token-pricing-input-image-tokens`,{type:`number`,description:`The token_pricing.input_image_tokens field`}).option(`token-pricing-input-text-tokens`,{type:`number`,description:`The token_pricing.input_text_tokens field`}).option(`token-pricing-input-tokens`,{type:`number`,description:`The token_pricing.input_tokens field`}).option(`token-pricing-input-video-tokens`,{type:`number`,description:`The token_pricing.input_video_tokens field`}).option(`token-pricing-output-image-count`,{type:`number`,description:`The token_pricing.output_image_count field`}).option(`token-pricing-output-reasoning-tokens`,{type:`number`,description:`The token_pricing.output_reasoning_tokens field`}).option(`token-pricing-output-tokens`,{type:`number`,description:`The token_pricing.output_tokens field`}).option(`token-pricing-total-tokens`,{type:`number`,description:`The token_pricing.total_tokens field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:x,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers costs update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/costs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiGateway.accountProviders.costs.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=l({cost_in:r[`cost-in`],cost_out:r[`cost-out`],cost_type:u(r[`cost-type`],`cost-type`,`text`),enable:r.enable,model:u(r.model,`model`,`text`),model_rule:u(r[`model-rule`],`model-rule`,`text`),token_pricing:{input_audio_tokens:r[`token-pricing-input-audio-tokens`],input_cache_creation_tokens:r[`token-pricing-input-cache-creation-tokens`],input_cached_tokens:r[`token-pricing-input-cached-tokens`],input_image_count:r[`token-pricing-input-image-count`],input_image_tokens:r[`token-pricing-input-image-tokens`],input_text_tokens:r[`token-pricing-input-text-tokens`],input_tokens:r[`token-pricing-input-tokens`],input_video_tokens:r[`token-pricing-input-video-tokens`],output_image_count:r[`token-pricing-output-image-count`],output_reasoning_tokens:r[`token-pricing-output-reasoning-tokens`],output_tokens:r[`token-pricing-output-tokens`],total_tokens:r[`token-pricing-total-tokens`]}});a(await s(`Updating`,async()=>d.aiGateway.accountProviders.costs.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}},C={command:`costs`,describe:`Operations for account-providers.costs`,builder:e=>e.command(te).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`base-url`,{type:`string`,description:`The base_url field`}).option(`beta`,{type:`boolean`,description:`The beta field`}).option(`curl-example`,{type:`string`,description:`The curl_example field`}).option(`description`,{type:`string`,description:`The description field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`headers`,{type:`string`,description:`The headers field`}).option(`js-example`,{type:`string`,description:`The js_example field`}).option(`link`,{type:`string`,description:`The link field`}).option(`name`,{type:`string`,description:`The name field`}).option(`position`,{type:`number`,description:`The position field`}).option(`slug`,{type:`string`,description:`The slug field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Creates a new AI Gateway.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.accountProviders.create({...e,account_id:p})),{successLabel:`Created`});return}r[`base-url`]===void 0&&(r[`base-url`]=await d(`base-url`,`The base_url field`)),r.name===void 0&&(r.name=await d(`name`,`The name field`)),r.slug===void 0&&(r.slug=await d(`slug`,`The slug field`));let m=l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.accountProviders.create({...m,account_id:p})),{successLabel:`Created`})}};function E(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:E,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.accountProviders.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function O(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const k={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:O,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.accountProviders.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function A(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`beta`,{type:`boolean`,description:`Beta`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`search`,{type:`string`,description:`Search by id, name, slug`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:A,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],beta:r.beta,enable:r.enable,search:r.search};if(r.dryRun){o({command:`cf ai-gateway account-providers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.accountProviders.list({account_id:u,...c})),{successLabel:`Loaded`})}};function M(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`base-url`,{type:`string`,description:`The base_url field`}).option(`beta`,{type:`boolean`,description:`The beta field`}).option(`curl-example`,{type:`string`,description:`The curl_example field`}).option(`description`,{type:`string`,description:`The description field`}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`headers`,{type:`string`,description:`The headers field`}).option(`js-example`,{type:`string`,description:`The js_example field`}).option(`link`,{type:`string`,description:`The link field`}).option(`logo`,{type:`string`,description:`The logo field`}).option(`name`,{type:`string`,description:`The name field`}).option(`position`,{type:`number`,description:`The position field`}).option(`slug`,{type:`string`,description:`The slug field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:M,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway account-providers update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/custom-providers/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),logo:u(r.logo,`logo`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiGateway.accountProviders.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}let p=l({base_url:u(r[`base-url`],`base-url`,`text`),beta:r.beta,curl_example:u(r[`curl-example`],`curl-example`,`text`),description:u(r.description,`description`,`text`),enable:r.enable,headers:u(r.headers,`headers`,`text`),js_example:u(r[`js-example`],`js-example`,`text`),link:u(r.link,`link`,`text`),logo:u(r.logo,`logo`,`text`),name:u(r.name,`name`,`text`),position:r.position,slug:u(r.slug,`slug`,`text`)});a(await s(`Updating`,async()=>d.aiGateway.accountProviders.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}},P={command:`account-providers`,describe:`Operations for account-providers`,builder:e=>e.command(T).command(D).command(k).command(j).command(N).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function F(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const I={command:`credit-balance`,describe:`Retrieve the current credit balance, payment method info, and top-up configuration.`,builder:F,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing credit-balance`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/credit-balance`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.creditBalance({account_id:l})),{successLabel:`Loaded`})}};function L(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`get-topup-limits`,describe:`Retrieve the minimum and maximum allowed top-up amounts (in cents) for this account.`,builder:L,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing get-topup-limits`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/limits`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.getTopupLimits({account_id:l})),{successLabel:`Loaded`})}};function z(e){return e.option(`type`,{type:`string`,description:`Filter invoice type: auto, manual, or all.`,choices:[`auto`,`all`,`manual`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`invoice-history`,describe:`Retrieve a list of past invoices with pagination, optionally filtered by type.`,builder:m(z),handler:async r=>{let c={type:r.type};if(r.dryRun){o({command:`cf ai-gateway billing invoice-history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/invoice-history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.billing.invoiceHistory({account_id:u,...c})),{successLabel:`Loaded`})}};function V(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`invoice-preview`,describe:`Retrieve a preview of the upcoming invoice including line items and tax.`,builder:V,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing invoice-preview`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/invoice-preview`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.invoicePreview({account_id:l})),{successLabel:`Loaded`})}};function U(e){return e.option(`amount`,{type:`number`,description:`Spending limit amount in cents (min 100).`}).option(`duration`,{type:`string`,description:`Spending limit duration.`,choices:[`daily`,`weekly`,`monthly`]}).option(`strategy`,{type:`string`,description:`Spending limit strategy.`,choices:[`fixed`,`sliding`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`create`,describe:`Deprecated: spending limits can no longer be created, enabled, or modified and this endpoint always responds 403. Use the new AI Gateway spend limits instead: https://developers.cloudflare.com/ai-gateway/features/spend-limits/. Existing limits can be removed via DELETE /spending-limit.`,builder:U,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({amount:r.amount,duration:u(r.duration,`duration`,`text`),strategy:u(r.strategy,`strategy`,`text`)}):c(r.body)});return}let d=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.aiGateway.billing.spendingLimit.create({...e,account_id:p})),{successLabel:`Created`});return}if(r.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);r.duration===void 0&&(r.duration=await f(`duration`,`Spending limit duration.`,[`daily`,`weekly`,`monthly`])),r.strategy===void 0&&(r.strategy=await f(`strategy`,`Spending limit strategy.`,[`fixed`,`sliding`]));let m=l({amount:r.amount,duration:u(r.duration,`duration`,`text`),strategy:u(r.strategy,`strategy`,`text`)});a(await s(`Creating`,async()=>d.aiGateway.billing.spendingLimit.create({...m,account_id:p})),{successLabel:`Created`})}};function G(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete`,describe:`Remove the spending limit for the account.`,builder:G,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
5
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.billing.spendingLimit.delete({account_id:l})),{successLabel:`Deleted`})}};function q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get`,describe:`Retrieve the current spending limit configuration for the account.`,builder:q,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing spending-limit get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/spending-limit`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.spendingLimit.get({account_id:l})),{successLabel:`Loaded`})}},Y={command:`spending-limit`,describe:`Operations for billing.spending-limit`,builder:e=>e.command(W).command(K).command(J).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function X(e){return e.option(`amount`,{type:`number`,description:`Auto top-up amount in cents (min 1000).`}).option(`threshold`,{type:`number`,description:`Balance threshold in cents that triggers auto top-up (min 500).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Z={command:`create`,describe:`Configure auto top-up with a balance threshold and top-up amount.`,builder:X,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup config create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({amount:r.amount,threshold:r.threshold}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...e,account_id:d})),{successLabel:`Created`});return}if(r.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);if(r.threshold===void 0)throw Error(`--threshold is required (or pass --body with this field set).`);let f=l({amount:r.amount,threshold:r.threshold});a(await s(`Creating`,async()=>u.aiGateway.billing.topup.config.create({...f,account_id:d})),{successLabel:`Created`})}};function Q(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ne={command:`delete`,describe:`Remove the auto top-up configuration for the account.`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup config delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
6
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.billing.topup.config.delete({account_id:l})),{successLabel:`Deleted`})}};function re(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get`,describe:`Retrieve the current auto top-up threshold, amount, and any error state.`,builder:re,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup config get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/config`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.billing.topup.config.get({account_id:l})),{successLabel:`Loaded`})}},ae={command:`config`,describe:`Operations for billing.topup.config`,builder:e=>e.command(Z).command(ne).command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function oe(e){return e.option(`amount`,{type:`number`,description:`Top-up amount in cents (min 1000).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const se={command:`create`,describe:`Create a credit top-up for the given account, charged to the account's default payment method.`,builder:oe,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({amount:r.amount}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Creating`,async()=>u.aiGateway.billing.topup.create({...e,account_id:d})),{successLabel:`Created`});return}if(r.amount===void 0)throw Error(`--amount is required (or pass --body with this field set).`);let f=l({amount:r.amount});a(await s(`Creating`,async()=>u.aiGateway.billing.topup.create({...f,account_id:d})),{successLabel:`Created`})}};function ce(e){return e.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 le={command:`eligibility`,describe:`Determine whether an account can self-serve a credit top-up, and if not, why. The dashboard forwards the account's payment-method list in the body; the reason logic is owned here.`,builder:ce,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup eligibility`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/eligibility`,pathParams:{},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.aiGateway.billing.topup.eligibility({...e,account_id:u})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>l.aiGateway.billing.topup.eligibility({account_id:u})),{successLabel:`Created`})}};function ue(e){return e.option(`payment-intent-id`,{type:`string`,description:`Stripe invoice ID to check status for.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={command:`status`,describe:`Get the payment processing status of a top-up by its invoice ID.`,builder:ue,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway billing topup status`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/topup/status`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({payment_intent_id:u(r[`payment-intent-id`],`payment-intent-id`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.billing.topup.status({...e,account_id:p})),{successLabel:`Created`});return}r[`payment-intent-id`]===void 0&&(r[`payment-intent-id`]=await d(`payment-intent-id`,`Stripe invoice ID to check status for.`));let m=l({payment_intent_id:u(r[`payment-intent-id`],`payment-intent-id`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.billing.topup.status({...m,account_id:p})),{successLabel:`Created`})}},fe={command:`topup`,describe:`Operations for billing.topup`,builder:e=>e.command(se).command(le).command(de).command(ae).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function pe(e){return e.option(`value-grouping-window`,{type:`string`,description:`Grouping window for usage data.`,choices:[`day`,`hour`],demandOption:!0}).option(`start-time`,{type:`number`,description:`Start time as Unix timestamp in milliseconds.`}).option(`end-time`,{type:`number`,description:`End time as Unix timestamp in milliseconds.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`usage-history`,describe:`Retrieve aggregated usage meter event summaries for the given time range.`,builder:m(pe),handler:async r=>{let c={value_grouping_window:r[`value-grouping-window`],start_time:r[`start-time`],end_time:r[`end-time`]};if(r.dryRun){o({command:`cf ai-gateway billing usage-history`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/billing/usage-history`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.billing.usageHistory({account_id:u,...c})),{successLabel:`Loaded`})}},he={command:`billing`,describe:`Operations for billing`,builder:e=>e.command(I).command(R).command(B).command(H).command(me).command(Y).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ge(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`domain`,{type:`string`,description:`the customer-owned custom hostname`}).option(`min-tls`,{type:`string`,description:`The minTLS field`,choices:[`1.0`,`1.1`,`1.2`,`1.3`]}).option(`zone-id`,{type:`string`,description:`Cloudflare Zone ID owning the custom hostname`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const _e={command:`create <gateway-id>`,describe:`Provisions a Cloudflare-for-SaaS custom hostname and returns the CNAME target to point DNS at.`,builder:ge,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway custom-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/custom-domains`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({domain:u(r.domain,`domain`,`text`),minTLS:u(r[`min-tls`],`min-tls`,`text`),zone_id:u(r[`zone-id`],`zone-id`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.customDomains.create({...e,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`});return}r.domain===void 0&&(r.domain=await d(`domain`,`the customer-owned custom hostname`)),r[`zone-id`]===void 0&&(r[`zone-id`]=await d(`zone-id`,`Cloudflare Zone ID owning the custom hostname`));let m=l({domain:u(r.domain,`domain`,`text`),minTLS:u(r[`min-tls`],`min-tls`,`text`),zone_id:u(r[`zone-id`],`zone-id`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.customDomains.create({...m,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`})}};function ve(e){return e.positional(`hostname`,{type:`string`,description:`the customer-owned custom hostname`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway 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 ye={command:`delete <hostname>`,describe:`Deletes an AI Gateway dataset.`,builder:ve,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway custom-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/custom-domains/${r.hostname==null?`<hostname>`:encodeURIComponent(String(r.hostname))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),hostname:String(r.hostname??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
7
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.customDomains.delete({account_id:l,gateway_id:r[`gateway-id`],hostname:r.hostname})),{successLabel:`Deleted`})}};function be(e){return e.positional(`hostname`,{type:`string`,description:`the customer-owned custom hostname`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get <hostname>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:be,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway custom-domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/custom-domains/${r.hostname==null?`<hostname>`:encodeURIComponent(String(r.hostname))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),hostname:String(r.hostname??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.customDomains.get({account_id:l,gateway_id:r[`gateway-id`],hostname:r.hostname})),{successLabel:`Loaded`})}};function Se(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`status`,{type:`string`,description:`Status`,choices:[`initializing`,`pending_dcv`,`active`,`blocked`,`error`]}).option(`search`,{type:`string`,description:`Search by hostname`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:m(Se),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],status:r.status,search:r.search};if(r.dryRun){o({command:`cf ai-gateway custom-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/custom-domains`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.customDomains.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}},we={command:`custom-domains`,describe:`Operations for custom-domains`,builder:e=>e.command(_e).command(ye).command(xe).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Te(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ee={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:Te,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway datasets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({enable:r.enable,name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.datasets.create({...e,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`});return}if(r.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await d(`name`,`The name field`));let m=l({enable:r.enable,name:u(r.name,`name`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.datasets.create({...m,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`})}};function De(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway 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 Oe={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:De,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway datasets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/datasets/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
8
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.datasets.delete({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Deleted`})}};function ke(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:ke,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway datasets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/datasets/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.datasets.get({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function je(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`enable`,{type:`boolean`,description:`Enable`}).option(`search`,{type:`string`,description:`Search by id, name, filters`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:je,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],name:r.name,enable:r.enable,search:r.search};if(r.dryRun){o({command:`cf ai-gateway datasets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/datasets`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.datasets.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}};function Ne(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`enable`,{type:`boolean`,description:`The enable field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Pe={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:Ne,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway datasets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/datasets/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({enable:r.enable,name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>f.aiGateway.datasets.update({...e,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`});return}if(r.enable===void 0)throw Error(`--enable is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await d(`name`,`The name field`));let m=l({enable:r.enable,name:u(r.name,`name`,`text`)});a(await s(`Updating`,async()=>f.aiGateway.datasets.update({...m,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`})}},Fe={command:`datasets`,describe:`Curated collections of gateway logs used as inputs for evaluations and fine-tuning`,builder:e=>e.command(Ee).command(Oe).command(Ae).command(Me).command(Pe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ie(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`version-id`,{type:`string`,description:`The version_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)`})}const Le={command:`create-deployment <id>`,describe:`Create a new AI Gateway Dynamic Route Deployment.`,builder:Ie,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing create-deployment`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/deployments`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({version_id:u(r[`version-id`],`version-id`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.dynamicRouting.createDeployment({...e,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Created`});return}r[`version-id`]===void 0&&(r[`version-id`]=await d(`version-id`,`The version_id field`));let m=l({version_id:u(r[`version-id`],`version-id`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.dynamicRouting.createDeployment({...m,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Created`})}};function Re(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,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)`})}const ze={command:`create-version <id>`,describe:`Create a new AI Gateway Dynamic Route Version.`,builder:Re,handler:async l=>{if(l.dryRun){o({command:`cf ai-gateway dynamic-routing create-version`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${l[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(l[`gateway-id`]))}/routes/${l.id==null?`<id>`:encodeURIComponent(String(l.id))}/versions`,pathParams:{"gateway-id":String(l[`gateway-id`]??``),id:String(l.id??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),d=l.local?e:await t();if(l.accountId=d,l.body){let e=c(l.body);a(await s(`Creating`,async()=>u.aiGateway.dynamicRouting.createVersion({...e,account_id:d,gateway_id:l[`gateway-id`],id:l.id})),{successLabel:`Created`});return}a(await s(`Creating`,async()=>r(u,`POST`,`/accounts/${d}/ai-gateway/gateways/${encodeURIComponent(String(l[`gateway-id`]))}/routes/${encodeURIComponent(String(l.id))}/versions`)),{successLabel:`Created`})}};function Be(e){return e.positional(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ve={command:`create <gateway-id>`,describe:`Create a new AI Gateway Dynamic Route.`,builder:Be,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.dynamicRouting.create({...e,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`});return}r.name===void 0&&(r.name=await d(`name`,`The name field`));let m=l({name:u(r.name,`name`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.dynamicRouting.create({...m,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`})}};function He(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway 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 Ue={command:`delete <id>`,describe:`Delete an AI Gateway Dynamic Route.`,builder:He,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
9
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.dynamicRouting.delete({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Deleted`})}};function We(e){return e.positional(`version-id`,{type:`string`,description:`Version ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`get-version <version-id>`,describe:`Get an AI Gateway Dynamic Route Version.`,builder:We,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing get-version`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/versions/${r[`version-id`]==null?`<version-id>`:encodeURIComponent(String(r[`version-id`]))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``),"version-id":String(r[`version-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.dynamicRouting.getVersion({account_id:l,gateway_id:r[`gateway-id`],id:r.id,version_id:r[`version-id`]})),{successLabel:`Loaded`})}};function Ke(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qe={command:`get <id>`,describe:`Get an AI Gateway Dynamic Route.`,builder:Ke,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.dynamicRouting.get({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function Je(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`list-deployments <id>`,describe:`List all AI Gateway Dynamic Route Deployments.`,builder:Je,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing list-deployments`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/deployments`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.dynamicRouting.listDeployments({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function Xe(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ze={command:`list-versions <id>`,describe:`List all AI Gateway Dynamic Route Versions.`,builder:Xe,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing list-versions`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/versions`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.dynamicRouting.listVersions({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function Qe(e){return e.option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number`}).option(`per-page`,{type:`number`,description:`Number of routes per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $e={command:`list`,describe:`List all AI Gateway Dynamic Routes.`,builder:Qe,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-gateway dynamic-routing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.dynamicRouting.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}};function et(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`Gateway ID`,demandOption:!0}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const tt={command:`update <id>`,describe:`Update an AI Gateway Dynamic Route.`,builder:et,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway dynamic-routing update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/routes/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>f.aiGateway.dynamicRouting.update({...e,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`});return}r.name===void 0&&(r.name=await d(`name`,`The name field`));let m=l({name:u(r.name,`name`,`text`)});a(await s(`Updating`,async()=>f.aiGateway.dynamicRouting.update({...m,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`})}},nt={command:`dynamic-routing`,describe:`Route requests across multiple AI providers with fallback, load-balancing, and versioned deployments`,builder:e=>e.command(Ve).command(Le).command(ze).command(Ue).command(qe).command(Ge).command($e).command(Ye).command(Ze).command(tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function rt(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`list`,describe:`Lists all available evaluator types for scoring AI gateway responses.`,builder:m(rt),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],order_by:r[`order-by`],order_by_direction:r[`order-by-direction`]};if(r.dryRun){o({command:`cf ai-gateway evaluation-types list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/evaluation-types`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.evaluationTypes.list({account_id:u,...c})),{successLabel:`Loaded`})}},at={command:`evaluation-types`,describe:`Available evaluator types for scoring AI gateway responses (accuracy, toxicity, etc.)`,builder:e=>e.command(it).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ot(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dataset-ids`,{type:`string`,array:!0,description:`The dataset_ids field`}).option(`evaluation-type-ids`,{type:`string`,array:!0,description:`The evaluation_type_ids field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const st={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:ot,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway evaluations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({dataset_ids:r[`dataset-ids`],evaluation_type_ids:r[`evaluation-type-ids`],name:u(r.name,`name`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.evaluations.create({...e,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`});return}if(r[`dataset-ids`]===void 0)throw Error(`--dataset-ids is required (or pass --body with this field set).`);if(r[`evaluation-type-ids`]===void 0)throw Error(`--evaluation-type-ids is required (or pass --body with this field set).`);r.name===void 0&&(r.name=await d(`name`,`The name field`));let m=l({dataset_ids:r[`dataset-ids`],evaluation_type_ids:r[`evaluation-type-ids`],name:u(r.name,`name`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.evaluations.create({...m,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`})}};function ct(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway 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 lt={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:ct,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway evaluations delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/evaluations/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
10
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.evaluations.delete({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Deleted`})}};function ut(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const dt={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:ut,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway evaluations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/evaluations/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.evaluations.get({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function ft(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`name`,{type:`string`,description:`Name`}).option(`processed`,{type:`boolean`,description:`Processed`}).option(`search`,{type:`string`,description:`Search by id, name`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pt={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:ft,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],name:r.name,processed:r.processed,search:r.search};if(r.dryRun){o({command:`cf ai-gateway evaluations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/evaluations`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.evaluations.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}},mt={command:`evaluations`,describe:`Run quality evaluations against gateway logs or datasets to score model outputs`,builder:e=>e.command(st).command(lt).command(dt).command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(e){return e.option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`id`,{type:`string`,description:`gateway id`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`],default:`postpaid`}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const gt={command:`create`,describe:`Creates a new AI Gateway.`,builder:ht,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({authentication:r.authentication,cache_invalidate_on_update:r[`cache-invalidate-on-update`],cache_ttl:r[`cache-ttl`],collect_logs:r[`collect-logs`],id:u(r.id,`id`,`text`),log_management:r[`log-management`],log_management_strategy:u(r[`log-management-strategy`],`log-management-strategy`,`text`),logpush:r.logpush,logpush_public_key:u(r[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:r[`rate-limiting-interval`],rate_limiting_limit:r[`rate-limiting-limit`],rate_limiting_technique:u(r[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(r[`retry-backoff`],`retry-backoff`,`text`),retry_delay:r[`retry-delay`],retry_max_attempts:r[`retry-max-attempts`],store_id:u(r[`store-id`],`store-id`,`text`),workers_ai_billing_mode:u(r[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:r.zdr}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.gateways.create({...e,account_id:p})),{successLabel:`Created`});return}if(r[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(r[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(r[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(r.id===void 0&&(r.id=await d(`id`,`gateway id`)),r[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(r[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let m=l({authentication:r.authentication,cache_invalidate_on_update:r[`cache-invalidate-on-update`],cache_ttl:r[`cache-ttl`],collect_logs:r[`collect-logs`],id:u(r.id,`id`,`text`),log_management:r[`log-management`],log_management_strategy:u(r[`log-management-strategy`],`log-management-strategy`,`text`),logpush:r.logpush,logpush_public_key:u(r[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:r[`rate-limiting-interval`],rate_limiting_limit:r[`rate-limiting-limit`],rate_limiting_technique:u(r[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(r[`retry-backoff`],`retry-backoff`,`text`),retry_delay:r[`retry-delay`],retry_max_attempts:r[`retry-max-attempts`],store_id:u(r[`store-id`],`store-id`,`text`),workers_ai_billing_mode:u(r[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:r.zdr});a(await s(`Creating`,async()=>f.aiGateway.gateways.create({...m,account_id:p})),{successLabel:`Created`})}};function _t(e){return e.positional(`id`,{type:`string`,description:`gateway 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 vt={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:_t,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
11
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.gateways.delete({account_id:l,id:r.id})),{successLabel:`Deleted`})}};function yt(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const bt={command:`get <id>`,describe:`Retrieves details for a specific AI Gateway dataset.`,builder:yt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.gateways.get({account_id:l,id:r.id})),{successLabel:`Loaded`})}};function xt(e){return e.option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`search`,{type:`string`,description:`Search by id`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const St={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:xt,handler:async r=>{let c={page:r.page,per_page:r[`per-page`],search:r.search};if(r.dryRun){o({command:`cf ai-gateway gateways list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.gateways.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Ct(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`alias`,{type:`string`,description:`The alias field`}).option(`default-config`,{type:`boolean`,description:`The default_config field`}).option(`provider-slug`,{type:`string`,description:`The provider_slug field`}).option(`rate-limit`,{type:`number`,description:`The rate_limit field`}).option(`rate-limit-period`,{type:`number`,description:`The rate_limit_period field`,default:60}).option(`secret`,{type:`string`,description:`The secret field`}).option(`secret-id`,{type:`string`,description:`The secret_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)`})}const wt={command:`create <gateway-id>`,describe:`Creates a new AI Gateway.`,builder:Ct,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways providers create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({alias:u(r.alias,`alias`,`text`),default_config:r[`default-config`],provider_slug:u(r[`provider-slug`],`provider-slug`,`text`),rate_limit:r[`rate-limit`],rate_limit_period:r[`rate-limit-period`],secret:u(r.secret,`secret`,`text`),secret_id:u(r[`secret-id`],`secret-id`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>f.aiGateway.gateways.providers.create({...e,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`});return}if(r.alias===void 0&&(r.alias=await d(`alias`,`The alias field`)),r[`default-config`]===void 0)throw Error(`--default-config is required (or pass --body with this field set).`);r[`provider-slug`]===void 0&&(r[`provider-slug`]=await d(`provider-slug`,`The provider_slug field`));let m=l({alias:u(r.alias,`alias`,`text`),default_config:r[`default-config`],provider_slug:u(r[`provider-slug`],`provider-slug`,`text`),rate_limit:r[`rate-limit`],rate_limit_period:r[`rate-limit-period`],secret:u(r.secret,`secret`,`text`),secret_id:u(r[`secret-id`],`secret-id`,`text`)});a(await s(`Creating`,async()=>f.aiGateway.gateways.providers.create({...m,account_id:p,gateway_id:r[`gateway-id`]})),{successLabel:`Created`})}};function Tt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway 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 Et={command:`delete <id>`,describe:`Deletes an AI Gateway dataset.`,builder:Tt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways providers delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/provider_configs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
12
|
-
`);return}a(await s(`Deleting`,async()=>c.aiGateway.gateways.providers.delete({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Deleted`})}};function Dt(e){return e.option(`gateway-id`,{type:`string`,description:`gateway 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 Ot={command:`list`,describe:`Lists all AI Gateway evaluator types configured for the account.`,builder:Dt,handler:async r=>{let c={page:r.page,per_page:r[`per-page`]};if(r.dryRun){o({command:`cf ai-gateway gateways providers list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/provider_configs`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.gateways.providers.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}};function kt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`secret`,{type:`string`,description:`The secret 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 At={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:kt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways providers update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/provider_configs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({secret:u(r.secret,`secret`,`text`)}):c(r.body)});return}let f=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Updating`,async()=>f.aiGateway.gateways.providers.update({...e,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`});return}r.secret===void 0&&(r.secret=await d(`secret`,`The secret field`));let m=l({secret:u(r.secret,`secret`,`text`)});a(await s(`Updating`,async()=>f.aiGateway.gateways.providers.update({...m,account_id:p,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`})}},jt={command:`providers`,describe:`Operations for gateways.providers`,builder:e=>e.command(wt).command(Et).command(Ot).command(At).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mt(e){return e.positional(`id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`authentication`,{type:`boolean`,description:`The authentication field`}).option(`cache-invalidate-on-update`,{type:`boolean`,description:`The cache_invalidate_on_update field`}).option(`cache-ttl`,{type:`number`,description:`The cache_ttl field`}).option(`collect-logs`,{type:`boolean`,description:`The collect_logs field`}).option(`guardrails-prompt-p1`,{type:`string`,description:`The guardrails.prompt.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s1`,{type:`string`,description:`The guardrails.prompt.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s10`,{type:`string`,description:`The guardrails.prompt.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s11`,{type:`string`,description:`The guardrails.prompt.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s12`,{type:`string`,description:`The guardrails.prompt.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s13`,{type:`string`,description:`The guardrails.prompt.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s2`,{type:`string`,description:`The guardrails.prompt.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s3`,{type:`string`,description:`The guardrails.prompt.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s4`,{type:`string`,description:`The guardrails.prompt.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s5`,{type:`string`,description:`The guardrails.prompt.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s6`,{type:`string`,description:`The guardrails.prompt.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s7`,{type:`string`,description:`The guardrails.prompt.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s8`,{type:`string`,description:`The guardrails.prompt.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-prompt-s9`,{type:`string`,description:`The guardrails.prompt.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-p1`,{type:`string`,description:`The guardrails.response.P1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s1`,{type:`string`,description:`The guardrails.response.S1 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s10`,{type:`string`,description:`The guardrails.response.S10 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s11`,{type:`string`,description:`The guardrails.response.S11 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s12`,{type:`string`,description:`The guardrails.response.S12 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s13`,{type:`string`,description:`The guardrails.response.S13 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s2`,{type:`string`,description:`The guardrails.response.S2 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s3`,{type:`string`,description:`The guardrails.response.S3 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s4`,{type:`string`,description:`The guardrails.response.S4 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s5`,{type:`string`,description:`The guardrails.response.S5 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s6`,{type:`string`,description:`The guardrails.response.S6 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s7`,{type:`string`,description:`The guardrails.response.S7 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s8`,{type:`string`,description:`The guardrails.response.S8 field`,choices:[`FLAG`,`BLOCK`]}).option(`guardrails-response-s9`,{type:`string`,description:`The guardrails.response.S9 field`,choices:[`FLAG`,`BLOCK`]}).option(`log-classification`,{type:`boolean`,description:`The log_classification field`}).option(`log-management`,{type:`number`,description:`The log_management field`}).option(`log-management-strategy`,{type:`string`,description:`The log_management_strategy field`,choices:[`STOP_INSERTING`,`DELETE_OLDEST`]}).option(`logpush`,{type:`boolean`,description:`The logpush field`}).option(`logpush-public-key`,{type:`string`,description:`The logpush_public_key field`}).option(`rate-limiting-interval`,{type:`number`,description:`The rate_limiting_interval field`}).option(`rate-limiting-limit`,{type:`number`,description:`The rate_limiting_limit field`}).option(`rate-limiting-technique`,{type:`string`,description:`The rate_limiting_technique field`,choices:[`fixed`,`sliding`]}).option(`retry-backoff`,{type:`string`,description:`Backoff strategy for retry delays`,choices:[`constant`,`linear`,`exponential`]}).option(`retry-delay`,{type:`number`,description:`Delay between retry attempts in milliseconds (0-5000)`}).option(`retry-max-attempts`,{type:`number`,description:`Maximum number of retry attempts for failed requests (1-5)`}).option(`spend-limits-enabled`,{type:`boolean`,description:`The spend_limits.enabled field`}).option(`store-id`,{type:`string`,description:`The store_id field`}).option(`stripe-authorization`,{type:`string`,description:`The stripe.authorization field`}).option(`workers-ai-billing-mode`,{type:`string`,description:`Controls how Workers AI inference calls routed through this gateway are billed. 'postpaid' bills the account directly through Workers AI; 'unified' deducts credits via AI Gateway using neuron-based pricing and delegates billing to AI Gateway.`,choices:[`postpaid`,`unified`]}).option(`zdr`,{type:`boolean`,description:`The zdr field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`stripe-authorization`].some(t=>e[t]!==void 0)){let t=[`stripe-authorization`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --stripe-* flag is set`)}return!0})}const Nt={command:`update <id>`,describe:`Updates an existing AI Gateway dataset.`,builder:Mt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway gateways update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``)},bodyKind:`json`,body:r.body===void 0?l({authentication:r.authentication,cache_invalidate_on_update:r[`cache-invalidate-on-update`],cache_ttl:r[`cache-ttl`],collect_logs:r[`collect-logs`],guardrails:{prompt:{P1:u(r[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:u(r[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:u(r[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:u(r[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:u(r[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:u(r[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:u(r[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:u(r[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:u(r[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:u(r[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:u(r[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:u(r[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:u(r[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:u(r[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:u(r[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:u(r[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:u(r[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:u(r[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:u(r[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:u(r[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:u(r[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:u(r[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:u(r[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:u(r[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:u(r[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:u(r[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:u(r[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:u(r[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:r[`log-classification`],log_management:r[`log-management`],log_management_strategy:u(r[`log-management-strategy`],`log-management-strategy`,`text`),logpush:r.logpush,logpush_public_key:u(r[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:r[`rate-limiting-interval`],rate_limiting_limit:r[`rate-limiting-limit`],rate_limiting_technique:u(r[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(r[`retry-backoff`],`retry-backoff`,`text`),retry_delay:r[`retry-delay`],retry_max_attempts:r[`retry-max-attempts`],spend_limits:{enabled:r[`spend-limits-enabled`]},store_id:u(r[`store-id`],`store-id`,`text`),stripe:{authorization:u(r[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:u(r[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:r.zdr}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>d.aiGateway.gateways.update({...e,account_id:f,id:r.id})),{successLabel:`Updated`});return}if(r[`cache-invalidate-on-update`]===void 0)throw Error(`--cache-invalidate-on-update is required (or pass --body with this field set).`);if(r[`cache-ttl`]===void 0)throw Error(`--cache-ttl is required (or pass --body with this field set).`);if(r[`collect-logs`]===void 0)throw Error(`--collect-logs is required (or pass --body with this field set).`);if(r[`rate-limiting-interval`]===void 0)throw Error(`--rate-limiting-interval is required (or pass --body with this field set).`);if(r[`rate-limiting-limit`]===void 0)throw Error(`--rate-limiting-limit is required (or pass --body with this field set).`);let p=l({authentication:r.authentication,cache_invalidate_on_update:r[`cache-invalidate-on-update`],cache_ttl:r[`cache-ttl`],collect_logs:r[`collect-logs`],guardrails:{prompt:{P1:u(r[`guardrails-prompt-p1`],`guardrails-prompt-p1`,`text`),S1:u(r[`guardrails-prompt-s1`],`guardrails-prompt-s1`,`text`),S10:u(r[`guardrails-prompt-s10`],`guardrails-prompt-s10`,`text`),S11:u(r[`guardrails-prompt-s11`],`guardrails-prompt-s11`,`text`),S12:u(r[`guardrails-prompt-s12`],`guardrails-prompt-s12`,`text`),S13:u(r[`guardrails-prompt-s13`],`guardrails-prompt-s13`,`text`),S2:u(r[`guardrails-prompt-s2`],`guardrails-prompt-s2`,`text`),S3:u(r[`guardrails-prompt-s3`],`guardrails-prompt-s3`,`text`),S4:u(r[`guardrails-prompt-s4`],`guardrails-prompt-s4`,`text`),S5:u(r[`guardrails-prompt-s5`],`guardrails-prompt-s5`,`text`),S6:u(r[`guardrails-prompt-s6`],`guardrails-prompt-s6`,`text`),S7:u(r[`guardrails-prompt-s7`],`guardrails-prompt-s7`,`text`),S8:u(r[`guardrails-prompt-s8`],`guardrails-prompt-s8`,`text`),S9:u(r[`guardrails-prompt-s9`],`guardrails-prompt-s9`,`text`)},response:{P1:u(r[`guardrails-response-p1`],`guardrails-response-p1`,`text`),S1:u(r[`guardrails-response-s1`],`guardrails-response-s1`,`text`),S10:u(r[`guardrails-response-s10`],`guardrails-response-s10`,`text`),S11:u(r[`guardrails-response-s11`],`guardrails-response-s11`,`text`),S12:u(r[`guardrails-response-s12`],`guardrails-response-s12`,`text`),S13:u(r[`guardrails-response-s13`],`guardrails-response-s13`,`text`),S2:u(r[`guardrails-response-s2`],`guardrails-response-s2`,`text`),S3:u(r[`guardrails-response-s3`],`guardrails-response-s3`,`text`),S4:u(r[`guardrails-response-s4`],`guardrails-response-s4`,`text`),S5:u(r[`guardrails-response-s5`],`guardrails-response-s5`,`text`),S6:u(r[`guardrails-response-s6`],`guardrails-response-s6`,`text`),S7:u(r[`guardrails-response-s7`],`guardrails-response-s7`,`text`),S8:u(r[`guardrails-response-s8`],`guardrails-response-s8`,`text`),S9:u(r[`guardrails-response-s9`],`guardrails-response-s9`,`text`)}},log_classification:r[`log-classification`],log_management:r[`log-management`],log_management_strategy:u(r[`log-management-strategy`],`log-management-strategy`,`text`),logpush:r.logpush,logpush_public_key:u(r[`logpush-public-key`],`logpush-public-key`,`text`),rate_limiting_interval:r[`rate-limiting-interval`],rate_limiting_limit:r[`rate-limiting-limit`],rate_limiting_technique:u(r[`rate-limiting-technique`],`rate-limiting-technique`,`text`),retry_backoff:u(r[`retry-backoff`],`retry-backoff`,`text`),retry_delay:r[`retry-delay`],retry_max_attempts:r[`retry-max-attempts`],spend_limits:{enabled:r[`spend-limits-enabled`]},store_id:u(r[`store-id`],`store-id`,`text`),stripe:{authorization:u(r[`stripe-authorization`],`stripe-authorization`,`text`)},workers_ai_billing_mode:u(r[`workers-ai-billing-mode`],`workers-ai-billing-mode`,`text`),zdr:r.zdr});a(await s(`Updating`,async()=>d.aiGateway.gateways.update({...p,account_id:f,id:r.id})),{successLabel:`Updated`})}},Pt={command:`gateways`,describe:`Operations for gateways`,builder:e=>e.command(gt).command(vt).command(bt).command(St).command(Nt).command(jt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ft(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const It={command:`get`,describe:`Returns the canonical logging platform and migration availability for an account.`,builder:Ft,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logging-state get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/logging-state`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.loggingState.get({account_id:l})),{successLabel:`Loaded`})}};function Lt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Rt={command:`update`,describe:`Irreversibly migrates an eligible account to Workers Observability logging.`,builder:Lt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logging-state update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/logging-state`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Updating`,async()=>c.aiGateway.loggingState.update({account_id:l})),{successLabel:`Updated`})}},zt={command:`logging-state`,describe:`Inspect and migrate the logging platform used by an AI Gateway account`,builder:e=>e.command(It).command(Rt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Bt(e){return e.positional(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`,`cost`,`tokens_in`,`tokens_out`,`duration`,`feedback`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`limit`,{type:`number`,description:`Limit`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const $={command:`delete <gateway-id>`,describe:`Deletes gateway log entries matching the specified criteria.`,builder:m(Bt),handler:async r=>{let c={order_by:r[`order-by`],order_by_direction:r[`order-by-direction`],filters:r.filters,limit:r.limit};if(r.dryRun){o({command:`cf ai-gateway logs delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await p({force:!!r.force})){process.stderr.write(`Aborted.
|
|
13
|
-
`);return}a(await s(`Deleting`,async()=>l.aiGateway.logs.delete({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Deleted`})}};function Vt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`feedback`,{type:`number`,description:`The feedback field`}).option(`score`,{type:`number`,description:`The score 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 Ht={command:`edit <id>`,describe:`Updates metadata for an AI Gateway log entry.`,builder:Vt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logs edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`json`,body:r.body===void 0?l({feedback:r.feedback,score:r.score}):c(r.body)});return}let u=await i(r),d=r.local?e:await t();if(r.accountId=d,r.body){let e=c(r.body);a(await s(`Updating`,async()=>u.aiGateway.logs.edit({...e,account_id:d,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`});return}let f=l({feedback:r.feedback,score:r.score});a(await s(`Updating`,async()=>u.aiGateway.logs.edit({...f,account_id:d,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Updated`})}};function Ut(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wt={command:`get <id>`,describe:`Retrieves detailed information for a specific AI Gateway log entry.`,builder:Ut,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logs get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}`,pathParams:{id:String(r.id??``),"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.logs.get({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function Gt(e){return e.option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`search`,{type:`string`,description:`Search`}).option(`page`,{type:`number`,description:`Page`}).option(`per-page`,{type:`number`,description:`Per page`}).option(`order-by`,{type:`string`,description:`Order by`,choices:[`created_at`,`provider`,`model`,`model_type`,`success`,`cached`]}).option(`order-by-direction`,{type:`string`,description:`Order by direction`,choices:[`asc`,`desc`]}).option(`filters`,{type:`string`,description:`Filters`}).option(`meta-info`,{type:`boolean`,description:`Meta info`}).option(`direction`,{type:`string`,description:`Direction`,choices:[`asc`,`desc`]}).option(`start-date`,{type:`string`,description:`Start date`}).option(`end-date`,{type:`string`,description:`End date`}).option(`min-cost`,{type:`number`,description:`Min cost`}).option(`max-cost`,{type:`number`,description:`Max cost`}).option(`min-tokens-in`,{type:`number`,description:`Min tokens in`}).option(`max-tokens-in`,{type:`number`,description:`Max tokens in`}).option(`min-tokens-out`,{type:`number`,description:`Min tokens out`}).option(`max-tokens-out`,{type:`number`,description:`Max tokens out`}).option(`min-total-tokens`,{type:`number`,description:`Min total tokens`}).option(`max-total-tokens`,{type:`number`,description:`Max total tokens`}).option(`min-duration`,{type:`number`,description:`Min duration`}).option(`max-duration`,{type:`number`,description:`Max duration`}).option(`feedback`,{type:`string`,description:`Feedback`,choices:[`-1`]}).option(`success`,{type:`boolean`,description:`Success`}).option(`cached`,{type:`boolean`,description:`Cached`}).option(`model`,{type:`string`,description:`Model`}).option(`model-type`,{type:`string`,description:`Model type`}).option(`provider`,{type:`string`,description:`Provider`}).option(`request-content-type`,{type:`string`,description:`Request content type`}).option(`response-content-type`,{type:`string`,description:`Response content type`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Kt={command:`list`,describe:`Lists request/response log entries for the AI gateway with filtering and pagination.`,builder:m(Gt),handler:async r=>{let c={search:r.search,page:r.page,per_page:r[`per-page`],order_by:r[`order-by`],order_by_direction:r[`order-by-direction`],filters:r.filters,meta_info:r[`meta-info`],direction:r.direction,start_date:r[`start-date`],end_date:r[`end-date`],min_cost:r[`min-cost`],max_cost:r[`max-cost`],min_tokens_in:r[`min-tokens-in`],max_tokens_in:r[`max-tokens-in`],min_tokens_out:r[`min-tokens-out`],max_tokens_out:r[`max-tokens-out`],min_total_tokens:r[`min-total-tokens`],max_total_tokens:r[`max-total-tokens`],min_duration:r[`min-duration`],max_duration:r[`max-duration`],feedback:r.feedback,success:r.success,cached:r.cached,model:r.model,model_type:r[`model-type`],provider:r.provider,request_content_type:r[`request-content-type`],response_content_type:r[`response-content-type`]};if(r.dryRun){o({command:`cf ai-gateway logs list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs`,pathParams:{"gateway-id":String(r[`gateway-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.aiGateway.logs.list({account_id:u,gateway_id:r[`gateway-id`],...c})),{successLabel:`Loaded`})}};function qt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Jt={command:`request <id>`,describe:`Retrieves the original request payload for an AI Gateway log entry.`,builder:qt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logs request`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/request`,pathParams:{id:String(r.id??``),"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.logs.request({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}};function Yt(e){return e.positional(`id`,{type:`string`,description:`ID`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Xt={command:`response <id>`,describe:`Retrieves the response payload for an AI Gateway log entry.`,builder:Yt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway logs response`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/logs/${r.id==null?`<id>`:encodeURIComponent(String(r.id))}/response`,pathParams:{id:String(r.id??``),"gateway-id":String(r[`gateway-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.logs.response({account_id:l,gateway_id:r[`gateway-id`],id:r.id})),{successLabel:`Loaded`})}},Zt={command:`logs`,describe:`Inspect individual request/response pairs that passed through the gateway`,builder:e=>e.command($).command(Ht).command(Wt).command(Kt).command(Jt).command(Xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qt(e){return e.positional(`provider`,{type:`string`,description:`Provider`,demandOption:!0}).option(`gateway-id`,{type:`string`,description:`gateway id`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $t={command:`get <provider>`,describe:`Retrieves the endpoint URL for an AI Gateway.`,builder:Qt,handler:async r=>{if(r.dryRun){o({command:`cf ai-gateway urls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/ai-gateway/gateways/${r[`gateway-id`]==null?`<gateway-id>`:encodeURIComponent(String(r[`gateway-id`]))}/url/${r.provider==null?`<provider>`:encodeURIComponent(String(r.provider))}`,pathParams:{"gateway-id":String(r[`gateway-id`]??``),provider:String(r.provider??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.aiGateway.urls.get({account_id:l,gateway_id:r[`gateway-id`],provider:r.provider})),{successLabel:`Loaded`})}},en={command:`urls`,describe:`Retrieve the gateway's proxy URL used by clients to send inference requests`,builder:e=>e.command($t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},tn={command:`ai-gateway`,describe:`Proxy, cache, rate-limit, and observe requests to AI providers — OpenAI, Anthropic, Workers AI, and more`,builder:e=>e.command(P).command(he).command(we).command(Fe).command(nt).command(at).command(mt).command(Pt).command(zt).command(Zt).command(en).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{tn as default};
|