@alpic-ai/api 1.165.0 → 1.166.0

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.d.mts CHANGED
@@ -47,6 +47,26 @@ declare const contract: {
47
47
  BAD_REQUEST: {};
48
48
  }>, Record<never, never>>;
49
49
  };
50
+ getUsage: {
51
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
52
+ teamId: z.ZodString;
53
+ }, z.core.$strip>, z.ZodObject<{
54
+ teamId: z.ZodString;
55
+ plan: z.ZodNullable<z.ZodEnum<{
56
+ pro: "pro";
57
+ business: "business";
58
+ enterprise: "enterprise";
59
+ }>>;
60
+ periodStart: z.ZodCoercedDate<unknown>;
61
+ periodEnd: z.ZodCoercedDate<unknown>;
62
+ requestCount: z.ZodNumber;
63
+ includedRequests: z.ZodNullable<z.ZodNumber>;
64
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
65
+ BAD_REQUEST: {};
66
+ }>, {
67
+ NOT_FOUND: {};
68
+ }>, Record<never, never>>;
69
+ };
50
70
  };
51
71
  analytics: {
52
72
  get: {
@@ -100,6 +120,87 @@ declare const contract: {
100
120
  }>, Record<never, never>>;
101
121
  };
102
122
  };
123
+ intents: {
124
+ list: {
125
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
126
+ tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
127
+ clientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
+ categoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
+ sortDir: z.ZodDefault<z.ZodEnum<{
130
+ asc: "asc";
131
+ desc: "desc";
132
+ }>>;
133
+ environmentId: z.ZodString;
134
+ since: z.ZodDefault<z.ZodString>;
135
+ until: z.ZodOptional<z.ZodString>;
136
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
137
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
138
+ search: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>, z.ZodObject<{
140
+ intents: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ intentIds: z.ZodArray<z.ZodString>;
143
+ environmentId: z.ZodString;
144
+ message: z.ZodString;
145
+ toolName: z.ZodString;
146
+ createdAt: z.ZodCoercedDate<unknown>;
147
+ occurrenceCount: z.ZodNumber;
148
+ clientName: z.ZodNullable<z.ZodString>;
149
+ clientId: z.ZodNullable<z.ZodString>;
150
+ categories: z.ZodArray<z.ZodObject<{
151
+ id: z.ZodString;
152
+ name: z.ZodString;
153
+ color: z.ZodEnum<{
154
+ red: "red";
155
+ orange: "orange";
156
+ yellow: "yellow";
157
+ green: "green";
158
+ blue: "blue";
159
+ purple: "purple";
160
+ pink: "pink";
161
+ gray: "gray";
162
+ }>;
163
+ }, z.core.$strip>>;
164
+ }, z.core.$strip>>;
165
+ totalCount: z.ZodNumber;
166
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
167
+ BAD_REQUEST: {};
168
+ }>, {
169
+ NOT_FOUND: {};
170
+ }>, Record<never, never>>;
171
+ };
172
+ };
173
+ feedbacks: {
174
+ list: {
175
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
176
+ clientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
177
+ environmentId: z.ZodString;
178
+ since: z.ZodDefault<z.ZodString>;
179
+ until: z.ZodOptional<z.ZodString>;
180
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
181
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
182
+ search: z.ZodOptional<z.ZodString>;
183
+ }, z.core.$strip>, z.ZodObject<{
184
+ feedbacks: z.ZodArray<z.ZodObject<{
185
+ id: z.ZodString;
186
+ createdAt: z.ZodCoercedDate<unknown>;
187
+ environmentId: z.ZodString;
188
+ content: z.ZodString;
189
+ source: z.ZodEnum<{
190
+ model: "model";
191
+ user: "user";
192
+ }>;
193
+ clientName: z.ZodNullable<z.ZodString>;
194
+ clientId: z.ZodNullable<z.ZodString>;
195
+ }, z.core.$strip>>;
196
+ totalCount: z.ZodNumber;
197
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
198
+ BAD_REQUEST: {};
199
+ }>, {
200
+ NOT_FOUND: {};
201
+ }>, Record<never, never>>;
202
+ };
203
+ };
103
204
  deployments: {
104
205
  list: {
105
206
  v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
@@ -1079,6 +1180,26 @@ declare const contractForDocs: {
1079
1180
  BAD_REQUEST: {};
1080
1181
  }>, Record<never, never>>;
1081
1182
  };
1183
+ getUsage: {
1184
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1185
+ teamId: z.ZodString;
1186
+ }, z.core.$strip>, z.ZodObject<{
1187
+ teamId: z.ZodString;
1188
+ plan: z.ZodNullable<z.ZodEnum<{
1189
+ pro: "pro";
1190
+ business: "business";
1191
+ enterprise: "enterprise";
1192
+ }>>;
1193
+ periodStart: z.ZodCoercedDate<unknown>;
1194
+ periodEnd: z.ZodCoercedDate<unknown>;
1195
+ requestCount: z.ZodNumber;
1196
+ includedRequests: z.ZodNullable<z.ZodNumber>;
1197
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
1198
+ BAD_REQUEST: {};
1199
+ }>, {
1200
+ NOT_FOUND: {};
1201
+ }>, Record<never, never>>;
1202
+ };
1082
1203
  };
