@amerged/ohmyhost-mcp 0.1.49 → 0.1.50

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.
@@ -5,6 +5,11 @@
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "exports": {
8
+ "./native-auth": {
9
+ "source": "./src/native-auth.ts",
10
+ "types": "./dist/native-auth.d.ts",
11
+ "import": "./dist/native-auth.js"
12
+ },
8
13
  "./database-sizes": {
9
14
  "source": "./src/database-sizes.ts",
10
15
  "types": "./dist/database-sizes.d.ts",
@@ -348,6 +348,11 @@ const VITE_BUILD_SCRIPT =
348
348
  // Each sentence names the file, the rule and the exact change. Render and parse both derive from
349
349
  // the template, so a client maps a detail back to exactly one typed diagnostic.
350
350
  const FRAMEWORK_CONVERSION_DETAILS = Object.freeze({
351
+ native_auth_route_conflict: {
352
+ paths: ["module"],
353
+ template:
354
+ '"{{path}}" declares a route in the reserved /api/auth/v1 namespace. Move the route or select a different authentication provider. Commit and push the change, then plan the new commit.',
355
+ },
351
356
  astro_template_import_unsupported: {
352
357
  paths: ["module"],
353
358
  template:
@@ -577,6 +577,15 @@ function configurationFindings(input: FrameworkSourceRuleInput): FrameworkConver
577
577
  const build = "command" in configuration.build ? configuration.build : null;
578
578
  const crons = (configuration.functions?.crons.length ?? 0) > 0;
579
579
  const findings: FrameworkConversionDiagnostic[] = [];
580
+ if (configuration.auth?.provider === "omh-native") {
581
+ for (const path of files) {
582
+ if (
583
+ /^(?:src\/)?(?:app|pages)\/api\/auth\/v1(?:\/.*)?\.(?:astro|[cm]?[jt]sx?)$/u.test(path) ||
584
+ /^src\/routes\/api(?:\.auth\.v1|\/auth\/v1)(?:[./].*)?\.[cm]?[jt]sx?$/u.test(path)
585
+ )
586
+ findings.push(diagnostic({ code: "native_auth_route_conflict", path }));
587
+ }
588
+ }
580
589
  // runtime.mode functions selects the functions framework, whose build is only build.install.
581
590
  if (framework !== "functions" && !runtimeModeAdmitted(framework, configuration, crons))
582
591
  findings.push(
@@ -45,7 +45,7 @@ export interface OhmyhostConfig {
45
45
  migrations?: string;
46
46
  }>;
47
47
  readonly auth?: Readonly<{
48
- provider: "none" | "better-auth";
48
+ provider: "none" | "better-auth" | "omh-native";
49
49
  }>;
50
50
  readonly mail?: Readonly<{
51
51
  enabled: boolean;
@@ -0,0 +1,158 @@
1
+ /** Stable contracts shared by Native Auth's trusted platform boundaries. */
2
+ export const NATIVE_AUTH_BASE_PATH = "/api/auth/v1" as const;
3
+ export const NATIVE_AUTH_BINDING_NAME = "OHMYHOST_AUTH" as const;
4
+ export const NATIVE_AUTH_REQUEST_DEADLINE_MS = 15_000;
5
+ /** Immutable platform-owned Native schema cohort; a changed schema requires a new migration. */
6
+ export const NATIVE_AUTH_SCHEMA_V1_SHA256 = // gitleaks:allow -- public migration digest
7
+ "65446cd8208df79d09d44513b8a22495c4b6b26012b1be6d21920037629bd147" as const;
8
+ export const NATIVE_AUTH_SCHEMA_V2_SHA256 = // gitleaks:allow -- public migration digest
9
+ "dc432e4f593dffff9c7549ef00956a91d6270678d6af34a32b7344164ebd2f71" as const;
10
+ export const NATIVE_AUTH_SCHEMA_MIGRATION_VERSION = 3 as const;
11
+ export const NATIVE_AUTH_SCHEMA_MIGRATION_SHA256 =
12
+ "799e3678b725c268176abc97e61ca796ff98c3ab32f2cfb119994aa9e35d3eeb" as const;
13
+ export const NATIVE_AUTH_DEFAULT_REDIRECT_PATHS = Object.freeze([
14
+ "/",
15
+ "/login",
16
+ "/reset-password",
17
+ "/accept-invitation",
18
+ ] as const);
19
+
20
+ /** Canonical local application path, with no escapes or ambiguous path segments. */
21
+ export function isNativeAuthRedirectPath(value: unknown): value is string {
22
+ return (
23
+ typeof value === "string" &&
24
+ value.length <= 256 &&
25
+ /^\/[A-Za-z0-9/_~.-]*$/u.test(value) &&
26
+ !value.includes("//") &&
27
+ !value.split("/").some((segment) => segment === "." || segment === "..")
28
+ );
29
+ }
30
+
31
+ export type NativeAuthProvider = "google" | "github";
32
+ export type NativeAuthSignupPolicy = "open" | "invite-only";
33
+ export type NativeAuthUserStatus = "pending" | "active" | "suspended";
34
+
35
+ /** Derived from trusted routing, never from a browser-provided project or origin. */
36
+ export interface NativeAuthRealmContext {
37
+ readonly projectId: string;
38
+ readonly environmentId: string;
39
+ readonly canonicalOrigin: string;
40
+ readonly realmGeneration: number;
41
+ readonly configurationRevision: number;
42
+ }
43
+
44
+ export interface NativeAuthSession {
45
+ readonly user: Readonly<{ id: string; email: string }>;
46
+ readonly session: Readonly<{ id: string; expiresAt: string }>;
47
+ }
48
+
49
+ /** Authenticated browser self projection; independent Native mailbox proof owns recovery. */
50
+ export interface NativeAuthSelfSession extends NativeAuthSession {
51
+ readonly user: Readonly<{ id: string; email: string; recoveryAvailable: boolean }>;
52
+ }
53
+
54
+ /** A private read-only binding. Store or admission failures reject instead of returning null. */
55
+ export interface NativeAuthBinding {
56
+ validateSession(
57
+ input: Readonly<{
58
+ cookie: string;
59
+ }>,
60
+ ): Promise<NativeAuthSession | null>;
61
+ }
62
+
63
+ export interface NativeAuthProviderStatus {
64
+ readonly provider: NativeAuthProvider;
65
+ readonly enabled: boolean;
66
+ readonly configured: boolean;
67
+ readonly clientId: string | null;
68
+ readonly secretPresent: boolean;
69
+ readonly callbackUrl: string | null;
70
+ readonly scopes: readonly string[];
71
+ readonly lastSuccessfulFlowAt: string | null;
72
+ }
73
+
74
+ /** Secret is input-only and must never be included in status or replay receipts. */
75
+ export interface NativeAuthProviderUpdate {
76
+ readonly configurationRevision: number;
77
+ readonly enabled: boolean;
78
+ readonly clientId?: string;
79
+ readonly clientSecret?: string;
80
+ }
81
+
82
+ export interface NativeAuthConfiguration {
83
+ readonly enabled: boolean;
84
+ readonly configurationRevision: number;
85
+ readonly revocationEpoch: number;
86
+ readonly signupPolicy: NativeAuthSignupPolicy;
87
+ readonly canonicalOrigin: string | null;
88
+ readonly applicationName: string;
89
+ readonly allowedRedirectPaths: readonly string[];
90
+ readonly resetPasswordPath: string;
91
+ readonly invitationPath: string;
92
+ readonly readiness: Readonly<{
93
+ paid: boolean;
94
+ sender: boolean;
95
+ origin: boolean;
96
+ storage: boolean;
97
+ }>;
98
+ }
99
+
100
+ export interface NativeAuthConfigurationUpdate {
101
+ readonly configurationRevision: number;
102
+ readonly enabled: boolean;
103
+ readonly signupPolicy: NativeAuthSignupPolicy;
104
+ readonly applicationName: string;
105
+ readonly canonicalOrigin?: string | null;
106
+ readonly allowedRedirectPaths?: readonly string[];
107
+ readonly resetPasswordPath?: string;
108
+ readonly invitationPath?: string;
109
+ }
110
+
111
+ export interface NativeAuthUser {
112
+ readonly id: string;
113
+ readonly email: string;
114
+ readonly status: NativeAuthUserStatus;
115
+ readonly recoveryAvailable: boolean;
116
+ readonly createdAt: string;
117
+ }
118
+
119
+ export interface NativeAuthUserCreate {
120
+ readonly email: string;
121
+ }
122
+
123
+ export interface NativeAuthUserPage {
124
+ readonly items: readonly NativeAuthUser[];
125
+ readonly nextCursor: string | null;
126
+ }
127
+
128
+ /** Exact browser-facing methods and paths; no engine admin or token APIs are reachable. */
129
+ const PUBLIC_ROUTES: Readonly<Record<string, readonly string[]>> = Object.freeze({
130
+ GET: Object.freeze([
131
+ "/get-session",
132
+ "/verify-email",
133
+ "/callback/google",
134
+ "/callback/github",
135
+ "/list-accounts",
136
+ ]),
137
+ POST: Object.freeze([
138
+ "/sign-up/email",
139
+ "/sign-in/email",
140
+ "/sign-in/social",
141
+ "/sign-out",
142
+ "/request-password-reset",
143
+ "/reset-password",
144
+ "/change-password",
145
+ "/send-verification-email",
146
+ "/link-social",
147
+ "/unlink-account",
148
+ "/accept-invitation",
149
+ "/reauthenticate",
150
+ "/enroll-recovery",
151
+ ]),
152
+ });
153
+
154
+ export function isNativeAuthPublicRoute(method: string, pathname: string): boolean {
155
+ if (!pathname.startsWith(`${NATIVE_AUTH_BASE_PATH}/`)) return false;
156
+ if (!Object.hasOwn(PUBLIC_ROUTES, method)) return false;
157
+ return PUBLIC_ROUTES[method]?.includes(pathname.slice(NATIVE_AUTH_BASE_PATH.length)) === true;
158
+ }
@@ -330,7 +330,7 @@ export const PROBLEM_POLICY = {
330
330
  status: 409,
331
331
  retryable: true,
332
332
  action:
333
- "Wait for the running operation to finish, read the project again, then rename with the new ETag.",
333
+ "Read project status and finish or retry any pending Native Auth deployment or other operation. Once preparation is complete, read the project again and rename with its current ETag.",
334
334
  title: "Project address change blocked",
335
335
  },
336
336
  project_identity_unavailable: {
@@ -638,6 +638,13 @@ export const PROBLEM_POLICY = {
638
638
  action:
639
639
  "This project still has a live or pending custom-domain connection. Read 'ohmyhost domain paid status --project ULID --json', remove that connection with 'ohmyhost domain paid delete --project ULID --hostname HOST --yes --json', then create a fresh project deletion plan. Repeating while it remains connected cannot work.",
640
640
  },
641
+ native_domain_sync_pending: {
642
+ status: 409,
643
+ retryable: false,
644
+ title: "Complete the pending domain change",
645
+ action:
646
+ "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.",
647
+ },
641
648
  } as const;
642
649
 
643
650
  export type ProblemCode = keyof typeof PROBLEM_POLICY;
@@ -61,9 +61,17 @@ export function assertProjectExport(value: unknown): asserts value is ProjectExp
61
61
  Number(archive["bytes"]) > 536870912 ||
62
62
  typeof archive["sha256"] !== "string" ||
63
63
  !/^sha256:[a-f0-9]{64}$/u.test(archive["sha256"]) ||
64
- !['["dev.sql"]', '["prod.sql"]', '["dev.sql","prod.sql"]', '["shared.sql"]'].includes(
65
- JSON.stringify(archive["sql_files"]),
66
- ) ||
64
+ ![
65
+ '["dev.sql"]',
66
+ '["prod.sql"]',
67
+ '["dev.sql","prod.sql"]',
68
+ '["shared.sql"]',
69
+ '["auth.sql"]',
70
+ '["dev.sql","auth.sql"]',
71
+ '["prod.sql","auth.sql"]',
72
+ '["dev.sql","prod.sql","auth.sql"]',
73
+ '["shared.sql","auth.sql"]',
74
+ ].includes(JSON.stringify(archive["sql_files"])) ||
67
75
  !timestamp(archive["captured_at"]) ||
68
76
  !timestamp(archive["expires_at"])
69
77
  )
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ohmyhost/sdk-ts",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,6 +20,7 @@ export {
20
20
  createCloudflareDnsAuthorization,
21
21
  createDeployment,
22
22
  createManagedSourceUpload,
23
+ createNativeAuthUser,
23
24
  createOrganization,
24
25
  createProject,
25
26
  createProjectDatabaseAccess,
@@ -34,6 +35,7 @@ export {
34
35
  declareApplicationDomainIdentity,
35
36
  deleteEnvironmentSecret,
36
37
  deleteManagedMailDomain,
38
+ deleteNativeAuthUser,
37
39
  deletePaidProjectDomain,
38
40
  deleteProject,
39
41
  deleteProjectDatabaseSchedule,
@@ -60,6 +62,9 @@ export {
60
62
  getManagedMailDomain,
61
63
  getManagedMailMessage,
62
64
  getManagedSourceUpload,
65
+ getNativeAuthConfiguration,
66
+ getNativeAuthProvider,
67
+ getNativeAuthUser,
63
68
  getOperation,
64
69
  getOrganizationAccount,
65
70
  getOrganizationCredits,
@@ -91,6 +96,7 @@ export {
91
96
  listManagedMailMessages,
92
97
  listManagedSourceFiles,
93
98
  listManagedSourceVersions,
99
+ listNativeAuthUsers,
94
100
  listProjectDatabaseAccess,
95
101
  listProjectDatabaseScheduleRuns,
96
102
  listProjectDatabaseSchedules,
@@ -113,16 +119,19 @@ export {
113
119
  putManagedSourceBlob,
114
120
  putProjectMailDomainBinding,
115
121
  queryProjectDatabase,
122
+ reactivateNativeAuthUser,
116
123
  reconcileOperation,
117
124
  recordSignupSource,
118
125
  registerFeatureInterest,
119
126
  replayProjectDatabaseWebhookDelivery,
127
+ resendNativeAuthInvitation,
120
128
  restoreManagedSource,
121
129
  retireWorkspaceMailDomain,
122
130
  retryManagedMailMessage,
123
131
  revokeApplicationDomainIdentity,
124
132
  revokeApplicationDomainIdentityDnsAuthorization,
125
133
  revokeCurrentSession,
134
+ revokeNativeAuthUserSessions,
126
135
  revokeProjectDatabaseAccess,
127
136
  revokeProjectDevShareLink,
128
137
  revokeUserApiKey,
@@ -139,8 +148,11 @@ export {
139
148
  streamOperationEvents,
140
149
  submitContactRequest,
141
150
  submitFeedback,
151
+ suspendNativeAuthUser,
142
152
  switchManagedSource,
143
153
  testProjectDatabaseWebhook,
154
+ updateNativeAuthConfiguration,
155
+ updateNativeAuthProvider,
144
156
  verifyApplicationDomainIdentity,
145
157
  verifyManagedMailWebhook,
146
158
  writeProjectDatabase,
@@ -263,6 +275,11 @@ export type {
263
275
  CreateManagedSourceUploadErrors,
264
276
  CreateManagedSourceUploadResponse,
265
277
  CreateManagedSourceUploadResponses,
278
+ CreateNativeAuthUserData,
279
+ CreateNativeAuthUserError,
280
+ CreateNativeAuthUserErrors,
281
+ CreateNativeAuthUserResponse,
282
+ CreateNativeAuthUserResponses,
266
283
  CreateOrganizationData,
267
284
  CreateOrganizationError,
268
285
  CreateOrganizationErrors,
@@ -380,6 +397,11 @@ export type {
380
397
  DeleteManagedMailDomainErrors,
381
398
  DeleteManagedMailDomainResponse,
382
399
  DeleteManagedMailDomainResponses,
400
+ DeleteNativeAuthUserData,
401
+ DeleteNativeAuthUserError,
402
+ DeleteNativeAuthUserErrors,
403
+ DeleteNativeAuthUserResponse,
404
+ DeleteNativeAuthUserResponses,
383
405
  DeletePaidProjectDomainData,
384
406
  DeletePaidProjectDomainError,
385
407
  DeletePaidProjectDomainErrors,
@@ -534,6 +556,21 @@ export type {
534
556
  GetManagedSourceUploadErrors,
535
557
  GetManagedSourceUploadResponse,
536
558
  GetManagedSourceUploadResponses,
559
+ GetNativeAuthConfigurationData,
560
+ GetNativeAuthConfigurationError,
561
+ GetNativeAuthConfigurationErrors,
562
+ GetNativeAuthConfigurationResponse,
563
+ GetNativeAuthConfigurationResponses,
564
+ GetNativeAuthProviderData,
565
+ GetNativeAuthProviderError,
566
+ GetNativeAuthProviderErrors,
567
+ GetNativeAuthProviderResponse,
568
+ GetNativeAuthProviderResponses,
569
+ GetNativeAuthUserData,
570
+ GetNativeAuthUserError,
571
+ GetNativeAuthUserErrors,
572
+ GetNativeAuthUserResponse,
573
+ GetNativeAuthUserResponses,
537
574
  GetOperationData,
538
575
  GetOperationError,
539
576
  GetOperationErrors,
@@ -702,6 +739,11 @@ export type {
702
739
  ListManagedSourceVersionsErrors,
703
740
  ListManagedSourceVersionsResponse,
704
741
  ListManagedSourceVersionsResponses,
742
+ ListNativeAuthUsersData,
743
+ ListNativeAuthUsersError,
744
+ ListNativeAuthUsersErrors,
745
+ ListNativeAuthUsersResponse,
746
+ ListNativeAuthUsersResponses,
705
747
  ListProjectDatabaseAccessData,
706
748
  ListProjectDatabaseAccessError,
707
749
  ListProjectDatabaseAccessErrors,
@@ -775,6 +817,15 @@ export type {
775
817
  ManagedSourceUploadReceipt,
776
818
  ManagedSourceUploadRequest,
777
819
  ManagedSourceVersions,
820
+ NativeAuthConfiguration,
821
+ NativeAuthConfigurationUpdate,
822
+ NativeAuthProviderStatus,
823
+ NativeAuthProviderUpdate,
824
+ NativeAuthProviderUpdateWritable,
825
+ NativeAuthRedirectPath,
826
+ NativeAuthUser,
827
+ NativeAuthUserCreate,
828
+ NativeAuthUserPage,
778
829
  NullableCommitSha,
779
830
  Operation,
780
831
  OperationDeploymentProgress,
@@ -887,6 +938,11 @@ export type {
887
938
  QueryProjectDatabaseErrors,
888
939
  QueryProjectDatabaseResponse,
889
940
  QueryProjectDatabaseResponses,
941
+ ReactivateNativeAuthUserData,
942
+ ReactivateNativeAuthUserError,
943
+ ReactivateNativeAuthUserErrors,
944
+ ReactivateNativeAuthUserResponse,
945
+ ReactivateNativeAuthUserResponses,
890
946
  ReconcileOperationData,
891
947
  ReconcileOperationError,
892
948
  ReconcileOperationErrors,
@@ -908,6 +964,11 @@ export type {
908
964
  ReplayProjectDatabaseWebhookDeliveryResponse,
909
965
  ReplayProjectDatabaseWebhookDeliveryResponses,
910
966
  RequestId,
967
+ ResendNativeAuthInvitationData,
968
+ ResendNativeAuthInvitationError,
969
+ ResendNativeAuthInvitationErrors,
970
+ ResendNativeAuthInvitationResponse,
971
+ ResendNativeAuthInvitationResponses,
911
972
  RestoreManagedSourceData,
912
973
  RestoreManagedSourceError,
913
974
  RestoreManagedSourceErrors,
@@ -938,6 +999,11 @@ export type {
938
999
  RevokeCurrentSessionErrors,
939
1000
  RevokeCurrentSessionResponse,
940
1001
  RevokeCurrentSessionResponses,
1002
+ RevokeNativeAuthUserSessionsData,
1003
+ RevokeNativeAuthUserSessionsError,
1004
+ RevokeNativeAuthUserSessionsErrors,
1005
+ RevokeNativeAuthUserSessionsResponse,
1006
+ RevokeNativeAuthUserSessionsResponses,
941
1007
  RevokeProjectDatabaseAccessData,
942
1008
  RevokeProjectDatabaseAccessError,
943
1009
  RevokeProjectDatabaseAccessErrors,
@@ -1031,6 +1097,11 @@ export type {
1031
1097
  SubmitFeedbackErrors,
1032
1098
  SubmitFeedbackResponse,
1033
1099
  SubmitFeedbackResponses,
1100
+ SuspendNativeAuthUserData,
1101
+ SuspendNativeAuthUserError,
1102
+ SuspendNativeAuthUserErrors,
1103
+ SuspendNativeAuthUserResponse,
1104
+ SuspendNativeAuthUserResponses,
1034
1105
  SwitchManagedSourceData,
1035
1106
  SwitchManagedSourceError,
1036
1107
  SwitchManagedSourceErrors,
@@ -1043,6 +1114,16 @@ export type {
1043
1114
  TestProjectDatabaseWebhookResponse,
1044
1115
  TestProjectDatabaseWebhookResponses,
1045
1116
  Ulid,
1117
+ UpdateNativeAuthConfigurationData,
1118
+ UpdateNativeAuthConfigurationError,
1119
+ UpdateNativeAuthConfigurationErrors,
1120
+ UpdateNativeAuthConfigurationResponse,
1121
+ UpdateNativeAuthConfigurationResponses,
1122
+ UpdateNativeAuthProviderData,
1123
+ UpdateNativeAuthProviderError,
1124
+ UpdateNativeAuthProviderErrors,
1125
+ UpdateNativeAuthProviderResponse,
1126
+ UpdateNativeAuthProviderResponses,
1046
1127
  UsageTotal,
1047
1128
  UserApiKey,
1048
1129
  UserApiKeyCreation,