@kortyx/telemetry-contracts 0.1.0 → 0.2.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/CHANGELOG.md +18 -0
- package/LICENSE +51 -43
- package/dist/index.d.ts +1687 -1
- package/dist/index.js +574 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,13 +21,57 @@ var index_exports = {};
|
|
|
21
21
|
__export(index_exports, {
|
|
22
22
|
EnsureWorkflowTopologyRequestSchema: () => EnsureWorkflowTopologyRequestSchema,
|
|
23
23
|
EnsureWorkflowTopologyResponseSchema: () => EnsureWorkflowTopologyResponseSchema,
|
|
24
|
+
STUDIO_TIME_RANGES: () => STUDIO_TIME_RANGES,
|
|
25
|
+
StudioCatalogsResponseSchema: () => StudioCatalogsResponseSchema,
|
|
26
|
+
StudioChangeResourceSchema: () => StudioChangeResourceSchema,
|
|
27
|
+
StudioChangeSchema: () => StudioChangeSchema,
|
|
28
|
+
StudioContextResponseSchema: () => StudioContextResponseSchema,
|
|
29
|
+
StudioDetailEventSchema: () => StudioDetailEventSchema,
|
|
30
|
+
StudioInterruptDetailResponseSchema: () => StudioInterruptDetailResponseSchema,
|
|
31
|
+
StudioInterruptInteractionModeSchema: () => StudioInterruptInteractionModeSchema,
|
|
32
|
+
StudioInterruptOptionSchema: () => StudioInterruptOptionSchema,
|
|
33
|
+
StudioInterruptSchema: () => StudioInterruptSchema,
|
|
34
|
+
StudioInterruptStatusSchema: () => StudioInterruptStatusSchema,
|
|
35
|
+
StudioInterruptTypeSchema: () => StudioInterruptTypeSchema,
|
|
36
|
+
StudioInterruptsResponseSchema: () => StudioInterruptsResponseSchema,
|
|
37
|
+
StudioMetricSchema: () => StudioMetricSchema,
|
|
38
|
+
StudioPricingSourceSchema: () => StudioPricingSourceSchema,
|
|
39
|
+
StudioPricingStatusSchema: () => StudioPricingStatusSchema,
|
|
40
|
+
StudioResumeOutcomeSchema: () => StudioResumeOutcomeSchema,
|
|
41
|
+
StudioRunDetailResponseSchema: () => StudioRunDetailResponseSchema,
|
|
42
|
+
StudioRunSchema: () => StudioRunSchema,
|
|
43
|
+
StudioRunStatusSchema: () => StudioRunStatusSchema,
|
|
44
|
+
StudioRunsResponseSchema: () => StudioRunsResponseSchema,
|
|
45
|
+
StudioSessionDetailResponseSchema: () => StudioSessionDetailResponseSchema,
|
|
46
|
+
StudioSessionSchema: () => StudioSessionSchema,
|
|
47
|
+
StudioSessionsResponseSchema: () => StudioSessionsResponseSchema,
|
|
48
|
+
StudioTimeRangeContextSchema: () => StudioTimeRangeContextSchema,
|
|
49
|
+
StudioTimeRangeQuerySchema: () => StudioTimeRangeQuerySchema,
|
|
50
|
+
StudioTimeRangeSchema: () => StudioTimeRangeSchema,
|
|
51
|
+
StudioWorkflowHealthSchema: () => StudioWorkflowHealthSchema,
|
|
52
|
+
StudioWorkflowInternalEdgeSchema: () => StudioWorkflowInternalEdgeSchema,
|
|
53
|
+
StudioWorkflowNodeSchema: () => StudioWorkflowNodeSchema,
|
|
54
|
+
StudioWorkflowSchema: () => StudioWorkflowSchema,
|
|
55
|
+
StudioWorkflowTransitionSchema: () => StudioWorkflowTransitionSchema,
|
|
56
|
+
StudioWorkflowsResponseSchema: () => StudioWorkflowsResponseSchema,
|
|
24
57
|
TELEMETRY_EVENT_TYPES: () => TELEMETRY_EVENT_TYPES,
|
|
58
|
+
TelemetryEventBatchResponseSchema: () => TelemetryEventBatchResponseSchema,
|
|
25
59
|
TelemetryEventBatchSchema: () => TelemetryEventBatchSchema,
|
|
26
60
|
TelemetryEventSchema: () => TelemetryEventSchema,
|
|
27
61
|
TelemetryEventTypeSchema: () => TelemetryEventTypeSchema,
|
|
62
|
+
TelemetryPricingHintSchema: () => TelemetryPricingHintSchema,
|
|
63
|
+
TelemetryPricingLineItemSchema: () => TelemetryPricingLineItemSchema,
|
|
64
|
+
TelemetryPricingSourceSchema: () => TelemetryPricingSourceSchema,
|
|
65
|
+
TelemetryPricingUnitSchema: () => TelemetryPricingUnitSchema,
|
|
66
|
+
TelemetryPricingUsageTypeSchema: () => TelemetryPricingUsageTypeSchema,
|
|
28
67
|
TelemetryServiceSchema: () => TelemetryServiceSchema,
|
|
68
|
+
TelemetryUnitPriceSchema: () => TelemetryUnitPriceSchema,
|
|
69
|
+
TelemetryUsageItemSchema: () => TelemetryUsageItemSchema,
|
|
29
70
|
WorkflowTopologyEdgeSchema: () => WorkflowTopologyEdgeSchema,
|
|
30
|
-
WorkflowTopologyNodeSchema: () => WorkflowTopologyNodeSchema
|
|
71
|
+
WorkflowTopologyNodeSchema: () => WorkflowTopologyNodeSchema,
|
|
72
|
+
WorkflowTopologyTransitionSchema: () => WorkflowTopologyTransitionSchema,
|
|
73
|
+
resolveStudioInterruptStatus: () => resolveStudioInterruptStatus,
|
|
74
|
+
resolveStudioTimeRange: () => resolveStudioTimeRange
|
|
31
75
|
});
|
|
32
76
|
module.exports = __toCommonJS(index_exports);
|
|
33
77
|
var import_zod = require("zod");
|
|
@@ -66,6 +110,12 @@ var WorkflowTopologyEdgeSchema = import_zod.z.object({
|
|
|
66
110
|
targetNodeId: import_zod.z.string().min(1),
|
|
67
111
|
condition: import_zod.z.string().optional()
|
|
68
112
|
}).strict();
|
|
113
|
+
var WorkflowTopologyTransitionSchema = import_zod.z.object({
|
|
114
|
+
sourceNodeId: import_zod.z.string().min(1).optional(),
|
|
115
|
+
targetWorkflowId: import_zod.z.string().min(1),
|
|
116
|
+
condition: import_zod.z.string().optional(),
|
|
117
|
+
intent: import_zod.z.string().optional()
|
|
118
|
+
}).strict();
|
|
69
119
|
var EnsureWorkflowTopologyRequestSchema = import_zod.z.object({
|
|
70
120
|
schemaVersion: import_zod.z.literal(1),
|
|
71
121
|
environment: import_zod.z.string().min(1),
|
|
@@ -77,7 +127,8 @@ var EnsureWorkflowTopologyRequestSchema = import_zod.z.object({
|
|
|
77
127
|
tags: import_zod.z.array(import_zod.z.string()).optional(),
|
|
78
128
|
topologyHash: import_zod.z.string().regex(/^[a-f0-9]{64}$/),
|
|
79
129
|
nodes: import_zod.z.array(WorkflowTopologyNodeSchema),
|
|
80
|
-
edges: import_zod.z.array(WorkflowTopologyEdgeSchema)
|
|
130
|
+
edges: import_zod.z.array(WorkflowTopologyEdgeSchema),
|
|
131
|
+
transitions: import_zod.z.array(WorkflowTopologyTransitionSchema).optional()
|
|
81
132
|
}).strict()
|
|
82
133
|
}).strict();
|
|
83
134
|
var EnsureWorkflowTopologyResponseSchema = import_zod.z.object({ workflowRevisionId: import_zod.z.string().min(1), created: import_zod.z.boolean() }).strict();
|
|
@@ -109,16 +160,536 @@ var TelemetryEventSchema = import_zod.z.object({
|
|
|
109
160
|
payload: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown())
|
|
110
161
|
}).strict();
|
|
111
162
|
var TelemetryEventBatchSchema = import_zod.z.object({ events: import_zod.z.array(TelemetryEventSchema).min(1) }).strict();
|
|
163
|
+
var TelemetryEventBatchResponseSchema = import_zod.z.object({
|
|
164
|
+
accepted: import_zod.z.number().int().nonnegative(),
|
|
165
|
+
inserted: import_zod.z.number().int().nonnegative(),
|
|
166
|
+
duplicates: import_zod.z.number().int().nonnegative()
|
|
167
|
+
}).strict();
|
|
168
|
+
var TelemetryPricingSourceSchema = import_zod.z.enum([
|
|
169
|
+
"sdk",
|
|
170
|
+
"provider",
|
|
171
|
+
"custom",
|
|
172
|
+
"project-rate-card",
|
|
173
|
+
"default-rate-card"
|
|
174
|
+
]);
|
|
175
|
+
var TelemetryPricingUnitSchema = import_zod.z.enum([
|
|
176
|
+
"token",
|
|
177
|
+
"character",
|
|
178
|
+
"request",
|
|
179
|
+
"image",
|
|
180
|
+
"audio_second",
|
|
181
|
+
"audio_minute",
|
|
182
|
+
"video_second",
|
|
183
|
+
"video_minute",
|
|
184
|
+
"second",
|
|
185
|
+
"minute",
|
|
186
|
+
"custom"
|
|
187
|
+
]);
|
|
188
|
+
var TelemetryPricingUsageTypeSchema = import_zod.z.enum([
|
|
189
|
+
"input",
|
|
190
|
+
"output",
|
|
191
|
+
"reasoning",
|
|
192
|
+
"cache_read",
|
|
193
|
+
"cache_write",
|
|
194
|
+
"embedding",
|
|
195
|
+
"image_input",
|
|
196
|
+
"image_output",
|
|
197
|
+
"audio_input",
|
|
198
|
+
"audio_output",
|
|
199
|
+
"video_input",
|
|
200
|
+
"video_output",
|
|
201
|
+
"request",
|
|
202
|
+
"custom"
|
|
203
|
+
]);
|
|
204
|
+
var TelemetryUsageItemSchema = import_zod.z.object({
|
|
205
|
+
usageType: TelemetryPricingUsageTypeSchema,
|
|
206
|
+
quantity: import_zod.z.number().nonnegative(),
|
|
207
|
+
unit: TelemetryPricingUnitSchema,
|
|
208
|
+
label: import_zod.z.string().optional()
|
|
209
|
+
}).strict();
|
|
210
|
+
var TelemetryUnitPriceSchema = import_zod.z.object({
|
|
211
|
+
usageType: TelemetryPricingUsageTypeSchema,
|
|
212
|
+
unit: TelemetryPricingUnitSchema,
|
|
213
|
+
unitQuantity: import_zod.z.number().positive().default(1),
|
|
214
|
+
priceMicros: import_zod.z.number().int().nonnegative(),
|
|
215
|
+
label: import_zod.z.string().optional()
|
|
216
|
+
}).strict();
|
|
217
|
+
var TelemetryPricingLineItemSchema = import_zod.z.object({
|
|
218
|
+
usageType: TelemetryPricingUsageTypeSchema,
|
|
219
|
+
quantity: import_zod.z.number().nonnegative(),
|
|
220
|
+
unit: TelemetryPricingUnitSchema,
|
|
221
|
+
unitQuantity: import_zod.z.number().positive().default(1),
|
|
222
|
+
unitPriceMicros: import_zod.z.number().int().nonnegative().optional(),
|
|
223
|
+
totalCostMicros: import_zod.z.number().int().nonnegative().optional(),
|
|
224
|
+
label: import_zod.z.string().optional()
|
|
225
|
+
}).strict().refine(
|
|
226
|
+
(value) => value.totalCostMicros !== void 0 || value.unitPriceMicros !== void 0,
|
|
227
|
+
"line item requires totalCostMicros or unitPriceMicros"
|
|
228
|
+
);
|
|
229
|
+
var TelemetryPricingHintSchema = import_zod.z.object({
|
|
230
|
+
source: TelemetryPricingSourceSchema.extract(["sdk", "provider", "custom"]),
|
|
231
|
+
currency: import_zod.z.string().min(3).max(12).default("USD"),
|
|
232
|
+
actualCostMicros: import_zod.z.number().int().nonnegative().optional(),
|
|
233
|
+
lineItems: import_zod.z.array(TelemetryPricingLineItemSchema).optional(),
|
|
234
|
+
unitPrices: import_zod.z.array(TelemetryUnitPriceSchema).optional(),
|
|
235
|
+
usageItems: import_zod.z.array(TelemetryUsageItemSchema).optional(),
|
|
236
|
+
pricingRef: import_zod.z.string().min(1).optional(),
|
|
237
|
+
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
238
|
+
}).strict();
|
|
239
|
+
var StudioRunStatusSchema = import_zod.z.enum([
|
|
240
|
+
"running",
|
|
241
|
+
"completed",
|
|
242
|
+
"interrupted",
|
|
243
|
+
"incomplete",
|
|
244
|
+
"failed",
|
|
245
|
+
"cancelled"
|
|
246
|
+
]);
|
|
247
|
+
var STUDIO_TIME_RANGES = [
|
|
248
|
+
"Last hour",
|
|
249
|
+
"24 hours",
|
|
250
|
+
"7 days",
|
|
251
|
+
"30 days",
|
|
252
|
+
"All time",
|
|
253
|
+
"Custom range"
|
|
254
|
+
];
|
|
255
|
+
var StudioTimeRangeSchema = import_zod.z.enum(STUDIO_TIME_RANGES);
|
|
256
|
+
var StudioTimeRangeQuerySchema = import_zod.z.object({
|
|
257
|
+
range: StudioTimeRangeSchema.optional(),
|
|
258
|
+
startedAfter: import_zod.z.string().optional(),
|
|
259
|
+
startedBefore: import_zod.z.string().optional()
|
|
260
|
+
}).strict();
|
|
261
|
+
var StudioTimeRangeContextSchema = import_zod.z.object({
|
|
262
|
+
range: StudioTimeRangeSchema,
|
|
263
|
+
startedAfter: import_zod.z.string().datetime({ offset: true }).nullable(),
|
|
264
|
+
startedBefore: import_zod.z.string().datetime({ offset: true }).nullable()
|
|
265
|
+
}).strict();
|
|
266
|
+
var STUDIO_TIME_RANGE_MILLISECONDS = {
|
|
267
|
+
"Last hour": 60 * 60 * 1e3,
|
|
268
|
+
"24 hours": 24 * 60 * 60 * 1e3,
|
|
269
|
+
"7 days": 7 * 24 * 60 * 60 * 1e3,
|
|
270
|
+
"30 days": 30 * 24 * 60 * 60 * 1e3
|
|
271
|
+
};
|
|
272
|
+
var parseIsoBoundary = (value, label) => {
|
|
273
|
+
if (!value) {
|
|
274
|
+
return { ok: false, error: `${label} is required for a custom range.` };
|
|
275
|
+
}
|
|
276
|
+
if (!/(?:Z|[+-]\d{2}:\d{2})$/.test(value)) {
|
|
277
|
+
return {
|
|
278
|
+
ok: false,
|
|
279
|
+
error: `${label} must include an explicit UTC offset.`
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const date = new Date(value);
|
|
283
|
+
return Number.isFinite(date.getTime()) ? { ok: true, date } : { ok: false, error: `${label} must be a valid ISO date and time.` };
|
|
284
|
+
};
|
|
285
|
+
var resolveStudioTimeRange = (input, now = /* @__PURE__ */ new Date()) => {
|
|
286
|
+
const parsedRange = StudioTimeRangeSchema.safeParse(
|
|
287
|
+
input.range || "24 hours"
|
|
288
|
+
);
|
|
289
|
+
if (!parsedRange.success) {
|
|
290
|
+
return {
|
|
291
|
+
ok: false,
|
|
292
|
+
error: `Unknown time range "${input.range}".`
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
if (!Number.isFinite(now.getTime())) {
|
|
296
|
+
return { ok: false, error: "The time range reference date is invalid." };
|
|
297
|
+
}
|
|
298
|
+
const range = parsedRange.data;
|
|
299
|
+
if (range === "All time") {
|
|
300
|
+
return {
|
|
301
|
+
ok: true,
|
|
302
|
+
value: { range, startedAfter: null, startedBefore: null }
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
if (range === "Custom range") {
|
|
306
|
+
const after = parseIsoBoundary(input.startedAfter, "Start time");
|
|
307
|
+
if ("error" in after) return { ok: false, error: after.error };
|
|
308
|
+
const before = parseIsoBoundary(input.startedBefore, "End time");
|
|
309
|
+
if ("error" in before) return { ok: false, error: before.error };
|
|
310
|
+
if (after.date.getTime() >= before.date.getTime()) {
|
|
311
|
+
return {
|
|
312
|
+
ok: false,
|
|
313
|
+
error: "Start time must be before end time."
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
ok: true,
|
|
318
|
+
value: {
|
|
319
|
+
range,
|
|
320
|
+
startedAfter: after.date.toISOString(),
|
|
321
|
+
startedBefore: before.date.toISOString()
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const duration = STUDIO_TIME_RANGE_MILLISECONDS[range];
|
|
326
|
+
if (!duration) {
|
|
327
|
+
return { ok: false, error: `Unknown time range "${range}".` };
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
ok: true,
|
|
331
|
+
value: {
|
|
332
|
+
range,
|
|
333
|
+
startedAfter: new Date(now.getTime() - duration).toISOString(),
|
|
334
|
+
startedBefore: now.toISOString()
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
var StudioInterruptStatusSchema = import_zod.z.enum([
|
|
339
|
+
"pending",
|
|
340
|
+
"resolved",
|
|
341
|
+
"expired",
|
|
342
|
+
"failed",
|
|
343
|
+
"cancelled"
|
|
344
|
+
]);
|
|
345
|
+
var resolveStudioInterruptStatus = (input, now = Date.now()) => {
|
|
346
|
+
if (input.status !== "pending" || !input.expiresAt) return input.status;
|
|
347
|
+
const expiresAt = Date.parse(input.expiresAt);
|
|
348
|
+
const nowMs = typeof now === "number" ? now : now.getTime();
|
|
349
|
+
return Number.isFinite(expiresAt) && Number.isFinite(nowMs) && expiresAt <= nowMs ? "expired" : input.status;
|
|
350
|
+
};
|
|
351
|
+
var StudioInterruptTypeSchema = import_zod.z.enum([
|
|
352
|
+
"choice",
|
|
353
|
+
"multi-choice",
|
|
354
|
+
"text",
|
|
355
|
+
"unknown"
|
|
356
|
+
]);
|
|
357
|
+
var StudioInterruptInteractionModeSchema = import_zod.z.enum([
|
|
358
|
+
"static-options",
|
|
359
|
+
"dynamic-picker",
|
|
360
|
+
"freeform",
|
|
361
|
+
"unknown"
|
|
362
|
+
]);
|
|
363
|
+
var StudioInterruptOptionSchema = import_zod.z.object({
|
|
364
|
+
id: import_zod.z.string().min(1),
|
|
365
|
+
label: import_zod.z.string().min(1),
|
|
366
|
+
description: import_zod.z.string().nullable()
|
|
367
|
+
}).strict();
|
|
368
|
+
var StudioResumeOutcomeSchema = import_zod.z.enum([
|
|
369
|
+
"resumed",
|
|
370
|
+
"resume failed",
|
|
371
|
+
"expired before resume",
|
|
372
|
+
"cancelled"
|
|
373
|
+
]);
|
|
374
|
+
var StudioWorkflowHealthSchema = import_zod.z.enum([
|
|
375
|
+
"unknown",
|
|
376
|
+
"healthy",
|
|
377
|
+
"degraded",
|
|
378
|
+
"failing",
|
|
379
|
+
"idle"
|
|
380
|
+
]);
|
|
381
|
+
var StudioPricingStatusSchema = import_zod.z.enum([
|
|
382
|
+
"priced",
|
|
383
|
+
"unpriced",
|
|
384
|
+
"unknown"
|
|
385
|
+
]);
|
|
386
|
+
var StudioPricingSourceSchema = TelemetryPricingSourceSchema.nullable();
|
|
387
|
+
var StudioChangeResourceSchema = import_zod.z.enum([
|
|
388
|
+
"runs",
|
|
389
|
+
"sessions",
|
|
390
|
+
"interrupts"
|
|
391
|
+
]);
|
|
392
|
+
var StudioChangeSchema = import_zod.z.object({
|
|
393
|
+
schemaVersion: import_zod.z.literal(1),
|
|
394
|
+
changeId: import_zod.z.string().min(1),
|
|
395
|
+
emittedAt: import_zod.z.string().datetime({ offset: true }),
|
|
396
|
+
organizationId: import_zod.z.string().min(1),
|
|
397
|
+
projectId: import_zod.z.string().min(1),
|
|
398
|
+
resources: import_zod.z.array(StudioChangeResourceSchema).min(1)
|
|
399
|
+
}).strict();
|
|
400
|
+
var StudioMetricSchema = import_zod.z.object({
|
|
401
|
+
runCount: import_zod.z.number().int().nonnegative(),
|
|
402
|
+
successRate: import_zod.z.number().min(0).max(100).nullable(),
|
|
403
|
+
errorRate: import_zod.z.number().min(0).max(100).nullable(),
|
|
404
|
+
retryCount: import_zod.z.number().int().nonnegative().nullable(),
|
|
405
|
+
interruptRate: import_zod.z.number().min(0).max(100).nullable(),
|
|
406
|
+
p50DurationMs: import_zod.z.number().nonnegative().nullable(),
|
|
407
|
+
p95DurationMs: import_zod.z.number().nonnegative().nullable(),
|
|
408
|
+
averageTokens: import_zod.z.number().nonnegative().nullable(),
|
|
409
|
+
averageCost: import_zod.z.number().nonnegative().nullable(),
|
|
410
|
+
currency: import_zod.z.string().nullable()
|
|
411
|
+
}).strict();
|
|
412
|
+
var StudioRunSchema = import_zod.z.object({
|
|
413
|
+
id: import_zod.z.string().min(1),
|
|
414
|
+
status: StudioRunStatusSchema,
|
|
415
|
+
startedAt: import_zod.z.string().datetime({ offset: true }),
|
|
416
|
+
endedAt: import_zod.z.string().datetime({ offset: true }).nullable(),
|
|
417
|
+
workflowId: import_zod.z.string().min(1),
|
|
418
|
+
workflowIds: import_zod.z.array(import_zod.z.string().min(1)),
|
|
419
|
+
workflowRefs: import_zod.z.array(
|
|
420
|
+
import_zod.z.object({
|
|
421
|
+
workflowId: import_zod.z.string().min(1),
|
|
422
|
+
workflowRevisionId: import_zod.z.string().nullable(),
|
|
423
|
+
declaredVersion: import_zod.z.string().nullable()
|
|
424
|
+
}).strict()
|
|
425
|
+
),
|
|
426
|
+
workflowRevisionId: import_zod.z.string().nullable(),
|
|
427
|
+
declaredVersion: import_zod.z.string().nullable(),
|
|
428
|
+
transitionIds: import_zod.z.array(import_zod.z.string().min(1)),
|
|
429
|
+
path: import_zod.z.array(import_zod.z.string()),
|
|
430
|
+
sessionId: import_zod.z.string().nullable(),
|
|
431
|
+
provider: import_zod.z.string().nullable(),
|
|
432
|
+
model: import_zod.z.string().nullable(),
|
|
433
|
+
models: import_zod.z.array(import_zod.z.string()),
|
|
434
|
+
durationMs: import_zod.z.number().nonnegative().nullable(),
|
|
435
|
+
tokens: import_zod.z.number().int().nonnegative().nullable(),
|
|
436
|
+
cost: import_zod.z.number().nonnegative().nullable(),
|
|
437
|
+
pricingStatus: StudioPricingStatusSchema,
|
|
438
|
+
pricingSource: StudioPricingSourceSchema,
|
|
439
|
+
currency: import_zod.z.string().nullable(),
|
|
440
|
+
result: import_zod.z.string().nullable(),
|
|
441
|
+
environment: import_zod.z.string().min(1),
|
|
442
|
+
userId: import_zod.z.string().nullable(),
|
|
443
|
+
tenantId: import_zod.z.string().nullable(),
|
|
444
|
+
hasTool: import_zod.z.boolean(),
|
|
445
|
+
hasRetry: import_zod.z.boolean(),
|
|
446
|
+
interruptNodeId: import_zod.z.string().nullable(),
|
|
447
|
+
interruptId: import_zod.z.string().nullable().optional(),
|
|
448
|
+
interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
|
|
449
|
+
interruptExpiresAt: import_zod.z.string().datetime({ offset: true }).nullable().optional()
|
|
450
|
+
}).strict();
|
|
451
|
+
var StudioSessionSchema = import_zod.z.object({
|
|
452
|
+
id: import_zod.z.string().min(1),
|
|
453
|
+
status: StudioRunStatusSchema,
|
|
454
|
+
lastActivityAt: import_zod.z.string().datetime({ offset: true }),
|
|
455
|
+
workflowIds: import_zod.z.array(import_zod.z.string()),
|
|
456
|
+
workflowCount: import_zod.z.number().int().nonnegative(),
|
|
457
|
+
activeWorkflowId: import_zod.z.string().nullable(),
|
|
458
|
+
activeVersion: import_zod.z.string().nullable(),
|
|
459
|
+
userId: import_zod.z.string().nullable(),
|
|
460
|
+
tenantId: import_zod.z.string().nullable(),
|
|
461
|
+
runs: import_zod.z.number().int().nonnegative(),
|
|
462
|
+
succeeded: import_zod.z.number().int().nonnegative(),
|
|
463
|
+
failed: import_zod.z.number().int().nonnegative(),
|
|
464
|
+
interrupted: import_zod.z.number().int().nonnegative(),
|
|
465
|
+
checkpoints: import_zod.z.number().int().nonnegative(),
|
|
466
|
+
hasFork: import_zod.z.boolean(),
|
|
467
|
+
durationMs: import_zod.z.number().nonnegative().nullable(),
|
|
468
|
+
tokens: import_zod.z.number().int().nonnegative().nullable(),
|
|
469
|
+
cost: import_zod.z.number().nonnegative().nullable(),
|
|
470
|
+
pricingStatus: StudioPricingStatusSchema,
|
|
471
|
+
pricingSource: StudioPricingSourceSchema,
|
|
472
|
+
currency: import_zod.z.string().nullable(),
|
|
473
|
+
latestResult: import_zod.z.string().nullable(),
|
|
474
|
+
latestError: import_zod.z.string().nullable(),
|
|
475
|
+
pendingInterruptId: import_zod.z.string().nullable(),
|
|
476
|
+
interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
|
|
477
|
+
interruptExpiresAt: import_zod.z.string().datetime({ offset: true }).nullable().optional(),
|
|
478
|
+
providers: import_zod.z.array(import_zod.z.string()),
|
|
479
|
+
models: import_zod.z.array(import_zod.z.string()),
|
|
480
|
+
tags: import_zod.z.array(import_zod.z.string()),
|
|
481
|
+
environment: import_zod.z.string().min(1)
|
|
482
|
+
}).strict();
|
|
483
|
+
var StudioInterruptSchema = import_zod.z.object({
|
|
484
|
+
id: import_zod.z.string().min(1),
|
|
485
|
+
status: StudioInterruptStatusSchema,
|
|
486
|
+
type: StudioInterruptTypeSchema,
|
|
487
|
+
interactionMode: StudioInterruptInteractionModeSchema,
|
|
488
|
+
schemaId: import_zod.z.string().nullable(),
|
|
489
|
+
schemaVersion: import_zod.z.string().nullable(),
|
|
490
|
+
createdAt: import_zod.z.string().datetime({ offset: true }),
|
|
491
|
+
resolvedAt: import_zod.z.string().datetime({ offset: true }).nullable(),
|
|
492
|
+
expiresAt: import_zod.z.string().datetime({ offset: true }).nullable(),
|
|
493
|
+
question: import_zod.z.string().nullable(),
|
|
494
|
+
contentCaptured: import_zod.z.boolean(),
|
|
495
|
+
optionCount: import_zod.z.number().int().nonnegative().nullable(),
|
|
496
|
+
options: import_zod.z.array(StudioInterruptOptionSchema).nullable(),
|
|
497
|
+
workflowId: import_zod.z.string().min(1),
|
|
498
|
+
nodeId: import_zod.z.string().nullable(),
|
|
499
|
+
sessionId: import_zod.z.string().nullable(),
|
|
500
|
+
userId: import_zod.z.string().nullable(),
|
|
501
|
+
tenantId: import_zod.z.string().nullable(),
|
|
502
|
+
response: import_zod.z.string().nullable(),
|
|
503
|
+
responseCaptured: import_zod.z.boolean(),
|
|
504
|
+
resumeOutcome: StudioResumeOutcomeSchema.nullable(),
|
|
505
|
+
resumeError: import_zod.z.string().nullable(),
|
|
506
|
+
runId: import_zod.z.string().min(1),
|
|
507
|
+
resumeToken: import_zod.z.string().nullable(),
|
|
508
|
+
resolvedBy: import_zod.z.string().nullable(),
|
|
509
|
+
environment: import_zod.z.string().min(1)
|
|
510
|
+
}).strict();
|
|
511
|
+
var StudioDetailEventSchema = import_zod.z.object({
|
|
512
|
+
id: import_zod.z.string().min(1),
|
|
513
|
+
type: TelemetryEventTypeSchema,
|
|
514
|
+
occurredAt: import_zod.z.string().datetime({ offset: true }),
|
|
515
|
+
receivedAt: import_zod.z.string().datetime({ offset: true }),
|
|
516
|
+
environment: import_zod.z.string().min(1),
|
|
517
|
+
serviceName: import_zod.z.string().min(1),
|
|
518
|
+
deploymentRef: import_zod.z.string().nullable(),
|
|
519
|
+
traceId: import_zod.z.string().nullable(),
|
|
520
|
+
spanId: import_zod.z.string().nullable(),
|
|
521
|
+
parentSpanId: import_zod.z.string().nullable(),
|
|
522
|
+
runId: import_zod.z.string().min(1),
|
|
523
|
+
sessionId: import_zod.z.string().nullable(),
|
|
524
|
+
workflowId: import_zod.z.string().min(1),
|
|
525
|
+
workflowRevisionId: import_zod.z.string().nullable(),
|
|
526
|
+
nodeId: import_zod.z.string().nullable(),
|
|
527
|
+
userId: import_zod.z.string().nullable(),
|
|
528
|
+
tenantId: import_zod.z.string().nullable(),
|
|
529
|
+
tags: import_zod.z.array(import_zod.z.string()),
|
|
530
|
+
metadata: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).nullable(),
|
|
531
|
+
payload: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown())
|
|
532
|
+
}).strict();
|
|
533
|
+
var StudioWorkflowNodeSchema = import_zod.z.object({
|
|
534
|
+
id: import_zod.z.string().min(1),
|
|
535
|
+
label: import_zod.z.string(),
|
|
536
|
+
type: import_zod.z.string().nullable(),
|
|
537
|
+
state: import_zod.z.enum(["healthy", "warning", "failed", "interrupted", "retried"]).nullable(),
|
|
538
|
+
provider: import_zod.z.string().nullable(),
|
|
539
|
+
model: import_zod.z.string().nullable(),
|
|
540
|
+
metrics: StudioMetricSchema
|
|
541
|
+
}).strict();
|
|
542
|
+
var StudioWorkflowInternalEdgeSchema = import_zod.z.object({
|
|
543
|
+
id: import_zod.z.string().min(1),
|
|
544
|
+
source: import_zod.z.string().min(1),
|
|
545
|
+
target: import_zod.z.string().min(1),
|
|
546
|
+
condition: import_zod.z.string().nullable()
|
|
547
|
+
}).strict();
|
|
548
|
+
var StudioWorkflowTransitionSchema = import_zod.z.object({
|
|
549
|
+
id: import_zod.z.string().min(1),
|
|
550
|
+
sourceWorkflowId: import_zod.z.string().min(1),
|
|
551
|
+
sourceNodeId: import_zod.z.string().nullable(),
|
|
552
|
+
targetWorkflowId: import_zod.z.string().min(1),
|
|
553
|
+
condition: import_zod.z.string().nullable(),
|
|
554
|
+
volume: import_zod.z.number().int().nonnegative(),
|
|
555
|
+
successRate: import_zod.z.number().min(0).max(100).nullable(),
|
|
556
|
+
medianDurationMs: import_zod.z.number().nonnegative().nullable(),
|
|
557
|
+
errorRate: import_zod.z.number().min(0).max(100).nullable()
|
|
558
|
+
}).strict();
|
|
559
|
+
var StudioWorkflowSchema = import_zod.z.object({
|
|
560
|
+
id: import_zod.z.string().min(1),
|
|
561
|
+
name: import_zod.z.string().min(1),
|
|
562
|
+
description: import_zod.z.string().nullable(),
|
|
563
|
+
versions: import_zod.z.array(import_zod.z.string()),
|
|
564
|
+
activeVersion: import_zod.z.string().nullable(),
|
|
565
|
+
activeRevisionId: import_zod.z.string().nullable(),
|
|
566
|
+
health: StudioWorkflowHealthSchema,
|
|
567
|
+
tags: import_zod.z.array(import_zod.z.string()),
|
|
568
|
+
lastActivityAt: import_zod.z.string().datetime({ offset: true }).nullable(),
|
|
569
|
+
metrics: StudioMetricSchema,
|
|
570
|
+
nodes: import_zod.z.array(StudioWorkflowNodeSchema),
|
|
571
|
+
internalEdges: import_zod.z.array(StudioWorkflowInternalEdgeSchema)
|
|
572
|
+
}).strict();
|
|
573
|
+
var StudioRunsResponseSchema = import_zod.z.object({
|
|
574
|
+
runs: import_zod.z.array(StudioRunSchema),
|
|
575
|
+
totalCount: import_zod.z.number().int().nonnegative()
|
|
576
|
+
}).strict();
|
|
577
|
+
var StudioSessionsResponseSchema = import_zod.z.object({
|
|
578
|
+
sessions: import_zod.z.array(StudioSessionSchema),
|
|
579
|
+
totalCount: import_zod.z.number().int().nonnegative()
|
|
580
|
+
}).strict();
|
|
581
|
+
var StudioInterruptsResponseSchema = import_zod.z.object({
|
|
582
|
+
interrupts: import_zod.z.array(StudioInterruptSchema),
|
|
583
|
+
totalCount: import_zod.z.number().int().nonnegative()
|
|
584
|
+
}).strict();
|
|
585
|
+
var StudioRunDetailResponseSchema = import_zod.z.object({
|
|
586
|
+
run: StudioRunSchema,
|
|
587
|
+
events: import_zod.z.array(StudioDetailEventSchema),
|
|
588
|
+
session: StudioSessionSchema.nullable(),
|
|
589
|
+
interrupts: import_zod.z.array(StudioInterruptSchema),
|
|
590
|
+
updatedAt: import_zod.z.string().datetime({ offset: true })
|
|
591
|
+
}).strict();
|
|
592
|
+
var StudioSessionDetailResponseSchema = import_zod.z.object({
|
|
593
|
+
session: StudioSessionSchema,
|
|
594
|
+
runs: import_zod.z.array(StudioRunSchema),
|
|
595
|
+
events: import_zod.z.array(StudioDetailEventSchema),
|
|
596
|
+
interrupts: import_zod.z.array(StudioInterruptSchema),
|
|
597
|
+
updatedAt: import_zod.z.string().datetime({ offset: true })
|
|
598
|
+
}).strict();
|
|
599
|
+
var StudioInterruptDetailResponseSchema = import_zod.z.object({
|
|
600
|
+
interrupt: StudioInterruptSchema,
|
|
601
|
+
events: import_zod.z.array(StudioDetailEventSchema),
|
|
602
|
+
run: StudioRunSchema.nullable(),
|
|
603
|
+
session: StudioSessionSchema.nullable(),
|
|
604
|
+
updatedAt: import_zod.z.string().datetime({ offset: true })
|
|
605
|
+
}).strict();
|
|
606
|
+
var StudioWorkflowsResponseSchema = import_zod.z.object({
|
|
607
|
+
workflows: import_zod.z.array(StudioWorkflowSchema),
|
|
608
|
+
transitions: import_zod.z.array(StudioWorkflowTransitionSchema),
|
|
609
|
+
cohort: StudioTimeRangeContextSchema.extend({
|
|
610
|
+
workflowId: import_zod.z.string().nullable(),
|
|
611
|
+
version: import_zod.z.string().nullable()
|
|
612
|
+
}).strict()
|
|
613
|
+
}).strict();
|
|
614
|
+
var StudioCatalogsResponseSchema = import_zod.z.object({
|
|
615
|
+
environments: import_zod.z.array(import_zod.z.string()),
|
|
616
|
+
providers: import_zod.z.array(import_zod.z.string()),
|
|
617
|
+
models: import_zod.z.array(import_zod.z.string()),
|
|
618
|
+
workflows: import_zod.z.array(import_zod.z.string()),
|
|
619
|
+
tags: import_zod.z.array(import_zod.z.string())
|
|
620
|
+
}).strict();
|
|
621
|
+
var StudioContextResponseSchema = import_zod.z.object({
|
|
622
|
+
organization: import_zod.z.object({
|
|
623
|
+
name: import_zod.z.string().min(1)
|
|
624
|
+
}).strict(),
|
|
625
|
+
project: import_zod.z.object({
|
|
626
|
+
name: import_zod.z.string().min(1)
|
|
627
|
+
}).strict(),
|
|
628
|
+
environments: import_zod.z.array(import_zod.z.string()),
|
|
629
|
+
apiKey: import_zod.z.object({
|
|
630
|
+
mode: import_zod.z.enum(["test", "live"]),
|
|
631
|
+
scopes: import_zod.z.array(import_zod.z.string())
|
|
632
|
+
}).strict(),
|
|
633
|
+
api: import_zod.z.object({
|
|
634
|
+
status: import_zod.z.literal("ok"),
|
|
635
|
+
service: import_zod.z.literal("kortyx-api"),
|
|
636
|
+
version: import_zod.z.string().min(1)
|
|
637
|
+
}).strict()
|
|
638
|
+
}).strict();
|
|
112
639
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
640
|
0 && (module.exports = {
|
|
114
641
|
EnsureWorkflowTopologyRequestSchema,
|
|
115
642
|
EnsureWorkflowTopologyResponseSchema,
|
|
643
|
+
STUDIO_TIME_RANGES,
|
|
644
|
+
StudioCatalogsResponseSchema,
|
|
645
|
+
StudioChangeResourceSchema,
|
|
646
|
+
StudioChangeSchema,
|
|
647
|
+
StudioContextResponseSchema,
|
|
648
|
+
StudioDetailEventSchema,
|
|
649
|
+
StudioInterruptDetailResponseSchema,
|
|
650
|
+
StudioInterruptInteractionModeSchema,
|
|
651
|
+
StudioInterruptOptionSchema,
|
|
652
|
+
StudioInterruptSchema,
|
|
653
|
+
StudioInterruptStatusSchema,
|
|
654
|
+
StudioInterruptTypeSchema,
|
|
655
|
+
StudioInterruptsResponseSchema,
|
|
656
|
+
StudioMetricSchema,
|
|
657
|
+
StudioPricingSourceSchema,
|
|
658
|
+
StudioPricingStatusSchema,
|
|
659
|
+
StudioResumeOutcomeSchema,
|
|
660
|
+
StudioRunDetailResponseSchema,
|
|
661
|
+
StudioRunSchema,
|
|
662
|
+
StudioRunStatusSchema,
|
|
663
|
+
StudioRunsResponseSchema,
|
|
664
|
+
StudioSessionDetailResponseSchema,
|
|
665
|
+
StudioSessionSchema,
|
|
666
|
+
StudioSessionsResponseSchema,
|
|
667
|
+
StudioTimeRangeContextSchema,
|
|
668
|
+
StudioTimeRangeQuerySchema,
|
|
669
|
+
StudioTimeRangeSchema,
|
|
670
|
+
StudioWorkflowHealthSchema,
|
|
671
|
+
StudioWorkflowInternalEdgeSchema,
|
|
672
|
+
StudioWorkflowNodeSchema,
|
|
673
|
+
StudioWorkflowSchema,
|
|
674
|
+
StudioWorkflowTransitionSchema,
|
|
675
|
+
StudioWorkflowsResponseSchema,
|
|
116
676
|
TELEMETRY_EVENT_TYPES,
|
|
677
|
+
TelemetryEventBatchResponseSchema,
|
|
117
678
|
TelemetryEventBatchSchema,
|
|
118
679
|
TelemetryEventSchema,
|
|
119
680
|
TelemetryEventTypeSchema,
|
|
681
|
+
TelemetryPricingHintSchema,
|
|
682
|
+
TelemetryPricingLineItemSchema,
|
|
683
|
+
TelemetryPricingSourceSchema,
|
|
684
|
+
TelemetryPricingUnitSchema,
|
|
685
|
+
TelemetryPricingUsageTypeSchema,
|
|
120
686
|
TelemetryServiceSchema,
|
|
687
|
+
TelemetryUnitPriceSchema,
|
|
688
|
+
TelemetryUsageItemSchema,
|
|
121
689
|
WorkflowTopologyEdgeSchema,
|
|
122
|
-
WorkflowTopologyNodeSchema
|
|
690
|
+
WorkflowTopologyNodeSchema,
|
|
691
|
+
WorkflowTopologyTransitionSchema,
|
|
692
|
+
resolveStudioInterruptStatus,
|
|
693
|
+
resolveStudioTimeRange
|
|
123
694
|
});
|
|
124
695
|
//# sourceMappingURL=index.js.map
|