@myagentroam/protocol 0.1.7 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export * from './enterprise.js';
3
+ export * from './skill.js';
4
+ export * from './mcp.js';
3
5
  export const healthStatusSchema = z.object({
4
6
  status: z.literal('ok')
5
7
  });
@@ -11,6 +13,15 @@ export const runnerAvailabilitySchema = z.object({
11
13
  available: z.boolean(),
12
14
  version: z.string().optional()
13
15
  });
16
+ export const runtimeCommandSchema = z
17
+ .object({
18
+ id: z.enum(['npx', 'git', 'python', 'pip']),
19
+ command: z.string().trim().min(1).max(128),
20
+ available: z.boolean(),
21
+ version: z.string().trim().min(1).max(512).optional(),
22
+ path: z.string().trim().min(1).max(2048).optional()
23
+ })
24
+ .strict();
14
25
  export const nodeUpgradeStatusSchema = z.object({
15
26
  state: z.enum(['IDLE', 'WAITING_FOR_RUNS', 'READY_TO_RESTART', 'FAILED']),
16
27
  targetVersion: z
@@ -32,6 +43,7 @@ export const nodeMetadataSchema = z
32
43
  codex: runnerAvailabilitySchema.optional(),
33
44
  claudeCode: runnerAvailabilitySchema.optional(),
34
45
  openCode: runnerAvailabilitySchema.optional(),
46
+ runtimeCommands: z.array(runtimeCommandSchema).max(16).optional(),
35
47
  supervisedUpgrade: z.boolean().optional(),
36
48
  upgrade: nodeUpgradeStatusSchema.optional()
37
49
  })
