@alpic-ai/api 0.0.0-staging.79eb8bf → 0.0.0-staging.7cfd495
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 +620 -39
- package/dist/index.mjs +384 -27
- 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,8 @@ 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"
|
|
34
39
|
];
|
|
35
40
|
const environmentVariableSchema = z.object({
|
|
36
41
|
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"),
|
|
@@ -55,7 +60,102 @@ const transportSchema = z.enum([
|
|
|
55
60
|
"sse",
|
|
56
61
|
"streamablehttp"
|
|
57
62
|
]);
|
|
58
|
-
|
|
63
|
+
const auditStatusSchema = z.enum([
|
|
64
|
+
"pending",
|
|
65
|
+
"partial",
|
|
66
|
+
"completed",
|
|
67
|
+
"failed"
|
|
68
|
+
]);
|
|
69
|
+
const platformSchema = z.enum(["chatgpt", "claudeai"]);
|
|
70
|
+
const checkSeveritySchema = z.enum([
|
|
71
|
+
"error",
|
|
72
|
+
"warning",
|
|
73
|
+
"info"
|
|
74
|
+
]);
|
|
75
|
+
const checkCategorySchema = z.enum([
|
|
76
|
+
"connectivity",
|
|
77
|
+
"tool-metadata",
|
|
78
|
+
"resource-metadata",
|
|
79
|
+
"performance",
|
|
80
|
+
"e2e"
|
|
81
|
+
]);
|
|
82
|
+
const checkScopeSchema = z.enum(["server", "view"]);
|
|
83
|
+
const checkDetailSchema = z.object({
|
|
84
|
+
label: z.string(),
|
|
85
|
+
value: z.string().optional()
|
|
86
|
+
});
|
|
87
|
+
const checkResultSchema = z.object({
|
|
88
|
+
checkId: z.string(),
|
|
89
|
+
status: z.enum([
|
|
90
|
+
"pass",
|
|
91
|
+
"fail",
|
|
92
|
+
"skip",
|
|
93
|
+
"pending"
|
|
94
|
+
]),
|
|
95
|
+
message: z.string(),
|
|
96
|
+
skipReason: z.string().optional(),
|
|
97
|
+
severity: checkSeveritySchema,
|
|
98
|
+
category: checkCategorySchema,
|
|
99
|
+
scope: checkScopeSchema,
|
|
100
|
+
platforms: z.array(platformSchema).readonly().optional(),
|
|
101
|
+
durationMs: z.number(),
|
|
102
|
+
details: z.array(checkDetailSchema).optional(),
|
|
103
|
+
hint: z.object({ text: z.string() }).optional()
|
|
104
|
+
});
|
|
105
|
+
const auditReportSchema = z.object({
|
|
106
|
+
schemaVersion: z.string(),
|
|
107
|
+
auditId: z.string(),
|
|
108
|
+
targetUrl: z.string(),
|
|
109
|
+
startedAt: z.string(),
|
|
110
|
+
completedAt: z.string(),
|
|
111
|
+
durationMs: z.number(),
|
|
112
|
+
results: z.array(checkResultSchema),
|
|
113
|
+
requiresAuth: z.boolean(),
|
|
114
|
+
hasViewSupport: z.boolean(),
|
|
115
|
+
viewPlatforms: z.array(platformSchema).readonly().optional(),
|
|
116
|
+
isReadyForPlatform: z.record(platformSchema, z.boolean()),
|
|
117
|
+
widgetScreenshotKeys: z.object({
|
|
118
|
+
chatgpt: z.string().optional(),
|
|
119
|
+
claudeai: z.string().optional()
|
|
120
|
+
}).optional(),
|
|
121
|
+
widgetScreenshots: z.object({
|
|
122
|
+
chatgpt: z.object({ url: z.string() }).optional(),
|
|
123
|
+
claudeai: z.object({ url: z.string() }).optional()
|
|
124
|
+
}).optional()
|
|
125
|
+
});
|
|
126
|
+
const playgroundHeaderSchema = z.object({
|
|
127
|
+
name: z.string().min(1).max(100),
|
|
128
|
+
description: z.string().max(200),
|
|
129
|
+
isRequired: z.boolean().default(false),
|
|
130
|
+
isSecret: z.boolean().default(false)
|
|
131
|
+
});
|
|
132
|
+
const playgroundExamplePromptSchema = z.object({
|
|
133
|
+
title: z.string().min(1).max(100),
|
|
134
|
+
prompt: z.string().min(1).max(500)
|
|
135
|
+
});
|
|
136
|
+
const serverFieldsSchema = z.object({
|
|
137
|
+
$schema: z.string(),
|
|
138
|
+
name: z.string(),
|
|
139
|
+
description: z.string(),
|
|
140
|
+
version: z.string().optional(),
|
|
141
|
+
title: z.string().optional(),
|
|
142
|
+
websiteUrl: z.url().optional(),
|
|
143
|
+
icons: z.array(z.object({
|
|
144
|
+
src: z.url(),
|
|
145
|
+
mimeType: z.string().optional(),
|
|
146
|
+
sizes: z.array(z.string()).optional()
|
|
147
|
+
})).optional(),
|
|
148
|
+
remotes: z.array(z.object({
|
|
149
|
+
type: z.string(),
|
|
150
|
+
url: z.url().optional(),
|
|
151
|
+
headers: z.array(z.object({
|
|
152
|
+
name: z.string(),
|
|
153
|
+
description: z.string(),
|
|
154
|
+
isRequired: z.boolean().optional(),
|
|
155
|
+
isSecret: z.boolean().optional()
|
|
156
|
+
})).optional()
|
|
157
|
+
})).optional()
|
|
158
|
+
});
|
|
59
159
|
//#endregion
|
|
60
160
|
//#region src/api.contract.ts
|
|
61
161
|
const deploymentStatusSchema = z.enum([
|
|
@@ -80,8 +180,16 @@ const deploymentSchema = z.object({
|
|
|
80
180
|
authorUsername: z.string().nullable(),
|
|
81
181
|
authorAvatarUrl: z.string().nullable(),
|
|
82
182
|
startedAt: z.coerce.date().nullable(),
|
|
83
|
-
completedAt: z.coerce.date().nullable()
|
|
183
|
+
completedAt: z.coerce.date().nullable(),
|
|
184
|
+
environmentId: z.string(),
|
|
185
|
+
environmentName: z.string(),
|
|
186
|
+
isCurrent: z.boolean(),
|
|
187
|
+
deploymentPageUrl: z.url().nullable()
|
|
84
188
|
});
|
|
189
|
+
const isValidLogTimeInput = (value) => {
|
|
190
|
+
if (ms(value) !== void 0) return true;
|
|
191
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
192
|
+
};
|
|
85
193
|
const createEnvironmentContractV1 = oc.route({
|
|
86
194
|
path: "/v1/environments",
|
|
87
195
|
method: "POST",
|
|
@@ -106,7 +214,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
106
214
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
107
215
|
}));
|
|
108
216
|
const getEnvironmentContractV1 = oc.route({
|
|
109
|
-
path: "/v1/environments
|
|
217
|
+
path: "/v1/environments/{environmentId}",
|
|
110
218
|
method: "GET",
|
|
111
219
|
summary: "Get an environment",
|
|
112
220
|
description: "Get an environment by ID",
|
|
@@ -121,10 +229,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
229
|
createdAt: z.coerce.date(),
|
|
122
230
|
projectId: z.string()
|
|
123
231
|
}));
|
|
232
|
+
const domainSchema = z.object({
|
|
233
|
+
domain: z.string(),
|
|
234
|
+
status: z.enum([
|
|
235
|
+
"ongoing",
|
|
236
|
+
"deployed",
|
|
237
|
+
"failed"
|
|
238
|
+
]),
|
|
239
|
+
createdAt: z.coerce.date()
|
|
240
|
+
});
|
|
124
241
|
const productionEnvironmentSchema = z.object({
|
|
125
242
|
id: z.string(),
|
|
126
243
|
name: z.string(),
|
|
127
244
|
mcpServerUrl: z.string(),
|
|
245
|
+
domains: z.array(domainSchema),
|
|
128
246
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
247
|
});
|
|
130
248
|
const environmentSchema = z.object({
|
|
@@ -153,7 +271,7 @@ const projectOutputSchema = z.object({
|
|
|
153
271
|
environments: z.array(environmentSchema)
|
|
154
272
|
});
|
|
155
273
|
const getProjectContractV1 = oc.route({
|
|
156
|
-
path: "/v1/projects
|
|
274
|
+
path: "/v1/projects/{projectId}",
|
|
157
275
|
method: "GET",
|
|
158
276
|
summary: "Get a project",
|
|
159
277
|
description: "Get a project by ID",
|
|
@@ -167,7 +285,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
285
|
description: "List all projects for a team",
|
|
168
286
|
tags: ["projects"],
|
|
169
287
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
288
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
289
|
const createProjectContractV1 = oc.route({
|
|
172
290
|
path: "/v1/projects",
|
|
173
291
|
method: "POST",
|
|
@@ -180,7 +298,7 @@ const createProjectContractV1 = oc.route({
|
|
|
180
298
|
BAD_REQUEST: {}
|
|
181
299
|
}).input(z.object({
|
|
182
300
|
teamId: z.string().optional(),
|
|
183
|
-
name: z.string().min(1).max(100),
|
|
301
|
+
name: z.string().trim().min(1).max(100),
|
|
184
302
|
sourceRepository: z.string().optional(),
|
|
185
303
|
branchName: z.string().min(1).optional(),
|
|
186
304
|
runtime: runtimeSchema,
|
|
@@ -210,8 +328,69 @@ const createProjectContractV1 = oc.route({
|
|
|
210
328
|
startCommand: z.string().nullable(),
|
|
211
329
|
createdAt: z.coerce.date()
|
|
212
330
|
}));
|
|
331
|
+
const environmentVariableOutputSchema = z.object({
|
|
332
|
+
id: z.string(),
|
|
333
|
+
key: z.string(),
|
|
334
|
+
value: z.string(),
|
|
335
|
+
isSecret: z.boolean(),
|
|
336
|
+
createdAt: z.coerce.date()
|
|
337
|
+
});
|
|
338
|
+
const listEnvironmentVariablesContractV1 = oc.route({
|
|
339
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
340
|
+
method: "GET",
|
|
341
|
+
summary: "List environment variables",
|
|
342
|
+
description: "List all environment variables for an environment",
|
|
343
|
+
tags: ["environments"],
|
|
344
|
+
successDescription: "The list of environment variables"
|
|
345
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
|
|
346
|
+
const createEnvironmentVariablesContractV1 = oc.route({
|
|
347
|
+
path: "/v1/environments/{environmentId}/environment-variables",
|
|
348
|
+
method: "POST",
|
|
349
|
+
summary: "Add environment variables",
|
|
350
|
+
description: "Add one or more environment variables to an environment",
|
|
351
|
+
tags: ["environments"],
|
|
352
|
+
successDescription: "The environment variables have been added successfully"
|
|
353
|
+
}).errors({
|
|
354
|
+
NOT_FOUND: {},
|
|
355
|
+
BAD_REQUEST: {}
|
|
356
|
+
}).input(z.object({
|
|
357
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
358
|
+
environmentVariables: environmentVariablesSchema
|
|
359
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
360
|
+
const updateEnvironmentVariableContractV1 = oc.route({
|
|
361
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
362
|
+
method: "PATCH",
|
|
363
|
+
summary: "Update an environment variable",
|
|
364
|
+
description: "Update an environment variable by ID",
|
|
365
|
+
tags: ["environments"],
|
|
366
|
+
successDescription: "The environment variable has been updated successfully"
|
|
367
|
+
}).errors({
|
|
368
|
+
NOT_FOUND: {},
|
|
369
|
+
BAD_REQUEST: {}
|
|
370
|
+
}).input(z.object({
|
|
371
|
+
environmentVariableId: z.string().describe("The ID of the environment variable"),
|
|
372
|
+
key: environmentVariableSchema.shape.key,
|
|
373
|
+
value: environmentVariableSchema.shape.value.optional(),
|
|
374
|
+
isSecret: environmentVariableSchema.shape.isSecret
|
|
375
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
376
|
+
const deleteEnvironmentVariableContractV1 = oc.route({
|
|
377
|
+
path: "/v1/environment-variables/{environmentVariableId}",
|
|
378
|
+
method: "DELETE",
|
|
379
|
+
summary: "Delete an environment variable",
|
|
380
|
+
description: "Delete an environment variable by ID",
|
|
381
|
+
tags: ["environments"],
|
|
382
|
+
successDescription: "The environment variable has been deleted successfully"
|
|
383
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
|
|
384
|
+
const deleteProjectContractV1 = oc.route({
|
|
385
|
+
path: "/v1/projects/{projectId}",
|
|
386
|
+
method: "DELETE",
|
|
387
|
+
summary: "Delete a project",
|
|
388
|
+
description: "Delete a project and all its environments",
|
|
389
|
+
tags: ["projects"],
|
|
390
|
+
successDescription: "The project has been deleted successfully"
|
|
391
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
213
392
|
const updateProjectContractV1 = oc.route({
|
|
214
|
-
path: "/v1/projects
|
|
393
|
+
path: "/v1/projects/{projectId}",
|
|
215
394
|
method: "PATCH",
|
|
216
395
|
summary: "Update a project",
|
|
217
396
|
description: "Update project settings",
|
|
@@ -222,10 +401,11 @@ const updateProjectContractV1 = oc.route({
|
|
|
222
401
|
BAD_REQUEST: {}
|
|
223
402
|
}).input(z.object({
|
|
224
403
|
projectId: z.string().describe("The ID of the project"),
|
|
404
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
225
405
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
226
406
|
})).output(projectOutputSchema);
|
|
227
407
|
const deployEnvironmentContractV1 = oc.route({
|
|
228
|
-
path: "/v1/environments
|
|
408
|
+
path: "/v1/environments/{environmentId}/deploy",
|
|
229
409
|
method: "POST",
|
|
230
410
|
summary: "Deploy an environment",
|
|
231
411
|
description: "Deploy an environment",
|
|
@@ -246,31 +426,73 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
246
426
|
tags: ["deployments"],
|
|
247
427
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
248
428
|
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
249
|
-
uploadUrl: z.
|
|
429
|
+
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
250
430
|
token: z.string().describe("Token to identify the source archive"),
|
|
251
431
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
252
432
|
}));
|
|
253
|
-
const
|
|
254
|
-
path: "/v1/projects
|
|
433
|
+
const listDeploymentsContractV1 = oc.route({
|
|
434
|
+
path: "/v1/projects/{projectId}/deployments",
|
|
255
435
|
method: "GET",
|
|
256
436
|
summary: "List project deployments",
|
|
257
437
|
description: "List all deployments for a project",
|
|
258
438
|
tags: ["deployments"],
|
|
259
439
|
successDescription: "The list of deployments"
|
|
260
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
440
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
441
|
+
projectId: z.string().describe("The ID of the project"),
|
|
442
|
+
status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
|
|
443
|
+
environmentId: z.string().optional().describe("Filter by environment ID")
|
|
444
|
+
})).output(z.array(deploymentSchema));
|
|
264
445
|
const getDeploymentContractV1 = oc.route({
|
|
265
|
-
path: "/v1/deployments
|
|
446
|
+
path: "/v1/deployments/{deploymentId}",
|
|
266
447
|
method: "GET",
|
|
267
448
|
summary: "Get a deployment",
|
|
268
449
|
description: "Get a deployment by ID",
|
|
269
450
|
tags: ["deployments"],
|
|
270
451
|
successDescription: "The deployment details"
|
|
271
452
|
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
|
|
453
|
+
const getLogsContractV1 = oc.route({
|
|
454
|
+
path: "/v1/environments/{environmentId}/logs",
|
|
455
|
+
method: "GET",
|
|
456
|
+
summary: "Get logs",
|
|
457
|
+
description: "Get logs for an environment",
|
|
458
|
+
tags: ["environments"],
|
|
459
|
+
successDescription: "The logs"
|
|
460
|
+
}).errors({
|
|
461
|
+
NOT_FOUND: {},
|
|
462
|
+
BAD_REQUEST: {}
|
|
463
|
+
}).input(z.object({
|
|
464
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
465
|
+
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)"),
|
|
466
|
+
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"),
|
|
467
|
+
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
468
|
+
level: z.array(z.enum([
|
|
469
|
+
"INFO",
|
|
470
|
+
"ERROR",
|
|
471
|
+
"WARNING",
|
|
472
|
+
"DEBUG"
|
|
473
|
+
])).optional().describe("Filter by log level"),
|
|
474
|
+
search: z.string().optional().describe("Filter pattern to search for in log content"),
|
|
475
|
+
nextToken: z.string().optional().describe("Pagination token from a previous response")
|
|
476
|
+
})).output(z.object({
|
|
477
|
+
logs: z.array(z.object({
|
|
478
|
+
timestamp: z.coerce.date(),
|
|
479
|
+
type: z.enum([
|
|
480
|
+
"START",
|
|
481
|
+
"END",
|
|
482
|
+
"INFO",
|
|
483
|
+
"ERROR",
|
|
484
|
+
"WARNING",
|
|
485
|
+
"DEBUG"
|
|
486
|
+
]),
|
|
487
|
+
requestId: z.string(),
|
|
488
|
+
content: z.string().optional(),
|
|
489
|
+
method: z.string().optional(),
|
|
490
|
+
durationInMs: z.number().optional()
|
|
491
|
+
})),
|
|
492
|
+
nextToken: z.string().nullable()
|
|
493
|
+
}));
|
|
272
494
|
const getDeploymentLogsContractV1 = oc.route({
|
|
273
|
-
path: "/v1/deployments
|
|
495
|
+
path: "/v1/deployments/{deploymentId}/logs",
|
|
274
496
|
method: "GET",
|
|
275
497
|
summary: "Get deployment logs",
|
|
276
498
|
description: "Get the logs for a deployment",
|
|
@@ -297,7 +519,7 @@ const analyticsTimeSeriesSchema = z.object({
|
|
|
297
519
|
task_count: z.array(analyticsDataPointSchema)
|
|
298
520
|
});
|
|
299
521
|
const getProjectAnalyticsContractV1 = oc.route({
|
|
300
|
-
path: "/v1/analytics
|
|
522
|
+
path: "/v1/analytics/{projectId}",
|
|
301
523
|
method: "GET",
|
|
302
524
|
summary: "Get project analytics",
|
|
303
525
|
description: "Get analytics data for a project over a time range",
|
|
@@ -332,14 +554,129 @@ const listTeamsContractV1 = oc.route({
|
|
|
332
554
|
id: z.string(),
|
|
333
555
|
name: z.string(),
|
|
334
556
|
createdAt: z.coerce.date(),
|
|
335
|
-
hasStripeAccount: z.boolean()
|
|
336
|
-
hasActiveSubscription: z.boolean()
|
|
557
|
+
hasStripeAccount: z.boolean()
|
|
337
558
|
})));
|
|
559
|
+
const getTunnelTicketContractV1 = oc.route({
|
|
560
|
+
path: "/v1/tunnels/ticket",
|
|
561
|
+
method: "GET",
|
|
562
|
+
summary: "Get a tunnel ticket",
|
|
563
|
+
description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
|
|
564
|
+
tags: ["tunnels"],
|
|
565
|
+
successDescription: "The tunnel ticket"
|
|
566
|
+
}).output(z.object({
|
|
567
|
+
subdomain: z.string().describe("The subdomain assigned to the user"),
|
|
568
|
+
ticket: z.string().describe("The signed tunnel ticket"),
|
|
569
|
+
tunnelHost: z.string().describe("The tunnel host to connect to")
|
|
570
|
+
}));
|
|
571
|
+
const publishServerContractV1 = oc.route({
|
|
572
|
+
path: "/v1/distribution/publish",
|
|
573
|
+
method: "POST",
|
|
574
|
+
summary: "Publish a server to the MCP registry",
|
|
575
|
+
tags: ["distribution"],
|
|
576
|
+
successDescription: "The server has been published successfully"
|
|
577
|
+
}).errors({
|
|
578
|
+
NOT_FOUND: {},
|
|
579
|
+
BAD_REQUEST: {}
|
|
580
|
+
}).input(z.object({
|
|
581
|
+
projectId: z.string(),
|
|
582
|
+
domain: z.string(),
|
|
583
|
+
title: z.string().min(1).max(100),
|
|
584
|
+
description: z.string().min(1).max(100),
|
|
585
|
+
websiteUrl: z.url().max(255).optional(),
|
|
586
|
+
iconSrc: z.url().max(255).optional(),
|
|
587
|
+
dryRun: z.boolean().optional()
|
|
588
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
589
|
+
const getServerInfoContractV1 = oc.route({
|
|
590
|
+
path: "/v1/distribution/get",
|
|
591
|
+
method: "GET",
|
|
592
|
+
summary: "Get server info",
|
|
593
|
+
description: "Get info about a server",
|
|
594
|
+
tags: ["distribution"],
|
|
595
|
+
successDescription: "The server info"
|
|
596
|
+
}).errors({
|
|
597
|
+
NOT_FOUND: {},
|
|
598
|
+
BAD_REQUEST: {}
|
|
599
|
+
}).input(z.object({
|
|
600
|
+
projectId: z.string(),
|
|
601
|
+
domain: z.string()
|
|
602
|
+
})).output(z.object({ serverFields: serverFieldsSchema }));
|
|
603
|
+
const playgroundServerMetadataOutputSchema = z.object({
|
|
604
|
+
name: z.string(),
|
|
605
|
+
description: z.string(),
|
|
606
|
+
headers: z.array(z.object({
|
|
607
|
+
name: z.string(),
|
|
608
|
+
description: z.string(),
|
|
609
|
+
isRequired: z.boolean(),
|
|
610
|
+
isSecret: z.boolean()
|
|
611
|
+
})),
|
|
612
|
+
examplePrompts: z.array(playgroundExamplePromptSchema)
|
|
613
|
+
});
|
|
614
|
+
const playgroundOutputSchema = z.object({
|
|
615
|
+
isPlaygroundEnabled: z.boolean(),
|
|
616
|
+
serverMetadata: playgroundServerMetadataOutputSchema.nullable()
|
|
617
|
+
});
|
|
618
|
+
const getPlaygroundContractV1 = oc.route({
|
|
619
|
+
path: "/v1/environments/{environmentId}/playground",
|
|
620
|
+
method: "GET",
|
|
621
|
+
summary: "Get playground configuration",
|
|
622
|
+
description: "Get the playground configuration for an environment",
|
|
623
|
+
tags: ["environments"],
|
|
624
|
+
successDescription: "The playground configuration"
|
|
625
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
|
|
626
|
+
const upsertPlaygroundContractV1 = oc.route({
|
|
627
|
+
path: "/v1/environments/{environmentId}/playground",
|
|
628
|
+
method: "PUT",
|
|
629
|
+
summary: "Update playground configuration",
|
|
630
|
+
description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
|
|
631
|
+
tags: ["environments"],
|
|
632
|
+
successDescription: "The updated playground configuration"
|
|
633
|
+
}).errors({
|
|
634
|
+
NOT_FOUND: {},
|
|
635
|
+
BAD_REQUEST: {}
|
|
636
|
+
}).input(z.object({
|
|
637
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
638
|
+
isPlaygroundEnabled: z.boolean().optional(),
|
|
639
|
+
name: z.string().min(1).max(100).optional(),
|
|
640
|
+
description: z.string().min(1).max(500).optional(),
|
|
641
|
+
headers: z.array(playgroundHeaderSchema).optional(),
|
|
642
|
+
examplePrompts: z.array(playgroundExamplePromptSchema).max(3).optional()
|
|
643
|
+
})).output(playgroundOutputSchema);
|
|
644
|
+
const createBeaconContractV1 = oc.route({
|
|
645
|
+
path: "/v1/beacon/audits",
|
|
646
|
+
method: "POST",
|
|
647
|
+
summary: "Create a beacon audit",
|
|
648
|
+
description: "Audit an MCP server for spec compliance and AI client compatibility",
|
|
649
|
+
tags: ["beacon"],
|
|
650
|
+
successDescription: "The audit has been created"
|
|
651
|
+
}).errors({
|
|
652
|
+
NOT_FOUND: {},
|
|
653
|
+
BAD_REQUEST: {}
|
|
654
|
+
}).input(z.object({
|
|
655
|
+
targetUrl: z.string().url().describe("The HTTPS URL of the MCP server to audit"),
|
|
656
|
+
teamId: z.string().optional().describe("The team ID to associate the audit with"),
|
|
657
|
+
projectId: z.string().optional().describe("The project ID to associate the audit with"),
|
|
658
|
+
excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
|
|
659
|
+
})).output(z.object({ id: z.string() }));
|
|
660
|
+
const getBeaconContractV1 = oc.route({
|
|
661
|
+
path: "/v1/beacon/audits/{auditId}",
|
|
662
|
+
method: "GET",
|
|
663
|
+
summary: "Get a beacon audit",
|
|
664
|
+
description: "Get a beacon audit by ID, including the report if completed",
|
|
665
|
+
tags: ["beacon"],
|
|
666
|
+
successDescription: "The audit details"
|
|
667
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ auditId: z.string().describe("The ID of the audit") })).output(z.object({
|
|
668
|
+
id: z.string(),
|
|
669
|
+
targetUrl: z.string(),
|
|
670
|
+
status: auditStatusSchema,
|
|
671
|
+
durationMs: z.number().nullable(),
|
|
672
|
+
createdAt: z.coerce.date(),
|
|
673
|
+
report: auditReportSchema.nullable()
|
|
674
|
+
}));
|
|
338
675
|
const contract = {
|
|
339
676
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
340
677
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
341
678
|
deployments: {
|
|
342
|
-
list: { v1:
|
|
679
|
+
list: { v1: listDeploymentsContractV1 },
|
|
343
680
|
get: { v1: getDeploymentContractV1 },
|
|
344
681
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
345
682
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -347,15 +684,35 @@ const contract = {
|
|
|
347
684
|
environments: {
|
|
348
685
|
create: { v1: createEnvironmentContractV1 },
|
|
349
686
|
get: { v1: getEnvironmentContractV1 },
|
|
350
|
-
deploy: { v1: deployEnvironmentContractV1 }
|
|
687
|
+
deploy: { v1: deployEnvironmentContractV1 },
|
|
688
|
+
getLogs: { v1: getLogsContractV1 }
|
|
689
|
+
},
|
|
690
|
+
environmentVariables: {
|
|
691
|
+
list: { v1: listEnvironmentVariablesContractV1 },
|
|
692
|
+
create: { v1: createEnvironmentVariablesContractV1 },
|
|
693
|
+
update: { v1: updateEnvironmentVariableContractV1 },
|
|
694
|
+
delete: { v1: deleteEnvironmentVariableContractV1 }
|
|
351
695
|
},
|
|
352
696
|
projects: {
|
|
353
697
|
update: { v1: updateProjectContractV1 },
|
|
354
698
|
get: { v1: getProjectContractV1 },
|
|
355
699
|
list: { v1: listProjectsContractV1 },
|
|
356
|
-
create: { v1: createProjectContractV1 }
|
|
700
|
+
create: { v1: createProjectContractV1 },
|
|
701
|
+
delete: { v1: deleteProjectContractV1 }
|
|
702
|
+
},
|
|
703
|
+
playground: {
|
|
704
|
+
get: { v1: getPlaygroundContractV1 },
|
|
705
|
+
upsert: { v1: upsertPlaygroundContractV1 }
|
|
706
|
+
},
|
|
707
|
+
tunnels: { getTicket: { v1: getTunnelTicketContractV1 } },
|
|
708
|
+
distribution: {
|
|
709
|
+
publish: { v1: publishServerContractV1 },
|
|
710
|
+
get: { v1: getServerInfoContractV1 }
|
|
711
|
+
},
|
|
712
|
+
beacon: {
|
|
713
|
+
create: { v1: createBeaconContractV1 },
|
|
714
|
+
get: { v1: getBeaconContractV1 }
|
|
357
715
|
}
|
|
358
716
|
};
|
|
359
|
-
|
|
360
717
|
//#endregion
|
|
361
|
-
export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
|
|
718
|
+
export { auditReportSchema, auditStatusSchema, buildSettingsSchema, checkCategorySchema, checkDetailSchema, checkResultSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, platformSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema };
|
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.7cfd495",
|
|
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.13",
|
|
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.7",
|
|
29
|
+
"typescript": "^6.0.2",
|
|
30
|
+
"vitest": "^4.1.2"
|
|
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
|
}
|