wrangler 4.92.0 → 4.93.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.
@@ -45233,6 +45233,36 @@ var init_inspect = __esm({
45233
45233
  __name(dockerImageInspect, "dockerImageInspect");
45234
45234
  }
45235
45235
  });
45236
+ function getFailedToRunDockerErrorMessage({
45237
+ numberOfContainers,
45238
+ isDev,
45239
+ isDryRun
45240
+ }) {
45241
+ const operation = isDev ? "running dev" : `deploying${isDryRun ? " (even in dry-run mode)" : ""}`;
45242
+ const headline = `The Docker CLI is needed to build the configured ${numberOfContainers !== 1 ? "images" : "image"} before ${operation} but could not be launched.`;
45243
+ let daemonHint;
45244
+ if (process.platform === "darwin") {
45245
+ daemonHint = "open the Docker Desktop app or run `open -a Docker`";
45246
+ } else if (process.platform === "win32") {
45247
+ daemonHint = "open the Docker Desktop app";
45248
+ } else {
45249
+ daemonHint = "run `sudo systemctl start docker`";
45250
+ }
45251
+ const steps = `To fix this, try the following:
45252
+ - If Docker is not installed, download it from https://docs.docker.com/get-started/get-docker/
45253
+ - If Docker is installed but the daemon is not running,
45254
+ ${daemonHint}.
45255
+ - If you use an alternative Docker-compatible CLI (e.g. Podman),
45256
+ set the WRANGLER_DOCKER_BIN environment variable to its path and DOCKER_HOST to its socket.`;
45257
+ const alternatives = "Note: Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so.";
45258
+ const hint = isDev ? "To suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or pass --enable-containers=false." : "If you cannot run Docker locally, you can still deploy your Worker by passing --containers-rollout=none. This will not deploy or update your Container.";
45259
+ return `${headline}
45260
+ ${steps}
45261
+
45262
+ ${alternatives}
45263
+
45264
+ ${hint}`;
45265
+ }
45236
45266
  function getContainerIdsByImageTags(dockerPath, imageTags) {
45237
45267
  const ids = /* @__PURE__ */ new Set();
45238
45268
  for (const imageTag of imageTags) {
@@ -45399,16 +45429,27 @@ var init_utils = __esm({
45399
45429
  }
45400
45430
  return true;
45401
45431
  }, "isDockerRunning");
45402
- verifyDockerInstalled = /* @__PURE__ */ __name(async (dockerPath, isDev = true) => {
45432
+ verifyDockerInstalled = /* @__PURE__ */ __name(async ({
45433
+ dockerPath,
45434
+ numberOfContainers,
45435
+ isDev = true,
45436
+ isDryRun = false
45437
+ }) => {
45403
45438
  const dockerIsRunning = await isDockerRunning(dockerPath);
45404
45439
  if (!dockerIsRunning) {
45405
45440
  throw new UserError(
45406
- `The Docker CLI could not be launched. Please ensure that the Docker CLI is installed and the daemon is running.
45407
- Other container tooling that is compatible with the Docker CLI and engine may work, but is not yet guaranteed to do so. You can specify an executable with the environment variable WRANGLER_DOCKER_BIN and a socket with DOCKER_HOST.${isDev ? "\nTo suppress this error if you do not intend on triggering any container instances, set dev.enable_containers to false in your Wrangler config or passing in --enable-containers=false." : ""}`,
45408
- { telemetryMessage: false }
45441
+ getFailedToRunDockerErrorMessage({
45442
+ numberOfContainers,
45443
+ isDev,
45444
+ isDryRun
45445
+ }),
45446
+ {
45447
+ telemetryMessage: false
45448
+ }
45409
45449
  );
45410
45450
  }
45411
45451
  }, "verifyDockerInstalled");
45452
+ __name(getFailedToRunDockerErrorMessage, "getFailedToRunDockerErrorMessage");
45412
45453
  cleanupContainers = /* @__PURE__ */ __name((dockerPath, imageTags) => {
45413
45454
  try {
45414
45455
  const containerIds = getContainerIdsByImageTags(dockerPath, imageTags);
@@ -45507,7 +45548,10 @@ async function prepareContainerImagesForDev(args) {
45507
45548
  { telemetryMessage: false }
45508
45549
  );
45509
45550
  }
45510
- await verifyDockerInstalled(dockerPath);
45551
+ await verifyDockerInstalled({
45552
+ dockerPath,
45553
+ numberOfContainers: containerOptions.length
45554
+ });
45511
45555
  for (const options of containerOptions) {
45512
45556
  if ("dockerfile" in options) {
45513
45557
  const build5 = await buildImage(dockerPath, options);
@@ -49983,9 +50027,35 @@ function getWranglerHiddenDirPath(projectRoot) {
49983
50027
  projectRoot ??= process.cwd();
49984
50028
  return path3__namespace.default.join(projectRoot, ".wrangler");
49985
50029
  }
50030
+ function sweepStaleWranglerTmpDirs(tmpRoot) {
50031
+ if (sweptTmpRoots.has(tmpRoot)) {
50032
+ return;
50033
+ }
50034
+ sweptTmpRoots.add(tmpRoot);
50035
+ let entries2;
50036
+ try {
50037
+ entries2 = fs27__namespace.default.readdirSync(tmpRoot, { withFileTypes: true });
50038
+ } catch {
50039
+ return;
50040
+ }
50041
+ const cutoff = Date.now() - STALE_WRANGLER_TMP_DIR_MS;
50042
+ for (const entry of entries2) {
50043
+ if (!entry.isDirectory()) {
50044
+ continue;
50045
+ }
50046
+ const entryPath = path3__namespace.default.join(tmpRoot, entry.name);
50047
+ try {
50048
+ if (fs27__namespace.default.statSync(entryPath).mtimeMs < cutoff) {
50049
+ removeDirSync(entryPath);
50050
+ }
50051
+ } catch {
50052
+ }
50053
+ }
50054
+ }
49986
50055
  function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
49987
50056
  const tmpRoot = path3__namespace.default.join(getWranglerHiddenDirPath(projectRoot), "tmp");
49988
50057
  fs27__namespace.default.mkdirSync(tmpRoot, { recursive: true });
50058
+ sweepStaleWranglerTmpDirs(tmpRoot);
49989
50059
  const tmpPrefix = path3__namespace.default.join(tmpRoot, `${prefix}-`);
49990
50060
  const tmpDir = fs27__namespace.default.realpathSync(fs27__namespace.default.mkdtempSync(tmpPrefix));
49991
50061
  const cleanupDir = /* @__PURE__ */ __name(() => {
@@ -50005,7 +50075,7 @@ function getWranglerTmpDir(projectRoot, prefix, cleanup = true) {
50005
50075
  }
50006
50076
  };
50007
50077
  }
50008
- var import_signal_exit2;
50078
+ var import_signal_exit2, STALE_WRANGLER_TMP_DIR_MS, sweptTmpRoots;
50009
50079
  var init_paths = __esm({
50010
50080
  "src/paths.ts"() {
50011
50081
  init_import_meta_url();
@@ -50015,6 +50085,9 @@ var init_paths = __esm({
50015
50085
  __name(readableRelative, "readableRelative");
50016
50086
  __name(getBasePath, "getBasePath");
50017
50087
  __name(getWranglerHiddenDirPath, "getWranglerHiddenDirPath");
50088
+ STALE_WRANGLER_TMP_DIR_MS = 24 * 60 * 60 * 1e3;
50089
+ sweptTmpRoots = /* @__PURE__ */ new Set();
50090
+ __name(sweepStaleWranglerTmpDirs, "sweepStaleWranglerTmpDirs");
50018
50091
  __name(getWranglerTmpDir, "getWranglerTmpDir");
50019
50092
  }
50020
50093
  });
@@ -55872,7 +55945,7 @@ var name, version;
55872
55945
  var init_package = __esm({
55873
55946
  "package.json"() {
55874
55947
  name = "wrangler";
55875
- version = "4.92.0";
55948
+ version = "4.93.0";
55876
55949
  }
55877
55950
  });
55878
55951
  function getWranglerVersion() {
@@ -154982,7 +155055,7 @@ var init_config5 = __esm({
154982
155055
  },
154983
155056
  affinities: convertContainerAffinitiesForApi(container),
154984
155057
  rollout_step_percentage: args?.containersRollout === "immediate" ? 100 : container.rollout_step_percentage ?? rolloutStepPercentageFallback,
154985
- rollout_kind: container.rollout_kind ?? "full_auto",
155058
+ rollout_kind: args?.containersRollout === "none" ? "none" : container.rollout_kind ?? "full_auto",
154986
155059
  rollout_active_grace_period: container.rollout_active_grace_period ?? 0,
154987
155060
  observability: {
154988
155061
  logs_enabled: config.observability?.logs?.enabled ?? config.observability?.enabled === true
@@ -160448,19 +160521,35 @@ function truncateDescription(description, alreadyUsed) {
160448
160521
  }
160449
160522
  return truncate2(description, process.stdout.columns - alreadyUsed);
160450
160523
  }
160451
- async function aiCatalogList(complianceConfig, accountId, partialUrl) {
160524
+ async function aiCatalogList(complianceConfig, accountId, partialUrl, options = {}) {
160452
160525
  const pageSize = 50;
160453
160526
  let page = 1;
160454
160527
  const results = [];
160455
160528
  while (results.length % pageSize === 0) {
160529
+ const queryParams = new URLSearchParams({
160530
+ per_page: pageSize.toString(),
160531
+ page: page.toString()
160532
+ });
160533
+ if (options.author !== void 0) {
160534
+ queryParams.set("author", options.author);
160535
+ }
160536
+ if (options.hideExperimental) {
160537
+ queryParams.set("hide_experimental", "true");
160538
+ }
160539
+ if (options.search !== void 0) {
160540
+ queryParams.set("search", options.search);
160541
+ }
160542
+ if (options.source !== void 0) {
160543
+ queryParams.set("source", options.source.toString());
160544
+ }
160545
+ if (options.task !== void 0) {
160546
+ queryParams.set("task", options.task);
160547
+ }
160456
160548
  const json = await fetchResult(
160457
160549
  complianceConfig,
160458
160550
  `/accounts/${accountId}/ai/${partialUrl}`,
160459
160551
  {},
160460
- new URLSearchParams({
160461
- per_page: pageSize.toString(),
160462
- page: page.toString()
160463
- })
160552
+ queryParams
160464
160553
  );
160465
160554
  page++;
160466
160555
  results.push(...json);
@@ -160489,8 +160578,13 @@ var init_utils6 = __esm({
160489
160578
  __name(truncateDescription, "truncateDescription");
160490
160579
  __name(aiCatalogList, "aiCatalogList");
160491
160580
  __name(aiFinetuneList, "aiFinetuneList");
160492
- listCatalogEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
160493
- return await aiCatalogList(complianceConfig, accountId, "models/search");
160581
+ listCatalogEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId, options = {}) => {
160582
+ return await aiCatalogList(
160583
+ complianceConfig,
160584
+ accountId,
160585
+ "models/search",
160586
+ options
160587
+ );
160494
160588
  }, "listCatalogEntries");
160495
160589
  listFinetuneEntries = /* @__PURE__ */ __name(async (complianceConfig, accountId) => {
160496
160590
  return await aiFinetuneList(complianceConfig, accountId);
@@ -160610,7 +160704,41 @@ var init_createFinetune = __esm({
160610
160704
  });
160611
160705
 
160612
160706
  // src/ai/listCatalog.ts
160613
- var aiModelsCommand;
160707
+ async function listModels({
160708
+ author,
160709
+ hideExperimental,
160710
+ json = false,
160711
+ search,
160712
+ source,
160713
+ task
160714
+ }, config) {
160715
+ const accountId = await requireAuth(config);
160716
+ const entries2 = await listCatalogEntries(config, accountId, {
160717
+ author,
160718
+ hideExperimental,
160719
+ search,
160720
+ source,
160721
+ task
160722
+ });
160723
+ if (json) {
160724
+ logger.json(entries2);
160725
+ } else if (entries2.length === 0) {
160726
+ logger.log(`No models found.`);
160727
+ } else {
160728
+ logger.table(
160729
+ entries2.map((entry) => ({
160730
+ model: entry.id,
160731
+ name: entry.name,
160732
+ description: truncateDescription(
160733
+ entry.description,
160734
+ entry.id.length + entry.name.length + (entry.task ? entry.task.name.length : 0) + 10
160735
+ ),
160736
+ task: entry.task ? entry.task.name : ""
160737
+ }))
160738
+ );
160739
+ }
160740
+ }
160741
+ var aiModelsCommand, aiModelsListCommand;
160614
160742
  var init_listCatalog = __esm({
160615
160743
  "src/ai/listCatalog.ts"() {
160616
160744
  init_import_meta_url();
@@ -160619,6 +160747,19 @@ var init_listCatalog = __esm({
160619
160747
  init_user3();
160620
160748
  init_utils6();
160621
160749
  aiModelsCommand = createCommand({
160750
+ metadata: {
160751
+ description: "Manage AI models",
160752
+ status: "stable",
160753
+ owner: "Product: AI"
160754
+ },
160755
+ behaviour: {
160756
+ printBanner: true
160757
+ },
160758
+ async handler(_args, { config }) {
160759
+ await listModels({}, config);
160760
+ }
160761
+ });
160762
+ aiModelsListCommand = createCommand({
160622
160763
  metadata: {
160623
160764
  description: "List catalog models",
160624
160765
  status: "stable",
@@ -160632,32 +160773,37 @@ var init_listCatalog = __esm({
160632
160773
  type: "boolean",
160633
160774
  description: "Return output as JSON",
160634
160775
  default: false
160776
+ },
160777
+ search: {
160778
+ type: "string",
160779
+ description: "Search models by name or description"
160780
+ },
160781
+ task: {
160782
+ type: "string",
160783
+ description: "Filter by task name"
160784
+ },
160785
+ author: {
160786
+ type: "string",
160787
+ description: "Filter by author"
160788
+ },
160789
+ source: {
160790
+ type: "number",
160791
+ description: "Filter by source ID"
160792
+ },
160793
+ "hide-experimental": {
160794
+ type: "boolean",
160795
+ description: "Hide experimental models",
160796
+ default: false
160635
160797
  }
160636
160798
  },
160637
- async handler({ json }, { config }) {
160638
- const accountId = await requireAuth(config);
160639
- const entries2 = await listCatalogEntries(config, accountId);
160640
- if (json) {
160641
- logger.log(JSON.stringify(entries2, null, 2));
160642
- } else {
160643
- if (entries2.length === 0) {
160644
- logger.log(`No models found.`);
160645
- } else {
160646
- logger.table(
160647
- entries2.map((entry) => ({
160648
- model: entry.id,
160649
- name: entry.name,
160650
- description: truncateDescription(
160651
- entry.description,
160652
- entry.id.length + entry.name.length + (entry.task ? entry.task.name.length : 0) + 10
160653
- ),
160654
- task: entry.task ? entry.task.name : ""
160655
- }))
160656
- );
160657
- }
160658
- }
160799
+ async handler({ author, hideExperimental, json, search, source, task }, { config }) {
160800
+ await listModels(
160801
+ { author, hideExperimental, json, search, source, task },
160802
+ config
160803
+ );
160659
160804
  }
160660
160805
  });
160806
+ __name(listModels, "listModels");
160661
160807
  }
160662
160808
  });
160663
160809
 
@@ -160711,6 +160857,43 @@ var init_listFinetune = __esm({
160711
160857
  });
160712
160858
  }
160713
160859
  });
160860
+
160861
+ // src/ai/modelSchema.ts
160862
+ var aiModelsSchemaCommand;
160863
+ var init_modelSchema = __esm({
160864
+ "src/ai/modelSchema.ts"() {
160865
+ init_import_meta_url();
160866
+ init_create_command();
160867
+ init_logger();
160868
+ init_user3();
160869
+ aiModelsSchemaCommand = createCommand({
160870
+ metadata: {
160871
+ description: "Get model schema",
160872
+ status: "stable",
160873
+ owner: "Product: AI"
160874
+ },
160875
+ behaviour: {
160876
+ printBanner: false
160877
+ },
160878
+ args: {
160879
+ model: {
160880
+ type: "string",
160881
+ demandOption: true,
160882
+ description: "The model to fetch a schema for"
160883
+ }
160884
+ },
160885
+ positionalArgs: ["model"],
160886
+ async handler({ model }, { config, sdk }) {
160887
+ const accountId = await requireAuth(config);
160888
+ const schema = await sdk.ai.models.schema.get({
160889
+ account_id: accountId,
160890
+ model
160891
+ });
160892
+ logger.json(schema);
160893
+ }
160894
+ });
160895
+ }
160896
+ });
160714
160897
  function formatLabelledValues(view, {
160715
160898
  formatLabel = /* @__PURE__ */ __name((label) => white(label + ":"), "formatLabel"),
160716
160899
  formatValue = /* @__PURE__ */ __name((value) => gray(value), "formatValue"),
@@ -181270,7 +181453,10 @@ Your database may not be available to serve requests during the migration, conti
181270
181453
  preview
181271
181454
  });
181272
181455
  if (response === null) {
181273
- return;
181456
+ throw new UserError(
181457
+ `Migration "${migration.name}" was not applied \u2014 execution was cancelled.`,
181458
+ { telemetryMessage: "d1 migrations apply execution cancelled" }
181459
+ );
181274
181460
  }
181275
181461
  for (const result of response) {
181276
181462
  if (Array.isArray(result)) {
@@ -181286,6 +181472,9 @@ Your database may not be available to serve requests during the migration, conti
181286
181472
  }
181287
181473
  }
181288
181474
  } catch (e9) {
181475
+ if (e9 instanceof UserError) {
181476
+ throw e9;
181477
+ }
181289
181478
  const err = e9;
181290
181479
  const maybeCause = err.cause ?? err;
181291
181480
  success2 = false;
@@ -230862,8 +231051,8 @@ var init_deploy2 = __esm({
230862
231051
  type: "string"
230863
231052
  },
230864
231053
  "containers-rollout": {
230865
- describe: "Rollout strategy for Containers changes. If set to immediate, it will override `rollout_percentage_steps` if configured and roll out to 100% of instances in one step. ",
230866
- choices: ["immediate", "gradual"]
231054
+ describe: "Rollout strategy for Containers changes. If set to immediate, it will override `rollout_percentage_steps` if configured and roll out to 100% of instances in one step. If set to none, the Worker will be deployed without building or updating any Containers.",
231055
+ choices: ["immediate", "gradual", "none"]
230867
231056
  },
230868
231057
  strict: {
230869
231058
  describe: "Enables strict mode for the deploy command, this prevents deployments to occur when there are even small potential risks.",
@@ -290809,7 +290998,13 @@ var init_tail2 = __esm({
290809
290998
  });
290810
290999
 
290811
291000
  // src/routes.ts
290812
- async function getWorkersDevSubdomain(complianceConfig, accountId, configPath, apiToken, abortSignal) {
291001
+ async function getWorkersDevSubdomain(complianceConfig, accountId, options = {}) {
291002
+ const {
291003
+ configPath,
291004
+ apiToken,
291005
+ abortSignal,
291006
+ registrationContext = "workers_dev"
291007
+ } = options;
290813
291008
  try {
290814
291009
  const { subdomain } = await fetchResult(
290815
291010
  complianceConfig,
@@ -290822,29 +291017,66 @@ async function getWorkersDevSubdomain(complianceConfig, accountId, configPath, a
290822
291017
  return `${subdomain}${getComplianceRegionSubdomain(complianceConfig)}.workers.dev`;
290823
291018
  } catch (e9) {
290824
291019
  const error2 = e9;
290825
- if (typeof error2 === "object" && !!error2 && error2.code === 10007) {
290826
- logger.warn(
290827
- "You need to register a workers.dev subdomain before publishing to workers.dev"
291020
+ if (typeof error2 !== "object" || !error2 || error2.code !== 10007) {
291021
+ throw e9;
291022
+ }
291023
+ logger.warn(getRegistrationWarning(registrationContext));
291024
+ const wantsToRegister = await confirm(
291025
+ "Would you like to register a workers.dev subdomain now?",
291026
+ { fallbackValue: false }
291027
+ );
291028
+ if (!wantsToRegister) {
291029
+ throw getRegistrationDeclinedError(
291030
+ registrationContext,
291031
+ accountId,
291032
+ configPath
290828
291033
  );
290829
- const wantsToRegister = await confirm(
290830
- "Would you like to register a workers.dev subdomain now?",
290831
- { fallbackValue: false }
291034
+ }
291035
+ return await registerSubdomain(
291036
+ complianceConfig,
291037
+ accountId,
291038
+ configPath,
291039
+ registrationContext
291040
+ );
291041
+ }
291042
+ }
291043
+ function getRegistrationWarning(registrationContext) {
291044
+ switch (registrationContext) {
291045
+ case "workflows":
291046
+ return "You need to register a workers.dev subdomain before deploying Workflows";
291047
+ case "workers_dev":
291048
+ return "You need to register a workers.dev subdomain before publishing to workers.dev";
291049
+ default: {
291050
+ const _exhaustive = registrationContext;
291051
+ return _exhaustive;
291052
+ }
291053
+ }
291054
+ }
291055
+ function getRegistrationDeclinedError(registrationContext, accountId, configPath) {
291056
+ const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
291057
+ switch (registrationContext) {
291058
+ case "workflows":
291059
+ return new UserError(
291060
+ `Workflows require your account to have a workers.dev subdomain. Register a workers.dev subdomain here:
291061
+ ${onboardingLink}`,
291062
+ {
291063
+ telemetryMessage: "workflows workers dev registration declined"
291064
+ }
290832
291065
  );
290833
- if (!wantsToRegister) {
290834
- const solutionMessage = `You can either deploy your worker to one or more routes by specifying them in your ${configFileName(configPath)} file, or register a workers.dev subdomain here:`;
290835
- const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
290836
- throw new UserError(`${solutionMessage}
291066
+ case "workers_dev": {
291067
+ const solutionMessage = `You can either deploy your worker to one or more routes by specifying them in your ${configFileName(configPath)} file, or register a workers.dev subdomain here:`;
291068
+ return new UserError(`${solutionMessage}
290837
291069
  ${onboardingLink}`, {
290838
- telemetryMessage: "routes workers dev registration declined"
290839
- });
290840
- }
290841
- return await registerSubdomain(complianceConfig, accountId, configPath);
290842
- } else {
290843
- throw e9;
291070
+ telemetryMessage: "routes workers dev registration declined"
291071
+ });
291072
+ }
291073
+ default: {
291074
+ const _exhaustive = registrationContext;
291075
+ return _exhaustive;
290844
291076
  }
290845
291077
  }
290846
291078
  }
290847
- async function registerSubdomain(complianceConfig, accountId, configPath) {
291079
+ async function registerSubdomain(complianceConfig, accountId, configPath, registrationContext) {
290848
291080
  let subdomain;
290849
291081
  while (subdomain === void 0) {
290850
291082
  const potentialName = await prompt(
@@ -290883,12 +291115,11 @@ async function registerSubdomain(complianceConfig, accountId, configPath) {
290883
291115
  )}. Ok to proceed?`
290884
291116
  );
290885
291117
  if (!ok) {
290886
- const solutionMessage = `You can either deploy your worker to one or more routes by specifying them in your ${configFileName(configPath)} file, or register a workers.dev subdomain here:`;
290887
- const onboardingLink = `https://dash.cloudflare.com/${accountId}/workers/onboarding`;
290888
- throw new UserError(`${solutionMessage}
290889
- ${onboardingLink}`, {
290890
- telemetryMessage: "routes workers dev registration declined"
290891
- });
291118
+ throw getRegistrationDeclinedError(
291119
+ registrationContext,
291120
+ accountId,
291121
+ configPath
291122
+ );
290892
291123
  }
290893
291124
  try {
290894
291125
  const result = await fetchResult(
@@ -290935,6 +291166,8 @@ var init_routes6 = __esm({
290935
291166
  init_dialogs();
290936
291167
  init_logger();
290937
291168
  __name(getWorkersDevSubdomain, "getWorkersDevSubdomain");
291169
+ __name(getRegistrationWarning, "getRegistrationWarning");
291170
+ __name(getRegistrationDeclinedError, "getRegistrationDeclinedError");
290938
291171
  __name(registerSubdomain, "registerSubdomain");
290939
291172
  }
290940
291173
  });
@@ -290981,6 +291214,9 @@ async function triggersDeploy(props) {
290981
291214
  }
290982
291215
  const uploadMs = Date.now() - start;
290983
291216
  const deployments = [];
291217
+ const hasWorkflowsDefinedInThisScript = config.workflows.some(
291218
+ (workflow) => isWorkflowDefinedInThisScript(workflow, scriptName)
291219
+ );
290984
291220
  const { wantWorkersDev, workersDevInSync } = await subdomainDeploy(
290985
291221
  props,
290986
291222
  accountId,
@@ -291050,6 +291286,12 @@ ${dashLink}`, {
291050
291286
  });
291051
291287
  }
291052
291288
  }
291289
+ if (!wantWorkersDev && hasWorkflowsDefinedInThisScript) {
291290
+ await getWorkersDevSubdomain(config, accountId, {
291291
+ configPath: config.configPath,
291292
+ registrationContext: "workflows"
291293
+ });
291294
+ }
291053
291295
  if (routesOnly.length > 0) {
291054
291296
  deployments.push(
291055
291297
  publishRoutes(config, routesOnly, {
@@ -291095,7 +291337,7 @@ ${dashLink}`, {
291095
291337
  }
291096
291338
  if (config.workflows?.length) {
291097
291339
  for (const workflow of config.workflows) {
291098
- if (workflow.script_name !== void 0 && workflow.script_name !== scriptName) {
291340
+ if (!isWorkflowDefinedInThisScript(workflow, scriptName)) {
291099
291341
  if (workflow.limits) {
291100
291342
  throw new UserError(
291101
291343
  `Workflow "${workflow.name}" has "limits" configured but references external script "${workflow.script_name}". Configure limits on the worker that defines the workflow.`,
@@ -291179,11 +291421,9 @@ async function validateSubdomainMixedState(props, accountId, scriptName, before,
291179
291421
  if (after.workers_dev === after.preview_urls) {
291180
291422
  return after;
291181
291423
  }
291182
- const userSubdomain = await getWorkersDevSubdomain(
291183
- config,
291184
- accountId,
291185
- config.configPath
291186
- );
291424
+ const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
291425
+ configPath: config.configPath
291426
+ });
291187
291427
  const previewUrl = `https://<VERSION_PREFIX>-${scriptName}.${userSubdomain}`;
291188
291428
  if (!after.workers_dev && after.preview_urls) {
291189
291429
  logger.warn(
@@ -291212,14 +291452,12 @@ async function validateSubdomainMixedState(props, accountId, scriptName, before,
291212
291452
  async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl, routes, deployments, firstDeploy) {
291213
291453
  const { config } = props;
291214
291454
  const { workers_dev: wantWorkersDev, preview_urls: wantPreviews } = getSubdomainValues(config.workers_dev, config.preview_urls, routes);
291215
- let workersDevURL;
291216
291455
  if (wantWorkersDev) {
291217
- const userSubdomain = await getWorkersDevSubdomain(
291218
- config,
291219
- accountId,
291220
- config.configPath
291221
- );
291222
- workersDevURL = !props.useServiceEnvironments || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
291456
+ const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
291457
+ configPath: config.configPath
291458
+ });
291459
+ const workersDevURL = !props.useServiceEnvironments || !props.env ? `${scriptName}.${userSubdomain}` : `${envName}.${scriptName}.${userSubdomain}`;
291460
+ deployments.push(Promise.resolve([workersDevURL]));
291223
291461
  }
291224
291462
  const before = await fetchResult(config, `${workerUrl}/subdomain`);
291225
291463
  const after = await retryOnAPIFailure(
@@ -291273,9 +291511,6 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
291273
291511
  { workers_dev: after.enabled, preview_urls: after.previews_enabled },
291274
291512
  firstDeploy
291275
291513
  );
291276
- if (workersDevURL) {
291277
- deployments.push(Promise.resolve([workersDevURL]));
291278
- }
291279
291514
  return {
291280
291515
  wantWorkersDev,
291281
291516
  wantPreviews,
@@ -291283,6 +291518,9 @@ async function subdomainDeploy(props, accountId, scriptName, envName, workerUrl,
291283
291518
  previewsInSync: before.previews_enabled === after.previews_enabled
291284
291519
  };
291285
291520
  }
291521
+ function isWorkflowDefinedInThisScript(workflow, scriptName) {
291522
+ return workflow.script_name === void 0 || workflow.script_name === scriptName;
291523
+ }
291286
291524
  var init_deploy5 = __esm({
291287
291525
  "src/triggers/deploy.ts"() {
291288
291526
  init_import_meta_url();
@@ -291302,6 +291540,7 @@ var init_deploy5 = __esm({
291302
291540
  __name(getSubdomainValuesAPIMock, "getSubdomainValuesAPIMock");
291303
291541
  __name(validateSubdomainMixedState, "validateSubdomainMixedState");
291304
291542
  __name(subdomainDeploy, "subdomainDeploy");
291543
+ __name(isWorkflowDefinedInThisScript, "isWorkflowDefinedInThisScript");
291305
291544
  }
291306
291545
  });
291307
291546
 
@@ -299794,11 +300033,9 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
299794
300033
  if (versionId && hasPreview) {
299795
300034
  const { previews_enabled: previews_available_on_subdomain } = await fetchResult(config, `${workerUrl}/subdomain`);
299796
300035
  if (previews_available_on_subdomain) {
299797
- const userSubdomain = await getWorkersDevSubdomain(
299798
- config,
299799
- accountId,
299800
- config.configPath
299801
- );
300036
+ const userSubdomain = await getWorkersDevSubdomain(config, accountId, {
300037
+ configPath: config.configPath
300038
+ });
299802
300039
  const shortVersion = versionId.slice(0, 8);
299803
300040
  versionPreviewUrl = `https://${shortVersion}-${workerName}.${userSubdomain}`;
299804
300041
  logger.log(`Version Preview URL: ${versionPreviewUrl}`);
@@ -306040,6 +306277,8 @@ function createCLIParser(argv) {
306040
306277
  registry.define([
306041
306278
  { command: "wrangler ai", definition: aiNamespace },
306042
306279
  { command: "wrangler ai models", definition: aiModelsCommand },
306280
+ { command: "wrangler ai models list", definition: aiModelsListCommand },
306281
+ { command: "wrangler ai models schema", definition: aiModelsSchemaCommand },
306043
306282
  { command: "wrangler ai finetune", definition: aiFineTuneNamespace },
306044
306283
  { command: "wrangler ai finetune list", definition: aiFineTuneListCommand },
306045
306284
  {
@@ -306586,6 +306825,7 @@ var init_src2 = __esm({
306586
306825
  init_createFinetune();
306587
306826
  init_listCatalog();
306588
306827
  init_listFinetune();
306828
+ init_modelSchema();
306589
306829
  init_artifacts();
306590
306830
  init_browser_rendering2();
306591
306831
  init_build4();
@@ -308141,6 +308381,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
308141
308381
  { telemetryMessage: "[data_blobs] with an ES module worker" }
308142
308382
  );
308143
308383
  }
308384
+ const isDryRun = props.dryRun;
308144
308385
  let sourceMapSize;
308145
308386
  const normalisedContainerConfig = await getNormalizedContainerOptions(
308146
308387
  config,
@@ -308230,21 +308471,21 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
308230
308471
  const content = fs27.readFileSync(resolvedEntryPointPath, {
308231
308472
  encoding: "utf-8"
308232
308473
  });
308233
- const migrations = !props.dryRun ? await getMigrationsToUpload(scriptName, {
308474
+ const migrations = !isDryRun ? await getMigrationsToUpload(scriptName, {
308234
308475
  accountId,
308235
308476
  config,
308236
308477
  useServiceEnvironments: props.useServiceEnvironments,
308237
308478
  env: props.env,
308238
308479
  dispatchNamespace: props.dispatchNamespace
308239
308480
  }) : void 0;
308240
- const assetsJwt = props.assetsOptions && !props.dryRun ? await syncAssets(
308481
+ const assetsJwt = props.assetsOptions && !isDryRun ? await syncAssets(
308241
308482
  config,
308242
308483
  accountId,
308243
308484
  props.assetsOptions.directory,
308244
308485
  scriptName,
308245
308486
  props.dispatchNamespace
308246
308487
  ) : void 0;
308247
- if (props.assetsOptions && props.dryRun) {
308488
+ if (props.assetsOptions && isDryRun) {
308248
308489
  await buildAssetManifest(props.assetsOptions.directory);
308249
308490
  }
308250
308491
  const workersSitesAssets = await syncWorkersSite(
@@ -308257,7 +308498,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
308257
308498
  scriptName + (useServiceEnvironments2 ? `-${props.env}` : ""),
308258
308499
  props.legacyAssetPaths,
308259
308500
  false,
308260
- props.dryRun,
308501
+ isDryRun,
308261
308502
  props.oldAssetTtl
308262
308503
  );
308263
308504
  const bindings = getBindings(config);
@@ -308343,22 +308584,27 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
308343
308584
  const canUseNewVersionsDeploymentsApi = workerExists && props.dispatchNamespace === void 0 && !useServiceEnvironments2 && format9 === "modules" && migrations === void 0 && !config.first_party_worker && config.containers === void 0;
308344
308585
  let workerBundle;
308345
308586
  const dockerPath = getDockerPath();
308346
- if (normalisedContainerConfig.length) {
308347
- const hasDockerfiles = normalisedContainerConfig.some(
308587
+ if (normalisedContainerConfig.length && props.containersRollout !== "none") {
308588
+ const containersWithDockerfile = normalisedContainerConfig.filter(
308348
308589
  (container) => "dockerfile" in container
308349
308590
  );
308350
- if (hasDockerfiles) {
308351
- await verifyDockerInstalled(dockerPath, false);
308591
+ if (containersWithDockerfile.length > 0) {
308592
+ await verifyDockerInstalled({
308593
+ dockerPath,
308594
+ isDev: false,
308595
+ isDryRun,
308596
+ numberOfContainers: containersWithDockerfile.length
308597
+ });
308352
308598
  }
308353
308599
  }
308354
- if (props.dryRun) {
308600
+ if (isDryRun) {
308355
308601
  if (normalisedContainerConfig.length) {
308356
308602
  for (const container of normalisedContainerConfig) {
308357
- if ("dockerfile" in container) {
308603
+ if ("dockerfile" in container && props.containersRollout !== "none") {
308358
308604
  await buildContainer(
308359
308605
  container,
308360
308606
  workerTag ?? "worker-tag",
308361
- props.dryRun,
308607
+ isDryRun,
308362
308608
  dockerPath
308363
308609
  );
308364
308610
  }
@@ -308590,13 +308836,13 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m
308590
308836
  destination.remove();
308591
308837
  }
308592
308838
  }
308593
- if (props.dryRun) {
308839
+ if (isDryRun) {
308594
308840
  logger.log(`--dry-run: exiting now.`);
308595
308841
  return { versionId, workerTag };
308596
308842
  }
308597
308843
  const uploadMs = Date.now() - start;
308598
308844
  logger.log("Uploaded", workerName, formatTime2(uploadMs));
308599
- if (normalisedContainerConfig.length) {
308845
+ if (normalisedContainerConfig.length && props.containersRollout !== "none") {
308600
308846
  assert54__default.default(versionId && accountId);
308601
308847
  await deployContainers(config, normalisedContainerConfig, {
308602
308848
  versionId,
@@ -311842,9 +312088,10 @@ async function createPreviewSession(complianceConfig, account, ctx, abortSignal,
311842
312088
  const subdomain = await getWorkersDevSubdomain(
311843
312089
  complianceConfig,
311844
312090
  account.accountId,
311845
- void 0,
311846
- apiToken,
311847
- withTimeout(abortSignal)
312091
+ {
312092
+ apiToken,
312093
+ abortSignal: withTimeout(abortSignal)
312094
+ }
311848
312095
  );
311849
312096
  host = `${name2 ?? crypto2__default.default.randomUUID()}.${subdomain}`;
311850
312097
  }
@@ -312759,6 +313006,32 @@ var init_ProxyServerWorker = __esm({
312759
313006
  ProxyServerWorker_default = scriptPath3;
312760
313007
  }
312761
313008
  });
313009
+ function isErrorEvent3(error2) {
313010
+ return typeof error2 === "object" && error2 !== null && "type" in error2 && error2.type === "error" && "reason" in error2 && "cause" in error2;
313011
+ }
313012
+ function getErrorMessage3(error2) {
313013
+ if (error2 instanceof Error) {
313014
+ return getErrorMessage3(error2.cause) ?? error2.message;
313015
+ }
313016
+ if (typeof error2 === "string") {
313017
+ return error2;
313018
+ }
313019
+ if (typeof error2 === "object" && error2 !== null) {
313020
+ const maybeMessage = error2.message;
313021
+ if (typeof maybeMessage === "string") {
313022
+ const maybeCause = error2.cause;
313023
+ return getErrorMessage3(maybeCause) ?? maybeMessage;
313024
+ }
313025
+ }
313026
+ return void 0;
313027
+ }
313028
+ function formatRemoteProxySessionError(error2) {
313029
+ if (isErrorEvent3(error2)) {
313030
+ const causeMessage = getErrorMessage3(error2.cause);
313031
+ return causeMessage ? `${error2.reason}: ${causeMessage}` : error2.reason;
313032
+ }
313033
+ return getErrorMessage3(error2);
313034
+ }
312762
313035
  async function startRemoteProxySession(bindings, options) {
312763
313036
  logger.log(source_default.dim("\u2394 Establishing remote connection..."));
312764
313037
  const rawBindings = Object.fromEntries(
@@ -312811,8 +313084,9 @@ ${errorMessage}`
312811
313084
  worker.raw.proxy.localServerReady.promise
312812
313085
  ]);
312813
313086
  if (maybeError && maybeError.error) {
313087
+ const details = formatRemoteProxySessionError(maybeError.error);
312814
313088
  throw new Error(
312815
- "Failed to start the remote proxy session. There is likely additional logging output above.",
313089
+ details ? `Failed to start the remote proxy session. ${details}` : "Failed to start the remote proxy session. There is likely additional logging output above.",
312816
313090
  {
312817
313091
  cause: maybeError.error
312818
313092
  }
@@ -312863,6 +313137,9 @@ var init_start_remote_proxy_session = __esm({
312863
313137
  init_logger();
312864
313138
  init_paths();
312865
313139
  init_startDevWorker();
313140
+ __name(isErrorEvent3, "isErrorEvent");
313141
+ __name(getErrorMessage3, "getErrorMessage");
313142
+ __name(formatRemoteProxySessionError, "formatRemoteProxySessionError");
312866
313143
  __name(startRemoteProxySession, "startRemoteProxySession");
312867
313144
  __name(getStartWorkerLogLevel, "getStartWorkerLogLevel");
312868
313145
  }