@@ -236,7 +248,9 @@ export const runnerProfileSchema = z.object({
236
248
  models: z.array(z.object({
237
249
  id: z.string().min(1).max(128),
238
250
  label: z.string().min(1).max(128),
239
- supportedEfforts: z.array(z.string().min(1).max(64)).max(32)
251
+ supportedEfforts: z.array(z.string().min(1).max(64)).max(32),
252
+ isDefault: z.boolean().optional(),
253
+ defaultEffort: z.string().min(1).max(64).optional()
240
254
  })),
241
255
  accessOptions: z.array(z.object({
242
256
  id: z.string().min(1).max(128),
@@ -754,7 +768,21 @@ export const workbenchNodeOperationSchema = z.enum([
754
768
  'terminal.close',
755
769
  'terminal.attach.authorize',
756
770
  'node.upgrade.request',
757
- 'node.upgrade.cancel'
771
+ 'node.upgrade.cancel',
772
+ 'node.skills.inspect',
773
+ 'node.skills.install',
774
+ 'node.skills.remove',
775
+ 'workspace.skills.inspect',
776
+ 'workspace.skills.install',
777
+ 'workspace.skills.remove',
778
+ 'workspace.skills.git-exclude-repair',
779
+ 'skill.install.job.get',
780
+ 'node.mcps.inspect',
781
+ 'node.mcps.install',
782
+ 'node.mcps.remove',
783
+ 'workspace.mcps.inspect',
784
+ 'workspace.mcps.install',
785
+ 'workspace.mcps.remove'
758
786
  ]);
759
787
  /**
760
788
  * A small, explicit envelope keeps WebSocket messages independently parseable
@@ -806,6 +834,19 @@ export const nodeErrorSchema = z.object({
806
834
  'TERMINAL_ATTACH_CONFLICT',
807
835
  'TERMINAL_REPLAY_GAP',
808
836
  'TERMINAL_DATA_CHANNEL_UNAVAILABLE',
837
+ 'SKILL_TARGET_OFFLINE',
838
+ 'SKILL_TARGET_LIMIT_EXCEEDED',
839
+ 'SKILL_NAME_CONFLICT',
840
+ 'SKILL_PATH_UNSAFE',
841
+ 'SKILL_CONTENT_INVALID',
842
+ 'SKILL_INSTALL_PARTIAL',
843
+ 'SKILL_INSTALL_FAILED',
844
+ 'SKILL_INSTALL_VERSION_UNKNOWN',
845
+ 'SKILL_INSTALL_RECOVERY_REQUIRED',
846
+ 'SKILL_INSTALL_INVALID_LINK',
847
+ 'NODE_SKILL_LINK_UNAVAILABLE',
848
+ 'WORKSPACE_SKILL_GIT_EXCLUDE_FAILED',
849
+ 'WORKSPACE_SKILL_TRACKED_CONFIRM_REQUIRED',
809
850
  'INTERNAL_ERROR'
810
851
  ])
811
852
  });
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,438 @@
1
+ import { z } from 'zod';
2
+ export declare const mcpSourceInputSchema: z.ZodEffects<z.ZodObject<{
3
+ scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
4
+ organizationId: z.ZodOptional<z.ZodNumber>;
5
+ name: z.ZodString;
6
+ locator: z.ZodEffects<z.ZodString, string, string>;
7
+ enabled: z.ZodOptional<z.ZodBoolean>;
8
+ }, "strict", z.ZodTypeAny, {
9
+ name: string;
10
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
11
+ locator: string;
12
+ organizationId?: number | undefined;
13
+ enabled?: boolean | undefined;
14
+ }, {
15
+ name: string;
16
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
17
+ locator: string;
18
+ organizationId?: number | undefined;
19
+ enabled?: boolean | undefined;
20
+ }>, {
21
+ name: string;
22
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
23
+ locator: string;
24
+ organizationId?: number | undefined;
25
+ enabled?: boolean | undefined;
26
+ }, {
27
+ name: string;
28
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
29
+ locator: string;
30
+ organizationId?: number | undefined;
31
+ enabled?: boolean | undefined;
32
+ }>;
33
+ export type McpSourceInput = z.infer<typeof mcpSourceInputSchema>;
34
+ export declare const mcpRuntimeDescriptorSchema: z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
35
+ transport: z.ZodLiteral<"STDIO">;
36
+ command: z.ZodString;
37
+ args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
+ environment: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
39
+ secretName: z.ZodString;
40
+ }, "strict", z.ZodTypeAny, {
41
+ secretName: string;
42
+ }, {
43
+ secretName: string;
44
+ }>>>>;
45
+ }, "strict", z.ZodTypeAny, {
46
+ transport: "STDIO";
47
+ command: string;
48
+ args: string[];
49
+ environment?: Record<string, {
50
+ secretName: string;
51
+ }> | undefined;
52
+ }, {
53
+ transport: "STDIO";
54
+ command: string;
55
+ args?: string[] | undefined;
56
+ environment?: Record<string, {
57
+ secretName: string;
58
+ }> | undefined;
59
+ }>, z.ZodObject<{
60
+ transport: z.ZodLiteral<"HTTP">;
61
+ url: z.ZodEffects<z.ZodString, string, string>;
62
+ headers: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
63
+ secretName: z.ZodString;
64
+ }, "strict", z.ZodTypeAny, {
65
+ secretName: string;
66
+ }, {
67
+ secretName: string;
68
+ }>>>>;
69
+ }, "strict", z.ZodTypeAny, {
70
+ transport: "HTTP";
71
+ url: string;
72
+ headers?: Record<string, {
73
+ secretName: string;
74
+ }> | undefined;
75
+ }, {
76
+ transport: "HTTP";
77
+ url: string;
78
+ headers?: Record<string, {
79
+ secretName: string;
80
+ }> | undefined;
81
+ }>]>;
82
+ export type McpRuntimeDescriptor = z.infer<typeof mcpRuntimeDescriptorSchema>;
83
+ export declare const mcpCatalogEntrySchema: z.ZodEffects<z.ZodObject<{
84
+ id: z.ZodString;
85
+ sourceId: z.ZodString;
86
+ scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
87
+ ownerOrganizationId: z.ZodOptional<z.ZodNumber>;
88
+ ownerUserId: z.ZodOptional<z.ZodNumber>;
89
+ serverName: z.ZodString;
90
+ displayName: z.ZodString;
91
+ description: z.ZodString;
92
+ version: z.ZodEffects<z.ZodString, string, string>;
93
+ featured: z.ZodBoolean;
94
+ tags: z.ZodArray<z.ZodString, "many">;
95
+ runtime: z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
96
+ transport: z.ZodLiteral<"STDIO">;
97
+ command: z.ZodString;
98
+ args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
99
+ environment: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
100
+ secretName: z.ZodString;
101
+ }, "strict", z.ZodTypeAny, {
102
+ secretName: string;
103
+ }, {
104
+ secretName: string;
105
+ }>>>>;
106
+ }, "strict", z.ZodTypeAny, {
107
+ transport: "STDIO";
108
+ command: string;
109
+ args: string[];
110
+ environment?: Record<string, {
111
+ secretName: string;
112
+ }> | undefined;
113
+ }, {
114
+ transport: "STDIO";
115
+ command: string;
116
+ args?: string[] | undefined;
117
+ environment?: Record<string, {
118
+ secretName: string;
119
+ }> | undefined;
120
+ }>, z.ZodObject<{
121
+ transport: z.ZodLiteral<"HTTP">;
122
+ url: z.ZodEffects<z.ZodString, string, string>;
123
+ headers: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
124
+ secretName: z.ZodString;
125
+ }, "strict", z.ZodTypeAny, {
126
+ secretName: string;
127
+ }, {
128
+ secretName: string;
129
+ }>>>>;
130
+ }, "strict", z.ZodTypeAny, {
131
+ transport: "HTTP";
132
+ url: string;
133
+ headers?: Record<string, {
134
+ secretName: string;
135
+ }> | undefined;
136
+ }, {
137
+ transport: "HTTP";
138
+ url: string;
139
+ headers?: Record<string, {
140
+ secretName: string;
141
+ }> | undefined;
142
+ }>]>;
143
+ createdAt: z.ZodNumber;
144
+ updatedAt: z.ZodNumber;
145
+ }, "strict", z.ZodTypeAny, {
146
+ id: string;
147
+ createdAt: number;
148
+ updatedAt: number;
149
+ displayName: string;
150
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
151
+ sourceId: string;
152
+ featured: boolean;
153
+ tags: string[];
154
+ description: string;
155
+ serverName: string;
156
+ version: string;
157
+ runtime: {
158
+ transport: "STDIO";
159
+ command: string;
160
+ args: string[];
161
+ environment?: Record<string, {
162
+ secretName: string;
163
+ }> | undefined;
164
+ } | {
165
+ transport: "HTTP";
166
+ url: string;
167
+ headers?: Record<string, {
168
+ secretName: string;
169
+ }> | undefined;
170
+ };
171
+ ownerUserId?: number | undefined;
172
+ ownerOrganizationId?: number | undefined;
173
+ }, {
174
+ id: string;
175
+ createdAt: number;
176
+ updatedAt: number;
177
+ displayName: string;
178
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
179
+ sourceId: string;
180
+ featured: boolean;
181
+ tags: string[];
182
+ description: string;
183
+ serverName: string;
184
+ version: string;
185
+ runtime: {
186
+ transport: "STDIO";
187
+ command: string;
188
+ args?: string[] | undefined;
189
+ environment?: Record<string, {
190
+ secretName: string;
191
+ }> | undefined;
192
+ } | {
193
+ transport: "HTTP";
194
+ url: string;
195
+ headers?: Record<string, {
196
+ secretName: string;
197
+ }> | undefined;
198
+ };
199
+ ownerUserId?: number | undefined;
200
+ ownerOrganizationId?: number | undefined;
201
+ }>, {
202
+ id: string;
203
+ createdAt: number;
204
+ updatedAt: number;
205
+ displayName: string;
206
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
207
+ sourceId: string;
208
+ featured: boolean;
209
+ tags: string[];
210
+ description: string;
211
+ serverName: string;
212
+ version: string;
213
+ runtime: {
214
+ transport: "STDIO";
215
+ command: string;
216
+ args: string[];
217
+ environment?: Record<string, {
218
+ secretName: string;
219
+ }> | undefined;
220
+ } | {
221
+ transport: "HTTP";
222
+ url: string;
223
+ headers?: Record<string, {
224
+ secretName: string;
225
+ }> | undefined;
226
+ };
227
+ ownerUserId?: number | undefined;
228
+ ownerOrganizationId?: number | undefined;
229
+ }, {
230
+ id: string;
231
+ createdAt: number;
232
+ updatedAt: number;
233
+ displayName: string;
234
+ scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
235
+ sourceId: string;
236
+ featured: boolean;
237
+ tags: string[];
238
+ description: string;
239
+ serverName: string;
240
+ version: string;
241
+ runtime: {
242
+ transport: "STDIO";
243
+ command: string;
244
+ args?: string[] | undefined;
245
+ environment?: Record<string, {
246
+ secretName: string;
247
+ }> | undefined;
248
+ } | {
249
+ transport: "HTTP";
250
+ url: string;
251
+ headers?: Record<string, {
252
+ secretName: string;
253
+ }> | undefined;
254
+ };
255
+ ownerUserId?: number | undefined;
256
+ ownerOrganizationId?: number | undefined;
257
+ }>;
258
+ export type McpCatalogEntry = z.infer<typeof mcpCatalogEntrySchema>;
259
+ export declare const mcpInstallationConfigurationSchema: z.ZodObject<{
260
+ arguments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
261
+ environment: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
262
+ secretName: z.ZodString;
263
+ }, "strict", z.ZodTypeAny, {
264
+ secretName: string;
265
+ }, {
266
+ secretName: string;
267
+ }>>>>;
268
+ headers: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
269
+ secretName: z.ZodString;
270
+ }, "strict", z.ZodTypeAny, {
271
+ secretName: string;
272
+ }, {
273
+ secretName: string;
274
+ }>>>>;
275
+ }, "strict", z.ZodTypeAny, {
276
+ environment?: Record<string, {
277
+ secretName: string;
278
+ }> | undefined;
279
+ headers?: Record<string, {
280
+ secretName: string;
281
+ }> | undefined;
282
+ arguments?: string[] | undefined;
283
+ }, {
284
+ environment?: Record<string, {
285
+ secretName: string;
286
+ }> | undefined;
287
+ headers?: Record<string, {
288
+ secretName: string;
289
+ }> | undefined;
290
+ arguments?: string[] | undefined;
291
+ }>;
292
+ export type McpInstallationConfiguration = z.infer<typeof mcpInstallationConfigurationSchema>;
293
+ export declare const mcpInstallationInputSchema: z.ZodObject<{
294
+ catalogEntryId: z.ZodString;
295
+ enabled: z.ZodDefault<z.ZodBoolean>;
296
+ configuration: z.ZodDefault<z.ZodObject<{
297
+ arguments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
298
+ environment: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
299
+ secretName: z.ZodString;
300
+ }, "strict", z.ZodTypeAny, {
301
+ secretName: string;
302
+ }, {
303
+ secretName: string;
304
+ }>>>>;
305
+ headers: z.ZodOptional<z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
306
+ secretName: z.ZodString;
307
+ }, "strict", z.ZodTypeAny, {
308
+ secretName: string;
309
+ }, {
310
+ secretName: string;
311
+ }>>>>;
312
+ }, "strict", z.ZodTypeAny, {
313
+ environment?: Record<string, {
314
+ secretName: string;
315
+ }> | undefined;
316
+ headers?: Record<string, {
317
+ secretName: string;
318
+ }> | undefined;
319
+ arguments?: string[] | undefined;
320
+ }, {
321
+ environment?: Record<string, {
322
+ secretName: string;
323
+ }> | undefined;
324
+ headers?: Record<string, {
325
+ secretName: string;
326
+ }> | undefined;
327
+ arguments?: string[] | undefined;
328
+ }>>;
329
+ }, "strict", z.ZodTypeAny, {
330
+ enabled: boolean;
331
+ catalogEntryId: string;
332
+ configuration: {
333
+ environment?: Record<string, {
334
+ secretName: string;
335
+ }> | undefined;
336
+ headers?: Record<string, {
337
+ secretName: string;
338
+ }> | undefined;
339
+ arguments?: string[] | undefined;
340
+ };
341
+ }, {
342
+ catalogEntryId: string;
343
+ enabled?: boolean | undefined;
344
+ configuration?: {
345
+ environment?: Record<string, {
346
+ secretName: string;
347
+ }> | undefined;
348
+ headers?: Record<string, {
349
+ secretName: string;
350
+ }> | undefined;
351
+ arguments?: string[] | undefined;
352
+ } | undefined;
353
+ }>;
354
+ export type McpInstallationInput = z.infer<typeof mcpInstallationInputSchema>;
355
+ export declare const installedMcpSchema: z.ZodObject<{
356
+ catalogEntryId: z.ZodString;
357
+ serverName: z.ZodString;
358
+ displayName: z.ZodString;
359
+ version: z.ZodString;
360
+ origin: z.ZodEnum<["NODE", "WORKSPACE"]>;
361
+ enabled: z.ZodBoolean;
362
+ status: z.ZodEnum<["CURRENT", "UPDATE_AVAILABLE", "INVALID", "UNAVAILABLE"]>;
363
+ installedAt: z.ZodNumber;
364
+ }, "strict", z.ZodTypeAny, {
365
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
366
+ displayName: string;
367
+ enabled: boolean;
368
+ installedAt: number;
369
+ serverName: string;
370
+ version: string;
371
+ catalogEntryId: string;
372
+ origin: "NODE" | "WORKSPACE";
373
+ }, {
374
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
375
+ displayName: string;
376
+ enabled: boolean;
377
+ installedAt: number;
378
+ serverName: string;
379
+ version: string;
380
+ catalogEntryId: string;
381
+ origin: "NODE" | "WORKSPACE";
382
+ }>;
383
+ export declare const mcpTargetInspectionSchema: z.ZodObject<{
384
+ targetKind: z.ZodEnum<["NODE", "WORKSPACE"]>;
385
+ installations: z.ZodArray<z.ZodObject<{
386
+ catalogEntryId: z.ZodString;
387
+ serverName: z.ZodString;
388
+ displayName: z.ZodString;
389
+ version: z.ZodString;
390
+ origin: z.ZodEnum<["NODE", "WORKSPACE"]>;
391
+ enabled: z.ZodBoolean;
392
+ status: z.ZodEnum<["CURRENT", "UPDATE_AVAILABLE", "INVALID", "UNAVAILABLE"]>;
393
+ installedAt: z.ZodNumber;
394
+ }, "strict", z.ZodTypeAny, {
395
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
396
+ displayName: string;
397
+ enabled: boolean;
398
+ installedAt: number;
399
+ serverName: string;
400
+ version: string;
401
+ catalogEntryId: string;
402
+ origin: "NODE" | "WORKSPACE";
403
+ }, {
404
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
405
+ displayName: string;
406
+ enabled: boolean;
407
+ installedAt: number;
408
+ serverName: string;
409
+ version: string;
410
+ catalogEntryId: string;
411
+ origin: "NODE" | "WORKSPACE";
412
+ }>, "many">;
413
+ }, "strict", z.ZodTypeAny, {
414
+ targetKind: "NODE" | "WORKSPACE";
415
+ installations: {
416
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
417
+ displayName: string;
418
+ enabled: boolean;
419
+ installedAt: number;
420
+ serverName: string;
421
+ version: string;
422
+ catalogEntryId: string;
423
+ origin: "NODE" | "WORKSPACE";
424
+ }[];
425
+ }, {
426
+ targetKind: "NODE" | "WORKSPACE";
427
+ installations: {
428
+ status: "CURRENT" | "UPDATE_AVAILABLE" | "INVALID" | "UNAVAILABLE";
429
+ displayName: string;
430
+ enabled: boolean;
431
+ installedAt: number;
432
+ serverName: string;
433
+ version: string;
434
+ catalogEntryId: string;
435
+ origin: "NODE" | "WORKSPACE";
436
+ }[];
437
+ }>;
438
+ export type McpTargetInspection = z.infer<typeof mcpTargetInspectionSchema>;
package/dist/mcp.js ADDED
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ import { skillScopeSchema } from './skill.js';
3
+ const httpsUrlSchema = z
4
+ .string()
5
+ .trim()
6
+ .min(1)
7
+ .max(2048)
8
+ .refine((value) => {
9
+ try {
10
+ const url = new URL(value);
11
+ return url.protocol === 'https:' && url.username === '' && url.password === '';
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }, 'URL must use HTTPS without userinfo');
17
+ const mcpNameSchema = z
18
+ .string()
19
+ .trim()
20
+ .min(1)
21
+ .max(255)
22
+ .regex(/^[A-Za-z0-9._/-]+$/u);
23
+ const environmentNameSchema = z.string().regex(/^[A-Z_][A-Z0-9_]*$/u);
24
+ const secretReferenceSchema = z.object({ secretName: environmentNameSchema }).strict();
25
+ const referenceMapSchema = z.record(environmentNameSchema, secretReferenceSchema).default({});
26
+ const headerReferenceMapSchema = z
27
+ .record(z
28
+ .string()
29
+ .trim()
30
+ .min(1)
31
+ .max(128)
32
+ .regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u), secretReferenceSchema)
33
+ .default({});
34
+ export const mcpSourceInputSchema = z
35
+ .object({
36
+ scope: skillScopeSchema,
37
+ organizationId: z.number().int().positive().optional(),
38
+ name: z.string().trim().min(1).max(128),
39
+ locator: httpsUrlSchema,
40
+ enabled: z.boolean().optional()
41
+ })
42
+ .strict()
43
+ .superRefine((source, context) => {
44
+ if ((source.scope === 'ORGANIZATION') !== (source.organizationId !== undefined))
45
+ context.addIssue({ code: 'custom', message: 'organizationId must match scope' });
46
+ });
47
+ export const mcpRuntimeDescriptorSchema = z.discriminatedUnion('transport', [
48
+ z
49
+ .object({
50
+ transport: z.literal('STDIO'),
51
+ command: z
52
+ .string()
53
+ .trim()
54
+ .min(1)
55
+ .max(512)
56
+ .regex(/^[^\r\n\0]+$/u),
57
+ args: z
58
+ .array(z
59
+ .string()
60
+ .max(2048)
61
+ .regex(/^[^\0]*$/u))
62
+ .max(64)
63
+ .default([]),
64
+ environment: referenceMapSchema.optional()
65
+ })
66
+ .strict(),
67
+ z
68
+ .object({
69
+ transport: z.literal('HTTP'),
70
+ url: httpsUrlSchema,
71
+ headers: headerReferenceMapSchema.optional()
72
+ })
73
+ .strict()
74
+ ]);
75
+ export const mcpCatalogEntrySchema = z
76
+ .object({
77
+ id: z.string().min(1).max(128),
78
+ sourceId: z.string().min(1).max(128),
79
+ scope: skillScopeSchema,
80
+ ownerOrganizationId: z.number().int().positive().optional(),
81
+ ownerUserId: z.number().int().positive().optional(),
82
+ serverName: mcpNameSchema,
83
+ displayName: z.string().trim().min(1).max(128),
84
+ description: z.string().max(4096),
85
+ version: z
86
+ .string()
87
+ .trim()
88
+ .min(1)
89
+ .max(255)
90
+ .refine((value) => value !== 'latest'),
91
+ featured: z.boolean(),
92
+ tags: z.array(z.string().trim().min(1).max(32)).max(10),
93
+ runtime: mcpRuntimeDescriptorSchema,
94
+ createdAt: z.number().int().nonnegative(),
95
+ updatedAt: z.number().int().nonnegative()
96
+ })
97
+ .strict()
98
+ .superRefine((entry, context) => {
99
+ if ((entry.scope === 'ORGANIZATION') !== (entry.ownerOrganizationId !== undefined))
100
+ context.addIssue({ code: 'custom', message: 'organization owner must match scope' });
101
+ if ((entry.scope === 'PERSONAL') !== (entry.ownerUserId !== undefined))
102
+ context.addIssue({ code: 'custom', message: 'user owner must match scope' });
103
+ });
104
+ export const mcpInstallationConfigurationSchema = z
105
+ .object({
106
+ arguments: z
107
+ .array(z
108
+ .string()
109
+ .max(2048)
110
+ .regex(/^[^\0]*$/u))
111
+ .max(32)
112
+ .optional(),
113
+ environment: referenceMapSchema.optional(),
114
+ headers: headerReferenceMapSchema.optional()
115
+ })
116
+ .strict();
117
+ export const mcpInstallationInputSchema = z
118
+ .object({
119
+ catalogEntryId: z.string().min(1).max(128),
120
+ enabled: z.boolean().default(true),
121
+ configuration: mcpInstallationConfigurationSchema.default({})
122
+ })
123
+ .strict();
124
+ export const installedMcpSchema = z
125
+ .object({
126
+ catalogEntryId: z.string().min(1).max(128),
127
+ serverName: mcpNameSchema,
128
+ displayName: z.string().trim().min(1).max(128),
129
+ version: z.string().trim().min(1).max(255),
130
+ origin: z.enum(['NODE', 'WORKSPACE']),
131
+ enabled: z.boolean(),
132
+ status: z.enum(['CURRENT', 'UPDATE_AVAILABLE', 'INVALID', 'UNAVAILABLE']),
133
+ installedAt: z.number().int().nonnegative()
134
+ })
135
+ .strict();
136
+ export const mcpTargetInspectionSchema = z
137
+ .object({
138
+ targetKind: z.enum(['NODE', 'WORKSPACE']),
139
+ installations: z.array(installedMcpSchema).max(500)
140
+ })
141
+ .strict();