@alpic-ai/api 0.0.0-staging.05f123d → 0.0.0-staging.0765ede

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.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/:environmentId",
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/:projectId",
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,84 @@ 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) }));
396
+ const updateProjectContractV1 = oc.route({
397
+ path: "/v1/projects/{projectId}",
398
+ method: "PATCH",
399
+ summary: "Update a project",
400
+ description: "Update project settings",
401
+ tags: ["projects"],
402
+ successDescription: "The project has been updated successfully"
403
+ }).errors({
404
+ NOT_FOUND: {},
405
+ BAD_REQUEST: {}
406
+ }).input(z.object({
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"),
409
+ sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
410
+ })).output(projectOutputSchema);
213
411
  const deployEnvironmentContractV1 = oc.route({
214
- path: "/v1/environments/:environmentId/deploy",
412
+ path: "/v1/environments/{environmentId}/deploy",
215
413
  method: "POST",
216
414
  summary: "Deploy an environment",
217
415
  description: "Deploy an environment",
@@ -232,34 +430,293 @@ const uploadDeploymentArtifactContractV1 = oc.route({
232
430
  tags: ["deployments"],
233
431
  successDescription: "The presigned upload URL has been generated successfully"
234
432
  }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
235
- uploadUrl: z.string().url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
433
+ uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
236
434
  token: z.string().describe("Token to identify the source archive"),
237
435
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
238
436
  }));
