@amerged/ohmyhost-cli 0.1.54 → 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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/bin.js +1 -1
  3. package/dist/{chunk-ZEKUTE7M.js → chunk-HNFWXGDN.js} +511 -60
  4. package/dist/index.js +3 -1
  5. package/package.json +1 -1
  6. package/src/apps/product-cli/package.json +1 -1
  7. package/src/apps/product-cli/src/cli.ts +128 -25
  8. package/src/apps/product-cli/src/command.ts +143 -20
  9. package/src/apps/product-cli/src/index.ts +1 -0
  10. package/src/apps/product-cli/src/product-api.ts +75 -2
  11. package/src/apps/product-cli/src/repository-init.ts +46 -9
  12. package/src/apps/product-cli/src/runtime-contract.ts +52 -4
  13. package/src/packages/contracts/package.json +10 -0
  14. package/src/packages/contracts/src/database-events.ts +1 -0
  15. package/src/packages/contracts/src/database-migration-admission.ts +33 -3
  16. package/src/packages/contracts/src/database-migration-errors.ts +10 -2
  17. package/src/packages/contracts/src/feedback.ts +9 -0
  18. package/src/packages/contracts/src/framework-admission.ts +4 -0
  19. package/src/packages/contracts/src/framework-source-rules.ts +55 -0
  20. package/src/packages/contracts/src/operation-failure.ts +8 -0
  21. package/src/packages/contracts/src/organization-mcp-connections.ts +7 -0
  22. package/src/packages/contracts/src/problem-policy.ts +74 -2
  23. package/src/packages/contracts/src/project-exports.ts +30 -0
  24. package/src/packages/contracts/src/secret-names.ts +9 -2
  25. package/src/packages/contracts/src/wfp-dispatch.ts +43 -0
  26. package/src/packages/sdk-ts/package.json +1 -1
  27. package/src/packages/sdk-ts/src/generated/index.ts +39 -0
  28. package/src/packages/sdk-ts/src/generated/sdk.gen.ts +303 -13
  29. package/src/packages/sdk-ts/src/generated/types.gen.ts +460 -12
  30. package/src/packages/sdk-ts/src/managed-mail-response.ts +12 -0
  31. package/src/packages/sdk-ts/src/managed-mail.ts +10 -1
  32. package/src/packages/workos-auth-contracts/src/webhooks.ts +7 -0
@@ -38526,6 +38526,10 @@ var FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
38526
38526
  paths: ["module"],
38527
38527
  template: `"{{path}}" imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". ${PUSH_AND_PLAN}`
38528
38528
  },
