@alpic-ai/api 0.0.0-staging.geece1d2 → 0.0.0-staging.gef9d36e
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 +285 -1
- package/dist/index.mjs +151 -11
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -170,6 +170,141 @@ declare const contract: {
|
|
|
170
170
|
}>, Record<never, never>>;
|
|
171
171
|
};
|
|
172
172
|
};
|
|
173
|
+
intentCategories: {
|
|
174
|
+
list: {
|
|
175
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
176
|
+
environmentId: z.ZodString;
|
|
177
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
color: z.ZodEnum<{
|
|
181
|
+
red: "red";
|
|
182
|
+
orange: "orange";
|
|
183
|
+
yellow: "yellow";
|
|
184
|
+
green: "green";
|
|
185
|
+
blue: "blue";
|
|
186
|
+
purple: "purple";
|
|
187
|
+
pink: "pink";
|
|
188
|
+
gray: "gray";
|
|
189
|
+
}>;
|
|
190
|
+
intentCount: z.ZodNumber;
|
|
191
|
+
}, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
192
|
+
BAD_REQUEST: {};
|
|
193
|
+
}>, {
|
|
194
|
+
NOT_FOUND: {};
|
|
195
|
+
}>, Record<never, never>>;
|
|
196
|
+
};
|
|
197
|
+
create: {
|
|
198
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
199
|
+
environmentId: z.ZodString;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
202
|
+
red: "red";
|
|
203
|
+
orange: "orange";
|
|
204
|
+
yellow: "yellow";
|
|
205
|
+
green: "green";
|
|
206
|
+
blue: "blue";
|
|
207
|
+
purple: "purple";
|
|
208
|
+
pink: "pink";
|
|
209
|
+
gray: "gray";
|
|
210
|
+
}>>;
|
|
211
|
+
intentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
212
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
215
|
+
environmentId: z.ZodString;
|
|
216
|
+
name: z.ZodString;
|
|
217
|
+
color: z.ZodEnum<{
|
|
218
|
+
red: "red";
|
|
219
|
+
orange: "orange";
|
|
220
|
+
yellow: "yellow";
|
|
221
|
+
green: "green";
|
|
222
|
+
blue: "blue";
|
|
223
|
+
purple: "purple";
|
|
224
|
+
pink: "pink";
|
|
225
|
+
gray: "gray";
|
|
226
|
+
}>;
|
|
227
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
228
|
+
BAD_REQUEST: {};
|
|
229
|
+
}>, {
|
|
230
|
+
NOT_FOUND: {};
|
|
231
|
+
}>, Record<never, never>>;
|
|
232
|
+
};
|
|
233
|
+
update: {
|
|
234
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
235
|
+
environmentId: z.ZodString;
|
|
236
|
+
categoryId: z.ZodString;
|
|
237
|
+
name: z.ZodOptional<z.ZodString>;
|
|
238
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
239
|
+
red: "red";
|
|
240
|
+
orange: "orange";
|
|
241
|
+
yellow: "yellow";
|
|
242
|
+
green: "green";
|
|
243
|
+
blue: "blue";
|
|
244
|
+
purple: "purple";
|
|
245
|
+
pink: "pink";
|
|
246
|
+
gray: "gray";
|
|
247
|
+
}>>;
|
|
248
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
249
|
+
id: z.ZodString;
|
|
250
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
251
|
+
environmentId: z.ZodString;
|
|
252
|
+
name: z.ZodString;
|
|
253
|
+
color: z.ZodEnum<{
|
|
254
|
+
red: "red";
|
|
255
|
+
orange: "orange";
|
|
256
|
+
yellow: "yellow";
|
|
257
|
+
green: "green";
|
|
258
|
+
blue: "blue";
|
|
259
|
+
purple: "purple";
|
|
260
|
+
pink: "pink";
|
|
261
|
+
gray: "gray";
|
|
262
|
+
}>;
|
|
263
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
264
|
+
BAD_REQUEST: {};
|
|
265
|
+
}>, {
|
|
266
|
+
NOT_FOUND: {};
|
|
267
|
+
}>, Record<never, never>>;
|
|
268
|
+
};
|
|
269
|
+
delete: {
|
|
270
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
271
|
+
environmentId: z.ZodString;
|
|
272
|
+
categoryId: z.ZodString;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
success: z.ZodLiteral<true>;
|
|
275
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
276
|
+
BAD_REQUEST: {};
|
|
277
|
+
}>, {
|
|
278
|
+
NOT_FOUND: {};
|
|
279
|
+
}>, Record<never, never>>;
|
|
280
|
+
};
|
|
281
|
+
link: {
|
|
282
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
283
|
+
environmentId: z.ZodString;
|
|
284
|
+
categoryId: z.ZodString;
|
|
285
|
+
intentIds: z.ZodArray<z.ZodString>;
|
|
286
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
287
|
+
success: z.ZodLiteral<true>;
|
|
288
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
289
|
+
BAD_REQUEST: {};
|
|
290
|
+
}>, {
|
|
291
|
+
NOT_FOUND: {};
|
|
292
|
+
}>, Record<never, never>>;
|
|
293
|
+
};
|
|
294
|
+
unlink: {
|
|
295
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
296
|
+
environmentId: z.ZodString;
|
|
297
|
+
categoryId: z.ZodString;
|
|
298
|
+
intentIds: z.ZodArray<z.ZodString>;
|
|
299
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
300
|
+
success: z.ZodLiteral<true>;
|
|
301
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
302
|
+
BAD_REQUEST: {};
|
|
303
|
+
}>, {
|
|
304
|
+
NOT_FOUND: {};
|
|
305
|
+
}>, Record<never, never>>;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
173
308
|
feedbacks: {
|
|
174
309
|
list: {
|
|
175
310
|
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -1303,6 +1438,141 @@ declare const contractForDocs: {
|
|
|
1303
1438
|
}>, Record<never, never>>;
|
|
1304
1439
|
};
|
|
1305
1440
|
};
|
|
1441
|
+
intentCategories: {
|
|
1442
|
+
list: {
|
|
1443
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1444
|
+
environmentId: z.ZodString;
|
|
1445
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1446
|
+
id: z.ZodString;
|
|
1447
|
+
name: z.ZodString;
|
|
1448
|
+
color: z.ZodEnum<{
|
|
1449
|
+
red: "red";
|
|
1450
|
+
orange: "orange";
|
|
1451
|
+
yellow: "yellow";
|
|
1452
|
+
green: "green";
|
|
1453
|
+
blue: "blue";
|
|
1454
|
+
purple: "purple";
|
|
1455
|
+
pink: "pink";
|
|
1456
|
+
gray: "gray";
|
|
1457
|
+
}>;
|
|
1458
|
+
intentCount: z.ZodNumber;
|
|
1459
|
+
}, z.core.$strip>>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1460
|
+
BAD_REQUEST: {};
|
|
1461
|
+
}>, {
|
|
1462
|
+
NOT_FOUND: {};
|
|
1463
|
+
}>, Record<never, never>>;
|
|
1464
|
+
};
|
|
1465
|
+
create: {
|
|
1466
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1467
|
+
environmentId: z.ZodString;
|
|
1468
|
+
name: z.ZodString;
|
|
1469
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
1470
|
+
red: "red";
|
|
1471
|
+
orange: "orange";
|
|
1472
|
+
yellow: "yellow";
|
|
1473
|
+
green: "green";
|
|
1474
|
+
blue: "blue";
|
|
1475
|
+
purple: "purple";
|
|
1476
|
+
pink: "pink";
|
|
1477
|
+
gray: "gray";
|
|
1478
|
+
}>>;
|
|
1479
|
+
intentIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1480
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1481
|
+
id: z.ZodString;
|
|
1482
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
1483
|
+
environmentId: z.ZodString;
|
|
1484
|
+
name: z.ZodString;
|
|
1485
|
+
color: z.ZodEnum<{
|
|
1486
|
+
red: "red";
|
|
1487
|
+
orange: "orange";
|
|
1488
|
+
yellow: "yellow";
|
|
1489
|
+
green: "green";
|
|
1490
|
+
blue: "blue";
|
|
1491
|
+
purple: "purple";
|
|
1492
|
+
pink: "pink";
|
|
1493
|
+
gray: "gray";
|
|
1494
|
+
}>;
|
|
1495
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1496
|
+
BAD_REQUEST: {};
|
|
1497
|
+
}>, {
|
|
1498
|
+
NOT_FOUND: {};
|
|
1499
|
+
}>, Record<never, never>>;
|
|
1500
|
+
};
|
|
1501
|
+
update: {
|
|
1502
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1503
|
+
environmentId: z.ZodString;
|
|
1504
|
+
categoryId: z.ZodString;
|
|
1505
|
+
name: z.ZodOptional<z.ZodString>;
|
|
1506
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
1507
|
+
red: "red";
|
|
1508
|
+
orange: "orange";
|
|
1509
|
+
yellow: "yellow";
|
|
1510
|
+
green: "green";
|
|
1511
|
+
blue: "blue";
|
|
1512
|
+
purple: "purple";
|
|
1513
|
+
pink: "pink";
|
|
1514
|
+
gray: "gray";
|
|
1515
|
+
}>>;
|
|
1516
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1517
|
+
id: z.ZodString;
|
|
1518
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
1519
|
+
environmentId: z.ZodString;
|
|
1520
|
+
name: z.ZodString;
|
|
1521
|
+
color: z.ZodEnum<{
|
|
1522
|
+
red: "red";
|
|
1523
|
+
orange: "orange";
|
|
1524
|
+
yellow: "yellow";
|
|
1525
|
+
green: "green";
|
|
1526
|
+
blue: "blue";
|
|
1527
|
+
purple: "purple";
|
|
1528
|
+
pink: "pink";
|
|
1529
|
+
gray: "gray";
|
|
1530
|
+
}>;
|
|
1531
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1532
|
+
BAD_REQUEST: {};
|
|
1533
|
+
}>, {
|
|
1534
|
+
NOT_FOUND: {};
|
|
1535
|
+
}>, Record<never, never>>;
|
|
1536
|
+
};
|
|
1537
|
+
delete: {
|
|
1538
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1539
|
+
environmentId: z.ZodString;
|
|
1540
|
+
categoryId: z.ZodString;
|
|
1541
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1542
|
+
success: z.ZodLiteral<true>;
|
|
1543
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1544
|
+
BAD_REQUEST: {};
|
|
1545
|
+
}>, {
|
|
1546
|
+
NOT_FOUND: {};
|
|
1547
|
+
}>, Record<never, never>>;
|
|
1548
|
+
};
|
|
1549
|
+
link: {
|
|
1550
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1551
|
+
environmentId: z.ZodString;
|
|
1552
|
+
categoryId: z.ZodString;
|
|
1553
|
+
intentIds: z.ZodArray<z.ZodString>;
|
|
1554
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1555
|
+
success: z.ZodLiteral<true>;
|
|
1556
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1557
|
+
BAD_REQUEST: {};
|
|
1558
|
+
}>, {
|
|
1559
|
+
NOT_FOUND: {};
|
|
1560
|
+
}>, Record<never, never>>;
|
|
1561
|
+
};
|
|
1562
|
+
unlink: {
|
|
1563
|
+
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
1564
|
+
environmentId: z.ZodString;
|
|
1565
|
+
categoryId: z.ZodString;
|
|
1566
|
+
intentIds: z.ZodArray<z.ZodString>;
|
|
1567
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1568
|
+
success: z.ZodLiteral<true>;
|
|
1569
|
+
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
|
|
1570
|
+
BAD_REQUEST: {};
|
|
1571
|
+
}>, {
|
|
1572
|
+
NOT_FOUND: {};
|
|
1573
|
+
}>, Record<never, never>>;
|
|
1574
|
+
};
|
|
1575
|
+
};
|
|
1306
1576
|
feedbacks: {
|
|
1307
1577
|
list: {
|
|
1308
1578
|
v1: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
@@ -2142,6 +2412,20 @@ type RouteAuthMeta = {
|
|
|
2142
2412
|
authScope?: AuthScope;
|
|
2143
2413
|
};
|
|
2144
2414
|
//#endregion
|
|
2415
|
+
//#region ../domains/src/intents/schemas.d.ts
|
|
2416
|
+
declare const intentCategoryColorSchema: z.ZodEnum<{
|
|
2417
|
+
red: "red";
|
|
2418
|
+
orange: "orange";
|
|
2419
|
+
yellow: "yellow";
|
|
2420
|
+
green: "green";
|
|
2421
|
+
blue: "blue";
|
|
2422
|
+
purple: "purple";
|
|
2423
|
+
pink: "pink";
|
|
2424
|
+
gray: "gray";
|
|
2425
|
+
}>;
|
|
2426
|
+
type IntentCategoryColor = z.infer<typeof intentCategoryColorSchema>;
|
|
2427
|
+
declare const INTENT_CATEGORY_COLORS: ("red" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "gray")[];
|
|
2428
|
+
//#endregion
|
|
2145
2429
|
//#region ../domains/src/platforms/schemas.d.ts
|
|
2146
2430
|
declare const platformSchema: z.ZodEnum<{
|
|
2147
2431
|
chatgpt: "chatgpt";
|
|
@@ -2221,4 +2505,4 @@ declare const serverFieldsSchema: z.ZodObject<{
|
|
|
2221
2505
|
}, z.core.$strip>>>;
|
|
2222
2506
|
}, z.core.$strip>;
|
|
2223
2507
|
//#endregion
|
|
2224
|
-
export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, ApiContext, AuthScope, PLATFORM_LABELS, type Platform, RouteAuthMeta, RouterInput, RouterOutput, Runtime, Transport, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
|
2508
|
+
export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, ApiContext, AuthScope, INTENT_CATEGORY_COLORS, type IntentCategoryColor, PLATFORM_LABELS, type Platform, RouteAuthMeta, RouterInput, RouterOutput, Runtime, Transport, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, intentCategoryColorSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -179,6 +179,7 @@ const PLATFORM_LABELS = {
|
|
|
179
179
|
};
|
|
180
180
|
const WAF_PLATFORMS = [
|
|
181
181
|
"akamai",
|
|
182
|
+
"cato",
|
|
182
183
|
"cloudflare",
|
|
183
184
|
"fastly"
|
|
184
185
|
];
|
|
@@ -256,6 +257,25 @@ z.object({
|
|
|
256
257
|
clientSecret: z.string(),
|
|
257
258
|
clientScopes: z.array(z.string())
|
|
258
259
|
});
|
|
260
|
+
const creditEntryReasonSchema = z.enum([
|
|
261
|
+
"free_seed",
|
|
262
|
+
"paid_conversion_floor",
|
|
263
|
+
"top_up",
|
|
264
|
+
"usage",
|
|
265
|
+
"admin_adjustment"
|
|
266
|
+
]);
|
|
267
|
+
z.enum(["playground"]);
|
|
268
|
+
z.number().int().min(500);
|
|
269
|
+
const creditActivityEntrySchema = z.object({
|
|
270
|
+
reason: creditEntryReasonSchema,
|
|
271
|
+
day: z.number(),
|
|
272
|
+
amountInNanoUSD: z.number(),
|
|
273
|
+
messageCount: z.number().nullable()
|
|
274
|
+
});
|
|
275
|
+
z.object({
|
|
276
|
+
balanceInNanoUSD: z.number(),
|
|
277
|
+
recentActivity: z.array(creditActivityEntrySchema)
|
|
278
|
+
});
|
|
259
279
|
const deploymentStatusSchema$1 = z.enum([
|
|
260
280
|
"ongoing",
|
|
261
281
|
"deployed",
|
|
@@ -424,7 +444,7 @@ const intentCategoryColorSchema = z.enum([
|
|
|
424
444
|
"pink",
|
|
425
445
|
"gray"
|
|
426
446
|
]);
|
|
427
|
-
intentCategoryColorSchema.options;
|
|
447
|
+
const INTENT_CATEGORY_COLORS = intentCategoryColorSchema.options;
|
|
428
448
|
const intentCategorySchema = z.object({
|
|
429
449
|
id: z.string(),
|
|
430
450
|
createdAt: z.coerce.date(),
|
|
@@ -432,7 +452,7 @@ const intentCategorySchema = z.object({
|
|
|
432
452
|
name: z.string(),
|
|
433
453
|
color: intentCategoryColorSchema
|
|
434
454
|
});
|
|
435
|
-
z.object({
|
|
455
|
+
const intentCategorySummarySchema = z.object({
|
|
436
456
|
id: z.string(),
|
|
437
457
|
name: z.string(),
|
|
438
458
|
color: intentCategoryColorSchema,
|
|
@@ -503,6 +523,16 @@ z.object({
|
|
|
503
523
|
createdAt: z.coerce.date(),
|
|
504
524
|
updatedAt: z.coerce.date()
|
|
505
525
|
});
|
|
526
|
+
const alpicMcpRequestLogSchema = z.object({
|
|
527
|
+
type: z.literal("mcp_request"),
|
|
528
|
+
method: z.string()
|
|
529
|
+
});
|
|
530
|
+
const alpicMcpErrorLogSchema = z.object({
|
|
531
|
+
type: z.literal("mcp_error"),
|
|
532
|
+
method: z.string(),
|
|
533
|
+
error: z.string()
|
|
534
|
+
});
|
|
535
|
+
z.union([alpicMcpRequestLogSchema, alpicMcpErrorLogSchema]);
|
|
506
536
|
z.enum([
|
|
507
537
|
"INFO",
|
|
508
538
|
"WARNING",
|
|
@@ -1398,12 +1428,6 @@ const chatgptSubmissionSchemaInternal = submissionMetaFieldsSchema.extend({
|
|
|
1398
1428
|
});
|
|
1399
1429
|
z.discriminatedUnion("platform", [claudeSubmissionSchemaInternal, chatgptSubmissionSchemaInternal]);
|
|
1400
1430
|
z.union([claudeSubmissionDraftSchema, chatgptSubmissionDraftSchema]);
|
|
1401
|
-
({
|
|
1402
|
-
free: 1e4,
|
|
1403
|
-
pro: 2e5,
|
|
1404
|
-
business: 2e6,
|
|
1405
|
-
enterprise: null
|
|
1406
|
-
}).free;
|
|
1407
1431
|
z.literal([
|
|
1408
1432
|
100,
|
|
1409
1433
|
75,
|
|
@@ -1426,12 +1450,49 @@ const customerUsageSchema = z.object({
|
|
|
1426
1450
|
periodEnd: z.number()
|
|
1427
1451
|
});
|
|
1428
1452
|
const partnerDiscountSchema = z.object({ endsAt: z.number() });
|
|
1429
|
-
z.object({ balanceInNanoUSD: z.number() });
|
|
1430
1453
|
z.object({
|
|
1431
1454
|
customerCredits: customerCreditsSchema.nullable(),
|
|
1432
1455
|
customerUsage: customerUsageSchema.nullable(),
|
|
1433
1456
|
partnerDiscount: partnerDiscountSchema.nullable()
|
|
1434
1457
|
});
|
|
1458
|
+
const telemetrySignalSchema = z.enum([
|
|
1459
|
+
"logs",
|
|
1460
|
+
"metrics",
|
|
1461
|
+
"traces"
|
|
1462
|
+
]);
|
|
1463
|
+
const otlpProtocolSchema = z.enum(["http/protobuf", "http/json"]);
|
|
1464
|
+
const otlpEndpointSchema = z.string().trim().min(1).max(2048);
|
|
1465
|
+
const OTLP_HEADER_VALUE_MAX_LENGTH = 2048;
|
|
1466
|
+
const otlpHeaderNameSchema = z.string().trim().min(1, "Enter a header name").max(128).regex(/^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/, "Use letters, digits and !#$%&'*+-.^_`|~ only");
|
|
1467
|
+
const otlpHeaderValueSchema = z.string().trim().max(OTLP_HEADER_VALUE_MAX_LENGTH).refine((value) => !/[\r\n]/.test(value), "Line breaks are not allowed in a header value");
|
|
1468
|
+
const telemetryDestinationHeaderSchema = z.object({
|
|
1469
|
+
id: z.string(),
|
|
1470
|
+
name: otlpHeaderNameSchema,
|
|
1471
|
+
value: otlpHeaderValueSchema,
|
|
1472
|
+
isSecret: z.boolean()
|
|
1473
|
+
});
|
|
1474
|
+
const otlpPushFailureReasonSchema = z.enum([
|
|
1475
|
+
"credentials",
|
|
1476
|
+
"wrong-path",
|
|
1477
|
+
"wrong-protocol",
|
|
1478
|
+
"invalid-payload",
|
|
1479
|
+
"partial-rejection",
|
|
1480
|
+
"blocked-target",
|
|
1481
|
+
"timeout",
|
|
1482
|
+
"unreachable",
|
|
1483
|
+
"receiver-error",
|
|
1484
|
+
"unexpected-status"
|
|
1485
|
+
]);
|
|
1486
|
+
const telemetryDestinationStatusSchema = z.enum(["active", "suspended"]);
|
|
1487
|
+
z.object({
|
|
1488
|
+
id: z.string(),
|
|
1489
|
+
signal: telemetrySignalSchema,
|
|
1490
|
+
endpoint: otlpEndpointSchema,
|
|
1491
|
+
protocol: otlpProtocolSchema,
|
|
1492
|
+
headers: z.array(telemetryDestinationHeaderSchema),
|
|
1493
|
+
status: telemetryDestinationStatusSchema,
|
|
1494
|
+
lastFailureReason: otlpPushFailureReasonSchema.nullable()
|
|
1495
|
+
});
|
|
1435
1496
|
//#endregion
|
|
1436
1497
|
//#region src/auth-scope.ts
|
|
1437
1498
|
/** Accepts an API key or OAuth access token (default for most routes). */
|
|
@@ -1912,7 +1973,7 @@ const getProjectAnalyticsContractV1 = base.route({
|
|
|
1912
1973
|
startTimestamp: z.coerce.number().describe("Start timestamp in milliseconds"),
|
|
1913
1974
|
endTimestamp: z.coerce.number().describe("End timestamp in milliseconds"),
|
|
1914
1975
|
timeZone: z.string().describe("IANA timezone (e.g. Europe/Paris)")
|
|
1915
|
-
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <=
|
|
1976
|
+
}).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp > 0, { message: "End date must be after start date" }).refine(({ startTimestamp, endTimestamp }) => endTimestamp - startTimestamp <= 26784e5, { message: "Date range must be less than 1 month" }).refine(({ timeZone }) => Intl.supportedValuesOf("timeZone").includes(timeZone), { message: "Time zone must be a valid IANA timezone" })).output(z.object({
|
|
1916
1977
|
metadata: z.object({
|
|
1917
1978
|
startTimestamp: z.number(),
|
|
1918
1979
|
endTimestamp: z.number(),
|
|
@@ -1976,6 +2037,77 @@ const listFeedbacksContractV1 = base.route({
|
|
|
1976
2037
|
feedbacks: z.array(feedbackSchema.extend({ clientId: z.string().nullable() })),
|
|
1977
2038
|
totalCount: z.number().int().nonnegative()
|
|
1978
2039
|
}));
|
|
2040
|
+
const intentCategoryNameSchema = z.string().trim().min(1).max(100).describe("The category name");
|
|
2041
|
+
const categorizableIntentIdsSchema = z.array(z.string().trim().min(1)).min(1).max(100).describe("IDs of the intents to categorize");
|
|
2042
|
+
const listIntentCategoriesContractV1 = base.route({
|
|
2043
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
2044
|
+
method: "GET",
|
|
2045
|
+
summary: "List intent categories",
|
|
2046
|
+
description: "List intent categories for an environment, including how many intents each category is linked to",
|
|
2047
|
+
tags: ["insights"],
|
|
2048
|
+
successDescription: "The intent categories"
|
|
2049
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({ environmentId: z.string().describe("The ID of the environment") })).output(z.array(intentCategorySummarySchema));
|
|
2050
|
+
const createIntentCategoryContractV1 = base.route({
|
|
2051
|
+
path: "/v1/environments/{environmentId}/intent-categories",
|
|
2052
|
+
method: "POST",
|
|
2053
|
+
summary: "Create an intent category",
|
|
2054
|
+
description: "Create an intent category, optionally linking it to existing intents",
|
|
2055
|
+
tags: ["insights"],
|
|
2056
|
+
successDescription: "The created intent category"
|
|
2057
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2058
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2059
|
+
name: intentCategoryNameSchema,
|
|
2060
|
+
color: intentCategoryColorSchema.optional().describe("The category color; derived from the name when omitted"),
|
|
2061
|
+
intentIds: categorizableIntentIdsSchema.optional().describe("IDs of intents to link to the new category")
|
|
2062
|
+
})).output(intentCategorySchema);
|
|
2063
|
+
const updateIntentCategoryContractV1 = base.route({
|
|
2064
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
2065
|
+
method: "PATCH",
|
|
2066
|
+
summary: "Update an intent category",
|
|
2067
|
+
description: "Rename or recolor an intent category",
|
|
2068
|
+
tags: ["insights"],
|
|
2069
|
+
successDescription: "The updated intent category"
|
|
2070
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2071
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2072
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2073
|
+
name: intentCategoryNameSchema.optional(),
|
|
2074
|
+
color: intentCategoryColorSchema.optional().describe("The category color")
|
|
2075
|
+
}).refine(({ name, color }) => name !== void 0 || color !== void 0, { message: "At least one of name or color must be provided" })).output(intentCategorySchema);
|
|
2076
|
+
const deleteIntentCategoryContractV1 = base.route({
|
|
2077
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}",
|
|
2078
|
+
method: "DELETE",
|
|
2079
|
+
summary: "Delete an intent category",
|
|
2080
|
+
description: "Delete an intent category; its intents are unlinked but not deleted",
|
|
2081
|
+
tags: ["insights"],
|
|
2082
|
+
successDescription: "The intent category has been deleted successfully"
|
|
2083
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2084
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2085
|
+
categoryId: z.string().describe("The ID of the category")
|
|
2086
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
2087
|
+
const linkIntentCategoryContractV1 = base.route({
|
|
2088
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/link",
|
|
2089
|
+
method: "POST",
|
|
2090
|
+
summary: "Link an intent category",
|
|
2091
|
+
description: "Link an intent category to intents; already linked intents are ignored",
|
|
2092
|
+
tags: ["insights"],
|
|
2093
|
+
successDescription: "The intents have been linked successfully"
|
|
2094
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2095
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2096
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2097
|
+
intentIds: categorizableIntentIdsSchema
|
|
2098
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
2099
|
+
const unlinkIntentCategoryContractV1 = base.route({
|
|
2100
|
+
path: "/v1/environments/{environmentId}/intent-categories/{categoryId}/unlink",
|
|
2101
|
+
method: "POST",
|
|
2102
|
+
summary: "Unlink an intent category",
|
|
2103
|
+
description: "Unlink an intent category from intents; intents without the category are ignored",
|
|
2104
|
+
tags: ["insights"],
|
|
2105
|
+
successDescription: "The intents have been unlinked successfully"
|
|
2106
|
+
}).errors({ NOT_FOUND: {} }).input(z.object({
|
|
2107
|
+
environmentId: z.string().describe("The ID of the environment"),
|
|
2108
|
+
categoryId: z.string().describe("The ID of the category"),
|
|
2109
|
+
intentIds: categorizableIntentIdsSchema
|
|
2110
|
+
})).output(z.object({ success: z.literal(true) }));
|
|
1979
2111
|
const listTeamsContractV1 = base.route({
|
|
1980
2112
|
path: "/v1/teams",
|
|
1981
2113
|
method: "GET",
|
|
@@ -2118,6 +2250,14 @@ const contract = {
|
|
|
2118
2250
|
},
|
|
2119
2251
|
analytics: { get: { v1: getProjectAnalyticsContractV1 } },
|
|
2120
2252
|
intents: { list: { v1: listIntentsContractV1 } },
|
|
2253
|
+
intentCategories: {
|
|
2254
|
+
list: { v1: listIntentCategoriesContractV1 },
|
|
2255
|
+
create: { v1: createIntentCategoryContractV1 },
|
|
2256
|
+
update: { v1: updateIntentCategoryContractV1 },
|
|
2257
|
+
delete: { v1: deleteIntentCategoryContractV1 },
|
|
2258
|
+
link: { v1: linkIntentCategoryContractV1 },
|
|
2259
|
+
unlink: { v1: unlinkIntentCategoryContractV1 }
|
|
2260
|
+
},
|
|
2121
2261
|
feedbacks: { list: { v1: listFeedbacksContractV1 } },
|
|
2122
2262
|
deployments: {
|
|
2123
2263
|
list: { v1: listDeploymentsContractV1 },
|
|
@@ -2165,4 +2305,4 @@ const contractForDocs = {
|
|
|
2165
2305
|
deployments: deploymentsForDocs
|
|
2166
2306
|
};
|
|
2167
2307
|
//#endregion
|
|
2168
|
-
export { AUTH_SCOPE_ANY, AUTH_SCOPE_USER, PLATFORM_LABELS, buildSettingsSchema, contract, contractForDocs, createEnvironmentContractV1, deploymentStatusSchema, environmentVariableSchema, environmentVariablesSchema, playgroundExamplePromptSchema, playgroundHeaderSchema, runtimeSchema, serverFieldsSchema, transportSchema, updateEnvironmentVariableSchema };
|
|
2308
|
+
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-staging.
|
|
3
|
+
"version": "0.0.0-staging.gef9d36e",
|
|
4
4
|
"description": "Contract for the Alpic API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.mjs",
|
|
@@ -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": "
|
|
58
|
+
"publish:npm": "../../scripts/publish-if-new.sh"
|
|
59
59
|
}
|
|
60
60
|
}
|