@alpic-ai/api 0.0.0-dev.ge3de960 → 0.0.0-dev.ge43674b

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.
Files changed (2) hide show
  1. package/dist/index.mjs +46 -15
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -876,11 +876,19 @@ const toolDefinitionSchema = z.object({
876
876
  }).optional()
877
877
  });
878
878
  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."),
879
+ scenario: z.string().min(1).describe("Short label for what this case demonstrates."),
880
+ 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
881
  toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
882
882
  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.");
883
+ }).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
884
+ const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial();
885
+ const blankPositiveTestCase = () => ({
886
+ scenario: "",
887
+ userPrompt: "",
888
+ toolTriggered: "",
889
+ expectedOutput: ""
890
+ });
891
+ const toFixedLength = (entries, length, blank) => Array.from({ length }, (_, index) => entries[index] ?? blank());
884
892
  const screenshotEntrySchema = z.object({
885
893
  prompt: z.string(),
886
894
  url: z.url()
@@ -1193,9 +1201,14 @@ const chatgptTranslationLocaleSchema = z.enum([
1193
1201
  "zh-TW"
1194
1202
  ]);
1195
1203
  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).");
1204
+ scenario: z.string().min(1),
1205
+ userPrompt: z.string().min(1)
1206
+ }).describe("Each case: Scenario + User prompt (the app should NOT trigger).");
1207
+ const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial();
1208
+ const blankNegativeTestCase = () => ({
1209
+ scenario: "",
1210
+ userPrompt: ""
1211
+ });
1199
1212
  const chatgptToolJustificationSchema = z.object({
1200
1213
  toolName: z.string(),
1201
1214
  readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
@@ -1230,8 +1243,8 @@ const chatgptSubmissionFormDataSchema = z.object({
1230
1243
  authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
1231
1244
  tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
1232
1245
  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."),
1246
+ 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."),
1247
+ 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."),
1235
1248
  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."),
1236
1249
  translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
1237
1250
  allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
@@ -1246,23 +1259,31 @@ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().e
1246
1259
  demoRecordingUrl: z.string().optional(),
1247
1260
  serverUrl: z.string().optional(),
1248
1261
  screenshots: z.array(screenshotDraftEntrySchema).optional(),
1262
+ testCases: z.array(positiveTestCaseDraftSchema).optional(),
1263
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).optional(),
1249
1264
  translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
1250
1265
  });
1251
- chatgptSubmissionFormDataSchema.pick({
1266
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "chatgpt" })` can populate. */
1267
+ const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1252
1268
  appName: true,
1253
1269
  developerName: true,
1254
1270
  serverUrl: true,
1255
1271
  tools: true,
1256
1272
  authentication: true
1257
1273
  });
1258
- chatgptSubmissionFormDataSchema.pick({
1274
+ /** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
1275
+ const chatgptAiGeneratedFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1259
1276
  tagline: true,
1260
1277
  description: true,
1261
1278
  category: true,
1262
1279
  testCases: true,
1263
1280
  negativeTestCases: true,
1264
1281
  toolJustifications: true
1265
- }).extend({ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline) });
1282
+ }).extend({
1283
+ tagline: clampStringField(chatgptSubmissionFormDataSchema.shape.tagline),
1284
+ testCases: z.array(positiveTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 5, blankPositiveTestCase)),
1285
+ negativeTestCases: z.array(negativeTestCaseDraftSchema).transform((cases) => toFixedLength(cases, 3, blankNegativeTestCase))
1286
+ });
1266
1287
  const claudeCategorySchema = z.enum([
1267
1288
  "Productivity",
1268
1289
  "Communication",
@@ -1385,7 +1406,8 @@ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().ext
1385
1406
  categories: z.array(claudeCategorySchema).optional(),
1386
1407
  screenshots: z.array(screenshotDraftEntrySchema).optional()
1387
1408
  });
1388
- claudeSubmissionFormDataSchema.pick({
1409
+ /** Source of truth for the fields `SubmissionPrefillService.prefill({ platform: "claudeai" })` can populate. */
1410
+ const claudePrefillFormDataSchema = claudeSubmissionFormDataSchema.pick({
1389
1411
  serverUrl: true,
1390
1412
  name: true,
1391
1413
  slug: true,
@@ -1407,10 +1429,17 @@ const claudeAiGeneratedFormDataRawSchema = z.object({
1407
1429
  categories: z.array(claudeCategorySchema).describe(claudeCategoryDescription),
1408
1430
  primaryUseCases: claudeSubmissionFormDataSchema.shape.primaryUseCases
1409
1431
  });
1410
- claudeAiGeneratedFormDataRawSchema.extend({
1432
+ const claudeAiGeneratedFormDataSchema = claudeAiGeneratedFormDataRawSchema.extend({
1411
1433
  oneLiner: clampStringField(claudeSubmissionFormDataSchema.shape.oneLiner),
1412
1434
  categories: claudeAiGeneratedFormDataRawSchema.shape.categories.transform((categories) => categories.slice(0, 5))
1413
1435
  });
1436
+ function provenanceByField(prefillShape, aiGeneratedShape) {
1437
+ const byField = {};
1438
+ for (const field of Object.keys(prefillShape)) byField[field] = "prefilled";
1439
+ for (const field of Object.keys(aiGeneratedShape)) byField[field] = "ai-generated";
1440
+ return byField;
1441
+ }
1442
+ provenanceByField(claudePrefillFormDataSchema.shape, claudeAiGeneratedFormDataSchema.shape), provenanceByField(chatgptPrefillFormDataSchema.shape, chatgptAiGeneratedFormDataSchema.shape);
1414
1443
  const submissionMetaFieldsSchema = z.object({
1415
1444
  id: z.string(),
1416
1445
  environmentId: z.string(),
@@ -1420,11 +1449,13 @@ const submissionMetaFieldsSchema = z.object({
1420
1449
  });
1421
1450
  const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1422
1451
  platform: z.literal("claudeai"),
1423
- formData: claudeSubmissionDraftSchema
1452
+ formData: claudeSubmissionDraftSchema,
1453
+ prefillSnapshot: claudeSubmissionDraftSchema.nullable().default(null)
1424
1454
  });
1425
1455
  const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1426
1456
  platform: z.literal("chatgpt"),
1427
- formData: chatgptSubmissionDraftSchema
1457
+ formData: chatgptSubmissionDraftSchema,
1458
+ prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
1428
1459
  });
1429
1460
  z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1430
1461
  z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/api",
3
- "version": "0.0.0-dev.ge3de960",
3
+ "version": "0.0.0-dev.ge43674b",
4
4
  "description": "Contract for the Alpic API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",