@alpic-ai/api 0.0.0-dev.ge83e64e → 0.0.0-dev.ge84792d

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