diff --git a/packages/wrangler/src/config/index.ts b/packages/wrangler/src/config/index.ts index 28f75b7de8e8..bbee138531d0 100644 --- a/packages/wrangler/src/config/index.ts +++ b/packages/wrangler/src/config/index.ts @@ -182,7 +182,7 @@ export function printBindings(bindings: CfWorkerInit["bindings"]) { return `${s.substring(0, maxLength - 3)}...`; }; - const output: { type: string; entries: { key: string; value: string }[] }[] = + const output: { type: string; entries: { key: string; value: string | boolean }[] }[] = []; const { @@ -418,9 +418,12 @@ export function printBindings(bindings: CfWorkerInit["bindings"]) { } if (ai !== undefined) { + const entries: [{ key: string; value: string | boolean; }] = [{ key: "Name", value: ai.binding }] + if (ai.staging) entries.push({ key: "Staging", value: ai.staging }) + output.push({ type: "AI", - entries: [{ key: "Name", value: ai.binding }], + entries: entries, }); } diff --git a/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts b/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts index 03d5580a3994..f477e96aff39 100644 --- a/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts +++ b/packages/wrangler/src/deployment-bundle/create-worker-upload-form.ts @@ -42,7 +42,7 @@ export type WorkerMetadataBinding = | { type: "wasm_module"; name: string; part: string } | { type: "text_blob"; name: string; part: string } | { type: "browser"; name: string } - | { type: "ai"; name: string } + | { type: "ai"; name: string, staging?: boolean } | { type: "version_metadata"; name: string } | { type: "data_blob"; name: string; part: string } | { type: "kv_namespace"; name: string; namespace_id: string } @@ -329,6 +329,7 @@ export function createWorkerUploadForm(worker: CfWorkerInit): FormData { if (bindings.ai !== undefined) { metadataBindings.push({ name: bindings.ai.binding, + staging: bindings.ai.staging, type: "ai", }); } diff --git a/packages/wrangler/src/deployment-bundle/worker.ts b/packages/wrangler/src/deployment-bundle/worker.ts index 73a852f1e2da..e05a5020c48b 100644 --- a/packages/wrangler/src/deployment-bundle/worker.ts +++ b/packages/wrangler/src/deployment-bundle/worker.ts @@ -111,6 +111,7 @@ export interface CfBrowserBinding { export interface CfAIBinding { binding: string; + staging?: boolean; } /**