@alpic-ai/api 0.0.0-staging.e70ea7d → 0.0.0-staging.e7665b9
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.d.mts +656 -41
- package/dist/index.mjs +410 -19
- package/package.json +11 -9
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { oc } from "@orpc/contract";
|
|
2
|
+
import ms from "ms";
|
|
2
3
|
import { z } from "zod";
|
|
3
|
-
|
|
4
4
|
//#region src/schemas.ts
|
|
5
5
|
const RESERVED_KEYS = [
|
|
6
6
|
"_HANDLER",
|
|
@@ -13,7 +13,11 @@ const RESERVED_KEYS = [
|
|
|
13
13
|
"AWS_LAMBDA_FUNCTION_VERSION",
|
|
14
14
|
"AWS_LAMBDA_INITIALIZATION_TYPE",
|
|
15
15
|
"AWS_LAMBDA_LOG_GROUP_NAME",
|
|
16
|
+
"AWS_LAMBDA_LOG_STREAM_NAME",
|
|
16
17
|
"AWS_ACCESS_KEY",
|
|
18
|
+
"AWS_ACCESS_KEY_ID",
|
|
19
|
+
"AWS_SECRET_ACCESS_KEY",
|
|
20
|
+
"AWS_SESSION_TOKEN",
|
|
17
21
|
"AWS_LAMBDA_RUNTIME_API",
|
|
18
22
|
"LAMBDA_TASK_ROOT",
|
|
19
23
|
"LAMBDA_RUNTIME_DIR",
|
|
@@ -30,7 +34,9 @@ const RESERVED_KEYS = [
|
|
|
30
34
|
"BUILD_ARG_BUILD_COMMAND",
|
|
31
35
|
"BUILD_ARG_BUILD_OUTPUT_DIR",
|
|
32
36
|
"BUILD_ARG_START_COMMAND",
|
|
33
|
-
"ALPIC_HOST"
|
|
37
|
+
"ALPIC_HOST",
|
|
38
|
+
"ALPIC_CUSTOM_DOMAINS",
|
|
39
|
+
"ALPIC_PROMPT_META_KEY"
|
|
34
40
|
];
|
|
35
41
|
const environmentVariableSchema = z.object({
|
|
36
42
|
key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
|
|
@@ -38,6 +44,10 @@ const environmentVariableSchema = z.object({
|
|
|
38
44
|
isSecret: z.boolean().default(false)
|
|
39
45
|
});
|
|
40
46
|
const environmentVariablesSchema = z.array(environmentVariableSchema);
|
|
47
|
+
const updateEnvironmentVariableSchema = environmentVariableSchema.partial({
|
|
48
|
+
value: true,
|
|
49
|
+
isSecret: true
|
|
50
|
+
});
|
|
41
51
|
const buildSettingsSchema = z.object({
|
|
42
52
|
installCommand: z.string().optional(),
|
|
43
53
|
buildCommand: z.string().optional(),
|
|
@@ -55,7 +65,104 @@ const transportSchema = z.enum([
|
|
|
55
65
|
"sse",
|
|
56
66
|
"streamablehttp"
|
|
57
67
|
]);
|
|
58
|
-
|
|
68
|
+
const auditStatusSchema = z.enum([
|
|
69
|
+
"pending",
|
|
70
|
+
"partial",
|
|
71
|
+
"completed",
|
|
72
|
+
"failed"
|
|
73
|
+
]);
|
|
74
|
+
const platformSchema = z.enum(["chatgpt", "claudeai"]);
|
|
75
|
+
const checkSeveritySchema = z.enum([
|
|
76
|
+
"error",
|
|
77
|
+
"warning",
|
|
78
|
+
"info"
|
|
79
|
+
]);
|
|
80
|
+
const checkCategorySchema = z.enum([
|
|
81
|
+
"connectivity",
|
|
82
|
+
"tool-metadata",
|
|
83
|
+
"resource-metadata",
|
|
84
|
+
"performance",
|
|
85
|
+
"e2e"
|
|
86
|
+
]);
|
|
87
|
+
const checkScopeSchema = z.enum(["server", "view"]);
|
|
88
|
+
const checkDetailSchema = z.object({
|
|
89
|
+
label: z.string(),
|
|
90
|
+
value: z.string().optional()
|
|
91
|
+
});
|
|
92
|
+
const checkResultSchema = z.object({
|
|
93
|
+
checkId: z.string(),
|
|
94
|
+
checkName: z.string(),
|
|
95
|
+
description: z.string(),
|
|
96
|
+
status: z.enum([
|
|
97
|
+
"pass",
|
|
98
|
+
"fail",
|
|
99
|
+
"skip",
|
|
100
|
+
"pending"
|
|
101
|
+
]),
|
|
102
|
+
message: z.string(),
|
|
103
|
+
skipReason: z.string().optional(),
|
|
104
|
+
severity: checkSeveritySchema,
|
|
105
|
+
category: checkCategorySchema,
|
|
106
|
+
scope: checkScopeSchema,
|
|
107
|
+
platforms: z.array(platformSchema).readonly().optional(),
|
|
108
|
+
durationMs: z.number(),
|
|
109
|
+
details: z.array(checkDetailSchema).optional(),
|
|
110
|
+
hint: z.object({ text: z.string() }).optional()
|
|
111
|
+
});
|
|
112
|
+
const auditReportSchema = z.object({
|
|
113
|
+
schemaVersion: z.string(),
|
|
114
|
+
auditId: z.string(),
|
|
115
|
+
targetUrl: z.string(),
|
|
116
|
+
startedAt: z.string(),
|
|
117
|
+
completedAt: z.string(),
|
|
118
|
+
durationMs: z.number(),
|
|
119
|
+
results: z.array(checkResultSchema),
|
|
120
|
+
requiresAuth: z.boolean(),
|
|
121
|
+
hasViewSupport: z.boolean(),
|
|
122
|
+
viewPlatforms: z.array(platformSchema).readonly().optional(),
|
|
123
|
+
isReadyForPlatform: z.record(platformSchema, z.boolean()),
|
|
124
|
+
widgetScreenshotKeys: z.object({
|
|
125
|
+
chatgpt: z.string().optional(),
|
|
126
|
+
claudeai: z.string().optional()
|
|
127
|
+
}).optional(),
|
|
128
|
+
widgetScreenshots: z.object({
|
|
129
|
+
chatgpt: z.object({ url: z.string() }).optional(),
|
|
130
|
+
claudeai: z.object({ url: z.string() }).optional()
|
|
131
|
+
}).optional()
|
|
132
|
+
});
|
|
133
|
+
const playgroundHeaderSchema = z.object({
|
|
134
|
+
name: z.string().min(1).max(100),
|
|
135
|
+
description: z.string().max(200),
|
|
136
|
+
isRequired: z.boolean().default(false),
|
|
137
|
+
isSecret: z.boolean().default(false)
|
|
138
|
+
});
|
|
139
|
+
const playgroundExamplePromptSchema = z.object({
|
|
140
|
+
title: z.string().min(1).max(100),
|
|
141
|
+
prompt: z.string().min(1).max(500)
|
|
142
|
+
});
|
|
143
|
+
const serverFieldsSchema = z.object({
|
|
144
|
+
$schema: z.string(),
|
|
145
|
+
name: z.string(),
|
|
146
|
+
description: z.string(),
|
|
147
|
+
version: z.string().optional(),
|
|
148
|
+
title: z.string().optional(),
|
|
149
|
+
websiteUrl: z.url().optional(),
|
|
150
|
+
icons: z.array(z.object({
|
|
151
|
+
src: z.url(),
|
|
152
|
+
mimeType: z.string().optional(),
|
|
153
|
+
sizes: z.array(z.string()).optional()
|
|
154
|
+
})).optional(),
|
|
155
|
+
remotes: z.array(z.object({
|
|
156
|
+
type: z.string(),
|
|
157
|
+
url: z.url().optional(),
|
|
158
|
+
headers: z.array(z.object({
|
|
159
|
+
name: z.string(),
|
|
160
|
+
description: z.string(),
|
|
161
|
+
isRequired: z.boolean().optional(),
|
|
162
|
+
isSecret: z.boolean().optional()
|
|
163
|
+
})).optional()
|
|
164
|
+
})).optional()
|
|
165
|
+
});
|
|
59
166
|
//#endregion
|
|
60
167
|
//#region src/api.contract.ts
|
|
61
168
|
const deploymentStatusSchema = z.enum([
|
|
@@ -80,8 +187,16 @@ const deploymentSchema = z.object({
|
|
|
80
187
|
authorUsername: z.string().nullable(),
|
|
81
188
|
authorAvatarUrl: z.string().nullable(),
|
|
82
189
|
startedAt: z.coerce.date().nullable(),
|
|
83
|
-
completedAt: z.coerce.date().nullable()
|
|
190
|
+
completedAt: z.coerce.date().nullable(),
|
|
191
|
+
environmentId: z.string(),
|
|
192
|
+
environmentName: z.string(),
|
|
193
|
+
isCurrent: z.boolean(),
|
|
194
|
+
deploymentPageUrl: z.url().nullable()
|
|
84
195
|
});
|
|
196
|
+
const isValidLogTimeInput = (value) => {
|
|
197
|
+
if (ms(value) !== void 0) return true;
|
|
198
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
199
|
+
};
|
|
85
200
|
const createEnvironmentContractV1 = oc.route({
|
|
86
201
|
path: "/v1/environments",
|
|
87
202
|
method: "POST",
|
|
@@ -121,10 +236,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
236
|
createdAt: z.coerce.date(),
|
|
122
237
|
projectId: z.string()
|
|
123
238
|
}));
|
|
239
|
+
const domainSchema = z.object({
|
|
240
|
+
domain: z.string(),
|
|
241
|
+
status: z.enum([
|
|
242
|
+
"ongoing",
|
|
243
|
+
"deployed",
|
|
244
|
+
"failed"
|
|
245
|
+
]),
|
|
246
|
+
createdAt: z.coerce.date()
|
|
247
|
+
});
|
|
124
248
|
const productionEnvironmentSchema = z.object({
|
|
125
249
|
id: z.string(),
|
|
126
250
|
name: z.string(),
|
|
127
251
|
mcpServerUrl: z.string(),
|
|
252
|
+
domains: z.array(domainSchema),
|
|
128
253
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
254
|
});
|
|
130
255
|
const environmentSchema = z.object({
|
|
@@ -167,7 +292,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
292
|
description: "List all projects for a team",
|
|
168
293
|
tags: ["projects"],
|
|
169
294
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
295
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
296
|
const createProjectContractV1 = oc.route({
|
|
172
297
|
path: "/v1/projects",
|
|
173
298
|
method: "POST",
|
|
@@ -180,7 +305,7 @@ const createProjectContractV1 = oc.route({
|
|
|
180
305
|
BAD_REQUEST: {}
|
|
181
306
|
}).input(z.object({
|
|
182
307
|
teamId: z.string().optional(),
|
|
183
|
-
name: z.string().min(1).max(100),
|
|
308
|
+
name: z.string().trim().min(1).max(100),
|
|
184
309
|
sourceRepository: z.string().optional(),
|
|
185
310
|
branchName: z.string().min(1).optional(),
|
|
186
311
|
runtime: runtimeSchema,
|
|
@@ -210,8 +335,61 @@ const createProjectContractV1 = oc.route({
|
|
|
210
335
|
startCommand: z.string().nullable(),
|
|
211
336
|
createdAt: z.coerce.date()
|
|
212
337
|
}));
|
|
338
|
+
const environmentVariableOutputSchema = z.object({
|
|
339
|
+
id: z.string(),
|
|
340
|
+
key: z.string(),
|
|
341
|
+
value: z.string(),
|
|
342
|
+
isSecret: z.boolean(),
|
|
343
|
+
createdAt: z.coerce.date()
|
|
344
|
+
});
|
|
345
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
346
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
347
|
+
method: "GET",
|
|
348
|
+
summary: "List environment variables",
|
|
349
|
+
description: "List all environment variables for an environment",
|
|
350
|
+
tags: ["environments"],
|
|
351
|
+
successDescription: "The list of environment variables"
|
|
352
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
353
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
354
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
355
|
+
method: "POST",
|
|
356
|
+
summary: "Add environment variables",
|
|
357
|
+
description: "Add one or more environment variables to an environment",
|
|
358
|
+
tags: ["environments"],
|
|
359
|
+
successDescription: "The environment variables have been added successfully"
|
|
360
|
+
}).errors({
|
|
361
|
+
NOT_FOUND: {},
|
|
362
|
+
BAD_REQUEST: {}
|
|
363
|
+
}).input(z.object({
|
|
364
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
365
|
+
environmentVariables: environmentVariablesSchema
|
|
366
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
367
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
368
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
369
|
+
method: "PATCH",
|
|
370
|
+
summary: "Update an environment variable",
|
|
371
|
+
description: "Update an environment variable by ID",
|
|
372
|
+
tags: ["environments"],
|
|
373
|
+
successDescription: "The environment variable has been updated successfully"
|
|
374
|
+
}).errors({
|
|
375
|
+
NOT_FOUND: {},
|
|
376
|
+
BAD_REQUEST: {}
|
|
377
|
+
}).input(z.object({
|
|
378
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
379
|
+
key: environmentVariableSchema.shape.key,
|
|
380
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
381
|
+
isSecret: environmentVariableSchema.shape.isSecret.optional()
|
|
382
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
383
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
384
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
385
|
+
method: "DELETE",
|
|
386
|
+
summary: "Delete an environment variable",
|
|
387
|
+
description: "Delete an environment variable by ID",
|
|
388
|
+
tags: ["environments"],
|
|
389
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
390
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
213
391
|
const deleteProjectContractV1 = oc.route({
|
|
214
|
-
path: "/v1/projects
|
|
392
|
+
path: "/v1/projects/{projectId}",
|
|
215
393
|
method: "DELETE",
|
|
216
394
|
summary: "Delete a project",
|
|
217
395
|
description: "Delete a project and all its environments",
|
|
@@ -230,6 +408,7 @@ const updateProjectContractV1 = oc.route({
|
|
|
230
408
|
BAD_REQUEST: {}
|
|
231
409
|
}).input(z.object({
|
|
232
410
|
projectId: z.string().describe("The ID of the project"),
|
|
411
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
233
412
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
234
413
|
})).output(projectOutputSchema);
|
|
235
414
|
const deployEnvironmentContractV1 = oc.route({
|
|
@@ -254,21 +433,22 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
254
433
|
tags: ["deployments"],
|
|
255
434
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
256
435
|
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
257
|
-
uploadUrl: z.
|
|
436
|
+
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
258
437
|
token: z.string().describe("Token to identify the source archive"),
|
|
259
438
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
260
439
|
}));
|
|
261
|
-
const
|
|
440
|
+
const listDeploymentsContractV1 = oc.route({
|
|
262
441
|
path: "/v1/projects/{projectId}/deployments",
|
|
263
442
|
method: "GET",
|
|
264
443
|
summary: "List project deployments",
|
|
265
444
|
description: "List all deployments for a project",
|
|
266
445
|
tags: ["deployments"],
|
|
267
446
|
successDescription: "The list of deployments"
|
|
268
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
447
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
448
|
+
projectId: z.string().describe("The ID of the project"),
|
|
449
|
+
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
450
|
+
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
451
|
+
})).output(z.array(deploymentSchema));
|
|
272
452
|
const getDeploymentContractV1 = oc.route({
|
|
273
453
|
path: "/v1/deployments/{deploymentId}",
|
|
274
454
|
method: "GET",
|
|
@@ -277,6 +457,82 @@ const getDeploymentContractV1 = oc.route({
|
|
|
277
457
|
tags: ["deployments"],
|
|
278
458
|
successDescription: "The deployment details"
|
|
279
459
|
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
|
|
460
|
+
const getLogsContractV1 = oc.route({
|
|
461
|
+
path: "/v1/environments/{environmentId}/logs",
|
|
462
|
+
method: "GET",
|
|
463
|
+
summary: "Get logs",
|
|
464
|
+
description: "Get logs for an environment",
|
|
465
|
+
tags: ["environments"],
|
|
466
|
+
successDescription: "The logs"
|
|
467
|
+
}).errors({
|
|
468
|
+
NOT_FOUND: {},
|
|
469
|
+
BAD_REQUEST: {}
|
|
470
|
+
}).input(z.object({
|
|
471
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
472
|
+
since: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
473
|
+
until: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("End time — ISO 8601 or relative"),
|
|
474
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
475
|
+
level: z.array(z.enum([
|
|
476
|
+
"INFO",
|
|
477
|
+
"ERROR",
|
|
478
|
+
"WARNING",
|
|
479
|
+
"DEBUG"
|
|
480
|
+
])).optional().describe("Filter by log level"),
|
|
481
|
+
search: z.string().optional().describe("Filter pattern to search for in log content"),
|
|
482
|
+
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
483
|
+
})).output(z.object({
|
|
484
|
+
logs: z.array(z.object({
|
|
485
|
+
timestamp: z.coerce.date(),
|
|
486
|
+
type: z.enum([
|
|
487
|
+
"START",
|
|
488
|
+
"END",
|
|
489
|
+
"INFO",
|
|
490
|
+
"ERROR",
|
|
491
|
+
"WARNING",
|
|
492
|
+
"DEBUG"
|
|
493
|
+
]),
|
|
494
|
+
requestId: z.string(),
|
|
495
|
+
content: z.string().optional(),
|
|
496
|
+
method: z.string().optional(),
|
|
497
|
+
durationInMs: z.number().optional()
|
|
498
|
+
})),
|
|
499
|
+
nextToken: z.string().nullable()
|
|
500
|
+
}));
|
|
501
|
+
const getLatestLogsContractV1 = oc.route({
|
|
502
|
+
path: "/v1/environments/{environmentId}/latest-logs",
|
|
503
|
+
method: "GET",
|
|
504
|
+
summary: "Get latest logs",
|
|
505
|
+
description: "Get the N most recent logs for an environment",
|
|
506
|
+
tags: ["environments"],
|
|
507
|
+
successDescription: "The latest logs"
|
|
508
|
+
}).errors({
|
|
509
|
+
NOT_FOUND: {},
|
|
510
|
+
BAD_REQUEST: {}
|
|
511
|
+
}).input(z.object({
|
|
512
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
513
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
|
|
514
|
+
level: z.array(z.enum([
|
|
515
|
+
"INFO",
|
|
516
|
+
"ERROR",
|
|
517
|
+
"WARNING",
|
|
518
|
+
"DEBUG"
|
|
519
|
+
])).optional().describe("Filter by log level"),
|
|
520
|
+
search: z.string().optional().describe("Filter pattern to search for in log content")
|
|
521
|
+
})).output(z.object({ logs: z.array(z.object({
|
|
522
|
+
timestamp: z.coerce.date(),
|
|
523
|
+
type: z.enum([
|
|
524
|
+
"START",
|
|
525
|
+
"END",
|
|
526
|
+
"INFO",
|
|
527
|
+
"ERROR",
|
|
528
|
+
"WARNING",
|
|
529
|
+
"DEBUG"
|
|
530
|
+
]),
|
|
531
|
+
requestId: z.string(),
|
|
532
|
+
content: z.string().optional(),
|
|
533
|
+
method: z.string().optional(),
|
|
534
|
+
durationInMs: z.number().optional()
|
|
535
|
+
})) }));
|
|
280
536
|
const getDeploymentLogsContractV1 = oc.route({
|
|
281
537
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
282
538
|
method: "GET",
|
|
@@ -340,14 +596,129 @@ const listTeamsContractV1 = oc.route({
|
|
|
340
596
|
id: z.string(),
|
|
341
597
|
name: z.string(),
|
|
342
598
|
createdAt: z.coerce.date(),
|
|
343
|
-
hasStripeAccount: z.boolean()
|
|
344
|
-
hasActiveSubscription: z.boolean()
|
|
599
|
+
hasStripeAccount: z.boolean()
|
|
345
600
|
})));
|
|
601
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
602
|
+
path: "/v1/tunnels/ticket",
|
|
603
|
+
method: "GET",
|
|
604
|
+
summary: "Get a tunnel ticket",
|
|
605
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
606
|
+
tags: ["tunnels"],
|
|
607
|
+
successDescription: "The tunnel ticket"
|
|
608
|
+
}).output(z.object({
|
|
609
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
610
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
611
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
612
|
+
}));
|
|
613
|
+
const publishServerContractV1 = oc.route({
|
|
614
|
+
path: "/v1/distribution/publish",
|
|
615
|
+
method: "POST",
|
|
616
|
+
summary: "Publish a server to the MCP registry",
|
|
617
|
+
tags: ["distribution"],
|
|
618
|
+
successDescription: "The server has been published successfully"
|
|
619
|
+
}).errors({
|
|
620
|
+
NOT_FOUND: {},
|
|
621
|
+
BAD_REQUEST: {}
|
|
622
|
+
}).input(z.object({
|
|
623
|
+
projectId: z.string(),
|
|
624
|
+
domain: z.string(),
|
|
625
|
+
title: z.string().min(1).max(100),
|
|
626
|
+
description: z.string().min(1).max(100),
|
|
627
|
+
websiteUrl: z.url().max(255).optional(),
|
|
628
|
+
iconSrc: z.url().max(255).optional(),
|
|
629
|
+
dryRun: z.boolean().optional()
|
|
630
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
631
|
+
const getServerInfoContractV1 = oc.route({
|
|
632
|
+
path: "/v1/distribution/get",
|
|
633
|
+
method: "GET",
|
|
634
|
+
summary: "Get server info",
|
|
635
|
+
description: "Get info about a server",
|
|
636
|
+
tags: ["distribution"],
|
|
637
|
+
successDescription: "The server info"
|
|
638
|
+
}).errors({
|
|
639
|
+
NOT_FOUND: {},
|
|
640
|
+
BAD_REQUEST: {}
|
|
641
|
+
}).input(z.object({
|
|
642
|
+
projectId: z.string(),
|
|
643
|
+
domain: z.string()
|
|
644
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
645
|
+
const playgroundServerMetadataOutputSchema = z.object({
|
|
646
|
+
name: z.string(),
|
|
647
|
+
description: z.string(),
|
|
648
|
+
headers: z.array(z.object({
|
|
649
|
+
name: z.string(),
|
|
650
|
+
description: z.string(),
|
|
651
|
+
isRequired: z.boolean(),
|
|
652
|
+
isSecret: z.boolean()
|
|
653
|
+
})),
|
|
654
|
+
examplePrompts: z.array(playgroundExamplePromptSchema)
|
|
655
|
+
});
|
|
656
|
+
const playgroundOutputSchema = z.object({
|
|
657
|
+
isPlaygroundEnabled: z.boolean(),
|
|
658
|
+
serverMetadata: playgroundServerMetadataOutputSchema.nullable()
|
|
659
|
+
});
|
|
660
|
+
const getPlaygroundContractV1 = oc.route({
|
|
661
|
+
path: "/v1/environments/{environmentId}/playground",
|
|
662
|
+
method: "GET",
|
|
663
|
+
summary: "Get playground configuration",
|
|
664
|
+
description: "Get the playground configuration for an environment",
|
|
665
|
+
tags: ["environments"],
|
|
666
|
+
successDescription: "The playground configuration"
|
|
667
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
|
|
668
|
+
const upsertPlaygroundContractV1 = oc.route({
|
|
669
|
+
path: "/v1/environments/{environmentId}/playground",
|
|
670
|
+
method: "PUT",
|
|
671
|
+
summary: "Update playground configuration",
|
|
672
|
+
description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
|
|
673
|
+
tags: ["environments"],
|
|
674
|
+
successDescription: "The updated playground configuration"
|
|
675
|
+
}).errors({
|
|
676
|
+
NOT_FOUND: {},
|
|
677
|
+
BAD_REQUEST: {}
|
|
678
|
+
}).input(z.object({
|
|
679
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
680
|
+
isPlaygroundEnabled: z.boolean().optional(),
|
|
681
|
+
name: z.string().min(1).max(100).optional(),
|
|
682
|
+
description: z.string().min(1).max(500).optional(),
|
|
683
|
+
headers: z.array(playgroundHeaderSchema).optional(),
|
|
684
|
+
examplePrompts: z.array(playgroundExamplePromptSchema).max(3).optional()
|
|
685
|
+
})).output(playgroundOutputSchema);
|
|
686
|
+
const createBeaconContractV1 = oc.route({
|
|
687
|
+
path: "/v1/beacon/audits",
|
|
688
|
+
method: "POST",
|
|
689
|
+
summary: "Create a beacon audit",
|
|
690
|
+
description: "Audit an MCP server for spec compliance and AI client compatibility",
|
|
691
|
+
tags: ["beacon"],
|
|
692
|
+
successDescription: "The audit has been created"
|
|
693
|
+
}).errors({
|
|
694
|
+
NOT_FOUND: {},
|
|
695
|
+
BAD_REQUEST: {}
|
|
696
|
+
}).input(z.object({
|
|
697
|
+
targetUrl: z.string().url().describe("The HTTPS URL of the MCP server to audit"),
|
|
698
|
+
teamId: z.string().optional().describe("The team ID to associate the audit with"),
|
|
699
|
+
projectId: z.string().optional().describe("The project ID to associate the audit with"),
|
|
700
|
+
excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
|
|
701
|
+
})).output(z.object({ id: z.string() }));
|
|
702
|
+
const getBeaconContractV1 = oc.route({
|
|
703
|
+
path: "/v1/beacon/audits/{auditId}",
|
|
704
|
+
method: "GET",
|
|
705
|
+
summary: "Get a beacon audit",
|
|
706
|
+
description: "Get a beacon audit by ID, including the report if completed",
|
|
707
|
+
tags: ["beacon"],
|
|
708
|
+
successDescription: "The audit details"
|
|
709
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ auditId: z.string().describe("The ID of the audit") })).output(z.object({
|
|
710
|
+
id: z.string(),
|
|
711
|
+
targetUrl: z.string(),
|
|
712
|
+
status: auditStatusSchema,
|
|
713
|
+
durationMs: z.number().nullable(),
|
|
714
|
+
createdAt: z.coerce.date(),
|
|
715
|
+
report: auditReportSchema.nullable()
|
|
716
|
+
}));
|
|
346
717
|
const contract = {
|
|
347
718
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
348
719
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
349
720
|
deployments: {
|
|
350
|
-
list: { v1:
|
|
721
|
+
list: { v1: listDeploymentsContractV1 },
|
|
351
722
|
get: { v1: getDeploymentContractV1 },
|
|
352
723
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
353
724
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -355,7 +726,15 @@ const contract = {
|
|
|
355
726
|
environments: {
|
|
356
727
|
create: { v1: createEnvironmentContractV1 },
|
|
357
728
|
get: { v1: getEnvironmentContractV1 },
|
|
358
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
729
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
730
|
+
getLogs: { v1: getLogsContractV1 },
|
|
731
|
+
getLatestLogs: { v1: getLatestLogsContractV1 }
|
|
732
|
+
},
|
|
733
|
+
environmentVariables: {
|
|
734
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
735
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
736
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
737
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
359
738
|
},
|
|
360
739
|
projects: {
|
|
361
740
|
update: { v1: updateProjectContractV1 },
|
|
@@ -363,8 +742,20 @@ const contract = {
|
|
|
363
742
|
list: { v1: listProjectsContractV1 },
|
|
364
743
|
create: { v1: createProjectContractV1 },
|
|
365
744
|
delete: { v1: deleteProjectContractV1 }
|
|
745
|
+
},
|
|
746
|
+
playground: {
|
|
747
|
+
get: { v1: getPlaygroundContractV1 },
|
|
748
|
+
upsert: { v1: upsertPlaygroundContractV1 }
|
|
749
|
+
},
|
|
750
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } },
|
|
751
|
+
distribution: {
|
|
752
|
+
publish: { v1: publishServerContractV1 },
|
|
753
|
+
get: { v1: getServerInfoContractV1 }
|
|
754
|
+
},
|
|
755
|
+
beacon: {
|
|
756
|
+
create: { v1: createBeaconContractV1 },
|
|
757
|
+
get: { v1: getBeaconContractV1 }
|
|
366
758
|
}
|
|
367
759
|
};
|
|
368
|
-
|
|
369
760
|
//#endregion
|
|
370
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
761
|
+
export { auditReportSchema, auditStatusSchema, buildSettingsSchema, checkCategorySchema, checkDetailSchema, checkResultSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, platformSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpic-ai/api",
|
|
3
|
-
"version": "0.0.0-staging.
|
|
3
|
+
"version": "0.0.0-staging.e7665b9",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -17,23 +17,25 @@
|
|
|
17
17
|
"author": "Alpic",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@orpc/contract": "^1.13.
|
|
20
|
+
"@orpc/contract": "^1.13.14",
|
|
21
|
+
"ms": "^2.1.3",
|
|
21
22
|
"zod": "^4.3.6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
25
|
-
"
|
|
26
|
+
"@types/ms": "^2.1.0",
|
|
26
27
|
"shx": "^0.4.0",
|
|
27
|
-
"tsdown": "^0.
|
|
28
|
-
"typescript": "^
|
|
29
|
-
"vitest": "^4.
|
|
28
|
+
"tsdown": "^0.21.9",
|
|
29
|
+
"typescript": "^6.0.3",
|
|
30
|
+
"vitest": "^4.1.4"
|
|
30
31
|
},
|
|
31
32
|
"scripts": {
|
|
32
33
|
"build": "shx rm -rf dist && tsdown",
|
|
33
|
-
"format": "biome check --write --error-on-warnings",
|
|
34
|
+
"format": "biome check --write --error-on-warnings .",
|
|
34
35
|
"test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
|
|
35
36
|
"test:unit": "vitest run",
|
|
36
|
-
"test:format": "
|
|
37
|
-
"test:type": "tsc --noEmit"
|
|
37
|
+
"test:format": "biome check --error-on-warnings .",
|
|
38
|
+
"test:type": "tsc --noEmit",
|
|
39
|
+
"publish:npm": "pnpm publish --tag \"${NPM_TAG}\" --access public --no-git-checks"
|
|
38
40
|
}
|
|
39
41
|
}
|