@amerged/ohmyhost-mcp 0.1.22 → 0.1.24

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 (87) hide show
  1. package/README.md +5 -2
  2. package/dist/{chunk-NLBFEH6H.js → chunk-EEFUMPKG.js} +25 -24
  3. package/dist/index.js +1 -1
  4. package/dist/stdio-main.js +734 -269
  5. package/package.json +1 -1
  6. package/src/apps/mcp/package.json +47 -0
  7. package/src/apps/mcp/{local-client.ts → src/local-client.ts} +69 -12
  8. package/src/apps/mcp/{local-server.ts → src/local-server.ts} +327 -145
  9. package/src/apps/product-cli/package.json +45 -0
  10. package/src/apps/product-cli/{bin.ts → src/bin.ts} +3 -0
  11. package/src/apps/product-cli/{cli.ts → src/cli.ts} +363 -87
  12. package/src/apps/product-cli/{command.ts → src/command.ts} +58 -11
  13. package/src/apps/product-cli/{composition.ts → src/composition.ts} +98 -21
  14. package/src/apps/product-cli/{index.ts → src/index.ts} +1 -0
  15. package/src/apps/product-cli/{product-api.ts → src/product-api.ts} +65 -19
  16. package/src/apps/product-cli/{repository-init.ts → src/repository-init.ts} +79 -29
  17. package/src/apps/product-cli/{runtime-contract.ts → src/runtime-contract.ts} +16 -309
  18. package/src/apps/product-cli/{user-token-file.ts → src/user-token-file.ts} +46 -35
  19. package/src/apps/product-cli/{workspace.ts → src/workspace.ts} +6 -0
  20. package/src/packages/agent-skills/package.json +24 -0
  21. package/src/packages/agent-skills/src/generated-skill-resources.ts +165 -0
  22. package/src/packages/agent-skills/{index.ts → src/index.ts} +1 -1
  23. package/src/packages/contracts/package.json +137 -0
  24. package/src/packages/contracts/src/browser-capabilities.ts +133 -0
  25. package/src/packages/contracts/src/customer-auth-admission.ts +36 -0
  26. package/src/packages/contracts/{database-access.ts → src/database-access.ts} +10 -2
  27. package/src/packages/contracts/{framework-admission.ts → src/framework-admission.ts} +88 -13
  28. package/src/packages/contracts/src/framework-build-script.mjs +22 -0
  29. package/src/packages/contracts/src/framework-build-script.ts +1 -0
  30. package/src/packages/contracts/{index.ts → src/index.ts} +17 -16
  31. package/src/packages/contracts/src/operation-data-change-result.ts +86 -0
  32. package/src/packages/contracts/{operation-deployment-result.ts → src/operation-deployment-result.ts} +2 -2
  33. package/src/packages/contracts/{operation-failure.ts → src/operation-failure.ts} +24 -12
  34. package/src/packages/contracts/src/problem-policy.ts +498 -0
  35. package/src/packages/contracts/src/project-data-changes.ts +90 -0
  36. package/src/packages/contracts/src/secret-names.ts +27 -0
  37. package/src/packages/sdk-ts/package.json +21 -0
  38. package/src/packages/sdk-ts/{generated → src/generated}/index.ts +15 -0
  39. package/src/packages/sdk-ts/{generated → src/generated}/sdk.gen.ts +114 -5
  40. package/src/packages/sdk-ts/{generated → src/generated}/types.gen.ts +209 -10
  41. package/src/packages/workos-auth-contracts/package.json +39 -0
  42. package/src/packages/agent-skills/generated-skill-resources.ts +0 -165
  43. /package/src/apps/mcp/{index.ts → src/index.ts} +0 -0
  44. /package/src/apps/mcp/{stdio-main.ts → src/stdio-main.ts} +0 -0
  45. /package/src/apps/product-cli/{credential-store.ts → src/credential-store.ts} +0 -0
  46. /package/src/apps/product-cli/{device-token-expiry.ts → src/device-token-expiry.ts} +0 -0
  47. /package/src/apps/product-cli/{file-credential-store.ts → src/file-credential-store.ts} +0 -0
  48. /package/src/apps/product-cli/{profile-store.ts → src/profile-store.ts} +0 -0
  49. /package/src/apps/product-cli/{project-link-store.ts → src/project-link-store.ts} +0 -0
  50. /package/src/apps/product-cli/{psql-session.ts → src/psql-session.ts} +0 -0
  51. /package/src/packages/contracts/{application-root.ts → src/application-root.ts} +0 -0
  52. /package/src/packages/contracts/{billing.ts → src/billing.ts} +0 -0
  53. /package/src/packages/contracts/{credit-pricing.ts → src/credit-pricing.ts} +0 -0
  54. /package/src/packages/contracts/{database-compute.ts → src/database-compute.ts} +0 -0
  55. /package/src/packages/contracts/{database-migration-admission.ts → src/database-migration-admission.ts} +0 -0
  56. /package/src/packages/contracts/{feedback.ts → src/feedback.ts} +0 -0
  57. /package/src/packages/contracts/{framework-family.ts → src/framework-family.ts} +0 -0
  58. /package/src/packages/contracts/{functions.ts → src/functions.ts} +0 -0
  59. /package/src/packages/contracts/{platform-origins.ts → src/platform-origins.ts} +0 -0
  60. /package/src/packages/contracts/{project-context.ts → src/project-context.ts} +0 -0
  61. /package/src/packages/contracts/{project-exports.ts → src/project-exports.ts} +0 -0
  62. /package/src/packages/contracts/{user-api-keys.ts → src/user-api-keys.ts} +0 -0
  63. /package/src/packages/sdk-ts/{generated → src/generated}/client/client.gen.ts +0 -0
  64. /package/src/packages/sdk-ts/{generated → src/generated}/client/index.ts +0 -0
  65. /package/src/packages/sdk-ts/{generated → src/generated}/client/types.gen.ts +0 -0
  66. /package/src/packages/sdk-ts/{generated → src/generated}/client/utils.gen.ts +0 -0
  67. /package/src/packages/sdk-ts/{generated → src/generated}/client.gen.ts +0 -0
  68. /package/src/packages/sdk-ts/{generated → src/generated}/core/auth.gen.ts +0 -0
  69. /package/src/packages/sdk-ts/{generated → src/generated}/core/bodySerializer.gen.ts +0 -0
  70. /package/src/packages/sdk-ts/{generated → src/generated}/core/params.gen.ts +0 -0
  71. /package/src/packages/sdk-ts/{generated → src/generated}/core/pathSerializer.gen.ts +0 -0
  72. /package/src/packages/sdk-ts/{generated → src/generated}/core/queryKeySerializer.gen.ts +0 -0
  73. /package/src/packages/sdk-ts/{generated → src/generated}/core/serverSentEvents.gen.ts +0 -0
  74. /package/src/packages/sdk-ts/{generated → src/generated}/core/types.gen.ts +0 -0
  75. /package/src/packages/sdk-ts/{generated → src/generated}/core/utils.gen.ts +0 -0
  76. /package/src/packages/sdk-ts/{index.ts → src/index.ts} +0 -0
  77. /package/src/packages/sdk-ts/{managed-mail-response.ts → src/managed-mail-response.ts} +0 -0
  78. /package/src/packages/sdk-ts/{managed-mail.ts → src/managed-mail.ts} +0 -0
  79. /package/src/packages/workos-auth-contracts/{device-flow.ts → src/device-flow.ts} +0 -0
  80. /package/src/packages/workos-auth-contracts/{index.ts → src/index.ts} +0 -0
  81. /package/src/packages/workos-auth-contracts/{management-rpc.ts → src/management-rpc.ts} +0 -0
  82. /package/src/packages/workos-auth-contracts/{organizations.ts → src/organizations.ts} +0 -0
  83. /package/src/packages/workos-auth-contracts/{parsing.ts → src/parsing.ts} +0 -0
  84. /package/src/packages/workos-auth-contracts/{session-status.ts → src/session-status.ts} +0 -0
  85. /package/src/packages/workos-auth-contracts/{tokens.ts → src/tokens.ts} +0 -0
  86. /package/src/packages/workos-auth-contracts/{user-api-keys.ts → src/user-api-keys.ts} +0 -0
  87. /package/src/packages/workos-auth-contracts/{webhooks.ts → src/webhooks.ts} +0 -0
