@alpic-ai/api 0.0.0-staging.c5df9aa → 0.0.0-staging.c660552
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 +657 -39
- package/dist/index.mjs +424 -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"),
|
|
@@ -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,8 +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
|
});
|
|
193
|
+
const isValidLogTimeInput = (value) => {
|
|
194
|
+
if (ms(value) !== void 0) return true;
|
|
195
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
196
|
+
};
|
|
85
197
|
const createEnvironmentContractV1 = oc.route({
|
|
86
198
|
path: "/v1/environments",
|
|
87
199
|
method: "POST",
|
|
@@ -106,7 +218,7 @@ const createEnvironmentContractV1 = oc.route({
|
|
|
106
218
|
projectId: z.string().describe("The ID of the project the environment belongs to")
|
|
107
219
|
}));
|
|
108
220
|
const getEnvironmentContractV1 = oc.route({
|
|
109
|
-
path: "/v1/environments
|
|
221
|
+
path: "/v1/environments/{environmentId}",
|
|
110
222
|
method: "GET",
|
|
111
223
|
summary: "Get an environment",
|
|
112
224
|
description: "Get an environment by ID",
|
|
@@ -121,10 +233,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
121
233
|
createdAt: z.coerce.date(),
|
|
122
234
|
projectId: z.string()
|
|
123
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
|
+
});
|
|
124
245
|
const productionEnvironmentSchema = z.object({
|
|
125
246
|
id: z.string(),
|
|
126
247
|
name: z.string(),
|
|
127
248
|
mcpServerUrl: z.string(),
|
|
249
|
+
domains: z.array(domainSchema),
|
|
128
250
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
129
251
|
});
|
|
130
252
|
const environmentSchema = z.object({
|
|
@@ -153,7 +275,7 @@ const projectOutputSchema = z.object({
|
|
|
153
275
|
environments: z.array(environmentSchema)
|
|
154
276
|
});
|
|
155
277
|
const getProjectContractV1 = oc.route({
|
|
156
|
-
path: "/v1/projects
|
|
278
|
+
path: "/v1/projects/{projectId}",
|
|
157
279
|
method: "GET",
|
|
158
280
|
summary: "Get a project",
|
|
159
281
|
description: "Get a project by ID",
|
|
@@ -167,7 +289,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
167
289
|
description: "List all projects for a team",
|
|
168
290
|
tags: ["projects"],
|
|
169
291
|
successDescription: "The list of projects"
|
|
170
|
-
}).output(z.array(projectOutputSchema));
|
|
292
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
171
293
|
const createProjectContractV1 = oc.route({
|
|
172
294
|
path: "/v1/projects",
|
|
173
295
|
method: "POST",
|
|
@@ -180,7 +302,7 @@ const createProjectContractV1 = oc.route({
|
|
|
180
302
|
BAD_REQUEST: {}
|
|
181
303
|
}).input(z.object({
|
|
182
304
|
teamId: z.string().optional(),
|
|
183
|
-
name: z.string().min(1).max(100),
|
|
305
|
+
name: z.string().trim().min(1).max(100),
|
|
184
306
|
sourceRepository: z.string().optional(),
|
|
185
307
|
branchName: z.string().min(1).optional(),
|
|
186
308
|
runtime: runtimeSchema,
|
|
@@ -210,8 +332,69 @@ const createProjectContractV1 = oc.route({
|
|
|
210
332
|
startCommand: z.string().nullable(),
|
|
211
333
|
createdAt: z.coerce.date()
|
|
212
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) }));
|
|
388
|
+
const deleteProjectContractV1 = oc.route({
|
|
389
|
+
path: "/v1/projects/{projectId}",
|
|
390
|
+
method: "DELETE",
|
|
391
|
+
summary: "Delete a project",
|
|
392
|
+
description: "Delete a project and all its environments",
|
|
393
|
+
tags: ["projects"],
|
|
394
|
+
successDescription: "The project has been deleted successfully"
|
|
395
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
|
|
213
396
|
const updateProjectContractV1 = oc.route({
|
|
214
|
-
path: "/v1/projects
|
|
397
|
+
path: "/v1/projects/{projectId}",
|
|
215
398
|
method: "PATCH",
|
|
216
399
|
summary: "Update a project",
|
|
217
400
|
description: "Update project settings",
|
|
@@ -222,10 +405,11 @@ const updateProjectContractV1 = oc.route({
|
|
|
222
405
|
BAD_REQUEST: {}
|
|
223
406
|
}).input(z.object({
|
|
224
407
|
projectId: z.string().describe("The ID of the project"),
|
|
408
|
+
name: z.string().min(1).max(100).optional().describe("The new name for the project"),
|
|
225
409
|
sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
|
|
226
410
|
})).output(projectOutputSchema);
|
|
227
411
|
const deployEnvironmentContractV1 = oc.route({
|
|
228
|
-
path: "/v1/environments
|
|
412
|
+
path: "/v1/environments/{environmentId}/deploy",
|
|
229
413
|
method: "POST",
|
|
230
414
|
summary: "Deploy an environment",
|
|
231
415
|
description: "Deploy an environment",
|
|
@@ -246,31 +430,108 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
246
430
|
tags: ["deployments"],
|
|
247
431
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
248
432
|
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
249
|
-
uploadUrl: z.
|
|
433
|
+
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
250
434
|
token: z.string().describe("Token to identify the source archive"),
|
|
251
435
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
252
436
|
}));
|
|
253
|
-
const
|
|
254
|
-
path: "/v1/projects
|
|
437
|
+
const listDeploymentsContractV1 = oc.route({
|
|
438
|
+
path: "/v1/projects/{projectId}/deployments",
|
|
255
439
|
method: "GET",
|
|
256
440
|
summary: "List project deployments",
|
|
257
441
|
description: "List all deployments for a project",
|
|
258
442
|
tags: ["deployments"],
|
|
259
443
|
successDescription: "The list of deployments"
|
|
260
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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));
|
|
264
449
|
const getDeploymentContractV1 = oc.route({
|
|
265
|
-
path: "/v1/deployments
|
|
450
|
+
path: "/v1/deployments/{deploymentId}",
|
|
266
451
|
method: "GET",
|
|
267
452
|
summary: "Get a deployment",
|
|
268
453
|
description: "Get a deployment by ID",
|
|
269
454
|
tags: ["deployments"],
|
|
270
455
|
successDescription: "The deployment details"
|
|
271
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
|
+
})) }));
|
|
272
533
|
const getDeploymentLogsContractV1 = oc.route({
|
|
273
|
-
path: "/v1/deployments
|
|
534
|
+
path: "/v1/deployments/{deploymentId}/logs",
|
|
274
535
|
method: "GET",
|
|
275
536
|
summary: "Get deployment logs",
|
|
276
537
|
description: "Get the logs for a deployment",
|
|
@@ -297,7 +558,7 @@ const analyticsTimeSeriesSchema = z.object({
|
|
|
297
558
|
task_count: z.array(analyticsDataPointSchema)
|
|
298
559
|
});
|
|
299
560
|
const getProjectAnalyticsContractV1 = oc.route({
|
|
300
|
-
path: "/v1/analytics
|
|
561
|
+
path: "/v1/analytics/{projectId}",
|
|
301
562
|
method: "GET",
|
|
302
563
|
summary: "Get project analytics",
|
|
303
564
|
description: "Get analytics data for a project over a time range",
|
|
@@ -332,14 +593,129 @@ const listTeamsContractV1 = oc.route({
|
|
|
332
593
|
id: z.string(),
|
|
333
594
|
name: z.string(),
|
|
334
595
|
createdAt: z.coerce.date(),
|
|
335
|
-
hasStripeAccount: z.boolean()
|
|
336
|
-
hasActiveSubscription: z.boolean()
|
|
596
|
+
hasStripeAccount: z.boolean()
|
|
337
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
|
+
}));
|
|
338
714
|
const contract = {
|
|
339
715
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
340
716
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
341
717
|
deployments: {
|
|
342
|
-
list: { v1:
|
|
718
|
+
list: { v1: listDeploymentsContractV1 },
|
|
343
719
|
get: { v1: getDeploymentContractV1 },
|
|
344
720
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
345
721
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -347,15 +723,36 @@ const contract = {
|
|
|
347
723
|
environments: {
|
|
348
724
|
create: { v1: createEnvironmentContractV1 },
|
|
349
725
|
get: { v1: getEnvironmentContractV1 },
|
|
350
|
-
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 }
|
|
351
735
|
},
|
|
352
736
|
projects: {
|
|
353
737
|
update: { v1: updateProjectContractV1 },
|
|
354
738
|
get: { v1: getProjectContractV1 },
|
|
355
739
|
list: { v1: listProjectsContractV1 },
|
|
356
|
-
create: { v1: createProjectContractV1 }
|
|
740
|
+
create: { v1: createProjectContractV1 },
|
|
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 }
|
|
357
755
|
}
|
|
358
756
|
};
|
|
359
|
-
|
|
360
757
|
//#endregion
|
|
361
|
-
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.c660552",
|
|
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.7",
|
|
29
|
+
"typescript": "^6.0.2",
|
|
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
|
}
|