1083
1204
  analytics: {
1084
1205
  get: {
@@ -1132,6 +1253,87 @@ declare const contractForDocs: {
1132
1253
  }>, Record<never, never>>;
1133
1254
  };
1134
1255
  };
1256
+ intents: {
1257
+ list: {
1258
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1259
+ tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1260
+ clientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1261
+ categoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1262
+ sortDir: z.ZodDefault<z.ZodEnum<{
1263
+ asc: "asc";
1264
+ desc: "desc";
1265
+ }>>;
1266
+ environmentId: z.ZodString;
1267
+ since: z.ZodDefault<z.ZodString>;
1268
+ until: z.ZodOptional<z.ZodString>;
1269
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1270
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1271
+ search: z.ZodOptional<z.ZodString>;
1272
+ }, z.core.$strip>, z.ZodObject<{
1273
+ intents: z.ZodArray<z.ZodObject<{
1274
+ id: z.ZodString;
1275
+ intentIds: z.ZodArray<z.ZodString>;
1276
+ environmentId: z.ZodString;
1277
+ message: z.ZodString;
1278
+ toolName: z.ZodString;
1279
+ createdAt: z.ZodCoercedDate<unknown>;
1280
+ occurrenceCount: z.ZodNumber;
1281
+ clientName: z.ZodNullable<z.ZodString>;
1282
+ clientId: z.ZodNullable<z.ZodString>;
1283
+ categories: z.ZodArray<z.ZodObject<{
1284
+ id: z.ZodString;
1285
+ name: z.ZodString;
1286
+ color: z.ZodEnum<{
1287
+ red: "red";
1288
+ orange: "orange";
1289
+ yellow: "yellow";
1290
+ green: "green";
1291
+ blue: "blue";
1292
+ purple: "purple";
1293
+ pink: "pink";
1294
+ gray: "gray";
1295
+ }>;
1296
+ }, z.core.$strip>>;
1297
+ }, z.core.$strip>>;
1298
+ totalCount: z.ZodNumber;
1299
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
1300
+ BAD_REQUEST: {};
1301
+ }>, {
1302
+ NOT_FOUND: {};
1303
+ }>, Record<never, never>>;
1304
+ };
1305
+ };
1306
+ feedbacks: {
1307
+ list: {
1308
+ v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
1309
+ clientIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1310
+ environmentId: z.ZodString;
1311
+ since: z.ZodDefault<z.ZodString>;
1312
+ until: z.ZodOptional<z.ZodString>;
1313
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1314
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
1315
+ search: z.ZodOptional<z.ZodString>;
1316
+ }, z.core.$strip>, z.ZodObject<{
1317
+ feedbacks: z.ZodArray<z.ZodObject<{
1318
+ id: z.ZodString;
1319
+ createdAt: z.ZodCoercedDate<unknown>;
1320
+ environmentId: z.ZodString;
1321
+ content: z.ZodString;
1322
+ source: z.ZodEnum<{
1323
+ model: "model";
1324
+ user: "user";
1325
+ }>;
1326
+ clientName: z.ZodNullable<z.ZodString>;
1327
+ clientId: z.ZodNullable<z.ZodString>;
1328
+ }, z.core.$strip>>;
1329
+ totalCount: z.ZodNumber;
1330
+ }, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
1331
+ BAD_REQUEST: {};
1332
+ }>, {
1333
+ NOT_FOUND: {};
1334
+ }>, Record<never, never>>;
1335
+ };
1336
+ };
1135
1337
  environments: {
1136
1338
  create: {
1137
1339
  v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
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(),
@@ -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,10 +1558,11 @@ 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
  };
1565
+ const timeInputSchema = z.string().refine(isValidTimeInput, { message: "Invalid time. Use relative (1h, 30m, 2d) or ISO 8601 format." });
1553
1566
  const base = oc.errors({ BAD_REQUEST: {} });
1554
1567
  const createEnvironmentContractV1 = base.route({
1555
1568
  path: "/v1/environments",
@@ -1827,8 +1840,8 @@ const getLogsContractV1 = base.route({
1827
1840
  successDescription: "The logs"
1828
1841
  }).errors({ NOT_FOUND: {} }).input(z.object({
1829
1842
  environmentId: z.string().describe("The ID of the environment"),
1830
- 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)"),
1831
- 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"),
1832
1845
  limit: z.coerce.number().int().min(1).max(1e3).default(1e3).describe("Maximum number of log entries to return."),
1833
1846
  level: z.array(z.enum([
1834
1847
  "INFO",
@@ -1909,6 +1922,60 @@ const getProjectAnalyticsContractV1 = base.route({
1909
1922
  }),
1910
1923
  timeSeries: analyticsTimeSeriesSchema
1911
1924
  }));
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
+ }));
1912
1979
  const listTeamsContractV1 = base.route({
1913
1980
  path: "/v1/teams",
1914
1981
  method: "GET",
@@ -1922,6 +1989,21 @@ const listTeamsContractV1 = base.route({
1922
1989
  createdAt: z.coerce.date(),
1923
1990
  hasStripeAccount: z.boolean()
1924
1991
  })));
1992
+ const getTeamUsageContractV1 = base.route({
1993
+ path: "/v1/teams/{teamId}/usage",
1994
+ method: "GET",
1995
+ summary: "Get team usage",
1996
+ 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.",
1997
+ tags: ["teams"],
1998
+ successDescription: "The current billing window usage"
1999
+ }).errors({ NOT_FOUND: {} }).input(z.object({ teamId: z.string().describe("The ID of the team") })).output(z.object({
2000
+ teamId: z.string(),
2001
+ plan: subscriptionPlanSchema.nullable().describe("The plan in force for the window, null on the Free plan"),
2002
+ periodStart: z.coerce.date().describe("Start of the current billing window"),
2003
+ periodEnd: z.coerce.date().describe("End of the current billing window"),
2004
+ requestCount: z.number().int().describe("MCP requests settled during the current billing window"),
2005
+ includedRequests: z.number().int().nullable().describe("Requests included in the plan for one window, null when the allowance is contract-specific")
2006
+ }));
1925
2007
  const getTunnelTicketContractV1 = base.route({
1926
2008
  path: "/v1/tunnels/ticket",
1927
2009
  method: "GET",
@@ -2030,8 +2112,13 @@ const getBeaconContractV1 = base.route({
2030
2112
  report: auditReportWithScreenshotsSchema.nullable()
2031
2113
  }));
2032
2114
  const contract = {
2033
- teams: { list: { v1: listTeamsContractV1 } },
2115
+ teams: {
2116
+ list: { v1: listTeamsContractV1 },
2117
+ getUsage: { v1: getTeamUsageContractV1 }
2118
+ },
2034
2119
  analytics: { get: { v1: getProjectAnalyticsContractV1 } },
2120
+ intents: { list: { v1: listIntentsContractV1 } },
2121
+ feedbacks: { list: { v1: listFeedbacksContractV1 } },
2035
2122
  deployments: {
2036
2123
  list: { v1: listDeploymentsContractV1 },
2037
2124
  get: { v1: getDeploymentContractV1 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alpic-ai/api",
3
- "version": "1.165.0",
3
+ "version": "1.166.0",
4
4
  "description": "Contract for the Alpic API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",