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