@alpic-ai/api 0.0.0-dev.gda78171 → 0.0.0-dev.gda9e2fe

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({
@@ -420,7 +430,8 @@ z.object({
420
430
  collectResponsePayload: z.boolean(),
421
431
  collectErrorMessage: z.boolean(),
422
432
  collectUserData: z.boolean(),
423
- identityTraitKey: z.string().min(1).max(200).nullable()
433
+ identityTraitKey: z.string().min(1).max(200).nullable(),
434
+ leadEventName: z.string().min(1).max(200).nullable()
424
435
  });
425
436
  const feedbackSchema = z.object({
426
437
  id: z.string(),
@@ -539,6 +550,14 @@ z.enum([
539
550
  "DEBUG",
540
551
  "ERROR"
541
552
  ]);
553
+ const LOG_SEARCH_MAX_ESCAPED_LENGTH = 960;
554
+ function escapeLogSearchTerm(search) {
555
+ return [...search].flatMap((character) => [...new TextEncoder().encode(character)]).map((byte) => {
556
+ const character = String.fromCharCode(byte);
557
+ return /^[a-zA-Z0-9]$/.test(character) ? character : `\\x${byte.toString(16).toUpperCase().padStart(2, "0")}`;
558
+ }).join("");
559
+ }
560
+ 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
561
  /** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
543
562
  const MCP_CLIENT_GROUPS = [
544
563
  {
@@ -885,7 +904,10 @@ const positiveTestCaseSchema = z.object({
885
904
  toolTriggered: z.string().optional().describe("The tool this prompt should invoke."),
886
905
  expectedOutput: z.string().optional().describe("What the user should see, including post-interaction behaviour where relevant.")
887
906
  }).describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
888
- const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial();
907
+ const positiveTestCaseDraftSchema = positiveTestCaseSchema.partial().extend({
908
+ scenario: z.string().optional(),
909
+ userPrompt: z.string().optional()
910
+ });
889
911
  const blankPositiveTestCase = () => ({
890
912
  scenario: "",
891
913
  userPrompt: "",
@@ -1207,12 +1229,16 @@ const chatgptTranslationLocaleSchema = z.enum([
1207
1229
  const negativeTestCaseSchema = z.object({
1208
1230
  scenario: z.string().min(1),
1209
1231
  userPrompt: z.string().min(1)
1210
- }).describe("Each case: Scenario + User prompt (the app should NOT trigger).");
1211
- const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial();
1232
+ }).describe("Each case: Scenario + User prompt (the plugin should NOT trigger).");
1233
+ const negativeTestCaseDraftSchema = negativeTestCaseSchema.partial().extend({
1234
+ scenario: z.string().optional(),
1235
+ userPrompt: z.string().optional()
1236
+ });
1212
1237
  const blankNegativeTestCase = () => ({
1213
1238
  scenario: "",
1214
1239
  userPrompt: ""
1215
1240
  });
1241
+ const chatgptSkillSchema = z.object({ name: z.string() }).describe("A skill discovered on the MCP server, by name.");
1216
1242
  const chatgptToolJustificationSchema = z.object({
1217
1243
  toolName: z.string(),
1218
1244
  readOnlyJustification: z.string().describe("One sentence on what the tool reads and returns."),
@@ -1232,27 +1258,28 @@ chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema
1232
1258
  const chatgptSubmissionFormDataSchema = z.object({
1233
1259
  logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
1234
1260
  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."),
1235
- appName: z.string().describe("The name users will see in ChatGPT and in the Apps Directory."),
1261
+ appName: z.string().describe("The name users will see in ChatGPT and in the Plugin Directory."),
1236
1262
  tagline: chatgptTaglineSchema.describe("Plain-language phrase focused on function and user value, 30 chars max. Avoid generic superlatives like \"the best …\"."),
1237
- 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)."),
1263
+ 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)."),
1238
1264
  category: chatgptCategorySchema.describe("Category from the OpenAI taxonomy."),
1239
- developerName: z.string().describe("Developer name shown publicly on the app's directory page."),
1265
+ developerName: z.string().describe("Developer name shown publicly on the plugin's directory page."),
1240
1266
  companyUrl: urlField.describe("Your company's main website URL."),
1241
1267
  supportChannel: supportChannelSchema.describe("Customer support URL or email address."),
1242
1268
  privacyPolicyUrl: urlField.describe("URL to your privacy policy."),
1243
- termsOfServiceUrl: urlField.describe("URL to the app's terms of service."),
1244
- 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."),
1245
- 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."),
1269
+ termsOfServiceUrl: urlField.describe("URL to the plugin's terms of service."),
1270
+ 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."),
1271
+ 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."),
1246
1272
  serverUrl: urlField.describe("URL of the MCP server."),
1247
1273
  authentication: chatgptAuthenticationSchema.describe("OAuth 2.0 or No auth. OAuth configuration is auto-discovered from the MCP server's metadata."),
1248
1274
  tools: z.array(toolDefinitionSchema).describe("List of tools exposed by the MCP server (auto-populated from the production server's manifest)."),
1249
1275
  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."),
1276
+ 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."),
1250
1277
  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."),
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."),
1278
+ 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."),
1279
+ 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."),
1253
1280
  translations: z.array(chatgptTranslationSchema).describe("Per-locale translation of tagline + description. English (US) is the default."),
1254
1281
  allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
1255
- releaseNotes: z.string().describe("Publicly displayed on the app details page.")
1282
+ releaseNotes: z.string().describe("Publicly displayed on the plugin details page.")
1256
1283
  });
1257
1284
  const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
1258
1285
  tagline: z.string().optional(),
@@ -1273,6 +1300,7 @@ const chatgptPrefillFormDataSchema = chatgptSubmissionFormDataSchema.pick({
1273
1300
  developerName: true,
1274
1301
  serverUrl: true,
1275
1302
  tools: true,
1303
+ skills: true,
1276
1304
  authentication: true
1277
1305
  });
1278
1306
  /** Source of truth for `SubmissionPrefillService.generate({ platform: "chatgpt" })`. */
@@ -1507,8 +1535,10 @@ const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1507
1535
  formData: chatgptSubmissionDraftSchema,
1508
1536
  prefillSnapshot: chatgptSubmissionDraftSchema.nullable().default(null)
1509
1537
  });
1510
- z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1538
+ const submissionSchemaInternal = z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1511
1539
  z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
1540
+ /** Discriminated on `platform`, which pins the shape of `formData`: a Claude submission cannot carry chatgpt-only fields, and vice-versa. */
1541
+ const submissionSchema = submissionSchemaInternal;
1512
1542
  z.literal([
1513
1543
  100,
1514
1544
  75,
@@ -2022,7 +2052,7 @@ const getLogsContractV1 = base.route({
2022
2052
  "WARNING",
2023
2053
  "DEBUG"
2024
2054
  ])).optional().describe("Filter by log level"),
2025
- search: z.string().optional().describe("Filter pattern to search for in log content"),
2055
+ search: logSearchSchema.optional().describe("Term to search for in log content"),
2026
2056
  nextToken: z.string().optional().describe("Pagination token from a previous response")
2027
2057
  })).output(z.object({
2028
2058
  logs: z.array(logEntrySchema),
@@ -2044,7 +2074,7 @@ const getLatestLogsContractV1 = base.route({
2044
2074
  "WARNING",
2045
2075
  "DEBUG"
2046
2076
  ])).optional().describe("Filter by log level"),
2047
- search: z.string().optional().describe("Filter pattern to search for in log content")
2077
+ search: logSearchSchema.optional().describe("Term to search for in log content")
2048
2078
  })).output(z.object({ logs: z.array(logEntrySchema) }));
