@haakco/hostingctl 1.0.797 → 1.0.808

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -29391,7 +29391,7 @@ async function sessionTarget(request = {}) {
29391
29391
  const known = Object.keys(document.profiles).sort();
29392
29392
  throw new SessionError([
29393
29393
  `No session for profile "${name}".`,
29394
- known.length === 0 ? "Run `hostingctl login --api-url <url> --client-id <id> --profile " + name + "`." : `Signed in profiles: ${known.join(", ")}. Select one with --profile, or sign in with \`hostingctl login --profile ${name}\`.`,
29394
+ known.length === 0 ? "Run `hostingctl login --profile " + name + "`." : `Signed in profiles: ${known.join(", ")}. Select one with --profile, or sign in with \`hostingctl login --profile ${name}\`.`,
29395
29395
  "`hostingctl auth profiles` lists them with the API each one is signed in to."
29396
29396
  ].join("\n"));
29397
29397
  }
@@ -34378,6 +34378,22 @@ function hostingEnvironmentRetry(options) {
34378
34378
  }));
34379
34379
  }
34380
34380
  /**
34381
+ * {@link /c/:company/hosting/environments/:environmentUuid/budget}
34382
+ */
34383
+ function hostingEnvironmentsBudget(options) {
34384
+ const { client: request = client, ...config } = options;
34385
+ return withUnwrap(request({
34386
+ method: "GET",
34387
+ url: "/c/{company}/hosting/environments/{environmentUuid}/budget",
34388
+ security: [{
34389
+ type: "http",
34390
+ scheme: "bearer"
34391
+ }],
34392
+ ...config,
34393
+ throwOnError: config.throwOnError ?? true
34394
+ }));
34395
+ }
34396
+ /**
34381
34397
  * @summary 200 rather than 201: this records desired state on an environment that already exists, and the
34382
34398
  * reconciler — not this call — makes the cache serve. The body reports each application's outcome,
34383
34399
  * so "the switch is on" and "every application is caching" are never confused
@@ -34808,6 +34824,39 @@ function hostingLogShow(options) {
34808
34824
  }));
34809
34825
  }
34810
34826
  /**
34827
+ * {@link /c/:company/hosting/environments/:environmentUuid/mail-relay/diagnoses}
34828
+ */
34829
+ function hostingMailRelayDiagnosisStart(options) {
34830
+ const { client: request = client, ...config } = options;
34831
+ return withUnwrap(request({
34832
+ method: "POST",
34833
+ url: "/c/{company}/hosting/environments/{environmentUuid}/mail-relay/diagnoses",
34834
+ security: [{
34835
+ type: "http",
34836
+ scheme: "bearer"
34837
+ }],
34838
+ contentType: { request: "application/json" },
34839
+ ...config,
34840
+ throwOnError: config.throwOnError ?? true
34841
+ }));
34842
+ }
34843
+ /**
34844
+ * {@link /c/:company/hosting/environments/:environmentUuid/mail-relay/diagnoses/:diagnosisUuid}
34845
+ */
34846
+ function hostingMailRelayDiagnosisShow(options) {
34847
+ const { client: request = client, ...config } = options;
34848
+ return withUnwrap(request({
34849
+ method: "GET",
34850
+ url: "/c/{company}/hosting/environments/{environmentUuid}/mail-relay/diagnoses/{diagnosisUuid}",
34851
+ security: [{
34852
+ type: "http",
34853
+ scheme: "bearer"
34854
+ }],
34855
+ ...config,
34856
+ throwOnError: config.throwOnError ?? true
34857
+ }));
34858
+ }
34859
+ /**
34811
34860
  * {@link /c/:company/hosting/nvme-blocks}
34812
34861
  */
34813
34862
  function hostingNvmeBlocksShow(options) {
@@ -35209,6 +35258,7 @@ function hostingDeploymentRedeploy(options) {
35209
35258
  type: "http",
35210
35259
  scheme: "bearer"
35211
35260
  }],
35261
+ contentType: { request: "application/json" },
35212
35262
  ...config,
35213
35263
  throwOnError: config.throwOnError ?? true
35214
35264
  }));
