@alpic-ai/api 0.0.0-dev.ge97c360 → 0.0.0-dev.ge9cac3a
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 +5209 -40
- package/dist/index.mjs +439 -39
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import * as z$1 from "zod/v4";
|
|
3
3
|
import { oc } from "@orpc/contract";
|
|
4
4
|
import ms from "ms";
|
|
5
|
-
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_supports-color@7.2.0_zod@4.4
|
|
5
|
+
//#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_supports-color@7.2.0_zod@4.5.4/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
|
|
6
6
|
/**
|
|
7
7
|
* Reusable URL validation that disallows javascript: scheme
|
|
8
8
|
*/
|
|
@@ -179,6 +179,7 @@ const PLATFORM_LABELS = {
|
|
|
179
179
|
};
|
|
180
180
|
const WAF_PLATFORMS = [
|
|
181
181
|
"akamai",
|
|
182
|
+
"cato",
|
|
182
183
|
"cloudflare",
|
|
183
184
|
"fastly"
|
|
184
185
|
];
|
|
@@ -256,6 +257,25 @@ z.object({
|
|
|
256
257
|
clientSecret: z.string(),
|
|
257
258
|
clientScopes: z.array(z.string())
|
|
258
259
|
});
|
|
260
|
+
const creditEntryReasonSchema = z.enum([
|
|
261
|
+
"free_seed",
|
|
262
|
+
"paid_conversion_floor",
|
|
263
|
+
"top_up",
|
|
264
|
+
"usage",
|
|
265
|
+
"admin_adjustment"
|
|
266
|
+
]);
|
|
267
|
+
z.enum(["playground"]);
|
|
268
|
+
z.number().int().min(500);
|
|
269
|
+
const creditActivityEntrySchema = z.object({
|
|
270
|
+
reason: creditEntryReasonSchema,
|
|
271
|
+
day: z.number(),
|
|
272
|
+
amountInNanoUSD: z.number(),
|
|
273
|
+
messageCount: z.number().nullable()
|
|
274
|
+
});
|
|
275
|
+
z.object({
|
|
276
|
+
balanceInNanoUSD: z.number(),
|
|
277
|
+
recentActivity: z.array(creditActivityEntrySchema)
|
|
278
|
+
});
|
|
259
279
|
const deploymentStatusSchema$1 = z.enum([
|
|
260
280
|
"ongoing",
|
|
261
281
|
"deployed",
|
|
@@ -402,7 +422,7 @@ z.object({
|
|
|
402
422
|
collectUserData: z.boolean(),
|
|
403
423
|
identityTraitKey: z.string().min(1).max(200).nullable()
|
|
404
424
|
});
|
|
405
|
-
z.object({
|
|
425
|
+
const feedbackSchema = z.object({
|
|
406
426
|
id: z.string(),
|
|
407
427
|
createdAt: z.coerce.date(),
|
|
408
428
|
environmentId: z.string(),
|
|
@@ -424,7 +444,7 @@ const intentCategoryColorSchema = z.enum([
|
|
|
424
444
|
"pink",
|
|
425
445
|
"gray"
|
|
426
446
|
]);
|
|
427
|
-
intentCategoryColorSchema.options;
|
|
447
|
+
const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
|
|
428
448
|
const intentCategorySchema = z.object({
|
|
429
449
|
id: z.string(),
|
|
430
450
|
createdAt: z.coerce.date(),
|
|
@@ -432,7 +452,7 @@ const intentCategorySchema = z.object({
|
|
|
432
452
|
name: z.string(),
|
|
433
453
|
color: intentCategoryColorSchema
|
|
434
454
|
});
|
|
435
|
-
z.object({
|
|
455
|
+
const intentCategorySummarySchema = z.object({
|
|
436
456
|
id: z.string(),
|
|
437
457
|
name: z.string(),
|
|
438
458
|
color: intentCategoryColorSchema,
|
|
@@ -503,6 +523,16 @@ z.object({
|
|
|
503
523
|
createdAt: z.coerce.date(),
|
|
504
524
|
updatedAt: z.coerce.date()
|
|
505
525
|
});
|
|
526
|
+
const alpicMcpRequestLogSchema = z.object({
|
|
527
|
+
type: z.literal("mcp_request"),
|
|
528
|
+
method: z.string()
|
|
529
|
+
});
|
|
530
|
+
const alpicMcpErrorLogSchema = z.object({
|
|
531
|
+
type: z.literal("mcp_error"),
|
|
532
|
+
method: z.string(),
|
|
533
|
+
error: z.string()
|
|
534
|
+
});
|
|
535
|
+
z.union([alpicMcpRequestLogSchema, alpicMcpErrorLogSchema]);
|
|
506
536
|
z.enum([
|
|
507
537
|
"INFO",
|
|
508
538
|
"WARNING",
|
|
@@ -834,6 +864,10 @@ const clampStringField = (field) => {
|
|
|
834
864
|
const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
|
|
835
865
|
return field.description ? withMin.describe(field.description) : withMin;
|
|
836
866
|
};
|
|
867
|
+
const unboundedArrayField = (field) => {
|
|
868
|
+
const unbounded = z.array(field.element);
|
|
869
|
+
return field.description ? unbounded.describe(field.description) : unbounded;
|
|
870
|
+
};
|
|
837
871
|
const toolDefinitionSchema = z.object({
|
|
838
872
|
name: z.string(),
|
|
839
873
|
title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
|
|
@@ -846,11 +880,19 @@ const toolDefinitionSchema = z.object({
|
|
|
846
880
|
}).optional()
|
|
847
881
|
});
|
|
848
882
|
const positiveTestCaseSchema = z.object({
|
|
849
|
-
scenario: z.string().describe("Short label for what this case demonstrates."),
|
|
850
|
-
userPrompt: z.string().describe("A realistic, standalone user message a reviewer can paste and run with no prior state or multi-turn setup. Vary phrasing and tone across cases."),
|
|
883
|
+
scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
|
|
884
|
+
userPrompt: z.string().min(1).describe("A realistic, standalone user message a reviewer can paste and run with no prior state or multi-turn setup. Vary phrasing and tone across cases."),
|
|
851
885
|
toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
|
|
852
886
|
expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
|
|
853
|
-
}).
|
|
887
|
+
}).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
|
|
888
|
+
const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial();
|
|
889
|
+
const blankPositiveTestCase = () => ({
|
|
890
|
+
scenario: "",
|
|
891
|
+
userPrompt: "",
|
|
892
|
+
toolTriggered: "",
|
|
893
|
+
expectedOutput: ""
|
|
894
|
+
});
|
|
895
|
+
const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
|
|
854
896
|
const screenshotEntrySchema = z.object({
|
|
855
897
|
prompt: z.string(),
|
|
856
898
|
url: z.url()
|
|
@@ -1163,9 +1205,14 @@ const chatgptTranslationLocaleSchema = z.enum([
|
|
|
1163
1205
|
"zh-TW"
|
|
1164
1206
|
]);
|
|
1165
1207
|
const negativeTestCaseSchema = z.object({
|
|
1166
|
-
scenario: z.string(),
|
|
1167
|
-
userPrompt: z.string()
|
|
1168
|
-
}).
|
|
1208
|
+
scenario: z.string().min(1),
|
|
1209
|
+
userPrompt: z.string().min(1)
|
|
1210
|
+
}).describe("Each case: Scenario + User prompt (the app should NOT trigger).");
|
|
1211
|
+
const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial();
|
|
1212
|
+
const blankNegativeTestCase = () => ({
|
|
1213
|
+
scenario: "",
|
|
1214
|
+
userPrompt: ""
|
|
1215
|
+
});
|
|
1169
1216
|
const chatgptToolJustificationSchema = z.object({
|
|
1170
1217
|
toolName: z.string(),
|
|
1171
1218
|
readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
|
|
@@ -1200,8 +1247,8 @@ const chatgptSubmissionFormDataSchema = z.object({
|
|
|
1200
1247
|
authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
|
|
1201
1248
|
tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
|
|
1202
1249
|
toolJustifications: z.array(chatgptToolJustificationSchema).describe("Per-tool justification of `readOnlyHint`, `openWorldHint`, and `destructiveHint` annotation values. One short, specific sentence per hint describing what the tool actually does."),
|
|
1203
|
-
testCases: z.array(positiveTestCaseSchema).describe("
|
|
1204
|
-
negativeTestCases: z.array(negativeTestCaseSchema).describe("3 negative test cases: prompts where the app should NOT trigger but the model might think it is relevant. These become production routing metadata that teaches ChatGPT when to stay silent, so pick tight near-misses: a product category the app does not carry, the right brand or domain but an intent the app does not serve, or a boundary with a sibling app."),
|
|
1250
|
+
testCases: z.array(positiveTestCaseSchema).length(5).describe("Exactly 5 positive test cases. Each: Scenario, User prompt, Tool triggered, Expected output. Collectively cover the full capability across different flow stages (initial search or browse, market or locale handling, post-interaction detail, an action ChatGPT performs on the user's behalf, and a conversion or secondary tool) rather than five variations of the same first step."),
|
|
1251
|
+
negativeTestCases: z.array(negativeTestCaseSchema).length(3).describe("Exactly 3 negative test cases: prompts where the app should NOT trigger but the model might think it is relevant. These become production routing metadata that teaches ChatGPT when to stay silent, so pick tight near-misses: a product category the app does not carry, the right brand or domain but an intent the app does not serve, or a boundary with a sibling app."),
|
|
1205
1252
|
screenshots: z.array(screenshotEntrySchema.extend({ prompt: z.string().max(75, { error: "Screenshot prompts are limited to 75 characters." }) })).max(3).describe("In-app screenshots paired with the user prompt that produced them (each prompt is 75 characters max). Widget apps must show the widget UI; non-widget apps show the model response. Min 1, max 3 entries, all public. Images: 706px wide, 400–860px tall, PNG."),
|
|
1206
1253
|
translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
|
|
1207
1254
|
allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
|
|
@@ -1216,23 +1263,34 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
|
|
|
1216
1263
|
demoRecordingUrl: z.string().optional(),
|
|
1217
1264
|
serverUrl: z.string().optional(),
|
|
1218
1265
|
screenshots: z.array(screenshotDraftEntrySchema).optional(),
|
|
1266
|
+
testCases: z.array(positiveTestCaseDraftSchema).optional(),
|
|
1267
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
|
|
1219
1268
|
translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
|
|
1220
1269
|
});
|
|
1221
|
-
|
|
1270
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
|
|
1271
|
+
const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1222
1272
|
appName: true,
|
|
1223
1273
|
developerName: true,
|
|
1224
1274
|
serverUrl: true,
|
|
1225
1275
|
tools: true,
|
|
1226
1276
|
authentication: true
|
|
1227
1277
|
});
|
|
1228
|
-
|
|
1278
|
+
/** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
|
|
1279
|
+
const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
|
|
1229
1280
|
tagline: true,
|
|
1230
1281
|
description: true,
|
|
1231
1282
|
category: true,
|
|
1232
1283
|
testCases: true,
|
|
1233
1284
|
negativeTestCases: true,
|
|
1234
1285
|
toolJustifications: true
|
|
1235
|
-
}).extend({
|
|
1286
|
+
}).extend({
|
|
1287
|
+
testCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.testCases),
|
|
1288
|
+
negativeTestCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.negativeTestCases)
|
|
1289
|
+
}).extend({
|
|
1290
|
+
tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
|
|
1291
|
+
testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
|
|
1292
|
+
negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
|
|
1293
|
+
});
|
|
1236
1294
|
const claudeCategorySchema = z.enum([
|
|
1237
1295
|
"Productivity",
|
|
1238
1296
|
"Communication",
|
|
@@ -1355,7 +1413,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
|
|
|
1355
1413
|
categories: z.array(claudeCategorySchema).optional(),
|
|
1356
1414
|
screenshots: z.array(screenshotDraftEntrySchema).optional()
|
|
1357
1415
|
});
|
|
1358
|
-
|
|
1416
|
+
/** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
|
|
1417
|
+
const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
|
|
1359
1418
|
serverUrl: true,
|
|
1360
1419
|
name: true,
|
|
1361
1420
|
slug: true,
|
|
@@ -1377,27 +1436,86 @@ const claudeAiGeneratedFormDataRawSchema = z.object({
|
|
|
1377
1436
|
categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
|
|
1378
1437
|
primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
|
|
1379
1438
|
});
|
|
1380
|
-
claudeAiGeneratedFormDataRawSchema.extend({
|
|
1439
|
+
const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
|
|
1381
1440
|
oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
|
|
1382
1441
|
categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
|
|
1383
1442
|
});
|
|
1443
|
+
function provenanceByField(prefillShape, aiGeneratedShape) {
|
|
1444
|
+
const byField = {};
|
|
1445
|
+
for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
|
|
1446
|
+
for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
|
|
1447
|
+
return byField;
|
|
1448
|
+
}
|
|
1449
|
+
provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
|
|
1450
|
+
const urlVerificationOutcomeSchema = z.enum([
|
|
1451
|
+
"pass",
|
|
1452
|
+
"fail",
|
|
1453
|
+
"unverified"
|
|
1454
|
+
]);
|
|
1455
|
+
const VERIFIABLE_URL_FIELDS = {
|
|
1456
|
+
chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
|
|
1457
|
+
claudeai: ["privacyPolicy"]
|
|
1458
|
+
};
|
|
1459
|
+
const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
|
|
1460
|
+
const policyDisclosureSchema = z.enum([
|
|
1461
|
+
"dataCategories",
|
|
1462
|
+
"purposesOfUse",
|
|
1463
|
+
"recipients",
|
|
1464
|
+
"retention"
|
|
1465
|
+
]);
|
|
1466
|
+
const urlVerificationFieldResultSchema = z.object({
|
|
1467
|
+
field: verifiableUrlFieldSchema,
|
|
1468
|
+
url: z.string(),
|
|
1469
|
+
outcome: urlVerificationOutcomeSchema,
|
|
1470
|
+
reason: z.string(),
|
|
1471
|
+
concerns: z.array(z.string()).optional(),
|
|
1472
|
+
scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
|
|
1473
|
+
});
|
|
1474
|
+
const urlVerificationSchema = z.object({
|
|
1475
|
+
verifiedAt: z.coerce.date(),
|
|
1476
|
+
results: z.array(urlVerificationFieldResultSchema)
|
|
1477
|
+
});
|
|
1478
|
+
const pageKindSchema = z.enum([
|
|
1479
|
+
"expectedDocument",
|
|
1480
|
+
"errorPage",
|
|
1481
|
+
"loginWall",
|
|
1482
|
+
"parkedDomain",
|
|
1483
|
+
"comingSoon",
|
|
1484
|
+
"marketingPage",
|
|
1485
|
+
"unrelatedDocument"
|
|
1486
|
+
]);
|
|
1487
|
+
z.object({
|
|
1488
|
+
pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
|
|
1489
|
+
reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
|
|
1490
|
+
missingDisclosures: z.array(policyDisclosureSchema).describe("For a privacy policy only: which of the four required disclosures the text does not cover. Empty for every other page kind.")
|
|
1491
|
+
});
|
|
1384
1492
|
const submissionMetaFieldsSchema = z.object({
|
|
1385
1493
|
id: z.string(),
|
|
1386
1494
|
environmentId: z.string(),
|
|
1387
1495
|
auditId: z.string().nullable(),
|
|
1496
|
+
urlVerification: urlVerificationSchema.nullable().default(null),
|
|
1388
1497
|
createdAt: z.coerce.date(),
|
|
1389
1498
|
updatedAt: z.coerce.date()
|
|
1390
1499
|
});
|
|
1391
1500
|
const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1392
1501
|
platform: z.literal("claudeai"),
|
|
1393
|
-
formData: claudeSubmissionDraftSchema
|
|
1502
|
+
formData: claudeSubmissionDraftSchema,
|
|
1503
|
+
prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
|
|
1394
1504
|
});
|
|
1395
1505
|
const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
1396
1506
|
platform: z.literal("chatgpt"),
|
|
1397
|
-
formData: chatgptSubmissionDraftSchema
|
|
1507
|
+
formData: chatgptSubmissionDraftSchema,
|
|
1508
|
+
prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
|
|
1398
1509
|
});
|
|
1399
|
-
z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1510
|
+
const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1400
1511
|
z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
|
|
1512
|
+
/** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
|
|
1513
|
+
const submissionSchema = submissionSchemaInternal;
|
|
1514
|
+
z.literal([
|
|
1515
|
+
100,
|
|
1516
|
+
75,
|
|
1517
|
+
50
|
|
1518
|
+
]);
|
|
1401
1519
|
const subscriptionPlanSchema = z.enum([
|
|
1402
1520
|
"pro",
|
|
1403
1521
|
"business",
|
|
@@ -1409,24 +1527,70 @@ const customerCreditsSchema = z.object({
|
|
|
1409
1527
|
expiresAt: z.number().nullable(),
|
|
1410
1528
|
currency: z.string()
|
|
1411
1529
|
});
|
|
1412
|
-
const customerUsageSchema = z.object({
|
|
1413
|
-
amountInCents: z.number(),
|
|
1414
|
-
currency: z.string(),
|
|
1415
|
-
periodEnd: z.number()
|
|
1416
|
-
});
|
|
1417
1530
|
const partnerDiscountSchema = z.object({ endsAt: z.number() });
|
|
1418
1531
|
z.object({
|
|
1419
1532
|
customerCredits: customerCreditsSchema.nullable(),
|
|
1420
|
-
customerUsage: customerUsageSchema.nullable(),
|
|
1421
1533
|
partnerDiscount: partnerDiscountSchema.nullable()
|
|
1422
1534
|
});
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
z.
|
|
1429
|
-
|
|
1535
|
+
const metricsQueueEventSchema = z.object({
|
|
1536
|
+
ts: z.number().int(),
|
|
1537
|
+
method: z.string(),
|
|
1538
|
+
tool: z.string().nullable(),
|
|
1539
|
+
client: z.string(),
|
|
1540
|
+
sessionId: z.string().nullable(),
|
|
1541
|
+
durationMs: z.number().int(),
|
|
1542
|
+
outputTokens: z.number().int().nullable(),
|
|
1543
|
+
errorType: z.enum([
|
|
1544
|
+
"mcp_error",
|
|
1545
|
+
"tool_error",
|
|
1546
|
+
"timeout"
|
|
1547
|
+
]).nullable(),
|
|
1548
|
+
errorCode: z.number().int().nullable()
|
|
1549
|
+
});
|
|
1550
|
+
z.object({
|
|
1551
|
+
v: z.literal(1),
|
|
1552
|
+
envId: z.string(),
|
|
1553
|
+
events: z.array(metricsQueueEventSchema)
|
|
1554
|
+
});
|
|
1555
|
+
z.object({ v: z.number() });
|
|
1556
|
+
const telemetrySignalSchema = z.enum([
|
|
1557
|
+
"logs",
|
|
1558
|
+
"metrics",
|
|
1559
|
+
"traces"
|
|
1560
|
+
]);
|
|
1561
|
+
const otlpProtocolSchema = z.enum(["http/protobuf", "http/json"]);
|
|
1562
|
+
const otlpEndpointSchema = z.string().trim().min(1).max(2048);
|
|
1563
|
+
const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
|
|
1564
|
+
const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
|
|
1565
|
+
const otlpHeaderValueSchema = z.string().trim().max(OTLP_HEADER_VALUE_MAX_LENGTH).refine((value) => !/[\r\n]/.test(value), "Line breaks are not allowed in a header value");
|
|
1566
|
+
const telemetryDestinationHeaderSchema = z.object({
|
|
1567
|
+
id: z.string(),
|
|
1568
|
+
name: otlpHeaderNameSchema,
|
|
1569
|
+
value: otlpHeaderValueSchema,
|
|
1570
|
+
isSecret: z.boolean()
|
|
1571
|
+
});
|
|
1572
|
+
const otlpPushFailureReasonSchema = z.enum([
|
|
1573
|
+
"credentials",
|
|
1574
|
+
"wrong-path",
|
|
1575
|
+
"wrong-protocol",
|
|
1576
|
+
"invalid-payload",
|
|
1577
|
+
"partial-rejection",
|
|
1578
|
+
"blocked-target",
|
|
1579
|
+
"timeout",
|
|
1580
|
+
"unreachable",
|
|
1581
|
+
"receiver-error",
|
|
1582
|
+
"unexpected-status"
|
|
1583
|
+
]);
|
|
1584
|
+
const telemetryDestinationStatusSchema = z.enum(["active", "suspended"]);
|
|
1585
|
+
z.object({
|
|
1586
|
+
id: z.string(),
|
|
1587
|
+
signal: telemetrySignalSchema,
|
|
1588
|
+
endpoint: otlpEndpointSchema,
|
|
1589
|
+
protocol: otlpProtocolSchema,
|
|
1590
|
+
headers: z.array(telemetryDestinationHeaderSchema),
|
|
1591
|
+
status: telemetryDestinationStatusSchema,
|
|
1592
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable()
|
|
1593
|
+
});
|
|
1430
1594
|
//#endregion
|
|
1431
1595
|
//#region src/auth-scope.ts
|
|
1432
1596
|
/** Accepts an API key or OAuth access token (default for most routes). */
|
|
@@ -1525,6 +1689,14 @@ const serverFieldsSchema = z.object({
|
|
|
1525
1689
|
});
|
|
1526
1690
|
//#endregion
|
|
1527
1691
|
//#region src/api.contract.ts
|
|
1692
|
+
const isValidIanaTimeZone = (timeZone) => {
|
|
1693
|
+
try {
|
|
1694
|
+
new Intl.DateTimeFormat("en-US", { timeZone });
|
|
1695
|
+
return true;
|
|
1696
|
+
} catch {
|
|
1697
|
+
return false;
|
|
1698
|
+
}
|
|
1699
|
+
};
|
|
1528
1700
|
const deploymentStatusSchema = z.enum([
|
|
1529
1701
|
"ongoing",
|
|
1530
1702
|
"deployed",
|
|
@@ -1553,10 +1725,11 @@ const deploymentSchema = z.object({
|
|
|
1553
1725
|
isCurrent: z.boolean(),
|
|
1554
1726
|
deploymentPageUrl: z.url().nullable()
|
|
1555
1727
|
});
|
|
1556
|
-
const
|
|
1728
|
+
const isValidTimeInput = (value) => {
|
|
1557
1729
|
if (ms(value) !== void 0) return true;
|
|
1558
1730
|
return !Number.isNaN(new Date(value).getTime());
|
|
1559
1731
|
};
|
|
1732
|
+
const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
|
|
1560
1733
|
const base = oc.errors({ BAD_REQUEST: {} });
|
|
1561
1734
|
const createEnvironmentContractV1 = base.route({
|
|
1562
1735
|
path: "/v1/environments",
|
|
@@ -1594,6 +1767,14 @@ const getEnvironmentContractV1 = base.route({
|
|
|
1594
1767
|
createdAt: z.coerce.date(),
|
|
1595
1768
|
projectId: z.string()
|
|
1596
1769
|
}));
|
|
1770
|
+
const deleteEnvironmentContractV1 = base.route({
|
|
1771
|
+
path: "/v1/environments/{environmentId}",
|
|
1772
|
+
method: "DELETE",
|
|
1773
|
+
summary: "Delete an environment",
|
|
1774
|
+
description: "All environments can be deleted except the production environment. This operation is not reversible: associated logs, analytics, and metrics are deleted as well.",
|
|
1775
|
+
tags: ["environments"],
|
|
1776
|
+
successDescription: "The environment has been deleted successfully"
|
|
1777
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.object({ success: z.literal(true) }));
|
|
1597
1778
|
const domainSchema = z.object({
|
|
1598
1779
|
domain: z.string(),
|
|
1599
1780
|
status: z.enum([
|
|
@@ -1834,8 +2015,8 @@ const getLogsContractV1 = base.route({
|
|
|
1834
2015
|
successDescription: "The logs"
|
|
1835
2016
|
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
1836
2017
|
environmentId: z.string().describe("The ID of the environment"),
|
|
1837
|
-
since:
|
|
1838
|
-
until:
|
|
2018
|
+
since: timeInputSchema.optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
2019
|
+
until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
|
|
1839
2020
|
limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
|
|
1840
2021
|
level: z.array(z.enum([
|
|
1841
2022
|
"INFO",
|
|
@@ -1906,7 +2087,7 @@ const getProjectAnalyticsContractV1 = base.route({
|
|
|
1906
2087
|
startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
|
|
1907
2088
|
endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
|
|
1908
2089
|
timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
|
|
1909
|
-
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <=
|
|
2090
|
+
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => isValidIanaTimeZone(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
|
|
1910
2091
|
metadata: z.object({
|
|
1911
2092
|
startTimestamp: z.number(),
|
|
1912
2093
|
endTimestamp: z.number(),
|
|
@@ -1916,6 +2097,131 @@ const getProjectAnalyticsContractV1 = base.route({
|
|
|
1916
2097
|
}),
|
|
1917
2098
|
timeSeries: analyticsTimeSeriesSchema
|
|
1918
2099
|
}));
|
|
2100
|
+
const paginatedInsightsInputShape = {
|
|
2101
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2102
|
+
since: timeInputSchema.default("7d").describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
|
|
2103
|
+
until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
|
|
2104
|
+
limit: z.coerce.number().int().min(1).max(200).default(50),
|
|
2105
|
+
offset: z.coerce.number().int().min(0).default(0),
|
|
2106
|
+
search: z.string().trim().min(1).max(200).optional()
|
|
2107
|
+
};
|
|
2108
|
+
const listIntentsContractV1 = base.route({
|
|
2109
|
+
path: "/v1/environments/{environmentId}/intents",
|
|
2110
|
+
method: "GET",
|
|
2111
|
+
summary: "List intents",
|
|
2112
|
+
description: "List grouped user intents for an environment over a time range",
|
|
2113
|
+
tags: ["insights"],
|
|
2114
|
+
successDescription: "The grouped user intents"
|
|
2115
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2116
|
+
...paginatedInsightsInputShape,
|
|
2117
|
+
tools: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
|
|
2118
|
+
clientIds: z.array(z.string().min(1)).min(1).max(100).optional(),
|
|
2119
|
+
categoryIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
|
|
2120
|
+
sortDir: z.enum(["asc", "desc"]).default("desc")
|
|
2121
|
+
})).output(z.object({
|
|
2122
|
+
intents: z.array(z.object({
|
|
2123
|
+
id: z.string(),
|
|
2124
|
+
intentIds: z.array(z.string()).min(1),
|
|
2125
|
+
environmentId: z.string(),
|
|
2126
|
+
message: z.string(),
|
|
2127
|
+
toolName: z.string(),
|
|
2128
|
+
createdAt: z.coerce.date(),
|
|
2129
|
+
occurrenceCount: z.number().int().positive(),
|
|
2130
|
+
clientName: z.string().nullable(),
|
|
2131
|
+
clientId: z.string().nullable(),
|
|
2132
|
+
categories: z.array(z.object({
|
|
2133
|
+
id: z.string(),
|
|
2134
|
+
name: z.string(),
|
|
2135
|
+
color: intentCategoryColorSchema
|
|
2136
|
+
}))
|
|
2137
|
+
})),
|
|
2138
|
+
totalCount: z.number().int().nonnegative()
|
|
2139
|
+
}));
|
|
2140
|
+
const listFeedbacksContractV1 = base.route({
|
|
2141
|
+
path: "/v1/environments/{environmentId}/feedbacks",
|
|
2142
|
+
method: "GET",
|
|
2143
|
+
summary: "List feedbacks",
|
|
2144
|
+
description: "List user feedback for an environment over a time range",
|
|
2145
|
+
tags: ["insights"],
|
|
2146
|
+
successDescription: "The user feedback"
|
|
2147
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2148
|
+
...paginatedInsightsInputShape,
|
|
2149
|
+
clientIds: z.array(z.string().min(1)).min(1).max(100).optional()
|
|
2150
|
+
})).output(z.object({
|
|
2151
|
+
feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
|
|
2152
|
+
totalCount: z.number().int().nonnegative()
|
|
2153
|
+
}));
|
|
2154
|
+
const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
|
|
2155
|
+
const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
|
|
2156
|
+
const listIntentCategoriesContractV1 = base.route({
|
|
2157
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
2158
|
+
method: "GET",
|
|
2159
|
+
summary: "List intent categories",
|
|
2160
|
+
description: "List intent categories for an environment, including how many intents each category is linked to",
|
|
2161
|
+
tags: ["insights"],
|
|
2162
|
+
successDescription: "The intent categories"
|
|
2163
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
|
|
2164
|
+
const createIntentCategoryContractV1 = base.route({
|
|
2165
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
2166
|
+
method: "POST",
|
|
2167
|
+
summary: "Create an intent category",
|
|
2168
|
+
description: "Create an intent category, optionally linking it to existing intents",
|
|
2169
|
+
tags: ["insights"],
|
|
2170
|
+
successDescription: "The created intent category"
|
|
2171
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2172
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2173
|
+
name: intentCategoryNameSchema,
|
|
2174
|
+
color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
|
|
2175
|
+
intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
|
|
2176
|
+
})).output(intentCategorySchema);
|
|
2177
|
+
const updateIntentCategoryContractV1 = base.route({
|
|
2178
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
2179
|
+
method: "PATCH",
|
|
2180
|
+
summary: "Update an intent category",
|
|
2181
|
+
description: "Rename or recolor an intent category",
|
|
2182
|
+
tags: ["insights"],
|
|
2183
|
+
successDescription: "The updated intent category"
|
|
2184
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2185
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2186
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2187
|
+
name: intentCategoryNameSchema.optional(),
|
|
2188
|
+
color: intentCategoryColorSchema.optional().describe("The category color")
|
|
2189
|
+
}).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
|
|
2190
|
+
const deleteIntentCategoryContractV1 = base.route({
|
|
2191
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
2192
|
+
method: "DELETE",
|
|
2193
|
+
summary: "Delete an intent category",
|
|
2194
|
+
description: "Delete an intent category; its intents are unlinked but not deleted",
|
|
2195
|
+
tags: ["insights"],
|
|
2196
|
+
successDescription: "The intent category has been deleted successfully"
|
|
2197
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2198
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2199
|
+
categoryId: z.string().describe("The ID of the category")
|
|
2200
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
2201
|
+
const linkIntentCategoryContractV1 = base.route({
|
|
2202
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
|
|
2203
|
+
method: "POST",
|
|
2204
|
+
summary: "Link an intent category",
|
|
2205
|
+
description: "Link an intent category to intents; already linked intents are ignored",
|
|
2206
|
+
tags: ["insights"],
|
|
2207
|
+
successDescription: "The intents have been linked successfully"
|
|
2208
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2209
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2210
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2211
|
+
intentIds: categorizableIntentIdsSchema
|
|
2212
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
2213
|
+
const unlinkIntentCategoryContractV1 = base.route({
|
|
2214
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
|
|
2215
|
+
method: "POST",
|
|
2216
|
+
summary: "Unlink an intent category",
|
|
2217
|
+
description: "Unlink an intent category from intents; intents without the category are ignored",
|
|
2218
|
+
tags: ["insights"],
|
|
2219
|
+
successDescription: "The intents have been unlinked successfully"
|
|
2220
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2221
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2222
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2223
|
+
intentIds: categorizableIntentIdsSchema
|
|
2224
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
1919
2225
|
const listTeamsContractV1 = base.route({
|
|
1920
2226
|
path: "/v1/teams",
|
|
1921
2227
|
method: "GET",
|
|
@@ -1929,6 +2235,21 @@ const listTeamsContractV1 = base.route({
|
|
|
1929
2235
|
createdAt: z.coerce.date(),
|
|
1930
2236
|
hasStripeAccount: z.boolean()
|
|
1931
2237
|
})));
|
|
2238
|
+
const getTeamUsageContractV1 = base.route({
|
|
2239
|
+
path: "/v1/teams/{teamId}/usage",
|
|
2240
|
+
method: "GET",
|
|
2241
|
+
summary: "Get team usage",
|
|
2242
|
+
description: "Get the MCP request usage of a team for its current billing window. A team that has made no request in the window reports zero.",
|
|
2243
|
+
tags: ["teams"],
|
|
2244
|
+
successDescription: "The current billing window usage"
|
|
2245
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
|
|
2246
|
+
teamId: z.string(),
|
|
2247
|
+
plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
|
|
2248
|
+
periodStart: z.coerce.date().describe("Start of the current billing window"),
|
|
2249
|
+
periodEnd: z.coerce.date().describe("End of the current billing window"),
|
|
2250
|
+
requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
|
|
2251
|
+
includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
|
|
2252
|
+
}));
|
|
1932
2253
|
const getTunnelTicketContractV1 = base.route({
|
|
1933
2254
|
path: "/v1/tunnels/ticket",
|
|
1934
2255
|
method: "GET",
|
|
@@ -2036,9 +2357,61 @@ const getBeaconContractV1 = base.route({
|
|
|
2036
2357
|
createdAt: z.coerce.date(),
|
|
2037
2358
|
report: auditReportWithScreenshotsSchema.nullable()
|
|
2038
2359
|
}));
|
|
2360
|
+
const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
|
|
2361
|
+
const submissionIdSchema = z.string().describe("The ID of the submission package");
|
|
2362
|
+
const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
|
|
2363
|
+
const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
|
|
2364
|
+
const createSubmissionContractV1 = base.route({
|
|
2365
|
+
path: "/v1/submissions",
|
|
2366
|
+
method: "POST",
|
|
2367
|
+
summary: "Create a submission package",
|
|
2368
|
+
description: "Create a submission package for an environment. Alpic reads the environment's live MCP server and prefills every field it can infer, so the response already carries the populated package. The environment must have a successful deployment and must not require authentication.",
|
|
2369
|
+
tags: ["submissions"],
|
|
2370
|
+
successDescription: "The created submission package, with its prefilled fields"
|
|
2371
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2372
|
+
environmentId: z.string().describe("The ID of the environment to build the package from"),
|
|
2373
|
+
platform: platformSchema.describe(PLATFORM_DESCRIPTION)
|
|
2374
|
+
})).output(submissionSchema);
|
|
2375
|
+
const getSubmissionContractV1 = base.route({
|
|
2376
|
+
path: "/v1/submissions/{submissionId}",
|
|
2377
|
+
method: "GET",
|
|
2378
|
+
summary: "Get a submission package",
|
|
2379
|
+
description: "Get a submission package by ID, including its form data and the prefill it started from",
|
|
2380
|
+
tags: ["submissions"],
|
|
2381
|
+
successDescription: "The submission package"
|
|
2382
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
|
|
2383
|
+
const updateSubmissionContractV1 = base.route({
|
|
2384
|
+
path: "/v1/submissions/{submissionId}",
|
|
2385
|
+
method: "PUT",
|
|
2386
|
+
summary: "Update a submission package",
|
|
2387
|
+
description: "Update the form data of a submission package. Only the fields you send are changed; the rest are left as they are. Unknown field names are rejected rather than ignored, so a typo fails the call. `platform` must match the package's own platform.",
|
|
2388
|
+
tags: ["submissions"],
|
|
2389
|
+
successDescription: "The updated submission package"
|
|
2390
|
+
}).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
|
|
2391
|
+
submissionId: submissionIdSchema,
|
|
2392
|
+
platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
|
|
2393
|
+
formData: claudeSubmissionUpdateSchema
|
|
2394
|
+
}), z.object({
|
|
2395
|
+
submissionId: submissionIdSchema,
|
|
2396
|
+
platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
|
|
2397
|
+
formData: chatgptSubmissionUpdateSchema
|
|
2398
|
+
})])).output(submissionSchema);
|
|
2039
2399
|
const contract = {
|
|
2040
|
-
teams: {
|
|
2400
|
+
teams: {
|
|
2401
|
+
list: { v1: listTeamsContractV1 },
|
|
2402
|
+
getUsage: { v1: getTeamUsageContractV1 }
|
|
2403
|
+
},
|
|
2041
2404
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
2405
|
+
intents: { list: { v1: listIntentsContractV1 } },
|
|
2406
|
+
intentCategories: {
|
|
2407
|
+
list: { v1: listIntentCategoriesContractV1 },
|
|
2408
|
+
create: { v1: createIntentCategoryContractV1 },
|
|
2409
|
+
update: { v1: updateIntentCategoryContractV1 },
|
|
2410
|
+
delete: { v1: deleteIntentCategoryContractV1 },
|
|
2411
|
+
link: { v1: linkIntentCategoryContractV1 },
|
|
2412
|
+
unlink: { v1: unlinkIntentCategoryContractV1 }
|
|
2413
|
+
},
|
|
2414
|
+
feedbacks: { list: { v1: listFeedbacksContractV1 } },
|
|
2042
2415
|
deployments: {
|
|
2043
2416
|
list: { v1: listDeploymentsContractV1 },
|
|
2044
2417
|
get: { v1: getDeploymentContractV1 },
|
|
@@ -2048,6 +2421,7 @@ const contract = {
|
|
|
2048
2421
|
environments: {
|
|
2049
2422
|
create: { v1: createEnvironmentContractV1 },
|
|
2050
2423
|
get: { v1: getEnvironmentContractV1 },
|
|
2424
|
+
delete: { v1: deleteEnvironmentContractV1 },
|
|
2051
2425
|
deploy: { v1: deployEnvironmentContractV1 },
|
|
2052
2426
|
getLogs: { v1: getLogsContractV1 },
|
|
2053
2427
|
getLatestLogs: { v1: getLatestLogsContractV1 }
|
|
@@ -2077,6 +2451,11 @@ const contract = {
|
|
|
2077
2451
|
beacon: {
|
|
2078
2452
|
create: { v1: createBeaconContractV1 },
|
|
2079
2453
|
get: { v1: getBeaconContractV1 }
|
|
2454
|
+
},
|
|
2455
|
+
submissions: {
|
|
2456
|
+
create: { v1: createSubmissionContractV1 },
|
|
2457
|
+
get: { v1: getSubmissionContractV1 },
|
|
2458
|
+
update: { v1: updateSubmissionContractV1 }
|
|
2080
2459
|
}
|
|
2081
2460
|
};
|
|
2082
2461
|
const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
|
|
@@ -2084,5 +2463,26 @@ const contractForDocs = {
|
|
|
2084
2463
|
...contract,
|
|
2085
2464
|
deployments: deploymentsForDocs
|
|
2086
2465
|
};
|
|
2466
|
+
/** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
|
|
2467
|
+
const OPENAPI_DOC_OPTIONS = {
|
|
2468
|
+
info: {
|
|
2469
|
+
title: "Alpic API",
|
|
2470
|
+
version: "1.0.0"
|
|
2471
|
+
},
|
|
2472
|
+
servers: [{ url: "https://api.alpic.ai" }],
|
|
2473
|
+
security: [{ bearerAuth: [] }],
|
|
2474
|
+
components: { securitySchemes: { bearerAuth: {
|
|
2475
|
+
type: "http",
|
|
2476
|
+
description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
|
|
2477
|
+
scheme: "bearer"
|
|
2478
|
+
} } },
|
|
2479
|
+
commonSchemas: {
|
|
2480
|
+
Submission: { schema: submissionSchema },
|
|
2481
|
+
ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
|
|
2482
|
+
ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
|
|
2483
|
+
ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
|
|
2484
|
+
ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
|
|
2485
|
+
}
|
|
2486
|
+
};
|
|
2087
2487
|
//#endregion
|
|
2088
|
-
export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
|
2488
|
+
export { AI_PLATFORMS, AUTH_SCOPE_ANY, AUTH_SCOPE_USER, INTENT_CATEGORY_COLORS, OPENAPI_DOC_OPTIONS, PLATFORM_LABELS, buildSettingsSchema, chatgptSubmissionUpdateSchema, claudeSubmissionUpdateSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|