2049
2079
  const getDeploymentLogsContractV1 = base.route({
2050
2080
  path: "/v1/deployments/{deploymentId}/logs",
@@ -2355,6 +2385,57 @@ const getBeaconContractV1 = base.route({
2355
2385
  createdAt: z.coerce.date(),
2356
2386
  report: auditReportWithScreenshotsSchema.nullable()
2357
2387
  }));
2388
+ const PLATFORM_DESCRIPTION = "The directory the package targets: `chatgpt` for the OpenAI App Directory, `claudeai` for the Anthropic MCP Directory";
2389
+ const submissionIdSchema = z.string().describe("The ID of the submission package");
2390
+ const claudeSubmissionUpdateSchema = claudeSubmissionDraftSchema.strict();
2391
+ const chatgptSubmissionUpdateSchema = chatgptSubmissionDraftSchema.strict();
2392
+ const createSubmissionContractV1 = base.route({
2393
+ path: "/v1/submissions",
2394
+ method: "POST",
2395
+ summary: "Create a submission package",
2396
+ 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.",
2397
+ tags: ["submissions"],
2398
+ successDescription: "The created submission package, with its prefilled fields"
2399
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2400
+ environmentId: z.string().describe("The ID of the environment to build the package from"),
2401
+ platform: platformSchema.describe(PLATFORM_DESCRIPTION)
2402
+ })).output(submissionSchema);
2403
+ const listSubmissionsContractV1 = base.route({
2404
+ path: "/v1/projects/{projectId}/submissions",
2405
+ method: "GET",
2406
+ summary: "List submission packages",
2407
+ description: "List the submission packages of a project, grouped by directory and most recently updated first, optionally narrowed to one environment or one directory",
2408
+ tags: ["submissions"],
2409
+ successDescription: "The list of submission packages"
2410
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2411
+ projectId: z.string().describe("The ID of the project"),
2412
+ environmentId: z.string().optional().describe("Filter by environment ID"),
2413
+ platform: platformSchema.optional().describe(PLATFORM_DESCRIPTION)
2414
+ })).output(z.array(submissionSchema));
2415
+ const getSubmissionContractV1 = base.route({
2416
+ path: "/v1/submissions/{submissionId}",
2417
+ method: "GET",
2418
+ summary: "Get a submission package",
2419
+ description: "Get a submission package by ID, including its form data and the prefill it started from",
2420
+ tags: ["submissions"],
2421
+ successDescription: "The submission package"
2422
+ }).errors({ NOT_FOUND: {} }).input(z.object({ submissionId: submissionIdSchema })).output(submissionSchema);
2423
+ const updateSubmissionContractV1 = base.route({
2424
+ path: "/v1/submissions/{submissionId}",
2425
+ method: "PUT",
2426
+ summary: "Update a submission package",
2427
+ 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.",
2428
+ tags: ["submissions"],
2429
+ successDescription: "The updated submission package"
2430
+ }).errors({ NOT_FOUND: {} }).input(z.discriminatedUnion("platform", [z.object({
2431
+ submissionId: submissionIdSchema,
2432
+ platform: z.literal("claudeai").describe(PLATFORM_DESCRIPTION),
2433
+ formData: claudeSubmissionUpdateSchema
2434
+ }), z.object({
2435
+ submissionId: submissionIdSchema,
2436
+ platform: z.literal("chatgpt").describe(PLATFORM_DESCRIPTION),
2437
+ formData: chatgptSubmissionUpdateSchema
2438
+ })])).output(submissionSchema);
2358
2439
  const contract = {
2359
2440
  teams: {
2360
2441
  list: { v1: listTeamsContractV1 },
@@ -2410,6 +2491,12 @@ const contract = {
2410
2491
  beacon: {
2411
2492
  create: { v1: createBeaconContractV1 },
2412
2493
  get: { v1: getBeaconContractV1 }
2494
+ },
2495
+ submissions: {
2496
+ create: { v1: createSubmissionContractV1 },
2497
+ list: { v1: listSubmissionsContractV1 },
2498
+ get: { v1: getSubmissionContractV1 },
2499
+ update: { v1: updateSubmissionContractV1 }
2413
2500
  }
2414
2501
  };
2415
2502
  const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
@@ -2417,5 +2504,26 @@ const contractForDocs = {
2417
2504
  ...contract,
2418
2505
  deployments: deploymentsForDocs
2419
2506
  };
2507
+ /** Shared by the served `openapi.json` and the snapshot test that guards it, so the two cannot drift. */
2508
+ const OPENAPI_DOC_OPTIONS = {
2509
+ info: {
2510
+ title: "Alpic API",
2511
+ version: "1.0.0"
2512
+ },
2513
+ servers: [{ url: "https://api.alpic.ai" }],
2514
+ security: [{ bearerAuth: [] }],
2515
+ components: { securitySchemes: { bearerAuth: {
2516
+ type: "http",
2517
+ description: "Bearer token for authentication. Use an API key from the API Keys page in team settings, or an OAuth access token.",
2518
+ scheme: "bearer"
2519
+ } } },
2520
+ commonSchemas: {
2521
+ Submission: { schema: submissionSchema },
2522
+ ClaudeSubmissionFormData: { schema: claudeSubmissionDraftSchema },
2523
+ ChatgptSubmissionFormData: { schema: chatgptSubmissionDraftSchema },
2524
+ ClaudeSubmissionFormDataUpdate: { schema: claudeSubmissionUpdateSchema },
2525
+ ChatgptSubmissionFormDataUpdate: { schema: chatgptSubmissionUpdateSchema }
2526
+ }
2527
+ };
2420
2528
  //#endregion
2421
- 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 };
2529
+ 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.gda78171",
3
+ "version": "0.0.0-dev.gda9e2fe",
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",