@kortyx/telemetry-contracts 0.17.2 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -28,11 +28,15 @@ __export(index_exports, {
28
28
  DiagnosticNoteSchema: () => DiagnosticNoteSchema,
29
29
  DiagnosticPartSchema: () => DiagnosticPartSchema,
30
30
  DiagnosticResponseSchema: () => DiagnosticResponseSchema,
31
+ EMPTY_TABLE_FILTERS: () => EMPTY_TABLE_FILTERS,
32
+ EVALUATION_TABLE_FILTER_FIELDS: () => EVALUATION_TABLE_FILTER_FIELDS,
31
33
  EnsureWorkflowTopologyRequestSchema: () => EnsureWorkflowTopologyRequestSchema,
32
34
  EnsureWorkflowTopologyResponseSchema: () => EnsureWorkflowTopologyResponseSchema,
33
35
  FEEDBACK_FILTERS: () => FEEDBACK_FILTERS,
34
36
  FeedbackReasonSchema: () => FeedbackReasonSchema,
35
37
  FeedbackSummarySchema: () => FeedbackSummarySchema,
38
+ LEGACY_TABLE_FILTERS: () => LEGACY_TABLE_FILTERS,
39
+ PROMPT_TABLE_FILTER_FIELDS: () => PROMPT_TABLE_FILTER_FIELDS,
36
40
  PromptAssetSchema: () => PromptAssetSchema,
37
41
  PromptAssignmentSchema: () => PromptAssignmentSchema,
38
42
  PromptBundleSchema: () => PromptBundleSchema,
@@ -49,6 +53,7 @@ __export(index_exports, {
49
53
  PromptUsageSchema: () => PromptUsageSchema,
50
54
  ReviewVerdictSchema: () => ReviewVerdictSchema,
51
55
  STUDIO_API_PROTOCOL_VERSION: () => STUDIO_API_PROTOCOL_VERSION,
56
+ STUDIO_TABLE_FIELDS: () => STUDIO_TABLE_FIELDS,
52
57
  STUDIO_TIME_RANGES: () => STUDIO_TIME_RANGES,
53
58
  StudioCatalogsResponseSchema: () => StudioCatalogsResponseSchema,
54
59
  StudioChangeResourceSchema: () => StudioChangeResourceSchema,
@@ -95,6 +100,8 @@ __export(index_exports, {
95
100
  StudioWorkflowTransitionSchema: () => StudioWorkflowTransitionSchema,
96
101
  StudioWorkflowsResponseSchema: () => StudioWorkflowsResponseSchema,
97
102
  TELEMETRY_EVENT_TYPES: () => TELEMETRY_EVENT_TYPES,
103
+ TableFilterRuleSchema: () => TableFilterRuleSchema,
104
+ TableFiltersSchema: () => TableFiltersSchema,
98
105
  TelemetryEventBatchResponseSchema: () => TelemetryEventBatchResponseSchema,
99
106
  TelemetryEventBatchSchema: () => TelemetryEventBatchSchema,
100
107
  TelemetryEventSchema: () => TelemetryEventSchema,
@@ -116,19 +123,27 @@ __export(index_exports, {
116
123
  WorkflowTopologyEdgeSchema: () => WorkflowTopologyEdgeSchema,
117
124
  WorkflowTopologyNodeSchema: () => WorkflowTopologyNodeSchema,
118
125
  WorkflowTopologyTransitionSchema: () => WorkflowTopologyTransitionSchema,
126
+ captureDiagnosticContent: () => captureDiagnosticContent,
127
+ filterOperators: () => filterOperators,
119
128
  isPrivateDiagnosticField: () => isPrivateDiagnosticField,
129
+ matchesTableFilters: () => matchesTableFilters,
130
+ matchesTableRule: () => matchesTableRule,
120
131
  newerStudioVersion: () => newerStudioVersion,
121
132
  projectWorkflowCalls: () => projectWorkflowCalls,
133
+ readStudioTableFilters: () => readStudioTableFilters,
122
134
  redactDiagnosticContent: () => redactDiagnosticContent,
123
135
  redactDiagnosticText: () => redactDiagnosticText,
124
136
  resolveStudioInterruptStatus: () => resolveStudioInterruptStatus,
125
137
  resolveStudioTimeRange: () => resolveStudioTimeRange,
126
138
  studioUpdateRunning: () => studioUpdateRunning,
127
139
  summarizeDiagnostic: () => summarizeDiagnostic,
128
- summarizeUserFeedback: () => summarizeUserFeedback
140
+ summarizeUserFeedback: () => summarizeUserFeedback,
141
+ tablePassRate: () => tablePassRate,
142
+ tableQueueMs: () => tableQueueMs,
143
+ validateTableFilters: () => validateTableFilters
129
144
  });
130
145
  module.exports = __toCommonJS(index_exports);
131
- var import_zod6 = require("zod");
146
+ var import_zod7 = require("zod");
132
147
 
133
148
  // src/scores.ts
134
149
  var import_zod = require("zod");
@@ -230,6 +245,11 @@ var DiagnosticContentSchema = import_zod2.z.object({
230
245
  }).strict();
231
246
  var DiagnosticCorrelationSchema = import_zod2.z.object({
232
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(),
233
253
  workflowId: import_zod2.z.string().optional(),
234
254
  nodeId: import_zod2.z.string().optional(),
235
255
  sessionId: import_zod2.z.string().optional(),
@@ -457,6 +477,243 @@ var StudioToolSchema = WorkflowToolSchema.extend({
457
477
  p95DurationMs: import_zod3.z.number().nonnegative().nullable()
458
478
  }).strict();
459
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);
500
+ }
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
+ });
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
+ }
516
+ var pointer = (key) => key.replace(/~/g, "~0").replace(/\//g, "~1");
517
+ function captureDiagnosticContent(error, project) {
518
+ const omissions = [];
519
+ const redactions = [];
520
+ const seen = /* @__PURE__ */ new WeakMap();
521
+ let nodes = 0;
522
+ let remaining = DIAGNOSTIC_LIMITS.bytes - 64 * 1024;
523
+ const omit = (path, reason, extra = {}) => {
524
+ if (omissions.length < 1e3)
525
+ omissions.push({ path: path.slice(0, 4096), reason, ...extra });
526
+ return { $omitted: reason };
527
+ };
528
+ const visit = (value, path, depth) => {
529
+ if (++nodes > DIAGNOSTIC_LIMITS.nodes) return omit(path, "node_limit");
530
+ if (depth > DIAGNOSTIC_LIMITS.depth) return omit(path, "depth_limit");
531
+ if (typeof value === "string") {
532
+ const clean = redactDiagnosticText(value);
533
+ if (clean !== value && redactions.length < 1e3)
534
+ redactions.push({
535
+ path: path.slice(0, 4096),
536
+ reason: "credential_text"
537
+ });
538
+ const bytes = encoder.encode(JSON.stringify(clean)).length;
539
+ if (bytes > remaining)
540
+ return omit(path, "byte_limit", {
541
+ originalBytes: encoder.encode(value).length
542
+ });
543
+ remaining -= bytes;
544
+ return clean;
545
+ }
546
+ if (value === null || typeof value === "boolean") return value;
547
+ if (typeof value === "number")
548
+ return Number.isFinite(value) ? value : { $type: "number", value: String(value) };
549
+ if (typeof value === "bigint")
550
+ return { $type: "bigint", value: value.toString() };
551
+ if (typeof value === "undefined") return { $type: "undefined" };
552
+ if (typeof value === "function" || typeof value === "symbol")
553
+ return omit(path, `unsupported_${typeof value}`);
554
+ const object = value;
555
+ const reference = seen.get(object);
556
+ if (reference) return { $ref: reference };
557
+ seen.set(object, path);
558
+ remaining -= 32;
559
+ if (remaining < 0) return omit(path, "byte_limit");
560
+ try {
561
+ if (value instanceof Date)
562
+ return { $type: "Date", value: Date.prototype.toISOString.call(value) };
563
+ if (value instanceof Map || value instanceof Set) {
564
+ const isMap = value instanceof Map;
565
+ const iterator = isMap ? Map.prototype.entries.call(value) : Set.prototype.values.call(value);
566
+ const count = Object.getOwnPropertyDescriptor(
567
+ isMap ? Map.prototype : Set.prototype,
568
+ "size"
569
+ )?.get?.call(value);
570
+ const entries = [];
571
+ for (let index = 0; index < Math.min(count, DIAGNOSTIC_LIMITS.properties); index++)
572
+ entries.push(iterator.next().value);
573
+ if (count > entries.length)
574
+ omissions.push({
575
+ path,
576
+ reason: "collection_limit",
577
+ originalCount: count
578
+ });
579
+ return isMap ? {
580
+ $type: "Map",
581
+ entries: visit(entries, `${path}/entries`, depth + 1)
582
+ } : {
583
+ $type: "Set",
584
+ values: visit(entries, `${path}/values`, depth + 1)
585
+ };
586
+ }
587
+ if (Array.isArray(value)) {
588
+ const count = Math.min(value.length, DIAGNOSTIC_LIMITS.properties);
589
+ const items = Array.from(
590
+ { length: count },
591
+ (_, index) => read(value, String(index), `${path}/${index}`, depth)
592
+ );
593
+ if (count < value.length)
594
+ items.push(
595
+ omit(path, "collection_limit", { originalCount: value.length })
596
+ );
597
+ return items;
598
+ }
599
+ const keys = Object.getOwnPropertyNames(object);
600
+ const result = /* @__PURE__ */ Object.create(null);
601
+ if (value instanceof Error) {
602
+ const ownName = Object.getOwnPropertyDescriptor(object, "name");
603
+ let type = ownName && "value" in ownName ? ownName.value : void 0;
604
+ if (typeof type !== "string") {
605
+ const name2 = Object.getOwnPropertyDescriptor(
606
+ Object.getPrototypeOf(value),
607
+ "name"
608
+ );
609
+ type = name2 && "value" in name2 ? name2.value : "Error";
610
+ }
611
+ result.type = visit(
612
+ typeof type === "string" ? type : "Error",
613
+ `${path}/type`,
614
+ depth + 1
615
+ );
616
+ }
617
+ for (const key of keys.slice(0, DIAGNOSTIC_LIMITS.properties)) {
618
+ if (["__proto__", "constructor", "prototype"].includes(key)) {
619
+ result[key] = omit(`${path}/${pointer(key)}`, "unsafe_key");
620
+ continue;
621
+ }
622
+ remaining -= encoder.encode(key).length + 4;
623
+ result[key] = read(object, key, `${path}/${pointer(key)}`, depth);
624
+ }
625
+ if (keys.length > DIAGNOSTIC_LIMITS.properties)
626
+ result.$omittedProperties = omit(path, "property_limit", {
627
+ originalCount: keys.length
628
+ });
629
+ return result;
630
+ } catch {
631
+ return omit(path, "unreadable_object");
632
+ }
633
+ };
634
+ const read = (object, key, path, depth) => {
635
+ if (isPrivateDiagnosticField(key)) {
636
+ if (redactions.length < 1e3)
637
+ redactions.push({
638
+ path: path.slice(0, 4096),
639
+ reason: "credential_field"
640
+ });
641
+ return "[REDACTED]";
642
+ }
643
+ try {
644
+ const property = Object.getOwnPropertyDescriptor(object, key);
645
+ if (property && "value" in property)
646
+ return visit(property.value, path, depth + 1);
647
+ if (key === "stack" && object instanceof Error && property?.get && property.get === nativeStackGetter)
648
+ return visit(nativeStack(object, property.get), path, depth + 1);
649
+ return omit(
650
+ path,
651
+ property ? "accessor_not_evaluated" : "unavailable_property"
652
+ );
653
+ } catch {
654
+ return omit(path, "unreadable_property");
655
+ }
656
+ };
657
+ try {
658
+ const original = project ? project(error) : error;
659
+ if (project && original === null) return null;
660
+ const captured = visit(original, "#/data", 0);
661
+ const upstreamOmissions = (0, import_errors.errorProperty)(original, "diagnosticOmissions");
662
+ if (Array.isArray(upstreamOmissions))
663
+ for (const note of upstreamOmissions.slice(0, 1e3)) {
664
+ const path = (0, import_errors.errorProperty)(note, "path");
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
+ };
714
+ }
715
+ }
716
+
460
717
  // src/prompts.ts
461
718
  var import_browser = require("@kortyx/prompts/browser");
462
719
  var import_zod4 = require("zod");
@@ -821,6 +1078,314 @@ function studioUpdateRunning(operation) {
821
1078
  return !!operation && operation.phase !== "succeeded" && operation.phase !== "failed";
822
1079
  }
823
1080
 
1081
+ // src/table-filters.ts
1082
+ var import_zod6 = require("zod");
1083
+ var TableFilterRuleSchema = import_zod6.z.object({
1084
+ field: import_zod6.z.string().min(1).max(80),
1085
+ operator: import_zod6.z.enum([
1086
+ "contains",
1087
+ "notContains",
1088
+ "is",
1089
+ "isNot",
1090
+ "gt",
1091
+ "gte",
1092
+ "lt",
1093
+ "lte",
1094
+ "between",
1095
+ "present",
1096
+ "missing"
1097
+ ]),
1098
+ values: import_zod6.z.array(
1099
+ import_zod6.z.union([import_zod6.z.string().min(1).max(512), import_zod6.z.number().finite(), import_zod6.z.boolean()])
1100
+ ).max(30)
1101
+ }).strict();
1102
+ var TableFiltersSchema = import_zod6.z.object({
1103
+ match: import_zod6.z.enum(["all", "any"]),
1104
+ rules: import_zod6.z.array(TableFilterRuleSchema).max(32)
1105
+ }).strict().refine(
1106
+ (value) => JSON.stringify(value).length <= 32768,
1107
+ "Filters must fit within 32 KiB."
1108
+ );
1109
+ var EMPTY_TABLE_FILTERS = { match: "all", rules: [] };
1110
+ var filterOperators = (kind) => [
1111
+ ...kind === "text" ? ["contains", "notContains"] : [],
1112
+ "is",
1113
+ "isNot",
1114
+ ...kind === "number" || kind === "date" ? ["gt", "gte", "lt", "lte", "between"] : [],
1115
+ "present",
1116
+ "missing"
1117
+ ];
1118
+ function validateTableFilters(filters, fields) {
1119
+ const parsed = TableFiltersSchema.safeParse(filters);
1120
+ if (!parsed.success) throw new Error("Enter valid values for every filter.");
1121
+ for (const rule of filters.rules) {
1122
+ const field2 = fields.find((item) => item.key === rule.field);
1123
+ if (!field2 || !filterOperators(field2.kind).includes(rule.operator))
1124
+ throw new Error("Unsupported filter field or operator.");
1125
+ const noValue = rule.operator === "present" || rule.operator === "missing";
1126
+ if (noValue ? rule.values.length !== 0 : rule.operator === "between" ? rule.values.length !== 2 : !rule.values.length)
1127
+ throw new Error("Invalid number of filter values.");
1128
+ for (const value of rule.values) {
1129
+ if (field2.kind === "number" && typeof value !== "number")
1130
+ throw new Error("Numeric filters require numbers.");
1131
+ if (field2.kind === "boolean" && typeof value !== "boolean")
1132
+ throw new Error("Boolean filters require true or false.");
1133
+ if ((field2.kind === "text" || field2.kind === "enum" || field2.kind === "date") && typeof value !== "string")
1134
+ throw new Error("Text filters require strings.");
1135
+ if (field2.kind === "date" && (typeof value !== "string" || !Number.isFinite(Date.parse(value)) || !/(Z|[+-]\d{2}:\d{2})$/.test(value)))
1136
+ throw new Error("Date filters require ISO timestamps with an offset.");
1137
+ }
1138
+ 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])))
1139
+ throw new Error("Filter minimum must not exceed maximum.");
1140
+ }
1141
+ return filters;
1142
+ }
1143
+ function matchesTableRule(value, rule, kind) {
1144
+ const values = (Array.isArray(value) ? value : [value]).filter(
1145
+ (item) => item !== null && item !== void 0 && item !== ""
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;
1180
+ }
1181
+ });
1182
+ }
1183
+ function matchesTableFilters(filters, read, fields) {
1184
+ if (!filters.rules.length) return true;
1185
+ const match = (rule) => matchesTableRule(
1186
+ read(rule.field),
1187
+ rule,
1188
+ fields?.find((f) => f.key === rule.field)?.kind
1189
+ );
1190
+ return filters.match === "any" ? filters.rules.some(match) : filters.rules.every(match);
1191
+ }
1192
+ var field = (key, label, kind = "text", unit) => ({ key, label, kind, ...unit ? { unit } : {} });
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;
1324
+ }
1325
+ const key = resource === "sessions" && alias === "provider" ? "providers" : resource === "sessions" && alias === "version" ? "activeVersion" : resource === "interrupts" && alias === "workflow" ? "workflowId" : original;
1326
+ const definition = fields.find((f) => f.key === key);
1327
+ if (!definition) continue;
1328
+ 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];
1329
+ rules.push({
1330
+ field: key,
1331
+ operator: resource === "interrupts" && alias === "workflow" ? "contains" : operator,
1332
+ values
1333
+ });
1334
+ }
1335
+ return validateTableFilters(
1336
+ TableFiltersSchema.parse({ ...filters, rules }),
1337
+ fields
1338
+ );
1339
+ }
1340
+ var PROMPT_TABLE_FILTER_FIELDS = [
1341
+ field("name", "Prompt"),
1342
+ field("key", "Key"),
1343
+ field("category", "Category"),
1344
+ field("categoryId", "Category ID"),
1345
+ field("live", "Is live", "boolean"),
1346
+ field("liveVersion", "Live version", "number"),
1347
+ field("latestVersion", "Newest version", "number"),
1348
+ field("updatedAt", "Updated", "date"),
1349
+ field("assignedTags", "Assigned tags"),
1350
+ field("assignedVersions", "Assigned versions"),
1351
+ field("versionsBehindLive", "Versions behind live", "number")
1352
+ ];
1353
+ var EVALUATION_TABLE_FILTER_FIELDS = [
1354
+ field("name", "Evaluation run"),
1355
+ field("id", "Evaluation ID"),
1356
+ field("selection", "Suite selection", "enum"),
1357
+ field("suiteCount", "Suites", "number"),
1358
+ field("judge", "Judge"),
1359
+ field("judgeVersion", "Judge version"),
1360
+ field("passRate", "Pass rate (%)", "number"),
1361
+ field("queueMs", "Queue time (ms)", "number"),
1362
+ field("status", "Status", "enum"),
1363
+ field("completedSuites", "Completed suites", "number"),
1364
+ field("completedAttempts", "Graded attempts", "number"),
1365
+ field("totalAttempts", "Total attempts", "number"),
1366
+ field("passed", "Passed", "number"),
1367
+ field("failed", "Failed", "number"),
1368
+ field("error", "Errors", "number"),
1369
+ field("cancelled", "Cancelled", "number"),
1370
+ field("applicationId", "Application ID"),
1371
+ field("application", "Application"),
1372
+ field("environment", "Environment", "enum"),
1373
+ field("trigger", "Trigger", "enum"),
1374
+ field("commit", "Commit"),
1375
+ field("createdAt", "Created", "date"),
1376
+ field("cost", "Cost", "number"),
1377
+ field("duration", "Duration (ms)", "number")
1378
+ ];
1379
+ function tablePassRate(counts) {
1380
+ const total = counts ? counts.passed + counts.failed + counts.error : 0;
1381
+ return counts && total > 0 ? counts.passed / total * 100 : void 0;
1382
+ }
1383
+ function tableQueueMs(createdAt, startedAt) {
1384
+ if (!startedAt) return void 0;
1385
+ const value = Date.parse(startedAt) - Date.parse(createdAt);
1386
+ return Number.isFinite(value) && value >= 0 ? value : void 0;
1387
+ }
1388
+
824
1389
  // src/workflow-calls.ts