@@ -40193,7 +40243,7 @@ var AUTH_USAGE = [
40193
40243
  "Usage: hostingctl auth status [--verify] [--profile <name>]",
40194
40244
  " hostingctl auth profiles",
40195
40245
  " hostingctl auth logout [--profile <name>] [--local]",
40196
- " hostingctl auth login --api-url <url> --client-id <id> [--profile <name>] [--no-browser]",
40246
+ " hostingctl auth login [--api-url <url>] [--client-id <id>] [--profile <name>] [--no-browser]",
40197
40247
  " hostingctl auth profile|password|register|forgot-password|reset-password|verify-email …",
40198
40248
  " hostingctl auth closure|picture|notifications …",
40199
40249
  " hostingctl auth impersonate <start|status|stop|list|end> …",
@@ -40427,7 +40477,7 @@ async function authSessions(context, rest) {
40427
40477
  * "which account am I about to act as".
40428
40478
  */
40429
40479
  function profilesText(report) {
40430
- if (report.profiles.length === 0) return [`No sessions on this machine (${report.file}).`, "Sign in with `hostingctl login --api-url <url> --client-id <id> --profile <name>`."].join("\n");
40480
+ if (report.profiles.length === 0) return [`No sessions on this machine (${report.file}).`, "Sign in with `hostingctl login --profile <name>`."].join("\n");
40431
40481
  const width = Math.max(...report.profiles.map((one) => one.name.length));
40432
40482
  const lines = report.profiles.map((one) => {
40433
40483
  const state = one.expired ? `expired ${one.expiresAt}` : `valid until ${one.expiresAt}`;
@@ -40564,6 +40614,21 @@ function authText(report) {
40564
40614
  " `auth closure request --reason <text>` re-reads this review before sending it."
40565
40615
  ].join("\n");
40566
40616
  }
40617
+ /**
40618
+ * The installations `login` knows, each with the first-party public OAuth client its panel and this CLI sign in
40619
+ * with. A client id is the public `VITE_OAUTH_CLIENT_ID` the panel serves in `/config.js`, an identifier rather
40620
+ * than a credential: PKCE, not a secret, proves the caller.
40621
+ *
40622
+ * The Rust client keeps the same table in `crates/hostingctl/src/config.rs`; `login-client-id.test.ts` refuses
40623
+ * the two drifting apart.
40624
+ */
40625
+ var KNOWN_INSTALLATIONS = [{
40626
+ apiUrl: "https://hosting.haak.co/api/v1",
40627
+ clientId: "01a0d2c2-cc35-70b7-bc8c-c9af385c728a"
40628
+ }, {
40629
+ apiUrl: "https://hosting-staging.haakdev.com/api/v1",
40630
+ clientId: "01a0d0db-c35d-7339-b32d-956be37a658b"
40631
+ }];
40567
40632
  // src/commands/login-metadata.ts
40568
40633
  /**
40569
40634
  * `login` — sign in with authorization-code/PKCE over a loopback redirect.
@@ -40572,14 +40637,15 @@ function authText(report) {
40572
40637
  * itself hold one copy of it between them. The target and the client id are global flags.
40573
40638
  */
40574
40639
  var LOGIN_USAGE = [
40575
- "Usage: hostingctl login --api-url <url> [--client-id <id>] [--profile <name>] [--company <slug>] [--no-browser]",
40640
+ "Usage: hostingctl login [--api-url <url>] [--client-id <id>] [--profile <name>] [--company <slug>] [--no-browser]",
40576
40641
  "",
40577
40642
  "Signs in with authorization-code/PKCE over a loopback redirect, proves the new token against the API, then",
40578
40643
  "writes the session to a mode 0600 credential file under a 0700 directory. It is a credential file rather than",
40579
40644
  "a keychain, so exclude it from backup and sync tools; what bounds the exposure is that the refresh token is",
40580
40645
  "single-use and expires.",
40581
40646
  "",
40582
- " --client-id <id> The first-party client to sign in with. Taken from HOSTINGCTL_CLIENT_ID, then from a\n session this machine already holds, so a re-login needs no id at all.",
40647
+ " --api-url <url> The installation to sign in to (default: https://hosting.haak.co/api/v1, or\n HOSTINGCTL_API_URL).",
40648
+ " --client-id <id> The first-party client to sign in with. Known installations ship their own; otherwise it\n is taken from HOSTINGCTL_CLIENT_ID, a session this machine holds, or the panel's config.",
40583
40649
  " --profile <name> Which named session to write (default: \"default\", or HOSTINGCTL_PROFILE).",
40584
40650
  " --company <slug> Store this company with the session, so company commands need no --company.",
40585
40651
  " Without it, HOSTINGCTL_COMPANY or the account's only company is used.",
@@ -40645,10 +40711,9 @@ function profileName(flags) {
40645
40711
  * runs inside `signIn`, so a token the API will not accept is never written over a session that works.
40646
40712
  */
40647
40713
  async function runLogin(context) {
40648
- const apiUrl = context.flags.get("--api-url");
40714
+ const apiUrl = (context.flags.get("--api-url") ?? "").trim() || "https://hosting.haak.co/api/v1";
40649
40715
  const profile = profileName(context.flags);
40650
40716
  const noBrowser = context.flags.has("--no-browser");
40651
- if (apiUrl === void 0 || apiUrl === "") throw new UsageError(LOGIN_USAGE);
40652
40717
  const resolvedClientId = await resolveClientId(context.flags, await readProfiles(), apiUrl);
40653
40718
  if (resolvedClientId === void 0) throw new UsageError(LOGIN_USAGE);
40654
40719
  const clientId = resolvedClientId;
@@ -40692,9 +40757,9 @@ var login = {
40692
40757
  };
40693
40758
  /**
40694
40759
  * The first-party client id to sign in with: the flag, `HOSTINGCTL_CLIENT_ID`, one this machine has already
40695
- * signed in with, and finally the platform's own published client.
40760
+ * signed in with, the client a known installation ships with, and finally the platform's own published client.
40696
40761
  *
40697
- * The last source is the one that makes `login` a single command. The platform serves its runtime config at
40762
+ * The last source covers an installation this CLI does not ship with, such as a local stack. The platform serves its runtime config at
40698
40763
  * `<origin>/config.js` as `window.__HOSTING_PUBLIC_CONFIG__`, and `VITE_OAUTH_CLIENT_ID` in it is the same
40699
40764
  * public client the web app signs in with — a public identifier of the application, not a credential. Reading
40700
40765
  * it means nobody has to be told a uuid before they can sign in, and no documentation can go stale with one.
@@ -40713,6 +40778,8 @@ async function resolveClientId(flags, document, apiUrl, fetcher = fetch) {
40713
40778
  if (fromEnvironment !== "") return fromEnvironment;
40714
40779
  const stored = Object.values(document.profiles).filter((one) => sameTarget(one.apiUrl, apiUrl)).map((one) => one.clientId.trim()).find((one) => one !== "");
40715
40780
  if (stored !== void 0) return stored;
40781
+ const known = KNOWN_INSTALLATIONS.find((one) => sameTarget(one.apiUrl, apiUrl));
40782
+ if (known !== void 0) return known.clientId;
40716
40783
  return await discoverClientId(apiUrl, fetcher);
40717
40784
  }
40718
40785
  /**
@@ -40790,7 +40857,7 @@ async function status$1(context, rest) {
40790
40857
  const stored = document.profiles[profile];
40791
40858
  if (stored === void 0) {
40792
40859
  const known = Object.keys(document.profiles).sort();
40793
- throw new UsageError(known.length === 0 ? `No session on this machine. Run \`hostingctl login --api-url <url> --client-id <id>\`.` : `No session for profile "${profile}". Signed in profiles: ${known.join(", ")}.`);
40860
+ throw new UsageError(known.length === 0 ? `No session on this machine. Run \`hostingctl login\`.` : `No session for profile "${profile}". Signed in profiles: ${known.join(", ")}.`);
40794
40861
  }
40795
40862
  const report = {
40796
40863
  profile,
@@ -42693,7 +42760,8 @@ async function deliverApplicationSource(progress, path, key, archive, deadline,
42693
42760
  path,
42694
42761
  body: {
42695
42762
  sourceUploadUuid: upload.uuid,
42696
- idempotencyKey: `setup-${upload.uuid}`
42763
+ idempotencyKey: `setup-${upload.uuid}`,
42764
+ deployMode: "deploy-when-built"
42697
42765
  }
42698
42766
  })).data;
42699
42767
  record({
@@ -42720,20 +42788,15 @@ async function deliverApplicationSource(progress, path, key, archive, deadline,
42720
42788
  };
42721
42789
  }
42722
42790
  /**
42723
- * Follow one queued build until its release is serving: the build to a final state, its own release, the deploy,
42724
- * and the running release. Shared by `environment setup` and `application build --wait`, which say differently
42725
- * where to read a failed build from — `next` is that sentence.
42791
+ * Follow one build requested in `deploy-when-built` mode until its release is serving: the build to a final state,
42792
+ * its own release, and the running release. The platform deploys it, so this only observes — stopping the command
42793
+ * changes nothing. Shared by `environment setup` and `application build --wait`, which say differently where to
42794
+ * read a failed build from — `next` is that sentence.
42726
42795
  */
42727
42796
  async function followBuildToServing(progress, path, key, build, deadline, next, onRelease = () => void 0) {
42728
42797
  const finished = await awaitBuild(progress, path, key, build, deadline, next);
42729
42798
  const release = await releaseForBuild(progress, path, key, build, deadline);
42730
42799
  onRelease(release.uuid);
42731
- progress.report(`${key}: deploying release ${release.uuid}`);
42732
- refuseAfterDeadline(deadline, "deploying its release", `hostingctl application deployment ${path.environmentUuid} ${path.workloadUuid} --company <slug>`);
42733
- await hostingDeploymentDeploy({ path: {
42734
- ...path,
42735
- releaseUuid: release.uuid
42736
- } });
42737
42800
  return {
42738
42801
  finished,
42739
42802
  running: await awaitRelease(progress, path, key, release.uuid, deadline)
@@ -42761,15 +42824,23 @@ async function releaseForBuild(progress, path, key, build, deadline) {
42761
42824
  await pause(path, key, "release", deadline);
42762
42825
  }
42763
42826
  }
42764
- /** A deploy is a request; only the release the deployment reports as running means the application is serving. */
42827
+ /**
42828
+ * Only the release the deployment reports as running means the application is serving. A release the platform left
42829
+ * ready with no recorded deploy — a newer one was deployed meanwhile — will not move on its own, so it is refused
42830
+ * with the command that deploys it.
42831
+ */
42765
42832
  async function awaitRelease(progress, path, key, releaseUuid, deadline) {
42766
42833
  for (;;) {
42767
- const running = (await deployment(path)).running;
42834
+ const observed = await deployment(path);
42835
+ const running = observed.running;
42768
42836
  if (running !== null && running.uuid === releaseUuid && running.isRunning) {
42769
42837
  progress.report(`${key}: release ${releaseUuid} ${running.status}, serving`);
42770
42838
  return running;
42771
42839
  }
42772
- progress.report(`${key}: release ${releaseUuid} ${running === null ? "not running yet" : `waiting (${running.status} of ${running.uuid})`}`);
42840
+ const release = observed.releases.find((one) => one.uuid === releaseUuid);
42841
+ const build = observed.builds.find((one) => one.uuid === release?.buildUuid);
42842
+ if (release?.status === "ready" && build?.deployMode === "candidate") throw new ApiError(422, `Release ${releaseUuid} of application ${key} is built but was not deployed. Deploy it with \`hostingctl application deploy ${path.environmentUuid} ${path.workloadUuid} ${releaseUuid} --company <slug> --confirm\`.`);
42843
+ progress.report(`${key}: release ${releaseUuid} ${release?.deployWaiting === true ? "will deploy when the current change finishes" : running === null ? "not running yet" : `waiting (${running.status} of ${running.uuid})`}`);
42773
42844
  await pause(path, key, "release", deadline);
42774
42845
  }
42775
42846
  }
@@ -42820,7 +42891,7 @@ var WAIT_FLAG_SPECS = [{
42820
42891
  /** The sentence `--wait` adds to the build's description, so a dry run says the deploy will follow. */
42821
42892
  var BUILD_WAIT_DESCRIPTION = "Then wait for it and deploy its release once it succeeds.";
42822
42893
  /**
42823
- * Follow the build `application build --wait` just queued, deploy its release and see it serving.
42894
+ * Follow the build `application build --wait` just queued in `deploy-when-built` mode and see its release serving.
42824
42895
  *
42825
42896
  * The same journey `environment setup` follows after its upload, narrated by the same progress owner; a failed
42826
42897
  * build is refused with the line it failed on first, and every identifier stays readable.
@@ -43081,6 +43152,10 @@ async function build$1(context, path, rest) {
43081
43152
  ...idempotencyKey === null ? {} : { idempotencyKey }
43082
43153
  };
43083
43154
  const wait = context.flags.has("--wait");
43155
+ const requested = wait ? {
43156
+ ...body,
43157
+ deployMode: "deploy-when-built"
43158
+ } : body;
43084
43159
  const deadline = wait ? commandDeadline(context.flags) : 0;
43085
43160
  const outcome = await confirmableWrite(context, [
43086
43161
  `Build application ${path.workloadUuid} from its applied configuration, ${sourceDescription(selection, upload, sshSource)}.`,
@@ -43088,7 +43163,7 @@ async function build$1(context, path, rest) {
43088
43163
  ...wait ? [BUILD_WAIT_DESCRIPTION] : []
43089
43164
  ].join("\n"), async () => (await hostingDeploymentStore({
43090
43165
  path,
43091
- body
43166
+ body: requested
43092
43167
  })).data);
43093
43168
  if (!wait || !outcome.sent) return {
43094
43169
  kind: "build-write",
@@ -43124,10 +43199,63 @@ function applicationBuildText(report) {
43124
43199
  if (report.kind === "build-wait") return buildWaitText(report);
43125
43200
  return report.kind === "build-write" ? writeText$6(report) : logText(report.log);
43126
43201
  }
43202
+ // src/commands/application-cache-rules.ts
43203
+ /** The `cache-set` flags that replace an application's ordered cache rules. */
43204
+ var CACHE_RULE_FLAGS = [{
43205
+ name: "--template",
43206
+ takesValue: true,
43207
+ description: "Replace the cache rules with a starter set: wordpress, static_build or application_headers."
43208
+ }, {
43209
+ name: "--rules-file",
43210
+ takesValue: true,
43211
+ description: "Replace the cache rules with the JSON array of rules this file holds."
43212
+ }];
43213
+ /**
43214
+ * Add the rule replacement `cache-set` was asked for: a starter template by name, or the ordered rules a
43215
+ * JSON file holds. The API validates both exactly as it does the panel's, so nothing here widens what may
43216
+ * be stored.
43217
+ */
43218
+ function addCacheRules(context, body, usage) {
43219
+ const template = context.flags.get("--template")?.trim() ?? "";
43220
+ const rulesFile = context.flags.get("--rules-file")?.trim() ?? "";
43221
+ if (template !== "" && rulesFile !== "") throw new UsageError(`cache-set takes --template or --rules-file, not both.\n\n${usage}`);
43222
+ if (template !== "") body.template = template;
43223
+ if (rulesFile !== "") body.rules = rulesFrom(rulesFile);
43224
+ }
43225
+ /** The ordered rules a `--rules-file` holds: a JSON array the API validates rule by rule. */
43226
+ function rulesFrom(file) {
43227
+ let parsed;
43228
+ try {
43229
+ parsed = JSON.parse(readFileSync(file, "utf8"));
43230
+ } catch (error) {
43231
+ throw new UsageError(`--rules-file ${file} is not readable JSON: ${error.message}`);
43232
+ }
43233
+ if (!Array.isArray(parsed)) throw new UsageError(`--rules-file ${file} must hold a JSON array of rules.`);
43234
+ return parsed;
43235
+ }
43236
+ /**
43237
+ * The named fields laid over the application's current settings.
43238
+ *
43239
+ * The API's update replaces the whole setting: an absent `enabled` is false and absent rules are none. So a
43240
+ * `cache-set` that named only `--fresh` used to switch the cache off and drop its rules (2026-11-13, on a
43241
+ * production WordPress site). Every unnamed field is now sent with the value it already has; a template or a
43242
+ * reset supplies its own rules, so the current ones are not sent beside it.
43243
+ */
43244
+ function overCurrent(current, named) {
43245
+ const replacesRules = "template" in named || "reset" in named;
43246
+ return {
43247
+ enabled: current.enabled,
43248
+ freshSeconds: current.freshSeconds,
43249
+ backgroundSeconds: current.backgroundSeconds,
43250
+ browserMaxAgeSeconds: current.browserMaxAgeSeconds,
43251
+ ...replacesRules ? {} : { rules: current.rules },
43252
+ ...named
43253
+ };
43254
+ }
43127
43255
  // src/commands/application-cache.ts
43128
43256
  var USAGE$50 = [
43129
43257
  "Usage: hostingctl application cache <environment-uuid> <application-uuid> --company <slug>",
43130
- " hostingctl application cache-set <environment-uuid> <application-uuid> --company <slug> [--enabled <on|off>] [--fresh <s>] [--background <s>] [--browser <s>] [--reset <on|off>]",
43258
+ " hostingctl application cache-set <environment-uuid> <application-uuid> --company <slug> [--enabled <on|off>] [--fresh <s>] [--background <s>] [--browser <s>] [--reset <on|off>] [--template <id> | --rules-file <rules.json>]",
43131
43259
  " hostingctl application cache-purge <environment-uuid> <application-uuid> --company <slug>",
43132
43260
  " hostingctl application routes <environment-uuid> --company <slug>",
43133
43261
  " hostingctl application route-add <environment-uuid> --company <slug> --source <uuid> --target <uuid> --path <path> [--domain <uuid>] [--canonical <on|off>]",
@@ -43135,7 +43263,9 @@ var USAGE$50 = [
43135
43263
  " hostingctl application route-remove <environment-uuid> <route-uuid> --company <slug>",
43136
43264
  "",
43137
43265
  " cache The application's HTTP cache settings as the platform applied them.",
43138
- " cache-set Change one or more of them. Only the fields named are sent.",
43266
+ " cache-set Change one or more of them. Only the fields named are sent. --template replaces the",
43267
+ " rules with a starter set (wordpress, static_build, application_headers); --rules-file",
43268
+ " replaces them with a JSON array of rules ({label, match, path, action, ...}), as the panel sends.",
43139
43269
  " cache-purge Clear the cache now.",
43140
43270
  " routes The environment's path routes between applications.",
43141
43271
  " route-add Route one path from an application to another.",
@@ -43156,10 +43286,13 @@ async function applicationCache(context, action, path, rest) {
43156
43286
  }));
43157
43287
  if (action === "cache-set") {
43158
43288
  const body = cacheBody(context);
43159
- return await written$6(confirmableWrite(context, `Change this application's cache: ${Object.keys(body).join(", ") || "nothing named"}.`, async () => (await hostingApplicationCacheUpdate({
43160
- path,
43161
- body
43162
- })).data));
43289
+ return await written$6(confirmableWrite(context, `Change this application's cache: ${Object.keys(body).join(", ") || "nothing named"}.`, async () => {
43290
+ const current = (await hostingApplicationCacheShow({ path })).data.settings;
43291
+ return (await hostingApplicationCacheUpdate({
43292
+ path,
43293
+ body: overCurrent(current, body)
43294
+ })).data;
43295
+ }));
43163
43296
  }
43164
43297
  if (action === "canonical") {
43165
43298
  const routeUuid = context.flags.get("--route") ?? "";
@@ -43245,6 +43378,7 @@ function cacheBody(context) {
43245
43378
  if (!Number.isInteger(value) || value < 0) throw new UsageError(`${flag} must be a whole number of seconds.\n\n${USAGE$50}`);
43246
43379
  body[field] = value;
43247
43380
  }
43381
+ addCacheRules(context, body, USAGE$50);
43248
43382
  if (Object.keys(body).length === 0) throw new UsageError(`cache-set needs at least one field.\n\n${USAGE$50}`);
43249
43383
  return body;
43250
43384
  }
@@ -44812,7 +44946,8 @@ var APPLICATION_METADATA = {
44812
44946
  description: "The version line `runtime-version` moves the application onto."
44813
44947
  },
44814
44948
  ...CREATE_FLAGS,
44815
- ...COMPONENT_SETTINGS_FLAGS
44949
+ ...COMPONENT_SETTINGS_FLAGS,
44950
+ ...CACHE_RULE_FLAGS
44816
44951
  ],
44817
44952
  subcommands: [
44818
44953
  "public-key",
@@ -45570,7 +45705,11 @@ function writeAnyResultText(result) {
45570
45705
  function writeResultText$1(result) {
45571
45706
  if ("failureStage" in result) return buildText(result);
45572
45707
  if ("releaseUuid" in result) return prepareImageText(result);
45573
- if ("imageDigest" in result) return [` release ${result.uuid} ${result.status} running ${result.isRunning ? "yes" : "no"}`, ...imageProvenanceText(result)].join("\n");
45708
+ if ("imageDigest" in result) return [
45709
+ ` release ${result.uuid} ${result.status} running ${result.isRunning ? "yes" : "no"}`,
45710
+ ...result.deployWaiting ? [" will deploy when the current change finishes"] : [],
45711
+ ...imageProvenanceText(result)
45712
+ ].join("\n");
45574
45713
  if ("runToken" in result) return ` ${result.message}`;
45575
45714
  if ("statusName" in result) return ` removal ${result.uuid} ${result.statusName} open ${result.isOpen ? "yes" : "no"}`;
45576
45715
  return applicationDetailText(result);
@@ -52636,6 +52775,40 @@ function environmentAdminText(report) {
52636
52775
  if (report.kind === "database") return databaseText$1(report.database);
52637
52776
  return tuningText(report.tuning);
52638
52777
  }
52778
+ // src/commands/environment-budget.ts
52779
+ var BUDGET_USAGE = [
52780
+ "Usage: hostingctl environment budget <environment-uuid> --company <slug> [--json]",
52781
+ "",
52782
+ " budget What each reservation inside the purchase holds — the shared Pod, each application with Pods of",
52783
+ " its own, each database server — beside what it used over the last two weeks, and a suggested",
52784
+ " size read from two full weeks of measurements.",
52785
+ "",
52786
+ "A reservation without two full weeks of readings says so instead of suggesting anything. Nothing here",
52787
+ "changes a size, so no --confirm is needed."
52788
+ ].join("\n");
52789
+ /** `environment budget <uuid>`: the purchase split into its reservations, each beside its measured use. */
52790
+ async function environmentBudget(context, rest) {
52791
+ const [uuid, ...extra] = rest;
52792
+ if (uuid === void 0 || extra.length > 0) throw new UsageError(BUDGET_USAGE);
52793
+ return (await hostingEnvironmentsBudget({ path: {
52794
+ company: await requireCompany(context.flags),
52795
+ environmentUuid: uuid
52796
+ } })).data;
52797
+ }
52798
+ /** One block per reservation: what it reserves, what it used, and the suggestion in the API's own words. */
52799
+ function budgetText$1(view) {
52800
+ return [`Bought ${view.purchase.cpuRequestMillicores}m CPU and ${view.purchase.memoryRequestMib} MiB memory; use read over ${view.windowDays} days.`, ...view.members.map(memberText)].join("\n");
52801
+ }
52802
+ function memberText(member) {
52803
+ const pods = member.replicas > 1 ? ` (${member.replicas} Pods)` : "";
52804
+ const used = member.used === null ? "not measured" : `${member.used.cpuP95Millicores}m CPU at the 95th percentile, ${member.used.memoryMaxMib} MiB peak`;
52805
+ const sized = member.suggestion.cpuRequestMillicores === null || member.suggestion.memoryMib === null ? "" : ` -> ${member.suggestion.cpuRequestMillicores}m CPU, ${member.suggestion.memoryMib} MiB`;
52806
+ return [
52807
+ ` ${member.name} [${member.kind}]${pods}`,
52808
+ ` reserved ${member.reserved.cpuRequestMillicores}m CPU, ${member.reserved.memoryRequestMib} MiB; used ${used}`,
52809
+ ` ${member.suggestion.outcome}${sized}: ${member.suggestion.reason}`
52810
+ ].join("\n");
52811
+ }
52639
52812
  // src/commands/environment-cache.ts
52640
52813
  /** The starting patterns the API resolves into ordinary rules, as the panel names them. */
52641
52814
  var TEMPLATES = [
@@ -53831,6 +54004,69 @@ function environmentExportText(report) {
53831
54004
  }
53832
54005
  return `release ${report.releaseUuid}:\n${JSON.stringify(report.bundle, null, 2)}`;
53833
54006
  }
54007
+ // src/commands/environment-mail-relay.ts
54008
+ var MAIL_RELAY_USAGE = [
54009
+ "Usage: hostingctl environment mail-relay-test <environment-uuid> --company <slug> --to <address>",
54010
+ "",
54011
+ " Send one test message through the environment's mail relay, from inside the environment, and print every",
54012
+ " step — settings, DNS, connect, TLS, greeting, sign-in, sender, recipient, message — with the server's own",
54013
+ " answer and the SMTP conversation. It stops at the first step that fails. Sign-in details are redacted and",
54014
+ " the address is used for this test only. Accepted by the relay is not delivered: check the inbox.",
54015
+ "",
54016
+ "Needs --confirm, because it sends a real message; --dry-run describes it without sending."
54017
+ ].join("\n");
54018
+ /** How long to follow a running test: the Job's own 90-second deadline plus the time to start and read it. */
54019
+ var WAIT_SECONDS = 180;
54020
+ var POLL_MILLISECONDS = 2e3;
54021
+ /** `--to`: the one address the test message goes to. */
54022
+ function recipientFlag(context) {
54023
+ const recipient = context.flags.get("--to")?.trim() ?? "";
54024
+ if (recipient === "") throw new UsageError(`--to is required.\n\n${MAIL_RELAY_USAGE}`);
54025
+ return recipient;
54026
+ }
54027
+ /** Start the test, then read it until it is no longer running or the wait runs out. */
54028
+ async function environmentMailRelayTest(context, rest) {
54029
+ const [environmentUuid, ...extra] = rest;
54030
+ if (extra.length > 0) throw new UsageError(MAIL_RELAY_USAGE);
54031
+ const path = await environmentPath(context, environmentUuid, MAIL_RELAY_USAGE);
54032
+ const recipient = recipientFlag(context);
54033
+ return {
54034
+ kind: "mail-relay-test",
54035
+ outcome: await confirmableWrite(context, `send one test message through the mail relay of environment ${path.environmentUuid}`, async () => {
54036
+ let result = (await hostingMailRelayDiagnosisStart({
54037
+ path,
54038
+ body: { recipient }
54039
+ })).data;
54040
+ const deadline = Date.now() + WAIT_SECONDS * 1e3;
54041
+ while (result.state === "running" && Date.now() < deadline) {
54042
+ await new Promise((resolve) => setTimeout(resolve, POLL_MILLISECONDS));
54043
+ result = (await hostingMailRelayDiagnosisShow({ path: {
54044
+ ...path,
54045
+ diagnosisUuid: result.uuid
54046
+ } })).data;
54047
+ }
54048
+ return result;
54049
+ })
54050
+ };
54051
+ }
54052
+ /** The verdict, each step with its status and words, then the conversation with the server. */
54053
+ function diagnosisText(result) {
54054
+ const lines = [`mail relay test ${{
54055
+ running: `still running after ${String(WAIT_SECONDS)}s; read it again with the web panel (test ${result.uuid})`,
54056
+ passed: "passed: the relay accepted the test message (accepted is not delivered — check the inbox)",
54057
+ failed: "failed: the first failed step below says where and why",
54058
+ unavailable: "unavailable: the test did not report, so nothing is known about the relay"
54059
+ }[result.state]}`];
54060
+ for (const step of result.steps) lines.push(` ${step.step.padEnd(13)} ${step.status.padEnd(11)} ${step.detail}`.trimEnd());
54061
+ if (result.transcript.length > 0) {
54062
+ lines.push(" conversation");
54063
+ for (const line of result.transcript) lines.push(` ${line.direction === "client" ? "->" : "<-"} ${line.text}`);
54064
+ }
54065
+ return lines.join("\n");
54066
+ }
54067
+ function environmentMailRelayText(report) {
54068
+ return renderWriteOutcome(report.outcome, diagnosisText);
54069
+ }
53834
54070
  // src/commands/environment-runtime-version-grants.ts
53835
54071
  /**
53836
54072
  * The flags this command reads, declared beside it so the metadata owner spreads one list rather than
@@ -54018,11 +54254,13 @@ var ENVIRONMENT_SUBCOMMANDS = [
54018
54254
  "portable",
54019
54255
  "configuration",
54020
54256
  "secret",
54257
+ "mail-relay-test",
54021
54258
  "databases",
54022
54259
  "database",
54023
54260
  "component-version",
54024
54261
  "references",
54025
54262
  "storage-usage",
54263
+ "budget",
54026
54264
  "storage-journal",
54027
54265
  "runtime-versions",
54028
54266
  "runtime-version-grants",
@@ -54085,10 +54323,12 @@ var ENVIRONMENT_USAGE = [
54085
54323
  " hostingctl environment configuration <show|preview|save|apply> <uuid> --company <slug> [--file <path>]",
54086
54324
  " [--wait]",
54087
54325
  " hostingctl environment secret <write|import|local> <uuid> --company <slug> …",
54326
+ " hostingctl environment mail-relay-test <uuid> --company <slug> --to <address>",
54088
54327
  " hostingctl environment databases|database <uuid> … --company <slug>",
54089
54328
  " hostingctl environment component-version <uuid> <workload-uuid> <version> --company <slug>",
54090
54329
  " hostingctl environment references <uuid> --company <slug>",
54091
54330
  " hostingctl environment storage-usage <uuid> --company <slug>",
54331
+ " hostingctl environment budget <uuid> --company <slug>",
54092
54332
  " hostingctl environment storage-journal <uuid> --company <slug>",
54093
54333
  " hostingctl environment runtime-versions --company <slug>",
54094
54334
  " hostingctl environment site-insights[-verify|-audit|-fix] <uuid> --company <slug> [--site <site-uuid>]",
@@ -54120,6 +54360,8 @@ var ENVIRONMENT_USAGE = [
54120
54360
  " generation it queued until the environment reports it applied, then reports that status.",
54121
54361
  " secret Set declared configuration secret values through the write-only control, or write the",
54122
54362
  " declarations' local development values for a local run.",
54363
+ " mail-relay-test Send one test message through the site's mail relay and print every step and the",
54364
+ " server's answers, stopping where it fails.",
54123
54365
  " databases List the environment-owned databases, declare one, replace who may consume it, or retire",
54124
54366
  " one while retaining its data and its backups.",
54125
54367
  " component-version Move one curated component instance to another version this platform pins an image for.",
@@ -54128,6 +54370,8 @@ var ENVIRONMENT_USAGE = [
54128
54370
  " in `field`, and a credential field is marked rather than valued.",
54129
54371
  " storage-usage What each volume was allocated, what it has written and what room is left, from the",
54130
54372
  " platform's own reading; a volume it could not read says so instead of reporting zero.",
54373
+ " budget Each reservation inside the purchase beside what it used over two weeks, with a suggested",
54374
+ " size; a reservation without two full weeks of readings says so instead of suggesting one.",
54131
54375
  " storage-journal The disposal rows this environment recorded: which claim was captured, how far its",
54132
54376
  " reclaim got, and the reason a pass refused to continue. Recorded rows only, never a",
54133
54377
  " live reading, and nothing in it makes a volume disposable.",
@@ -54138,7 +54382,7 @@ var ENVIRONMENT_USAGE = [
54138
54382
  "",
54139
54383
  "The writes (create, setup, reconcile, scale, component-version, object-cache-set, site-insights-verify/audit/fix,",
54140
54384
  "portable prepare/confirm, configuration save/apply,",
54141
- "secret write/import, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
54385
+ "secret write/import, mail-relay-test, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
54142
54386
  "",
54143
54387
  "`secret local` is the one exception and is a read: it writes each declaration's local development value - a",
54144
54388
  "development default such as `password`, not a credential - into an env file for a local run, names the declared",
@@ -54867,6 +55111,10 @@ var ENVIRONMENT_TOPICS = [
54867
55111
  path: ["secret"],
54868
55112
  usage: SECRETS_USAGE
54869
55113
  },
55114
+ {
55115
+ path: ["mail-relay-test"],
55116
+ usage: MAIL_RELAY_USAGE
55117
+ },
54870
55118
  {
54871
55119
  path: ["databases"],
54872
55120
  usage: DATABASES_USAGE
@@ -55107,6 +55355,11 @@ var ENVIRONMENT_METADATA = {
55107
55355
  takesValue: false,
55108
55356
  description: "Confirm moving the environment's configuration source between its repository file and this document."
55109
55357
  },
55358
+ {
55359
+ name: "--to",
55360
+ takesValue: true,
55361
+ description: "The address `mail-relay-test` sends its one test message to."
55362
+ },
55110
55363
  {
55111
55364
  name: "--wait",
55112
55365
  takesValue: false,
@@ -55865,6 +56118,7 @@ function environmentTaggedText(report) {
55865
56118
  if (report.kind === "service-addition" || report.kind === "service-retirement" || report.kind === "service-write") return environmentServicesText(report);
55866
56119
  if (report.kind === "site-insights" || report.kind === "site-insights-write") return environmentSiteInsightsText(report);
55867
56120
  if (report.kind === "storage-journal") return storageJournalText(report.journal);
56121
+ if (report.kind === "mail-relay-test") return environmentMailRelayText(report);
55868
56122
  return environmentAdminText(report);
55869
56123
  }
55870
56124
  // src/commands/environment-text-cache.ts
@@ -55875,16 +56129,17 @@ function cacheEnablementText(enablement) {
55875
56129
  }
55876
56130
  // src/commands/environment-text.ts
55877
56131
  /**
55878
- * The two answers that describe what an environment may reference or hold.
56132
+ * The three readings of what an environment may reference, holds on disk, and uses of its purchase.
55879
56133
  *
55880
- * A user-defined guard keeps the parent renderer's branch count where it was — one decision rather than two — and
56134
+ * A user-defined guard keeps the parent renderer's branch count where it was — one decision rather than three — and
55881
56135
  * still narrows the union, so the default branch below keeps its own type.
55882
56136
  */
55883
- function isReferenceOrUsage(report) {
55884
- return "producers" in report || "rows" in report;
56137
+ function isReading(report) {
56138
+ return "producers" in report || "rows" in report || "windowDays" in report;
55885
56139
  }
55886
- /** Render whichever of the two projections this answer is. */
55887
- function referenceOrUsageText(report) {
56140
+ /** Render whichever of the three readings this answer is. */
56141
+ function readingText(report) {
56142
+ if ("windowDays" in report) return budgetText$1(report);
55888
56143
  return "producers" in report ? referenceDirectoryText(report) : storageUsageText(report);
55889
56144
  }
55890
56145
  /** The tagged answers. A cache change carries an outcome rather than a payload, so it renders as a write. */
@@ -55903,7 +56158,7 @@ function taggedReportText(report) {
55903
56158
  function environmentText(report) {
55904
56159
  if ("kind" in report) return taggedReportText(report);
55905
56160
  if ("sent" in report) return writeText$2(report);
55906
- if (isReferenceOrUsage(report)) return referenceOrUsageText(report);
56161
+ if (isReading(report)) return readingText(report);
55907
56162
  if ("configuration" in report) return configurationPreviewText(report);
55908
56163
  if ("canManage" in report && "revision" in report) return configurationPageText(report);
55909
56164
  if ("canManage" in report && "databases" in report) return databasePageText(report);
@@ -63434,7 +63689,7 @@ var hostingFinalCopyOrderEnumSchema = _enum(["best-effort", "stop-on-failure"]).
63434
63689
  var createHostingCancellationRequestSchema = object({
63435
63690
  reason: string().min(4).max(2e3),
63436
63691
  reviewGeneration: int().min(1),
63437
- effectiveAt: datetime(),
63692
+ effectiveAt: datetime().optional().describe("\"Now\" ends service at the confirmation, so it has no date to agree and the recorder ignores one."),
63438
63693
  accepted: boolean().describe("`boolean` rather than `accepted`, for the reason recorded on\nResetHostingAdministratorPasswordRequest: the accepted rule's value set is\ninferred into the generated client as an enum OpenAPI cannot express.\n\"Must be true\" is asserted in HostingCancellationService, the single writer of\na cancellation row, so a direct caller cannot skip it either."),
63439
63694
  deletionAcknowledged: boolean().optional().describe("The destructive choice carries its own acknowledgement, checked authoritatively by the\nrecorder; the boundary only has to accept the field."),
63440
63695
  liveStorageDisposalAcknowledged: boolean().optional().describe("Irreversible live-storage removal is its own confirmation, checked authoritatively by the\nrecorder; the boundary only has to accept the field. An older client that omits it records\nno consent, and that episode is refused at approval rather than granted the newer meaning."),
@@ -63911,6 +64166,7 @@ var domainDataSchema = object({
63911
64166
  hostname: string(),
63912
64167
  status: string(),
63913
64168
  statusName: string(),
64169
+ verifiedThrough: string().nullable(),
63914
64170
  proofCurrent: boolean(),
63915
64171
  verifiedAt: string().nullable(),
63916
64172
  lastCheckedAt: string().nullable(),
@@ -65387,6 +65643,11 @@ var hostingBudgetDataSchema = object({
65387
65643
  storageLimitMib: int(),
65388
65644
  toolsCpuLimitMillicores: int().nullable().describe("Deprecated compatibility field. The retired override always reports null.")
65389
65645
  });
65646
+ var hostingBudgetMemberKindEnumSchema = _enum([
65647
+ "shared-pod",
65648
+ "application",
65649
+ "database"
65650
+ ]).describe("What one row of an environment's budget view reserves for: the shared Pod, an application with Pods of its own, or a database server the purchase funds. Closed, because the view lists exactly these three kinds of reservation.\n");
65390
65651
  var hostingFailureCauseEnumSchema = _enum([
65391
65652
  "source-not-reachable",
65392
65653
  "commit-not-found",
@@ -65411,6 +65672,7 @@ var hostingFailureExplanationDataSchema = object({
65411
65672
  nextAction: string().nullable(),
65412
65673
  retryable: boolean()
65413
65674
  });
65675
+ var hostingBuildDeployModeEnumSchema = _enum(["candidate", "deploy-when-built"]).describe("What a person asked to happen once their build succeeds. `candidate` leaves the release for a deliberate Deploy. `deploy-when-built` is a recorded intent: the backend promotes and deploys the release as the person who asked, so leaving the page during the build changes nothing. It is the person's own request, separate from a branch push's automatic-deployment consent, so an update pause (which governs pushes) does not refuse it.\n");
65414
65676
  var hostingBuildDataSchema = object({
65415
65677
  uuid: string(),
65416
65678
  attempt: int(),
@@ -65429,7 +65691,8 @@ var hostingBuildDataSchema = object({
65429
65691
  queuedAt: string().nullable(),
65430
65692
  startedAt: string().nullable(),
65431
65693
  finishedAt: string().nullable(),
65432
- explanation: union([hostingFailureExplanationDataSchema, _null()])
65694
+ explanation: union([hostingFailureExplanationDataSchema, _null()]),
65695
+ deployMode: hostingBuildDeployModeEnumSchema.describe("What the person asked to happen once this attempt succeeds: a candidate, or a deploy as them.")
65433
65696
  });
65434
65697
  var hostingBuildErrorDataSchema = object({
65435
65698
  step: string(),
@@ -66340,7 +66603,8 @@ var hostingReleaseDataSchema = object({
66340
66603
  sourceCommitSha: string().nullable(),
66341
66604
  sourceBranch: string().nullable(),
66342
66605
  bundleDownloadUrl: string().nullable(),
66343
- image: union([hostingReleaseImageDataSchema, _null()])
66606
+ image: union([hostingReleaseImageDataSchema, _null()]),
66607
+ deployWaiting: boolean().describe("Whether a person's deploy of this ready release is recorded and waits for the environment's current\nchange to finish. The page says \"will deploy when the current change finishes\" instead of offering a\nDeploy that would only be asked again.")
66344
66608
  });
66345
66609
  var hostingRepositorySelectionDataSchema = object({
66346
66610
  uuid: string(),
@@ -66466,6 +66730,38 @@ object({
66466
66730
  checkedAt: string(),
66467
66731
  routingVerifiedAt: string().nullable()
66468
66732
  });
66733
+ var hostingMeasuredUseDataSchema = object({
66734
+ cpuP95Millicores: int(),
66735
+ cpuMaxMillicores: int(),
66736
+ memoryP95Mib: int(),
66737
+ memoryMaxMib: int(),
66738
+ measuredHours: int()
66739
+ });
66740
+ var hostingRightSizingSuggestionDataSchema = object({
66741
+ outcome: _enum([
66742
+ "smaller",
66743
+ "keep",
66744
+ "larger",
66745
+ "unmeasured"
66746
+ ]).describe("What two weeks of measured use suggest for one reservation. `unmeasured` is not a verdict: it says there were not two full weeks of measurements to suggest from, and the suggestion's reason says what was missing. It is never read as \"the size is right\".\n").describe("What two weeks of measured use suggest for one reservation. `unmeasured` is not a verdict: it says there were not two full weeks of measurements to suggest from, and the suggestion's reason says what was missing. It is never read as \"the size is right\".\n"),
66747
+ reason: string(),
66748
+ cpuRequestMillicores: int().nullable(),
66749
+ memoryMib: int().nullable()
66750
+ });
66751
+ var hostingEnvironmentBudgetMemberDataSchema = object({
66752
+ kind: hostingBudgetMemberKindEnumSchema.describe("What one row of an environment's budget view reserves for: the shared Pod, an application with Pods of its own, or a database server the purchase funds. Closed, because the view lists exactly these three kinds of reservation.\n"),
66753
+ name: string(),
66754
+ workloadUuid: string().nullable(),
66755
+ replicas: int(),
66756
+ reserved: hostingResourceDataSchema,
66757
+ used: union([hostingMeasuredUseDataSchema, _null()]),
66758
+ suggestion: hostingRightSizingSuggestionDataSchema
66759
+ });
66760
+ object({
66761
+ purchase: hostingResourceDataSchema,
66762
+ windowDays: int(),
66763
+ members: array(hostingEnvironmentBudgetMemberDataSchema)
66764
+ });
66469
66765
  var hostingWorkloadRuntimeSecretDataSchema = object({
66470
66766
  key: string(),
66471
66767
  required: boolean(),
@@ -66779,6 +67075,46 @@ object({
66779
67075
  maximumReuseSeconds: int(),
66780
67076
  capabilities: hostingHttpCacheCapabilitiesDataSchema
66781
67077
  });
67078
+ var hostingMailRelayDiagnosisStateEnumSchema = _enum([
67079
+ "running",
67080
+ "passed",
67081
+ "failed",
67082
+ "unavailable"
67083
+ ]).describe("Where one mail relay diagnosis stands. `passed` means the relay accepted the test message, never that it was delivered.\n| |\n|---|\n| `running` <br/> The test is running in the environment. |\n| `passed` <br/> Every step passed: the relay accepted the test message for delivery. |\n| `failed` <br/> A step failed; the steps name which one and why. |\n| `unavailable` <br/> The test could not run or report at all, so nothing is known about the relay. |");
67084
+ var hostingMailRelayDiagnosisStepEnumSchema = _enum([
67085
+ "configuration",
67086
+ "dns",
67087
+ "connect",
67088
+ "tls",
67089
+ "greeting",
67090
+ "auth",
67091
+ "sender",
67092
+ "recipient",
67093
+ "message"
67094
+ ]).describe("One step of a mail relay diagnosis, in the order a real send takes them. The order is the canonical display order; on a STARTTLS port the server's greeting is read before TLS, and the result lists the steps in the order the run actually took them.\n| |\n|---|\n| `configuration` <br/> The five relay values are rendered for the site and the test recipient is an address. |\n| `dns` <br/> The relay host resolves from the environment's network. |\n| `connect` <br/> The relay port accepts a TCP connection from the environment's network. |\n| `tls` <br/> TLS is negotiated, implicitly on 465 or with STARTTLS, with a certificate valid for the host. |\n| `greeting` <br/> The server greets and answers EHLO with the sign-in methods it offers. |\n| `auth` <br/> The relay's username and password are accepted. |\n| `sender` <br/> The relay accepts the configured From address as the sender. |\n| `recipient` <br/> The relay accepts the test recipient. |\n| `message` <br/> The relay accepts the test message for delivery. |");
67095
+ var hostingMailRelayDiagnosisStepStatusEnumSchema = _enum([
67096
+ "passed",
67097
+ "failed",
67098
+ "not_reached"
67099
+ ]).describe("What happened at one diagnosis step.\n| |\n|---|\n| `passed` <br/> |\n| `failed` <br/> |\n| `not_reached` <br/> An earlier step failed, so this one was never tried. |");
67100
+ var hostingMailRelayDiagnosisStepDataSchema = object({
67101
+ step: hostingMailRelayDiagnosisStepEnumSchema.describe("One step of a mail relay diagnosis, in the order a real send takes them. The order is the canonical display order; on a STARTTLS port the server's greeting is read before TLS, and the result lists the steps in the order the run actually took them.\n| |\n|---|\n| `configuration` <br/> The five relay values are rendered for the site and the test recipient is an address. |\n| `dns` <br/> The relay host resolves from the environment's network. |\n| `connect` <br/> The relay port accepts a TCP connection from the environment's network. |\n| `tls` <br/> TLS is negotiated, implicitly on 465 or with STARTTLS, with a certificate valid for the host. |\n| `greeting` <br/> The server greets and answers EHLO with the sign-in methods it offers. |\n| `auth` <br/> The relay's username and password are accepted. |\n| `sender` <br/> The relay accepts the configured From address as the sender. |\n| `recipient` <br/> The relay accepts the test recipient. |\n| `message` <br/> The relay accepts the test message for delivery. |"),
67102
+ status: hostingMailRelayDiagnosisStepStatusEnumSchema.describe("What happened at one diagnosis step.\n| |\n|---|\n| `passed` <br/> |\n| `failed` <br/> |\n| `not_reached` <br/> An earlier step failed, so this one was never tried. |"),
67103
+ detail: string().describe("What was found, in words, with the server's own answer when it refused. Never a credential.")
67104
+ });
67105
+ var hostingMailRelayDiagnosisLineDataSchema = object({
67106
+ direction: _enum(["client", "server"]).describe("Who said one line of the SMTP conversation.\n| |\n|---|\n| `client` <br/> The environment, speaking to the relay. |\n| `server` <br/> The relay's answer. |").describe("Who said one line of the SMTP conversation.\n| |\n|---|\n| `client` <br/> The environment, speaking to the relay. |\n| `server` <br/> The relay's answer. |"),
67107
+ text: string()
67108
+ });
67109
+ object({
67110
+ uuid: string(),
67111
+ environmentUuid: string(),
67112
+ state: hostingMailRelayDiagnosisStateEnumSchema.describe("Where one mail relay diagnosis stands. `passed` means the relay accepted the test message, never that it was delivered.\n| |\n|---|\n| `running` <br/> The test is running in the environment. |\n| `passed` <br/> Every step passed: the relay accepted the test message for delivery. |\n| `failed` <br/> A step failed; the steps name which one and why. |\n| `unavailable` <br/> The test could not run or report at all, so nothing is known about the relay. |"),
67113
+ steps: array(hostingMailRelayDiagnosisStepDataSchema).describe("Every step in the order it ran, then the ones a failure left `not_reached`. Empty while running."),
67114
+ transcript: array(hostingMailRelayDiagnosisLineDataSchema),
67115
+ startedAt: string(),
67116
+ finishedAt: string().nullable()
67117
+ });
66782
67118
  var hostingNodeMoveReviewDataSchema = object({
66783
67119
  sourceEnvironmentUuid: string(),
66784
67120
  destinationEnvironmentUuid: string(),
@@ -68926,8 +69262,9 @@ var requestHostingBuildRequestSchema = object({
68926
69262
  repositorySelectionUuid: uuid().nullish().describe("Exactly one source may be named. A repository selection and an upload are the two a request\nmay choose directly; an SSH source is usually the application's binding and is named only to\nbuild from a connection that is not the bound one."),
68927
69263
  sourceUploadUuid: uuid().nullish(),
68928
69264
  sshSourceUuid: uuid().nullish(),
68929
- idempotencyKey: string().max(128).nullish()
68930
- }).describe("A request to build an application's applied configuration.\n\nNothing here names a commit, an image or a recipe: the source is whichever of the three source kinds\nthe caller names, resolved to an exact identity by that kind's own owner, and the rest comes from the\napplied configuration. A caller cannot ask for a build of something the environment did not declare.\n\nNaming more than one source is refused by the deployment owner rather than here, because \"which one\n * would be used\" is a rule about the build rather than about a field's shape.\n\n`idempotencyKey` is optional. Supplying one makes a repeated request resolve to the attempt that\nalready exists — useful for a retried HTTP call — while omitting it means a deliberate new\nattempt, which is what a second deploy actually is.");
69265
+ idempotencyKey: string().max(128).nullish(),
69266
+ deployMode: union([hostingBuildDeployModeEnumSchema, _null()]).optional()
69267
+ }).describe("A request to build an application's applied configuration.\n\nNothing here names a commit, an image or a recipe: the source is whichever of the three source kinds\nthe caller names, resolved to an exact identity by that kind's own owner, and the rest comes from the\napplied configuration. A caller cannot ask for a build of something the environment did not declare.\n\nNaming more than one source is refused by the deployment owner rather than here, because \"which one\n * would be used\" is a rule about the build rather than about a field's shape.\n\n`idempotencyKey` is optional. Supplying one makes a repeated request resolve to the attempt that\nalready exists — useful for a retried HTTP call — while omitting it means a deliberate new\nattempt, which is what a second deploy actually is.\n\n`deployMode` is what happens once the build succeeds: `candidate` (the default) leaves the release for\nDeploy, and `deploy-when-built` records the caller's deploy so the backend carries it out even if the\ncaller goes away.");
68931
69268
  var requestHostingDatabaseRetirementRequestSchema = object({
68932
69269
  confirmation: string().min(64).max(64),
68933
69270
  desiredGeneration: int().min(0),
@@ -69144,6 +69481,7 @@ var startGitHubConnectionRequestSchema = object({
69144
69481
  connectionUuid: uuid().optional(),
69145
69482
  accountLogin: string().max(39).regex(/^[A-Za-z\d]+(?:-[A-Za-z\d]+)*$/).optional()
69146
69483
  });
69484
+ object({ recipient: email().max(254).describe("Where the one test message goes. Used for this send only and never stored.") });
69147
69485
  var startImpersonationRequestSchema = object({
69148
69486
  targetUuid: uuid(),
69149
69487
  company: string().max(64),
@@ -72248,7 +72586,7 @@ union([
72248
72586
  messageDataSchema,
72249
72587
  hostingRefusalDataSchema
72250
72588
  ]);
72251
- requestHostingBuildRequestSchema.optional().describe("A request to build an application's applied configuration.\n\nNothing here names a commit, an image or a recipe: the source is whichever of the three source kinds\nthe caller names, resolved to an exact identity by that kind's own owner, and the rest comes from the\napplied configuration. A caller cannot ask for a build of something the environment did not declare.\n\nNaming more than one source is refused by the deployment owner rather than here, because \"which one\n * would be used\" is a rule about the build rather than about a field's shape.\n\n`idempotencyKey` is optional. Supplying one makes a repeated request resolve to the attempt that\nalready exists — useful for a retried HTTP call — while omitting it means a deliberate new\nattempt, which is what a second deploy actually is.");
72589
+ requestHostingBuildRequestSchema.optional().describe("A request to build an application's applied configuration.\n\nNothing here names a commit, an image or a recipe: the source is whichever of the three source kinds\nthe caller names, resolved to an exact identity by that kind's own owner, and the rest comes from the\napplied configuration. A caller cannot ask for a build of something the environment did not declare.\n\nNaming more than one source is refused by the deployment owner rather than here, because \"which one\n * would be used\" is a rule about the build rather than about a field's shape.\n\n`idempotencyKey` is optional. Supplying one makes a repeated request resolve to the attempt that\nalready exists — useful for a retried HTTP call — while omitting it means a deliberate new\nattempt, which is what a second deploy actually is.\n\n`deployMode` is what happens once the build succeeds: `candidate` (the default) leaves the release for\nDeploy, and `deploy-when-built` records the caller's deploy so the backend carries it out even if the\ncaller goes away.");
72252
72590
  object({
72253
72591
  company: string(),
72254
72592
  environmentUuid: string(),
@@ -72787,6 +73125,15 @@ object({
72787
73125
  company: string(),
72788
73126
  environmentUuid: string()
72789
73127
  });
73128
+ union([
73129
+ object({ message: string().describe("Error overview.") }),
73130
+ object({ message: string().describe("Error overview.") }),
73131
+ messageDataSchema
73132
+ ]);
73133
+ object({
73134
+ company: string(),
73135
+ environmentUuid: string()
73136
+ });
72790
73137
  union([
72791
73138
  object({ message: string().describe("Error overview.") }),
72792
73139
  object({ message: string().describe("Error overview.") }),
@@ -73058,6 +73405,30 @@ object({
73058
73405
  company: string(),
73059
73406
  environmentUuid: string()
73060
73407
  });
73408
+ union([
73409
+ object({ message: string().describe("Error overview.") }),
73410
+ messageDataSchema,
73411
+ messageDataSchema,
73412
+ messageDataSchema,
73413
+ object({
73414
+ message: string().describe("Errors overview."),
73415
+ errors: record$1(string(), array(string())).describe("A detailed description of each field that failed validation.")
73416
+ })
73417
+ ]);
73418
+ object({
73419
+ company: string(),
73420
+ environmentUuid: string()
73421
+ });
73422
+ union([
73423
+ object({ message: string().describe("Error overview.") }),
73424
+ messageDataSchema,
73425
+ messageDataSchema
73426
+ ]);
73427
+ object({
73428
+ company: string(),
73429
+ environmentUuid: string(),
73430
+ diagnosisUuid: string()
73431
+ });
73061
73432
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
73062
73433
  object({ company: string() });
73063
73434
  union([
@@ -73286,6 +73657,7 @@ union([
73286
73657
  messageDataSchema,
73287
73658
  hostingRefusalDataSchema
73288
73659
  ]);
73660
+ object({ deployMode: union([hostingBuildDeployModeEnumSchema, _null()]).optional() }).optional();
73289
73661
  object({
73290
73662
  company: string(),
73291
73663
  environmentUuid: string(),
@@ -73338,6 +73710,7 @@ object({
73338
73710
  repositoryId: int()
73339
73711
  });
73340
73712
  string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish();
73713
+ string().max(255).nullish();
73341
73714
  union([
73342
73715
  object({ message: string().describe("Error overview.") }),
73343
73716
  object({ message: string().describe("Error overview.") }),
@@ -73348,7 +73721,10 @@ object({
73348
73721
  connectionUuid: string(),
73349
73722
  selectionUuid: string()
73350
73723
  });
73351
- object({ root: string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish() });
73724
+ object({
73725
+ root: string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish(),
73726
+ branch: string().max(255).nullish()
73727
+ });
73352
73728
  var hostingRepositoryConnectionStartStatus200Schema = gitHubConnectionStartDataSchema;
73353
73729
  var hostingRepositoryConnectionStartStatus201Schema = gitHubConnectionStartDataSchema;
73354
73730
  var hostingRepositoryConnectionStartStatus401Schema = object({ message: string().describe("Error overview.") });
@@ -76253,12 +76629,14 @@ var SIMPLE_SUBCOMMANDS = {
76253
76629
  portable,
76254
76630
  configuration,
76255
76631
  secret,
76632
+ "mail-relay-test": environmentMailRelayTest,
76256
76633
  databases,
76257
76634
  database,
76258
76635
  "runtime-versions": environmentRuntimeVersions,
76259
76636
  "runtime-version-grants": environmentRuntimeVersionGrants,
76260
76637
  storage: environmentStorage,
76261
- "storage-journal": environmentStorageJournal
76638
+ "storage-journal": environmentStorageJournal,
76639
+ budget: environmentBudget
76262
76640
  };
76263
76641
  /** Which feature group answers this subcommand and arguments, or null when the command itself does. */
76264
76642
  function dispatched(context, subcommand, rest) {
@@ -76574,6 +76952,7 @@ var LOGS_USAGE = [
76574
76952
  " live The same environment's current container output, as the platform reads it now.",
76575
76953
  "",
76576
76954
  " --application Only one application's output, for environment and live.",
76955
+ " --limit Entries per answer; for live, each container's newest lines.",
76577
76956
  " dns Retained operational DNS events for one owned zone.",
76578
76957
  " mail Retained Postfix delivery attempts for one owned mail domain.",
76579
76958
  "",
@@ -76605,7 +76984,7 @@ var logs = {
76605
76984
  {
76606
76985
  name: "--limit",
76607
76986
  takesValue: true,
76608
- description: "How many entries one answer holds, from 1 to 200."
76987
+ description: "How many entries one answer holds, from 1 to 200; for live, each container's newest lines."
76609
76988
  }
76610
76989
  ],
76611
76990
  subcommands: [
@@ -76626,9 +77005,13 @@ var logs = {
76626
77005
  company,
76627
77006
  environmentUuid: uuid
76628
77007
  } })).data;
76629
- return application === void 0 ? live : {
77008
+ const entries = live.entries.filter((one) => application === void 0 || one.applicationUuid === application).map((one) => query.limit === void 0 ? one : {
77009
+ ...one,
77010
+ lines: one.lines.slice(-query.limit)
77011
+ });
77012
+ return {
76630
77013
  ...live,
76631
- entries: live.entries.filter((one) => one.applicationUuid === application)
77014
+ entries
76632
77015
  };
76633
77016
  }
76634
77017
  if (source === "environment") return (await hostingLogHistoryShow({
@@ -85024,7 +85407,7 @@ function writeUpdateState(state, env = process.env) {
85024
85407
  } catch {}
85025
85408
  }
85026
85409
  // src/version.ts
85027
- var VERSION = "1.0.797";
85410
+ var VERSION = "1.0.808";
85028
85411
  // src/commands/update.ts
85029
85412
  /**
85030
85413
  * `update` — bring this copy of the CLI up to the published version.
@@ -85098,7 +85481,7 @@ var update = {
85098
85481
  }, process.env);
85099
85482
  return {
85100
85483
  ...known,
85101
- current: after ?? "1.0.797",
85484
+ current: after ?? "1.0.808",
85102
85485
  latest: after ?? latest,
85103
85486
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
85104
85487
  action: "run",
@@ -85379,7 +85762,7 @@ async function printUpdateNotice(options) {
85379
85762
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
85380
85763
  } catch {}
85381
85764
  if (latest === null) return;
85382
- if (!isNewerVersion(latest, "1.0.797")) return;
85765
+ if (!isNewerVersion(latest, "1.0.808")) return;
85383
85766
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
85384
85767
  }
85385
85768
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */