@amerged/ohmyhost-mcp 0.1.49 → 0.1.52

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 (29) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-GLPFLQD6.js → chunk-EAD7RRAF.js} +5 -5
  3. package/dist/index.js +1 -1
  4. package/dist/stdio-main.js +555 -5
  5. package/package.json +1 -1
  6. package/src/apps/mcp/package.json +1 -1
  7. package/src/apps/mcp/src/local-client.ts +5 -0
  8. package/src/apps/mcp/src/local-server.ts +307 -1
  9. package/src/apps/product-cli/package.json +1 -1
  10. package/src/apps/product-cli/src/cli.ts +22 -0
  11. package/src/apps/product-cli/src/command.ts +235 -0
  12. package/src/apps/product-cli/src/composition.ts +7 -2
  13. package/src/apps/product-cli/src/index.ts +1 -0
  14. package/src/apps/product-cli/src/native-auth.ts +172 -0
  15. package/src/apps/product-cli/src/product-api.ts +6 -0
  16. package/src/packages/agent-skills/src/generated-skill-resources.ts +4 -4
  17. package/src/packages/contracts/package.json +10 -0
  18. package/src/packages/contracts/src/framework-admission.ts +5 -0
  19. package/src/packages/contracts/src/framework-source-rules.ts +9 -0
  20. package/src/packages/contracts/src/index.ts +1 -1
  21. package/src/packages/contracts/src/native-auth.ts +158 -0
  22. package/src/packages/contracts/src/previews.ts +179 -0
  23. package/src/packages/contracts/src/problem-policy.ts +8 -1
  24. package/src/packages/contracts/src/project-exports.ts +11 -3
  25. package/src/packages/sdk-ts/package.json +1 -1
  26. package/src/packages/sdk-ts/src/generated/index.ts +81 -0
  27. package/src/packages/sdk-ts/src/generated/sdk.gen.ts +604 -0
  28. package/src/packages/sdk-ts/src/generated/types.gen.ts +995 -4
  29. package/src/packages/workos-auth-contracts/src/webhooks.ts +30 -13
@@ -746,11 +746,16 @@ export const runProductionCli = async (
746
746
  }
747
747
  // A command handed over from an OHMYHOST_TOKEN process runs only with a key of that account,
748
748
  // never with a saved login, even one of the same user.
749
- const requiredToken = command.kind === "secret-set" ? command.environmentToken : undefined;
749
+ const requiredToken =
750
+ command.kind === "secret-set" || command.kind === "native-auth"
751
+ ? command.environmentToken
752
+ : undefined;
750
753
  // Either handed form names its account; the login or key that would run it must be exactly that
751
754
  // account, so a login of the same name on another computer is refused before anything is read.
752
755
  const handedAccount =
753
- command.kind === "secret-set" ? (requiredToken ?? command.profileAccount) : undefined;
756
+ command.kind === "secret-set" || command.kind === "native-auth"
757
+ ? (requiredToken ?? command.profileAccount)
758
+ : undefined;
754
759
  if (requiredToken !== undefined && apiToken === undefined)
755
760
  return written(
756
761
  errorDocument(
@@ -33,3 +33,4 @@ export {
33
33
  } from "./runtime-contract.js";
34
34
 
35
35
  export * from "./user-token-file.js";
36
+ export * from "./native-auth.js";
@@ -0,0 +1,172 @@
1
+ import * as sdk from "@ohmyhost/sdk-ts";
2
+
3
+ type Scope = { readonly projectId: string; readonly environmentId: string };
4
+ type Write = { readonly idempotencyKey: string };
5
+ export type NativeAuthCommand = Scope &
6
+ (
7
+ | { action: "config_get" }
8
+ | (Write & {
9
+ action: "config_set";
10
+ configurationRevision: number;
11
+ enabled: boolean;
12
+ signupPolicy: "open" | "invite-only";
13
+ applicationName: string;
14
+ canonicalOrigin?: string | null;
15
+ allowedRedirectPaths?: readonly string[];
16
+ resetPasswordPath?: string;
17
+ invitationPath?: string;
18
+ })
19
+ | { action: "provider_get"; provider: "google" | "github" }
20
+ | (Write & {
21
+ action: "provider_set";
22
+ provider: "google" | "github";
23
+ configurationRevision: number;
24
+ enabled: boolean;
25
+ clientId?: string;
26
+ clientSecret?: string;
27
+ })
28
+ | { action: "users_list"; limit?: number; cursor?: string; search?: string }
29
+ | (Write & { action: "user_create"; email: string })
30
+ | { action: "user_get"; userId: string }
31
+ | (Write & {
32
+ action:
33
+ | "user_delete"
34
+ | "user_invite"
35
+ | "user_suspend"
36
+ | "user_reactivate"
37
+ | "user_revoke_sessions";
38
+ userId: string;
39
+ })
40
+ );
41
+
42
+ /** All local clients use the generated SDK and never return provider input secrets. */
43
+ export async function executeNativeAuth(
44
+ client: sdk.OhMyHostClient,
45
+ command: NativeAuthCommand,
46
+ ): Promise<unknown> {
47
+ const scope = { project_id: command.projectId, environment_id: command.environmentId };
48
+ const options = { client };
49
+ switch (command.action) {
50
+ case "config_get":
51
+ return sdk.getNativeAuthConfiguration(scope, options);
52
+ case "config_set":
53
+ return sdk.updateNativeAuthConfiguration(
54
+ {
55
+ ...scope,
56
+ "Idempotency-Key": command.idempotencyKey,
57
+ nativeAuthConfigurationUpdate: {
58
+ configurationRevision: command.configurationRevision,
59
+ enabled: command.enabled,
60
+ signupPolicy: command.signupPolicy,
61
+ applicationName: command.applicationName,
62
+ ...(command.canonicalOrigin === undefined
63
+ ? {}
64
+ : { canonicalOrigin: command.canonicalOrigin }),
65
+ ...(command.allowedRedirectPaths === undefined
66
+ ? {}
67
+ : { allowedRedirectPaths: [...command.allowedRedirectPaths] }),
68
+ ...(command.resetPasswordPath === undefined
69
+ ? {}
70
+ : { resetPasswordPath: command.resetPasswordPath }),
71
+ ...(command.invitationPath === undefined
72
+ ? {}
73
+ : { invitationPath: command.invitationPath }),
74
+ },
75
+ },
76
+ options,
77
+ );
78
+ case "provider_get": {
79
+ const result = await sdk.getNativeAuthProvider(
80
+ { ...scope, provider: command.provider },
81
+ options,
82
+ );
83
+ return providerStatus(result);
84
+ }
85
+ case "provider_set": {
86
+ const result = await sdk.updateNativeAuthProvider(
87
+ {
88
+ ...scope,
89
+ provider: command.provider,
90
+ "Idempotency-Key": command.idempotencyKey,
91
+ nativeAuthProviderUpdateWritable: {
92
+ configurationRevision: command.configurationRevision,
93
+ enabled: command.enabled,
94
+ ...(command.clientId === undefined ? {} : { clientId: command.clientId }),
95
+ ...(command.clientSecret === undefined ? {} : { clientSecret: command.clientSecret }),
96
+ },
97
+ },
98
+ options,
99
+ );
100
+ return providerStatus(result);
101
+ }
102
+ case "users_list":
103
+ return sdk.listNativeAuthUsers(
104
+ {
105
+ ...scope,
106
+ ...(command.limit === undefined ? {} : { limit: command.limit }),
107
+ ...(command.cursor === undefined ? {} : { cursor: command.cursor }),
108
+ ...(command.search === undefined ? {} : { search: command.search }),
109
+ },
110
+ options,
111
+ );
112
+ case "user_create":
113
+ return sdk.createNativeAuthUser(
114
+ {
115
+ ...scope,
116
+ "Idempotency-Key": command.idempotencyKey,
117
+ nativeAuthUserCreate: { email: command.email },
118
+ },
119
+ options,
120
+ );
121
+ case "user_get":
122
+ return sdk.getNativeAuthUser({ ...scope, user_id: command.userId }, options);
123
+ case "user_delete":
124
+ return sdk.deleteNativeAuthUser(
125
+ { ...scope, user_id: command.userId, "Idempotency-Key": command.idempotencyKey },
126
+ options,
127
+ );
128
+ case "user_invite":
129
+ return sdk.resendNativeAuthInvitation(
130
+ { ...scope, user_id: command.userId, "Idempotency-Key": command.idempotencyKey },
131
+ options,
132
+ );
133
+ case "user_suspend":
134
+ return sdk.suspendNativeAuthUser(
135
+ { ...scope, user_id: command.userId, "Idempotency-Key": command.idempotencyKey },
136
+ options,
137
+ );
138
+ case "user_reactivate":
139
+ return sdk.reactivateNativeAuthUser(
140
+ { ...scope, user_id: command.userId, "Idempotency-Key": command.idempotencyKey },
141
+ options,
142
+ );
143
+ case "user_revoke_sessions":
144
+ return sdk.revokeNativeAuthUserSessions(
145
+ { ...scope, user_id: command.userId, "Idempotency-Key": command.idempotencyKey },
146
+ options,
147
+ );
148
+ }
149
+ }
150
+
151
+ function providerStatus(result: sdk.NativeAuthProviderStatus): sdk.NativeAuthProviderStatus {
152
+ const {
153
+ provider,
154
+ enabled,
155
+ configured,
156
+ clientId,
157
+ secretPresent,
158
+ callbackUrl,
159
+ scopes,
160
+ lastSuccessfulFlowAt,
161
+ } = result;
162
+ return {
163
+ provider,
164
+ enabled,
165
+ configured,
166
+ clientId,
167
+ secretPresent,
168
+ callbackUrl,
169
+ scopes,
170
+ lastSuccessfulFlowAt,
171
+ };
172
+ }
@@ -4,6 +4,7 @@ import {
4
4
  type ManagedMailCommand,
5
5
  type SharedMailCommand,
6
6
  } from "@ohmyhost/sdk-ts";
7
+ import { executeNativeAuth, type NativeAuthCommand } from "./native-auth.js";
7
8
  import type {
8
9
  ProjectDataChangeKind,
9
10
  ProjectDataChangePlan,
@@ -257,6 +258,7 @@ export interface DatabaseTableAnswer {
257
258
  }
258
259
 
259
260
  export interface ProductApi {
261
+ nativeAuth?(input: NativeAuthCommand): Promise<unknown>;
260
262
  readonly managedSource?: ManagedSourceApi;
261
263
  planProjectDataChange(input: {
262
264
  projectId: string;
@@ -1810,4 +1812,8 @@ export class GeneratedSdkProductApi implements ProductApi {
1810
1812
  public managedMail(input: ManagedMailCommand) {
1811
1813
  return executeManagedMail(this.#client, input);
1812
1814
  }
1815
+
1816
+ public nativeAuth(input: NativeAuthCommand) {
1817
+ return executeNativeAuth(this.#client, input);
1818
+ }
1813
1819
  }