@alpic-ai/api 0.0.0-dev.gede1d99 → 0.0.0-dev.gedf37b2

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
@@ -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.5.4/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
5
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.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
  */
@@ -119,7 +119,12 @@ z$1.object({
119
119
  token_type: z$1.string(),
120
120
  expires_in: z$1.coerce.number().optional(),
121
121
  scope: z$1.string().optional(),
122
- refresh_token: z$1.string().optional()
122
+ refresh_token: z$1.string().optional(),
123
+ /**
124
+ * Not part of the wire format: the authorization server this value was obtained from, added by
125
+ * the client's `auth()` before it is stored and compared when it is read back.
126
+ */
127
+ issuer: z$1.string().optional().catch(void 0)
123
128
  }).strip();
124
129
  z$1.object({
125
130
  error: z$1.string(),
@@ -158,7 +163,12 @@ const OAuthClientInformationSchema = z$1.object({
158
163
  client_id: z$1.string(),
159
164
  client_secret: z$1.string().optional(),
160
165
  client_id_issued_at: z$1.number().optional(),
161
- client_secret_expires_at: z$1.number().optional()
166
+ client_secret_expires_at: z$1.number().optional(),
167
+ /**
168
+ * Not part of the wire format: the authorization server this value was obtained from, added by
169
+ * the client's `auth()` before it is stored and compared when it is read back.
170
+ */
171
+ issuer: z$1.string().optional().catch(void 0)
162
172
  }).strip();
163
173
  OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
164
174
  z$1.object({
@@ -336,7 +346,8 @@ const standaloneEnvironmentSchema = z.object({
336
346
  const protectedWithoutDiscoveryEnvironmentSchema = z.object({
337
347
  allowsAnonymous: z.literal(false),
338
348
  oAuthMetadata: z.strictObject({}),
339
- scope: z.string().optional()
349
+ scope: z.string().optional(),
350
+ wwwAuthenticate: z.string().optional()
340
351
  });
341
352
  const legacyPublicEnvironmentSchema = z.object({
342
353
  isPublic: z.literal(true),
@@ -420,7 +431,8 @@ z.object({
420
431
  collectResponsePayload: z.boolean(),
421
432
  collectErrorMessage: z.boolean(),
422
433
  collectUserData: z.boolean(),
423
- identityTraitKey: z.string().min(1).max(200).nullable()
434
+ identityTraitKey: z.string().min(1).max(200).nullable(),
435
+ leadEventName: z.string().min(1).max(200).nullable()
424
436
  });
425
437
  const feedbackSchema = z.object({
426
438
  id: z.string(),
@@ -539,6 +551,14 @@ z.enum([
539
551
  "DEBUG",
540
552
  "ERROR"
541
553
  ]);
554
+ const LOG_SEARCH_MAX_ESCAPED_LENGTH = 960;
555
+ function escapeLogSearchTerm(search) {
556
+ return [...search].flatMap((character) => [...new TextEncoder().encode(character)]).map((byte) => {
557
+ const character = String.fromCharCode(byte);
558
+ return /^[a-zA-Z0-9]$/.test(character) ? character : `\\x${byte.toString(16).toUpperCase().padStart(2, "0")}`;
559
+ }).join("");
560
+ }
561
+ const logSearchSchema = z.string().max(240, `Search must be 240 characters or fewer`).refine((search) => escapeLogSearchTerm(search).length <= LOG_SEARCH_MAX_ESCAPED_LENGTH, "Search is too complex; shorten it or use fewer special characters");
542
562
  /** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
543
563
  const MCP_CLIENT_GROUPS = [
544
564
  {
@@ -864,6 +884,10 @@ const clampStringField = (field) => {
864
884
  const withMin = field.minLength === null ? clamped : clamped.min(field.minLength);
865
885
  return field.description ? withMin.describe(field.description) : withMin;
866
886
  };
887
+ const unboundedArrayField = (field) => {
888
+ const unbounded = z.array(field.element);
889
+ return field.description ? unbounded.describe(field.description) : unbounded;
890
+ };
867
891
  const toolDefinitionSchema = z.object({
868
892
  name: z.string(),
869
893
  title: z.string().optional().describe("Human-friendly name for the tool, used in the UI. If not provided, `name` will be used."),
@@ -876,11 +900,22 @@ const toolDefinitionSchema = z.object({
876
900
  }).optional()
877
901
  });
878
902
  const positiveTestCaseSchema = z.object({
879
- scenario: z.string().describe("Short label for what this case demonstrates."),
880
- 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."),
903
+ scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
904
+ 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."),
881
905
  toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
882
906
  expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
883
- }).partial().describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
907
+ }).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
908
+ const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial().extend({
909
+ scenario: z.string().optional(),
910
+ userPrompt: z.string().optional()
911
+ });
912
+ const blankPositiveTestCase = () => ({
913
+ scenario: "",
914
+ userPrompt: "",
915
+ toolTriggered: "",
916
+ expectedOutput: ""
917
+ });
918
+ const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
884
919
  const screenshotEntrySchema = z.object({
885
920
  prompt: z.string(),
886
921
  url: z.url()
@@ -1193,9 +1228,18 @@ const chatgptTranslationLocaleSchema = z.enum([
1193
1228
  "zh-TW"
1194
1229
  ]);
1195
1230
  const negativeTestCaseSchema = z.object({
1196
- scenario: z.string(),
1197
- userPrompt: z.string()
1198
- }).partial().describe("Each case: Scenario + User prompt (the app should NOT trigger).");
1231
+ scenario: z.string().min(1),
1232
+ userPrompt: z.string().min(1)
1233
+ }).describe("Each case: Scenario + User prompt (the plugin should NOT trigger).");
1234
+ const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial().extend({
1235
+ scenario: z.string().optional(),
1236
+ userPrompt: z.string().optional()
1237
+ });
1238
+ const blankNegativeTestCase = () => ({
1239
+ scenario: "",
1240
+ userPrompt: ""
1241
+ });
1242
+ const chatgptSkillSchema = z.object({ name: z.string() }).describe("A skill discovered on the MCP server, by name.");
1199
1243
  const chatgptToolJustificationSchema = z.object({
1200
1244
  toolName: z.string(),
1201
1245
  readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
@@ -1215,27 +1259,28 @@ chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema
1215
1259
  const chatgptSubmissionFormDataSchema = z.object({
1216
1260
  logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
1217
1261
  logoDark: z.string().optional().describe("Optional dark-mode logo icon. Square PNG, same specs as the light icon. Leave empty if the light icon also works on dark backgrounds."),
1218
- appName: z.string().describe("The name users will see in ChatGPT and in the Apps Directory."),
1262
+ appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
1219
1263
  tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
1220
- description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the app does and why people will love it. Appears publicly on the directory page. End it by naming the product categories or intents the app does NOT cover, so ChatGPT learns when not to route to it (define exclusions by absent categories or wrong intents, never by naming other brands)."),
1264
+ description: chatgptDescriptionSchema.describe("Clear, engaging description highlighting what the plugin does and why people will love it. Appears publicly on the directory page. End it by naming the product categories or intents the plugin does NOT cover, so ChatGPT learns when not to route to it (define exclusions by absent categories or wrong intents, never by naming other brands)."),
1221
1265
  category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
1222
- developerName: z.string().describe("Developer name shown publicly on the app's directory page."),
1266
+ developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
1223
1267
  companyUrl: urlField.describe("Your company's main website URL."),
1224
1268
  supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
1225
1269
  privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
1226
- termsOfServiceUrl: urlField.describe("URL to the app's terms of service."),
1227
- demoRecordingUrl: urlField.describe("URL to a video demonstrating the app, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
1228
- appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My app links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the app does not offer digital goods."),
1270
+ termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
1271
+ demoRecordingUrl: urlField.describe("URL to a video demonstrating the plugin, recorded via OpenAI Developer Mode. Cover all main use cases on web, iOS, and Android."),
1272
+ appCommerceAndPurchasing: z.boolean().describe("Checkbox: 'My plugin links or directs users out of ChatGPT to make purchases.' Defaults to false. Verify the plugin does not offer digital goods."),
1229
1273
  serverUrl: urlField.describe("URL of the MCP server."),
1230
1274
  authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
1231
1275
  tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
1232
1276
  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."),
1233
- testCases: z.array(positiveTestCaseSchema).describe("At least 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."),
1234
- 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."),
1235
- 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."),
1277
+ skills: z.array(chatgptSkillSchema).optional().describe("Skills the server exposes over MCP (auto-populated from the production server's manifest). Left unset when the server does not advertise the skills extension, which is a different state from advertising it and exposing none."),
1278
+ 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."),
1279
+ negativeTestCases: z.array(negativeTestCaseSchema).length(3).describe("Exactly 3 negative test cases: prompts where the plugin 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 plugin does not carry, the right brand or domain but an intent the plugin does not serve, or a boundary with a sibling plugin."),
1280
+ screenshots: z.array(screenshotEntrySchema.extend({ prompt: z.string().max(75, { error: "Screenshot prompts are limited to 75 characters." }) })).max(3).describe("In-plugin screenshots paired with the user prompt that produced them (each prompt is 75 characters max). Widget plugins must show the widget UI; non-widget plugins show the model response. Min 1, max 3 entries, all public. Images: 706px wide, 400–860px tall, PNG."),
1236
1281
  translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
1237
1282
  allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
1238
- releaseNotes: z.string().describe("Publicly displayed on the app details page.")
1283
+ releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
1239
1284
  });
1240
1285
  const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
1241
1286
  tagline: z.string().optional(),
@@ -1246,23 +1291,35 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
1246
1291
  demoRecordingUrl: z.string().optional(),
1247
1292
  serverUrl: z.string().optional(),
1248
1293
  screenshots: z.array(screenshotDraftEntrySchema).optional(),
1294
+ testCases: z.array(positiveTestCaseDraftSchema).optional(),
1295
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
1249
1296
  translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
1250
1297
  });
1251
- chatgptSubmissionFormDataSchema.pick({
1298
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
1299
+ const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1252
1300
  appName: true,
1253
1301
  developerName: true,
1254
1302
  serverUrl: true,
1255
1303
  tools: true,
1304
+ skills: true,
1256
1305
  authentication: true
1257
1306
  });
1258
- chatgptSubmissionFormDataSchema.pick({
1307
+ /** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
1308
+ const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1259
1309
  tagline: true,
1260
1310
  description: true,
1261
1311
  category: true,
1262
1312
  testCases: true,
1263
1313
  negativeTestCases: true,
1264
1314
  toolJustifications: true
1265
- }).extend({ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline) });
1315
+ }).extend({
1316
+ testCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.testCases),
1317
+ negativeTestCases: unboundedArrayField(chatgptSubmissionFormDataSchema.shape.negativeTestCases)
1318
+ }).extend({
1319
+ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
1320
+ testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
1321
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
1322
+ });
1266
1323
  const claudeCategorySchema = z.enum([
1267
1324
  "Productivity",
1268
1325
  "Communication",
@@ -1385,7 +1442,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
1385
1442
  categories: z.array(claudeCategorySchema).optional(),
1386
1443
  screenshots: z.array(screenshotDraftEntrySchema).optional()
1387
1444
  });
1388
- claudeSubmissionFormDataSchema.pick({
1445
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
1446
+ const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
1389
1447
  serverUrl: true,
1390
1448
  name: true,
1391
1449
  slug: true,
@@ -1407,27 +1465,81 @@ const claudeAiGeneratedFormDataRawSchema = z.object({
1407
1465
  categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
1408
1466
  primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
1409
1467
  });
1410
- claudeAiGeneratedFormDataRawSchema.extend({
1468
+ const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
1411
1469
  oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
1412
1470
  categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
1413
1471
  });
1472
+ function provenanceByField(prefillShape, aiGeneratedShape) {
1473
+ const byField = {};
1474
+ for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
1475
+ for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
1476
+ return byField;
1477
+ }
1478
+ provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
1479
+ const urlVerificationOutcomeSchema = z.enum([
1480
+ "pass",
1481
+ "fail",
1482
+ "unverified"
1483
+ ]);
1484
+ const VERIFIABLE_URL_FIELDS = {
1485
+ chatgpt: ["privacyPolicyUrl", "termsOfServiceUrl"],
1486
+ claudeai: ["privacyPolicy"]
1487
+ };
1488
+ const verifiableUrlFieldSchema = z.enum([...VERIFIABLE_URL_FIELDS.chatgpt, ...VERIFIABLE_URL_FIELDS.claudeai]);
1489
+ const policyDisclosureSchema = z.enum([
1490
+ "dataCategories",
1491
+ "purposesOfUse",
1492
+ "recipients",
1493
+ "retention"
1494
+ ]);
1495
+ const urlVerificationFieldResultSchema = z.object({
1496
+ field: verifiableUrlFieldSchema,
1497
+ url: z.string(),
1498
+ outcome: urlVerificationOutcomeSchema,
1499
+ reason: z.string(),
1500
+ concerns: z.array(z.string()).optional(),
1501
+ scrapedWith: z.enum(["fetch", "firecrawl"]).optional()
1502
+ });
1503
+ const urlVerificationSchema = z.object({
1504
+ verifiedAt: z.coerce.date(),
1505
+ results: z.array(urlVerificationFieldResultSchema)
1506
+ });
1507
+ const pageKindSchema = z.enum([
1508
+ "expectedDocument",
1509
+ "errorPage",
1510
+ "loginWall",
1511
+ "parkedDomain",
1512
+ "comingSoon",
1513
+ "marketingPage",
1514
+ "unrelatedDocument"
1515
+ ]);
1516
+ z.object({
1517
+ pageKind: pageKindSchema.describe("What the page actually is. Use 'expectedDocument' only when it is genuinely the document the field claims."),
1518
+ reason: z.string().max(200).describe("One sentence naming what the page is, addressed to the developer who entered the URL."),
1519
+ 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.")
1520
+ });
1414
1521
  const submissionMetaFieldsSchema = z.object({
1415
1522
  id: z.string(),
1416
1523
  environmentId: z.string(),
1417
1524
  auditId: z.string().nullable(),
1525
+ urlVerification: urlVerificationSchema.nullable().default(null),
1418
1526
  createdAt: z.coerce.date(),
1419
1527
  updatedAt: z.coerce.date()
1420
1528
  });
1421
1529
  const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1422
1530
  platform: z.literal("claudeai"),
1423
- formData: claudeSubmissionDraftSchema
1531
+ formData: claudeSubmissionDraftSchema,
1532
+ prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
1424
1533
  });
1425
1534
  const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1426
1535
  platform: z.literal("chatgpt"),
1427
- formData: chatgptSubmissionDraftSchema
1536
+ formData: chatgptSubmissionDraftSchema,
1537
+ prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
1428
1538
  });
1429
- z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1539
+ const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1430
1540
  z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
1541
+ /** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
1542
+ const submissionSchema = submissionSchemaInternal;
1431
1543
  z.literal([
1432
1544
  100,
1433
1545
  75,
@@ -1455,6 +1567,7 @@ const metricsQueueEventSchema = z.object({
1455
1567
  tool: z.string().nullable(),
1456
1568
  client: z.string(),
1457
1569
  sessionId: z.string().nullable(),
1570
+ conversationId: z.string().nullable().optional(),
1458
1571
  durationMs: z.number().int(),
1459
1572
  outputTokens: z.number().int().nullable(),
1460
1573
  errorType: z.enum([
@@ -1506,7 +1619,8 @@ z.object({
1506
1619
  protocol: otlpProtocolSchema,
1507
1620
  headers: z.array(telemetryDestinationHeaderSchema),
1508
1621
  status: telemetryDestinationStatusSchema,
1509
- lastFailureReason: otlpPushFailureReasonSchema.nullable()
1622
+ lastFailureReason: otlpPushFailureReasonSchema.nullable(),
1623
+ isScopedToIntentionalRequestsOnly: z.boolean()
1510
1624
  });
1511
1625
  //#endregion
1512
1626
  //#region src/auth-scope.ts
@@ -1941,7 +2055,7 @@ const getLogsContractV1 = base.route({
1941
2055
  "WARNING",
1942
2056
  "DEBUG"
1943
2057
  ])).optional().describe("Filter by log level"),
1944
- search: z.string().optional().describe("Filter pattern to search for in log content"),
2058
+ search: logSearchSchema.optional().describe("Term to search for in log content"),
1945
2059
  nextToken: z.string().optional().describe("Pagination token from a previous response")
1946
2060
  })).output(z.object({
1947
2061
  logs: z.array(logEntrySchema),
@@ -1963,7 +2077,7 @@ const getLatestLogsContractV1 = base.route({
1963
2077
  "WARNING",
1964
2078
  "DEBUG"
1965
2079
  ])).optional().describe("Filter by log level"),
1966
- search: z.string().optional().describe("Filter pattern to search for in log content")
2080
+ search: logSearchSchema.optional().describe("Term to search for in log content")
1967
2081
  })).output(z.object({ logs: z.array(logEntrySchema) }));
1968
2082
  const getDeploymentLogsContractV1 = base.route({
1969
2083
  path: "/v1/deployments/{deploymentId}/logs",
@@ -2274,6 +2388,57 @@ const getBeaconContractV1 = base.route({
2274
2388
  createdAt: z.coerce.date(),
2275
2389
  report: auditReportWithScreenshotsSchema.nullable()
2276
2390
  }));
2391
+ const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
2392
+ const submissionIdSchema = z.string().describe("The ID of the submission package");
2393
+ const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
2394
+ const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
2395
+ const createSubmissionContractV1 = base.route({
2396
+ path: "/v1/submissions",
2397
+ method: "POST",
2398
+ summary: "Create a submission package",
2399
+ 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.",
2400
+ tags: ["submissions"],
2401
+ successDescription: "The created submission package, with its prefilled fields"
2402
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2403
+ environmentId: z.string().describe("The ID of the environment to build the package from"),
2404
+ platform: platformSchema.describe(PLATFORM_DESCRIPTION)
2405
+ })).output(submissionSchema);
2406
+ const listSubmissionsContractV1 = base.route({
2407
+ path: "/v1/projects/{projectId}/submissions",
2408
+ method: "GET",
2409
+ summary: "List submission packages",
2410
+ description: "List the submission packages of a project, grouped by directory and most recently updated first, optionally narrowed to one environment or one directory",
2411
+ tags: ["submissions"],
2412
+ successDescription: "The list of submission packages"
2413
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2414
+ projectId: z.string().describe("The ID of the project"),
2415
+ environmentId: z.string().optional().describe("Filter by environment ID"),
2416
+ platform: platformSchema.optional().describe(PLATFORM_DESCRIPTION)
2417
+ })).output(z.array(submissionSchema));
2418
+ const getSubmissionContractV1 = base.route({
2419
+ path: "/v1/submissions/{submissionId}",
2420
+ method: "GET",
2421
+ summary: "Get a submission package",
2422
+ description: "Get a submission package by ID, including its form data and the prefill it started from",
2423
+ tags: ["submissions"],
2424
+ successDescription: "The submission package"
2425
+ }).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
2426
+ const updateSubmissionContractV1 = base.route({
2427
+ path: "/v1/submissions/{submissionId}",
2428
+ method: "PUT",
2429
+ summary: "Update a submission package",
2430
+ 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.",
2431
+ tags: ["submissions"],
2432
+ successDescription: "The updated submission package"
2433
+ }).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
2434
+ submissionId: submissionIdSchema,
2435
+ platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
2436
+ formData: claudeSubmissionUpdateSchema
2437
+ }), z.object({
2438
+ submissionId: submissionIdSchema,
2439
+ platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
2440
+ formData: chatgptSubmissionUpdateSchema
2441
+ })])).output(submissionSchema);
2277
2442
  const contract = {
2278
2443
  teams: {
2279
2444
  list: { v1: listTeamsContractV1 },
@@ -2329,6 +2494,12 @@ const contract = {
2329
2494
  beacon: {
2330
2495
  create: { v1: createBeaconContractV1 },
2331
2496
  get: { v1: getBeaconContractV1 }
2497
+ },
2498
+ submissions: {
2499
+ create: { v1: createSubmissionContractV1 },
2500
+ list: { v1: listSubmissionsContractV1 },
2501
+ get: { v1: getSubmissionContractV1 },
2502
+ update: { v1: updateSubmissionContractV1 }
2332
2503
  }
2333
2504
  };
2334
2505
  const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
@@ -2336,5 +2507,26 @@ const contractForDocs = {
2336
2507
  ...contract,
2337
2508
  deployments: deploymentsForDocs
2338
2509
  };
2510
+ /** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
2511
+ const OPENAPI_DOC_OPTIONS = {
2512
+ info: {
2513
+ title: "Alpic API",
2514
+ version: "1.0.0"
2515
+ },
2516
+ servers: [{ url: "https://api.alpic.ai" }],
2517
+ security: [{ bearerAuth: [] }],
2518
+ components: { securitySchemes: { bearerAuth: {
2519
+ type: "http",
2520
+ description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
2521
+ scheme: "bearer"
2522
+ } } },
2523
+ commonSchemas: {
2524
+ Submission: { schema: submissionSchema },
2525
+ ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
2526
+ ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
2527
+ ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
2528
+ ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
2529
+ }
2530
+ };
2339
2531
  //#endregion
2340
- export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, INTENT_CATEGORY_COLORS, PLATFORM_LABELS, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
2532
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/api",
3
- "version": "0.0.0-dev.gede1d99",
3
+ "version": "0.0.0-dev.gedf37b2",
4
4
  "description": "Contract for the Alpic API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -33,20 +33,20 @@
33
33
  "author": "Alpic",
34
34
  "license": "ISC",
35
35
  "dependencies": {
36
- "@orpc/contract": "^1.15.0",
36
+ "@orpc/contract": "^1.15.4",
37
37
  "ms": "^2.1.3",
38
38
  "zod": "^4.5.4"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@alpic-ai/domains": "0.0.0",
42
- "@orpc/openapi": "^1.15.0",
43
- "@orpc/zod": "^1.15.0",
42
+ "@orpc/openapi": "^1.15.4",
43
+ "@orpc/zod": "^1.15.4",
44
44
  "@total-typescript/tsconfig": "^1.0.4",
45
45
  "@types/ms": "^2.1.0",
46
46
  "shx": "^0.4.0",
47
- "tsdown": "^0.22.14",
47
+ "tsdown": "^0.23.0",
48
48
  "typescript": "^6.0.3",
49
- "vitest": "^4.1.11"
49
+ "vitest": "^5.0.3"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "shx rm -rf dist && tsdown",