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