@haakco/hostingctl 1.0.797 → 1.0.807

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
  }
@@ -34808,6 +34808,39 @@ function hostingLogShow(options) {
34808
34808
  }));
34809
34809
  }
34810
34810
  /**
34811
+ * {@link /c/:company/hosting/environments/:environmentUuid/mail-relay/diagnoses}
34812
+ */
34813
+ function hostingMailRelayDiagnosisStart(options) {
34814
+ const { client: request = client, ...config } = options;
34815
+ return withUnwrap(request({
34816
+ method: "POST",
34817
+ url: "/c/{company}/hosting/environments/{environmentUuid}/mail-relay/diagnoses",
34818
+ security: [{
34819
+ type: "http",
34820
+ scheme: "bearer"
34821
+ }],
34822
+ contentType: { request: "application/json" },
34823
+ ...config,
34824
+ throwOnError: config.throwOnError ?? true
34825
+ }));
34826
+ }
34827
+ /**
34828
+ * {@link /c/:company/hosting/environments/:environmentUuid/mail-relay/diagnoses/:diagnosisUuid}
34829
+ */
34830
+ function hostingMailRelayDiagnosisShow(options) {
34831
+ const { client: request = client, ...config } = options;
34832
+ return withUnwrap(request({
34833
+ method: "GET",
34834
+ url: "/c/{company}/hosting/environments/{environmentUuid}/mail-relay/diagnoses/{diagnosisUuid}",
34835
+ security: [{
34836
+ type: "http",
34837
+ scheme: "bearer"
34838
+ }],
34839
+ ...config,
34840
+ throwOnError: config.throwOnError ?? true
34841
+ }));
34842
+ }
34843
+ /**
34811
34844
  * {@link /c/:company/hosting/nvme-blocks}
34812
34845
  */
34813
34846
  function hostingNvmeBlocksShow(options) {
@@ -35209,6 +35242,7 @@ function hostingDeploymentRedeploy(options) {
35209
35242
  type: "http",
35210
35243
  scheme: "bearer"
35211
35244
  }],
35245
+ contentType: { request: "application/json" },
35212
35246
  ...config,
35213
35247
  throwOnError: config.throwOnError ?? true
35214
35248
  }));
