@alpic-ai/api 0.0.0-staging.1b6d528 → 0.0.0-staging.1cefa2d
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 +653 -41
- package/dist/index.mjs +411 -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,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,9 +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
|
});
|
|
85
|
-
const
|
|
196
|
+
const isValidLogTimeInput = (value) => {
|
|
197
|
+
if (ms(value) !== void 0) return true;
|
|
198
|
+
return !Number.isNaN(new Date(value).getTime());
|
|
199
|
+
};
|
|
86
200
|
const createEnvironmentContractV1 = oc.route({
|
|
87
201
|
path: "/v1/environments",
|
|
88
202
|
method: "POST",
|
|
@@ -122,10 +236,20 @@ const getEnvironmentContractV1 = oc.route({
|
|
|
122
236
|
createdAt: z.coerce.date(),
|
|
123
237
|
projectId: z.string()
|
|
124
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
|
+
});
|
|
125
248
|
const productionEnvironmentSchema = z.object({
|
|
126
249
|
id: z.string(),
|
|
127
250
|
name: z.string(),
|
|
128
251
|
mcpServerUrl: z.string(),
|
|
252
|
+
domains: z.array(domainSchema),
|
|
129
253
|
latestDeployment: latestDeploymentSchema.nullable()
|
|
130
254
|
});
|
|
131
255
|
const environmentSchema = z.object({
|
|
@@ -168,7 +292,7 @@ const listProjectsContractV1 = oc.route({
|
|
|
168
292
|
description: "List all projects for a team",
|
|
169
293
|
tags: ["projects"],
|
|
170
294
|
successDescription: "The list of projects"
|
|
171
|
-
}).output(z.array(projectOutputSchema));
|
|
295
|
+
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
|
|
172
296
|
const createProjectContractV1 = oc.route({
|
|
173
297
|
path: "/v1/projects",
|
|
174
298
|
method: "POST",
|
|
@@ -181,7 +305,7 @@ const createProjectContractV1 = oc.route({
|
|
|
181
305
|
BAD_REQUEST: {}
|
|
182
306
|
}).input(z.object({
|
|
183
307
|
teamId: z.string().optional(),
|
|
184
|
-
name: z.string().min(1).max(100),
|
|
308
|
+
name: z.string().trim().min(1).max(100),
|
|
185
309
|
sourceRepository: z.string().optional(),
|
|
186
310
|
branchName: z.string().min(1).optional(),
|
|
187
311
|
runtime: runtimeSchema,
|
|
@@ -211,8 +335,61 @@ const createProjectContractV1 = oc.route({
|
|
|
211
335
|
startCommand: z.string().nullable(),
|
|
212
336
|
createdAt: z.coerce.date()
|
|
213
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) }));
|
|
214
391
|
const deleteProjectContractV1 = oc.route({
|
|
215
|
-
path: "/v1/projects
|
|
392
|
+
path: "/v1/projects/{projectId}",
|
|
216
393
|
method: "DELETE",
|
|
217
394
|
summary: "Delete a project",
|
|
218
395
|
description: "Delete a project and all its environments",
|
|
@@ -247,7 +424,7 @@ const deployEnvironmentContractV1 = oc.route({
|
|
|
247
424
|
}).input(z.object({
|
|
248
425
|
environmentId: z.string().describe("The ID of the environment to deploy"),
|
|
249
426
|
token: z.string().describe("The token to identify the source archive").optional()
|
|
250
|
-
})).output(
|
|
427
|
+
})).output(deploymentSchema);
|
|
251
428
|
const uploadDeploymentArtifactContractV1 = oc.route({
|
|
252
429
|
path: "/v1/deployments/upload",
|
|
253
430
|
method: "POST",
|
|
@@ -256,21 +433,22 @@ const uploadDeploymentArtifactContractV1 = oc.route({
|
|
|
256
433
|
tags: ["deployments"],
|
|
257
434
|
successDescription: "The presigned upload URL has been generated successfully"
|
|
258
435
|
}).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
|
|
259
|
-
uploadUrl: z.
|
|
436
|
+
uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
|
|
260
437
|
token: z.string().describe("Token to identify the source archive"),
|
|
261
438
|
expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
|
|
262
439
|
}));
|
|
263
|
-
const
|
|
440
|
+
const listDeploymentsContractV1 = oc.route({
|
|
264
441
|
path: "/v1/projects/{projectId}/deployments",
|
|
265
442
|
method: "GET",
|
|
266
443
|
summary: "List project deployments",
|
|
267
444
|
description: "List all deployments for a project",
|
|
268
445
|
tags: ["deployments"],
|
|
269
446
|
successDescription: "The list of deployments"
|
|
270
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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));
|
|
274
452
|
const getDeploymentContractV1 = oc.route({
|
|
275
453
|
path: "/v1/deployments/{deploymentId}",
|
|
276
454
|
method: "GET",
|
|
@@ -278,7 +456,83 @@ const getDeploymentContractV1 = oc.route({
|
|
|
278
456
|
description: "Get a deployment by ID",
|
|
279
457
|
tags: ["deployments"],
|
|
280
458
|
successDescription: "The deployment details"
|
|
281
|
-
}).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(
|
|
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
|
+
})) }));
|
|
282
536
|
const getDeploymentLogsContractV1 = oc.route({
|
|
283
537
|
path: "/v1/deployments/{deploymentId}/logs",
|
|
284
538
|
method: "GET",
|
|
@@ -342,14 +596,129 @@ const listTeamsContractV1 = oc.route({
|
|
|
342
596
|
id: z.string(),
|
|
343
597
|
name: z.string(),
|
|
344
598
|
createdAt: z.coerce.date(),
|
|
345
|
-
hasStripeAccount: z.boolean()
|
|
346
|
-
hasActiveSubscription: z.boolean()
|
|
599
|
+
hasStripeAccount: z.boolean()
|
|
347
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
|
+
}));
|
|
348
717
|
const contract = {
|
|
349
718
|
teams: { list: { v1: listTeamsContractV1 } },
|
|
350
719
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
351
720
|
deployments: {
|
|
352
|
-
list: { v1:
|
|
721
|
+
list: { v1: listDeploymentsContractV1 },
|
|
353
722
|
get: { v1: getDeploymentContractV1 },
|
|
354
723
|
uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
|
|
355
724
|
getLogs: { v1: getDeploymentLogsContractV1 }
|
|
@@ -357,7 +726,15 @@ const contract = {
|
|
|
357
726
|
environments: {
|
|
358
727
|
create: { v1: createEnvironmentContractV1 },
|
|
359
728
|
get: { v1: getEnvironmentContractV1 },
|
|
360
|
-
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 }
|
|
361
738
|
},
|
|
362
739
|
projects: {
|
|
363
740
|
update: { v1: updateProjectContractV1 },
|
|
@@ -365,8 +742,20 @@ const contract = {
|
|
|
365
742
|
list: { v1: listProjectsContractV1 },
|
|
366
743
|
create: { v1: createProjectContractV1 },
|
|
367
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 }
|
|
368
758
|
}
|
|
369
759
|
};
|
|
370
|
-
|
|
371
760
|
//#endregion
|
|
372
|
-
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.1cefa2d",
|
|
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.9",
|
|
29
|
+
"typescript": "^6.0.3",
|
|
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
|
}
|