@@ -0,0 +1,86 @@
1
+ import {
2
+ parseOperationDeploymentResult,
3
+ type OperationDeploymentResult,
4
+ } from "./operation-deployment-result.js";
5
+
6
+ export const OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION =
7
+ "ohmyhost.operation-data-change-result/v1" as const;
8
+ export interface OperationDataChangeResult {
9
+ readonly schemaVersion: typeof OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION;
10
+ readonly operationId: string;
11
+ readonly change:
12
+ | "isolate_prod_keeps_data"
13
+ | "isolate_dev_keeps_data"
14
+ | "share_prod_keeps_data"
15
+ | "reset_dev";
16
+ readonly data_mode: "shared" | "isolated";
17
+ readonly redeploy_environments: readonly ("dev" | "prod")[];
18
+ readonly deleted_database: boolean;
19
+ readonly deleted_files: number;
20
+ }
21
+ export type OperationResult = OperationDeploymentResult | OperationDataChangeResult;
22
+
23
+ export function createOperationDataChangeResult(
24
+ input: Omit<OperationDataChangeResult, "schemaVersion">,
25
+ ): OperationDataChangeResult {
26
+ return parseOperationDataChangeResult({
27
+ schemaVersion: OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION,
28
+ ...input,
29
+ });
30
+ }
31
+ export function parseOperationDataChangeResult(value: unknown): OperationDataChangeResult {
32
+ if (value === null || typeof value !== "object" || Array.isArray(value)) invalid();
33
+ const input = value as Record<string, unknown>;
34
+ if (
35
+ Object.keys(input).sort().join(",") !==
36
+ "change,data_mode,deleted_database,deleted_files,operationId,redeploy_environments,schemaVersion" ||
37
+ input["schemaVersion"] !== OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION ||
38
+ typeof input["operationId"] !== "string" ||
39
+ !/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(input["operationId"])
40
+ )
41
+ invalid();
42
+ const change = input["change"];
43
+ if (
44
+ change !== "isolate_prod_keeps_data" &&
45
+ change !== "isolate_dev_keeps_data" &&
46
+ change !== "share_prod_keeps_data" &&
47
+ change !== "reset_dev"
48
+ )
49
+ invalid();
50
+ const retiring = change === "reset_dev" || change === "share_prod_keeps_data";
51
+ const redeploy = input["redeploy_environments"];
52
+ if (
53
+ input["data_mode"] !== (change === "share_prod_keeps_data" ? "shared" : "isolated") ||
54
+ !Array.isArray(redeploy) ||
55
+ redeploy.length !== 1 ||
56
+ redeploy[0] !== (change === "isolate_dev_keeps_data" ? "prod" : "dev") ||
57
+ typeof input["deleted_database"] !== "boolean" ||
58
+ !Number.isSafeInteger(input["deleted_files"]) ||
59
+ Number(input["deleted_files"]) < 0 ||
60
+ (!retiring && (input["deleted_database"] || input["deleted_files"] !== 0))
61
+ )
62
+ invalid();
63
+ return Object.freeze({
64
+ schemaVersion: OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION,
65
+ operationId: input["operationId"],
66
+ change,
67
+ data_mode: input["data_mode"] as "shared" | "isolated",
68
+ redeploy_environments: Object.freeze([redeploy[0] as "dev" | "prod"]),
69
+ deleted_database: input["deleted_database"],
70
+ deleted_files: Number(input["deleted_files"]),
71
+ });
72
+ }
73
+
74
+ /** Keep the deployment-specific parser and its return type unchanged. */
75
+ export function parseOperationResult(value: unknown): OperationResult {
76
+ return value !== null &&
77
+ typeof value === "object" &&
78
+ !Array.isArray(value) &&
79
+ (value as Record<string, unknown>)["schemaVersion"] ===
80
+ OPERATION_DATA_CHANGE_RESULT_SCHEMA_VERSION
81
+ ? parseOperationDataChangeResult(value)
82
+ : parseOperationDeploymentResult(value);
83
+ }
84
+ function invalid(): never {
85
+ throw new TypeError("Operation data change result is invalid");
86
+ }
@@ -91,9 +91,9 @@ const deploymentProgressActions = {
91
91
  publishing:
92
92
  "The build has completed. Runtime preparation or publication is still running; poll this same operation.",
93
93
  waiting_for_mail:
94
- "Read 'ohmyhost mail domain status --project PROJECT --json' now and follow its verification issue and DNS records. Keep this operation; do not rebuild or repeat correct DNS changes.",
94
+ "Read 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status) now, with the Prod environment ID from 'ohmyhost project status', and follow its verification issue and DNS records. Keep this operation; do not rebuild or repeat correct DNS changes.",
95
95
  mail_status_unavailable:
96
- "Mail readiness could not be observed. Read 'ohmyhost mail domain status --project PROJECT --json' and report a persistent error; keep this operation.",
96
+ "Mail readiness could not be observed. Read 'ohmyhost mail status --project PROJECT --environment PROD_ENVIRONMENT_ULID --json' (MCP mail_status) with the Prod environment ID from 'ohmyhost project status', and report a persistent error; keep this operation.",
97
97
  } as const;