437
+ const listDeploymentsContractV1 = oc.route({
438
+ path: "/v1/projects/{projectId}/deployments",
439
+ method: "GET",
440
+ summary: "List project deployments",
441
+ description: "List all deployments for a project",
442
+ tags: ["deployments"],
443
+ successDescription: "The list of deployments"
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));
239
449
  const getDeploymentContractV1 = oc.route({
240
- path: "/v1/deployments/:deploymentId",
450
+ path: "/v1/deployments/{deploymentId}",
241
451
  method: "GET",
242
452
  summary: "Get a deployment",
243
453
  description: "Get a deployment by ID",
244
454
  tags: ["deployments"],
245
455
  successDescription: "The deployment details"
246
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 getDeploymentLogsContractV1 = oc.route({
499
+ path: "/v1/deployments/{deploymentId}/logs",
500
+ method: "GET",
501
+ summary: "Get deployment logs",
502
+ description: "Get the logs for a deployment",
503
+ tags: ["deployments"],
504
+ successDescription: "The deployment logs"
505
+ }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(z.object({
506
+ logs: z.array(z.object({
507
+ timestamp: z.coerce.date().optional(),
508
+ content: z.string().optional()
509
+ })),
510
+ hasMoreLogs: z.boolean()
511
+ }));
512
+ const analyticsDataPointSchema = z.object({
513
+ timestamp: z.number(),
514
+ categories: z.record(z.string(), z.unknown())
515
+ });
516
+ const analyticsTimeSeriesSchema = z.object({
517
+ sessions_count: z.array(analyticsDataPointSchema),
518
+ requests_count: z.array(analyticsDataPointSchema),
519
+ requests_latency_mean: z.array(analyticsDataPointSchema),
520
+ tool_errors: z.array(analyticsDataPointSchema),
521
+ mcp_errors: z.array(analyticsDataPointSchema),
522
+ output_token_mean: z.array(analyticsDataPointSchema),
523
+ task_count: z.array(analyticsDataPointSchema)
524
+ });
525
+ const getProjectAnalyticsContractV1 = oc.route({
526
+ path: "/v1/analytics/{projectId}",
527
+ method: "GET",
528
+ summary: "Get project analytics",
529
+ description: "Get analytics data for a project over a time range",
530
+ tags: ["analytics"],
531
+ successDescription: "The project analytics data"
532
+ }).errors({
533
+ NOT_FOUND: {},
534
+ BAD_REQUEST: {}
535
+ }).input(z.object({
536
+ projectId: z.string().describe("The ID of the project"),
537
+ startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
538
+ endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
539
+ timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
540
+ }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 744 * 60 * 60 * 1e3, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
541
+ metadata: z.object({
542
+ startTimestamp: z.number(),
543
+ endTimestamp: z.number(),
544
+ timeZone: z.string(),
545
+ startDate: z.coerce.date(),
546
+ interval: z.string()
547
+ }),
548
+ timeSeries: analyticsTimeSeriesSchema
549
+ }));
550
+ const listTeamsContractV1 = oc.route({
551
+ path: "/v1/teams",
552
+ method: "GET",
553
+ summary: "List teams",
554
+ description: "List all teams for the authenticated user",
555
+ tags: ["teams"],
556
+ successDescription: "The list of teams"
557
+ }).output(z.array(z.object({
558
+ id: z.string(),
559
+ name: z.string(),
560
+ createdAt: z.coerce.date(),
561
+ hasStripeAccount: z.boolean()
562
+ })));
563
+ const getTunnelTicketContractV1 = oc.route({
564
+ path: "/v1/tunnels/ticket",
565
+ method: "GET",
566
+ summary: "Get a tunnel ticket",
567
+ description: "Get a signed ticket for establishing a tunnel connection. Requires user authentication (API keys are not supported).",
568
+ tags: ["tunnels"],
569
+ successDescription: "The tunnel ticket"
570
+ }).output(z.object({
571
+ subdomain: z.string().describe("The subdomain assigned to the user"),
572
+ ticket: z.string().describe("The signed tunnel ticket"),
573
+ tunnelHost: z.string().describe("The tunnel host to connect to")
574
+ }));
575
+ const publishServerContractV1 = oc.route({
576
+ path: "/v1/distribution/publish",
577
+ method: "POST",
578
+ summary: "Publish a server to the MCP registry",
579
+ tags: ["distribution"],
580
+ successDescription: "The server has been published successfully"
581
+ }).errors({
582
+ NOT_FOUND: {},
583
+ BAD_REQUEST: {}
584
+ }).input(z.object({
585
+ projectId: z.string(),
586
+ domain: z.string(),
587
+ title: z.string().min(1).max(100),
588
+ description: z.string().min(1).max(100),
589
+ websiteUrl: z.url().max(255).optional(),
590
+ iconSrc: z.url().max(255).optional(),
591
+ dryRun: z.boolean().optional()
592
+ })).output(z.object({ serverFields: serverFieldsSchema }));
593
+ const getServerInfoContractV1 = oc.route({
594
+ path: "/v1/distribution/get",
595
+ method: "GET",
596
+ summary: "Get server info",
597
+ description: "Get info about a server",
598
+ tags: ["distribution"],
599
+ successDescription: "The server info"
600
+ }).errors({
601
+ NOT_FOUND: {},
602
+ BAD_REQUEST: {}
603
+ }).input(z.object({
604
+ projectId: z.string(),
605
+ domain: z.string()
606
+ })).output(z.object({ serverFields: serverFieldsSchema }));
607
+ const playgroundServerMetadataOutputSchema = z.object({
608
+ name: z.string(),
609
+ description: z.string(),
610
+ headers: z.array(z.object({
611
+ name: z.string(),
612
+ description: z.string(),
613
+ isRequired: z.boolean(),
614
+ isSecret: z.boolean()
615
+ })),
616
+ examplePrompts: z.array(playgroundExamplePromptSchema)
617
+ });
618
+ const playgroundOutputSchema = z.object({
619
+ isPlaygroundEnabled: z.boolean(),
620
+ serverMetadata: playgroundServerMetadataOutputSchema.nullable()
621
+ });
622
+ const getPlaygroundContractV1 = oc.route({
623
+ path: "/v1/environments/{environmentId}/playground",
624
+ method: "GET",
625
+ summary: "Get playground configuration",
626
+ description: "Get the playground configuration for an environment",
627
+ tags: ["environments"],
628
+ successDescription: "The playground configuration"
629
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
630
+ const upsertPlaygroundContractV1 = oc.route({
631
+ path: "/v1/environments/{environmentId}/playground",
632
+ method: "PUT",
633
+ summary: "Update playground configuration",
634
+ description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
635
+ tags: ["environments"],
636
+ successDescription: "The updated playground configuration"
637
+ }).errors({
638
+ NOT_FOUND: {},
639
+ BAD_REQUEST: {}
640
+ }).input(z.object({
641
+ environmentId: z.string().describe("The ID of the environment"),
642
+ isPlaygroundEnabled: z.boolean().optional(),
643
+ name: z.string().min(1).max(100).optional(),
644
+ description: z.string().min(1).max(500).optional(),
645
+ headers: z.array(playgroundHeaderSchema).optional(),
646
+ examplePrompts: z.array(playgroundExamplePromptSchema).max(3).optional()
647
+ })).output(playgroundOutputSchema);
648
+ const createBeaconContractV1 = oc.route({
649
+ path: "/v1/beacon/audits",
650
+ method: "POST",
651
+ summary: "Create a beacon audit",
652
+ description: "Audit an MCP server for spec compliance and AI client compatibility",
653
+ tags: ["beacon"],
654
+ successDescription: "The audit has been created"
655
+ }).errors({
656
+ NOT_FOUND: {},
657
+ BAD_REQUEST: {}
658
+ }).input(z.object({
659
+ targetUrl: z.string().url().describe("The HTTPS URL of the MCP server to audit"),
660
+ teamId: z.string().optional().describe("The team ID to associate the audit with"),
661
+ projectId: z.string().optional().describe("The project ID to associate the audit with"),
662
+ excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
663
+ })).output(z.object({ id: z.string() }));
664
+ const getBeaconContractV1 = oc.route({
665
+ path: "/v1/beacon/audits/{auditId}",
666
+ method: "GET",
667
+ summary: "Get a beacon audit",
668
+ description: "Get a beacon audit by ID, including the report if completed",
669
+ tags: ["beacon"],
670
+ successDescription: "The audit details"
671
+ }).errors({ NOT_FOUND: {} }).input(z.object({ auditId: z.string().describe("The ID of the audit") })).output(z.object({
672
+ id: z.string(),
673
+ targetUrl: z.string(),
674
+ status: auditStatusSchema,
675
+ durationMs: z.number().nullable(),
676
+ createdAt: z.coerce.date(),
677
+ report: auditReportSchema.nullable()
678
+ }));
247
679
  const contract = {
680
+ teams: { list: { v1: listTeamsContractV1 } },
681
+ analytics: { get: { v1: getProjectAnalyticsContractV1 } },
248
682
  deployments: {
683
+ list: { v1: listDeploymentsContractV1 },
249
684
  get: { v1: getDeploymentContractV1 },
250
- uploadArtifact: { v1: uploadDeploymentArtifactContractV1 }
685
+ uploadArtifact: { v1: uploadDeploymentArtifactContractV1 },
686
+ getLogs: { v1: getDeploymentLogsContractV1 }
251
687
  },
252
688
  environments: {
253
689
  create: { v1: createEnvironmentContractV1 },
254
690
  get: { v1: getEnvironmentContractV1 },
255
- deploy: { v1: deployEnvironmentContractV1 }
691
+ deploy: { v1: deployEnvironmentContractV1 },
692
+ getLogs: { v1: getLogsContractV1 }
693
+ },
694
+ environmentVariables: {
695
+ list: { v1: listEnvironmentVariablesContractV1 },
696
+ create: { v1: createEnvironmentVariablesContractV1 },
697
+ update: { v1: updateEnvironmentVariableContractV1 },
698
+ delete: { v1: deleteEnvironmentVariableContractV1 }
256
699
  },
257
700
  projects: {
701
+ update: { v1: updateProjectContractV1 },
258
702
  get: { v1: getProjectContractV1 },
259
703
  list: { v1: listProjectsContractV1 },
260
- create: { v1: createProjectContractV1 }
704
+ create: { v1: createProjectContractV1 },
705
+ delete: { v1: deleteProjectContractV1 }
706
+ },
707
+ playground: {
708
+ get: { v1: getPlaygroundContractV1 },
709
+ upsert: { v1: upsertPlaygroundContractV1 }
710
+ },
711
+ tunnels: { getTicket: { v1: getTunnelTicketContractV1 } },
712
+ distribution: {
713
+ publish: { v1: publishServerContractV1 },
714
+ get: { v1: getServerInfoContractV1 }
715
+ },
716
+ beacon: {
717
+ create: { v1: createBeaconContractV1 },
718
+ get: { v1: getBeaconContractV1 }
261
719
  }
262
720
  };
263
-
264
721
  //#endregion
265
- export { buildSettingsSchema, contract, createEnvironmentContractV1, environmentVariableSchema, environmentVariablesSchema, runtimeSchema, transportSchema };
722
+ 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.05f123d",
3
+ "version": "0.0.0-staging.0765ede",
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.4",
20
+ "@orpc/contract": "^1.13.13",
21
+ "ms": "^2.1.3",
21
22
  "zod": "^4.3.6"
22
23
  },
23
24
  "devDependencies": {
24
25
  "@total-typescript/tsconfig": "^1.0.4",
25
- "biome": "^0.3.3",
26
+ "@types/ms": "^2.1.0",
26
27
  "shx": "^0.4.0",
27
- "tsdown": "^0.20.3",
28
- "typescript": "^5.9.3",
29
- "vitest": "^4.0.18"
28
+ "tsdown": "^0.21.7",
29
+ "typescript": "^6.0.2",
30
+ "vitest": "^4.1.2"
30
31
  },
31
32
  "scripts": {
32
33
  "build": "shx rm -rf dist && tsdown",
33
- "format": "biome check --write --error-on-warnings",
34
+ "format": "biome check --write --error-on-warnings .",
34
35
  "test": "pnpm run test:unit && pnpm run test:type && pnpm run test:format",
35
36
  "test:unit": "vitest run",
36
- "test:format": "prettier --check .",
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
  }