@@ -40193,7 +40227,7 @@ var AUTH_USAGE = [
40193
40227
  "Usage: hostingctl auth status [--verify] [--profile <name>]",
40194
40228
  " hostingctl auth profiles",
40195
40229
  " hostingctl auth logout [--profile <name>] [--local]",
40196
- " hostingctl auth login --api-url <url> --client-id <id> [--profile <name>] [--no-browser]",
40230
+ " hostingctl auth login [--api-url <url>] [--client-id <id>] [--profile <name>] [--no-browser]",
40197
40231
  " hostingctl auth profile|password|register|forgot-password|reset-password|verify-email …",
40198
40232
  " hostingctl auth closure|picture|notifications …",
40199
40233
  " hostingctl auth impersonate <start|status|stop|list|end> …",
@@ -40427,7 +40461,7 @@ async function authSessions(context, rest) {
40427
40461
  * "which account am I about to act as".
40428
40462
  */
40429
40463
  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");
40464
+ if (report.profiles.length === 0) return [`No sessions on this machine (${report.file}).`, "Sign in with `hostingctl login --profile <name>`."].join("\n");
40431
40465
  const width = Math.max(...report.profiles.map((one) => one.name.length));
40432
40466
  const lines = report.profiles.map((one) => {
40433
40467
  const state = one.expired ? `expired ${one.expiresAt}` : `valid until ${one.expiresAt}`;
@@ -40564,6 +40598,21 @@ function authText(report) {
40564
40598
  " `auth closure request --reason <text>` re-reads this review before sending it."
40565
40599
  ].join("\n");
40566
40600
  }
40601
+ /**
40602
+ * The installations `login` knows, each with the first-party public OAuth client its panel and this CLI sign in
40603
+ * with. A client id is the public `VITE_OAUTH_CLIENT_ID` the panel serves in `/config.js`, an identifier rather
40604
+ * than a credential: PKCE, not a secret, proves the caller.
40605
+ *
40606
+ * The Rust client keeps the same table in `crates/hostingctl/src/config.rs`; `login-client-id.test.ts` refuses
40607
+ * the two drifting apart.
40608
+ */
40609
+ var KNOWN_INSTALLATIONS = [{
40610
+ apiUrl: "https://hosting.haak.co/api/v1",
40611
+ clientId: "01a0d2c2-cc35-70b7-bc8c-c9af385c728a"
40612
+ }, {
40613
+ apiUrl: "https://hosting-staging.haakdev.com/api/v1",
40614
+ clientId: "01a0d0db-c35d-7339-b32d-956be37a658b"
40615
+ }];
40567
40616
  // src/commands/login-metadata.ts
40568
40617
  /**
40569
40618
  * `login` — sign in with authorization-code/PKCE over a loopback redirect.
@@ -40572,14 +40621,15 @@ function authText(report) {
40572
40621
  * itself hold one copy of it between them. The target and the client id are global flags.
40573
40622
  */
40574
40623
  var LOGIN_USAGE = [
40575
- "Usage: hostingctl login --api-url <url> [--client-id <id>] [--profile <name>] [--company <slug>] [--no-browser]",
40624
+ "Usage: hostingctl login [--api-url <url>] [--client-id <id>] [--profile <name>] [--company <slug>] [--no-browser]",
40576
40625
  "",
40577
40626
  "Signs in with authorization-code/PKCE over a loopback redirect, proves the new token against the API, then",
40578
40627
  "writes the session to a mode 0600 credential file under a 0700 directory. It is a credential file rather than",
40579
40628
  "a keychain, so exclude it from backup and sync tools; what bounds the exposure is that the refresh token is",
40580
40629
  "single-use and expires.",
40581
40630
  "",
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.",
40631
+ " --api-url <url> The installation to sign in to (default: https://hosting.haak.co/api/v1, or\n HOSTINGCTL_API_URL).",
40632
+ " --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
40633
  " --profile <name> Which named session to write (default: \"default\", or HOSTINGCTL_PROFILE).",
40584
40634
  " --company <slug> Store this company with the session, so company commands need no --company.",
40585
40635
  " Without it, HOSTINGCTL_COMPANY or the account's only company is used.",
@@ -40645,10 +40695,9 @@ function profileName(flags) {
40645
40695
  * runs inside `signIn`, so a token the API will not accept is never written over a session that works.
40646
40696
  */
40647
40697
  async function runLogin(context) {
40648
- const apiUrl = context.flags.get("--api-url");
40698
+ const apiUrl = (context.flags.get("--api-url") ?? "").trim() || "https://hosting.haak.co/api/v1";
40649
40699
  const profile = profileName(context.flags);
40650
40700
  const noBrowser = context.flags.has("--no-browser");
40651
- if (apiUrl === void 0 || apiUrl === "") throw new UsageError(LOGIN_USAGE);
40652
40701
  const resolvedClientId = await resolveClientId(context.flags, await readProfiles(), apiUrl);
40653
40702
  if (resolvedClientId === void 0) throw new UsageError(LOGIN_USAGE);
40654
40703
  const clientId = resolvedClientId;
@@ -40692,9 +40741,9 @@ var login = {
40692
40741
  };
40693
40742
  /**
40694
40743
  * 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.
40744
+ * signed in with, the client a known installation ships with, and finally the platform's own published client.
40696
40745
  *
40697
- * The last source is the one that makes `login` a single command. The platform serves its runtime config at
40746
+ * 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
40747
  * `<origin>/config.js` as `window.__HOSTING_PUBLIC_CONFIG__`, and `VITE_OAUTH_CLIENT_ID` in it is the same
40699
40748
  * public client the web app signs in with — a public identifier of the application, not a credential. Reading
40700
40749
  * it means nobody has to be told a uuid before they can sign in, and no documentation can go stale with one.
@@ -40713,6 +40762,8 @@ async function resolveClientId(flags, document, apiUrl, fetcher = fetch) {
40713
40762
  if (fromEnvironment !== "") return fromEnvironment;
40714
40763
  const stored = Object.values(document.profiles).filter((one) => sameTarget(one.apiUrl, apiUrl)).map((one) => one.clientId.trim()).find((one) => one !== "");
40715
40764
  if (stored !== void 0) return stored;
40765
+ const known = KNOWN_INSTALLATIONS.find((one) => sameTarget(one.apiUrl, apiUrl));
40766
+ if (known !== void 0) return known.clientId;
40716
40767
  return await discoverClientId(apiUrl, fetcher);
40717
40768
  }
40718
40769
  /**
@@ -40790,7 +40841,7 @@ async function status$1(context, rest) {
40790
40841
  const stored = document.profiles[profile];
40791
40842
  if (stored === void 0) {
40792
40843
  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(", ")}.`);
40844
+ 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
40845
  }
40795
40846
  const report = {
40796
40847
  profile,
@@ -42693,7 +42744,8 @@ async function deliverApplicationSource(progress, path, key, archive, deadline,
42693
42744
  path,
42694
42745
  body: {
42695
42746
  sourceUploadUuid: upload.uuid,
42696
- idempotencyKey: `setup-${upload.uuid}`
42747
+ idempotencyKey: `setup-${upload.uuid}`,
42748
+ deployMode: "deploy-when-built"
42697
42749
  }
42698
42750
  })).data;
42699
42751
  record({
@@ -42720,20 +42772,15 @@ async function deliverApplicationSource(progress, path, key, archive, deadline,
42720
42772
  };
42721
42773
  }
42722
42774
  /**
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.
42775
+ * Follow one build requested in `deploy-when-built` mode until its release is serving: the build to a final state,
42776
+ * its own release, and the running release. The platform deploys it, so this only observes — stopping the command
42777
+ * changes nothing. Shared by `environment setup` and `application build --wait`, which say differently where to
42778
+ * read a failed build from — `next` is that sentence.
42726
42779
  */
42727
42780
  async function followBuildToServing(progress, path, key, build, deadline, next, onRelease = () => void 0) {
42728
42781
  const finished = await awaitBuild(progress, path, key, build, deadline, next);
42729
42782
  const release = await releaseForBuild(progress, path, key, build, deadline);
42730
42783
  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
42784
  return {
42738
42785
  finished,
42739
42786
  running: await awaitRelease(progress, path, key, release.uuid, deadline)
@@ -42761,15 +42808,23 @@ async function releaseForBuild(progress, path, key, build, deadline) {
42761
42808
  await pause(path, key, "release", deadline);
42762
42809
  }
42763
42810
  }
42764
- /** A deploy is a request; only the release the deployment reports as running means the application is serving. */
42811
+ /**
42812
+ * Only the release the deployment reports as running means the application is serving. A release the platform left
42813
+ * ready with no recorded deploy — a newer one was deployed meanwhile — will not move on its own, so it is refused
42814
+ * with the command that deploys it.
42815
+ */
42765
42816
  async function awaitRelease(progress, path, key, releaseUuid, deadline) {
42766
42817
  for (;;) {
42767
- const running = (await deployment(path)).running;
42818
+ const observed = await deployment(path);
42819
+ const running = observed.running;
42768
42820
  if (running !== null && running.uuid === releaseUuid && running.isRunning) {
42769
42821
  progress.report(`${key}: release ${releaseUuid} ${running.status}, serving`);
42770
42822
  return running;
42771
42823
  }
42772
- progress.report(`${key}: release ${releaseUuid} ${running === null ? "not running yet" : `waiting (${running.status} of ${running.uuid})`}`);
42824
+ const release = observed.releases.find((one) => one.uuid === releaseUuid);
42825
+ const build = observed.builds.find((one) => one.uuid === release?.buildUuid);
42826
+ 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\`.`);
42827
+ 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
42828
  await pause(path, key, "release", deadline);
42774
42829
  }
42775
42830
  }
@@ -42820,7 +42875,7 @@ var WAIT_FLAG_SPECS = [{
42820
42875
  /** The sentence `--wait` adds to the build's description, so a dry run says the deploy will follow. */
42821
42876
  var BUILD_WAIT_DESCRIPTION = "Then wait for it and deploy its release once it succeeds.";
42822
42877
  /**
42823
- * Follow the build `application build --wait` just queued, deploy its release and see it serving.
42878
+ * Follow the build `application build --wait` just queued in `deploy-when-built` mode and see its release serving.
42824
42879
  *
42825
42880
  * The same journey `environment setup` follows after its upload, narrated by the same progress owner; a failed
42826
42881
  * build is refused with the line it failed on first, and every identifier stays readable.
@@ -43081,6 +43136,10 @@ async function build$1(context, path, rest) {
43081
43136
  ...idempotencyKey === null ? {} : { idempotencyKey }
43082
43137
  };
43083
43138
  const wait = context.flags.has("--wait");
43139
+ const requested = wait ? {
43140
+ ...body,
43141
+ deployMode: "deploy-when-built"
43142
+ } : body;
43084
43143
  const deadline = wait ? commandDeadline(context.flags) : 0;
43085
43144
  const outcome = await confirmableWrite(context, [
43086
43145
  `Build application ${path.workloadUuid} from its applied configuration, ${sourceDescription(selection, upload, sshSource)}.`,
@@ -43088,7 +43147,7 @@ async function build$1(context, path, rest) {
43088
43147
  ...wait ? [BUILD_WAIT_DESCRIPTION] : []
43089
43148
  ].join("\n"), async () => (await hostingDeploymentStore({
43090
43149
  path,
43091
- body
43150
+ body: requested
43092
43151
  })).data);
43093
43152
  if (!wait || !outcome.sent) return {
43094
43153
  kind: "build-write",
@@ -45570,7 +45629,11 @@ function writeAnyResultText(result) {
45570
45629
  function writeResultText$1(result) {
45571
45630
  if ("failureStage" in result) return buildText(result);
45572
45631
  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");
45632
+ if ("imageDigest" in result) return [
45633
+ ` release ${result.uuid} ${result.status} running ${result.isRunning ? "yes" : "no"}`,
45634
+ ...result.deployWaiting ? [" will deploy when the current change finishes"] : [],
45635
+ ...imageProvenanceText(result)
45636
+ ].join("\n");
45574
45637
  if ("runToken" in result) return ` ${result.message}`;
45575
45638
  if ("statusName" in result) return ` removal ${result.uuid} ${result.statusName} open ${result.isOpen ? "yes" : "no"}`;
45576
45639
  return applicationDetailText(result);
@@ -53831,6 +53894,69 @@ function environmentExportText(report) {
53831
53894
  }
53832
53895
  return `release ${report.releaseUuid}:\n${JSON.stringify(report.bundle, null, 2)}`;
53833
53896
  }
53897
+ // src/commands/environment-mail-relay.ts
53898
+ var MAIL_RELAY_USAGE = [
53899
+ "Usage: hostingctl environment mail-relay-test <environment-uuid> --company <slug> --to <address>",
53900
+ "",
53901
+ " Send one test message through the environment's mail relay, from inside the environment, and print every",
53902
+ " step — settings, DNS, connect, TLS, greeting, sign-in, sender, recipient, message — with the server's own",
53903
+ " answer and the SMTP conversation. It stops at the first step that fails. Sign-in details are redacted and",
53904
+ " the address is used for this test only. Accepted by the relay is not delivered: check the inbox.",
53905
+ "",
53906
+ "Needs --confirm, because it sends a real message; --dry-run describes it without sending."
53907
+ ].join("\n");
53908
+ /** How long to follow a running test: the Job's own 90-second deadline plus the time to start and read it. */
53909
+ var WAIT_SECONDS = 180;
53910
+ var POLL_MILLISECONDS = 2e3;
53911
+ /** `--to`: the one address the test message goes to. */
53912
+ function recipientFlag(context) {
53913
+ const recipient = context.flags.get("--to")?.trim() ?? "";
53914
+ if (recipient === "") throw new UsageError(`--to is required.\n\n${MAIL_RELAY_USAGE}`);
53915
+ return recipient;
53916
+ }
53917
+ /** Start the test, then read it until it is no longer running or the wait runs out. */
53918
+ async function environmentMailRelayTest(context, rest) {
53919
+ const [environmentUuid, ...extra] = rest;
53920
+ if (extra.length > 0) throw new UsageError(MAIL_RELAY_USAGE);
53921
+ const path = await environmentPath(context, environmentUuid, MAIL_RELAY_USAGE);
53922
+ const recipient = recipientFlag(context);
53923
+ return {
53924
+ kind: "mail-relay-test",
53925
+ outcome: await confirmableWrite(context, `send one test message through the mail relay of environment ${path.environmentUuid}`, async () => {
53926
+ let result = (await hostingMailRelayDiagnosisStart({
53927
+ path,
53928
+ body: { recipient }
53929
+ })).data;
53930
+ const deadline = Date.now() + WAIT_SECONDS * 1e3;
53931
+ while (result.state === "running" && Date.now() < deadline) {
53932
+ await new Promise((resolve) => setTimeout(resolve, POLL_MILLISECONDS));
53933
+ result = (await hostingMailRelayDiagnosisShow({ path: {
53934
+ ...path,
53935
+ diagnosisUuid: result.uuid
53936
+ } })).data;
53937
+ }
53938
+ return result;
53939
+ })
53940
+ };
53941
+ }
53942
+ /** The verdict, each step with its status and words, then the conversation with the server. */
53943
+ function diagnosisText(result) {
53944
+ const lines = [`mail relay test ${{
53945
+ running: `still running after ${String(WAIT_SECONDS)}s; read it again with the web panel (test ${result.uuid})`,
53946
+ passed: "passed: the relay accepted the test message (accepted is not delivered — check the inbox)",
53947
+ failed: "failed: the first failed step below says where and why",
53948
+ unavailable: "unavailable: the test did not report, so nothing is known about the relay"
53949
+ }[result.state]}`];
53950
+ for (const step of result.steps) lines.push(` ${step.step.padEnd(13)} ${step.status.padEnd(11)} ${step.detail}`.trimEnd());
53951
+ if (result.transcript.length > 0) {
53952
+ lines.push(" conversation");
53953
+ for (const line of result.transcript) lines.push(` ${line.direction === "client" ? "->" : "<-"} ${line.text}`);
53954
+ }
53955
+ return lines.join("\n");
53956
+ }
53957
+ function environmentMailRelayText(report) {
53958
+ return renderWriteOutcome(report.outcome, diagnosisText);
53959
+ }
53834
53960
  // src/commands/environment-runtime-version-grants.ts
53835
53961
  /**
53836
53962
  * The flags this command reads, declared beside it so the metadata owner spreads one list rather than
@@ -54018,6 +54144,7 @@ var ENVIRONMENT_SUBCOMMANDS = [
54018
54144
  "portable",
54019
54145
  "configuration",
54020
54146
  "secret",
54147
+ "mail-relay-test",
54021
54148
  "databases",
54022
54149
  "database",
54023
54150
  "component-version",
@@ -54085,6 +54212,7 @@ var ENVIRONMENT_USAGE = [
54085
54212
  " hostingctl environment configuration <show|preview|save|apply> <uuid> --company <slug> [--file <path>]",
54086
54213
  " [--wait]",
54087
54214
  " hostingctl environment secret <write|import|local> <uuid> --company <slug> …",
54215
+ " hostingctl environment mail-relay-test <uuid> --company <slug> --to <address>",
54088
54216
  " hostingctl environment databases|database <uuid> … --company <slug>",
54089
54217
  " hostingctl environment component-version <uuid> <workload-uuid> <version> --company <slug>",
54090
54218
  " hostingctl environment references <uuid> --company <slug>",
@@ -54120,6 +54248,8 @@ var ENVIRONMENT_USAGE = [
54120
54248
  " generation it queued until the environment reports it applied, then reports that status.",
54121
54249
  " secret Set declared configuration secret values through the write-only control, or write the",
54122
54250
  " declarations' local development values for a local run.",
54251
+ " mail-relay-test Send one test message through the site's mail relay and print every step and the",
54252
+ " server's answers, stopping where it fails.",
54123
54253
  " databases List the environment-owned databases, declare one, replace who may consume it, or retire",
54124
54254
  " one while retaining its data and its backups.",
54125
54255
  " component-version Move one curated component instance to another version this platform pins an image for.",
@@ -54138,7 +54268,7 @@ var ENVIRONMENT_USAGE = [
54138
54268
  "",
54139
54269
  "The writes (create, setup, reconcile, scale, component-version, object-cache-set, site-insights-verify/audit/fix,",
54140
54270
  "portable prepare/confirm, configuration save/apply,",
54141
- "secret write/import, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
54271
+ "secret write/import, mail-relay-test, database create/bind/retire) need --confirm; --dry-run describes the change without making it.",
54142
54272
  "",
54143
54273
  "`secret local` is the one exception and is a read: it writes each declaration's local development value - a",
54144
54274
  "development default such as `password`, not a credential - into an env file for a local run, names the declared",
@@ -54867,6 +54997,10 @@ var ENVIRONMENT_TOPICS = [
54867
54997
  path: ["secret"],
54868
54998
  usage: SECRETS_USAGE
54869
54999
  },
55000
+ {
55001
+ path: ["mail-relay-test"],
55002
+ usage: MAIL_RELAY_USAGE
55003
+ },
54870
55004
  {
54871
55005
  path: ["databases"],
54872
55006
  usage: DATABASES_USAGE
@@ -55107,6 +55241,11 @@ var ENVIRONMENT_METADATA = {
55107
55241
  takesValue: false,
55108
55242
  description: "Confirm moving the environment's configuration source between its repository file and this document."
55109
55243
  },
55244
+ {
55245
+ name: "--to",
55246
+ takesValue: true,
55247
+ description: "The address `mail-relay-test` sends its one test message to."
55248
+ },
55110
55249
  {
55111
55250
  name: "--wait",
55112
55251
  takesValue: false,
@@ -55865,6 +56004,7 @@ function environmentTaggedText(report) {
55865
56004
  if (report.kind === "service-addition" || report.kind === "service-retirement" || report.kind === "service-write") return environmentServicesText(report);
55866
56005
  if (report.kind === "site-insights" || report.kind === "site-insights-write") return environmentSiteInsightsText(report);
55867
56006
  if (report.kind === "storage-journal") return storageJournalText(report.journal);
56007
+ if (report.kind === "mail-relay-test") return environmentMailRelayText(report);
55868
56008
  return environmentAdminText(report);
55869
56009
  }
55870
56010
  // src/commands/environment-text-cache.ts
@@ -63434,7 +63574,7 @@ var hostingFinalCopyOrderEnumSchema = _enum(["best-effort", "stop-on-failure"]).
63434
63574
  var createHostingCancellationRequestSchema = object({
63435
63575
  reason: string().min(4).max(2e3),
63436
63576
  reviewGeneration: int().min(1),
63437
- effectiveAt: datetime(),
63577
+ effectiveAt: datetime().optional().describe("\"Now\" ends service at the confirmation, so it has no date to agree and the recorder ignores one."),
63438
63578
  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
63579
  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
63580
  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 +64051,7 @@ var domainDataSchema = object({
63911
64051
  hostname: string(),
63912
64052
  status: string(),
63913
64053
  statusName: string(),
64054
+ verifiedThrough: string().nullable(),
63914
64055
  proofCurrent: boolean(),
63915
64056
  verifiedAt: string().nullable(),
63916
64057
  lastCheckedAt: string().nullable(),
@@ -65411,6 +65552,7 @@ var hostingFailureExplanationDataSchema = object({
65411
65552
  nextAction: string().nullable(),
65412
65553
  retryable: boolean()
65413
65554
  });
65555
+ 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
65556
  var hostingBuildDataSchema = object({
65415
65557
  uuid: string(),
65416
65558
  attempt: int(),
@@ -65429,7 +65571,8 @@ var hostingBuildDataSchema = object({
65429
65571
  queuedAt: string().nullable(),
65430
65572
  startedAt: string().nullable(),
65431
65573
  finishedAt: string().nullable(),
65432
- explanation: union([hostingFailureExplanationDataSchema, _null()])
65574
+ explanation: union([hostingFailureExplanationDataSchema, _null()]),
65575
+ deployMode: hostingBuildDeployModeEnumSchema.describe("What the person asked to happen once this attempt succeeds: a candidate, or a deploy as them.")
65433
65576
  });
65434
65577
  var hostingBuildErrorDataSchema = object({
65435
65578
  step: string(),
@@ -66340,7 +66483,8 @@ var hostingReleaseDataSchema = object({
66340
66483
  sourceCommitSha: string().nullable(),
66341
66484
  sourceBranch: string().nullable(),
66342
66485
  bundleDownloadUrl: string().nullable(),
66343
- image: union([hostingReleaseImageDataSchema, _null()])
66486
+ image: union([hostingReleaseImageDataSchema, _null()]),
66487
+ 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
66488
  });
66345
66489
  var hostingRepositorySelectionDataSchema = object({
66346
66490
  uuid: string(),
@@ -66779,6 +66923,46 @@ object({
66779
66923
  maximumReuseSeconds: int(),
66780
66924
  capabilities: hostingHttpCacheCapabilitiesDataSchema
66781
66925
  });
66926
+ var hostingMailRelayDiagnosisStateEnumSchema = _enum([
66927
+ "running",
66928
+ "passed",
66929
+ "failed",
66930
+ "unavailable"
66931
+ ]).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. |");
66932
+ var hostingMailRelayDiagnosisStepEnumSchema = _enum([
66933
+ "configuration",
66934
+ "dns",
66935
+ "connect",
66936
+ "tls",
66937
+ "greeting",
66938
+ "auth",
66939
+ "sender",
66940
+ "recipient",
66941
+ "message"
66942
+ ]).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. |");
66943
+ var hostingMailRelayDiagnosisStepStatusEnumSchema = _enum([
66944
+ "passed",
66945
+ "failed",
66946
+ "not_reached"
66947
+ ]).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. |");
66948
+ var hostingMailRelayDiagnosisStepDataSchema = object({
66949
+ 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. |"),
66950
+ 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. |"),
66951
+ detail: string().describe("What was found, in words, with the server's own answer when it refused. Never a credential.")
66952
+ });
66953
+ var hostingMailRelayDiagnosisLineDataSchema = object({
66954
+ 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. |"),
66955
+ text: string()
66956
+ });
66957
+ object({
66958
+ uuid: string(),
66959
+ environmentUuid: string(),
66960
+ 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. |"),
66961
+ steps: array(hostingMailRelayDiagnosisStepDataSchema).describe("Every step in the order it ran, then the ones a failure left `not_reached`. Empty while running."),
66962
+ transcript: array(hostingMailRelayDiagnosisLineDataSchema),
66963
+ startedAt: string(),
66964
+ finishedAt: string().nullable()
66965
+ });
66782
66966
  var hostingNodeMoveReviewDataSchema = object({
66783
66967
  sourceEnvironmentUuid: string(),
66784
66968
  destinationEnvironmentUuid: string(),
@@ -68926,8 +69110,9 @@ var requestHostingBuildRequestSchema = object({
68926
69110
  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
69111
  sourceUploadUuid: uuid().nullish(),
68928
69112
  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.");
69113
+ idempotencyKey: string().max(128).nullish(),
69114
+ deployMode: union([hostingBuildDeployModeEnumSchema, _null()]).optional()
69115
+ }).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
69116
  var requestHostingDatabaseRetirementRequestSchema = object({
68932
69117
  confirmation: string().min(64).max(64),
68933
69118
  desiredGeneration: int().min(0),
@@ -69144,6 +69329,7 @@ var startGitHubConnectionRequestSchema = object({
69144
69329
  connectionUuid: uuid().optional(),
69145
69330
  accountLogin: string().max(39).regex(/^[A-Za-z\d]+(?:-[A-Za-z\d]+)*$/).optional()
69146
69331
  });
69332
+ object({ recipient: email().max(254).describe("Where the one test message goes. Used for this send only and never stored.") });
69147
69333
  var startImpersonationRequestSchema = object({
69148
69334
  targetUuid: uuid(),
69149
69335
  company: string().max(64),
@@ -72248,7 +72434,7 @@ union([
72248
72434
  messageDataSchema,
72249
72435
  hostingRefusalDataSchema
72250
72436
  ]);
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.");
72437
+ 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
72438
  object({
72253
72439
  company: string(),
72254
72440
  environmentUuid: string(),
@@ -73058,6 +73244,30 @@ object({
73058
73244
  company: string(),
73059
73245
  environmentUuid: string()
73060
73246
  });
73247
+ union([
73248
+ object({ message: string().describe("Error overview.") }),
73249
+ messageDataSchema,
73250
+ messageDataSchema,
73251
+ messageDataSchema,
73252
+ object({
73253
+ message: string().describe("Errors overview."),
73254
+ errors: record$1(string(), array(string())).describe("A detailed description of each field that failed validation.")
73255
+ })
73256
+ ]);
73257
+ object({
73258
+ company: string(),
73259
+ environmentUuid: string()
73260
+ });
73261
+ union([
73262
+ object({ message: string().describe("Error overview.") }),
73263
+ messageDataSchema,
73264
+ messageDataSchema
73265
+ ]);
73266
+ object({
73267
+ company: string(),
73268
+ environmentUuid: string(),
73269
+ diagnosisUuid: string()
73270
+ });
73061
73271
  union([object({ message: string().describe("Error overview.") }), object({ message: string().describe("Error overview.") })]);
73062
73272
  object({ company: string() });
73063
73273
  union([
@@ -73286,6 +73496,7 @@ union([
73286
73496
  messageDataSchema,
73287
73497
  hostingRefusalDataSchema
73288
73498
  ]);
73499
+ object({ deployMode: union([hostingBuildDeployModeEnumSchema, _null()]).optional() }).optional();
73289
73500
  object({
73290
73501
  company: string(),
73291
73502
  environmentUuid: string(),
@@ -73338,6 +73549,7 @@ object({
73338
73549
  repositoryId: int()
73339
73550
  });
73340
73551
  string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish();
73552
+ string().max(255).nullish();
73341
73553
  union([
73342
73554
  object({ message: string().describe("Error overview.") }),
73343
73555
  object({ message: string().describe("Error overview.") }),
@@ -73348,7 +73560,10 @@ object({
73348
73560
  connectionUuid: string(),
73349
73561
  selectionUuid: string()
73350
73562
  });
73351
- object({ root: string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish() });
73563
+ object({
73564
+ root: string().max(256).regex(/^(?:\.|(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+(?:\/(?!\.{1,2}(?:\/|$))[A-Za-z0-9_.-]+)*)$/).nullish(),
73565
+ branch: string().max(255).nullish()
73566
+ });
73352
73567
  var hostingRepositoryConnectionStartStatus200Schema = gitHubConnectionStartDataSchema;
73353
73568
  var hostingRepositoryConnectionStartStatus201Schema = gitHubConnectionStartDataSchema;
73354
73569
  var hostingRepositoryConnectionStartStatus401Schema = object({ message: string().describe("Error overview.") });
@@ -76253,6 +76468,7 @@ var SIMPLE_SUBCOMMANDS = {
76253
76468
  portable,
76254
76469
  configuration,
76255
76470
  secret,
76471
+ "mail-relay-test": environmentMailRelayTest,
76256
76472
  databases,
76257
76473
  database,
76258
76474
  "runtime-versions": environmentRuntimeVersions,
@@ -76574,6 +76790,7 @@ var LOGS_USAGE = [
76574
76790
  " live The same environment's current container output, as the platform reads it now.",
76575
76791
  "",
76576
76792
  " --application Only one application's output, for environment and live.",
76793
+ " --limit Entries per answer; for live, each container's newest lines.",
76577
76794
  " dns Retained operational DNS events for one owned zone.",
76578
76795
  " mail Retained Postfix delivery attempts for one owned mail domain.",
76579
76796
  "",
@@ -76605,7 +76822,7 @@ var logs = {
76605
76822
  {
76606
76823
  name: "--limit",
76607
76824
  takesValue: true,
76608
- description: "How many entries one answer holds, from 1 to 200."
76825
+ description: "How many entries one answer holds, from 1 to 200; for live, each container's newest lines."
76609
76826
  }
76610
76827
  ],
76611
76828
  subcommands: [
@@ -76626,9 +76843,13 @@ var logs = {
76626
76843
  company,
76627
76844
  environmentUuid: uuid
76628
76845
  } })).data;
76629
- return application === void 0 ? live : {
76846
+ const entries = live.entries.filter((one) => application === void 0 || one.applicationUuid === application).map((one) => query.limit === void 0 ? one : {
76847
+ ...one,
76848
+ lines: one.lines.slice(-query.limit)
76849
+ });
76850
+ return {
76630
76851
  ...live,
76631
- entries: live.entries.filter((one) => one.applicationUuid === application)
76852
+ entries
76632
76853
  };
76633
76854
  }
76634
76855
  if (source === "environment") return (await hostingLogHistoryShow({
@@ -85024,7 +85245,7 @@ function writeUpdateState(state, env = process.env) {
85024
85245
  } catch {}
85025
85246
  }
85026
85247
  // src/version.ts
85027
- var VERSION = "1.0.797";
85248
+ var VERSION = "1.0.807";
85028
85249
  // src/commands/update.ts
85029
85250
  /**
85030
85251
  * `update` — bring this copy of the CLI up to the published version.
@@ -85098,7 +85319,7 @@ var update = {
85098
85319
  }, process.env);
85099
85320
  return {
85100
85321
  ...known,
85101
- current: after ?? "1.0.797",
85322
+ current: after ?? "1.0.807",
85102
85323
  latest: after ?? latest,
85103
85324
  upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
85104
85325
  action: "run",
@@ -85379,7 +85600,7 @@ async function printUpdateNotice(options) {
85379
85600
  }, env, { waitMs: NOTICE_LOCK_WAIT_MS });
85380
85601
  } catch {}
85381
85602
  if (latest === null) return;
85382
- if (!isNewerVersion(latest, "1.0.797")) return;
85603
+ if (!isNewerVersion(latest, "1.0.807")) return;
85383
85604
  process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
85384
85605
  }
85385
85606
  /** Whether an environment variable is set to something, which is how CI and the opt-out are read. */