825
1390
  var str = (v, fallback = "") => typeof v === "string" ? v : fallback;
826
1391
  function projectWorkflowCalls(events) {
@@ -960,82 +1525,82 @@ var TELEMETRY_EVENT_TYPES = [
960
1525
  "session.forked",
961
1526
  "session.rolled_back"
962
1527
  ];
963
- var TelemetryServiceSchema = import_zod6.z.object({
964
- name: import_zod6.z.string().min(1),
965
- deploymentRef: import_zod6.z.string().min(1).optional()
1528
+ var TelemetryServiceSchema = import_zod7.z.object({
1529
+ name: import_zod7.z.string().min(1),
1530
+ deploymentRef: import_zod7.z.string().min(1).optional()
966
1531
  }).strict();
967
- var WorkflowTopologyNodeSchema = import_zod6.z.object({
968
- id: import_zod6.z.string().min(1),
969
- label: import_zod6.z.string().optional(),
970
- type: import_zod6.z.string().optional(),
971
- provider: import_zod6.z.string().optional(),
972
- model: import_zod6.z.string().optional(),
973
- metadata: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
974
- tools: import_zod6.z.array(WorkflowToolSchema).optional(),
1532
+ var WorkflowTopologyNodeSchema = import_zod7.z.object({
1533
+ id: import_zod7.z.string().min(1),
1534
+ label: import_zod7.z.string().optional(),
1535
+ type: import_zod7.z.string().optional(),
1536
+ provider: import_zod7.z.string().optional(),
1537
+ model: import_zod7.z.string().optional(),
1538
+ metadata: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional(),
1539
+ tools: import_zod7.z.array(WorkflowToolSchema).optional(),
975
1540
  toolDiscovery: ToolDiscoverySchema.optional()
976
1541
  }).strict();
977
- var WorkflowTopologyEdgeSchema = import_zod6.z.object({
978
- sourceNodeId: import_zod6.z.string().min(1),
979
- targetNodeId: import_zod6.z.string().min(1),
980
- condition: import_zod6.z.string().optional()
1542
+ var WorkflowTopologyEdgeSchema = import_zod7.z.object({
1543
+ sourceNodeId: import_zod7.z.string().min(1),
1544
+ targetNodeId: import_zod7.z.string().min(1),
1545
+ condition: import_zod7.z.string().optional()
981
1546
  }).strict();
982
- var WorkflowTopologyCallSchema = import_zod6.z.object({
983
- sourceNodeId: import_zod6.z.string().min(1),
984
- targetWorkflowId: import_zod6.z.string().min(1)
1547
+ var WorkflowTopologyCallSchema = import_zod7.z.object({
1548
+ sourceNodeId: import_zod7.z.string().min(1),
1549
+ targetWorkflowId: import_zod7.z.string().min(1)
985
1550
  }).strict();
986
- var WorkflowTopologyTransitionSchema = import_zod6.z.object({
987
- sourceNodeId: import_zod6.z.string().min(1).optional(),
988
- targetWorkflowId: import_zod6.z.string().min(1),
989
- condition: import_zod6.z.string().optional(),
990
- intent: import_zod6.z.string().optional(),
991
- kind: import_zod6.z.enum(["call", "handoff"]).optional()
1551
+ var WorkflowTopologyTransitionSchema = import_zod7.z.object({
1552
+ sourceNodeId: import_zod7.z.string().min(1).optional(),
1553
+ targetWorkflowId: import_zod7.z.string().min(1),
1554
+ condition: import_zod7.z.string().optional(),
1555
+ intent: import_zod7.z.string().optional(),
1556
+ kind: import_zod7.z.enum(["call", "handoff"]).optional()
992
1557
  }).strict();
993
- var EnsureWorkflowTopologyRequestSchema = import_zod6.z.object({
994
- schemaVersion: import_zod6.z.literal(1),
995
- environment: import_zod6.z.string().min(1),
1558
+ var EnsureWorkflowTopologyRequestSchema = import_zod7.z.object({
1559
+ schemaVersion: import_zod7.z.literal(1),
1560
+ environment: import_zod7.z.string().min(1),
996
1561
  service: TelemetryServiceSchema,
997
- workflow: import_zod6.z.object({
998
- id: import_zod6.z.string().min(1),
999
- declaredVersion: import_zod6.z.string().min(1),
1000
- description: import_zod6.z.string().optional(),
1001
- tags: import_zod6.z.array(import_zod6.z.string()).optional(),
1002
- topologyHash: import_zod6.z.string().regex(/^[a-f0-9]{64}$/),
1003
- nodes: import_zod6.z.array(WorkflowTopologyNodeSchema),
1004
- edges: import_zod6.z.array(WorkflowTopologyEdgeSchema),
1005
- transitions: import_zod6.z.array(WorkflowTopologyTransitionSchema).optional(),
1006
- calls: import_zod6.z.array(WorkflowTopologyCallSchema).optional()
1562
+ workflow: import_zod7.z.object({
1563
+ id: import_zod7.z.string().min(1),
1564
+ declaredVersion: import_zod7.z.string().min(1),
1565
+ description: import_zod7.z.string().optional(),
1566
+ tags: import_zod7.z.array(import_zod7.z.string()).optional(),
1567
+ topologyHash: import_zod7.z.string().regex(/^[a-f0-9]{64}$/),
1568
+ nodes: import_zod7.z.array(WorkflowTopologyNodeSchema),
1569
+ edges: import_zod7.z.array(WorkflowTopologyEdgeSchema),
1570
+ transitions: import_zod7.z.array(WorkflowTopologyTransitionSchema).optional(),
1571
+ calls: import_zod7.z.array(WorkflowTopologyCallSchema).optional()
1007
1572
  }).strict()
1008
1573
  }).strict();
1009
- var EnsureWorkflowTopologyResponseSchema = import_zod6.z.object({ workflowRevisionId: import_zod6.z.string().min(1), created: import_zod6.z.boolean() }).strict();
1010
- var TelemetryEventTypeSchema = import_zod6.z.enum(TELEMETRY_EVENT_TYPES);
1011
- var TelemetryEventSchema = import_zod6.z.object({
1012
- schemaVersion: import_zod6.z.literal(1),
1013
- eventId: import_zod6.z.string().min(1),
1014
- occurredAt: import_zod6.z.string().datetime({ offset: true }),
1015
- environment: import_zod6.z.string().min(1),
1574
+ var EnsureWorkflowTopologyResponseSchema = import_zod7.z.object({ workflowRevisionId: import_zod7.z.string().min(1), created: import_zod7.z.boolean() }).strict();
1575
+ var TelemetryEventTypeSchema = import_zod7.z.enum(TELEMETRY_EVENT_TYPES);
1576
+ var TelemetryEventSchema = import_zod7.z.object({
1577
+ schemaVersion: import_zod7.z.literal(1),
1578
+ eventId: import_zod7.z.string().min(1),
1579
+ occurredAt: import_zod7.z.string().datetime({ offset: true }),
1580
+ environment: import_zod7.z.string().min(1),
1016
1581
  service: TelemetryServiceSchema,
1017
- correlation: import_zod6.z.object({
1018
- invocationId: import_zod6.z.string().optional(),
1019
- parentInvocationId: import_zod6.z.string().optional(),
1020
- branchId: import_zod6.z.string().optional(),
1021
- traceId: import_zod6.z.string().optional(),
1022
- spanId: import_zod6.z.string().optional(),
1023
- parentSpanId: import_zod6.z.string().optional(),
1024
- runId: import_zod6.z.string().min(1),
1025
- sessionId: import_zod6.z.string().optional(),
1026
- workflowId: import_zod6.z.string().min(1),
1027
- workflowRevisionId: import_zod6.z.string().optional(),
1028
- topologyHash: import_zod6.z.string().regex(/^[a-f0-9]{64}$/).optional(),
1029
- nodeId: import_zod6.z.string().optional()
1582
+ correlation: import_zod7.z.object({
1583
+ invocationId: import_zod7.z.string().optional(),
1584
+ parentInvocationId: import_zod7.z.string().optional(),
1585
+ branchId: import_zod7.z.string().optional(),
1586
+ traceId: import_zod7.z.string().optional(),
1587
+ spanId: import_zod7.z.string().optional(),
1588
+ parentSpanId: import_zod7.z.string().optional(),
1589
+ runId: import_zod7.z.string().min(1),
1590
+ sessionId: import_zod7.z.string().optional(),
1591
+ workflowId: import_zod7.z.string().min(1),
1592
+ workflowRevisionId: import_zod7.z.string().optional(),
1593
+ topologyHash: import_zod7.z.string().regex(/^[a-f0-9]{64}$/).optional(),
1594
+ nodeId: import_zod7.z.string().optional()
1030
1595
  }).strict(),
1031
- context: import_zod6.z.object({
1032
- userId: import_zod6.z.string().optional(),
1033
- tenantId: import_zod6.z.string().optional(),
1034
- tags: import_zod6.z.array(import_zod6.z.string()).optional(),
1035
- metadata: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional()
1596
+ context: import_zod7.z.object({
1597
+ userId: import_zod7.z.string().optional(),
1598
+ tenantId: import_zod7.z.string().optional(),
1599
+ tags: import_zod7.z.array(import_zod7.z.string()).optional(),
1600
+ metadata: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional()
1036
1601
  }).strict().optional(),
1037
1602
  type: TelemetryEventTypeSchema,
1038
- payload: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown())
1603
+ payload: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown())
1039
1604
  }).strict().superRefine((event, ctx) => {
1040
1605
  if (!event.type.startsWith("tool.")) return;
1041
1606
  const canonical = event.payload.version === 1 || [
@@ -1078,20 +1643,20 @@ var TelemetryEventSchema = import_zod6.z.object({
1078
1643
  });
1079
1644
  }
1080
1645
  });
1081
- var TelemetryEventBatchSchema = import_zod6.z.object({ events: import_zod6.z.array(TelemetryEventSchema).min(1) }).strict();
1082
- var TelemetryEventBatchResponseSchema = import_zod6.z.object({
1083
- accepted: import_zod6.z.number().int().nonnegative(),
1084
- inserted: import_zod6.z.number().int().nonnegative(),
1085
- duplicates: import_zod6.z.number().int().nonnegative()
1646
+ var TelemetryEventBatchSchema = import_zod7.z.object({ events: import_zod7.z.array(TelemetryEventSchema).min(1) }).strict();
1647
+ var TelemetryEventBatchResponseSchema = import_zod7.z.object({
1648
+ accepted: import_zod7.z.number().int().nonnegative(),
1649
+ inserted: import_zod7.z.number().int().nonnegative(),
1650
+ duplicates: import_zod7.z.number().int().nonnegative()
1086
1651
  }).strict();
1087
- var TelemetryPricingSourceSchema = import_zod6.z.enum([
1652
+ var TelemetryPricingSourceSchema = import_zod7.z.enum([
1088
1653
  "sdk",
1089
1654
  "provider",
1090
1655
  "custom",
1091
1656
  "project-rate-card",
1092
1657
  "default-rate-card"
1093
1658
  ]);
1094
- var TelemetryPricingUnitSchema = import_zod6.z.enum([
1659
+ var TelemetryPricingUnitSchema = import_zod7.z.enum([
1095
1660
  "token",
1096
1661
  "character",
1097
1662
  "request",
@@ -1104,7 +1669,7 @@ var TelemetryPricingUnitSchema = import_zod6.z.enum([
1104
1669
  "minute",
1105
1670
  "custom"
1106
1671
  ]);
1107
- var TelemetryPricingUsageTypeSchema = import_zod6.z.enum([
1672
+ var TelemetryPricingUsageTypeSchema = import_zod7.z.enum([
1108
1673
  "input",
1109
1674
  "output",
1110
1675
  "reasoning",
@@ -1120,42 +1685,42 @@ var TelemetryPricingUsageTypeSchema = import_zod6.z.enum([
1120
1685
  "request",
1121
1686
  "custom"
1122
1687
  ]);
1123
- var TelemetryUsageItemSchema = import_zod6.z.object({
1688
+ var TelemetryUsageItemSchema = import_zod7.z.object({
1124
1689
  usageType: TelemetryPricingUsageTypeSchema,
1125
- quantity: import_zod6.z.number().nonnegative(),
1690
+ quantity: import_zod7.z.number().nonnegative(),
1126
1691
  unit: TelemetryPricingUnitSchema,
1127
- label: import_zod6.z.string().optional()
1692
+ label: import_zod7.z.string().optional()
1128
1693
  }).strict();
1129
- var TelemetryUnitPriceSchema = import_zod6.z.object({
1694
+ var TelemetryUnitPriceSchema = import_zod7.z.object({
1130
1695
  usageType: TelemetryPricingUsageTypeSchema,
1131
1696
  unit: TelemetryPricingUnitSchema,
1132
- unitQuantity: import_zod6.z.number().positive().default(1),
1133
- priceMicros: import_zod6.z.number().int().nonnegative(),
1134
- label: import_zod6.z.string().optional()
1697
+ unitQuantity: import_zod7.z.number().positive().default(1),
1698
+ priceMicros: import_zod7.z.number().int().nonnegative(),
1699
+ label: import_zod7.z.string().optional()
1135
1700
  }).strict();
1136
- var TelemetryPricingLineItemSchema = import_zod6.z.object({
1701
+ var TelemetryPricingLineItemSchema = import_zod7.z.object({
1137
1702
  usageType: TelemetryPricingUsageTypeSchema,
1138
- quantity: import_zod6.z.number().nonnegative(),
1703
+ quantity: import_zod7.z.number().nonnegative(),
1139
1704
  unit: TelemetryPricingUnitSchema,
1140
- unitQuantity: import_zod6.z.number().positive().default(1),
1141
- unitPriceMicros: import_zod6.z.number().int().nonnegative().optional(),
1142
- totalCostMicros: import_zod6.z.number().int().nonnegative().optional(),
1143
- label: import_zod6.z.string().optional()
1705
+ unitQuantity: import_zod7.z.number().positive().default(1),
1706
+ unitPriceMicros: import_zod7.z.number().int().nonnegative().optional(),
1707
+ totalCostMicros: import_zod7.z.number().int().nonnegative().optional(),
1708
+ label: import_zod7.z.string().optional()
1144
1709
  }).strict().refine(
1145
1710
  (value) => value.totalCostMicros !== void 0 || value.unitPriceMicros !== void 0,
1146
1711
  "line item requires totalCostMicros or unitPriceMicros"
1147
1712
  );
1148
- var TelemetryPricingHintSchema = import_zod6.z.object({
1713
+ var TelemetryPricingHintSchema = import_zod7.z.object({
1149
1714
  source: TelemetryPricingSourceSchema.extract(["sdk", "provider", "custom"]),
1150
- currency: import_zod6.z.string().min(3).max(12).default("USD"),
1151
- actualCostMicros: import_zod6.z.number().int().nonnegative().optional(),
1152
- lineItems: import_zod6.z.array(TelemetryPricingLineItemSchema).optional(),
1153
- unitPrices: import_zod6.z.array(TelemetryUnitPriceSchema).optional(),
1154
- usageItems: import_zod6.z.array(TelemetryUsageItemSchema).optional(),
1155
- pricingRef: import_zod6.z.string().min(1).optional(),
1156
- metadata: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional()
1715
+ currency: import_zod7.z.string().min(3).max(12).default("USD"),
1716
+ actualCostMicros: import_zod7.z.number().int().nonnegative().optional(),
1717
+ lineItems: import_zod7.z.array(TelemetryPricingLineItemSchema).optional(),
1718
+ unitPrices: import_zod7.z.array(TelemetryUnitPriceSchema).optional(),
1719
+ usageItems: import_zod7.z.array(TelemetryUsageItemSchema).optional(),
1720
+ pricingRef: import_zod7.z.string().min(1).optional(),
1721
+ metadata: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional()
1157
1722
  }).strict();
1158
- var StudioRunStatusSchema = import_zod6.z.enum([
1723
+ var StudioRunStatusSchema = import_zod7.z.enum([
1159
1724
  "running",
1160
1725
  "completed",
1161
1726
  "interrupted",
@@ -1171,16 +1736,16 @@ var STUDIO_TIME_RANGES = [
1171
1736
  "All time",
1172
1737
  "Custom range"
1173
1738
  ];
1174
- var StudioTimeRangeSchema = import_zod6.z.enum(STUDIO_TIME_RANGES);
1175
- var StudioTimeRangeQuerySchema = import_zod6.z.object({
1739
+ var StudioTimeRangeSchema = import_zod7.z.enum(STUDIO_TIME_RANGES);
1740
+ var StudioTimeRangeQuerySchema = import_zod7.z.object({
1176
1741
  range: StudioTimeRangeSchema.optional(),
1177
- startedAfter: import_zod6.z.string().optional(),
1178
- startedBefore: import_zod6.z.string().optional()
1742
+ startedAfter: import_zod7.z.string().optional(),
1743
+ startedBefore: import_zod7.z.string().optional()
1179
1744
  }).strict();
1180
- var StudioTimeRangeContextSchema = import_zod6.z.object({
1745
+ var StudioTimeRangeContextSchema = import_zod7.z.object({
1181
1746
  range: StudioTimeRangeSchema,
1182
- startedAfter: import_zod6.z.string().datetime({ offset: true }).nullable(),
1183
- startedBefore: import_zod6.z.string().datetime({ offset: true }).nullable()
1747
+ startedAfter: import_zod7.z.string().datetime({ offset: true }).nullable(),
1748
+ startedBefore: import_zod7.z.string().datetime({ offset: true }).nullable()
1184
1749
  }).strict();
1185
1750
  var STUDIO_TIME_RANGE_MILLISECONDS = {
1186
1751
  "Last hour": 60 * 60 * 1e3,
@@ -1254,7 +1819,7 @@ var resolveStudioTimeRange = (input, now = /* @__PURE__ */ new Date()) => {
1254
1819
  }
1255
1820
  };
1256
1821
  };
1257
- var StudioInterruptStatusSchema = import_zod6.z.enum([
1822
+ var StudioInterruptStatusSchema = import_zod7.z.enum([
1258
1823
  "pending",
1259
1824
  "resolved",
1260
1825
  "expired",
@@ -1267,341 +1832,341 @@ var resolveStudioInterruptStatus = (input, now = Date.now()) => {
1267
1832
  const nowMs = typeof now === "number" ? now : now.getTime();
1268
1833
  return Number.isFinite(expiresAt) && Number.isFinite(nowMs) && expiresAt <= nowMs ? "expired" : input.status;
1269
1834
  };
1270
- var StudioInterruptTypeSchema = import_zod6.z.enum([
1835
+ var StudioInterruptTypeSchema = import_zod7.z.enum([
1271
1836
  "choice",
1272
1837
  "multi-choice",
1273
1838
  "text",
1274
1839
  "structured",
1275
1840
  "unknown"
1276
1841
  ]);
1277
- var StudioInterruptInteractionModeSchema = import_zod6.z.enum([
1842
+ var StudioInterruptInteractionModeSchema = import_zod7.z.enum([
1278
1843
  "static-options",
1279
1844
  "dynamic-picker",
1280
1845
  "freeform",
1281
1846
  "unknown"
1282
1847
  ]);
1283
- var StudioInterruptOptionSchema = import_zod6.z.object({
1284
- id: import_zod6.z.string().min(1),
1285
- label: import_zod6.z.string().min(1),
1286
- description: import_zod6.z.string().nullable()
1848
+ var StudioInterruptOptionSchema = import_zod7.z.object({
1849
+ id: import_zod7.z.string().min(1),
1850
+ label: import_zod7.z.string().min(1),
1851
+ description: import_zod7.z.string().nullable()
1287
1852
  }).strip();
1288
- var StudioInterruptValueSchema = import_zod6.z.union([
1289
- import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()),
1290
- import_zod6.z.array(import_zod6.z.unknown()),
1291
- import_zod6.z.string(),
1292
- import_zod6.z.number(),
1293
- import_zod6.z.boolean()
1853
+ var StudioInterruptValueSchema = import_zod7.z.union([
1854
+ import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()),
1855
+ import_zod7.z.array(import_zod7.z.unknown()),
1856
+ import_zod7.z.string(),
1857
+ import_zod7.z.number(),
1858
+ import_zod7.z.boolean()
1294
1859
  ]);
1295
- var StudioResumeOutcomeSchema = import_zod6.z.enum([
1860
+ var StudioResumeOutcomeSchema = import_zod7.z.enum([
1296
1861
  "resumed",
1297
1862
  "resume failed",
1298
1863
  "expired before resume",
1299
1864
  "cancelled"
1300
1865
  ]);
1301
- var StudioWorkflowHealthSchema = import_zod6.z.enum([
1866
+ var StudioWorkflowHealthSchema = import_zod7.z.enum([
1302
1867
  "unknown",
1303
1868
  "healthy",
1304
1869
  "degraded",
1305
1870
  "failing",
1306
1871
  "idle"
1307
1872
  ]);
1308
- var StudioPricingStatusSchema = import_zod6.z.enum([
1873
+ var StudioPricingStatusSchema = import_zod7.z.enum([
1309
1874
  "priced",
1310
1875
  "unpriced",
1311
1876
  "unknown"
1312
1877
  ]);
1313
1878
  var StudioPricingSourceSchema = TelemetryPricingSourceSchema.nullable();
1314
- var StudioChangeResourceSchema = import_zod6.z.enum([
1879
+ var StudioChangeResourceSchema = import_zod7.z.enum([
1315
1880
  "evals",
1316
1881
  "workflows",
1317
1882
  "runs",
1318
1883
  "sessions",
1319
1884
  "interrupts"
1320
1885
  ]);
1321
- var StudioChangeSchema = import_zod6.z.object({
1322
- schemaVersion: import_zod6.z.literal(1),
1323
- changeId: import_zod6.z.string().min(1),
1324
- emittedAt: import_zod6.z.string().datetime({ offset: true }),
1325
- organizationId: import_zod6.z.string().min(1),
1326
- projectId: import_zod6.z.string().min(1),
1327
- environment: import_zod6.z.string().min(1).optional(),
1328
- resources: import_zod6.z.array(StudioChangeResourceSchema).min(1)
1886
+ var StudioChangeSchema = import_zod7.z.object({
1887
+ schemaVersion: import_zod7.z.literal(1),
1888
+ changeId: import_zod7.z.string().min(1),
1889
+ emittedAt: import_zod7.z.string().datetime({ offset: true }),
1890
+ organizationId: import_zod7.z.string().min(1),
1891
+ projectId: import_zod7.z.string().min(1),
1892
+ environment: import_zod7.z.string().min(1).optional(),
1893
+ resources: import_zod7.z.array(StudioChangeResourceSchema).min(1)
1329
1894
  }).strict();
1330
- var StudioCostSummarySchema = import_zod6.z.object({
1331
- amounts: import_zod6.z.array(
1332
- import_zod6.z.object({
1333
- amount: import_zod6.z.number().nonnegative(),
1334
- currency: import_zod6.z.string().nullable()
1895
+ var StudioCostSummarySchema = import_zod7.z.object({
1896
+ amounts: import_zod7.z.array(
1897
+ import_zod7.z.object({
1898
+ amount: import_zod7.z.number().nonnegative(),
1899
+ currency: import_zod7.z.string().nullable()
1335
1900
  }).strip()
1336
1901
  ),
1337
- complete: import_zod6.z.boolean()
1902
+ complete: import_zod7.z.boolean()
1338
1903
  }).strip();
1339
- var StudioMetricSchema = import_zod6.z.object({
1340
- runCount: import_zod6.z.number().int().nonnegative(),
1341
- successRate: import_zod6.z.number().min(0).max(100).nullable(),
1342
- errorRate: import_zod6.z.number().min(0).max(100).nullable(),
1343
- retryCount: import_zod6.z.number().int().nonnegative().nullable(),
1344
- interruptRate: import_zod6.z.number().min(0).max(100).nullable(),
1345
- p50DurationMs: import_zod6.z.number().nonnegative().nullable(),
1346
- p95DurationMs: import_zod6.z.number().nonnegative().nullable(),
1347
- averageTokens: import_zod6.z.number().nonnegative().nullable(),
1348
- averageCost: import_zod6.z.number().nonnegative().nullable(),
1904
+ var StudioMetricSchema = import_zod7.z.object({
1905
+ runCount: import_zod7.z.number().int().nonnegative(),
1906
+ successRate: import_zod7.z.number().min(0).max(100).nullable(),
1907
+ errorRate: import_zod7.z.number().min(0).max(100).nullable(),
1908
+ retryCount: import_zod7.z.number().int().nonnegative().nullable(),
1909
+ interruptRate: import_zod7.z.number().min(0).max(100).nullable(),
1910
+ p50DurationMs: import_zod7.z.number().nonnegative().nullable(),
1911
+ p95DurationMs: import_zod7.z.number().nonnegative().nullable(),
1912
+ averageTokens: import_zod7.z.number().nonnegative().nullable(),
1913
+ averageCost: import_zod7.z.number().nonnegative().nullable(),
1349
1914
  averageCostSummary: StudioCostSummarySchema.optional(),
1350
- currency: import_zod6.z.string().nullable()
1915
+ currency: import_zod7.z.string().nullable()
1351
1916
  }).strip();
1352
- var StudioRunSchema = import_zod6.z.object({
1353
- id: import_zod6.z.string().min(1),
1917
+ var StudioRunSchema = import_zod7.z.object({
1918
+ id: import_zod7.z.string().min(1),
1354
1919
  feedback: FeedbackSummarySchema.optional(),
1355
- callerNodeId: import_zod6.z.string().optional(),
1356
- parentRunId: import_zod6.z.string().optional(),
1357
- parentWorkflowId: import_zod6.z.string().optional(),
1358
- invocationId: import_zod6.z.string().optional(),
1359
- branchId: import_zod6.z.string().optional(),
1360
- callId: import_zod6.z.string().optional(),
1920
+ callerNodeId: import_zod7.z.string().optional(),
1921
+ parentRunId: import_zod7.z.string().optional(),
1922
+ parentWorkflowId: import_zod7.z.string().optional(),
1923
+ invocationId: import_zod7.z.string().optional(),
1924
+ branchId: import_zod7.z.string().optional(),
1925
+ callId: import_zod7.z.string().optional(),
1361
1926
  status: StudioRunStatusSchema,
1362
- startedAt: import_zod6.z.string().datetime({ offset: true }),
1363
- endedAt: import_zod6.z.string().datetime({ offset: true }).nullable(),
1364
- workflowId: import_zod6.z.string().min(1),
1365
- workflowIds: import_zod6.z.array(import_zod6.z.string().min(1)),
1366
- workflowRefs: import_zod6.z.array(
1367
- import_zod6.z.object({
1368
- workflowId: import_zod6.z.string().min(1),
1369
- workflowRevisionId: import_zod6.z.string().nullable(),
1370
- declaredVersion: import_zod6.z.string().nullable()
1927
+ startedAt: import_zod7.z.string().datetime({ offset: true }),
1928
+ endedAt: import_zod7.z.string().datetime({ offset: true }).nullable(),
1929
+ workflowId: import_zod7.z.string().min(1),
1930
+ workflowIds: import_zod7.z.array(import_zod7.z.string().min(1)),
1931
+ workflowRefs: import_zod7.z.array(
1932
+ import_zod7.z.object({
1933
+ workflowId: import_zod7.z.string().min(1),
1934
+ workflowRevisionId: import_zod7.z.string().nullable(),
1935
+ declaredVersion: import_zod7.z.string().nullable()
1371
1936
  }).strip()
1372
1937
  ),
1373
- workflowRevisionId: import_zod6.z.string().nullable(),
1374
- declaredVersion: import_zod6.z.string().nullable(),
1375
- transitionIds: import_zod6.z.array(import_zod6.z.string().min(1)),
1376
- path: import_zod6.z.array(import_zod6.z.string()),
1377
- sessionId: import_zod6.z.string().nullable(),
1378
- provider: import_zod6.z.string().nullable(),
1379
- model: import_zod6.z.string().nullable(),
1380
- models: import_zod6.z.array(import_zod6.z.string()),
1381
- durationMs: import_zod6.z.number().nonnegative().nullable(),
1382
- tokens: import_zod6.z.number().int().nonnegative().nullable(),
1383
- cost: import_zod6.z.number().nonnegative().nullable(),
1938
+ workflowRevisionId: import_zod7.z.string().nullable(),
1939
+ declaredVersion: import_zod7.z.string().nullable(),
1940
+ transitionIds: import_zod7.z.array(import_zod7.z.string().min(1)),
1941
+ path: import_zod7.z.array(import_zod7.z.string()),
1942
+ sessionId: import_zod7.z.string().nullable(),
1943
+ provider: import_zod7.z.string().nullable(),
1944
+ model: import_zod7.z.string().nullable(),
1945
+ models: import_zod7.z.array(import_zod7.z.string()),
1946
+ durationMs: import_zod7.z.number().nonnegative().nullable(),
1947
+ tokens: import_zod7.z.number().int().nonnegative().nullable(),
1948
+ cost: import_zod7.z.number().nonnegative().nullable(),
1384
1949
  costSummary: StudioCostSummarySchema.optional(),
1385
1950
  pricingStatus: StudioPricingStatusSchema,
1386
1951
  pricingSource: StudioPricingSourceSchema,
1387
- currency: import_zod6.z.string().nullable(),
1388
- result: import_zod6.z.string().nullable(),
1389
- environment: import_zod6.z.string().min(1),
1390
- userId: import_zod6.z.string().nullable(),
1391
- tenantId: import_zod6.z.string().nullable(),
1392
- hasTool: import_zod6.z.boolean(),
1393
- hasRetry: import_zod6.z.boolean(),
1394
- interruptNodeId: import_zod6.z.string().nullable(),
1395
- interruptId: import_zod6.z.string().nullable().optional(),
1952
+ currency: import_zod7.z.string().nullable(),
1953
+ result: import_zod7.z.string().nullable(),
1954
+ environment: import_zod7.z.string().min(1),
1955
+ userId: import_zod7.z.string().nullable(),
1956
+ tenantId: import_zod7.z.string().nullable(),
1957
+ hasTool: import_zod7.z.boolean(),
1958
+ hasRetry: import_zod7.z.boolean(),
1959
+ interruptNodeId: import_zod7.z.string().nullable(),
1960
+ interruptId: import_zod7.z.string().nullable().optional(),
1396
1961
  interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
1397
- interruptExpiresAt: import_zod6.z.string().datetime({ offset: true }).nullable().optional()
1962
+ interruptExpiresAt: import_zod7.z.string().datetime({ offset: true }).nullable().optional()
1398
1963
  }).strip();
1399
- var StudioSessionSchema = import_zod6.z.object({
1400
- id: import_zod6.z.string().min(1),
1964
+ var StudioSessionSchema = import_zod7.z.object({
1965
+ id: import_zod7.z.string().min(1),
1401
1966
  status: StudioRunStatusSchema,
1402
- lastActivityAt: import_zod6.z.string().datetime({ offset: true }),
1403
- workflowIds: import_zod6.z.array(import_zod6.z.string()),
1404
- workflowCount: import_zod6.z.number().int().nonnegative(),
1405
- activeWorkflowId: import_zod6.z.string().nullable(),
1406
- activeVersion: import_zod6.z.string().nullable(),
1407
- userId: import_zod6.z.string().nullable(),
1408
- tenantId: import_zod6.z.string().nullable(),
1409
- runs: import_zod6.z.number().int().nonnegative(),
1410
- succeeded: import_zod6.z.number().int().nonnegative(),
1411
- failed: import_zod6.z.number().int().nonnegative(),
1412
- interrupted: import_zod6.z.number().int().nonnegative(),
1413
- checkpoints: import_zod6.z.number().int().nonnegative(),
1414
- hasFork: import_zod6.z.boolean(),
1415
- durationMs: import_zod6.z.number().nonnegative().nullable(),
1416
- tokens: import_zod6.z.number().int().nonnegative().nullable(),
1417
- cost: import_zod6.z.number().nonnegative().nullable(),
1967
+ lastActivityAt: import_zod7.z.string().datetime({ offset: true }),
1968
+ workflowIds: import_zod7.z.array(import_zod7.z.string()),
1969
+ workflowCount: import_zod7.z.number().int().nonnegative(),
1970
+ activeWorkflowId: import_zod7.z.string().nullable(),
1971
+ activeVersion: import_zod7.z.string().nullable(),
1972
+ userId: import_zod7.z.string().nullable(),
1973
+ tenantId: import_zod7.z.string().nullable(),
1974
+ runs: import_zod7.z.number().int().nonnegative(),
1975
+ succeeded: import_zod7.z.number().int().nonnegative(),
1976
+ failed: import_zod7.z.number().int().nonnegative(),
1977
+ interrupted: import_zod7.z.number().int().nonnegative(),
1978
+ checkpoints: import_zod7.z.number().int().nonnegative(),
1979
+ hasFork: import_zod7.z.boolean(),
1980
+ durationMs: import_zod7.z.number().nonnegative().nullable(),
1981
+ tokens: import_zod7.z.number().int().nonnegative().nullable(),
1982
+ cost: import_zod7.z.number().nonnegative().nullable(),
1418
1983
  costSummary: StudioCostSummarySchema.optional(),
1419
1984
  pricingStatus: StudioPricingStatusSchema,
1420
1985
  pricingSource: StudioPricingSourceSchema,
1421
- currency: import_zod6.z.string().nullable(),
1422
- latestResult: import_zod6.z.string().nullable(),
1423
- latestError: import_zod6.z.string().nullable(),
1424
- pendingInterruptId: import_zod6.z.string().nullable(),
1986
+ currency: import_zod7.z.string().nullable(),
1987
+ latestResult: import_zod7.z.string().nullable(),
1988
+ latestError: import_zod7.z.string().nullable(),
1989
+ pendingInterruptId: import_zod7.z.string().nullable(),
1425
1990
  interruptStatus: StudioInterruptStatusSchema.nullable().optional(),
1426
- interruptExpiresAt: import_zod6.z.string().datetime({ offset: true }).nullable().optional(),
1427
- providers: import_zod6.z.array(import_zod6.z.string()),
1428
- models: import_zod6.z.array(import_zod6.z.string()),
1429
- tags: import_zod6.z.array(import_zod6.z.string()),
1430
- environment: import_zod6.z.string().min(1)
1991
+ interruptExpiresAt: import_zod7.z.string().datetime({ offset: true }).nullable().optional(),
1992
+ providers: import_zod7.z.array(import_zod7.z.string()),
1993
+ models: import_zod7.z.array(import_zod7.z.string()),
1994
+ tags: import_zod7.z.array(import_zod7.z.string()),
1995
+ environment: import_zod7.z.string().min(1)
1431
1996
  }).strip();
1432
- var StudioInterruptSchema = import_zod6.z.object({
1433
- afterResponseCompleted: import_zod6.z.boolean().optional(),
1434
- id: import_zod6.z.string().min(1),
1997
+ var StudioInterruptSchema = import_zod7.z.object({
1998
+ afterResponseCompleted: import_zod7.z.boolean().optional(),
1999
+ id: import_zod7.z.string().min(1),
1435
2000
  status: StudioInterruptStatusSchema,
1436
2001
  type: StudioInterruptTypeSchema,
1437
2002
  interactionMode: StudioInterruptInteractionModeSchema,
1438
- contract: import_zod6.z.string().nullable().default(null),
1439
- schemaId: import_zod6.z.string().nullable(),
1440
- schemaVersion: import_zod6.z.string().nullable(),
1441
- createdAt: import_zod6.z.string().datetime({ offset: true }),
1442
- resolvedAt: import_zod6.z.string().datetime({ offset: true }).nullable(),
1443
- expiresAt: import_zod6.z.string().datetime({ offset: true }).nullable(),
1444
- question: import_zod6.z.string().nullable(),
1445
- contentCaptured: import_zod6.z.boolean(),
1446
- request: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).nullable().default(null),
1447
- requestCaptured: import_zod6.z.boolean().default(false),
1448
- optionCount: import_zod6.z.number().int().nonnegative().nullable(),
1449
- options: import_zod6.z.array(StudioInterruptOptionSchema).nullable(),
1450
- workflowId: import_zod6.z.string().min(1),
1451
- nodeId: import_zod6.z.string().nullable(),
1452
- sessionId: import_zod6.z.string().nullable(),
1453
- userId: import_zod6.z.string().nullable(),
1454
- tenantId: import_zod6.z.string().nullable(),
1455
- response: import_zod6.z.string().nullable(),
2003
+ contract: import_zod7.z.string().nullable().default(null),
2004
+ schemaId: import_zod7.z.string().nullable(),
2005
+ schemaVersion: import_zod7.z.string().nullable(),
2006
+ createdAt: import_zod7.z.string().datetime({ offset: true }),
2007
+ resolvedAt: import_zod7.z.string().datetime({ offset: true }).nullable(),
2008
+ expiresAt: import_zod7.z.string().datetime({ offset: true }).nullable(),
2009
+ question: import_zod7.z.string().nullable(),
2010
+ contentCaptured: import_zod7.z.boolean(),
2011
+ request: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).nullable().default(null),
2012
+ requestCaptured: import_zod7.z.boolean().default(false),
2013
+ optionCount: import_zod7.z.number().int().nonnegative().nullable(),
2014
+ options: import_zod7.z.array(StudioInterruptOptionSchema).nullable(),
2015
+ workflowId: import_zod7.z.string().min(1),
2016
+ nodeId: import_zod7.z.string().nullable(),
2017
+ sessionId: import_zod7.z.string().nullable(),
2018
+ userId: import_zod7.z.string().nullable(),
2019
+ tenantId: import_zod7.z.string().nullable(),
2020
+ response: import_zod7.z.string().nullable(),
1456
2021
  responseValue: StudioInterruptValueSchema.nullable().default(null),
1457
- responseCaptured: import_zod6.z.boolean(),
2022
+ responseCaptured: import_zod7.z.boolean(),
1458
2023
  resumeOutcome: StudioResumeOutcomeSchema.nullable(),
1459
- resumeError: import_zod6.z.string().nullable(),
1460
- runId: import_zod6.z.string().min(1),
1461
- resumeToken: import_zod6.z.string().nullable(),
1462
- resolvedBy: import_zod6.z.string().nullable(),
1463
- environment: import_zod6.z.string().min(1)
2024
+ resumeError: import_zod7.z.string().nullable(),
2025
+ runId: import_zod7.z.string().min(1),
2026
+ resumeToken: import_zod7.z.string().nullable(),
2027
+ resolvedBy: import_zod7.z.string().nullable(),
2028
+ environment: import_zod7.z.string().min(1)
1464
2029
  }).strip();
1465
- var StudioDetailEventSchema = import_zod6.z.object({
1466
- id: import_zod6.z.string().min(1),
2030
+ var StudioDetailEventSchema = import_zod7.z.object({
2031
+ id: import_zod7.z.string().min(1),
1467
2032
  // Studio readers must preserve future event kinds within the same API major.
1468
- type: import_zod6.z.string().min(1),
1469
- occurredAt: import_zod6.z.string().datetime({ offset: true }),
1470
- receivedAt: import_zod6.z.string().datetime({ offset: true }),
1471
- environment: import_zod6.z.string().min(1),
1472
- serviceName: import_zod6.z.string().min(1),
1473
- deploymentRef: import_zod6.z.string().nullable(),
1474
- traceId: import_zod6.z.string().nullable(),
1475
- spanId: import_zod6.z.string().nullable(),
1476
- parentSpanId: import_zod6.z.string().nullable(),
1477
- runId: import_zod6.z.string().min(1),
1478
- sessionId: import_zod6.z.string().nullable(),
1479
- workflowId: import_zod6.z.string().min(1),
1480
- workflowRevisionId: import_zod6.z.string().nullable(),
1481
- nodeId: import_zod6.z.string().nullable(),
1482
- userId: import_zod6.z.string().nullable(),
1483
- tenantId: import_zod6.z.string().nullable(),
1484
- tags: import_zod6.z.array(import_zod6.z.string()),
1485
- metadata: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).nullable(),
1486
- payload: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown())
2033
+ type: import_zod7.z.string().min(1),
2034
+ occurredAt: import_zod7.z.string().datetime({ offset: true }),
2035
+ receivedAt: import_zod7.z.string().datetime({ offset: true }),
2036
+ environment: import_zod7.z.string().min(1),
2037
+ serviceName: import_zod7.z.string().min(1),
2038
+ deploymentRef: import_zod7.z.string().nullable(),
2039
+ traceId: import_zod7.z.string().nullable(),
2040
+ spanId: import_zod7.z.string().nullable(),
2041
+ parentSpanId: import_zod7.z.string().nullable(),
2042
+ runId: import_zod7.z.string().min(1),
2043
+ sessionId: import_zod7.z.string().nullable(),
2044
+ workflowId: import_zod7.z.string().min(1),
2045
+ workflowRevisionId: import_zod7.z.string().nullable(),
2046
+ nodeId: import_zod7.z.string().nullable(),
2047
+ userId: import_zod7.z.string().nullable(),
2048
+ tenantId: import_zod7.z.string().nullable(),
2049
+ tags: import_zod7.z.array(import_zod7.z.string()),
2050
+ metadata: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).nullable(),
2051
+ payload: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown())
1487
2052
  }).strip();
1488
- var StudioWorkflowNodeSchema = import_zod6.z.object({
1489
- tools: import_zod6.z.array(StudioToolSchema).optional(),
2053
+ var StudioWorkflowNodeSchema = import_zod7.z.object({
2054
+ tools: import_zod7.z.array(StudioToolSchema).optional(),
1490
2055
  toolDiscovery: ToolDiscoverySchema.optional(),
1491
- id: import_zod6.z.string().min(1),
1492
- label: import_zod6.z.string(),
1493
- type: import_zod6.z.string().nullable(),
1494
- state: import_zod6.z.enum(["healthy", "warning", "failed", "interrupted", "retried"]).nullable(),
1495
- provider: import_zod6.z.string().nullable(),
1496
- model: import_zod6.z.string().nullable(),
2056
+ id: import_zod7.z.string().min(1),
2057
+ label: import_zod7.z.string(),
2058
+ type: import_zod7.z.string().nullable(),
2059
+ state: import_zod7.z.enum(["healthy", "warning", "failed", "interrupted", "retried"]).nullable(),
2060
+ provider: import_zod7.z.string().nullable(),
2061
+ model: import_zod7.z.string().nullable(),
1497
2062
  metrics: StudioMetricSchema
1498
2063
  }).strip();
1499
- var StudioWorkflowInternalEdgeSchema = import_zod6.z.object({
1500
- id: import_zod6.z.string().min(1),
1501
- source: import_zod6.z.string().min(1),
1502
- target: import_zod6.z.string().min(1),
1503
- condition: import_zod6.z.string().nullable()
2064
+ var StudioWorkflowInternalEdgeSchema = import_zod7.z.object({
2065
+ id: import_zod7.z.string().min(1),
2066
+ source: import_zod7.z.string().min(1),
2067
+ target: import_zod7.z.string().min(1),
2068
+ condition: import_zod7.z.string().nullable()
1504
2069
  }).strip();
1505
- var StudioWorkflowTransitionSchema = import_zod6.z.object({
1506
- kind: import_zod6.z.enum(["call", "handoff"]).optional(),
1507
- id: import_zod6.z.string().min(1),
1508
- sourceWorkflowId: import_zod6.z.string().min(1),
1509
- sourceNodeId: import_zod6.z.string().nullable(),
1510
- targetWorkflowId: import_zod6.z.string().min(1),
1511
- condition: import_zod6.z.string().nullable(),
1512
- volume: import_zod6.z.number().int().nonnegative(),
1513
- successRate: import_zod6.z.number().min(0).max(100).nullable(),
1514
- medianDurationMs: import_zod6.z.number().nonnegative().nullable(),
1515
- errorRate: import_zod6.z.number().min(0).max(100).nullable()
2070
+ var StudioWorkflowTransitionSchema = import_zod7.z.object({
2071
+ kind: import_zod7.z.enum(["call", "handoff"]).optional(),
2072
+ id: import_zod7.z.string().min(1),
2073
+ sourceWorkflowId: import_zod7.z.string().min(1),
2074
+ sourceNodeId: import_zod7.z.string().nullable(),
2075
+ targetWorkflowId: import_zod7.z.string().min(1),
2076
+ condition: import_zod7.z.string().nullable(),
2077
+ volume: import_zod7.z.number().int().nonnegative(),
2078
+ successRate: import_zod7.z.number().min(0).max(100).nullable(),
2079
+ medianDurationMs: import_zod7.z.number().nonnegative().nullable(),
2080
+ errorRate: import_zod7.z.number().min(0).max(100).nullable()
1516
2081
  }).strip();
1517
- var StudioWorkflowSchema = import_zod6.z.object({
1518
- id: import_zod6.z.string().min(1),
1519
- name: import_zod6.z.string().min(1),
1520
- description: import_zod6.z.string().nullable(),
1521
- versions: import_zod6.z.array(import_zod6.z.string()),
1522
- activeVersion: import_zod6.z.string().nullable(),
1523
- activeRevisionId: import_zod6.z.string().nullable(),
2082
+ var StudioWorkflowSchema = import_zod7.z.object({
2083
+ id: import_zod7.z.string().min(1),
2084
+ name: import_zod7.z.string().min(1),
2085
+ description: import_zod7.z.string().nullable(),
2086
+ versions: import_zod7.z.array(import_zod7.z.string()),
2087
+ activeVersion: import_zod7.z.string().nullable(),
2088
+ activeRevisionId: import_zod7.z.string().nullable(),
1524
2089
  health: StudioWorkflowHealthSchema,
1525
- tags: import_zod6.z.array(import_zod6.z.string()),
1526
- lastActivityAt: import_zod6.z.string().datetime({ offset: true }).nullable(),
2090
+ tags: import_zod7.z.array(import_zod7.z.string()),
2091
+ lastActivityAt: import_zod7.z.string().datetime({ offset: true }).nullable(),
1527
2092
  metrics: StudioMetricSchema,
1528
- nodes: import_zod6.z.array(StudioWorkflowNodeSchema),
1529
- internalEdges: import_zod6.z.array(StudioWorkflowInternalEdgeSchema)
2093
+ nodes: import_zod7.z.array(StudioWorkflowNodeSchema),
2094
+ internalEdges: import_zod7.z.array(StudioWorkflowInternalEdgeSchema)
1530
2095
  }).strip();
1531
- var StudioRunsResponseSchema = import_zod6.z.object({
1532
- runs: import_zod6.z.array(StudioRunSchema),
1533
- totalCount: import_zod6.z.number().int().nonnegative()
2096
+ var StudioRunsResponseSchema = import_zod7.z.object({
2097
+ runs: import_zod7.z.array(StudioRunSchema),
2098
+ totalCount: import_zod7.z.number().int().nonnegative()
1534
2099
  }).strip();
1535
- var StudioSessionsResponseSchema = import_zod6.z.object({
1536
- sessions: import_zod6.z.array(StudioSessionSchema),
1537
- totalCount: import_zod6.z.number().int().nonnegative()
2100
+ var StudioSessionsResponseSchema = import_zod7.z.object({
2101
+ sessions: import_zod7.z.array(StudioSessionSchema),
2102
+ totalCount: import_zod7.z.number().int().nonnegative()
1538
2103
  }).strip();
1539
- var StudioInterruptsResponseSchema = import_zod6.z.object({
1540
- interrupts: import_zod6.z.array(StudioInterruptSchema),
1541
- totalCount: import_zod6.z.number().int().nonnegative()
2104
+ var StudioInterruptsResponseSchema = import_zod7.z.object({
2105
+ interrupts: import_zod7.z.array(StudioInterruptSchema),
2106
+ totalCount: import_zod7.z.number().int().nonnegative()
1542
2107
  }).strip();
1543
- var StudioRunDetailResponseSchema = import_zod6.z.object({
2108
+ var StudioRunDetailResponseSchema = import_zod7.z.object({
1544
2109
  run: StudioRunSchema,
1545
- scores: import_zod6.z.array(StudioScoreSchema).optional(),
1546
- canReview: import_zod6.z.boolean().optional(),
1547
- reviewActorId: import_zod6.z.string().optional(),
1548
- events: import_zod6.z.array(StudioDetailEventSchema),
2110
+ scores: import_zod7.z.array(StudioScoreSchema).optional(),
2111
+ canReview: import_zod7.z.boolean().optional(),
2112
+ reviewActorId: import_zod7.z.string().optional(),
2113
+ events: import_zod7.z.array(StudioDetailEventSchema),
1549
2114
  session: StudioSessionSchema.nullable(),
1550
- interrupts: import_zod6.z.array(StudioInterruptSchema),
1551
- updatedAt: import_zod6.z.string().datetime({ offset: true })
2115
+ interrupts: import_zod7.z.array(StudioInterruptSchema),
2116
+ updatedAt: import_zod7.z.string().datetime({ offset: true })
1552
2117
  }).strip();
1553
- var StudioSessionDetailResponseSchema = import_zod6.z.object({
2118
+ var StudioSessionDetailResponseSchema = import_zod7.z.object({
1554
2119
  session: StudioSessionSchema,
1555
- runs: import_zod6.z.array(StudioRunSchema),
1556
- events: import_zod6.z.array(StudioDetailEventSchema),
1557
- interrupts: import_zod6.z.array(StudioInterruptSchema),
1558
- updatedAt: import_zod6.z.string().datetime({ offset: true })
2120
+ runs: import_zod7.z.array(StudioRunSchema),
2121
+ events: import_zod7.z.array(StudioDetailEventSchema),
2122
+ interrupts: import_zod7.z.array(StudioInterruptSchema),
2123
+ updatedAt: import_zod7.z.string().datetime({ offset: true })
1559
2124
  }).strip();
1560
- var StudioInterruptDetailResponseSchema = import_zod6.z.object({
2125
+ var StudioInterruptDetailResponseSchema = import_zod7.z.object({
1561
2126
  interrupt: StudioInterruptSchema,
1562
- events: import_zod6.z.array(StudioDetailEventSchema),
2127
+ events: import_zod7.z.array(StudioDetailEventSchema),
1563
2128
  run: StudioRunSchema.nullable(),
1564
2129
  session: StudioSessionSchema.nullable(),
1565
- updatedAt: import_zod6.z.string().datetime({ offset: true })
2130
+ updatedAt: import_zod7.z.string().datetime({ offset: true })
1566
2131
  }).strip();
1567
- var StudioWorkflowsResponseSchema = import_zod6.z.object({
1568
- workflows: import_zod6.z.array(StudioWorkflowSchema),
1569
- observedCalls: import_zod6.z.array(
2132
+ var StudioWorkflowsResponseSchema = import_zod7.z.object({
2133
+ workflows: import_zod7.z.array(StudioWorkflowSchema),
2134
+ observedCalls: import_zod7.z.array(
1570
2135
  StudioWorkflowTransitionSchema.extend({
1571
- runId: import_zod6.z.string(),
1572
- invocationId: import_zod6.z.string(),
1573
- branchId: import_zod6.z.string()
2136
+ runId: import_zod7.z.string(),
2137
+ invocationId: import_zod7.z.string(),
2138
+ branchId: import_zod7.z.string()
1574
2139
  })
1575
2140
  ).optional(),
1576
- transitions: import_zod6.z.array(StudioWorkflowTransitionSchema),
2141
+ transitions: import_zod7.z.array(StudioWorkflowTransitionSchema),
1577
2142
  cohort: StudioTimeRangeContextSchema.extend({
1578
- workflowId: import_zod6.z.string().nullable(),
1579
- version: import_zod6.z.string().nullable()
2143
+ workflowId: import_zod7.z.string().nullable(),
2144
+ version: import_zod7.z.string().nullable()
1580
2145
  }).strip()
1581
2146
  }).strip();
1582
- var StudioCatalogsResponseSchema = import_zod6.z.object({
1583
- environments: import_zod6.z.array(import_zod6.z.string()),
1584
- providers: import_zod6.z.array(import_zod6.z.string()),
1585
- models: import_zod6.z.array(import_zod6.z.string()),
1586
- workflows: import_zod6.z.array(import_zod6.z.string()),
1587
- tags: import_zod6.z.array(import_zod6.z.string())
2147
+ var StudioCatalogsResponseSchema = import_zod7.z.object({
2148
+ environments: import_zod7.z.array(import_zod7.z.string()),
2149
+ providers: import_zod7.z.array(import_zod7.z.string()),
2150
+ models: import_zod7.z.array(import_zod7.z.string()),
2151
+ workflows: import_zod7.z.array(import_zod7.z.string()),
2152
+ tags: import_zod7.z.array(import_zod7.z.string())
1588
2153
  }).strip();
1589
- var StudioContextResponseSchema = import_zod6.z.object({
1590
- organization: import_zod6.z.object({
1591
- name: import_zod6.z.string().min(1)
2154
+ var StudioContextResponseSchema = import_zod7.z.object({
2155
+ organization: import_zod7.z.object({
2156
+ name: import_zod7.z.string().min(1)
1592
2157
  }).strip(),
1593
- project: import_zod6.z.object({
1594
- name: import_zod6.z.string().min(1)
2158
+ project: import_zod7.z.object({
2159
+ name: import_zod7.z.string().min(1)
1595
2160
  }).strip(),
1596
- environments: import_zod6.z.array(import_zod6.z.string()),
1597
- apiKey: import_zod6.z.object({
1598
- mode: import_zod6.z.enum(["test", "live"]),
1599
- scopes: import_zod6.z.array(import_zod6.z.string())
2161
+ environments: import_zod7.z.array(import_zod7.z.string()),
2162
+ apiKey: import_zod7.z.object({
2163
+ mode: import_zod7.z.enum(["test", "live"]),
2164
+ scopes: import_zod7.z.array(import_zod7.z.string())
1600
2165
  }).strip().nullable(),
1601
- api: import_zod6.z.object({
1602
- status: import_zod6.z.literal("ok"),
1603
- service: import_zod6.z.literal("kortyx-api"),
1604
- version: import_zod6.z.string().min(1)
2166
+ api: import_zod7.z.object({
2167
+ status: import_zod7.z.literal("ok"),
2168
+ service: import_zod7.z.literal("kortyx-api"),
2169
+ version: import_zod7.z.string().min(1)
1605
2170
  }).strip()
1606
2171
  }).strip();
1607
2172
  // Annotate the CommonJS export names for ESM import in node:
@@ -1615,11 +2180,15 @@ var StudioContextResponseSchema = import_zod6.z.object({
1615
2180
  DiagnosticNoteSchema,
1616
2181
  DiagnosticPartSchema,
1617
2182
  DiagnosticResponseSchema,
2183
+ EMPTY_TABLE_FILTERS,
2184
+ EVALUATION_TABLE_FILTER_FIELDS,
1618
2185
  EnsureWorkflowTopologyRequestSchema,
1619
2186
  EnsureWorkflowTopologyResponseSchema,
1620
2187
  FEEDBACK_FILTERS,
1621
2188
  FeedbackReasonSchema,
1622
2189
  FeedbackSummarySchema,
2190
+ LEGACY_TABLE_FILTERS,
2191
+ PROMPT_TABLE_FILTER_FIELDS,
1623
2192
  PromptAssetSchema,
1624
2193
  PromptAssignmentSchema,
1625
2194
  PromptBundleSchema,
@@ -1636,6 +2205,7 @@ var StudioContextResponseSchema = import_zod6.z.object({
1636
2205
  PromptUsageSchema,
1637
2206
  ReviewVerdictSchema,
1638
2207
  STUDIO_API_PROTOCOL_VERSION,
2208
+ STUDIO_TABLE_FIELDS,
1639
2209
  STUDIO_TIME_RANGES,
1640
2210
  StudioCatalogsResponseSchema,
1641
2211
  StudioChangeResourceSchema,
@@ -1682,6 +2252,8 @@ var StudioContextResponseSchema = import_zod6.z.object({
1682
2252
  StudioWorkflowTransitionSchema,
1683
2253
  StudioWorkflowsResponseSchema,
1684
2254
  TELEMETRY_EVENT_TYPES,
2255
+ TableFilterRuleSchema,
2256
+ TableFiltersSchema,
1685
2257
  TelemetryEventBatchResponseSchema,
1686
2258
  TelemetryEventBatchSchema,
1687
2259
  TelemetryEventSchema,
@@ -1703,15 +2275,23 @@ var StudioContextResponseSchema = import_zod6.z.object({
1703
2275
  WorkflowTopologyEdgeSchema,
1704
2276
  WorkflowTopologyNodeSchema,
1705
2277
  WorkflowTopologyTransitionSchema,
2278
+ captureDiagnosticContent,
2279
+ filterOperators,
1706
2280
  isPrivateDiagnosticField,
2281
+ matchesTableFilters,
2282
+ matchesTableRule,
1707
2283
  newerStudioVersion,
1708
2284
  projectWorkflowCalls,
2285
+ readStudioTableFilters,
1709
2286
  redactDiagnosticContent,
1710
2287
  redactDiagnosticText,
1711
2288
  resolveStudioInterruptStatus,
1712
2289
  resolveStudioTimeRange,
1713
2290
  studioUpdateRunning,
1714
2291
  summarizeDiagnostic,
1715
- summarizeUserFeedback
2292
+ summarizeUserFeedback,
2293
+ tablePassRate,
2294
+ tableQueueMs,
2295
+ validateTableFilters
1716
2296
  });
1717
2297
  //# sourceMappingURL=index.js.map