@alpic-ai/api 0.0.0-dev.gd961425 → 0.0.0-dev.gd963357

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
@@ -402,7 +402,7 @@ z.object({
402
402
  collectUserData: z.boolean(),
403
403
  identityTraitKey: z.string().min(1).max(200).nullable()
404
404
  });
405
- z.object({
405
+ const feedbackSchema = z.object({
406
406
  id: z.string(),
407
407
  createdAt: z.coerce.date(),
408
408
  environmentId: z.string(),
@@ -424,7 +424,7 @@ const intentCategoryColorSchema = z.enum([
424
424
  "pink",
425
425
  "gray"
426
426
  ]);
427
- intentCategoryColorSchema.options;
427
+ const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
428
428
  const intentCategorySchema = z.object({
429
429
  id: z.string(),
430
430
  createdAt: z.coerce.date(),
@@ -432,7 +432,7 @@ const intentCategorySchema = z.object({
432
432
  name: z.string(),
433
433
  color: intentCategoryColorSchema
434
434
  });
435
- z.object({
435
+ const intentCategorySummarySchema = z.object({
436
436
  id: z.string(),
437
437
  name: z.string(),
438
438
  color: intentCategoryColorSchema,
@@ -1398,6 +1398,17 @@ const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
1398
1398
  });
1399
1399
  z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
1400
1400
  z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
1401
+ ({
1402
+ free: 1e4,
1403
+ pro: 2e5,
1404
+ business: 2e6,
1405
+ enterprise: null
1406
+ }).free;
1407
+ z.literal([
1408
+ 100,
1409
+ 75,
1410
+ 50
1411
+ ]);
1401
1412
  const subscriptionPlanSchema = z.enum([
1402
1413
  "pro",
1403
1414
  "business",
@@ -1415,6 +1426,7 @@ const customerUsageSchema = z.object({
1415
1426
  periodEnd: z.number()
1416
1427
  });
1417
1428
  const partnerDiscountSchema = z.object({ endsAt: z.number() });
1429
+ z.object({ balanceInNanoUSD: z.number() });
1418
1430
  z.object({
1419
1431
  customerCredits: customerCreditsSchema.nullable(),
1420
1432
  customerUsage: customerUsageSchema.nullable(),
@@ -1546,21 +1558,20 @@ const deploymentSchema = z.object({
1546
1558
  isCurrent: z.boolean(),
1547
1559
  deploymentPageUrl: z.url().nullable()
1548
1560
  });
1549
- const isValidLogTimeInput = (value) => {
1561
+ const isValidTimeInput = (value) => {
1550
1562
  if (ms(value) !== void 0) return true;
1551
1563
  return !Number.isNaN(new Date(value).getTime());
1552
1564
  };
1553
- const createEnvironmentContractV1 = oc.route({
1565
+ const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
1566
+ const base = oc.errors({ BAD_REQUEST: {} });
1567
+ const createEnvironmentContractV1 = base.route({
1554
1568
  path: "/v1/environments",
1555
1569
  method: "POST",
1556
1570
  summary: "Create an environment",
1557
1571
  description: "Create an environment for a project",
1558
1572
  tags: ["environments"],
1559
1573
  successDescription: "The environment has been created successfully"
1560
- }).errors({
1561
- NOT_FOUND: {},
1562
- BAD_REQUEST: {}
1563
- }).input(z.object({
1574
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1564
1575
  projectId: z.string().describe("The ID of the project to create the environment for"),
1565
1576
  name: z.string().min(1).describe("The name of the environment"),
1566
1577
  sourceBranch: z.string().min(1).describe("The branch used to build the environment"),
@@ -1573,7 +1584,7 @@ const createEnvironmentContractV1 = oc.route({
1573
1584
  createdAt: z.coerce.date(),
1574
1585
  projectId: z.string().describe("The ID of the project the environment belongs to")
1575
1586
  }));
1576
- const getEnvironmentContractV1 = oc.route({
1587
+ const getEnvironmentContractV1 = base.route({
1577
1588
  path: "/v1/environments/{environmentId}",
1578
1589
  method: "GET",
1579
1590
  summary: "Get an environment",
@@ -1630,7 +1641,7 @@ const projectOutputSchema = z.object({
1630
1641
  productionEnvironment: productionEnvironmentSchema.nullable(),
1631
1642
  environments: z.array(environmentSchema)
1632
1643
  });
1633
- const getProjectContractV1 = oc.route({
1644
+ const getProjectContractV1 = base.route({
1634
1645
  path: "/v1/projects/{projectId}",
1635
1646
  method: "GET",
1636
1647
  summary: "Get a project",
@@ -1638,18 +1649,15 @@ const getProjectContractV1 = oc.route({
1638
1649
  tags: ["projects"],
1639
1650
  successDescription: "The project details"
1640
1651
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(projectOutputSchema);
1641
- const listProjectsContractV1 = oc.route({
1652
+ const listProjectsContractV1 = base.route({
1642
1653
  path: "/v1/projects",
1643
1654
  method: "GET",
1644
1655
  summary: "List projects",
1645
1656
  description: "List all projects for a team",
1646
1657
  tags: ["projects"],
1647
1658
  successDescription: "The list of projects"
1648
- }).errors({
1649
- NOT_FOUND: {},
1650
- BAD_REQUEST: {}
1651
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
1652
- const createProjectContractV1 = oc.route({
1659
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.array(projectOutputSchema));
1660
+ const createProjectContractV1 = base.route({
1653
1661
  path: "/v1/projects",
1654
1662
  method: "POST",
1655
1663
  summary: "Create a project",
@@ -1658,7 +1666,6 @@ const createProjectContractV1 = oc.route({
1658
1666
  successDescription: "The project has been created successfully"
1659
1667
  }).errors({
1660
1668
  NOT_FOUND: {},
1661
- BAD_REQUEST: {},
1662
1669
  FORBIDDEN: {}
1663
1670
  }).input(z.object({
1664
1671
  teamId: z.string().optional(),
@@ -1699,7 +1706,7 @@ const environmentVariableOutputSchema = z.object({
1699
1706
  isSecret: z.boolean(),
1700
1707
  createdAt: z.coerce.date()
1701
1708
  });
1702
- const listEnvironmentVariablesContractV1 = oc.route({
1709
+ const listEnvironmentVariablesContractV1 = base.route({
1703
1710
  path: "/v1/environments/{environmentId}/environment-variables",
1704
1711
  method: "GET",
1705
1712
  summary: "List environment variables",
@@ -1707,48 +1714,39 @@ const listEnvironmentVariablesContractV1 = oc.route({
1707
1714
  tags: ["environments"],
1708
1715
  successDescription: "The list of environment variables"
1709
1716
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(environmentVariableOutputSchema));
1710
- const createEnvironmentVariablesContractV1 = oc.route({
1717
+ const createEnvironmentVariablesContractV1 = base.route({
1711
1718
  path: "/v1/environments/{environmentId}/environment-variables",
1712
1719
  method: "POST",
1713
1720
  summary: "Add environment variables",
1714
1721
  description: "Add one or more environment variables to an environment",
1715
1722
  tags: ["environments"],
1716
1723
  successDescription: "The environment variables have been added successfully"
1717
- }).errors({
1718
- NOT_FOUND: {},
1719
- BAD_REQUEST: {}
1720
- }).input(z.object({
1724
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1721
1725
  environmentId: z.string().describe("The ID of the environment"),
1722
1726
  environmentVariables: environmentVariablesSchema
1723
1727
  })).output(z.object({ success: z.literal(true) }));
1724
- const updateEnvironmentVariableContractV1 = oc.route({
1728
+ const updateEnvironmentVariableContractV1 = base.route({
1725
1729
  path: "/v1/environment-variables/{environmentVariableId}",
1726
1730
  method: "PATCH",
1727
1731
  summary: "Update an environment variable",
1728
1732
  description: "Update an environment variable by ID",
1729
1733
  tags: ["environments"],
1730
1734
  successDescription: "The environment variable has been updated successfully"
1731
- }).errors({
1732
- NOT_FOUND: {},
1733
- BAD_REQUEST: {}
1734
- }).input(z.object({
1735
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1735
1736
  environmentVariableId: z.string().describe("The ID of the environment variable"),
1736
1737
  key: environmentVariableSchema.shape.key,
1737
1738
  value: environmentVariableSchema.shape.value.optional(),
1738
1739
  isSecret: environmentVariableSchema.shape.isSecret.optional()
1739
1740
  })).output(z.object({ success: z.literal(true) }));
1740
- const deleteEnvironmentVariableContractV1 = oc.route({
1741
+ const deleteEnvironmentVariableContractV1 = base.route({
1741
1742
  path: "/v1/environment-variables/{environmentVariableId}",
1742
1743
  method: "DELETE",
1743
1744
  summary: "Delete an environment variable",
1744
1745
  description: "Delete an environment variable by ID",
1745
1746
  tags: ["environments"],
1746
1747
  successDescription: "The environment variable has been deleted successfully"
1747
- }).errors({
1748
- NOT_FOUND: {},
1749
- BAD_REQUEST: {}
1750
- }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
1751
- const deleteProjectContractV1 = oc.route({
1748
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentVariableId: z.string().describe("The ID of the environment variable") })).output(z.object({ success: z.literal(true) }));
1749
+ const deleteProjectContractV1 = base.route({
1752
1750
  path: "/v1/projects/{projectId}",
1753
1751
  method: "DELETE",
1754
1752
  summary: "Delete a project",
@@ -1756,7 +1754,7 @@ const deleteProjectContractV1 = oc.route({
1756
1754
  tags: ["projects"],
1757
1755
  successDescription: "The project has been deleted successfully"
1758
1756
  }).errors({ NOT_FOUND: {} }).input(z.object({ projectId: z.string().describe("The ID of the project") })).output(z.object({ success: z.literal(true) }));
1759
- const updateProjectContractV1 = oc.route({
1757
+ const updateProjectContractV1 = base.route({
1760
1758
  path: "/v1/projects/{projectId}",
1761
1759
  method: "PATCH",
1762
1760
  summary: "Update a project",
@@ -1765,14 +1763,13 @@ const updateProjectContractV1 = oc.route({
1765
1763
  successDescription: "The project has been updated successfully"
1766
1764
  }).errors({
1767
1765
  NOT_FOUND: {},
1768
- BAD_REQUEST: {},
1769
1766
  FORBIDDEN: {}
1770
1767
  }).input(z.object({
1771
1768
  projectId: z.string().describe("The ID of the project"),
1772
1769
  name: z.string().min(1).max(100).optional().describe("The new name for the project"),
1773
1770
  sourceRepository: z.string().nullable().optional().describe("The source repository to connect to the project")
1774
1771
  })).output(projectOutputSchema);
1775
- const deployEnvironmentContractV1 = oc.route({
1772
+ const deployEnvironmentContractV1 = base.route({
1776
1773
  path: "/v1/environments/{environmentId}/deploy",
1777
1774
  method: "POST",
1778
1775
  summary: "Deploy an environment",
@@ -1781,29 +1778,25 @@ const deployEnvironmentContractV1 = oc.route({
1781
1778
  successDescription: "The environment has been deployed successfully"
1782
1779
  }).errors({
1783
1780
  NOT_FOUND: {},
1784
- BAD_REQUEST: {},
1785
1781
  CONFLICT: {}
1786
1782
  }).input(z.object({
1787
1783
  environmentId: z.string().describe("The ID of the environment to deploy"),
1788
1784
  token: z.string().describe("The token to identify the source archive").optional(),
1789
1785
  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.")
1790
1786
  })).output(deploymentSchema);
1791
- const uploadDeploymentArtifactContractV1 = oc.route({
1787
+ const uploadDeploymentArtifactContractV1 = base.route({
1792
1788
  path: "/v1/deployments/upload",
1793
1789
  method: "POST",
1794
1790
  summary: "Upload deployment artifacts",
1795
1791
  description: "Return a presigned S3 URL to upload a deployment artifact",
1796
1792
  tags: ["deployments"],
1797
1793
  successDescription: "The presigned upload URL has been generated successfully"
1798
- }).errors({
1799
- NOT_FOUND: {},
1800
- BAD_REQUEST: {}
1801
- }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
1794
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().optional() }).optional()).output(z.object({
1802
1795
  uploadUrl: z.url().describe("Presigned S3 URL to upload the source archive with HTTP PUT"),
1803
1796
  token: z.string().describe("Token to identify the source archive"),
1804
1797
  expiresAt: z.coerce.date().describe("Expiration date of the presigned URL")
1805
1798
  }));
1806
- const listDeploymentsContractV1 = oc.route({
1799
+ const listDeploymentsContractV1 = base.route({
1807
1800
  path: "/v1/projects/{projectId}/deployments",
1808
1801
  method: "GET",
1809
1802
  summary: "List project deployments",
@@ -1815,7 +1808,7 @@ const listDeploymentsContractV1 = oc.route({
1815
1808
  status: z.array(deploymentStatusSchema).optional().describe("Filter by one or more statuses"),
1816
1809
  environmentId: z.string().optional().describe("Filter by environment ID")
1817
1810
  })).output(z.array(deploymentSchema));
1818
- const getDeploymentContractV1 = oc.route({
1811
+ const getDeploymentContractV1 = base.route({
1819
1812
  path: "/v1/deployments/{deploymentId}",
1820
1813
  method: "GET",
1821
1814
  summary: "Get a deployment",
@@ -1838,20 +1831,17 @@ const logEntrySchema = z.object({
1838
1831
  method: z.string().optional(),
1839
1832
  durationInMs: z.number().optional()
1840
1833
  });
1841
- const getLogsContractV1 = oc.route({
1834
+ const getLogsContractV1 = base.route({
1842
1835
  path: "/v1/environments/{environmentId}/logs",
1843
1836
  method: "GET",
1844
1837
  summary: "Get logs",
1845
1838
  description: "Get logs for an environment",
1846
1839
  tags: ["environments"],
1847
1840
  successDescription: "The logs"
1848
- }).errors({
1849
- NOT_FOUND: {},
1850
- BAD_REQUEST: {}
1851
- }).input(z.object({
1841
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1852
1842
  environmentId: z.string().describe("The ID of the environment"),
1853
- 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)"),
1854
- 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"),
1843
+ since: timeInputSchema.optional().describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1844
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
1855
1845
  limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
1856
1846
  level: z.array(z.enum([
1857
1847
  "INFO",
@@ -1865,17 +1855,14 @@ const getLogsContractV1 = oc.route({
1865
1855
  logs: z.array(logEntrySchema),
1866
1856
  nextToken: z.string().nullable()
1867
1857
  }));
1868
- const getLatestLogsContractV1 = oc.route({
1858
+ const getLatestLogsContractV1 = base.route({
1869
1859
  path: "/v1/environments/{environmentId}/latest-logs",
1870
1860
  method: "GET",
1871
1861
  summary: "Get latest logs",
1872
1862
  description: "Get the N most recent logs for an environment",
1873
1863
  tags: ["environments"],
1874
1864
  successDescription: "The latest logs"
1875
- }).errors({
1876
- NOT_FOUND: {},
1877
- BAD_REQUEST: {}
1878
- }).input(z.object({
1865
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1879
1866
  environmentId: z.string().describe("The ID of the environment"),
1880
1867
  limit: z.coerce.number().int().min(1).max(1e3).default(100).describe("Number of most recent log entries to return"),
1881
1868
  level: z.array(z.enum([
@@ -1886,7 +1873,7 @@ const getLatestLogsContractV1 = oc.route({
1886
1873
  ])).optional().describe("Filter by log level"),
1887
1874
  search: z.string().optional().describe("Filter pattern to search for in log content")
1888
1875
  })).output(z.object({ logs: z.array(logEntrySchema) }));
1889
- const getDeploymentLogsContractV1 = oc.route({
1876
+ const getDeploymentLogsContractV1 = base.route({
1890
1877
  path: "/v1/deployments/{deploymentId}/logs",
1891
1878
  method: "GET",
1892
1879
  summary: "Get deployment logs",
@@ -1913,17 +1900,14 @@ const analyticsTimeSeriesSchema = z.object({
1913
1900
  output_token_mean: z.array(analyticsDataPointSchema),
1914
1901
  task_count: z.array(analyticsDataPointSchema)
1915
1902
  });
1916
- const getProjectAnalyticsContractV1 = oc.route({
1903
+ const getProjectAnalyticsContractV1 = base.route({
1917
1904
  path: "/v1/analytics/{projectId}",
1918
1905
  method: "GET",
1919
1906
  summary: "Get project analytics",
1920
1907
  description: "Get analytics data for a project over a time range",
1921
1908
  tags: ["analytics"],
1922
1909
  successDescription: "The project analytics data"
1923
- }).errors({
1924
- NOT_FOUND: {},
1925
- BAD_REQUEST: {}
1926
- }).input(z.object({
1910
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1927
1911
  projectId: z.string().describe("The ID of the project"),
1928
1912
  startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
1929
1913
  endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
@@ -1938,7 +1922,132 @@ const getProjectAnalyticsContractV1 = oc.route({
1938
1922
  }),
1939
1923
  timeSeries: analyticsTimeSeriesSchema
1940
1924
  }));
1941
- const listTeamsContractV1 = oc.route({
1925
+ const paginatedInsightsInputShape = {
1926
+ environmentId: z.string().describe("The ID of the environment"),
1927
+ since: timeInputSchema.default("7d").describe("Start time — ISO 8601 (2024-01-01T00:00:00Z) or relative (1h, 30m, 2d)"),
1928
+ until: timeInputSchema.optional().describe("End time — ISO 8601 or relative"),
1929
+ limit: z.coerce.number().int().min(1).max(200).default(50),
1930
+ offset: z.coerce.number().int().min(0).default(0),
1931
+ search: z.string().trim().min(1).max(200).optional()
1932
+ };
1933
+ const listIntentsContractV1 = base.route({
1934
+ path: "/v1/environments/{environmentId}/intents",
1935
+ method: "GET",
1936
+ summary: "List intents",
1937
+ description: "List grouped user intents for an environment over a time range",
1938
+ tags: ["insights"],
1939
+ successDescription: "The grouped user intents"
1940
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1941
+ ...paginatedInsightsInputShape,
1942
+ tools: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
1943
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional(),
1944
+ categoryIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
1945
+ sortDir: z.enum(["asc", "desc"]).default("desc")
1946
+ })).output(z.object({
1947
+ intents: z.array(z.object({
1948
+ id: z.string(),
1949
+ intentIds: z.array(z.string()).min(1),
1950
+ environmentId: z.string(),
1951
+ message: z.string(),
1952
+ toolName: z.string(),
1953
+ createdAt: z.coerce.date(),
1954
+ occurrenceCount: z.number().int().positive(),
1955
+ clientName: z.string().nullable(),
1956
+ clientId: z.string().nullable(),
1957
+ categories: z.array(z.object({
1958
+ id: z.string(),
1959
+ name: z.string(),
1960
+ color: intentCategoryColorSchema
1961
+ }))
1962
+ })),
1963
+ totalCount: z.number().int().nonnegative()
1964
+ }));
1965
+ const listFeedbacksContractV1 = base.route({
1966
+ path: "/v1/environments/{environmentId}/feedbacks",
1967
+ method: "GET",
1968
+ summary: "List feedbacks",
1969
+ description: "List user feedback for an environment over a time range",
1970
+ tags: ["insights"],
1971
+ successDescription: "The user feedback"
1972
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1973
+ ...paginatedInsightsInputShape,
1974
+ clientIds: z.array(z.string().min(1)).min(1).max(100).optional()
1975
+ })).output(z.object({
1976
+ feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
1977
+ totalCount: z.number().int().nonnegative()
1978
+ }));
1979
+ const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
1980
+ const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
1981
+ const listIntentCategoriesContractV1 = base.route({
1982
+ path: "/v1/environments/{environmentId}/intent-categories",
1983
+ method: "GET",
1984
+ summary: "List intent categories",
1985
+ description: "List intent categories for an environment, including how many intents each category is linked to",
1986
+ tags: ["insights"],
1987
+ successDescription: "The intent categories"
1988
+ }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
1989
+ const createIntentCategoryContractV1 = base.route({
1990
+ path: "/v1/environments/{environmentId}/intent-categories",
1991
+ method: "POST",
1992
+ summary: "Create an intent category",
1993
+ description: "Create an intent category, optionally linking it to existing intents",
1994
+ tags: ["insights"],
1995
+ successDescription: "The created intent category"
1996
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1997
+ environmentId: z.string().describe("The ID of the environment"),
1998
+ name: intentCategoryNameSchema,
1999
+ color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
2000
+ intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
2001
+ })).output(intentCategorySchema);
2002
+ const updateIntentCategoryContractV1 = base.route({
2003
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
2004
+ method: "PATCH",
2005
+ summary: "Update an intent category",
2006
+ description: "Rename or recolor an intent category",
2007
+ tags: ["insights"],
2008
+ successDescription: "The updated intent category"
2009
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2010
+ environmentId: z.string().describe("The ID of the environment"),
2011
+ categoryId: z.string().describe("The ID of the category"),
2012
+ name: intentCategoryNameSchema.optional(),
2013
+ color: intentCategoryColorSchema.optional().describe("The category color")
2014
+ }).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
2015
+ const deleteIntentCategoryContractV1 = base.route({
2016
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
2017
+ method: "DELETE",
2018
+ summary: "Delete an intent category",
2019
+ description: "Delete an intent category; its intents are unlinked but not deleted",
2020
+ tags: ["insights"],
2021
+ successDescription: "The intent category has been deleted successfully"
2022
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2023
+ environmentId: z.string().describe("The ID of the environment"),
2024
+ categoryId: z.string().describe("The ID of the category")
2025
+ })).output(z.object({ success: z.literal(true) }));
2026
+ const linkIntentCategoryContractV1 = base.route({
2027
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
2028
+ method: "POST",
2029
+ summary: "Link an intent category",
2030
+ description: "Link an intent category to intents; already linked intents are ignored",
2031
+ tags: ["insights"],
2032
+ successDescription: "The intents have been linked successfully"
2033
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2034
+ environmentId: z.string().describe("The ID of the environment"),
2035
+ categoryId: z.string().describe("The ID of the category"),
2036
+ intentIds: categorizableIntentIdsSchema
2037
+ })).output(z.object({ success: z.literal(true) }));
2038
+ const unlinkIntentCategoryContractV1 = base.route({
2039
+ path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
2040
+ method: "POST",
2041
+ summary: "Unlink an intent category",
2042
+ description: "Unlink an intent category from intents; intents without the category are ignored",
2043
+ tags: ["insights"],
2044
+ successDescription: "The intents have been unlinked successfully"
2045
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2046
+ environmentId: z.string().describe("The ID of the environment"),
2047
+ categoryId: z.string().describe("The ID of the category"),
2048
+ intentIds: categorizableIntentIdsSchema
2049
+ })).output(z.object({ success: z.literal(true) }));
2050
+ const listTeamsContractV1 = base.route({
1942
2051
  path: "/v1/teams",
1943
2052
  method: "GET",
1944
2053
  summary: "List teams",
@@ -1951,7 +2060,22 @@ const listTeamsContractV1 = oc.route({
1951
2060
  createdAt: z.coerce.date(),
1952
2061
  hasStripeAccount: z.boolean()
1953
2062
  })));
1954
- const getTunnelTicketContractV1 = oc.route({
2063
+ const getTeamUsageContractV1 = base.route({
2064
+ path: "/v1/teams/{teamId}/usage",
2065
+ method: "GET",
2066
+ summary: "Get team usage",
2067
+ 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.",
2068
+ tags: ["teams"],
2069
+ successDescription: "The current billing window usage"
2070
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
2071
+ teamId: z.string(),
2072
+ plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
2073
+ periodStart: z.coerce.date().describe("Start of the current billing window"),
2074
+ periodEnd: z.coerce.date().describe("End of the current billing window"),
2075
+ requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
2076
+ includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
2077
+ }));
2078
+ const getTunnelTicketContractV1 = base.route({
1955
2079
  path: "/v1/tunnels/ticket",
1956
2080
  method: "GET",
1957
2081
  summary: "Get a tunnel ticket",
@@ -1963,16 +2087,13 @@ const getTunnelTicketContractV1 = oc.route({
1963
2087
  ticket: z.string().describe("The signed tunnel ticket"),
1964
2088
  tunnelHost: z.string().describe("The tunnel host to connect to")
1965
2089
  }));
1966
- const publishServerContractV1 = oc.route({
2090
+ const publishServerContractV1 = base.route({
1967
2091
  path: "/v1/distribution/publish",
1968
2092
  method: "POST",
1969
2093
  summary: "Publish a server to the MCP registry",
1970
2094
  tags: ["distribution"],
1971
2095
  successDescription: "The server has been published successfully"
1972
- }).errors({
1973
- NOT_FOUND: {},
1974
- BAD_REQUEST: {}
1975
- }).input(z.object({
2096
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1976
2097
  projectId: z.string(),
1977
2098
  domain: z.string(),
1978
2099
  title: z.string().min(1).max(100),
@@ -1981,17 +2102,14 @@ const publishServerContractV1 = oc.route({
1981
2102
  iconSrc: z.url().max(255).optional(),
1982
2103
  dryRun: z.boolean().optional()
1983
2104
  })).output(z.object({ serverFields: serverFieldsSchema }));
1984
- const getServerInfoContractV1 = oc.route({
2105
+ const getServerInfoContractV1 = base.route({
1985
2106
  path: "/v1/distribution/get",
1986
2107
  method: "GET",
1987
2108
  summary: "Get server info",
1988
2109
  description: "Get info about a server",
1989
2110
  tags: ["distribution"],
1990
2111
  successDescription: "The server info"
1991
- }).errors({
1992
- NOT_FOUND: {},
1993
- BAD_REQUEST: {}
1994
- }).input(z.object({
2112
+ }).errors({ NOT_FOUND: {} }).input(z.object({
1995
2113
  projectId: z.string(),
1996
2114
  domain: z.string()
1997
2115
  })).output(z.object({ serverFields: serverFieldsSchema }));
@@ -2010,7 +2128,7 @@ const playgroundOutputSchema = z.object({
2010
2128
  isPlaygroundEnabled: z.boolean(),
2011
2129
  serverMetadata: playgroundServerMetadataOutputSchema.nullable()
2012
2130
  });
2013
- const getPlaygroundContractV1 = oc.route({
2131
+ const getPlaygroundContractV1 = base.route({
2014
2132
  path: "/v1/environments/{environmentId}/playground",
2015
2133
  method: "GET",
2016
2134
  summary: "Get playground configuration",
@@ -2018,17 +2136,14 @@ const getPlaygroundContractV1 = oc.route({
2018
2136
  tags: ["environments"],
2019
2137
  successDescription: "The playground configuration"
2020
2138
  }).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(playgroundOutputSchema);
2021
- const upsertPlaygroundContractV1 = oc.route({
2139
+ const upsertPlaygroundContractV1 = base.route({
2022
2140
  path: "/v1/environments/{environmentId}/playground",
2023
2141
  method: "PUT",
2024
2142
  summary: "Update playground configuration",
2025
2143
  description: "Update the playground configuration for an environment. All fields are optional — only provided fields are updated.",
2026
2144
  tags: ["environments"],
2027
2145
  successDescription: "The updated playground configuration"
2028
- }).errors({
2029
- NOT_FOUND: {},
2030
- BAD_REQUEST: {}
2031
- }).input(z.object({
2146
+ }).errors({ NOT_FOUND: {} }).input(z.object({
2032
2147
  environmentId: z.string().describe("The ID of the environment"),
2033
2148
  isPlaygroundEnabled: z.boolean().optional(),
2034
2149
  name: z.string().min(1).max(100).optional(),
@@ -2036,7 +2151,7 @@ const upsertPlaygroundContractV1 = oc.route({
2036
2151
  headers: z.array(playgroundHeaderSchema).optional(),
2037
2152
  examplePrompts: z.array(playgroundExamplePromptSchema).max(5).optional()
2038
2153
  })).output(playgroundOutputSchema);
2039
- const createBeaconContractV1 = oc.route({
2154
+ const createBeaconContractV1 = base.route({
2040
2155
  path: "/v1/beacon/audits",
2041
2156
  method: "POST",
2042
2157
  summary: "Create a beacon audit",
@@ -2045,7 +2160,6 @@ const createBeaconContractV1 = oc.route({
2045
2160
  successDescription: "The audit has been created"
2046
2161
  }).errors({
2047
2162
  NOT_FOUND: {},
2048
- BAD_REQUEST: {},
2049
2163
  DNS_RESOLUTION_FAILED: { status: 400 }
2050
2164
  }).input(z.object({
2051
2165
  targetUrl: z.url().describe("The HTTPS URL of the MCP server to audit"),
@@ -2053,7 +2167,7 @@ const createBeaconContractV1 = oc.route({
2053
2167
  projectId: z.string().optional().describe("The project ID to associate the audit with"),
2054
2168
  excludeCategories: z.array(checkCategorySchema).optional().describe("Check categories to exclude from the audit")
2055
2169
  })).output(z.object({ id: z.string() }));
2056
- const getBeaconContractV1 = oc.route({
2170
+ const getBeaconContractV1 = base.route({
2057
2171
  path: "/v1/beacon/audits/{auditId}",
2058
2172
  method: "GET",
2059
2173
  summary: "Get a beacon audit",
@@ -2069,8 +2183,21 @@ const getBeaconContractV1 = oc.route({
2069
2183
  report: auditReportWithScreenshotsSchema.nullable()
2070
2184
  }));
2071
2185
  const contract = {
2072
- teams: { list: { v1: listTeamsContractV1 } },
2186
+ teams: {
2187
+ list: { v1: listTeamsContractV1 },
2188
+ getUsage: { v1: getTeamUsageContractV1 }
2189
+ },
2073
2190
  analytics: { get: { v1: getProjectAnalyticsContractV1 } },
2191
+ intents: { list: { v1: listIntentsContractV1 } },
2192
+ intentCategories: {
2193
+ list: { v1: listIntentCategoriesContractV1 },
2194
+ create: { v1: createIntentCategoryContractV1 },
2195
+ update: { v1: updateIntentCategoryContractV1 },
2196
+ delete: { v1: deleteIntentCategoryContractV1 },
2197
+ link: { v1: linkIntentCategoryContractV1 },
2198
+ unlink: { v1: unlinkIntentCategoryContractV1 }
2199
+ },
2200
+ feedbacks: { list: { v1: listFeedbacksContractV1 } },
2074
2201
  deployments: {
2075
2202
  list: { v1: listDeploymentsContractV1 },
2076
2203
  get: { v1: getDeploymentContractV1 },
@@ -2117,4 +2244,4 @@ const contractForDocs = {
2117
2244
  deployments: deploymentsForDocs
2118
2245
  };
2119
2246
  //#endregion
2120
- export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
2247
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/api",
3
- "version": "0.0.0-dev.gd961425",
3
+ "version": "0.0.0-dev.gd963357",
4
4
  "description": "Contract for the Alpic API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -33,13 +33,13 @@
33
33
  "author": "Alpic",
34
34
  "license": "ISC",
35
35
  "dependencies": {
36
- "@orpc/contract": "^1.14.13",
36
+ "@orpc/contract": "^1.15.0",
37
37
  "ms": "^2.1.3",
38
38
  "zod": "^4.4.3"
39
39
  },
40
40
  "devDependencies": {
41
- "@orpc/openapi": "^1.14.13",
42
- "@orpc/zod": "^1.14.13",
41
+ "@orpc/openapi": "^1.15.0",
42
+ "@orpc/zod": "^1.15.0",
43
43
  "@total-typescript/tsconfig": "^1.0.4",
44
44
  "@types/ms": "^2.1.0",
45
45
  "shx": "^0.4.0",