38529
+ socket_primitive_unsupported: {
38530
+ paths: ["module"],
38531
+ template: `"{{path}}" loads cloudflare:sockets; customer Workers cannot open sockets. Call HTTPS services through the global fetch function and declare each origin in runtime.egress.allow in ohmyhost.yaml. ${PUSH_AND_PLAN}`
38532
+ },
38529
38533
  source_syntax_invalid: {
38530
38534
  paths: ["module"],
38531
38535
  template: 'Invalid JavaScript or TypeScript in "{{path}}". Fix the file, commit and push the change, then plan the new commit.'
@@ -38977,6 +38981,14 @@ var failures = {
38977
38981
  promotion_target_stale: [
38978
38982
  "The Prod deployment changed before promotion could start.",
38979
38983
  "Read current Prod status, run 'ohmyhost deployment promote plan' again and confirm it with the new resource_etag and confirmation_token. Replaying this terminal operation cannot replace its stale target."
38984
+ ],
38985
+ project_handle_taken: [
38986
+ "The requested project handle was taken before the rename could finish. The project keeps its current handle.",
38987
+ "Run 'ohmyhost project handle check --handle NAME --json' or MCP project_handle_check, choose a handle that is still free, then submit the rename again with the current ETag and a new idempotency key. Replaying this terminal operation cannot take the handle."
38988
+ ],
38989
+ managed_source_dispatch_failed: [
38990
+ "The managed source change could not be dispatched for processing, so it was ended.",
38991
+ "Read the current source to confirm it did not change, then submit the change again with a new idempotency key."
38980
38992
  ]
38981
38993
  };
38982
38994
  function publicOperationReconciliation(observation) {
@@ -39904,6 +39916,7 @@ var detailSentence = new RegExp("^" + detailPrefix + "((?: (?:" + [
39904
39916
  "(?:title|description) must be a string\\.",
39905
39917
  "(?:title|description) must not be empty\\.",
39906
39918
  "(?:title|description) must not start or end with whitespace; trim it\\.",
39919
+ "(?:title|description) must not contain a credential, key or connection string; remove it and submit again\\.",
39907
39920
  "(?:title|description) has [1-9][0-9]{0,8} characters, over the (?:160|8000)-character limit; shorten it, it is never truncated\\.",
39908
39921
  "title must not contain line breaks, tabs or other control characters\\.",
39909
39922
  "description must not contain control characters other than tabs and line breaks, such as terminal color codes\\.",
@@ -39953,6 +39966,9 @@ function hasControlCharacter2(value, multiline) {
39953
39966
  });
39954
39967
  }
39955
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
+
39956
39972
  // packages/contracts/dist/project-data-changes.js
39957
39973
  var PROJECT_DATA_CHANGE_KINDS = [
39958
39974
  "isolate_prod_keeps_data",
@@ -40336,6 +40352,12 @@ var PROBLEM_POLICY = {
40336
40352
  action: "The project already answers on this address; no rename is needed.",
40337
40353
  title: "Project address is unchanged"
40338
40354
  },
40355
+ database_limit_reached: {
40356
+ status: 409,
40357
+ retryable: false,
40358
+ action: "Delete a database you no longer need, or the project whose database it is, then deploy again. The limit counts the organization's live databases.",
40359
+ title: "Database limit reached"
40360
+ },
40339
40361
  project_rename_blocked: {
40340
40362
  status: 409,
40341
40363
  retryable: true,
@@ -40410,6 +40432,12 @@ var PROBLEM_POLICY = {
40410
40432
  action: "Read the workspace sender resource and project binding. Reuse requires explicit domain-use authority, target-project editing and a current verified application identity with the same registrable main domain. Read the current revision before changing settings. Detach a shared project binding explicitly; legacy domain deletion cannot retire a resource used by another project.",
40411
40433
  title: "Mail domain conflict"
40412
40434
  },
40435
+ mail_domain_pending_limit: {
40436
+ status: 409,
40437
+ retryable: false,
40438
+ action: "This organization already holds the maximum number of unverified workspace mail domains. Verify one of them, or retire an unused one, and then add this domain again.",
40439
+ title: "Mail domain pending limit"
40440
+ },
40413
40441
  mail_domain_required: {
40414
40442
  status: 409,
40415
40443
  retryable: false,
@@ -40488,6 +40516,12 @@ var PROBLEM_POLICY = {
40488
40516
  action: "Keep the flag on, remove the custom domain with 'ohmyhost domain paid delete', or buy Paid, then switch the flag off.",
40489
40517
  title: "Powered-by flag required"
40490
40518
  },
40519
+ build_capacity_reached: {
40520
+ status: 429,
40521
+ retryable: false,
40522
+ action: "This organization already has its maximum number of open builds. Wait for an open deployment to finish, then start a new deployment with a new idempotency key.",
40523
+ title: "Build capacity reached"
40524
+ },
40491
40525
  rate_limited: {
40492
40526
  status: 429,
40493
40527
  retryable: true,
@@ -40538,6 +40572,12 @@ var PROBLEM_POLICY = {
40538
40572
  action: "Stop retries and submit feedback with this operation ID. A platform recovery review is required.",
40539
40573
  title: "Recovery attempts exhausted"
40540
40574
  },
40575
+ reconciliation_not_pending: {
40576
+ status: 409,
40577
+ retryable: false,
40578
+ action: "Do not repeat this reconciliation: no uncertain delivery or provider mutation is pending for this operation. If the operation still does not finish, submit feedback with this operation ID.",
40579
+ title: "No recovery pending"
40580
+ },
40541
40581
  service_unavailable: {
40542
40582
  status: 503,
40543
40583
  retryable: true,
@@ -40555,10 +40595,17 @@ var PROBLEM_POLICY = {
40555
40595
  domain_hostname_taken: {
40556
40596
  status: 409,
40557
40597
  retryable: false,
40558
- action: "A live project connection already holds this hostname. Remove it from the project you manage with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then apply it to the new project. Repeating while that connection remains cannot work; report the request_id if you cannot manage its owning project.",
40559
- restAction: "A live project connection already holds this hostname. Remove it from the project you manage with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then apply it to the new project. Repeating while that connection remains cannot work; report the request_id if you cannot manage its owning project.",
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.",
40560
40600
  title: "Domain hostname is already connected"
40561
40601
  },
40602
+ domain_ownership_required: {
40603
+ status: 409,
40604
+ retryable: false,
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.",
40607
+ title: "Verify the domain before connecting it"
40608
+ },
40562
40609
  domain_dns_conflict: {
40563
40610
  status: 409,
40564
40611
  retryable: false,
@@ -40604,6 +40651,36 @@ var PROBLEM_POLICY = {
40604
40651
  retryable: false,
40605
40652
  title: "Complete the pending domain change",
40606
40653
  action: "Read project status and Paid domain status to identify the pending change. If a Paid domain removal is pending, retry it as a current owner with a new idempotency key. If a project address change is pending, submit a fresh address change as a current owner. After it finishes, create a new project deletion plan."
40654
+ },
40655
+ native_auth_launch_unavailable: {
40656
+ status: 409,
40657
+ retryable: false,
40658
+ title: "Native Auth cannot launch yet",
40659
+ action: "Read the Native Auth configuration with 'ohmyhost auth config get --project ULID --environment ULID --json'. Its readiness shows which requirement is missing: a Paid plan, a verified sender domain, an approved canonical origin or storage. Complete that requirement, then send the change again with a new idempotency key. Repeating unchanged does not help."
40660
+ },
40661
+ native_auth_provider_unavailable: {
40662
+ status: 409,
40663
+ retryable: false,
40664
+ title: "Native Auth provider unavailable",
40665
+ action: "This sign-in provider cannot be enabled for this project's current Native Auth state. Read the provider with 'ohmyhost auth provider get --project ULID --environment ULID --provider google|github --json' and complete the Native Auth configuration it reports. Repeating unchanged does not help."
40666
+ },
40667
+ native_auth_epoch_exhausted: {
40668
+ status: 409,
40669
+ retryable: false,
40670
+ title: "Native Auth policy changes exhausted",
40671
+ action: "This project's Native Auth policy has reached its revision limit, so no further policy change is accepted. Do not retry. Contact support with the request_id of this response."
40672
+ },
40673
+ project_domains_conflict: {
40674
+ status: 409,
40675
+ retryable: false,
40676
+ title: "Project domains belong to another handle",
40677
+ action: "The domains of this project were configured under another project handle. Read the project with 'ohmyhost project status --project ULID --json' to see its current handle, then repeat the domain configuration with a new idempotency key. Do not replay the earlier request."
40678
+ },
40679
+ native_user_conflict: {
40680
+ status: 409,
40681
+ retryable: false,
40682
+ title: "Native Auth user conflicts with current state",
40683
+ action: "The user already exists, or the user is not in the state this action needs (for example a pending user cannot be suspended, and only a pending invitation can be resent). Read the user with 'ohmyhost auth user get --project ULID --environment ULID --user UUID --json' and choose the action that matches its status."
40607
40684
  }
40608
40685
  };
40609
40686
 
@@ -40737,6 +40814,29 @@ var parseGithubOrganizationConnectionStatus = (value) => {
40737
40814
  }
40738
40815
  return input;
40739
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
+ };
40740
40840
  var parseGithubConnectionAuthorization = (value) => {
40741
40841
  const input = exactRecord2(value, [
40742
40842
  "authorization_id",
@@ -40799,7 +40899,7 @@ var parseCloudflareDnsAuthorizationStatus = (value) => {
40799
40899
  const input = exactRecord2(value, ["status", "zone", "scopes", "expires_at"]);
40800
40900
  const status = input["status"];
40801
40901
  const scopes = input["scopes"];
40802
- if (status !== "not_authorized" && status !== "pending" && status !== "authorized" && status !== "expired" && status !== "revoked" || (status === "not_authorized" ? input["zone"] !== null : typeof input["zone"] !== "string" || !isPaidHostname(input["zone"])) || !Array.isArray(scopes) || scopes.length > 2 || scopes.some((scope) => scope !== "dns.write" && scope !== "zone.read") || new Set(scopes).size !== scopes.length || input["expires_at"] !== null && !isIsoInstant(input["expires_at"]) || status === "authorized" && [...scopes].sort().join(",") !== "dns.write,zone.read" || status === "not_authorized" && (scopes.length !== 0 || input["expires_at"] !== null)) {
40902
+ if (status !== "not_authorized" && status !== "pending" && status !== "authorized" && status !== "reauthorization_required" && status !== "expired" && status !== "revoked" || (status === "not_authorized" ? input["zone"] !== null : typeof input["zone"] !== "string" || !isPaidHostname(input["zone"])) || !Array.isArray(scopes) || scopes.length > 2 || scopes.some((scope) => scope !== "dns.write" && scope !== "zone.read") || new Set(scopes).size !== scopes.length || input["expires_at"] !== null && !isIsoInstant(input["expires_at"]) || status === "authorized" && [...scopes].sort().join(",") !== "dns.write,zone.read" || status === "not_authorized" && (scopes.length !== 0 || input["expires_at"] !== null) || status === "reauthorization_required" && (scopes.length !== 0 || input["expires_at"] !== null)) {
40803
40903
  throw new ResponseContractError();
40804
40904
  }
40805
40905
  return input;
@@ -41138,7 +41238,7 @@ var parseFunctionRun = (value) => {
41138
41238
  "status_code"
41139
41239
  ]);
41140
41240
  const nullableInstant = (candidate) => candidate === null || isIsoInstant(candidate);
41141
- if (!isUlidValue(input["id"]) || !isUlidValue(input["deployment_id"]) || typeof input["cron"] !== "string" || input["cron"].length === 0 || input["cron"].length > 64 || !isIsoInstant(input["scheduled_at"]) || !["due", "running", "retry", "succeeded", "failed"].includes(String(input["state"])) || !Number.isSafeInteger(input["attempt"]) || Number(input["attempt"]) < 0 || Number(input["attempt"]) > 3 || !(input["status_code"] === null || Number.isSafeInteger(input["status_code"]) && Number(input["status_code"]) >= 100 && Number(input["status_code"]) <= 599) || !nullableInstant(input["started_at"]) || !nullableInstant(input["finished_at"])) {
41241
+ if (!isUlidValue(input["id"]) || !isUlidValue(input["deployment_id"]) || typeof input["cron"] !== "string" || input["cron"].length === 0 || input["cron"].length > 64 || !isIsoInstant(input["scheduled_at"]) || !["due", "running", "retry", "succeeded", "failed", "skipped"].includes(String(input["state"])) || !Number.isSafeInteger(input["attempt"]) || Number(input["attempt"]) < 0 || Number(input["attempt"]) > 3 || !(input["status_code"] === null || Number.isSafeInteger(input["status_code"]) && Number(input["status_code"]) >= 100 && Number(input["status_code"]) <= 599) || !nullableInstant(input["started_at"]) || !nullableInstant(input["finished_at"])) {
41142
41242
  throw new ResponseContractError();
41143
41243
  }
41144
41244
  return input;
@@ -42420,12 +42520,13 @@ var FIXED_PLATFORM_NAMES = /* @__PURE__ */ new Set([
42420
42520
  "IMAGES",
42421
42521
  "STORAGE"
42422
42522
  ]);
42423
- var INSTALLED_PLATFORM_KEYS = /* @__PURE__ */ new Set([
42523
+ var INSTALLED_PLATFORM_KEY_NAMES = [
42424
42524
  "OHMYHOST_STORAGE_KEY",
42425
42525
  "OHMYHOST_MAIL_KEY",
42426
42526
  "OHMYHOST_AI_KEY",
42427
42527
  "BETTER_AUTH_SECRET"
42428
- ]);
42528
+ ];
42529
+ var INSTALLED_PLATFORM_KEYS = new Set(INSTALLED_PLATFORM_KEY_NAMES);
42429
42530
  function isUserSecretName(value, action = "set") {
42430
42531
  if (typeof value !== "string" || !USER_SECRET_NAME_PATTERN.test(value))
42431
42532
  return false;
@@ -43347,6 +43448,8 @@ var recognizedCommandLabel = (argv) => {
43347
43448
  return "github connect";
43348
43449
  if (value === "github" && values[0] === "status")
43349
43450
  return "github status";
43451
+ if (value === "github" && values[0] === "disconnect")
43452
+ return "github disconnect";
43350
43453
  if (value === "operation" && values[0] === "get")
43351
43454
  return "operation get";
43352
43455
  if (value === "credits" && values[0] === "account")
@@ -43375,7 +43478,7 @@ var recognizedCommandLabel = (argv) => {
43375
43478
  return "operation reconcile";
43376
43479
  if (value === "token" && ["create", "list", "revoke"].includes(values[0] ?? ""))
43377
43480
  return `token ${values[0]}`;
43378
- if (value === "export" && (values[0] === "create" || values[0] === "get"))
43481
+ if (value === "export" && (values[0] === "create" || values[0] === "get" || values[0] === "download-link"))
43379
43482
  return `export ${values[0]}`;
43380
43483
  if (value === "feedback" && values[0] === "submit")
43381
43484
  return "feedback submit";
@@ -43393,6 +43496,12 @@ var recognizedCommandLabel = (argv) => {
43393
43496
  return "organization list";
43394
43497
  if (value === "organization" && values[0] === "use")
43395
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
+ }
43396
43505
  if (value === "project" && values[0] === "list")
43397
43506
  return "project list";
43398
43507
  if (value === "project" && values[0] === "context")
@@ -43553,6 +43662,8 @@ var recognizedCommandLabel = (argv) => {
43553
43662
  return "mail webhook verify";
43554
43663
  if (values[1] === "disable")
43555
43664
  return "mail webhook disable";
43665
+ if (values[1] === "rotate")
43666
+ return "mail webhook rotate";
43556
43667
  }
43557
43668
  if (values[0] === "messages") {
43558
43669
  if (values[1] === "list")
@@ -44093,14 +44204,18 @@ var parseProductCliCommand = (argv) => {
44093
44204
  }
44094
44205
  if (first === "github") {
44095
44206
  const subcommand = values.shift();
44096
- if (yes || wait || follow || stdin)
44207
+ if (wait || follow || stdin)
44208
+ throw new InvalidCommandError();
44209
+ if (subcommand !== "connect" && subcommand !== "status" && subcommand !== "disconnect")
44097
44210
  throw new InvalidCommandError();
44098
- if (subcommand !== "connect" && subcommand !== "status")
44211
+ if (yes !== (subcommand === "disconnect"))
44099
44212
  throw new InvalidCommandError();
44100
44213
  const options = parseOptions(values, subcommand === "connect" ? ["--organization", "--idempotency-key"] : ["--organization"]);
44101
44214
  const organizationId = options["--organization"];
44102
44215
  if (!ORGANIZATION_ULID.test(organizationId))
44103
44216
  throw new InvalidCommandError();
44217
+ if (subcommand === "disconnect")
44218
+ return { kind: "github-disconnect", organizationId, yes: true, credentialStore };
44104
44219
  return subcommand === "connect" ? {
44105
44220
  kind: "github-connect",
44106
44221
  organizationId,
@@ -44108,6 +44223,35 @@ var parseProductCliCommand = (argv) => {
44108
44223
  credentialStore
44109
44224
  } : { kind: "github-status", organizationId, credentialStore };
44110
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
+ }
44111
44255
  if (first === "organization") {
44112
44256
  const subcommand = values.shift();
44113
44257
  if (yes || wait || follow || stdin)
@@ -44625,8 +44769,13 @@ var parseProductCliCommand = (argv) => {
44625
44769
  if (subcommand === "delete" || subcommand === "test") {
44626
44770
  if (!yes || wait || follow || revoke || stdin)
44627
44771
  throw new InvalidCommandError();
44628
- const options = parseOptionalOptions(values, ["--project", "--environment", "--webhook"]);
44629
- const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"];
44772
+ const options = parseOptionalOptions(values, [
44773
+ "--project",
44774
+ "--environment",
44775
+ "--webhook",
44776
+ "--idempotency-key"
44777
+ ]);
44778
+ const projectId = options["--project"], environment = options["--environment"], webhookId = options["--webhook"], idempotencyKey = options["--idempotency-key"] ?? null;
44630
44779
  if (!isValue(projectId))
44631
44780
  throw new InvalidCommandError();
44632
44781
  if (environment !== "dev" && environment !== "prod")
@@ -44638,6 +44787,7 @@ var parseProductCliCommand = (argv) => {
44638
44787
  projectId,
44639
44788
  environment,
44640
44789
  webhookId: target,
44790
+ idempotencyKey,
44641
44791
  yes: true,
44642
44792
  credentialStore
44643
44793
  };
@@ -44646,6 +44796,7 @@ var parseProductCliCommand = (argv) => {
44646
44796
  projectId,
44647
44797
  environment,
44648
44798
  webhookId: target,
44799
+ idempotencyKey,
44649
44800
  yes: true,
44650
44801
  credentialStore
44651
44802
  };
@@ -44676,7 +44827,12 @@ var parseProductCliCommand = (argv) => {
44676
44827
  if (subcommand === "replay") {
44677
44828
  if (!yes || wait || follow || revoke || stdin)
44678
44829
  throw new InvalidCommandError();
44679
- const options = parseOptionalOptions(values, ["--project", "--environment", "--delivery"]);
44830
+ const options = parseOptionalOptions(values, [
44831
+ "--project",
44832
+ "--environment",
44833
+ "--delivery",
44834
+ "--idempotency-key"
44835
+ ]);
44680
44836
  const projectId = options["--project"], environment = options["--environment"], deliveryId = options["--delivery"];
44681
44837
  if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44682
44838
  throw new InvalidCommandError();
@@ -44685,6 +44841,7 @@ var parseProductCliCommand = (argv) => {
44685
44841
  projectId,
44686
44842
  environment,
44687
44843
  deliveryId: contractValue(() => parseDatabaseDeliveryId(deliveryId)),
44844
+ idempotencyKey: options["--idempotency-key"] ?? null,
44688
44845
  yes: true,
44689
44846
  credentialStore
44690
44847
  };
@@ -44761,7 +44918,7 @@ var parseProductCliCommand = (argv) => {
44761
44918
  if (subcommand === "delete" || subcommand === "run") {
44762
44919
  if (!yes || wait || follow || revoke || stdin)
44763
44920
  throw new InvalidCommandError();
44764
- const options = parseOptionalOptions(values, ["--project", "--environment", "--name"]);
44921
+ const options = parseOptionalOptions(values, subcommand === "run" ? ["--project", "--environment", "--name", "--idempotency-key"] : ["--project", "--environment", "--name"]);
44765
44922
  const projectId = options["--project"], environment = options["--environment"];
44766
44923
  if (!isValue(projectId) || environment !== "dev" && environment !== "prod")
44767
44924
  throw new InvalidCommandError();
@@ -44778,6 +44935,7 @@ var parseProductCliCommand = (argv) => {
44778
44935
  projectId,
44779
44936
  environment,
44780
44937
  name,
44938
+ idempotencyKey: options["--idempotency-key"] ?? null,
44781
44939
  yes: true,
44782
44940
  credentialStore
44783
44941
  };
@@ -45100,6 +45258,21 @@ var parseProductCliCommand = (argv) => {
45100
45258
  const options = parseOptions(values, ["--project"]);
45101
45259
  return { kind: "export-get", projectId: options["--project"], exportId, credentialStore };
45102
45260
  }
45261
+ if (first === "export" && values[0] === "download-link") {
45262
+ if (yes || wait || follow || stdin)
45263
+ throw new InvalidCommandError();
45264
+ values.shift();
45265
+ const exportId = values.shift();
45266
+ if (!exportId)
45267
+ throw new InvalidCommandError();
45268
+ const options = parseOptions(values, ["--project"]);
45269
+ return {
45270
+ kind: "export-download-link",
45271
+ projectId: options["--project"],
45272
+ exportId,
45273
+ credentialStore
45274
+ };
45275
+ }
45103
45276
  if (first === "secret" && values[0] === "list") {
45104
45277
  if (yes || wait || follow || stdin)
45105
45278
  throw new InvalidCommandError();
@@ -45279,9 +45452,10 @@ var parseProductCliCommand = (argv) => {
45279
45452
  const area = values.shift();
45280
45453
  const sub = area === "webhook" || area === "messages" || area === "domain" ? values.shift() : void 0;
45281
45454
  const retiring = area === "domain" && sub === "delete";
45282
- if (yes !== retiring || wait || follow || stdin)
45455
+ const rotating = area === "webhook" && sub === "rotate";
45456
+ if (yes !== (retiring || rotating) || wait || follow || stdin)
45283
45457
  throw new InvalidCommandError();
45284
- const options = parseOptionalOptions(values, [
45458
+ const options = parseOptionalOptions(values, rotating ? ["--project", "--environment", "--idempotency-key"] : [
45285
45459
  "--project",
45286
45460
  "--environment",
45287
45461
  "--domain",
@@ -45331,6 +45505,13 @@ var parseProductCliCommand = (argv) => {
45331
45505
  idempotencyKey: required("--idempotency-key")
45332
45506
  };
45333
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";
45334
45515
  } else if (area === "webhook" && (sub === "verify" || sub === "disable")) {
45335
45516
  request = {
45336
45517
  ...scope,
@@ -45953,7 +46134,7 @@ function exact4(v, keys) {
45953
46134
  // apps/product-cli/package.json
45954
46135
  var package_default = {
45955
46136
  name: "@ohmyhost/product-cli",
45956
- version: "0.1.54",
46137
+ version: "0.1.56",
45957
46138
  private: true,
45958
46139
  ohmyhost: {
45959
46140
  deployment: "production",
@@ -46017,6 +46198,14 @@ function assertProjectContext(v) {
46017
46198
  }
46018
46199
 
46019
46200
  // packages/contracts/dist/project-exports.js
46201
+ var EXPORT_PASSWORD_MIN_CHARACTERS = 12;
46202
+ function exportPasswordMeetsMinimum(value) {
46203
+ return Array.from(value).length >= EXPORT_PASSWORD_MIN_CHARACTERS;
46204
+ }
46205
+ function assertProjectExportDownloadLink(value) {
46206
+ if (!record7(value) || Object.keys(value).sort().join(",") !== "download_expires_at,download_url,id,project_id" || typeof value["id"] !== "string" || !id.test(value["id"]) || typeof value["project_id"] !== "string" || !id.test(value["project_id"]) || typeof value["download_url"] !== "string" || !value["download_url"].startsWith("https://") || !timestamp5(value["download_expires_at"]))
46207
+ throw new TypeError("Project export download link is invalid");
46208
+ }
46020
46209
  function assertProjectExport(value) {
46021
46210
  if (!record7(value) || Object.keys(value).sort().join(",") !== "archive,error,id,next_poll_after_seconds,next_request_at,project_id,requested_at,state" || typeof value["id"] !== "string" || !id.test(value["id"]) || typeof value["project_id"] !== "string" || !id.test(value["project_id"]) || !["queued", "running", "succeeded", "failed", "cancelled"].includes(String(value["state"])) || !timestamp5(value["requested_at"]) || !timestamp5(value["next_request_at"]))
46022
46211
  invalid4();
@@ -46262,8 +46451,10 @@ var HELP_USAGE = Object.freeze({
46262
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)",
46263
46452
  "github connect": "ohmyhost github connect --organization ULID --idempotency-key KEY --json (connect once, then link covered repositories without another browser consent)",
46264
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)",
46265
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)",
46266
- "export get": "ohmyhost export get EXPORT_ULID --project ULID --json (poll the original job; signed ZIP download lasts 24 hours)",
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)",
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)",
46267
46458
  "credits account": "ohmyhost credits account --organization ULID --json",
46268
46459
  "referral link": "ohmyhost referral link --organization ULID --json (the workspace's link to share; a new user whose first workspace comes from it starts with 30 days of Paid and 1,000 credits, and its first payment gives this workspace 1,000 credits plus 30 days of Paid unless a subscription or an unbounded grant already covers it)",
46269
46460
  "credits balance": "ohmyhost credits balance --organization ULID --json",
@@ -46278,6 +46469,8 @@ var HELP_USAGE = Object.freeze({
46278
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)",
46279
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)",
46280
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)",
46281
46474
  "operation get": "ohmyhost operation get OPERATION_ULID --json",
46282
46475
  "operation reconcile": "ohmyhost operation reconcile OPERATION_ULID --idempotency-key KEY --yes --json",
46283
46476
  "token create": "ohmyhost token create --organization ULID --name NAME --idempotency-key KEY --out .env.local --json",
@@ -46315,16 +46508,16 @@ var HELP_USAGE = Object.freeze({
46315
46508
  "database webhook create": "ohmyhost database webhook create --project ULID --environment dev|prod --url HTTPS_URL --event-types TYPE[,TYPE] [--headers-file PATH] --idempotency-key KEY --yes --json (the signing secret is shown once in this answer; types: database.created, database.ready, database.woke, database.slept, database.suspended, database.resized, database.deleted, data.<topic> for the rows of one watched table printed by database watch create, or data.* for every watched table; a bare * is not accepted and does not include data events; the headers file is a UTF-8 JSON object of at most 8 KiB)",
46316
46509
  "database webhook list": "ohmyhost database webhook list --project ULID [--environment dev|prod] --json (dev when omitted; the secret is never listed)",
46317
46510
  "database webhook get": "ohmyhost database webhook get --project ULID [--environment dev|prod] --webhook ID --json",
46318
- "database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID --yes --json",
46319
- "database webhook test": "ohmyhost database webhook test --project ULID --environment dev|prod --webhook ID --yes --json (sends one signed test request to the receiver; nothing is stored)",
46511
+ "database webhook delete": "ohmyhost database webhook delete --project ULID --environment dev|prod --webhook ID [--idempotency-key KEY] --yes --json (a retry with the same key and request returns the stored answer; without a key each call is new)",
46512
+ "database webhook test": "ohmyhost database webhook test --project ULID --environment dev|prod --webhook ID [--idempotency-key KEY] --yes --json (sends one signed test request to the receiver; nothing is stored; a retry with the same key and request returns the stored outcome without sending again)",
46320
46513
  "database webhook deliveries": "ohmyhost database webhook deliveries --project ULID [--environment dev|prod] [--webhook ID] [--limit 1..100] [--cursor CURSOR] --json",
46321
- "database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID --yes --json",
46514
+ "database webhook replay": "ohmyhost database webhook replay --project ULID --environment dev|prod --delivery ID [--idempotency-key KEY] --yes --json (a retry with the same key and request returns the stored answer without queuing another attempt)",
46322
46515
  "database schedule set": "ohmyhost database schedule set --project ULID --environment dev|prod --name NAME (--cron EXPR | --every-seconds N) --statements-file PATH [--timeout-ms N] [--enabled true|false] --yes --json (runs the statements in the file, a UTF-8 JSON array of 1 to 20 SQL strings, as the runtime role of the application; cron has five fields in UTC; every-seconds is 60 to 2678400; timeout-ms is 1000 to 30000, default 10000). A project whose Stop budget is reached has its schedules disabled automatically, within about an hour of the billed usage reaching the budget: the credit service does this after its hourly pgcf pass, and Continue budgets are never touched. While the budget is reached, schedule set with enabled true and schedule run are refused with project_budget_exceeded (HTTP 402). Re-enabling is manual: raise the budget (or wait for the next UTC month) and run database schedule set --enabled true again with the schedule body (read it with schedule get).",
46323
46516
  "database schedule list": "ohmyhost database schedule list --project ULID [--environment dev|prod] --json (dev when omitted)",
46324
46517
  "database schedule get": "ohmyhost database schedule get --project ULID [--environment dev|prod] --name NAME --json",
46325
46518
  "database schedule delete": "ohmyhost database schedule delete --project ULID --environment dev|prod --name NAME --yes --json",
46326
46519
  "database schedule runs": "ohmyhost database schedule runs --project ULID [--environment dev|prod] --name NAME [--limit 1..50] --json",
46327
- "database schedule run": "ohmyhost database schedule run --project ULID --environment dev|prod --name NAME --yes --json (queues one run now, in addition to the timer; refused with project_budget_exceeded (HTTP 402) while the project's Stop budget is reached)",
46520
+ "database schedule run": "ohmyhost database schedule run --project ULID --environment dev|prod --name NAME [--idempotency-key KEY] --yes --json (queues one run now, in addition to the timer; a retry with the same key and request returns the stored answer without a second run; refused with project_budget_exceeded (HTTP 402) while the project's Stop budget is reached)",
46328
46521
  "database executions": "ohmyhost database executions --project ULID [--environment dev|prod] --from ISO --to ISO --granularity hour|day [--limit 1..100] [--cursor CURSOR] --json (UTC timestamps like 2026-10-30T00:00:00.000Z aligned to the granularity, at most 31 days; counts schedule runs, webhook attempts and events per hour or day; these are counters only, executions have no price of their own and the awake compute time of the database is what is billed)",
46329
46522
  "database psql": "ohmyhost database psql --project ULID --environment dev|prod [--mode read|write] [--ttl 5m|1h|24h|SECONDS] [--json] (starts local psql with a temporary credential and revokes it on exit)",
46330
46523
  link: "ohmyhost link --project ULID --repository-owner OWNER --repository-name REPOSITORY --idempotency-key KEY --json (uses the workspace GitHub connection and waits for the source-link operation)",
@@ -46385,6 +46578,7 @@ var HELP_USAGE = Object.freeze({
46385
46578
  "mail webhook set": "ohmyhost mail webhook set --project ULID --environment ULID --url HTTPS_URL --idempotency-key KEY --json",
46386
46579
  "mail webhook verify": "ohmyhost mail webhook verify --project ULID --environment ULID --idempotency-key KEY --json",
46387
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)",
46388
46582
  "mail messages list": "ohmyhost mail messages list --project ULID --environment ULID [--after ULID] --json",
46389
46583
  "mail messages get": "ohmyhost mail messages get --project ULID --environment ULID --message ULID --json",
46390
46584
  "mail messages retry": "ohmyhost mail messages retry --project ULID --environment ULID --message ULID --idempotency-key KEY --json",
@@ -46422,18 +46616,18 @@ var invalidCommandAction = (argv, commandPrefix) => {
46422
46616
  const linkable = /(?:^|\s)--project ULID/u.test(usage) && !argv.includes("--project");
46423
46617
  return `The arguments of '${label}' are invalid or incomplete; nothing was sent. Usage: ${usage}.${linkable ? ` --project may be omitted only inside a directory linked with '${commandPrefix} link' for this OHMYHOST_ENVIRONMENT; otherwise pass --project ULID.` : ""}`;
46424
46618
  };
46425
- var retryAdvice = (command) => {
46619
+ var retryAdvice = (command, keyed = true) => {
46426
46620
  const usage = Object.hasOwn(HELP_USAGE, command) ? HELP_USAGE[command] : "";
46427
- if (usage.includes("--idempotency-key"))
46621
+ if (keyed && usage.includes("--idempotency-key"))
46428
46622
  return "run the same command again with the same --idempotency-key; the change may already have been applied, and a new key could apply it twice";
46429
46623
  if (usage.includes("--yes"))
46430
46624
  return "this command has no idempotency key and the change may already have been applied; check its current state first with the matching list or get command (for example database access list --project ULID --json), and run the command again only if the change is not there";
46431
46625
  return "run the same command again; this command has no idempotency key, so check its current state first if it may have changed anything";
46432
46626
  };
46433
- var internalErrorAction = (command) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
46627
+ var internalErrorAction = (command, keyed = true) => `The ohmyhost client stopped on an unexpected error; the stderr line starting with [ohmyhost: identifies it. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json and install the published client if it is older, then ${retryAdvice(command, keyed)}. If the current client fails the same way, report it with feedback submit (kind bug, error code internal_error) and quote that stderr line.`;
46434
46628
  var CREDENTIAL_STORE_UNAVAILABLE_ACTION = "This computer's credential store (for example macOS Keychain or Windows Credential Manager) or the saved-login list in ~/.ohmyhost/profiles could not be read or written; nothing was changed. If the agent runs in a sandbox, run the command with access to them before asking the customer to sign in again. If the store is locked, ask the customer to unlock it, then run the command again. On a server, container or CI runner without a credential store, do not run login: load OHMYHOST_TOKEN from a private env file with a token from the portal's API Tokens page.";
46435
- var responseContractAction = (command) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
46436
- var requestTimeoutAction = (command) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command)}.`;
46629
+ var responseContractAction = (command, keyed = true) => `The ohmyho.st API answered in a form this client version does not accept, usually because the client is older than the service. Compare 'ohmyhost --version' with https://ohmyho.st/client-release.json; if it is older, install the published CLI and MCP and reload MCP. Then ${retryAdvice(command, keyed)}. If the current version answers this too, report it with feedback submit (kind bug, error code response_contract_invalid).`;
46630
+ var requestTimeoutAction = (command, keyed = true) => `The ohmyho.st API did not answer within 30 seconds; ${retryAdvice(command, keyed)}.`;
46437
46631
  var LOGOUT_UNCONFIRMED_ACTION = "The saved login was removed from this computer, but ohmyho.st did not confirm that its session ended. Running logout again cannot retry this, because the login is gone; do not sign in again just to revoke it. Tell the customer the session end was not confirmed.";
46438
46632
  var HEADERS_FILE_INVALID_ACTION = "Put one JSON object of header names and values in the file named by --headers-file: UTF-8, at most 8 KiB, unique names, values of visible ASCII characters. Names such as content-type, host, content-length, connection, transfer-encoding, user-agent, te, upgrade and expect, and names starting with pgcf-, cf- or x-forwarded-, are refused. Nothing was sent; fix the file and run the command again.";
46439
46633
  var SCHEDULE_STATEMENTS_FILE_INVALID_ACTION = "Put one JSON array of 1 to 20 non-empty SQL strings in the file named by --statements-file: UTF-8, at most 64 KiB in total and 16 KiB per statement, without NUL characters. Nothing was saved; fix the file and run the command again.";
@@ -46535,6 +46729,36 @@ var ProductCli = class {
46535
46729
  }
46536
46730
  });
46537
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
+ }
46538
46762
  if (command.kind === "whoami")
46539
46763
  return await this.getCurrentIdentity(command, signal);
46540
46764
  if (command.kind === "token-create" || command.kind === "token-list" || command.kind === "token-revoke") {
@@ -46678,7 +46902,7 @@ var ProductCli = class {
46678
46902
  if (command.kind === "export-create") {
46679
46903
  const api = await this.authenticatedApi(command.credentialStore, signal);
46680
46904
  const password = await this.dependencies.readSecretValue(signal);
46681
- if (password.trim().length === 0 || new TextEncoder().encode(password).length > 1024)
46905
+ if (password.trim().length === 0 || new TextEncoder().encode(password).length > 1024 || !exportPasswordMeetsMinimum(password))
46682
46906
  throw new SecretInputError();
46683
46907
  const operation = parseOperation(await api.createProjectExport({
46684
46908
  projectId: command.projectId,
@@ -46696,6 +46920,15 @@ var ProductCli = class {
46696
46920
  assertProjectExport(result);
46697
46921
  return success("export get", { status: result.state, export: result });
46698
46922
  }
46923
+ if (command.kind === "export-download-link") {
46924
+ const api = await this.authenticatedApi(command.credentialStore, signal);
46925
+ const link2 = await api.createProjectExportDownloadLink({
46926
+ projectId: command.projectId,
46927
+ exportId: command.exportId
46928
+ });
46929
+ assertProjectExportDownloadLink(link2);
46930
+ return success("export download-link", { status: "succeeded", download_link: link2 });
46931
+ }
46699
46932
  if (command.kind === "feedback-status") {
46700
46933
  const api = await this.authenticatedApi(command.credentialStore, signal);
46701
46934
  const feedback = await api.getFeedback(command.feedbackId, command.cursor);
@@ -46931,7 +47164,14 @@ var ProductCli = class {
46931
47164
  if (error instanceof ProfileLimitError)
46932
47165
  return failure(name, 2, "profile_limit_reached", false, profileLimitAction(this.dependencies.commandPrefix));
46933
47166
  this.recordDiagnostic(diagnosticDescriptor(error, signal));
46934
- return classifyFailure(name, error, signal, this.context());
47167
+ return classifyFailure(
47168
+ name,
47169
+ error,
47170
+ signal,
47171
+ this.context(),
47172
+ // A mutation parsed without its optional --idempotency-key has no key to repeat with.
47173
+ !("idempotencyKey" in command && command.idempotencyKey === null)
47174
+ );
46935
47175
  }
46936
47176
  }
46937
47177
  githubConnectAction(organizationId) {
@@ -47446,7 +47686,8 @@ var ProductCli = class {
47446
47686
  const deleted = await api.deleteProjectDatabaseWebhook({
47447
47687
  projectId: command.projectId,
47448
47688
  environment: command.environment,
47449
- webhookId: command.webhookId
47689
+ webhookId: command.webhookId,
47690
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47450
47691
  });
47451
47692
  return success("database webhook delete", { status: "succeeded", deleted });
47452
47693
  }
@@ -47455,7 +47696,8 @@ var ProductCli = class {
47455
47696
  const result = await api.testProjectDatabaseWebhook({
47456
47697
  projectId: command.projectId,
47457
47698
  environment: command.environment,
47458
- webhookId: command.webhookId
47699
+ webhookId: command.webhookId,
47700
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47459
47701
  });
47460
47702
  return success("database webhook test", { status: "succeeded", result });
47461
47703
  }
@@ -47479,7 +47721,8 @@ var ProductCli = class {
47479
47721
  const replay = await api.replayProjectDatabaseWebhookDelivery({
47480
47722
  projectId: command.projectId,
47481
47723
  environment: command.environment,
47482
- deliveryId: command.deliveryId
47724
+ deliveryId: command.deliveryId,
47725
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47483
47726
  });
47484
47727
  return success("database webhook replay", { status: "succeeded", replay });
47485
47728
  }
@@ -47536,7 +47779,8 @@ var ProductCli = class {
47536
47779
  const run = await api.runProjectDatabaseSchedule({
47537
47780
  projectId: command.projectId,
47538
47781
  environment: command.environment,
47539
- name: command.name
47782
+ name: command.name,
47783
+ ...command.idempotencyKey === null ? {} : { idempotencyKey: command.idempotencyKey }
47540
47784
  });
47541
47785
  return success("database schedule run", { status: "succeeded", run });
47542
47786
  }
@@ -48158,25 +48402,25 @@ var ACCOUNT_SENSITIVE_PROBLEMS = /* @__PURE__ */ new Set([
48158
48402
  "repository_not_installed"
48159
48403
  ]);
48160
48404
  var classifyCliFailure = (command, error, signal) => classifyFailure(command, error, signal);
48161
- var classifyFailure = (command, error, signal, actingAs) => {
48405
+ var classifyFailure = (command, error, signal, actingAs, keyed = true) => {
48162
48406
  if (error instanceof LocalSourcePublicationError)
48163
48407
  return failure(command, 2, error.code, error.code === "source_publication_pending", error.message, error.operation);
48164
48408
  if (error instanceof SourceWorkspaceError)
48165
48409
  return failure(command, 2, error.code, error.code === "source_snapshot_changed", error.message);
48166
48410
  if (signal.aborted || isCancellation(error)) {
48167
- return failure(command, 130, "command_cancelled", true, `The command was stopped by an interrupt or termination signal, for example the shell's command timeout, before it finished; ${retryAdvice(command)}. Give login and commands with --wait or --follow several minutes, or run them in the background.`);
48411
+ return failure(command, 130, "command_cancelled", true, `The command was stopped by an interrupt or termination signal, for example the shell's command timeout, before it finished; ${retryAdvice(command, keyed)}. Give login and commands with --wait or --follow several minutes, or run them in the background.`);
48168
48412
  }
48169
48413
  if (isTimeout2(error)) {
48170
- return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
48414
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command, keyed));
48171
48415
  }
48172
48416
  if (error instanceof ProductCliFailure && error.code === "request_timeout" && error.retryable) {
48173
- return failure(command, 8, "request_timeout", true, requestTimeoutAction(command));
48417
+ return failure(command, 8, "request_timeout", true, requestTimeoutAction(command, keyed));
48174
48418
  }
48175
48419
  if (error instanceof ProductCliFailure) {
48176
48420
  return failure(command, error.exitCode, error.code, error.retryable, error.suggestedAction, error.operation);
48177
48421
  }
48178
48422
  if (error instanceof SecretInputError) {
48179
- return failure(command, 2, "secret_input_invalid", false, command === "export create" ? "Pipe the ZIP password through standard input: non-blank UTF-8 of at most 1024 bytes. A final line break becomes part of the password." : "Pipe a non-empty UTF-8 value of at most 5120 bytes through standard input.");
48423
+ return failure(command, 2, "secret_input_invalid", false, command === "export create" ? `Pipe the ZIP password through standard input: at least ${EXPORT_PASSWORD_MIN_CHARACTERS} characters, non-blank UTF-8 of at most 1024 bytes. A final line break becomes part of the password.` : "Pipe a non-empty UTF-8 value of at most 5120 bytes through standard input.");
48180
48424
  }
48181
48425
  if (error instanceof WorkosContractError) {
48182
48426
  if (error.code === "access_denied") {
@@ -48191,7 +48435,7 @@ var classifyFailure = (command, error, signal, actingAs) => {
48191
48435
  return failure(command, 3, "credential_store_unavailable", false, CREDENTIAL_STORE_UNAVAILABLE_ACTION);
48192
48436
  }
48193
48437
  if (error instanceof ResponseContractError) {
48194
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48438
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48195
48439
  }
48196
48440
  if (error instanceof PublicResponseTooLargeError) {
48197
48441
  return failure(command, 7, "response_too_large", false, "Retry only after the remote response is repaired.");
@@ -48201,16 +48445,16 @@ var classifyFailure = (command, error, signal, actingAs) => {
48201
48445
  const problem = parseSafeProblem(error);
48202
48446
  return failure(command, 7, problem.code, problem.retryable, problem.suggestedAction, void 0, problem.retryAfterSeconds, problem.requestId, problem.docsUrl, ACCOUNT_SENSITIVE_PROBLEMS.has(problem.code) ? actingAs : void 0, problem.message);
48203
48447
  } catch {
48204
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48448
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48205
48449
  }
48206
48450
  }
48207
48451
  if (looksLikeRemoteObject(error)) {
48208
- return failure(command, 7, "response_contract_invalid", false, responseContractAction(command));
48452
+ return failure(command, 7, "response_contract_invalid", false, responseContractAction(command, keyed));
48209
48453
  }
48210
48454
  if (error instanceof NetworkTransportError) {
48211
- return failure(command, 8, "network_error", true, `The request did not reach the ohmyho.st API, or its answer was cut off. If the agent runs in a sandbox without network access, run the command with network access. Otherwise ${retryAdvice(command)}.`);
48455
+ return failure(command, 8, "network_error", true, `The request did not reach the ohmyho.st API, or its answer was cut off. If the agent runs in a sandbox without network access, run the command with network access. Otherwise ${retryAdvice(command, keyed)}.`);
48212
48456
  }
48213
- return failure(command, 1, "internal_error", false, internalErrorAction(command));
48457
+ return failure(command, 1, "internal_error", false, internalErrorAction(command, keyed));
48214
48458
  };
48215
48459
  var reusedKeyProblem = (error) => {
48216
48460
  if (!looksLikeProblem(error))
@@ -48377,6 +48621,8 @@ var parsedCommandName = (command) => {
48377
48621
  return "export create";
48378
48622
  if (command.kind === "export-get")
48379
48623
  return "export get";
48624
+ if (command.kind === "export-download-link")
48625
+ return "export download-link";
48380
48626
  if (command.kind === "token-create")
48381
48627
  return "token create";
48382
48628
  if (command.kind === "token-list")
@@ -48429,6 +48675,12 @@ var parsedCommandName = (command) => {
48429
48675
  return "github connect";
48430
48676
  if (command.kind === "github-status")
48431
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";
48432
48684
  if (command.kind === "project-list")
48433
48685
  return "project list";
48434
48686
  if (command.kind === "database-compute-set")
@@ -50145,6 +50397,23 @@ var connectGithubOrganization = (parameters, options) => {
50145
50397
  }
50146
50398
  });
50147
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
+ };
50148
50417
  var getGithubOrganizationConnection = (parameters, options) => {
50149
50418
  const params = buildClientParams([parameters], [
50150
50419
  {
@@ -50162,6 +50431,41 @@ var getGithubOrganizationConnection = (parameters, options) => {
50162
50431
  ...params
50163
50432
  });
50164
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
+ };
50165
50469
  var getOrganizationReferral = (parameters, options) => {
50166
50470
  const params = buildClientParams([parameters], [
50167
50471
  {
@@ -50526,6 +50830,24 @@ var getProjectExport = (parameters, options) => {
50526
50830
  ...params
50527
50831
  });
50528
50832
  };
50833
+ var createProjectExportDownloadLink = (parameters, options) => {
50834
+ const params = buildClientParams([parameters], [
50835
+ {
50836
+ args: [
50837
+ { in: "headers", key: "X-Request-Id" },
50838
+ { in: "path", key: "project_id" },
50839
+ { in: "path", key: "export_id" }
50840
+ ]
50841
+ }
50842
+ ]);
50843
+ return (options?.client ?? client).post({
50844
+ responseStyle: "data",
50845
+ security: [{ scheme: "bearer", type: "http" }],
50846
+ url: "/v1/projects/{project_id}/exports/{export_id}/download-links",
50847
+ ...options,
50848
+ ...params
50849
+ });
50850
+ };
50529
50851
  var getProjectCreditBudget = (parameters, options) => {
50530
50852
  const params = buildClientParams([parameters], [
50531
50853
  {
@@ -50844,6 +51166,7 @@ var createProjectDevAccessTicket = (parameters, options) => {
50844
51166
  {
50845
51167
  args: [
50846
51168
  { in: "headers", key: "X-Request-Id" },
51169
+ { in: "headers", key: "Idempotency-Key" },
50847
51170
  { in: "path", key: "project_id" }
50848
51171
  ]
50849
51172
  }
@@ -51570,6 +51893,7 @@ var createProjectDatabaseAccess = (parameters, options) => {
51570
51893
  {
51571
51894
  args: [
51572
51895
  { in: "headers", key: "X-Request-Id" },
51896
+ { in: "headers", key: "Idempotency-Key" },
51573
51897
  { in: "path", key: "project_id" },
51574
51898
  { key: "projectDatabaseAccessRequest", map: "body" }
51575
51899
  ]
@@ -51740,6 +52064,7 @@ var deleteProjectDatabaseWebhook = (parameters, options) => {
51740
52064
  {
51741
52065
  args: [
51742
52066
  { in: "headers", key: "X-Request-Id" },
52067
+ { in: "headers", key: "Idempotency-Key" },
51743
52068
  { in: "path", key: "project_id" },
51744
52069
  { in: "path", key: "webhook_id" },
51745
52070
  { in: "query", key: "environment" }
@@ -51778,6 +52103,7 @@ var testProjectDatabaseWebhook = (parameters, options) => {
51778
52103
  {
51779
52104
  args: [
51780
52105
  { in: "headers", key: "X-Request-Id" },
52106
+ { in: "headers", key: "Idempotency-Key" },
51781
52107
  { in: "path", key: "project_id" },
51782
52108
  { in: "path", key: "webhook_id" },
51783
52109
  { in: "query", key: "environment" }
@@ -51818,6 +52144,7 @@ var replayProjectDatabaseWebhookDelivery = (parameters, options) => {
51818
52144
  {
51819
52145
  args: [
51820
52146
  { in: "headers", key: "X-Request-Id" },
52147
+ { in: "headers", key: "Idempotency-Key" },
51821
52148
  { in: "path", key: "project_id" },
51822
52149
  { in: "path", key: "delivery_id" },
51823
52150
  { in: "query", key: "environment" }
@@ -51938,6 +52265,7 @@ var runProjectDatabaseSchedule = (parameters, options) => {
51938
52265
  {
51939
52266
  args: [
51940
52267
  { in: "headers", key: "X-Request-Id" },
52268
+ { in: "headers", key: "Idempotency-Key" },
51941
52269
  { in: "path", key: "project_id" },
51942
52270
  { in: "path", key: "name" },
51943
52271
  { in: "query", key: "environment" }
@@ -52294,6 +52622,25 @@ var prepareManagedMailWebhook = (parameters, options) => {
52294
52622
  }
52295
52623
  });
52296
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
+ };
52297
52644
  var verifyManagedMailWebhook = (parameters, options) => {
52298
52645
  const params = buildClientParams([parameters], [
52299
52646
  {
@@ -52470,6 +52817,13 @@ function assertManagedMailResponse(value, input) {
52470
52817
  }
52471
52818
  return;
52472
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
+ }
52473
52827
  if (input.action === "webhook_set") {
52474
52828
  exact5(r, ["url", "signing_secret", "status"]);
52475
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"]))
@@ -52616,6 +52970,8 @@ function requestManagedMail(client2, input) {
52616
52970
  }, { client: client2 });
52617
52971
  case "webhook_verify":
52618
52972
  return verifyManagedMailWebhook({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52973
+ case "webhook_rotate":
52974
+ return rotateManagedMailWebhookSecret({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52619
52975
  case "webhook_disable":
52620
52976
  return disableManagedMailReceiving({ ...scope, "Idempotency-Key": input.idempotencyKey }, { client: client2 });
52621
52977
  case "domain_delete":
@@ -53145,6 +53501,7 @@ function checkedResponse(kind, value) {
53145
53501
  }
53146
53502
 
53147
53503
  // apps/product-cli/dist/product-api.js
53504
+ import { randomUUID as randomUUID3 } from "node:crypto";
53148
53505
  var WEBHOOK_SCOPE_MISMATCH = "Webhook response scope mismatch";
53149
53506
  var WATCH_SCOPE_MISMATCH = "Watch response scope mismatch";
53150
53507
  var TABLE_SCOPE_MISMATCH = "Table response scope mismatch";
@@ -53219,6 +53576,11 @@ var GeneratedSdkProductApi = class {
53219
53576
  assertProjectExport(result);
53220
53577
  return result;
53221
53578
  }
53579
+ async createProjectExportDownloadLink(input) {
53580
+ const result = await createProjectExportDownloadLink({ project_id: input.projectId, export_id: input.exportId }, { client: this.#client });
53581
+ assertProjectExportDownloadLink(result);
53582
+ return result;
53583
+ }
53222
53584
  async getCurrentIdentity() {
53223
53585
  return getCurrentIdentity({}, { client: this.#client });
53224
53586
  }
@@ -53450,6 +53812,7 @@ var GeneratedSdkProductApi = class {
53450
53812
  }
53451
53813
  async deleteProjectDatabaseWebhook(input) {
53452
53814
  const value = await deleteProjectDatabaseWebhook({
53815
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53453
53816
  project_id: input.projectId,
53454
53817
  environment: input.environment,
53455
53818
  webhook_id: input.webhookId
@@ -53461,6 +53824,7 @@ var GeneratedSdkProductApi = class {
53461
53824
  }
53462
53825
  async testProjectDatabaseWebhook(input) {
53463
53826
  const value = await testProjectDatabaseWebhook({
53827
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53464
53828
  project_id: input.projectId,
53465
53829
  environment: input.environment,
53466
53830
  webhook_id: input.webhookId
@@ -53483,6 +53847,7 @@ var GeneratedSdkProductApi = class {
53483
53847
  }
53484
53848
  async replayProjectDatabaseWebhookDelivery(input) {
53485
53849
  const value = await replayProjectDatabaseWebhookDelivery({
53850
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53486
53851
  project_id: input.projectId,
53487
53852
  environment: input.environment,
53488
53853
  delivery_id: input.deliveryId
@@ -53547,7 +53912,12 @@ var GeneratedSdkProductApi = class {
53547
53912
  return value;
53548
53913
  }
53549
53914
  async runProjectDatabaseSchedule(input) {
53550
- const value = await runProjectDatabaseSchedule({ project_id: input.projectId, environment: input.environment, name: input.name }, { client: this.#client });
53915
+ const value = await runProjectDatabaseSchedule({
53916
+ "Idempotency-Key": input.idempotencyKey ?? randomUUID3(),
53917
+ project_id: input.projectId,
53918
+ environment: input.environment,
53919
+ name: input.name
53920
+ }, { client: this.#client });
53551
53921
  assertDatabaseScheduleRunAccepted(value);
53552
53922
  if (value.schedule !== input.name)
53553
53923
  throw new TypeError(SCHEDULE_SCOPE_MISMATCH);
@@ -53664,6 +54034,15 @@ var GeneratedSdkProductApi = class {
53664
54034
  async getGithubConnection(organizationId) {
53665
54035
  return getGithubOrganizationConnection({ organization_id: organizationId }, { client: this.#client });
53666
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
+ }
53667
54046
  async linkSource(input) {
53668
54047
  return linkProjectSource({
53669
54048
  "Idempotency-Key": input.idempotencyKey,
@@ -54635,6 +55014,18 @@ var PNPM_RESOLVED_VERSION = /^([^()]+)(?:\(.*\))?$/u;
54635
55014
  var DEFAULT_EXPORT_PATTERN = /\bexport\s+default\b/u;
54636
55015
  var FETCH_HANDLER_PATTERN = /(?:[{,;}]|\basync)\s*fetch\s*(?:\(|:|,|\})/u;
54637
55016
  var SCHEDULED_HANDLER_PATTERN = /\bscheduled\s*(?:\(|:|,|\})/u;
55017
+ var SOCKET_PRIMITIVE_SPECIFIER = "cloudflare:sockets";
55018
+ var SOCKET_PRIMITIVE_PATTERN = new RegExp(`["'\`]${SOCKET_PRIMITIVE_SPECIFIER}["'\`]`, "u");
55019
+ var STRING_ESCAPE = /\\(?:x([0-9A-Fa-f]{2})|u([0-9A-Fa-f]{4})|u\{([0-9A-Fa-f]{1,6})\}|(?:\r\n|[\n\r\u2028\u2029])|([^\n\r\u2028\u2029]))/gu;
55020
+ var SIMPLE_STRING_ESCAPES = Object.freeze({
55021
+ b: "\b",
55022
+ f: "\f",
55023
+ n: "\n",
55024
+ r: "\r",
55025
+ t: " ",
55026
+ v: "\v",
55027
+ "0": "\0"
55028
+ });
54638
55029
  var DATABASE_CONTRACT_PATTERNS = Object.freeze([
54639
55030
  [
54640
55031
  /\bHYPERDRIVE\b|\bconnectionString\b|\bDATABASE_URL\b|postgres(?:ql)?:\/\//u,
@@ -54818,6 +55209,19 @@ function databaseContractCodes(source) {
54818
55209
  const code = sourceWithoutComments(source);
54819
55210
  return Object.freeze(DATABASE_CONTRACT_PATTERNS.filter(([pattern]) => pattern.test(code)).map(([, found]) => found));
54820
55211
  }
55212
+ function importsSocketPrimitive(source) {
55213
+ return SOCKET_PRIMITIVE_PATTERN.test(decodeStringEscapes(source));
55214
+ }
55215
+ function decodeStringEscapes(source) {
55216
+ return source.replace(STRING_ESCAPE, (match, hex, unit, braces, plain) => {
55217
+ const code = hex ?? unit ?? braces;
55218
+ if (code !== void 0) {
55219
+ const point = Number.parseInt(code, 16);
55220
+ return point > 1114111 ? match : String.fromCodePoint(point);
55221
+ }
55222
+ return plain === void 0 ? "" : SIMPLE_STRING_ESCAPES[plain] ?? plain;
55223
+ });
55224
+ }
54821
55225
  function workerModuleFindings(worker) {
54822
55226
  const { path: path2 } = worker;
54823
55227
  const code = sourceWithoutComments(worker.source);
@@ -54876,6 +55280,9 @@ function sourceWithoutComments(source) {
54876
55280
  function isDatabaseContractModule(path2) {
54877
55281
  return /\.(?:astro|ts|tsx|js|jsx|mjs|mts)$/u.test(path2) && !/\.d\.[cm]?ts$/u.test(path2);
54878
55282
  }
55283
+ function isSocketPrimitiveModule(path2) {
55284
+ return /\.(?:astro|[cm]?[jt]sx?)$/u.test(path2) && !/\.d\.[cm]?ts$/u.test(path2);
55285
+ }
54879
55286
  function manifestFindings(input, versions) {
54880
55287
  const { configuration, framework, manifest: manifest2 } = input;
54881
55288
  const findings = [];
@@ -55294,8 +55701,9 @@ function astroConfigFindings(text, path2, mode) {
55294
55701
  var DatabaseMigrationAdmissionError = class extends Error {
55295
55702
  reason;
55296
55703
  code = "database_migration_not_admitted";
55297
- constructor(reason) {
55298
- super("Database migration is not admitted");
55704
+ /** `detail` names the exact requirement for a refusal whose cause the customer can change; the code and reason do not change. */
55705
+ constructor(reason, detail) {
55706
+ super(detail === void 0 ? "Database migration is not admitted" : `Database migration is not admitted: ${detail}`);
55299
55707
  this.reason = reason;
55300
55708
  this.name = "DatabaseMigrationAdmissionError";
55301
55709
  }
@@ -55768,14 +56176,37 @@ function rejectFunctionBodyReferences(sql) {
55768
56176
  throw new DatabaseMigrationAdmissionError("provider_specific");
55769
56177
  }
55770
56178
  }
56179
+ function pinsSearchPath(tokens) {
56180
+ let found = false;
56181
+ for (let index = 0; index + 2 < tokens.length; index += 1) {
56182
+ if (!isSqlKeyword(tokens[index], "set") || !isSqlKeyword(tokens[index + 1], "search_path"))
56183
+ continue;
56184
+ const operator = tokens[index + 2];
56185
+ const assigns = isSqlKeyword(operator, "to") || operator?.kind === "symbol" && operator.value === "=";
56186
+ const first = tokens[index + 3];
56187
+ if (!assigns || !first)
56188
+ return false;
56189
+ found = true;
56190
+ if (first.kind === "string") {
56191
+ const list = first.value.trim().toLowerCase();
56192
+ if (list !== "" && !/^pg_catalog(?:\s*,|$)/u.test(list))
56193
+ return false;
56194
+ } else if (first.kind === "word" || first.kind === "identifier") {
56195
+ if (first.value.toLowerCase() !== "pg_catalog")
56196
+ return false;
56197
+ } else
56198
+ return false;
56199
+ }
56200
+ return found;
56201
+ }
55771
56202
  function admitStatement(tokens, sql) {
55772
56203
  const normalized = tokens.map((token) => token.kind === "string" ? "'literal'" : token.text.toLowerCase()).join(" ").replace(/\s*\.\s*/gu, ".");
55773
56204
  if (normalized === "set check_function_bodies = false")
55774
56205
  return;
55775
56206
  if (/^create\s+function\b/u.test(normalized)) {
55776
56207
  rejectFunctionBodyReferences(sql);
55777
- if (!/\blanguage\s+(?:sql|plpgsql)\b/u.test(normalized) || /\bsecurity\s+definer\b/u.test(normalized) && !/\bset\s+search_path\s*(?:=\s*|to\s+)/u.test(normalized)) {
55778
- throw new DatabaseMigrationAdmissionError("unsupported");
56208
+ if (!/\blanguage\s+(?:sql|plpgsql)\b/u.test(normalized) || /\bsecurity\s+definer\b/u.test(normalized) && !pinsSearchPath(tokens)) {
56209
+ throw new DatabaseMigrationAdmissionError("unsupported", "a SECURITY DEFINER function needs every SET search_path to be '' or to start with pg_catalog");
55779
56210
  }
55780
56211
  return;
55781
56212
  }
@@ -55820,7 +56251,8 @@ var GATEWAY_BINDING_NAME = /^OHMYHOST_(?:MAIL|STORAGE)_GATEWAY$/u;
55820
56251
  var GATEWAY_WORD_TOKEN = /[\p{ID_Start}_$][\p{ID_Continue}$]*/uy;
55821
56252
  var UNNAMED_MODULE_MESSAGES = Object.freeze({
55822
56253
  database_binding_private: 'The module at path reads a database connection string (DATABASE_URL, HYPERDRIVE, connectionString or a postgres:// URL); none reaches a customer Worker. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.',
55823
- database_driver_unsupported: 'The module at path imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.'
56254
+ database_driver_unsupported: 'The module at path imports a database socket driver (pg, postgres, pg-native or mysql2); customer Workers cannot open sockets. Call the database with createPrivateDatabaseClient from "@ohmyhost/customer-runtime/database". Commit and push the change, then plan the new commit.',
56255
+ socket_primitive_unsupported: "The module at path loads cloudflare:sockets; customer Workers cannot open sockets. Call HTTPS services through the global fetch function and declare each origin in runtime.egress.allow in ohmyhost.yaml. Commit and push the change, then plan the new commit."
55824
56256
  });
55825
56257
  function callsStorageClient(source) {
55826
56258
  return STORAGE_CLIENT_CALL_PATTERN.test(sourceWithoutComments(source));
@@ -56017,6 +56449,7 @@ async function judgeSource(context) {
56017
56449
  ...source.findings.map((finding) => requiredCatalogBlocker(finding, context.applicationRoot)),
56018
56450
  ...await workerModuleBlockers(context),
56019
56451
  ...await databaseContractBlockers(context, context.provider),
56452
+ ...await socketPrimitiveBlockers(context),
56020
56453
  ...await gatewayBindingBlockers(context),
56021
56454
  ...await storageClientBlockers(context),
56022
56455
  ...await migrationSqlBlockers(context, context.provider)
@@ -56240,11 +56673,28 @@ async function databaseContractBlockers(context, provider) {
56240
56673
  if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
56241
56674
  continue;
56242
56675
  for (const code of databaseContractCodes(await readFile3(absolute, "utf8")))
56243
- blockers.push(catalogBlocker({ code, path: path2 }, context.applicationRoot) ?? Object.freeze({
56244
- code,
56245
- path: repositoryPath(context.applicationRoot, path2),
56246
- message: UNNAMED_MODULE_MESSAGES[code]
56247
- }));
56676
+ blockers.push(moduleBlocker(code, path2, context.applicationRoot));
56677
+ }
56678
+ return blockers;
56679
+ }
56680
+ function moduleBlocker(code, path2, applicationRoot) {
56681
+ return catalogBlocker({ code, path: path2 }, applicationRoot) ?? Object.freeze({
56682
+ code,
56683
+ path: repositoryPath(applicationRoot, path2),
56684
+ message: UNNAMED_MODULE_MESSAGES[code]
56685
+ });
56686
+ }
56687
+ async function socketPrimitiveBlockers(context) {
56688
+ const blockers = [];
56689
+ for (const path2 of context.files) {
56690
+ if (!isSocketPrimitiveModule(path2))
56691
+ continue;
56692
+ const absolute = resolve5(context.applicationDirectory, path2);
56693
+ const information = await stat2(absolute);
56694
+ if (!information.isFile() || information.size > MAXIMUM_SOURCE_BYTES)
56695
+ continue;
56696
+ if (importsSocketPrimitive(await readFile3(absolute, "utf8")))
56697
+ blockers.push(moduleBlocker("socket_primitive_unsupported", path2, context.applicationRoot));
56248
56698
  }
56249
56699
  return blockers;
56250
56700
  }
@@ -56796,7 +57246,7 @@ function isNodeError(value) {
56796
57246
  }
56797
57247
 
56798
57248
  // apps/product-cli/dist/composition.js
56799
- import { randomUUID as randomUUID3 } from "node:crypto";
57249
+ import { randomUUID as randomUUID4 } from "node:crypto";
56800
57250
  import { join as join6, resolve as resolve6 } from "node:path";
56801
57251
 
56802
57252
  // packages/workos-auth-contracts/dist/device-flow.js
@@ -57633,7 +58083,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57633
58083
  const result = error instanceof InvalidCommandError ? invalidCommandFailure(args, environment) : errorDocument(recognizedCommandLabel(args), 1, "internal_error", false, internalErrorAction(recognizedCommandLabel(args)));
57634
58084
  if (!(error instanceof InvalidCommandError)) {
57635
58085
  diagnostics.record({
57636
- correlationId: randomUUID3(),
58086
+ correlationId: randomUUID4(),
57637
58087
  category: "internal",
57638
58088
  subsystem: "parser",
57639
58089
  errorKind: "unexpected"
@@ -57775,7 +58225,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57775
58225
  const result = compositionFailure(recognizedCommandLabel(args), error, signal, platform.commandPrefix, profile);
57776
58226
  if (result.exitCode === 1)
57777
58227
  diagnostics.record({
57778
- correlationId: randomUUID3(),
58228
+ correlationId: randomUUID4(),
57779
58229
  category: "internal",
57780
58230
  subsystem: "authentication",
57781
58231
  errorKind: "unexpected"
@@ -57843,7 +58293,7 @@ var runProductionCli = async (argv, environment, io, signal, overrides = {}) =>
57843
58293
  now,
57844
58294
  waitUntil,
57845
58295
  lifecycleTimeoutMs: REQUEST_TIMEOUT_MS,
57846
- createCorrelationId: randomUUID3,
58296
+ createCorrelationId: randomUUID4,
57847
58297
  diagnosticSink: diagnostics,
57848
58298
  operationEventSink: { write: (value) => io.writeStdout(value) },
57849
58299
  readSecretValue: overrides.readSecretValue ?? ((readSignal) => readSecretValueFromStandardInput(process.stdin, readSignal)),
@@ -57931,7 +58381,7 @@ var runOfflineInit = async (command, io, diagnostics) => {
57931
58381
  } catch (error) {
57932
58382
  const known = error instanceof RepositoryInitError;
57933
58383
  diagnostics.record({
57934
- correlationId: randomUUID3(),
58384
+ correlationId: randomUUID4(),
57935
58385
  category: known ? "configuration" : "internal",
57936
58386
  subsystem: "runtime",
57937
58387
  errorKind: known ? "invalid_response" : "unexpected"
@@ -58079,7 +58529,7 @@ var GeneratedSdkSessionRevoker = class {
58079
58529
  fetch: transport.fetch,
58080
58530
  throwOnError: true
58081
58531
  });
58082
- const result = await revokeCurrentSession({ "Idempotency-Key": randomUUID3() }, { client: client2, signal });
58532
+ const result = await revokeCurrentSession({ "Idempotency-Key": randomUUID4() }, { client: client2, signal });
58083
58533
  if (result.revoked !== true)
58084
58534
  throw new LifecycleTransportError();
58085
58535
  } catch (error) {
@@ -58258,7 +58708,7 @@ var runOfflineLogout = async (registry, request, commandPrefix, io, diagnostics)
58258
58708
  }
58259
58709
  } catch {
58260
58710
  diagnostics.record({
58261
- correlationId: randomUUID3(),
58711
+ correlationId: randomUUID4(),
58262
58712
  category: "credential_store",
58263
58713
  subsystem: "credential_store",
58264
58714
  errorKind: "unavailable"
@@ -58342,6 +58792,7 @@ export {
58342
58792
  parsePaidDomainPlan,
58343
58793
  parsePaidDomain,
58344
58794
  parseCloudflareDnsAuthorization,
58795
+ parseGithubDisconnection,
58345
58796
  parseCloudflareDnsAuthorizationStatus,
58346
58797
  parseDevAccessState,
58347
58798
  parsePoweredByFlag,