98
98
  export type DeploymentProgressPhase = keyof typeof deploymentProgressActions;
99
99
  export interface OperationDeploymentProgress {
@@ -1,11 +1,11 @@
1
1
  const failures = {
2
2
  operation_abandoned: [
3
- "The operation stopped renewing its execution lease and was ended.",
4
- "Inspect project status and, when this operation names a deployment_id, its diagnostics with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs before creating a fresh plan. Keep this operation ID; the expired execution cannot resume.",
3
+ "ohmyho.st stopped this operation before it finished and ended it.",
4
+ "Repeating this operation cannot resume it. Read project status for what is live; if this operation names a deployment_id, read 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. Then submit the request once more with a new idempotency key: a deployment, promotion, rollback or deletion from a fresh plan, a rename with the ETag from project status. If it ends the same way, report both operation IDs through feedback.",
5
5
  ],
6
6
  database_write_rejected: [
7
7
  "The database rejected this write; it was not committed.",
8
- "Inspect the schema and parameter types with database query, then correct the statement and use a new key. Do not reset the database.",
8
+ "The statement failed on PostgreSQL, ran or waited for a lock longer than 5 seconds, affected more than 1,000 rows, or was not one INSERT, UPDATE or DELETE. Check table, column and parameter types with database query, split a large change into batches of at most 1,000 rows, then submit with a new key. Nothing was committed; do not reset the database.",
9
9
  ],
10
10
  database_write_unavailable: [
11
11
  "The database write could not start.",
@@ -58,7 +58,7 @@ const failures = {
58
58
  ],
59
59
  operation_failed: [
60
60
  "The operation failed.",
61
- "Inspect the operation events and deployment diagnostics. Include the operation ID when reporting the issue.",
61
+ "Read project status and, if this operation names a deployment_id, its diagnostics with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json'. Without one (a source link or project creation), check project status or project list, then repeat that command once with a new idempotency key. If it fails again, report the operation ID through feedback.",
62
62
  ],
63
63
  build_not_started: [
64
64
  "The deployment ended without starting a build.",
@@ -66,7 +66,7 @@ const failures = {
66
66
  ],
67
67
  build_failed: [
68
68
  "The build did not produce a verified deployable artifact.",
69
- "Read the BUILD_FAILED diagnostic of this operation's deployment_id with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs; its excerpt is the tail of the install and build output. Correct that failure and verify the commands for the admitted commit before planning a new deployment.",
69
+ "Read the BUILD_FAILED item of this operation's deployment_id with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. Its excerpt is the tail of your install and build output: fix that error, push and plan the new commit. Without an excerpt the build printed nothing, passed the 8-minute limit or failed inside ohmyho.st: plan the same commit once more, and report the operation ID through feedback if it fails again.",
70
70
  ],
71
71
  insufficient_organization_credits: [
72
72
  "The organization does not have sufficient available credits for this operation.",
@@ -74,28 +74,40 @@ const failures = {
74
74
  ],
75
75
  paid_plan_required: [
76
76
  "Transactional mail requires an active Paid plan for this organization.",
77
- "Activate or renew Paid for the organization, then create a new deployment plan. Replaying this terminal operation cannot enable mail. Do not change application code or reset its database.",
77
+ "Ask the organization Owner to activate Paid through billing checkout; top-ups and signup credits do not activate it. Then plan the same deployment or promotion again. If the app should send no mail, instead set mail.enabled to false in ohmyhost.yaml, commit and push, and plan the new commit. Replaying this operation cannot enable mail. Do not reset the database.",
78
78
  ],
79
79
  database_migration_failed: [
80
- "The database migrations could not be applied.",
81
- "Inspect the migration diagnostics and verify the canonical SQL migrations on PostgreSQL. Preserve production data; do not reset the database to retry a deployment.",
80
+ "The database migrations were not applied; none of this deployment's new migration files took effect.",
81
+ "Read the DATABASE_MIGRATION_FAILED item in 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' and fix what it names; run 'ohmyhost init --dry-run --json' for migration_sql_not_admitted. Keep applied files unchanged, give new files later timestamps, and add to existing tables only nullable columns without default and non-unique indexes. Push and plan the new commit; never reset the database.",
82
82
  ],
83
83
  runtime_candidate_failed: [
84
84
  "The deployed candidate failed its runtime checks.",
85
- "Read the HEALTH_CHECK_FAILED diagnostic of this operation's deployment_id with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. Its route must answer 2xx to a cookieless GET without a redirect; status_code and, for owners, excerpt show what it answered. Fix that, often a missing secret or a redirect, then plan a new deployment.",
85
+ "Read the HEALTH_CHECK_FAILED item with 'ohmyhost deployment logs --project PROJECT_ULID --deployment DEPLOYMENT_ULID --follow --json' or MCP deployment_logs. ohmyhost.yaml runtime.healthcheck (default /) must answer 2xx to a cookieless GET without redirect; status_code and, for owners, excerpt show the answer. After a promotion or rollback, fix that environment, often a missing secret, and plan it again; else fix the app, push and plan the new commit. No such item: plan once more, then report.",
86
86
  ],
87
87
  runtime_candidate_rejected: [
88
- "The runtime rejected the built Worker script.",
89
- "Check that src/ohmyhost/worker.ts exports its handlers as the default export and imports no framework-only modules, then plan the new commit. Replaying this terminal operation cannot stage the same script.",
88
+ "The runtime refused to load the built Worker.",
89
+ "The built Worker could not be loaded: top-level code throws or calls fetch, timers or random values outside a handler, an import cannot be resolved, a Worker module such as src/ohmyhost/companion.ts has no default export, or the bundle is too large. Fix that, push and plan the new commit; replaying this operation cannot pass. If none of this applies, report the operation ID through feedback.",
90
90
  ],
91
91
  storage_jurisdiction_conflict: [
92
92
  "storage.jurisdiction must equal the project's hosting region.",
93
- "Set storage.jurisdiction in ohmyhost.yaml to the project's hosting region shown by project status and plan again. A project cannot move its files between regions; do not delete or recreate the project to change it.",
93
+ "Set storage.jurisdiction in ohmyhost.yaml to the project's region (us or eu) shown by 'ohmyhost project status', commit and push, then plan the new commit (for a promotion, deploy it to Dev and promote again); the unchanged commit fails again. A project cannot move its files between regions; do not delete or recreate the project to change it.",
94
94
  ],
95
95
  provider_state_absent: [
96
96
  "Reconciliation confirmed that the required deployment resources are absent.",
97
97
  "Create a fresh deployment plan. The original operation is terminal; do not repeatedly reconcile it.",
98
98
  ],
99
+ auto_deploy_plan_rejected: [
100
+ "The GitHub push could not be planned for deployment.",
101
+ "Read project status and the operation's error or deployment diagnostics. Correct the source or configuration named there, push the new commit and plan it before deploying. Replaying this failed operation cannot start a build.",
102
+ ],
103
+ promotion_source_stale: [
104
+ "The Dev deployment changed before promotion could start.",
105
+ "Read the current Dev deployment with 'ohmyhost project status --project ULID --json', then run 'ohmyhost deployment promote plan' for that succeeded deployment and confirm the new plan. Replaying this terminal promotion cannot select another source.",
106
+ ],
107
+ promotion_target_stale: [
108
+ "The Prod deployment changed before promotion could start.",
109
+ "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.",
110
+ ],
99
111
  } as const;
100
112
 
101
113
  export interface PublicOperationFailure {