@alpic-ai/api 0.0.0-staging.g5fc2bcf → 0.0.0-staging.g601babe

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 (3) hide show
  1. package/dist/index.d.mts +1534 -59
  2. package/dist/index.mjs +606 -194
  3. package/package.json +24 -8
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.29.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
5
+ //#region ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_supports-color@7.2.0_zod@4.4.3/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js
6
6
  /**
7
7
  * Reusable URL validation that disallows javascript: scheme
8
8
  */
@@ -169,11 +169,22 @@ z$1.object({
169
169
  token: z$1.string(),
170
170
  token_type_hint: z$1.string().optional()
171
171
  }).strip();
172
- const platformSchema = z.enum(["chatgpt", "claudeai"]);
172
+ //#endregion
173
+ //#region ../domains/dist/index.mjs
174
+ const AI_PLATFORMS = ["chatgpt", "claudeai"];
175
+ const platformSchema = z.enum(AI_PLATFORMS);
173
176
  const PLATFORM_LABELS = {
174
177
  chatgpt: "ChatGPT",
175
178
  claudeai: "Claude.ai"
176
179
  };
180
+ const WAF_PLATFORMS = [
181
+ "akamai",
182
+ "cato",
183
+ "cloudflare",
184
+ "fastly"
185
+ ];
186
+ const ALLOWED_PLATFORMS = [...AI_PLATFORMS, ...WAF_PLATFORMS];
187
+ const allowedPlatformSchema = z.enum(ALLOWED_PLATFORMS);
177
188
  const auditStatusSchema = z.enum([
178
189
  "pending",
179
190
  "partial",
@@ -246,6 +257,16 @@ z.object({
246
257
  clientSecret: z.string(),
247
258
  clientScopes: z.array(z.string())
248
259
  });
260
+ z.enum([
261
+ "opening_balance",
262
+ "free_seed",
263
+ "paid_conversion_floor",
264
+ "top_up",
265
+ "usage",
266
+ "refund",
267
+ "admin_adjustment"
268
+ ]);
269
+ z.enum(["playground"]);
249
270
  const deploymentStatusSchema$1 = z.enum([
250
271
  "ongoing",
251
272
  "deployed",
@@ -273,34 +294,51 @@ const deploymentSummarySchema = z.object({
273
294
  createdAt: z.coerce.date(),
274
295
  updatedAt: z.coerce.date()
275
296
  });
276
- /**
277
- * Public environment
278
- *
279
- * No OAuth metadata exposed.
280
- */
297
+ /** Public environment: answers anonymously and exposes no OAuth metadata. */
281
298
  const publicEnvironmentSchema = z.object({
299
+ allowsAnonymous: z.literal(true),
300
+ oAuthMetadata: z.strictObject({})
301
+ });
302
+ /** Protected environment whose external resource metadata URL is returned in the WWW-Authenticate header on the first 401; everything after is handled outside the MCP server scope. */
303
+ const externalResourceMetadataEnvironmentSchema = z.object({
304
+ allowsAnonymous: z.boolean(),
305
+ oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
306
+ scope: z.string().optional()
307
+ });
308
+ /** Protected environment whose own /.well-known/oauth-protected-resource endpoint points at an external authorization server; everything after is handled outside the MCP server scope. */
309
+ const externalAuthorizationServerEnvironmentSchema = z.object({
310
+ allowsAnonymous: z.boolean(),
311
+ oAuthMetadata: z.object({
312
+ externalAuthorizationServerUrl: z.url(),
313
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
314
+ }),
315
+ scope: z.string().optional()
316
+ });
317
+ /** Standalone protected environment: the server itself exposes both the /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server endpoints. */
318
+ const standaloneEnvironmentSchema = z.object({
319
+ allowsAnonymous: z.boolean(),
320
+ oAuthMetadata: z.object({
321
+ authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
322
+ resourceMetadata: OAuthProtectedResourceMetadataSchema.optional()
323
+ }),
324
+ scope: z.string().optional()
325
+ });
326
+ /** Protected environment that enforces authentication but advertises no OAuth discovery metadata; clients must obtain credentials out-of-band. */
327
+ const protectedWithoutDiscoveryEnvironmentSchema = z.object({
328
+ allowsAnonymous: z.literal(false),
329
+ oAuthMetadata: z.strictObject({}),
330
+ scope: z.string().optional()
331
+ });
332
+ const legacyPublicEnvironmentSchema = z.object({
282
333
  isPublic: z.literal(true),
283
334
  oAuthMetadata: z.undefined().optional()
284
335
  });
285
- /**
286
- * Protected environment with an external resource metadata URL
287
- *
288
- * An external resource metadata URL is returned in the WWW-Authenticate header during the first 401 response.
289
- * Everything that follows is handled outside of the MCP server scope.
290
- */
291
- const externalResourceMetadataEnvironmentSchema = z.object({
336
+ const legacyExternalResourceMetadataEnvironmentSchema = z.object({
292
337
  isPublic: z.literal(false),
293
338
  oAuthMetadata: z.object({ externalResourceMetadataUrl: z.url() }),
294
339
  scope: z.string().optional()
295
340
  });
296
- /**
297
- * Protected environment with an external authorization server URL
298
- *
299
- * The server itself exposes the /.well-known/oauth-protected-resource endpoint.
300
- * An external authorization server URL is returned when requesting the endpoint.
301
- * Everything that follows is handled outside of the MCP server scope.
302
- */
303
- const externalAuthorizationServerEnvironmentSchema = z.object({
341
+ const legacyExternalAuthorizationServerEnvironmentSchema = z.object({
304
342
  isPublic: z.literal(false),
305
343
  oAuthMetadata: z.object({
306
344
  externalAuthorizationServerUrl: z.url(),
@@ -308,13 +346,7 @@ const externalAuthorizationServerEnvironmentSchema = z.object({
308
346
  }),
309
347
  scope: z.string().optional()
310
348
  });
311
- /**
312
- * Standalone protected environment
313
- *
314
- * The server itself exposes the /.well-known/oauth-protected-resource endpoint.
315
- * The server itself exposes the /.well-known/oauth-authorization-server endpoint.
316
- */
317
- const standaloneEnvironmentSchema = z.object({
349
+ const legacyStandaloneEnvironmentSchema = z.object({
318
350
  isPublic: z.literal(false),
319
351
  oAuthMetadata: z.object({
320
352
  authorizationServerMetadata: z.union([OAuthMetadataSchema, OpenIdProviderDiscoveryMetadataSchema]),
@@ -322,14 +354,7 @@ const standaloneEnvironmentSchema = z.object({
322
354
  }),
323
355
  scope: z.string().optional()
324
356
  });
325
- /**
326
- * Protected environment without OAuth discovery
327
- *
328
- * The server enforces authentication but exposes no OAuth discovery metadata.
329
- * Neither /.well-known/oauth-protected-resource nor /.well-known/oauth-authorization-server
330
- * are advertised. Clients must obtain credentials out-of-band.
331
- */
332
- const protectedWithoutDiscoveryEnvironmentSchema = z.object({
357
+ const legacyProtectedWithoutDiscoveryEnvironmentSchema = z.object({
333
358
  isPublic: z.literal(false),
334
359
  oAuthMetadata: z.strictObject({}),
335
360
  scope: z.string().optional()
@@ -339,9 +364,19 @@ z.union([
339
364
  externalResourceMetadataEnvironmentSchema,
340
365
  externalAuthorizationServerEnvironmentSchema,
341
366
  standaloneEnvironmentSchema,
342
- protectedWithoutDiscoveryEnvironmentSchema
367
+ protectedWithoutDiscoveryEnvironmentSchema,
368
+ legacyPublicEnvironmentSchema,
369
+ legacyExternalResourceMetadataEnvironmentSchema,
370
+ legacyExternalAuthorizationServerEnvironmentSchema,
371
+ legacyStandaloneEnvironmentSchema,
372
+ legacyProtectedWithoutDiscoveryEnvironmentSchema
373
+ ]);
374
+ const playgroundModelSchema = z.enum([
375
+ "global.anthropic.claude-haiku-4-5-20251001-v1:0",
376
+ "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
377
+ "openai.gpt-5.4",
378
+ "openai.gpt-5.5"
343
379
  ]);
344
- const allowedPlatformSchema = platformSchema;
345
380
  const environmentDomainSchema = z.object({
346
381
  name: z.string(),
347
382
  status: z.enum([
@@ -361,6 +396,7 @@ const environmentSchema$1 = z.object({
361
396
  latestDeployment: deploymentSummarySchema.optional(),
362
397
  openaiAppsChallenge: z.string().nullable().optional(),
363
398
  isPlaygroundEnabled: z.boolean(),
399
+ playgroundModel: playgroundModelSchema,
364
400
  isIpWhitelistEnabled: z.boolean(),
365
401
  ipAllowlist: z.array(z.string()).nullable(),
366
402
  allowedPlatforms: z.array(allowedPlatformSchema),
@@ -374,14 +410,16 @@ z.object({
374
410
  collectRequestPayload: z.boolean(),
375
411
  collectResponsePayload: z.boolean(),
376
412
  collectErrorMessage: z.boolean(),
377
- collectUserData: z.boolean()
413
+ collectUserData: z.boolean(),
414
+ identityTraitKey: z.string().min(1).max(200).nullable()
378
415
  });
379
- z.object({
416
+ const feedbackSchema = z.object({
380
417
  id: z.string(),
381
418
  createdAt: z.coerce.date(),
382
419
  environmentId: z.string(),
383
420
  content: z.string(),
384
- source: z.enum(["model", "user"])
421
+ source: z.enum(["model", "user"]),
422
+ clientName: z.string().nullable()
385
423
  });
386
424
  z.object({
387
425
  content: z.string(),
@@ -397,7 +435,7 @@ const intentCategoryColorSchema = z.enum([
397
435
  "pink",
398
436
  "gray"
399
437
  ]);
400
- intentCategoryColorSchema.options;
438
+ const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
401
439
  const intentCategorySchema = z.object({
402
440
  id: z.string(),
403
441
  createdAt: z.coerce.date(),
@@ -405,7 +443,7 @@ const intentCategorySchema = z.object({
405
443
  name: z.string(),
406
444
  color: intentCategoryColorSchema
407
445
  });
408
- z.object({
446
+ const intentCategorySummarySchema = z.object({
409
447
  id: z.string(),
410
448
  name: z.string(),
411
449
  color: intentCategoryColorSchema,
@@ -417,6 +455,7 @@ z.object({
417
455
  environmentId: z.string(),
418
456
  toolName: z.string(),
419
457
  message: z.string(),
458
+ clientName: z.string().nullable(),
420
459
  categories: z.array(intentCategorySchema)
421
460
  });
422
461
  const signalCategorySchema = z.object({
@@ -481,6 +520,246 @@ z.enum([
481
520
  "DEBUG",
482
521
  "ERROR"
483
522
  ]);
523
+ /** Only names a vendor actually ships belong here: lookalikes like `claude-code-test` are customers' own scripts. */
524
+ const MCP_CLIENT_GROUPS = [
525
+ {
526
+ id: "claude_code",
527
+ label: "Claude Code",
528
+ vendor: "anthropic",
529
+ rawNames: ["claude-code", "Anthropic/ClaudeCodeDesktop"]
530
+ },
531
+ {
532
+ id: "claude",
533
+ label: "Claude",
534
+ vendor: "anthropic",
535
+ rawNames: [
536
+ "Anthropic/ClaudeAI",
537
+ "claude-ai",
538
+ "claude",
539
+ "Claude",
540
+ "claude-desktop",
541
+ "claude-desktop-3p"
542
+ ]
543
+ },
544
+ {
545
+ id: "claude_mobile",
546
+ label: "Claude mobile",
547
+ vendor: "anthropic",
548
+ rawNames: ["claude-ios", "ClaudeAndroid"]
549
+ },
550
+ {
551
+ id: "claude_cowork",
552
+ label: "Claude Cowork",
553
+ vendor: "anthropic",
554
+ rawNames: ["Anthropic/Cowork"]
555
+ },
556
+ {
557
+ id: "claude_toolbox",
558
+ label: "Claude Toolbox",
559
+ vendor: "anthropic",
560
+ rawNames: ["Anthropic/Toolbox", "Anthropic/toolbox-bootstrap"]
561
+ },
562
+ {
563
+ id: "anthropic_api",
564
+ label: "Anthropic API",
565
+ vendor: "anthropic",
566
+ rawNames: ["Anthropic/API"]
567
+ },
568
+ {
569
+ id: "anthropic_connector_refresh",
570
+ label: "Anthropic (connector refresh)",
571
+ vendor: "anthropic",
572
+ rawNames: ["Anthropic"]
573
+ },
574
+ {
575
+ id: "codex",
576
+ label: "Codex",
577
+ vendor: "openai",
578
+ rawNames: [
579
+ "codex-mcp-client",
580
+ "codex",
581
+ "Codex",
582
+ "codex-cli",
583
+ "openai-mcp (Codex)"
584
+ ]
585
+ },
586
+ {
587
+ id: "chatgpt",
588
+ label: "ChatGPT",
589
+ vendor: "openai",
590
+ rawNames: ["openai-mcp (ChatGPT)"]
591
+ },
592
+ {
593
+ id: "openai_responses_api",
594
+ label: "OpenAI Responses API",
595
+ vendor: "openai",
596
+ rawNames: ["openai-mcp (Responses API)"]
597
+ },
598
+ {
599
+ id: "openai_agent_builder",
600
+ label: "OpenAI Agent Builder",
601
+ vendor: "openai",
602
+ rawNames: ["openai-mcp (Agent Builder)"]
603
+ },
604
+ {
605
+ id: "openai_other",
606
+ label: "OpenAI Other",
607
+ vendor: "openai",
608
+ rawNames: ["openai-mcp"]
609
+ },
610
+ {
611
+ id: "cursor",
612
+ label: "Cursor",
613
+ vendor: "cursor",
614
+ rawNames: [
615
+ "cursor-vscode",
616
+ "Cursor",
617
+ "cursor"
618
+ ]
619
+ },
620
+ {
621
+ id: "cline",
622
+ label: "Cline",
623
+ vendor: "cline",
624
+ rawNames: [
625
+ "Cline",
626
+ "cline",
627
+ "@cline/core"
628
+ ]
629
+ },
630
+ {
631
+ id: "github_copilot",
632
+ label: "GitHub Copilot",
633
+ vendor: "githubCopilot",
634
+ rawNames: [
635
+ "Copilot",
636
+ "github-copilot-developer",
637
+ "Copilot MCP Gateway",
638
+ "Xcode/copilot-xcode"
639
+ ]
640
+ },
641
+ {
642
+ id: "gemini_cli",
643
+ label: "Gemini CLI",
644
+ vendor: "google",
645
+ rawNames: ["gemini-cli-mcp-client", "gemini-cli"]
646
+ },
647
+ {
648
+ id: "antigravity",
649
+ label: "Antigravity",
650
+ vendor: "google",
651
+ rawNames: ["antigravity-client"]
652
+ },
653
+ {
654
+ id: "gemini",
655
+ label: "Gemini",
656
+ vendor: "google",
657
+ rawNames: ["Gemini", "google-ai-edge-gallery"]
658
+ },
659
+ {
660
+ id: "windsurf",
661
+ label: "Windsurf",
662
+ vendor: "windsurf",
663
+ rawNames: ["Windsurf", "windsurf-client"]
664
+ },
665
+ {
666
+ id: "mistral",
667
+ label: "Mistral / Le Chat",
668
+ vendor: "mistral",
669
+ rawNames: ["Mistral"],
670
+ rawNamePrefixes: ["connector:custom-mcp:"]
671
+ },
672
+ {
673
+ id: "n8n",
674
+ label: "n8n",
675
+ vendor: "n8n",
676
+ rawNames: [
677
+ "@n8n/n8n-nodes-langchain.mcpClient",
678
+ "@n8n/n8n-nodes-langchain.mcpClientTool",
679
+ "n8n"
680
+ ]
681
+ },
682
+ {
683
+ id: "alpic_playground",
684
+ label: "Alpic Playground",
685
+ vendor: "alpic",
686
+ rawNames: ["alpic-playground", "playground"]
687
+ },
688
+ {
689
+ id: "opencode",
690
+ label: "opencode",
691
+ vendor: "opencode",
692
+ rawNames: ["opencode"]
693
+ },
694
+ {
695
+ id: "zed",
696
+ label: "Zed",
697
+ vendor: "zed",
698
+ rawNames: ["Zed", "zed"]
699
+ },
700
+ {
701
+ id: "zapier",
702
+ label: "Zapier",
703
+ vendor: "zapier",
704
+ rawNames: ["Zapier", "zapier"]
705
+ },
706
+ {
707
+ id: "make",
708
+ label: "Make",
709
+ vendor: "make",
710
+ rawNames: ["Make", "make"]
711
+ },
712
+ {
713
+ id: "librechat",
714
+ label: "LibreChat",
715
+ vendor: "mcp",
716
+ rawNames: ["LibreChat", "librechat"]
717
+ },
718
+ {
719
+ id: "jan",
720
+ label: "Jan",
721
+ vendor: "mcp",
722
+ rawNames: ["Jan", "jan"]
723
+ },
724
+ {
725
+ id: "goose",
726
+ label: "goose",
727
+ vendor: "mcp",
728
+ rawNames: ["goose", "Goose"]
729
+ },
730
+ {
731
+ id: "mcphost",
732
+ label: "mcphost",
733
+ vendor: "mcp",
734
+ rawNames: ["mcphost"]
735
+ },
736
+ {
737
+ id: "mcporter",
738
+ label: "mcporter",
739
+ vendor: "mcp",
740
+ rawNames: ["mcporter"]
741
+ },
742
+ {
743
+ id: "rmcp",
744
+ label: "rmcp",
745
+ vendor: "mcp",
746
+ rawNames: ["rmcp"]
747
+ },
748
+ {
749
+ id: "unnamed_client",
750
+ label: "Unnamed client",
751
+ vendor: "mcp",
752
+ rawNames: [
753
+ "mcp",
754
+ "unknown",
755
+ ""
756
+ ]
757
+ }
758
+ ];
759
+ /** A source pattern, not a RegExp, because analytics renders the same rule into ClickHouse RE2, which shares this syntax. */
760
+ const MCP_REMOTE_WRAPPER_SUFFIX = String.raw` \(via mcp-remote [^\n]+?\)$`;
761
+ new RegExp(MCP_REMOTE_WRAPPER_SUFFIX);
762
+ new Map(MCP_CLIENT_GROUPS.map((group) => [group.id, group]));
484
763
  const runtimeSchema = z.enum([
485
764
  "python3.13",
486
765
  "python3.14",
@@ -509,6 +788,16 @@ z.object({
509
788
  environments: z.array(environmentWithDomainsSchema),
510
789
  productionEnvironment: environmentWithDomainsSchema.nullable()
511
790
  });
791
+ const domainFailureReasonSchema = z.enum([
792
+ "caa",
793
+ "dns",
794
+ "invalid_domain",
795
+ "other"
796
+ ]);
797
+ const projectDomainMappingSchema = z.object({
798
+ pathPrefix: z.string(),
799
+ environment: environmentSchema$1
800
+ });
512
801
  z.object({
513
802
  name: z.string(),
514
803
  createdAt: z.coerce.date(),
@@ -517,7 +806,9 @@ z.object({
517
806
  "deployed",
518
807
  "failed"
519
808
  ]),
520
- environment: environmentSchema$1
809
+ failureReason: domainFailureReasonSchema.nullable(),
810
+ environment: environmentSchema$1,
811
+ mappings: z.array(projectDomainMappingSchema)
521
812
  });
522
813
  const serverFieldsSchema$1 = z.object({
523
814
  $schema: z.string(),
@@ -546,15 +837,7 @@ z.object({
546
837
  serverFields: serverFieldsSchema$1,
547
838
  source: z.enum(["registry", "defaults"])
548
839
  });
549
- /**
550
- * Returns a variant of a `maxLength`-constrained string that clamps (truncates) instead of
551
- * rejecting on overflow — used for AI-generated copy where the model routinely overshoots.
552
- *
553
- * NOTE: this rebuilds the schema from scratch, carrying over only `maxLength` (as a clamp),
554
- * `minLength`, and the description. Any other validators on the source field (`.regex()`,
555
- * `.email()`, custom refinements) are intentionally dropped — this helper is meant for plain
556
- * free-text length caps only. A field with `null` `maxLength` is returned unchanged.
557
- */
840
+ /** Clamps instead of rejecting on max-length overflow (for AI-generated copy that overshoots); intentionally carries over only maxLength, minLength, and description, dropping any other validators. */
558
841
  const clampStringField = (field) => {
559
842
  const max = field.maxLength;
560
843
  if (max === null) return field;
@@ -581,8 +864,9 @@ const positiveTestCaseSchema = z.object({
581
864
  }).partial().describe("Each case: Scenario, User prompt, Tool triggered, Expected output.");
582
865
  const screenshotEntrySchema = z.object({
583
866
  prompt: z.string(),
584
- url: z.url().or(z.literal(""))
867
+ url: z.url()
585
868
  }).describe("Each screenshot: the user prompt that produced it + the image URL.");
869
+ const screenshotDraftEntrySchema = screenshotEntrySchema.extend({ url: z.string() });
586
870
  /** Accepts either a valid email or URL. */
587
871
  const supportChannelSchema = z.string().refine((value) => z.email().safeParse(value).success || z.url().safeParse(value).success, { error: "Must be a valid email or URL" });
588
872
  /** A URL field whose error spells out that the scheme is required. */
@@ -899,11 +1183,7 @@ const chatgptToolJustificationSchema = z.object({
899
1183
  openWorldJustification: z.string().describe("One sentence on whether the tool reaches external systems beyond your own service."),
900
1184
  destructiveJustification: z.string().describe("One sentence on whether the tool changes data. For a read-only tool, state the full triad: \"No data is created, modified, or deleted.\"")
901
1185
  }).describe("Per-tool justification of each MCP annotation value (one specific sentence per hint).");
902
- /**
903
- * Base copy fields, defined once and reused by both the submission form and per-locale
904
- * translations so the constraints (tagline ≤ 30 chars) never drift. The translation generation
905
- * path wraps these in {@link clampStringField} since the LLM tends to overshoot the limit.
906
- */
1186
+ /** Defined once and reused by both the submission form and per-locale translations so the tagline ≤ 30 chars constraint never drifts. */
907
1187
  const chatgptTaglineSchema = z.string().max(30);
908
1188
  const chatgptDescriptionSchema = z.string();
909
1189
  const chatgptTranslationSchema = z.object({
@@ -912,10 +1192,7 @@ const chatgptTranslationSchema = z.object({
912
1192
  description: chatgptDescriptionSchema
913
1193
  }).describe("Locale-scoped override for tagline + description. English (US) is the default.");
914
1194
  chatgptTranslationSchema.extend({ tagline: clampStringField(chatgptTaglineSchema) });
915
- /**
916
- * Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section.
917
- * When adding/removing/reordering fields, keep this in sync with the sheet.
918
- */
1195
+ /** Field order mirrors the ChatGPT (OpenAI) submission spreadsheet, grouped by section; keep it in sync with the sheet. */
919
1196
  const chatgptSubmissionFormDataSchema = z.object({
920
1197
  logoLight: z.string().describe("Logo icon for light mode. Square PNG, no borders or rounded corners (clients apply circular cropping)."),
921
1198
  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."),
@@ -941,6 +1218,17 @@ const chatgptSubmissionFormDataSchema = z.object({
941
1218
  allowedCountries: chatgptAllowedCountriesSchema.describe("Availability: all supported countries, or an allow-list / block-list of specific ones (ISO alpha-2)."),
942
1219
  releaseNotes: z.string().describe("Publicly displayed on the app details page.")
943
1220
  });
1221
+ const chatgptSubmissionDraftSchema = chatgptSubmissionFormDataSchema.partial().extend({
1222
+ tagline: z.string().optional(),
1223
+ companyUrl: z.string().optional(),
1224
+ supportChannel: z.string().optional(),
1225
+ privacyPolicyUrl: z.string().optional(),
1226
+ termsOfServiceUrl: z.string().optional(),
1227
+ demoRecordingUrl: z.string().optional(),
1228
+ serverUrl: z.string().optional(),
1229
+ screenshots: z.array(screenshotDraftEntrySchema).optional(),
1230
+ translations: z.array(chatgptTranslationSchema.extend({ tagline: z.string() })).optional()
1231
+ });
944
1232
  chatgptSubmissionFormDataSchema.pick({
945
1233
  appName: true,
946
1234
  developerName: true,
@@ -1001,11 +1289,7 @@ const claudePolicyAcknowledgementSchema = z.enum([
1001
1289
  "My connector does not collect conversation data beyond what is needed for its function.",
1002
1290
  "Public documentation for this connector will be live by the publish date."
1003
1291
  ]);
1004
- /**
1005
- * Field order mirrors the claude.ai directory submission wizard
1006
- * (`claude.ai/admin-settings/directory/submissions/new`), grouped by step.
1007
- * When adding/removing/reordering fields, keep this in sync with the wizard.
1008
- */
1292
+ /** Field order mirrors the claude.ai directory submission wizard (`claude.ai/admin-settings/directory/submissions/new`), grouped by step; keep it in sync with the wizard. */
1009
1293
  const claudeSubmissionFormDataSchema = z.object({
1010
1294
  serverUrl: z.url().describe(`The full https:// URL where your MCP server is hosted and reachable. In the claude.ai wizard this is read live
1011
1295
  from the custom connector you select — the connection is used to verify the URL and the tool list at submission time.
@@ -1067,6 +1351,21 @@ fully populated account.`),
1067
1351
  submission. Each is an attestation you are legally agreeing to by submitting.`),
1068
1352
  additionalNotes: z.string().optional().describe("Anything else the review team should know about your connector. Optional.")
1069
1353
  });
1354
+ const claudeSubmissionDraftSchema = claudeSubmissionFormDataSchema.partial().extend({
1355
+ serverUrl: z.string().optional(),
1356
+ name: z.string().optional(),
1357
+ slug: z.string().optional(),
1358
+ oneLiner: z.string().optional(),
1359
+ description: z.string().optional(),
1360
+ iconUrl: z.string().optional(),
1361
+ documentation: z.string().optional(),
1362
+ support: z.string().optional(),
1363
+ privacyPolicy: z.string().optional(),
1364
+ companyWebsite: z.string().optional(),
1365
+ primaryContactEmail: z.string().optional(),
1366
+ categories: z.array(claudeCategorySchema).optional(),
1367
+ screenshots: z.array(screenshotDraftEntrySchema).optional()
1368
+ });
1070
1369
  claudeSubmissionFormDataSchema.pick({
1071
1370
  serverUrl: true,
1072
1371
  name: true,
@@ -1082,12 +1381,7 @@ claudeSubmissionFormDataSchema.pick({
1082
1381
  connectionRequirements: claudeSubmissionFormDataSchema.shape.connectionRequirements.optional(),
1083
1382
  testInstructions: claudeSubmissionFormDataSchema.shape.testInstructions.optional()
1084
1383
  });
1085
- /**
1086
- * Narrative fields the LLM-backed generation step produces for Claude submissions.
1087
- * This schema accepts the slightly loose shape returned by AI generation, then normalizes it into
1088
- * the strict form shape. Keep transforms here rather than in callers so generation leniency is
1089
- * colocated with the Claude contract.
1090
- */
1384
+ /** Loose shape returned by AI generation for Claude narrative fields; transforms live here so generation leniency stays colocated with the Claude contract. */
1091
1385
  const claudeAiGeneratedFormDataRawSchema = z.object({
1092
1386
  oneLiner: claudeSubmissionFormDataSchema.shape.oneLiner,
1093
1387
  description: claudeSubmissionFormDataSchema.shape.description,
@@ -1107,14 +1401,19 @@ const submissionMetaFieldsSchema = z.object({
1107
1401
  });
1108
1402
  const claudeSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1109
1403
  platform: z.literal("claudeai"),
1110
- formData: claudeSubmissionFormDataSchema.partial()
1404
+ formData: claudeSubmissionDraftSchema
1111
1405
  });
1112
1406
  const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1113
1407
  platform: z.literal("chatgpt"),
1114
- formData: chatgptSubmissionFormDataSchema.partial()
1408
+ formData: chatgptSubmissionDraftSchema
1115
1409
  });
1116
1410
  z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1117
- z.union([claudeSubmissionFormDataSchema.partial(), chatgptSubmissionFormDataSchema.partial()]);
1411
+ z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
1412
+ z.literal([
1413
+ 100,
1414
+ 75,
1415
+ 50
1416
+ ]);
1118
1417
  const subscriptionPlanSchema = z.enum([
1119
1418
  "pro",
1120
1419
  "business",
@@ -1132,6 +1431,7 @@ const customerUsageSchema = z.object({
1132
1431
  periodEnd: z.number()
1133
1432
  });
1134
1433
  const partnerDiscountSchema = z.object({ endsAt: z.number() });
1434
+ z.object({ balanceInNanoUSD: z.number() });
1135
1435
  z.object({
1136
1436
  customerCredits: customerCreditsSchema.nullable(),
1137
1437
  customerUsage: customerUsageSchema.nullable(),
@@ -1179,7 +1479,10 @@ const RESERVED_KEYS = [
1179
1479
  "BUILD_ARG_START_COMMAND",
1180
1480
  "ALPIC_HOST",
1181
1481
  "ALPIC_CUSTOM_DOMAINS",
1182
- "ALPIC_INTENT_META_KEY"
1482
+ "ALPIC_INTENT_META_KEY",
1483
+ "ALPIC_FEEDBACK_META_KEY",
1484
+ "ALPIC_EVENTS_META_KEY",
1485
+ "ALPIC_IDENTIFY_META_KEY"
1183
1486
  ];
1184
1487
  const environmentVariableSchema = z.object({
1185
1488
  key: z.string().min(2, "Key must be at least 2 characters").regex(/^[a-zA-Z]([a-zA-Z0-9_])+$/, "Key must start with a letter and contain only letters, numbers, and underscores").refine((key) => !RESERVED_KEYS.includes(key), "This key is reserved and cannot be used as an environment variable key"),
@@ -1260,21 +1563,20 @@ const deploymentSchema = z.object({
1260
1563
  isCurrent: z.boolean(),
1261
1564
  deploymentPageUrl: z.url().nullable()
1262
1565
  });
1263
- const isValidLogTimeInput = (value) => {
1566
+ const isValidTimeInput = (value) => {
1264
1567
  if (ms(value) !== void 0) return true;
1265
1568
  return !Number.isNaN(new Date(value).getTime());
1266
1569
  };
1267
- const createEnvironmentContractV1 = oc.route({
1570
+ const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
1571
+ const base = oc.errors({ BAD_REQUEST: {} });
1572
+ const createEnvironmentContractV1 = base.route({
1268
1573
  path: "/v1/environments",
1269
1574
  method: "POST",
1270
1575
  summary: "Create an environment",
1271
1576
  description: "Create an environment for a project",
1272
1577
  tags: ["environments"],
1273
1578
  successDescription: "The environment has been created successfully"
1274
- }).errors({
1275
- NOT_FOUND: {},
1276
- BAD_REQUEST: {}
1277
- }).input(z.object({
1579
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1278
1580
  projectId: z.string().describe("The ID of the project to create the environment for"),
1279
1581
  name: z.string().min(1).describe("The name of the environment"),
1280
1582
  sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
@@ -1287,7 +1589,7 @@ const createEnvironmentContractV1 = oc.route({
1287
1589
  createdAt: z.coerce.date(),
1288
1590
  projectId: z.string().describe("The ID of the project the environment belongs to")
1289
1591
  }));
1290
- const getEnvironmentContractV1 = oc.route({
1592
+ const getEnvironmentContractV1 = base.route({
1291
1593
  path: "/v1/environments/{environmentId}",
1292
1594
  method: "GET",
1293
1595
  summary: "Get an environment",
@@ -1344,7 +1646,7 @@ const projectOutputSchema = z.object({
1344
1646
  productionEnvironment: productionEnvironmentSchema.nullable(),
1345
1647
  environments: z.array(environmentSchema)
1346
1648
  });
1347
- const getProjectContractV1 = oc.route({
1649
+ const getProjectContractV1 = base.route({
1348
1650
  path: "/v1/projects/{projectId}",
1349
1651
  method: "GET",
1350
1652
  summary: "Get a project",
@@ -1352,18 +1654,15 @@ const getProjectContractV1 = oc.route({
1352
1654
  tags: ["projects"],
1353
1655
  successDescription: "The project details"
1354
1656
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
1355
- const listProjectsContractV1 = oc.route({
1657
+ const listProjectsContractV1 = base.route({
1356
1658
  path: "/v1/projects",
1357
1659
  method: "GET",
1358
1660
  summary: "List projects",
1359
1661
  description: "List all projects for a team",
1360
1662
  tags: ["projects"],
1361
1663
  successDescription: "The list of projects"
1362
- }).errors({
1363
- NOT_FOUND: {},
1364
- BAD_REQUEST: {}
1365
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
1366
- const createProjectContractV1 = oc.route({
1664
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
1665
+ const createProjectContractV1 = base.route({
1367
1666
  path: "/v1/projects",
1368
1667
  method: "POST",
1369
1668
  summary: "Create a project",
@@ -1372,7 +1671,6 @@ const createProjectContractV1 = oc.route({
1372
1671
  successDescription: "The project has been created successfully"
1373
1672
  }).errors({
1374
1673
  NOT_FOUND: {},
1375
- BAD_REQUEST: {},
1376
1674
  FORBIDDEN: {}
1377
1675
  }).input(z.object({
1378
1676
  teamId: z.string().optional(),
@@ -1413,7 +1711,7 @@ const environmentVariableOutputSchema = z.object({
1413
1711
  isSecret: z.boolean(),
1414
1712
  createdAt: z.coerce.date()
1415
1713
  });
1416
- const listEnvironmentVariablesContractV1 = oc.route({
1714
+ const listEnvironmentVariablesContractV1 = base.route({
1417
1715
  path: "/v1/environments/{environmentId}/environment-variables",
1418
1716
  method: "GET",
1419
1717
  summary: "List environment variables",
@@ -1421,48 +1719,39 @@ const listEnvironmentVariablesContractV1 = oc.route({
1421
1719
  tags: ["environments"],
1422
1720
  successDescription: "The list of environment variables"
1423
1721
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
1424
- const createEnvironmentVariablesContractV1 = oc.route({
1722
+ const createEnvironmentVariablesContractV1 = base.route({
1425
1723
  path: "/v1/environments/{environmentId}/environment-variables",
1426
1724
  method: "POST",
1427
1725
  summary: "Add environment variables",
1428
1726
  description: "Add one or more environment variables to an environment",
1429
1727
  tags: ["environments"],
1430
1728
  successDescription: "The environment variables have been added successfully"
1431
- }).errors({
1432
- NOT_FOUND: {},
1433
- BAD_REQUEST: {}
1434
- }).input(z.object({
1729
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1435
1730
  environmentId: z.string().describe("The ID of the environment"),
1436
1731
  environmentVariables: environmentVariablesSchema
1437
1732
  })).output(z.object({ success: z.literal(true) }));
1438
- const updateEnvironmentVariableContractV1 = oc.route({
1733
+ const updateEnvironmentVariableContractV1 = base.route({
1439
1734
  path: "/v1/environment-variables/{environmentVariableId}",
1440
1735
  method: "PATCH",
1441
1736
  summary: "Update an environment variable",
1442
1737
  description: "Update an environment variable by ID",
1443
1738
  tags: ["environments"],
1444
1739
  successDescription: "The environment variable has been updated successfully"
1445
- }).errors({
1446
- NOT_FOUND: {},
1447
- BAD_REQUEST: {}
1448
- }).input(z.object({
1740
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1449
1741
  environmentVariableId: z.string().describe("The ID of the environment variable"),
1450
1742
  key: environmentVariableSchema.shape.key,
1451
1743
  value: environmentVariableSchema.shape.value.optional(),
1452
1744
  isSecret: environmentVariableSchema.shape.isSecret.optional()
1453
1745
  })).output(z.object({ success: z.literal(true) }));
1454
- const deleteEnvironmentVariableContractV1 = oc.route({
1746
+ const deleteEnvironmentVariableContractV1 = base.route({
1455
1747
  path: "/v1/environment-variables/{environmentVariableId}",
1456
1748
  method: "DELETE",
1457
1749
  summary: "Delete an environment variable",
1458
1750
  description: "Delete an environment variable by ID",
1459
1751
  tags: ["environments"],
1460
1752
  successDescription: "The environment variable has been deleted successfully"
1461
- }).errors({
1462
- NOT_FOUND: {},
1463
- BAD_REQUEST: {}
1464
- }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
1465
- const deleteProjectContractV1 = oc.route({
1753
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
1754
+ const deleteProjectContractV1 = base.route({
1466
1755
  path: "/v1/projects/{projectId}",
1467
1756
  method: "DELETE",
1468
1757
  summary: "Delete a project",
@@ -1470,7 +1759,7 @@ const deleteProjectContractV1 = oc.route({
1470
1759
  tags: ["projects"],
1471
1760
  successDescription: "The project has been deleted successfully"
1472
1761
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
1473
- const updateProjectContractV1 = oc.route({
1762
+ const updateProjectContractV1 = base.route({
1474
1763
  path: "/v1/projects/{projectId}",
1475
1764
  method: "PATCH",
1476
1765
  summary: "Update a project",
@@ -1479,14 +1768,13 @@ const updateProjectContractV1 = oc.route({
1479
1768
  successDescription: "The project has been updated successfully"
1480
1769
  }).errors({
1481
1770
  NOT_FOUND: {},
1482
- BAD_REQUEST: {},
1483
1771
  FORBIDDEN: {}
1484
1772
  }).input(z.object({
1485
1773
  projectId: z.string().describe("The ID of the project"),
1486
1774
  name: z.string().min(1).max(100).optional().describe("The new name for the project"),
1487
1775
  sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
1488
1776
  })).output(projectOutputSchema);
1489
- const deployEnvironmentContractV1 = oc.route({
1777
+ const deployEnvironmentContractV1 = base.route({
1490
1778
  path: "/v1/environments/{environmentId}/deploy",
1491
1779
  method: "POST",
1492
1780
  summary: "Deploy an environment",
@@ -1495,27 +1783,25 @@ const deployEnvironmentContractV1 = oc.route({
1495
1783
  successDescription: "The environment has been deployed successfully"
1496
1784
  }).errors({
1497
1785
  NOT_FOUND: {},
1498
- BAD_REQUEST: {}
1786
+ CONFLICT: {}
1499
1787
  }).input(z.object({
1500
1788
  environmentId: z.string().describe("The ID of the environment to deploy"),
1501
- token: z.string().describe("The token to identify the source archive").optional()
1789
+ token: z.string().describe("The token to identify the source archive").optional(),
1790
+ settings: buildSettingsSchema.extend({ transport: transportSchema }).optional().describe("Project settings detected by the client from the source. When provided, the server skips downloading and extracting the source archive to detect them.")
1502
1791
  })).output(deploymentSchema);
1503
- const uploadDeploymentArtifactContractV1 = oc.route({
1792
+ const uploadDeploymentArtifactContractV1 = base.route({
1504
1793
  path: "/v1/deployments/upload",
1505
1794
  method: "POST",
1506
1795
  summary: "Upload deployment artifacts",
1507
1796
  description: "Return a presigned S3 URL to upload a deployment artifact",
1508
1797
  tags: ["deployments"],
1509
1798
  successDescription: "The presigned upload URL has been generated successfully"
1510
- }).errors({
1511
- NOT_FOUND: {},
1512
- BAD_REQUEST: {}
1513
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
1799
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
1514
1800
  uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
1515
1801
  token: z.string().describe("Token to identify the source archive"),
1516
1802
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
1517
1803
  }));
1518
- const listDeploymentsContractV1 = oc.route({
1804
+ const listDeploymentsContractV1 = base.route({
1519
1805
  path: "/v1/projects/{projectId}/deployments",
1520
1806
  method: "GET",
1521
1807
  summary: "List project deployments",
@@ -1527,7 +1813,7 @@ const listDeploymentsContractV1 = oc.route({
1527
1813
  status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
1528
1814
  environmentId: z.string().optional().describe("Filter by environment ID")
1529
1815
  })).output(z.array(deploymentSchema));
1530
- const getDeploymentContractV1 = oc.route({
1816
+ const getDeploymentContractV1 = base.route({
1531
1817
  path: "/v1/deployments/{deploymentId}",
1532
1818
  method: "GET",
1533
1819
  summary: "Get a deployment",
@@ -1535,20 +1821,32 @@ const getDeploymentContractV1 = oc.route({
1535
1821
  tags: ["deployments"],
1536
1822
  successDescription: "The deployment details"
1537
1823
  }).errors({ NOT_FOUND: {} }).input(z.object({ deploymentId: z.string().describe("The ID of the deployment") })).output(deploymentSchema);
1538
- const getLogsContractV1 = oc.route({
1824
+ const logEntrySchema = z.object({
1825
+ timestamp: z.coerce.date(),
1826
+ type: z.enum([
1827
+ "START",
1828
+ "END",
1829
+ "INFO",
1830
+ "ERROR",
1831
+ "WARNING",
1832
+ "DEBUG"
1833
+ ]),
1834
+ requestId: z.string(),
1835
+ content: z.string().optional(),
1836
+ method: z.string().optional(),
1837
+ durationInMs: z.number().optional()
1838
+ });
1839
+ const getLogsContractV1 = base.route({
1539
1840
  path: "/v1/environments/{environmentId}/logs",
1540
1841
  method: "GET",
1541
1842
  summary: "Get logs",
1542
1843
  description: "Get logs for an environment",
1543
1844
  tags: ["environments"],
1544
1845
  successDescription: "The logs"
1545
- }).errors({
1546
- NOT_FOUND: {},
1547
- BAD_REQUEST: {}
1548
- }).input(z.object({
1846
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1549
1847
  environmentId: z.string().describe("The ID of the environment"),
1550
- since: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1551
- until: z.string().refine(isValidLogTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." }).optional().describe("End time — ISO 8601 or relative"),
1848
+ since: timeInputSchema.optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1849
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
1552
1850
  limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
1553
1851
  level: z.array(z.enum([
1554
1852
  "INFO",
@@ -1559,34 +1857,17 @@ const getLogsContractV1 = oc.route({
1559
1857
  search: z.string().optional().describe("Filter pattern to search for in log content"),
1560
1858
  nextToken: z.string().optional().describe("Pagination token from a previous response")
1561
1859
  })).output(z.object({
1562
- logs: z.array(z.object({
1563
- timestamp: z.coerce.date(),
1564
- type: z.enum([
1565
- "START",
1566
- "END",
1567
- "INFO",
1568
- "ERROR",
1569
- "WARNING",
1570
- "DEBUG"
1571
- ]),
1572
- requestId: z.string(),
1573
- content: z.string().optional(),
1574
- method: z.string().optional(),
1575
- durationInMs: z.number().optional()
1576
- })),
1860
+ logs: z.array(logEntrySchema),
1577
1861
  nextToken: z.string().nullable()
1578
1862
  }));
1579
- const getLatestLogsContractV1 = oc.route({
1863
+ const getLatestLogsContractV1 = base.route({
1580
1864
  path: "/v1/environments/{environmentId}/latest-logs",
1581
1865
  method: "GET",
1582
1866
  summary: "Get latest logs",
1583
1867
  description: "Get the N most recent logs for an environment",
1584
1868
  tags: ["environments"],
1585
1869
  successDescription: "The latest logs"
1586
- }).errors({
1587
- NOT_FOUND: {},
1588
- BAD_REQUEST: {}
1589
- }).input(z.object({
1870
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1590
1871
  environmentId: z.string().describe("The ID of the environment"),
1591
1872
  limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
1592
1873
  level: z.array(z.enum([
@@ -1596,22 +1877,8 @@ const getLatestLogsContractV1 = oc.route({
1596
1877
  "DEBUG"
1597
1878
  ])).optional().describe("Filter by log level"),
1598
1879
  search: z.string().optional().describe("Filter pattern to search for in log content")
1599
- })).output(z.object({ logs: z.array(z.object({
1600
- timestamp: z.coerce.date(),
1601
- type: z.enum([
1602
- "START",
1603
- "END",
1604
- "INFO",
1605
- "ERROR",
1606
- "WARNING",
1607
- "DEBUG"
1608
- ]),
1609
- requestId: z.string(),
1610
- content: z.string().optional(),
1611
- method: z.string().optional(),
1612
- durationInMs: z.number().optional()
1613
- })) }));
1614
- const getDeploymentLogsContractV1 = oc.route({
1880
+ })).output(z.object({ logs: z.array(logEntrySchema) }));
1881
+ const getDeploymentLogsContractV1 = base.route({
1615
1882
  path: "/v1/deployments/{deploymentId}/logs",
1616
1883
  method: "GET",
1617
1884
  summary: "Get deployment logs",
@@ -1638,17 +1905,14 @@ const analyticsTimeSeriesSchema = z.object({
1638
1905
  output_token_mean: z.array(analyticsDataPointSchema),
1639
1906
  task_count: z.array(analyticsDataPointSchema)
1640
1907
  });
1641
- const getProjectAnalyticsContractV1 = oc.route({
1908
+ const getProjectAnalyticsContractV1 = base.route({
1642
1909
  path: "/v1/analytics/{projectId}",
1643
1910
  method: "GET",
1644
1911
  summary: "Get project analytics",
1645
1912
  description: "Get analytics data for a project over a time range",
1646
1913
  tags: ["analytics"],
1647
1914
  successDescription: "The project analytics data"
1648
- }).errors({
1649
- NOT_FOUND: {},
1650
- BAD_REQUEST: {}
1651
- }).input(z.object({
1915
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1652
1916
  projectId: z.string().describe("The ID of the project"),
1653
1917
  startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
1654
1918
  endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
@@ -1663,7 +1927,132 @@ const getProjectAnalyticsContractV1 = oc.route({
1663
1927
  }),
1664
1928
  timeSeries: analyticsTimeSeriesSchema
1665
1929
  }));
1666
- const listTeamsContractV1 = oc.route({
1930
+ const paginatedInsightsInputShape = {
1931
+ environmentId: z.string().describe("The ID of the environment"),
1932
+ since: timeInputSchema.default("7d").describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1933
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
1934
+ limit: z.coerce.number().int().min(1).max(200).default(50),
1935
+ offset: z.coerce.number().int().min(0).default(0),
1936
+ search: z.string().trim().min(1).max(200).optional()
1937
+ };
1938
+ const listIntentsContractV1 = base.route({
1939
+ path: "/v1/environments/{environmentId}/intents",
1940
+ method: "GET",
1941
+ summary: "List intents",
1942
+ description: "List grouped user intents for an environment over a time range",
1943
+ tags: ["insights"],
1944
+ successDescription: "The grouped user intents"
1945
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1946
+ ...paginatedInsightsInputShape,
1947
+ tools: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
1948
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional(),
1949
+ categoryIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
1950
+ sortDir: z.enum(["asc", "desc"]).default("desc")
1951
+ })).output(z.object({
1952
+ intents: z.array(z.object({
1953
+ id: z.string(),
1954
+ intentIds: z.array(z.string()).min(1),
1955
+ environmentId: z.string(),
1956
+ message: z.string(),
1957
+ toolName: z.string(),
1958
+ createdAt: z.coerce.date(),
1959
+ occurrenceCount: z.number().int().positive(),
1960
+ clientName: z.string().nullable(),
1961
+ clientId: z.string().nullable(),
1962
+ categories: z.array(z.object({
1963
+ id: z.string(),
1964
+ name: z.string(),
1965
+ color: intentCategoryColorSchema
1966
+ }))
1967
+ })),
1968
+ totalCount: z.number().int().nonnegative()
1969
+ }));
1970
+ const listFeedbacksContractV1 = base.route({
1971
+ path: "/v1/environments/{environmentId}/feedbacks",
1972
+ method: "GET",
1973
+ summary: "List feedbacks",
1974
+ description: "List user feedback for an environment over a time range",
1975
+ tags: ["insights"],
1976
+ successDescription: "The user feedback"
1977
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1978
+ ...paginatedInsightsInputShape,
1979
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional()
1980
+ })).output(z.object({
1981
+ feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
1982
+ totalCount: z.number().int().nonnegative()
1983
+ }));
1984
+ const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
1985
+ const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
1986
+ const listIntentCategoriesContractV1 = base.route({
1987
+ path: "/v1/environments/{environmentId}/intent-categories",
1988
+ method: "GET",
1989
+ summary: "List intent categories",
1990
+ description: "List intent categories for an environment, including how many intents each category is linked to",
1991
+ tags: ["insights"],
1992
+ successDescription: "The intent categories"
1993
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
1994
+ const createIntentCategoryContractV1 = base.route({
1995
+ path: "/v1/environments/{environmentId}/intent-categories",
1996
+ method: "POST",
1997
+ summary: "Create an intent category",
1998
+ description: "Create an intent category, optionally linking it to existing intents",
1999
+ tags: ["insights"],
2000
+ successDescription: "The created intent category"
2001
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2002
+ environmentId: z.string().describe("The ID of the environment"),
2003
+ name: intentCategoryNameSchema,
2004
+ color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
2005
+ intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
2006
+ })).output(intentCategorySchema);
2007
+ const updateIntentCategoryContractV1 = base.route({
2008
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
2009
+ method: "PATCH",
2010
+ summary: "Update an intent category",
2011
+ description: "Rename or recolor an intent category",
2012
+ tags: ["insights"],
2013
+ successDescription: "The updated intent category"
2014
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2015
+ environmentId: z.string().describe("The ID of the environment"),
2016
+ categoryId: z.string().describe("The ID of the category"),
2017
+ name: intentCategoryNameSchema.optional(),
2018
+ color: intentCategoryColorSchema.optional().describe("The category color")
2019
+ }).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
2020
+ const deleteIntentCategoryContractV1 = base.route({
2021
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
2022
+ method: "DELETE",
2023
+ summary: "Delete an intent category",
2024
+ description: "Delete an intent category; its intents are unlinked but not deleted",
2025
+ tags: ["insights"],
2026
+ successDescription: "The intent category has been deleted successfully"
2027
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2028
+ environmentId: z.string().describe("The ID of the environment"),
2029
+ categoryId: z.string().describe("The ID of the category")
2030
+ })).output(z.object({ success: z.literal(true) }));
2031
+ const linkIntentCategoryContractV1 = base.route({
2032
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
2033
+ method: "POST",
2034
+ summary: "Link an intent category",
2035
+ description: "Link an intent category to intents; already linked intents are ignored",
2036
+ tags: ["insights"],
2037
+ successDescription: "The intents have been linked successfully"
2038
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2039
+ environmentId: z.string().describe("The ID of the environment"),
2040
+ categoryId: z.string().describe("The ID of the category"),
2041
+ intentIds: categorizableIntentIdsSchema
2042
+ })).output(z.object({ success: z.literal(true) }));
2043
+ const unlinkIntentCategoryContractV1 = base.route({
2044
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
2045
+ method: "POST",
2046
+ summary: "Unlink an intent category",
2047
+ description: "Unlink an intent category from intents; intents without the category are ignored",
2048
+ tags: ["insights"],
2049
+ successDescription: "The intents have been unlinked successfully"
2050
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2051
+ environmentId: z.string().describe("The ID of the environment"),
2052
+ categoryId: z.string().describe("The ID of the category"),
2053
+ intentIds: categorizableIntentIdsSchema
2054
+ })).output(z.object({ success: z.literal(true) }));
2055
+ const listTeamsContractV1 = base.route({
1667
2056
  path: "/v1/teams",
1668
2057
  method: "GET",
1669
2058
  summary: "List teams",
@@ -1676,7 +2065,22 @@ const listTeamsContractV1 = oc.route({
1676
2065
  createdAt: z.coerce.date(),
1677
2066
  hasStripeAccount: z.boolean()
1678
2067
  })));
1679
- const getTunnelTicketContractV1 = oc.route({
2068
+ const getTeamUsageContractV1 = base.route({
2069
+ path: "/v1/teams/{teamId}/usage",
2070
+ method: "GET",
2071
+ summary: "Get team usage",
2072
+ 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.",
2073
+ tags: ["teams"],
2074
+ successDescription: "The current billing window usage"
2075
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
2076
+ teamId: z.string(),
2077
+ plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
2078
+ periodStart: z.coerce.date().describe("Start of the current billing window"),
2079
+ periodEnd: z.coerce.date().describe("End of the current billing window"),
2080
+ requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
2081
+ includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
2082
+ }));
2083
+ const getTunnelTicketContractV1 = base.route({
1680
2084
  path: "/v1/tunnels/ticket",
1681
2085
  method: "GET",
1682
2086
  summary: "Get a tunnel ticket",
@@ -1688,16 +2092,13 @@ const getTunnelTicketContractV1 = oc.route({
1688
2092
  ticket: z.string().describe("The signed tunnel ticket"),
1689
2093
  tunnelHost: z.string().describe("The tunnel host to connect to")
1690
2094
  }));
1691
- const publishServerContractV1 = oc.route({
2095
+ const publishServerContractV1 = base.route({
1692
2096
  path: "/v1/distribution/publish",
1693
2097
  method: "POST",
1694
2098
  summary: "Publish a server to the MCP registry",
1695
2099
  tags: ["distribution"],
1696
2100
  successDescription: "The server has been published successfully"
1697
- }).errors({
1698
- NOT_FOUND: {},
1699
- BAD_REQUEST: {}
1700
- }).input(z.object({
2101
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1701
2102
  projectId: z.string(),
1702
2103
  domain: z.string(),
1703
2104
  title: z.string().min(1).max(100),
@@ -1706,17 +2107,14 @@ const publishServerContractV1 = oc.route({
1706
2107
  iconSrc: z.url().max(255).optional(),
1707
2108
  dryRun: z.boolean().optional()
1708
2109
  })).output(z.object({ serverFields: serverFieldsSchema }));
1709
- const getServerInfoContractV1 = oc.route({
2110
+ const getServerInfoContractV1 = base.route({
1710
2111
  path: "/v1/distribution/get",
1711
2112
  method: "GET",
1712
2113
  summary: "Get server info",
1713
2114
  description: "Get info about a server",
1714
2115
  tags: ["distribution"],
1715
2116
  successDescription: "The server info"
1716
- }).errors({
1717
- NOT_FOUND: {},
1718
- BAD_REQUEST: {}
1719
- }).input(z.object({
2117
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1720
2118
  projectId: z.string(),
1721
2119
  domain: z.string()
1722
2120
  })).output(z.object({ serverFields: serverFieldsSchema }));
@@ -1735,7 +2133,7 @@ const playgroundOutputSchema = z.object({
1735
2133
  isPlaygroundEnabled: z.boolean(),
1736
2134
  serverMetadata: playgroundServerMetadataOutputSchema.nullable()
1737
2135
  });
1738
- const getPlaygroundContractV1 = oc.route({
2136
+ const getPlaygroundContractV1 = base.route({
1739
2137
  path: "/v1/environments/{environmentId}/playground",
1740
2138
  method: "GET",
1741
2139
  summary: "Get playground configuration",
@@ -1743,17 +2141,14 @@ const getPlaygroundContractV1 = oc.route({
1743
2141
  tags: ["environments"],
1744
2142
  successDescription: "The playground configuration"
1745
2143
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
1746
- const upsertPlaygroundContractV1 = oc.route({
2144
+ const upsertPlaygroundContractV1 = base.route({
1747
2145
  path: "/v1/environments/{environmentId}/playground",
1748
2146
  method: "PUT",
1749
2147
  summary: "Update playground configuration",
1750
2148
  description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
1751
2149
  tags: ["environments"],
1752
2150
  successDescription: "The updated playground configuration"
1753
- }).errors({
1754
- NOT_FOUND: {},
1755
- BAD_REQUEST: {}
1756
- }).input(z.object({
2151
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1757
2152
  environmentId: z.string().describe("The ID of the environment"),
1758
2153
  isPlaygroundEnabled: z.boolean().optional(),
1759
2154
  name: z.string().min(1).max(100).optional(),
@@ -1761,7 +2156,7 @@ const upsertPlaygroundContractV1 = oc.route({
1761
2156
  headers: z.array(playgroundHeaderSchema).optional(),
1762
2157
  examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
1763
2158
  })).output(playgroundOutputSchema);
1764
- const createBeaconContractV1 = oc.route({
2159
+ const createBeaconContractV1 = base.route({
1765
2160
  path: "/v1/beacon/audits",
1766
2161
  method: "POST",
1767
2162
  summary: "Create a beacon audit",
@@ -1770,7 +2165,6 @@ const createBeaconContractV1 = oc.route({
1770
2165
  successDescription: "The audit has been created"
1771
2166
  }).errors({
1772
2167
  NOT_FOUND: {},
1773
- BAD_REQUEST: {},
1774
2168
  DNS_RESOLUTION_FAILED: { status: 400 }
1775
2169
  }).input(z.object({
1776
2170
  targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
@@ -1778,7 +2172,7 @@ const createBeaconContractV1 = oc.route({
1778
2172
  projectId: z.string().optional().describe("The project ID to associate the audit with"),
1779
2173
  excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
1780
2174
  })).output(z.object({ id: z.string() }));
1781
- const getBeaconContractV1 = oc.route({
2175
+ const getBeaconContractV1 = base.route({
1782
2176
  path: "/v1/beacon/audits/{auditId}",
1783
2177
  method: "GET",
1784
2178
  summary: "Get a beacon audit",
@@ -1794,8 +2188,21 @@ const getBeaconContractV1 = oc.route({
1794
2188
  report: auditReportWithScreenshotsSchema.nullable()
1795
2189
  }));
1796
2190
  const contract = {
1797
- teams: { list: { v1: listTeamsContractV1 } },
2191
+ teams: {
2192
+ list: { v1: listTeamsContractV1 },
2193
+ getUsage: { v1: getTeamUsageContractV1 }
2194
+ },
1798
2195
  analytics: { get: { v1: getProjectAnalyticsContractV1 } },
2196
+ intents: { list: { v1: listIntentsContractV1 } },
2197
+ intentCategories: {
2198
+ list: { v1: listIntentCategoriesContractV1 },
2199
+ create: { v1: createIntentCategoryContractV1 },
2200
+ update: { v1: updateIntentCategoryContractV1 },
2201
+ delete: { v1: deleteIntentCategoryContractV1 },
2202
+ link: { v1: linkIntentCategoryContractV1 },
2203
+ unlink: { v1: unlinkIntentCategoryContractV1 }
2204
+ },
2205
+ feedbacks: { list: { v1: listFeedbacksContractV1 } },
1799
2206
  deployments: {
1800
2207
  list: { v1: listDeploymentsContractV1 },
1801
2208
  get: { v1: getDeploymentContractV1 },
@@ -1836,5 +2243,10 @@ const contract = {
1836
2243
  get: { v1: getBeaconContractV1 }
1837
2244
  }
1838
2245
  };
2246
+ const { uploadArtifact: _discard, ...deploymentsForDocs } = contract.deployments;
2247
+ const contractForDocs = {
2248
+ ...contract,
2249
+ deployments: deploymentsForDocs
2250
+ };
1839
2251
  //#endregion
1840
- export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
2252
+ 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 };