@amerged/ohmyhost-cli 0.1.55 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @amerged/ohmyhost-cli
2
2
 
3
- ohmyho.st cli client, version 0.1.55.
3
+ ohmyho.st cli client, version 0.1.56.
4
4
 
5
5
  ```sh
6
6
  npm install --global @amerged/ohmyhost-cli
package/dist/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __ohmyhostCreateRequire } from "node:module"; const require = __ohmyhostCreateRequire(import.meta.url);
3
3
  import {
4
4
  runProductionCli
5
- } from "./chunk-4OAAJX5B.js";
5
+ } from "./chunk-HNFWXGDN.js";
6
6
  import "./chunk-7D2RFLWM.js";
7
7
 
8
8
  // apps/product-cli/dist/bin.js
@@ -39966,6 +39966,9 @@ function hasControlCharacter2(value, multiline) {
39966
39966
  });
39967
39967
  }
39968
39968
 
39969
+ // packages/contracts/dist/organization-mcp-connections.js
39970
+ var MCP_CONNECTION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
39971
+
39969
39972
  // packages/contracts/dist/project-data-changes.js
39970
39973
  var PROJECT_DATA_CHANGE_KINDS = [
39971
39974
  "isolate_prod_keeps_data",
@@ -40592,15 +40595,15 @@ var PROBLEM_POLICY = {
40592
40595
  domain_hostname_taken: {
40593
40596
  status: 409,
40594
40597
  retryable: false,
40595
- action: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
40596
- restAction: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
40598
+ action: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
40599
+ restAction: "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
40597
40600
  title: "Domain hostname is already connected"
40598
40601
  },
40599
40602
  domain_ownership_required: {
40600
40603
  status: 409,
40601
40604
  retryable: false,
40602
- action: "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
40603
- restAction: "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
40605
+ action: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
40606
+ restAction: "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
40604
40607
  title: "Verify the domain before connecting it"
40605
40608
  },
40606
40609
  domain_dns_conflict: {
@@ -40811,6 +40814,29 @@ var parseGithubOrganizationConnectionStatus = (value) => {
40811
40814
  }
40812
40815
  return input;
40813
40816
  };
40817
+ var parseOrganizationMcpConnectionList = (value) => {
40818
+ const input = exactRecord2(value, ["connections"]);
40819
+ if (!Array.isArray(input["connections"]))
40820
+ throw new ResponseContractError();
40821
+ for (const item of input["connections"]) {
40822
+ const connection = exactRecord2(item, ["connection_id", "client_id", "user_id", "connected_at"]);
40823
+ if (typeof connection["connection_id"] !== "string" || !MCP_CONNECTION_ID_PATTERN.test(connection["connection_id"]) || !boundedString(connection["client_id"], 1, 2048) || !boundedString(connection["user_id"], 1, 256) || !isIsoInstant(connection["connected_at"]))
40824
+ throw new ResponseContractError();
40825
+ }
40826
+ return input;
40827
+ };
40828
+ var parseOrganizationMcpConnectionRevocation = (value) => {
40829
+ const input = exactRecord2(value, ["state"]);
40830
+ if (input["state"] !== "pending" && input["state"] !== "revoked")
40831
+ throw new ResponseContractError();
40832
+ return input;
40833
+ };
40834
+ var parseGithubDisconnection = (value) => {
40835
+ const status = parseGithubOrganizationConnectionStatus(value);
40836
+ if (status.status === "connected")
40837
+ throw new ResponseContractError();
40838
+ return status;
40839
+ };
40814
40840
  var parseGithubConnectionAuthorization = (value) => {
40815
40841
  const input = exactRecord2(value, [
40816
40842
  "authorization_id",
@@ -42494,12 +42520,13 @@ var FIXED_PLATFORM_NAMES = /* @__PURE__ */ new Set([
42494
42520
  "IMAGES",
42495
42521
  "STORAGE"
42496
42522
  ]);
42497
- var INSTALLED_PLATFORM_KEYS = /* @__PURE__ */ new Set([
42523
+ var INSTALLED_PLATFORM_KEY_NAMES = [
42498
42524
  "OHMYHOST_STORAGE_KEY",
42499
42525
  "OHMYHOST_MAIL_KEY",
42500
42526
  "OHMYHOST_AI_KEY",
42501
42527
  "BETTER_AUTH_SECRET"
42502
- ]);
42528
+ ];
42529
+ var INSTALLED_PLATFORM_KEYS = new Set(INSTALLED_PLATFORM_KEY_NAMES);
42503
42530
  function isUserSecretName(value, action = "set") {
42504
42531
  if (typeof value !== "string" || !USER_SECRET_NAME_PATTERN.test(value))
42505
42532
  return false;
@@ -43421,6 +43448,8 @@ var recognizedCommandLabel = (argv) => {
43421
43448
  return "github connect";
43422
43449
  if (value === "github" && values[0] === "status")
43423
43450
  return "github status";
43451
+ if (value === "github" && values[0] === "disconnect")
43452
+ return "github disconnect";
43424
43453
  if (value === "operation" && values[0] === "get")
43425
43454
  return "operation get";
43426
43455
  if (value === "credits" && values[0] === "account")
@@ -43467,6 +43496,12 @@ var recognizedCommandLabel = (argv) => {
43467
43496
  return "organization list";
43468
43497
  if (value === "organization" && values[0] === "use")
43469
43498
  return "organization use";
43499
+ if (value === "organization" && values[0] === "mcp-connections") {
43500
+ if (values[1] === "list")
43501
+ return "organization mcp-connections list";
43502
+ if (values[1] === "revoke")
43503
+ return "organization mcp-connections revoke";
43504
+ }
43470
43505
  if (value === "project" && values[0] === "list")
43471
43506
  return "project list";
43472
43507
  if (value === "project" && values[0] === "context")
@@ -43627,6 +43662,8 @@ var recognizedCommandLabel = (argv) => {
43627
43662
  return "mail webhook verify";
43628
43663
  if (values[1] === "disable")
43629
43664
  return "mail webhook disable";
43665
+ if (values[1] === "rotate")
43666
+ return "mail webhook rotate";
43630
43667
  }
43631
43668
  if (values[0] === "messages") {
43632
43669
  if (values[1] === "list")
@@ -44167,14 +44204,18 @@ var parseProductCliCommand = (argv) => {
44167
44204
  }
44168
44205
  if (first === "github") {
44169
44206
  const subcommand = values.shift();
44170
- if (yes || wait || follow || stdin)
44207
+ if (wait || follow || stdin)
44171
44208
  throw new InvalidCommandError();
44172
- if (subcommand !== "connect" && subcommand !== "status")
44209
+ if (subcommand !== "connect" && subcommand !== "status" && subcommand !== "disconnect")
44210
+ throw new InvalidCommandError();
44211
+ if (yes !== (subcommand === "disconnect"))
44173
44212
  throw new InvalidCommandError();
44174
44213
  const options = parseOptions(values, subcommand === "connect" ? ["--organization", "--idempotency-key"] : ["--organization"]);
44175
44214
  const organizationId = options["--organization"];
44176
44215
  if (!ORGANIZATION_ULID.test(organizationId))
44177
44216
  throw new InvalidCommandError();
44217
+ if (subcommand === "disconnect")
44218
+ return { kind: "github-disconnect", organizationId, yes: true, credentialStore };
44178
44219
  return subcommand === "connect" ? {
44179
44220
  kind: "github-connect",
44180
44221
  organizationId,
@@ -44182,6 +44223,35 @@ var parseProductCliCommand = (argv) => {
44182
44223
  credentialStore
44183
44224
  } : { kind: "github-status", organizationId, credentialStore };
44184
44225
  }
44226
+ if (first === "organization" && values[0] === "mcp-connections") {
44227
+ values.shift();
44228
+ const subcommand = values.shift();
44229
+ if (wait || follow || stdin)
44230
+ throw new InvalidCommandError();
44231
+ if (yes !== (subcommand === "revoke"))
44232
+ throw new InvalidCommandError();
44233
+ if (subcommand === "list") {
44234
+ const organizationId = parseOptions(values, ["--organization"])["--organization"];
44235
+ if (!ORGANIZATION_ULID.test(organizationId))
44236
+ throw new InvalidCommandError();
44237
+ return { kind: "organization-mcp-connections-list", organizationId, credentialStore };
44238
+ }
44239
+ if (subcommand === "revoke") {
44240
+ const options = parseOptions(values, ["--organization", "--connection"]);
44241
+ const organizationId = options["--organization"];
44242
+ const connectionId = options["--connection"];
44243
+ if (!ORGANIZATION_ULID.test(organizationId) || !MCP_CONNECTION_ID_PATTERN.test(connectionId))
44244
+ throw new InvalidCommandError();
44245
+ return {
44246
+ kind: "organization-mcp-connection-revoke",
44247
+ organizationId,
44248
+ connectionId,
44249
+ yes: true,
44250
+ credentialStore
44251
+ };
44252
+ }
44253
+ throw new InvalidCommandError();
44254
+ }
44185
44255
  if (first === "organization") {
44186
44256
  const subcommand = values.shift();
44187
44257
  if (yes || wait || follow || stdin)
@@ -45382,9 +45452,10 @@ var parseProductCliCommand = (argv) => {
45382
45452
  const area = values.shift();
45383
45453
  const sub = area === "webhook" || area === "messages" || area === "domain" ? values.shift() : void 0;
45384
45454
  const retiring = area === "domain" && sub === "delete";
45385
- if (yes !== retiring || wait || follow || stdin)
45455
+ const rotating = area === "webhook" && sub === "rotate";
45456
+ if (yes !== (retiring || rotating) || wait || follow || stdin)
45386
45457
  throw new InvalidCommandError();
45387
- const options = parseOptionalOptions(values, [
45458
+ const options = parseOptionalOptions(values, rotating ? ["--project", "--environment", "--idempotency-key"] : [
45388
45459
  "--project",
45389
45460
  "--environment",
45390
45461
  "--domain",
@@ -45434,6 +45505,13 @@ var parseProductCliCommand = (argv) => {
45434
45505
  idempotencyKey: required("--idempotency-key")
45435
45506
  };
45436
45507
  label = "mail webhook set";
45508
+ } else if (rotating) {
45509
+ request = {
45510
+ ...scope,
45511
+ action: "webhook_rotate",
45512
+ idempotencyKey: required("--idempotency-key")
45513
+ };
45514
+ label = "mail webhook rotate";
45437
45515
  } else if (area === "webhook" && (sub === "verify" || sub === "disable")) {
45438
45516
  request = {
45439
45517
  ...scope,
@@ -46056,7 +46134,7 @@ function exact4(v, keys) {
46056
46134
  // apps/product-cli/package.json
46057
46135
  var package_default = {
46058
46136
  name: "@ohmyhost/product-cli",
46059
- version: "0.1.55",
46137
+ version: "0.1.56",
46060
46138
  private: true,
46061
46139
  ohmyhost: {
46062
46140
  deployment: "production",
@@ -46373,6 +46451,7 @@ var HELP_USAGE = Object.freeze({
46373
46451
  "profile list": "ohmyhost profile list --json (saved logins on this computer: name, user and organization, never a token; pass --profile-name NAME or set OHMYHOST_PROFILE to choose one)",
46374
46452
  "github connect": "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
46375
46453
  "github status": "ohmyhost github status --organization ULID --json",
46454
+ "github disconnect": "ohmyhost github disconnect --organization ULID --yes --json (Owner only; revokes the workspace GitHub connection and every repository grant under it, so auto-deploy and linked sources stop at once; the GitHub App stays installed for other workspaces, and github connect starts a new connection)",
46376
46455
  "export create": "ohmyhost export create --project ULID --idempotency-key KEY --stdin --json (password on stdin only; one accepted SQL ZIP per project per 24 hours)",
46377
46456
  "export get": "ohmyhost export get EXPORT_ULID --project ULID --json (poll the original job: progress and error only, never a download URL; once it succeeds, run 'ohmyhost export download-link' for the signed 24-hour ZIP link)",
46378
46457
  "export download-link": "ohmyhost export download-link EXPORT_ULID --project ULID --json (signs one audited 24-hour link of a succeeded SQL ZIP; the URL is a secret, keep it out of files and notes; each call signs another link)",
@@ -46390,6 +46469,8 @@ var HELP_USAGE = Object.freeze({
46390
46469
  "organization create": "ohmyhost organization create --name NAME --idempotency-key KEY [--source SOURCE] --json (SOURCE is optional attribution from a link's r value; a login without organization is bound to the new workspace, another login keeps its own)",
46391
46470
  "organization list": "ohmyhost organization list [--profile-name NAME] --json (the workspaces of the chosen login's user and the one that login is scoped to)",
46392
46471
  "organization use": "ohmyhost organization use --organization ULID [--profile-name NAME] --json (binds a login that has no organization yet; another organization needs its own login)",
46472
+ "organization mcp-connections list": "ohmyhost organization mcp-connections list --organization ULID --json (Owner only; lists each MCP client connected to this workspace and the member who connected it; disconnected consents are not listed)",
46473
+ "organization mcp-connections revoke": "ohmyhost organization mcp-connections revoke --organization ULID --connection UUID --yes --json (Owner only; disconnects one MCP client from this workspace only, and the member's other workspaces are unaffected; repeat until it answers revoked)",
46393
46474
  "operation get": "ohmyhost operation get OPERATION_ULID --json",
46394
46475
  "operation reconcile": "ohmyhost operation reconcile OPERATION_ULID --idempotency-key KEY --yes --json",
46395
46476
  "token create": "ohmyhost token create --organization ULID --name NAME --idempotency-key KEY --out .env.local --json",
@@ -46497,6 +46578,7 @@ var HELP_USAGE = Object.freeze({
46497
46578
  "mail webhook set": "ohmyhost mail webhook set --project ULID --environment ULID --url HTTPS_URL --idempotency-key KEY --json",
46498
46579
  "mail webhook verify": "ohmyhost mail webhook verify --project ULID --environment ULID --idempotency-key KEY --json",
46499
46580
  "mail webhook disable": "ohmyhost mail webhook disable --project ULID --environment ULID --idempotency-key KEY --json",
46581
+ "mail webhook rotate": "ohmyhost mail webhook rotate --project ULID --environment ULID --idempotency-key KEY --yes --json (Owner only; issues a new signing secret for the same endpoint, stops the earlier secrets at once and ends receiving until the endpoint verifies the new one; the secret is returned once, so install it in Prod application secrets and never write it into files or notes)",
46500
46582
  "mail messages list": "ohmyhost mail messages list --project ULID --environment ULID [--after ULID] --json",
46501
46583
  "mail messages get": "ohmyhost mail messages get --project ULID --environment ULID --message ULID --json",
46502
46584
  "mail messages retry": "ohmyhost mail messages retry --project ULID --environment ULID --message ULID --idempotency-key KEY --json",
@@ -46647,6 +46729,36 @@ var ProductCli = class {
46647
46729
  }
46648
46730
  });
46649
46731
  }
46732
+ if (command.kind === "github-disconnect") {
46733
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46734
+ const github = parseGithubDisconnection(await api.disconnectGithub(command.organizationId));
46735
+ if (github.connection !== null && github.connection.organization_id !== command.organizationId)
46736
+ throw new ResponseContractError();
46737
+ return success(name, {
46738
+ status: github.status,
46739
+ github,
46740
+ ...github.status === "connected" ? {} : { next_action: this.githubConnectAction(command.organizationId) }
46741
+ });
46742
+ }
46743
+ if (command.kind === "organization-mcp-connections-list") {
46744
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46745
+ const page = parseOrganizationMcpConnectionList(await api.listOrganizationMcpConnections(command.organizationId));
46746
+ return success(name, { status: "listed", connections: page.connections });
46747
+ }
46748
+ if (command.kind === "organization-mcp-connection-revoke") {
46749
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46750
+ const revocation = parseOrganizationMcpConnectionRevocation(await api.revokeOrganizationMcpConnection({
46751
+ organizationId: command.organizationId,
46752
+ connectionId: command.connectionId
46753
+ }));
46754
+ return success(name, {
46755
+ status: revocation.state,
46756
+ revocation,
46757
+ ...revocation.state === "revoked" ? {} : {
46758
+ next_action: "Repeat this exact command until status is revoked; the client's active provider use is still draining."
46759
+ }
46760
+ });
46761
+ }
46650
46762
  if (command.kind === "whoami")
46651
46763
  return await this.getCurrentIdentity(command, signal);
46652
46764
  if (command.kind === "token-create" || command.kind === "token-list" || command.kind === "token-revoke") {
@@ -48563,6 +48675,12 @@ var parsedCommandName = (command) => {
48563
48675
  return "github connect";
48564
48676
  if (command.kind === "github-status")
48565
48677
  return "github status";
48678
+ if (command.kind === "github-disconnect")
48679
+ return "github disconnect";
48680
+ if (command.kind === "organization-mcp-connections-list")
48681
+ return "organization mcp-connections list";
48682
+ if (command.kind === "organization-mcp-connection-revoke")
48683
+ return "organization mcp-connections revoke";
48566
48684
  if (command.kind === "project-list")
48567
48685
  return "project list";
48568
48686
  if (command.kind === "database-compute-set")
@@ -50279,6 +50397,23 @@ var connectGithubOrganization = (parameters, options) => {
50279
50397
  }
50280
50398
  });
50281
50399
  };
50400
+ var disconnectGithubOrganization = (parameters, options) => {
50401
+ const params = buildClientParams([parameters], [
50402
+ {
50403
+ args: [
50404
+ { in: "headers", key: "X-Request-Id" },
50405
+ { in: "path", key: "organization_id" }
50406
+ ]
50407
+ }
50408
+ ]);
50409
+ return (options?.client ?? client).delete({
50410
+ responseStyle: "data",
50411
+ security: [{ scheme: "bearer", type: "http" }],
50412
+ url: "/v1/organizations/{organization_id}/github",
50413
+ ...options,
50414
+ ...params
50415
+ });
50416
+ };
50282
50417
  var getGithubOrganizationConnection = (parameters, options) => {
50283
50418
  const params = buildClientParams([parameters], [
50284
50419
  {
@@ -50296,6 +50431,41 @@ var getGithubOrganizationConnection = (parameters, options) => {
50296
50431
  ...params
50297
50432
  });
50298
50433
  };
50434
+ var listOrganizationMcpConnections = (parameters, options) => {
50435
+ const params = buildClientParams([parameters], [
50436
+ {
50437
+ args: [
50438
+ { in: "headers", key: "X-Request-Id" },
50439
+ { in: "path", key: "organization_id" }
50440
+ ]
50441
+ }
50442
+ ]);
50443
+ return (options?.client ?? client).get({
50444
+ responseStyle: "data",
50445
+ security: [{ scheme: "bearer", type: "http" }],
50446
+ url: "/v1/organizations/{organization_id}/mcp-connections",
50447
+ ...options,
50448
+ ...params
50449
+ });
50450
+ };
50451
+ var revokeOrganizationMcpConnection = (parameters, options) => {
50452
+ const params = buildClientParams([parameters], [
50453
+ {
50454
+ args: [
50455
+ { in: "headers", key: "X-Request-Id" },
50456
+ { in: "path", key: "organization_id" },
50457
+ { in: "path", key: "connection_id" }
50458
+ ]
50459
+ }
50460
+ ]);
50461
+ return (options?.client ?? client).delete({
50462
+ responseStyle: "data",
50463
+ security: [{ scheme: "bearer", type: "http" }],
50464
+ url: "/v1/organizations/{organization_id}/mcp-connections/{connection_id}",
50465
+ ...options,
50466
+ ...params
50467
+ });
50468
+ };
50299
50469
  var getOrganizationReferral = (parameters, options) => {
50300
50470
  const params = buildClientParams([parameters], [
50301
50471
  {
@@ -52452,6 +52622,25 @@ var prepareManagedMailWebhook = (parameters, options) => {
52452
52622
  }
52453
52623
  });
52454
52624
  };
52625
+ var rotateManagedMailWebhookSecret = (parameters, options) => {
52626
+ const params = buildClientParams([parameters], [
52627
+ {
52628
+ args: [
52629
+ { in: "headers", key: "X-Request-Id" },
52630
+ { in: "headers", key: "Idempotency-Key" },
52631
+ { in: "path", key: "project_id" },
52632
+ { in: "path", key: "environment_id" }
52633
+ ]
52634
+ }
52635
+ ]);
52636
+ return (options?.client ?? client).post({
52637
+ responseStyle: "data",
52638
+ security: [{ scheme: "bearer", type: "http" }],
52639
+ url: "/v1/projects/{project_id}/environments/{environment_id}/mail-webhook:rotate",
52640
+ ...options,
52641
+ ...params
52642
+ });
52643
+ };
52455
52644
  var verifyManagedMailWebhook = (parameters, options) => {
52456
52645
  const params = buildClientParams([parameters], [
52457
52646
  {
@@ -52628,6 +52817,13 @@ function assertManagedMailResponse(value, input) {
52628
52817
  }
52629
52818
  return;
52630
52819
  }
52820
+ if (input.action === "webhook_rotate") {
52821
+ exact5(r, ["url", "signing_secret", "status"]);
52822
+ https(r["url"]);
52823
+ if (r["status"] !== "verification_required" || typeof r["signing_secret"] !== "string" || !/^whsec_[A-Za-z0-9+/]{43}=$/u.test(r["signing_secret"]))
52824
+ invalid5();
52825
+ return;
52826
+ }
52631
52827
  if (input.action === "webhook_set") {
52632
52828
  exact5(r, ["url", "signing_secret", "status"]);
52633
52829
  if (r["url"] !== input.url || r["status"] !== "verification_required" || typeof r["signing_secret"] !== "string" || !/^whsec_[A-Za-z0-9+/]{43}=$/u.test(r["signing_secret"]))
@@ -52774,6 +52970,8 @@ function requestManagedMail(client2, input) {
52774
52970
  }, { client: client2 });
52775
52971
  case "webhook_verify":
52776
52972
  return verifyManagedMailWebhook({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52973
+ case "webhook_rotate":
52974
+ return rotateManagedMailWebhookSecret({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52777
52975
  case "webhook_disable":
52778
52976
  return disableManagedMailReceiving({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52779
52977
  case "domain_delete":
@@ -53836,6 +54034,15 @@ var GeneratedSdkProductApi = class {
53836
54034
  async getGithubConnection(organizationId) {
53837
54035
  return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
53838
54036
  }
54037
+ async disconnectGithub(organizationId) {
54038
+ return disconnectGithubOrganization({ organization_id: organizationId }, { client: this.#client });
54039
+ }
54040
+ async listOrganizationMcpConnections(organizationId) {
54041
+ return listOrganizationMcpConnections({ organization_id: organizationId }, { client: this.#client });
54042
+ }
54043
+ async revokeOrganizationMcpConnection(input) {
54044
+ return revokeOrganizationMcpConnection({ organization_id: input.organizationId, connection_id: input.connectionId }, { client: this.#client });
54045
+ }
53839
54046
  async linkSource(input) {
53840
54047
  return linkProjectSource({
53841
54048
  "Idempotency-Key": input.idempotencyKey,
@@ -58585,6 +58792,7 @@ export {
58585
58792
  parsePaidDomainPlan,
58586
58793
  parsePaidDomain,
58587
58794
  parseCloudflareDnsAuthorization,
58795
+ parseGithubDisconnection,
58588
58796
  parseCloudflareDnsAuthorizationStatus,
58589
58797
  parseDevAccessState,
58590
58798
  parsePoweredByFlag,
package/dist/index.js CHANGED
@@ -68,6 +68,7 @@ import {
68
68
  parseCurrentIdentity,
69
69
  parseDevAccessState,
70
70
  parseDevAccessTicket,
71
+ parseGithubDisconnection,
71
72
  parseOperation,
72
73
  parseOperationEvent,
73
74
  parseOrganizationReferral,
@@ -102,7 +103,7 @@ import {
102
103
  selectWorkspace,
103
104
  verifiedUserId,
104
105
  workspaceOf
105
- } from "./chunk-4OAAJX5B.js";
106
+ } from "./chunk-HNFWXGDN.js";
106
107
  import {
107
108
  CredentialStoreIntegrityError,
108
109
  CredentialStoreUnavailableError,
@@ -325,6 +326,7 @@ export {
325
326
  parseCurrentIdentity,
326
327
  parseDevAccessState,
327
328
  parseDevAccessTicket,
329
+ parseGithubDisconnection,
328
330
  parseOperation,
329
331
  parseOperationEvent,
330
332
  parseOrganizationReferral,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amerged/ohmyhost-cli",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/product-cli",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "private": true,
5
5
  "ohmyhost": {
6
6
  "deployment": "production",
@@ -108,7 +108,10 @@ import {
108
108
  import {
109
109
  parseCloudflareDnsAuthorization,
110
110
  parseGithubConnectionAuthorization,
111
+ parseGithubDisconnection,
111
112
  parseGithubOrganizationConnectionStatus,
113
+ parseOrganizationMcpConnectionList,
114
+ parseOrganizationMcpConnectionRevocation,
112
115
  parseCloudflareDnsAuthorizationStatus,
113
116
  parseDeploymentPlan,
114
117
  parseProjectDataChangePlan,
@@ -352,6 +355,8 @@ const HELP_USAGE = Object.freeze({
352
355
  "github connect":
353
356
  "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
354
357
  "github status": "ohmyhost github status --organization ULID --json",
358
+ "github disconnect":
359
+ "ohmyhost github disconnect --organization ULID --yes --json (Owner only; revokes the workspace GitHub connection and every repository grant under it, so auto-deploy and linked sources stop at once; the GitHub App stays installed for other workspaces, and github connect starts a new connection)",
355
360
  "export create":
356
361
  "ohmyhost export create --project ULID --idempotency-key KEY --stdin --json (password on stdin only; one accepted SQL ZIP per project per 24 hours)",
357
362
  "export get":
@@ -381,6 +386,10 @@ const HELP_USAGE = Object.freeze({
381
386
  "ohmyhost organization list [--profile-name NAME] --json (the workspaces of the chosen login's user and the one that login is scoped to)",
382
387
  "organization use":
383
388
  "ohmyhost organization use --organization ULID [--profile-name NAME] --json (binds a login that has no organization yet; another organization needs its own login)",
389
+ "organization mcp-connections list":
390
+ "ohmyhost organization mcp-connections list --organization ULID --json (Owner only; lists each MCP client connected to this workspace and the member who connected it; disconnected consents are not listed)",
391
+ "organization mcp-connections revoke":
392
+ "ohmyhost organization mcp-connections revoke --organization ULID --connection UUID --yes --json (Owner only; disconnects one MCP client from this workspace only, and the member's other workspaces are unaffected; repeat until it answers revoked)",
384
393
  "operation get": "ohmyhost operation get OPERATION_ULID --json",
385
394
  "operation reconcile":
386
395
  "ohmyhost operation reconcile OPERATION_ULID --idempotency-key KEY --yes --json",
@@ -568,6 +577,8 @@ const HELP_USAGE = Object.freeze({
568
577
  "ohmyhost mail webhook verify --project ULID --environment ULID --idempotency-key KEY --json",
569
578
  "mail webhook disable":
570
579
  "ohmyhost mail webhook disable --project ULID --environment ULID --idempotency-key KEY --json",
580
+ "mail webhook rotate":
581
+ "ohmyhost mail webhook rotate --project ULID --environment ULID --idempotency-key KEY --yes --json (Owner only; issues a new signing secret for the same endpoint, stops the earlier secrets at once and ends receiving until the endpoint verifies the new one; the secret is returned once, so install it in Prod application secrets and never write it into files or notes)",
571
582
  "mail messages list":
572
583
  "ohmyhost mail messages list --project ULID --environment ULID [--after ULID] --json",
573
584
  "mail messages get":
@@ -863,6 +874,48 @@ export class ProductCli {
863
874
  }),
864
875
  });
865
876
  }
877
+ if (command.kind === "github-disconnect") {
878
+ const api = await this.authenticatedApi(command.credentialStore, signal);
879
+ const github = parseGithubDisconnection(await api.disconnectGithub(command.organizationId));
880
+ if (
881
+ github.connection !== null &&
882
+ github.connection.organization_id !== command.organizationId
883
+ )
884
+ throw new ResponseContractError();
885
+ return success(name, {
886
+ status: github.status,
887
+ github,
888
+ ...(github.status === "connected"
889
+ ? {}
890
+ : { next_action: this.githubConnectAction(command.organizationId) }),
891
+ });
892
+ }
893
+ if (command.kind === "organization-mcp-connections-list") {
894
+ const api = await this.authenticatedApi(command.credentialStore, signal);
895
+ const page = parseOrganizationMcpConnectionList(
896
+ await api.listOrganizationMcpConnections(command.organizationId),
897
+ );
898
+ return success(name, { status: "listed", connections: page.connections });
899
+ }
900
+ if (command.kind === "organization-mcp-connection-revoke") {
901
+ const api = await this.authenticatedApi(command.credentialStore, signal);
902
+ const revocation = parseOrganizationMcpConnectionRevocation(
903
+ await api.revokeOrganizationMcpConnection({
904
+ organizationId: command.organizationId,
905
+ connectionId: command.connectionId,
906
+ }),
907
+ );
908
+ return success(name, {
909
+ status: revocation.state,
910
+ revocation,
911
+ ...(revocation.state === "revoked"
912
+ ? {}
913
+ : {
914
+ next_action:
915
+ "Repeat this exact command until status is revoked; the client's active provider use is still draining.",
916
+ }),
917
+ });
918
+ }
866
919
  if (command.kind === "whoami") return await this.getCurrentIdentity(command, signal);
867
920
  if (
868
921
  command.kind === "token-create" ||
@@ -3702,6 +3755,11 @@ const parsedCommandName = (command: ProductCliCommand): CommandLabel => {
3702
3755
  if (command.kind === "organization-use") return "organization use";
3703
3756
  if (command.kind === "github-connect") return "github connect";
3704
3757
  if (command.kind === "github-status") return "github status";
3758
+ if (command.kind === "github-disconnect") return "github disconnect";
3759
+ if (command.kind === "organization-mcp-connections-list")
3760
+ return "organization mcp-connections list";
3761
+ if (command.kind === "organization-mcp-connection-revoke")
3762
+ return "organization mcp-connections revoke";
3705
3763
  if (command.kind === "project-list") return "project list";
3706
3764
  if (command.kind === "database-compute-set") return "database compute set";
3707
3765
  if (command.kind === "database-compute-get") return "database compute get";
@@ -1,4 +1,5 @@
1
1
  import { isUserSecretName } from "@ohmyhost/contracts/secret-names";
2
+ import { MCP_CONNECTION_ID_PATTERN } from "@ohmyhost/contracts/organization-mcp-connections";
2
3
  import {
3
4
  DATABASE_PAGE_MAX_ITEMS,
4
5
  parseDatabaseCursor,
@@ -124,6 +125,24 @@ export type ProductCliCommand =
124
125
  readonly organizationId: string;
125
126
  readonly credentialStore: "native";
126
127
  }
128
+ | {
129
+ readonly kind: "github-disconnect";
130
+ readonly organizationId: string;
131
+ readonly yes: true;
132
+ readonly credentialStore: "native";
133
+ }
134
+ | {
135
+ readonly kind: "organization-mcp-connections-list";
136
+ readonly organizationId: string;
137
+ readonly credentialStore: "native";
138
+ }
139
+ | {
140
+ readonly kind: "organization-mcp-connection-revoke";
141
+ readonly organizationId: string;
142
+ readonly connectionId: string;
143
+ readonly yes: true;
144
+ readonly credentialStore: "native";
145
+ }
127
146
  | ({
128
147
  readonly kind: "database-compute-set";
129
148
  readonly projectId: string;
@@ -746,6 +765,7 @@ export type ProductCliCommand =
746
765
  | "mail webhook set"
747
766
  | "mail webhook verify"
748
767
  | "mail webhook disable"
768
+ | "mail webhook rotate"
749
769
  | "mail messages list"
750
770
  | "mail messages get"
751
771
  | "mail messages retry";
@@ -1049,8 +1069,11 @@ export type RecognizedCommandLabel =
1049
1069
  | "organization create"
1050
1070
  | "organization list"
1051
1071
  | "organization use"
1072
+ | "organization mcp-connections list"
1073
+ | "organization mcp-connections revoke"
1052
1074
  | "github connect"
1053
1075
  | "github status"
1076
+ | "github disconnect"
1054
1077
  | "project list"
1055
1078
  | "project status"
1056
1079
  | "project dev-access create"
@@ -1115,6 +1138,7 @@ export type RecognizedCommandLabel =
1115
1138
  | "mail webhook set"
1116
1139
  | "mail webhook verify"
1117
1140
  | "mail webhook disable"
1141
+ | "mail webhook rotate"
1118
1142
  | "mail messages list"
1119
1143
  | "mail messages get"
1120
1144
  | "mail messages retry"
@@ -1175,6 +1199,7 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
1175
1199
  if (value === "profile" && values[0] === "list") return "profile list";
1176
1200
  if (value === "github" && values[0] === "connect") return "github connect";
1177
1201
  if (value === "github" && values[0] === "status") return "github status";
1202
+ if (value === "github" && values[0] === "disconnect") return "github disconnect";
1178
1203
  if (value === "operation" && values[0] === "get") return "operation get";
1179
1204
  if (value === "credits" && values[0] === "account") return "credits account";
1180
1205
  if (value === "referral" && values[0] === "link") return "referral link";
@@ -1207,6 +1232,10 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
1207
1232
  if (value === "organization" && values[0] === "create") return "organization create";
1208
1233
  if (value === "organization" && values[0] === "list") return "organization list";
1209
1234
  if (value === "organization" && values[0] === "use") return "organization use";
1235
+ if (value === "organization" && values[0] === "mcp-connections") {
1236
+ if (values[1] === "list") return "organization mcp-connections list";
1237
+ if (values[1] === "revoke") return "organization mcp-connections revoke";
1238
+ }
1210
1239
  if (value === "project" && values[0] === "list") return "project list";
1211
1240
  if (value === "project" && values[0] === "context") return "project context";
1212
1241
  if (value === "project" && values[0] === "notes" && values[1] === "set")
@@ -1330,6 +1359,7 @@ export const recognizedCommandLabel = (argv: readonly string[]): RecognizedComma
1330
1359
  if (values[1] === "set") return "mail webhook set";
1331
1360
  if (values[1] === "verify") return "mail webhook verify";
1332
1361
  if (values[1] === "disable") return "mail webhook disable";
1362
+ if (values[1] === "rotate") return "mail webhook rotate";
1333
1363
  }
1334
1364
  if (values[0] === "messages") {
1335
1365
  if (values[1] === "list") return "mail messages list";
@@ -1970,14 +2000,19 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
1970
2000
  }
1971
2001
  if (first === "github") {
1972
2002
  const subcommand = values.shift();
1973
- if (yes || wait || follow || stdin) throw new InvalidCommandError();
1974
- if (subcommand !== "connect" && subcommand !== "status") throw new InvalidCommandError();
2003
+ if (wait || follow || stdin) throw new InvalidCommandError();
2004
+ if (subcommand !== "connect" && subcommand !== "status" && subcommand !== "disconnect")
2005
+ throw new InvalidCommandError();
2006
+ // Only disconnecting is destructive, and it requires --yes; the route reads no idempotency key.
2007
+ if (yes !== (subcommand === "disconnect")) throw new InvalidCommandError();
1975
2008
  const options = parseOptions(
1976
2009
  values,
1977
2010
  subcommand === "connect" ? ["--organization", "--idempotency-key"] : ["--organization"],
1978
2011
  );
1979
2012
  const organizationId = options["--organization"];
1980
2013
  if (!ORGANIZATION_ULID.test(organizationId)) throw new InvalidCommandError();
2014
+ if (subcommand === "disconnect")
2015
+ return { kind: "github-disconnect", organizationId, yes: true, credentialStore };
1981
2016
  return subcommand === "connect"
1982
2017
  ? {
1983
2018
  kind: "github-connect",
@@ -1987,6 +2022,33 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
1987
2022
  }
1988
2023
  : { kind: "github-status", organizationId, credentialStore };
1989
2024
  }
2025
+ if (first === "organization" && values[0] === "mcp-connections") {
2026
+ values.shift();
2027
+ const subcommand = values.shift();
2028
+ if (wait || follow || stdin) throw new InvalidCommandError();
2029
+ // Only disconnecting a client is destructive, and it requires --yes; the route reads no key.
2030
+ if (yes !== (subcommand === "revoke")) throw new InvalidCommandError();
2031
+ if (subcommand === "list") {
2032
+ const organizationId = parseOptions(values, ["--organization"])["--organization"];
2033
+ if (!ORGANIZATION_ULID.test(organizationId)) throw new InvalidCommandError();
2034
+ return { kind: "organization-mcp-connections-list", organizationId, credentialStore };
2035
+ }
2036
+ if (subcommand === "revoke") {
2037
+ const options = parseOptions(values, ["--organization", "--connection"]);
2038
+ const organizationId = options["--organization"];
2039
+ const connectionId = options["--connection"];
2040
+ if (!ORGANIZATION_ULID.test(organizationId) || !MCP_CONNECTION_ID_PATTERN.test(connectionId))
2041
+ throw new InvalidCommandError();
2042
+ return {
2043
+ kind: "organization-mcp-connection-revoke",
2044
+ organizationId,
2045
+ connectionId,
2046
+ yes: true,
2047
+ credentialStore,
2048
+ };
2049
+ }
2050
+ throw new InvalidCommandError();
2051
+ }
1990
2052
  if (first === "organization") {
1991
2053
  const subcommand = values.shift();
1992
2054
  if (yes || wait || follow || stdin) throw new InvalidCommandError();
@@ -3310,20 +3372,27 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
3310
3372
  const area = values.shift();
3311
3373
  const sub =
3312
3374
  area === "webhook" || area === "messages" || area === "domain" ? values.shift() : undefined;
3313
- // Only retiring the mail domain is destructive, and it requires --yes.
3375
+ // Only retiring the mail domain and rotating the webhook secret are destructive: each needs --yes.
3314
3376
  const retiring = area === "domain" && sub === "delete";
3315
- if (yes !== retiring || wait || follow || stdin) throw new InvalidCommandError();
3316
- const options = parseOptionalOptions(values, [
3317
- "--project",
3318
- "--environment",
3319
- "--domain",
3320
- "--sending",
3321
- "--receiving",
3322
- "--url",
3323
- "--idempotency-key",
3324
- "--message",
3325
- "--after",
3326
- ]);
3377
+ const rotating = area === "webhook" && sub === "rotate";
3378
+ if (yes !== (retiring || rotating) || wait || follow || stdin) throw new InvalidCommandError();
3379
+ // Rotation takes only its scope and key, so any other option is refused rather than dropped.
3380
+ const options = parseOptionalOptions(
3381
+ values,
3382
+ rotating
3383
+ ? ["--project", "--environment", "--idempotency-key"]
3384
+ : [
3385
+ "--project",
3386
+ "--environment",
3387
+ "--domain",
3388
+ "--sending",
3389
+ "--receiving",
3390
+ "--url",
3391
+ "--idempotency-key",
3392
+ "--message",
3393
+ "--after",
3394
+ ],
3395
+ );
3327
3396
  const required = (key: keyof typeof options) => {
3328
3397
  const value = options[key];
3329
3398
  if (!value) throw new InvalidCommandError();
@@ -3364,6 +3433,13 @@ export const parseProductCliCommand = (argv: readonly string[]): ProductCliComma
3364
3433
  idempotencyKey: required("--idempotency-key"),
3365
3434
  };
3366
3435
  label = "mail webhook set";
3436
+ } else if (rotating) {
3437
+ request = {
3438
+ ...scope,
3439
+ action: "webhook_rotate",
3440
+ idempotencyKey: required("--idempotency-key"),
3441
+ };
3442
+ label = "mail webhook rotate";
3367
3443
  } else if (area === "webhook" && (sub === "verify" || sub === "disable")) {
3368
3444
  request = {
3369
3445
  ...scope,
@@ -24,6 +24,7 @@ export {
24
24
  parseCloudflareDnsAuthorizationStatus,
25
25
  parsePaidDomain,
26
26
  parsePaidDomainPlan,
27
+ parseGithubDisconnection,
27
28
  parseOperation,
28
29
  parseOperationEvent,
29
30
  parseSafeProblem,
@@ -136,8 +136,13 @@ import {
136
136
  type Organization,
137
137
  type GithubConnectionAuthorization,
138
138
  type GithubOrganizationConnectionStatus,
139
+ type OrganizationMcpConnectionList,
140
+ type OrganizationMcpConnectionRevocation,
139
141
  connectGithubOrganization,
140
142
  getGithubOrganizationConnection,
143
+ disconnectGithubOrganization,
144
+ listOrganizationMcpConnections,
145
+ revokeOrganizationMcpConnection,
141
146
  deleteEnvironmentSecret,
142
147
  deleteProject,
143
148
  deletePaidProjectDomain,
@@ -548,6 +553,12 @@ export interface ProductApi {
548
553
  readonly idempotencyKey: string;
549
554
  }): Promise<GithubConnectionAuthorization>;
550
555
  getGithubConnection(organizationId: string): Promise<GithubOrganizationConnectionStatus>;
556
+ disconnectGithub(organizationId: string): Promise<GithubOrganizationConnectionStatus>;
557
+ listOrganizationMcpConnections(organizationId: string): Promise<OrganizationMcpConnectionList>;
558
+ revokeOrganizationMcpConnection(input: {
559
+ readonly organizationId: string;
560
+ readonly connectionId: string;
561
+ }): Promise<OrganizationMcpConnectionRevocation>;
551
562
  linkSource(input: {
552
563
  readonly projectId: string;
553
564
  readonly repositoryOwner: string;
@@ -1556,6 +1567,34 @@ export class GeneratedSdkProductApi implements ProductApi {
1556
1567
  );
1557
1568
  }
1558
1569
 
1570
+ public async disconnectGithub(
1571
+ organizationId: string,
1572
+ ): Promise<GithubOrganizationConnectionStatus> {
1573
+ return disconnectGithubOrganization(
1574
+ { organization_id: organizationId },
1575
+ { client: this.#client },
1576
+ );
1577
+ }
1578
+
1579
+ public async listOrganizationMcpConnections(
1580
+ organizationId: string,
1581
+ ): Promise<OrganizationMcpConnectionList> {
1582
+ return listOrganizationMcpConnections(
1583
+ { organization_id: organizationId },
1584
+ { client: this.#client },
1585
+ );
1586
+ }
1587
+
1588
+ public async revokeOrganizationMcpConnection(input: {
1589
+ readonly organizationId: string;
1590
+ readonly connectionId: string;
1591
+ }): Promise<OrganizationMcpConnectionRevocation> {
1592
+ return revokeOrganizationMcpConnection(
1593
+ { organization_id: input.organizationId, connection_id: input.connectionId },
1594
+ { client: this.#client },
1595
+ );
1596
+ }
1597
+
1559
1598
  public async linkSource(input: {
1560
1599
  readonly projectId: string;
1561
1600
  readonly repositoryOwner: string;
@@ -1,4 +1,5 @@
1
1
  import { parseFeedbackSubmissionDetail } from "@ohmyhost/contracts/feedback";
2
+ import { MCP_CONNECTION_ID_PATTERN } from "@ohmyhost/contracts/organization-mcp-connections";
2
3
  import {
3
4
  assertGithubSourceResponse,
4
5
  assertManagedSourceResponse,
@@ -20,6 +21,8 @@ import type {
20
21
  GithubOrganizationConnection,
21
22
  GithubOrganizationConnectionStatus,
22
23
  OrganizationCredits,
24
+ OrganizationMcpConnectionList,
25
+ OrganizationMcpConnectionRevocation,
23
26
  ProjectCreditBudget,
24
27
  } from "@ohmyhost/sdk-ts";
25
28
  import { isSaasCnameTarget, type SaasCnameTarget } from "@ohmyhost/contracts/platform-origins";
@@ -331,6 +334,41 @@ export const parseGithubOrganizationConnectionStatus = (
331
334
  return input as unknown as GithubOrganizationConnectionStatus;
332
335
  };
333
336
 
337
+ export const parseOrganizationMcpConnectionList = (
338
+ value: unknown,
339
+ ): OrganizationMcpConnectionList => {
340
+ const input = exactRecord(value, ["connections"]);
341
+ if (!Array.isArray(input["connections"])) throw new ResponseContractError();
342
+ for (const item of input["connections"]) {
343
+ const connection = exactRecord(item, ["connection_id", "client_id", "user_id", "connected_at"]);
344
+ if (
345
+ typeof connection["connection_id"] !== "string" ||
346
+ !MCP_CONNECTION_ID_PATTERN.test(connection["connection_id"]) ||
347
+ !boundedString(connection["client_id"], 1, 2048) ||
348
+ !boundedString(connection["user_id"], 1, 256) ||
349
+ !isIsoInstant(connection["connected_at"])
350
+ )
351
+ throw new ResponseContractError();
352
+ }
353
+ return input as unknown as OrganizationMcpConnectionList;
354
+ };
355
+
356
+ export const parseOrganizationMcpConnectionRevocation = (
357
+ value: unknown,
358
+ ): OrganizationMcpConnectionRevocation => {
359
+ const input = exactRecord(value, ["state"]);
360
+ if (input["state"] !== "pending" && input["state"] !== "revoked")
361
+ throw new ResponseContractError();
362
+ return input as unknown as OrganizationMcpConnectionRevocation;
363
+ };
364
+
365
+ /** A disconnect answer that still reports a live connection did not disconnect, so it is refused. */
366
+ export const parseGithubDisconnection = (value: unknown): GithubOrganizationConnectionStatus => {
367
+ const status = parseGithubOrganizationConnectionStatus(value);
368
+ if (status.status === "connected") throw new ResponseContractError();
369
+ return status;
370
+ };
371
+
334
372
  export const parseGithubConnectionAuthorization = (
335
373
  value: unknown,
336
374
  ): GithubConnectionAuthorization => {
@@ -162,6 +162,11 @@
162
162
  "types": "./dist/secret-names.d.ts",
163
163
  "import": "./dist/secret-names.js"
164
164
  },
165
+ "./organization-mcp-connections": {
166
+ "source": "./src/organization-mcp-connections.ts",
167
+ "types": "./dist/organization-mcp-connections.d.ts",
168
+ "import": "./dist/organization-mcp-connections.js"
169
+ },
165
170
  "./project-data-changes": {
166
171
  "source": "./src/project-data-changes.ts",
167
172
  "types": "./dist/project-data-changes.d.ts",
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The connection_id of one workspace MCP consent. The public contract names it as a UUID; the
3
+ * clients accept any hex UUID in the 8-4-4-4-12 form, so a server id that RFC 4122 would refuse is
4
+ * still reachable from the CLI and the MCP tools.
5
+ */
6
+ export const MCP_CONNECTION_ID_PATTERN =
7
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu;
@@ -611,18 +611,18 @@ export const PROBLEM_POLICY = {
611
611
  status: 409,
612
612
  retryable: false,
613
613
  action:
614
- "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
614
+ "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
615
615
  restAction:
616
- "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json), add the _omh-project.HOST TXT record it returns, run application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again.",
616
+ "A live connection holds it; its holder removes it with ohmyhost domain paid delete --project ULID --hostname HOST --yes --json. To connect it here, add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json.",
617
617
  title: "Domain hostname is already connected",
618
618
  },
619
619
  domain_ownership_required: {
620
620
  status: 409,
621
621
  retryable: false,
622
622
  action:
623
- "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
623
+ "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
624
624
  restAction:
625
- "This hostname is not verified for this project yet. Run application_domain_identity_declare (CLI: ohmyhost mail identity declare --project ULID --hostname HOST --idempotency-key KEY --json) and add the _omh-project.HOST TXT record it returns; then application_domain_identity_verify (CLI: ohmyhost mail identity verify --project ULID --expected-revision N --idempotency-key KEY --json), then apply again. Repeating before then cannot work.",
625
+ "This hostname is not verified for this project yet. Add the _omh-project.HOST TXT record that ohmyhost domain paid status --project ULID --json shows for it, then apply again with ohmyhost domain paid apply --project ULID --hostname HOST --idempotency-key KEY --json. Repeating before the record is published cannot work.",
626
626
  title: "Verify the domain before connecting it",
627
627
  },
628
628
  domain_dns_conflict: {
@@ -10,12 +10,19 @@ const FIXED_PLATFORM_NAMES = new Set([
10
10
  "IMAGES",
11
11
  "STORAGE",
12
12
  ]);
13
- const INSTALLED_PLATFORM_KEYS = new Set([
13
+ /** The four keys the platform installs; control-store's rotation accepts exactly these names. */
14
+ export const INSTALLED_PLATFORM_KEY_NAMES = [
14
15
  "OHMYHOST_STORAGE_KEY",
15
16
  "OHMYHOST_MAIL_KEY",
16
17
  "OHMYHOST_AI_KEY",
17
18
  "BETTER_AUTH_SECRET",
18
- ]);
19
+ ] as const;
20
+ const INSTALLED_PLATFORM_KEYS = new Set<string>(INSTALLED_PLATFORM_KEY_NAMES);
21
+
22
+ /** The four keys the platform installs. An owner may rotate them; a customer may never set or delete them. */
23
+ export function isInstalledPlatformKeyName(value: unknown): value is string {
24
+ return typeof value === "string" && INSTALLED_PLATFORM_KEYS.has(value);
25
+ }
19
26
 
20
27
  export function isUserSecretName(
21
28
  value: unknown,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -141,6 +141,7 @@ export {
141
141
  revokeUserApiKey,
142
142
  revokeWorkspaceMailDomainDnsAuthorization,
143
143
  rollbackDeployment,
144
+ rotateEnvironmentSecret,
144
145
  rotateManagedMailWebhookSecret,
145
146
  rotateProjectDevShareLink,
146
147
  runProjectDatabaseSchedule,
@@ -1057,6 +1058,11 @@ export type {
1057
1058
  RollbackDeploymentErrors,
1058
1059
  RollbackDeploymentResponse,
1059
1060
  RollbackDeploymentResponses,
1061
+ RotateEnvironmentSecretData,
1062
+ RotateEnvironmentSecretError,
1063
+ RotateEnvironmentSecretErrors,
1064
+ RotateEnvironmentSecretResponse,
1065
+ RotateEnvironmentSecretResponses,
1060
1066
  RotateManagedMailWebhookSecretData,
1061
1067
  RotateManagedMailWebhookSecretError,
1062
1068
  RotateManagedMailWebhookSecretErrors,
@@ -326,6 +326,8 @@ import type {
326
326
  RevokeWorkspaceMailDomainDnsAuthorizationResponses,
327
327
  RollbackDeploymentErrors,
328
328
  RollbackDeploymentResponses,
329
+ RotateEnvironmentSecretErrors,
330
+ RotateEnvironmentSecretResponses,
329
331
  RotateManagedMailWebhookSecretErrors,
330
332
  RotateManagedMailWebhookSecretResponses,
331
333
  RotateProjectDevShareLinkErrors,
@@ -6791,6 +6793,54 @@ export const putEnvironmentSecret = <ThrowOnError extends boolean = true>(
6791
6793
  });
6792
6794
  };
6793
6795
 
6796
+ /**
6797
+ * Rotate an installed platform key
6798
+ *
6799
+ * Replaces the value of an installed platform key (OHMYHOST_AI_KEY, OHMYHOST_MAIL_KEY, OHMYHOST_STORAGE_KEY or BETTER_AUTH_SECRET) with a value the platform generates. The request has no body and the value is never returned. The earlier value stops authorizing at once, and the new value reaches the running environment without a deployment. Other names answer 400; an installed key the environment does not hold answers 404. Repeating the same idempotency key replays the stored metadata.
6800
+ */
6801
+ export const rotateEnvironmentSecret = <ThrowOnError extends boolean = true>(
6802
+ parameters: {
6803
+ "X-Request-Id"?: string;
6804
+ "Idempotency-Key": string;
6805
+ project_id: Ulid;
6806
+ environment_id: Ulid;
6807
+ secret_name: string;
6808
+ },
6809
+ options?: Options<never, ThrowOnError>,
6810
+ ): RequestResult<
6811
+ RotateEnvironmentSecretResponses,
6812
+ RotateEnvironmentSecretErrors,
6813
+ ThrowOnError,
6814
+ "data"
6815
+ > => {
6816
+ const params = buildClientParams(
6817
+ [parameters],
6818
+ [
6819
+ {
6820
+ args: [
6821
+ { in: "headers", key: "X-Request-Id" },
6822
+ { in: "headers", key: "Idempotency-Key" },
6823
+ { in: "path", key: "project_id" },
6824
+ { in: "path", key: "environment_id" },
6825
+ { in: "path", key: "secret_name" },
6826
+ ],
6827
+ },
6828
+ ],
6829
+ );
6830
+ return (options?.client ?? client).post<
6831
+ RotateEnvironmentSecretResponses,
6832
+ RotateEnvironmentSecretErrors,
6833
+ ThrowOnError,
6834
+ "data"
6835
+ >({
6836
+ responseStyle: "data",
6837
+ security: [{ scheme: "bearer", type: "http" }],
6838
+ url: "/v1/projects/{project_id}/environments/{environment_id}/secrets/{secret_name}/rotate",
6839
+ ...options,
6840
+ ...params,
6841
+ });
6842
+ };
6843
+
6794
6844
  /**
6795
6845
  * Get an operation
6796
6846
  */
@@ -522,7 +522,7 @@ export type PaidDomainPlan = {
522
522
  };
523
523
 
524
524
  /**
525
- * awaiting_deployment means the requested hostname is declared but not provisioned. Its hostname is present, suspension_reason, custom_hostname_status, ssl_status and url are null, and validation_records is empty. Authorize Cloudflare, deploy to Prod, then repeat the same apply.
525
+ * awaiting_deployment means the requested hostname is declared but not provisioned. Its hostname is present, suspension_reason, custom_hostname_status, ssl_status and url are null. validation_records holds only the _omh-project TXT ownership record while the hostname is not yet proven, and is empty once it is proven. Publish that record, authorize Cloudflare, deploy to Prod, then repeat the same apply.
526
526
  */
527
527
  export type PaidDomain = {
528
528
  status:
@@ -11300,6 +11300,80 @@ export type PutEnvironmentSecretResponses = {
11300
11300
  export type PutEnvironmentSecretResponse =
11301
11301
  PutEnvironmentSecretResponses[keyof PutEnvironmentSecretResponses];
11302
11302
 
11303
+ export type RotateEnvironmentSecretData = {
11304
+ body?: never;
11305
+ headers: {
11306
+ /**
11307
+ * Optional caller-provided correlation identifier.
11308
+ */
11309
+ "X-Request-Id"?: string;
11310
+ /**
11311
+ * Identifies one mutation and its canonical request payload.
11312
+ */
11313
+ "Idempotency-Key": string;
11314
+ };
11315
+ path: {
11316
+ /**
11317
+ * Project identifier.
11318
+ */
11319
+ project_id: Ulid;
11320
+ /**
11321
+ * Environment identifier.
11322
+ */
11323
+ environment_id: Ulid;
11324
+ /**
11325
+ * Uppercase environment-variable name.
11326
+ */
11327
+ secret_name: string;
11328
+ };
11329
+ query?: never;
11330
+ url: "/v1/projects/{project_id}/environments/{environment_id}/secrets/{secret_name}/rotate";
11331
+ };
11332
+
11333
+ export type RotateEnvironmentSecretErrors = {
11334
+ /**
11335
+ * The request failed.
11336
+ */
11337
+ 400: ProblemDetails;
11338
+ /**
11339
+ * The request failed.
11340
+ */
11341
+ 401: ProblemDetails;
11342
+ /**
11343
+ * The request failed.
11344
+ */
11345
+ 403: ProblemDetails;
11346
+ /**
11347
+ * The resource does not exist or is not visible to the authenticated principal.
11348
+ */
11349
+ 404: ProblemDetails;
11350
+ /**
11351
+ * The idempotency key was already used with a different canonical request.
11352
+ */
11353
+ 409: IdempotencyConflictProblem;
11354
+ /**
11355
+ * The request failed.
11356
+ */
11357
+ 429: ProblemDetails;
11358
+ /**
11359
+ * The request failed.
11360
+ */
11361
+ 503: ProblemDetails;
11362
+ };
11363
+
11364
+ export type RotateEnvironmentSecretError =
11365
+ RotateEnvironmentSecretErrors[keyof RotateEnvironmentSecretErrors];
11366
+
11367
+ export type RotateEnvironmentSecretResponses = {
11368
+ /**
11369
+ * Rotated secret metadata. The value is never returned.
11370
+ */
11371
+ 200: EnvironmentSecret;
11372
+ };
11373
+
11374
+ export type RotateEnvironmentSecretResponse =
11375
+ RotateEnvironmentSecretResponses[keyof RotateEnvironmentSecretResponses];
11376
+
11303
11377
  export type GetOperationData = {
11304
11378
  body?: never;
11305
11379
  headers?: {
@@ -49,6 +49,18 @@ export function assertManagedMailResponse(value: unknown, input: ManagedMailComm
49
49
  }
50
50
  return;
51
51
  }
52
+ if (input.action === "webhook_rotate") {
53
+ // The rotated secret is the only answer that carries it; the endpoint is the one already set.
54
+ exact(r, ["url", "signing_secret", "status"]);
55
+ https(r["url"]);
56
+ if (
57
+ r["status"] !== "verification_required" ||
58
+ typeof r["signing_secret"] !== "string" ||
59
+ !/^whsec_[A-Za-z0-9+/]{43}=$/u.test(r["signing_secret"])
60
+ )
61
+ invalid();
62
+ return;
63
+ }
52
64
  if (input.action === "webhook_set") {
53
65
  exact(r, ["url", "signing_secret", "status"]);
54
66
  if (
@@ -6,6 +6,7 @@ import {
6
6
  prepareManagedMailWebhook,
7
7
  verifyManagedMailWebhook,
8
8
  disableManagedMailReceiving,
9
+ rotateManagedMailWebhookSecret,
9
10
  deleteManagedMailDomain,
10
11
  listManagedMailMessages,
11
12
  getManagedMailMessage,
@@ -21,7 +22,10 @@ export type ManagedMailCommand = { projectId: string; environmentId: string } &
21
22
  }
22
23
  | { action: "status" }
23
24
  | { action: "webhook_set"; url: string; idempotencyKey: string }
24
- | { action: "webhook_verify" | "webhook_disable" | "domain_delete"; idempotencyKey: string }
25
+ | {
26
+ action: "webhook_verify" | "webhook_disable" | "webhook_rotate" | "domain_delete";
27
+ idempotencyKey: string;
28
+ }
25
29
  | { action: "messages_list"; after?: string }
26
30
  | { action: "message_get"; messageId: string }
27
31
  | { action: "message_retry"; messageId: string; idempotencyKey: string }
@@ -59,6 +63,11 @@ function requestManagedMail(client: Client, input: ManagedMailCommand) {
59
63
  { ...scope, "Idempotency-Key": input.idempotencyKey },
60
64
  { client },
61
65
  );
66
+ case "webhook_rotate":
67
+ return rotateManagedMailWebhookSecret(
68
+ { ...scope, "Idempotency-Key": input.idempotencyKey },
69
+ { client },
70
+ );
62
71
  case "webhook_disable":
63
72
  return disableManagedMailReceiving(
64
73
  { ...scope, "Idempotency-Key": input.idempotencyKey },