@kortyx/telemetry-contracts 0.18.0 → 0.19.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 +15 -0
- package/README.md +22 -0
- package/dist/index.d.ts +573 -3
- package/dist/index.js +1668 -1485
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,9 +8,9 @@ var __export = (target, all) => {
|
|
|
8
8
|
};
|
|
9
9
|
var __copyProps = (to, from, except, desc) => {
|
|
10
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let
|
|
12
|
-
if (!__hasOwnProp.call(to,
|
|
13
|
-
__defProp(to,
|
|
11
|
+
for (let key2 of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
13
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
14
14
|
}
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
PromptTransferRequestSchema: () => PromptTransferRequestSchema,
|
|
53
53
|
PromptUsageSchema: () => PromptUsageSchema,
|
|
54
54
|
ReviewVerdictSchema: () => ReviewVerdictSchema,
|
|
55
|
+
SAMPLE_PROJECT: () => SAMPLE_PROJECT,
|
|
55
56
|
STUDIO_API_PROTOCOL_VERSION: () => STUDIO_API_PROTOCOL_VERSION,
|
|
56
57
|
STUDIO_TABLE_FIELDS: () => STUDIO_TABLE_FIELDS,
|
|
57
58
|
STUDIO_TIME_RANGES: () => STUDIO_TIME_RANGES,
|
|
@@ -81,11 +82,23 @@ __export(index_exports, {
|
|
|
81
82
|
StudioRunSchema: () => StudioRunSchema,
|
|
82
83
|
StudioRunStatusSchema: () => StudioRunStatusSchema,
|
|
83
84
|
StudioRunsResponseSchema: () => StudioRunsResponseSchema,
|
|
85
|
+
StudioSavedViewDefinitionSchema: () => StudioSavedViewDefinitionSchema,
|
|
84
86
|
StudioScoreResponseSchema: () => StudioScoreResponseSchema,
|
|
85
87
|
StudioScoreSchema: () => StudioScoreSchema,
|
|
86
88
|
StudioSessionDetailResponseSchema: () => StudioSessionDetailResponseSchema,
|
|
87
89
|
StudioSessionSchema: () => StudioSessionSchema,
|
|
88
90
|
StudioSessionsResponseSchema: () => StudioSessionsResponseSchema,
|
|
91
|
+
StudioTableConfigurationSchema: () => StudioTableConfigurationSchema,
|
|
92
|
+
StudioTableDefaultsSchema: () => StudioTableDefaultsSchema,
|
|
93
|
+
StudioTableIdSchema: () => StudioTableIdSchema,
|
|
94
|
+
StudioTableLayoutSchema: () => StudioTableLayoutSchema,
|
|
95
|
+
StudioTablePreferenceOperationSchema: () => StudioTablePreferenceOperationSchema,
|
|
96
|
+
StudioTablePreferenceResponseSchema: () => StudioTablePreferenceResponseSchema,
|
|
97
|
+
StudioTablePreferenceScopeSchema: () => StudioTablePreferenceScopeSchema,
|
|
98
|
+
StudioTablePreferenceWriteSchema: () => StudioTablePreferenceWriteSchema,
|
|
99
|
+
StudioTablePreferencesSchema: () => StudioTablePreferencesSchema,
|
|
100
|
+
StudioTableQueryPreferencesSchema: () => StudioTableQueryPreferencesSchema,
|
|
101
|
+
StudioTableViewSchema: () => StudioTableViewSchema,
|
|
89
102
|
StudioTimeRangeContextSchema: () => StudioTimeRangeContextSchema,
|
|
90
103
|
StudioTimeRangeQuerySchema: () => StudioTimeRangeQuerySchema,
|
|
91
104
|
StudioTimeRangeSchema: () => StudioTimeRangeSchema,
|
|
@@ -123,7 +136,9 @@ __export(index_exports, {
|
|
|
123
136
|
WorkflowTopologyEdgeSchema: () => WorkflowTopologyEdgeSchema,
|
|
124
137
|
WorkflowTopologyNodeSchema: () => WorkflowTopologyNodeSchema,
|
|
125
138
|
WorkflowTopologyTransitionSchema: () => WorkflowTopologyTransitionSchema,
|
|
139
|
+
applyTablePreferenceOperation: () => applyTablePreferenceOperation,
|
|
126
140
|
captureDiagnosticContent: () => captureDiagnosticContent,
|
|
141
|
+
emptyTablePreferences: () => emptyTablePreferences,
|
|
127
142
|
filterOperators: () => filterOperators,
|
|
128
143
|
isPrivateDiagnosticField: () => isPrivateDiagnosticField,
|
|
129
144
|
matchesTableFilters: () => matchesTableFilters,
|
|
@@ -143,7 +158,7 @@ __export(index_exports, {
|
|
|
143
158
|
validateTableFilters: () => validateTableFilters
|
|
144
159
|
});
|
|
145
160
|
module.exports = __toCommonJS(index_exports);
|
|
146
|
-
var
|
|
161
|
+
var import_zod8 = require("zod");
|
|
147
162
|
|
|
148
163
|
// src/scores.ts
|
|
149
164
|
var import_zod = require("zod");
|
|
@@ -218,1172 +233,1324 @@ function summarizeUserFeedback(scores) {
|
|
|
218
233
|
return feedback;
|
|
219
234
|
}
|
|
220
235
|
|
|
221
|
-
// src/
|
|
236
|
+
// src/table-preferences.ts
|
|
237
|
+
var import_zod3 = require("zod");
|
|
238
|
+
|
|
239
|
+
// src/table-filters.ts
|
|
222
240
|
var import_zod2 = require("zod");
|
|
223
|
-
var
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
status: import_zod2.z.enum(["complete", "partial", "failed"]),
|
|
242
|
-
omissions: import_zod2.z.array(DiagnosticNoteSchema).max(1e4),
|
|
243
|
-
redactions: import_zod2.z.array(DiagnosticNoteSchema).max(1e4)
|
|
244
|
-
}).strict()
|
|
245
|
-
}).strict();
|
|
246
|
-
var DiagnosticCorrelationSchema = import_zod2.z.object({
|
|
247
|
-
runId: import_zod2.z.string().optional(),
|
|
248
|
-
evaluationId: import_zod2.z.string().optional(),
|
|
249
|
-
suiteRunId: import_zod2.z.string().optional(),
|
|
250
|
-
caseId: import_zod2.z.string().optional(),
|
|
251
|
-
repetition: import_zod2.z.string().optional(),
|
|
252
|
-
phase: import_zod2.z.string().optional(),
|
|
253
|
-
workflowId: import_zod2.z.string().optional(),
|
|
254
|
-
nodeId: import_zod2.z.string().optional(),
|
|
255
|
-
sessionId: import_zod2.z.string().optional(),
|
|
256
|
-
invocationId: import_zod2.z.string().optional(),
|
|
257
|
-
parentInvocationId: import_zod2.z.string().optional(),
|
|
258
|
-
branchId: import_zod2.z.string().optional(),
|
|
259
|
-
toolCallId: import_zod2.z.string().optional(),
|
|
260
|
-
attemptId: import_zod2.z.string().optional(),
|
|
261
|
-
workflowRevisionId: import_zod2.z.string().optional(),
|
|
262
|
-
traceId: import_zod2.z.string().optional(),
|
|
263
|
-
spanId: import_zod2.z.string().optional(),
|
|
264
|
-
parentSpanId: import_zod2.z.string().optional()
|
|
265
|
-
}).strict();
|
|
266
|
-
var DiagnosticManifestSchema = import_zod2.z.object({
|
|
267
|
-
schemaVersion: import_zod2.z.literal(1),
|
|
268
|
-
diagnosticId: import_zod2.z.string().uuid(),
|
|
269
|
-
occurrenceId: import_zod2.z.string().uuid(),
|
|
270
|
-
occurredAt: import_zod2.z.string().datetime({ offset: true }),
|
|
271
|
-
environment: import_zod2.z.string().min(1).max(256),
|
|
272
|
-
service: import_zod2.z.object({
|
|
273
|
-
name: import_zod2.z.string().min(1).max(256),
|
|
274
|
-
deploymentRef: import_zod2.z.string().max(1024).optional()
|
|
275
|
-
}).strict(),
|
|
276
|
-
correlation: DiagnosticCorrelationSchema,
|
|
277
|
-
handled: import_zod2.z.boolean(),
|
|
278
|
-
severity: import_zod2.z.enum(["warning", "error"]),
|
|
279
|
-
mechanism: import_zod2.z.enum(["span", "report", "tool"]),
|
|
280
|
-
summary: import_zod2.z.object({ type: import_zod2.z.string().max(256), message: import_zod2.z.string().max(8192) }).strict(),
|
|
281
|
-
captureStatus: import_zod2.z.enum(["complete", "partial", "failed"]),
|
|
282
|
-
checksum: import_zod2.z.string().regex(/^[a-f0-9]{64}$/),
|
|
283
|
-
byteLength: import_zod2.z.number().int().min(1).max(DIAGNOSTIC_LIMITS.bytes),
|
|
284
|
-
partCount: import_zod2.z.number().int().min(1).max(DIAGNOSTIC_LIMITS.parts)
|
|
285
|
-
}).strict().superRefine((value, ctx) => {
|
|
286
|
-
if (value.partCount !== Math.ceil(value.byteLength / DIAGNOSTIC_LIMITS.partBytes))
|
|
287
|
-
ctx.addIssue({
|
|
288
|
-
code: "custom",
|
|
289
|
-
path: ["partCount"],
|
|
290
|
-
message: "Part count does not match byte length."
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
var DiagnosticPartSchema = import_zod2.z.object({
|
|
294
|
-
index: import_zod2.z.number().int().min(0).max(DIAGNOSTIC_LIMITS.parts - 1),
|
|
295
|
-
data: import_zod2.z.string().max(Math.ceil(DIAGNOSTIC_LIMITS.partBytes / 3) * 4).regex(
|
|
296
|
-
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
|
|
297
|
-
)
|
|
298
|
-
}).strict();
|
|
299
|
-
var DiagnosticResponseSchema = import_zod2.z.object({
|
|
300
|
-
manifest: DiagnosticManifestSchema,
|
|
301
|
-
state: import_zod2.z.enum(["pending", "available", "incomplete", "expired"]),
|
|
302
|
-
receivedParts: import_zod2.z.number().int().nonnegative(),
|
|
303
|
-
expiresAt: import_zod2.z.string().datetime({ offset: true }),
|
|
304
|
-
content: DiagnosticContentSchema.nullable(),
|
|
305
|
-
contentChecksum: import_zod2.z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
306
|
-
contentByteLength: import_zod2.z.number().int().nonnegative().nullable()
|
|
241
|
+
var TableFilterRuleSchema = import_zod2.z.object({
|
|
242
|
+
field: import_zod2.z.string().min(1).max(80),
|
|
243
|
+
operator: import_zod2.z.enum([
|
|
244
|
+
"contains",
|
|
245
|
+
"notContains",
|
|
246
|
+
"is",
|
|
247
|
+
"isNot",
|
|
248
|
+
"gt",
|
|
249
|
+
"gte",
|
|
250
|
+
"lt",
|
|
251
|
+
"lte",
|
|
252
|
+
"between",
|
|
253
|
+
"present",
|
|
254
|
+
"missing"
|
|
255
|
+
]),
|
|
256
|
+
values: import_zod2.z.array(
|
|
257
|
+
import_zod2.z.union([import_zod2.z.string().min(1).max(512), import_zod2.z.number().finite(), import_zod2.z.boolean()])
|
|
258
|
+
).max(30)
|
|
307
259
|
}).strict();
|
|
308
|
-
var
|
|
309
|
-
|
|
260
|
+
var TableFiltersSchema = import_zod2.z.object({
|
|
261
|
+
match: import_zod2.z.enum(["all", "any"]),
|
|
262
|
+
rules: import_zod2.z.array(TableFilterRuleSchema).max(32)
|
|
263
|
+
}).strict().refine(
|
|
264
|
+
(value) => JSON.stringify(value).length <= 32768,
|
|
265
|
+
"Filters must fit within 32 KiB."
|
|
310
266
|
);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
} : {}
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
function redactDiagnosticContent(content) {
|
|
343
|
-
const redactions = [...content.capture.redactions];
|
|
344
|
-
const omissions = [...content.capture.omissions];
|
|
345
|
-
let nodes = 0;
|
|
346
|
-
const visit = (value, path, depth = 0) => {
|
|
347
|
-
if (++nodes > DIAGNOSTIC_LIMITS.nodes || depth > DIAGNOSTIC_LIMITS.depth) {
|
|
348
|
-
const reason = depth > DIAGNOSTIC_LIMITS.depth ? "server_depth_limit" : "server_node_limit";
|
|
349
|
-
if (omissions.length < 1e4)
|
|
350
|
-
omissions.push({ path: path.slice(0, 4096), reason });
|
|
351
|
-
return { $omitted: reason };
|
|
352
|
-
}
|
|
353
|
-
if (typeof value === "string") {
|
|
354
|
-
const clean = redactDiagnosticText(value);
|
|
355
|
-
if (clean !== value && redactions.length < 1e4)
|
|
356
|
-
redactions.push({
|
|
357
|
-
path: path.slice(0, 4096),
|
|
358
|
-
reason: "server_credential_text"
|
|
359
|
-
});
|
|
360
|
-
return clean;
|
|
361
|
-
}
|
|
362
|
-
if (Array.isArray(value)) {
|
|
363
|
-
if (value.length > DIAGNOSTIC_LIMITS.properties && omissions.length < 1e4)
|
|
364
|
-
omissions.push({
|
|
365
|
-
path: path.slice(0, 4096),
|
|
366
|
-
reason: "server_collection_limit",
|
|
367
|
-
originalCount: value.length
|
|
368
|
-
});
|
|
369
|
-
return value.slice(0, DIAGNOSTIC_LIMITS.properties).map((item, index) => visit(item, `${path}/${index}`, depth + 1));
|
|
370
|
-
}
|
|
371
|
-
if (value && typeof value === "object") {
|
|
372
|
-
const keys = Object.keys(value);
|
|
373
|
-
if (keys.length > DIAGNOSTIC_LIMITS.properties && omissions.length < 1e4)
|
|
374
|
-
omissions.push({
|
|
375
|
-
path: path.slice(0, 4096),
|
|
376
|
-
reason: "server_property_limit",
|
|
377
|
-
originalCount: keys.length
|
|
378
|
-
});
|
|
379
|
-
return Object.fromEntries(
|
|
380
|
-
keys.slice(0, DIAGNOSTIC_LIMITS.properties).map((key) => {
|
|
381
|
-
const nested = value[key];
|
|
382
|
-
if (isPrivateDiagnosticField(key)) {
|
|
383
|
-
if (redactions.length < 1e4 && nested !== "[REDACTED]")
|
|
384
|
-
redactions.push({
|
|
385
|
-
path: `${path}/${key}`.slice(0, 4096),
|
|
386
|
-
reason: "server_credential_field"
|
|
387
|
-
});
|
|
388
|
-
return [key, "[REDACTED]"];
|
|
389
|
-
}
|
|
390
|
-
return [key, visit(nested, `${path}/${key}`, depth + 1)];
|
|
391
|
-
})
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
return value;
|
|
395
|
-
};
|
|
396
|
-
return {
|
|
397
|
-
...content,
|
|
398
|
-
data: visit(content.data, "#/data"),
|
|
399
|
-
capture: {
|
|
400
|
-
...content.capture,
|
|
401
|
-
status: content.capture.status === "failed" ? "failed" : omissions.length ? "partial" : "complete",
|
|
402
|
-
omissions: omissions.map((note) => ({
|
|
403
|
-
...note,
|
|
404
|
-
path: redactDiagnosticText(note.path),
|
|
405
|
-
reason: redactDiagnosticText(note.reason)
|
|
406
|
-
})),
|
|
407
|
-
redactions: redactions.map((note) => ({
|
|
408
|
-
...note,
|
|
409
|
-
path: redactDiagnosticText(note.path),
|
|
410
|
-
reason: redactDiagnosticText(note.reason)
|
|
411
|
-
}))
|
|
267
|
+
var EMPTY_TABLE_FILTERS = { match: "all", rules: [] };
|
|
268
|
+
var filterOperators = (kind) => [
|
|
269
|
+
...kind === "text" ? ["contains", "notContains"] : [],
|
|
270
|
+
"is",
|
|
271
|
+
"isNot",
|
|
272
|
+
...kind === "number" || kind === "date" ? ["gt", "gte", "lt", "lte", "between"] : [],
|
|
273
|
+
"present",
|
|
274
|
+
"missing"
|
|
275
|
+
];
|
|
276
|
+
function validateTableFilters(filters, fields) {
|
|
277
|
+
const parsed = TableFiltersSchema.safeParse(filters);
|
|
278
|
+
if (!parsed.success) throw new Error("Enter valid values for every filter.");
|
|
279
|
+
for (const rule of filters.rules) {
|
|
280
|
+
const field2 = fields.find((item) => item.key === rule.field);
|
|
281
|
+
if (!field2 || !filterOperators(field2.kind).includes(rule.operator))
|
|
282
|
+
throw new Error("Unsupported filter field or operator.");
|
|
283
|
+
const noValue = rule.operator === "present" || rule.operator === "missing";
|
|
284
|
+
if (noValue ? rule.values.length !== 0 : rule.operator === "between" ? rule.values.length !== 2 : !rule.values.length)
|
|
285
|
+
throw new Error("Invalid number of filter values.");
|
|
286
|
+
for (const value of rule.values) {
|
|
287
|
+
if (field2.kind === "number" && typeof value !== "number")
|
|
288
|
+
throw new Error("Numeric filters require numbers.");
|
|
289
|
+
if (field2.kind === "boolean" && typeof value !== "boolean")
|
|
290
|
+
throw new Error("Boolean filters require true or false.");
|
|
291
|
+
if ((field2.kind === "text" || field2.kind === "enum" || field2.kind === "date") && typeof value !== "string")
|
|
292
|
+
throw new Error("Text filters require strings.");
|
|
293
|
+
if (field2.kind === "date" && (typeof value !== "string" || !Number.isFinite(Date.parse(value)) || !/(Z|[+-]\d{2}:\d{2})$/.test(value)))
|
|
294
|
+
throw new Error("Date filters require ISO timestamps with an offset.");
|
|
412
295
|
}
|
|
413
|
-
|
|
296
|
+
if (rule.operator === "between" && (field2.kind === "date" ? Date.parse(String(rule.values[0])) > Date.parse(String(rule.values[1])) : Number(rule.values[0]) > Number(rule.values[1])))
|
|
297
|
+
throw new Error("Filter minimum must not exceed maximum.");
|
|
298
|
+
}
|
|
299
|
+
return filters;
|
|
414
300
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
"
|
|
420
|
-
"
|
|
421
|
-
|
|
422
|
-
"
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}).strict().optional()
|
|
453
|
-
});
|
|
454
|
-
var WorkflowToolSchema = import_zod3.z.object({
|
|
455
|
-
name: import_zod3.z.string().min(1).max(256),
|
|
456
|
-
description: import_zod3.z.string().max(4096).optional(),
|
|
457
|
-
callingMode: import_zod3.z.enum(["direct", "model"]),
|
|
458
|
-
provenance: import_zod3.z.enum(["source", "observed"]),
|
|
459
|
-
inputFields: import_zod3.z.array(
|
|
460
|
-
import_zod3.z.object({ name: import_zod3.z.string(), type: import_zod3.z.string(), required: import_zod3.z.boolean() }).strict()
|
|
461
|
-
).optional()
|
|
462
|
-
}).strict();
|
|
463
|
-
var ToolDiscoverySchema = import_zod3.z.object({
|
|
464
|
-
status: import_zod3.z.enum(["complete", "unresolved"]),
|
|
465
|
-
publishedAt: import_zod3.z.string().datetime().optional(),
|
|
466
|
-
warnings: import_zod3.z.array(import_zod3.z.string()).optional()
|
|
467
|
-
}).strict();
|
|
468
|
-
var StudioToolSchema = WorkflowToolSchema.extend({
|
|
469
|
-
callingMode: import_zod3.z.enum(["direct", "model", "unknown"]),
|
|
470
|
-
calls: import_zod3.z.number().nonnegative(),
|
|
471
|
-
replays: import_zod3.z.number().nonnegative(),
|
|
472
|
-
successes: import_zod3.z.number().nonnegative(),
|
|
473
|
-
denials: import_zod3.z.number().nonnegative(),
|
|
474
|
-
faults: import_zod3.z.number().nonnegative(),
|
|
475
|
-
cancellations: import_zod3.z.number().nonnegative(),
|
|
476
|
-
p50DurationMs: import_zod3.z.number().nonnegative().nullable(),
|
|
477
|
-
p95DurationMs: import_zod3.z.number().nonnegative().nullable()
|
|
478
|
-
}).strict();
|
|
479
|
-
|
|
480
|
-
// src/diagnostic-capture.ts
|
|
481
|
-
var import_errors = require("@kortyx/core/errors");
|
|
482
|
-
var encoder = new TextEncoder();
|
|
483
|
-
var nativeStackGetter = Object.getOwnPropertyDescriptor(
|
|
484
|
-
new Error(),
|
|
485
|
-
"stack"
|
|
486
|
-
)?.get;
|
|
487
|
-
function nativeStack(object, getter) {
|
|
488
|
-
if (!getter || getter !== nativeStackGetter)
|
|
489
|
-
throw new Error("Custom stack accessor");
|
|
490
|
-
for (const key of ["name", "message"]) {
|
|
491
|
-
let cursor = object;
|
|
492
|
-
while (cursor) {
|
|
493
|
-
const descriptor = Object.getOwnPropertyDescriptor(cursor, key);
|
|
494
|
-
if (descriptor) {
|
|
495
|
-
if (!("value" in descriptor) || typeof descriptor.value !== "string")
|
|
496
|
-
throw new Error("Custom error formatting");
|
|
497
|
-
break;
|
|
498
|
-
}
|
|
499
|
-
cursor = Object.getPrototypeOf(cursor);
|
|
301
|
+
function matchesTableRule(value, rule, kind) {
|
|
302
|
+
const values = (Array.isArray(value) ? value : [value]).filter(
|
|
303
|
+
(item) => item !== null && item !== void 0 && item !== ""
|
|
304
|
+
);
|
|
305
|
+
if (rule.operator === "present") return values.length > 0;
|
|
306
|
+
if (rule.operator === "missing") return values.length === 0;
|
|
307
|
+
if (!values.length) return false;
|
|
308
|
+
const equal = (a, b) => typeof a === "string" && typeof b === "string" ? kind === "date" ? Date.parse(a) === Date.parse(b) : a.toLowerCase() === b.toLowerCase() : a === b;
|
|
309
|
+
const contains = () => values.some(
|
|
310
|
+
(a) => rule.values.some(
|
|
311
|
+
(b) => String(a).toLowerCase().includes(String(b).toLowerCase())
|
|
312
|
+
)
|
|
313
|
+
);
|
|
314
|
+
if (rule.operator === "contains") return contains();
|
|
315
|
+
if (rule.operator === "notContains") return !contains();
|
|
316
|
+
if (rule.operator === "is")
|
|
317
|
+
return values.some((a) => rule.values.some((b) => equal(a, b)));
|
|
318
|
+
if (rule.operator === "isNot")
|
|
319
|
+
return !values.some((a) => rule.values.some((b) => equal(a, b)));
|
|
320
|
+
return values.some((a) => {
|
|
321
|
+
const comparable = typeof a === "string" && a.includes("T") && (a.endsWith("Z") || /[+-]\d{2}:\d{2}$/.test(a)) ? Date.parse(a) : Number(a);
|
|
322
|
+
const bounds = rule.values.map(
|
|
323
|
+
(b) => typeof b === "string" ? Date.parse(b) : Number(b)
|
|
324
|
+
);
|
|
325
|
+
switch (rule.operator) {
|
|
326
|
+
case "gt":
|
|
327
|
+
return comparable > bounds[0];
|
|
328
|
+
case "gte":
|
|
329
|
+
return comparable >= bounds[0];
|
|
330
|
+
case "lt":
|
|
331
|
+
return comparable < bounds[0];
|
|
332
|
+
case "lte":
|
|
333
|
+
return comparable <= bounds[0];
|
|
334
|
+
case "between":
|
|
335
|
+
return comparable >= bounds[0] && comparable <= bounds[1];
|
|
336
|
+
default:
|
|
337
|
+
return false;
|
|
500
338
|
}
|
|
501
|
-
}
|
|
502
|
-
const formatter = Object.getOwnPropertyDescriptor(Error, "prepareStackTrace");
|
|
503
|
-
if (formatter && (!("value" in formatter) || !formatter.writable))
|
|
504
|
-
throw new Error("Custom stack formatter");
|
|
505
|
-
Object.defineProperty(Error, "prepareStackTrace", {
|
|
506
|
-
...formatter ?? { configurable: true, writable: true },
|
|
507
|
-
value: void 0
|
|
508
339
|
});
|
|
509
|
-
try {
|
|
510
|
-
return getter.call(object);
|
|
511
|
-
} finally {
|
|
512
|
-
if (formatter) Object.defineProperty(Error, "prepareStackTrace", formatter);
|
|
513
|
-
else Reflect.deleteProperty(Error, "prepareStackTrace");
|
|
514
|
-
}
|
|
515
340
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
341
|
+
function matchesTableFilters(filters, read, fields) {
|
|
342
|
+
if (!filters.rules.length) return true;
|
|
343
|
+
const match = (rule) => matchesTableRule(
|
|
344
|
+
read(rule.field),
|
|
345
|
+
rule,
|
|
346
|
+
fields?.find((f) => f.key === rule.field)?.kind
|
|
347
|
+
);
|
|
348
|
+
return filters.match === "any" ? filters.rules.some(match) : filters.rules.every(match);
|
|
349
|
+
}
|
|
350
|
+
var field = (key2, label, kind = "text", unit) => ({ key: key2, label, kind, ...unit ? { unit } : {} });
|
|
351
|
+
var identity = [field("userId", "User ID"), field("tenantId", "Tenant ID")];
|
|
352
|
+
var metrics = [
|
|
353
|
+
field("durationMs", "Duration", "number", "ms"),
|
|
354
|
+
field("tokens", "Tokens", "number"),
|
|
355
|
+
field("cost", "Cost", "number", "currency units"),
|
|
356
|
+
field("currency", "Currency", "enum")
|
|
357
|
+
];
|
|
358
|
+
var STUDIO_TABLE_FIELDS = {
|
|
359
|
+
runs: [
|
|
360
|
+
field("id", "Run ID"),
|
|
361
|
+
field("execution", "Execution", "enum"),
|
|
362
|
+
field("parentRunId", "Parent run ID"),
|
|
363
|
+
field("callId", "Call ID"),
|
|
364
|
+
field("status", "Status", "enum"),
|
|
365
|
+
field("startedAt", "Started", "date"),
|
|
366
|
+
field("endedAt", "Ended", "date"),
|
|
367
|
+
...identity,
|
|
368
|
+
field("environment", "Environment", "enum"),
|
|
369
|
+
field("pricingStatus", "Pricing status", "enum"),
|
|
370
|
+
field("feedback", "Feedback", "enum"),
|
|
371
|
+
field("workflowIds", "Workflow"),
|
|
372
|
+
field("versions", "Version"),
|
|
373
|
+
field("path", "Path"),
|
|
374
|
+
field("sessionId", "Session ID"),
|
|
375
|
+
field("provider", "Provider", "enum"),
|
|
376
|
+
field("models", "Model"),
|
|
377
|
+
...metrics,
|
|
378
|
+
field("result", "Result"),
|
|
379
|
+
field("hasTool", "Has tool call", "boolean"),
|
|
380
|
+
field("toolName", "Tool name"),
|
|
381
|
+
field("toolOutcome", "Tool outcome", "enum"),
|
|
382
|
+
field("toolMode", "Called by", "enum"),
|
|
383
|
+
field("transitionIds", "Workflow transition")
|
|
384
|
+
],
|
|
385
|
+
sessions: [
|
|
386
|
+
field("id", "Session ID"),
|
|
387
|
+
field("status", "Status", "enum"),
|
|
388
|
+
field("lastActivityAt", "Last activity", "date"),
|
|
389
|
+
field("environment", "Environment", "enum"),
|
|
390
|
+
...identity,
|
|
391
|
+
field("workflowIds", "Workflow"),
|
|
392
|
+
field("activeVersion", "Version"),
|
|
393
|
+
field("runs", "Runs", "number"),
|
|
394
|
+
field("succeeded", "Successful runs", "number"),
|
|
395
|
+
field("failed", "Failed runs", "number"),
|
|
396
|
+
field("interrupted", "Interrupted runs", "number"),
|
|
397
|
+
field("checkpoints", "Checkpoints", "number"),
|
|
398
|
+
field("hasFork", "Has branch", "boolean"),
|
|
399
|
+
...metrics,
|
|
400
|
+
field("latestResult", "Latest result"),
|
|
401
|
+
field("latestError", "Latest error"),
|
|
402
|
+
field("pendingInterruptId", "Pending interrupt"),
|
|
403
|
+
field("hasError", "Has error", "boolean"),
|
|
404
|
+
field("hasInterrupt", "Has interrupt", "boolean"),
|
|
405
|
+
field("hasCheckpoint", "Has checkpoint", "boolean"),
|
|
406
|
+
field("providers", "Provider", "enum"),
|
|
407
|
+
field("models", "Model"),
|
|
408
|
+
field("tags", "Tags")
|
|
409
|
+
],
|
|
410
|
+
interrupts: [
|
|
411
|
+
field("id", "Interrupt ID"),
|
|
412
|
+
field("status", "Status", "enum"),
|
|
413
|
+
field("createdAt", "Created", "date"),
|
|
414
|
+
field("expiresAt", "Expires", "date"),
|
|
415
|
+
field("resolvedAt", "Resolved", "date"),
|
|
416
|
+
field("environment", "Environment", "enum"),
|
|
417
|
+
field("age", "Age", "number", "minutes"),
|
|
418
|
+
field("resolutionMs", "Resolution time", "number", "ms"),
|
|
419
|
+
field("type", "Type", "enum"),
|
|
420
|
+
field("question", "Request"),
|
|
421
|
+
field("contract", "Contract"),
|
|
422
|
+
field("schemaId", "Schema ID"),
|
|
423
|
+
field("workflowId", "Workflow"),
|
|
424
|
+
field("nodeId", "Node"),
|
|
425
|
+
field("sessionId", "Session ID"),
|
|
426
|
+
...identity,
|
|
427
|
+
field("response", "Response"),
|
|
428
|
+
field("resolvedBy", "Resolved by"),
|
|
429
|
+
field("resumeOutcome", "Resume outcome", "enum"),
|
|
430
|
+
field("resumeError", "Resume error"),
|
|
431
|
+
field("runId", "Run ID")
|
|
432
|
+
]
|
|
433
|
+
};
|
|
434
|
+
var LEGACY_TABLE_FILTERS = {
|
|
435
|
+
toolName: ["toolName", "contains"],
|
|
436
|
+
toolOutcome: ["toolOutcome", "is"],
|
|
437
|
+
toolMode: ["toolMode", "is"],
|
|
438
|
+
error: ["hasError", "is"],
|
|
439
|
+
interrupt: ["hasInterrupt", "is"],
|
|
440
|
+
checkpoint: ["hasCheckpoint", "is"],
|
|
441
|
+
fork: ["hasFork", "is"],
|
|
442
|
+
transition: ["transitionIds", "is"],
|
|
443
|
+
status: ["status", "is"],
|
|
444
|
+
provider: ["provider", "is"],
|
|
445
|
+
workflow: ["workflowIds", "is"],
|
|
446
|
+
version: ["versions", "is"],
|
|
447
|
+
path: ["path", "is"],
|
|
448
|
+
session: ["sessionId", "contains"],
|
|
449
|
+
model: ["models", "contains"],
|
|
450
|
+
result: ["result", "contains"],
|
|
451
|
+
feedback: ["feedback", "is"],
|
|
452
|
+
tool: ["hasTool", "is"],
|
|
453
|
+
user: ["userId", "contains"],
|
|
454
|
+
tenant: ["tenantId", "contains"],
|
|
455
|
+
tags: ["tags", "contains"],
|
|
456
|
+
node: ["nodeId", "contains"],
|
|
457
|
+
resolver: ["resolvedBy", "contains"],
|
|
458
|
+
outcome: ["resumeOutcome", "is"],
|
|
459
|
+
type: ["type", "is"],
|
|
460
|
+
minCost: ["cost", "gte"],
|
|
461
|
+
maxCost: ["cost", "lte"],
|
|
462
|
+
minTokens: ["tokens", "gte"],
|
|
463
|
+
maxTokens: ["tokens", "lte"],
|
|
464
|
+
minDuration: ["durationMs", "gte"],
|
|
465
|
+
maxDuration: ["durationMs", "lte"],
|
|
466
|
+
minAge: ["age", "gte"],
|
|
467
|
+
maxAge: ["age", "lte"]
|
|
468
|
+
};
|
|
469
|
+
function readStudioTableFilters(query, resource) {
|
|
470
|
+
const fields = STUDIO_TABLE_FIELDS[resource];
|
|
471
|
+
const filters = query.tableFilters ? TableFiltersSchema.parse(JSON.parse(query.tableFilters)) : { match: "all", rules: [] };
|
|
472
|
+
const rules = [...filters.rules];
|
|
473
|
+
for (const [alias, [original, operator]] of Object.entries(
|
|
474
|
+
LEGACY_TABLE_FILTERS
|
|
475
|
+
)) {
|
|
476
|
+
const raw = query[alias];
|
|
477
|
+
if (!raw) continue;
|
|
478
|
+
if (resource === "interrupts" && alias === "error") {
|
|
479
|
+
if (raw === "true" || raw === "1")
|
|
480
|
+
rules.push({ field: "resumeError", operator: "present", values: [] });
|
|
481
|
+
continue;
|
|
655
482
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const reason = (0, import_errors.errorProperty)(note, "reason");
|
|
666
|
-
if (typeof path === "string" && typeof reason === "string")
|
|
667
|
-
omissions.push({
|
|
668
|
-
path: redactDiagnosticText(path).slice(0, 4096),
|
|
669
|
-
reason: redactDiagnosticText(reason).slice(0, 128)
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
const data = captured && typeof captured === "object" && !Array.isArray(captured) ? captured : {
|
|
673
|
-
type: "Error",
|
|
674
|
-
message: typeof captured === "string" ? captured : "Execution reported a fault.",
|
|
675
|
-
value: captured
|
|
676
|
-
};
|
|
677
|
-
if (typeof data.message !== "string" && !("message" in data))
|
|
678
|
-
data.message = "Execution reported a fault.";
|
|
679
|
-
if (!("type" in data))
|
|
680
|
-
data.type = typeof data.name === "string" ? data.name : "Error";
|
|
681
|
-
const content = {
|
|
682
|
-
schemaVersion: 1,
|
|
683
|
-
data,
|
|
684
|
-
capture: {
|
|
685
|
-
status: omissions.length ? "partial" : "complete",
|
|
686
|
-
omissions,
|
|
687
|
-
redactions
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
if (encoder.encode(JSON.stringify(content)).length > DIAGNOSTIC_LIMITS.bytes)
|
|
691
|
-
return {
|
|
692
|
-
schemaVersion: 1,
|
|
693
|
-
data: {
|
|
694
|
-
type: "Error",
|
|
695
|
-
message: "Diagnostic exceeded the capture budget."
|
|
696
|
-
},
|
|
697
|
-
capture: {
|
|
698
|
-
status: "partial",
|
|
699
|
-
redactions: [],
|
|
700
|
-
omissions: [{ path: "#/data", reason: "serialized_byte_limit" }]
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
return content;
|
|
704
|
-
} catch {
|
|
705
|
-
return {
|
|
706
|
-
schemaVersion: 1,
|
|
707
|
-
data: { type: "Error", message: "Diagnostic capture failed." },
|
|
708
|
-
capture: {
|
|
709
|
-
status: "failed",
|
|
710
|
-
redactions: [],
|
|
711
|
-
omissions: [{ path: "#/data", reason: "projection_or_capture_failed" }]
|
|
712
|
-
}
|
|
713
|
-
};
|
|
483
|
+
const key2 = resource === "sessions" && alias === "provider" ? "providers" : resource === "sessions" && alias === "version" ? "activeVersion" : resource === "interrupts" && alias === "workflow" ? "workflowId" : original;
|
|
484
|
+
const definition = fields.find((f) => f.key === key2);
|
|
485
|
+
if (!definition) continue;
|
|
486
|
+
const values = definition.kind === "number" ? [Number(raw) * (alias.endsWith("Duration") ? 1e3 : 1)] : definition.kind === "boolean" ? [raw === "true" || raw === "1"] : operator === "is" ? raw.split(",").filter(Boolean) : [raw];
|
|
487
|
+
rules.push({
|
|
488
|
+
field: key2,
|
|
489
|
+
operator: resource === "interrupts" && alias === "workflow" ? "contains" : operator,
|
|
490
|
+
values
|
|
491
|
+
});
|
|
714
492
|
}
|
|
493
|
+
return validateTableFilters(
|
|
494
|
+
TableFiltersSchema.parse({ ...filters, rules }),
|
|
495
|
+
fields
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
var PROMPT_TABLE_FILTER_FIELDS = [
|
|
499
|
+
field("name", "Prompt"),
|
|
500
|
+
field("key", "Key"),
|
|
501
|
+
field("category", "Category"),
|
|
502
|
+
field("categoryId", "Category ID"),
|
|
503
|
+
field("live", "Is live", "boolean"),
|
|
504
|
+
field("liveVersion", "Live version", "number"),
|
|
505
|
+
field("latestVersion", "Newest version", "number"),
|
|
506
|
+
field("updatedAt", "Updated", "date"),
|
|
507
|
+
field("assignedTags", "Assigned tags"),
|
|
508
|
+
field("assignedVersions", "Assigned versions"),
|
|
509
|
+
field("versionsBehindLive", "Versions behind live", "number")
|
|
510
|
+
];
|
|
511
|
+
var EVALUATION_TABLE_FILTER_FIELDS = [
|
|
512
|
+
field("name", "Evaluation run"),
|
|
513
|
+
field("id", "Evaluation ID"),
|
|
514
|
+
field("selection", "Suite selection", "enum"),
|
|
515
|
+
field("suiteCount", "Suites", "number"),
|
|
516
|
+
field("judge", "Judge"),
|
|
517
|
+
field("judgeVersion", "Judge version"),
|
|
518
|
+
field("passRate", "Pass rate (%)", "number"),
|
|
519
|
+
field("queueMs", "Queue time (ms)", "number"),
|
|
520
|
+
field("status", "Status", "enum"),
|
|
521
|
+
field("completedSuites", "Completed suites", "number"),
|
|
522
|
+
field("completedAttempts", "Graded attempts", "number"),
|
|
523
|
+
field("totalAttempts", "Total attempts", "number"),
|
|
524
|
+
field("passed", "Passed", "number"),
|
|
525
|
+
field("failed", "Failed", "number"),
|
|
526
|
+
field("error", "Errors", "number"),
|
|
527
|
+
field("cancelled", "Cancelled", "number"),
|
|
528
|
+
field("applicationId", "Application ID"),
|
|
529
|
+
field("application", "Application"),
|
|
530
|
+
field("environment", "Environment", "enum"),
|
|
531
|
+
field("trigger", "Trigger", "enum"),
|
|
532
|
+
field("commit", "Commit"),
|
|
533
|
+
field("createdAt", "Created", "date"),
|
|
534
|
+
field("cost", "Cost", "number"),
|
|
535
|
+
field("duration", "Duration (ms)", "number")
|
|
536
|
+
];
|
|
537
|
+
function tablePassRate(counts) {
|
|
538
|
+
const total = counts ? counts.passed + counts.failed + counts.error : 0;
|
|
539
|
+
return counts && total > 0 ? counts.passed / total * 100 : void 0;
|
|
540
|
+
}
|
|
541
|
+
function tableQueueMs(createdAt, startedAt) {
|
|
542
|
+
if (!startedAt) return void 0;
|
|
543
|
+
const value = Date.parse(startedAt) - Date.parse(createdAt);
|
|
544
|
+
return Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
715
545
|
}
|
|
716
546
|
|
|
717
|
-
// src/
|
|
718
|
-
var
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
).max(
|
|
742
|
-
|
|
547
|
+
// src/table-preferences.ts
|
|
548
|
+
var StudioTableIdSchema = import_zod3.z.enum([
|
|
549
|
+
"runs",
|
|
550
|
+
"sessions",
|
|
551
|
+
"interrupts",
|
|
552
|
+
"prompts",
|
|
553
|
+
"prompt-groups",
|
|
554
|
+
"prompt-runs",
|
|
555
|
+
"prompt-evals",
|
|
556
|
+
"evaluations",
|
|
557
|
+
"eval-comparison",
|
|
558
|
+
"eval-cases",
|
|
559
|
+
"evaluation-suites",
|
|
560
|
+
"legacy-eval-runs",
|
|
561
|
+
"eval-suites"
|
|
562
|
+
]);
|
|
563
|
+
var key = import_zod3.z.string().min(1).max(80);
|
|
564
|
+
var StudioTableLayoutSchema = import_zod3.z.object({
|
|
565
|
+
widths: import_zod3.z.record(key, import_zod3.z.number().finite().min(1).max(1e4)).refine((v) => Object.keys(v).length <= 256),
|
|
566
|
+
order: import_zod3.z.array(key).max(256),
|
|
567
|
+
hidden: import_zod3.z.array(key).max(256),
|
|
568
|
+
pinned: import_zod3.z.record(key, import_zod3.z.enum(["left", "right"]).optional()).refine((v) => Object.keys(v).length <= 256)
|
|
569
|
+
}).strict();
|
|
570
|
+
var StudioTableQueryPreferencesSchema = import_zod3.z.object({
|
|
571
|
+
sort: import_zod3.z.string().max(80),
|
|
572
|
+
dir: import_zod3.z.enum(["asc", "desc"]),
|
|
573
|
+
pageSize: import_zod3.z.number().int().min(1).max(250)
|
|
574
|
+
}).strict();
|
|
575
|
+
var StudioSavedViewDefinitionSchema = import_zod3.z.object({
|
|
576
|
+
name: import_zod3.z.string().trim().min(1).max(80),
|
|
577
|
+
filters: TableFiltersSchema,
|
|
578
|
+
layout: StudioTableLayoutSchema,
|
|
579
|
+
scope: import_zod3.z.record(key, import_zod3.z.string().max(512)).refine((v) => Object.keys(v).length <= 32),
|
|
580
|
+
sort: import_zod3.z.string().max(80).optional(),
|
|
581
|
+
direction: import_zod3.z.enum(["asc", "desc"]).optional(),
|
|
582
|
+
pageSize: import_zod3.z.number().int().min(1).max(250).optional()
|
|
583
|
+
}).strict();
|
|
584
|
+
var StudioTableViewSchema = StudioSavedViewDefinitionSchema.extend({
|
|
585
|
+
id: import_zod3.z.uuid()
|
|
743
586
|
});
|
|
744
|
-
var
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
587
|
+
var StudioTableDefaultsSchema = import_zod3.z.object({
|
|
588
|
+
layout: StudioTableLayoutSchema.optional(),
|
|
589
|
+
query: StudioTableQueryPreferencesSchema.optional()
|
|
590
|
+
}).strict();
|
|
591
|
+
var StudioTableConfigurationSchema = import_zod3.z.object({
|
|
592
|
+
schemaVersion: import_zod3.z.literal(1),
|
|
593
|
+
defaults: StudioTableDefaultsSchema,
|
|
594
|
+
views: import_zod3.z.array(StudioTableViewSchema).max(30).refine((v) => new Set(v.map((x) => x.id)).size === v.length)
|
|
595
|
+
}).strict();
|
|
596
|
+
var StudioTablePreferencesSchema = StudioTableConfigurationSchema.extend({ revision: import_zod3.z.number().int().min(0) });
|
|
597
|
+
var StudioTablePreferenceScopeSchema = import_zod3.z.object({
|
|
598
|
+
cacheKey: import_zod3.z.string().regex(/^[a-f0-9]{64}$/),
|
|
599
|
+
ownerKind: import_zod3.z.enum(["project", "user"])
|
|
749
600
|
});
|
|
750
|
-
var
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
601
|
+
var StudioTablePreferenceOperationSchema = import_zod3.z.discriminatedUnion(
|
|
602
|
+
"kind",
|
|
603
|
+
[
|
|
604
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("defaults"), patch: StudioTableDefaultsSchema }).strict(),
|
|
605
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("putView"), view: StudioTableViewSchema }).strict(),
|
|
606
|
+
import_zod3.z.object({ kind: import_zod3.z.literal("deleteView"), id: import_zod3.z.uuid() }).strict()
|
|
607
|
+
]
|
|
608
|
+
);
|
|
609
|
+
var StudioTablePreferenceWriteSchema = import_zod3.z.object({
|
|
610
|
+
scopeKey: import_zod3.z.string().regex(/^[a-f0-9]{64}$/),
|
|
611
|
+
expectedRevision: import_zod3.z.number().int().min(0),
|
|
612
|
+
operation: StudioTablePreferenceOperationSchema
|
|
613
|
+
}).strict();
|
|
614
|
+
function emptyTablePreferences() {
|
|
615
|
+
return { schemaVersion: 1, revision: 0, defaults: {}, views: [] };
|
|
616
|
+
}
|
|
617
|
+
function applyTablePreferenceOperation(state, operation) {
|
|
618
|
+
if (operation.kind === "defaults")
|
|
619
|
+
return { ...state, defaults: { ...state.defaults, ...operation.patch } };
|
|
620
|
+
if (operation.kind === "deleteView")
|
|
621
|
+
return {
|
|
622
|
+
...state,
|
|
623
|
+
views: state.views.filter((v) => v.id !== operation.id)
|
|
624
|
+
};
|
|
625
|
+
const exists = state.views.some((v) => v.id === operation.view.id);
|
|
626
|
+
return StudioTablePreferencesSchema.parse({
|
|
627
|
+
...state,
|
|
628
|
+
views: exists ? state.views.map(
|
|
629
|
+
(v) => v.id === operation.view.id ? operation.view : v
|
|
630
|
+
) : [...state.views, operation.view]
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
var StudioTablePreferenceResponseSchema = import_zod3.z.object({
|
|
634
|
+
scope: StudioTablePreferenceScopeSchema,
|
|
635
|
+
preferences: StudioTablePreferencesSchema
|
|
760
636
|
});
|
|
761
|
-
|
|
637
|
+
|
|
638
|
+
// src/diagnostics.ts
|
|
639
|
+
var import_zod4 = require("zod");
|
|
640
|
+
var DIAGNOSTIC_LIMITS = {
|
|
641
|
+
bytes: 8 * 1024 * 1024,
|
|
642
|
+
partBytes: 64 * 1024,
|
|
643
|
+
parts: 128,
|
|
644
|
+
nodes: 1e4,
|
|
645
|
+
depth: 128,
|
|
646
|
+
properties: 1e3
|
|
647
|
+
};
|
|
648
|
+
var DiagnosticNoteSchema = import_zod4.z.object({
|
|
649
|
+
path: import_zod4.z.string().max(4096),
|
|
650
|
+
reason: import_zod4.z.string().max(128),
|
|
651
|
+
originalBytes: import_zod4.z.number().int().nonnegative().optional(),
|
|
652
|
+
originalCount: import_zod4.z.number().int().nonnegative().optional()
|
|
653
|
+
}).strict();
|
|
654
|
+
var DiagnosticContentSchema = import_zod4.z.object({
|
|
762
655
|
schemaVersion: import_zod4.z.literal(1),
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
permissions: import_zod4.z.object({
|
|
769
|
-
edit: import_zod4.z.boolean(),
|
|
770
|
-
promote: import_zod4.z.boolean(),
|
|
771
|
-
review: import_zod4.z.boolean(),
|
|
772
|
-
settings: import_zod4.z.boolean()
|
|
773
|
-
})
|
|
774
|
-
});
|
|
775
|
-
var PromptStoredVersionSchema = import_browser.PromptVersionSchema.extend({
|
|
776
|
-
promptId: import_zod4.z.uuid(),
|
|
777
|
-
note: import_zod4.z.string(),
|
|
778
|
-
author: import_zod4.z.string(),
|
|
779
|
-
createdAt: import_zod4.z.string(),
|
|
780
|
-
origin: import_zod4.z.object({
|
|
781
|
-
apiUrl: import_zod4.z.string(),
|
|
782
|
-
projectId: import_zod4.z.string(),
|
|
783
|
-
key: import_zod4.z.string(),
|
|
784
|
-
version,
|
|
785
|
-
hash: import_zod4.z.string()
|
|
786
|
-
}).nullable()
|
|
787
|
-
});
|
|
788
|
-
var PromptPolicySchema = import_zod4.z.object({
|
|
789
|
-
revision,
|
|
790
|
-
requireTest: import_zod4.z.boolean(),
|
|
791
|
-
requireChangeNote: import_zod4.z.boolean().default(false),
|
|
792
|
-
requiredSuites: import_zod4.z.array(import_zod4.z.object({ targetId: name, suiteId: name })).max(100),
|
|
793
|
-
requiredReviews: import_zod4.z.number().int().min(0).max(10),
|
|
794
|
-
allowException: import_zod4.z.boolean()
|
|
795
|
-
});
|
|
796
|
-
var PromptEvidenceSchema = import_zod4.z.object({
|
|
797
|
-
environment: import_zod4.z.string(),
|
|
798
|
-
runId: import_zod4.z.string(),
|
|
799
|
-
evaluationId: import_zod4.z.string().nullable().optional(),
|
|
800
|
-
targetId: import_zod4.z.string(),
|
|
801
|
-
suiteId: import_zod4.z.string(),
|
|
802
|
-
suiteRevision: import_zod4.z.string().optional(),
|
|
803
|
-
status: import_zod4.z.string(),
|
|
804
|
-
version,
|
|
805
|
-
fullSuite: import_zod4.z.boolean(),
|
|
806
|
-
usage: import_zod4.z.enum([
|
|
807
|
-
"verified",
|
|
808
|
-
"pending",
|
|
809
|
-
"not-used",
|
|
810
|
-
"mismatch",
|
|
811
|
-
"context-differs"
|
|
812
|
-
]),
|
|
813
|
-
groupName: import_zod4.z.string().nullable(),
|
|
814
|
-
createdAt: import_zod4.z.string(),
|
|
815
|
-
companions: import_zod4.z.array(import_zod4.z.object({ key: import_browser.PromptKeySchema, version }))
|
|
816
|
-
});
|
|
817
|
-
var PromptUsageSchema = import_zod4.z.object({
|
|
818
|
-
eventId: import_zod4.z.string(),
|
|
819
|
-
runId: import_zod4.z.string(),
|
|
820
|
-
sessionId: import_zod4.z.string().nullable(),
|
|
821
|
-
nodeId: import_zod4.z.string().nullable(),
|
|
822
|
-
version: import_zod4.z.number().int(),
|
|
823
|
-
hash: import_zod4.z.string().nullable(),
|
|
824
|
-
source: import_zod4.z.string().nullable(),
|
|
825
|
-
model: import_zod4.z.string().nullable(),
|
|
826
|
-
environment: import_zod4.z.string(),
|
|
827
|
-
occurredAt: import_zod4.z.string(),
|
|
828
|
-
captured: import_zod4.z.boolean()
|
|
829
|
-
});
|
|
830
|
-
var PromptDetailSchema = import_zod4.z.object({
|
|
831
|
-
asset: PromptAssetSchema,
|
|
832
|
-
versions: import_zod4.z.array(PromptStoredVersionSchema),
|
|
833
|
-
versionsNextCursor: import_zod4.z.string().nullable().optional(),
|
|
834
|
-
draft: import_browser.PromptContentSchema.nullable(),
|
|
835
|
-
draftBase: import_zod4.z.number().int().nullable(),
|
|
836
|
-
draftRevision: revision,
|
|
837
|
-
evidence: import_zod4.z.array(PromptEvidenceSchema),
|
|
838
|
-
usage: import_zod4.z.array(PromptUsageSchema),
|
|
839
|
-
activity: import_zod4.z.array(
|
|
840
|
-
import_zod4.z.object({
|
|
841
|
-
id: import_zod4.z.string(),
|
|
842
|
-
action: import_zod4.z.string(),
|
|
843
|
-
actor: import_zod4.z.string(),
|
|
844
|
-
details: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
845
|
-
createdAt: import_zod4.z.string()
|
|
846
|
-
})
|
|
847
|
-
),
|
|
848
|
-
policies: import_zod4.z.array(PromptPolicySchema),
|
|
849
|
-
reviews: import_zod4.z.array(
|
|
850
|
-
import_zod4.z.object({
|
|
851
|
-
version,
|
|
852
|
-
hash: import_zod4.z.string(),
|
|
853
|
-
independent: import_zod4.z.boolean(),
|
|
854
|
-
reviewer: import_zod4.z.string(),
|
|
855
|
-
note: import_zod4.z.string(),
|
|
856
|
-
createdAt: import_zod4.z.string()
|
|
857
|
-
})
|
|
858
|
-
).optional()
|
|
859
|
-
});
|
|
860
|
-
var PromptMutationSchema = import_zod4.z.discriminatedUnion("action", [
|
|
861
|
-
import_zod4.z.object({
|
|
862
|
-
action: import_zod4.z.literal("tag-set"),
|
|
863
|
-
id: import_zod4.z.uuid(),
|
|
864
|
-
tag: import_browser.PromptTagSchema.refine(
|
|
865
|
-
(tag) => tag !== "live",
|
|
866
|
-
"Use promotion to update live."
|
|
867
|
-
),
|
|
868
|
-
version,
|
|
869
|
-
expectedRevision: revision
|
|
870
|
-
}).strict(),
|
|
871
|
-
import_zod4.z.object({
|
|
872
|
-
action: import_zod4.z.literal("tag-remove"),
|
|
873
|
-
id: import_zod4.z.uuid(),
|
|
874
|
-
tag: import_browser.PromptTagSchema.refine(
|
|
875
|
-
(tag) => tag !== "live",
|
|
876
|
-
"The live tag cannot be removed manually."
|
|
877
|
-
),
|
|
878
|
-
expectedRevision: revision
|
|
879
|
-
}).strict(),
|
|
880
|
-
import_zod4.z.object({
|
|
881
|
-
action: import_zod4.z.literal("bulk-update"),
|
|
882
|
-
assets: import_zod4.z.array(import_zod4.z.object({ id: import_zod4.z.uuid(), expectedRevision: revision })).min(1).max(100),
|
|
883
|
-
categoryId: import_zod4.z.uuid().nullable().optional(),
|
|
884
|
-
archived: import_zod4.z.boolean().optional()
|
|
885
|
-
}).strict().refine(
|
|
886
|
-
(value) => value.categoryId !== void 0 || value.archived !== void 0,
|
|
887
|
-
"Choose a category or archive state."
|
|
888
|
-
),
|
|
889
|
-
import_zod4.z.object({
|
|
890
|
-
action: import_zod4.z.literal("create"),
|
|
891
|
-
key: import_browser.PromptKeySchema,
|
|
892
|
-
name,
|
|
893
|
-
categoryId: import_zod4.z.uuid().nullable().default(null),
|
|
894
|
-
content: import_browser.PromptContentSchema,
|
|
895
|
-
note: import_zod4.z.string().trim().max(2e3).default(""),
|
|
896
|
-
idempotencyKey: import_zod4.z.uuid().optional()
|
|
897
|
-
}).strict(),
|
|
898
|
-
import_zod4.z.object({
|
|
899
|
-
action: import_zod4.z.literal("draft"),
|
|
900
|
-
id: import_zod4.z.uuid(),
|
|
901
|
-
content: import_browser.PromptContentSchema,
|
|
902
|
-
baseVersion: version,
|
|
903
|
-
expectedRevision: revision
|
|
904
|
-
}).strict(),
|
|
905
|
-
import_zod4.z.object({
|
|
906
|
-
action: import_zod4.z.literal("discard-draft"),
|
|
907
|
-
id: import_zod4.z.uuid(),
|
|
908
|
-
expectedRevision: revision
|
|
909
|
-
}).strict(),
|
|
910
|
-
import_zod4.z.object({
|
|
911
|
-
action: import_zod4.z.literal("save"),
|
|
912
|
-
id: import_zod4.z.uuid(),
|
|
913
|
-
content: import_browser.PromptContentSchema,
|
|
914
|
-
baseVersion: version,
|
|
915
|
-
expectedHash: import_zod4.z.string().regex(/^[a-f0-9]{64}$/),
|
|
916
|
-
expectedDraftRevision: revision.optional(),
|
|
917
|
-
note: import_zod4.z.string().trim().max(2e3).default(""),
|
|
918
|
-
idempotencyKey: import_zod4.z.uuid()
|
|
919
|
-
}).strict(),
|
|
920
|
-
import_zod4.z.object({
|
|
921
|
-
action: import_zod4.z.literal("update"),
|
|
922
|
-
id: import_zod4.z.uuid(),
|
|
923
|
-
expectedRevision: revision,
|
|
924
|
-
name: name.optional(),
|
|
925
|
-
categoryId: import_zod4.z.uuid().nullable().optional(),
|
|
926
|
-
archived: import_zod4.z.boolean().optional()
|
|
927
|
-
}).strict(),
|
|
928
|
-
import_zod4.z.object({
|
|
929
|
-
action: import_zod4.z.literal("category-create"),
|
|
930
|
-
path: import_zod4.z.string().trim().min(1).max(1e3)
|
|
931
|
-
}).strict(),
|
|
932
|
-
import_zod4.z.object({
|
|
933
|
-
action: import_zod4.z.literal("category-update"),
|
|
934
|
-
id: import_zod4.z.uuid(),
|
|
935
|
-
expectedRevision: revision,
|
|
936
|
-
name: name.optional(),
|
|
937
|
-
parentId: import_zod4.z.uuid().nullable().optional()
|
|
938
|
-
}).strict(),
|
|
939
|
-
import_zod4.z.object({
|
|
940
|
-
action: import_zod4.z.literal("category-delete"),
|
|
941
|
-
id: import_zod4.z.uuid(),
|
|
942
|
-
expectedRevision: revision,
|
|
943
|
-
destinationId: import_zod4.z.uuid().nullable()
|
|
944
|
-
}).strict(),
|
|
945
|
-
import_zod4.z.object({
|
|
946
|
-
action: import_zod4.z.literal("group-create"),
|
|
947
|
-
name,
|
|
948
|
-
members: import_zod4.z.array(import_zod4.z.object({ promptId: import_zod4.z.uuid(), version })).max(100).optional()
|
|
949
|
-
}).strict(),
|
|
950
|
-
import_zod4.z.object({
|
|
951
|
-
action: import_zod4.z.literal("group-update"),
|
|
952
|
-
id: import_zod4.z.uuid(),
|
|
953
|
-
expectedRevision: revision,
|
|
954
|
-
name: name.optional(),
|
|
955
|
-
members: import_zod4.z.array(import_zod4.z.object({ promptId: import_zod4.z.uuid(), version })).max(100).optional()
|
|
956
|
-
}).strict(),
|
|
957
|
-
import_zod4.z.object({
|
|
958
|
-
action: import_zod4.z.literal("group-delete"),
|
|
959
|
-
id: import_zod4.z.uuid(),
|
|
960
|
-
expectedRevision: revision
|
|
961
|
-
}).strict(),
|
|
962
|
-
import_zod4.z.object({
|
|
963
|
-
action: import_zod4.z.literal("promote"),
|
|
964
|
-
id: import_zod4.z.uuid(),
|
|
965
|
-
version,
|
|
966
|
-
expectedRevision: revision,
|
|
967
|
-
exceptionReason: import_zod4.z.string().trim().min(1).max(2e3).optional(),
|
|
968
|
-
rollback: import_zod4.z.boolean().default(false)
|
|
969
|
-
}).strict(),
|
|
970
|
-
import_zod4.z.object({
|
|
971
|
-
action: import_zod4.z.literal("review"),
|
|
972
|
-
id: import_zod4.z.uuid(),
|
|
973
|
-
version,
|
|
974
|
-
note: import_zod4.z.string().trim().min(1).max(2e3)
|
|
975
|
-
}).strict(),
|
|
976
|
-
import_zod4.z.object({
|
|
977
|
-
action: import_zod4.z.literal("policy"),
|
|
978
|
-
id: import_zod4.z.uuid(),
|
|
979
|
-
policy: PromptPolicySchema
|
|
656
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
657
|
+
capture: import_zod4.z.object({
|
|
658
|
+
status: import_zod4.z.enum(["complete", "partial", "failed"]),
|
|
659
|
+
omissions: import_zod4.z.array(DiagnosticNoteSchema).max(1e4),
|
|
660
|
+
redactions: import_zod4.z.array(DiagnosticNoteSchema).max(1e4)
|
|
980
661
|
}).strict()
|
|
981
|
-
|
|
982
|
-
var
|
|
983
|
-
|
|
984
|
-
import_zod4.z.
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
662
|
+
}).strict();
|
|
663
|
+
var DiagnosticCorrelationSchema = import_zod4.z.object({
|
|
664
|
+
runId: import_zod4.z.string().optional(),
|
|
665
|
+
evaluationId: import_zod4.z.string().optional(),
|
|
666
|
+
suiteRunId: import_zod4.z.string().optional(),
|
|
667
|
+
caseId: import_zod4.z.string().optional(),
|
|
668
|
+
repetition: import_zod4.z.string().optional(),
|
|
669
|
+
phase: import_zod4.z.string().optional(),
|
|
670
|
+
workflowId: import_zod4.z.string().optional(),
|
|
671
|
+
nodeId: import_zod4.z.string().optional(),
|
|
672
|
+
sessionId: import_zod4.z.string().optional(),
|
|
673
|
+
invocationId: import_zod4.z.string().optional(),
|
|
674
|
+
parentInvocationId: import_zod4.z.string().optional(),
|
|
675
|
+
branchId: import_zod4.z.string().optional(),
|
|
676
|
+
toolCallId: import_zod4.z.string().optional(),
|
|
677
|
+
attemptId: import_zod4.z.string().optional(),
|
|
678
|
+
workflowRevisionId: import_zod4.z.string().optional(),
|
|
679
|
+
traceId: import_zod4.z.string().optional(),
|
|
680
|
+
spanId: import_zod4.z.string().optional(),
|
|
681
|
+
parentSpanId: import_zod4.z.string().optional()
|
|
682
|
+
}).strict();
|
|
683
|
+
var DiagnosticManifestSchema = import_zod4.z.object({
|
|
684
|
+
schemaVersion: import_zod4.z.literal(1),
|
|
685
|
+
diagnosticId: import_zod4.z.string().uuid(),
|
|
686
|
+
occurrenceId: import_zod4.z.string().uuid(),
|
|
687
|
+
occurredAt: import_zod4.z.string().datetime({ offset: true }),
|
|
688
|
+
environment: import_zod4.z.string().min(1).max(256),
|
|
689
|
+
service: import_zod4.z.object({
|
|
690
|
+
name: import_zod4.z.string().min(1).max(256),
|
|
691
|
+
deploymentRef: import_zod4.z.string().max(1024).optional()
|
|
988
692
|
}).strict(),
|
|
989
|
-
|
|
693
|
+
correlation: DiagnosticCorrelationSchema,
|
|
694
|
+
handled: import_zod4.z.boolean(),
|
|
695
|
+
severity: import_zod4.z.enum(["warning", "error"]),
|
|
696
|
+
mechanism: import_zod4.z.enum(["span", "report", "tool"]),
|
|
697
|
+
summary: import_zod4.z.object({ type: import_zod4.z.string().max(256), message: import_zod4.z.string().max(8192) }).strict(),
|
|
698
|
+
captureStatus: import_zod4.z.enum(["complete", "partial", "failed"]),
|
|
699
|
+
checksum: import_zod4.z.string().regex(/^[a-f0-9]{64}$/),
|
|
700
|
+
byteLength: import_zod4.z.number().int().min(1).max(DIAGNOSTIC_LIMITS.bytes),
|
|
701
|
+
partCount: import_zod4.z.number().int().min(1).max(DIAGNOSTIC_LIMITS.parts)
|
|
702
|
+
}).strict().superRefine((value, ctx) => {
|
|
703
|
+
if (value.partCount !== Math.ceil(value.byteLength / DIAGNOSTIC_LIMITS.partBytes))
|
|
704
|
+
ctx.addIssue({
|
|
705
|
+
code: "custom",
|
|
706
|
+
path: ["partCount"],
|
|
707
|
+
message: "Part count does not match byte length."
|
|
708
|
+
});
|
|
709
|
+
});
|
|
710
|
+
var DiagnosticPartSchema = import_zod4.z.object({
|
|
711
|
+
index: import_zod4.z.number().int().min(0).max(DIAGNOSTIC_LIMITS.parts - 1),
|
|
712
|
+
data: import_zod4.z.string().max(Math.ceil(DIAGNOSTIC_LIMITS.partBytes / 3) * 4).regex(
|
|
713
|
+
/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/
|
|
714
|
+
)
|
|
715
|
+
}).strict();
|
|
716
|
+
var DiagnosticResponseSchema = import_zod4.z.object({
|
|
717
|
+
manifest: DiagnosticManifestSchema,
|
|
718
|
+
state: import_zod4.z.enum(["pending", "available", "incomplete", "expired"]),
|
|
719
|
+
receivedParts: import_zod4.z.number().int().nonnegative(),
|
|
720
|
+
expiresAt: import_zod4.z.string().datetime({ offset: true }),
|
|
721
|
+
content: DiagnosticContentSchema.nullable(),
|
|
722
|
+
contentChecksum: import_zod4.z.string().regex(/^[a-f0-9]{64}$/).nullable(),
|
|
723
|
+
contentByteLength: import_zod4.z.number().int().nonnegative().nullable()
|
|
724
|
+
}).strict();
|
|
725
|
+
var isPrivateDiagnosticField = (key2) => /^(?:password|passwd|secret|clientsecret|privatekey|credential|credentials|authorization|proxyauthorization|bearer|bearertoken|jwt|token|accesstoken|refreshtoken|authtoken|apikey|xapikey|apitoken|xauthtoken|xaccesstoken|awsaccesskeyid|awssecretaccesskey|awssessiontoken|xamzsecuritytoken|apisecret|cookie|setcookie|resumehandle|resumetoken)$/.test(
|
|
726
|
+
key2.toLowerCase().replace(/[^a-z0-9]/g, "")
|
|
727
|
+
);
|
|
728
|
+
function redactDiagnosticText(value) {
|
|
729
|
+
return value.replace(/\bBearer\s+[A-Za-z0-9._~+/-]+=*/gi, "Bearer [REDACTED]").replace(
|
|
730
|
+
/\b(?:ktyx_(?:test|live)_[^\s"'<>]+|sk-(?:proj-|ant-)?[A-Za-z0-9_-]{12,}|AIza[A-Za-z0-9_-]{20,}|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)/g,
|
|
731
|
+
"[REDACTED]"
|
|
732
|
+
).replace(
|
|
733
|
+
/(["']?(?:api[_-]?key|access[_-]?token|refresh[_-]?token|password|passwd|secret|token|client[_-]?secret|authorization|cookie)["']?\s*[:=]\s*)(["'])(.*?)\2/gi,
|
|
734
|
+
"$1$2[REDACTED]$2"
|
|
735
|
+
).replace(
|
|
736
|
+
/(\b(?:api[_-]?key|access[_-]?token|refresh[_-]?token|password|passwd|secret|token|client[_-]?secret)\s*[:=]\s*)(?!["'[])[^\s,;}&]+/gi,
|
|
737
|
+
"$1[REDACTED]"
|
|
738
|
+
).replace(
|
|
739
|
+
/(\b(?:authorization|proxy-authorization)\s*:\s*Basic\s+)[A-Za-z0-9+/=]+/gi,
|
|
740
|
+
"$1[REDACTED]"
|
|
741
|
+
).replace(
|
|
742
|
+
/([?&](?:api[_-]?key|token|access[_-]?token|password)=)[^&#\s]+/gi,
|
|
743
|
+
"$1[REDACTED]"
|
|
744
|
+
).replace(/(https?:\/\/)[^\s/@:]+:[^\s/@]+@/gi, "$1[REDACTED]@");
|
|
745
|
+
}
|
|
746
|
+
function summarizeDiagnostic(data, depth = 0) {
|
|
747
|
+
return {
|
|
748
|
+
type: typeof data.type === "string" ? data.type.slice(0, 256) : "Error",
|
|
749
|
+
message: typeof data.message === "string" ? data.message.slice(0, 8192) : "Execution reported a fault.",
|
|
750
|
+
...typeof data.stack === "string" ? { stack: data.stack.slice(0, 32768) } : {},
|
|
751
|
+
...depth < 4 && data.cause && typeof data.cause === "object" && !Array.isArray(data.cause) ? {
|
|
752
|
+
cause: summarizeDiagnostic(
|
|
753
|
+
data.cause,
|
|
754
|
+
depth + 1
|
|
755
|
+
)
|
|
756
|
+
} : {}
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
function redactDiagnosticContent(content) {
|
|
760
|
+
const redactions = [...content.capture.redactions];
|
|
761
|
+
const omissions = [...content.capture.omissions];
|
|
762
|
+
let nodes = 0;
|
|
763
|
+
const visit = (value, path, depth = 0) => {
|
|
764
|
+
if (++nodes > DIAGNOSTIC_LIMITS.nodes || depth > DIAGNOSTIC_LIMITS.depth) {
|
|
765
|
+
const reason = depth > DIAGNOSTIC_LIMITS.depth ? "server_depth_limit" : "server_node_limit";
|
|
766
|
+
if (omissions.length < 1e4)
|
|
767
|
+
omissions.push({ path: path.slice(0, 4096), reason });
|
|
768
|
+
return { $omitted: reason };
|
|
769
|
+
}
|
|
770
|
+
if (typeof value === "string") {
|
|
771
|
+
const clean = redactDiagnosticText(value);
|
|
772
|
+
if (clean !== value && redactions.length < 1e4)
|
|
773
|
+
redactions.push({
|
|
774
|
+
path: path.slice(0, 4096),
|
|
775
|
+
reason: "server_credential_text"
|
|
776
|
+
});
|
|
777
|
+
return clean;
|
|
778
|
+
}
|
|
779
|
+
if (Array.isArray(value)) {
|
|
780
|
+
if (value.length > DIAGNOSTIC_LIMITS.properties && omissions.length < 1e4)
|
|
781
|
+
omissions.push({
|
|
782
|
+
path: path.slice(0, 4096),
|
|
783
|
+
reason: "server_collection_limit",
|
|
784
|
+
originalCount: value.length
|
|
785
|
+
});
|
|
786
|
+
return value.slice(0, DIAGNOSTIC_LIMITS.properties).map((item, index) => visit(item, `${path}/${index}`, depth + 1));
|
|
787
|
+
}
|
|
788
|
+
if (value && typeof value === "object") {
|
|
789
|
+
const keys = Object.keys(value);
|
|
790
|
+
if (keys.length > DIAGNOSTIC_LIMITS.properties && omissions.length < 1e4)
|
|
791
|
+
omissions.push({
|
|
792
|
+
path: path.slice(0, 4096),
|
|
793
|
+
reason: "server_property_limit",
|
|
794
|
+
originalCount: keys.length
|
|
795
|
+
});
|
|
796
|
+
return Object.fromEntries(
|
|
797
|
+
keys.slice(0, DIAGNOSTIC_LIMITS.properties).map((key2) => {
|
|
798
|
+
const nested = value[key2];
|
|
799
|
+
if (isPrivateDiagnosticField(key2)) {
|
|
800
|
+
if (redactions.length < 1e4 && nested !== "[REDACTED]")
|
|
801
|
+
redactions.push({
|
|
802
|
+
path: `${path}/${key2}`.slice(0, 4096),
|
|
803
|
+
reason: "server_credential_field"
|
|
804
|
+
});
|
|
805
|
+
return [key2, "[REDACTED]"];
|
|
806
|
+
}
|
|
807
|
+
return [key2, visit(nested, `${path}/${key2}`, depth + 1)];
|
|
808
|
+
})
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
return value;
|
|
812
|
+
};
|
|
813
|
+
return {
|
|
814
|
+
...content,
|
|
815
|
+
data: visit(content.data, "#/data"),
|
|
816
|
+
capture: {
|
|
817
|
+
...content.capture,
|
|
818
|
+
status: content.capture.status === "failed" ? "failed" : omissions.length ? "partial" : "complete",
|
|
819
|
+
omissions: omissions.map((note) => ({
|
|
820
|
+
...note,
|
|
821
|
+
path: redactDiagnosticText(note.path),
|
|
822
|
+
reason: redactDiagnosticText(note.reason)
|
|
823
|
+
})),
|
|
824
|
+
redactions: redactions.map((note) => ({
|
|
825
|
+
...note,
|
|
826
|
+
path: redactDiagnosticText(note.path),
|
|
827
|
+
reason: redactDiagnosticText(note.reason)
|
|
828
|
+
}))
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// src/sample-project.ts
|
|
834
|
+
var SAMPLE_PROJECT = {
|
|
835
|
+
id: "kortyx-sample",
|
|
836
|
+
name: "Sample project",
|
|
837
|
+
version: 5,
|
|
838
|
+
recordedAt: "2026-10-01T12:00:00.000Z",
|
|
839
|
+
referenceTime: "2026-10-01T12:10:00.000Z",
|
|
840
|
+
workflowId: "sample-support-assistant",
|
|
841
|
+
revisionId: "10000000-0000-4000-8000-000000000001",
|
|
842
|
+
runs: {
|
|
843
|
+
success: "sample-support-success",
|
|
844
|
+
failure: "sample-support-failure",
|
|
845
|
+
approval: "sample-support-approval",
|
|
846
|
+
followUp: "sample-support-follow-up",
|
|
847
|
+
baseline: "sample-support-baseline"
|
|
848
|
+
},
|
|
849
|
+
sessions: {
|
|
850
|
+
success: "sample-session-success",
|
|
851
|
+
failure: "sample-session-failure",
|
|
852
|
+
approval: "sample-session-approval",
|
|
853
|
+
followUp: "sample-session-success",
|
|
854
|
+
baseline: "sample-session-baseline"
|
|
855
|
+
},
|
|
856
|
+
specialistWorkflowIds: {
|
|
857
|
+
research: "sample-order-research",
|
|
858
|
+
resolution: "sample-order-resolution"
|
|
859
|
+
},
|
|
860
|
+
specialistRevisionIds: {
|
|
861
|
+
research: "10000000-0000-4000-8000-000000000020",
|
|
862
|
+
resolution: "10000000-0000-4000-8000-000000000021"
|
|
863
|
+
},
|
|
864
|
+
evaluationIds: {
|
|
865
|
+
baseline: "10000000-0000-4000-8000-000000000030",
|
|
866
|
+
candidate: "10000000-0000-4000-8000-000000000031",
|
|
867
|
+
latest: "10000000-0000-4000-8000-000000000003"
|
|
868
|
+
},
|
|
869
|
+
candidateEvalRunId: "10000000-0000-4000-8000-000000000032",
|
|
870
|
+
pendingApprovalId: "sample-pending-credit-review",
|
|
871
|
+
pendingChoiceId: "sample-pending-parcel-choice",
|
|
872
|
+
diagnosticIds: {
|
|
873
|
+
budgetLimit: "30000000-0000-4000-8000-e6dfcc9c117a"
|
|
874
|
+
},
|
|
875
|
+
interruptId: "sample-refund-approval",
|
|
876
|
+
promptId: "10000000-0000-4000-8000-000000000002",
|
|
877
|
+
evaluationId: "10000000-0000-4000-8000-000000000003",
|
|
878
|
+
evalRunId: "10000000-0000-4000-8000-000000000004",
|
|
879
|
+
baselineEvalRunId: "10000000-0000-4000-8000-000000000005",
|
|
880
|
+
caseId: "order-status",
|
|
881
|
+
gradingCaseId: "delivery-note",
|
|
882
|
+
targetId: "sample-support",
|
|
883
|
+
suiteId: "sample-support-quality",
|
|
884
|
+
anchors: {
|
|
885
|
+
selector: "sample-project-selector",
|
|
886
|
+
notice: "sample-project-notice",
|
|
887
|
+
visibility: "sample-project-visibility"
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
// src/tools.ts
|
|
892
|
+
var import_zod5 = require("zod");
|
|
893
|
+
var ToolOutcomeSchema = import_zod5.z.enum([
|
|
894
|
+
"success",
|
|
895
|
+
"denied",
|
|
896
|
+
"fault",
|
|
897
|
+
"cancelled"
|
|
990
898
|
]);
|
|
991
|
-
var
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}).
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
899
|
+
var ToolObservationSchema = import_zod5.z.object({
|
|
900
|
+
version: import_zod5.z.literal(1),
|
|
901
|
+
name: import_zod5.z.string().min(1).max(256),
|
|
902
|
+
toolCallId: import_zod5.z.string().min(1),
|
|
903
|
+
attemptId: import_zod5.z.string().min(1),
|
|
904
|
+
callingMode: import_zod5.z.enum(["direct", "model"]),
|
|
905
|
+
executed: import_zod5.z.boolean(),
|
|
906
|
+
outcome: ToolOutcomeSchema.optional(),
|
|
907
|
+
denialCode: import_zod5.z.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).optional(),
|
|
908
|
+
errorType: import_zod5.z.string().max(256).optional(),
|
|
909
|
+
errorMessage: import_zod5.z.string().max(8192).optional(),
|
|
910
|
+
diagnosticId: import_zod5.z.string().uuid().optional(),
|
|
911
|
+
durationMs: import_zod5.z.number().finite().nonnegative().optional(),
|
|
912
|
+
workflowId: import_zod5.z.string().optional(),
|
|
913
|
+
nodeId: import_zod5.z.string().optional(),
|
|
914
|
+
workflowRevisionId: import_zod5.z.string().optional(),
|
|
915
|
+
runId: import_zod5.z.string().optional(),
|
|
916
|
+
invocationId: import_zod5.z.string().optional(),
|
|
917
|
+
parentInvocationId: import_zod5.z.string().optional(),
|
|
918
|
+
branchId: import_zod5.z.string().optional(),
|
|
919
|
+
observationKind: import_zod5.z.enum(["reused", "waiting"]).optional(),
|
|
920
|
+
suspended: import_zod5.z.boolean().optional(),
|
|
921
|
+
source: import_zod5.z.object({
|
|
922
|
+
runId: import_zod5.z.string().optional(),
|
|
923
|
+
invocationId: import_zod5.z.string().optional(),
|
|
924
|
+
branchId: import_zod5.z.string().optional(),
|
|
925
|
+
toolCallId: import_zod5.z.string(),
|
|
926
|
+
attemptId: import_zod5.z.string()
|
|
927
|
+
}).strict().optional()
|
|
928
|
+
});
|
|
929
|
+
var WorkflowToolSchema = import_zod5.z.object({
|
|
930
|
+
name: import_zod5.z.string().min(1).max(256),
|
|
931
|
+
description: import_zod5.z.string().max(4096).optional(),
|
|
932
|
+
callingMode: import_zod5.z.enum(["direct", "model"]),
|
|
933
|
+
provenance: import_zod5.z.enum(["source", "observed"]),
|
|
934
|
+
inputFields: import_zod5.z.array(
|
|
935
|
+
import_zod5.z.object({ name: import_zod5.z.string(), type: import_zod5.z.string(), required: import_zod5.z.boolean() }).strict()
|
|
936
|
+
).optional()
|
|
1014
937
|
}).strict();
|
|
1015
|
-
var
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
938
|
+
var ToolDiscoverySchema = import_zod5.z.object({
|
|
939
|
+
status: import_zod5.z.enum(["complete", "unresolved"]),
|
|
940
|
+
publishedAt: import_zod5.z.string().datetime().optional(),
|
|
941
|
+
warnings: import_zod5.z.array(import_zod5.z.string()).optional()
|
|
942
|
+
}).strict();
|
|
943
|
+
var StudioToolSchema = WorkflowToolSchema.extend({
|
|
944
|
+
callingMode: import_zod5.z.enum(["direct", "model", "unknown"]),
|
|
945
|
+
calls: import_zod5.z.number().nonnegative(),
|
|
946
|
+
replays: import_zod5.z.number().nonnegative(),
|
|
947
|
+
successes: import_zod5.z.number().nonnegative(),
|
|
948
|
+
denials: import_zod5.z.number().nonnegative(),
|
|
949
|
+
faults: import_zod5.z.number().nonnegative(),
|
|
950
|
+
cancellations: import_zod5.z.number().nonnegative(),
|
|
951
|
+
p50DurationMs: import_zod5.z.number().nonnegative().nullable(),
|
|
952
|
+
p95DurationMs: import_zod5.z.number().nonnegative().nullable()
|
|
1021
953
|
}).strict();
|
|
1022
954
|
|
|
1023
|
-
// src/
|
|
1024
|
-
var
|
|
1025
|
-
var
|
|
1026
|
-
var
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
updatedAt: import_zod5.z.iso.datetime(),
|
|
1058
|
-
backup: import_zod5.z.string().nullable(),
|
|
1059
|
-
messages: import_zod5.z.array(import_zod5.z.string()).max(100)
|
|
1060
|
-
});
|
|
1061
|
-
var StudioUpdateStatusSchema = import_zod5.z.object({
|
|
1062
|
-
current: import_zod5.z.string().nullable(),
|
|
1063
|
-
available: StudioReleaseSchema.nullable(),
|
|
1064
|
-
checkedAt: import_zod5.z.iso.datetime().nullable(),
|
|
1065
|
-
checkError: import_zod5.z.string().nullable(),
|
|
1066
|
-
settings: StudioUpdateSettingsSchema,
|
|
1067
|
-
operation: StudioUpdateOperationSchema.nullable()
|
|
1068
|
-
});
|
|
1069
|
-
function newerStudioVersion(candidate, current) {
|
|
1070
|
-
const next = StudioReleaseVersionSchema.parse(candidate).split(".").map(BigInt);
|
|
1071
|
-
const previous = StudioReleaseVersionSchema.parse(current).split(".").map(BigInt);
|
|
1072
|
-
for (let i = 0; i < 3; i++) {
|
|
1073
|
-
if (next[i] !== previous[i]) return (next[i] ?? 0n) > (previous[i] ?? 0n);
|
|
955
|
+
// src/diagnostic-capture.ts
|
|
956
|
+
var import_errors = require("@kortyx/core/errors");
|
|
957
|
+
var encoder = new TextEncoder();
|
|
958
|
+
var nativeStackGetter = Object.getOwnPropertyDescriptor(
|
|
959
|
+
new Error(),
|
|
960
|
+
"stack"
|
|
961
|
+
)?.get;
|
|
962
|
+
function nativeStack(object, getter) {
|
|
963
|
+
if (!getter || getter !== nativeStackGetter)
|
|
964
|
+
throw new Error("Custom stack accessor");
|
|
965
|
+
for (const key2 of ["name", "message"]) {
|
|
966
|
+
let cursor = object;
|
|
967
|
+
while (cursor) {
|
|
968
|
+
const descriptor = Object.getOwnPropertyDescriptor(cursor, key2);
|
|
969
|
+
if (descriptor) {
|
|
970
|
+
if (!("value" in descriptor) || typeof descriptor.value !== "string")
|
|
971
|
+
throw new Error("Custom error formatting");
|
|
972
|
+
break;
|
|
973
|
+
}
|
|
974
|
+
cursor = Object.getPrototypeOf(cursor);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
const formatter = Object.getOwnPropertyDescriptor(Error, "prepareStackTrace");
|
|
978
|
+
if (formatter && (!("value" in formatter) || !formatter.writable))
|
|
979
|
+
throw new Error("Custom stack formatter");
|
|
980
|
+
Object.defineProperty(Error, "prepareStackTrace", {
|
|
981
|
+
...formatter ?? { configurable: true, writable: true },
|
|
982
|
+
value: void 0
|
|
983
|
+
});
|
|
984
|
+
try {
|
|
985
|
+
return getter.call(object);
|
|
986
|
+
} finally {
|
|
987
|
+
if (formatter) Object.defineProperty(Error, "prepareStackTrace", formatter);
|
|
988
|
+
else Reflect.deleteProperty(Error, "prepareStackTrace");
|
|
1074
989
|
}
|
|
1075
|
-
return false;
|
|
1076
|
-
}
|
|
1077
|
-
function studioUpdateRunning(operation) {
|
|
1078
|
-
return !!operation && operation.phase !== "succeeded" && operation.phase !== "failed";
|
|
1079
990
|
}
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
"
|
|
1094
|
-
"
|
|
1095
|
-
"
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
})
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
if (
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
991
|
+
var pointer = (key2) => key2.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
992
|
+
function captureDiagnosticContent(error, project) {
|
|
993
|
+
const omissions = [];
|
|
994
|
+
const redactions = [];
|
|
995
|
+
const seen = /* @__PURE__ */ new WeakMap();
|
|
996
|
+
let nodes = 0;
|
|
997
|
+
let remaining = DIAGNOSTIC_LIMITS.bytes - 64 * 1024;
|
|
998
|
+
const omit = (path, reason, extra = {}) => {
|
|
999
|
+
if (omissions.length < 1e3)
|
|
1000
|
+
omissions.push({ path: path.slice(0, 4096), reason, ...extra });
|
|
1001
|
+
return { $omitted: reason };
|
|
1002
|
+
};
|
|
1003
|
+
const visit = (value, path, depth) => {
|
|
1004
|
+
if (++nodes > DIAGNOSTIC_LIMITS.nodes) return omit(path, "node_limit");
|
|
1005
|
+
if (depth > DIAGNOSTIC_LIMITS.depth) return omit(path, "depth_limit");
|
|
1006
|
+
if (typeof value === "string") {
|
|
1007
|
+
const clean = redactDiagnosticText(value);
|
|
1008
|
+
if (clean !== value && redactions.length < 1e3)
|
|
1009
|
+
redactions.push({
|
|
1010
|
+
path: path.slice(0, 4096),
|
|
1011
|
+
reason: "credential_text"
|
|
1012
|
+
});
|
|
1013
|
+
const bytes = encoder.encode(JSON.stringify(clean)).length;
|
|
1014
|
+
if (bytes > remaining)
|
|
1015
|
+
return omit(path, "byte_limit", {
|
|
1016
|
+
originalBytes: encoder.encode(value).length
|
|
1017
|
+
});
|
|
1018
|
+
remaining -= bytes;
|
|
1019
|
+
return clean;
|
|
1020
|
+
}
|
|
1021
|
+
if (value === null || typeof value === "boolean") return value;
|
|
1022
|
+
if (typeof value === "number")
|
|
1023
|
+
return Number.isFinite(value) ? value : { $type: "number", value: String(value) };
|
|
1024
|
+
if (typeof value === "bigint")
|
|
1025
|
+
return { $type: "bigint", value: value.toString() };
|
|
1026
|
+
if (typeof value === "undefined") return { $type: "undefined" };
|
|
1027
|
+
if (typeof value === "function" || typeof value === "symbol")
|
|
1028
|
+
return omit(path, `unsupported_${typeof value}`);
|
|
1029
|
+
const object = value;
|
|
1030
|
+
const reference = seen.get(object);
|
|
1031
|
+
if (reference) return { $ref: reference };
|
|
1032
|
+
seen.set(object, path);
|
|
1033
|
+
remaining -= 32;
|
|
1034
|
+
if (remaining < 0) return omit(path, "byte_limit");
|
|
1035
|
+
try {
|
|
1036
|
+
if (value instanceof Date)
|
|
1037
|
+
return { $type: "Date", value: Date.prototype.toISOString.call(value) };
|
|
1038
|
+
if (value instanceof Map || value instanceof Set) {
|
|
1039
|
+
const isMap = value instanceof Map;
|
|
1040
|
+
const iterator = isMap ? Map.prototype.entries.call(value) : Set.prototype.values.call(value);
|
|
1041
|
+
const count = Object.getOwnPropertyDescriptor(
|
|
1042
|
+
isMap ? Map.prototype : Set.prototype,
|
|
1043
|
+
"size"
|
|
1044
|
+
)?.get?.call(value);
|
|
1045
|
+
const entries = [];
|
|
1046
|
+
for (let index = 0; index < Math.min(count, DIAGNOSTIC_LIMITS.properties); index++)
|
|
1047
|
+
entries.push(iterator.next().value);
|
|
1048
|
+
if (count > entries.length)
|
|
1049
|
+
omissions.push({
|
|
1050
|
+
path,
|
|
1051
|
+
reason: "collection_limit",
|
|
1052
|
+
originalCount: count
|
|
1053
|
+
});
|
|
1054
|
+
return isMap ? {
|
|
1055
|
+
$type: "Map",
|
|
1056
|
+
entries: visit(entries, `${path}/entries`, depth + 1)
|
|
1057
|
+
} : {
|
|
1058
|
+
$type: "Set",
|
|
1059
|
+
values: visit(entries, `${path}/values`, depth + 1)
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
if (Array.isArray(value)) {
|
|
1063
|
+
const count = Math.min(value.length, DIAGNOSTIC_LIMITS.properties);
|
|
1064
|
+
const items = Array.from(
|
|
1065
|
+
{ length: count },
|
|
1066
|
+
(_, index) => read(value, String(index), `${path}/${index}`, depth)
|
|
1067
|
+
);
|
|
1068
|
+
if (count < value.length)
|
|
1069
|
+
items.push(
|
|
1070
|
+
omit(path, "collection_limit", { originalCount: value.length })
|
|
1071
|
+
);
|
|
1072
|
+
return items;
|
|
1073
|
+
}
|
|
1074
|
+
const keys = Object.getOwnPropertyNames(object);
|
|
1075
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
1076
|
+
if (value instanceof Error) {
|
|
1077
|
+
const ownName = Object.getOwnPropertyDescriptor(object, "name");
|
|
1078
|
+
let type = ownName && "value" in ownName ? ownName.value : void 0;
|
|
1079
|
+
if (typeof type !== "string") {
|
|
1080
|
+
const name2 = Object.getOwnPropertyDescriptor(
|
|
1081
|
+
Object.getPrototypeOf(value),
|
|
1082
|
+
"name"
|
|
1083
|
+
);
|
|
1084
|
+
type = name2 && "value" in name2 ? name2.value : "Error";
|
|
1085
|
+
}
|
|
1086
|
+
result.type = visit(
|
|
1087
|
+
typeof type === "string" ? type : "Error",
|
|
1088
|
+
`${path}/type`,
|
|
1089
|
+
depth + 1
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
for (const key2 of keys.slice(0, DIAGNOSTIC_LIMITS.properties)) {
|
|
1093
|
+
if (["__proto__", "constructor", "prototype"].includes(key2)) {
|
|
1094
|
+
result[key2] = omit(`${path}/${pointer(key2)}`, "unsafe_key");
|
|
1095
|
+
continue;
|
|
1096
|
+
}
|
|
1097
|
+
remaining -= encoder.encode(key2).length + 4;
|
|
1098
|
+
result[key2] = read(object, key2, `${path}/${pointer(key2)}`, depth);
|
|
1099
|
+
}
|
|
1100
|
+
if (keys.length > DIAGNOSTIC_LIMITS.properties)
|
|
1101
|
+
result.$omittedProperties = omit(path, "property_limit", {
|
|
1102
|
+
originalCount: keys.length
|
|
1103
|
+
});
|
|
1104
|
+
return result;
|
|
1105
|
+
} catch {
|
|
1106
|
+
return omit(path, "unreadable_object");
|
|
1137
1107
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
if (rule.operator === "present") return values.length > 0;
|
|
1148
|
-
if (rule.operator === "missing") return values.length === 0;
|
|
1149
|
-
if (!values.length) return false;
|
|
1150
|
-
const equal = (a, b) => typeof a === "string" && typeof b === "string" ? kind === "date" ? Date.parse(a) === Date.parse(b) : a.toLowerCase() === b.toLowerCase() : a === b;
|
|
1151
|
-
const contains = () => values.some(
|
|
1152
|
-
(a) => rule.values.some(
|
|
1153
|
-
(b) => String(a).toLowerCase().includes(String(b).toLowerCase())
|
|
1154
|
-
)
|
|
1155
|
-
);
|
|
1156
|
-
if (rule.operator === "contains") return contains();
|
|
1157
|
-
if (rule.operator === "notContains") return !contains();
|
|
1158
|
-
if (rule.operator === "is")
|
|
1159
|
-
return values.some((a) => rule.values.some((b) => equal(a, b)));
|
|
1160
|
-
if (rule.operator === "isNot")
|
|
1161
|
-
return !values.some((a) => rule.values.some((b) => equal(a, b)));
|
|
1162
|
-
return values.some((a) => {
|
|
1163
|
-
const comparable = typeof a === "string" && a.includes("T") && (a.endsWith("Z") || /[+-]\d{2}:\d{2}$/.test(a)) ? Date.parse(a) : Number(a);
|
|
1164
|
-
const bounds = rule.values.map(
|
|
1165
|
-
(b) => typeof b === "string" ? Date.parse(b) : Number(b)
|
|
1166
|
-
);
|
|
1167
|
-
switch (rule.operator) {
|
|
1168
|
-
case "gt":
|
|
1169
|
-
return comparable > bounds[0];
|
|
1170
|
-
case "gte":
|
|
1171
|
-
return comparable >= bounds[0];
|
|
1172
|
-
case "lt":
|
|
1173
|
-
return comparable < bounds[0];
|
|
1174
|
-
case "lte":
|
|
1175
|
-
return comparable <= bounds[0];
|
|
1176
|
-
case "between":
|
|
1177
|
-
return comparable >= bounds[0] && comparable <= bounds[1];
|
|
1178
|
-
default:
|
|
1179
|
-
return false;
|
|
1108
|
+
};
|
|
1109
|
+
const read = (object, key2, path, depth) => {
|
|
1110
|
+
if (isPrivateDiagnosticField(key2)) {
|
|
1111
|
+
if (redactions.length < 1e3)
|
|
1112
|
+
redactions.push({
|
|
1113
|
+
path: path.slice(0, 4096),
|
|
1114
|
+
reason: "credential_field"
|
|
1115
|
+
});
|
|
1116
|
+
return "[REDACTED]";
|
|
1180
1117
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
var identity = [field("userId", "User ID"), field("tenantId", "Tenant ID")];
|
|
1194
|
-
var metrics = [
|
|
1195
|
-
field("durationMs", "Duration", "number", "ms"),
|
|
1196
|
-
field("tokens", "Tokens", "number"),
|
|
1197
|
-
field("cost", "Cost", "number", "currency units"),
|
|
1198
|
-
field("currency", "Currency", "enum")
|
|
1199
|
-
];
|
|
1200
|
-
var STUDIO_TABLE_FIELDS = {
|
|
1201
|
-
runs: [
|
|
1202
|
-
field("id", "Run ID"),
|
|
1203
|
-
field("execution", "Execution", "enum"),
|
|
1204
|
-
field("parentRunId", "Parent run ID"),
|
|
1205
|
-
field("callId", "Call ID"),
|
|
1206
|
-
field("status", "Status", "enum"),
|
|
1207
|
-
field("startedAt", "Started", "date"),
|
|
1208
|
-
field("endedAt", "Ended", "date"),
|
|
1209
|
-
...identity,
|
|
1210
|
-
field("environment", "Environment", "enum"),
|
|
1211
|
-
field("pricingStatus", "Pricing status", "enum"),
|
|
1212
|
-
field("feedback", "Feedback", "enum"),
|
|
1213
|
-
field("workflowIds", "Workflow"),
|
|
1214
|
-
field("versions", "Version"),
|
|
1215
|
-
field("path", "Path"),
|
|
1216
|
-
field("sessionId", "Session ID"),
|
|
1217
|
-
field("provider", "Provider", "enum"),
|
|
1218
|
-
field("models", "Model"),
|
|
1219
|
-
...metrics,
|
|
1220
|
-
field("result", "Result"),
|
|
1221
|
-
field("hasTool", "Has tool call", "boolean"),
|
|
1222
|
-
field("toolName", "Tool name"),
|
|
1223
|
-
field("toolOutcome", "Tool outcome", "enum"),
|
|
1224
|
-
field("toolMode", "Called by", "enum"),
|
|
1225
|
-
field("transitionIds", "Workflow transition")
|
|
1226
|
-
],
|
|
1227
|
-
sessions: [
|
|
1228
|
-
field("id", "Session ID"),
|
|
1229
|
-
field("status", "Status", "enum"),
|
|
1230
|
-
field("lastActivityAt", "Last activity", "date"),
|
|
1231
|
-
field("environment", "Environment", "enum"),
|
|
1232
|
-
...identity,
|
|
1233
|
-
field("workflowIds", "Workflow"),
|
|
1234
|
-
field("activeVersion", "Version"),
|
|
1235
|
-
field("runs", "Runs", "number"),
|
|
1236
|
-
field("succeeded", "Successful runs", "number"),
|
|
1237
|
-
field("failed", "Failed runs", "number"),
|
|
1238
|
-
field("interrupted", "Interrupted runs", "number"),
|
|
1239
|
-
field("checkpoints", "Checkpoints", "number"),
|
|
1240
|
-
field("hasFork", "Has branch", "boolean"),
|
|
1241
|
-
...metrics,
|
|
1242
|
-
field("latestResult", "Latest result"),
|
|
1243
|
-
field("latestError", "Latest error"),
|
|
1244
|
-
field("pendingInterruptId", "Pending interrupt"),
|
|
1245
|
-
field("hasError", "Has error", "boolean"),
|
|
1246
|
-
field("hasInterrupt", "Has interrupt", "boolean"),
|
|
1247
|
-
field("hasCheckpoint", "Has checkpoint", "boolean"),
|
|
1248
|
-
field("providers", "Provider", "enum"),
|
|
1249
|
-
field("models", "Model"),
|
|
1250
|
-
field("tags", "Tags")
|
|
1251
|
-
],
|
|
1252
|
-
interrupts: [
|
|
1253
|
-
field("id", "Interrupt ID"),
|
|
1254
|
-
field("status", "Status", "enum"),
|
|
1255
|
-
field("createdAt", "Created", "date"),
|
|
1256
|
-
field("expiresAt", "Expires", "date"),
|
|
1257
|
-
field("resolvedAt", "Resolved", "date"),
|
|
1258
|
-
field("environment", "Environment", "enum"),
|
|
1259
|
-
field("age", "Age", "number", "minutes"),
|
|
1260
|
-
field("resolutionMs", "Resolution time", "number", "ms"),
|
|
1261
|
-
field("type", "Type", "enum"),
|
|
1262
|
-
field("question", "Request"),
|
|
1263
|
-
field("contract", "Contract"),
|
|
1264
|
-
field("schemaId", "Schema ID"),
|
|
1265
|
-
field("workflowId", "Workflow"),
|
|
1266
|
-
field("nodeId", "Node"),
|
|
1267
|
-
field("sessionId", "Session ID"),
|
|
1268
|
-
...identity,
|
|
1269
|
-
field("response", "Response"),
|
|
1270
|
-
field("resolvedBy", "Resolved by"),
|
|
1271
|
-
field("resumeOutcome", "Resume outcome", "enum"),
|
|
1272
|
-
field("resumeError", "Resume error"),
|
|
1273
|
-
field("runId", "Run ID")
|
|
1274
|
-
]
|
|
1275
|
-
};
|
|
1276
|
-
var LEGACY_TABLE_FILTERS = {
|
|
1277
|
-
toolName: ["toolName", "contains"],
|
|
1278
|
-
toolOutcome: ["toolOutcome", "is"],
|
|
1279
|
-
toolMode: ["toolMode", "is"],
|
|
1280
|
-
error: ["hasError", "is"],
|
|
1281
|
-
interrupt: ["hasInterrupt", "is"],
|
|
1282
|
-
checkpoint: ["hasCheckpoint", "is"],
|
|
1283
|
-
fork: ["hasFork", "is"],
|
|
1284
|
-
transition: ["transitionIds", "is"],
|
|
1285
|
-
status: ["status", "is"],
|
|
1286
|
-
provider: ["provider", "is"],
|
|
1287
|
-
workflow: ["workflowIds", "is"],
|
|
1288
|
-
version: ["versions", "is"],
|
|
1289
|
-
path: ["path", "is"],
|
|
1290
|
-
session: ["sessionId", "contains"],
|
|
1291
|
-
model: ["models", "contains"],
|
|
1292
|
-
result: ["result", "contains"],
|
|
1293
|
-
feedback: ["feedback", "is"],
|
|
1294
|
-
tool: ["hasTool", "is"],
|
|
1295
|
-
user: ["userId", "contains"],
|
|
1296
|
-
tenant: ["tenantId", "contains"],
|
|
1297
|
-
tags: ["tags", "contains"],
|
|
1298
|
-
node: ["nodeId", "contains"],
|
|
1299
|
-
resolver: ["resolvedBy", "contains"],
|
|
1300
|
-
outcome: ["resumeOutcome", "is"],
|
|
1301
|
-
type: ["type", "is"],
|
|
1302
|
-
minCost: ["cost", "gte"],
|
|
1303
|
-
maxCost: ["cost", "lte"],
|
|
1304
|
-
minTokens: ["tokens", "gte"],
|
|
1305
|
-
maxTokens: ["tokens", "lte"],
|
|
1306
|
-
minDuration: ["durationMs", "gte"],
|
|
1307
|
-
maxDuration: ["durationMs", "lte"],
|
|
1308
|
-
minAge: ["age", "gte"],
|
|
1309
|
-
maxAge: ["age", "lte"]
|
|
1310
|
-
};
|
|
1311
|
-
function readStudioTableFilters(query, resource) {
|
|
1312
|
-
const fields = STUDIO_TABLE_FIELDS[resource];
|
|
1313
|
-
const filters = query.tableFilters ? TableFiltersSchema.parse(JSON.parse(query.tableFilters)) : { match: "all", rules: [] };
|
|
1314
|
-
const rules = [...filters.rules];
|
|
1315
|
-
for (const [alias, [original, operator]] of Object.entries(
|
|
1316
|
-
LEGACY_TABLE_FILTERS
|
|
1317
|
-
)) {
|
|
1318
|
-
const raw = query[alias];
|
|
1319
|
-
if (!raw) continue;
|
|
1320
|
-
if (resource === "interrupts" && alias === "error") {
|
|
1321
|
-
if (raw === "true" || raw === "1")
|
|
1322
|
-
rules.push({ field: "resumeError", operator: "present", values: [] });
|
|
1323
|
-
continue;
|
|
1118
|
+
try {
|
|
1119
|
+
const property = Object.getOwnPropertyDescriptor(object, key2);
|
|
1120
|
+
if (property && "value" in property)
|
|
1121
|
+
return visit(property.value, path, depth + 1);
|
|
1122
|
+
if (key2 === "stack" && object instanceof Error && property?.get && property.get === nativeStackGetter)
|
|
1123
|
+
return visit(nativeStack(object, property.get), path, depth + 1);
|
|
1124
|
+
return omit(
|
|
1125
|
+
path,
|
|
1126
|
+
property ? "accessor_not_evaluated" : "unavailable_property"
|
|
1127
|
+
);
|
|
1128
|
+
} catch {
|
|
1129
|
+
return omit(path, "unreadable_property");
|
|
1324
1130
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1131
|
+
};
|
|
1132
|
+
try {
|
|
1133
|
+
const original = project ? project(error) : error;
|
|
1134
|
+
if (project && original === null) return null;
|
|
1135
|
+
const captured = visit(original, "#/data", 0);
|
|
1136
|
+
const upstreamOmissions = (0, import_errors.errorProperty)(original, "diagnosticOmissions");
|
|
1137
|
+
if (Array.isArray(upstreamOmissions))
|
|
1138
|
+
for (const note of upstreamOmissions.slice(0, 1e3)) {
|
|
1139
|
+
const path = (0, import_errors.errorProperty)(note, "path");
|
|
1140
|
+
const reason = (0, import_errors.errorProperty)(note, "reason");
|
|
1141
|
+
if (typeof path === "string" && typeof reason === "string")
|
|
1142
|
+
omissions.push({
|
|
1143
|
+
path: redactDiagnosticText(path).slice(0, 4096),
|
|
1144
|
+
reason: redactDiagnosticText(reason).slice(0, 128)
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
const data = captured && typeof captured === "object" && !Array.isArray(captured) ? captured : {
|
|
1148
|
+
type: "Error",
|
|
1149
|
+
message: typeof captured === "string" ? captured : "Execution reported a fault.",
|
|
1150
|
+
value: captured
|
|
1151
|
+
};
|
|
1152
|
+
if (typeof data.message !== "string" && !("message" in data))
|
|
1153
|
+
data.message = "Execution reported a fault.";
|
|
1154
|
+
if (!("type" in data))
|
|
1155
|
+
data.type = typeof data.name === "string" ? data.name : "Error";
|
|
1156
|
+
const content = {
|
|
1157
|
+
schemaVersion: 1,
|
|
1158
|
+
data,
|
|
1159
|
+
capture: {
|
|
1160
|
+
status: omissions.length ? "partial" : "complete",
|
|
1161
|
+
omissions,
|
|
1162
|
+
redactions
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
if (encoder.encode(JSON.stringify(content)).length > DIAGNOSTIC_LIMITS.bytes)
|
|
1166
|
+
return {
|
|
1167
|
+
schemaVersion: 1,
|
|
1168
|
+
data: {
|
|
1169
|
+
type: "Error",
|
|
1170
|
+
message: "Diagnostic exceeded the capture budget."
|
|
1171
|
+
},
|
|
1172
|
+
capture: {
|
|
1173
|
+
status: "partial",
|
|
1174
|
+
redactions: [],
|
|
1175
|
+
omissions: [{ path: "#/data", reason: "serialized_byte_limit" }]
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
return content;
|
|
1179
|
+
} catch {
|
|
1180
|
+
return {
|
|
1181
|
+
schemaVersion: 1,
|
|
1182
|
+
data: { type: "Error", message: "Diagnostic capture failed." },
|
|
1183
|
+
capture: {
|
|
1184
|
+
status: "failed",
|
|
1185
|
+
redactions: [],
|
|
1186
|
+
omissions: [{ path: "#/data", reason: "projection_or_capture_failed" }]
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1334
1189
|
}
|
|
1335
|
-
return validateTableFilters(
|
|
1336
|
-
TableFiltersSchema.parse({ ...filters, rules }),
|
|
1337
|
-
fields
|
|
1338
|
-
);
|
|
1339
1190
|
}
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
var
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1191
|
+
|
|
1192
|
+
// src/prompts.ts
|
|
1193
|
+
var import_browser = require("@kortyx/prompts/browser");
|
|
1194
|
+
var import_zod6 = require("zod");
|
|
1195
|
+
var name = import_zod6.z.string().trim().min(1).max(200);
|
|
1196
|
+
var version = import_zod6.z.number().int().positive();
|
|
1197
|
+
var revision = import_zod6.z.number().int().nonnegative();
|
|
1198
|
+
var PromptCategorySchema = import_zod6.z.object({
|
|
1199
|
+
id: import_zod6.z.uuid(),
|
|
1200
|
+
name,
|
|
1201
|
+
parentId: import_zod6.z.uuid().nullable(),
|
|
1202
|
+
revision
|
|
1203
|
+
});
|
|
1204
|
+
var PromptGroupSchema = import_zod6.z.object({
|
|
1205
|
+
id: import_zod6.z.uuid(),
|
|
1206
|
+
name,
|
|
1207
|
+
revision,
|
|
1208
|
+
members: import_zod6.z.array(
|
|
1209
|
+
import_zod6.z.object({
|
|
1210
|
+
promptId: import_zod6.z.uuid(),
|
|
1211
|
+
version,
|
|
1212
|
+
key: import_browser.PromptKeySchema.optional(),
|
|
1213
|
+
name: name.optional(),
|
|
1214
|
+
archived: import_zod6.z.boolean().optional()
|
|
1215
|
+
})
|
|
1216
|
+
).max(100),
|
|
1217
|
+
updatedAt: import_zod6.z.string()
|
|
1218
|
+
});
|
|
1219
|
+
var PromptAssignmentSchema = import_zod6.z.object({
|
|
1220
|
+
tag: import_browser.PromptTagSchema,
|
|
1221
|
+
version,
|
|
1222
|
+
revision,
|
|
1223
|
+
updatedAt: import_zod6.z.string()
|
|
1224
|
+
});
|
|
1225
|
+
var PromptAssetSchema = import_zod6.z.object({
|
|
1226
|
+
id: import_zod6.z.uuid(),
|
|
1227
|
+
key: import_browser.PromptKeySchema,
|
|
1228
|
+
name,
|
|
1229
|
+
categoryId: import_zod6.z.uuid().nullable(),
|
|
1230
|
+
latestVersion: version,
|
|
1231
|
+
revision,
|
|
1232
|
+
archived: import_zod6.z.boolean(),
|
|
1233
|
+
updatedAt: import_zod6.z.string(),
|
|
1234
|
+
assignments: import_zod6.z.array(PromptAssignmentSchema)
|
|
1235
|
+
});
|
|
1236
|
+
var PromptLibrarySchema = import_zod6.z.object({
|
|
1237
|
+
schemaVersion: import_zod6.z.literal(1),
|
|
1238
|
+
assets: import_zod6.z.array(PromptAssetSchema),
|
|
1239
|
+
categories: import_zod6.z.array(PromptCategorySchema),
|
|
1240
|
+
groups: import_zod6.z.array(PromptGroupSchema),
|
|
1241
|
+
totalCount: import_zod6.z.number().int().nonnegative(),
|
|
1242
|
+
nextCursor: import_zod6.z.string().nullable(),
|
|
1243
|
+
permissions: import_zod6.z.object({
|
|
1244
|
+
edit: import_zod6.z.boolean(),
|
|
1245
|
+
promote: import_zod6.z.boolean(),
|
|
1246
|
+
review: import_zod6.z.boolean(),
|
|
1247
|
+
settings: import_zod6.z.boolean()
|
|
1248
|
+
})
|
|
1249
|
+
});
|
|
1250
|
+
var PromptStoredVersionSchema = import_browser.PromptVersionSchema.extend({
|
|
1251
|
+
promptId: import_zod6.z.uuid(),
|
|
1252
|
+
note: import_zod6.z.string(),
|
|
1253
|
+
author: import_zod6.z.string(),
|
|
1254
|
+
createdAt: import_zod6.z.string(),
|
|
1255
|
+
origin: import_zod6.z.object({
|
|
1256
|
+
apiUrl: import_zod6.z.string(),
|
|
1257
|
+
projectId: import_zod6.z.string(),
|
|
1258
|
+
key: import_zod6.z.string(),
|
|
1259
|
+
version,
|
|
1260
|
+
hash: import_zod6.z.string()
|
|
1261
|
+
}).nullable()
|
|
1262
|
+
});
|
|
1263
|
+
var PromptPolicySchema = import_zod6.z.object({
|
|
1264
|
+
revision,
|
|
1265
|
+
requireTest: import_zod6.z.boolean(),
|
|
1266
|
+
requireChangeNote: import_zod6.z.boolean().default(false),
|
|
1267
|
+
requiredSuites: import_zod6.z.array(import_zod6.z.object({ targetId: name, suiteId: name })).max(100),
|
|
1268
|
+
requiredReviews: import_zod6.z.number().int().min(0).max(10),
|
|
1269
|
+
allowException: import_zod6.z.boolean()
|
|
1270
|
+
});
|
|
1271
|
+
var PromptEvidenceSchema = import_zod6.z.object({
|
|
1272
|
+
environment: import_zod6.z.string(),
|
|
1273
|
+
runId: import_zod6.z.string(),
|
|
1274
|
+
evaluationId: import_zod6.z.string().nullable().optional(),
|
|
1275
|
+
targetId: import_zod6.z.string(),
|
|
1276
|
+
suiteId: import_zod6.z.string(),
|
|
1277
|
+
suiteRevision: import_zod6.z.string().optional(),
|
|
1278
|
+
status: import_zod6.z.string(),
|
|
1279
|
+
version,
|
|
1280
|
+
fullSuite: import_zod6.z.boolean(),
|
|
1281
|
+
usage: import_zod6.z.enum([
|
|
1282
|
+
"verified",
|
|
1283
|
+
"pending",
|
|
1284
|
+
"not-used",
|
|
1285
|
+
"mismatch",
|
|
1286
|
+
"context-differs"
|
|
1287
|
+
]),
|
|
1288
|
+
groupName: import_zod6.z.string().nullable(),
|
|
1289
|
+
createdAt: import_zod6.z.string(),
|
|
1290
|
+
companions: import_zod6.z.array(import_zod6.z.object({ key: import_browser.PromptKeySchema, version }))
|
|
1291
|
+
});
|
|
1292
|
+
var PromptUsageSchema = import_zod6.z.object({
|
|
1293
|
+
eventId: import_zod6.z.string(),
|
|
1294
|
+
runId: import_zod6.z.string(),
|
|
1295
|
+
sessionId: import_zod6.z.string().nullable(),
|
|
1296
|
+
nodeId: import_zod6.z.string().nullable(),
|
|
1297
|
+
version: import_zod6.z.number().int(),
|
|
1298
|
+
hash: import_zod6.z.string().nullable(),
|
|
1299
|
+
source: import_zod6.z.string().nullable(),
|
|
1300
|
+
model: import_zod6.z.string().nullable(),
|
|
1301
|
+
environment: import_zod6.z.string(),
|
|
1302
|
+
occurredAt: import_zod6.z.string(),
|
|
1303
|
+
captured: import_zod6.z.boolean()
|
|
1304
|
+
});
|
|
1305
|
+
var PromptDetailSchema = import_zod6.z.object({
|
|
1306
|
+
asset: PromptAssetSchema,
|
|
1307
|
+
versions: import_zod6.z.array(PromptStoredVersionSchema),
|
|
1308
|
+
versionsNextCursor: import_zod6.z.string().nullable().optional(),
|
|
1309
|
+
draft: import_browser.PromptContentSchema.nullable(),
|
|
1310
|
+
draftBase: import_zod6.z.number().int().nullable(),
|
|
1311
|
+
draftRevision: revision,
|
|
1312
|
+
evidence: import_zod6.z.array(PromptEvidenceSchema),
|
|
1313
|
+
usage: import_zod6.z.array(PromptUsageSchema),
|
|
1314
|
+
activity: import_zod6.z.array(
|
|
1315
|
+
import_zod6.z.object({
|
|
1316
|
+
id: import_zod6.z.string(),
|
|
1317
|
+
action: import_zod6.z.string(),
|
|
1318
|
+
actor: import_zod6.z.string(),
|
|
1319
|
+
details: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()),
|
|
1320
|
+
createdAt: import_zod6.z.string()
|
|
1321
|
+
})
|
|
1322
|
+
),
|
|
1323
|
+
policies: import_zod6.z.array(PromptPolicySchema),
|
|
1324
|
+
reviews: import_zod6.z.array(
|
|
1325
|
+
import_zod6.z.object({
|
|
1326
|
+
version,
|
|
1327
|
+
hash: import_zod6.z.string(),
|
|
1328
|
+
independent: import_zod6.z.boolean(),
|
|
1329
|
+
reviewer: import_zod6.z.string(),
|
|
1330
|
+
note: import_zod6.z.string(),
|
|
1331
|
+
createdAt: import_zod6.z.string()
|
|
1332
|
+
})
|
|
1333
|
+
).optional()
|
|
1334
|
+
});
|
|
1335
|
+
var PromptMutationSchema = import_zod6.z.discriminatedUnion("action", [
|
|
1336
|
+
import_zod6.z.object({
|
|
1337
|
+
action: import_zod6.z.literal("tag-set"),
|
|
1338
|
+
id: import_zod6.z.uuid(),
|
|
1339
|
+
tag: import_browser.PromptTagSchema.refine(
|
|
1340
|
+
(tag) => tag !== "live",
|
|
1341
|
+
"Use promotion to update live."
|
|
1342
|
+
),
|
|
1343
|
+
version,
|
|
1344
|
+
expectedRevision: revision
|
|
1345
|
+
}).strict(),
|
|
1346
|
+
import_zod6.z.object({
|
|
1347
|
+
action: import_zod6.z.literal("tag-remove"),
|
|
1348
|
+
id: import_zod6.z.uuid(),
|
|
1349
|
+
tag: import_browser.PromptTagSchema.refine(
|
|
1350
|
+
(tag) => tag !== "live",
|
|
1351
|
+
"The live tag cannot be removed manually."
|
|
1352
|
+
),
|
|
1353
|
+
expectedRevision: revision
|
|
1354
|
+
}).strict(),
|
|
1355
|
+
import_zod6.z.object({
|
|
1356
|
+
action: import_zod6.z.literal("bulk-update"),
|
|
1357
|
+
assets: import_zod6.z.array(import_zod6.z.object({ id: import_zod6.z.uuid(), expectedRevision: revision })).min(1).max(100),
|
|
1358
|
+
categoryId: import_zod6.z.uuid().nullable().optional(),
|
|
1359
|
+
archived: import_zod6.z.boolean().optional()
|
|
1360
|
+
}).strict().refine(
|
|
1361
|
+
(value) => value.categoryId !== void 0 || value.archived !== void 0,
|
|
1362
|
+
"Choose a category or archive state."
|
|
1363
|
+
),
|
|
1364
|
+
import_zod6.z.object({
|
|
1365
|
+
action: import_zod6.z.literal("create"),
|
|
1366
|
+
key: import_browser.PromptKeySchema,
|
|
1367
|
+
name,
|
|
1368
|
+
categoryId: import_zod6.z.uuid().nullable().default(null),
|
|
1369
|
+
content: import_browser.PromptContentSchema,
|
|
1370
|
+
note: import_zod6.z.string().trim().max(2e3).default(""),
|
|
1371
|
+
idempotencyKey: import_zod6.z.uuid().optional()
|
|
1372
|
+
}).strict(),
|
|
1373
|
+
import_zod6.z.object({
|
|
1374
|
+
action: import_zod6.z.literal("draft"),
|
|
1375
|
+
id: import_zod6.z.uuid(),
|
|
1376
|
+
content: import_browser.PromptContentSchema,
|
|
1377
|
+
baseVersion: version,
|
|
1378
|
+
expectedRevision: revision
|
|
1379
|
+
}).strict(),
|
|
1380
|
+
import_zod6.z.object({
|
|
1381
|
+
action: import_zod6.z.literal("discard-draft"),
|
|
1382
|
+
id: import_zod6.z.uuid(),
|
|
1383
|
+
expectedRevision: revision
|
|
1384
|
+
}).strict(),
|
|
1385
|
+
import_zod6.z.object({
|
|
1386
|
+
action: import_zod6.z.literal("save"),
|
|
1387
|
+
id: import_zod6.z.uuid(),
|
|
1388
|
+
content: import_browser.PromptContentSchema,
|
|
1389
|
+
baseVersion: version,
|
|
1390
|
+
expectedHash: import_zod6.z.string().regex(/^[a-f0-9]{64}$/),
|
|
1391
|
+
expectedDraftRevision: revision.optional(),
|
|
1392
|
+
note: import_zod6.z.string().trim().max(2e3).default(""),
|
|
1393
|
+
idempotencyKey: import_zod6.z.uuid()
|
|
1394
|
+
}).strict(),
|
|
1395
|
+
import_zod6.z.object({
|
|
1396
|
+
action: import_zod6.z.literal("update"),
|
|
1397
|
+
id: import_zod6.z.uuid(),
|
|
1398
|
+
expectedRevision: revision,
|
|
1399
|
+
name: name.optional(),
|
|
1400
|
+
categoryId: import_zod6.z.uuid().nullable().optional(),
|
|
1401
|
+
archived: import_zod6.z.boolean().optional()
|
|
1402
|
+
}).strict(),
|
|
1403
|
+
import_zod6.z.object({
|
|
1404
|
+
action: import_zod6.z.literal("category-create"),
|
|
1405
|
+
path: import_zod6.z.string().trim().min(1).max(1e3)
|
|
1406
|
+
}).strict(),
|
|
1407
|
+
import_zod6.z.object({
|
|
1408
|
+
action: import_zod6.z.literal("category-update"),
|
|
1409
|
+
id: import_zod6.z.uuid(),
|
|
1410
|
+
expectedRevision: revision,
|
|
1411
|
+
name: name.optional(),
|
|
1412
|
+
parentId: import_zod6.z.uuid().nullable().optional()
|
|
1413
|
+
}).strict(),
|
|
1414
|
+
import_zod6.z.object({
|
|
1415
|
+
action: import_zod6.z.literal("category-delete"),
|
|
1416
|
+
id: import_zod6.z.uuid(),
|
|
1417
|
+
expectedRevision: revision,
|
|
1418
|
+
destinationId: import_zod6.z.uuid().nullable()
|
|
1419
|
+
}).strict(),
|
|
1420
|
+
import_zod6.z.object({
|
|
1421
|
+
action: import_zod6.z.literal("group-create"),
|
|
1422
|
+
name,
|
|
1423
|
+
members: import_zod6.z.array(import_zod6.z.object({ promptId: import_zod6.z.uuid(), version })).max(100).optional()
|
|
1424
|
+
}).strict(),
|
|
1425
|
+
import_zod6.z.object({
|
|
1426
|
+
action: import_zod6.z.literal("group-update"),
|
|
1427
|
+
id: import_zod6.z.uuid(),
|
|
1428
|
+
expectedRevision: revision,
|
|
1429
|
+
name: name.optional(),
|
|
1430
|
+
members: import_zod6.z.array(import_zod6.z.object({ promptId: import_zod6.z.uuid(), version })).max(100).optional()
|
|
1431
|
+
}).strict(),
|
|
1432
|
+
import_zod6.z.object({
|
|
1433
|
+
action: import_zod6.z.literal("group-delete"),
|
|
1434
|
+
id: import_zod6.z.uuid(),
|
|
1435
|
+
expectedRevision: revision
|
|
1436
|
+
}).strict(),
|
|
1437
|
+
import_zod6.z.object({
|
|
1438
|
+
action: import_zod6.z.literal("promote"),
|
|
1439
|
+
id: import_zod6.z.uuid(),
|
|
1440
|
+
version,
|
|
1441
|
+
expectedRevision: revision,
|
|
1442
|
+
exceptionReason: import_zod6.z.string().trim().min(1).max(2e3).optional(),
|
|
1443
|
+
rollback: import_zod6.z.boolean().default(false)
|
|
1444
|
+
}).strict(),
|
|
1445
|
+
import_zod6.z.object({
|
|
1446
|
+
action: import_zod6.z.literal("review"),
|
|
1447
|
+
id: import_zod6.z.uuid(),
|
|
1448
|
+
version,
|
|
1449
|
+
note: import_zod6.z.string().trim().min(1).max(2e3)
|
|
1450
|
+
}).strict(),
|
|
1451
|
+
import_zod6.z.object({
|
|
1452
|
+
action: import_zod6.z.literal("policy"),
|
|
1453
|
+
id: import_zod6.z.uuid(),
|
|
1454
|
+
policy: PromptPolicySchema
|
|
1455
|
+
}).strict()
|
|
1456
|
+
]);
|
|
1457
|
+
var PromptSelectionSchema = import_zod6.z.discriminatedUnion("type", [
|
|
1458
|
+
import_zod6.z.object({ type: import_zod6.z.literal("live") }).strict(),
|
|
1459
|
+
import_zod6.z.object({
|
|
1460
|
+
type: import_zod6.z.literal("single"),
|
|
1461
|
+
id: import_zod6.z.string().min(1),
|
|
1462
|
+
version: import_zod6.z.number().int().positive()
|
|
1463
|
+
}).strict(),
|
|
1464
|
+
import_zod6.z.object({ type: import_zod6.z.literal("group"), groupId: import_zod6.z.uuid() }).strict()
|
|
1465
|
+
]);
|
|
1466
|
+
var PromptBundleSchema = import_zod6.z.object({
|
|
1467
|
+
schemaVersion: import_zod6.z.literal(1),
|
|
1468
|
+
origin: import_zod6.z.object({
|
|
1469
|
+
apiUrl: import_zod6.z.url().refine((value) => {
|
|
1470
|
+
const url = new URL(value);
|
|
1471
|
+
return /^https?:$/.test(url.protocol) && !url.username && !url.password && !url.search;
|
|
1472
|
+
}),
|
|
1473
|
+
projectId: import_zod6.z.string().min(1)
|
|
1474
|
+
}).strict(),
|
|
1475
|
+
prompts: import_zod6.z.array(
|
|
1476
|
+
import_zod6.z.object({
|
|
1477
|
+
key: import_browser.PromptKeySchema,
|
|
1478
|
+
name,
|
|
1479
|
+
categoryPath: import_zod6.z.string().optional(),
|
|
1480
|
+
versions: import_zod6.z.array(import_browser.PromptVersionSchema.extend({ note: import_zod6.z.string().max(2e3) })).min(1).max(200)
|
|
1481
|
+
}).strict()
|
|
1482
|
+
).min(1).max(200),
|
|
1483
|
+
groups: import_zod6.z.array(
|
|
1484
|
+
import_zod6.z.object({
|
|
1485
|
+
name,
|
|
1486
|
+
members: import_zod6.z.array(import_zod6.z.object({ key: import_browser.PromptKeySchema, version })).max(100)
|
|
1487
|
+
}).strict()
|
|
1488
|
+
).max(100).default([])
|
|
1489
|
+
}).strict();
|
|
1490
|
+
var PromptTransferRequestSchema = import_zod6.z.object({
|
|
1491
|
+
bundle: PromptBundleSchema,
|
|
1492
|
+
conflicts: import_zod6.z.enum(["error", "append"]).default("error"),
|
|
1493
|
+
rename: import_zod6.z.record(import_browser.PromptKeySchema, import_browser.PromptKeySchema).default({}),
|
|
1494
|
+
categories: import_zod6.z.boolean().default(true),
|
|
1495
|
+
groups: import_zod6.z.boolean().default(false)
|
|
1496
|
+
}).strict();
|
|
1497
|
+
|
|
1498
|
+
// src/studio-updates.ts
|
|
1499
|
+
var import_zod7 = require("zod");
|
|
1500
|
+
var StudioReleaseVersionSchema = import_zod7.z.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
|
|
1501
|
+
var StudioReleaseDeploymentSchema = import_zod7.z.object({
|
|
1502
|
+
strategy: import_zod7.z.enum(["rolling", "recreate"])
|
|
1503
|
+
});
|
|
1504
|
+
var StudioReleaseSchema = import_zod7.z.object({
|
|
1505
|
+
format: import_zod7.z.literal(1),
|
|
1506
|
+
installer: import_zod7.z.literal(1),
|
|
1507
|
+
version: StudioReleaseVersionSchema,
|
|
1508
|
+
api: import_zod7.z.string().regex(/^ghcr\.io\/kortyx-io\/kortyx-api@sha256:[a-f0-9]{64}$/),
|
|
1509
|
+
studio: import_zod7.z.string().regex(/^ghcr\.io\/kortyx-io\/kortyx-studio@sha256:[a-f0-9]{64}$/),
|
|
1510
|
+
deployment: StudioReleaseDeploymentSchema.default({
|
|
1511
|
+
strategy: "recreate"
|
|
1512
|
+
})
|
|
1513
|
+
});
|
|
1514
|
+
var StudioUpdateSettingsSchema = import_zod7.z.object({
|
|
1515
|
+
automatic: import_zod7.z.boolean(),
|
|
1516
|
+
hourUtc: import_zod7.z.number().int().min(0).max(23)
|
|
1517
|
+
});
|
|
1518
|
+
var StudioUpdateOperationSchema = import_zod7.z.object({
|
|
1519
|
+
id: import_zod7.z.uuid(),
|
|
1520
|
+
from: import_zod7.z.string(),
|
|
1521
|
+
release: StudioReleaseSchema,
|
|
1522
|
+
phase: import_zod7.z.enum([
|
|
1523
|
+
"starting",
|
|
1524
|
+
"pulling",
|
|
1525
|
+
"backup",
|
|
1526
|
+
"installing",
|
|
1527
|
+
"verifying",
|
|
1528
|
+
"succeeded",
|
|
1529
|
+
"failed"
|
|
1530
|
+
]),
|
|
1531
|
+
startedAt: import_zod7.z.iso.datetime(),
|
|
1532
|
+
updatedAt: import_zod7.z.iso.datetime(),
|
|
1533
|
+
backup: import_zod7.z.string().nullable(),
|
|
1534
|
+
messages: import_zod7.z.array(import_zod7.z.string()).max(100)
|
|
1535
|
+
});
|
|
1536
|
+
var StudioUpdateStatusSchema = import_zod7.z.object({
|
|
1537
|
+
current: import_zod7.z.string().nullable(),
|
|
1538
|
+
available: StudioReleaseSchema.nullable(),
|
|
1539
|
+
checkedAt: import_zod7.z.iso.datetime().nullable(),
|
|
1540
|
+
checkError: import_zod7.z.string().nullable(),
|
|
1541
|
+
settings: StudioUpdateSettingsSchema,
|
|
1542
|
+
operation: StudioUpdateOperationSchema.nullable()
|
|
1543
|
+
});
|
|
1544
|
+
function newerStudioVersion(candidate, current) {
|
|
1545
|
+
const next = StudioReleaseVersionSchema.parse(candidate).split(".").map(BigInt);
|
|
1546
|
+
const previous = StudioReleaseVersionSchema.parse(current).split(".").map(BigInt);
|
|
1547
|
+
for (let i = 0; i < 3; i++) {
|
|
1548
|
+
if (next[i] !== previous[i]) return (next[i] ?? 0n) > (previous[i] ?? 0n);
|
|
1549
|
+
}
|
|
1550
|
+
return false;
|
|
1382
1551
|
}
|
|
1383
|
-
function
|
|
1384
|
-
|
|
1385
|
-
const value = Date.parse(startedAt) - Date.parse(createdAt);
|
|
1386
|
-
return Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
1552
|
+
function studioUpdateRunning(operation) {
|
|
1553
|
+
return !!operation && operation.phase !== "succeeded" && operation.phase !== "failed";
|
|
1387
1554
|
}
|
|
1388
1555
|
|
|
1389
1556
|
// src/workflow-calls.ts
|
|
@@ -1393,10 +1560,10 @@ function projectWorkflowCalls(events) {
|
|
|
1393
1560
|
for (const event of events) {
|
|
1394
1561
|
if (!event.type.startsWith("workflow.call.") || !str(event.payload.invocationId) || !str(event.payload.targetWorkflowId))
|
|
1395
1562
|
continue;
|
|
1396
|
-
const
|
|
1397
|
-
const group = groups.get(
|
|
1563
|
+
const key2 = `${event.runId}:${str(event.payload.branchId, event.runId)}:${event.payload.invocationId}`;
|
|
1564
|
+
const group = groups.get(key2) ?? [];
|
|
1398
1565
|
if (!group.some((existing) => existing.id === event.id)) group.push(event);
|
|
1399
|
-
groups.set(
|
|
1566
|
+
groups.set(key2, group);
|
|
1400
1567
|
}
|
|
1401
1568
|
return [...groups.entries()].map(([id, group]) => {
|
|
1402
1569
|
group.sort(
|
|
@@ -1525,82 +1692,82 @@ var TELEMETRY_EVENT_TYPES = [
|
|
|
1525
1692
|
"session.forked",
|
|
1526
1693
|
"session.rolled_back"
|
|
1527
1694
|
];
|
|
1528
|
-
var TelemetryServiceSchema =
|
|
1529
|
-
name:
|
|
1530
|
-
deploymentRef:
|
|
1695
|
+
var TelemetryServiceSchema = import_zod8.z.object({
|
|
1696
|
+
name: import_zod8.z.string().min(1),
|
|
1697
|
+
deploymentRef: import_zod8.z.string().min(1).optional()
|
|
1531
1698
|
}).strict();
|
|
1532
|
-
var WorkflowTopologyNodeSchema =
|
|
1533
|
-
id:
|
|
1534
|
-
label:
|
|
1535
|
-
type:
|
|
1536
|
-
provider:
|
|
1537
|
-
model:
|
|
1538
|
-
metadata:
|
|
1539
|
-
tools:
|
|
1699
|
+
var WorkflowTopologyNodeSchema = import_zod8.z.object({
|
|
1700
|
+
id: import_zod8.z.string().min(1),
|
|
1701
|
+
label: import_zod8.z.string().optional(),
|
|
1702
|
+
type: import_zod8.z.string().optional(),
|
|
1703
|
+
provider: import_zod8.z.string().optional(),
|
|
1704
|
+
model: import_zod8.z.string().optional(),
|
|
1705
|
+
metadata: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).optional(),
|
|
1706
|
+
tools: import_zod8.z.array(WorkflowToolSchema).optional(),
|
|
1540
1707
|
toolDiscovery: ToolDiscoverySchema.optional()
|
|
1541
1708
|
}).strict();
|
|
1542
|
-
var WorkflowTopologyEdgeSchema =
|
|
1543
|
-
sourceNodeId:
|
|
1544
|
-
targetNodeId:
|
|
1545
|
-
condition:
|
|
1709
|
+
var WorkflowTopologyEdgeSchema = import_zod8.z.object({
|
|
1710
|
+
sourceNodeId: import_zod8.z.string().min(1),
|
|
1711
|
+
targetNodeId: import_zod8.z.string().min(1),
|
|
1712
|
+
condition: import_zod8.z.string().optional()
|
|
1546
1713
|
}).strict();
|
|
1547
|
-
var WorkflowTopologyCallSchema =
|
|
1548
|
-
sourceNodeId:
|
|
1549
|
-
targetWorkflowId:
|
|
1714
|
+
var WorkflowTopologyCallSchema = import_zod8.z.object({
|
|
1715
|
+
sourceNodeId: import_zod8.z.string().min(1),
|
|
1716
|
+
targetWorkflowId: import_zod8.z.string().min(1)
|
|
1550
1717
|
}).strict();
|
|
1551
|
-
var WorkflowTopologyTransitionSchema =
|
|
1552
|
-
sourceNodeId:
|
|
1553
|
-
targetWorkflowId:
|
|
1554
|
-
condition:
|
|
1555
|
-
intent:
|
|
1556
|
-
kind:
|
|
1718
|
+
var WorkflowTopologyTransitionSchema = import_zod8.z.object({
|
|
1719
|
+
sourceNodeId: import_zod8.z.string().min(1).optional(),
|
|
1720
|
+
targetWorkflowId: import_zod8.z.string().min(1),
|
|
1721
|
+
condition: import_zod8.z.string().optional(),
|
|
1722
|
+
intent: import_zod8.z.string().optional(),
|
|
1723
|
+
kind: import_zod8.z.enum(["call", "handoff"]).optional()
|
|
1557
1724
|
}).strict();
|
|
1558
|
-
var EnsureWorkflowTopologyRequestSchema =
|
|
1559
|
-
schemaVersion:
|
|
1560
|
-
environment:
|
|
1725
|
+
var EnsureWorkflowTopologyRequestSchema = import_zod8.z.object({
|
|
1726
|
+
schemaVersion: import_zod8.z.literal(1),
|
|
1727
|
+
environment: import_zod8.z.string().min(1),
|
|
1561
1728
|
service: TelemetryServiceSchema,
|
|
1562
|
-
workflow:
|
|
1563
|
-
id:
|
|
1564
|
-
declaredVersion:
|
|
1565
|
-
description:
|
|
1566
|
-
tags:
|
|
1567
|
-
topologyHash:
|
|
1568
|
-
nodes:
|
|
1569
|
-
edges:
|
|
1570
|
-
transitions:
|
|
1571
|
-
calls:
|
|
1729
|
+
workflow: import_zod8.z.object({
|
|
1730
|
+
id: import_zod8.z.string().min(1),
|
|
1731
|
+
declaredVersion: import_zod8.z.string().min(1),
|
|
1732
|
+
description: import_zod8.z.string().optional(),
|
|
1733
|
+
tags: import_zod8.z.array(import_zod8.z.string()).optional(),
|
|
1734
|
+
topologyHash: import_zod8.z.string().regex(/^[a-f0-9]{64}$/),
|
|
1735
|
+
nodes: import_zod8.z.array(WorkflowTopologyNodeSchema),
|
|
1736
|
+
edges: import_zod8.z.array(WorkflowTopologyEdgeSchema),
|
|
1737
|
+
transitions: import_zod8.z.array(WorkflowTopologyTransitionSchema).optional(),
|
|
1738
|
+
calls: import_zod8.z.array(WorkflowTopologyCallSchema).optional()
|
|
1572
1739
|
}).strict()
|
|
1573
1740
|
}).strict();
|
|
1574
|
-
var EnsureWorkflowTopologyResponseSchema =
|
|
1575
|
-
var TelemetryEventTypeSchema =
|
|
1576
|
-
var TelemetryEventSchema =
|
|
1577
|
-
schemaVersion:
|
|
1578
|
-
eventId:
|
|
1579
|
-
occurredAt:
|
|
1580
|
-
environment:
|
|
1741
|
+
var EnsureWorkflowTopologyResponseSchema = import_zod8.z.object({ workflowRevisionId: import_zod8.z.string().min(1), created: import_zod8.z.boolean() }).strict();
|
|
1742
|
+
var TelemetryEventTypeSchema = import_zod8.z.enum(TELEMETRY_EVENT_TYPES);
|
|
1743
|
+
var TelemetryEventSchema = import_zod8.z.object({
|
|
1744
|
+
schemaVersion: import_zod8.z.literal(1),
|
|
1745
|
+
eventId: import_zod8.z.string().min(1),
|
|
1746
|
+
occurredAt: import_zod8.z.string().datetime({ offset: true }),
|
|
1747
|
+
environment: import_zod8.z.string().min(1),
|
|
1581
1748
|
service: TelemetryServiceSchema,
|
|
1582
|
-
correlation:
|
|
1583
|
-
invocationId:
|
|
1584
|
-
parentInvocationId:
|
|
1585
|
-
branchId:
|
|
1586
|
-
traceId:
|
|
1587
|
-
spanId:
|
|
1588
|
-
parentSpanId:
|
|
1589
|
-
runId:
|
|
1590
|
-
sessionId:
|
|
1591
|
-
workflowId:
|
|
1592
|
-
workflowRevisionId:
|
|
1593
|
-
topologyHash:
|
|
1594
|
-
nodeId:
|
|
1749
|
+
correlation: import_zod8.z.object({
|
|
1750
|
+
invocationId: import_zod8.z.string().optional(),
|
|
1751
|
+
parentInvocationId: import_zod8.z.string().optional(),
|
|
1752
|
+
branchId: import_zod8.z.string().optional(),
|
|
1753
|
+
traceId: import_zod8.z.string().optional(),
|
|
1754
|
+
spanId: import_zod8.z.string().optional(),
|
|
1755
|
+
parentSpanId: import_zod8.z.string().optional(),
|
|
1756
|
+
runId: import_zod8.z.string().min(1),
|
|
1757
|
+
sessionId: import_zod8.z.string().optional(),
|
|
1758
|
+
workflowId: import_zod8.z.string().min(1),
|
|
1759
|
+
workflowRevisionId: import_zod8.z.string().optional(),
|
|
1760
|
+
topologyHash: import_zod8.z.string().regex(/^[a-f0-9]{64}$/).optional(),
|
|
1761
|
+
nodeId: import_zod8.z.string().optional()
|
|
1595
1762
|
}).strict(),
|
|
1596
|
-
context:
|
|
1597
|
-
userId:
|
|
1598
|
-
tenantId:
|
|
1599
|
-
tags:
|
|
1600
|
-
metadata:
|
|
1763
|
+
context: import_zod8.z.object({
|
|
1764
|
+
userId: import_zod8.z.string().optional(),
|
|
1765
|
+
tenantId: import_zod8.z.string().optional(),
|
|
1766
|
+
tags: import_zod8.z.array(import_zod8.z.string()).optional(),
|
|
1767
|
+
metadata: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).optional()
|
|
1601
1768
|
}).strict().optional(),
|
|
1602
1769
|
type: TelemetryEventTypeSchema,
|
|
1603
|
-
payload:
|
|
1770
|
+
payload: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown())
|
|
1604
1771
|
}).strict().superRefine((event, ctx) => {
|
|
1605
1772
|
if (!event.type.startsWith("tool.")) return;
|
|
1606
1773
|
const canonical = event.payload.version === 1 || [
|
|
@@ -1643,20 +1810,20 @@ var TelemetryEventSchema = import_zod7.z.object({
|
|
|
1643
1810
|
});
|
|
1644
1811
|
}
|
|
1645
1812
|
});
|
|
1646
|
-
var TelemetryEventBatchSchema =
|
|
1647
|
-
var TelemetryEventBatchResponseSchema =
|
|
1648
|
-
accepted:
|
|
1649
|
-
inserted:
|
|
1650
|
-
duplicates:
|
|
1813
|
+
var TelemetryEventBatchSchema = import_zod8.z.object({ events: import_zod8.z.array(TelemetryEventSchema).min(1) }).strict();
|
|
1814
|
+
var TelemetryEventBatchResponseSchema = import_zod8.z.object({
|
|
1815
|
+
accepted: import_zod8.z.number().int().nonnegative(),
|
|
1816
|
+
inserted: import_zod8.z.number().int().nonnegative(),
|
|
1817
|
+
duplicates: import_zod8.z.number().int().nonnegative()
|
|
1651
1818
|
}).strict();
|
|
1652
|
-
var TelemetryPricingSourceSchema =
|
|
1819
|
+
var TelemetryPricingSourceSchema = import_zod8.z.enum([
|
|
1653
1820
|
"sdk",
|
|
1654
1821
|
"provider",
|
|
1655
1822
|
"custom",
|
|
1656
1823
|
"project-rate-card",
|
|
1657
1824
|
"default-rate-card"
|
|
1658
1825
|
]);
|
|
1659
|
-
var TelemetryPricingUnitSchema =
|
|
1826
|
+
var TelemetryPricingUnitSchema = import_zod8.z.enum([
|
|
1660
1827
|
"token",
|
|
1661
1828
|
"character",
|
|
1662
1829
|
"request",
|
|
@@ -1669,7 +1836,7 @@ var TelemetryPricingUnitSchema = import_zod7.z.enum([
|
|
|
1669
1836
|
"minute",
|
|
1670
1837
|
"custom"
|
|
1671
1838
|
]);
|
|
1672
|
-
var TelemetryPricingUsageTypeSchema =
|
|
1839
|
+
var TelemetryPricingUsageTypeSchema = import_zod8.z.enum([
|
|
1673
1840
|
"input",
|
|
1674
1841
|
"output",
|
|
1675
1842
|
"reasoning",
|
|
@@ -1685,42 +1852,42 @@ var TelemetryPricingUsageTypeSchema = import_zod7.z.enum([
|
|
|
1685
1852
|
"request",
|
|
1686
1853
|
"custom"
|
|
1687
1854
|
]);
|
|
1688
|
-
var TelemetryUsageItemSchema =
|
|
1855
|
+
var TelemetryUsageItemSchema = import_zod8.z.object({
|
|
1689
1856
|
usageType: TelemetryPricingUsageTypeSchema,
|
|
1690
|
-
quantity:
|
|
1857
|
+
quantity: import_zod8.z.number().nonnegative(),
|
|
1691
1858
|
unit: TelemetryPricingUnitSchema,
|
|
1692
|
-
label:
|
|
1859
|
+
label: import_zod8.z.string().optional()
|
|
1693
1860
|
}).strict();
|
|
1694
|
-
var TelemetryUnitPriceSchema =
|
|
1861
|
+
var TelemetryUnitPriceSchema = import_zod8.z.object({
|
|
1695
1862
|
usageType: TelemetryPricingUsageTypeSchema,
|
|
1696
1863
|
unit: TelemetryPricingUnitSchema,
|
|
1697
|
-
unitQuantity:
|
|
1698
|
-
priceMicros:
|
|
1699
|
-
label:
|
|
1864
|
+
unitQuantity: import_zod8.z.number().positive().default(1),
|
|
1865
|
+
priceMicros: import_zod8.z.number().int().nonnegative(),
|
|
1866
|
+
label: import_zod8.z.string().optional()
|
|
1700
1867
|
}).strict();
|
|
1701
|
-
var TelemetryPricingLineItemSchema =
|
|
1868
|
+
var TelemetryPricingLineItemSchema = import_zod8.z.object({
|
|
1702
1869
|
usageType: TelemetryPricingUsageTypeSchema,
|
|
1703
|
-
quantity:
|
|
1870
|
+
quantity: import_zod8.z.number().nonnegative(),
|
|
1704
1871
|
unit: TelemetryPricingUnitSchema,
|
|
1705
|
-
unitQuantity:
|
|
1706
|
-
unitPriceMicros:
|
|
1707
|
-
totalCostMicros:
|
|
1708
|
-
label:
|
|
1872
|
+
unitQuantity: import_zod8.z.number().positive().default(1),
|
|
1873
|
+
unitPriceMicros: import_zod8.z.number().int().nonnegative().optional(),
|
|
1874
|
+
totalCostMicros: import_zod8.z.number().int().nonnegative().optional(),
|
|
1875
|
+
label: import_zod8.z.string().optional()
|
|
1709
1876
|
}).strict().refine(
|
|
1710
1877
|
(value) => value.totalCostMicros !== void 0 || value.unitPriceMicros !== void 0,
|
|
1711
1878
|
"line item requires totalCostMicros or unitPriceMicros"
|
|
1712
1879
|
);
|
|
1713
|
-
var TelemetryPricingHintSchema =
|
|
1880
|
+
var TelemetryPricingHintSchema = import_zod8.z.object({
|
|
1714
1881
|
source: TelemetryPricingSourceSchema.extract(["sdk", "provider", "custom"]),
|
|
1715
|
-
currency:
|
|
1716
|
-
actualCostMicros:
|
|
1717
|
-
lineItems:
|
|
1718
|
-
unitPrices:
|
|
1719
|
-
usageItems:
|
|
1720
|
-
pricingRef:
|
|
1721
|
-
metadata:
|
|
1882
|
+
currency: import_zod8.z.string().min(3).max(12).default("USD"),
|
|
1883
|
+
actualCostMicros: import_zod8.z.number().int().nonnegative().optional(),
|
|
1884
|
+
lineItems: import_zod8.z.array(TelemetryPricingLineItemSchema).optional(),
|
|
1885
|
+
unitPrices: import_zod8.z.array(TelemetryUnitPriceSchema).optional(),
|
|
1886
|
+
usageItems: import_zod8.z.array(TelemetryUsageItemSchema).optional(),
|
|
1887
|
+
pricingRef: import_zod8.z.string().min(1).optional(),
|
|
1888
|
+
metadata: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).optional()
|
|
1722
1889
|
}).strict();
|
|
1723
|
-
var StudioRunStatusSchema =
|
|
1890
|
+
var StudioRunStatusSchema = import_zod8.z.enum([
|
|
1724
1891
|
"running",
|
|
1725
1892
|
"completed",
|
|
1726
1893
|
"interrupted",
|
|
@@ -1736,16 +1903,16 @@ var STUDIO_TIME_RANGES = [
|
|
|
1736
1903
|
"All time",
|
|
1737
1904
|
"Custom range"
|
|
1738
1905
|
];
|
|
1739
|
-
var StudioTimeRangeSchema =
|
|
1740
|
-
var StudioTimeRangeQuerySchema =
|
|
1906
|
+
var StudioTimeRangeSchema = import_zod8.z.enum(STUDIO_TIME_RANGES);
|
|
1907
|
+
var StudioTimeRangeQuerySchema = import_zod8.z.object({
|
|
1741
1908
|
range: StudioTimeRangeSchema.optional(),
|
|
1742
|
-
startedAfter:
|
|
1743
|
-
startedBefore:
|
|
1909
|
+
startedAfter: import_zod8.z.string().optional(),
|
|
1910
|
+
startedBefore: import_zod8.z.string().optional()
|
|
1744
1911
|
}).strict();
|
|
1745
|
-
var StudioTimeRangeContextSchema =
|
|
1912
|
+
var StudioTimeRangeContextSchema = import_zod8.z.object({
|
|
1746
1913
|
range: StudioTimeRangeSchema,
|
|
1747
|
-
startedAfter:
|
|
1748
|
-
startedBefore:
|
|
1914
|
+
startedAfter: import_zod8.z.string().datetime({ offset: true }).nullable(),
|
|
1915
|
+
startedBefore: import_zod8.z.string().datetime({ offset: true }).nullable()
|
|
1749
1916
|
}).strict();
|
|
1750
1917
|
var STUDIO_TIME_RANGE_MILLISECONDS = {
|
|
1751
1918
|
"Last hour": 60 * 60 * 1e3,
|
|
@@ -1819,7 +1986,7 @@ var resolveStudioTimeRange = (input, now = /* @__PURE__ */ new Date()) => {
|
|
|
1819
1986
|
}
|
|
1820
1987
|
};
|
|
1821
1988
|
};
|
|
1822
|
-
var StudioInterruptStatusSchema =
|
|
1989
|
+
var StudioInterruptStatusSchema = import_zod8.z.enum([
|
|
1823
1990
|
"pending",
|
|
1824
1991
|
"resolved",
|
|
1825
1992
|
"expired",
|
|
@@ -1832,341 +1999,342 @@ var resolveStudioInterruptStatus = (input, now = Date.now()) => {
|
|
|
1832
1999
|
const nowMs = typeof now === "number" ? now : now.getTime();
|
|
1833
2000
|
return Number.isFinite(expiresAt) && Number.isFinite(nowMs) && expiresAt <= nowMs ? "expired" : input.status;
|
|
1834
2001
|
};
|
|
1835
|
-
var StudioInterruptTypeSchema =
|
|
2002
|
+
var StudioInterruptTypeSchema = import_zod8.z.enum([
|
|
1836
2003
|
"choice",
|
|
1837
2004
|
"multi-choice",
|
|
1838
2005
|
"text",
|
|
1839
2006
|
"structured",
|
|
1840
2007
|
"unknown"
|
|
1841
2008
|
]);
|
|
1842
|
-
var StudioInterruptInteractionModeSchema =
|
|
2009
|
+
var StudioInterruptInteractionModeSchema = import_zod8.z.enum([
|
|
1843
2010
|
"static-options",
|
|
1844
2011
|
"dynamic-picker",
|
|
1845
2012
|
"freeform",
|
|
1846
2013
|
"unknown"
|
|
1847
2014
|
]);
|
|
1848
|
-
var StudioInterruptOptionSchema =
|
|
1849
|
-
id:
|
|
1850
|
-
label:
|
|
1851
|
-
description:
|
|
2015
|
+
var StudioInterruptOptionSchema = import_zod8.z.object({
|
|
2016
|
+
id: import_zod8.z.string().min(1),
|
|
2017
|
+
label: import_zod8.z.string().min(1),
|
|
2018
|
+
description: import_zod8.z.string().nullable()
|
|
1852
2019
|
}).strip();
|
|
1853
|
-
var StudioInterruptValueSchema =
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
2020
|
+
var StudioInterruptValueSchema = import_zod8.z.union([
|
|
2021
|
+
import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()),
|
|
2022
|
+
import_zod8.z.array(import_zod8.z.unknown()),
|
|
2023
|
+
import_zod8.z.string(),
|
|
2024
|
+
import_zod8.z.number(),
|
|
2025
|
+
import_zod8.z.boolean()
|
|
1859
2026
|
]);
|
|
1860
|
-
var StudioResumeOutcomeSchema =
|
|
2027
|
+
var StudioResumeOutcomeSchema = import_zod8.z.enum([
|
|
1861
2028
|
"resumed",
|
|
1862
2029
|
"resume failed",
|
|
1863
2030
|
"expired before resume",
|
|
1864
2031
|
"cancelled"
|
|
1865
2032
|
]);
|
|
1866
|
-
var StudioWorkflowHealthSchema =
|
|
2033
|
+
var StudioWorkflowHealthSchema = import_zod8.z.enum([
|
|
1867
2034
|
"unknown",
|
|
1868
2035
|
"healthy",
|
|
1869
2036
|
"degraded",
|
|
1870
2037
|
"failing",
|
|
1871
2038
|
"idle"
|
|
1872
2039
|
]);
|
|
1873
|
-
var StudioPricingStatusSchema =
|
|
2040
|
+
var StudioPricingStatusSchema = import_zod8.z.enum([
|
|
1874
2041
|
"priced",
|
|
1875
2042
|
"unpriced",
|
|
1876
2043
|
"unknown"
|
|
1877
2044
|
]);
|
|
1878
2045
|
var StudioPricingSourceSchema = TelemetryPricingSourceSchema.nullable();
|
|
1879
|
-
var StudioChangeResourceSchema =
|
|
2046
|
+
var StudioChangeResourceSchema = import_zod8.z.enum([
|
|
1880
2047
|
"evals",
|
|
1881
2048
|
"workflows",
|
|
1882
2049
|
"runs",
|
|
1883
2050
|
"sessions",
|
|
1884
2051
|
"interrupts"
|
|
1885
2052
|
]);
|
|
1886
|
-
var StudioChangeSchema =
|
|
1887
|
-
schemaVersion:
|
|
1888
|
-
changeId:
|
|
1889
|
-
emittedAt:
|
|
1890
|
-
organizationId:
|
|
1891
|
-
projectId:
|
|
1892
|
-
environment:
|
|
1893
|
-
resources:
|
|
2053
|
+
var StudioChangeSchema = import_zod8.z.object({
|
|
2054
|
+
schemaVersion: import_zod8.z.literal(1),
|
|
2055
|
+
changeId: import_zod8.z.string().min(1),
|
|
2056
|
+
emittedAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2057
|
+
organizationId: import_zod8.z.string().min(1),
|
|
2058
|
+
projectId: import_zod8.z.string().min(1),
|
|
2059
|
+
environment: import_zod8.z.string().min(1).optional(),
|
|
2060
|
+
resources: import_zod8.z.array(StudioChangeResourceSchema).min(1)
|
|
1894
2061
|
}).strict();
|
|
1895
|
-
var StudioCostSummarySchema =
|
|
1896
|
-
amounts:
|
|
1897
|
-
|
|
1898
|
-
amount:
|
|
1899
|
-
currency:
|
|
2062
|
+
var StudioCostSummarySchema = import_zod8.z.object({
|
|
2063
|
+
amounts: import_zod8.z.array(
|
|
2064
|
+
import_zod8.z.object({
|
|
2065
|
+
amount: import_zod8.z.number().nonnegative(),
|
|
2066
|
+
currency: import_zod8.z.string().nullable()
|
|
1900
2067
|
}).strip()
|
|
1901
2068
|
),
|
|
1902
|
-
complete:
|
|
2069
|
+
complete: import_zod8.z.boolean()
|
|
1903
2070
|
}).strip();
|
|
1904
|
-
var StudioMetricSchema =
|
|
1905
|
-
runCount:
|
|
1906
|
-
successRate:
|
|
1907
|
-
errorRate:
|
|
1908
|
-
retryCount:
|
|
1909
|
-
interruptRate:
|
|
1910
|
-
p50DurationMs:
|
|
1911
|
-
p95DurationMs:
|
|
1912
|
-
averageTokens:
|
|
1913
|
-
averageCost:
|
|
2071
|
+
var StudioMetricSchema = import_zod8.z.object({
|
|
2072
|
+
runCount: import_zod8.z.number().int().nonnegative(),
|
|
2073
|
+
successRate: import_zod8.z.number().min(0).max(100).nullable(),
|
|
2074
|
+
errorRate: import_zod8.z.number().min(0).max(100).nullable(),
|
|
2075
|
+
retryCount: import_zod8.z.number().int().nonnegative().nullable(),
|
|
2076
|
+
interruptRate: import_zod8.z.number().min(0).max(100).nullable(),
|
|
2077
|
+
p50DurationMs: import_zod8.z.number().nonnegative().nullable(),
|
|
2078
|
+
p95DurationMs: import_zod8.z.number().nonnegative().nullable(),
|
|
2079
|
+
averageTokens: import_zod8.z.number().nonnegative().nullable(),
|
|
2080
|
+
averageCost: import_zod8.z.number().nonnegative().nullable(),
|
|
1914
2081
|
averageCostSummary: StudioCostSummarySchema.optional(),
|
|
1915
|
-
currency:
|
|
2082
|
+
currency: import_zod8.z.string().nullable()
|
|
1916
2083
|
}).strip();
|
|
1917
|
-
var StudioRunSchema =
|
|
1918
|
-
id:
|
|
2084
|
+
var StudioRunSchema = import_zod8.z.object({
|
|
2085
|
+
id: import_zod8.z.string().min(1),
|
|
1919
2086
|
feedback: FeedbackSummarySchema.optional(),
|
|
1920
|
-
callerNodeId:
|
|
1921
|
-
parentRunId:
|
|
1922
|
-
parentWorkflowId:
|
|
1923
|
-
invocationId:
|
|
1924
|
-
branchId:
|
|
1925
|
-
callId:
|
|
2087
|
+
callerNodeId: import_zod8.z.string().optional(),
|
|
2088
|
+
parentRunId: import_zod8.z.string().optional(),
|
|
2089
|
+
parentWorkflowId: import_zod8.z.string().optional(),
|
|
2090
|
+
invocationId: import_zod8.z.string().optional(),
|
|
2091
|
+
branchId: import_zod8.z.string().optional(),
|
|
2092
|
+
callId: import_zod8.z.string().optional(),
|
|
1926
2093
|
status: StudioRunStatusSchema,
|
|
1927
|
-
startedAt:
|
|
1928
|
-
endedAt:
|
|
1929
|
-
workflowId:
|
|
1930
|
-
workflowIds:
|
|
1931
|
-
workflowRefs:
|
|
1932
|
-
|
|
1933
|
-
workflowId:
|
|
1934
|
-
workflowRevisionId:
|
|
1935
|
-
declaredVersion:
|
|
2094
|
+
startedAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2095
|
+
endedAt: import_zod8.z.string().datetime({ offset: true }).nullable(),
|
|
2096
|
+
workflowId: import_zod8.z.string().min(1),
|
|
2097
|
+
workflowIds: import_zod8.z.array(import_zod8.z.string().min(1)),
|
|
2098
|
+
workflowRefs: import_zod8.z.array(
|
|
2099
|
+
import_zod8.z.object({
|
|
2100
|
+
workflowId: import_zod8.z.string().min(1),
|
|
2101
|
+
workflowRevisionId: import_zod8.z.string().nullable(),
|
|
2102
|
+
declaredVersion: import_zod8.z.string().nullable()
|
|
1936
2103
|
}).strip()
|
|
1937
2104
|
),
|
|
1938
|
-
workflowRevisionId:
|
|
1939
|
-
declaredVersion:
|
|
1940
|
-
transitionIds:
|
|
1941
|
-
path:
|
|
1942
|
-
sessionId:
|
|
1943
|
-
provider:
|
|
1944
|
-
model:
|
|
1945
|
-
models:
|
|
1946
|
-
durationMs:
|
|
1947
|
-
tokens:
|
|
1948
|
-
cost:
|
|
2105
|
+
workflowRevisionId: import_zod8.z.string().nullable(),
|
|
2106
|
+
declaredVersion: import_zod8.z.string().nullable(),
|
|
2107
|
+
transitionIds: import_zod8.z.array(import_zod8.z.string().min(1)),
|
|
2108
|
+
path: import_zod8.z.array(import_zod8.z.string()),
|
|
2109
|
+
sessionId: import_zod8.z.string().nullable(),
|
|
2110
|
+
provider: import_zod8.z.string().nullable(),
|
|
2111
|
+
model: import_zod8.z.string().nullable(),
|
|
2112
|
+
models: import_zod8.z.array(import_zod8.z.string()),
|
|
2113
|
+
durationMs: import_zod8.z.number().nonnegative().nullable(),
|
|
2114
|
+
tokens: import_zod8.z.number().int().nonnegative().nullable(),
|
|
2115
|
+
cost: import_zod8.z.number().nonnegative().nullable(),
|
|
1949
2116
|
costSummary: StudioCostSummarySchema.optional(),
|
|
1950
2117
|
pricingStatus: StudioPricingStatusSchema,
|
|
1951
2118
|
pricingSource: StudioPricingSourceSchema,
|
|
1952
|
-
currency:
|
|
1953
|
-
result:
|
|
1954
|
-
environment:
|
|
1955
|
-
userId:
|
|
1956
|
-
tenantId:
|
|
1957
|
-
hasTool:
|
|
1958
|
-
hasRetry:
|
|
1959
|
-
interruptNodeId:
|
|
1960
|
-
interruptId:
|
|
2119
|
+
currency: import_zod8.z.string().nullable(),
|
|
2120
|
+
result: import_zod8.z.string().nullable(),
|
|
2121
|
+
environment: import_zod8.z.string().min(1),
|
|
2122
|
+
userId: import_zod8.z.string().nullable(),
|
|
2123
|
+
tenantId: import_zod8.z.string().nullable(),
|
|
2124
|
+
hasTool: import_zod8.z.boolean(),
|
|
2125
|
+
hasRetry: import_zod8.z.boolean(),
|
|
2126
|
+
interruptNodeId: import_zod8.z.string().nullable(),
|
|
2127
|
+
interruptId: import_zod8.z.string().nullable().optional(),
|
|
1961
2128
|
interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
|
|
1962
|
-
interruptExpiresAt:
|
|
2129
|
+
interruptExpiresAt: import_zod8.z.string().datetime({ offset: true }).nullable().optional()
|
|
1963
2130
|
}).strip();
|
|
1964
|
-
var StudioSessionSchema =
|
|
1965
|
-
id:
|
|
2131
|
+
var StudioSessionSchema = import_zod8.z.object({
|
|
2132
|
+
id: import_zod8.z.string().min(1),
|
|
1966
2133
|
status: StudioRunStatusSchema,
|
|
1967
|
-
lastActivityAt:
|
|
1968
|
-
workflowIds:
|
|
1969
|
-
workflowCount:
|
|
1970
|
-
activeWorkflowId:
|
|
1971
|
-
activeVersion:
|
|
1972
|
-
userId:
|
|
1973
|
-
tenantId:
|
|
1974
|
-
runs:
|
|
1975
|
-
succeeded:
|
|
1976
|
-
failed:
|
|
1977
|
-
interrupted:
|
|
1978
|
-
checkpoints:
|
|
1979
|
-
hasFork:
|
|
1980
|
-
durationMs:
|
|
1981
|
-
tokens:
|
|
1982
|
-
cost:
|
|
2134
|
+
lastActivityAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2135
|
+
workflowIds: import_zod8.z.array(import_zod8.z.string()),
|
|
2136
|
+
workflowCount: import_zod8.z.number().int().nonnegative(),
|
|
2137
|
+
activeWorkflowId: import_zod8.z.string().nullable(),
|
|
2138
|
+
activeVersion: import_zod8.z.string().nullable(),
|
|
2139
|
+
userId: import_zod8.z.string().nullable(),
|
|
2140
|
+
tenantId: import_zod8.z.string().nullable(),
|
|
2141
|
+
runs: import_zod8.z.number().int().nonnegative(),
|
|
2142
|
+
succeeded: import_zod8.z.number().int().nonnegative(),
|
|
2143
|
+
failed: import_zod8.z.number().int().nonnegative(),
|
|
2144
|
+
interrupted: import_zod8.z.number().int().nonnegative(),
|
|
2145
|
+
checkpoints: import_zod8.z.number().int().nonnegative(),
|
|
2146
|
+
hasFork: import_zod8.z.boolean(),
|
|
2147
|
+
durationMs: import_zod8.z.number().nonnegative().nullable(),
|
|
2148
|
+
tokens: import_zod8.z.number().int().nonnegative().nullable(),
|
|
2149
|
+
cost: import_zod8.z.number().nonnegative().nullable(),
|
|
1983
2150
|
costSummary: StudioCostSummarySchema.optional(),
|
|
1984
2151
|
pricingStatus: StudioPricingStatusSchema,
|
|
1985
2152
|
pricingSource: StudioPricingSourceSchema,
|
|
1986
|
-
currency:
|
|
1987
|
-
latestResult:
|
|
1988
|
-
latestError:
|
|
1989
|
-
pendingInterruptId:
|
|
2153
|
+
currency: import_zod8.z.string().nullable(),
|
|
2154
|
+
latestResult: import_zod8.z.string().nullable(),
|
|
2155
|
+
latestError: import_zod8.z.string().nullable(),
|
|
2156
|
+
pendingInterruptId: import_zod8.z.string().nullable(),
|
|
1990
2157
|
interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
|
|
1991
|
-
interruptExpiresAt:
|
|
1992
|
-
providers:
|
|
1993
|
-
models:
|
|
1994
|
-
tags:
|
|
1995
|
-
environment:
|
|
2158
|
+
interruptExpiresAt: import_zod8.z.string().datetime({ offset: true }).nullable().optional(),
|
|
2159
|
+
providers: import_zod8.z.array(import_zod8.z.string()),
|
|
2160
|
+
models: import_zod8.z.array(import_zod8.z.string()),
|
|
2161
|
+
tags: import_zod8.z.array(import_zod8.z.string()),
|
|
2162
|
+
environment: import_zod8.z.string().min(1)
|
|
1996
2163
|
}).strip();
|
|
1997
|
-
var StudioInterruptSchema =
|
|
1998
|
-
afterResponseCompleted:
|
|
1999
|
-
id:
|
|
2164
|
+
var StudioInterruptSchema = import_zod8.z.object({
|
|
2165
|
+
afterResponseCompleted: import_zod8.z.boolean().optional(),
|
|
2166
|
+
id: import_zod8.z.string().min(1),
|
|
2000
2167
|
status: StudioInterruptStatusSchema,
|
|
2001
2168
|
type: StudioInterruptTypeSchema,
|
|
2002
2169
|
interactionMode: StudioInterruptInteractionModeSchema,
|
|
2003
|
-
contract:
|
|
2004
|
-
schemaId:
|
|
2005
|
-
schemaVersion:
|
|
2006
|
-
createdAt:
|
|
2007
|
-
resolvedAt:
|
|
2008
|
-
expiresAt:
|
|
2009
|
-
question:
|
|
2010
|
-
contentCaptured:
|
|
2011
|
-
request:
|
|
2012
|
-
requestCaptured:
|
|
2013
|
-
optionCount:
|
|
2014
|
-
options:
|
|
2015
|
-
workflowId:
|
|
2016
|
-
nodeId:
|
|
2017
|
-
sessionId:
|
|
2018
|
-
userId:
|
|
2019
|
-
tenantId:
|
|
2020
|
-
response:
|
|
2170
|
+
contract: import_zod8.z.string().nullable().default(null),
|
|
2171
|
+
schemaId: import_zod8.z.string().nullable(),
|
|
2172
|
+
schemaVersion: import_zod8.z.string().nullable(),
|
|
2173
|
+
createdAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2174
|
+
resolvedAt: import_zod8.z.string().datetime({ offset: true }).nullable(),
|
|
2175
|
+
expiresAt: import_zod8.z.string().datetime({ offset: true }).nullable(),
|
|
2176
|
+
question: import_zod8.z.string().nullable(),
|
|
2177
|
+
contentCaptured: import_zod8.z.boolean(),
|
|
2178
|
+
request: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).nullable().default(null),
|
|
2179
|
+
requestCaptured: import_zod8.z.boolean().default(false),
|
|
2180
|
+
optionCount: import_zod8.z.number().int().nonnegative().nullable(),
|
|
2181
|
+
options: import_zod8.z.array(StudioInterruptOptionSchema).nullable(),
|
|
2182
|
+
workflowId: import_zod8.z.string().min(1),
|
|
2183
|
+
nodeId: import_zod8.z.string().nullable(),
|
|
2184
|
+
sessionId: import_zod8.z.string().nullable(),
|
|
2185
|
+
userId: import_zod8.z.string().nullable(),
|
|
2186
|
+
tenantId: import_zod8.z.string().nullable(),
|
|
2187
|
+
response: import_zod8.z.string().nullable(),
|
|
2021
2188
|
responseValue: StudioInterruptValueSchema.nullable().default(null),
|
|
2022
|
-
responseCaptured:
|
|
2189
|
+
responseCaptured: import_zod8.z.boolean(),
|
|
2023
2190
|
resumeOutcome: StudioResumeOutcomeSchema.nullable(),
|
|
2024
|
-
resumeError:
|
|
2025
|
-
runId:
|
|
2026
|
-
resumeToken:
|
|
2027
|
-
resolvedBy:
|
|
2028
|
-
environment:
|
|
2191
|
+
resumeError: import_zod8.z.string().nullable(),
|
|
2192
|
+
runId: import_zod8.z.string().min(1),
|
|
2193
|
+
resumeToken: import_zod8.z.string().nullable(),
|
|
2194
|
+
resolvedBy: import_zod8.z.string().nullable(),
|
|
2195
|
+
environment: import_zod8.z.string().min(1)
|
|
2029
2196
|
}).strip();
|
|
2030
|
-
var StudioDetailEventSchema =
|
|
2031
|
-
id:
|
|
2197
|
+
var StudioDetailEventSchema = import_zod8.z.object({
|
|
2198
|
+
id: import_zod8.z.string().min(1),
|
|
2032
2199
|
// Studio readers must preserve future event kinds within the same API major.
|
|
2033
|
-
type:
|
|
2034
|
-
occurredAt:
|
|
2035
|
-
receivedAt:
|
|
2036
|
-
environment:
|
|
2037
|
-
serviceName:
|
|
2038
|
-
deploymentRef:
|
|
2039
|
-
traceId:
|
|
2040
|
-
spanId:
|
|
2041
|
-
parentSpanId:
|
|
2042
|
-
runId:
|
|
2043
|
-
sessionId:
|
|
2044
|
-
workflowId:
|
|
2045
|
-
workflowRevisionId:
|
|
2046
|
-
nodeId:
|
|
2047
|
-
userId:
|
|
2048
|
-
tenantId:
|
|
2049
|
-
tags:
|
|
2050
|
-
metadata:
|
|
2051
|
-
payload:
|
|
2200
|
+
type: import_zod8.z.string().min(1),
|
|
2201
|
+
occurredAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2202
|
+
receivedAt: import_zod8.z.string().datetime({ offset: true }),
|
|
2203
|
+
environment: import_zod8.z.string().min(1),
|
|
2204
|
+
serviceName: import_zod8.z.string().min(1),
|
|
2205
|
+
deploymentRef: import_zod8.z.string().nullable(),
|
|
2206
|
+
traceId: import_zod8.z.string().nullable(),
|
|
2207
|
+
spanId: import_zod8.z.string().nullable(),
|
|
2208
|
+
parentSpanId: import_zod8.z.string().nullable(),
|
|
2209
|
+
runId: import_zod8.z.string().min(1),
|
|
2210
|
+
sessionId: import_zod8.z.string().nullable(),
|
|
2211
|
+
workflowId: import_zod8.z.string().min(1),
|
|
2212
|
+
workflowRevisionId: import_zod8.z.string().nullable(),
|
|
2213
|
+
nodeId: import_zod8.z.string().nullable(),
|
|
2214
|
+
userId: import_zod8.z.string().nullable(),
|
|
2215
|
+
tenantId: import_zod8.z.string().nullable(),
|
|
2216
|
+
tags: import_zod8.z.array(import_zod8.z.string()),
|
|
2217
|
+
metadata: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown()).nullable(),
|
|
2218
|
+
payload: import_zod8.z.record(import_zod8.z.string(), import_zod8.z.unknown())
|
|
2052
2219
|
}).strip();
|
|
2053
|
-
var StudioWorkflowNodeSchema =
|
|
2054
|
-
tools:
|
|
2220
|
+
var StudioWorkflowNodeSchema = import_zod8.z.object({
|
|
2221
|
+
tools: import_zod8.z.array(StudioToolSchema).optional(),
|
|
2055
2222
|
toolDiscovery: ToolDiscoverySchema.optional(),
|
|
2056
|
-
id:
|
|
2057
|
-
label:
|
|
2058
|
-
type:
|
|
2059
|
-
state:
|
|
2060
|
-
provider:
|
|
2061
|
-
model:
|
|
2223
|
+
id: import_zod8.z.string().min(1),
|
|
2224
|
+
label: import_zod8.z.string(),
|
|
2225
|
+
type: import_zod8.z.string().nullable(),
|
|
2226
|
+
state: import_zod8.z.enum(["healthy", "warning", "failed", "interrupted", "retried"]).nullable(),
|
|
2227
|
+
provider: import_zod8.z.string().nullable(),
|
|
2228
|
+
model: import_zod8.z.string().nullable(),
|
|
2062
2229
|
metrics: StudioMetricSchema
|
|
2063
2230
|
}).strip();
|
|
2064
|
-
var StudioWorkflowInternalEdgeSchema =
|
|
2065
|
-
id:
|
|
2066
|
-
source:
|
|
2067
|
-
target:
|
|
2068
|
-
condition:
|
|
2231
|
+
var StudioWorkflowInternalEdgeSchema = import_zod8.z.object({
|
|
2232
|
+
id: import_zod8.z.string().min(1),
|
|
2233
|
+
source: import_zod8.z.string().min(1),
|
|
2234
|
+
target: import_zod8.z.string().min(1),
|
|
2235
|
+
condition: import_zod8.z.string().nullable()
|
|
2069
2236
|
}).strip();
|
|
2070
|
-
var StudioWorkflowTransitionSchema =
|
|
2071
|
-
kind:
|
|
2072
|
-
id:
|
|
2073
|
-
sourceWorkflowId:
|
|
2074
|
-
sourceNodeId:
|
|
2075
|
-
targetWorkflowId:
|
|
2076
|
-
condition:
|
|
2077
|
-
volume:
|
|
2078
|
-
successRate:
|
|
2079
|
-
medianDurationMs:
|
|
2080
|
-
errorRate:
|
|
2237
|
+
var StudioWorkflowTransitionSchema = import_zod8.z.object({
|
|
2238
|
+
kind: import_zod8.z.enum(["call", "handoff"]).optional(),
|
|
2239
|
+
id: import_zod8.z.string().min(1),
|
|
2240
|
+
sourceWorkflowId: import_zod8.z.string().min(1),
|
|
2241
|
+
sourceNodeId: import_zod8.z.string().nullable(),
|
|
2242
|
+
targetWorkflowId: import_zod8.z.string().min(1),
|
|
2243
|
+
condition: import_zod8.z.string().nullable(),
|
|
2244
|
+
volume: import_zod8.z.number().int().nonnegative(),
|
|
2245
|
+
successRate: import_zod8.z.number().min(0).max(100).nullable(),
|
|
2246
|
+
medianDurationMs: import_zod8.z.number().nonnegative().nullable(),
|
|
2247
|
+
errorRate: import_zod8.z.number().min(0).max(100).nullable()
|
|
2081
2248
|
}).strip();
|
|
2082
|
-
var StudioWorkflowSchema =
|
|
2083
|
-
id:
|
|
2084
|
-
name:
|
|
2085
|
-
description:
|
|
2086
|
-
versions:
|
|
2087
|
-
activeVersion:
|
|
2088
|
-
activeRevisionId:
|
|
2249
|
+
var StudioWorkflowSchema = import_zod8.z.object({
|
|
2250
|
+
id: import_zod8.z.string().min(1),
|
|
2251
|
+
name: import_zod8.z.string().min(1),
|
|
2252
|
+
description: import_zod8.z.string().nullable(),
|
|
2253
|
+
versions: import_zod8.z.array(import_zod8.z.string()),
|
|
2254
|
+
activeVersion: import_zod8.z.string().nullable(),
|
|
2255
|
+
activeRevisionId: import_zod8.z.string().nullable(),
|
|
2089
2256
|
health: StudioWorkflowHealthSchema,
|
|
2090
|
-
tags:
|
|
2091
|
-
lastActivityAt:
|
|
2257
|
+
tags: import_zod8.z.array(import_zod8.z.string()),
|
|
2258
|
+
lastActivityAt: import_zod8.z.string().datetime({ offset: true }).nullable(),
|
|
2092
2259
|
metrics: StudioMetricSchema,
|
|
2093
|
-
nodes:
|
|
2094
|
-
internalEdges:
|
|
2260
|
+
nodes: import_zod8.z.array(StudioWorkflowNodeSchema),
|
|
2261
|
+
internalEdges: import_zod8.z.array(StudioWorkflowInternalEdgeSchema)
|
|
2095
2262
|
}).strip();
|
|
2096
|
-
var StudioRunsResponseSchema =
|
|
2097
|
-
runs:
|
|
2098
|
-
totalCount:
|
|
2263
|
+
var StudioRunsResponseSchema = import_zod8.z.object({
|
|
2264
|
+
runs: import_zod8.z.array(StudioRunSchema),
|
|
2265
|
+
totalCount: import_zod8.z.number().int().nonnegative()
|
|
2099
2266
|
}).strip();
|
|
2100
|
-
var StudioSessionsResponseSchema =
|
|
2101
|
-
sessions:
|
|
2102
|
-
totalCount:
|
|
2267
|
+
var StudioSessionsResponseSchema = import_zod8.z.object({
|
|
2268
|
+
sessions: import_zod8.z.array(StudioSessionSchema),
|
|
2269
|
+
totalCount: import_zod8.z.number().int().nonnegative()
|
|
2103
2270
|
}).strip();
|
|
2104
|
-
var StudioInterruptsResponseSchema =
|
|
2105
|
-
interrupts:
|
|
2106
|
-
totalCount:
|
|
2271
|
+
var StudioInterruptsResponseSchema = import_zod8.z.object({
|
|
2272
|
+
interrupts: import_zod8.z.array(StudioInterruptSchema),
|
|
2273
|
+
totalCount: import_zod8.z.number().int().nonnegative()
|
|
2107
2274
|
}).strip();
|
|
2108
|
-
var StudioRunDetailResponseSchema =
|
|
2275
|
+
var StudioRunDetailResponseSchema = import_zod8.z.object({
|
|
2109
2276
|
run: StudioRunSchema,
|
|
2110
|
-
scores:
|
|
2111
|
-
canReview:
|
|
2112
|
-
reviewActorId:
|
|
2113
|
-
events:
|
|
2277
|
+
scores: import_zod8.z.array(StudioScoreSchema).optional(),
|
|
2278
|
+
canReview: import_zod8.z.boolean().optional(),
|
|
2279
|
+
reviewActorId: import_zod8.z.string().optional(),
|
|
2280
|
+
events: import_zod8.z.array(StudioDetailEventSchema),
|
|
2114
2281
|
session: StudioSessionSchema.nullable(),
|
|
2115
|
-
interrupts:
|
|
2116
|
-
updatedAt:
|
|
2282
|
+
interrupts: import_zod8.z.array(StudioInterruptSchema),
|
|
2283
|
+
updatedAt: import_zod8.z.string().datetime({ offset: true })
|
|
2117
2284
|
}).strip();
|
|
2118
|
-
var StudioSessionDetailResponseSchema =
|
|
2285
|
+
var StudioSessionDetailResponseSchema = import_zod8.z.object({
|
|
2119
2286
|
session: StudioSessionSchema,
|
|
2120
|
-
runs:
|
|
2121
|
-
events:
|
|
2122
|
-
interrupts:
|
|
2123
|
-
updatedAt:
|
|
2287
|
+
runs: import_zod8.z.array(StudioRunSchema),
|
|
2288
|
+
events: import_zod8.z.array(StudioDetailEventSchema),
|
|
2289
|
+
interrupts: import_zod8.z.array(StudioInterruptSchema),
|
|
2290
|
+
updatedAt: import_zod8.z.string().datetime({ offset: true })
|
|
2124
2291
|
}).strip();
|
|
2125
|
-
var StudioInterruptDetailResponseSchema =
|
|
2292
|
+
var StudioInterruptDetailResponseSchema = import_zod8.z.object({
|
|
2126
2293
|
interrupt: StudioInterruptSchema,
|
|
2127
|
-
events:
|
|
2294
|
+
events: import_zod8.z.array(StudioDetailEventSchema),
|
|
2128
2295
|
run: StudioRunSchema.nullable(),
|
|
2129
2296
|
session: StudioSessionSchema.nullable(),
|
|
2130
|
-
updatedAt:
|
|
2297
|
+
updatedAt: import_zod8.z.string().datetime({ offset: true })
|
|
2131
2298
|
}).strip();
|
|
2132
|
-
var StudioWorkflowsResponseSchema =
|
|
2133
|
-
workflows:
|
|
2134
|
-
observedCalls:
|
|
2299
|
+
var StudioWorkflowsResponseSchema = import_zod8.z.object({
|
|
2300
|
+
workflows: import_zod8.z.array(StudioWorkflowSchema),
|
|
2301
|
+
observedCalls: import_zod8.z.array(
|
|
2135
2302
|
StudioWorkflowTransitionSchema.extend({
|
|
2136
|
-
runId:
|
|
2137
|
-
invocationId:
|
|
2138
|
-
branchId:
|
|
2303
|
+
runId: import_zod8.z.string(),
|
|
2304
|
+
invocationId: import_zod8.z.string(),
|
|
2305
|
+
branchId: import_zod8.z.string()
|
|
2139
2306
|
})
|
|
2140
2307
|
).optional(),
|
|
2141
|
-
transitions:
|
|
2308
|
+
transitions: import_zod8.z.array(StudioWorkflowTransitionSchema),
|
|
2142
2309
|
cohort: StudioTimeRangeContextSchema.extend({
|
|
2143
|
-
workflowId:
|
|
2144
|
-
version:
|
|
2310
|
+
workflowId: import_zod8.z.string().nullable(),
|
|
2311
|
+
version: import_zod8.z.string().nullable()
|
|
2145
2312
|
}).strip()
|
|
2146
2313
|
}).strip();
|
|
2147
|
-
var StudioCatalogsResponseSchema =
|
|
2148
|
-
environments:
|
|
2149
|
-
providers:
|
|
2150
|
-
models:
|
|
2151
|
-
workflows:
|
|
2152
|
-
tags:
|
|
2314
|
+
var StudioCatalogsResponseSchema = import_zod8.z.object({
|
|
2315
|
+
environments: import_zod8.z.array(import_zod8.z.string()),
|
|
2316
|
+
providers: import_zod8.z.array(import_zod8.z.string()),
|
|
2317
|
+
models: import_zod8.z.array(import_zod8.z.string()),
|
|
2318
|
+
workflows: import_zod8.z.array(import_zod8.z.string()),
|
|
2319
|
+
tags: import_zod8.z.array(import_zod8.z.string())
|
|
2153
2320
|
}).strip();
|
|
2154
|
-
var StudioContextResponseSchema =
|
|
2155
|
-
|
|
2156
|
-
|
|
2321
|
+
var StudioContextResponseSchema = import_zod8.z.object({
|
|
2322
|
+
tablePreferenceScope: StudioTablePreferenceScopeSchema.nullable().optional(),
|
|
2323
|
+
organization: import_zod8.z.object({
|
|
2324
|
+
name: import_zod8.z.string().min(1)
|
|
2157
2325
|
}).strip(),
|
|
2158
|
-
project:
|
|
2159
|
-
name:
|
|
2326
|
+
project: import_zod8.z.object({
|
|
2327
|
+
name: import_zod8.z.string().min(1)
|
|
2160
2328
|
}).strip(),
|
|
2161
|
-
environments:
|
|
2162
|
-
apiKey:
|
|
2163
|
-
mode:
|
|
2164
|
-
scopes:
|
|
2329
|
+
environments: import_zod8.z.array(import_zod8.z.string()),
|
|
2330
|
+
apiKey: import_zod8.z.object({
|
|
2331
|
+
mode: import_zod8.z.enum(["test", "live"]),
|
|
2332
|
+
scopes: import_zod8.z.array(import_zod8.z.string())
|
|
2165
2333
|
}).strip().nullable(),
|
|
2166
|
-
api:
|
|
2167
|
-
status:
|
|
2168
|
-
service:
|
|
2169
|
-
version:
|
|
2334
|
+
api: import_zod8.z.object({
|
|
2335
|
+
status: import_zod8.z.literal("ok"),
|
|
2336
|
+
service: import_zod8.z.literal("kortyx-api"),
|
|
2337
|
+
version: import_zod8.z.string().min(1)
|
|
2170
2338
|
}).strip()
|
|
2171
2339
|
}).strip();
|
|
2172
2340
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2204,6 +2372,7 @@ var StudioContextResponseSchema = import_zod7.z.object({
|
|
|
2204
2372
|
PromptTransferRequestSchema,
|
|
2205
2373
|
PromptUsageSchema,
|
|
2206
2374
|
ReviewVerdictSchema,
|
|
2375
|
+
SAMPLE_PROJECT,
|
|
2207
2376
|
STUDIO_API_PROTOCOL_VERSION,
|
|
2208
2377
|
STUDIO_TABLE_FIELDS,
|
|
2209
2378
|
STUDIO_TIME_RANGES,
|
|
@@ -2233,11 +2402,23 @@ var StudioContextResponseSchema = import_zod7.z.object({
|
|
|
2233
2402
|
StudioRunSchema,
|
|
2234
2403
|
StudioRunStatusSchema,
|
|
2235
2404
|
StudioRunsResponseSchema,
|
|
2405
|
+
StudioSavedViewDefinitionSchema,
|
|
2236
2406
|
StudioScoreResponseSchema,
|
|
2237
2407
|
StudioScoreSchema,
|
|
2238
2408
|
StudioSessionDetailResponseSchema,
|
|
2239
2409
|
StudioSessionSchema,
|
|
2240
2410
|
StudioSessionsResponseSchema,
|
|
2411
|
+
StudioTableConfigurationSchema,
|
|
2412
|
+
StudioTableDefaultsSchema,
|
|
2413
|
+
StudioTableIdSchema,
|
|
2414
|
+
StudioTableLayoutSchema,
|
|
2415
|
+
StudioTablePreferenceOperationSchema,
|
|
2416
|
+
StudioTablePreferenceResponseSchema,
|
|
2417
|
+
StudioTablePreferenceScopeSchema,
|
|
2418
|
+
StudioTablePreferenceWriteSchema,
|
|
2419
|
+
StudioTablePreferencesSchema,
|
|
2420
|
+
StudioTableQueryPreferencesSchema,
|
|
2421
|
+
StudioTableViewSchema,
|
|
2241
2422
|
StudioTimeRangeContextSchema,
|
|
2242
2423
|
StudioTimeRangeQuerySchema,
|
|
2243
2424
|
StudioTimeRangeSchema,
|
|
@@ -2275,7 +2456,9 @@ var StudioContextResponseSchema = import_zod7.z.object({
|
|
|
2275
2456
|
WorkflowTopologyEdgeSchema,
|
|
2276
2457
|
WorkflowTopologyNodeSchema,
|
|
2277
2458
|
WorkflowTopologyTransitionSchema,
|
|
2459
|
+
applyTablePreferenceOperation,
|
|
2278
2460
|
captureDiagnosticContent,
|
|
2461
|
+
emptyTablePreferences,
|
|
2279
2462
|
filterOperators,
|
|
2280
2463
|
isPrivateDiagnosticField,
|
|
2281
2464
|
matchesTableFilters,
|